@orbit-build/cli 1.8.1 → 1.9.1
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/index.js +317 -127
- package/package.json +1 -1
- package/skills/cumcm-draft/scripts/audit_paper.py +2 -0
- package/skills/cumcm-draft/scripts/bootstrap_project.py +2 -0
- package/skills/cumcm-draft/scripts/build_paper.py +2 -0
- package/skills/cumcm-draft/scripts/capture_environment.py +2 -0
- package/skills/cumcm-draft/scripts/clean_project.py +2 -0
- package/skills/cumcm-draft/scripts/evidence_freeze.py +2 -0
- package/skills/cumcm-draft/scripts/finalize_project.py +2 -0
- package/skills/cumcm-draft/scripts/inspect_inputs.py +2 -0
- package/skills/cumcm-draft/scripts/package_support.py +2 -0
- package/skills/cumcm-draft/scripts/script_runtime.py +17 -0
- package/skills/cumcm-draft/scripts/validate_project.py +2 -0
package/dist/index.js
CHANGED
|
@@ -29351,11 +29351,11 @@ ${lanes.join("\n")}
|
|
|
29351
29351
|
return toComponents;
|
|
29352
29352
|
}
|
|
29353
29353
|
const components = toComponents.slice(start);
|
|
29354
|
-
const
|
|
29354
|
+
const relative16 = [];
|
|
29355
29355
|
for (; start < fromComponents.length; start++) {
|
|
29356
|
-
|
|
29356
|
+
relative16.push("..");
|
|
29357
29357
|
}
|
|
29358
|
-
return ["", ...
|
|
29358
|
+
return ["", ...relative16, ...components];
|
|
29359
29359
|
}
|
|
29360
29360
|
function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
|
|
29361
29361
|
Debug.assert(getRootLength(fromDirectory) > 0 === getRootLength(to) > 0, "Paths must either both be absolute or both be relative");
|
|
@@ -73900,9 +73900,9 @@ ${lanes.join("\n")}
|
|
|
73900
73900
|
if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
|
|
73901
73901
|
return;
|
|
73902
73902
|
}
|
|
73903
|
-
const
|
|
73903
|
+
const relative16 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
|
|
73904
73904
|
for (const symlinkDirectory of symlinkDirectories) {
|
|
73905
|
-
const option = resolvePath(symlinkDirectory,
|
|
73905
|
+
const option = resolvePath(symlinkDirectory, relative16);
|
|
73906
73906
|
const result2 = cb(option, target === referenceRedirect);
|
|
73907
73907
|
shouldFilterIgnoredPaths = true;
|
|
73908
73908
|
if (result2) return result2;
|
|
@@ -235100,49 +235100,49 @@ var require_fast_uri = __commonJS({
|
|
|
235100
235100
|
schemelessOptions.skipEscape = true;
|
|
235101
235101
|
return serialize(resolved, schemelessOptions);
|
|
235102
235102
|
}
|
|
235103
|
-
function resolveComponent(base,
|
|
235103
|
+
function resolveComponent(base, relative16, options, skipNormalization) {
|
|
235104
235104
|
const target = {};
|
|
235105
235105
|
if (!skipNormalization) {
|
|
235106
235106
|
base = parse7(serialize(base, options), options);
|
|
235107
|
-
|
|
235107
|
+
relative16 = parse7(serialize(relative16, options), options);
|
|
235108
235108
|
}
|
|
235109
235109
|
options = options || {};
|
|
235110
|
-
if (!options.tolerant &&
|
|
235111
|
-
target.scheme =
|
|
235112
|
-
target.userinfo =
|
|
235113
|
-
target.host =
|
|
235114
|
-
target.port =
|
|
235115
|
-
target.path = removeDotSegments(
|
|
235116
|
-
target.query =
|
|
235110
|
+
if (!options.tolerant && relative16.scheme) {
|
|
235111
|
+
target.scheme = relative16.scheme;
|
|
235112
|
+
target.userinfo = relative16.userinfo;
|
|
235113
|
+
target.host = relative16.host;
|
|
235114
|
+
target.port = relative16.port;
|
|
235115
|
+
target.path = removeDotSegments(relative16.path || "");
|
|
235116
|
+
target.query = relative16.query;
|
|
235117
235117
|
} else {
|
|
235118
|
-
if (
|
|
235119
|
-
target.userinfo =
|
|
235120
|
-
target.host =
|
|
235121
|
-
target.port =
|
|
235122
|
-
target.path = removeDotSegments(
|
|
235123
|
-
target.query =
|
|
235118
|
+
if (relative16.userinfo !== void 0 || relative16.host !== void 0 || relative16.port !== void 0) {
|
|
235119
|
+
target.userinfo = relative16.userinfo;
|
|
235120
|
+
target.host = relative16.host;
|
|
235121
|
+
target.port = relative16.port;
|
|
235122
|
+
target.path = removeDotSegments(relative16.path || "");
|
|
235123
|
+
target.query = relative16.query;
|
|
235124
235124
|
} else {
|
|
235125
|
-
if (!
|
|
235125
|
+
if (!relative16.path) {
|
|
235126
235126
|
target.path = base.path;
|
|
235127
|
-
if (
|
|
235128
|
-
target.query =
|
|
235127
|
+
if (relative16.query !== void 0) {
|
|
235128
|
+
target.query = relative16.query;
|
|
235129
235129
|
} else {
|
|
235130
235130
|
target.query = base.query;
|
|
235131
235131
|
}
|
|
235132
235132
|
} else {
|
|
235133
|
-
if (
|
|
235134
|
-
target.path = removeDotSegments(
|
|
235133
|
+
if (relative16.path[0] === "/") {
|
|
235134
|
+
target.path = removeDotSegments(relative16.path);
|
|
235135
235135
|
} else {
|
|
235136
235136
|
if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
|
|
235137
|
-
target.path = "/" +
|
|
235137
|
+
target.path = "/" + relative16.path;
|
|
235138
235138
|
} else if (!base.path) {
|
|
235139
|
-
target.path =
|
|
235139
|
+
target.path = relative16.path;
|
|
235140
235140
|
} else {
|
|
235141
|
-
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) +
|
|
235141
|
+
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative16.path;
|
|
235142
235142
|
}
|
|
235143
235143
|
target.path = removeDotSegments(target.path);
|
|
235144
235144
|
}
|
|
235145
|
-
target.query =
|
|
235145
|
+
target.query = relative16.query;
|
|
235146
235146
|
}
|
|
235147
235147
|
target.userinfo = base.userinfo;
|
|
235148
235148
|
target.host = base.host;
|
|
@@ -235150,7 +235150,7 @@ var require_fast_uri = __commonJS({
|
|
|
235150
235150
|
}
|
|
235151
235151
|
target.scheme = base.scheme;
|
|
235152
235152
|
}
|
|
235153
|
-
target.fragment =
|
|
235153
|
+
target.fragment = relative16.fragment;
|
|
235154
235154
|
return target;
|
|
235155
235155
|
}
|
|
235156
235156
|
function equal(uriA, uriB, options) {
|
|
@@ -256022,7 +256022,6 @@ function createDefaultToolRegistry() {
|
|
|
256022
256022
|
var defaultToolRegistry = registerDefaultTools(toolRegistry);
|
|
256023
256023
|
|
|
256024
256024
|
// ../context-engine/dist/index.js
|
|
256025
|
-
import { join as join63 } from "path";
|
|
256026
256025
|
import { existsSync as existsSync10 } from "fs";
|
|
256027
256026
|
import { pathToFileURL } from "url";
|
|
256028
256027
|
import { z as z29 } from "zod";
|
|
@@ -256059,6 +256058,7 @@ import { z as z63 } from "zod";
|
|
|
256059
256058
|
import { existsSync as existsSync63, lstatSync as lstatSync5, promises as fs22 } from "fs";
|
|
256060
256059
|
import { dirname as dirname62, isAbsolute as isAbsolute33, join as join53, win32 as win323 } from "path";
|
|
256061
256060
|
import { parse as parseYaml32 } from "yaml";
|
|
256061
|
+
import { dirname as dirname7, join as join63, relative as relative5, resolve as resolve62 } from "path";
|
|
256062
256062
|
var ProjectIndexer = class {
|
|
256063
256063
|
constructor(cwd) {
|
|
256064
256064
|
this.cwd = cwd;
|
|
@@ -259017,8 +259017,113 @@ function diagnostic(path9, code, message2) {
|
|
|
259017
259017
|
function describe2(error) {
|
|
259018
259018
|
return error instanceof Error ? error.message : String(error);
|
|
259019
259019
|
}
|
|
259020
|
-
var SKILLS_CACHE_TTL_MS = 3e4;
|
|
259021
259020
|
var PROJECT_INSTRUCTIONS_MAX_BYTES = 1024 * 1024;
|
|
259021
|
+
var PROJECT_INSTRUCTION_CANDIDATES = [
|
|
259022
|
+
"ORBIT.md",
|
|
259023
|
+
".agents/AGENTS.md",
|
|
259024
|
+
"AGENTS.md",
|
|
259025
|
+
"CLAUDE.md",
|
|
259026
|
+
".helix/instructions.md",
|
|
259027
|
+
"RUNE.md",
|
|
259028
|
+
".cursorrules",
|
|
259029
|
+
".copilotrules"
|
|
259030
|
+
];
|
|
259031
|
+
var SCOPED_INSTRUCTION_CANDIDATES = [
|
|
259032
|
+
"ORBIT.md",
|
|
259033
|
+
".agents/AGENTS.md",
|
|
259034
|
+
"AGENTS.md",
|
|
259035
|
+
"CLAUDE.md",
|
|
259036
|
+
".helix/instructions.md",
|
|
259037
|
+
"RUNE.md",
|
|
259038
|
+
".cursorrules",
|
|
259039
|
+
".copilotrules"
|
|
259040
|
+
];
|
|
259041
|
+
var INSTRUCTION_FILE_MAX_BYTES = PROJECT_INSTRUCTIONS_MAX_BYTES;
|
|
259042
|
+
function loadProjectInstructions(cwd, relevantFiles = []) {
|
|
259043
|
+
const specialized = readInstructionSources(cwd, [
|
|
259044
|
+
...PROJECT_INSTRUCTION_CANDIDATES,
|
|
259045
|
+
...discoverScopedInstructionPaths(cwd, relevantFiles)
|
|
259046
|
+
]);
|
|
259047
|
+
if (specialized.length > 0) return renderInstructionSources(specialized);
|
|
259048
|
+
const readme = readInstructionSources(cwd, ["README.md"]);
|
|
259049
|
+
return renderInstructionSources(readme);
|
|
259050
|
+
}
|
|
259051
|
+
function discoverScopedInstructionPaths(cwd, relevantFiles) {
|
|
259052
|
+
const root = resolve62(cwd);
|
|
259053
|
+
const discovered = /* @__PURE__ */ new Set();
|
|
259054
|
+
for (const file of relevantFiles) {
|
|
259055
|
+
let target;
|
|
259056
|
+
try {
|
|
259057
|
+
target = resolveSafePath(cwd, file);
|
|
259058
|
+
} catch {
|
|
259059
|
+
continue;
|
|
259060
|
+
}
|
|
259061
|
+
let directory = dirname7(target);
|
|
259062
|
+
const ancestors = [];
|
|
259063
|
+
while (true) {
|
|
259064
|
+
ancestors.push(directory);
|
|
259065
|
+
if (directory === root) break;
|
|
259066
|
+
const parent = dirname7(directory);
|
|
259067
|
+
if (parent === directory || !isWithin(root, parent)) break;
|
|
259068
|
+
directory = parent;
|
|
259069
|
+
}
|
|
259070
|
+
for (const ancestor of ancestors.reverse()) {
|
|
259071
|
+
const relativeDirectory = relative5(root, ancestor).replace(/\\/g, "/");
|
|
259072
|
+
for (const candidate of SCOPED_INSTRUCTION_CANDIDATES) {
|
|
259073
|
+
discovered.add(
|
|
259074
|
+
relativeDirectory ? `${relativeDirectory}/${candidate}` : candidate
|
|
259075
|
+
);
|
|
259076
|
+
}
|
|
259077
|
+
}
|
|
259078
|
+
}
|
|
259079
|
+
return [...discovered].sort((left, right) => {
|
|
259080
|
+
const leftDepth = left.split("/").length;
|
|
259081
|
+
const rightDepth = right.split("/").length;
|
|
259082
|
+
return leftDepth - rightDepth || left.localeCompare(right);
|
|
259083
|
+
});
|
|
259084
|
+
}
|
|
259085
|
+
function isWithin(root, target) {
|
|
259086
|
+
const relativePath = relative5(resolve62(root), resolve62(target));
|
|
259087
|
+
return relativePath === "" || !relativePath.startsWith("..") && !relativePath.includes("/..");
|
|
259088
|
+
}
|
|
259089
|
+
function readInstructionSources(cwd, candidates) {
|
|
259090
|
+
const sources = [];
|
|
259091
|
+
const seen = /* @__PURE__ */ new Set();
|
|
259092
|
+
let remainingBytes = PROJECT_INSTRUCTIONS_MAX_BYTES;
|
|
259093
|
+
for (const relativePath of candidates) {
|
|
259094
|
+
if (remainingBytes <= 0) break;
|
|
259095
|
+
const normalized = relativePath.replace(/\\/g, "/").toLowerCase();
|
|
259096
|
+
if (seen.has(normalized)) continue;
|
|
259097
|
+
seen.add(normalized);
|
|
259098
|
+
const path9 = join63(cwd, ...relativePath.split("/"));
|
|
259099
|
+
try {
|
|
259100
|
+
const content = readBoundedRegularFile(
|
|
259101
|
+
path9,
|
|
259102
|
+
Math.min(INSTRUCTION_FILE_MAX_BYTES, remainingBytes)
|
|
259103
|
+
);
|
|
259104
|
+
if (content === void 0 || content.trim().length === 0) continue;
|
|
259105
|
+
const bytes = Buffer.byteLength(content, "utf8");
|
|
259106
|
+
if (bytes > remainingBytes) continue;
|
|
259107
|
+
sources.push({ path: relativePath, content });
|
|
259108
|
+
remainingBytes -= bytes;
|
|
259109
|
+
} catch {
|
|
259110
|
+
}
|
|
259111
|
+
}
|
|
259112
|
+
return sources;
|
|
259113
|
+
}
|
|
259114
|
+
function renderInstructionSources(sources) {
|
|
259115
|
+
if (sources.length === 0) return "";
|
|
259116
|
+
const rendered = sources.map(({ path: path9, content }) => {
|
|
259117
|
+
const normalized = content.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
259118
|
+
return `## Orbit instruction source: ${path9}
|
|
259119
|
+
${normalized.trim()}`;
|
|
259120
|
+
}).join("\n\n");
|
|
259121
|
+
return truncateTextToTokenBudget(
|
|
259122
|
+
rendered,
|
|
259123
|
+
Math.ceil(PROJECT_INSTRUCTIONS_MAX_BYTES / 4)
|
|
259124
|
+
);
|
|
259125
|
+
}
|
|
259126
|
+
var SKILLS_CACHE_TTL_MS = 3e4;
|
|
259022
259127
|
var MAX_RELEVANT_FILES = 64;
|
|
259023
259128
|
var FILE_SUMMARY_CONCURRENCY = 8;
|
|
259024
259129
|
var ContextPackBuilder = class {
|
|
@@ -259039,7 +259144,12 @@ var ContextPackBuilder = class {
|
|
|
259039
259144
|
}
|
|
259040
259145
|
async build(relevantFiles, userQuery, options = {}) {
|
|
259041
259146
|
const projectIndexPromise = this.indexer.index();
|
|
259042
|
-
const projectInstructionsPromise =
|
|
259147
|
+
const projectInstructionsPromise = Promise.resolve(
|
|
259148
|
+
loadProjectInstructions(
|
|
259149
|
+
this.cwd,
|
|
259150
|
+
relevantFiles.map((file) => file.path)
|
|
259151
|
+
)
|
|
259152
|
+
);
|
|
259043
259153
|
const config = ConfigLoader.loadSync(this.cwd);
|
|
259044
259154
|
const skillsPromise = this.loadSkills(
|
|
259045
259155
|
config,
|
|
@@ -259212,30 +259322,6 @@ var ContextPackBuilder = class {
|
|
|
259212
259322
|
}
|
|
259213
259323
|
return { ...fitted, usedEstimate };
|
|
259214
259324
|
}
|
|
259215
|
-
async loadInstructions() {
|
|
259216
|
-
const candidates = [
|
|
259217
|
-
"ORBIT.md",
|
|
259218
|
-
".agents/AGENTS.md",
|
|
259219
|
-
"AGENTS.md",
|
|
259220
|
-
"CLAUDE.md",
|
|
259221
|
-
"RUNE.md",
|
|
259222
|
-
".cursorrules",
|
|
259223
|
-
".copilotrules",
|
|
259224
|
-
"README.md"
|
|
259225
|
-
];
|
|
259226
|
-
for (const name of candidates) {
|
|
259227
|
-
const p = join63(this.cwd, ...name.split("/"));
|
|
259228
|
-
try {
|
|
259229
|
-
const content = readBoundedRegularFile(
|
|
259230
|
-
p,
|
|
259231
|
-
PROJECT_INSTRUCTIONS_MAX_BYTES
|
|
259232
|
-
);
|
|
259233
|
-
if (content !== void 0) return content;
|
|
259234
|
-
} catch {
|
|
259235
|
-
}
|
|
259236
|
-
}
|
|
259237
|
-
return "";
|
|
259238
|
-
}
|
|
259239
259325
|
async loadSkills(config, userQuery, forcedSkills = []) {
|
|
259240
259326
|
const skillsConfig = config.skills;
|
|
259241
259327
|
if (skillsConfig.enabled === false) {
|
|
@@ -262704,7 +262790,7 @@ function firstString(...values) {
|
|
|
262704
262790
|
// ../session/dist/index.js
|
|
262705
262791
|
import { z as z31 } from "zod";
|
|
262706
262792
|
import { createHash as createHash9, randomUUID as randomUUID6 } from "crypto";
|
|
262707
|
-
import { dirname as
|
|
262793
|
+
import { dirname as dirname8, isAbsolute as isAbsolute5, join as join9, relative as relative6, resolve as resolve7, sep } from "path";
|
|
262708
262794
|
import {
|
|
262709
262795
|
closeSync as closeSync5,
|
|
262710
262796
|
existsSync as existsSync11,
|
|
@@ -263134,7 +263220,7 @@ function syncParentDirectory(filePath) {
|
|
|
263134
263220
|
if (process.platform === "win32") return;
|
|
263135
263221
|
let directoryFd;
|
|
263136
263222
|
try {
|
|
263137
|
-
directoryFd = openSync5(
|
|
263223
|
+
directoryFd = openSync5(dirname8(filePath), "r");
|
|
263138
263224
|
fsyncSync4(directoryFd);
|
|
263139
263225
|
} catch {
|
|
263140
263226
|
} finally {
|
|
@@ -263253,7 +263339,7 @@ function sanitizeTraceJsonText(text2, cwd) {
|
|
|
263253
263339
|
}
|
|
263254
263340
|
function normalizeTracePath(filePath, cwd) {
|
|
263255
263341
|
const absolute = resolve7(cwd, filePath);
|
|
263256
|
-
const relativePath =
|
|
263342
|
+
const relativePath = relative6(cwd, absolute);
|
|
263257
263343
|
if (relativePath && !relativePath.startsWith("..") && !isAbsolute5(relativePath)) {
|
|
263258
263344
|
return relativePath.split(sep).join("/");
|
|
263259
263345
|
}
|
|
@@ -263703,7 +263789,7 @@ var SessionStore = class {
|
|
|
263703
263789
|
} catch {
|
|
263704
263790
|
return [];
|
|
263705
263791
|
}
|
|
263706
|
-
return this.readHistoryFiles(file, join9(
|
|
263792
|
+
return this.readHistoryFiles(file, join9(dirname8(file), "history.jsonl"));
|
|
263707
263793
|
}
|
|
263708
263794
|
readHistoryFiles(snapshotPath, journalPath) {
|
|
263709
263795
|
let history = [];
|
|
@@ -263774,7 +263860,7 @@ var SessionStore = class {
|
|
|
263774
263860
|
const validId = SessionIdSchema.parse(id);
|
|
263775
263861
|
const sessionRoot = this.resolveSessionRoot();
|
|
263776
263862
|
const resolved = resolveSafePath(this.cwd, join9(sessionRoot, validId));
|
|
263777
|
-
const relativePath =
|
|
263863
|
+
const relativePath = relative6(sessionRoot, resolved);
|
|
263778
263864
|
if (relativePath !== validId || relativePath.includes(sep) || isAbsolute5(relativePath)) {
|
|
263779
263865
|
throw new Error(`Invalid session directory: ${id}`);
|
|
263780
263866
|
}
|
|
@@ -277796,7 +277882,7 @@ import { styleText as styleText2, stripVTControlCharacters } from "util";
|
|
|
277796
277882
|
import process$1 from "process";
|
|
277797
277883
|
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
277798
277884
|
import { existsSync as existsSync15, lstatSync as lstatSync7, readdirSync as readdirSync8 } from "fs";
|
|
277799
|
-
import { dirname as
|
|
277885
|
+
import { dirname as dirname9, join as join13 } from "path";
|
|
277800
277886
|
function isUnicodeSupported() {
|
|
277801
277887
|
if (process$1.platform !== "win32") {
|
|
277802
277888
|
return process$1.env.TERM !== "linux";
|
|
@@ -283567,7 +283653,7 @@ var FullscreenTui = class {
|
|
|
283567
283653
|
// src/runtime/ReplController.ts
|
|
283568
283654
|
import picocolors19 from "picocolors";
|
|
283569
283655
|
import { rmSync as rmSync8, watch } from "fs";
|
|
283570
|
-
import { dirname as
|
|
283656
|
+
import { dirname as dirname14, resolve as resolve14 } from "path";
|
|
283571
283657
|
import { homedir as homedir11 } from "os";
|
|
283572
283658
|
import http3 from "http";
|
|
283573
283659
|
import { randomBytes as randomBytes5, randomUUID as randomUUID13, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
@@ -283786,14 +283872,14 @@ function stripQuotes(value) {
|
|
|
283786
283872
|
// src/runtime/webui/WebUiRuntime.ts
|
|
283787
283873
|
import http2 from "http";
|
|
283788
283874
|
import { randomBytes as randomBytes4, randomUUID as randomUUID10 } from "crypto";
|
|
283789
|
-
import { isAbsolute as isAbsolute6, relative as
|
|
283875
|
+
import { isAbsolute as isAbsolute6, relative as relative9, resolve as resolve11 } from "path";
|
|
283790
283876
|
import { z as z61 } from "zod";
|
|
283791
283877
|
|
|
283792
283878
|
// src/runtime/AutocompleteCandidates.ts
|
|
283793
283879
|
import glob4 from "fast-glob";
|
|
283794
283880
|
import { existsSync as existsSync18, readdirSync as readdirSync10 } from "fs";
|
|
283795
283881
|
import { homedir as homedir10 } from "os";
|
|
283796
|
-
import { dirname as
|
|
283882
|
+
import { dirname as dirname10, join as join17, resolve as resolve9 } from "path";
|
|
283797
283883
|
import { z as z58 } from "zod";
|
|
283798
283884
|
var AUTOCOMPLETE_SYMBOL_INDEX_MAX_BYTES = 256 * 1024 * 1024;
|
|
283799
283885
|
var symbolIndexSchema = z58.object({
|
|
@@ -283836,7 +283922,7 @@ async function getAutocompleteCandidates(cwd, config, mcpPromptCommands = []) {
|
|
|
283836
283922
|
const sessions = [];
|
|
283837
283923
|
const normCwd = resolve9(cwd).toLowerCase().replace(/\\/g, "/");
|
|
283838
283924
|
const normHome = resolve9(homedir10()).toLowerCase().replace(/\\/g, "/");
|
|
283839
|
-
const isHomeOrRoot = normCwd === normHome || normCwd === "/" || /^[a-zA-Z]:\/$/.test(normCwd) ||
|
|
283925
|
+
const isHomeOrRoot = normCwd === normHome || normCwd === "/" || /^[a-zA-Z]:\/$/.test(normCwd) || dirname10(normCwd) === normCwd;
|
|
283840
283926
|
if (isHomeOrRoot) {
|
|
283841
283927
|
return { commands, commandDetails, files, symbols, sessions };
|
|
283842
283928
|
}
|
|
@@ -290360,7 +290446,7 @@ var WEB_UI_FAVICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4
|
|
|
290360
290446
|
</svg>`;
|
|
290361
290447
|
|
|
290362
290448
|
// src/runtime/webui/WebUiData.ts
|
|
290363
|
-
import { relative as
|
|
290449
|
+
import { relative as relative7 } from "path";
|
|
290364
290450
|
|
|
290365
290451
|
// src/runtime/webui/WebUiSecurity.ts
|
|
290366
290452
|
import { timingSafeEqual } from "crypto";
|
|
@@ -291336,7 +291422,7 @@ async function collectWebUiSkills(options) {
|
|
|
291336
291422
|
BUILTIN_SLASH_COMMANDS
|
|
291337
291423
|
).filter((command) => command.source === "project");
|
|
291338
291424
|
const displayPath = (path9) => {
|
|
291339
|
-
const projectRelative =
|
|
291425
|
+
const projectRelative = relative7(options.cwd, path9).replace(/\\/g, "/");
|
|
291340
291426
|
if (projectRelative && !projectRelative.startsWith("..")) {
|
|
291341
291427
|
return projectRelative;
|
|
291342
291428
|
}
|
|
@@ -299805,7 +299891,7 @@ var WEB_UI_STYLES = WEB_UI_STYLE_SECTIONS.join("");
|
|
|
299805
299891
|
|
|
299806
299892
|
// src/runtime/CapabilityScaffolder.ts
|
|
299807
299893
|
import { promises as fs6 } from "fs";
|
|
299808
|
-
import { dirname as
|
|
299894
|
+
import { dirname as dirname11, join as join18, relative as relative8, resolve as resolve10 } from "path";
|
|
299809
299895
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
299810
299896
|
import { stringify as stringifyYaml } from "yaml";
|
|
299811
299897
|
import { z as z60 } from "zod";
|
|
@@ -299855,7 +299941,7 @@ async function createProjectCapability(cwd, request) {
|
|
|
299855
299941
|
const stageDirectory = resolveSafePath(
|
|
299856
299942
|
workspace,
|
|
299857
299943
|
resolve10(
|
|
299858
|
-
|
|
299944
|
+
dirname11(skillsDirectory),
|
|
299859
299945
|
`.orbit-stage-${validated.name}-${randomUUID9()}`
|
|
299860
299946
|
)
|
|
299861
299947
|
);
|
|
@@ -299888,7 +299974,7 @@ async function createProjectCapability(cwd, request) {
|
|
|
299888
299974
|
return {
|
|
299889
299975
|
kind: validated.kind,
|
|
299890
299976
|
name: validated.name,
|
|
299891
|
-
path: normalizePath5(
|
|
299977
|
+
path: normalizePath5(relative8(workspace, skillPath))
|
|
299892
299978
|
};
|
|
299893
299979
|
}
|
|
299894
299980
|
const commandsDirectory = await ensureSafeDirectory(
|
|
@@ -299921,7 +300007,7 @@ async function createProjectCapability(cwd, request) {
|
|
|
299921
300007
|
return {
|
|
299922
300008
|
kind: validated.kind,
|
|
299923
300009
|
name: validated.name,
|
|
299924
|
-
path: normalizePath5(
|
|
300010
|
+
path: normalizePath5(relative8(workspace, workflowPath))
|
|
299925
300011
|
};
|
|
299926
300012
|
}
|
|
299927
300013
|
async function assertMissing(path9) {
|
|
@@ -300976,7 +301062,7 @@ function isSkillScopeDiscoverable(cwd, configuredDirectories, scope) {
|
|
|
300976
301062
|
scope === "versioned" ? ".agents/skills" : ".orbit/skills"
|
|
300977
301063
|
);
|
|
300978
301064
|
return resolveSkillDirectories(cwd, configuredDirectories).some((root) => {
|
|
300979
|
-
const pathFromRoot =
|
|
301065
|
+
const pathFromRoot = relative9(root, target);
|
|
300980
301066
|
return pathFromRoot === "" || !pathFromRoot.startsWith("..") && !isAbsolute6(pathFromRoot);
|
|
300981
301067
|
});
|
|
300982
301068
|
}
|
|
@@ -301544,14 +301630,14 @@ async function handleWorkspaceConfigCommand(configArgument, dependencies) {
|
|
|
301544
301630
|
// src/runtime/commands/ContextCommandHandler.ts
|
|
301545
301631
|
import glob5 from "fast-glob";
|
|
301546
301632
|
import { existsSync as existsSync19, statSync as statSync6 } from "fs";
|
|
301547
|
-
import { isAbsolute as isAbsolute7, relative as
|
|
301633
|
+
import { isAbsolute as isAbsolute7, relative as relative10, resolve as resolve12 } from "path";
|
|
301548
301634
|
import picocolors12 from "picocolors";
|
|
301549
301635
|
function parseAddArgument(argument) {
|
|
301550
301636
|
const match = argument.match(/^(--read-only|--readonly|-r)(?:\s+|$)/);
|
|
301551
301637
|
return match ? { fileArgument: argument.slice(match[0].length).trim(), readOnly: true } : { fileArgument: argument, readOnly: false };
|
|
301552
301638
|
}
|
|
301553
301639
|
function toWorkspaceRelative(cwd, absolutePath) {
|
|
301554
|
-
return
|
|
301640
|
+
return relative10(cwd, absolutePath).replace(/\\/g, "/");
|
|
301555
301641
|
}
|
|
301556
301642
|
function safeCandidateFiles(cwd, candidates) {
|
|
301557
301643
|
return candidates.filter((candidate) => {
|
|
@@ -301897,7 +301983,7 @@ async function handleContextCommand(command, argument, dependencies) {
|
|
|
301897
301983
|
// src/runtime/commands/RollbackCommandHandler.ts
|
|
301898
301984
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
301899
301985
|
import { existsSync as existsSync20, lstatSync as lstatSync8, mkdirSync as mkdirSync6, rmSync as rmSync7, writeFileSync as writeFileSync7 } from "fs";
|
|
301900
|
-
import { dirname as
|
|
301986
|
+
import { dirname as dirname12 } from "path";
|
|
301901
301987
|
import picocolors13 from "picocolors";
|
|
301902
301988
|
import { z as z66 } from "zod";
|
|
301903
301989
|
var GitStatusCodeSchema = z66.string().length(2).regex(/^[ MADRCU?!]{2}$/);
|
|
@@ -302258,7 +302344,7 @@ function restoreWorkspaceSnapshot(cwd, snapshots) {
|
|
|
302258
302344
|
);
|
|
302259
302345
|
}
|
|
302260
302346
|
}
|
|
302261
|
-
mkdirSync6(
|
|
302347
|
+
mkdirSync6(dirname12(absolutePath), { recursive: true });
|
|
302262
302348
|
writeFileSync7(resolveSafePath(cwd, snapshot.path), snapshot.content);
|
|
302263
302349
|
} catch (error) {
|
|
302264
302350
|
failures.push(`${snapshot.path}: ${toErrorMessage3(error)}`);
|
|
@@ -303004,7 +303090,7 @@ function copyBooleanCapability(source, sourceKey, target, targetKey) {
|
|
|
303004
303090
|
// src/runtime/ProjectLauncher.ts
|
|
303005
303091
|
import { spawn as spawn5 } from "child_process";
|
|
303006
303092
|
import { existsSync as existsSync21, mkdirSync as mkdirSync7, realpathSync as realpathSync3, statSync as statSync7 } from "fs";
|
|
303007
|
-
import { dirname as
|
|
303093
|
+
import { dirname as dirname13, isAbsolute as isAbsolute8, parse as parse5, resolve as resolve13 } from "path";
|
|
303008
303094
|
var PROJECT_WEB_UI_READY_MESSAGE = "orbit-webui-ready";
|
|
303009
303095
|
var ProjectLaunchError = class extends Error {
|
|
303010
303096
|
constructor(code, message2, options) {
|
|
@@ -303130,7 +303216,7 @@ function ensureProjectDirectory(projectPath) {
|
|
|
303130
303216
|
requireProjectDirectory(projectPath);
|
|
303131
303217
|
return;
|
|
303132
303218
|
}
|
|
303133
|
-
const parentPath =
|
|
303219
|
+
const parentPath = dirname13(projectPath);
|
|
303134
303220
|
if (!existsSync21(parentPath)) {
|
|
303135
303221
|
throw new ProjectLaunchError(
|
|
303136
303222
|
"parent_missing",
|
|
@@ -306246,11 +306332,11 @@ var IMAGE_TYPES = {
|
|
|
306246
306332
|
".webp": "image/webp"
|
|
306247
306333
|
};
|
|
306248
306334
|
function loadTerminalImage(requestedPath, options) {
|
|
306249
|
-
const
|
|
306250
|
-
if (!
|
|
306335
|
+
const relative16 = requestedPath.trim().replace(/^(["'])(.*)\1$/, "$2");
|
|
306336
|
+
if (!relative16 || /[\u0000-\u001f\u007f]/.test(relative16)) {
|
|
306251
306337
|
throw new Error("Image path must be a non-empty workspace-relative path.");
|
|
306252
306338
|
}
|
|
306253
|
-
const path9 = resolveSafePath(options.cwd,
|
|
306339
|
+
const path9 = resolveSafePath(options.cwd, relative16);
|
|
306254
306340
|
const leaf = lstatSync9(path9);
|
|
306255
306341
|
if (leaf.isSymbolicLink() && !options.allowSymbolicLink) {
|
|
306256
306342
|
throw new Error(
|
|
@@ -306258,7 +306344,7 @@ function loadTerminalImage(requestedPath, options) {
|
|
|
306258
306344
|
);
|
|
306259
306345
|
}
|
|
306260
306346
|
if (!leaf.isFile())
|
|
306261
|
-
throw new Error(`Image is not a regular file: ${
|
|
306347
|
+
throw new Error(`Image is not a regular file: ${relative16}`);
|
|
306262
306348
|
const stats = statSync8(path9);
|
|
306263
306349
|
if (stats.size <= 0 || stats.size > MAX_TERMINAL_IMAGE_BYTES) {
|
|
306264
306350
|
throw new Error(
|
|
@@ -306852,7 +306938,7 @@ Risk Warning: ${reason}`);
|
|
|
306852
306938
|
});
|
|
306853
306939
|
const normCwd = resolve14(this.cwd).toLowerCase().replace(/\\/g, "/");
|
|
306854
306940
|
const normHome = resolve14(homedir11()).toLowerCase().replace(/\\/g, "/");
|
|
306855
|
-
const isHomeOrRoot = normCwd === normHome || normCwd === "/" || /^[a-zA-Z]:\/$/.test(normCwd) ||
|
|
306941
|
+
const isHomeOrRoot = normCwd === normHome || normCwd === "/" || /^[a-zA-Z]:\/$/.test(normCwd) || dirname14(normCwd) === normCwd;
|
|
306856
306942
|
if (!isHomeOrRoot) {
|
|
306857
306943
|
const indexer = new SymbolIndexer(this.cwd);
|
|
306858
306944
|
this.watcher = watch(
|
|
@@ -308706,7 +308792,7 @@ function errorMessage4(error) {
|
|
|
308706
308792
|
// src/commands/acp.ts
|
|
308707
308793
|
import picocolors27 from "picocolors";
|
|
308708
308794
|
import { createHash as createHash14 } from "crypto";
|
|
308709
|
-
import { dirname as
|
|
308795
|
+
import { dirname as dirname15 } from "path";
|
|
308710
308796
|
import { existsSync as existsSync29, mkdirSync as mkdirSync8 } from "fs";
|
|
308711
308797
|
|
|
308712
308798
|
// ../acp/dist/index.js
|
|
@@ -313518,7 +313604,7 @@ async function runAcpRegistryFetchCommand(options = {}) {
|
|
|
313518
313604
|
);
|
|
313519
313605
|
}
|
|
313520
313606
|
}
|
|
313521
|
-
mkdirSync8(
|
|
313607
|
+
mkdirSync8(dirname15(outputPath), { recursive: true });
|
|
313522
313608
|
replacePrivateFileAtomically(
|
|
313523
313609
|
outputPath,
|
|
313524
313610
|
`${JSON.stringify(fetched.file, null, 2)}
|
|
@@ -313998,7 +314084,7 @@ function isRecord13(value) {
|
|
|
313998
314084
|
|
|
313999
314085
|
// src/commands/review.ts
|
|
314000
314086
|
import { existsSync as existsSync30, lstatSync as lstatSync11, readdirSync as readdirSync11 } from "fs";
|
|
314001
|
-
import { isAbsolute as isAbsolute9, join as join20, relative as
|
|
314087
|
+
import { isAbsolute as isAbsolute9, join as join20, relative as relative11, sep as sep3 } from "path";
|
|
314002
314088
|
import { z as z85 } from "zod";
|
|
314003
314089
|
import picocolors28 from "picocolors";
|
|
314004
314090
|
var FindingSchema = z85.object({
|
|
@@ -314085,7 +314171,7 @@ function runReviewCommand(action, artifactName, findingId, options = {}) {
|
|
|
314085
314171
|
{
|
|
314086
314172
|
format,
|
|
314087
314173
|
artifactCount: selected.length,
|
|
314088
|
-
out:
|
|
314174
|
+
out: relative11(cwd, outputPath).split(sep3).join("/")
|
|
314089
314175
|
},
|
|
314090
314176
|
options.json === true
|
|
314091
314177
|
);
|
|
@@ -314239,7 +314325,7 @@ function normalizeReviewPath(file, cwd) {
|
|
|
314239
314325
|
const candidate = file.trim();
|
|
314240
314326
|
if (!candidate) return "<unknown>";
|
|
314241
314327
|
const absolute = isAbsolute9(candidate) ? candidate : resolveSafePath(cwd, candidate);
|
|
314242
|
-
const relativePath =
|
|
314328
|
+
const relativePath = relative11(cwd, absolute);
|
|
314243
314329
|
if (relativePath && !relativePath.startsWith("..") && !isAbsolute9(relativePath)) {
|
|
314244
314330
|
return relativePath.split(sep3).join("/");
|
|
314245
314331
|
}
|
|
@@ -314342,7 +314428,7 @@ import {
|
|
|
314342
314428
|
rmSync as rmSync9,
|
|
314343
314429
|
writeFileSync as writeFileSync8
|
|
314344
314430
|
} from "fs";
|
|
314345
|
-
import { dirname as
|
|
314431
|
+
import { dirname as dirname16, resolve as resolve16 } from "path";
|
|
314346
314432
|
import { randomUUID as randomUUID14 } from "crypto";
|
|
314347
314433
|
import { z as z86 } from "zod";
|
|
314348
314434
|
var TraceOptionsSchema = z86.object({
|
|
@@ -314362,7 +314448,7 @@ function runTraceExport(cwd, sessionId, options = {}) {
|
|
|
314362
314448
|
return void 0;
|
|
314363
314449
|
}
|
|
314364
314450
|
const outputPath = resolveSafePath(cwd, value.out);
|
|
314365
|
-
const directory =
|
|
314451
|
+
const directory = dirname16(outputPath);
|
|
314366
314452
|
if (existsSync31(directory)) {
|
|
314367
314453
|
const stats = lstatSync12(directory);
|
|
314368
314454
|
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
@@ -315216,7 +315302,7 @@ import {
|
|
|
315216
315302
|
rmSync as rmSync10,
|
|
315217
315303
|
writeFileSync as writeFileSync9
|
|
315218
315304
|
} from "fs";
|
|
315219
|
-
import { basename as basename8, dirname as
|
|
315305
|
+
import { basename as basename8, dirname as dirname17, join as join27, relative as relative12, resolve as resolve17 } from "path";
|
|
315220
315306
|
import { createHash as createHash15, randomUUID as randomUUID15 } from "crypto";
|
|
315221
315307
|
import { promisify as promisify5 } from "util";
|
|
315222
315308
|
import picocolors30 from "picocolors";
|
|
@@ -315560,7 +315646,7 @@ function computeAcceptanceFixtureHash(cwd, fixturePaths) {
|
|
|
315560
315646
|
};
|
|
315561
315647
|
for (const requestedPath of Array.from(new Set(fixturePaths)).sort()) {
|
|
315562
315648
|
const absolutePath = resolveSafePath(cwd, requestedPath);
|
|
315563
|
-
const normalized =
|
|
315649
|
+
const normalized = relative12(resolve17(cwd), absolutePath).replace(/\\/g, "/");
|
|
315564
315650
|
visit(normalized, absolutePath);
|
|
315565
315651
|
}
|
|
315566
315652
|
const digest = createHash15("sha256");
|
|
@@ -315705,7 +315791,7 @@ function snapshotWorkspaceIntoWorktree(sourceCwd, worktreeCwd) {
|
|
|
315705
315791
|
const targetPath = resolveSafePath(worktreeCwd, relativePath);
|
|
315706
315792
|
const stats = lstatSync13(sourcePath);
|
|
315707
315793
|
if (stats.isSymbolicLink() || !stats.isFile()) continue;
|
|
315708
|
-
mkdirSync10(
|
|
315794
|
+
mkdirSync10(dirname17(targetPath), { recursive: true });
|
|
315709
315795
|
copyFileSync(sourcePath, targetPath);
|
|
315710
315796
|
}
|
|
315711
315797
|
execFileSync9("git", ["add", "-A"], {
|
|
@@ -315764,7 +315850,7 @@ function writeEvaluationReport(cwd, runId, report) {
|
|
|
315764
315850
|
return filePath;
|
|
315765
315851
|
}
|
|
315766
315852
|
function writeJsonAtomically2(filePath, value) {
|
|
315767
|
-
const directory =
|
|
315853
|
+
const directory = dirname17(filePath);
|
|
315768
315854
|
if (existsSync38(directory)) {
|
|
315769
315855
|
const stats = lstatSync13(directory);
|
|
315770
315856
|
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
@@ -316109,7 +316195,7 @@ import {
|
|
|
316109
316195
|
openSync as openSync6,
|
|
316110
316196
|
statSync as statSync9
|
|
316111
316197
|
} from "fs";
|
|
316112
|
-
import { dirname as
|
|
316198
|
+
import { dirname as dirname18, resolve as resolve20 } from "path";
|
|
316113
316199
|
import { z as z215 } from "zod";
|
|
316114
316200
|
import { randomBytes as randomBytes6, timingSafeEqual as timingSafeEqual3 } from "crypto";
|
|
316115
316201
|
import {
|
|
@@ -316145,7 +316231,7 @@ import {
|
|
|
316145
316231
|
} from "https";
|
|
316146
316232
|
import { timingSafeEqual as timingSafeEqual22 } from "crypto";
|
|
316147
316233
|
import { existsSync as existsSync310, readFileSync as readFileSync22, realpathSync as realpathSync5, statSync as statSync24 } from "fs";
|
|
316148
|
-
import { isAbsolute as isAbsolute10, relative as
|
|
316234
|
+
import { isAbsolute as isAbsolute10, relative as relative13, resolve as resolve36 } from "path";
|
|
316149
316235
|
import { URL as URL2 } from "url";
|
|
316150
316236
|
import { z as z410 } from "zod";
|
|
316151
316237
|
import { createPublicKey as createPublicKey5, verify as verifySignature5 } from "crypto";
|
|
@@ -316211,6 +316297,59 @@ var DaemonTaskStateSchema = z96.enum([
|
|
|
316211
316297
|
"canceled",
|
|
316212
316298
|
"orphaned"
|
|
316213
316299
|
]);
|
|
316300
|
+
var DaemonFailureCodeSchema = z96.enum([
|
|
316301
|
+
"canceled",
|
|
316302
|
+
"aborted",
|
|
316303
|
+
"lease_expired",
|
|
316304
|
+
"nonzero_exit",
|
|
316305
|
+
"runner_error",
|
|
316306
|
+
"unknown"
|
|
316307
|
+
]);
|
|
316308
|
+
function deriveDaemonFailureMetadata(state, options = {}) {
|
|
316309
|
+
if (state === "completed" || state === "queued" || state === "running") {
|
|
316310
|
+
return void 0;
|
|
316311
|
+
}
|
|
316312
|
+
if (state === "canceled") {
|
|
316313
|
+
return {
|
|
316314
|
+
failureCode: "canceled",
|
|
316315
|
+
retryable: false,
|
|
316316
|
+
recoveryHint: "Canceled explicitly. Resume the task only when you are ready to retry it."
|
|
316317
|
+
};
|
|
316318
|
+
}
|
|
316319
|
+
if (state === "orphaned") {
|
|
316320
|
+
return {
|
|
316321
|
+
failureCode: "lease_expired",
|
|
316322
|
+
retryable: true,
|
|
316323
|
+
recoveryHint: "The previous daemon stopped renewing its lease. Inspect the workspace, then resume explicitly."
|
|
316324
|
+
};
|
|
316325
|
+
}
|
|
316326
|
+
if (state === "aborted") {
|
|
316327
|
+
return {
|
|
316328
|
+
failureCode: "aborted",
|
|
316329
|
+
retryable: true,
|
|
316330
|
+
recoveryHint: "The daemon stopped before completion. Inspect partial changes, then resume explicitly."
|
|
316331
|
+
};
|
|
316332
|
+
}
|
|
316333
|
+
if (options.exitCode !== void 0 && options.exitCode !== 0) {
|
|
316334
|
+
return {
|
|
316335
|
+
failureCode: "nonzero_exit",
|
|
316336
|
+
retryable: true,
|
|
316337
|
+
recoveryHint: "The runner exited with a non-zero code. Review the recorded error and verification output before resuming."
|
|
316338
|
+
};
|
|
316339
|
+
}
|
|
316340
|
+
if (options.error) {
|
|
316341
|
+
return {
|
|
316342
|
+
failureCode: "runner_error",
|
|
316343
|
+
retryable: true,
|
|
316344
|
+
recoveryHint: "The runner failed unexpectedly. Review the error and workspace state before resuming."
|
|
316345
|
+
};
|
|
316346
|
+
}
|
|
316347
|
+
return {
|
|
316348
|
+
failureCode: "unknown",
|
|
316349
|
+
retryable: true,
|
|
316350
|
+
recoveryHint: "The task ended without a detailed failure receipt. Inspect the workspace before resuming."
|
|
316351
|
+
};
|
|
316352
|
+
}
|
|
316214
316353
|
var DaemonRunOptionsSchema = z96.object({
|
|
316215
316354
|
provider: z96.string().trim().min(1).max(256).optional(),
|
|
316216
316355
|
model: z96.string().trim().min(1).max(256).optional(),
|
|
@@ -316249,6 +316388,9 @@ var DaemonTaskRecordSchema = z96.object({
|
|
|
316249
316388
|
endedAt: z96.string().datetime().optional(),
|
|
316250
316389
|
exitCode: z96.number().int().min(0).max(255).optional(),
|
|
316251
316390
|
error: z96.string().max(4e3).optional(),
|
|
316391
|
+
failureCode: DaemonFailureCodeSchema.optional(),
|
|
316392
|
+
retryable: z96.boolean().optional(),
|
|
316393
|
+
recoveryHint: z96.string().max(500).optional(),
|
|
316252
316394
|
owner: z96.object({
|
|
316253
316395
|
instanceId: z96.string().regex(/^daemon_[a-f0-9]{24,64}$/),
|
|
316254
316396
|
/** Optional for backward-compatible reads of pre-lease v1 records. */
|
|
@@ -316323,7 +316465,7 @@ var DaemonAuditLog = class {
|
|
|
316323
316465
|
initialize() {
|
|
316324
316466
|
if (this.initialized) return this.verify();
|
|
316325
316467
|
const path9 = this.resolveFilePath();
|
|
316326
|
-
ensurePrivateDirectory(
|
|
316468
|
+
ensurePrivateDirectory(dirname18(path9));
|
|
316327
316469
|
this.assertRegularPath(path9);
|
|
316328
316470
|
if (!existsSync39(path9)) {
|
|
316329
316471
|
this.initialized = true;
|
|
@@ -316462,7 +316604,7 @@ var DaemonAuditLog = class {
|
|
|
316462
316604
|
return path9;
|
|
316463
316605
|
}
|
|
316464
316606
|
assertRegularPath(path9) {
|
|
316465
|
-
const parent =
|
|
316607
|
+
const parent = dirname18(path9);
|
|
316466
316608
|
mkdirSync11(parent, { recursive: true });
|
|
316467
316609
|
if (existsSync39(path9) && (lstatSync15(path9).isSymbolicLink() || !statSync9(path9).isFile())) {
|
|
316468
316610
|
throw new Error("Daemon audit log must be a regular file.");
|
|
@@ -316948,6 +317090,7 @@ var DaemonStore = class {
|
|
|
316948
317090
|
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
316949
317091
|
...options.exitCode === void 0 ? {} : { exitCode: options.exitCode },
|
|
316950
317092
|
...options.error ? { error: redactSecrets(options.error).slice(0, 4e3) } : {},
|
|
317093
|
+
...deriveDaemonFailureMetadata(state, options),
|
|
316951
317094
|
...options.sessionId ? { sessionId: options.sessionId } : {},
|
|
316952
317095
|
owner: void 0
|
|
316953
317096
|
});
|
|
@@ -316963,6 +317106,9 @@ var DaemonStore = class {
|
|
|
316963
317106
|
state: "canceled",
|
|
316964
317107
|
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
316965
317108
|
error: "Canceled by an authenticated daemon client.",
|
|
317109
|
+
failureCode: "canceled",
|
|
317110
|
+
retryable: false,
|
|
317111
|
+
recoveryHint: "Canceled explicitly. Resume the task only when you are ready to retry it.",
|
|
316966
317112
|
owner: void 0
|
|
316967
317113
|
});
|
|
316968
317114
|
});
|
|
@@ -316983,6 +317129,9 @@ var DaemonStore = class {
|
|
|
316983
317129
|
endedAt: void 0,
|
|
316984
317130
|
exitCode: void 0,
|
|
316985
317131
|
error: void 0,
|
|
317132
|
+
failureCode: void 0,
|
|
317133
|
+
retryable: void 0,
|
|
317134
|
+
recoveryHint: void 0,
|
|
316986
317135
|
owner: void 0
|
|
316987
317136
|
});
|
|
316988
317137
|
});
|
|
@@ -317062,6 +317211,9 @@ var DaemonStore = class {
|
|
|
317062
317211
|
state: "orphaned",
|
|
317063
317212
|
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
317064
317213
|
error: "The owning Orbit daemon stopped renewing its lease; resume explicitly to retry this task.",
|
|
317214
|
+
failureCode: "lease_expired",
|
|
317215
|
+
retryable: true,
|
|
317216
|
+
recoveryHint: "The previous daemon stopped renewing its lease. Inspect the workspace, then resume explicitly.",
|
|
317065
317217
|
owner: void 0
|
|
317066
317218
|
});
|
|
317067
317219
|
});
|
|
@@ -317939,7 +318091,7 @@ function canonicalAllowedWorkspace(input, roots) {
|
|
|
317939
318091
|
continue;
|
|
317940
318092
|
}
|
|
317941
318093
|
const allowed = realpathSync5.native(allowedPath);
|
|
317942
|
-
const relation =
|
|
318094
|
+
const relation = relative13(allowed, canonical);
|
|
317943
318095
|
if (relation === "" || !relation.startsWith("..") && !isAbsolute10(relation)) {
|
|
317944
318096
|
return canonical;
|
|
317945
318097
|
}
|
|
@@ -318808,14 +318960,52 @@ function printDaemonResult(json, value) {
|
|
|
318808
318960
|
);
|
|
318809
318961
|
return;
|
|
318810
318962
|
}
|
|
318963
|
+
if (isRecord17(value) && value.ok === true) {
|
|
318964
|
+
const tasks = Array.isArray(value.tasks) ? value.tasks.filter(isDaemonTaskRecord) : [];
|
|
318965
|
+
if (tasks.length > 0) {
|
|
318966
|
+
console.log(picocolors33.green(`\u2714 ${tasks.length} daemon task(s)`));
|
|
318967
|
+
for (const task2 of tasks) printHumanDaemonTask(task2);
|
|
318968
|
+
return;
|
|
318969
|
+
}
|
|
318970
|
+
const task = isDaemonTaskRecord(value.task) ? value.task : void 0;
|
|
318971
|
+
if (task) {
|
|
318972
|
+
printHumanDaemonTask(task);
|
|
318973
|
+
return;
|
|
318974
|
+
}
|
|
318975
|
+
if (typeof value.activeTasks === "number") {
|
|
318976
|
+
console.log(
|
|
318977
|
+
picocolors33.green(
|
|
318978
|
+
`\u2714 Daemon healthy \xB7 ${value.activeTasks} active task(s)`
|
|
318979
|
+
)
|
|
318980
|
+
);
|
|
318981
|
+
return;
|
|
318982
|
+
}
|
|
318983
|
+
}
|
|
318811
318984
|
console.log(picocolors33.green(`\u2714 ${JSON.stringify(value)}`));
|
|
318812
318985
|
}
|
|
318986
|
+
function printHumanDaemonTask(task) {
|
|
318987
|
+
const icon = task.state === "completed" ? "\u2714" : ["failed", "aborted"].includes(task.state) ? "\u2716" : task.state === "canceled" || task.state === "orphaned" ? "\u26A0" : "\u25CF";
|
|
318988
|
+
const summary = `${icon} ${task.id} \xB7 ${task.state} \xB7 attempt ${task.attempt}`;
|
|
318989
|
+
console.log(
|
|
318990
|
+
task.state === "completed" ? picocolors33.green(summary) : task.state === "failed" || task.state === "aborted" ? picocolors33.red(summary) : picocolors33.yellow(summary)
|
|
318991
|
+
);
|
|
318992
|
+
if (task.failureCode) {
|
|
318993
|
+
const retry = task.retryable ? "\u53EF\u6062\u590D" : "\u4E0D\u53EF\u81EA\u52A8\u6062\u590D";
|
|
318994
|
+
console.log(picocolors33.gray(` failure: ${task.failureCode} \xB7 ${retry}`));
|
|
318995
|
+
}
|
|
318996
|
+
if (task.error) console.log(picocolors33.gray(` error: ${task.error}`));
|
|
318997
|
+
if (task.recoveryHint)
|
|
318998
|
+
console.log(picocolors33.cyan(` next: ${task.recoveryHint}`));
|
|
318999
|
+
}
|
|
318813
319000
|
function formatHost(host) {
|
|
318814
319001
|
return host.includes(":") && !host.startsWith("[") ? `[${host}]` : host;
|
|
318815
319002
|
}
|
|
318816
319003
|
function isRecord17(value) {
|
|
318817
319004
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
318818
319005
|
}
|
|
319006
|
+
function isDaemonTaskRecord(value) {
|
|
319007
|
+
return isRecord17(value) && typeof value.id === "string" && typeof value.state === "string" && typeof value.attempt === "number";
|
|
319008
|
+
}
|
|
318819
319009
|
function normalizeRootList(value) {
|
|
318820
319010
|
if (!Array.isArray(value)) return [];
|
|
318821
319011
|
return value.flatMap(
|
|
@@ -318839,7 +319029,7 @@ import {
|
|
|
318839
319029
|
writeFileSync as writeFileSync11
|
|
318840
319030
|
} from "fs";
|
|
318841
319031
|
import { createHash as createHash17, randomUUID as randomUUID16 } from "crypto";
|
|
318842
|
-
import { dirname as
|
|
319032
|
+
import { dirname as dirname19, isAbsolute as isAbsolute11, join as join31, relative as relative14, resolve as resolve29, sep as sep4 } from "path";
|
|
318843
319033
|
import { z as z99 } from "zod";
|
|
318844
319034
|
var MAX_BACKUP_BYTES = 64 * 1024 * 1024;
|
|
318845
319035
|
var MAX_SERIALIZED_BACKUP_BYTES = 96 * 1024 * 1024;
|
|
@@ -318928,7 +319118,7 @@ function createProjectBackup(projectDirectory) {
|
|
|
318928
319118
|
`Project backup exceeds ${formatBytes3(MAX_BACKUP_BYTES)}. Remove large generated data and retry.`
|
|
318929
319119
|
);
|
|
318930
319120
|
}
|
|
318931
|
-
const bundlePath = normalizeBundlePath(
|
|
319121
|
+
const bundlePath = normalizeBundlePath(relative14(orbitRoot, absolutePath));
|
|
318932
319122
|
if (!bundlePath) throw new Error("Unable to create a safe backup path.");
|
|
318933
319123
|
files.push({
|
|
318934
319124
|
path: bundlePath,
|
|
@@ -318948,7 +319138,7 @@ function createProjectBackup(projectDirectory) {
|
|
|
318948
319138
|
}
|
|
318949
319139
|
function writeProjectBackup(outputPath, bundle) {
|
|
318950
319140
|
const destination = resolve29(outputPath);
|
|
318951
|
-
mkdirSync12(
|
|
319141
|
+
mkdirSync12(dirname19(destination), { recursive: true });
|
|
318952
319142
|
const temporaryPath = `${destination}.${process.pid}.${randomUUID16()}.tmp`;
|
|
318953
319143
|
try {
|
|
318954
319144
|
writeFileSync11(
|
|
@@ -319008,7 +319198,7 @@ function restoreProjectBackup(projectDirectory, bundle, options = {}) {
|
|
|
319008
319198
|
try {
|
|
319009
319199
|
for (const { file, destination } of planned) {
|
|
319010
319200
|
const stagedPath = resolveBackupDestination(stagedRoot, file.path);
|
|
319011
|
-
mkdirSync12(
|
|
319201
|
+
mkdirSync12(dirname19(stagedPath), { recursive: true, mode: 448 });
|
|
319012
319202
|
writeFileSync11(stagedPath, Buffer.from(file.content, "base64"), {
|
|
319013
319203
|
mode: 384,
|
|
319014
319204
|
flag: "wx"
|
|
@@ -319017,11 +319207,11 @@ function restoreProjectBackup(projectDirectory, bundle, options = {}) {
|
|
|
319017
319207
|
}
|
|
319018
319208
|
for (const { file, destination, stagedPath } of staged) {
|
|
319019
319209
|
assertRestoreDestinationSafe(orbitRoot, destination, file.path);
|
|
319020
|
-
mkdirSync12(
|
|
319210
|
+
mkdirSync12(dirname19(destination), { recursive: true, mode: 448 });
|
|
319021
319211
|
let previousPath;
|
|
319022
319212
|
if (existsSync41(destination)) {
|
|
319023
319213
|
previousPath = resolveBackupDestination(previousRoot, file.path);
|
|
319024
|
-
mkdirSync12(
|
|
319214
|
+
mkdirSync12(dirname19(previousPath), { recursive: true, mode: 448 });
|
|
319025
319215
|
renameSync8(destination, previousPath);
|
|
319026
319216
|
}
|
|
319027
319217
|
const record2 = { destination, previousPath };
|
|
@@ -319038,7 +319228,7 @@ function restoreProjectBackup(projectDirectory, bundle, options = {}) {
|
|
|
319038
319228
|
try {
|
|
319039
319229
|
rmSync13(record2.destination, { force: true });
|
|
319040
319230
|
if (record2.previousPath && existsSync41(record2.previousPath)) {
|
|
319041
|
-
mkdirSync12(
|
|
319231
|
+
mkdirSync12(dirname19(record2.destination), { recursive: true });
|
|
319042
319232
|
renameSync8(record2.previousPath, record2.destination);
|
|
319043
319233
|
}
|
|
319044
319234
|
} catch (rollbackError) {
|
|
@@ -319061,10 +319251,10 @@ function restoreProjectBackup(projectDirectory, bundle, options = {}) {
|
|
|
319061
319251
|
}
|
|
319062
319252
|
}
|
|
319063
319253
|
function assertRestoreDestinationSafe(orbitRoot, destination, bundlePath) {
|
|
319064
|
-
assertDirectoryChainHasNoSymlink(orbitRoot,
|
|
319254
|
+
assertDirectoryChainHasNoSymlink(orbitRoot, dirname19(destination));
|
|
319065
319255
|
let current = resolve29(orbitRoot);
|
|
319066
|
-
const parent =
|
|
319067
|
-
for (const part of
|
|
319256
|
+
const parent = dirname19(destination);
|
|
319257
|
+
for (const part of relative14(current, parent).split(sep4).filter(Boolean)) {
|
|
319068
319258
|
current = join31(current, part);
|
|
319069
319259
|
if (existsSync41(current) && !lstatSync16(current).isDirectory()) {
|
|
319070
319260
|
throw new Error(
|
|
@@ -319098,7 +319288,7 @@ function listBackupFiles(root) {
|
|
|
319098
319288
|
);
|
|
319099
319289
|
}
|
|
319100
319290
|
const absolutePath = join31(directory, name);
|
|
319101
|
-
const relativePath =
|
|
319291
|
+
const relativePath = relative14(root, absolutePath).split(sep4).join("/");
|
|
319102
319292
|
const topLevel = relativePath.split("/")[0]?.toLowerCase() ?? "";
|
|
319103
319293
|
if (EXCLUDED_TOP_LEVEL.has(topLevel) || topLevel.startsWith(".restore-")) {
|
|
319104
319294
|
continue;
|
|
@@ -319142,7 +319332,7 @@ function resolveBackupDestination(root, filePath) {
|
|
|
319142
319332
|
function assertDirectoryChainHasNoSymlink(root, target) {
|
|
319143
319333
|
const absoluteRoot = resolve29(root);
|
|
319144
319334
|
const absoluteTarget = resolve29(target);
|
|
319145
|
-
const relativeTarget =
|
|
319335
|
+
const relativeTarget = relative14(absoluteRoot, absoluteTarget);
|
|
319146
319336
|
if (relativeTarget.startsWith("..") || isAbsolute11(relativeTarget)) {
|
|
319147
319337
|
throw new Error("Backup restore directory escapes the project.");
|
|
319148
319338
|
}
|
|
@@ -319273,11 +319463,11 @@ import {
|
|
|
319273
319463
|
} from "fs";
|
|
319274
319464
|
import { randomUUID as randomUUID17 } from "crypto";
|
|
319275
319465
|
import {
|
|
319276
|
-
dirname as
|
|
319466
|
+
dirname as dirname20,
|
|
319277
319467
|
extname as extname7,
|
|
319278
319468
|
isAbsolute as isAbsolute12,
|
|
319279
319469
|
join as join35,
|
|
319280
|
-
relative as
|
|
319470
|
+
relative as relative15,
|
|
319281
319471
|
resolve as resolve31,
|
|
319282
319472
|
sep as sep5
|
|
319283
319473
|
} from "path";
|
|
@@ -319320,7 +319510,7 @@ var ExtensionManager = class {
|
|
|
319320
319510
|
install(cwd, manifestPath, options = {}) {
|
|
319321
319511
|
const manifest = loadOrbitExtensionManifest(cwd, manifestPath);
|
|
319322
319512
|
verifyOrbitCompatibility(manifest, readCliVersion());
|
|
319323
|
-
const sourceRoot =
|
|
319513
|
+
const sourceRoot = dirname20(resolve31(cwd, manifestPath));
|
|
319324
319514
|
validateContributionFiles(sourceRoot, manifest);
|
|
319325
319515
|
validateContributionPermissions(manifest);
|
|
319326
319516
|
const requiresTrust = extensionRequiresTrust(manifest, sourceRoot);
|
|
@@ -319374,7 +319564,7 @@ var ExtensionManager = class {
|
|
|
319374
319564
|
}
|
|
319375
319565
|
for (const target2 of declarativeTargets) {
|
|
319376
319566
|
if (!existsSync45(target2.target)) continue;
|
|
319377
|
-
mkdirSync13(
|
|
319567
|
+
mkdirSync13(dirname20(target2.backup), { recursive: true });
|
|
319378
319568
|
renameSync9(target2.target, target2.backup);
|
|
319379
319569
|
target2.backedUp = true;
|
|
319380
319570
|
}
|
|
@@ -319391,7 +319581,7 @@ var ExtensionManager = class {
|
|
|
319391
319581
|
installedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
319392
319582
|
trusted: options.trust === true || !requiresTrust,
|
|
319393
319583
|
path: target,
|
|
319394
|
-
manifestFile:
|
|
319584
|
+
manifestFile: relative15(sourceRoot, resolve31(cwd, manifestPath)).replace(
|
|
319395
319585
|
/\\/g,
|
|
319396
319586
|
"/"
|
|
319397
319587
|
)
|
|
@@ -319417,7 +319607,7 @@ var ExtensionManager = class {
|
|
|
319417
319607
|
rmSync14(target2.target, { recursive: true, force: true });
|
|
319418
319608
|
}
|
|
319419
319609
|
if (target2.backedUp && existsSync45(target2.backup)) {
|
|
319420
|
-
mkdirSync13(
|
|
319610
|
+
mkdirSync13(dirname20(target2.target), { recursive: true });
|
|
319421
319611
|
renameSync9(target2.backup, target2.target);
|
|
319422
319612
|
}
|
|
319423
319613
|
}
|
|
@@ -319472,7 +319662,7 @@ var ExtensionManager = class {
|
|
|
319472
319662
|
try {
|
|
319473
319663
|
for (const entry of targets) {
|
|
319474
319664
|
if (!existsSync45(entry.target)) continue;
|
|
319475
|
-
mkdirSync13(
|
|
319665
|
+
mkdirSync13(dirname20(entry.backup), { recursive: true });
|
|
319476
319666
|
renameSync9(entry.target, entry.backup);
|
|
319477
319667
|
entry.backedUp = true;
|
|
319478
319668
|
}
|
|
@@ -319483,7 +319673,7 @@ var ExtensionManager = class {
|
|
|
319483
319673
|
try {
|
|
319484
319674
|
for (const entry of targets) {
|
|
319485
319675
|
if (!entry.backedUp || !existsSync45(entry.backup)) continue;
|
|
319486
|
-
mkdirSync13(
|
|
319676
|
+
mkdirSync13(dirname20(entry.target), { recursive: true });
|
|
319487
319677
|
renameSync9(entry.backup, entry.target);
|
|
319488
319678
|
}
|
|
319489
319679
|
rmSync14(rollbackRoot, { recursive: true, force: true });
|
|
@@ -319509,7 +319699,7 @@ var ExtensionManager = class {
|
|
|
319509
319699
|
}
|
|
319510
319700
|
isManagedExtensionPath(extension) {
|
|
319511
319701
|
const expected = resolve31(this.extensionsDir, extension.id);
|
|
319512
|
-
const slot =
|
|
319702
|
+
const slot = relative15(this.extensionsDir, expected);
|
|
319513
319703
|
const remainsInsideManagedRoot = slot.length > 0 && slot !== ".." && !slot.startsWith(`..${sep5}`) && !isAbsolute12(slot);
|
|
319514
319704
|
return remainsInsideManagedRoot && resolve31(extension.path) === expected;
|
|
319515
319705
|
}
|
|
@@ -319633,7 +319823,7 @@ function validateContributionFiles(root, manifest) {
|
|
|
319633
319823
|
];
|
|
319634
319824
|
for (const contribution of contributions) {
|
|
319635
319825
|
const target = resolve31(root, contribution.path);
|
|
319636
|
-
const relation =
|
|
319826
|
+
const relation = relative15(root, target);
|
|
319637
319827
|
if (relation.startsWith("..") || relation === "") {
|
|
319638
319828
|
throw new Error(
|
|
319639
319829
|
`Invalid extension contribution path: ${contribution.path}`
|
|
@@ -319690,7 +319880,7 @@ function validateContributionFiles(root, manifest) {
|
|
|
319690
319880
|
}
|
|
319691
319881
|
const definition = loadExtensionToolDefinition(root, tool.path);
|
|
319692
319882
|
const entrypoint = resolve31(root, definition.entrypoint);
|
|
319693
|
-
const relation =
|
|
319883
|
+
const relation = relative15(root, entrypoint);
|
|
319694
319884
|
if (relation.startsWith("..") || relation === "" || !existsSync45(entrypoint) || lstatSync17(entrypoint).isSymbolicLink() || !lstatSync17(entrypoint).isFile()) {
|
|
319695
319885
|
throw new Error(
|
|
319696
319886
|
`Extension tool entrypoint is missing or unsafe: ${definition.entrypoint}`
|
|
@@ -319733,7 +319923,7 @@ function copyDirectoryEntry(source, target, budget, depth) {
|
|
|
319733
319923
|
if (budget.bytes > MAX_EXTENSION_TREE_BYTES) {
|
|
319734
319924
|
throw new Error("Extension tree exceeds the 256 MiB limit.");
|
|
319735
319925
|
}
|
|
319736
|
-
mkdirSync13(
|
|
319926
|
+
mkdirSync13(dirname20(target), { recursive: true });
|
|
319737
319927
|
writeFileSync12(target, data, { mode: 384 });
|
|
319738
319928
|
}
|
|
319739
319929
|
function materializeDeclarativeContributions(extensionRoot, manifest, orbitDir) {
|
|
@@ -319763,7 +319953,7 @@ function removeTransactionArtifact(path9) {
|
|
|
319763
319953
|
function assertSafeManagedPath(target, managedRoot) {
|
|
319764
319954
|
const root = resolve31(managedRoot);
|
|
319765
319955
|
const absoluteTarget = resolve31(target);
|
|
319766
|
-
const relation =
|
|
319956
|
+
const relation = relative15(root, absoluteTarget);
|
|
319767
319957
|
if (relation === ".." || relation.startsWith(`..${sep5}`) || isAbsolute12(relation)) {
|
|
319768
319958
|
throw new Error(`Managed extension path escapes ${root}.`);
|
|
319769
319959
|
}
|
|
@@ -319793,7 +319983,7 @@ function assertSafeManagedPath(target, managedRoot) {
|
|
|
319793
319983
|
}
|
|
319794
319984
|
}
|
|
319795
319985
|
if (current === root) return;
|
|
319796
|
-
const parent =
|
|
319986
|
+
const parent = dirname20(current);
|
|
319797
319987
|
if (parent === current) {
|
|
319798
319988
|
throw new Error(`Managed extension path could not reach ${root}.`);
|
|
319799
319989
|
}
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ from pathlib import Path
|
|
|
9
9
|
from typing import Any
|
|
10
10
|
|
|
11
11
|
from project_utils import build_directory, delivery_directory, generated_directory
|
|
12
|
+
from script_runtime import configure_utf8_output
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
FIGURE_SUFFIXES = {".png"}
|
|
@@ -307,4 +308,5 @@ def main() -> None:
|
|
|
307
308
|
|
|
308
309
|
|
|
309
310
|
if __name__ == "__main__":
|
|
311
|
+
configure_utf8_output()
|
|
310
312
|
main()
|
|
@@ -12,6 +12,7 @@ from project_utils import (
|
|
|
12
12
|
delivery_directory,
|
|
13
13
|
question_numbers,
|
|
14
14
|
)
|
|
15
|
+
from script_runtime import configure_utf8_output
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
SKILL_ROOT = Path(__file__).resolve().parents[1]
|
|
@@ -484,4 +485,5 @@ if __name__ == "__main__":
|
|
|
484
485
|
|
|
485
486
|
|
|
486
487
|
if __name__ == "__main__":
|
|
488
|
+
configure_utf8_output()
|
|
487
489
|
main()
|
|
@@ -17,6 +17,7 @@ from project_utils import (
|
|
|
17
17
|
load_profile,
|
|
18
18
|
numeric_limit,
|
|
19
19
|
)
|
|
20
|
+
from script_runtime import configure_utf8_output
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
EXCLUDED_PARTS = {
|
|
@@ -310,4 +311,5 @@ def main() -> None:
|
|
|
310
311
|
|
|
311
312
|
|
|
312
313
|
if __name__ == "__main__":
|
|
314
|
+
configure_utf8_output()
|
|
313
315
|
main()
|
|
@@ -7,6 +7,7 @@ import sys
|
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
|
|
9
9
|
from project_utils import control_directory
|
|
10
|
+
from script_runtime import configure_utf8_output
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
def main() -> None:
|
|
@@ -55,4 +56,5 @@ def main() -> None:
|
|
|
55
56
|
|
|
56
57
|
|
|
57
58
|
if __name__ == "__main__":
|
|
59
|
+
configure_utf8_output()
|
|
58
60
|
main()
|
|
@@ -5,6 +5,7 @@ import shutil
|
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
|
|
7
7
|
from project_utils import build_directory
|
|
8
|
+
from script_runtime import configure_utf8_output
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
CACHE_DIR_NAMES = {
|
|
@@ -143,4 +144,5 @@ def main() -> None:
|
|
|
143
144
|
|
|
144
145
|
|
|
145
146
|
if __name__ == "__main__":
|
|
147
|
+
configure_utf8_output()
|
|
146
148
|
main()
|
|
@@ -8,6 +8,7 @@ from pathlib import Path
|
|
|
8
8
|
from typing import Any
|
|
9
9
|
|
|
10
10
|
from project_utils import control_path, delivery_directory, iter_regular_files
|
|
11
|
+
from script_runtime import configure_utf8_output
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
EXCLUDED_PARTS = {"__pycache__", ".pytest_cache", ".mypy_cache", ".ruff_cache", "build"}
|
|
@@ -119,4 +120,5 @@ def main() -> None:
|
|
|
119
120
|
|
|
120
121
|
|
|
121
122
|
if __name__ == "__main__":
|
|
123
|
+
configure_utf8_output()
|
|
122
124
|
main()
|
|
@@ -12,6 +12,7 @@ sys.dont_write_bytecode = True
|
|
|
12
12
|
|
|
13
13
|
from evidence_freeze import require_refresh_authorization, write_freeze
|
|
14
14
|
from project_utils import question_numbers
|
|
15
|
+
from script_runtime import configure_utf8_output
|
|
15
16
|
from validate_project import code_architecture_errors
|
|
16
17
|
|
|
17
18
|
|
|
@@ -96,4 +97,5 @@ def main() -> None:
|
|
|
96
97
|
|
|
97
98
|
|
|
98
99
|
if __name__ == "__main__":
|
|
100
|
+
configure_utf8_output()
|
|
99
101
|
main()
|
|
@@ -11,6 +11,7 @@ import zipfile
|
|
|
11
11
|
from pathlib import Path
|
|
12
12
|
|
|
13
13
|
from project_utils import control_directory
|
|
14
|
+
from script_runtime import configure_utf8_output
|
|
14
15
|
from typing import Any
|
|
15
16
|
from xml.etree import ElementTree
|
|
16
17
|
|
|
@@ -245,4 +246,5 @@ def main() -> None:
|
|
|
245
246
|
|
|
246
247
|
|
|
247
248
|
if __name__ == "__main__":
|
|
249
|
+
configure_utf8_output()
|
|
248
250
|
main()
|
|
@@ -13,6 +13,7 @@ from project_utils import (
|
|
|
13
13
|
numeric_limit,
|
|
14
14
|
question_numbers,
|
|
15
15
|
)
|
|
16
|
+
from script_runtime import configure_utf8_output
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
EXCLUDED_PARTS = {
|
|
@@ -127,4 +128,5 @@ def main() -> None:
|
|
|
127
128
|
|
|
128
129
|
|
|
129
130
|
if __name__ == "__main__":
|
|
131
|
+
configure_utf8_output()
|
|
130
132
|
main()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
from typing import TextIO
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def _configure_stream(stream: TextIO) -> None:
|
|
8
|
+
reconfigure = getattr(stream, "reconfigure", None)
|
|
9
|
+
if callable(reconfigure):
|
|
10
|
+
reconfigure(encoding="utf-8", errors="backslashreplace")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def configure_utf8_output() -> None:
|
|
14
|
+
"""Keep Chinese paths printable in terminals and redirected subprocess output."""
|
|
15
|
+
|
|
16
|
+
_configure_stream(sys.stdout)
|
|
17
|
+
_configure_stream(sys.stderr)
|
|
@@ -27,6 +27,7 @@ from project_utils import (
|
|
|
27
27
|
numeric_limit,
|
|
28
28
|
question_numbers,
|
|
29
29
|
)
|
|
30
|
+
from script_runtime import configure_utf8_output
|
|
30
31
|
from evidence_freeze import evidence_differences
|
|
31
32
|
|
|
32
33
|
|
|
@@ -1410,4 +1411,5 @@ def main() -> None:
|
|
|
1410
1411
|
|
|
1411
1412
|
|
|
1412
1413
|
if __name__ == "__main__":
|
|
1414
|
+
configure_utf8_output()
|
|
1413
1415
|
main()
|