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

@@ -66,13 +66,13 @@ const strictProfileArtifact = {
},
bindings: {
runtime: 'openclaw',
entrypoint: 'scripts/watchdog_auto_notify_orchestrator.mjs',
entrypoint: 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs',
scripts: {
watchdog: 'scripts/long_task_watchdog.mjs',
dispatcher: 'scripts/operator_notify_dispatcher.mjs',
bridgeSupervisor: 'scripts/operator_notify_bridge_supervisor.mjs',
senderBinding: 'scripts/operator_notify_sender_binding.mjs',
orchestrator: 'scripts/watchdog_auto_notify_orchestrator.mjs'
watchdog: 'plugins/reporting-governance/scripts/long_task_watchdog.mjs',
dispatcher: 'plugins/reporting-governance/scripts/operator_notify_dispatcher.mjs',
bridgeSupervisor: 'plugins/reporting-governance/scripts/operator_notify_bridge_supervisor.mjs',
senderBinding: 'plugins/reporting-governance/scripts/operator_notify_sender_binding.mjs',
orchestrator: 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs'
},
artifact_roots: {
queueItems: 'state/operator-notify-queue'

View File

@@ -313,13 +313,13 @@ test('executeGovernanceContract exposes deployment binding when profile artifact
...strictProfile.spec,
bindings: {
runtime: 'openclaw',
entrypoint: 'scripts/watchdog_auto_notify_orchestrator.mjs',
entrypoint: 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs',
scripts: {
watchdog: 'scripts/long_task_watchdog.mjs',
dispatcher: 'scripts/operator_notify_dispatcher.mjs',
bridgeSupervisor: 'scripts/operator_notify_bridge_supervisor.mjs',
senderBinding: 'scripts/operator_notify_sender_binding.mjs',
orchestrator: 'scripts/watchdog_auto_notify_orchestrator.mjs'
watchdog: 'plugins/reporting-governance/scripts/long_task_watchdog.mjs',
dispatcher: 'plugins/reporting-governance/scripts/operator_notify_dispatcher.mjs',
bridgeSupervisor: 'plugins/reporting-governance/scripts/operator_notify_bridge_supervisor.mjs',
senderBinding: 'plugins/reporting-governance/scripts/operator_notify_sender_binding.mjs',
orchestrator: 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs'
},
artifact_roots: {
queueItems: 'state/operator-notify-queue'
@@ -344,7 +344,7 @@ test('executeGovernanceContract exposes deployment binding when profile artifact
});
assert.equal(result.preflight.status, 'pass');
assert.equal(result.deploymentBinding.entrypoint, path.resolve(repoRoot, 'scripts/watchdog_auto_notify_orchestrator.mjs'));
assert.equal(result.deploymentBinding.scripts.dispatcher, path.resolve(repoRoot, 'scripts/operator_notify_dispatcher.mjs'));
assert.equal(result.deploymentBinding.entrypoint, path.resolve(repoRoot, 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs'));
assert.equal(result.deploymentBinding.scripts.dispatcher, path.resolve(repoRoot, 'plugins/reporting-governance/scripts/operator_notify_dispatcher.mjs'));
assert.equal(result.deploymentBinding.artifactRoots.queueItems, path.resolve(repoRoot, 'state/operator-notify-queue'));
});

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'));
});

View File

@@ -380,7 +380,7 @@ test('yaml to artifact generation produces validator-compatible package artifact
assert.equal(artifact.kind, 'DeploymentProfileArtifact');
assert.equal(artifact.metadata.source_profile, 'profiles/demo.yaml');
assert.equal(artifact.spec.bindings.entrypoint, 'scripts/watchdog_auto_notify_orchestrator.mjs');
assert.equal(artifact.spec.bindings.entrypoint, 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs');
assert.doesNotThrow(() => validateDeploymentProfileArtifact(artifact));
});

View File

@@ -93,13 +93,13 @@ const strictProfileArtifact = {
},
bindings: {
runtime: 'openclaw',
entrypoint: 'scripts/watchdog_auto_notify_orchestrator.mjs',
entrypoint: 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs',
scripts: {
watchdog: 'scripts/long_task_watchdog.mjs',
dispatcher: 'scripts/operator_notify_dispatcher.mjs',
bridgeSupervisor: 'scripts/operator_notify_bridge_supervisor.mjs',
senderBinding: 'scripts/operator_notify_sender_binding.mjs',
orchestrator: 'scripts/watchdog_auto_notify_orchestrator.mjs'
watchdog: 'plugins/reporting-governance/scripts/long_task_watchdog.mjs',
dispatcher: 'plugins/reporting-governance/scripts/operator_notify_dispatcher.mjs',
bridgeSupervisor: 'plugins/reporting-governance/scripts/operator_notify_bridge_supervisor.mjs',
senderBinding: 'plugins/reporting-governance/scripts/operator_notify_sender_binding.mjs',
orchestrator: 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs'
},
artifact_roots: {
queueItems: 'state/operator-notify-queue'

View File

@@ -127,7 +127,7 @@ test('orchestrator adapter can bootstrap from profile artifact loader path', ()
const result = runOrchestratorAdapter({
profileId: 'strict-manager-mode',
repoRootOverride: path.resolve(packageRoot),
repoRootOverride: path.resolve(packageRoot, '..', '..'),
state: statePath,
evidenceDir: path.join(root, 'evidence'),
eventDir: path.join(root, 'events'),
@@ -160,7 +160,7 @@ test('orchestrator adapter can use artifact_roots.queueItems as the default queu
const result = runOrchestratorAdapter({
profileId: 'strict-manager-mode',
repoRootOverride: path.resolve(packageRoot),
repoRootOverride: path.resolve(packageRoot, '..', '..'),
state: statePath,
evidenceDir: path.join(root, 'evidence'),
eventDir: path.join(root, 'events'),
@@ -184,7 +184,7 @@ test('orchestrator adapter fails closed at use time when artifact_roots.queueIte
const fakeRepoRoot = path.join(sandbox, 'repo');
const outsideRoot = path.join(sandbox, 'outside');
const realRepoRoot = path.resolve(packageRoot);
fs.mkdirSync(path.join(fakeRepoRoot, 'scripts'), { recursive: true });
fs.mkdirSync(path.join(fakeRepoRoot, 'plugins', 'reporting-governance', 'scripts'), { recursive: true });
fs.mkdirSync(path.join(fakeRepoRoot, 'state', 'operator-notify-queue'), { recursive: true });
fs.mkdirSync(outsideRoot, { recursive: true });
for (const name of [
@@ -194,7 +194,7 @@ test('orchestrator adapter fails closed at use time when artifact_roots.queueIte
'operator_notify_bridge_supervisor.mjs',
'operator_notify_sender_binding.mjs',
]) {
fs.copyFileSync(path.join(realRepoRoot, 'scripts', name), path.join(fakeRepoRoot, 'scripts', name));
fs.copyFileSync(path.join(realRepoRoot, 'scripts', name), path.join(fakeRepoRoot, 'plugins', 'reporting-governance', 'scripts', name));
}
const deploymentBinding = createDeploymentBindingContract({
@@ -210,13 +210,13 @@ test('orchestrator adapter fails closed at use time when artifact_roots.queueIte
package: { pluginVersion: '0.1.0-mainline' },
bindings: {
runtime: 'openclaw',
entrypoint: 'scripts/watchdog_auto_notify_orchestrator.mjs',
entrypoint: 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs',
scripts: {
watchdog: 'scripts/long_task_watchdog.mjs',
dispatcher: 'scripts/operator_notify_dispatcher.mjs',
bridgeSupervisor: 'scripts/operator_notify_bridge_supervisor.mjs',
senderBinding: 'scripts/operator_notify_sender_binding.mjs',
orchestrator: 'scripts/watchdog_auto_notify_orchestrator.mjs'
watchdog: 'plugins/reporting-governance/scripts/long_task_watchdog.mjs',
dispatcher: 'plugins/reporting-governance/scripts/operator_notify_dispatcher.mjs',
bridgeSupervisor: 'plugins/reporting-governance/scripts/operator_notify_bridge_supervisor.mjs',
senderBinding: 'plugins/reporting-governance/scripts/operator_notify_sender_binding.mjs',
orchestrator: 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs'
},
artifact_roots: {
queueItems: 'state/operator-notify-queue'