397777089e
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
23 lines
912 B
JavaScript
23 lines
912 B
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Recommended-node resolver for direct episodes.
|
|
* Pure — read-only, no exec, no fs (Security Guidance #40).
|
|
*
|
|
* For an episode classified as `taskClassification` with node_chosen='direct',
|
|
* return the first live (non-dormant) recommended node ID from the
|
|
* classification map. Mirrors missed-activations.mjs dormancy logic:
|
|
* dormancy[id] === false strictly (missing/true → not live).
|
|
*
|
|
* Per spec: docs/superpowers/specs/2026-05-23-observer-parser-skill-hook-expand-design.md
|
|
*/
|
|
|
|
export function recommendNode(taskClassification, classificationMap, dormancy) {
|
|
if (!taskClassification || !classificationMap || !dormancy) return null;
|
|
const recommended = classificationMap[taskClassification];
|
|
if (!Array.isArray(recommended) || recommended.length === 0) return null;
|
|
for (const id of recommended) {
|
|
if (dormancy[id] === false) return id;
|
|
}
|
|
return null;
|
|
}
|