refactor: package-own watchdog orchestrator entrypoint

This commit is contained in:
Eve
2026-05-08 16:11:49 +08:00
parent c3b9e12474
commit e99423da97
11 changed files with 175 additions and 67 deletions

View File

@@ -13,7 +13,7 @@ import {
import { createRuntimeBinding } from '../src/adapters/index.mjs';
const packageRoot = path.resolve(import.meta.dirname, '..');
const repoRoot = path.resolve(packageRoot);
const repoRoot = path.resolve(packageRoot, '..', '..');
function createArtifact(overrides = {}) {
return {
@@ -23,8 +23,8 @@ function createArtifact(overrides = {}) {
package: { pluginVersion: '0.1.0-mainline' },
bindings: {
runtime: 'openclaw',
entrypoint: 'scripts/watchdog_auto_notify_orchestrator.mjs',
scripts: { watchdog: 'scripts/long_task_watchdog.mjs' },
entrypoint: 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs',
scripts: { watchdog: 'plugins/reporting-governance/scripts/long_task_watchdog.mjs' },
artifact_roots: { queueItems: 'state/operator-notify-queue' },
},
},
@@ -49,8 +49,8 @@ test('deployment binding contract resolves package artifact into real repo scrip
assert.equal(binding.runtime, 'openclaw');
assert.equal(binding.pluginVersion, '0.1.0-mainline');
assert.equal(binding.compatibilityMode, 'strict_envelope');
assert.equal(binding.entrypoint, path.resolve(repoRoot, 'scripts/watchdog_auto_notify_orchestrator.mjs'));
assert.equal(binding.scripts.watchdog, path.resolve(repoRoot, 'scripts/long_task_watchdog.mjs'));
assert.equal(binding.entrypoint, path.resolve(repoRoot, 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs'));
assert.equal(binding.scripts.watchdog, path.resolve(repoRoot, 'plugins/reporting-governance/scripts/long_task_watchdog.mjs'));
assert.equal(binding.artifactRoots.queueItems, path.resolve(repoRoot, 'state/operator-notify-queue'));
assert.equal(fs.existsSync(binding.scripts.orchestrator), true);
});
@@ -81,7 +81,7 @@ test('deployment profile artifact validation fails closed on boundary drift', ()
package: { pluginVersion: '0.1.0-mainline' },
bindings: {
entrypoint: '',
scripts: { watchdog: 'scripts/long_task_watchdog.mjs' },
scripts: { watchdog: 'plugins/reporting-governance/scripts/long_task_watchdog.mjs' },
artifact_roots: { queueItems: 'state/operator-notify-queue' },
},
},
@@ -94,7 +94,7 @@ test('deployment profile artifact validation fails closed on boundary drift', ()
spec: {
package: { pluginVersion: '' },
bindings: {
entrypoint: 'scripts/watchdog_auto_notify_orchestrator.mjs',
entrypoint: 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs',
scripts: { watchdog: '' },
artifact_roots: { queueItems: 'state/operator-notify-queue' },
},
@@ -108,7 +108,7 @@ test('deployment profile artifact validation fails closed on boundary drift', ()
spec: {
package: { pluginVersion: '0.1.0-mainline' },
bindings: {
entrypoint: 'scripts/watchdog_auto_notify_orchestrator.mjs',
entrypoint: 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs',
scripts: [],
artifact_roots: { queueItems: 'state/operator-notify-queue' },
},
@@ -125,7 +125,7 @@ test('deployment profile artifact validation rejects absolute binding paths', ()
package: { pluginVersion: '0.1.0-mainline' },
bindings: {
entrypoint: '/abs/path',
scripts: { watchdog: 'scripts/long_task_watchdog.mjs' },
scripts: { watchdog: 'plugins/reporting-governance/scripts/long_task_watchdog.mjs' },
artifact_roots: { queueItems: 'state/operator-notify-queue' },
},
},
@@ -138,7 +138,7 @@ test('deployment profile artifact validation rejects absolute binding paths', ()
spec: {
package: { pluginVersion: '0.1.0-mainline' },
bindings: {
entrypoint: 'scripts/watchdog_auto_notify_orchestrator.mjs',
entrypoint: 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs',
scripts: { watchdog: '/abs/path' },
artifact_roots: { queueItems: 'state/operator-notify-queue' },
},
@@ -152,8 +152,8 @@ test('deployment profile artifact validation rejects absolute binding paths', ()
spec: {
package: { pluginVersion: '0.1.0-mainline' },
bindings: {
entrypoint: 'scripts/watchdog_auto_notify_orchestrator.mjs',
scripts: { watchdog: 'scripts/long_task_watchdog.mjs' },
entrypoint: 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs',
scripts: { watchdog: 'plugins/reporting-governance/scripts/long_task_watchdog.mjs' },
artifact_roots: { queueItems: '/abs/path' },
},
},
@@ -169,7 +169,7 @@ test('deployment profile artifact validation rejects escape paths after resoluti
package: { pluginVersion: '0.1.0-mainline' },
bindings: {
entrypoint: '../../escape',
scripts: { watchdog: 'scripts/long_task_watchdog.mjs' },
scripts: { watchdog: 'plugins/reporting-governance/scripts/long_task_watchdog.mjs' },
artifact_roots: { queueItems: 'state/operator-notify-queue' },
},
},
@@ -183,7 +183,7 @@ test('deployment profile artifact validation rejects escape paths after resoluti
spec: {
package: { pluginVersion: '0.1.0-mainline' },
bindings: {
entrypoint: 'scripts/watchdog_auto_notify_orchestrator.mjs',
entrypoint: 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs',
scripts: { watchdog: '../../escape' },
artifact_roots: { queueItems: 'state/operator-notify-queue' },
},
@@ -199,8 +199,8 @@ test('deployment profile artifact validation rejects escape paths after resoluti
spec: {
package: { pluginVersion: '0.1.0-mainline' },
bindings: {
entrypoint: 'scripts/watchdog_auto_notify_orchestrator.mjs',
scripts: { watchdog: 'scripts/long_task_watchdog.mjs' },
entrypoint: 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs',
scripts: { watchdog: 'plugins/reporting-governance/scripts/long_task_watchdog.mjs' },
artifact_roots: { queueItems: '../escape' },
},
},
@@ -216,9 +216,9 @@ test('deployment binding contract allows normalized in-root paths that contain d
package: { pluginVersion: '0.1.0-mainline' },
bindings: {
runtime: 'openclaw',
entrypoint: 'scripts/../scripts/watchdog_auto_notify_orchestrator.mjs',
entrypoint: 'plugins/reporting-governance/scripts/../scripts/watchdog_auto_notify_orchestrator.mjs',
scripts: {
watchdog: 'scripts/./long_task_watchdog.mjs',
watchdog: 'plugins/reporting-governance/scripts/./long_task_watchdog.mjs',
},
artifact_roots: {
queueItems: 'state/../state/operator-notify-queue',
@@ -229,8 +229,8 @@ test('deployment binding contract allows normalized in-root paths that contain d
repoRootOverride: repoRoot,
});
assert.equal(binding.entrypoint, path.resolve(repoRoot, 'scripts/watchdog_auto_notify_orchestrator.mjs'));
assert.equal(binding.scripts.watchdog, path.resolve(repoRoot, 'scripts/long_task_watchdog.mjs'));
assert.equal(binding.entrypoint, path.resolve(repoRoot, 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs'));
assert.equal(binding.scripts.watchdog, path.resolve(repoRoot, 'plugins/reporting-governance/scripts/long_task_watchdog.mjs'));
assert.equal(binding.artifactRoots.queueItems, path.resolve(repoRoot, 'state/operator-notify-queue'));
});