opencode-swarm 7.140.0 → 7.140.2
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/.opencode/skills/commit-pr/SKILL.md +7 -0
- package/.opencode/skills/issue-ingest/SKILL.md +32 -1
- package/.opencode/skills/swarm-pr-feedback/SKILL.md +21 -5
- package/.opencode/skills/swarm-pr-review/SKILL.md +75 -17
- package/dist/background/candidate-contract.d.ts +3 -0
- package/dist/cli/{config-doctor-3bm8pvnb.js → config-doctor-shc0n4q1.js} +3 -3
- package/dist/cli/{core-jtj9j6z5.js → core-p5cyej3r.js} +2 -2
- package/dist/cli/{curation-policy-zkvkg4np.js → curation-policy-7n6t8he4.js} +2 -2
- package/dist/cli/{curator-llm-factory-kbqtk2wm.js → curator-llm-factory-pr4bdfqw.js} +14 -14
- package/dist/cli/{curator-78ejknh2.js → curator-zp5qq24c.js} +14 -14
- package/dist/cli/{guardrail-explain-d6emse0z.js → guardrail-explain-thddj6jv.js} +15 -15
- package/dist/cli/{guardrail-log-27d6r2xq.js → guardrail-log-w8fmxe1x.js} +4 -4
- package/dist/cli/{hive-promoter-r5x4a2ta.js → hive-promoter-0yg3gxg6.js} +14 -14
- package/dist/cli/{index-43k8ntw7.js → index-0tevsq1a.js} +2 -2
- package/dist/cli/{index-ma8vk3v1.js → index-1j5my2qy.js} +2 -2
- package/dist/cli/{index-s38e38qy.js → index-325zmfyj.js} +4 -4
- package/dist/cli/{index-scbp2d32.js → index-4rje8dc0.js} +16 -16
- package/dist/cli/{index-6yv6wda9.js → index-7ax0bkqh.js} +1 -1
- package/dist/cli/{index-hbnsmnb0.js → index-898f16j9.js} +1 -1
- package/dist/cli/{index-f8dhh53t.js → index-9txca231.js} +3 -3
- package/dist/cli/{index-0pqh1710.js → index-bmmzfrc7.js} +2 -2
- package/dist/cli/{index-0jbhmm8b.js → index-chx92bes.js} +2 -2
- package/dist/cli/{index-p6h8f59v.js → index-jfp1bgt1.js} +1 -1
- package/dist/cli/{index-r4t92q32.js → index-n408rw7n.js} +9 -1
- package/dist/cli/{index-mb34t6w9.js → index-n831qq2v.js} +459 -178
- package/dist/cli/{index-6ykm2eha.js → index-t59cdg48.js} +1 -1
- package/dist/cli/{index-chycpf9y.js → index-vjqe1z2w.js} +3 -3
- package/dist/cli/{index-zebb6yw0.js → index-x6mtyj6q.js} +2 -2
- package/dist/cli/{index-6d7jkk1s.js → index-y98ngs4g.js} +2 -2
- package/dist/cli/{index-bdnrrx3w.js → index-yt3vz0e1.js} +1 -1
- package/dist/cli/{index-fxw0zvxc.js → index-z6md3t8m.js} +5 -5
- package/dist/cli/index.js +14 -14
- package/dist/cli/{knowledge-escalator-qjdfv9sj.js → knowledge-escalator-58tw74js.js} +3 -3
- package/dist/cli/{knowledge-events-7szzg70x.js → knowledge-events-knr0pfq4.js} +1 -1
- package/dist/cli/{knowledge-store-9mr7a9n8.js → knowledge-store-e2srcd89.js} +1 -1
- package/dist/cli/{knowledge-validator-58s2j0dp.js → knowledge-validator-1dtj02q8.js} +4 -4
- package/dist/cli/{scan-cursor-h3j1egky.js → scan-cursor-7tqsvbp8.js} +2 -2
- package/dist/cli/{schema-9ryqandr.js → schema-b046zss2.js} +2 -2
- package/dist/cli/{skill-generator-66ez26yh.js → skill-generator-bvph9d98.js} +5 -5
- package/dist/commands/registry.d.ts +1 -1
- package/dist/git/pr-workflow-state.d.ts +3 -1
- package/dist/hooks/issue-trace-reducer.d.ts +37 -13
- package/dist/hooks/issue-trace-state.d.ts +38 -9
- package/dist/hooks/issue-trace.d.ts +15 -2
- package/dist/hooks/pr-workflow-gate.d.ts +21 -7
- package/dist/index.js +117 -107
- package/dist/tools/complete-pr-workflow.d.ts +6 -0
- package/dist/tools/gh-evidence.d.ts +6 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/manifest.d.ts +2 -0
- package/dist/tools/prepare-pr-workflow-checkout.d.ts +11 -0
- package/dist/tools/record-issue-publication.d.ts +16 -0
- package/dist/tools/record-issue-reproduction.d.ts +22 -0
- package/dist/tools/tool-metadata.d.ts +8 -0
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
loadPluginConfigWithMeta,
|
|
8
8
|
loadPluginConfigWithMetaAsync,
|
|
9
9
|
resolveWorktreeIsolationConfig
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-0tevsq1a.js";
|
|
11
11
|
import {
|
|
12
12
|
ApprovalEvidenceSchema,
|
|
13
13
|
BaseEvidenceSchema,
|
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
TurboConfigSchema,
|
|
66
66
|
WorktreeIsolationConfigSchema,
|
|
67
67
|
resolveAutoReviewConfig
|
|
68
|
-
} from "./index-
|
|
68
|
+
} from "./index-bmmzfrc7.js";
|
|
69
69
|
import {
|
|
70
70
|
ALL_AGENT_NAMES,
|
|
71
71
|
ALL_SUBAGENT_NAMES,
|
|
@@ -75,7 +75,7 @@ import {
|
|
|
75
75
|
QA_AGENTS,
|
|
76
76
|
isQAAgent,
|
|
77
77
|
isSubagent
|
|
78
|
-
} from "./index-
|
|
78
|
+
} from "./index-n408rw7n.js";
|
|
79
79
|
import"./index-zjygnfay.js";
|
|
80
80
|
import"./index-bk5tah7q.js";
|
|
81
81
|
import"./index-bpmtbmy9.js";
|
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
init_schema,
|
|
17
17
|
stripKnownSwarmPrefix
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-bmmzfrc7.js";
|
|
19
19
|
import {
|
|
20
20
|
init_constants
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-n408rw7n.js";
|
|
22
22
|
import {
|
|
23
23
|
__commonJS,
|
|
24
24
|
__toESM
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
detectPosixWrites,
|
|
13
13
|
detectWindowsWrites,
|
|
14
14
|
resolveWriteTargets
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-n831qq2v.js";
|
|
16
16
|
import {
|
|
17
17
|
checkFileAuthority,
|
|
18
18
|
classifyFile,
|
|
19
19
|
isInDeclaredScope,
|
|
20
20
|
redactPath,
|
|
21
21
|
redactShellCommand
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-x6mtyj6q.js";
|
|
23
23
|
|
|
24
24
|
// src/services/guardrail-explain-service.ts
|
|
25
25
|
import path from "path";
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
resolveSwarmKnowledgePath,
|
|
7
7
|
transactKnowledge,
|
|
8
8
|
wordBigrams
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-325zmfyj.js";
|
|
10
10
|
import {
|
|
11
11
|
countEntryContradictionsInWindow,
|
|
12
12
|
countEntryViolationsInWindow,
|
|
13
13
|
readKnowledgeEvents,
|
|
14
14
|
recordKnowledgeEvent
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-jfp1bgt1.js";
|
|
16
16
|
import {
|
|
17
17
|
init_knowledge_types,
|
|
18
18
|
isActiveStatus
|
|
@@ -190,11 +190,11 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
|
|
|
190
190
|
alreadyInactive: true
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
193
|
+
const { quarantineEntry } = await import("./knowledge-validator-1dtj02q8.js");
|
|
194
194
|
let policyConfig;
|
|
195
195
|
try {
|
|
196
|
-
const { KnowledgeConfigSchema } = await import("./schema-
|
|
197
|
-
const { loadPluginConfigWithMeta } = await import("./index-
|
|
196
|
+
const { KnowledgeConfigSchema } = await import("./schema-b046zss2.js");
|
|
197
|
+
const { loadPluginConfigWithMeta } = await import("./index-vjqe1z2w.js");
|
|
198
198
|
const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
|
|
199
199
|
policyConfig = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
200
200
|
} catch {
|
package/dist/cli/index.js
CHANGED
|
@@ -6,19 +6,19 @@ import {
|
|
|
6
6
|
getPluginConfigDir,
|
|
7
7
|
getPluginLockFilePaths,
|
|
8
8
|
resolveCommand
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-n831qq2v.js";
|
|
10
10
|
import"./index-41hkt36g.js";
|
|
11
11
|
import"./index-1m1ksyqt.js";
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
12
|
+
import"./index-x6mtyj6q.js";
|
|
13
|
+
import"./index-chx92bes.js";
|
|
14
14
|
import"./index-brh827g0.js";
|
|
15
15
|
import"./index-yyyk63kk.js";
|
|
16
16
|
import"./index-y8552snf.js";
|
|
17
17
|
import"./index-4905hd2m.js";
|
|
18
18
|
import"./index-134d35c1.js";
|
|
19
|
-
import"./index-
|
|
20
|
-
import"./index-
|
|
21
|
-
import"./index-
|
|
19
|
+
import"./index-9txca231.js";
|
|
20
|
+
import"./index-z6md3t8m.js";
|
|
21
|
+
import"./index-yt3vz0e1.js";
|
|
22
22
|
import"./index-v2xrer41.js";
|
|
23
23
|
import"./index-c8s9a3zh.js";
|
|
24
24
|
import"./index-9ss2m4rs.js";
|
|
@@ -28,7 +28,7 @@ import"./index-556ja8an.js";
|
|
|
28
28
|
import"./index-kbfsp07d.js";
|
|
29
29
|
import"./index-1kyex7z2.js";
|
|
30
30
|
import"./index-b8zgtz81.js";
|
|
31
|
-
import"./index-
|
|
31
|
+
import"./index-898f16j9.js";
|
|
32
32
|
import"./index-b9rd29ge.js";
|
|
33
33
|
import"./index-k46me75h.js";
|
|
34
34
|
import"./index-ee3x66a5.js";
|
|
@@ -36,11 +36,11 @@ import"./index-74hpm6sh.js";
|
|
|
36
36
|
import"./index-n0pja0qs.js";
|
|
37
37
|
import"./index-8fwhhayc.js";
|
|
38
38
|
import"./index-q1exe2b3.js";
|
|
39
|
-
import"./index-
|
|
40
|
-
import"./index-
|
|
39
|
+
import"./index-1j5my2qy.js";
|
|
40
|
+
import"./index-t59cdg48.js";
|
|
41
41
|
import"./index-rtry5xyf.js";
|
|
42
|
-
import"./index-
|
|
43
|
-
import"./index-
|
|
42
|
+
import"./index-325zmfyj.js";
|
|
43
|
+
import"./index-jfp1bgt1.js";
|
|
44
44
|
import"./index-ae75rja9.js";
|
|
45
45
|
import"./index-rs1f1bh0.js";
|
|
46
46
|
import"./index-h2waehqq.js";
|
|
@@ -48,7 +48,7 @@ import"./index-ed5ykebp.js";
|
|
|
48
48
|
import"./index-hfvxhk4z.js";
|
|
49
49
|
import"./index-7g4c7s5r.js";
|
|
50
50
|
import"./index-4nt52yr9.js";
|
|
51
|
-
import"./index-
|
|
51
|
+
import"./index-0tevsq1a.js";
|
|
52
52
|
import"./index-gprxjmm7.js";
|
|
53
53
|
import"./index-n832052r.js";
|
|
54
54
|
import"./index-d181x9zr.js";
|
|
@@ -57,11 +57,11 @@ import"./index-zgwm4ryv.js";
|
|
|
57
57
|
import {
|
|
58
58
|
init_package,
|
|
59
59
|
package_default
|
|
60
|
-
} from "./index-
|
|
60
|
+
} from "./index-bmmzfrc7.js";
|
|
61
61
|
import {
|
|
62
62
|
DEFAULT_AGENT_CONFIGS,
|
|
63
63
|
init_constants
|
|
64
|
-
} from "./index-
|
|
64
|
+
} from "./index-n408rw7n.js";
|
|
65
65
|
import"./index-zjygnfay.js";
|
|
66
66
|
import"./index-bk5tah7q.js";
|
|
67
67
|
import"./index-ry0hgg3m.js";
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
maybeEscalateOnViolation,
|
|
9
9
|
maybeQuarantineOnContradiction,
|
|
10
10
|
readRecentEscalations
|
|
11
|
-
} from "./index-
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
11
|
+
} from "./index-z6md3t8m.js";
|
|
12
|
+
import"./index-325zmfyj.js";
|
|
13
|
+
import"./index-jfp1bgt1.js";
|
|
14
14
|
import"./index-ae75rja9.js";
|
|
15
15
|
import"./index-rs1f1bh0.js";
|
|
16
16
|
import"./index-h2waehqq.js";
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
resolveKnowledgeCounterBaselinePath,
|
|
29
29
|
resolveKnowledgeEventsPath,
|
|
30
30
|
resolveLegacyApplicationLogPath
|
|
31
|
-
} from "./index-
|
|
31
|
+
} from "./index-jfp1bgt1.js";
|
|
32
32
|
import"./index-ae75rja9.js";
|
|
33
33
|
import"./index-rs1f1bh0.js";
|
|
34
34
|
import"./index-h2waehqq.js";
|
|
@@ -23,11 +23,11 @@ import {
|
|
|
23
23
|
validateLesson,
|
|
24
24
|
validateSkillCandidatePath,
|
|
25
25
|
validateSkillPath
|
|
26
|
-
} from "./index-
|
|
27
|
-
import"./index-
|
|
26
|
+
} from "./index-1j5my2qy.js";
|
|
27
|
+
import"./index-t59cdg48.js";
|
|
28
28
|
import"./index-rtry5xyf.js";
|
|
29
|
-
import"./index-
|
|
30
|
-
import"./index-
|
|
29
|
+
import"./index-325zmfyj.js";
|
|
30
|
+
import"./index-jfp1bgt1.js";
|
|
31
31
|
import"./index-ae75rja9.js";
|
|
32
32
|
import"./index-rs1f1bh0.js";
|
|
33
33
|
import"./index-h2waehqq.js";
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
alreadyCuratedThisGeneration,
|
|
5
5
|
claimNextScanBatch,
|
|
6
6
|
getScanStatus
|
|
7
|
-
} from "./index-
|
|
8
|
-
import"./index-
|
|
7
|
+
} from "./index-yt3vz0e1.js";
|
|
8
|
+
import"./index-325zmfyj.js";
|
|
9
9
|
import"./index-ae75rja9.js";
|
|
10
10
|
import"./index-rs1f1bh0.js";
|
|
11
11
|
import"./index-h2waehqq.js";
|
|
@@ -96,8 +96,8 @@ import {
|
|
|
96
96
|
resolveGeneratedAgentRole,
|
|
97
97
|
resolveGuardrailsConfig,
|
|
98
98
|
stripKnownSwarmPrefix
|
|
99
|
-
} from "./index-
|
|
100
|
-
import"./index-
|
|
99
|
+
} from "./index-bmmzfrc7.js";
|
|
100
|
+
import"./index-n408rw7n.js";
|
|
101
101
|
import"./index-zjygnfay.js";
|
|
102
102
|
import"./index-bk5tah7q.js";
|
|
103
103
|
import"./index-bpmtbmy9.js";
|
|
@@ -33,12 +33,12 @@ import {
|
|
|
33
33
|
sanitizeSlug,
|
|
34
34
|
selectCandidateEntries,
|
|
35
35
|
writeEvalStub
|
|
36
|
-
} from "./index-
|
|
37
|
-
import"./index-
|
|
38
|
-
import"./index-
|
|
36
|
+
} from "./index-9txca231.js";
|
|
37
|
+
import"./index-1j5my2qy.js";
|
|
38
|
+
import"./index-t59cdg48.js";
|
|
39
39
|
import"./index-rtry5xyf.js";
|
|
40
|
-
import"./index-
|
|
41
|
-
import"./index-
|
|
40
|
+
import"./index-325zmfyj.js";
|
|
41
|
+
import"./index-jfp1bgt1.js";
|
|
42
42
|
import"./index-ae75rja9.js";
|
|
43
43
|
import"./index-rs1f1bh0.js";
|
|
44
44
|
import"./index-h2waehqq.js";
|
|
@@ -619,7 +619,7 @@ export declare const COMMAND_REGISTRY: {
|
|
|
619
619
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
620
620
|
readonly description: "Clear a stuck PR_REVIEW/PR_FEEDBACK mechanical gate and stop the auto-resume loop [mode] [reason]";
|
|
621
621
|
readonly args: "[PR_REVIEW|PR_FEEDBACK] [reason...]";
|
|
622
|
-
readonly details: "Human-only escape hatch for an unrecoverable PR_REVIEW or PR_FEEDBACK mechanical gate. When the architect cannot reach complete_pr_workflow — for example a compound `git fetch && git checkout` was rejected as read-only shell syntax, the PR head cannot be fetched, or the working tree is on the wrong branch — running this clears the durable gate state for the current session and stops the auto-resume loop without depending on the trapped model. The agent itself cannot run this command; it must call the abort_pr_workflow tool (or ask you to run this command). Both paths funnel into the same fail-closed abortPrWorkflow hook, which refuses while the workflow is armed for publication or while PR workflow lanes are still in flight. An audit event is appended to .swarm/events.jsonl.";
|
|
622
|
+
readonly details: "Human-only escape hatch for an unrecoverable PR_REVIEW or PR_FEEDBACK mechanical gate. When the architect cannot reach complete_pr_workflow — for example a compound `git fetch && git checkout` was rejected as read-only shell syntax, the PR head cannot be fetched, or the working tree is on the wrong branch — running this clears the durable gate state for the current session and stops the auto-resume loop without depending on the trapped model. The agent itself cannot run this command; it must call the abort_pr_workflow tool (or ask you to run this command). Both paths funnel into the same fail-closed abortPrWorkflow hook, which refuses while the workflow is armed for publication or while PR workflow lanes are still in flight. When checkout preparation preserved a stash, the result instructs the caller to run prepare_pr_workflow_checkout operation=restore after the clear. An audit event is appended to .swarm/events.jsonl.";
|
|
623
623
|
readonly category: "utility";
|
|
624
624
|
readonly toolPolicy: "restricted";
|
|
625
625
|
};
|
|
@@ -28,7 +28,9 @@ declare function activeOperations(gitDir: string): Promise<string[]>;
|
|
|
28
28
|
* Unknown Git state fails closed; ordinary tracked/untracked dirt is explicitly
|
|
29
29
|
* distinguished from conflict and in-progress-operation recovery states.
|
|
30
30
|
*/
|
|
31
|
-
export declare function classifyPrWorkflowGitState(directory: string
|
|
31
|
+
export declare function classifyPrWorkflowGitState(directory: string, options?: {
|
|
32
|
+
ignoredPaths?: readonly string[];
|
|
33
|
+
}): Promise<PrWorkflowGitState>;
|
|
32
34
|
export declare const _internals: {
|
|
33
35
|
runGitCapture: typeof runGitCapture;
|
|
34
36
|
activeOperations: typeof activeOperations;
|
|
@@ -3,7 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Determines the next mode transition for an issue-trace workflow
|
|
5
5
|
* based on current trace state and workflow artifacts. Evaluated
|
|
6
|
-
* top-to-bottom (first-match-wins) against
|
|
6
|
+
* top-to-bottom (first-match-wins) against the decision table below.
|
|
7
|
+
*
|
|
8
|
+
* Issue #2131 finding 2: the reducer no longer conflates "the engine
|
|
9
|
+
* handed off to commit-pr" with "the issue is resolved." Trace state is a
|
|
10
|
+
* typed `status` (`in_progress` → `publication_handoff` → `published`), and
|
|
11
|
+
* the commit-pr handoff sets `publication_handoff` (NOT a terminal
|
|
12
|
+
* "completed"). `published` is reachable only after a verifiable publication
|
|
13
|
+
* receipt is observed. A reproduction gate (evidence OR a typed waiver) must
|
|
14
|
+
* be satisfied before the PLAN transition fires.
|
|
7
15
|
*/
|
|
8
16
|
export interface IssueReference {
|
|
9
17
|
url: string;
|
|
@@ -22,10 +30,20 @@ export interface IssueReference {
|
|
|
22
30
|
timestamp: string;
|
|
23
31
|
};
|
|
24
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Trace lifecycle status. Replaces the boolean `completed` (issue #2131
|
|
35
|
+
* finding 2.4):
|
|
36
|
+
* - `in_progress`: the engine is driving PLAN → CRITIC-GATE → EXECUTE.
|
|
37
|
+
* - `publication_handoff`: all phases complete; the engine has emitted the
|
|
38
|
+
* commit-pr directive and stopped driving. This is NOT "issue resolved" —
|
|
39
|
+
* publication is owned by commit-pr and has not yet been confirmed.
|
|
40
|
+
* - `published`: a verifiable publication receipt was observed. Terminal.
|
|
41
|
+
*/
|
|
42
|
+
export type TraceStatus = 'in_progress' | 'publication_handoff' | 'published';
|
|
25
43
|
export interface TraceState {
|
|
26
44
|
issueNumber: number;
|
|
27
45
|
lastTransition: string | null;
|
|
28
|
-
|
|
46
|
+
status: TraceStatus;
|
|
29
47
|
}
|
|
30
48
|
export interface WorkflowArtifacts {
|
|
31
49
|
specExists: boolean;
|
|
@@ -33,12 +51,16 @@ export interface WorkflowArtifacts {
|
|
|
33
51
|
planExists: boolean;
|
|
34
52
|
criticApproved: boolean;
|
|
35
53
|
allPhasesComplete: boolean;
|
|
54
|
+
/** Reproduction evidence OR a typed waiver is present (issue #2131 2.6). */
|
|
55
|
+
reproductionPermitted: boolean;
|
|
56
|
+
/** A verifiable publication receipt has been observed (issue #2131 2.4). */
|
|
57
|
+
publicationObserved: boolean;
|
|
36
58
|
}
|
|
37
59
|
export interface TransitionResult {
|
|
38
60
|
nextMode: string | null;
|
|
39
61
|
directive: string | null;
|
|
40
62
|
nextLastTransition: string | null;
|
|
41
|
-
|
|
63
|
+
nextStatus: TraceStatus;
|
|
42
64
|
}
|
|
43
65
|
export interface ComputeNextModeParams {
|
|
44
66
|
issueReference: IssueReference | null;
|
|
@@ -51,16 +73,18 @@ export interface ComputeNextModeParams {
|
|
|
51
73
|
*
|
|
52
74
|
* Decision table (top-to-bottom, first match wins):
|
|
53
75
|
* (a) No issue reference or trace not requested → no-op
|
|
54
|
-
* (b) Trace already
|
|
55
|
-
* (c)
|
|
56
|
-
* (d)
|
|
57
|
-
* (e) Spec
|
|
58
|
-
* (f)
|
|
59
|
-
*
|
|
60
|
-
* (
|
|
76
|
+
* (b) Trace already published (terminal) → no-op
|
|
77
|
+
* (c) publication_handoff: observe publication → PUBLISHED; else no-op
|
|
78
|
+
* (d) Cross-issue guard (spec issue ≠ current issue) → no-op
|
|
79
|
+
* (e) Spec does not exist → no-op
|
|
80
|
+
* (f) Spec exists, no plan, reproduction permitted,
|
|
81
|
+
* never transitioned (or re-entrant idempotency) → PLAN
|
|
82
|
+
* (f-block) Spec exists, no plan, reproduction NOT permitted → no-op
|
|
83
|
+
* (g) Plan exists but critic not approved → no-op
|
|
84
|
+
* (h) Critic approved, phases incomplete, not yet PLAN_TO_EXECUTE → EXECUTE
|
|
85
|
+
* (i) All phases complete, not yet EXECUTE_TO_COMMIT → publication_handoff + COMMIT directive
|
|
61
86
|
*
|
|
62
|
-
* Idempotency: rows (
|
|
63
|
-
* `traceState.lastTransition` already equals the target
|
|
64
|
-
* transition value.
|
|
87
|
+
* Idempotency: rows (f), (h), (i) return no-op when
|
|
88
|
+
* `traceState.lastTransition` already equals the target transition value.
|
|
65
89
|
*/
|
|
66
90
|
export declare function computeNextMode(params: ComputeNextModeParams): TransitionResult;
|
|
@@ -4,11 +4,19 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Uses the `_internals` DI seam pattern (AGENTS.md invariant 7) so
|
|
6
6
|
* tests can override filesystem calls without `mock.module` leakage.
|
|
7
|
+
*
|
|
8
|
+
* Issue #2131 finding 2.3: plan state is read through the AUTHORITATIVE
|
|
9
|
+
* ledger-aware `loadPlan` (never `loadPlanJsonOnly`, never projection
|
|
10
|
+
* existence). Finding 2.4: trace state is a typed `status`, with
|
|
11
|
+
* backward-compatible reading of legacy `completed: boolean` records.
|
|
12
|
+
* Findings 2.6 / 2.4(published): reproduction + publication receipt readers.
|
|
7
13
|
*/
|
|
8
14
|
import { existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
9
15
|
import type { Plan } from '../config/plan-schema';
|
|
10
16
|
import type { IssueReference, TraceState } from './issue-trace-reducer';
|
|
11
17
|
declare function _defaultLoadPlanFromLedger(directory: string): Promise<Plan | null>;
|
|
18
|
+
declare function _defaultReproductionReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
|
|
19
|
+
declare function _defaultPublicationReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
|
|
12
20
|
export declare const _internals: {
|
|
13
21
|
readFileSync: typeof readFileSync;
|
|
14
22
|
writeFileSync: typeof writeFileSync;
|
|
@@ -17,6 +25,8 @@ export declare const _internals: {
|
|
|
17
25
|
mkdirSync: typeof mkdirSync;
|
|
18
26
|
unlinkSync: typeof unlinkSync;
|
|
19
27
|
loadPlanFromLedger: typeof _defaultLoadPlanFromLedger;
|
|
28
|
+
reproductionReceiptExists: typeof _defaultReproductionReceiptExists;
|
|
29
|
+
publicationReceiptExists: typeof _defaultPublicationReceiptExists;
|
|
20
30
|
};
|
|
21
31
|
/**
|
|
22
32
|
* Reads `.swarm/issue-reference.json` and returns the parsed object,
|
|
@@ -24,9 +34,10 @@ export declare const _internals: {
|
|
|
24
34
|
*/
|
|
25
35
|
export declare function readIssueReference(directory: string): IssueReference | null;
|
|
26
36
|
/**
|
|
27
|
-
* Reads `.swarm/issue-trace-state.json` and returns the parsed state
|
|
28
|
-
* or
|
|
29
|
-
* if the file is
|
|
37
|
+
* Reads `.swarm/issue-trace-state.json` and returns the parsed state
|
|
38
|
+
* (new `status` or legacy `completed`, normalized), or a default
|
|
39
|
+
* `{issueNumber:0, lastTransition:null, status:'in_progress'}` if the file is
|
|
40
|
+
* absent or malformed.
|
|
30
41
|
*/
|
|
31
42
|
export declare function readTraceState(directory: string): TraceState;
|
|
32
43
|
/**
|
|
@@ -42,23 +53,41 @@ export declare function writeTraceState(directory: string, state: TraceState): v
|
|
|
42
53
|
*/
|
|
43
54
|
export declare function readSpecIssueNumber(directory: string): number | null;
|
|
44
55
|
/**
|
|
45
|
-
* Loads the plan from the ledger-aware
|
|
46
|
-
* Async because the underlying
|
|
56
|
+
* Loads the plan from the AUTHORITATIVE ledger-aware loader (issue #2131 2.3).
|
|
57
|
+
* Async because the underlying loader is async.
|
|
47
58
|
*/
|
|
48
59
|
export declare function loadPlanFromLedger(directory: string): Promise<Plan | null>;
|
|
49
60
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
61
|
+
* Computes plan presence AND phase-completion status from a single
|
|
62
|
+
* AUTHORITATIVE plan load. `planExists` reflects ledger authority, not
|
|
63
|
+
* projection (`.swarm/plan.json`) existence. Returns
|
|
64
|
+
* `{ planExists: false, allComplete: false }` if the plan is null/empty.
|
|
52
65
|
*/
|
|
53
66
|
export declare function readPlanPhaseStatus(directory: string): Promise<{
|
|
67
|
+
planExists: boolean;
|
|
54
68
|
allComplete: boolean;
|
|
55
69
|
}>;
|
|
70
|
+
/**
|
|
71
|
+
* Returns whether an AUTHORITATIVE plan exists (ledger-aware). Async because
|
|
72
|
+
* the loader is async. Prefer {@link readPlanPhaseStatus} when both presence
|
|
73
|
+
* and phase status are needed, to load the plan once.
|
|
74
|
+
*/
|
|
75
|
+
export declare function planExists(directory: string): Promise<boolean>;
|
|
56
76
|
/**
|
|
57
77
|
* Returns whether `.swarm/spec.md` exists.
|
|
58
78
|
*/
|
|
59
79
|
export declare function specExists(directory: string): boolean;
|
|
60
80
|
/**
|
|
61
|
-
* Returns whether
|
|
81
|
+
* Returns whether a valid reproduction receipt exists for the given issue
|
|
82
|
+
* (issue #2131 2.6). The receipt is written by the `record_issue_reproduction`
|
|
83
|
+
* tool and binds to the issue number.
|
|
84
|
+
*/
|
|
85
|
+
export declare function reproductionReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
|
|
86
|
+
/**
|
|
87
|
+
* Returns whether a valid publication receipt exists for the given issue (issue
|
|
88
|
+
* #2131 2.4). The receipt is written by the `record_issue_publication` tool
|
|
89
|
+
* after PR creation and is issue-bound so a prior issue's receipt cannot satisfy
|
|
90
|
+
* a new trace.
|
|
62
91
|
*/
|
|
63
|
-
export declare function
|
|
92
|
+
export declare function publicationReceiptExists(directory: string, issueNumber: number): Promise<boolean>;
|
|
64
93
|
export {};
|
|
@@ -8,9 +8,16 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Uses the `_internals` DI seam pattern (AGENTS.md invariant 7) so
|
|
10
10
|
* tests can override adapter functions without `mock.module` leakage.
|
|
11
|
+
*
|
|
12
|
+
* Issue #2131 finding 2.5: a transition is persisted ONLY AFTER its
|
|
13
|
+
* directive/mode message is durably appended to the host `output.messages`.
|
|
14
|
+
* If the host output lacks a mutable messages array the transition is NOT
|
|
15
|
+
* advanced, so the next cycle recomputes and retries — a lost directive can
|
|
16
|
+
* no longer be permanently suppressed by idempotency while state advances.
|
|
11
17
|
*/
|
|
18
|
+
import { error as _logErrorImpl } from '../utils/logger.js';
|
|
12
19
|
import { isPlanCriticApproved } from './delegation-gate';
|
|
13
|
-
import {
|
|
20
|
+
import { publicationReceiptExists, readIssueReference, readPlanPhaseStatus, readSpecIssueNumber, readTraceState, reproductionReceiptExists, specExists, writeTraceState } from './issue-trace-state';
|
|
14
21
|
export declare const _internals: {
|
|
15
22
|
readIssueReference: typeof readIssueReference;
|
|
16
23
|
readTraceState: typeof readTraceState;
|
|
@@ -18,8 +25,10 @@ export declare const _internals: {
|
|
|
18
25
|
readSpecIssueNumber: typeof readSpecIssueNumber;
|
|
19
26
|
readPlanPhaseStatus: typeof readPlanPhaseStatus;
|
|
20
27
|
specExists: typeof specExists;
|
|
21
|
-
|
|
28
|
+
reproductionReceiptExists: typeof reproductionReceiptExists;
|
|
29
|
+
publicationReceiptExists: typeof publicationReceiptExists;
|
|
22
30
|
isPlanCriticApproved: typeof isPlanCriticApproved;
|
|
31
|
+
logError: typeof _logErrorImpl;
|
|
23
32
|
};
|
|
24
33
|
export declare function createIssueTraceHook(_config: unknown, directory: string, approvalTimeoutMs?: number): {
|
|
25
34
|
messagesTransform: (input: unknown, output: unknown) => Promise<void>;
|
|
@@ -29,3 +38,7 @@ export declare function createIssueTraceHook(_config: unknown, directory: string
|
|
|
29
38
|
* cross-test pollution from the module-level cache.
|
|
30
39
|
*/
|
|
31
40
|
export declare function resetApprovalCache(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Reset the plan phase-status cache. Called by tests in afterEach.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resetPhaseStatusCache(): void;
|
|
@@ -4,7 +4,7 @@ import { type LaneOutputArtifact } from '../background/lane-output-store.js';
|
|
|
4
4
|
import { type BackgroundDelegationRecord, type BackgroundDelegationResult, findByBatchId } from '../background/pending-delegations.js';
|
|
5
5
|
import { type PrReviewInlineTriggerRow } from '../background/pr-review-trigger-contract.js';
|
|
6
6
|
import { type RevisionDigestResult, resolveCommitCountSince, resolveCommitCountSinceAsync, resolveCurrentGitHead, resolveCurrentGitHeadAsync, resolveCurrentUpstreamPushTarget, resolveCurrentUpstreamPushTargetAsync, resolveCurrentUpstreamRemoteRef, resolveExactRemoteBranchHead, resolveExactRemoteBranchHeadAsync, resolveIsExactSingleChildCommit, resolveIsExactSingleChildCommitAsync, resolveIsWorkingTreeClean, resolveIsWorkingTreeCleanAsync, resolvePrReviewDiffStats, resolvePrReviewDiffStatsAsync, resolvePrWorkflowRevisionDigest, resolvePrWorkflowRevisionDigestDetailed, resolveRemoteRefsContainingHead, resolveRemoteRefsContainingHeadAsync } from '../background/workspace-snapshot.js';
|
|
7
|
-
import { type PrWorkflowGitState } from '../git/pr-workflow-state.js';
|
|
7
|
+
import { classifyPrWorkflowGitState, type PrWorkflowGitState } from '../git/pr-workflow-state.js';
|
|
8
8
|
export declare const PR_REVIEW_BASE_DIMENSION_IDS: readonly ["intent-architecture", "correctness-state", "tests-falsifiability", "security-trust", "reliability-performance", "compatibility-delivery"];
|
|
9
9
|
export declare const PR_REVIEW_REQUIRED_MICRO_LANE_IDS: ("auth-identity-secrets" | "untrusted-input-boundaries" | "subprocess-platform" | "concurrency-state" | "dependencies-build-release" | "api-schema-migrations" | "test-infrastructure" | "ui-accessibility-i18n" | "privacy-observability" | "generated-provenance" | "unclassified-risk")[];
|
|
10
10
|
export type PrReviewBaseDimensionId = (typeof PR_REVIEW_BASE_DIMENSION_IDS)[number];
|
|
@@ -33,7 +33,7 @@ export interface PrReviewDiscoveryLaneValidationInput {
|
|
|
33
33
|
result: BackgroundDelegationResult;
|
|
34
34
|
artifact: LaneOutputArtifact | null;
|
|
35
35
|
expected: {
|
|
36
|
-
mode: 'swarm-pr-review:base' | 'swarm-pr-review:micro';
|
|
36
|
+
mode: 'swarm-pr-review:base' | 'swarm-pr-review:micro' | 'swarm-pr-review:council';
|
|
37
37
|
workflowLane: string;
|
|
38
38
|
ownedWorkflowLanes?: readonly string[];
|
|
39
39
|
prHeadSha: string;
|
|
@@ -359,6 +359,13 @@ export declare function readPrWorkflowGateState(directory: string, sessionID: st
|
|
|
359
359
|
export declare function withPrWorkflowCheckoutPreparationLock<T>(directory: string, sessionID: string, action: (state: PrWorkflowGateState, controls: {
|
|
360
360
|
markRecoveryRequired: (gitState: PrWorkflowGitState) => Promise<PrWorkflowGateState>;
|
|
361
361
|
}) => Promise<T>): Promise<T>;
|
|
362
|
+
/**
|
|
363
|
+
* Serialize post-terminal checkout restoration against both checkout mutations
|
|
364
|
+
* and same-session gate activation. Holding the session-state lock while the
|
|
365
|
+
* caller restores makes the inactive-gate check atomic with respect to a new
|
|
366
|
+
* activatePrWorkflow/persistState call.
|
|
367
|
+
*/
|
|
368
|
+
export declare function withInactivePrWorkflowCheckoutRestoreLock<T>(directory: string, sessionID: string, action: () => Promise<T>): Promise<T>;
|
|
362
369
|
export declare function clearPrWorkflowGateState(directory: string, sessionID: string, expectedRevision?: number): Promise<void>;
|
|
363
370
|
/**
|
|
364
371
|
* Abort an active PR workflow gate without reaching terminal completion.
|
|
@@ -380,13 +387,19 @@ export declare function clearPrWorkflowGateState(directory: string, sessionID: s
|
|
|
380
387
|
* commit. The tool gate refuses armed abort too (defense in depth).
|
|
381
388
|
* 4. Refuses while open `swarm-pr-*` delegations exist, matching
|
|
382
389
|
* `completePrWorkflow` — aborting mid-flight would orphan running lanes.
|
|
390
|
+
* 5. A `recovery` abort may clear an unbound or bound gate once every lane
|
|
391
|
+
* has settled. This is the bounded escape hatch for exhausted discovery,
|
|
392
|
+
* validation, or checkout recovery; requiring a pre-bind
|
|
393
|
+
* `checkoutRecovery` marker here would strand failures discovered only
|
|
394
|
+
* after the head was bound. `force` remains the explicit user override.
|
|
383
395
|
*
|
|
384
396
|
* Records a non-fatal audit event into the existing `.swarm/events.jsonl`
|
|
385
397
|
* (no new ledger file), then delegates to `clearPrWorkflowGateState`.
|
|
386
398
|
*/
|
|
387
399
|
export declare function abortPrWorkflow(directory: string, sessionID: string, options?: {
|
|
388
400
|
expectedMode?: PrWorkflowMode;
|
|
389
|
-
|
|
401
|
+
kind: 'recovery' | 'force';
|
|
402
|
+
reason: string;
|
|
390
403
|
}): Promise<{
|
|
391
404
|
mode: PrWorkflowMode;
|
|
392
405
|
prHeadSha?: string;
|
|
@@ -528,6 +541,7 @@ export declare const _test_exports: {
|
|
|
528
541
|
openCheckoutLock: typeof openCheckoutLockFile;
|
|
529
542
|
removeCheckoutLock: typeof removeCheckoutLockFile;
|
|
530
543
|
checkoutMutationActionTimeoutMs: number;
|
|
544
|
+
classifyPrWorkflowGitStateAsync: typeof classifyPrWorkflowGitState;
|
|
531
545
|
resolveCurrentGitHead: typeof resolveCurrentGitHead;
|
|
532
546
|
resolveCurrentGitHeadAsync: typeof resolveCurrentGitHeadAsync;
|
|
533
547
|
resolveCurrentUpstreamPushTarget: typeof resolveCurrentUpstreamPushTarget;
|
|
@@ -788,10 +802,10 @@ declare function analyzePrReviewBatchRecordIntegrity(args: {
|
|
|
788
802
|
expectedPrHeadSha?: string;
|
|
789
803
|
}): BatchRecordIntegrityAnalysis[];
|
|
790
804
|
/**
|
|
791
|
-
* Validate a just-collected base
|
|
792
|
-
* ledger publishes it as completed. The caller supplies the
|
|
793
|
-
* and
|
|
794
|
-
* accept stale terminal state or a different output reference.
|
|
805
|
+
* Validate a just-collected base, micro, or council discovery result before the
|
|
806
|
+
* delegation ledger publishes it as completed. The caller supplies the
|
|
807
|
+
* prospective result and exact stored artifact, so this pure validator cannot
|
|
808
|
+
* accidentally accept stale terminal state or a different output reference.
|
|
795
809
|
*/
|
|
796
810
|
export declare function validatePrReviewDiscoveryLaneCompletion(input: PrReviewDiscoveryLaneValidationInput): PrReviewLaneValidationResult;
|
|
797
811
|
/** Require at least one semantically valid discovery row or CLEAN attestation. */
|