feat(reporting-governance): add minimal runtime integrated slice
This commit is contained in:
@@ -69,6 +69,7 @@ test('package root export resolves public package surface only', () => {
|
||||
hasRunWatchdogChain: typeof plugin.runWatchdogChain,
|
||||
hasPlanDecisionExecution: typeof plugin.planDecisionExecution,
|
||||
hasExecuteGovernanceContract: typeof plugin.executeGovernanceContract,
|
||||
hasExecuteRuntimeIntegratedGovernance: typeof plugin.executeRuntimeIntegratedGovernance,
|
||||
}));
|
||||
`);
|
||||
|
||||
@@ -76,6 +77,7 @@ test('package root export resolves public package surface only', () => {
|
||||
assert.equal(result.hasRunWatchdogChain, 'function');
|
||||
assert.equal(result.hasPlanDecisionExecution, 'function');
|
||||
assert.equal(result.hasExecuteGovernanceContract, 'function');
|
||||
assert.equal(result.hasExecuteRuntimeIntegratedGovernance, 'function');
|
||||
} finally {
|
||||
fs.rmSync(root, { recursive: true, force: true });
|
||||
}
|
||||
@@ -141,43 +143,47 @@ test('leaf subpath export resolves and can execute through injected runtime bind
|
||||
const root = createFixtureRoot();
|
||||
try {
|
||||
installPackageAlias(root);
|
||||
fs.mkdirSync(path.join(root, 'scripts'), { recursive: true });
|
||||
fs.mkdirSync(path.join(root, 'events'), { recursive: true });
|
||||
fs.mkdirSync(path.join(root, 'evidence'), { recursive: true });
|
||||
fs.mkdirSync(path.join(root, 'queue'), { recursive: true });
|
||||
const statePath = writeState(root);
|
||||
|
||||
const stubScriptPath = path.join(root, 'scripts', 'custom-watchdog.mjs');
|
||||
fs.writeFileSync(stubScriptPath, `
|
||||
process.stdout.write(JSON.stringify({
|
||||
ok: true,
|
||||
source: 'stub-watchdog',
|
||||
argv: process.argv.slice(2),
|
||||
}));
|
||||
`, 'utf8');
|
||||
fs.mkdirSync(path.join(root, 'evidence'), { recursive: true });
|
||||
fs.mkdirSync(path.join(root, 'events'), { recursive: true });
|
||||
fs.mkdirSync(path.join(root, 'queue'), { recursive: true });
|
||||
fs.mkdirSync(path.join(root, 'spool'), { recursive: true });
|
||||
fs.mkdirSync(path.join(root, 'receipts'), { recursive: true });
|
||||
|
||||
const result = runJsonEval(root, `
|
||||
import { runWatchdogAdapter } from '@openclaw/plugin-reporting-governance/adapters/watchdog';
|
||||
const out = runWatchdogAdapter({
|
||||
import { runOrchestratorAdapter } from '@openclaw/plugin-reporting-governance/adapters/orchestrator';
|
||||
const payload = runOrchestratorAdapter({
|
||||
runtimeBinding: {
|
||||
cwd: ${JSON.stringify(path.resolve(packageRoot, '..', '..'))},
|
||||
scripts: {
|
||||
orchestrator: ${JSON.stringify(path.resolve(packageRoot, '..', '..', 'scripts', 'watchdog_auto_notify_orchestrator.mjs'))},
|
||||
watchdog: ${JSON.stringify(path.resolve(packageRoot, '..', '..', 'scripts', 'long_task_watchdog.mjs'))},
|
||||
dispatcher: ${JSON.stringify(path.resolve(packageRoot, '..', '..', 'scripts', 'operator_notify_dispatcher.mjs'))},
|
||||
bridgeSupervisor: ${JSON.stringify(path.resolve(packageRoot, '..', '..', 'scripts', 'operator_notify_bridge_supervisor.mjs'))},
|
||||
},
|
||||
},
|
||||
state: ${JSON.stringify(statePath)},
|
||||
evidenceDir: ${JSON.stringify(path.join(root, 'evidence'))},
|
||||
eventDir: ${JSON.stringify(path.join(root, 'events'))},
|
||||
notificationDir: ${JSON.stringify(path.join(root, 'queue'))},
|
||||
runtimeBinding: {
|
||||
cwd: ${JSON.stringify(root)},
|
||||
scripts: {
|
||||
watchdog: ${JSON.stringify(stubScriptPath)},
|
||||
},
|
||||
},
|
||||
queueDir: ${JSON.stringify(path.join(root, 'queue'))},
|
||||
spoolDir: ${JSON.stringify(path.join(root, 'spool'))},
|
||||
receiptDir: ${JSON.stringify(path.join(root, 'receipts'))},
|
||||
writeState: true,
|
||||
dryRun: true,
|
||||
now: '2026-05-07T08:20:00.000Z',
|
||||
});
|
||||
process.stdout.write(JSON.stringify(out));
|
||||
`);
|
||||
process.stdout.write(JSON.stringify({
|
||||
ok: payload.ok,
|
||||
dispatchedCount: payload.result.dispatcher.dispatchedCount,
|
||||
pendingCount: payload.result.supervisor.pendingCount,
|
||||
}));
|
||||
`, {
|
||||
RG_REPO_ROOT: path.resolve(packageRoot, '..', '..'),
|
||||
});
|
||||
|
||||
assert.equal(result.ok, true);
|
||||
assert.equal(result.source, 'stub-watchdog');
|
||||
assert.ok(result.argv.includes('--state'));
|
||||
assert.ok(result.argv.includes(path.resolve(statePath)));
|
||||
assert.equal(result.dispatchedCount, 1);
|
||||
assert.equal(result.pendingCount, 1);
|
||||
} finally {
|
||||
fs.rmSync(root, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user