opencode-swarm 7.124.0 → 7.125.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/critic-gate/SKILL.md +8 -0
- package/.opencode/skills/swarm/SKILL.md +12 -8
- package/.opencode/skills/swarm-pr-feedback/SKILL.md +245 -171
- package/.opencode/skills/swarm-pr-feedback/references/bot-claim-verification.md +71 -0
- package/.opencode/skills/swarm-pr-feedback/references/operational-gotchas.md +49 -0
- package/.opencode/skills/swarm-pr-review/SKILL.md +238 -412
- package/.opencode/skills/swarm-pr-review/references/parser-dry-run.md +235 -0
- package/.opencode/skills/swarm-pr-review/references/prompt-templates.md +103 -0
- package/.opencode/skills/writing-tests/SKILL.md +4 -123
- package/.opencode/skills/writing-tests/references/mock-and-seam-inventory.md +43 -0
- package/README.md +3 -1
- package/dist/background/lane-output-store.d.ts +10 -0
- package/dist/background/pending-delegations.d.ts +3 -0
- package/dist/background/workspace-snapshot.d.ts +59 -0
- package/dist/cli/{config-doctor-53mnpeke.js → config-doctor-g3m2q646.js} +2 -2
- package/dist/cli/{curation-policy-ny033330.js → curation-policy-vgbx8530.js} +2 -2
- package/dist/cli/{curator-llm-factory-e0tjz8qq.js → curator-llm-factory-7pvqy94w.js} +15 -14
- package/dist/cli/{curator-nvn1pdq6.js → curator-xk4g1nx2.js} +15 -14
- package/dist/cli/{evidence-summary-service-9hq7n9k9.js → evidence-summary-service-v4h2w487.js} +1 -1
- package/dist/cli/{guardrail-explain-d3dd57nf.js → guardrail-explain-wfk16bpr.js} +16 -15
- package/dist/cli/{guardrail-log-3q2z9axs.js → guardrail-log-5zz9xx6z.js} +3 -3
- package/dist/cli/{hive-promoter-9gbpepgm.js → hive-promoter-njwc5rt0.js} +15 -14
- package/dist/cli/{pending-delegations-e3bcqj77.js → index-0cz1ws47.js} +4 -18
- package/dist/cli/{index-3yyr4ynk.js → index-3k8pg467.js} +1 -1
- package/dist/cli/{index-x2mmnrnx.js → index-83rwq7pb.js} +1 -1
- package/dist/cli/{index-c6crt5rs.js → index-8yvqkbw7.js} +12 -2
- package/dist/cli/{index-z0m4angq.js → index-93cq8t5b.js} +5 -5
- package/dist/cli/{index-8pz0ypxz.js → index-cz6fv84h.js} +17 -16
- package/dist/cli/{index-mkkx1a4f.js → index-dsf1yv4s.js} +1588 -891
- package/dist/cli/{index-4rzzzjtg.js → index-fs02c7tz.js} +277 -16
- package/dist/cli/{index-zjedv2bd.js → index-ghteqdy1.js} +2 -2
- package/dist/cli/{index-13d2g7k9.js → index-kvrk3h8p.js} +1 -1
- package/dist/cli/{index-eeg04r0x.js → index-kws8zn6y.js} +1 -1
- package/dist/cli/index-mg54y5gc.js +564 -0
- package/dist/cli/{index-qd77aft9.js → index-mhhmecsw.js} +2 -2
- package/dist/cli/{index-2x4maxte.js → index-mwdcvh0e.js} +4 -4
- package/dist/cli/{index-e19mxn9f.js → index-pbjenws7.js} +1 -1
- package/dist/cli/{index-wqwpzhv1.js → index-rpg8qqjs.js} +2 -2
- package/dist/cli/{index-tyg0zezw.js → index-tn3shyqj.js} +3 -3
- package/dist/cli/{index-htbjqftb.js → index-txragda9.js} +1 -1
- package/dist/cli/{index-v5ecczts.js → index-z4sc6yxc.js} +1 -1
- package/dist/cli/index.js +15 -14
- package/dist/cli/{knowledge-escalator-r1s01m3z.js → knowledge-escalator-jtyykzqc.js} +3 -3
- package/dist/cli/{knowledge-events-a9hmxvke.js → knowledge-events-qhr97sy9.js} +1 -1
- package/dist/cli/{knowledge-store-jt31br5k.js → knowledge-store-332x3pjv.js} +1 -1
- package/dist/cli/{knowledge-validator-9vrwxr3z.js → knowledge-validator-3t8tgzsz.js} +4 -4
- package/dist/cli/pending-delegations-7j8xqg5f.js +34 -0
- package/dist/cli/{scan-cursor-bkjtsawg.js → scan-cursor-q21c9k9q.js} +2 -2
- package/dist/cli/{schema-y3z416z7.js → schema-y2d7j2jk.js} +1 -1
- package/dist/cli/{skill-generator-794hyndw.js → skill-generator-3gkxx98d.js} +5 -5
- package/dist/cli/workspace-snapshot-c9pxxt9a.js +48 -0
- package/dist/commands/close.d.ts +4 -2
- package/dist/commands/registry.d.ts +1 -1
- package/dist/config/schema.d.ts +4 -0
- package/dist/evidence/documents-retention.d.ts +116 -0
- package/dist/evidence/manager.d.ts +17 -0
- package/dist/hooks/pr-workflow-gate.d.ts +211 -0
- package/dist/hooks/pr-workflow-response-gate.d.ts +23 -0
- package/dist/hooks/pr-workflow-session-resolver.d.ts +14 -0
- package/dist/index.js +563 -523
- package/dist/tools/complete-pr-workflow.d.ts +5 -0
- package/dist/tools/dispatch-lanes.d.ts +44 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/manifest.d.ts +2 -0
- package/dist/tools/run-pr-feedback-stage-a.d.ts +69 -0
- package/dist/tools/tool-metadata.d.ts +8 -0
- package/dist/tools/write-pr-review-trigger-eval.d.ts +56 -46
- package/package.json +1 -1
- package/dist/cli/index-dqh3zhhc.js +0 -133
- package/dist/cli/workspace-snapshot-eyf6gd0d.js +0 -22
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createSwarmTool } from './create-tool.js';
|
|
2
|
+
export declare function executeCompletePrWorkflow(args: unknown, directory: string, context?: {
|
|
3
|
+
sessionID?: string;
|
|
4
|
+
}): Promise<string>;
|
|
5
|
+
export declare const complete_pr_workflow: ReturnType<typeof createSwarmTool>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { resolveExactMergeBase, resolvePrWorkflowRevisionDigest } from '../background/workspace-snapshot.js';
|
|
2
3
|
import { createParallelDispatcher } from '../parallel/dispatcher/parallel-dispatcher.js';
|
|
3
4
|
import { createSwarmTool } from './create-tool.js';
|
|
4
5
|
export declare const MAX_PROMPT_CHARS = 80000;
|
|
@@ -6,12 +7,18 @@ declare const LaneSchema: z.ZodObject<{
|
|
|
6
7
|
id: z.ZodString;
|
|
7
8
|
agent: z.ZodString;
|
|
8
9
|
prompt: z.ZodString;
|
|
10
|
+
workflow_lane: z.ZodOptional<z.ZodString>;
|
|
11
|
+
feedback_item_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12
|
+
review_item_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
9
13
|
}, z.core.$strip>;
|
|
10
14
|
declare const DispatchLanesArgsSchema: z.ZodObject<{
|
|
11
15
|
lanes: z.ZodArray<z.ZodObject<{
|
|
12
16
|
id: z.ZodString;
|
|
13
17
|
agent: z.ZodString;
|
|
14
18
|
prompt: z.ZodString;
|
|
19
|
+
workflow_lane: z.ZodOptional<z.ZodString>;
|
|
20
|
+
feedback_item_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
21
|
+
review_item_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
15
22
|
}, z.core.$strip>>;
|
|
16
23
|
common_prompt: z.ZodOptional<z.ZodString>;
|
|
17
24
|
max_concurrent: z.ZodOptional<z.ZodNumber>;
|
|
@@ -22,6 +29,9 @@ declare const DispatchLanesAsyncArgsSchema: z.ZodObject<{
|
|
|
22
29
|
id: z.ZodString;
|
|
23
30
|
agent: z.ZodString;
|
|
24
31
|
prompt: z.ZodString;
|
|
32
|
+
workflow_lane: z.ZodOptional<z.ZodString>;
|
|
33
|
+
feedback_item_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
34
|
+
review_item_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
35
|
}, z.core.$strip>>;
|
|
26
36
|
common_prompt: z.ZodOptional<z.ZodString>;
|
|
27
37
|
max_concurrent: z.ZodOptional<z.ZodNumber>;
|
|
@@ -30,7 +40,15 @@ declare const DispatchLanesAsyncArgsSchema: z.ZodObject<{
|
|
|
30
40
|
batch_id: z.ZodOptional<z.ZodString>;
|
|
31
41
|
mode: z.ZodOptional<z.ZodString>;
|
|
32
42
|
pr_head_sha: z.ZodOptional<z.ZodString>;
|
|
43
|
+
base_sha: z.ZodOptional<z.ZodString>;
|
|
44
|
+
base_ref: z.ZodOptional<z.ZodString>;
|
|
33
45
|
scope: z.ZodOptional<z.ZodString>;
|
|
46
|
+
trigger_evaluation: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
47
|
+
trigger_id: z.ZodString;
|
|
48
|
+
result: z.ZodLiteral<"MATCHED">;
|
|
49
|
+
evidence: z.ZodString;
|
|
50
|
+
}, z.core.$strict>>>;
|
|
51
|
+
feedback_inventory: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
34
52
|
}, z.core.$strip>;
|
|
35
53
|
declare const CollectLaneResultsArgsSchema: z.ZodObject<{
|
|
36
54
|
batch_id: z.ZodString;
|
|
@@ -213,12 +231,16 @@ export declare const _internals: {
|
|
|
213
231
|
getSessionOps: () => SessionOps | null;
|
|
214
232
|
getGeneratedAgentNames: () => readonly string[];
|
|
215
233
|
createParallelDispatcher: typeof createParallelDispatcher;
|
|
234
|
+
resolvePrWorkflowRevisionDigest: typeof resolvePrWorkflowRevisionDigest;
|
|
235
|
+
resolveExactMergeBase: typeof resolveExactMergeBase;
|
|
216
236
|
now: () => number;
|
|
217
237
|
sleep: (ms: number) => Promise<void>;
|
|
218
238
|
};
|
|
219
239
|
export declare const _test_exports: {
|
|
220
240
|
applyCommonPrompt: typeof applyCommonPrompt;
|
|
221
241
|
applyExplorerFormatSuffix: typeof applyExplorerFormatSuffix;
|
|
242
|
+
applyPrWorkflowPromptContract: typeof applyPrWorkflowPromptContract;
|
|
243
|
+
buildReadOnlyTools: typeof buildReadOnlyTools;
|
|
222
244
|
buildLaneSessionCreateArgs: typeof buildLaneSessionCreateArgs;
|
|
223
245
|
extractAssistantTranscript: typeof extractAssistantTranscript;
|
|
224
246
|
formatError: typeof formatError;
|
|
@@ -229,6 +251,9 @@ export declare const _test_exports: {
|
|
|
229
251
|
id: z.ZodString;
|
|
230
252
|
agent: z.ZodString;
|
|
231
253
|
prompt: z.ZodString;
|
|
254
|
+
workflow_lane: z.ZodOptional<z.ZodString>;
|
|
255
|
+
feedback_item_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
256
|
+
review_item_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
232
257
|
}, z.core.$strip>>;
|
|
233
258
|
common_prompt: z.ZodOptional<z.ZodString>;
|
|
234
259
|
max_concurrent: z.ZodOptional<z.ZodNumber>;
|
|
@@ -239,6 +264,9 @@ export declare const _test_exports: {
|
|
|
239
264
|
id: z.ZodString;
|
|
240
265
|
agent: z.ZodString;
|
|
241
266
|
prompt: z.ZodString;
|
|
267
|
+
workflow_lane: z.ZodOptional<z.ZodString>;
|
|
268
|
+
feedback_item_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
269
|
+
review_item_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
242
270
|
}, z.core.$strip>>;
|
|
243
271
|
common_prompt: z.ZodOptional<z.ZodString>;
|
|
244
272
|
max_concurrent: z.ZodOptional<z.ZodNumber>;
|
|
@@ -247,7 +275,15 @@ export declare const _test_exports: {
|
|
|
247
275
|
batch_id: z.ZodOptional<z.ZodString>;
|
|
248
276
|
mode: z.ZodOptional<z.ZodString>;
|
|
249
277
|
pr_head_sha: z.ZodOptional<z.ZodString>;
|
|
278
|
+
base_sha: z.ZodOptional<z.ZodString>;
|
|
279
|
+
base_ref: z.ZodOptional<z.ZodString>;
|
|
250
280
|
scope: z.ZodOptional<z.ZodString>;
|
|
281
|
+
trigger_evaluation: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
282
|
+
trigger_id: z.ZodString;
|
|
283
|
+
result: z.ZodLiteral<"MATCHED">;
|
|
284
|
+
evidence: z.ZodString;
|
|
285
|
+
}, z.core.$strict>>>;
|
|
286
|
+
feedback_inventory: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
251
287
|
}, z.core.$strip>;
|
|
252
288
|
DEFAULT_TIMEOUT_MS: number;
|
|
253
289
|
DEFAULT_ASYNC_LAUNCH_TIMEOUT_MS: number;
|
|
@@ -280,6 +316,7 @@ declare function extractAssistantTranscript(messages: Array<{
|
|
|
280
316
|
transcriptIncomplete: boolean;
|
|
281
317
|
};
|
|
282
318
|
declare function nextCollectPollInterval(currentMs: number): number;
|
|
319
|
+
declare function buildReadOnlyTools(): ReadOnlyToolPermissions;
|
|
283
320
|
type ApplyCommonPromptResult = {
|
|
284
321
|
ok: true;
|
|
285
322
|
lanes: DispatchLaneSpec[];
|
|
@@ -299,6 +336,13 @@ type ApplyCommonPromptResult = {
|
|
|
299
336
|
*/
|
|
300
337
|
declare function applyCommonPrompt(lanes: DispatchLaneSpec[], commonPrompt: string | undefined): ApplyCommonPromptResult;
|
|
301
338
|
declare function applyExplorerFormatSuffix(lanes: DispatchLaneSpec[]): DispatchLaneSpec[];
|
|
339
|
+
declare function applyPrWorkflowPromptContract(lanes: DispatchLaneSpec[], options: {
|
|
340
|
+
mode?: string;
|
|
341
|
+
prHeadSha?: string;
|
|
342
|
+
revisionDigest?: string;
|
|
343
|
+
scope?: string;
|
|
344
|
+
callerFocus?: string;
|
|
345
|
+
}): ApplyCommonPromptResult;
|
|
302
346
|
declare function formatError(error: unknown): string;
|
|
303
347
|
declare function buildLaneSessionCreateArgs(directory: string, lane: DispatchLaneSpec, context: Pick<DispatchLanesExecutionContext, 'sessionID'>): {
|
|
304
348
|
body: {
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -86,6 +86,7 @@ export type { ClassifiedFailure, FailureClassification, FailureCluster, } from '
|
|
|
86
86
|
export { classifyAndCluster, classifyFailure, clusterFailures, } from '../test-impact/failure-classifier.js';
|
|
87
87
|
export type { FlakyTestEntry } from '../test-impact/flaky-detector.js';
|
|
88
88
|
export { computeFlakyScore, detectFlakyTests, isTestQuarantined, } from '../test-impact/flaky-detector.js';
|
|
89
|
+
export { complete_pr_workflow, executeCompletePrWorkflow, } from './complete-pr-workflow';
|
|
89
90
|
export { epic_plan_waves } from './epic-plan-waves';
|
|
90
91
|
export { epic_record_divergence } from './epic-record-divergence';
|
|
91
92
|
export { epic_decide_phase } from './epic-run-phase';
|
|
@@ -98,6 +99,7 @@ export { lean_turbo_runner_status } from './lean-turbo-runner-status';
|
|
|
98
99
|
export { lean_turbo_status } from './lean-turbo-status';
|
|
99
100
|
export { lint_spec } from './lint-spec';
|
|
100
101
|
export { mutation_test } from './mutation-test';
|
|
102
|
+
export { executeRunPrFeedbackStageA, run_pr_feedback_stage_a, } from './run-pr-feedback-stage-a';
|
|
101
103
|
export { symbols } from './symbols';
|
|
102
104
|
export { type SyntaxCheckFileResult, type SyntaxCheckInput, type SyntaxCheckResult, syntax_check, syntaxCheck, } from './syntax-check';
|
|
103
105
|
export { test_impact } from './test-impact';
|
package/dist/tools/manifest.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ export declare const TOOL_MANIFEST: {
|
|
|
42
42
|
evidence_check: () => ToolDefinition;
|
|
43
43
|
check_gate_status: () => ToolDefinition;
|
|
44
44
|
completion_verify: () => ToolDefinition;
|
|
45
|
+
complete_pr_workflow: () => ToolDefinition;
|
|
46
|
+
run_pr_feedback_stage_a: () => ToolDefinition;
|
|
45
47
|
submit_council_verdicts: () => ToolDefinition;
|
|
46
48
|
submit_phase_council_verdicts: () => ToolDefinition;
|
|
47
49
|
declare_council_criteria: () => ToolDefinition;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { readGitTextAtRevision, resolveCurrentGitHead, resolveExactMergeBase, resolveGitControlStateDigest, resolvePrWorkflowRevisionDigest } from '../background/workspace-snapshot.js';
|
|
3
|
+
import { runExternalTool } from '../utils/external-tool-runner.js';
|
|
4
|
+
import { createSwarmTool } from './create-tool.js';
|
|
5
|
+
declare const STAGE_A_CATEGORIES: readonly ["build", "typecheck", "lint", "diff-check", "reproduction"];
|
|
6
|
+
type StageACategory = (typeof STAGE_A_CATEGORIES)[number];
|
|
7
|
+
declare const OPTIONAL_STAGE_A_CATEGORIES: readonly ["build", "typecheck", "lint"];
|
|
8
|
+
type OptionalStageACategory = (typeof OPTIONAL_STAGE_A_CATEGORIES)[number];
|
|
9
|
+
interface StageAObligation {
|
|
10
|
+
id: string;
|
|
11
|
+
category: OptionalStageACategory;
|
|
12
|
+
workingDirectory: string;
|
|
13
|
+
source: string;
|
|
14
|
+
validatorContract?: {
|
|
15
|
+
path: string;
|
|
16
|
+
id: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
interface ContractBaseProvenance {
|
|
20
|
+
baseRef: string;
|
|
21
|
+
baseSha: string;
|
|
22
|
+
}
|
|
23
|
+
declare const StageACheckSchema: z.ZodObject<{
|
|
24
|
+
category: z.ZodEnum<{
|
|
25
|
+
lint: "lint";
|
|
26
|
+
build: "build";
|
|
27
|
+
typecheck: "typecheck";
|
|
28
|
+
"diff-check": "diff-check";
|
|
29
|
+
reproduction: "reproduction";
|
|
30
|
+
}>;
|
|
31
|
+
command: z.ZodArray<z.ZodString>;
|
|
32
|
+
targets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
|
+
feedback_targets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
34
|
+
feedback_item_id: z.ZodString;
|
|
35
|
+
target: z.ZodString;
|
|
36
|
+
expected_behavior: z.ZodString;
|
|
37
|
+
}, z.core.$strict>>>;
|
|
38
|
+
working_directory: z.ZodOptional<z.ZodString>;
|
|
39
|
+
obligation_id: z.ZodOptional<z.ZodString>;
|
|
40
|
+
validator_contract: z.ZodOptional<z.ZodObject<{
|
|
41
|
+
path: z.ZodString;
|
|
42
|
+
id: z.ZodString;
|
|
43
|
+
}, z.core.$strict>>;
|
|
44
|
+
timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
declare function isPlausibleStageACommand(category: StageACategory, command: readonly string[]): boolean;
|
|
47
|
+
type StageACheckInput = z.infer<typeof StageACheckSchema>;
|
|
48
|
+
declare function commandMatchesObligationSource(directory: string, obligation: StageAObligation, check: StageACheckInput, contractValidated: boolean): boolean;
|
|
49
|
+
/** Discover concrete workspace/category/source obligations from bounded local signals. */
|
|
50
|
+
declare function discoverApplicableStageAObligations(directory: string, contractBase?: ContractBaseProvenance): StageAObligation[];
|
|
51
|
+
declare function discoverApplicableStageACategories(directory: string, contractBase?: ContractBaseProvenance): OptionalStageACategory[];
|
|
52
|
+
/** Execute every mandatory repository-generic Stage A category and persist receipts. */
|
|
53
|
+
export declare function executeRunPrFeedbackStageA(args: unknown, directory: string, context?: {
|
|
54
|
+
sessionID?: string;
|
|
55
|
+
}): Promise<string>;
|
|
56
|
+
export declare const _internals: {
|
|
57
|
+
runExternalTool: typeof runExternalTool;
|
|
58
|
+
readGitTextAtRevision: typeof readGitTextAtRevision;
|
|
59
|
+
resolveExactMergeBase: typeof resolveExactMergeBase;
|
|
60
|
+
resolveCurrentGitHead: typeof resolveCurrentGitHead;
|
|
61
|
+
resolveGitControlStateDigest: typeof resolveGitControlStateDigest;
|
|
62
|
+
resolvePrWorkflowRevisionDigest: typeof resolvePrWorkflowRevisionDigest;
|
|
63
|
+
isPlausibleStageACommand: typeof isPlausibleStageACommand;
|
|
64
|
+
discoverApplicableStageACategories: typeof discoverApplicableStageACategories;
|
|
65
|
+
discoverApplicableStageAObligations: typeof discoverApplicableStageAObligations;
|
|
66
|
+
commandMatchesObligationSource: typeof commandMatchesObligationSource;
|
|
67
|
+
};
|
|
68
|
+
export declare const run_pr_feedback_stage_a: ReturnType<typeof createSwarmTool>;
|
|
69
|
+
export {};
|
|
@@ -99,6 +99,14 @@ export declare const TOOL_METADATA: {
|
|
|
99
99
|
description: string;
|
|
100
100
|
agents: ("critic_oversight" | "architect")[];
|
|
101
101
|
};
|
|
102
|
+
complete_pr_workflow: {
|
|
103
|
+
description: string;
|
|
104
|
+
agents: "architect"[];
|
|
105
|
+
};
|
|
106
|
+
run_pr_feedback_stage_a: {
|
|
107
|
+
description: string;
|
|
108
|
+
agents: "architect"[];
|
|
109
|
+
};
|
|
102
110
|
submit_council_verdicts: {
|
|
103
111
|
description: string;
|
|
104
112
|
agents: never[];
|
|
@@ -1,67 +1,75 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { resolveExactMergeBase, resolvePrWorkflowRevisionDigest } from '../background/workspace-snapshot.js';
|
|
2
3
|
import { createSwarmTool } from './create-tool';
|
|
4
|
+
export declare const _internals: {
|
|
5
|
+
resolvePrWorkflowRevisionDigest: typeof resolvePrWorkflowRevisionDigest;
|
|
6
|
+
resolveMergeBase: typeof resolveExactMergeBase;
|
|
7
|
+
};
|
|
3
8
|
/** Canonical trigger IDs and display values shared with the PR-review protocol. */
|
|
4
9
|
export declare const PR_REVIEW_TRIGGER_DEFINITIONS: readonly [{
|
|
5
|
-
readonly id: "
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
10
|
+
readonly id: "auth-identity-secrets";
|
|
11
|
+
readonly scope: "universal";
|
|
12
|
+
readonly trigger_row: "authentication, authorization, identity, sessions, permissions, secrets, cryptography";
|
|
13
|
+
readonly micro_lane: "Identity and secret boundaries";
|
|
8
14
|
}, {
|
|
9
|
-
readonly id: "
|
|
10
|
-
readonly
|
|
11
|
-
readonly
|
|
15
|
+
readonly id: "untrusted-input-boundaries";
|
|
16
|
+
readonly scope: "universal";
|
|
17
|
+
readonly trigger_row: "parsing, serialization, queries, templates/rendering, file or network input/output";
|
|
18
|
+
readonly micro_lane: "Untrusted input and sink analysis";
|
|
12
19
|
}, {
|
|
13
|
-
readonly id: "
|
|
14
|
-
readonly
|
|
15
|
-
readonly
|
|
20
|
+
readonly id: "subprocess-platform";
|
|
21
|
+
readonly scope: "universal";
|
|
22
|
+
readonly trigger_row: "subprocesses, shell commands, filesystem operations, OS/runtime-specific code";
|
|
23
|
+
readonly micro_lane: "Subprocess and platform safety";
|
|
16
24
|
}, {
|
|
17
|
-
readonly id: "
|
|
18
|
-
readonly
|
|
19
|
-
readonly
|
|
25
|
+
readonly id: "concurrency-state";
|
|
26
|
+
readonly scope: "universal";
|
|
27
|
+
readonly trigger_row: "queues, caches, retries, transactions, locks, state machines, async coordination";
|
|
28
|
+
readonly micro_lane: "Concurrency and state transitions";
|
|
20
29
|
}, {
|
|
21
|
-
readonly id: "
|
|
22
|
-
readonly
|
|
23
|
-
readonly
|
|
30
|
+
readonly id: "dependencies-build-release";
|
|
31
|
+
readonly scope: "universal";
|
|
32
|
+
readonly trigger_row: "dependency manifests, lockfiles, installers, build scripts, CI, packaging, deployment";
|
|
33
|
+
readonly micro_lane: "Dependency and delivery integrity";
|
|
24
34
|
}, {
|
|
25
|
-
readonly id: "
|
|
26
|
-
readonly
|
|
27
|
-
readonly
|
|
35
|
+
readonly id: "api-schema-migrations";
|
|
36
|
+
readonly scope: "universal";
|
|
37
|
+
readonly trigger_row: "public API, wire/schema/config/storage formats, migrations, feature flags";
|
|
38
|
+
readonly micro_lane: "Compatibility and migration safety";
|
|
28
39
|
}, {
|
|
29
|
-
readonly id: "
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
32
|
-
|
|
33
|
-
readonly id: "config-ratchet";
|
|
34
|
-
readonly trigger_row: "config, defaults, ratchet, locks, policy flags";
|
|
35
|
-
readonly micro_lane: "Config ratchet semantics";
|
|
36
|
-
}, {
|
|
37
|
-
readonly id: "url-fetch";
|
|
38
|
-
readonly trigger_row: "url, fetch, http, GitHub PR/issue parsing, package fetch";
|
|
39
|
-
readonly micro_lane: "URL sanitization and external fetch";
|
|
40
|
+
readonly id: "test-infrastructure";
|
|
41
|
+
readonly scope: "universal";
|
|
42
|
+
readonly trigger_row: "tests, mocks, fixtures, harnesses, coverage, CI matrices";
|
|
43
|
+
readonly micro_lane: "Test validity and isolation";
|
|
40
44
|
}, {
|
|
41
|
-
readonly id: "
|
|
42
|
-
readonly
|
|
43
|
-
readonly
|
|
45
|
+
readonly id: "ui-accessibility-i18n";
|
|
46
|
+
readonly scope: "universal";
|
|
47
|
+
readonly trigger_row: "user interfaces, interaction flows, rendering, accessibility, localization";
|
|
48
|
+
readonly micro_lane: "UI and human-interface quality";
|
|
44
49
|
}, {
|
|
45
|
-
readonly id: "
|
|
46
|
-
readonly
|
|
47
|
-
readonly
|
|
50
|
+
readonly id: "privacy-observability";
|
|
51
|
+
readonly scope: "universal";
|
|
52
|
+
readonly trigger_row: "telemetry, logs, analytics, traces, retention, diagnostics";
|
|
53
|
+
readonly micro_lane: "Privacy and observability safety";
|
|
48
54
|
}, {
|
|
49
|
-
readonly id: "
|
|
50
|
-
readonly
|
|
51
|
-
readonly
|
|
55
|
+
readonly id: "generated-provenance";
|
|
56
|
+
readonly scope: "universal";
|
|
57
|
+
readonly trigger_row: "generated, vendored, binary, model-produced, codegen or checked-in build artifacts";
|
|
58
|
+
readonly micro_lane: "Generated artifact provenance";
|
|
52
59
|
}, {
|
|
53
|
-
readonly id: "
|
|
54
|
-
readonly
|
|
55
|
-
readonly
|
|
60
|
+
readonly id: "unclassified-risk";
|
|
61
|
+
readonly scope: "universal";
|
|
62
|
+
readonly trigger_row: "any changed artifact or behavior not confidently classified by the rows above";
|
|
63
|
+
readonly micro_lane: "Unclassified high-risk fallback";
|
|
56
64
|
}];
|
|
57
65
|
declare const WritePrReviewTriggerEvalArgsSchema: z.ZodObject<{
|
|
58
66
|
run_id: z.ZodString;
|
|
67
|
+
pr_head_sha: z.ZodString;
|
|
68
|
+
base_sha: z.ZodOptional<z.ZodString>;
|
|
69
|
+
base_ref: z.ZodOptional<z.ZodString>;
|
|
59
70
|
rows: z.ZodArray<z.ZodObject<{
|
|
60
71
|
trigger_id: z.ZodString;
|
|
61
|
-
result: z.
|
|
62
|
-
MATCHED: "MATCHED";
|
|
63
|
-
"NO-MATCH": "NO-MATCH";
|
|
64
|
-
}>;
|
|
72
|
+
result: z.ZodLiteral<"MATCHED">;
|
|
65
73
|
evidence: z.ZodString;
|
|
66
74
|
source_batch_id: z.ZodOptional<z.ZodString>;
|
|
67
75
|
source_lane_id: z.ZodOptional<z.ZodString>;
|
|
@@ -69,6 +77,8 @@ declare const WritePrReviewTriggerEvalArgsSchema: z.ZodObject<{
|
|
|
69
77
|
}, z.core.$strict>;
|
|
70
78
|
export type WritePrReviewTriggerEvalArgs = z.infer<typeof WritePrReviewTriggerEvalArgsSchema>;
|
|
71
79
|
/** Validate and atomically persist the complete PR-review trigger evaluation. */
|
|
72
|
-
export declare function executeWritePrReviewTriggerEval(args: unknown, directory: string
|
|
80
|
+
export declare function executeWritePrReviewTriggerEval(args: unknown, directory: string, context?: {
|
|
81
|
+
sessionID?: string;
|
|
82
|
+
}): Promise<string>;
|
|
73
83
|
export declare const write_pr_review_trigger_eval: ReturnType<typeof createSwarmTool>;
|
|
74
84
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.125.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,133 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// src/background/workspace-snapshot.ts
|
|
3
|
-
import * as child_process from "child_process";
|
|
4
|
-
import { createHash } from "crypto";
|
|
5
|
-
import * as path from "path";
|
|
6
|
-
var GIT_SNAPSHOT_TIMEOUT_MS = 3000;
|
|
7
|
-
var GIT_SNAPSHOT_MAX_BUFFER = 512 * 1024;
|
|
8
|
-
function runGit(directory, args) {
|
|
9
|
-
const result = _internals.spawnSync("git", ["-C", directory, ...args], {
|
|
10
|
-
cwd: directory,
|
|
11
|
-
encoding: "utf-8",
|
|
12
|
-
timeout: GIT_SNAPSHOT_TIMEOUT_MS,
|
|
13
|
-
maxBuffer: GIT_SNAPSHOT_MAX_BUFFER,
|
|
14
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
15
|
-
});
|
|
16
|
-
if (result.error || result.status !== 0)
|
|
17
|
-
return null;
|
|
18
|
-
return typeof result.stdout === "string" ? result.stdout.trimEnd() : null;
|
|
19
|
-
}
|
|
20
|
-
function parseNulPaths(output) {
|
|
21
|
-
return output.split("\x00").filter((entry) => entry.length > 0);
|
|
22
|
-
}
|
|
23
|
-
function parsePorcelainPaths(output) {
|
|
24
|
-
const entries = parseNulPaths(output);
|
|
25
|
-
const paths = [];
|
|
26
|
-
for (let index = 0;index < entries.length; index++) {
|
|
27
|
-
const entry = entries[index];
|
|
28
|
-
if (entry.length < 4 || entry[2] !== " ")
|
|
29
|
-
return null;
|
|
30
|
-
const status = entry.slice(0, 2);
|
|
31
|
-
const changedPath = entry.slice(3);
|
|
32
|
-
if (!changedPath)
|
|
33
|
-
return null;
|
|
34
|
-
paths.push(changedPath);
|
|
35
|
-
if (status.includes("R") || status.includes("C")) {
|
|
36
|
-
const originalPath = entries[++index];
|
|
37
|
-
if (!originalPath)
|
|
38
|
-
return null;
|
|
39
|
-
paths.push(originalPath);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return [...new Set(paths)];
|
|
43
|
-
}
|
|
44
|
-
function captureWorkspaceSnapshot(directory, optionsOrScope = null, prHeadShaArg = null) {
|
|
45
|
-
const scope = typeof optionsOrScope === "object" && optionsOrScope !== null ? optionsOrScope.scope ?? null : optionsOrScope;
|
|
46
|
-
const prHeadSha = (() => {
|
|
47
|
-
if (typeof optionsOrScope !== "object" || optionsOrScope === null) {
|
|
48
|
-
return prHeadShaArg;
|
|
49
|
-
}
|
|
50
|
-
if (optionsOrScope.resolveCurrentPrHeadSha) {
|
|
51
|
-
return runGit(directory, ["rev-parse", "@{upstream}"]);
|
|
52
|
-
}
|
|
53
|
-
return optionsOrScope.prHeadSha ?? null;
|
|
54
|
-
})();
|
|
55
|
-
const gitHead = runGit(directory, ["rev-parse", "HEAD"]);
|
|
56
|
-
const porcelain = runGit(directory, [
|
|
57
|
-
"status",
|
|
58
|
-
"--porcelain=v1",
|
|
59
|
-
"-z",
|
|
60
|
-
"--untracked-files=all"
|
|
61
|
-
]);
|
|
62
|
-
const changedFiles = porcelain === null ? null : parsePorcelainPaths(porcelain);
|
|
63
|
-
return {
|
|
64
|
-
directory: path.resolve(directory),
|
|
65
|
-
gitHead,
|
|
66
|
-
dirtyHash: porcelain === null ? null : digest(porcelain),
|
|
67
|
-
changedFiles,
|
|
68
|
-
prHeadSha,
|
|
69
|
-
scope
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function changedFilesSinceSnapshot(directory, baseline) {
|
|
73
|
-
if (!baseline?.gitHead || baseline.changedFiles == null)
|
|
74
|
-
return null;
|
|
75
|
-
if (baseline.changedFiles.length > 0)
|
|
76
|
-
return null;
|
|
77
|
-
const current = captureWorkspaceSnapshot(directory);
|
|
78
|
-
if (!current.gitHead || current.changedFiles == null)
|
|
79
|
-
return null;
|
|
80
|
-
const changed = new Set(current.changedFiles);
|
|
81
|
-
if (baseline.gitHead !== current.gitHead) {
|
|
82
|
-
const committed = runGit(directory, [
|
|
83
|
-
"diff",
|
|
84
|
-
"--name-only",
|
|
85
|
-
"-z",
|
|
86
|
-
baseline.gitHead,
|
|
87
|
-
current.gitHead
|
|
88
|
-
]);
|
|
89
|
-
if (committed === null)
|
|
90
|
-
return null;
|
|
91
|
-
for (const changedPath of parseNulPaths(committed))
|
|
92
|
-
changed.add(changedPath);
|
|
93
|
-
}
|
|
94
|
-
return [...changed];
|
|
95
|
-
}
|
|
96
|
-
function workspaceSnapshotMatches(expected, current) {
|
|
97
|
-
if (!expected)
|
|
98
|
-
return { ok: true };
|
|
99
|
-
if (path.resolve(expected.directory) !== path.resolve(current.directory)) {
|
|
100
|
-
return {
|
|
101
|
-
ok: false,
|
|
102
|
-
reason: `directory changed: expected ${expected.directory}, got ${current.directory}`
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
const checks = ["gitHead", "dirtyHash", "prHeadSha"];
|
|
106
|
-
for (const key of checks) {
|
|
107
|
-
const expectedValue = expected[key];
|
|
108
|
-
if (expectedValue === null)
|
|
109
|
-
continue;
|
|
110
|
-
if (current[key] !== expectedValue) {
|
|
111
|
-
return {
|
|
112
|
-
ok: false,
|
|
113
|
-
reason: `${key} changed: expected ${expectedValue}, got ${current[key] ?? "unknown"}`
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return { ok: true };
|
|
118
|
-
}
|
|
119
|
-
var compareWorkspaceSnapshot = workspaceSnapshotMatches;
|
|
120
|
-
function compareWorkspaceSnapshots(expected, current) {
|
|
121
|
-
const result = workspaceSnapshotMatches(expected, current);
|
|
122
|
-
if (result.ok)
|
|
123
|
-
return { stale: false };
|
|
124
|
-
return { stale: true, reason: result.reason };
|
|
125
|
-
}
|
|
126
|
-
function digest(text) {
|
|
127
|
-
return createHash("sha256").update(text).digest("hex");
|
|
128
|
-
}
|
|
129
|
-
var _internals = {
|
|
130
|
-
spawnSync: child_process.spawnSync
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
export { parsePorcelainPaths, captureWorkspaceSnapshot, changedFilesSinceSnapshot, workspaceSnapshotMatches, compareWorkspaceSnapshot, compareWorkspaceSnapshots, digest, _internals };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
_internals,
|
|
4
|
-
captureWorkspaceSnapshot,
|
|
5
|
-
changedFilesSinceSnapshot,
|
|
6
|
-
compareWorkspaceSnapshot,
|
|
7
|
-
compareWorkspaceSnapshots,
|
|
8
|
-
digest,
|
|
9
|
-
parsePorcelainPaths,
|
|
10
|
-
workspaceSnapshotMatches
|
|
11
|
-
} from "./index-dqh3zhhc.js";
|
|
12
|
-
import"./index-a76rekgs.js";
|
|
13
|
-
export {
|
|
14
|
-
workspaceSnapshotMatches,
|
|
15
|
-
parsePorcelainPaths,
|
|
16
|
-
digest,
|
|
17
|
-
compareWorkspaceSnapshots,
|
|
18
|
-
compareWorkspaceSnapshot,
|
|
19
|
-
changedFilesSinceSnapshot,
|
|
20
|
-
captureWorkspaceSnapshot,
|
|
21
|
-
_internals
|
|
22
|
-
};
|