opencode-swarm 7.31.0 → 7.32.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.
@@ -0,0 +1,38 @@
1
+ import { z } from 'zod';
2
+ import type { ProposeMemoryInput } from '../memory/gateway';
3
+ export declare const AgentOutputMemorySchema: z.ZodObject<{
4
+ memoryProposals: z.ZodOptional<z.ZodArray<z.ZodObject<{
5
+ operation: z.ZodEnum<{
6
+ ignore: "ignore";
7
+ add: "add";
8
+ delete: "delete";
9
+ update: "update";
10
+ merge: "merge";
11
+ supersede: "supersede";
12
+ }>;
13
+ kind: z.ZodOptional<z.ZodEnum<{
14
+ evidence: "evidence";
15
+ todo: "todo";
16
+ user_preference: "user_preference";
17
+ project_fact: "project_fact";
18
+ architecture_decision: "architecture_decision";
19
+ repo_convention: "repo_convention";
20
+ api_finding: "api_finding";
21
+ code_pattern: "code_pattern";
22
+ test_pattern: "test_pattern";
23
+ failure_pattern: "failure_pattern";
24
+ security_note: "security_note";
25
+ scratch: "scratch";
26
+ }>>;
27
+ text: z.ZodOptional<z.ZodString>;
28
+ targetMemoryId: z.ZodOptional<z.ZodString>;
29
+ relatedMemoryIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
30
+ rationale: z.ZodString;
31
+ evidenceRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
32
+ }, z.core.$strict>>>;
33
+ }, z.core.$loose>;
34
+ export interface ExtractedAgentMemoryProposals {
35
+ proposals: ProposeMemoryInput[];
36
+ error?: string;
37
+ }
38
+ export declare function extractMemoryProposalsFromAgentOutput(outputText: string): ExtractedAgentMemoryProposals;
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.31.0",
37
+ version: "7.32.1",
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",
@@ -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
- export declare function writeCouncilEvidence(workingDir: string, synthesis: CouncilSynthesis): void;
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>;