omegon 0.6.4 → 0.6.5
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/bin/omegon.mjs +48 -8
- package/extensions/bootstrap/index.ts +1 -0
- package/package.json +1 -1
package/bin/omegon.mjs
CHANGED
|
@@ -2,39 +2,79 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Omegon entry point.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* from omegon rather than from ~/.pi/agent/.
|
|
5
|
+
* Keeps mutable user state in the shared pi-compatible agent directory while
|
|
6
|
+
* injecting Omegon-packaged resources from the installed package root.
|
|
8
7
|
*
|
|
9
8
|
* Resolution order for the underlying agent core:
|
|
10
9
|
* 1. vendor/pi-mono (dev mode — git submodule present)
|
|
11
10
|
* 2. node_modules/@styrene-lab/pi-coding-agent (installed via npm)
|
|
12
11
|
*/
|
|
12
|
+
import { copyFileSync, cpSync, existsSync, mkdirSync } from "node:fs";
|
|
13
13
|
import { dirname, join } from "node:path";
|
|
14
|
-
import {
|
|
14
|
+
import { homedir } from "node:os";
|
|
15
15
|
import { fileURLToPath } from "node:url";
|
|
16
16
|
|
|
17
17
|
const __filename = fileURLToPath(import.meta.url);
|
|
18
18
|
const omegonRoot = dirname(dirname(__filename));
|
|
19
|
+
const defaultStateDir = join(homedir(), ".pi", "agent");
|
|
20
|
+
const stateDir = process.env.PI_CODING_AGENT_DIR || defaultStateDir;
|
|
21
|
+
const usingExplicitStateOverride = Boolean(process.env.PI_CODING_AGENT_DIR);
|
|
19
22
|
|
|
20
23
|
const vendorCli = join(omegonRoot, "vendor/pi-mono/packages/coding-agent/dist/cli.js");
|
|
21
24
|
const npmCli = join(omegonRoot, "node_modules/@styrene-lab/pi-coding-agent/dist/cli.js");
|
|
22
25
|
const cli = existsSync(vendorCli) ? vendorCli : npmCli;
|
|
23
26
|
const resolutionMode = cli === vendorCli ? "vendor" : "npm";
|
|
24
27
|
|
|
28
|
+
function migrateLegacyStatePath(relativePath, kind = "file") {
|
|
29
|
+
if (usingExplicitStateOverride) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const legacyPath = join(omegonRoot, relativePath);
|
|
34
|
+
const targetPath = join(stateDir, relativePath);
|
|
35
|
+
if (!existsSync(legacyPath) || existsSync(targetPath)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
mkdirSync(dirname(targetPath), { recursive: true });
|
|
40
|
+
if (kind === "directory") {
|
|
41
|
+
cpSync(legacyPath, targetPath, { recursive: true, force: false });
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
copyFileSync(legacyPath, targetPath);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function injectBundledResourceArgs(argv) {
|
|
48
|
+
const injected = [...argv];
|
|
49
|
+
const pushPair = (flag, value) => {
|
|
50
|
+
if (existsSync(value)) {
|
|
51
|
+
injected.push(flag, value);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
pushPair("--extension", omegonRoot);
|
|
56
|
+
pushPair("--skill", join(omegonRoot, "skills"));
|
|
57
|
+
pushPair("--prompt-template", join(omegonRoot, "prompts"));
|
|
58
|
+
pushPair("--theme", join(omegonRoot, "themes"));
|
|
59
|
+
return injected;
|
|
60
|
+
}
|
|
61
|
+
|
|
25
62
|
if (process.argv.includes("--where")) {
|
|
26
63
|
process.stdout.write(JSON.stringify({
|
|
27
64
|
omegonRoot,
|
|
28
65
|
cli,
|
|
29
66
|
resolutionMode,
|
|
30
|
-
agentDir:
|
|
67
|
+
agentDir: stateDir,
|
|
68
|
+
stateDir,
|
|
31
69
|
executable: "omegon",
|
|
32
70
|
}, null, 2) + "\n");
|
|
33
71
|
process.exit(0);
|
|
34
72
|
}
|
|
35
73
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
74
|
+
process.env.PI_CODING_AGENT_DIR = stateDir;
|
|
75
|
+
migrateLegacyStatePath("auth.json");
|
|
76
|
+
migrateLegacyStatePath("settings.json");
|
|
77
|
+
migrateLegacyStatePath("sessions", "directory");
|
|
78
|
+
process.argv = injectBundledResourceArgs(process.argv);
|
|
39
79
|
|
|
40
80
|
await import(cli);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omegon",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Omegon — an opinionated distribution of pi (by Mario Zechner) with extensions for lifecycle management, memory, orchestration, and visualization",
|
|
5
5
|
"bin": {
|
|
6
6
|
"omegon": "bin/omegon.mjs",
|