opencode-swarm 6.67.0 → 6.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +363 -6
- package/dist/commands/brainstorm.d.ts +13 -0
- package/dist/commands/brainstorm.test.d.ts +1 -0
- package/dist/commands/doctor.d.ts +7 -0
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/qa-gates.d.ts +15 -0
- package/dist/commands/qa-gates.test.d.ts +1 -0
- package/dist/commands/registry.d.ts +12 -0
- package/dist/db/global-db.d.ts +22 -0
- package/dist/db/global-db.test.d.ts +7 -0
- package/dist/db/index.d.ts +13 -0
- package/dist/db/project-db.d.ts +40 -0
- package/dist/db/project-db.test.d.ts +4 -0
- package/dist/db/qa-gate-profile.d.ts +89 -0
- package/dist/db/qa-gate-profile.test.d.ts +4 -0
- package/dist/index.js +709 -97
- package/dist/state.d.ts +7 -0
- package/dist/tools/get-approved-plan.d.ts +4 -0
- package/dist/tools/get-qa-gate-profile.d.ts +27 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/set-qa-gates.d.ts +37 -0
- package/dist/tools/tool-names.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service layer for the `qa_gate_profile` table in the per-project database.
|
|
3
|
+
*
|
|
4
|
+
* A QA gate profile is keyed by plan_id and captures which QA gates are
|
|
5
|
+
* enabled for that plan. Profiles are locked after critic approval; once
|
|
6
|
+
* locked, row updates are rejected by a SQLite trigger and by this service.
|
|
7
|
+
* Sessions can only ratchet gates tighter (enable more), never disable them.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* QA gate flags. All seven gates are tracked explicitly.
|
|
11
|
+
*/
|
|
12
|
+
export interface QaGates {
|
|
13
|
+
reviewer: boolean;
|
|
14
|
+
test_engineer: boolean;
|
|
15
|
+
council_mode: boolean;
|
|
16
|
+
sme_enabled: boolean;
|
|
17
|
+
critic_pre_plan: boolean;
|
|
18
|
+
hallucination_guard: boolean;
|
|
19
|
+
sast_enabled: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Default QA gate configuration for newly-created profiles.
|
|
23
|
+
*/
|
|
24
|
+
export declare const DEFAULT_QA_GATES: QaGates;
|
|
25
|
+
/**
|
|
26
|
+
* Row-level representation of a persisted QA gate profile.
|
|
27
|
+
*/
|
|
28
|
+
export interface QaGateProfile {
|
|
29
|
+
id: number;
|
|
30
|
+
plan_id: string;
|
|
31
|
+
created_at: string;
|
|
32
|
+
project_type: string | null;
|
|
33
|
+
gates: QaGates;
|
|
34
|
+
locked_at: string | null;
|
|
35
|
+
locked_by_snapshot_seq: number | null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Fetch the profile for `planId` or return null if none exists.
|
|
39
|
+
*
|
|
40
|
+
* Read-only: if `.swarm/swarm.db` does not exist yet, returns null
|
|
41
|
+
* without creating the DB file or running migrations. This keeps callers
|
|
42
|
+
* on read-only paths (`get_approved_plan`, `get_qa_gate_profile`, the
|
|
43
|
+
* `qa-gates show` command) from silently mutating the workspace just by
|
|
44
|
+
* looking for a profile. Write paths (`getOrCreateProfile`, `setGates`,
|
|
45
|
+
* `lockProfile`) continue to initialize the DB on demand.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getProfile(directory: string, planId: string): QaGateProfile | null;
|
|
48
|
+
/**
|
|
49
|
+
* Return the existing profile for `planId`, or create a new one seeded with
|
|
50
|
+
* `DEFAULT_QA_GATES` if none exists. Tolerates races on the UNIQUE index.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getOrCreateProfile(directory: string, planId: string, projectType?: string): QaGateProfile;
|
|
53
|
+
/**
|
|
54
|
+
* Update gates for `planId`. Gates can only be ratcheted tighter —
|
|
55
|
+
* attempting to disable a currently-enabled gate throws. Throws if the
|
|
56
|
+
* profile is locked.
|
|
57
|
+
*/
|
|
58
|
+
export declare function setGates(directory: string, planId: string, gates: Partial<QaGates>): QaGateProfile;
|
|
59
|
+
/**
|
|
60
|
+
* Lock the profile for `planId`, recording the snapshot seq that anchors it.
|
|
61
|
+
* Idempotent: locking an already-locked profile returns it unchanged.
|
|
62
|
+
*/
|
|
63
|
+
export declare function lockProfile(directory: string, planId: string, snapshotSeq: number): QaGateProfile;
|
|
64
|
+
/**
|
|
65
|
+
* Compute a SHA-256 hex digest over the stable identity of a profile.
|
|
66
|
+
* Used by `get_approved_plan` for drift detection.
|
|
67
|
+
*/
|
|
68
|
+
export declare function computeProfileHash(profile: QaGateProfile): string;
|
|
69
|
+
/**
|
|
70
|
+
* Merge session-level gate overrides on top of the spec-level profile.
|
|
71
|
+
* Session overrides can only ratchet gates tighter (set to true); false
|
|
72
|
+
* values in overrides are ignored.
|
|
73
|
+
*
|
|
74
|
+
* IMPORTANT — caller responsibility: this function is the *computation*
|
|
75
|
+
* of effective gates, not an enforcement point. Enforcement consumers
|
|
76
|
+
* (reviewer dispatch, SAST runner, council convene paths, etc.) must
|
|
77
|
+
* call this at their own check sites, passing the current profile from
|
|
78
|
+
* `getProfile` and the agent session's `qaGateSessionOverrides ?? {}`.
|
|
79
|
+
* Reading raw `profile.gates` directly from an enforcement site will
|
|
80
|
+
* silently ignore operator-applied session overrides. Session overrides
|
|
81
|
+
* are currently surfaced via `/swarm qa-gates show`; wiring additional
|
|
82
|
+
* enforcement consumers is tracked as follow-up work and does not affect
|
|
83
|
+
* spec-level gate correctness on the approved-plan path.
|
|
84
|
+
*
|
|
85
|
+
* Session overrides are intentionally ephemeral — they live only in
|
|
86
|
+
* in-memory `AgentSessionState.qaGateSessionOverrides` and are NOT
|
|
87
|
+
* persisted to the session snapshot. Process restart clears them.
|
|
88
|
+
*/
|
|
89
|
+
export declare function getEffectiveGates(profile: QaGateProfile, sessionOverrides: Partial<QaGates>): QaGates;
|