opencode-swarm 7.32.0 → 7.32.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +1 -1
- package/dist/config/schema.d.ts +2 -2
- package/dist/council/council-evidence-writer.d.ts +10 -1
- package/dist/evidence/task-file.d.ts +49 -0
- package/dist/full-auto/critic-response-parser.d.ts +30 -0
- package/dist/full-auto/oversight.d.ts +2 -7
- package/dist/hooks/full-auto-intercept.d.ts +2 -7
- package/dist/index.js +1429 -1476
- package/dist/memory/schema.d.ts +3 -3
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var package_default;
|
|
|
34
34
|
var init_package = __esm(() => {
|
|
35
35
|
package_default = {
|
|
36
36
|
name: "opencode-swarm",
|
|
37
|
-
version: "7.32.
|
|
37
|
+
version: "7.32.2",
|
|
38
38
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
39
39
|
main: "dist/index.js",
|
|
40
40
|
types: "dist/index.d.ts",
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -287,8 +287,8 @@ export type ReviewPassesConfig = z.infer<typeof ReviewPassesConfigSchema>;
|
|
|
287
287
|
export declare const AdversarialDetectionConfigSchema: z.ZodObject<{
|
|
288
288
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
289
289
|
policy: z.ZodDefault<z.ZodEnum<{
|
|
290
|
-
gate: "gate";
|
|
291
290
|
ignore: "ignore";
|
|
291
|
+
gate: "gate";
|
|
292
292
|
warn: "warn";
|
|
293
293
|
}>>;
|
|
294
294
|
pairs: z.ZodDefault<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>>;
|
|
@@ -1053,8 +1053,8 @@ export declare const PluginConfigSchema: z.ZodObject<{
|
|
|
1053
1053
|
adversarial_detection: z.ZodOptional<z.ZodObject<{
|
|
1054
1054
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1055
1055
|
policy: z.ZodDefault<z.ZodEnum<{
|
|
1056
|
-
gate: "gate";
|
|
1057
1056
|
ignore: "ignore";
|
|
1057
|
+
gate: "gate";
|
|
1058
1058
|
warn: "warn";
|
|
1059
1059
|
}>>;
|
|
1060
1060
|
pairs: z.ZodDefault<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>>;
|
|
@@ -14,5 +14,14 @@
|
|
|
14
14
|
* filename; defense-in-depth regex validation rejects malformed IDs before
|
|
15
15
|
* any filesystem op.
|
|
16
16
|
*/
|
|
17
|
+
import { withTaskEvidenceLock } from '../evidence/task-file.js';
|
|
17
18
|
import type { CouncilSynthesis } from './types';
|
|
18
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Dependency-injection seam for testing. Tests can temporarily replace
|
|
21
|
+
* `withTaskEvidenceLock` to exercise error paths (e.g. EvidenceLockTimeoutError)
|
|
22
|
+
* without mock.module leakage. Restore the entry in afterEach.
|
|
23
|
+
*/
|
|
24
|
+
export declare const _internals: {
|
|
25
|
+
withTaskEvidenceLock: typeof withTaskEvidenceLock;
|
|
26
|
+
};
|
|
27
|
+
export declare function writeCouncilEvidence(workingDir: string, synthesis: CouncilSynthesis): Promise<void>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared write primitives for the flat task-scoped evidence file
|
|
3
|
+
* `.swarm/evidence/{taskId}.json`.
|
|
4
|
+
*
|
|
5
|
+
* This file is the single source of truth for *where* the flat task evidence
|
|
6
|
+
* file lives and *how* it is written safely. Multiple writers target the same
|
|
7
|
+
* `{taskId}.json` (the delegation-gate hook via `gate-evidence.ts`, and the
|
|
8
|
+
* Work-Complete council via `council-evidence-writer.ts`). They MUST coordinate
|
|
9
|
+
* through the same lock key and use the same atomic temp-file+rename write, or
|
|
10
|
+
* one writer's read-modify-write can clobber the other's (lost update) or
|
|
11
|
+
* observe a torn file.
|
|
12
|
+
*
|
|
13
|
+
* The lock is keyed by the *relative* evidence path, so every writer has to
|
|
14
|
+
* pass the identical relative path to `withEvidenceLock`. Centralizing that
|
|
15
|
+
* derivation here (`taskEvidenceRelPath`) guarantees the keys match.
|
|
16
|
+
*
|
|
17
|
+
* This module deliberately holds no schema/validation logic — each caller keeps
|
|
18
|
+
* its own taskId validation and read/merge semantics.
|
|
19
|
+
*/
|
|
20
|
+
import { renameSync, unlinkSync } from 'node:fs';
|
|
21
|
+
/**
|
|
22
|
+
* Relative path (under `.swarm/`) of the flat task evidence file.
|
|
23
|
+
* This is also the lock key — it MUST be identical across all writers to the
|
|
24
|
+
* same task file so their locks coordinate.
|
|
25
|
+
*/
|
|
26
|
+
export declare function taskEvidenceRelPath(taskId: string): string;
|
|
27
|
+
/** Absolute path of the flat task evidence file under `<directory>/.swarm/`. */
|
|
28
|
+
export declare function taskEvidencePath(directory: string, taskId: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Dependency-injection seam for testing. Tests can temporarily replace these
|
|
31
|
+
* to exercise failure paths (e.g. EPERM on renameSync) without mock.module leakage.
|
|
32
|
+
* Restore each entry in afterEach via the saved original reference.
|
|
33
|
+
*/
|
|
34
|
+
export declare const _internals: {
|
|
35
|
+
renameSync: typeof renameSync;
|
|
36
|
+
unlinkSync: typeof unlinkSync;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Atomic write: write to a unique temp file, then rename over the target.
|
|
40
|
+
* The rename is atomic on POSIX and Windows, so readers never observe a torn
|
|
41
|
+
* file. The temp file is cleaned up in `finally` (no-op once renamed away).
|
|
42
|
+
*/
|
|
43
|
+
export declare function atomicWriteFile(targetPath: string, content: string): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Acquire the exclusive lock for a task's flat evidence file, run `fn`, release.
|
|
46
|
+
* Thin wrapper over `withEvidenceLock` that fixes the lock-key convention so all
|
|
47
|
+
* writers to `{taskId}.json` serialize against each other.
|
|
48
|
+
*/
|
|
49
|
+
export declare function withTaskEvidenceLock<T>(directory: string, taskId: string, agent: string, fn: () => Promise<T>): Promise<T>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface ParsedCriticResponse {
|
|
2
|
+
verdict: string;
|
|
3
|
+
reasoning: string;
|
|
4
|
+
evidenceChecked: string[];
|
|
5
|
+
antiPatternsDetected: string[];
|
|
6
|
+
escalationNeeded: boolean;
|
|
7
|
+
rawResponse: string;
|
|
8
|
+
}
|
|
9
|
+
interface ParseCriticResponseOptions {
|
|
10
|
+
validVerdicts?: readonly string[];
|
|
11
|
+
onUnknownVerdict?: (value: string) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Parses a structured critic response into a `ParsedCriticResponse`.
|
|
15
|
+
*
|
|
16
|
+
* Expected format (one field per line, value may span multiple lines until the next field):
|
|
17
|
+
* VERDICT: <value>
|
|
18
|
+
* REASONING: <text>
|
|
19
|
+
* EVIDENCE_CHECKED: <comma-separated list or "none">
|
|
20
|
+
* ANTI_PATTERNS_DETECTED: <comma-separated list or "none">
|
|
21
|
+
* ESCALATION_NEEDED: YES | NO
|
|
22
|
+
*
|
|
23
|
+
* @param rawResponse - The raw text response from the critic agent.
|
|
24
|
+
* @param options.validVerdicts - Override the default verdict allowlist. Unknown verdicts
|
|
25
|
+
* (those not in this list) default to `NEEDS_REVISION` and trigger `onUnknownVerdict`.
|
|
26
|
+
* @param options.onUnknownVerdict - Called with the raw verdict string when it is not
|
|
27
|
+
* in `validVerdicts`. Use for logging or metrics. Does not affect parsing outcome.
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseCriticResponseFields(rawResponse: string, options?: ParseCriticResponseOptions): ParsedCriticResponse;
|
|
30
|
+
export {};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
reasoning: string;
|
|
4
|
-
evidenceChecked: string[];
|
|
5
|
-
antiPatternsDetected: string[];
|
|
6
|
-
escalationNeeded: boolean;
|
|
7
|
-
rawResponse: string;
|
|
1
|
+
import { type ParsedCriticResponse } from './critic-response-parser';
|
|
2
|
+
export interface FullAutoCriticResult extends ParsedCriticResponse {
|
|
8
3
|
}
|
|
9
4
|
export type FullAutoTriggerSource = 'text_pattern' | 'tool_action' | 'cadence' | 'subagent_return' | 'phase_boundary' | 'task_completion' | 'risk';
|
|
10
5
|
export interface FullAutoOversightEvent {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* and injects the critic's autonomous oversight response when escalation is detected.
|
|
9
9
|
*/
|
|
10
10
|
import type { PluginConfig } from '../config';
|
|
11
|
+
import { type ParsedCriticResponse } from '../full-auto/critic-response-parser';
|
|
11
12
|
interface MessageWithParts {
|
|
12
13
|
info: {
|
|
13
14
|
role: string;
|
|
@@ -24,13 +25,7 @@ interface MessageWithParts {
|
|
|
24
25
|
/**
|
|
25
26
|
* Result from critic dispatch — used to inject verdict into message stream.
|
|
26
27
|
*/
|
|
27
|
-
interface CriticDispatchResult {
|
|
28
|
-
verdict: string;
|
|
29
|
-
reasoning: string;
|
|
30
|
-
evidenceChecked: string[];
|
|
31
|
-
antiPatternsDetected: string[];
|
|
32
|
-
escalationNeeded: boolean;
|
|
33
|
-
rawResponse: string;
|
|
28
|
+
interface CriticDispatchResult extends ParsedCriticResponse {
|
|
34
29
|
}
|
|
35
30
|
/**
|
|
36
31
|
* Parses the critic's structured text response into a CriticDispatchResult.
|