opensyn 0.1.1 → 0.1.4
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/index.ts +19 -11
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/runtime/opensyn-cli +7 -0
- package/runtime/opensyn-daemon +7 -0
- package/runtime/opensyn-host-distiller.mjs +6 -1
package/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
openSync,
|
|
10
10
|
readFileSync,
|
|
11
11
|
readdirSync,
|
|
12
|
+
renameSync,
|
|
12
13
|
realpathSync,
|
|
13
14
|
rmSync,
|
|
14
15
|
statSync,
|
|
@@ -456,6 +457,23 @@ function defaultProjectionBundleRoot(): string {
|
|
|
456
457
|
return path.join(home, ".openclaw", "workspace");
|
|
457
458
|
}
|
|
458
459
|
|
|
460
|
+
function syncRuntimeFile(sourcePath: string, destPath: string): void {
|
|
461
|
+
const sourceStat = statSync(sourcePath);
|
|
462
|
+
const needsCopy =
|
|
463
|
+
!existsSync(destPath) ||
|
|
464
|
+
statSync(destPath).size !== sourceStat.size ||
|
|
465
|
+
statSync(destPath).mtimeMs < sourceStat.mtimeMs;
|
|
466
|
+
if (!needsCopy) {
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
mkdirSync(path.dirname(destPath), { recursive: true });
|
|
471
|
+
const tempPath = `${destPath}.tmp-${process.pid}-${Date.now()}`;
|
|
472
|
+
copyFileSync(sourcePath, tempPath);
|
|
473
|
+
chmodSync(tempPath, sourceStat.mode);
|
|
474
|
+
renameSync(tempPath, destPath);
|
|
475
|
+
}
|
|
476
|
+
|
|
459
477
|
function syncRuntimeTree(sourceDir: string, destDir: string): void {
|
|
460
478
|
if (!existsSync(sourceDir)) {
|
|
461
479
|
return;
|
|
@@ -469,17 +487,7 @@ function syncRuntimeTree(sourceDir: string, destDir: string): void {
|
|
|
469
487
|
syncRuntimeTree(sourcePath, destPath);
|
|
470
488
|
continue;
|
|
471
489
|
}
|
|
472
|
-
|
|
473
|
-
const needsCopy =
|
|
474
|
-
!existsSync(destPath) ||
|
|
475
|
-
statSync(destPath).size !== sourceStat.size ||
|
|
476
|
-
statSync(destPath).mtimeMs < sourceStat.mtimeMs;
|
|
477
|
-
if (!needsCopy) {
|
|
478
|
-
continue;
|
|
479
|
-
}
|
|
480
|
-
mkdirSync(path.dirname(destPath), { recursive: true });
|
|
481
|
-
copyFileSync(sourcePath, destPath);
|
|
482
|
-
chmodSync(destPath, sourceStat.mode);
|
|
490
|
+
syncRuntimeFile(sourcePath, destPath);
|
|
483
491
|
}
|
|
484
492
|
}
|
|
485
493
|
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
package/runtime/opensyn-cli
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
4
|
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
|
+
script_path="$(cd "$script_dir" && pwd)/$(basename "${BASH_SOURCE[0]}")"
|
|
5
6
|
|
|
6
7
|
platform="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
|
7
8
|
arch_raw="$(uname -m)"
|
|
@@ -30,6 +31,12 @@ candidates+=(
|
|
|
30
31
|
)
|
|
31
32
|
|
|
32
33
|
for candidate in "${candidates[@]}"; do
|
|
34
|
+
if [[ -n "$candidate" ]]; then
|
|
35
|
+
candidate_real="$(realpath -m "$candidate" 2>/dev/null || printf '%s' "$candidate")"
|
|
36
|
+
if [[ "$candidate_real" == "$script_path" ]]; then
|
|
37
|
+
continue
|
|
38
|
+
fi
|
|
39
|
+
fi
|
|
33
40
|
if [[ -n "$candidate" && -x "$candidate" ]]; then
|
|
34
41
|
exec "$candidate" "$@"
|
|
35
42
|
fi
|
package/runtime/opensyn-daemon
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
4
|
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
|
+
script_path="$(cd "$script_dir" && pwd)/$(basename "${BASH_SOURCE[0]}")"
|
|
5
6
|
|
|
6
7
|
platform="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
|
7
8
|
arch_raw="$(uname -m)"
|
|
@@ -30,6 +31,12 @@ candidates+=(
|
|
|
30
31
|
)
|
|
31
32
|
|
|
32
33
|
for candidate in "${candidates[@]}"; do
|
|
34
|
+
if [[ -n "$candidate" ]]; then
|
|
35
|
+
candidate_real="$(realpath -m "$candidate" 2>/dev/null || printf '%s' "$candidate")"
|
|
36
|
+
if [[ "$candidate_real" == "$script_path" ]]; then
|
|
37
|
+
continue
|
|
38
|
+
fi
|
|
39
|
+
fi
|
|
33
40
|
if [[ -n "$candidate" && -x "$candidate" ]]; then
|
|
34
41
|
exec "$candidate" "$@"
|
|
35
42
|
fi
|
|
@@ -148,12 +148,17 @@ async function main() {
|
|
|
148
148
|
stdout: result.stdout?.trim() || "",
|
|
149
149
|
stderr: result.stderr?.trim() || "",
|
|
150
150
|
};
|
|
151
|
+
const computedLastError =
|
|
152
|
+
result.status && result.status !== 0
|
|
153
|
+
? payload.error || payload.stderr || ""
|
|
154
|
+
: payload.error || "";
|
|
151
155
|
updateState(options.statePath, {
|
|
152
156
|
last_started_at: startedAt,
|
|
153
157
|
last_finished_at: finishedAt,
|
|
154
158
|
last_exit_code: result.status,
|
|
155
159
|
last_signal: result.signal,
|
|
156
|
-
last_error:
|
|
160
|
+
last_error: computedLastError,
|
|
161
|
+
last_stderr: payload.stderr,
|
|
157
162
|
last_stdout: payload.stdout,
|
|
158
163
|
last_command: payload.command,
|
|
159
164
|
last_command_args: payload.command_args,
|