opencode-swarm 7.178.1 → 7.179.1
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/deep-dive/SKILL.md +1 -1
- package/.opencode/skills/execute/SKILL.md +9 -8
- package/.opencode/skills/running-tests/SKILL.md +40 -29
- package/.opencode/skills/swarm-plan/SKILL.md +1 -1
- package/.opencode/skills/writing-tests/SKILL.md +11 -4
- package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
- package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
- package/dist/agents/critic.d.ts +6 -6
- package/dist/agents/explorer.d.ts +1 -1
- package/dist/cli/{coder-settlement-m03dfyec.js → coder-settlement-f1nmezzv.js} +8 -8
- package/dist/cli/{config-doctor-x8b260sh.js → config-doctor-ena2803f.js} +3 -3
- package/dist/cli/{core-2d0xcyby.js → core-fcfzme3m.js} +2 -2
- package/dist/cli/{curation-policy-7am15ht9.js → curation-policy-c7mdsf7m.js} +4 -4
- package/dist/cli/{curator-llm-factory-rgdb2ee5.js → curator-llm-factory-dds2fnhj.js} +33 -33
- package/dist/cli/{curator-5kfkqzc9.js → curator-q9s5q9v4.js} +33 -33
- package/dist/cli/{dispatch-9yqqqfr6.js → dispatch-p5zjg5e6.js} +1 -1
- package/dist/cli/{evidence-summary-service-959pwbwb.js → evidence-summary-service-wtj8mkm6.js} +13 -13
- package/dist/cli/{explorer-2cv64zfj.js → explorer-m50sfrp7.js} +1 -1
- package/dist/cli/{gate-evidence-66kjx6zj.js → gate-evidence-h83yb8nd.js} +5 -5
- package/dist/cli/{guardrail-explain-rre9ntq3.js → guardrail-explain-qm5wej7v.js} +34 -34
- package/dist/cli/{guardrail-log-t0ydqz5s.js → guardrail-log-zf1htf1d.js} +7 -7
- package/dist/cli/{guardrail-reset-6gad352a.js → guardrail-reset-f2p198j3.js} +33 -33
- package/dist/cli/{hive-promoter-zgnagx67.js → hive-promoter-1mhx2jh0.js} +33 -33
- package/dist/cli/{index-xr9n0vjv.js → index-0h3cr7pn.js} +1 -1
- package/dist/cli/{index-t8dqe4ns.js → index-34bwqcea.js} +1 -1
- package/dist/cli/{index-b50qevsm.js → index-5d224akk.js} +4 -4
- package/dist/cli/{index-yew23624.js → index-6r92fw88.js} +4 -4
- package/dist/cli/{index-byfrearz.js → index-93nx95me.js} +4 -4
- package/dist/cli/{index-eq1n57tg.js → index-9fb01jk5.js} +1 -1
- package/dist/cli/{index-zv3j0v08.js → index-9s1xzvnn.js} +2 -2
- package/dist/cli/{index-whjrhatw.js → index-a11ztzs5.js} +18 -1
- package/dist/cli/{index-2e6txjp7.js → index-ajm7ebyd.js} +3 -3
- package/dist/cli/{index-x1m1nnry.js → index-aqpwm350.js} +4 -4
- package/dist/cli/{index-ksq6cqg0.js → index-b567t0cr.js} +5 -5
- package/dist/cli/{index-bb148vht.js → index-cvg402ha.js} +1 -1
- package/dist/cli/{index-r78kphsr.js → index-dz12bshh.js} +3 -3
- package/dist/cli/{index-xr3eye3f.js → index-epfjc1c1.js} +7 -7
- package/dist/cli/{index-kz9pcqn9.js → index-f2v90gfc.js} +1 -1
- package/dist/cli/{index-7n4dtzk4.js → index-g6nyk713.js} +1 -1
- package/dist/cli/{index-w1b5qqnp.js → index-h59vsbch.js} +2 -2
- package/dist/cli/{index-hnvmj9wx.js → index-hamqvzqn.js} +70 -4
- package/dist/cli/{index-wajcx84s.js → index-ky262b73.js} +2123 -762
- package/dist/cli/{index-qbs49vge.js → index-m1w40kfw.js} +1 -1
- package/dist/cli/{index-1hgqs8j8.js → index-n2wjrgcs.js} +3 -3
- package/dist/cli/{index-1zrrerev.js → index-pfg3jwe9.js} +2 -2
- package/dist/cli/{index-1qnykdaw.js → index-pn023bf9.js} +35 -35
- package/dist/cli/{index-nrfjjqm4.js → index-pskba939.js} +1 -1
- package/dist/cli/{index-6e8fpjdg.js → index-q375xdcw.js} +2 -2
- package/dist/cli/{index-pk97v7b8.js → index-qt0793qm.js} +4 -4
- package/dist/cli/{index-pyxs697r.js → index-rb9jmj30.js} +5 -5
- package/dist/cli/{index-fyfbpz4f.js → index-rdec0y3z.js} +1 -0
- package/dist/cli/{index-4e4zsj2g.js → index-sj29n50e.js} +5 -5
- package/dist/cli/{index-x54339yd.js → index-vp9pn7sv.js} +5 -5
- package/dist/cli/{index-1jcy4gc6.js → index-w4c2repz.js} +33 -33
- package/dist/cli/{index-m2n1rhgv.js → index-w872yykk.js} +1 -1
- package/dist/cli/{index-kj599831.js → index-xy7k7f3k.js} +2 -2
- package/dist/cli/{index-7kty6f59.js → index-y94vwx2q.js} +5 -5
- package/dist/cli/{index-h0kyy9rd.js → index-y98fvmb8.js} +9 -9
- package/dist/cli/{index-0pmh1kks.js → index-yfpswnjt.js} +1 -1
- package/dist/cli/{index-2pyba37z.js → index-yp25bc9n.js} +6 -6
- package/dist/cli/{index-j7w16s92.js → index-zbhvr9st.js} +2 -2
- package/dist/cli/index.js +34 -34
- package/dist/cli/{knowledge-escalator-5r6mww64.js → knowledge-escalator-z6tkgrjq.js} +11 -11
- package/dist/cli/{knowledge-events-typjw0sd.js → knowledge-events-2bgefatz.js} +9 -9
- package/dist/cli/{knowledge-link-mvykydxg.js → knowledge-link-gfz47ves.js} +3 -3
- package/dist/cli/{knowledge-store-9qcf3emn.js → knowledge-store-1fphg9sa.js} +4 -4
- package/dist/cli/{knowledge-validator-k6ydsxzy.js → knowledge-validator-723h2vck.js} +6 -6
- package/dist/cli/{mcp-tedxsgey.js → mcp-xyswgya5.js} +1 -1
- package/dist/cli/{model-preflight-kh9dwts2.js → model-preflight-61xgqwcs.js} +1 -1
- package/dist/cli/{pending-delegations-d20fnrzv.js → pending-delegations-5zm19yvv.js} +8 -8
- package/dist/cli/{pr-subscriptions-awwhg139.js → pr-subscriptions-5hm6hzv6.js} +8 -8
- package/dist/cli/{pr-workflow-gate-ke79bb9c.js → pr-workflow-gate-48rzb2bh.js} +35 -33
- package/dist/cli/{runner-y3sydwtj.js → runner-16b691ba.js} +4 -4
- package/dist/cli/{scan-cursor-16s6dp7f.js → scan-cursor-m28tddrg.js} +5 -5
- package/dist/cli/{schema-nqjp43vq.js → schema-jt9axyj6.js} +2 -2
- package/dist/cli/{scope-persistence-8z1hwdr2.js → scope-persistence-d0358pw7.js} +13 -13
- package/dist/cli/{server-x16hp9aq.js → server-d5jxcbxz.js} +33 -33
- package/dist/cli/{skill-generator-xadg43ph.js → skill-generator-qanka67x.js} +13 -13
- package/dist/cli/{snapshot-coordination-init-3yyzb2c4.js → snapshot-coordination-init-mhrq11p8.js} +33 -33
- package/dist/cli/{telemetry-c9wv2cfw.js → telemetry-qxav5cdk.js} +1 -1
- package/dist/cli/{worktree-collision-ownership-drqhmmtd.js → worktree-collision-ownership-ygdbpexh.js} +8 -8
- package/dist/cli/{worktree-isolation-aebdyb1m.js → worktree-isolation-4855f2az.js} +33 -33
- package/dist/commands/registry.d.ts +3 -3
- package/dist/db/coordination-store.d.ts +10 -0
- package/dist/hooks/pr-workflow-gate.d.ts +15 -6
- package/dist/index.js +238 -218
- package/dist/lang/backends/go.d.ts +2 -0
- package/dist/mutation/engine.d.ts +7 -0
- package/dist/mutation/equivalence.d.ts +12 -1
- package/dist/pr-review/circuit.d.ts +3 -3
- package/dist/pr-review/legacy-transcript-adapter.d.ts +7 -10
- package/dist/pr-review/persistence.d.ts +36 -0
- package/dist/retention/sweep.d.ts +4 -0
- package/dist/test-impact/analyzer.d.ts +46 -4
- package/dist/test-impact/constants.d.ts +4 -0
- package/dist/tools/mutation-test.d.ts +12 -0
- package/dist/tools/prepare-pr-workflow-checkout.d.ts +19 -0
- package/dist/tools/repo-map-action-dispositions.d.ts +23 -0
- package/dist/tools/test-runner.d.ts +45 -2
- package/package.json +1 -1
- package/dist/pr-review/guardrails.d.ts +0 -67
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* `typescript.ts` for the rationale; backend-purity test enforces.
|
|
11
11
|
*/
|
|
12
12
|
import type { LanguageBackend } from '../backend';
|
|
13
|
+
/** Avoid spending unbounded time parsing an attacker-controlled source file. */
|
|
14
|
+
export declare const MAX_IMPORT_SOURCE_BYTES: number;
|
|
13
15
|
declare function extractImports(_sourceFile: string, source: string): string[];
|
|
14
16
|
/**
|
|
15
17
|
* Build the Go backend from the registered profile.
|
|
@@ -95,8 +95,15 @@ export declare const _internals: {
|
|
|
95
95
|
* `args.executable === 'git'`) keeps working for `git`-flavored callers.
|
|
96
96
|
*/
|
|
97
97
|
resolveGitExecutable: typeof resolveGitExecutable;
|
|
98
|
+
beforeRestoreWrite: () => void;
|
|
98
99
|
};
|
|
99
100
|
export declare function executeMutation(patch: MutationPatch, testCommand: string[], testFiles: string[], workingDir: string, options?: MutationExecutionOptions): Promise<MutationResult>;
|
|
100
101
|
export declare function computeReport(results: MutationResult[], durationMs: number, budgetMs?: number): MutationReport;
|
|
102
|
+
/**
|
|
103
|
+
* Apply a unified diff's hunks to the original file text, producing the full
|
|
104
|
+
* mutated file. Returns null when the diff does not parse or does not apply
|
|
105
|
+
* cleanly to the original (context mismatch), so callers can fall back.
|
|
106
|
+
*/
|
|
107
|
+
export declare function applyUnifiedDiff(originalCode: string, patchText: string): string | null;
|
|
101
108
|
export declare function executeMutationSuite(patches: MutationPatch[], testCommand: string[], testFiles: string[], workingDir: string, budgetMs?: number, onProgress?: (completed: number, total: number, result: MutationResult) => void, sourceFiles?: Map<string, string>, options?: MutationExecutionOptions): Promise<MutationReport>;
|
|
102
109
|
export {};
|
|
@@ -18,7 +18,17 @@ export type LLMJudgeCallback = (original: string, mutated: string, context: stri
|
|
|
18
18
|
* Strips comments (single-line // and multi-line /* *\/), console.log/debugger statements,
|
|
19
19
|
* trailing whitespace, and blank lines. Returns true if the stripped versions are identical.
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Comment syntax family for a language hint (a file path or language id).
|
|
23
|
+
* The default family preserves the historical 2-argument behavior exactly:
|
|
24
|
+
* // line comments plus slash-star block comments (TS/JS/Go/PHP/Java/Kotlin/C/C++/Rust).
|
|
25
|
+
*/
|
|
26
|
+
interface CommentSyntaxFamily {
|
|
27
|
+
lineTokens: string[];
|
|
28
|
+
blockComments: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare function commentFamilyForLanguage(languageHint?: string): CommentSyntaxFamily;
|
|
31
|
+
export declare function isStaticallyEquivalent(originalCode: string, mutatedCode: string, languageHint?: string): boolean;
|
|
22
32
|
export declare const _internals: {
|
|
23
33
|
isStaticallyEquivalent: typeof isStaticallyEquivalent;
|
|
24
34
|
checkEquivalence: typeof checkEquivalence;
|
|
@@ -38,3 +48,4 @@ export declare function batchCheckEquivalence(patches: Array<{
|
|
|
38
48
|
originalCode: string;
|
|
39
49
|
mutatedCode: string;
|
|
40
50
|
}>, llmJudge?: LLMJudgeCallback): Promise<EquivalenceResult[]>;
|
|
51
|
+
export {};
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
* Issue #2385 additionally makes this module the ONLY authority that may
|
|
23
23
|
* construct or transition circuit records: policy snapshot resolution, the
|
|
24
24
|
* re-enable reset, and the rolled-back-probe transition live here (previously
|
|
25
|
-
* inline record constructions in the gate). The
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* inline record constructions in the gate). The source-tree regression tests
|
|
26
|
+
* enforce that no circuit record is built outside `src/pr-review/`; this pure
|
|
27
|
+
* state-machine module remains the production construction authority.
|
|
28
28
|
*/
|
|
29
29
|
import { z } from 'zod';
|
|
30
30
|
import type { BackgroundDelegationRecord } from '../background/pending-delegations.js';
|
|
@@ -4,12 +4,10 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This is the ONLY module allowed to convert raw transcript / artifact text
|
|
6
6
|
* into canonical PR-review data (verdict rows, per-item verdicts, feedback
|
|
7
|
-
* classifications).
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `legacy*`-prefixed aliases and the test surface exported below — never
|
|
12
|
-
* through the conversion identifiers themselves.
|
|
7
|
+
* classifications). This module is the sole owner of the transcript
|
|
8
|
+
* conversion identifiers across `src/`; the gate therefore consumes this
|
|
9
|
+
* boundary through the `legacy*`-prefixed aliases and the test surface
|
|
10
|
+
* exported below — never through the conversion identifiers themselves.
|
|
13
11
|
*
|
|
14
12
|
* Compat gating: the settlement path that accepts legacy (pre-structured-
|
|
15
13
|
* receipt) transcript text is governed by the delegation record's
|
|
@@ -252,10 +250,9 @@ export declare function feedbackArtifactTextCoversItems(text: string, itemIds: r
|
|
|
252
250
|
*/
|
|
253
251
|
export declare function readSettledFeedbackClassifications(directory: string, state: PrReviewTranscriptState): Map<string, string>;
|
|
254
252
|
/**
|
|
255
|
-
* Issue #2385 guardrail aliases:
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
* instead of the canonical names.
|
|
253
|
+
* Issue #2385 guardrail aliases: transcript-conversion identifiers are owned
|
|
254
|
+
* only by this module, so the owning gate imports these aliases instead of
|
|
255
|
+
* the canonical names.
|
|
259
256
|
*/
|
|
260
257
|
export declare const analyzeLegacyVerdictRowContract: typeof analyzePrReviewVerdictRowContract;
|
|
261
258
|
export declare const legacyArtifactHasExactPositiveVerdictRow: typeof artifactHasExactPositiveVerdictRow;
|
|
@@ -55,6 +55,10 @@ export interface PrReviewPersistenceHooks {
|
|
|
55
55
|
beforeSafeDirectoryCreate?: (parentPath: string, nextPath: string) => Promise<void>;
|
|
56
56
|
beforeAtomicTempWrite?: () => Promise<void>;
|
|
57
57
|
beforeAtomicRename?: () => Promise<void>;
|
|
58
|
+
/** Test-only interleave point immediately before terminal CAS deletion. */
|
|
59
|
+
beforeTerminalizationDelete?: () => Promise<void>;
|
|
60
|
+
/** Test-only unlink seam for partial-shadow cleanup recovery tests. */
|
|
61
|
+
removeShadowProjection?: (filePath: string) => Promise<void>;
|
|
58
62
|
}
|
|
59
63
|
export declare const defaultPersistenceHooks: PrReviewPersistenceHooks;
|
|
60
64
|
/**
|
|
@@ -94,6 +98,28 @@ export declare function readPrWorkflowGateStateFromDisk<S extends PrWorkflowPers
|
|
|
94
98
|
export declare function readPrWorkflowGateStateFileRawFromDisk<S extends PrWorkflowPersistedStateBase>(filePath: string, stateLabel: string): Promise<S | null>;
|
|
95
99
|
export declare function readPrWorkflowGateStateFileFromDisk<S extends PrWorkflowPersistedStateBase>(filePath: string, stateLabel: string): Promise<S | null>;
|
|
96
100
|
export declare function readPrWorkflowGateStateFromCoordination<S extends PrWorkflowPersistedStateBase>(directory: string, sessionID: string): Promise<S | null>;
|
|
101
|
+
export type PrWorkflowGateCoordinationRecovery<S extends PrWorkflowPersistedStateBase> = {
|
|
102
|
+
kind: 'absent';
|
|
103
|
+
} | {
|
|
104
|
+
kind: 'valid';
|
|
105
|
+
rowRevision: number;
|
|
106
|
+
generation: number;
|
|
107
|
+
state: S;
|
|
108
|
+
} | {
|
|
109
|
+
kind: 'corrupt';
|
|
110
|
+
rowRevision: number;
|
|
111
|
+
generation: number;
|
|
112
|
+
reason: string;
|
|
113
|
+
} | {
|
|
114
|
+
kind: 'invalid';
|
|
115
|
+
reason: string;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Inspect one workflow coordination row for recovery without trusting payload
|
|
119
|
+
* bytes. Only payload JSON/codec/generation failures are recoverable with a
|
|
120
|
+
* matching shadow projection. Database open/query errors intentionally escape.
|
|
121
|
+
*/
|
|
122
|
+
export declare function readPrWorkflowGateStateCoordinationForRecovery<S extends PrWorkflowPersistedStateBase>(directory: string, sessionID: string): PrWorkflowGateCoordinationRecovery<S>;
|
|
97
123
|
/** Persist one CAS-checked state replacement while the session lock is held. */
|
|
98
124
|
export declare function writeStateWhileLocked<S extends PrWorkflowPersistedStateBase>(directory: string, state: S, options?: {
|
|
99
125
|
replaceWorkflowInstanceId?: string;
|
|
@@ -103,6 +129,16 @@ export declare function deleteStateWhileLocked(directory: string, sessionID: str
|
|
|
103
129
|
expectedStateRevision?: number;
|
|
104
130
|
allowSalvagedRead?: boolean;
|
|
105
131
|
}): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Terminalize one session's gate on exact owner lifecycle deletion.
|
|
134
|
+
*
|
|
135
|
+
* This is deliberately independent of abort policy: it serializes the exact
|
|
136
|
+
* normalized session, removes that session's shadow projection before its
|
|
137
|
+
* CAS-delete, then forgets the cache entry. A missing row/projection is an
|
|
138
|
+
* idempotent successful terminal; retaining the row across partial cleanup
|
|
139
|
+
* prevents a legacy shadow from being imported as resurrected state.
|
|
140
|
+
*/
|
|
141
|
+
export declare function terminalizePrWorkflowGateForSession(directory: string, sessionID: string): Promise<void>;
|
|
106
142
|
/** A bounded checkout-mutation refusal that never permits unsafe late overlap. */
|
|
107
143
|
export declare class PrWorkflowCheckoutMutationTimeoutError extends Error {
|
|
108
144
|
readonly phase: 'queue' | 'action';
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
* - authoritative streams (plan ledger, knowledge store, council, evidence,
|
|
24
24
|
* scopes, swarm.db, telemetry) are NOT in any family and are never
|
|
25
25
|
* touched (negative test).
|
|
26
|
+
* - checkout-preparation receipts remain recovery material: the checkout
|
|
27
|
+
* family only removes old, strictly validated applied+verified receipts
|
|
28
|
+
* (and abandoned atomic-write temporary files), never a pending receipt or
|
|
29
|
+
* its stash.
|
|
26
30
|
*/
|
|
27
31
|
/** Default age horizon for keyspace families (30 days). */
|
|
28
32
|
export declare const DEFAULT_FAMILY_AGE_DAYS = 30;
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { validateProjectRoot } from '../evidence/manager.js';
|
|
2
|
+
/**
|
|
3
|
+
* Impact analysis is advisory and must never turn a caller's request into an
|
|
4
|
+
* unbounded workspace scan. These limits are deliberately larger than the
|
|
5
|
+
* 50-file execution cap: a normal repository may have more test files than a
|
|
6
|
+
* single invocation may safely execute, but a pathological repository must
|
|
7
|
+
* still fail closed before it consumes unbounded memory or CPU.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MAX_IMPACT_TEST_FILES = 4096;
|
|
10
|
+
export declare const MAX_IMPACT_TEST_FILE_BYTES: number;
|
|
11
|
+
export declare const MAX_IMPACT_GO_MOD_BYTES: number;
|
|
12
|
+
export declare const MAX_IMPACT_SCAN_BYTES: number;
|
|
13
|
+
export declare const MAX_IMPACT_WALK_ENTRIES = 100000;
|
|
14
|
+
export declare const MAX_IMPACT_SCAN_DEPTH = 32;
|
|
15
|
+
export declare const MAX_IMPACT_CACHE_BYTES: number;
|
|
16
|
+
export declare const MAX_IMPACT_MAP_SOURCES = 10000;
|
|
17
|
+
export declare const MAX_IMPACT_MAP_REFERENCES = 100000;
|
|
2
18
|
export interface TestImpactResult {
|
|
3
19
|
impactedTests: string[];
|
|
4
20
|
unrelatedTests: string[];
|
|
@@ -6,9 +22,24 @@ export interface TestImpactResult {
|
|
|
6
22
|
impactMap: Record<string, string[]>;
|
|
7
23
|
budgetExceeded?: boolean;
|
|
8
24
|
}
|
|
25
|
+
export type ImpactCacheStatus = 'fresh' | 'missing' | 'corrupt' | 'legacy' | 'stale' | 'rebuilt_missing' | 'rebuilt_corrupt' | 'rebuilt_legacy' | 'rebuilt_stale' | 'overflow' | 'overflow_unverified' | 'missing_unverified' | 'corrupt_unverified' | 'legacy_unverified' | 'fresh_unverified';
|
|
26
|
+
export interface ImpactCacheInspection {
|
|
27
|
+
status: ImpactCacheStatus;
|
|
28
|
+
cachePath: string;
|
|
29
|
+
}
|
|
30
|
+
interface TestFileIdentity {
|
|
31
|
+
path: string;
|
|
32
|
+
size: number;
|
|
33
|
+
mtimeMs: number;
|
|
34
|
+
digest: string;
|
|
35
|
+
}
|
|
9
36
|
declare function normalizePath(p: string): string;
|
|
10
|
-
declare function isCacheStale(impactMap: Record<string, string[]>, generatedAtMs: number): boolean;
|
|
37
|
+
declare function isCacheStale(impactMap: Record<string, string[]>, generatedAtMs: number, testFiles?: TestFileIdentity[], cwd?: string): boolean;
|
|
11
38
|
declare function resolveRelativeImport(fromDir: string, importPath: string): string | null;
|
|
39
|
+
declare function findGoModule(fromDir: string): {
|
|
40
|
+
moduleRoot: string;
|
|
41
|
+
modulePath: string;
|
|
42
|
+
} | null;
|
|
12
43
|
/**
|
|
13
44
|
* Test-only: clear the go-module memoization cache. Production code
|
|
14
45
|
* should never need this — the cache is per-call-graph scoped, but tests
|
|
@@ -17,7 +48,10 @@ declare function resolveRelativeImport(fromDir: string, importPath: string): str
|
|
|
17
48
|
declare function _clearGoModuleCache(): void;
|
|
18
49
|
declare function findTestFilesSync(cwd: string): string[];
|
|
19
50
|
declare function extractImports(content: string): string[];
|
|
20
|
-
declare function buildImpactMapInternal(cwd: string): Promise<Record<string, string[]>>;
|
|
51
|
+
declare function buildImpactMapInternal(cwd: string, testFilesOverride?: string[]): Promise<Record<string, string[]>>;
|
|
52
|
+
export declare function getImpactCacheStatus(cwd: string, options?: {
|
|
53
|
+
verify?: boolean;
|
|
54
|
+
}): ImpactCacheInspection;
|
|
21
55
|
export declare const _internals: {
|
|
22
56
|
validateProjectRoot: typeof validateProjectRoot;
|
|
23
57
|
normalizePath: typeof normalizePath;
|
|
@@ -25,11 +59,14 @@ export declare const _internals: {
|
|
|
25
59
|
resolveRelativeImport: typeof resolveRelativeImport;
|
|
26
60
|
findTestFilesSync: typeof findTestFilesSync;
|
|
27
61
|
extractImports: typeof extractImports;
|
|
62
|
+
findGoModule: typeof findGoModule;
|
|
28
63
|
buildImpactMapInternal: typeof buildImpactMapInternal;
|
|
29
64
|
buildImpactMap: typeof buildImpactMap;
|
|
30
65
|
loadImpactMap: typeof loadImpactMap;
|
|
66
|
+
loadImpactMapWithStatus: typeof loadImpactMapWithStatus;
|
|
31
67
|
saveImpactMap: typeof saveImpactMap;
|
|
32
68
|
analyzeImpact: typeof analyzeImpact;
|
|
69
|
+
getImpactCacheStatus: typeof getImpactCacheStatus;
|
|
33
70
|
_clearGoModuleCache: typeof _clearGoModuleCache;
|
|
34
71
|
};
|
|
35
72
|
export declare function buildImpactMap(cwd: string): Promise<Record<string, string[]>>;
|
|
@@ -38,7 +75,12 @@ export interface LoadImpactMapOptions {
|
|
|
38
75
|
* Use for estimation-only reads where slight staleness is acceptable. */
|
|
39
76
|
skipRebuild?: boolean;
|
|
40
77
|
}
|
|
78
|
+
export interface ImpactMapLoadResult {
|
|
79
|
+
map: Record<string, string[]>;
|
|
80
|
+
status: ImpactCacheStatus;
|
|
81
|
+
}
|
|
82
|
+
export declare function loadImpactMapWithStatus(cwd: string, options?: LoadImpactMapOptions): Promise<ImpactMapLoadResult>;
|
|
41
83
|
export declare function loadImpactMap(cwd: string, options?: LoadImpactMapOptions): Promise<Record<string, string[]>>;
|
|
42
|
-
declare function saveImpactMap(cwd: string, impactMap: Record<string, string[]
|
|
43
|
-
export declare function analyzeImpact(changedFiles: string[], cwd: string, budget?: number): Promise<TestImpactResult>;
|
|
84
|
+
declare function saveImpactMap(cwd: string, impactMap: Record<string, string[]>, testFiles?: string[]): Promise<void>;
|
|
85
|
+
export declare function analyzeImpact(changedFiles: string[], cwd: string, budget?: number, impactMapOverride?: Record<string, string[]>): Promise<TestImpactResult>;
|
|
44
86
|
export {};
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
+
import * as path from 'node:path';
|
|
1
2
|
import { createSwarmTool } from './create-tool';
|
|
3
|
+
declare function normalizeWorkspaceFile(value: unknown, cwd: string, requireExisting: boolean): {
|
|
4
|
+
value: string;
|
|
5
|
+
absolute: string;
|
|
6
|
+
} | {
|
|
7
|
+
error: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const _internals: {
|
|
10
|
+
pathRelative: typeof path.relative;
|
|
11
|
+
normalizeWorkspaceFile: typeof normalizeWorkspaceFile;
|
|
12
|
+
};
|
|
2
13
|
export declare const mutation_test: ReturnType<typeof createSwarmTool>;
|
|
14
|
+
export {};
|
|
@@ -1,9 +1,26 @@
|
|
|
1
|
+
import { appendCoreEventSync } from '../events/core-events.js';
|
|
1
2
|
import { classifyPrWorkflowGitState } from '../git/pr-workflow-state.js';
|
|
2
3
|
import { createSwarmTool } from './create-tool.js';
|
|
3
4
|
export interface PrWorkflowCheckoutRestoreInventoryItem {
|
|
4
5
|
stash_oid: string;
|
|
5
6
|
stash_present: boolean | null;
|
|
6
7
|
}
|
|
8
|
+
export interface PrWorkflowCheckoutReconciliationSummary {
|
|
9
|
+
/** The exact owner session whose receipt directory was inspected. */
|
|
10
|
+
sessionID: string;
|
|
11
|
+
/** Number of validated receipt files considered in this bounded pass. */
|
|
12
|
+
inspectedReceiptCount: number;
|
|
13
|
+
/** Verified receipt OIDs whose marked stash was collected and verified absent. */
|
|
14
|
+
collectedStashOids: string[];
|
|
15
|
+
/** Missing-stash receipt OIDs with bounded core-event evidence and receipt retirement. */
|
|
16
|
+
retiredMissingStashOids: string[];
|
|
17
|
+
/** Receipt/stash OIDs deliberately preserved (pending, unknown, or failed cleanup). */
|
|
18
|
+
preservedStashOids: string[];
|
|
19
|
+
/** Cleanup failures; no corresponding receipt is retired when this is non-empty. */
|
|
20
|
+
failures: string[];
|
|
21
|
+
/** True when all inspected inventory stayed within the hard bounds. */
|
|
22
|
+
bounded: boolean;
|
|
23
|
+
}
|
|
7
24
|
/**
|
|
8
25
|
* Preserve explicit dirty tracked files before the unbound PR checkout.
|
|
9
26
|
*
|
|
@@ -27,6 +44,7 @@ declare function runGit(directory: string, args: string[], options?: {
|
|
|
27
44
|
declare function readBoundedGitStdout(stream: {
|
|
28
45
|
getReader(): ReadableStreamDefaultReader<Uint8Array>;
|
|
29
46
|
}, onOverflow: () => void): Promise<string>;
|
|
47
|
+
export declare function reconcilePrWorkflowCheckoutReceipts(directory: string, rawSessionID: string): Promise<PrWorkflowCheckoutReconciliationSummary>;
|
|
30
48
|
declare function removeCheckoutRestoreReceipt(receiptPath: string): Promise<void>;
|
|
31
49
|
export declare function listPendingPrWorkflowCheckoutRestores(directory: string, sessionID: string): Promise<PrWorkflowCheckoutRestoreInventoryItem[]>;
|
|
32
50
|
/**
|
|
@@ -40,6 +58,7 @@ export declare const _internals: {
|
|
|
40
58
|
readBoundedGitStdout: typeof readBoundedGitStdout;
|
|
41
59
|
classifyGitState: typeof classifyPrWorkflowGitState;
|
|
42
60
|
removeCheckoutRestoreReceipt: typeof removeCheckoutRestoreReceipt;
|
|
61
|
+
appendCoreEventSync: typeof appendCoreEventSync;
|
|
43
62
|
};
|
|
44
63
|
export declare const prepare_pr_workflow_checkout: ReturnType<typeof createSwarmTool>;
|
|
45
64
|
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disposition registry for repo_map actions audited as unreferenced (issue #2540).
|
|
3
|
+
*
|
|
4
|
+
* Every entry in VALID_ACTIONS must be reachable from a real workflow surface
|
|
5
|
+
* (agent prompt, skill, or command) or be deliberately retired. This registry
|
|
6
|
+
* records the per-action disposition for the six audit actions from
|
|
7
|
+
* REPOGRAPH-11 (docs/audits/swarm-plugin-review-2026-09.md): each is retained
|
|
8
|
+
* and wired to the listed consumers. The controls wired by #2516
|
|
9
|
+
* (route_trace, test_pack) and the two additional contextually-unreferenced
|
|
10
|
+
* entries the ratchet surfaced (callers, retrieve) are intentionally NOT
|
|
11
|
+
* subjects here — they already had, or gained independently, their own
|
|
12
|
+
* consumers and are enforced by the VALID_ACTIONS↔consumer ratchet test
|
|
13
|
+
* (tests/unit/config/repo-map-action-consumer-ratchet.test.ts).
|
|
14
|
+
*/
|
|
15
|
+
export interface RepoMapActionDisposition {
|
|
16
|
+
/** retained = wired to real consumers; retired = removed from the advertised surface */
|
|
17
|
+
disposition: 'retained' | 'retired';
|
|
18
|
+
/** repo-relative workflow-surface files containing a repo_map-contextual reference (required when retained) */
|
|
19
|
+
consumers?: string[];
|
|
20
|
+
/** surfaces scrubbed of the action (required when retired: schema, help, prompts, inventory) */
|
|
21
|
+
removedFrom?: string[];
|
|
22
|
+
}
|
|
23
|
+
export declare const REPO_MAP_ACTION_DISPOSITIONS: Record<string, RepoMapActionDisposition>;
|
|
@@ -4,7 +4,7 @@ import { resolveLocalNodeTool } from '../build/command-resolution';
|
|
|
4
4
|
import { isCommandAvailable } from '../build/discovery';
|
|
5
5
|
import type { NativeTestTarget, TestScope } from '../lang/backend';
|
|
6
6
|
import { buildNativeTargetCommand } from '../lang/default-backend';
|
|
7
|
-
import { analyzeImpact, loadImpactMap } from '../test-impact/analyzer.js';
|
|
7
|
+
import { analyzeImpact, getImpactCacheStatus, type ImpactCacheStatus, loadImpactMap, loadImpactMapWithStatus } from '../test-impact/analyzer.js';
|
|
8
8
|
import { getAllHistory, type TestRunRecord } from '../test-impact/history-store.js';
|
|
9
9
|
import { bunSpawn } from '../utils/bun-compat';
|
|
10
10
|
export declare const MAX_OUTPUT_BYTES = 512000;
|
|
@@ -13,6 +13,9 @@ export declare const DEFAULT_TIMEOUT_MS = 60000;
|
|
|
13
13
|
export declare const MAX_TIMEOUT_MS = 300000;
|
|
14
14
|
export declare const MAX_SAFE_TEST_FILES = 50;
|
|
15
15
|
export declare const MAX_SAFE_SOURCE_FILES = 1;
|
|
16
|
+
export declare const MAX_RAW_FILE_ENTRIES = 512;
|
|
17
|
+
export declare const MAX_FILE_PATH_LENGTH = 4096;
|
|
18
|
+
export declare const MAX_GRAPH_FILE_BYTES: number;
|
|
16
19
|
/**
|
|
17
20
|
* Estimate the fan-out (number of unique test files) for given source files
|
|
18
21
|
* by reading the cached impact map without spawning a subprocess.
|
|
@@ -23,6 +26,7 @@ export declare const MAX_SAFE_SOURCE_FILES = 1;
|
|
|
23
26
|
*/
|
|
24
27
|
export declare function estimateFanOut(sourceFiles: string[], cwd: string): Promise<{
|
|
25
28
|
estimatedCount: number;
|
|
29
|
+
status: 'advisory' | 'unavailable';
|
|
26
30
|
}>;
|
|
27
31
|
export declare const SUPPORTED_FRAMEWORKS: readonly ["bun", "vitest", "jest", "mocha", "pytest", "cargo", "pester", "go-test", "maven", "gradle", "dotnet-test", "ctest", "swift-test", "dart-test", "rspec", "minitest", "pest", "phpunit", "php-artisan"];
|
|
28
32
|
export type TestFramework = (typeof SUPPORTED_FRAMEWORKS)[number] | 'none';
|
|
@@ -35,7 +39,13 @@ export interface TestRunnerArgs {
|
|
|
35
39
|
timeout_ms?: number;
|
|
36
40
|
bail?: boolean;
|
|
37
41
|
}
|
|
38
|
-
export type RegressionOutcome = 'pass' | 'skip' | 'regression' | 'scope_exceeded' | 'error';
|
|
42
|
+
export type RegressionOutcome = 'pass' | 'skip' | 'no_impacted_tests' | 'regression' | 'scope_exceeded' | 'error';
|
|
43
|
+
/** Binding cap decision reported on every discovery-scope response. */
|
|
44
|
+
export interface CapDecision {
|
|
45
|
+
decision: 'within_cap' | 'cap_exceeded';
|
|
46
|
+
resolved_test_count: number;
|
|
47
|
+
limit: number;
|
|
48
|
+
}
|
|
39
49
|
export interface TestTotals {
|
|
40
50
|
passed: number;
|
|
41
51
|
failed: number;
|
|
@@ -64,6 +74,10 @@ export interface TestSuccessResult {
|
|
|
64
74
|
testCases?: ParsedTestCaseResult[];
|
|
65
75
|
message?: string;
|
|
66
76
|
outcome?: RegressionOutcome;
|
|
77
|
+
resolution?: TestResolution;
|
|
78
|
+
resolved_test_files?: string[];
|
|
79
|
+
cap_decision?: CapDecision;
|
|
80
|
+
fallback_reason?: string;
|
|
67
81
|
}
|
|
68
82
|
export interface TestErrorResult {
|
|
69
83
|
success: false;
|
|
@@ -80,8 +94,35 @@ export interface TestErrorResult {
|
|
|
80
94
|
message?: string;
|
|
81
95
|
outcome?: RegressionOutcome;
|
|
82
96
|
attempted_scope?: 'graph';
|
|
97
|
+
resolution?: TestResolution;
|
|
98
|
+
resolved_test_files?: string[];
|
|
99
|
+
cap_decision?: CapDecision;
|
|
100
|
+
fallback_reason?: string;
|
|
83
101
|
}
|
|
84
102
|
export type TestResult = TestSuccessResult | TestErrorResult;
|
|
103
|
+
export interface TestResolution {
|
|
104
|
+
requestedScope: TestScope;
|
|
105
|
+
effectiveScope: TestScope;
|
|
106
|
+
sourceFiles: string[];
|
|
107
|
+
/**
|
|
108
|
+
* Normalized test files. Execute decisions are always capped at `cap`;
|
|
109
|
+
* scope-exceeded decisions may retain one `cap + 1` sentinel for evidence.
|
|
110
|
+
*/
|
|
111
|
+
resolvedFiles: string[];
|
|
112
|
+
cap: number;
|
|
113
|
+
decision: 'execute' | 'scope_exceeded' | 'skip';
|
|
114
|
+
/** Structured fan-out estimate; the scalar fields below are compatibility aliases. */
|
|
115
|
+
estimate: {
|
|
116
|
+
count: number;
|
|
117
|
+
status: 'advisory' | 'unavailable' | 'not_run';
|
|
118
|
+
};
|
|
119
|
+
/** Backward-compatible aliases for consumers that predate the structured estimate. */
|
|
120
|
+
estimateCount: number;
|
|
121
|
+
estimateStatus: 'advisory' | 'unavailable' | 'not_run';
|
|
122
|
+
cacheStatus?: ImpactCacheStatus;
|
|
123
|
+
fallbackReason: string | null;
|
|
124
|
+
evaluable: boolean;
|
|
125
|
+
}
|
|
85
126
|
/**
|
|
86
127
|
* Phase 3 dispatch path: detect the test framework via the
|
|
87
128
|
* `LanguageBackend` registry from `src/lang/dispatch.ts`. Currently
|
|
@@ -160,6 +201,8 @@ export declare const test_runner: ReturnType<typeof tool>;
|
|
|
160
201
|
export declare const _internals: {
|
|
161
202
|
analyzeImpact: typeof analyzeImpact;
|
|
162
203
|
loadImpactMap: typeof loadImpactMap;
|
|
204
|
+
loadImpactMapWithStatus: typeof loadImpactMapWithStatus;
|
|
205
|
+
getImpactCacheStatus: typeof getImpactCacheStatus;
|
|
163
206
|
isCommandAvailable: typeof isCommandAvailable;
|
|
164
207
|
existsSync: typeof fs.existsSync;
|
|
165
208
|
readdirSync: typeof fs.readdirSync;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.179.1",
|
|
4
4
|
"description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PR-review recurrence guardrails (issue #2385).
|
|
3
|
-
*
|
|
4
|
-
* Exported source scanners implementing the mechanical guardrails the issue
|
|
5
|
-
* requires. Each scanner is a PURE function over `{ path, content }` source
|
|
6
|
-
* maps; unit tests prove each scanner flags a synthetic violating snippet
|
|
7
|
-
* (the guardrail "biting") and then apply it over the real `src/` tree.
|
|
8
|
-
*
|
|
9
|
-
* 1. `scanObserverTerminalization` — (a) the historical wait-deadline/no-client
|
|
10
|
-
* terminalizer may never reappear by name; (b) in
|
|
11
|
-
* `src/tools/dispatch-lanes.ts`, durable delegation-transition writes are
|
|
12
|
-
* allowed only inside the sanctioned settlement functions.
|
|
13
|
-
* 2. `scanParallelCircuitRuleConstruction` — circuit-record construction may
|
|
14
|
-
* exist only under `src/pr-review/` (the inline-construction recurrence
|
|
15
|
-
* class G-1).
|
|
16
|
-
*
|
|
17
|
-
* Issue #2385 originally specified a third scanner for transcript-parsing
|
|
18
|
-
* locality (the 13 conversion symbols restricted to the legacy adapter),
|
|
19
|
-
* but its only test consumer was a synthetic-input bite demo with no
|
|
20
|
-
* production caller. The boundary is already enforced structurally
|
|
21
|
-
* (the legacy-transcript-adapter is the sole module that owns those symbols,
|
|
22
|
-
* and the two retained scanners cover the real recurrence classes). A
|
|
23
|
-
* scanner with no caller would create the appearance of a guardrail where
|
|
24
|
-
* there is none — per the issue's "no unwired functionality" bar, it was
|
|
25
|
-
* removed instead.
|
|
26
|
-
*/
|
|
27
|
-
export interface GuardrailSource {
|
|
28
|
-
path: string;
|
|
29
|
-
content: string;
|
|
30
|
-
}
|
|
31
|
-
export interface GuardrailHit {
|
|
32
|
-
path: string;
|
|
33
|
-
line: number;
|
|
34
|
-
rule: string;
|
|
35
|
-
excerpt: string;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* The historical PR-review wait-deadline terminalizer (issue #2381 deleted
|
|
39
|
-
* it). Any reappearance of these names in `src/` is the exact recurrence
|
|
40
|
-
* class the issue forbids: a collection wait budget or an unavailable host
|
|
41
|
-
* messages client must never write a terminal delegation transition.
|
|
42
|
-
*/
|
|
43
|
-
export declare const FORBIDDEN_OBSERVER_TERMINALIZER_SYMBOLS: readonly string[];
|
|
44
|
-
/**
|
|
45
|
-
* Enclosing functions in `src/tools/dispatch-lanes.ts` that are allowed to
|
|
46
|
-
* write delegation transitions. Every entry is child-evidence-driven
|
|
47
|
-
* settlement (typed terminal error, explicit caller cancellation, or the
|
|
48
|
-
* age+liveness presumed-stale backstop) — never observer-deadline evidence:
|
|
49
|
-
* - `startAsyncLanePrompt`: `running` transition after a successful launch.
|
|
50
|
-
* - `appendAsyncLaneLaunchError`: typed `error` for a failed child launch.
|
|
51
|
-
* - `collectOnce`: explicit caller `cancelled` transition.
|
|
52
|
-
* - `settleCollectedLane`: `completed`/`error` settlement from child evidence.
|
|
53
|
-
* - `sweepStaleAsyncLaneRecords`: the presumed-stale `stale` backstop.
|
|
54
|
-
* Additions must document their evidence source here.
|
|
55
|
-
*/
|
|
56
|
-
export declare const DELEGATION_WRITE_ALLOWED_FUNCTIONS: ReadonlySet<string>;
|
|
57
|
-
/**
|
|
58
|
-
* Guardrail 2. (a) flags any forbidden historical-terminalizer symbol;
|
|
59
|
-
* (b) for `src/tools/dispatch-lanes.ts`, flags delegation-transition writes
|
|
60
|
-
* inside any enclosing function outside the sanctioned allowlist. This
|
|
61
|
-
* module itself is exempt from rule (a): it DEFINES the forbidden names
|
|
62
|
-
* (the definition site is not a recurrence, same reasoning as the adapter
|
|
63
|
-
* allowlist in guardrail 1).
|
|
64
|
-
*/
|
|
65
|
-
export declare function scanObserverTerminalization(sources: readonly GuardrailSource[]): GuardrailHit[];
|
|
66
|
-
/** Guardrail 3 (issue #2385 recurrence class G-1). */
|
|
67
|
-
export declare function scanParallelCircuitRuleConstruction(sources: readonly GuardrailSource[]): GuardrailHit[];
|