@navels/neal 0.1.0
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/LICENSE +21 -0
- package/README.md +527 -0
- package/SECURITY.md +91 -0
- package/config.yml +104 -0
- package/dist/neal/activity-footer.js +177 -0
- package/dist/neal/activity-reporting.js +1 -0
- package/dist/neal/adjudicator/artifacts.js +58 -0
- package/dist/neal/adjudicator/blocked-adjudicator.js +223 -0
- package/dist/neal/adjudicator/contracts.js +139 -0
- package/dist/neal/adjudicator/execute.js +611 -0
- package/dist/neal/adjudicator/final-completion.js +104 -0
- package/dist/neal/adjudicator/planning.js +145 -0
- package/dist/neal/adjudicator/specs.js +453 -0
- package/dist/neal/agents/prompts.js +120 -0
- package/dist/neal/agents/rounds.js +706 -0
- package/dist/neal/agents/schemas.js +832 -0
- package/dist/neal/agents/structured-coder.js +82 -0
- package/dist/neal/agents/structured-json.js +528 -0
- package/dist/neal/agents.js +4 -0
- package/dist/neal/atomic-write.js +18 -0
- package/dist/neal/blocked-guidance.js +406 -0
- package/dist/neal/cli.js +471 -0
- package/dist/neal/commands/check.js +401 -0
- package/dist/neal/commands/compat.js +807 -0
- package/dist/neal/commands/interactive-activity.js +57 -0
- package/dist/neal/commands/new-run.js +79 -0
- package/dist/neal/commands/plan-and-execute.js +44 -0
- package/dist/neal/commands/recovery-guidance.js +217 -0
- package/dist/neal/commands/resume-run.js +395 -0
- package/dist/neal/commands/review.js +21 -0
- package/dist/neal/commands/runtime.js +557 -0
- package/dist/neal/commands/setup.js +596 -0
- package/dist/neal/commands/squash.js +113 -0
- package/dist/neal/commands/status.js +33 -0
- package/dist/neal/commands/writer-exit-codes.js +42 -0
- package/dist/neal/commit-message.js +17 -0
- package/dist/neal/config.js +432 -0
- package/dist/neal/context/artifacts.js +140 -0
- package/dist/neal/context/context.js +324 -0
- package/dist/neal/context/inline-review-context.js +131 -0
- package/dist/neal/context/reviewer-context.js +166 -0
- package/dist/neal/context/shared.js +117 -0
- package/dist/neal/context/types.js +1 -0
- package/dist/neal/diagnostic.js +208 -0
- package/dist/neal/execute-finalization.js +5 -0
- package/dist/neal/final-completion-review.js +188 -0
- package/dist/neal/final-completion.js +229 -0
- package/dist/neal/git.js +339 -0
- package/dist/neal/index.js +135 -0
- package/dist/neal/interactive-controls.js +85 -0
- package/dist/neal/logger.js +102 -0
- package/dist/neal/manual-gates.js +121 -0
- package/dist/neal/orchestrator/artifacts.js +70 -0
- package/dist/neal/orchestrator/completion.js +531 -0
- package/dist/neal/orchestrator/failures.js +31 -0
- package/dist/neal/orchestrator/notifications.js +175 -0
- package/dist/neal/orchestrator/phases/coder.js +516 -0
- package/dist/neal/orchestrator/phases/planning.js +540 -0
- package/dist/neal/orchestrator/phases/recovery.js +798 -0
- package/dist/neal/orchestrator/phases/review.js +136 -0
- package/dist/neal/orchestrator/phases/shared.js +279 -0
- package/dist/neal/orchestrator/run-loop.js +113 -0
- package/dist/neal/orchestrator/split-plan.js +235 -0
- package/dist/neal/orchestrator/transitions.js +309 -0
- package/dist/neal/orchestrator.js +215 -0
- package/dist/neal/phase-display.js +27 -0
- package/dist/neal/plan-doc.js +154 -0
- package/dist/neal/plan-queue.js +1092 -0
- package/dist/neal/plan-refinement.js +39 -0
- package/dist/neal/plan-validation.js +525 -0
- package/dist/neal/progress.js +237 -0
- package/dist/neal/prompts/assert-builder.js +13 -0
- package/dist/neal/prompts/execute.js +290 -0
- package/dist/neal/prompts/guidance.js +70 -0
- package/dist/neal/prompts/planning.js +313 -0
- package/dist/neal/prompts/review-doctrine.js +142 -0
- package/dist/neal/prompts/shared.js +101 -0
- package/dist/neal/prompts/specialized.js +212 -0
- package/dist/neal/prompts/specs.js +572 -0
- package/dist/neal/providers/anthropic-claude.js +1599 -0
- package/dist/neal/providers/detection.js +139 -0
- package/dist/neal/providers/generic-agentic-tools.js +586 -0
- package/dist/neal/providers/generic-agentic.js +1238 -0
- package/dist/neal/providers/liveness.js +151 -0
- package/dist/neal/providers/openai-codex.js +1014 -0
- package/dist/neal/providers/openai-compatible.js +654 -0
- package/dist/neal/providers/registry.js +389 -0
- package/dist/neal/providers/telemetry.js +208 -0
- package/dist/neal/providers/types.js +21 -0
- package/dist/neal/recovery-artifacts.js +50 -0
- package/dist/neal/resume-decision.js +220 -0
- package/dist/neal/resume-planner.js +265 -0
- package/dist/neal/retrospective.js +391 -0
- package/dist/neal/review-debt.js +18 -0
- package/dist/neal/review-findings/artifacts.js +173 -0
- package/dist/neal/review-findings/prompts.js +172 -0
- package/dist/neal/review-findings/provider.js +330 -0
- package/dist/neal/review-findings/run.js +373 -0
- package/dist/neal/review-findings/types.js +1 -0
- package/dist/neal/review-mode.js +67 -0
- package/dist/neal/review.js +137 -0
- package/dist/neal/run-lock.js +334 -0
- package/dist/neal/run-metrics.js +355 -0
- package/dist/neal/run-narrative-types.js +1 -0
- package/dist/neal/run-narrative.js +1374 -0
- package/dist/neal/run-registry.js +218 -0
- package/dist/neal/run-status.js +25 -0
- package/dist/neal/scopes.js +451 -0
- package/dist/neal/sensitive-text.js +8 -0
- package/dist/neal/squash-message.js +379 -0
- package/dist/neal/squash.js +591 -0
- package/dist/neal/state-invariants.js +496 -0
- package/dist/neal/state-views.js +344 -0
- package/dist/neal/state.js +887 -0
- package/dist/neal/status-footer.js +258 -0
- package/dist/neal/status.js +1260 -0
- package/dist/neal/storage-paths.js +57 -0
- package/dist/neal/support.js +58 -0
- package/dist/neal/terminal-narrator.js +435 -0
- package/dist/neal/types.js +1 -0
- package/dist/neal/verification-events.js +81 -0
- package/dist/neal/version.js +37 -0
- package/dist/neal/worktree-status.js +137 -0
- package/dist/notifier.js +44 -0
- package/docs/ADJUDICATOR_INVENTORY.md +310 -0
- package/docs/PROMPT_SPECS.md +266 -0
- package/docs/README.md +22 -0
- package/docs/architecture.md +113 -0
- package/docs/assets/neal-execution-flow.png +0 -0
- package/docs/automation.md +65 -0
- package/docs/comparison.md +105 -0
- package/docs/compat.md +269 -0
- package/docs/compatible-models.md +135 -0
- package/docs/demo.md +55 -0
- package/docs/maintenance.md +64 -0
- package/docs/plan-format.md +213 -0
- package/docs/providers.md +751 -0
- package/docs/release.md +147 -0
- package/docs/state-machine.md +266 -0
- package/docs/storage.md +207 -0
- package/docs/troubleshooting.md +152 -0
- package/examples/compat/add-edit-verify/PLAN.md +29 -0
- package/examples/compat/add-edit-verify/broken.diff +8 -0
- package/examples/compat/add-edit-verify/good.diff +8 -0
- package/examples/compat/add-edit-verify/package.json +5 -0
- package/examples/compat/add-edit-verify/src/add.js +2 -0
- package/examples/compat/add-edit-verify/test/add.test.js +9 -0
- package/examples/compat/is-even-add-test/PLAN.md +30 -0
- package/examples/compat/is-even-add-test/broken.diff +11 -0
- package/examples/compat/is-even-add-test/good.diff +11 -0
- package/examples/compat/is-even-add-test/package.json +5 -0
- package/examples/compat/is-even-add-test/src/is-even.js +3 -0
- package/examples/compat/is-even-add-test/test/is-even.test.js +9 -0
- package/examples/compat/manifest.json +60 -0
- package/examples/compat/plan-greeting/ISSUE.md +25 -0
- package/examples/compat/plan-greeting/package.json +5 -0
- package/examples/compat/plan-greeting/src/greet.js +2 -0
- package/examples/compat/plan-greeting/test/greet.test.js +8 -0
- package/examples/compat/reverse-grep-edit/PLAN.md +32 -0
- package/examples/compat/reverse-grep-edit/broken.diff +12 -0
- package/examples/compat/reverse-grep-edit/good.diff +12 -0
- package/examples/compat/reverse-grep-edit/package.json +5 -0
- package/examples/compat/reverse-grep-edit/src/strings.js +10 -0
- package/examples/compat/reverse-grep-edit/test/strings.test.js +15 -0
- package/examples/issue-triage-js/PLAN.md +83 -0
- package/examples/issue-triage-js/README.md +76 -0
- package/examples/issue-triage-js/package.json +9 -0
- package/examples/issue-triage-js/src/issue-triage.js +87 -0
- package/examples/issue-triage-js/test/issue-triage.test.js +107 -0
- package/package.json +70 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
export const REVIEW_FINDINGS_ADJUDICATED_LOOP_CONTRACT = {
|
|
2
|
+
loopKind: 'review',
|
|
3
|
+
sideEffectPolicy: 'read_only',
|
|
4
|
+
allowedOutcomes: ['accepted', 'revise', 'blocked', 'failed', 'cap_reached'],
|
|
5
|
+
terminalOutcomes: ['accepted', 'blocked', 'failed', 'cap_reached'],
|
|
6
|
+
roundCap: {
|
|
7
|
+
source: 'neal.max_review_rounds',
|
|
8
|
+
appliesTo: 'review_iterations',
|
|
9
|
+
outcomeWhenReached: 'cap_reached',
|
|
10
|
+
notes: 'Review findings revise the read-only findings artifact until reviewer acceptance or the configured review-round cap is reached.',
|
|
11
|
+
},
|
|
12
|
+
terminalArtifact: {
|
|
13
|
+
kind: 'review_findings',
|
|
14
|
+
storage: '.neal/reviews/<review-id>/REVIEW_FINAL.md',
|
|
15
|
+
description: 'Accepted read-only findings for a selected local commit range.',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export const ADJUDICATED_LOOP_KINDS = [
|
|
19
|
+
'plan',
|
|
20
|
+
'execute',
|
|
21
|
+
'review',
|
|
22
|
+
'final_completion',
|
|
23
|
+
];
|
|
24
|
+
export const LOOP_SIDE_EFFECT_POLICIES = [
|
|
25
|
+
'read_only',
|
|
26
|
+
'plan_doc_only',
|
|
27
|
+
'code_changes',
|
|
28
|
+
];
|
|
29
|
+
export const ADJUDICATED_LOOP_OUTCOMES = [
|
|
30
|
+
'accepted',
|
|
31
|
+
'revise',
|
|
32
|
+
'blocked',
|
|
33
|
+
'failed',
|
|
34
|
+
'cap_reached',
|
|
35
|
+
];
|
|
36
|
+
export function assertAllowedLoopOutcome(contract, outcome, ownerId) {
|
|
37
|
+
if (contract.allowedOutcomes.includes(outcome)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
throw new Error(`Adjudicated loop ${ownerId} resolved outcome ${outcome}, but allowed outcomes are: ${contract.allowedOutcomes.join(', ')}.`);
|
|
41
|
+
}
|
|
42
|
+
export function assertTerminalLoopOutcome(contract, outcome, ownerId) {
|
|
43
|
+
assertAllowedLoopOutcome(contract, outcome, ownerId);
|
|
44
|
+
if (contract.terminalOutcomes.includes(outcome)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
throw new Error(`Adjudicated loop ${ownerId} resolved terminal outcome ${outcome}, but terminal outcomes are: ${contract.terminalOutcomes.join(', ')}.`);
|
|
48
|
+
}
|
|
49
|
+
function isReviewedDraftTerminalOutcome(outcome) {
|
|
50
|
+
return outcome === 'accepted' || outcome === 'blocked' || outcome === 'cap_reached';
|
|
51
|
+
}
|
|
52
|
+
export function resolveReviewedDraftLoopStep(args) {
|
|
53
|
+
if (args.round < 1) {
|
|
54
|
+
throw new Error(`Adjudicated loop ${args.ownerId} round must be at least 1.`);
|
|
55
|
+
}
|
|
56
|
+
if (args.maxRounds < 1) {
|
|
57
|
+
throw new Error(`Adjudicated loop ${args.ownerId} maxRounds must be at least 1.`);
|
|
58
|
+
}
|
|
59
|
+
assertAllowedLoopOutcome(args.contract, args.verdict, args.ownerId);
|
|
60
|
+
if (args.verdict === 'accepted' || args.verdict === 'blocked') {
|
|
61
|
+
assertTerminalLoopOutcome(args.contract, args.verdict, args.ownerId);
|
|
62
|
+
return {
|
|
63
|
+
outcome: args.verdict,
|
|
64
|
+
terminalOutcome: args.verdict,
|
|
65
|
+
shouldRevise: false,
|
|
66
|
+
capReached: false,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
if (args.round >= args.maxRounds) {
|
|
70
|
+
const capOutcome = args.contract.roundCap.outcomeWhenReached;
|
|
71
|
+
assertTerminalLoopOutcome(args.contract, capOutcome, args.ownerId);
|
|
72
|
+
if (!isReviewedDraftTerminalOutcome(capOutcome)) {
|
|
73
|
+
throw new Error(`Adjudicated loop ${args.ownerId} round cap outcome ${capOutcome} is not valid for a reviewed draft loop.`);
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
outcome: capOutcome,
|
|
77
|
+
terminalOutcome: capOutcome,
|
|
78
|
+
shouldRevise: false,
|
|
79
|
+
capReached: true,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
outcome: 'revise',
|
|
84
|
+
terminalOutcome: null,
|
|
85
|
+
shouldRevise: true,
|
|
86
|
+
capReached: false,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export function renderAdjudicatedLoopContractLines(contract) {
|
|
90
|
+
return [
|
|
91
|
+
`- Loop kind: ${contract.loopKind}`,
|
|
92
|
+
`- Side-effect policy: ${contract.sideEffectPolicy}`,
|
|
93
|
+
`- Allowed loop outcomes: ${contract.allowedOutcomes.join(', ')}`,
|
|
94
|
+
`- Terminal loop outcomes: ${contract.terminalOutcomes.join(', ')}`,
|
|
95
|
+
`- Round cap: ${contract.roundCap.source} -> ${contract.roundCap.outcomeWhenReached}`,
|
|
96
|
+
`- Terminal artifact: ${contract.terminalArtifact.kind} at ${contract.terminalArtifact.storage}`,
|
|
97
|
+
];
|
|
98
|
+
}
|
|
99
|
+
export function validateAdjudicatedLoopContract(ownerId, contract) {
|
|
100
|
+
if (!contract) {
|
|
101
|
+
throw new Error(`Adjudication spec ${ownerId} is missing an adjudicated loop contract.`);
|
|
102
|
+
}
|
|
103
|
+
if (!ADJUDICATED_LOOP_KINDS.includes(contract.loopKind)) {
|
|
104
|
+
throw new Error(`Adjudication spec ${ownerId} declares unknown loop kind ${contract.loopKind}.`);
|
|
105
|
+
}
|
|
106
|
+
if (!LOOP_SIDE_EFFECT_POLICIES.includes(contract.sideEffectPolicy)) {
|
|
107
|
+
throw new Error(`Adjudication spec ${ownerId} must declare a valid side-effect policy.`);
|
|
108
|
+
}
|
|
109
|
+
if (contract.allowedOutcomes.length === 0) {
|
|
110
|
+
throw new Error(`Adjudication spec ${ownerId} must declare at least one allowed loop outcome.`);
|
|
111
|
+
}
|
|
112
|
+
if (contract.terminalOutcomes.length === 0) {
|
|
113
|
+
throw new Error(`Adjudication spec ${ownerId} must declare at least one terminal loop outcome.`);
|
|
114
|
+
}
|
|
115
|
+
const allowedOutcomes = new Set(contract.allowedOutcomes);
|
|
116
|
+
for (const outcome of contract.allowedOutcomes) {
|
|
117
|
+
if (!ADJUDICATED_LOOP_OUTCOMES.includes(outcome)) {
|
|
118
|
+
throw new Error(`Adjudication spec ${ownerId} declares unknown loop outcome ${outcome}.`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
for (const outcome of contract.terminalOutcomes) {
|
|
122
|
+
if (!allowedOutcomes.has(outcome)) {
|
|
123
|
+
throw new Error(`Adjudication spec ${ownerId} terminal outcome ${outcome} is not in allowed loop outcomes.`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (!allowedOutcomes.has(contract.roundCap.outcomeWhenReached)) {
|
|
127
|
+
throw new Error(`Adjudication spec ${ownerId} round cap outcome ${contract.roundCap.outcomeWhenReached} is not in allowed loop outcomes.`);
|
|
128
|
+
}
|
|
129
|
+
if (!contract.roundCap.source.trim()) {
|
|
130
|
+
throw new Error(`Adjudication spec ${ownerId} must declare a round-cap source.`);
|
|
131
|
+
}
|
|
132
|
+
if (!contract.roundCap.notes.trim()) {
|
|
133
|
+
throw new Error(`Adjudication spec ${ownerId} must declare round-cap semantics.`);
|
|
134
|
+
}
|
|
135
|
+
if (!contract.terminalArtifact.storage.trim() || !contract.terminalArtifact.description.trim()) {
|
|
136
|
+
throw new Error(`Adjudication spec ${ownerId} must declare terminal artifact storage and description.`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
validateAdjudicatedLoopContract('review', REVIEW_FINDINGS_ADJUDICATED_LOOP_CONTRACT);
|