@cydm/magic-shell-agent-node 0.1.18 → 0.1.20

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.
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@magicshell/primary-pie-extension",
3
+ "private": true,
4
+ "type": "module",
5
+ "pie": {
6
+ "name": "@magicshell/primary-pie-extension",
7
+ "main": "index.js"
8
+ }
9
+ }
@@ -0,0 +1,4 @@
1
+ export declare function getPackagedPluginDir(): string | null;
2
+ export declare function getWorkbenchRoot(): string | null;
3
+ export declare function getPrimaryPieExtensionDistDir(): string | null;
4
+ export declare function getMagicShellCliPath(): string | null;
@@ -0,0 +1,83 @@
1
+ import { existsSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ function currentDistDir() {
5
+ return path.dirname(fileURLToPath(import.meta.url));
6
+ }
7
+ function findExistingDirectory(candidates) {
8
+ for (const candidate of candidates) {
9
+ if (!candidate)
10
+ continue;
11
+ try {
12
+ if (existsSync(candidate)) {
13
+ return candidate;
14
+ }
15
+ }
16
+ catch {
17
+ // Ignore invalid paths while probing runtime assets.
18
+ }
19
+ }
20
+ return null;
21
+ }
22
+ function findExistingFile(candidates) {
23
+ for (const candidate of candidates) {
24
+ if (!candidate)
25
+ continue;
26
+ try {
27
+ if (existsSync(candidate)) {
28
+ return candidate;
29
+ }
30
+ }
31
+ catch {
32
+ // Ignore invalid paths while probing runtime assets.
33
+ }
34
+ }
35
+ return null;
36
+ }
37
+ export function getPackagedPluginDir() {
38
+ const currentDir = currentDistDir();
39
+ return findExistingDirectory([
40
+ process.env.MAGIC_SHELL_PLUGINS_DIR ? path.resolve(process.env.MAGIC_SHELL_PLUGINS_DIR) : null,
41
+ path.resolve(currentDir, "./plugins"),
42
+ // Development-only fallback for source checkouts.
43
+ path.resolve(currentDir, "../../../plugins"),
44
+ ]);
45
+ }
46
+ export function getWorkbenchRoot() {
47
+ const currentDir = currentDistDir();
48
+ const candidates = [
49
+ process.env.MAGIC_SHELL_WORKBENCH_ROOT ? path.resolve(process.env.MAGIC_SHELL_WORKBENCH_ROOT) : null,
50
+ path.resolve(currentDir, "./workbench"),
51
+ // Development-only fallback for source checkouts.
52
+ path.resolve(currentDir, "../../../apps/web/src"),
53
+ ];
54
+ for (const candidate of candidates) {
55
+ if (!candidate)
56
+ continue;
57
+ if (existsSync(path.join(candidate, "index.html"))) {
58
+ return candidate;
59
+ }
60
+ }
61
+ return null;
62
+ }
63
+ export function getPrimaryPieExtensionDistDir() {
64
+ const currentDir = currentDistDir();
65
+ return findExistingDirectory([
66
+ process.env.MAGIC_SHELL_PRIMARY_EXTENSION_DIR ? path.resolve(process.env.MAGIC_SHELL_PRIMARY_EXTENSION_DIR) : null,
67
+ path.resolve(currentDir, "./primary-pie-extension"),
68
+ // Development-only fallback for source checkouts.
69
+ path.resolve(currentDir, "../../primary-pie-extension/dist"),
70
+ ]);
71
+ }
72
+ export function getMagicShellCliPath() {
73
+ const currentDir = currentDistDir();
74
+ return findExistingFile([
75
+ process.env.MAGIC_SHELL_CLI_PATH ? path.resolve(process.env.MAGIC_SHELL_CLI_PATH) : null,
76
+ // Installed alongside @cydm/magic-shell under the same @cydm scope.
77
+ path.resolve(currentDir, "../../magic-shell/dist/cli.js"),
78
+ // Installed under @cydm/magic-shell -> node_modules/@cydm/magic-shell-agent-node/dist
79
+ path.resolve(currentDir, "../../../../dist/cli.js"),
80
+ // Development-only fallback for source checkouts.
81
+ path.resolve(currentDir, "../../cli/dist/cli.js"),
82
+ ]);
83
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cydm/magic-shell-agent-node",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "Magic Shell Agent Node - Local agent connector",
5
5
  "homepage": "https://magicshell.ai",
6
6
  "keywords": [