@workit-dev/pi 2.11.1 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.js +1 -0
- package/dist/workit.js +60 -33
- package/package.json +1 -1
package/dist/worker.js
CHANGED
|
@@ -7405,6 +7405,7 @@ var workspaceConfigSchema = object({
|
|
|
7405
7405
|
releaseNotes: unknown().optional().describe("The release notes `workit release finish` publishes on the forge release: `auto` (default: the draft when there is one, else the notes built from the version's changelog section), `off` (no forge release) or `review` (finish refuses until `workit release notes approve`). A release track overrides it."),
|
|
7406
7406
|
trailers: boolean2().optional().describe("Whether commits get the `Workit-Session:` trailer (default true). With false, authorship lives in the ledger only."),
|
|
7407
7407
|
deleteBranch: boolean2().optional().describe("Whether `workit pr merge` deletes the head branch after a merge (default true); `--keep-branch` opts out for one merge."),
|
|
7408
|
+
cleanup: unknown().optional().describe("What happens when work finishes: `auto` (default) removes the delivered branch's clean Workit worktree and local branch, switches a clean checkout on it back to the trunk, and stops the processes registered inside them; `keep` removes and stops nothing. A value Workit does not know reads as `keep`."),
|
|
7408
7409
|
liveSessionGuard: boolean2().optional().describe("Whether the live-session guard denies edits in a checkout another live agent session owns (default true)."),
|
|
7409
7410
|
fanout: object({
|
|
7410
7411
|
tierModels: unknown().optional().describe("The model per slice TIER (mundane, standard, hard), as one name or per host.")
|
package/dist/workit.js
CHANGED
|
@@ -4,7 +4,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
4
4
|
|
|
5
5
|
// packages/workit-core/src/core.ts
|
|
6
6
|
import { spawnSync as spawnSync22 } from "node:child_process";
|
|
7
|
-
import { existsSync as
|
|
7
|
+
import { existsSync as existsSync14, realpathSync as realpathSync9 } from "node:fs";
|
|
8
8
|
import path35 from "node:path";
|
|
9
9
|
|
|
10
10
|
// packages/workit-core/src/core/task-contract.ts
|
|
@@ -9166,6 +9166,7 @@ var workspaceConfigSchema = object({
|
|
|
9166
9166
|
releaseNotes: unknown().optional().describe("The release notes `workit release finish` publishes on the forge release: `auto` (default: the draft when there is one, else the notes built from the version's changelog section), `off` (no forge release) or `review` (finish refuses until `workit release notes approve`). A release track overrides it."),
|
|
9167
9167
|
trailers: boolean2().optional().describe("Whether commits get the `Workit-Session:` trailer (default true). With false, authorship lives in the ledger only."),
|
|
9168
9168
|
deleteBranch: boolean2().optional().describe("Whether `workit pr merge` deletes the head branch after a merge (default true); `--keep-branch` opts out for one merge."),
|
|
9169
|
+
cleanup: unknown().optional().describe("What happens when work finishes: `auto` (default) removes the delivered branch's clean Workit worktree and local branch, switches a clean checkout on it back to the trunk, and stops the processes registered inside them; `keep` removes and stops nothing. A value Workit does not know reads as `keep`."),
|
|
9169
9170
|
liveSessionGuard: boolean2().optional().describe("Whether the live-session guard denies edits in a checkout another live agent session owns (default true)."),
|
|
9170
9171
|
fanout: object({
|
|
9171
9172
|
tierModels: unknown().optional().describe("The model per slice TIER (mundane, standard, hard), as one name or per host.")
|
|
@@ -18358,7 +18359,7 @@ var exportDigest = (bundle) => sha256({
|
|
|
18358
18359
|
});
|
|
18359
18360
|
// packages/workit-core/src/core/route-intent.ts
|
|
18360
18361
|
import { spawnSync as spawnSync17 } from "node:child_process";
|
|
18361
|
-
import { existsSync as
|
|
18362
|
+
import { existsSync as existsSync12 } from "node:fs";
|
|
18362
18363
|
import path30 from "node:path";
|
|
18363
18364
|
|
|
18364
18365
|
// packages/workit-core/src/hooks/raw-git.ts
|
|
@@ -18369,6 +18370,7 @@ import os6 from "node:os";
|
|
|
18369
18370
|
import path29 from "node:path";
|
|
18370
18371
|
|
|
18371
18372
|
// packages/workit-core/src/autonomy.ts
|
|
18373
|
+
import { closeSync as closeSync3, copyFileSync as copyFileSync2, existsSync as existsSync11, openSync as openSync3 } from "node:fs";
|
|
18372
18374
|
import path27 from "node:path";
|
|
18373
18375
|
|
|
18374
18376
|
// packages/workit-core/src/core/eval-world.ts
|
|
@@ -18534,12 +18536,36 @@ function checkSeal(dir) {
|
|
|
18534
18536
|
}
|
|
18535
18537
|
|
|
18536
18538
|
// packages/workit-core/src/autonomy.ts
|
|
18537
|
-
var
|
|
18539
|
+
var accountHomeDir = () => {
|
|
18538
18540
|
const home = grantsHome.resolve();
|
|
18539
18541
|
return home === null ? null : configDir({ HOME: home });
|
|
18540
18542
|
};
|
|
18541
|
-
var
|
|
18543
|
+
var deniedFile = (dir) => {
|
|
18544
|
+
for (const name of ["workspaces.json", SEAL_FILE]) {
|
|
18545
|
+
const file = path27.join(dir, name);
|
|
18546
|
+
try {
|
|
18547
|
+
closeSync3(openSync3(file, "r"));
|
|
18548
|
+
} catch (error) {
|
|
18549
|
+
const code = error.code;
|
|
18550
|
+
if (code === "EACCES" || code === "EPERM")
|
|
18551
|
+
return file;
|
|
18552
|
+
}
|
|
18553
|
+
}
|
|
18554
|
+
return null;
|
|
18555
|
+
};
|
|
18556
|
+
var accountDir = () => {
|
|
18557
|
+
const dir = accountHomeDir();
|
|
18558
|
+
return dir === null || deniedFile(dir) !== null ? null : dir;
|
|
18559
|
+
};
|
|
18560
|
+
var grantsDir = () => accountHomeDir() ?? resolveConfigDir();
|
|
18542
18561
|
var NO_ACCOUNT = "no OS account record answered (core/account-home.ts), so no grants are read: the D4 defaults apply";
|
|
18562
|
+
var accountUnread = () => {
|
|
18563
|
+
const dir = accountHomeDir();
|
|
18564
|
+
if (dir === null)
|
|
18565
|
+
return NO_ACCOUNT;
|
|
18566
|
+
const file = deniedFile(dir);
|
|
18567
|
+
return file === null ? null : `the account's ${path27.basename(file)} cannot be read (permission denied), so it reads as no workspace entries: no grants, no models, the D4 defaults apply`;
|
|
18568
|
+
};
|
|
18543
18569
|
var entriesIn = (dir) => dir === null ? [] : loadWorkspacesFrom(dir);
|
|
18544
18570
|
var fileSource = (dir = accountDir()) => ({
|
|
18545
18571
|
resolve: (cwd, name) => dir === null ? null : resolveWorkspaceFrom(cwd, dir, name),
|
|
@@ -18599,7 +18625,7 @@ var benchWorld = (cwd) => {
|
|
|
18599
18625
|
var grantsOverride = () => {
|
|
18600
18626
|
const shown = shownGrantsDir();
|
|
18601
18627
|
if (shown === null)
|
|
18602
|
-
return NO_ACCOUNT;
|
|
18628
|
+
return accountUnread() ?? NO_ACCOUNT;
|
|
18603
18629
|
const configured = path27.resolve(resolveConfigDir());
|
|
18604
18630
|
return configured === path27.resolve(shown) ? null : `the config directory is redirected to ${configured} (WORKIT_CONFIG, WORKIT_CONFIG_DIR or XDG_CONFIG_HOME), but that override does not apply to grants: grants are read only from ${path27.join(grantsDir(), "workspaces.json")}, and under a redirect they never exceed the D4 defaults`;
|
|
18605
18631
|
};
|
|
@@ -18768,9 +18794,10 @@ function capAt(source, named, where, by, why, main = false) {
|
|
|
18768
18794
|
}
|
|
18769
18795
|
function resolveAutonomy(cwd, target) {
|
|
18770
18796
|
const world = benchWorld(cwd);
|
|
18797
|
+
const unread = world ? null : accountUnread();
|
|
18798
|
+
if (unread !== null)
|
|
18799
|
+
return { ...autonomyOf(null), note: unread };
|
|
18771
18800
|
const override = world ? null : grantsOverride();
|
|
18772
|
-
if (override === NO_ACCOUNT)
|
|
18773
|
-
return { ...autonomyOf(null), note: override };
|
|
18774
18801
|
let resolved;
|
|
18775
18802
|
const once = typeof target === "function" ? () => resolved ??= target() : target;
|
|
18776
18803
|
const account = accountAuthority(cwd, world, once);
|
|
@@ -18869,9 +18896,9 @@ function capAtRemotes(source, autonomy, cwd, target) {
|
|
|
18869
18896
|
return capped;
|
|
18870
18897
|
}
|
|
18871
18898
|
var grantsMatter = (kind) => {
|
|
18872
|
-
|
|
18873
|
-
if (override === NO_ACCOUNT)
|
|
18899
|
+
if (accountUnread() !== null)
|
|
18874
18900
|
return false;
|
|
18901
|
+
const override = grantsOverride();
|
|
18875
18902
|
const entries = entriesIn(accountDir());
|
|
18876
18903
|
const matters = entries.some((entry) => {
|
|
18877
18904
|
const autonomy = autonomyOf(entry);
|
|
@@ -21484,7 +21511,7 @@ var judgedDir = (root, dir) => {
|
|
|
21484
21511
|
if (dir === null)
|
|
21485
21512
|
return root;
|
|
21486
21513
|
const resolved = path30.resolve(root, dir);
|
|
21487
|
-
return
|
|
21514
|
+
return existsSync12(resolved) && inWorkitWorkspace(resolved) ? resolved : null;
|
|
21488
21515
|
};
|
|
21489
21516
|
var shellBranchPolicyViolation = (root, command, dialect = "posix") => {
|
|
21490
21517
|
let judged = false;
|
|
@@ -23480,7 +23507,7 @@ class WorkitCore {
|
|
|
23480
23507
|
}
|
|
23481
23508
|
// packages/workit-core/src/core/repo-context.ts
|
|
23482
23509
|
import { spawnSync as spawnSync18 } from "node:child_process";
|
|
23483
|
-
import { existsSync as
|
|
23510
|
+
import { existsSync as existsSync13, readFileSync as readFileSync11, readdirSync as readdirSync4 } from "node:fs";
|
|
23484
23511
|
import path31 from "node:path";
|
|
23485
23512
|
var isSafeContextRange = (value) => value.length <= 4096 && (() => {
|
|
23486
23513
|
try {
|
|
@@ -23662,7 +23689,7 @@ var diffStatForRange = (cwd, range) => {
|
|
|
23662
23689
|
};
|
|
23663
23690
|
var packageScripts = (cwd, keys) => {
|
|
23664
23691
|
const pkgPath = path31.join(cwd, "package.json");
|
|
23665
|
-
if (!
|
|
23692
|
+
if (!existsSync13(pkgPath))
|
|
23666
23693
|
return [];
|
|
23667
23694
|
try {
|
|
23668
23695
|
const pkg = JSON.parse(readFileSync11(pkgPath, "utf8"));
|
|
@@ -23697,7 +23724,7 @@ var documentationFiles = (cwd) => {
|
|
|
23697
23724
|
return matches.toSorted().slice(0, 200);
|
|
23698
23725
|
};
|
|
23699
23726
|
var readTrimmed2 = (file, maxLines) => {
|
|
23700
|
-
if (!
|
|
23727
|
+
if (!existsSync13(file))
|
|
23701
23728
|
return "";
|
|
23702
23729
|
const lines = readFileSync11(file, "utf8").split(`
|
|
23703
23730
|
`);
|
|
@@ -23773,7 +23800,7 @@ ${status.stderr}` : "");
|
|
|
23773
23800
|
stdout += `
|
|
23774
23801
|
`;
|
|
23775
23802
|
stdout += printSection("Recent Validation Signals");
|
|
23776
|
-
if (
|
|
23803
|
+
if (existsSync13(path31.join(cwd, "package.json"))) {
|
|
23777
23804
|
stdout += `package.json detected. Common scripts:
|
|
23778
23805
|
`;
|
|
23779
23806
|
const found = packageScripts(cwd, ["lint", "format:check", "test", "build"]);
|
|
@@ -23782,7 +23809,7 @@ ${status.stderr}` : "");
|
|
|
23782
23809
|
`) + `
|
|
23783
23810
|
`;
|
|
23784
23811
|
}
|
|
23785
|
-
if (
|
|
23812
|
+
if (existsSync13(path31.join(cwd, "Cargo.toml")) || existsSync13(path31.join(cwd, "src-tauri/Cargo.toml"))) {
|
|
23786
23813
|
stdout += `Rust project detected.
|
|
23787
23814
|
`;
|
|
23788
23815
|
}
|
|
@@ -23834,7 +23861,7 @@ function changelogContext(root, range) {
|
|
|
23834
23861
|
`;
|
|
23835
23862
|
stdout += printSection("Existing CHANGELOG.md");
|
|
23836
23863
|
const changelogPath = path31.join(cwd, "CHANGELOG.md");
|
|
23837
|
-
if (
|
|
23864
|
+
if (existsSync13(changelogPath)) {
|
|
23838
23865
|
stdout += readTrimmed2(changelogPath, 260) + `
|
|
23839
23866
|
`;
|
|
23840
23867
|
} else {
|
|
@@ -23876,7 +23903,7 @@ function docsRefreshContext(root, range) {
|
|
|
23876
23903
|
`;
|
|
23877
23904
|
stdout += printSection("README Preview");
|
|
23878
23905
|
const readme = path31.join(cwd, "README.md");
|
|
23879
|
-
if (
|
|
23906
|
+
if (existsSync13(readme)) {
|
|
23880
23907
|
stdout += readTrimmed2(readme, 220) + `
|
|
23881
23908
|
`;
|
|
23882
23909
|
} else {
|
|
@@ -23885,7 +23912,7 @@ function docsRefreshContext(root, range) {
|
|
|
23885
23912
|
}
|
|
23886
23913
|
stdout += printSection("Package Scripts");
|
|
23887
23914
|
const pkgPath = path31.join(cwd, "package.json");
|
|
23888
|
-
if (
|
|
23915
|
+
if (existsSync13(pkgPath)) {
|
|
23889
23916
|
try {
|
|
23890
23917
|
const pkg = JSON.parse(readFileSync11(pkgPath, "utf8"));
|
|
23891
23918
|
stdout += JSON.stringify({ name: pkg.name, version: pkg.version, scripts: pkg.scripts }, null, 2) + `
|
|
@@ -23941,7 +23968,7 @@ function releaseNotesContext(root, rangeOrTag) {
|
|
|
23941
23968
|
`;
|
|
23942
23969
|
stdout += printSection("Existing Release Files");
|
|
23943
23970
|
for (const rel of ["CHANGELOG.md", "RELEASE_NOTES.md", ".github/releases.md"]) {
|
|
23944
|
-
if (
|
|
23971
|
+
if (existsSync13(path31.join(cwd, rel)))
|
|
23945
23972
|
stdout += rel + `
|
|
23946
23973
|
`;
|
|
23947
23974
|
}
|
|
@@ -24564,7 +24591,7 @@ function resolveInside(root, candidate) {
|
|
|
24564
24591
|
throw new Error("path must stay inside repository root");
|
|
24565
24592
|
}
|
|
24566
24593
|
let ancestor = target;
|
|
24567
|
-
while (!
|
|
24594
|
+
while (!existsSync14(ancestor))
|
|
24568
24595
|
ancestor = path35.dirname(ancestor);
|
|
24569
24596
|
const canonicalAncestor = realpathSync9(ancestor);
|
|
24570
24597
|
if (canonicalAncestor !== base && !canonicalAncestor.startsWith(base + path35.sep)) {
|
|
@@ -25903,7 +25930,7 @@ var splitDenial = (plan) => ({
|
|
|
25903
25930
|
});
|
|
25904
25931
|
// packages/workit-core/src/hooks/write-gate.ts
|
|
25905
25932
|
import {
|
|
25906
|
-
existsSync as
|
|
25933
|
+
existsSync as existsSync15,
|
|
25907
25934
|
readdirSync as readdirSync5,
|
|
25908
25935
|
readFileSync as readFileSync12,
|
|
25909
25936
|
readlinkSync as readlinkSync3,
|
|
@@ -26615,7 +26642,7 @@ var linkSources = (args, at) => {
|
|
|
26615
26642
|
const sources = names.filter((name, index) => into >= 0 ? name !== dest : index < names.length - 1 || names.length === 1);
|
|
26616
26643
|
const target = dest === undefined ? null : at(dest);
|
|
26617
26644
|
const symbolic = args.some((arg) => /^-[a-zA-Z]*s|^--symbolic$/.test(arg));
|
|
26618
|
-
const base = target === null ? null : into >= 0 || sources.length > 1 ||
|
|
26645
|
+
const base = target === null ? null : into >= 0 || sources.length > 1 || existsSync15(target) || /[\\/]$/.test(dest ?? "") ? target : path41.dirname(target);
|
|
26619
26646
|
return sources.flatMap((source) => {
|
|
26620
26647
|
if (symbolic && base !== null && !path41.isAbsolute(homeExpanded(source)))
|
|
26621
26648
|
return [path41.resolve(base, source)];
|
|
@@ -28344,7 +28371,7 @@ import path46 from "node:path";
|
|
|
28344
28371
|
|
|
28345
28372
|
// packages/workit-core/src/approvals/release-notes-ask.ts
|
|
28346
28373
|
import { createHash as createHash20 } from "node:crypto";
|
|
28347
|
-
import { existsSync as
|
|
28374
|
+
import { existsSync as existsSync16, readFileSync as readFileSync14 } from "node:fs";
|
|
28348
28375
|
import path44 from "node:path";
|
|
28349
28376
|
var sha2563 = (data) => createHash20("sha256").update(data).digest("hex");
|
|
28350
28377
|
var isReleaseNotesApprove = (words) => words[0] === "notes" && words[1] === "approve";
|
|
@@ -28390,7 +28417,7 @@ var releaseNotesAskAt = (args, cwd) => {
|
|
|
28390
28417
|
path44.join(dir, "packages", `${version.replaceAll("/", "%2F")}.md`),
|
|
28391
28418
|
path44.join(dir, `${version}.md`)
|
|
28392
28419
|
])
|
|
28393
|
-
if (
|
|
28420
|
+
if (existsSync16(file))
|
|
28394
28421
|
try {
|
|
28395
28422
|
return releaseNotesAsk(args, { path: file, notes: readFileSync14(file, "utf8") });
|
|
28396
28423
|
} catch {
|
|
@@ -30130,7 +30157,7 @@ var cdWorkitSplit = (command) => {
|
|
|
30130
30157
|
};
|
|
30131
30158
|
|
|
30132
30159
|
// packages/workit-core/src/hooks/model-limit.ts
|
|
30133
|
-
import { closeSync as
|
|
30160
|
+
import { closeSync as closeSync4, openSync as openSync4, readdirSync as readdirSync7, readSync, statSync as statSync5 } from "node:fs";
|
|
30134
30161
|
import os11 from "node:os";
|
|
30135
30162
|
import path49 from "node:path";
|
|
30136
30163
|
var MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
|
|
@@ -30271,21 +30298,21 @@ var TAIL_BYTES2 = 16384;
|
|
|
30271
30298
|
var tail = (file, size) => {
|
|
30272
30299
|
const length = Math.min(size, TAIL_BYTES2);
|
|
30273
30300
|
const buffer = Buffer.alloc(length);
|
|
30274
|
-
const fd =
|
|
30301
|
+
const fd = openSync4(file, "r");
|
|
30275
30302
|
try {
|
|
30276
30303
|
readSync(fd, buffer, 0, length, size - length);
|
|
30277
30304
|
} finally {
|
|
30278
|
-
|
|
30305
|
+
closeSync4(fd);
|
|
30279
30306
|
}
|
|
30280
30307
|
return buffer.toString("utf8");
|
|
30281
30308
|
};
|
|
30282
30309
|
var start = (file) => {
|
|
30283
30310
|
const buffer = Buffer.alloc(TAIL_BYTES2);
|
|
30284
|
-
const fd =
|
|
30311
|
+
const fd = openSync4(file, "r");
|
|
30285
30312
|
try {
|
|
30286
30313
|
return buffer.subarray(0, readSync(fd, buffer, 0, TAIL_BYTES2, 0)).toString("utf8");
|
|
30287
30314
|
} finally {
|
|
30288
|
-
|
|
30315
|
+
closeSync4(fd);
|
|
30289
30316
|
}
|
|
30290
30317
|
};
|
|
30291
30318
|
var parse5 = (line) => {
|
|
@@ -31840,7 +31867,7 @@ var abandonedLaunches = (root) => {
|
|
|
31840
31867
|
var cancelHint = (workerId) => `cancel it first: workit_worker {"action":"cancel","workerId":"${workerId}","reason":"launch outcome unknown"} (CLI: workit worker cancel --payload '{"workerId":"${workerId}","reason":"launch outcome unknown"}')`;
|
|
31841
31868
|
|
|
31842
31869
|
// packages/workit-core/src/core/cli-locate.ts
|
|
31843
|
-
import { closeSync as
|
|
31870
|
+
import { closeSync as closeSync5, existsSync as existsSync17, openSync as openSync5, readSync as readSync2 } from "node:fs";
|
|
31844
31871
|
import path53 from "node:path";
|
|
31845
31872
|
var LAUNCHER_MARKER = "workit-owned-launcher";
|
|
31846
31873
|
var CLI_PACKAGE_PATH = ["node_modules", "@workit-dev", "cli"];
|
|
@@ -31855,7 +31882,7 @@ var ownedCurrentEntry = (env, platform = process.platform) => path53.join(instal
|
|
|
31855
31882
|
var head = (file) => {
|
|
31856
31883
|
let fd;
|
|
31857
31884
|
try {
|
|
31858
|
-
fd =
|
|
31885
|
+
fd = openSync5(file, "r");
|
|
31859
31886
|
const buffer = Buffer.alloc(256);
|
|
31860
31887
|
const read = readSync2(fd, buffer, 0, buffer.length, 0);
|
|
31861
31888
|
return buffer.subarray(0, read).toString("utf8");
|
|
@@ -31863,13 +31890,13 @@ var head = (file) => {
|
|
|
31863
31890
|
return "";
|
|
31864
31891
|
} finally {
|
|
31865
31892
|
if (fd !== undefined)
|
|
31866
|
-
|
|
31893
|
+
closeSync5(fd);
|
|
31867
31894
|
}
|
|
31868
31895
|
};
|
|
31869
31896
|
var locateWorkitCli = (options = {}) => {
|
|
31870
31897
|
const env = options.env ?? process.env;
|
|
31871
31898
|
const platform = options.platform ?? process.platform;
|
|
31872
|
-
const exists = options.exists ??
|
|
31899
|
+
const exists = options.exists ?? existsSync17;
|
|
31873
31900
|
const read = options.read ?? head;
|
|
31874
31901
|
const node = options.node ?? process.execPath;
|
|
31875
31902
|
const launcher = ownedLauncherPath(env, platform);
|