@opencangjie/skills 0.0.25 → 0.0.26
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/package.json +1 -1
- package/scripts/runtime.js +27 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencangjie/skills",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "JavaScript/TypeScript SDK for AgentSkills Runtime - Install, manage, and execute AI agent skills with built-in runtime support",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
package/scripts/runtime.js
CHANGED
|
@@ -58,7 +58,27 @@ function getRuntimeDir() {
|
|
|
58
58
|
|
|
59
59
|
function getRuntimePath() {
|
|
60
60
|
const { platform, arch, suffix } = getPlatform();
|
|
61
|
-
|
|
61
|
+
// Check for release structure first (release/bin/agentskills-runtime.exe)
|
|
62
|
+
// Then fall back to direct structure (bin/agentskills-runtime.exe)
|
|
63
|
+
const releasePath = path.join(getRuntimeDir(), `${platform}-${arch}`, 'release', 'bin', `agentskills-runtime${suffix}`);
|
|
64
|
+
const directPath = path.join(getRuntimeDir(), `${platform}-${arch}`, `agentskills-runtime${suffix}`);
|
|
65
|
+
|
|
66
|
+
if (fs.existsSync(releasePath)) {
|
|
67
|
+
return releasePath;
|
|
68
|
+
}
|
|
69
|
+
return directPath;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function getRuntimeWorkingDir() {
|
|
73
|
+
const { platform, arch } = getPlatform();
|
|
74
|
+
// For release structure, working dir should be the release directory (parent of bin/)
|
|
75
|
+
// This ensures .env file at release/.env can be found
|
|
76
|
+
const releaseDir = path.join(getRuntimeDir(), `${platform}-${arch}`, 'release');
|
|
77
|
+
if (fs.existsSync(path.join(releaseDir, 'bin'))) {
|
|
78
|
+
return releaseDir;
|
|
79
|
+
}
|
|
80
|
+
// Fall back to bin directory for direct structure
|
|
81
|
+
return path.join(getRuntimeDir(), `${platform}-${arch}`, 'bin');
|
|
62
82
|
}
|
|
63
83
|
|
|
64
84
|
function isRuntimeInstalled() {
|
|
@@ -152,10 +172,14 @@ function startRuntime(options = {}) {
|
|
|
152
172
|
|
|
153
173
|
const args = ['--port', String(port), '--host', host];
|
|
154
174
|
|
|
175
|
+
// Use the correct working directory for the runtime
|
|
176
|
+
// This ensures .env file can be found in the release directory
|
|
177
|
+
const workingDir = getRuntimeWorkingDir();
|
|
178
|
+
|
|
155
179
|
const child = spawn(runtimePath, args, {
|
|
156
180
|
stdio: options.detached ? 'ignore' : 'inherit',
|
|
157
181
|
detached: options.detached || false,
|
|
158
|
-
cwd:
|
|
182
|
+
cwd: workingDir
|
|
159
183
|
});
|
|
160
184
|
|
|
161
185
|
if (options.detached) {
|
|
@@ -207,6 +231,7 @@ module.exports = {
|
|
|
207
231
|
getPlatform,
|
|
208
232
|
getRuntimeDir,
|
|
209
233
|
getRuntimePath,
|
|
234
|
+
getRuntimeWorkingDir,
|
|
210
235
|
isRuntimeInstalled,
|
|
211
236
|
downloadRuntime,
|
|
212
237
|
startRuntime,
|