@cydm/pie 4.4.2 → 4.5.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/builtin/extensions/ask-user/index.js +6 -6
- package/dist/builtin/extensions/changelog/index.js +1 -1
- package/dist/builtin/extensions/cron/index.js +55 -7
- package/dist/builtin/extensions/document-attachments/index.js +1 -1
- package/dist/builtin/extensions/herdr-agent-state/index.js +1 -1
- package/dist/builtin/extensions/im-forward/README.md +3 -1
- package/dist/builtin/extensions/im-forward/index.js +364 -118
- package/dist/builtin/extensions/init/index.js +1 -1
- package/dist/builtin/extensions/mcp-adapter/index.js +2 -2
- package/dist/builtin/extensions/memory/index.js +9 -11
- package/dist/builtin/extensions/pie-ipc/index.js +70 -19
- package/dist/builtin/extensions/pie-proc/index.js +27 -13
- package/dist/builtin/extensions/plan-mode/index.js +6 -6
- package/dist/builtin/extensions/subagent/index.js +9 -11
- package/dist/builtin/extensions/todo/index.js +6 -6
- package/dist/builtin/skills/chrome-devtools-axi/SKILL.md +24 -1
- package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-bridge.js +86 -21
- package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-cli.js +6 -1
- package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-runtime.js +1 -1
- package/dist/builtin/skills/chrome-devtools-axi/{cli-CHC7XYFU.js → cli-NLPMVDGG.js} +32 -4
- package/dist/builtin/skills/computer-use-axi/computer-use-axi-broker.js +220 -22
- package/dist/chunks/{auth-storage-RABPRJ6T.js → auth-storage-C3FZMT7J.js} +3 -3
- package/dist/chunks/{chunk-OFLKAWI4.js → chunk-2CJIENLY.js} +90 -100
- package/dist/chunks/{chunk-R7VO46EK.js → chunk-3W3SXVPB.js} +5 -4
- package/dist/chunks/{chunk-IPLMGAML.js → chunk-5KI4Y4LA.js} +1 -1
- package/dist/chunks/{chunk-YNTIOWCD.js → chunk-BLDI2GRF.js} +5 -5
- package/dist/chunks/{chunk-UCKOXAME.js → chunk-CBDQJMUI.js} +9 -44
- package/dist/chunks/chunk-CGSFBWOM.js +100 -0
- package/dist/chunks/{chunk-7LTQLJJF.js → chunk-LAJXWOKS.js} +15 -10
- package/dist/chunks/{chunk-RZGYXAJU.js → chunk-LZQXQOPJ.js} +1 -12
- package/dist/chunks/{chunk-EQOI6RZV.js → chunk-NHV2CALB.js} +3 -5
- package/dist/chunks/{chunk-OV7SLSHR.js → chunk-SW2E33UL.js} +2 -4
- package/dist/chunks/{chunk-BPSCGGVF.js → chunk-XXGYUYXI.js} +1 -1
- package/dist/chunks/{chunk-XO3NM7BB.js → chunk-Y3I2UV5Y.js} +3 -3
- package/dist/chunks/{chunk-IZDNZW3S.js → chunk-Z2FKA2ZH.js} +8 -8
- package/dist/chunks/chunk-ZPJ3BNQB.js +126 -0
- package/dist/chunks/{config-HF2PDLN5.js → config-4EOI5NOU.js} +2 -4
- package/dist/chunks/{manager-cli-BYCF4RKN.js → manager-cli-2ATPC47M.js} +35 -5
- package/dist/chunks/manager-upgrade-5CPKTRJ7.js +562 -0
- package/dist/chunks/{model-registry-7FNIUYPF.js → model-registry-3XAHXXTA.js} +5 -5
- package/dist/chunks/{src-OVWRBWKU.js → src-B44QWSGM.js} +4 -4
- package/dist/chunks/{src-A5YI46OD.js → src-CLE5ILN4.js} +6 -6
- package/dist/chunks/{src-OA3TP6DS.js → src-EGXFJ3WA.js} +5 -5
- package/dist/chunks/{src-TF2RAGRU.js → src-Q7LU27C2.js} +3 -3
- package/dist/chunks/{test-stream-7YZDGBPO.js → test-stream-OR3EJBNF.js} +3 -3
- package/dist/cli.js +173 -136
- package/package.json +3 -3
- package/dist/chunks/chunk-7KLWHWZD.js +0 -164
|
@@ -2,17 +2,17 @@ import { createRequire as __createRequire } from "node:module"; const require =
|
|
|
2
2
|
import {
|
|
3
3
|
createAgentOperationError,
|
|
4
4
|
getAgentFailureMetadata
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5KI4Y4LA.js";
|
|
6
6
|
import {
|
|
7
7
|
FileSystemGateway,
|
|
8
8
|
detectPlatform,
|
|
9
9
|
getFileSystemGateway,
|
|
10
10
|
getPlatformConfig,
|
|
11
11
|
streamSimple
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3W3SXVPB.js";
|
|
13
13
|
import {
|
|
14
14
|
Type
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-XXGYUYXI.js";
|
|
16
16
|
|
|
17
17
|
// ../../packages/agent-framework/src/skills/parser.ts
|
|
18
18
|
function parseFrontmatter(yaml) {
|
|
@@ -147,7 +147,7 @@ function pathContains(parent, child) {
|
|
|
147
147
|
}
|
|
148
148
|
async function readExcludeCwds() {
|
|
149
149
|
try {
|
|
150
|
-
const { getSettingsPath } = await import("./config-
|
|
150
|
+
const { getSettingsPath } = await import("./config-4EOI5NOU.js");
|
|
151
151
|
const raw = JSON.parse(fs.readFileSync(getSettingsPath(), "utf8"));
|
|
152
152
|
const list = raw?.extensions?.memory?.excludeCwds;
|
|
153
153
|
if (!Array.isArray(list)) return [];
|
|
@@ -171,11 +171,11 @@ async function runDistillWorkerMain(memoryRoot, date, noExit = false) {
|
|
|
171
171
|
let result;
|
|
172
172
|
let ledger;
|
|
173
173
|
try {
|
|
174
|
-
const { ModelRegistry } = await import("./model-registry-
|
|
175
|
-
const { AuthStorage } = await import("./auth-storage-
|
|
176
|
-
const { getSessionsDir } = await import("./config-
|
|
177
|
-
const { FileSessionStore } = await import("./src-
|
|
178
|
-
const { MemoryStore, runDistillation } = await import("./src-
|
|
174
|
+
const { ModelRegistry } = await import("./model-registry-3XAHXXTA.js");
|
|
175
|
+
const { AuthStorage } = await import("./auth-storage-C3FZMT7J.js");
|
|
176
|
+
const { getSessionsDir } = await import("./config-4EOI5NOU.js");
|
|
177
|
+
const { FileSessionStore } = await import("./src-EGXFJ3WA.js");
|
|
178
|
+
const { MemoryStore, runDistillation } = await import("./src-CLE5ILN4.js");
|
|
179
179
|
const store = new MemoryStore(memoryRoot);
|
|
180
180
|
ledger = store;
|
|
181
181
|
const registry = new ModelRegistry(AuthStorage.create());
|
|
@@ -190,7 +190,7 @@ async function runDistillWorkerMain(memoryRoot, date, noExit = false) {
|
|
|
190
190
|
if (!resolved.model || !resolved.apiKey) {
|
|
191
191
|
throw new Error(`no complete model/key pair for class ${modelClass}${resolved.fallbackReason ? `: ${resolved.fallbackReason}` : ""}`);
|
|
192
192
|
}
|
|
193
|
-
const { completeSimple } = await import("./src-
|
|
193
|
+
const { completeSimple } = await import("./src-Q7LU27C2.js");
|
|
194
194
|
const message = await withModelTimeout(
|
|
195
195
|
completeSimple(
|
|
196
196
|
resolved.model,
|
|
@@ -255,7 +255,7 @@ async function runDistillAuto(memoryRoot, days = 7, runner) {
|
|
|
255
255
|
} catch {
|
|
256
256
|
}
|
|
257
257
|
};
|
|
258
|
-
const { MemoryStore, todayKey } = await import("./src-
|
|
258
|
+
const { MemoryStore, todayKey } = await import("./src-CLE5ILN4.js");
|
|
259
259
|
const store = new MemoryStore(memoryRoot);
|
|
260
260
|
const today = todayKey(Date.now());
|
|
261
261
|
const dates = [];
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/core/node-ownership-lock.ts
|
|
4
|
+
import * as fs from "node:fs";
|
|
5
|
+
import * as path from "node:path";
|
|
6
|
+
import { randomUUID } from "node:crypto";
|
|
7
|
+
function pidDefinitelyDead(pid) {
|
|
8
|
+
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
9
|
+
try {
|
|
10
|
+
process.kill(pid, 0);
|
|
11
|
+
return false;
|
|
12
|
+
} catch (error) {
|
|
13
|
+
return error.code === "ESRCH";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function withOwnershipMutex(lock, fn) {
|
|
17
|
+
fs.mkdirSync(path.dirname(lock), { recursive: true, mode: 448 });
|
|
18
|
+
const token = randomUUID();
|
|
19
|
+
const candidate = `${lock}.acquire.${token}`;
|
|
20
|
+
fs.mkdirSync(candidate, { mode: 448 });
|
|
21
|
+
try {
|
|
22
|
+
fs.writeFileSync(path.join(candidate, `held.${token}`), JSON.stringify({ version: 1, pid: process.pid }), { flag: "wx", mode: 384 });
|
|
23
|
+
const deadline = process.hrtime.bigint() + 2000000000n;
|
|
24
|
+
for (; ; ) {
|
|
25
|
+
try {
|
|
26
|
+
fs.renameSync(candidate, lock);
|
|
27
|
+
break;
|
|
28
|
+
} catch (error) {
|
|
29
|
+
if (!["EEXIST", "ENOTEMPTY", "EPERM", "ENOTDIR"].includes(error.code ?? "")) throw error;
|
|
30
|
+
if (process.hrtime.bigint() >= deadline) throw new Error(`Ownership mutex contention: ${lock}`);
|
|
31
|
+
try {
|
|
32
|
+
const entries = fs.readdirSync(lock);
|
|
33
|
+
if (entries.every((name) => {
|
|
34
|
+
if (!/^held\.[a-f0-9-]+$/.test(name)) return false;
|
|
35
|
+
const value = JSON.parse(fs.readFileSync(path.join(lock, name), "utf8"));
|
|
36
|
+
return value?.version === 1 && pidDefinitelyDead(value.pid);
|
|
37
|
+
})) {
|
|
38
|
+
for (const name of entries) {
|
|
39
|
+
try {
|
|
40
|
+
fs.unlinkSync(path.join(lock, name));
|
|
41
|
+
} catch (e) {
|
|
42
|
+
if (e.code !== "ENOENT") throw e;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
fs.rmdirSync(lock);
|
|
46
|
+
}
|
|
47
|
+
} catch {
|
|
48
|
+
}
|
|
49
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 3);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
return fn();
|
|
54
|
+
} finally {
|
|
55
|
+
try {
|
|
56
|
+
fs.unlinkSync(path.join(lock, `held.${token}`));
|
|
57
|
+
} catch {
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
fs.rmdirSync(lock);
|
|
61
|
+
} catch {
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
} finally {
|
|
65
|
+
fs.rmSync(candidate, { recursive: true, force: true });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function readOwnership(target, valid) {
|
|
69
|
+
let raw;
|
|
70
|
+
try {
|
|
71
|
+
raw = fs.readFileSync(target, "utf8");
|
|
72
|
+
} catch (error) {
|
|
73
|
+
if (error.code === "ENOENT") return void 0;
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
const value = JSON.parse(raw);
|
|
77
|
+
if (!value || !Number.isInteger(value.pid) || value.pid <= 0 || typeof value.holder !== "string" || !Number.isFinite(value.heartbeatAt) || value.generation !== void 0 && typeof value.generation !== "string" || !valid(value)) {
|
|
78
|
+
throw new Error(`Invalid ownership record: ${target}`);
|
|
79
|
+
}
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
function claimOwnership(target, mine, valid) {
|
|
83
|
+
const mutex = `${target}.mutex`;
|
|
84
|
+
const generation = randomUUID();
|
|
85
|
+
const publish = () => {
|
|
86
|
+
const tmp = `${target}.${randomUUID()}.tmp`;
|
|
87
|
+
try {
|
|
88
|
+
fs.writeFileSync(tmp, `${JSON.stringify({ ...mine, generation, heartbeatAt: Date.now() })}
|
|
89
|
+
`, { flag: "wx", mode: 384 });
|
|
90
|
+
fs.renameSync(tmp, target);
|
|
91
|
+
} finally {
|
|
92
|
+
fs.rmSync(tmp, { force: true });
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const holder = withOwnershipMutex(mutex, () => {
|
|
96
|
+
const current = readOwnership(target, valid);
|
|
97
|
+
if (current && !pidDefinitelyDead(current.pid)) return current;
|
|
98
|
+
publish();
|
|
99
|
+
return void 0;
|
|
100
|
+
});
|
|
101
|
+
if (holder) return { holder };
|
|
102
|
+
let released = false;
|
|
103
|
+
return { handle: {
|
|
104
|
+
heartbeat: () => {
|
|
105
|
+
if (released) return false;
|
|
106
|
+
return withOwnershipMutex(mutex, () => {
|
|
107
|
+
if (readOwnership(target, valid)?.generation !== generation) return false;
|
|
108
|
+
publish();
|
|
109
|
+
return true;
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
release: () => {
|
|
113
|
+
if (released) return;
|
|
114
|
+
released = true;
|
|
115
|
+
withOwnershipMutex(mutex, () => {
|
|
116
|
+
if (readOwnership(target, valid)?.generation === generation) fs.unlinkSync(target);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
} };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export {
|
|
123
|
+
pidDefinitelyDead,
|
|
124
|
+
readOwnership,
|
|
125
|
+
claimOwnership
|
|
126
|
+
};
|
|
@@ -18,13 +18,11 @@ import {
|
|
|
18
18
|
getSessionsDir,
|
|
19
19
|
getSettingsPath,
|
|
20
20
|
getThemesDir,
|
|
21
|
-
init_config,
|
|
22
21
|
isBunRuntime,
|
|
23
22
|
migrateConfigFromAgentDir,
|
|
24
23
|
resolveSessionsDirOverride
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
init_config();
|
|
24
|
+
} from "./chunk-CBDQJMUI.js";
|
|
25
|
+
import "./chunk-LZQXQOPJ.js";
|
|
28
26
|
export {
|
|
29
27
|
APP_NAME,
|
|
30
28
|
CONFIG_DIR_NAME,
|
|
@@ -3,10 +3,9 @@ import {
|
|
|
3
3
|
readProcessCommandLine
|
|
4
4
|
} from "./chunk-X6LBWHK3.js";
|
|
5
5
|
import {
|
|
6
|
-
getConfigDir
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import "./chunk-RZGYXAJU.js";
|
|
6
|
+
getConfigDir
|
|
7
|
+
} from "./chunk-CBDQJMUI.js";
|
|
8
|
+
import "./chunk-LZQXQOPJ.js";
|
|
10
9
|
|
|
11
10
|
// src/commands/manager-cli.ts
|
|
12
11
|
import { spawn, execFileSync } from "node:child_process";
|
|
@@ -14,7 +13,6 @@ import { createRequire } from "node:module";
|
|
|
14
13
|
import * as fs from "node:fs";
|
|
15
14
|
import * as os from "node:os";
|
|
16
15
|
import * as path from "node:path";
|
|
17
|
-
init_config();
|
|
18
16
|
var require_ = createRequire(import.meta.url);
|
|
19
17
|
var CRON_SECTION_MARKER = "## \u5B9A\u65F6\u4EFB\u52A1";
|
|
20
18
|
var CRON_SECTION = `
|
|
@@ -776,6 +774,34 @@ function withStartLock(dir, fn) {
|
|
|
776
774
|
}
|
|
777
775
|
});
|
|
778
776
|
}
|
|
777
|
+
async function runUpgradeCommand(args) {
|
|
778
|
+
const { upgradePaths, performUpgrade, cliEffects, parseTarget } = await import("./manager-upgrade-5CPKTRJ7.js");
|
|
779
|
+
const targetIdx = args.indexOf("--target");
|
|
780
|
+
if (targetIdx >= 0 && typeof args[targetIdx + 1] !== "string") {
|
|
781
|
+
console.error('--target expects "latest" or an x.y.z version (no value given)');
|
|
782
|
+
process.exitCode = 2;
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
785
|
+
const target = parseTarget(targetIdx >= 0 ? args[targetIdx + 1] : void 0);
|
|
786
|
+
if (target === void 0) {
|
|
787
|
+
const given = targetIdx >= 0 ? args[targetIdx + 1] : void 0;
|
|
788
|
+
console.error(`--target expects "latest" or an x.y.z version (got ${JSON.stringify(given)})`);
|
|
789
|
+
process.exitCode = 2;
|
|
790
|
+
return;
|
|
791
|
+
}
|
|
792
|
+
const force = args.includes("--force");
|
|
793
|
+
const paths = upgradePaths(process.argv[1] ?? "");
|
|
794
|
+
console.log(`Upgrading @cydm/pie \u2192 ${target} (this may take a minute)\u2026`);
|
|
795
|
+
const result = await performUpgrade(paths, cliEffects(paths, (m) => console.log(m)), { target, force });
|
|
796
|
+
if (result.ok) {
|
|
797
|
+
console.log(`\u2713 Upgraded ${result.fromVersion} \u2192 ${result.toVersion}`);
|
|
798
|
+
if (result.workersRecycled?.length) console.log(` recycled idle workers: ${result.workersRecycled.map((w) => `${w.name}(${w.pid})`).join(", ")}`);
|
|
799
|
+
if (result.workersSkipped?.length) console.log(` busy workers left as-is: ${result.workersSkipped.map((w) => `${w.name}(${w.pid})`).join(", ")}`);
|
|
800
|
+
} else {
|
|
801
|
+
console.error(`\u2717 Upgrade stopped at "${result.stage}": ${result.detail ?? "unknown"}`);
|
|
802
|
+
process.exitCode = 1;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
779
805
|
async function runManagerCommand(args) {
|
|
780
806
|
const sub = args[0] ?? "";
|
|
781
807
|
const dir = sub === "tail" ? tailWorkspaceDir() : workspaceDir();
|
|
@@ -971,6 +997,10 @@ async function runManagerCommand(args) {
|
|
|
971
997
|
process.exitCode = 2;
|
|
972
998
|
return;
|
|
973
999
|
}
|
|
1000
|
+
if (sub === "upgrade") {
|
|
1001
|
+
await runUpgradeCommand(args.slice(1));
|
|
1002
|
+
return;
|
|
1003
|
+
}
|
|
974
1004
|
if (sub === "tail") {
|
|
975
1005
|
const follow = args.includes("-f") || args.includes("--follow");
|
|
976
1006
|
const jsonOut = args.includes("--json");
|