panteao-ts 1.1.0 → 1.1.2

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/cjs/index.js CHANGED
@@ -47,12 +47,17 @@ function findEngineBinary(binName) {
47
47
  process.cwd(),
48
48
  path.resolve(process.cwd(), 'node_modules'),
49
49
  path.resolve(process.cwd(), '..'),
50
- path.resolve(process.cwd(), '..', '..')
50
+ path.resolve(process.cwd(), '..', '..'),
51
+ path.resolve(process.cwd(), '..', '..', '..')
51
52
  ];
52
53
  const candidates = [];
53
54
  for (const root of searchRoots) {
54
55
  candidates.push(path.join(root, 'node_modules', platformPkg, 'bin', binName), path.join(root, 'node_modules', platformPkg, binName), path.join(root, platformPkg, 'bin', binName), path.join(root, platformPkg, binName), path.join(root, 'bin', binName), path.join(root, binName));
55
56
  }
57
+ const envPath = process.env.PANTEAO_ENGINE_PATH || process.env.PANTEAO_ENGINE_BIN;
58
+ if (envPath) {
59
+ candidates.push(envPath);
60
+ }
56
61
  for (const candidate of candidates) {
57
62
  if (fs.existsSync(candidate)) {
58
63
  return candidate;
@@ -130,6 +135,21 @@ class BdiClient extends events_1.EventEmitter {
130
135
  if (this.port === 0) {
131
136
  this.port = await getFreePort();
132
137
  }
138
+ if (!fs.existsSync(this.binPath)) {
139
+ const errMsg = `[Panteão] Engine binary not found at resolved path: ${this.binPath}. ` +
140
+ `Ensure the correct architecture package (panteao-engine-${process.platform}-${process.arch}) is installed ` +
141
+ `or provide a valid absolute path via the 'binPath' option.`;
142
+ this.emit('error', new Error(errMsg));
143
+ throw new Error(errMsg);
144
+ }
145
+ if (process.platform !== 'win32') {
146
+ try {
147
+ fs.accessSync(this.binPath, fs.constants.X_OK);
148
+ }
149
+ catch (e) {
150
+ fs.chmodSync(this.binPath, 0o755);
151
+ }
152
+ }
133
153
  const args = [this.project, '--port', String(this.port)];
134
154
  this.process = child_process.spawn(this.binPath, args, { stdio: 'ignore' });
135
155
  await new Promise((resolve) => setTimeout(resolve, 800));
package/dist/esm/index.js CHANGED
@@ -11,12 +11,17 @@ function findEngineBinary(binName) {
11
11
  process.cwd(),
12
12
  path.resolve(process.cwd(), 'node_modules'),
13
13
  path.resolve(process.cwd(), '..'),
14
- path.resolve(process.cwd(), '..', '..')
14
+ path.resolve(process.cwd(), '..', '..'),
15
+ path.resolve(process.cwd(), '..', '..', '..')
15
16
  ];
16
17
  const candidates = [];
17
18
  for (const root of searchRoots) {
18
19
  candidates.push(path.join(root, 'node_modules', platformPkg, 'bin', binName), path.join(root, 'node_modules', platformPkg, binName), path.join(root, platformPkg, 'bin', binName), path.join(root, platformPkg, binName), path.join(root, 'bin', binName), path.join(root, binName));
19
20
  }
21
+ const envPath = process.env.PANTEAO_ENGINE_PATH || process.env.PANTEAO_ENGINE_BIN;
22
+ if (envPath) {
23
+ candidates.push(envPath);
24
+ }
20
25
  for (const candidate of candidates) {
21
26
  if (fs.existsSync(candidate)) {
22
27
  return candidate;
@@ -94,6 +99,21 @@ export class BdiClient extends EventEmitter {
94
99
  if (this.port === 0) {
95
100
  this.port = await getFreePort();
96
101
  }
102
+ if (!fs.existsSync(this.binPath)) {
103
+ const errMsg = `[Panteão] Engine binary not found at resolved path: ${this.binPath}. ` +
104
+ `Ensure the correct architecture package (panteao-engine-${process.platform}-${process.arch}) is installed ` +
105
+ `or provide a valid absolute path via the 'binPath' option.`;
106
+ this.emit('error', new Error(errMsg));
107
+ throw new Error(errMsg);
108
+ }
109
+ if (process.platform !== 'win32') {
110
+ try {
111
+ fs.accessSync(this.binPath, fs.constants.X_OK);
112
+ }
113
+ catch (e) {
114
+ fs.chmodSync(this.binPath, 0o755);
115
+ }
116
+ }
97
117
  const args = [this.project, '--port', String(this.port)];
98
118
  this.process = child_process.spawn(this.binPath, args, { stdio: 'ignore' });
99
119
  await new Promise((resolve) => setTimeout(resolve, 800));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "panteao-ts",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "TypeScript client for the Panteao BDI agent engine",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",