nolo-cli 0.188.0-alpha.2 → 0.188.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{_executeModel-7GFCTOFY.js → _executeModel-WQ7BV3G7.js} +22 -22
- package/{action-HQXK4ZT4.js → action-BHWB4MOK.js} +2 -2
- package/{addContentAction-3WAN3OWY.js → addContentAction-BY375D35.js} +3 -3
- package/{addDialogAgentAction-WNQBFR5G.js → addDialogAgentAction-HOZYOCWC.js} +2 -2
- package/{agentDeleteCommand-GETUDKX4.js → agentDeleteCommand-4DK6X4S4.js} +24 -24
- package/{agentEmailCommands-2EB4DJSA.js → agentEmailCommands-CYPIYPOK.js} +25 -25
- package/agentFavoriteCommands-GAFEXKKP.js +187 -0
- package/{agentListCommands-6RONL2YO.js → agentListCommands-MAG736RU.js} +8 -8
- package/{agentMachineCommands-J6SX7CPR.js → agentMachineCommands-7VTOWHHD.js} +6 -6
- package/{agentRecordCommands-UXFGQXD6.js → agentRecordCommands-VK3NEK5G.js} +24 -24
- package/{agentRunCommand-QTK73QMM.js → agentRunCommand-7MFVUHWX.js} +25 -25
- package/{agentRuntimeLocal-G4KEXO5D.js → agentRuntimeLocal-NAAYNHCW.js} +4 -4
- package/{agentSlice-STUDWJJZ.js → agentSlice-TZRLTBEJ.js} +3 -3
- package/{appDeleteCommands-6L6PTB6G.js → appDeleteCommands-VDHCDVBF.js} +8 -8
- package/{appDeployCommands-PLXIHXN3.js → appDeployCommands-V6UTKVXR.js} +8 -8
- package/{appDeployStatusCommands-VGYYEBTV.js → appDeployStatusCommands-4UIFSEPC.js} +8 -8
- package/{appGetCommands-NAANWNTG.js → appGetCommands-XKDXLC3C.js} +8 -8
- package/{appListCommands-ZT5YE2IX.js → appListCommands-BELRVX2Y.js} +8 -8
- package/{authCommand-NVTKI7QU.js → authCommand-RV5MQDWN.js} +3 -3
- package/{authCommands-RFLKIPBT.js → authCommands-MZUXPRYJ.js} +2 -2
- package/{builtinSkillRegistry-2VN6JG4U.js → builtinSkillRegistry-7MBUY5EY.js} +3 -3
- package/{chromeOpsCommands-DOFY2OCF.js → chromeOpsCommands-C46BXHEE.js} +1 -1
- package/{chunk-5LVGXDSL.js → chunk-2NAE7IVE.js} +1 -1
- package/{chunk-FGIJLPZ3.js → chunk-4MYCKDSI.js} +2 -2
- package/{chunk-3QFOYFJW.js → chunk-5DIFZFYF.js} +4 -4
- package/{chunk-KOIGM3KU.js → chunk-5DPVRMSY.js} +1 -1
- package/{chunk-GSX7Z46F.js → chunk-5HAPEKNH.js} +1 -1
- package/{chunk-RBVR7P3M.js → chunk-63JHZKGZ.js} +18 -18
- package/{chunk-JOOWHDGM.js → chunk-A5BLRE3G.js} +1 -1
- package/{chunk-VECM2WX3.js → chunk-ABMBNULR.js} +2 -2
- package/{chunk-HVV4B6OL.js → chunk-ADTJJVDJ.js} +210 -43
- package/{chunk-Y2ZDNW2H.js → chunk-B2N5GZBU.js} +2 -2
- package/{chunk-7SJG5ZNX.js → chunk-B6EZB6DW.js} +1 -1
- package/{chunk-H6FUDBS3.js → chunk-CGKSIL4D.js} +5 -5
- package/{chunk-CLGAGPEM.js → chunk-CNMQATUF.js} +1 -1
- package/{chunk-ER4UTWWS.js → chunk-DFF6B7P7.js} +1 -1
- package/{chunk-WMHWFFTE.js → chunk-ECX3NKRD.js} +46 -0
- package/{chunk-R6AJKHEU.js → chunk-EVF6F3QU.js} +3 -3
- package/{chunk-7N6C3IHF.js → chunk-EXSR7DXT.js} +2 -2
- package/{chunk-WBCYL63M.js → chunk-GYVLAHA4.js} +1 -1
- package/{chunk-RKLQVXUE.js → chunk-HTLIKE5U.js} +2 -2
- package/{chunk-4OTMONZL.js → chunk-IOIPWEL4.js} +9 -9
- package/{chunk-RANCLEEC.js → chunk-JG6IWEAW.js} +10 -10
- package/{chunk-LOQYQUM2.js → chunk-JGJVDP2W.js} +17 -17
- package/{chunk-S4W4GV3B.js → chunk-K6TZSON4.js} +1 -1
- package/{chunk-VH7PE33C.js → chunk-KDBKEYUW.js} +36 -11
- package/{chunk-A43QYPYN.js → chunk-NMDAOZRN.js} +12 -12
- package/{chunk-ZIOYHDYW.js → chunk-OUSUFO5W.js} +2 -2
- package/{chunk-PCPQWTXJ.js → chunk-PD2YRFAI.js} +1 -1
- package/{chunk-OXOXPREC.js → chunk-SM56M7N7.js} +1 -1
- package/{chunk-2RHDAHFX.js → chunk-TFSMPRAY.js} +4 -4
- package/{chunk-Q54QGYRW.js → chunk-TZLPJRNO.js} +4 -4
- package/{chunk-6G5V4Y3V.js → chunk-UC5RISH3.js} +65 -41
- package/{chunk-IFN7MHWL.js → chunk-UGCQKKXW.js} +1 -1
- package/{chunk-YO3O7H2X.js → chunk-UNOILAZP.js} +14 -0
- package/{chunk-YUZIPPER.js → chunk-UVWBGWBO.js} +8 -2
- package/{chunk-MMOISK6N.js → chunk-V62MBA65.js} +3 -3
- package/{chunk-IIGDVODZ.js → chunk-WAZ6BTSC.js} +1 -1
- package/{chunk-O2MBTX37.js → chunk-WVGVGT44.js} +4 -4
- package/{chunk-RGTPR57U.js → chunk-YARN6MCX.js} +4 -4
- package/{chunk-PVZ3GB25.js → chunk-YHNZZIAH.js} +5 -5
- package/{commandRegistry-MTKBHP45.js → commandRegistry-RM2Z2DVF.js} +65 -61
- package/{contentThunks-E4DHXF3M.js → contentThunks-RP4BYNUC.js} +8 -8
- package/{cooldownCommands-IUU3ZH3L.js → cooldownCommands-4XKJFEBW.js} +1 -1
- package/{createAgentAutomationAction-2P2II7B3.js → createAgentAutomationAction-AYFAMQ5D.js} +8 -8
- package/{createDialogAction-MFZGE5EO.js → createDialogAction-NV5TEAIN.js} +10 -10
- package/{createPageAction-SBU2YCNR.js → createPageAction-FJGDX55N.js} +8 -8
- package/{dbSlice-2O3YBVPP.js → dbSlice-QAUXABCC.js} +2 -2
- package/{dialogCommands-AWGFKOGS.js → dialogCommands-4BGV6DPD.js} +8 -8
- package/{dialogSlice-GKPCUQWM.js → dialogSlice-ZUYNLTF6.js} +7 -7
- package/{dialogUsageCommand-44XMU6DD.js → dialogUsageCommand-QTG6ILEJ.js} +58 -5
- package/{docCreateCommands-4JEKXNST.js → docCreateCommands-3CW75UF2.js} +7 -7
- package/{docDeleteCommands-Q5K4UJPQ.js → docDeleteCommands-NL4ZYMN5.js} +8 -8
- package/{docReadCommands-ZZ7HMGPV.js → docReadCommands-HXCNVDPQ.js} +7 -7
- package/{docStore-DOZVBVKZ.js → docStore-EPAZ4HLD.js} +3 -3
- package/{docUpdateCommands-NUFXB6BD.js → docUpdateCommands-RMVBAMDE.js} +7 -7
- package/{fetchMessages-QLW7INJJ.js → fetchMessages-HWBVATSE.js} +1 -1
- package/{handleSendMessageAction-FY4RBJEA.js → handleSendMessageAction-5UH3DA6V.js} +15 -15
- package/index.js +6 -6
- package/{keys-N6HQICY5.js → keys-P4ZDOVJW.js} +11 -1
- package/{localDialogRead-55YDVPNU.js → localDialogRead-CT5HGDMC.js} +1 -1
- package/{localRuntimeAdapter-KCS5Y4T6.js → localRuntimeAdapter-LVPGHOJK.js} +22 -22
- package/{machineCommands-E3HMAMLA.js → machineCommands-O6RDJGLV.js} +23 -23
- package/{machineWsRunDispatch-MGDBTLDX.js → machineWsRunDispatch-GVDQO742.js} +23 -23
- package/{memberThunks-VXT36MZP.js → memberThunks-QWAAGQBS.js} +155 -52
- package/package.json +1 -1
- package/{readlineWorkspace-IWWKZK3F.js → readlineWorkspace-I5XZFI2E.js} +87 -41
- package/{removeDialogAgentAction-PK24DJ2J.js → removeDialogAgentAction-YEPO5AYI.js} +3 -3
- package/{runAgentClientLoop-CFIM6MXT.js → runAgentClientLoop-LV2HYQPH.js} +20 -20
- package/{secretCommands-UZV7CPJY.js → secretCommands-N6CMCJDZ.js} +1 -1
- package/{setDialogExtraReferencesAction-BN4IBUO6.js → setDialogExtraReferencesAction-EH5GWDAJ.js} +3 -3
- package/{setPrimaryDialogAgentAction-JR5SMLZY.js → setPrimaryDialogAgentAction-PNWRK6IY.js} +3 -3
- package/{settingThunks-RJZQHL7H.js → settingThunks-7VCWB6P7.js} +2 -2
- package/{spaceCommands-BI3TRIAK.js → spaceCommands-ZUI4CTSO.js} +6 -6
- package/{streamAgentChatTurn-3BS7IAFR.js → streamAgentChatTurn-ZCHIQR35.js} +22 -22
- package/{switchDialogAgentAction-TSIXBNRH.js → switchDialogAgentAction-23BFWJMV.js} +2 -2
- package/{tools-PCTUYG54.js → tools-2DZDJWHZ.js} +17 -17
- package/{updateCommands-Y6CKFKIF.js → updateCommands-KE6LP3QX.js} +3 -3
- package/{updateDialogTitleAction-ZHFIMEQL.js → updateDialogTitleAction-QZWVKVVW.js} +8 -8
- package/{windowsSelfUpdate-XV2MMQAC.js → windowsSelfUpdate-26TSFXEZ.js} +2 -2
|
@@ -145,7 +145,7 @@ import {
|
|
|
145
145
|
resolveEmptyAssistantFallbackMessage,
|
|
146
146
|
resolveEmptyAssistantOutcome,
|
|
147
147
|
resolveTruncatedReasoningTailLog
|
|
148
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-K6TZSON4.js";
|
|
149
149
|
import {
|
|
150
150
|
COMPACTION_SUMMARY_SCHEMA_VERSION,
|
|
151
151
|
COMPACTION_SUMMARY_SYSTEM_PROMPT,
|
|
@@ -12720,8 +12720,8 @@ function sanitizeToolCallPairing(messages) {
|
|
|
12720
12720
|
}
|
|
12721
12721
|
|
|
12722
12722
|
// packages/agent-runtime/toolSpillStore.ts
|
|
12723
|
-
import { createHash } from "node:crypto";
|
|
12724
|
-
import { existsSync, mkdirSync, readdirSync, renameSync, statSync, unlinkSync, utimesSync, writeFileSync } from "node:fs";
|
|
12723
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
12724
|
+
import { constants, copyFileSync, createReadStream, existsSync, mkdirSync, readdirSync, renameSync, statSync, unlinkSync, utimesSync, writeFileSync } from "node:fs";
|
|
12725
12725
|
import { isAbsolute, join as join2, relative } from "node:path";
|
|
12726
12726
|
var DEFAULT_MAX_SPILL_DIR_BYTES = 50 * 1024 * 1024;
|
|
12727
12727
|
var DEFAULT_SPILL_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -12747,6 +12747,127 @@ function countLines(text2) {
|
|
|
12747
12747
|
}
|
|
12748
12748
|
return lines;
|
|
12749
12749
|
}
|
|
12750
|
+
var SPILL_PUBLICATION_GRACE_MS = 6e4;
|
|
12751
|
+
async function hashFileStreaming(path) {
|
|
12752
|
+
const hash2 = createHash("sha256");
|
|
12753
|
+
await new Promise((resolve7, reject) => {
|
|
12754
|
+
const stream = createReadStream(path);
|
|
12755
|
+
stream.on("data", (chunk) => hash2.update(chunk));
|
|
12756
|
+
stream.on("error", reject);
|
|
12757
|
+
stream.on("end", () => resolve7());
|
|
12758
|
+
});
|
|
12759
|
+
return hash2.digest("hex");
|
|
12760
|
+
}
|
|
12761
|
+
async function promoteToolSpillFile(sourcePath, options) {
|
|
12762
|
+
const injected = options?.ops ?? {};
|
|
12763
|
+
const ops = {
|
|
12764
|
+
now: injected.now ?? (() => Date.now()),
|
|
12765
|
+
statSize: injected.statSize ?? ((path) => statSync(path).size),
|
|
12766
|
+
rename: injected.rename ?? ((from, to) => renameSync(from, to)),
|
|
12767
|
+
copyExclusive: injected.copyExclusive ?? ((from, to) => {
|
|
12768
|
+
copyFileSync(from, to, constants.COPYFILE_EXCL);
|
|
12769
|
+
}),
|
|
12770
|
+
unlink: injected.unlink ?? ((path) => unlinkSync(path)),
|
|
12771
|
+
exists: injected.exists ?? ((path) => existsSync(path)),
|
|
12772
|
+
mkdirp: injected.mkdirp ?? ((dir) => mkdirSync(dir, { recursive: true })),
|
|
12773
|
+
touch: injected.touch ?? ((path, atMs) => {
|
|
12774
|
+
const at = new Date(atMs);
|
|
12775
|
+
utimesSync(path, at, at);
|
|
12776
|
+
}),
|
|
12777
|
+
hashFile: injected.hashFile ?? hashFileStreaming,
|
|
12778
|
+
cleanup: injected.cleanup ?? ((dir) => cleanupExpiredSpills(dir, { throttleMs: 0 })),
|
|
12779
|
+
randomId: injected.randomId ?? (() => randomUUID())
|
|
12780
|
+
};
|
|
12781
|
+
const preservedIfPresent = () => {
|
|
12782
|
+
try {
|
|
12783
|
+
return ops.exists(sourcePath) ? sourcePath : void 0;
|
|
12784
|
+
} catch {
|
|
12785
|
+
return sourcePath;
|
|
12786
|
+
}
|
|
12787
|
+
};
|
|
12788
|
+
let size3 = 0;
|
|
12789
|
+
try {
|
|
12790
|
+
size3 = ops.statSize(sourcePath);
|
|
12791
|
+
} catch {
|
|
12792
|
+
const preservedPath = preservedIfPresent();
|
|
12793
|
+
return preservedPath ? { ok: false, reason: "unverified", preservedPath } : { ok: false, reason: "missing" };
|
|
12794
|
+
}
|
|
12795
|
+
if (size3 <= 0) return { ok: false, reason: "empty" };
|
|
12796
|
+
let expectedHash = "";
|
|
12797
|
+
try {
|
|
12798
|
+
expectedHash = await ops.hashFile(sourcePath);
|
|
12799
|
+
} catch {
|
|
12800
|
+
const preservedPath = preservedIfPresent();
|
|
12801
|
+
return preservedPath ? { ok: false, reason: "unverified", preservedPath } : { ok: false, reason: "missing" };
|
|
12802
|
+
}
|
|
12803
|
+
const workspaceRoot = options?.workspaceRoot;
|
|
12804
|
+
const candidateDirs = Array.from(
|
|
12805
|
+
new Set(
|
|
12806
|
+
[
|
|
12807
|
+
resolveSpillDirectory({ workspaceRoot }),
|
|
12808
|
+
resolveNoloStateDir("spills")
|
|
12809
|
+
].filter(Boolean)
|
|
12810
|
+
)
|
|
12811
|
+
);
|
|
12812
|
+
for (const dir of candidateDirs) {
|
|
12813
|
+
const id = ops.randomId();
|
|
12814
|
+
const final = join2(dir, `spill-execshell-${id}.log`);
|
|
12815
|
+
const stage = join2(dir, `.spill-execshell-${id}.${ops.randomId()}.copying`);
|
|
12816
|
+
let stageOwnedByMove = false;
|
|
12817
|
+
let stageOwnedByCopy = false;
|
|
12818
|
+
try {
|
|
12819
|
+
ops.mkdirp(dir);
|
|
12820
|
+
try {
|
|
12821
|
+
ops.rename(sourcePath, stage);
|
|
12822
|
+
stageOwnedByMove = true;
|
|
12823
|
+
} catch (error) {
|
|
12824
|
+
if (error?.code !== "EXDEV") throw error;
|
|
12825
|
+
ops.copyExclusive(sourcePath, stage);
|
|
12826
|
+
stageOwnedByCopy = true;
|
|
12827
|
+
}
|
|
12828
|
+
const actualHash = await ops.hashFile(stage);
|
|
12829
|
+
if (actualHash !== expectedHash) throw new Error("spill verification failed");
|
|
12830
|
+
ops.touch(stage, ops.now());
|
|
12831
|
+
ops.rename(stage, final);
|
|
12832
|
+
if (ops.exists(sourcePath)) {
|
|
12833
|
+
try {
|
|
12834
|
+
ops.unlink(sourcePath);
|
|
12835
|
+
} catch {
|
|
12836
|
+
}
|
|
12837
|
+
}
|
|
12838
|
+
try {
|
|
12839
|
+
ops.cleanup(dir);
|
|
12840
|
+
} catch {
|
|
12841
|
+
}
|
|
12842
|
+
const displayPath = workspaceRoot && isAbsolute(workspaceRoot) && dir === candidateDirs[0] ? (() => {
|
|
12843
|
+
const rel = relative(workspaceRoot, final);
|
|
12844
|
+
return !rel.startsWith("..") && !isAbsolute(rel) ? rel : final;
|
|
12845
|
+
})() : final;
|
|
12846
|
+
return { ok: true, spillPath: final, displayPath };
|
|
12847
|
+
} catch {
|
|
12848
|
+
if (stageOwnedByCopy) {
|
|
12849
|
+
try {
|
|
12850
|
+
ops.unlink(stage);
|
|
12851
|
+
} catch {
|
|
12852
|
+
}
|
|
12853
|
+
continue;
|
|
12854
|
+
}
|
|
12855
|
+
if (stageOwnedByMove) {
|
|
12856
|
+
try {
|
|
12857
|
+
ops.rename(stage, sourcePath);
|
|
12858
|
+
continue;
|
|
12859
|
+
} catch {
|
|
12860
|
+
return { ok: false, reason: "publish-failed", preservedPath: stage };
|
|
12861
|
+
}
|
|
12862
|
+
}
|
|
12863
|
+
}
|
|
12864
|
+
}
|
|
12865
|
+
return {
|
|
12866
|
+
ok: false,
|
|
12867
|
+
reason: "publish-failed",
|
|
12868
|
+
preservedPath: preservedIfPresent()
|
|
12869
|
+
};
|
|
12870
|
+
}
|
|
12750
12871
|
function cleanupExpiredSpills(spillDir, options) {
|
|
12751
12872
|
if (!existsSync(spillDir)) return;
|
|
12752
12873
|
const throttleMs = options?.throttleMs ?? 0;
|
|
@@ -12773,14 +12894,16 @@ function cleanupExpiredSpills(spillDir, options) {
|
|
|
12773
12894
|
const fullPath = join2(spillDir, entry.name);
|
|
12774
12895
|
try {
|
|
12775
12896
|
const stats = statSync(fullPath);
|
|
12776
|
-
|
|
12897
|
+
const protectedByPublication = isSpillLog && entry.name.startsWith("spill-execshell-") && now - stats.mtimeMs < SPILL_PUBLICATION_GRACE_MS;
|
|
12898
|
+
if (!protectedByPublication && (now - stats.mtimeMs > maxAge || isOrphanTmp)) {
|
|
12777
12899
|
unlinkSync(fullPath);
|
|
12778
12900
|
} else {
|
|
12779
12901
|
spillFiles.push({
|
|
12780
12902
|
name: entry.name,
|
|
12781
12903
|
fullPath,
|
|
12782
12904
|
mtimeMs: stats.mtimeMs,
|
|
12783
|
-
size: stats.size
|
|
12905
|
+
size: stats.size,
|
|
12906
|
+
protectedByPublication
|
|
12784
12907
|
});
|
|
12785
12908
|
}
|
|
12786
12909
|
} catch {
|
|
@@ -12791,6 +12914,7 @@ function cleanupExpiredSpills(spillDir, options) {
|
|
|
12791
12914
|
spillFiles.sort((a, b) => a.mtimeMs - b.mtimeMs);
|
|
12792
12915
|
for (const file of spillFiles) {
|
|
12793
12916
|
if (totalSize <= maxBytes) break;
|
|
12917
|
+
if (file.protectedByPublication) continue;
|
|
12794
12918
|
try {
|
|
12795
12919
|
unlinkSync(file.fullPath);
|
|
12796
12920
|
totalSize -= file.size;
|
|
@@ -14311,10 +14435,10 @@ function detectExecShellSynchronousWarnings(command, shell) {
|
|
|
14311
14435
|
}
|
|
14312
14436
|
|
|
14313
14437
|
// packages/agent-runtime/workspaceShell.ts
|
|
14314
|
-
import { createWriteStream, mkdirSync as mkdirSync2 } from "node:fs";
|
|
14438
|
+
import { createWriteStream, mkdirSync as mkdirSync2, rmSync } from "node:fs";
|
|
14315
14439
|
import { dirname, join as join4, resolve } from "node:path";
|
|
14316
14440
|
import { spawn as spawnChildProcess } from "node:child_process";
|
|
14317
|
-
import { randomUUID } from "node:crypto";
|
|
14441
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
14318
14442
|
import { tmpdir } from "node:os";
|
|
14319
14443
|
|
|
14320
14444
|
// packages/agent-runtime/runtimeCompat.ts
|
|
@@ -15251,11 +15375,18 @@ function truncateToolOutput(value, limit = 2e4, options) {
|
|
|
15251
15375
|
${tail}`;
|
|
15252
15376
|
}
|
|
15253
15377
|
var DEFAULT_MAX_STREAM_BUFFER_BYTES = 5 * 1024 * 1024;
|
|
15378
|
+
function removeSpillFile(path) {
|
|
15379
|
+
try {
|
|
15380
|
+
rmSync(path, { force: true });
|
|
15381
|
+
} catch {
|
|
15382
|
+
}
|
|
15383
|
+
}
|
|
15254
15384
|
function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BYTES) {
|
|
15255
15385
|
if (!stream) return Promise.resolve("");
|
|
15256
15386
|
const options = typeof maxBytesOrOptions === "number" ? { maxBytes: maxBytesOrOptions } : maxBytesOrOptions ?? {};
|
|
15257
15387
|
const maxBytes = typeof options.maxBytes === "number" && Number.isFinite(options.maxBytes) && options.maxBytes >= 0 ? options.maxBytes : DEFAULT_MAX_STREAM_BUFFER_BYTES;
|
|
15258
15388
|
const spillPath = asOptionalTrimmedString(options.spillPath);
|
|
15389
|
+
const spillRetention = options.spillRetention ?? "keep";
|
|
15259
15390
|
const createSink = options.spillSinkFactory ?? ((path) => createWriteStream(path));
|
|
15260
15391
|
return new Promise((resolveStream, rejectStream) => {
|
|
15261
15392
|
const chunks2 = [];
|
|
@@ -15264,6 +15395,8 @@ function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BY
|
|
|
15264
15395
|
let truncated = false;
|
|
15265
15396
|
let spillState = spillPath ? "idle" : "disabled";
|
|
15266
15397
|
let spillError = null;
|
|
15398
|
+
let spillRetainedPath = null;
|
|
15399
|
+
let sourceEnded = false;
|
|
15267
15400
|
let spillSink = null;
|
|
15268
15401
|
let sourcePausedForSpill = false;
|
|
15269
15402
|
let sinkFinished = false;
|
|
@@ -15344,20 +15477,42 @@ function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BY
|
|
|
15344
15477
|
for (const head3 of headChunks) writeToSink(head3);
|
|
15345
15478
|
writeToSink(crossingChunk);
|
|
15346
15479
|
};
|
|
15480
|
+
const settleSpillRetention = async () => {
|
|
15481
|
+
if (!spillPath || spillRetention === "keep") {
|
|
15482
|
+
if (spillPath && spillRetention === "keep" && spillState === "ok") {
|
|
15483
|
+
spillRetainedPath = spillPath;
|
|
15484
|
+
}
|
|
15485
|
+
return;
|
|
15486
|
+
}
|
|
15487
|
+
if (spillRetention === "promote" && spillState === "ok" && sourceEnded) {
|
|
15488
|
+
const promoted = await promoteToolSpillFile(spillPath, {
|
|
15489
|
+
workspaceRoot: options.spillWorkspaceRoot
|
|
15490
|
+
});
|
|
15491
|
+
if (promoted.ok) {
|
|
15492
|
+
spillRetainedPath = promoted.displayPath;
|
|
15493
|
+
return;
|
|
15494
|
+
}
|
|
15495
|
+
if (promoted.preservedPath) {
|
|
15496
|
+
return;
|
|
15497
|
+
}
|
|
15498
|
+
}
|
|
15499
|
+
removeSpillFile(spillPath);
|
|
15500
|
+
};
|
|
15347
15501
|
const finalize2 = (wasTruncated) => {
|
|
15348
15502
|
if (settled) return;
|
|
15349
15503
|
settled = true;
|
|
15350
15504
|
const truncatedNow = wasTruncated || truncated;
|
|
15351
15505
|
const baseText = Buffer.concat(chunks2).toString("utf8");
|
|
15352
|
-
const done4 = () => {
|
|
15506
|
+
const done4 = async () => {
|
|
15507
|
+
await settleSpillRetention();
|
|
15353
15508
|
let text2 = baseText;
|
|
15354
15509
|
if (truncatedNow) {
|
|
15355
15510
|
const notes = [`output exceeded ${formatLimit} buffer limit`];
|
|
15356
|
-
if (
|
|
15357
|
-
notes.push(`full output: ${
|
|
15511
|
+
if (spillRetainedPath && sourceEnded) {
|
|
15512
|
+
notes.push(`full output: ${spillRetainedPath}`);
|
|
15358
15513
|
} else if (spillPath) {
|
|
15359
15514
|
notes.push(
|
|
15360
|
-
`spill failed${spillError ? ` (${spillError})` : ""}; output incomplete`
|
|
15515
|
+
spillState === "failed" ? `spill failed${spillError ? ` (${spillError})` : ""}; output incomplete` : `spill output not retained; output incomplete`
|
|
15361
15516
|
);
|
|
15362
15517
|
}
|
|
15363
15518
|
text2 += `
|
|
@@ -15368,7 +15523,7 @@ function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BY
|
|
|
15368
15523
|
};
|
|
15369
15524
|
const sink = spillSink;
|
|
15370
15525
|
if (!sink || spillState !== "open") {
|
|
15371
|
-
done4();
|
|
15526
|
+
void done4();
|
|
15372
15527
|
return;
|
|
15373
15528
|
}
|
|
15374
15529
|
let closed = false;
|
|
@@ -15380,7 +15535,7 @@ function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BY
|
|
|
15380
15535
|
} else if (spillState === "open") {
|
|
15381
15536
|
spillState = "ok";
|
|
15382
15537
|
}
|
|
15383
|
-
done4();
|
|
15538
|
+
void done4();
|
|
15384
15539
|
};
|
|
15385
15540
|
if (sink.destroyed === true) {
|
|
15386
15541
|
settleSink(true, new Error("spill writable closed before finish"));
|
|
@@ -15434,9 +15589,13 @@ function readNodeStream(stream, maxBytesOrOptions = DEFAULT_MAX_STREAM_BUFFER_BY
|
|
|
15434
15589
|
}
|
|
15435
15590
|
}
|
|
15436
15591
|
resumeSourceIfPaused();
|
|
15592
|
+
void settleSpillRetention();
|
|
15437
15593
|
rejectStream(error);
|
|
15438
15594
|
});
|
|
15439
|
-
stream.on("end", () =>
|
|
15595
|
+
stream.on("end", () => {
|
|
15596
|
+
sourceEnded = true;
|
|
15597
|
+
finalize2(false);
|
|
15598
|
+
});
|
|
15440
15599
|
stream.on("close", () => finalize2(false));
|
|
15441
15600
|
});
|
|
15442
15601
|
}
|
|
@@ -15547,10 +15706,18 @@ async function runWorkspaceCommand(args2) {
|
|
|
15547
15706
|
};
|
|
15548
15707
|
exitPromise.then(detachSignalCleanup, detachSignalCleanup);
|
|
15549
15708
|
const stdoutCapture = stdoutPromiseResult(
|
|
15550
|
-
readNodeStream(proc.stdout, {
|
|
15709
|
+
readNodeStream(proc.stdout, {
|
|
15710
|
+
spillPath: join4(tmpdir(), `nolo-stream-${randomUUID2()}.log`),
|
|
15711
|
+
spillRetention: "promote",
|
|
15712
|
+
spillWorkspaceRoot: args2.workspaceRoot
|
|
15713
|
+
})
|
|
15551
15714
|
);
|
|
15552
15715
|
const stderrCapture = stdoutPromiseResult(
|
|
15553
|
-
readNodeStream(proc.stderr, {
|
|
15716
|
+
readNodeStream(proc.stderr, {
|
|
15717
|
+
spillPath: join4(tmpdir(), `nolo-stream-${randomUUID2()}-stderr.log`),
|
|
15718
|
+
spillRetention: "promote",
|
|
15719
|
+
spillWorkspaceRoot: args2.workspaceRoot
|
|
15720
|
+
})
|
|
15554
15721
|
);
|
|
15555
15722
|
const killChild = (signal) => {
|
|
15556
15723
|
if (detached && typeof proc.pid === "number") {
|
|
@@ -15967,18 +16134,18 @@ import { createHash as createHash4 } from "node:crypto";
|
|
|
15967
16134
|
import { createRequire } from "node:module";
|
|
15968
16135
|
import { existsSync as existsSync4 } from "node:fs";
|
|
15969
16136
|
import { realpath, stat, readFile } from "node:fs/promises";
|
|
15970
|
-
import { isAbsolute as
|
|
16137
|
+
import { isAbsolute as isAbsolute3, relative as relative3, win32 } from "node:path";
|
|
15971
16138
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
15972
16139
|
import { lookup as lookup2 } from "node:dns/promises";
|
|
15973
16140
|
import { isIP } from "node:net";
|
|
15974
16141
|
function isVisualPathOutside(rel) {
|
|
15975
|
-
return rel === ".." || /^\.\.[\\/]/.test(rel) ||
|
|
16142
|
+
return rel === ".." || /^\.\.[\\/]/.test(rel) || isAbsolute3(rel) || win32.isAbsolute(rel);
|
|
15976
16143
|
}
|
|
15977
16144
|
async function validateVisualUrl(input, workspaceRoot) {
|
|
15978
16145
|
const url = new URL(input);
|
|
15979
16146
|
if (url.protocol === "file:") {
|
|
15980
16147
|
const [root, path] = await Promise.all([realpath(workspaceRoot), realpath(fileURLToPath(url))]);
|
|
15981
|
-
const rel =
|
|
16148
|
+
const rel = relative3(root, path);
|
|
15982
16149
|
if (isVisualPathOutside(rel)) throw new Error("Renderer file URL is outside workspaceRoot.");
|
|
15983
16150
|
if (!(await stat(path)).isFile()) throw new Error("Renderer file URL must point to a file, not a directory.");
|
|
15984
16151
|
return pathToFileURL(path);
|
|
@@ -16052,10 +16219,10 @@ async function renderVisualPage(args2) {
|
|
|
16052
16219
|
if (typeof args2.persistScreenshot !== "function") {
|
|
16053
16220
|
throw new Error("renderVisualPage: persistScreenshot is required (expected a function that stores the PNG bytes)");
|
|
16054
16221
|
}
|
|
16055
|
-
if (!
|
|
16222
|
+
if (!isAbsolute3(args2.workspaceRoot)) {
|
|
16056
16223
|
throw new Error("renderVisualPage: workspaceRoot must be an absolute path");
|
|
16057
16224
|
}
|
|
16058
|
-
if (!
|
|
16225
|
+
if (!isAbsolute3(args2.screenshotPath) || !relative3(args2.workspaceRoot, args2.screenshotPath) || isVisualPathOutside(relative3(args2.workspaceRoot, args2.screenshotPath))) {
|
|
16059
16226
|
throw new Error("renderVisualPage: screenshotPath must be a file path inside workspaceRoot");
|
|
16060
16227
|
}
|
|
16061
16228
|
if (args2.timeoutMs !== void 0 && (typeof args2.timeoutMs !== "number" || !Number.isFinite(args2.timeoutMs) || args2.timeoutMs <= 0)) {
|
|
@@ -16312,7 +16479,7 @@ var captureHostWindow = createHostWindowCapture();
|
|
|
16312
16479
|
// packages/agent-runtime/localWorkspaceTools.ts
|
|
16313
16480
|
import { lstat as lstat2, readdir as readdir2, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
|
|
16314
16481
|
import { homedir } from "node:os";
|
|
16315
|
-
import { dirname as dirname3, relative as
|
|
16482
|
+
import { dirname as dirname3, relative as relative6, resolve as resolve5, sep as sep2 } from "node:path";
|
|
16316
16483
|
import { spawn as spawnChildProcess3 } from "node:child_process";
|
|
16317
16484
|
|
|
16318
16485
|
// packages/core/readRangeLedger.ts
|
|
@@ -16349,7 +16516,7 @@ function isLineRangeCovered(request3, covered) {
|
|
|
16349
16516
|
|
|
16350
16517
|
// packages/agent-runtime/fileTextSearch.ts
|
|
16351
16518
|
import { readdir, readFile as readFile3, stat as stat3 } from "node:fs/promises";
|
|
16352
|
-
import { basename, relative as
|
|
16519
|
+
import { basename, relative as relative4, resolve as resolve3 } from "node:path";
|
|
16353
16520
|
import { spawn as spawnChildProcess2 } from "node:child_process";
|
|
16354
16521
|
|
|
16355
16522
|
// packages/agent-runtime/gitignore.ts
|
|
@@ -16376,7 +16543,7 @@ async function hasRootGitignore(workspaceRoot) {
|
|
|
16376
16543
|
|
|
16377
16544
|
// packages/agent-runtime/fileTextSearch.ts
|
|
16378
16545
|
var normalizePath = (value) => value.replaceAll("\\", "/");
|
|
16379
|
-
var pathFor = (root, file, absolute = false) => absolute ? normalizePath(file) : normalizePath(
|
|
16546
|
+
var pathFor = (root, file, absolute = false) => absolute ? normalizePath(file) : normalizePath(relative4(root, file) || basename(file));
|
|
16380
16547
|
var COMMAND_LIMIT_HEADROOM = 1;
|
|
16381
16548
|
async function runCommand(binary, args2, cwd, maxResults) {
|
|
16382
16549
|
const recordLimit = maxResults === void 0 ? 0 : Math.max(0, maxResults) + COMMAND_LIMIT_HEADROOM;
|
|
@@ -17191,10 +17358,10 @@ function filterDeclaredWorkspaceToolNames(args2) {
|
|
|
17191
17358
|
// packages/agent-runtime/workspacePathGuard.ts
|
|
17192
17359
|
import { constants as fsConstants } from "node:fs";
|
|
17193
17360
|
import { lstat, mkdir, open, readlink, realpath as realpath2 } from "node:fs/promises";
|
|
17194
|
-
import { basename as basename2, dirname as dirname2, isAbsolute as
|
|
17361
|
+
import { basename as basename2, dirname as dirname2, isAbsolute as isAbsolute4, join as join5, relative as relative5, resolve as resolve4, sep } from "node:path";
|
|
17195
17362
|
function isPathInsideRoot(root, targetPath) {
|
|
17196
|
-
const rel =
|
|
17197
|
-
return rel === "" || rel !== ".." && !rel.startsWith(`..${sep}`) && !
|
|
17363
|
+
const rel = relative5(resolve4(root), resolve4(targetPath));
|
|
17364
|
+
return rel === "" || rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute4(rel);
|
|
17198
17365
|
}
|
|
17199
17366
|
function isNotFoundError(error) {
|
|
17200
17367
|
const code = error?.code;
|
|
@@ -17281,7 +17448,7 @@ async function resolveOpenedFilePath(handle) {
|
|
|
17281
17448
|
for (const root of FD_LINK_ROOTS) {
|
|
17282
17449
|
try {
|
|
17283
17450
|
const linked = await readlink(`${root}/${handle.fd}`);
|
|
17284
|
-
if (
|
|
17451
|
+
if (isAbsolute4(linked)) return linked.replace(/ \(deleted\)$/, "");
|
|
17285
17452
|
} catch {
|
|
17286
17453
|
}
|
|
17287
17454
|
}
|
|
@@ -17590,11 +17757,11 @@ function parseWorkspaceToolArguments(raw) {
|
|
|
17590
17757
|
}
|
|
17591
17758
|
}
|
|
17592
17759
|
function normalizeWorkspaceRelativePath(args2) {
|
|
17593
|
-
const relativePath =
|
|
17760
|
+
const relativePath = relative6(args2.workspaceRoot, args2.targetPath);
|
|
17594
17761
|
return relativePath || ".";
|
|
17595
17762
|
}
|
|
17596
17763
|
function isPathInsideWorkspace(args2) {
|
|
17597
|
-
const relativePath =
|
|
17764
|
+
const relativePath = relative6(args2.workspaceRoot, args2.targetPath);
|
|
17598
17765
|
return relativePath === "" || !relativePath.startsWith("..") && !relativePath.includes(`..${sep2}`);
|
|
17599
17766
|
}
|
|
17600
17767
|
var PATH_FIELD_ALIASES = ["path", "file_path", "filePath", "filename", "file", "target_file", "targetFile", "file_to_read", "fileToRead", "target_path", "read_path", "path_to_read", "pathToRead"];
|
|
@@ -18258,7 +18425,7 @@ async function listWorkspaceEntries(args2) {
|
|
|
18258
18425
|
if (truncated) break;
|
|
18259
18426
|
const absolutePath = resolve5(dirPath, name);
|
|
18260
18427
|
const info = await stat4(absolutePath);
|
|
18261
|
-
const relativePath =
|
|
18428
|
+
const relativePath = relative6(args2.dirPath, absolutePath) || ".";
|
|
18262
18429
|
const isDirectory = info.isDirectory();
|
|
18263
18430
|
entries.push(isDirectory ? `${relativePath}/` : relativePath);
|
|
18264
18431
|
if (args2.maxResults && entries.length >= args2.maxResults) {
|
|
@@ -19873,7 +20040,7 @@ var normalizeContextBlockScopes = (legacyBlocks = void 0, scopes = void 0) => {
|
|
|
19873
20040
|
};
|
|
19874
20041
|
|
|
19875
20042
|
// packages/agent-runtime/localAutoCompaction.ts
|
|
19876
|
-
import { randomUUID as
|
|
20043
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
19877
20044
|
function toPlanCompressionMessages(history) {
|
|
19878
20045
|
return history.map((message, index) => ({
|
|
19879
20046
|
id: typeof message.id === "string" && message.id.length > 0 ? message.id : `local-${index}`,
|
|
@@ -20108,7 +20275,7 @@ async function maybeAutoCompactLocalHistory(args2) {
|
|
|
20108
20275
|
};
|
|
20109
20276
|
}
|
|
20110
20277
|
emitPhase({ kind: "compaction-start" });
|
|
20111
|
-
const compactionAttemptId =
|
|
20278
|
+
const compactionAttemptId = randomUUID3();
|
|
20112
20279
|
let compactionT0 = Date.now();
|
|
20113
20280
|
let compactionInputTokens;
|
|
20114
20281
|
let compactionPrevSummaryTokens;
|
|
@@ -22985,7 +23152,7 @@ function buildLoadSkillExecutor(args2) {
|
|
|
22985
23152
|
const { resolveSkillByName } = await import("./skillDiscovery-F3TMVQOJ.js");
|
|
22986
23153
|
const resolved = resolveSkillByName(args2.cwd, name);
|
|
22987
23154
|
if (!resolved) {
|
|
22988
|
-
const { resolveBuiltinSkillByName } = await import("./builtinSkillRegistry-
|
|
23155
|
+
const { resolveBuiltinSkillByName } = await import("./builtinSkillRegistry-7MBUY5EY.js");
|
|
22989
23156
|
const builtin = resolveBuiltinSkillByName(name);
|
|
22990
23157
|
if (builtin) {
|
|
22991
23158
|
return {
|
|
@@ -23063,7 +23230,7 @@ function resolveSessionKey(args2) {
|
|
|
23063
23230
|
}
|
|
23064
23231
|
|
|
23065
23232
|
// packages/agent-runtime/devin/devinProvider.ts
|
|
23066
|
-
import { randomBytes, randomUUID as
|
|
23233
|
+
import { randomBytes, randomUUID as randomUUID4 } from "node:crypto";
|
|
23067
23234
|
var CLIENT_NAME = "chisel";
|
|
23068
23235
|
var CLIENT_VERSION = "3000.11.3";
|
|
23069
23236
|
function writeVarint(fieldNum, value) {
|
|
@@ -23123,7 +23290,7 @@ function encodeDevinClientMetadata(token) {
|
|
|
23123
23290
|
]);
|
|
23124
23291
|
}
|
|
23125
23292
|
function devinId(id, purpose) {
|
|
23126
|
-
return id?.sessionKey && isStableSessionIdentityEnabled() ? deriveStableUuid(id.sessionKey, purpose) :
|
|
23293
|
+
return id?.sessionKey && isStableSessionIdentityEnabled() ? deriveStableUuid(id.sessionKey, purpose) : randomUUID4();
|
|
23127
23294
|
}
|
|
23128
23295
|
function encodeDevinChatMessage(msg, identity2, index = 0) {
|
|
23129
23296
|
const source = msg.role === "assistant" ? 2 : msg.role === "tool" ? 4 : 1;
|
|
@@ -23217,7 +23384,7 @@ ${item.text}`;
|
|
|
23217
23384
|
const chatMessageBuffers = coalesced.map((m, i) => encodeDevinChatMessage(m, identity2, i));
|
|
23218
23385
|
const completionConfig = buildCompletionConfig({ temperature });
|
|
23219
23386
|
const modelConfig = Buffer.concat([
|
|
23220
|
-
writeStringField(1,
|
|
23387
|
+
writeStringField(1, randomUUID4()),
|
|
23221
23388
|
writeVarint(2, 1),
|
|
23222
23389
|
writeVarint(3, 4)
|
|
23223
23390
|
]);
|
|
@@ -23229,7 +23396,7 @@ ${item.text}`;
|
|
|
23229
23396
|
writeMessageField(8, completionConfig),
|
|
23230
23397
|
...tools.map((tool) => writeMessageField(10, encodeDevinToolDefinition(tool))),
|
|
23231
23398
|
writeMessageField(15, modelConfig),
|
|
23232
|
-
writeStringField(16,
|
|
23399
|
+
writeStringField(16, randomUUID4()),
|
|
23233
23400
|
writeVarint(20, 1),
|
|
23234
23401
|
writeStringField(21, model)
|
|
23235
23402
|
]);
|
|
@@ -23600,17 +23767,17 @@ function createDevinProvider(options) {
|
|
|
23600
23767
|
}
|
|
23601
23768
|
|
|
23602
23769
|
// packages/agent-runtime/executionLeaseValidation.ts
|
|
23603
|
-
import { isAbsolute as
|
|
23770
|
+
import { isAbsolute as isAbsolute6, relative as relative7, resolve as resolve6 } from "node:path";
|
|
23604
23771
|
function withinRoot(root, child) {
|
|
23605
|
-
if (!
|
|
23772
|
+
if (!isAbsolute6(root) || !isAbsolute6(child)) return false;
|
|
23606
23773
|
const canonicalRoot = resolve6(root);
|
|
23607
23774
|
const canonicalChild = resolve6(child);
|
|
23608
|
-
const suffix =
|
|
23609
|
-
return suffix === "" || suffix !== ".." && !suffix.startsWith("../") && !suffix.startsWith("..\\") && !
|
|
23775
|
+
const suffix = relative7(canonicalRoot, canonicalChild);
|
|
23776
|
+
return suffix === "" || suffix !== ".." && !suffix.startsWith("../") && !suffix.startsWith("..\\") && !isAbsolute6(suffix);
|
|
23610
23777
|
}
|
|
23611
23778
|
function subsetOf(allowed, actual) {
|
|
23612
23779
|
return actual.every(
|
|
23613
|
-
(root) =>
|
|
23780
|
+
(root) => isAbsolute6(root) && allowed.some((parent) => withinRoot(parent, root))
|
|
23614
23781
|
);
|
|
23615
23782
|
}
|
|
23616
23783
|
function validateConfiguredRootExecutionLease(ticket, lease) {
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
import {
|
|
54
54
|
fileKey,
|
|
55
55
|
getFileIdFromKey
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-ECX3NKRD.js";
|
|
57
57
|
import {
|
|
58
58
|
ulid
|
|
59
59
|
} from "./chunk-XJWWBO34.js";
|
|
@@ -782,7 +782,7 @@ var dbSlice = createSliceWithThunks({
|
|
|
782
782
|
// 这里改成动态 import,运行期才解析,彻底断开这条边。
|
|
783
783
|
share: create.asyncThunk(
|
|
784
784
|
async (config, thunkApi) => {
|
|
785
|
-
const { shareResourceAction } = await import("./action-
|
|
785
|
+
const { shareResourceAction } = await import("./action-BHWB4MOK.js");
|
|
786
786
|
return shareResourceAction(config, thunkApi);
|
|
787
787
|
}
|
|
788
788
|
),
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addContentToSpace
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YARN6MCX.js";
|
|
4
4
|
import {
|
|
5
5
|
format,
|
|
6
6
|
prepareAndPersistMessage,
|
|
7
7
|
uiAskChoiceFunc,
|
|
8
8
|
uiAskChoiceFunctionSchema
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-63JHZKGZ.js";
|
|
10
10
|
import {
|
|
11
11
|
formatISO
|
|
12
12
|
} from "./chunk-ZRAU6T47.js";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
removeCachedEntity,
|
|
17
17
|
upsertSSREntity,
|
|
18
18
|
write
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-B2N5GZBU.js";
|
|
20
20
|
import {
|
|
21
21
|
isDevelopment
|
|
22
22
|
} from "./chunk-6Q7UTJKR.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
} from "./chunk-PXYBUFDB.js";
|
|
26
26
|
import {
|
|
27
27
|
buildBuiltinObjectSkillReference
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-SM56M7N7.js";
|
|
29
29
|
import {
|
|
30
30
|
extractCustomId
|
|
31
31
|
} from "./chunk-M2EJHDJP.js";
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
createMemoryKey,
|
|
38
38
|
memoryOwnerRange,
|
|
39
39
|
memorySubjectKindRange
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-ECX3NKRD.js";
|
|
41
41
|
import {
|
|
42
42
|
createDialogKey,
|
|
43
43
|
dialogMessageRange
|
|
@@ -2990,6 +2990,47 @@ var createTokenKey = {
|
|
|
2990
2990
|
end: createKey("token", userId, "\uFFFF")
|
|
2991
2991
|
})
|
|
2992
2992
|
};
|
|
2993
|
+
var TOKEN_DIALOG_INDEX_PREFIX = "idx-token-dialog";
|
|
2994
|
+
var encodeTokenIndexSegment = (segment) => {
|
|
2995
|
+
let out = "";
|
|
2996
|
+
for (const ch of segment) {
|
|
2997
|
+
if (/[A-Za-z0-9]/.test(ch)) {
|
|
2998
|
+
out += ch;
|
|
2999
|
+
continue;
|
|
3000
|
+
}
|
|
3001
|
+
for (const byte of new TextEncoder().encode(ch)) {
|
|
3002
|
+
out += `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
return out;
|
|
3006
|
+
};
|
|
3007
|
+
var createTokenDialogIndexKey = Object.assign(
|
|
3008
|
+
(userId, dialogId, callId) => createKey(
|
|
3009
|
+
TOKEN_DIALOG_INDEX_PREFIX,
|
|
3010
|
+
encodeTokenIndexSegment(userId),
|
|
3011
|
+
encodeTokenIndexSegment(dialogId),
|
|
3012
|
+
encodeTokenIndexSegment(callId)
|
|
3013
|
+
),
|
|
3014
|
+
{
|
|
3015
|
+
/** 某个用户在某个对话下的全部索引项范围(范围扫描用) */
|
|
3016
|
+
rangeOfDialog: (userId, dialogId) => ({
|
|
3017
|
+
start: createKey(
|
|
3018
|
+
TOKEN_DIALOG_INDEX_PREFIX,
|
|
3019
|
+
encodeTokenIndexSegment(userId),
|
|
3020
|
+
encodeTokenIndexSegment(dialogId),
|
|
3021
|
+
""
|
|
3022
|
+
),
|
|
3023
|
+
end: createKey(
|
|
3024
|
+
TOKEN_DIALOG_INDEX_PREFIX,
|
|
3025
|
+
encodeTokenIndexSegment(userId),
|
|
3026
|
+
encodeTokenIndexSegment(dialogId),
|
|
3027
|
+
"\uFFFF"
|
|
3028
|
+
)
|
|
3029
|
+
})
|
|
3030
|
+
}
|
|
3031
|
+
);
|
|
3032
|
+
var TOKEN_DIALOG_INDEX_FORMAT = "v2";
|
|
3033
|
+
var createTokenDialogBackfillKey = (userId) => createKey("idx-tokendlg-backfill", encodeTokenIndexSegment(userId));
|
|
2993
3034
|
var createTokenStatsKey = Object.assign(
|
|
2994
3035
|
(userId, dateKey) => createKey("token", "stats", "day", "user", userId, dateKey),
|
|
2995
3036
|
{
|
|
@@ -3461,6 +3502,11 @@ export {
|
|
|
3461
3502
|
memorySubjectKindRange,
|
|
3462
3503
|
createTransactionKey,
|
|
3463
3504
|
createTokenKey,
|
|
3505
|
+
TOKEN_DIALOG_INDEX_PREFIX,
|
|
3506
|
+
encodeTokenIndexSegment,
|
|
3507
|
+
createTokenDialogIndexKey,
|
|
3508
|
+
TOKEN_DIALOG_INDEX_FORMAT,
|
|
3509
|
+
createTokenDialogBackfillKey,
|
|
3464
3510
|
createTokenStatsKey,
|
|
3465
3511
|
createTokenStatsAppliedKey,
|
|
3466
3512
|
isTokenStatsKey,
|