@zergai/ztc 0.16.0-beta.1 → 0.16.2-dev.202611091056
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 +9 -7
- package/bin/zmux-darwin-arm64 +0 -0
- package/bin/ztc-audio-darwin-arm64 +0 -0
- package/bin/ztc-capture-darwin-arm64 +0 -0
- package/bin/ztc-computer-darwin-arm64 +0 -0
- package/bin/ztc-llm-darwin-arm64 +0 -0
- package/bin/ztc-tts-darwin-arm64 +0 -0
- package/bin/ztc-tui-darwin-arm64 +0 -0
- package/bin/zterm-darwin-arm64 +0 -0
- package/dist/App.js +30 -10
- package/dist/agent/commands/accounts.js +3 -0
- package/dist/agent/commands/dictation.js +3 -3
- package/dist/agent/commands/environment.js +2 -0
- package/dist/agent/commands/profile.js +3 -0
- package/dist/agent/commands/rewind.js +2 -0
- package/dist/agent/commands/types.d.ts +18 -9
- package/dist/app/controller.d.ts +4 -2
- package/dist/app/controller.js +4 -1
- package/dist/cli_ratatui.d.ts +17 -2
- package/dist/cli_ratatui.js +147 -27
- package/dist/config.js +43 -17
- package/dist/headless.d.ts +4 -1
- package/dist/headless.js +8 -4
- package/dist/session_media.js +4 -1
- package/dist/types.d.ts +16 -0
- package/dist/utils/dictation.js +5 -2
- package/dist/zlm-embed.mjs +119 -105
- package/package.json +16 -8
package/dist/zlm-embed.mjs
CHANGED
|
@@ -2551,8 +2551,8 @@ async function readHttpErrorBody(response, signal) {
|
|
|
2551
2551
|
let body = "";
|
|
2552
2552
|
let bodyReadState = "complete";
|
|
2553
2553
|
let stopRead;
|
|
2554
|
-
const stopped = new Promise((
|
|
2555
|
-
stopRead =
|
|
2554
|
+
const stopped = new Promise((resolve22) => {
|
|
2555
|
+
stopRead = resolve22;
|
|
2556
2556
|
});
|
|
2557
2557
|
const timer = setTimeout(() => stopRead("timeout"), BODY_TIMEOUT_MS);
|
|
2558
2558
|
const aborted2 = () => stopRead("failed");
|
|
@@ -3592,10 +3592,10 @@ var init_codex_buffered_recovery = __esm({
|
|
|
3592
3592
|
return await complete();
|
|
3593
3593
|
} catch (error62) {
|
|
3594
3594
|
if (!this.canRecover() || !this.canPost()) throw error62;
|
|
3595
|
-
await new Promise((
|
|
3595
|
+
await new Promise((resolve22, reject) => {
|
|
3596
3596
|
const abort = () => reject(this.controller.signal.reason);
|
|
3597
3597
|
this.controller.signal.addEventListener("abort", abort, { once: true });
|
|
3598
|
-
void this.last.settled.then(
|
|
3598
|
+
void this.last.settled.then(resolve22, reject).finally(() => this.controller.signal.removeEventListener("abort", abort));
|
|
3599
3599
|
if (this.controller.signal.aborted) abort();
|
|
3600
3600
|
});
|
|
3601
3601
|
this.controller.signal.throwIfAborted();
|
|
@@ -3627,8 +3627,8 @@ var init_codex_buffered_recovery = __esm({
|
|
|
3627
3627
|
usage: "unknown"
|
|
3628
3628
|
};
|
|
3629
3629
|
let settle2;
|
|
3630
|
-
const settled = new Promise((
|
|
3631
|
-
settle2 =
|
|
3630
|
+
const settled = new Promise((resolve22) => {
|
|
3631
|
+
settle2 = resolve22;
|
|
3632
3632
|
});
|
|
3633
3633
|
this.last = { event, settled };
|
|
3634
3634
|
this.emit(event);
|
|
@@ -3867,14 +3867,14 @@ function throwIfRefreshAborted(signal) {
|
|
|
3867
3867
|
}
|
|
3868
3868
|
function awaitRefresh(refresh, signal) {
|
|
3869
3869
|
if (!signal) return refresh;
|
|
3870
|
-
return new Promise((
|
|
3870
|
+
return new Promise((resolve22, reject) => {
|
|
3871
3871
|
const cancelled = () => reject(new Error("Codex token refresh cancelled."));
|
|
3872
3872
|
if (signal.aborted) {
|
|
3873
3873
|
cancelled();
|
|
3874
3874
|
return;
|
|
3875
3875
|
}
|
|
3876
3876
|
signal.addEventListener("abort", cancelled, { once: true });
|
|
3877
|
-
void refresh.then(
|
|
3877
|
+
void refresh.then(resolve22, reject).finally(() => signal.removeEventListener("abort", cancelled));
|
|
3878
3878
|
});
|
|
3879
3879
|
}
|
|
3880
3880
|
function parseCodexAuthData(data) {
|
|
@@ -4734,8 +4734,8 @@ var init_codex_app_server = __esm({
|
|
|
4734
4734
|
if (this.closed) {
|
|
4735
4735
|
return Promise.resolve({ value: void 0, done: true });
|
|
4736
4736
|
}
|
|
4737
|
-
return new Promise((
|
|
4738
|
-
this.waiters.push({ resolve:
|
|
4737
|
+
return new Promise((resolve22, reject) => {
|
|
4738
|
+
this.waiters.push({ resolve: resolve22, reject });
|
|
4739
4739
|
});
|
|
4740
4740
|
}
|
|
4741
4741
|
};
|
|
@@ -5253,7 +5253,7 @@ var init_codex_app_server = __esm({
|
|
|
5253
5253
|
async request(method, params, onActivity) {
|
|
5254
5254
|
this.ensureTransport();
|
|
5255
5255
|
const id = this.nextRequestId++;
|
|
5256
|
-
const promise2 = new Promise((
|
|
5256
|
+
const promise2 = new Promise((resolve22, reject) => {
|
|
5257
5257
|
const timer = setTimeout(() => {
|
|
5258
5258
|
if (!this.pending.has(id)) return;
|
|
5259
5259
|
this.pending.delete(id);
|
|
@@ -5270,7 +5270,7 @@ var init_codex_app_server = __esm({
|
|
|
5270
5270
|
onActivity,
|
|
5271
5271
|
resolve: (value) => {
|
|
5272
5272
|
clearTimeout(timer);
|
|
5273
|
-
|
|
5273
|
+
resolve22(value);
|
|
5274
5274
|
},
|
|
5275
5275
|
reject: (error62) => {
|
|
5276
5276
|
clearTimeout(timer);
|
|
@@ -6106,7 +6106,7 @@ var init_kimi_code_auth = __esm({
|
|
|
6106
6106
|
});
|
|
6107
6107
|
let { status, data } = await post();
|
|
6108
6108
|
if (REFRESH_RETRYABLE_STATUSES.has(status)) {
|
|
6109
|
-
await new Promise((
|
|
6109
|
+
await new Promise((resolve22) => setTimeout(resolve22, 1e3));
|
|
6110
6110
|
({ status, data } = await post());
|
|
6111
6111
|
}
|
|
6112
6112
|
if (status === 200 && typeof data.access_token === "string") {
|
|
@@ -6540,10 +6540,10 @@ async function writeFileAtomic(path2, data, options = {}) {
|
|
|
6540
6540
|
const written = writeFileAsync(tmp, data);
|
|
6541
6541
|
try {
|
|
6542
6542
|
if (signal) {
|
|
6543
|
-
await new Promise((
|
|
6543
|
+
await new Promise((resolve22, reject) => {
|
|
6544
6544
|
const cancel = () => reject(signal.reason);
|
|
6545
6545
|
signal.addEventListener("abort", cancel, { once: true });
|
|
6546
|
-
void written.then(
|
|
6546
|
+
void written.then(resolve22, reject).finally(() => signal.removeEventListener("abort", cancel));
|
|
6547
6547
|
if (signal.aborted) cancel();
|
|
6548
6548
|
});
|
|
6549
6549
|
} else {
|
|
@@ -9920,8 +9920,8 @@ var init_status_line_config = __esm({
|
|
|
9920
9920
|
});
|
|
9921
9921
|
|
|
9922
9922
|
// src/config.ts
|
|
9923
|
-
import { dirname as dirname7, join as join12 } from "path";
|
|
9924
|
-
import { stat, readFile as readFile2, writeFile as writeFile3, mkdir as mkdir3,
|
|
9923
|
+
import { dirname as dirname7, join as join12, resolve as resolve5 } from "path";
|
|
9924
|
+
import { stat, readFile as readFile2, readlink, writeFile as writeFile3, mkdir as mkdir3, rm, unlink as unlink4, rename as rename3, realpath } from "fs/promises";
|
|
9925
9925
|
import { statSync as statSync2 } from "fs";
|
|
9926
9926
|
import { homedir as homedir5 } from "os";
|
|
9927
9927
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
@@ -10107,12 +10107,7 @@ function migrateSettingsDefaults(saved2) {
|
|
|
10107
10107
|
return migrated;
|
|
10108
10108
|
}
|
|
10109
10109
|
async function replaceSettingsFile(path2, text5) {
|
|
10110
|
-
|
|
10111
|
-
try {
|
|
10112
|
-
target = await realpath(path2);
|
|
10113
|
-
} catch (error62) {
|
|
10114
|
-
if (error62.code !== "ENOENT") throw error62;
|
|
10115
|
-
}
|
|
10110
|
+
const target = await settingsFileTarget(path2);
|
|
10116
10111
|
const temporary = `${target}.${process.pid}.${randomUUID3()}.tmp`;
|
|
10117
10112
|
try {
|
|
10118
10113
|
await writeFile3(temporary, text5, { encoding: "utf-8", mode: 384, flag: "wx" });
|
|
@@ -10125,6 +10120,26 @@ async function replaceSettingsFile(path2, text5) {
|
|
|
10125
10120
|
}
|
|
10126
10121
|
}
|
|
10127
10122
|
}
|
|
10123
|
+
async function settingsFileTarget(path2) {
|
|
10124
|
+
try {
|
|
10125
|
+
return await realpath(path2);
|
|
10126
|
+
} catch (error62) {
|
|
10127
|
+
if (error62.code !== "ENOENT") throw error62;
|
|
10128
|
+
}
|
|
10129
|
+
let target = path2;
|
|
10130
|
+
for (let links = 0; links < 32; links += 1) {
|
|
10131
|
+
let link;
|
|
10132
|
+
try {
|
|
10133
|
+
link = await readlink(target);
|
|
10134
|
+
} catch (error62) {
|
|
10135
|
+
const code = error62.code;
|
|
10136
|
+
if (code === "ENOENT" || code === "EINVAL") return target;
|
|
10137
|
+
throw error62;
|
|
10138
|
+
}
|
|
10139
|
+
target = resolve5(dirname7(target), link);
|
|
10140
|
+
}
|
|
10141
|
+
throw Object.assign(new Error(`Too many symbolic links: ${path2}`), { code: "ELOOP" });
|
|
10142
|
+
}
|
|
10128
10143
|
async function writeBackupOnce(path2, text5) {
|
|
10129
10144
|
try {
|
|
10130
10145
|
await writeFile3(path2, text5, { encoding: "utf-8", mode: 384, flag: "wx" });
|
|
@@ -10831,8 +10846,7 @@ var init_config = __esm({
|
|
|
10831
10846
|
if (saved2 === void 0) delete record11[key];
|
|
10832
10847
|
else record11[key] = saved2;
|
|
10833
10848
|
}
|
|
10834
|
-
await
|
|
10835
|
-
await chmod2(path2, 384);
|
|
10849
|
+
await replaceSettingsFile(path2, JSON.stringify(toSave, null, 2));
|
|
10836
10850
|
} catch (err) {
|
|
10837
10851
|
runtimeDiag("error", `Failed to save config: ${err?.message ?? err}`);
|
|
10838
10852
|
}
|
|
@@ -12713,10 +12727,10 @@ function reconnectDelay(policy, attempt) {
|
|
|
12713
12727
|
}
|
|
12714
12728
|
async function waitForReconnect(delayMs, signal) {
|
|
12715
12729
|
if (signal?.aborted) throw signal.reason;
|
|
12716
|
-
await new Promise((
|
|
12730
|
+
await new Promise((resolve22, reject) => {
|
|
12717
12731
|
const finish = () => {
|
|
12718
12732
|
signal?.removeEventListener("abort", abort);
|
|
12719
|
-
|
|
12733
|
+
resolve22();
|
|
12720
12734
|
};
|
|
12721
12735
|
const timeout = setTimeout(finish, delayMs);
|
|
12722
12736
|
const abort = () => {
|
|
@@ -13942,14 +13956,14 @@ var init_zlm_stdio = __esm({
|
|
|
13942
13956
|
|
|
13943
13957
|
// src/zlm.ts
|
|
13944
13958
|
import { realpathSync as realpathSync6 } from "node:fs";
|
|
13945
|
-
import { resolve as
|
|
13959
|
+
import { resolve as resolve21 } from "node:path";
|
|
13946
13960
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
13947
13961
|
|
|
13948
13962
|
// src/agent/agent.ts
|
|
13949
13963
|
import { createHash as createHash21, randomUUID as randomUUID13 } from "node:crypto";
|
|
13950
13964
|
import { isDeepStrictEqual as isDeepStrictEqual4 } from "node:util";
|
|
13951
13965
|
import { existsSync as existsSync6, readFileSync as readFileSync9, realpathSync as realpathSync5 } from "fs";
|
|
13952
|
-
import { extname, resolve as
|
|
13966
|
+
import { extname, resolve as resolve18 } from "path";
|
|
13953
13967
|
|
|
13954
13968
|
// src/session_handoff_contract.ts
|
|
13955
13969
|
var TASK_HANDOFF_MAX_BYTES = 32 * 1024;
|
|
@@ -14407,14 +14421,14 @@ import { join as join15 } from "node:path";
|
|
|
14407
14421
|
|
|
14408
14422
|
// src/utils/shell.ts
|
|
14409
14423
|
import { spawn as spawn2 } from "child_process";
|
|
14410
|
-
import { resolve as
|
|
14424
|
+
import { resolve as resolve7, sep as sep2 } from "path";
|
|
14411
14425
|
import { homedir as homedir7 } from "os";
|
|
14412
14426
|
|
|
14413
14427
|
// src/utils/sandbox.ts
|
|
14414
14428
|
import { existsSync as existsSync3, mkdirSync as mkdirSync4, mkdtempSync, realpathSync, rmSync, statSync as statSync3, writeFileSync as writeFileSync5 } from "fs";
|
|
14415
14429
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
14416
14430
|
import { homedir as homedir6, tmpdir as tmpdir2 } from "os";
|
|
14417
|
-
import { basename as basename2, dirname as dirname8, join as join13, resolve as
|
|
14431
|
+
import { basename as basename2, dirname as dirname8, join as join13, resolve as resolve6, sep } from "path";
|
|
14418
14432
|
import { spawnSync } from "child_process";
|
|
14419
14433
|
|
|
14420
14434
|
// src/utils/subprocess_env.ts
|
|
@@ -14537,7 +14551,7 @@ function schemeString(value) {
|
|
|
14537
14551
|
}
|
|
14538
14552
|
function normalizeRoot(root, cwd) {
|
|
14539
14553
|
const expanded = root === "~" ? homedir6() : root.replace(/^~(?=\/|$)/, homedir6());
|
|
14540
|
-
return
|
|
14554
|
+
return resolve6(expanded.startsWith(sep) ? expanded : resolve6(cwd, expanded));
|
|
14541
14555
|
}
|
|
14542
14556
|
function profileAllowsNetwork(profile) {
|
|
14543
14557
|
return profile?.capabilities?.network !== false;
|
|
@@ -14572,7 +14586,7 @@ function selectedDeveloperReadRoots(cwd, env = process.env) {
|
|
|
14572
14586
|
if (result.error || result.status !== 0) return [];
|
|
14573
14587
|
const selected = result.stdout.trim();
|
|
14574
14588
|
if (!selected) return [];
|
|
14575
|
-
const developer = realpathSync(
|
|
14589
|
+
const developer = realpathSync(resolve6(cwd, selected));
|
|
14576
14590
|
if (basename2(developer) !== "Developer" || basename2(dirname8(developer)) !== "Contents" || !basename2(dirname8(dirname8(developer))).endsWith(".app")) return [];
|
|
14577
14591
|
const bin = realpathSync(join13(developer, "usr", "bin"));
|
|
14578
14592
|
const library = realpathSync(join13(developer, "usr", "lib", "libxcrun.dylib"));
|
|
@@ -15161,7 +15175,7 @@ function evaluateCommandSafety(command, cwd) {
|
|
|
15161
15175
|
return { allowed: false, rule: "fork-bomb", token: ":(){:|:&};:" };
|
|
15162
15176
|
}
|
|
15163
15177
|
const home = homedir7();
|
|
15164
|
-
const cwdResolved =
|
|
15178
|
+
const cwdResolved = resolve7(cwd);
|
|
15165
15179
|
for (const segment of shellSegments(command)) {
|
|
15166
15180
|
const program = commandProgram(segment);
|
|
15167
15181
|
if (program === "mkfs" || program.startsWith("mkfs.")) {
|
|
@@ -15174,8 +15188,8 @@ function evaluateCommandSafety(command, cwd) {
|
|
|
15174
15188
|
const isForce = flags.some((flag) => flag.replace(/^-+/, "").toLowerCase().includes("f"));
|
|
15175
15189
|
if (!isRecursive2 || !isForce) continue;
|
|
15176
15190
|
for (const rawTarget of words.slice(1).filter((word) => !word.startsWith("-"))) {
|
|
15177
|
-
const resolvedTarget =
|
|
15178
|
-
if (resolvedTarget ===
|
|
15191
|
+
const resolvedTarget = resolve7(cwdResolved, expandTarget(rawTarget, home));
|
|
15192
|
+
if (resolvedTarget === resolve7(home) || PROTECTED_ROOTS.includes(resolvedTarget)) {
|
|
15179
15193
|
return { allowed: false, rule: "rm-recursive-system-root", token: rawTarget };
|
|
15180
15194
|
}
|
|
15181
15195
|
if (resolvedTarget === cwdResolved || cwdResolved.startsWith(resolvedTarget + sep2)) {
|
|
@@ -15279,7 +15293,7 @@ async function runShellCommand(command, cwd, signal, timeoutMs, sandboxOptions)
|
|
|
15279
15293
|
if (!stageVerdict.allowed) throw new Error(`Command rejected for safety rule ${stageVerdict.rule}: ${stageVerdict.token}`);
|
|
15280
15294
|
}
|
|
15281
15295
|
const subprocessEnv = buildUserSubprocessEnv(env ?? (temporaryWriteRoot === void 0 ? buildUserSubprocessEnv() : buildTemporaryWriteRootSubprocessEnv(temporaryWriteRoot)));
|
|
15282
|
-
const effectiveCwd = DOCKER_CONTAINER ? cwd.startsWith("/") ? cwd : `${DOCKER_WORKDIR}/${cwd}` :
|
|
15296
|
+
const effectiveCwd = DOCKER_CONTAINER ? cwd.startsWith("/") ? cwd : `${DOCKER_WORKDIR}/${cwd}` : resolve7(cwd);
|
|
15283
15297
|
const effectiveCommand = coordinator?.command ?? (DOCKER_CONTAINER ? wrapForDocker(command, effectiveCwd) : command);
|
|
15284
15298
|
const sandboxPlan = DOCKER_CONTAINER ? buildSandboxCommandPlan(effectiveCommand, process.cwd(), {
|
|
15285
15299
|
...sandboxCommandOptions,
|
|
@@ -15360,7 +15374,7 @@ async function runShellCommand(command, cwd, signal, timeoutMs, sandboxOptions)
|
|
|
15360
15374
|
let termination;
|
|
15361
15375
|
const escalateKill = () => {
|
|
15362
15376
|
if (termination) return;
|
|
15363
|
-
termination = new Promise((
|
|
15377
|
+
termination = new Promise((resolve22) => {
|
|
15364
15378
|
if (child.pid) killGroup(child.pid, "SIGTERM");
|
|
15365
15379
|
killTimer = setTimeout(() => {
|
|
15366
15380
|
if (child.pid) {
|
|
@@ -15373,7 +15387,7 @@ async function runShellCommand(command, cwd, signal, timeoutMs, sandboxOptions)
|
|
|
15373
15387
|
killGroup(child.pid, "SIGKILL");
|
|
15374
15388
|
}
|
|
15375
15389
|
}
|
|
15376
|
-
|
|
15390
|
+
resolve22();
|
|
15377
15391
|
}, executionPolicy.cleanup.term_grace_ms);
|
|
15378
15392
|
});
|
|
15379
15393
|
};
|
|
@@ -15521,7 +15535,7 @@ import { execFile } from "node:child_process";
|
|
|
15521
15535
|
import { createHash as createHash10, randomUUID as randomUUID7 } from "node:crypto";
|
|
15522
15536
|
import { constants as constants2 } from "node:fs";
|
|
15523
15537
|
import { lstat as lstat3, open as open2, realpath as realpath2 } from "node:fs/promises";
|
|
15524
|
-
import { dirname as dirname10, isAbsolute as isAbsolute3, relative, resolve as
|
|
15538
|
+
import { dirname as dirname10, isAbsolute as isAbsolute3, relative, resolve as resolve8 } from "node:path";
|
|
15525
15539
|
import { promisify as promisify2 } from "node:util";
|
|
15526
15540
|
init_source_verification_contract();
|
|
15527
15541
|
var SOURCE_FILE_MAX_BYTES = 2 * 1024 * 1024;
|
|
@@ -15582,7 +15596,7 @@ function sealSnapshot(snapshot2) {
|
|
|
15582
15596
|
return parsed;
|
|
15583
15597
|
}
|
|
15584
15598
|
async function captureSourceSnapshot(cwd, sourcePaths, options = {}) {
|
|
15585
|
-
const root = await realpath2(
|
|
15599
|
+
const root = await realpath2(resolve8(cwd));
|
|
15586
15600
|
const paths = [...sourcePaths].sort();
|
|
15587
15601
|
if (paths.length < 1 || paths.length > 64 || new Set(paths).size !== paths.length || paths.some((path2) => !path2 || Buffer.byteLength(path2) > 512 || /[\\\u0000-\u001f\u007f]/u.test(path2) || /^[A-Za-z]:/.test(path2) || path2.split("/").some((part) => !part || part === "." || part === ".."))) {
|
|
15588
15602
|
throw new Error("Source verification requires 1\u201364 unique relative scoped file paths");
|
|
@@ -15608,11 +15622,11 @@ async function captureSourceSnapshot(cwd, sourcePaths, options = {}) {
|
|
|
15608
15622
|
if (Buffer.byteLength(JSON.stringify(worst)) > SOURCE_SNAPSHOT_MAX_BYTES) {
|
|
15609
15623
|
throw new Error("Source verification snapshot metadata exceeds 16KiB; narrow source_paths");
|
|
15610
15624
|
}
|
|
15611
|
-
for (const path2 of paths) await assertScopedLocation(root,
|
|
15625
|
+
for (const path2 of paths) await assertScopedLocation(root, resolve8(root, path2));
|
|
15612
15626
|
const files = [];
|
|
15613
15627
|
let remaining = SOURCE_CAPTURE_MAX_BYTES;
|
|
15614
15628
|
for (const path2 of paths) {
|
|
15615
|
-
const absolute =
|
|
15629
|
+
const absolute = resolve8(root, path2);
|
|
15616
15630
|
let row = { path: path2, kind: "unavailable", sha256: null, bytes: 0, mode: 0 };
|
|
15617
15631
|
try {
|
|
15618
15632
|
await assertScopedLocation(root, absolute);
|
|
@@ -16000,8 +16014,8 @@ async function readCommandJob(sessionId, jobId, cursor = 0, waitMs = 0, signal,
|
|
|
16000
16014
|
let timer;
|
|
16001
16015
|
let onAbort;
|
|
16002
16016
|
try {
|
|
16003
|
-
await Promise.race([job.done, new Promise((
|
|
16004
|
-
timer = setTimeout(
|
|
16017
|
+
await Promise.race([job.done, new Promise((resolve22, reject) => {
|
|
16018
|
+
timer = setTimeout(resolve22, waitMs);
|
|
16005
16019
|
onAbort = () => reject(cancelled());
|
|
16006
16020
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
16007
16021
|
})]);
|
|
@@ -16054,7 +16068,7 @@ async function waitForCommandProgress(sessionId, jobId, options) {
|
|
|
16054
16068
|
if (options.canInspectVerificationSource) job.canInspectVerificationSource = options.canInspectVerificationSource;
|
|
16055
16069
|
const cancelled = () => new Error(`Command read cancelled; inspect job ${jobId} before retrying. The job may still be running.`);
|
|
16056
16070
|
if (options.signal?.aborted) throw cancelled();
|
|
16057
|
-
const progress = await new Promise((
|
|
16071
|
+
const progress = await new Promise((resolve22, reject) => {
|
|
16058
16072
|
let settled = false;
|
|
16059
16073
|
let timer;
|
|
16060
16074
|
const cleanup = () => {
|
|
@@ -16080,7 +16094,7 @@ async function waitForCommandProgress(sessionId, jobId, options) {
|
|
|
16080
16094
|
const reason = result2.status !== "running" ? "terminal" : result2.output.length > 0 ? "output" : deadline ? "deadline" : null;
|
|
16081
16095
|
if (reason !== null) {
|
|
16082
16096
|
cleanup();
|
|
16083
|
-
|
|
16097
|
+
resolve22({ reason, result: result2 });
|
|
16084
16098
|
}
|
|
16085
16099
|
} catch (error62) {
|
|
16086
16100
|
cleanup();
|
|
@@ -21331,7 +21345,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
21331
21345
|
var NONE = 0;
|
|
21332
21346
|
var ASSUMED = 1;
|
|
21333
21347
|
var PROVEN = 2;
|
|
21334
|
-
function isRecursive(inst, stack,
|
|
21348
|
+
function isRecursive(inst, stack, resolve22) {
|
|
21335
21349
|
const cached3 = recursive.get(inst);
|
|
21336
21350
|
if (cached3 !== void 0)
|
|
21337
21351
|
return cached3 ? PROVEN : NONE;
|
|
@@ -21341,7 +21355,7 @@ function isRecursive(inst, stack, resolve21) {
|
|
|
21341
21355
|
let result = NONE;
|
|
21342
21356
|
const check2 = (child) => {
|
|
21343
21357
|
if (result !== PROVEN && child?._zod) {
|
|
21344
|
-
const answer = isRecursive(child, stack,
|
|
21358
|
+
const answer = isRecursive(child, stack, resolve22);
|
|
21345
21359
|
if (answer > result)
|
|
21346
21360
|
result = answer;
|
|
21347
21361
|
}
|
|
@@ -21352,7 +21366,7 @@ function isRecursive(inst, stack, resolve21) {
|
|
|
21352
21366
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
21353
21367
|
if (spread && !desc.enumerable)
|
|
21354
21368
|
continue;
|
|
21355
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
21369
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve22) : NONE;
|
|
21356
21370
|
if (child > answer)
|
|
21357
21371
|
answer = child;
|
|
21358
21372
|
}
|
|
@@ -21416,7 +21430,7 @@ function isRecursive(inst, stack, resolve21) {
|
|
|
21416
21430
|
break;
|
|
21417
21431
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
21418
21432
|
case "lazy": {
|
|
21419
|
-
const inner = def._cachedInner ?? (
|
|
21433
|
+
const inner = def._cachedInner ?? (resolve22 ? inst._zod.innerType : void 0);
|
|
21420
21434
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
21421
21435
|
break;
|
|
21422
21436
|
}
|
|
@@ -36146,7 +36160,7 @@ function commandStillRunning(content2) {
|
|
|
36146
36160
|
init_capabilities();
|
|
36147
36161
|
init_checked_commands();
|
|
36148
36162
|
import { homedir as homedir9 } from "os";
|
|
36149
|
-
import { resolve as
|
|
36163
|
+
import { resolve as resolve9, isAbsolute as isAbsolute4, sep as sep3 } from "path";
|
|
36150
36164
|
var AllowAllPolicy = class {
|
|
36151
36165
|
evaluateTool() {
|
|
36152
36166
|
return { allowed: true };
|
|
@@ -36304,7 +36318,7 @@ function extractPathArgs(args, executionCwd) {
|
|
|
36304
36318
|
}
|
|
36305
36319
|
function normalizeRoot2(path2, cwd) {
|
|
36306
36320
|
const expanded = path2 === "~" ? homedir9() : path2.replace(/^~(?=\/|$)/, homedir9());
|
|
36307
|
-
return
|
|
36321
|
+
return resolve9(isAbsolute4(expanded) ? expanded : resolve9(cwd, expanded));
|
|
36308
36322
|
}
|
|
36309
36323
|
function isWithinRoot(path2, root) {
|
|
36310
36324
|
return path2 === root || path2.startsWith(root.endsWith(sep3) ? root : `${root}${sep3}`);
|
|
@@ -36952,16 +36966,16 @@ import {
|
|
|
36952
36966
|
readSync as readSync3,
|
|
36953
36967
|
realpathSync as realpathSync3
|
|
36954
36968
|
} from "node:fs";
|
|
36955
|
-
import { basename as basename5, dirname as dirname12, isAbsolute as isAbsolute5, join as join18, resolve as
|
|
36969
|
+
import { basename as basename5, dirname as dirname12, isAbsolute as isAbsolute5, join as join18, resolve as resolve11, sep as sep5 } from "node:path";
|
|
36956
36970
|
|
|
36957
36971
|
// src/utils/mirror_media.ts
|
|
36958
36972
|
import { tmpdir as tmpdir3 } from "os";
|
|
36959
|
-
import { join as join17, resolve as
|
|
36973
|
+
import { join as join17, resolve as resolve10, sep as sep4 } from "path";
|
|
36960
36974
|
var MIRROR_MEDIA_ROOT = join17(tmpdir3(), "ztc-mirror-media");
|
|
36961
36975
|
function isMirrorMediaPath(localPath) {
|
|
36962
36976
|
if (!localPath) return false;
|
|
36963
|
-
const root =
|
|
36964
|
-
const target =
|
|
36977
|
+
const root = resolve10(MIRROR_MEDIA_ROOT);
|
|
36978
|
+
const target = resolve10(localPath);
|
|
36965
36979
|
return target === root || target.startsWith(root + sep4);
|
|
36966
36980
|
}
|
|
36967
36981
|
|
|
@@ -37278,7 +37292,7 @@ init_capabilities();
|
|
|
37278
37292
|
// src/agent/tools/file.ts
|
|
37279
37293
|
init_capabilities();
|
|
37280
37294
|
import { readFile as readFile3, readdir as readdir2, stat as stat2 } from "fs/promises";
|
|
37281
|
-
import { basename as basename6, dirname as dirname13, resolve as
|
|
37295
|
+
import { basename as basename6, dirname as dirname13, resolve as resolve13, posix as posix2 } from "path";
|
|
37282
37296
|
import { homedir as homedir10 } from "os";
|
|
37283
37297
|
import { createHash as createHash15, randomBytes as randomBytes3 } from "crypto";
|
|
37284
37298
|
import { exec as exec2 } from "child_process";
|
|
@@ -37492,15 +37506,15 @@ function describeEdit(beforeContent, afterContent) {
|
|
|
37492
37506
|
|
|
37493
37507
|
// src/utils/temporary_write_root.ts
|
|
37494
37508
|
import { lstat as lstat4, mkdir as mkdir4 } from "fs/promises";
|
|
37495
|
-
import { parse as parse4, resolve as
|
|
37509
|
+
import { parse as parse4, resolve as resolve12, sep as sep6 } from "path";
|
|
37496
37510
|
function isPathWithinRoot(path2, root) {
|
|
37497
|
-
const normalizedPath =
|
|
37498
|
-
const normalizedRoot =
|
|
37511
|
+
const normalizedPath = resolve12(path2);
|
|
37512
|
+
const normalizedRoot = resolve12(root);
|
|
37499
37513
|
return normalizedPath === normalizedRoot || normalizedPath.startsWith(normalizedRoot.endsWith(sep6) ? normalizedRoot : `${normalizedRoot}${sep6}`);
|
|
37500
37514
|
}
|
|
37501
37515
|
async function assertTemporaryWritePathAllowed(target, root, action) {
|
|
37502
|
-
const resolvedRoot =
|
|
37503
|
-
const resolvedTarget =
|
|
37516
|
+
const resolvedRoot = resolve12(root);
|
|
37517
|
+
const resolvedTarget = resolve12(target);
|
|
37504
37518
|
if (!isPathWithinRoot(resolvedTarget, resolvedRoot)) {
|
|
37505
37519
|
throw new Error(`${action} denied: path is outside temporary write root (${resolvedRoot})`);
|
|
37506
37520
|
}
|
|
@@ -37514,7 +37528,7 @@ async function assertTemporaryWritePathAllowed(target, root, action) {
|
|
|
37514
37528
|
});
|
|
37515
37529
|
}
|
|
37516
37530
|
async function assertTemporaryRootSafe(root, action) {
|
|
37517
|
-
const resolvedRoot =
|
|
37531
|
+
const resolvedRoot = resolve12(root);
|
|
37518
37532
|
await assertPathComponentsHaveNoSymlinks(resolvedRoot, {
|
|
37519
37533
|
allowMissingTail: false,
|
|
37520
37534
|
errorPrefix: `${action} denied: temporary write root`
|
|
@@ -37522,7 +37536,7 @@ async function assertTemporaryRootSafe(root, action) {
|
|
|
37522
37536
|
return resolvedRoot;
|
|
37523
37537
|
}
|
|
37524
37538
|
async function assertPathComponentsHaveNoSymlinks(path2, options) {
|
|
37525
|
-
for (const component of pathComponentPrefixes(
|
|
37539
|
+
for (const component of pathComponentPrefixes(resolve12(path2))) {
|
|
37526
37540
|
try {
|
|
37527
37541
|
const info = await lstat4(component);
|
|
37528
37542
|
if (info.isSymbolicLink()) {
|
|
@@ -37547,7 +37561,7 @@ function pathComponentPrefixes(path2) {
|
|
|
37547
37561
|
const prefixes = [parsed.root];
|
|
37548
37562
|
let current = parsed.root;
|
|
37549
37563
|
for (const component of components) {
|
|
37550
|
-
current =
|
|
37564
|
+
current = resolve12(current, component);
|
|
37551
37565
|
prefixes.push(current);
|
|
37552
37566
|
}
|
|
37553
37567
|
return prefixes;
|
|
@@ -37606,7 +37620,7 @@ function countNewlines(content2, end = content2.length) {
|
|
|
37606
37620
|
}
|
|
37607
37621
|
function expandTilde(path2) {
|
|
37608
37622
|
if (path2.startsWith("~/")) {
|
|
37609
|
-
return
|
|
37623
|
+
return resolve13(homedir10(), path2.slice(2));
|
|
37610
37624
|
}
|
|
37611
37625
|
if (path2 === "~") {
|
|
37612
37626
|
return homedir10();
|
|
@@ -37622,7 +37636,7 @@ function resolvePath(path2, context) {
|
|
|
37622
37636
|
}
|
|
37623
37637
|
const expanded = expandTilde(path2);
|
|
37624
37638
|
const base = context?.cwd || process.cwd();
|
|
37625
|
-
return
|
|
37639
|
+
return resolve13(base, expanded);
|
|
37626
37640
|
}
|
|
37627
37641
|
async function assertTemporaryWriteAllowed(path2, context) {
|
|
37628
37642
|
if (context?.temporaryWriteRoot === void 0) return;
|
|
@@ -38078,7 +38092,7 @@ var listDirectoryTool = {
|
|
|
38078
38092
|
if (entries.length > 100) truncated = true;
|
|
38079
38093
|
const results = [];
|
|
38080
38094
|
for (const entry of entries.slice(0, 100)) {
|
|
38081
|
-
const entryPath =
|
|
38095
|
+
const entryPath = resolve13(dir, entry.name);
|
|
38082
38096
|
const info = {
|
|
38083
38097
|
name: entry.name,
|
|
38084
38098
|
type: entry.isDirectory() ? "directory" : "file"
|
|
@@ -38105,7 +38119,7 @@ var listDirectoryTool = {
|
|
|
38105
38119
|
|
|
38106
38120
|
// src/agent/tools/shell.ts
|
|
38107
38121
|
init_capabilities();
|
|
38108
|
-
import { resolve as
|
|
38122
|
+
import { resolve as resolve14 } from "path";
|
|
38109
38123
|
init_config();
|
|
38110
38124
|
init_checked_commands();
|
|
38111
38125
|
init_source_verification_contract();
|
|
@@ -38410,7 +38424,7 @@ function resolveRunCommandCwd(args, context) {
|
|
|
38410
38424
|
const docker = dockerTarget();
|
|
38411
38425
|
if (docker) return containerPath(docker, args.cwd ? String(args.cwd) : ".");
|
|
38412
38426
|
const baseCwd = context?.cwd || process.cwd();
|
|
38413
|
-
return args.cwd ?
|
|
38427
|
+
return args.cwd ? resolve14(baseCwd, String(args.cwd)) : baseCwd;
|
|
38414
38428
|
}
|
|
38415
38429
|
var runCommandTool = {
|
|
38416
38430
|
isErrorResult: failedCommandReceipt,
|
|
@@ -38522,7 +38536,7 @@ var runCommandTool = {
|
|
|
38522
38536
|
throw new Error(`run_command: command argument is invalid: "${command}"`);
|
|
38523
38537
|
}
|
|
38524
38538
|
const cwd = resolveRunCommandCwd(args, context);
|
|
38525
|
-
const temporaryWriteRoot = context?.temporaryWriteRoot === void 0 ? void 0 :
|
|
38539
|
+
const temporaryWriteRoot = context?.temporaryWriteRoot === void 0 ? void 0 : resolve14(context.temporaryWriteRoot);
|
|
38526
38540
|
if (temporaryWriteRoot !== void 0) {
|
|
38527
38541
|
await assertTemporaryRootSafe(temporaryWriteRoot, "run_command");
|
|
38528
38542
|
if (!isPathWithinRoot(cwd, temporaryWriteRoot)) {
|
|
@@ -39337,8 +39351,8 @@ var BackgroundWorkers = class {
|
|
|
39337
39351
|
if (this.running.size > 0) {
|
|
39338
39352
|
const wait = Math.max(0, this.lastCheckAt + this.checkIntervalMs - this.now());
|
|
39339
39353
|
let timer;
|
|
39340
|
-
await Promise.race([all, new Promise((
|
|
39341
|
-
timer = setTimeout(
|
|
39354
|
+
await Promise.race([all, new Promise((resolve22) => {
|
|
39355
|
+
timer = setTimeout(resolve22, wait);
|
|
39342
39356
|
})]);
|
|
39343
39357
|
clearTimeout(timer);
|
|
39344
39358
|
}
|
|
@@ -39377,7 +39391,7 @@ init_loop_policy();
|
|
|
39377
39391
|
init_tool_compression();
|
|
39378
39392
|
|
|
39379
39393
|
// src/agent/runtime/tool_runtime.ts
|
|
39380
|
-
import { basename as basename8, dirname as dirname16, join as join22, relative as relative3, resolve as
|
|
39394
|
+
import { basename as basename8, dirname as dirname16, join as join22, relative as relative3, resolve as resolve17 } from "path";
|
|
39381
39395
|
import { realpathSync as realpathSync4 } from "node:fs";
|
|
39382
39396
|
import { appendFile } from "node:fs/promises";
|
|
39383
39397
|
|
|
@@ -39403,7 +39417,7 @@ init_config();
|
|
|
39403
39417
|
|
|
39404
39418
|
// src/context/intents_loader.ts
|
|
39405
39419
|
import { appendFileSync as appendFileSync5, existsSync as existsSync5, mkdirSync as mkdirSync7, readFileSync as readFileSync8, statSync as statSync5, writeFileSync as writeFileSync8 } from "fs";
|
|
39406
|
-
import { basename as basename7, dirname as dirname14, join as join19, relative as relative2, resolve as
|
|
39420
|
+
import { basename as basename7, dirname as dirname14, join as join19, relative as relative2, resolve as resolve15 } from "path";
|
|
39407
39421
|
var DEFAULT_MAX_BYTES = 32 * 1024;
|
|
39408
39422
|
var DEFAULT_FILE_INTENT_THRESHOLD_LINES = 400;
|
|
39409
39423
|
function loadIntentsContext(cwd = process.cwd(), settings, options = {}) {
|
|
@@ -39457,7 +39471,7 @@ function maybeAutoUpdateIntents(options) {
|
|
|
39457
39471
|
if (isIntentFile(changedPath)) {
|
|
39458
39472
|
continue;
|
|
39459
39473
|
}
|
|
39460
|
-
const absolutePath =
|
|
39474
|
+
const absolutePath = resolve15(options.cwd, changedPath);
|
|
39461
39475
|
const target = selectIntentTarget(options.cwd, absolutePath, threshold);
|
|
39462
39476
|
ensureIntentFile(target);
|
|
39463
39477
|
const relChanged = relative2(options.cwd, absolutePath) || basename7(absolutePath);
|
|
@@ -39472,13 +39486,13 @@ function buildIntentCandidates(cwd, relatedPaths, includeHierarchy) {
|
|
|
39472
39486
|
const seen = /* @__PURE__ */ new Set();
|
|
39473
39487
|
const candidates = [];
|
|
39474
39488
|
if (includeHierarchy) {
|
|
39475
|
-
const roots = findRootToCwd(
|
|
39489
|
+
const roots = findRootToCwd(resolve15(cwd));
|
|
39476
39490
|
for (const dir of roots) {
|
|
39477
39491
|
pushUnique(candidates, seen, join19(dir, ".ztc-intents.md"));
|
|
39478
39492
|
}
|
|
39479
39493
|
}
|
|
39480
39494
|
for (const relatedPath of relatedPaths) {
|
|
39481
|
-
const absolutePath =
|
|
39495
|
+
const absolutePath = resolve15(cwd, relatedPath);
|
|
39482
39496
|
pushUnique(candidates, seen, fileIntentPath(absolutePath));
|
|
39483
39497
|
}
|
|
39484
39498
|
return candidates;
|
|
@@ -39504,8 +39518,8 @@ function selectIntentTarget(cwd, absolutePath, threshold) {
|
|
|
39504
39518
|
return fileIntentPath(absolutePath);
|
|
39505
39519
|
}
|
|
39506
39520
|
const dir = existsSync5(absolutePath) && statSync5(absolutePath).isDirectory() ? absolutePath : dirname14(absolutePath);
|
|
39507
|
-
const normalizedCwd =
|
|
39508
|
-
const normalizedDir =
|
|
39521
|
+
const normalizedCwd = resolve15(cwd);
|
|
39522
|
+
const normalizedDir = resolve15(dir);
|
|
39509
39523
|
if (!isInside(normalizedDir, normalizedCwd)) {
|
|
39510
39524
|
return join19(normalizedCwd, ".ztc-intents.md");
|
|
39511
39525
|
}
|
|
@@ -39567,7 +39581,7 @@ function loadBudgetedFile(path2, maxBytes) {
|
|
|
39567
39581
|
}
|
|
39568
39582
|
}
|
|
39569
39583
|
function pushUnique(paths, seen, path2) {
|
|
39570
|
-
const normalized =
|
|
39584
|
+
const normalized = resolve15(path2);
|
|
39571
39585
|
if (seen.has(normalized)) {
|
|
39572
39586
|
return;
|
|
39573
39587
|
}
|
|
@@ -39968,7 +39982,7 @@ init_source_verification_contract();
|
|
|
39968
39982
|
import { createHash as createHash18 } from "node:crypto";
|
|
39969
39983
|
import { constants as constants4 } from "node:fs";
|
|
39970
39984
|
import { lstat as lstat5, open as open4, realpath as realpath3 } from "node:fs/promises";
|
|
39971
|
-
import { dirname as dirname15, resolve as
|
|
39985
|
+
import { dirname as dirname15, resolve as resolve16 } from "node:path";
|
|
39972
39986
|
var VERIFIER_INPUT_MAX_BYTES = 65536;
|
|
39973
39987
|
var hash4 = (bytes4) => createHash18("sha256").update(bytes4).digest("hex");
|
|
39974
39988
|
function seal(source2) {
|
|
@@ -39990,7 +40004,7 @@ async function captureVerifierInputs(context, paths) {
|
|
|
39990
40004
|
instrumentation: "unknown"
|
|
39991
40005
|
});
|
|
39992
40006
|
if (!request2 || paths.length !== 2) throw new TypeError("Verifier capture requires two distinct scoped relative paths");
|
|
39993
|
-
const cwd = await realpath3(
|
|
40007
|
+
const cwd = await realpath3(resolve16(context.cwd));
|
|
39994
40008
|
const source2 = {
|
|
39995
40009
|
schema_version: 1,
|
|
39996
40010
|
source_id: "0".repeat(64),
|
|
@@ -40004,7 +40018,7 @@ async function captureVerifierInputs(context, paths) {
|
|
|
40004
40018
|
};
|
|
40005
40019
|
const documents = /* @__PURE__ */ new Map();
|
|
40006
40020
|
for (const row of source2.files) {
|
|
40007
|
-
const absolute =
|
|
40021
|
+
const absolute = resolve16(cwd, row.path);
|
|
40008
40022
|
try {
|
|
40009
40023
|
if (context.signal?.aborted || context.canInspectVerificationSource && !await context.canInspectVerificationSource(seal(structuredClone(source2)))) continue;
|
|
40010
40024
|
if (await realpath3(dirname15(absolute)) !== dirname15(absolute)) continue;
|
|
@@ -40218,7 +40232,7 @@ async function runCPUWorkload(workload, context) {
|
|
|
40218
40232
|
if (process.platform === "win32") return { outcome: "unknown", output: "", executionPolicyId: null };
|
|
40219
40233
|
const plan = buildSandboxCommandPlan(`exec ${quote2(process.execPath)} --input-type=module -e ${quote2(SCRIPT)}`, context.cwd, context.commandPolicy);
|
|
40220
40234
|
const executionPolicyId = cpuHash(JSON.stringify({ backend: plan.backend, enforcement: plan.enforcement, policy: context.commandPolicy ?? null }));
|
|
40221
|
-
return new Promise((
|
|
40235
|
+
return new Promise((resolve22) => {
|
|
40222
40236
|
let outcome;
|
|
40223
40237
|
let output2 = "";
|
|
40224
40238
|
let outputBytes = 0;
|
|
@@ -40249,7 +40263,7 @@ async function runCPUWorkload(workload, context) {
|
|
|
40249
40263
|
child.on("close", (code) => {
|
|
40250
40264
|
clearTimeout(timer);
|
|
40251
40265
|
context.signal?.removeEventListener("abort", cancel);
|
|
40252
|
-
|
|
40266
|
+
resolve22({ outcome: outcome ?? (code === 0 ? "passed" : "failed"), output: output2, executionPolicyId });
|
|
40253
40267
|
});
|
|
40254
40268
|
if (context.signal?.aborted) cancel();
|
|
40255
40269
|
else child.stdin.end(JSON.stringify(workload));
|
|
@@ -40452,10 +40466,10 @@ function isHostControlPlaneWrite(tool, args, cwd) {
|
|
|
40452
40466
|
if (typeof tool?.hostControlPlaneWritePath !== "string" || typeof args.path !== "string") return false;
|
|
40453
40467
|
try {
|
|
40454
40468
|
const noFollowLeaf = (path2) => {
|
|
40455
|
-
const absolute =
|
|
40469
|
+
const absolute = resolve17(path2);
|
|
40456
40470
|
return join22(realpathSync4(dirname16(absolute)), basename8(absolute));
|
|
40457
40471
|
};
|
|
40458
|
-
return noFollowLeaf(
|
|
40472
|
+
return noFollowLeaf(resolve17(cwd, args.path)) === noFollowLeaf(tool.hostControlPlaneWritePath);
|
|
40459
40473
|
} catch {
|
|
40460
40474
|
return false;
|
|
40461
40475
|
}
|
|
@@ -40479,7 +40493,7 @@ function canonicalSourcePath(path2) {
|
|
|
40479
40493
|
function sourceReadDecision(cwd, paths, policy) {
|
|
40480
40494
|
let approvalRequired = false;
|
|
40481
40495
|
for (const path2 of paths) {
|
|
40482
|
-
const lexical =
|
|
40496
|
+
const lexical = resolve17(cwd, path2);
|
|
40483
40497
|
const check2 = (target) => policy?.evaluateTool({
|
|
40484
40498
|
name: "read_file",
|
|
40485
40499
|
args: { path: target },
|
|
@@ -40513,7 +40527,7 @@ function prependMessages(base, messages) {
|
|
|
40513
40527
|
${base}` : prefix3;
|
|
40514
40528
|
}
|
|
40515
40529
|
function normalizeChangedPath(path2, cwd) {
|
|
40516
|
-
const rel = relative3(cwd,
|
|
40530
|
+
const rel = relative3(cwd, resolve17(cwd, path2));
|
|
40517
40531
|
return rel.startsWith("..") ? path2 : rel || ".";
|
|
40518
40532
|
}
|
|
40519
40533
|
function extractChangedPaths(capabilities, output2, cwd) {
|
|
@@ -40744,7 +40758,7 @@ async function executeToolWithRuntime(name2, args, options) {
|
|
|
40744
40758
|
instrumentation: measured ? "production" : "unknown"
|
|
40745
40759
|
} : effectiveArgs.verification);
|
|
40746
40760
|
if (!request2) return { content: `${name2}: invalid source verification request`, isError: true, effectiveArgs };
|
|
40747
|
-
const cwd = !adapter && effectiveArgs.cwd ?
|
|
40761
|
+
const cwd = !adapter && effectiveArgs.cwd ? resolve17(options.context.cwd, String(effectiveArgs.cwd)) : options.context.cwd;
|
|
40748
40762
|
const decision = sourceReadDecision(cwd, request2.source_paths, options.policy);
|
|
40749
40763
|
if (!decision.allowed) return {
|
|
40750
40764
|
content: decision.reason || "Permission denied: source verification requires file_read.",
|
|
@@ -41315,14 +41329,14 @@ function waitForRetryDelay(milliseconds, signal) {
|
|
|
41315
41329
|
if (signal?.aborted) {
|
|
41316
41330
|
return Promise.reject(new AgentError("Cancelled", "CANCELLED"));
|
|
41317
41331
|
}
|
|
41318
|
-
return new Promise((
|
|
41332
|
+
return new Promise((resolve22, reject) => {
|
|
41319
41333
|
const timer = setTimeout(finish, milliseconds);
|
|
41320
41334
|
const onAbort = () => finish(new AgentError("Cancelled", "CANCELLED"));
|
|
41321
41335
|
function finish(error62) {
|
|
41322
41336
|
clearTimeout(timer);
|
|
41323
41337
|
signal?.removeEventListener("abort", onAbort);
|
|
41324
41338
|
if (error62) reject(error62);
|
|
41325
|
-
else
|
|
41339
|
+
else resolve22();
|
|
41326
41340
|
}
|
|
41327
41341
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
41328
41342
|
if (signal?.aborted) onAbort();
|
|
@@ -41537,7 +41551,7 @@ var Agent = class _Agent {
|
|
|
41537
41551
|
}
|
|
41538
41552
|
if (admitted) admitted = receipt2.source.files.every((file2) => this.policy.evaluateTool({
|
|
41539
41553
|
name: "read_file",
|
|
41540
|
-
args: { path:
|
|
41554
|
+
args: { path: resolve18(receipt2.source.cwd, file2.path) },
|
|
41541
41555
|
capabilities: ["file_read" /* FILE_READ */]
|
|
41542
41556
|
}).allowed);
|
|
41543
41557
|
coverage.push(admitted ? await projectCurrentVerification(receipt2) : {
|
|
@@ -42317,7 +42331,7 @@ ${currentCoverage.length - rows.length} additional applicability checks omitted.
|
|
|
42317
42331
|
if (signal?.aborted) break;
|
|
42318
42332
|
const chunk = text5.slice(i, i + this.streamChunkSize);
|
|
42319
42333
|
this.emit({ type: "stream_delta", content: chunk });
|
|
42320
|
-
await new Promise((
|
|
42334
|
+
await new Promise((resolve22) => setTimeout(resolve22, 10));
|
|
42321
42335
|
}
|
|
42322
42336
|
this.emit({ type: "stream_end" });
|
|
42323
42337
|
}
|
|
@@ -44322,7 +44336,7 @@ init_capabilities();
|
|
|
44322
44336
|
init_logger();
|
|
44323
44337
|
init_extension_discovery();
|
|
44324
44338
|
import { homedir as homedir11 } from "os";
|
|
44325
|
-
import { join as join23, resolve as
|
|
44339
|
+
import { join as join23, resolve as resolve19, basename as basename9 } from "path";
|
|
44326
44340
|
import { readdir as readdir3, readFile as readFile5 } from "fs/promises";
|
|
44327
44341
|
var MAX_DEPTH = 4;
|
|
44328
44342
|
function defaultMarkdownRoots() {
|
|
@@ -44447,13 +44461,13 @@ function deriveSkillId(path2, meta3) {
|
|
|
44447
44461
|
if (explicit) return explicit;
|
|
44448
44462
|
const name2 = meta3.name ? String(meta3.name) : "";
|
|
44449
44463
|
if (name2) return name2.toLowerCase().replace(/\s+/g, "-");
|
|
44450
|
-
return basename9(
|
|
44464
|
+
return basename9(resolve19(path2, "..")) || "skill";
|
|
44451
44465
|
}
|
|
44452
44466
|
async function loadSkills(roots = defaultMarkdownRoots()) {
|
|
44453
44467
|
const skills = [];
|
|
44454
44468
|
const seenFiles = /* @__PURE__ */ new Set();
|
|
44455
44469
|
for (const root of roots) {
|
|
44456
|
-
const resolvedRoot =
|
|
44470
|
+
const resolvedRoot = resolve19(root);
|
|
44457
44471
|
const paths = await walk(root);
|
|
44458
44472
|
for (const filePath of paths) {
|
|
44459
44473
|
if (seenFiles.has(filePath)) continue;
|
|
@@ -44486,7 +44500,7 @@ async function loadSkills(roots = defaultMarkdownRoots()) {
|
|
|
44486
44500
|
}
|
|
44487
44501
|
|
|
44488
44502
|
// src/skills/bundled/index.ts
|
|
44489
|
-
import { dirname as dirname17, resolve as
|
|
44503
|
+
import { dirname as dirname17, resolve as resolve20 } from "path";
|
|
44490
44504
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
44491
44505
|
|
|
44492
44506
|
// src/skills/bundled/init-context.ts
|
|
@@ -44641,7 +44655,7 @@ var bundledCodeSkills = [
|
|
|
44641
44655
|
];
|
|
44642
44656
|
function bundledMarkdownRoot() {
|
|
44643
44657
|
const here = dirname17(fileURLToPath2(import.meta.url));
|
|
44644
|
-
return
|
|
44658
|
+
return resolve20(here);
|
|
44645
44659
|
}
|
|
44646
44660
|
|
|
44647
44661
|
// src/skills/registry.ts
|
|
@@ -44819,7 +44833,7 @@ var invokeSkillTool = makeInvokeSkillTool(resolveAmbientSkills);
|
|
|
44819
44833
|
// src/zlm.ts
|
|
44820
44834
|
var ZLM_EMBED_API_VERSION = "zerglang.ztc-embed/1";
|
|
44821
44835
|
var ZLM_STDIO_PROTOCOL = "zerglang.ztc-host/1";
|
|
44822
|
-
var ZLM_ZTC_VERSION = true ? "0.16.
|
|
44836
|
+
var ZLM_ZTC_VERSION = true ? "0.16.2-dev.202611091056" : "development";
|
|
44823
44837
|
var ZLM_MAX_HOST_TOOLS = 64;
|
|
44824
44838
|
var ZLM_MAX_SYSTEM_PROMPT_BYTES = 128 * 1024;
|
|
44825
44839
|
var ZLM_HOST_APPROVAL_CAPABILITIES = Object.freeze([
|
|
@@ -44954,7 +44968,7 @@ function validateTools(input2) {
|
|
|
44954
44968
|
});
|
|
44955
44969
|
}
|
|
44956
44970
|
function resolveRequired(value, label) {
|
|
44957
|
-
return
|
|
44971
|
+
return resolve21(requiredBounded(value, label, 4096));
|
|
44958
44972
|
}
|
|
44959
44973
|
function requiredBounded(value, label, maxBytes) {
|
|
44960
44974
|
const normalized = value.trim();
|
|
@@ -45076,9 +45090,9 @@ async function runDirectEntry() {
|
|
|
45076
45090
|
var directEntry = false;
|
|
45077
45091
|
if (process.argv[1]) {
|
|
45078
45092
|
try {
|
|
45079
|
-
directEntry = realpathSync6(
|
|
45093
|
+
directEntry = realpathSync6(resolve21(process.argv[1])) === realpathSync6(fileURLToPath3(import.meta.url));
|
|
45080
45094
|
} catch {
|
|
45081
|
-
directEntry =
|
|
45095
|
+
directEntry = resolve21(process.argv[1]) === fileURLToPath3(import.meta.url);
|
|
45082
45096
|
}
|
|
45083
45097
|
}
|
|
45084
45098
|
if (directEntry) {
|