opencode-swarm 7.140.3 → 7.140.5
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/brainstorm/SKILL.md +1 -1
- package/.opencode/skills/ci-failure-batching/SKILL.md +11 -1
- package/.opencode/skills/ci-fix-monitor/SKILL.md +6 -4
- package/.opencode/skills/discover/SKILL.md +1 -1
- package/.opencode/skills/durable-session-state/SKILL.md +82 -0
- package/.opencode/skills/engineering-conventions/SKILL.md +1 -1
- package/.opencode/skills/issue-ingest/SKILL.md +13 -7
- package/.opencode/skills/issue-tracer/SKILL.md +1 -1
- package/.opencode/skills/orchestrating-subagents/SKILL.md +113 -0
- package/.opencode/skills/parallel-work-check/SKILL.md +1 -1
- package/.opencode/skills/plan/SKILL.md +40 -12
- package/.opencode/skills/swarm-ci-monitor/SKILL.md +5 -3
- package/.opencode/skills/swarm-pr-feedback/SKILL.md +30 -4
- package/.opencode/skills/writing-tests/SKILL.md +1 -1
- package/dist/agents/architect.d.ts +2 -1
- package/dist/agents/reviewer-directive-compliance.d.ts +19 -5
- package/dist/background/pending-delegations.d.ts +5 -0
- package/dist/cli/{config-doctor-fnmfd35x.js → config-doctor-5vzpq4qa.js} +3 -3
- package/dist/cli/{core-p5cyej3r.js → core-xjzdc56e.js} +2 -2
- package/dist/cli/{curation-policy-d52h4g8t.js → curation-policy-avvb56x2.js} +6 -8
- package/dist/cli/{curator-3zpdqt9r.js → curator-5nytvg7p.js} +38 -38
- package/dist/cli/curator-llm-factory-rds75zhj.js +61 -0
- package/dist/cli/{evidence-summary-service-nfdc1ht9.js → evidence-summary-service-zq4gyx6g.js} +15 -12
- package/dist/cli/gate-evidence-smn2wqft.js +51 -0
- package/dist/cli/guardrail-explain-an7jvam1.js +62 -0
- package/dist/cli/{guardrail-log-82da8y5a.js → guardrail-log-0hnd2k9v.js} +4 -4
- package/dist/cli/{hive-promoter-af5yaxvt.js → hive-promoter-qe8pqg79.js} +38 -38
- package/dist/cli/{index-qksjaxpd.js → index-01ggt2mj.js} +49 -18
- package/dist/cli/{index-j1xmren9.js → index-0r2m0vbq.js} +12 -10
- package/dist/cli/{index-pg7n141e.js → index-0rx9t9w8.js} +1 -1
- package/dist/cli/{index-brh827g0.js → index-2bg901qt.js} +73 -32
- package/dist/cli/{index-8n4c3vec.js → index-386ts4tm.js} +4 -4
- package/dist/cli/{index-898f16j9.js → index-8rp1y4ab.js} +2 -2
- package/dist/cli/{index-hfvxhk4z.js → index-912qz4y0.js} +88 -88
- package/dist/cli/index-affh1gtg.js +2554 -0
- package/dist/cli/{index-1m1ksyqt.js → index-c432knmy.js} +1 -1
- package/dist/cli/{index-jvk119ck.js → index-e0mpz2j3.js} +54 -19
- package/dist/cli/{index-ry0hgg3m.js → index-epvhf50h.js} +37 -3
- package/dist/cli/{index-95bj4kaw.js → index-ex7r16gc.js} +2 -2
- package/dist/cli/{index-7d5jseea.js → index-jm4cpp4n.js} +5 -2
- package/dist/cli/{index-n408rw7n.js → index-jqsfsqbx.js} +27 -2
- package/dist/cli/{index-7kdd75se.js → index-kb5q9v34.js} +11 -9
- package/dist/cli/{index-jfjnn408.js → index-m9xrdjn0.js} +1 -1
- package/dist/cli/{index-pj9h75cc.js → index-mm2egvdt.js} +40 -40
- package/dist/cli/{index-8bnzzv3b.js → index-nwrwy8eb.js} +70 -34
- package/dist/cli/index-nyjtzmsj.js +43 -0
- package/dist/cli/{index-h2waehqq.js → index-p8kk34am.js} +3 -3
- package/dist/cli/{index-wf35ka4z.js → index-ptn13xjn.js} +3 -3
- package/dist/cli/{index-1kyex7z2.js → index-qwm6vdyv.js} +32 -1
- package/dist/cli/{index-p9dsb0tw.js → index-qy1nq52t.js} +2 -19
- package/dist/cli/{index-b9rd29ge.js → index-s1v0wza5.js} +6 -2
- package/dist/cli/{index-yyyk63kk.js → index-t5pytnca.js} +2 -2
- package/dist/cli/index-tjqzr3jc.js +623 -0
- package/dist/cli/{index-rs1f1bh0.js → index-vh05t3w5.js} +1 -1
- package/dist/cli/{index-adyxbmt5.js → index-wkt9fj06.js} +4 -4
- package/dist/cli/{index-kbfsp07d.js → index-wrb0gykj.js} +217 -15
- package/dist/cli/{index-xz8f1n1a.js → index-z7h37d63.js} +2 -2
- package/dist/cli/{index-q1q8b85k.js → index-z90nvqj3.js} +49315 -47331
- package/dist/cli/{index-b8zgtz81.js → index-zsrtt42s.js} +34 -1
- package/dist/cli/{index-gtbmabws.js → index-ztgn70jz.js} +2 -2
- package/dist/cli/index.js +37 -37
- package/dist/cli/{knowledge-escalator-7q59skqg.js → knowledge-escalator-4pfrc902.js} +20 -8
- package/dist/cli/{knowledge-events-3nwfdpq7.js → knowledge-events-3zkfnksk.js} +19 -6
- package/dist/cli/{knowledge-link-q46k9adx.js → knowledge-link-m9p80f4r.js} +5 -5
- package/dist/cli/{knowledge-store-0d83rhh3.js → knowledge-store-dpqgvvjt.js} +6 -6
- package/dist/cli/{knowledge-validator-6mfx91a2.js → knowledge-validator-2c7w87dk.js} +8 -9
- package/dist/cli/{pending-delegations-qzrx38y9.js → pending-delegations-cxx9tezp.js} +4 -4
- package/dist/cli/{pr-subscriptions-5s59h4dd.js → pr-subscriptions-2sfnb599.js} +4 -4
- package/dist/cli/{runner-y78d7ryb.js → runner-mky3vvht.js} +6 -6
- package/dist/cli/{scan-cursor-rc8q12ss.js → scan-cursor-1z60gwrw.js} +7 -7
- package/dist/cli/{schema-n9eaxp3a.js → schema-vpnkwvez.js} +2 -2
- package/dist/cli/{scope-persistence-dr1msqxw.js → scope-persistence-p9dmprry.js} +10 -5
- package/dist/cli/{skill-generator-q7c6vadg.js → skill-generator-yx7ka1cj.js} +19 -10
- package/dist/cli/{telemetry-sc57xtb0.js → telemetry-0x6kszvk.js} +1 -1
- package/dist/cli/{worktree-collision-ownership-7a8e6gr9.js → worktree-collision-ownership-wm5pse49.js} +8 -8
- package/dist/cli/worktree-isolation-bwc6ra8e.js +102 -0
- package/dist/cli/worktree-provisioning-owner-sjh7te1h.js +22 -0
- package/dist/commands/acknowledge-spec-drift.d.ts +4 -5
- package/dist/commands/ci-simulate.d.ts +7 -3
- package/dist/commands/close.d.ts +8 -0
- package/dist/commands/registry.d.ts +2 -2
- package/dist/commands/sdd.d.ts +15 -0
- package/dist/config/bundled-skills.d.ts +1 -1
- package/dist/config/evidence-schema.d.ts +3 -3
- package/dist/config/index.d.ts +2 -2
- package/dist/config/plan-schema.d.ts +8 -0
- package/dist/config/schema.d.ts +4 -2
- package/dist/council/council-evidence-writer.d.ts +1 -1
- package/dist/gate-evidence.d.ts +117 -4
- package/dist/git/branch.d.ts +1 -1
- package/dist/hooks/delegate-ack-collector.d.ts +5 -0
- package/dist/hooks/delegation-gate.d.ts +21 -0
- package/dist/hooks/hive-promoter.d.ts +4 -4
- package/dist/hooks/issue-trace-reducer.d.ts +7 -1
- package/dist/hooks/issue-trace-state.d.ts +18 -0
- package/dist/hooks/issue-trace.d.ts +3 -1
- package/dist/hooks/knowledge-application-gate.d.ts +8 -3
- package/dist/hooks/knowledge-application.d.ts +8 -5
- package/dist/hooks/knowledge-escalator.d.ts +9 -5
- package/dist/hooks/knowledge-events.d.ts +21 -8
- package/dist/hooks/knowledge-injector.d.ts +9 -0
- package/dist/hooks/knowledge-receipt-ledger-storage.d.ts +49 -0
- package/dist/hooks/knowledge-receipt-ledger.d.ts +305 -0
- package/dist/hooks/knowledge-receipt-observability.d.ts +28 -0
- package/dist/hooks/knowledge-receipt-validator.d.ts +13 -50
- package/dist/hooks/knowledge-store.d.ts +6 -1
- package/dist/hooks/knowledge-types.d.ts +12 -0
- package/dist/hooks/phase-complete-directive-gate.d.ts +3 -1
- package/dist/hooks/phase-directives.d.ts +4 -4
- package/dist/hooks/pr-workflow-gate.d.ts +34 -1
- package/dist/hooks/promotion-evidence-store.d.ts +14 -8
- package/dist/hooks/reviewer-verdict-parser.d.ts +34 -10
- package/dist/index.js +823 -779
- package/dist/knowledge/curation-policy.d.ts +0 -2
- package/dist/observability/catalog.d.ts +5 -3
- package/dist/observability/legacy.d.ts +4 -3
- package/dist/plan/ledger.d.ts +55 -0
- package/dist/plan/manager.d.ts +9 -0
- package/dist/plan/planning-profile.d.ts +27 -0
- package/dist/services/spec-drift-recovery.d.ts +84 -0
- package/dist/session/snapshot-writer.d.ts +3 -1
- package/dist/state.d.ts +19 -17
- package/dist/summaries/schema.d.ts +2 -2
- package/dist/telemetry.d.ts +1 -1
- package/dist/tools/convene-council.d.ts +6 -6
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/manifest.d.ts +3 -0
- package/dist/tools/phase-complete.d.ts +9 -0
- package/dist/tools/rebind-pr-feedback-head.d.ts +17 -0
- package/dist/tools/record-implementation-review.d.ts +19 -0
- package/dist/tools/record-recurrence-sweep.d.ts +17 -0
- package/dist/tools/run-pr-feedback-stage-a.d.ts +8 -0
- package/dist/tools/save-plan.d.ts +8 -0
- package/dist/tools/submit-phase-council-verdicts.d.ts +6 -6
- package/dist/tools/tool-metadata.d.ts +40 -28
- package/dist/tools/update-task-status.d.ts +13 -0
- package/dist/tools/write-final-council-evidence.d.ts +6 -6
- package/dist/types/events.d.ts +29 -1
- package/dist/workflow/coder-settlement.d.ts +62 -0
- package/dist/workflow/task-repair.d.ts +30 -0
- package/dist/workflow/task-terminal.d.ts +52 -0
- package/package.json +3 -1
- package/dist/cli/curator-llm-factory-2h0xb62t.js +0 -61
- package/dist/cli/gate-evidence-46qeyfc1.js +0 -32
- package/dist/cli/guardrail-explain-yktan15c.js +0 -62
- package/dist/cli/index-d181x9zr.js +0 -71
- package/dist/cli/index-n0pja0qs.js +0 -239
- package/dist/cli/index-n8jncheh.js +0 -666
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
handleGuardrailExplain
|
|
4
|
-
} from "./index-95bj4kaw.js";
|
|
5
|
-
import"./index-q1q8b85k.js";
|
|
6
|
-
import"./index-41hkt36g.js";
|
|
7
|
-
import"./index-1m1ksyqt.js";
|
|
8
|
-
import"./index-wf35ka4z.js";
|
|
9
|
-
import"./index-xz8f1n1a.js";
|
|
10
|
-
import"./index-brh827g0.js";
|
|
11
|
-
import"./index-yyyk63kk.js";
|
|
12
|
-
import"./index-y8552snf.js";
|
|
13
|
-
import"./index-4905hd2m.js";
|
|
14
|
-
import"./index-134d35c1.js";
|
|
15
|
-
import"./index-7kdd75se.js";
|
|
16
|
-
import"./index-jvk119ck.js";
|
|
17
|
-
import"./index-gtbmabws.js";
|
|
18
|
-
import"./index-v2xrer41.js";
|
|
19
|
-
import"./index-c8s9a3zh.js";
|
|
20
|
-
import"./index-9ss2m4rs.js";
|
|
21
|
-
import"./index-jfjnn408.js";
|
|
22
|
-
import"./index-adyxbmt5.js";
|
|
23
|
-
import"./index-556ja8an.js";
|
|
24
|
-
import"./index-kbfsp07d.js";
|
|
25
|
-
import"./index-1kyex7z2.js";
|
|
26
|
-
import"./index-b8zgtz81.js";
|
|
27
|
-
import"./index-898f16j9.js";
|
|
28
|
-
import"./index-b9rd29ge.js";
|
|
29
|
-
import"./index-k46me75h.js";
|
|
30
|
-
import"./index-ee3x66a5.js";
|
|
31
|
-
import"./index-74hpm6sh.js";
|
|
32
|
-
import"./index-n0pja0qs.js";
|
|
33
|
-
import"./index-8fwhhayc.js";
|
|
34
|
-
import"./index-q1exe2b3.js";
|
|
35
|
-
import"./index-8n4c3vec.js";
|
|
36
|
-
import"./index-p9dsb0tw.js";
|
|
37
|
-
import"./index-rtry5xyf.js";
|
|
38
|
-
import"./index-qksjaxpd.js";
|
|
39
|
-
import"./index-n8jncheh.js";
|
|
40
|
-
import"./index-ae75rja9.js";
|
|
41
|
-
import"./index-rs1f1bh0.js";
|
|
42
|
-
import"./index-h2waehqq.js";
|
|
43
|
-
import"./index-ed5ykebp.js";
|
|
44
|
-
import"./index-hfvxhk4z.js";
|
|
45
|
-
import"./index-7g4c7s5r.js";
|
|
46
|
-
import"./index-4nt52yr9.js";
|
|
47
|
-
import"./index-8bnzzv3b.js";
|
|
48
|
-
import"./index-gprxjmm7.js";
|
|
49
|
-
import"./index-n832052r.js";
|
|
50
|
-
import"./index-d181x9zr.js";
|
|
51
|
-
import"./index-4rhhvd1a.js";
|
|
52
|
-
import"./index-zgwm4ryv.js";
|
|
53
|
-
import"./index-7d5jseea.js";
|
|
54
|
-
import"./index-n408rw7n.js";
|
|
55
|
-
import"./index-zjygnfay.js";
|
|
56
|
-
import"./index-bk5tah7q.js";
|
|
57
|
-
import"./index-ry0hgg3m.js";
|
|
58
|
-
import"./index-bpmtbmy9.js";
|
|
59
|
-
import"./index-a76rekgs.js";
|
|
60
|
-
export {
|
|
61
|
-
handleGuardrailExplain
|
|
62
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
exports_external,
|
|
4
|
-
init_zod
|
|
5
|
-
} from "./index-bpmtbmy9.js";
|
|
6
|
-
|
|
7
|
-
// src/config/plan-schema.ts
|
|
8
|
-
init_zod();
|
|
9
|
-
var ExecutionProfileSchema = exports_external.object({
|
|
10
|
-
parallelization_enabled: exports_external.boolean().default(false),
|
|
11
|
-
max_concurrent_tasks: exports_external.number().int().min(1).max(64).default(10),
|
|
12
|
-
council_parallel: exports_external.boolean().default(true),
|
|
13
|
-
locked: exports_external.boolean().default(false),
|
|
14
|
-
auto_proceed: exports_external.boolean().default(false),
|
|
15
|
-
commit_after_each_completed_task: exports_external.boolean().default(false)
|
|
16
|
-
});
|
|
17
|
-
var TaskStatusSchema = exports_external.enum([
|
|
18
|
-
"pending",
|
|
19
|
-
"in_progress",
|
|
20
|
-
"completed",
|
|
21
|
-
"blocked",
|
|
22
|
-
"closed"
|
|
23
|
-
]);
|
|
24
|
-
var TaskSizeSchema = exports_external.enum(["small", "medium", "large"]);
|
|
25
|
-
var PhaseStatusSchema = exports_external.enum([
|
|
26
|
-
"pending",
|
|
27
|
-
"in_progress",
|
|
28
|
-
"complete",
|
|
29
|
-
"completed",
|
|
30
|
-
"blocked",
|
|
31
|
-
"closed"
|
|
32
|
-
]);
|
|
33
|
-
var MigrationStatusSchema = exports_external.enum([
|
|
34
|
-
"native",
|
|
35
|
-
"migrated",
|
|
36
|
-
"migration_failed"
|
|
37
|
-
]);
|
|
38
|
-
var TaskSchema = exports_external.object({
|
|
39
|
-
id: exports_external.string(),
|
|
40
|
-
phase: exports_external.number().int().min(1),
|
|
41
|
-
status: TaskStatusSchema.default("pending"),
|
|
42
|
-
size: TaskSizeSchema.default("small"),
|
|
43
|
-
description: exports_external.string().min(1),
|
|
44
|
-
depends: exports_external.array(exports_external.string()).default([]),
|
|
45
|
-
acceptance: exports_external.string().optional(),
|
|
46
|
-
files_touched: exports_external.array(exports_external.string()).default([]),
|
|
47
|
-
evidence_path: exports_external.string().optional(),
|
|
48
|
-
blocked_reason: exports_external.string().optional(),
|
|
49
|
-
fr_refs: exports_external.array(exports_external.string()).optional()
|
|
50
|
-
});
|
|
51
|
-
var PhaseSchema = exports_external.object({
|
|
52
|
-
id: exports_external.number().int().min(1),
|
|
53
|
-
name: exports_external.string().min(1),
|
|
54
|
-
status: PhaseStatusSchema.default("pending"),
|
|
55
|
-
tasks: exports_external.array(TaskSchema).default([]),
|
|
56
|
-
type: exports_external.enum(["code", "non-code"]).optional(),
|
|
57
|
-
required_agents: exports_external.array(exports_external.string()).optional()
|
|
58
|
-
});
|
|
59
|
-
var PlanSchema = exports_external.object({
|
|
60
|
-
schema_version: exports_external.literal("1.0.0"),
|
|
61
|
-
title: exports_external.string().min(1),
|
|
62
|
-
swarm: exports_external.string().min(1),
|
|
63
|
-
current_phase: exports_external.number().int().min(1).optional(),
|
|
64
|
-
phases: exports_external.array(PhaseSchema).min(1),
|
|
65
|
-
migration_status: MigrationStatusSchema.optional(),
|
|
66
|
-
specMtime: exports_external.string().optional(),
|
|
67
|
-
specHash: exports_external.string().optional(),
|
|
68
|
-
execution_profile: ExecutionProfileSchema.optional()
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
export { ExecutionProfileSchema, TaskStatusSchema, TaskSizeSchema, PhaseStatusSchema, MigrationStatusSchema, TaskSchema, PhaseSchema, PlanSchema };
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
atomicWriteFile,
|
|
4
|
-
taskEvidencePath,
|
|
5
|
-
withTaskEvidenceLock
|
|
6
|
-
} from "./index-h2waehqq.js";
|
|
7
|
-
import {
|
|
8
|
-
telemetry
|
|
9
|
-
} from "./index-ry0hgg3m.js";
|
|
10
|
-
import {
|
|
11
|
-
exports_external,
|
|
12
|
-
init_zod
|
|
13
|
-
} from "./index-bpmtbmy9.js";
|
|
14
|
-
|
|
15
|
-
// src/gate-evidence.ts
|
|
16
|
-
init_zod();
|
|
17
|
-
import { mkdirSync, readFileSync, realpathSync } from "fs";
|
|
18
|
-
import * as path from "path";
|
|
19
|
-
|
|
20
|
-
// src/validation/task-id.ts
|
|
21
|
-
var STRICT_TASK_ID_PATTERN = /^\d+\.\d+(\.\d+)*$/;
|
|
22
|
-
var RETRO_TASK_ID_REGEX = /^retro-\d+$/;
|
|
23
|
-
var INTERNAL_TOOL_ID_REGEX = /^(?:sast_scan|quality_budget|syntax_check|placeholder_scan|sbom_generate|build|secretscan)$/;
|
|
24
|
-
var GENERAL_TASK_ID_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/;
|
|
25
|
-
function checkUnsafeChars(taskId) {
|
|
26
|
-
if (!taskId || taskId.length === 0) {
|
|
27
|
-
return "Invalid task ID: empty string";
|
|
28
|
-
}
|
|
29
|
-
if (/\0/.test(taskId)) {
|
|
30
|
-
return "Invalid task ID: contains null bytes";
|
|
31
|
-
}
|
|
32
|
-
for (let i = 0;i < taskId.length; i++) {
|
|
33
|
-
if (taskId.charCodeAt(i) < 32) {
|
|
34
|
-
return "Invalid task ID: contains control characters";
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (taskId.includes("..") || taskId.includes("/") || taskId.includes("\\")) {
|
|
38
|
-
return "Invalid task ID: path traversal detected";
|
|
39
|
-
}
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
function isStrictTaskId(taskId) {
|
|
43
|
-
if (!taskId)
|
|
44
|
-
return false;
|
|
45
|
-
const unsafeMsg = checkUnsafeChars(taskId);
|
|
46
|
-
if (unsafeMsg)
|
|
47
|
-
return false;
|
|
48
|
-
return STRICT_TASK_ID_PATTERN.test(taskId);
|
|
49
|
-
}
|
|
50
|
-
function assertStrictTaskId(taskId) {
|
|
51
|
-
if (!isStrictTaskId(taskId)) {
|
|
52
|
-
throw new Error(`Invalid taskId: "${taskId}". Must match N.M or N.M.P (e.g. "1.1", "1.2.3").`);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
function sanitizeTaskId(taskId) {
|
|
56
|
-
const unsafeMsg = checkUnsafeChars(taskId);
|
|
57
|
-
if (unsafeMsg) {
|
|
58
|
-
throw new Error(unsafeMsg);
|
|
59
|
-
}
|
|
60
|
-
if (STRICT_TASK_ID_PATTERN.test(taskId) || RETRO_TASK_ID_REGEX.test(taskId) || INTERNAL_TOOL_ID_REGEX.test(taskId) || GENERAL_TASK_ID_REGEX.test(taskId)) {
|
|
61
|
-
return taskId;
|
|
62
|
-
}
|
|
63
|
-
throw new Error(`Invalid task ID: must be alphanumeric (ASCII) with optional hyphens, underscores, or dots, got "${taskId}"`);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// src/gate-evidence.ts
|
|
67
|
-
var GateEvidenceSchema = exports_external.object({
|
|
68
|
-
sessionId: exports_external.string(),
|
|
69
|
-
timestamp: exports_external.string(),
|
|
70
|
-
agent: exports_external.string()
|
|
71
|
-
}).passthrough();
|
|
72
|
-
var TaskEvidenceSchema = exports_external.object({
|
|
73
|
-
taskId: exports_external.string(),
|
|
74
|
-
required_gates: exports_external.array(exports_external.string()).default([]),
|
|
75
|
-
gates: exports_external.record(exports_external.string(), GateEvidenceSchema),
|
|
76
|
-
turbo: exports_external.boolean().optional(),
|
|
77
|
-
test_engineer_exempt: exports_external.boolean().optional()
|
|
78
|
-
});
|
|
79
|
-
var DEFAULT_REQUIRED_GATES = ["reviewer", "test_engineer"];
|
|
80
|
-
function isValidTaskId(taskId) {
|
|
81
|
-
return isStrictTaskId(taskId);
|
|
82
|
-
}
|
|
83
|
-
function assertValidTaskId(taskId) {
|
|
84
|
-
assertStrictTaskId(taskId);
|
|
85
|
-
}
|
|
86
|
-
function deriveRequiredGates(agentType, context = {}) {
|
|
87
|
-
switch (agentType) {
|
|
88
|
-
case "coder":
|
|
89
|
-
return context.testEngineerExempt === true ? ["reviewer"] : ["reviewer", "test_engineer"];
|
|
90
|
-
case "docs":
|
|
91
|
-
return ["docs"];
|
|
92
|
-
case "designer":
|
|
93
|
-
return ["designer", "reviewer", "test_engineer"];
|
|
94
|
-
case "explorer":
|
|
95
|
-
return ["explorer"];
|
|
96
|
-
case "sme":
|
|
97
|
-
return ["sme"];
|
|
98
|
-
case "reviewer":
|
|
99
|
-
return ["reviewer"];
|
|
100
|
-
case "test_engineer":
|
|
101
|
-
return ["test_engineer"];
|
|
102
|
-
case "critic":
|
|
103
|
-
return ["critic"];
|
|
104
|
-
case "critic_sounding_board":
|
|
105
|
-
return ["critic_sounding_board"];
|
|
106
|
-
case "critic_drift_verifier":
|
|
107
|
-
return ["critic_drift_verifier"];
|
|
108
|
-
case "critic_hallucination_verifier":
|
|
109
|
-
return ["critic_hallucination_verifier"];
|
|
110
|
-
case "critic_architecture_supervisor":
|
|
111
|
-
return ["critic_architecture_supervisor"];
|
|
112
|
-
default:
|
|
113
|
-
return ["reviewer", "test_engineer"];
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
function expandRequiredGates(existingGates, newAgentType, context = {}) {
|
|
117
|
-
const newGates = deriveRequiredGates(newAgentType, context);
|
|
118
|
-
const combined = [...new Set([...existingGates ?? [], ...newGates])];
|
|
119
|
-
return combined.sort();
|
|
120
|
-
}
|
|
121
|
-
function getEvidenceDir(directory) {
|
|
122
|
-
const swarmDir = path.resolve(directory, ".swarm");
|
|
123
|
-
const evidenceDir = path.join(swarmDir, "evidence");
|
|
124
|
-
mkdirSync(evidenceDir, { recursive: true });
|
|
125
|
-
let resolvedSwarmDir;
|
|
126
|
-
let resolvedEvidenceDir;
|
|
127
|
-
try {
|
|
128
|
-
resolvedSwarmDir = path.normalize(realpathSync(swarmDir));
|
|
129
|
-
resolvedEvidenceDir = path.normalize(realpathSync(evidenceDir));
|
|
130
|
-
} catch (error) {
|
|
131
|
-
throw new Error(`Unable to resolve evidence directory: ${error.message}`);
|
|
132
|
-
}
|
|
133
|
-
const swarmPrefix = `${resolvedSwarmDir}${path.sep}`;
|
|
134
|
-
const withinSwarmBoundary = process.platform === "win32" ? resolvedEvidenceDir.toLowerCase().startsWith(swarmPrefix.toLowerCase()) : resolvedEvidenceDir.startsWith(swarmPrefix);
|
|
135
|
-
if (!withinSwarmBoundary) {
|
|
136
|
-
throw new Error(`Evidence path escapes .swarm boundary: ${resolvedEvidenceDir}`);
|
|
137
|
-
}
|
|
138
|
-
return resolvedEvidenceDir;
|
|
139
|
-
}
|
|
140
|
-
function getEvidencePath(directory, taskId) {
|
|
141
|
-
assertValidTaskId(taskId);
|
|
142
|
-
return taskEvidencePath(directory, taskId);
|
|
143
|
-
}
|
|
144
|
-
function readExisting(evidencePath, taskId) {
|
|
145
|
-
try {
|
|
146
|
-
const raw = readFileSync(evidencePath, "utf-8");
|
|
147
|
-
return TaskEvidenceSchema.parse(JSON.parse(raw));
|
|
148
|
-
} catch (error) {
|
|
149
|
-
if (error.code === "ENOENT")
|
|
150
|
-
return null;
|
|
151
|
-
telemetry.gateParseError(taskId, error);
|
|
152
|
-
throw error;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
async function recordGateEvidence(directory, taskId, gate, sessionId, turbo) {
|
|
156
|
-
assertValidTaskId(taskId);
|
|
157
|
-
await withTaskEvidenceLock(directory, taskId, gate, async () => {
|
|
158
|
-
const resolvedEvidenceDir = getEvidenceDir(directory);
|
|
159
|
-
const evidencePath = path.join(resolvedEvidenceDir, `${taskId}.json`);
|
|
160
|
-
let existing = null;
|
|
161
|
-
try {
|
|
162
|
-
existing = readExisting(evidencePath, taskId);
|
|
163
|
-
} catch (error) {
|
|
164
|
-
telemetry.gateParseError(taskId, error);
|
|
165
|
-
throw error;
|
|
166
|
-
}
|
|
167
|
-
const requiredGates = existing ? expandRequiredGates(existing.required_gates, gate) : deriveRequiredGates(gate);
|
|
168
|
-
const updated = {
|
|
169
|
-
taskId,
|
|
170
|
-
required_gates: requiredGates,
|
|
171
|
-
turbo: turbo === true ? true : existing?.turbo,
|
|
172
|
-
test_engineer_exempt: existing?.test_engineer_exempt,
|
|
173
|
-
gates: {
|
|
174
|
-
...existing?.gates ?? {},
|
|
175
|
-
[gate]: {
|
|
176
|
-
sessionId,
|
|
177
|
-
timestamp: new Date().toISOString(),
|
|
178
|
-
agent: gate
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
await atomicWriteFile(evidencePath, JSON.stringify(updated, null, 2));
|
|
183
|
-
});
|
|
184
|
-
telemetry.gatePassed(sessionId, gate, taskId);
|
|
185
|
-
}
|
|
186
|
-
async function recordAgentDispatch(directory, taskId, agentType, turbo, context = {}) {
|
|
187
|
-
assertValidTaskId(taskId);
|
|
188
|
-
await withTaskEvidenceLock(directory, taskId, agentType, async () => {
|
|
189
|
-
const resolvedEvidenceDir = getEvidenceDir(directory);
|
|
190
|
-
const evidencePath = path.join(resolvedEvidenceDir, `${taskId}.json`);
|
|
191
|
-
let existing = null;
|
|
192
|
-
try {
|
|
193
|
-
existing = readExisting(evidencePath, taskId);
|
|
194
|
-
} catch (error) {
|
|
195
|
-
telemetry.gateParseError(taskId, error);
|
|
196
|
-
throw error;
|
|
197
|
-
}
|
|
198
|
-
const requiredGates = existing ? expandRequiredGates(existing.required_gates, agentType, context) : deriveRequiredGates(agentType, context);
|
|
199
|
-
const updated = {
|
|
200
|
-
taskId,
|
|
201
|
-
required_gates: requiredGates,
|
|
202
|
-
turbo: turbo === true ? true : existing?.turbo,
|
|
203
|
-
test_engineer_exempt: agentType === "coder" ? context.testEngineerExempt === true && !requiredGates.includes("test_engineer") : existing?.test_engineer_exempt,
|
|
204
|
-
gates: existing?.gates ?? {}
|
|
205
|
-
};
|
|
206
|
-
await atomicWriteFile(evidencePath, JSON.stringify(updated, null, 2));
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
async function readTaskEvidence(directory, taskId) {
|
|
210
|
-
try {
|
|
211
|
-
assertValidTaskId(taskId);
|
|
212
|
-
return readExisting(getEvidencePath(directory, taskId), taskId);
|
|
213
|
-
} catch {
|
|
214
|
-
return null;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
function readTaskEvidenceRaw(directory, taskId) {
|
|
218
|
-
assertValidTaskId(taskId);
|
|
219
|
-
const evidencePath = getEvidencePath(directory, taskId);
|
|
220
|
-
try {
|
|
221
|
-
const raw = readFileSync(evidencePath, "utf-8");
|
|
222
|
-
return TaskEvidenceSchema.parse(JSON.parse(raw));
|
|
223
|
-
} catch (error) {
|
|
224
|
-
const code = error.code;
|
|
225
|
-
if (code === "ENOENT" || code === "ENAMETOOLONG")
|
|
226
|
-
return null;
|
|
227
|
-
throw error;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
async function hasPassedAllGates(directory, taskId) {
|
|
231
|
-
const evidence = await readTaskEvidence(directory, taskId);
|
|
232
|
-
if (!evidence)
|
|
233
|
-
return false;
|
|
234
|
-
if (!Array.isArray(evidence.required_gates) || evidence.required_gates.length === 0)
|
|
235
|
-
return false;
|
|
236
|
-
return evidence.required_gates.every((gate) => evidence.gates[gate] != null);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
export { sanitizeTaskId, DEFAULT_REQUIRED_GATES, isValidTaskId, deriveRequiredGates, expandRequiredGates, recordGateEvidence, recordAgentDispatch, readTaskEvidence, readTaskEvidenceRaw, hasPassedAllGates };
|