opencode-swarm 7.87.3 → 7.88.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.
Files changed (32) hide show
  1. package/.opencode/skills/brainstorm/SKILL.md +2 -1
  2. package/.opencode/skills/clarify/SKILL.md +7 -1
  3. package/.opencode/skills/clarify-spec/SKILL.md +1 -1
  4. package/.opencode/skills/issue-ingest/SKILL.md +3 -2
  5. package/.opencode/skills/plan/SKILL.md +7 -1
  6. package/.opencode/skills/specify/SKILL.md +3 -2
  7. package/.opencode/skills/swarm-pr-review/SKILL.md +304 -9
  8. package/README.md +1 -0
  9. package/dist/background/candidate-parser.d.ts +189 -0
  10. package/dist/background/candidate-sidecar-store.d.ts +56 -0
  11. package/dist/cli/{config-doctor-6h64pn8n.js → config-doctor-jzbgpbdh.js} +2 -2
  12. package/dist/cli/{guardrail-explain-2q9myk7c.js → guardrail-explain-995zavv8.js} +5 -5
  13. package/dist/cli/{guardrail-log-eegabqcp.js → guardrail-log-c7egm5km.js} +3 -3
  14. package/dist/cli/{index-q9h0wb04.js → index-0asbrmdx.js} +4 -0
  15. package/dist/cli/{index-kz1bmebr.js → index-4td9ef53.js} +523 -229
  16. package/dist/cli/{index-1cb4wxnm.js → index-819xp49y.js} +1 -1
  17. package/dist/cli/{index-5hvbw5xh.js → index-g00qm2gf.js} +1 -1
  18. package/dist/cli/{index-r3f47swm.js → index-sr7g2msm.js} +6 -6
  19. package/dist/cli/{index-amwa268r.js → index-tt5aehrb.js} +2 -2
  20. package/dist/cli/{index-5vpe6vq9.js → index-vjsr9bqt.js} +1 -1
  21. package/dist/cli/index.js +4 -4
  22. package/dist/cli/{schema-84146tvk.js → schema-vb6jkxgg.js} +1 -1
  23. package/dist/index.js +2114 -991
  24. package/dist/memory/config.d.ts +1 -0
  25. package/dist/memory/gateway.d.ts +1 -0
  26. package/dist/memory/provider-pool.d.ts +50 -0
  27. package/dist/memory/sqlite-provider.d.ts +3 -0
  28. package/dist/tools/index.d.ts +1 -0
  29. package/dist/tools/manifest.d.ts +1 -0
  30. package/dist/tools/parse-lane-candidates.d.ts +2 -0
  31. package/dist/tools/tool-metadata.d.ts +4 -0
  32. package/package.json +1 -1
@@ -0,0 +1,189 @@
1
+ import { z } from 'zod';
2
+ declare const ArtifactInputSchema: z.ZodObject<{
3
+ output_ref: z.ZodString;
4
+ batchId: z.ZodString;
5
+ laneId: z.ZodString;
6
+ agent: z.ZodString;
7
+ role: z.ZodString;
8
+ sessionId: z.ZodOptional<z.ZodString>;
9
+ parentSessionId: z.ZodOptional<z.ZodString>;
10
+ digest: z.ZodString;
11
+ text: z.ZodString;
12
+ transcriptIncomplete: z.ZodOptional<z.ZodBoolean>;
13
+ artifact_status: z.ZodEnum<{
14
+ ok: "ok";
15
+ "ref-not-found": "ref-not-found";
16
+ "artifact-corrupted": "artifact-corrupted";
17
+ }>;
18
+ source: z.ZodEnum<{
19
+ dispatch_lanes: "dispatch_lanes";
20
+ collect_lane_results: "collect_lane_results";
21
+ }>;
22
+ produced_at: z.ZodString;
23
+ }, z.core.$strict>;
24
+ declare const ParseFlagsSchema: z.ZodObject<{
25
+ accept_partial: z.ZodBoolean;
26
+ accept_degraded: z.ZodBoolean;
27
+ degraded: z.ZodBoolean;
28
+ row_format_version: z.ZodNumber;
29
+ producer: z.ZodOptional<z.ZodString>;
30
+ }, z.core.$strict>;
31
+ export type ArtifactInput = z.infer<typeof ArtifactInputSchema>;
32
+ export type ParseFlags = z.infer<typeof ParseFlagsSchema>;
33
+ /**
34
+ * The two supported pipe-delimited format families produced by lane agents.
35
+ */
36
+ export type RowFormatFamily = 'base_explorer' | 'micro_lane';
37
+ /**
38
+ * A single parsed candidate record extracted from lane text.
39
+ */
40
+ export interface CandidateRecord {
41
+ record_type: 'candidate';
42
+ row_format_family: RowFormatFamily;
43
+ row_format_version: number;
44
+ record_version: {
45
+ major: number;
46
+ minor: number;
47
+ };
48
+ source_output_ref: string;
49
+ source_batch_id: string;
50
+ source_lane_id: string;
51
+ source_agent: string;
52
+ source_digest: string;
53
+ extracted_from_partial_source: boolean;
54
+ sessionId?: string;
55
+ parentSessionId?: string;
56
+ producer?: string;
57
+ candidate_id: string;
58
+ lane: string | null;
59
+ micro_lane: string | null;
60
+ severity: string | null;
61
+ category: string | null;
62
+ file_line: string | null;
63
+ claim: string | null;
64
+ evidence_summary: string | null;
65
+ impact_context: string | null;
66
+ invariant_violated: string | null;
67
+ confidence: string | null;
68
+ }
69
+ /**
70
+ * One invocation-envelope record per parseCandidates call.
71
+ * Part of the return value but not persisted to a sidecar in this phase.
72
+ */
73
+ export interface InvocationEnvelope {
74
+ record_type: 'invocation';
75
+ source_output_ref: string;
76
+ source_batch_id: string;
77
+ source_lane_id: string;
78
+ source_agent: string;
79
+ source_digest: string;
80
+ row_format_version: number;
81
+ producer?: string;
82
+ produced_at: string;
83
+ record_version: {
84
+ major: number;
85
+ minor: number;
86
+ };
87
+ sessionId?: string;
88
+ parentSessionId?: string;
89
+ format_families_detected: string[];
90
+ candidate_count: number;
91
+ parse_errors: number;
92
+ malformed_rows: number;
93
+ }
94
+ /**
95
+ * Detail record for a required-field violation inside a data row.
96
+ */
97
+ export interface ParseErrorDetail {
98
+ row_index: number;
99
+ field: string;
100
+ message: string;
101
+ }
102
+ /**
103
+ * Warning record for a candidate_id that occurs more than once.
104
+ */
105
+ export interface DuplicateIdWarning {
106
+ candidate_id: string;
107
+ occurrences: number;
108
+ }
109
+ /**
110
+ * Aggregate diagnostics returned alongside every parse result.
111
+ */
112
+ export interface DiagnosticsSummary {
113
+ candidate_count: number;
114
+ parse_errors: number;
115
+ parse_error_details: ParseErrorDetail[];
116
+ malformed_rows: number;
117
+ duplicate_id_count: number;
118
+ duplicate_id_warnings: DuplicateIdWarning[];
119
+ degraded_source_count: number;
120
+ incomplete_source_count: number;
121
+ format_families_detected: string[];
122
+ }
123
+ /**
124
+ * Top-level return value from parseCandidates.
125
+ */
126
+ export interface ParseResult {
127
+ error?: string;
128
+ error_code?: string;
129
+ candidates: CandidateRecord[];
130
+ invocation_envelope: InvocationEnvelope;
131
+ diagnostics: DiagnosticsSummary;
132
+ }
133
+ /**
134
+ * Options for the parse-and-persist path.
135
+ */
136
+ export interface ParsePersistOptions {
137
+ /** Project root directory (OpenCode process working directory). */
138
+ projectRoot: string;
139
+ /** Override the batch digest. When omitted, SHA-256(batchId) is used. */
140
+ batchDigest?: string;
141
+ /**
142
+ * Passed through to the sidecar store's `useLockfile` option.
143
+ * When true, a proper-lockfile lock is acquired on the batch directory
144
+ * before the append; on lock failure `sidecar_write_error` is set.
145
+ * Default: false (no lock — existing append-only pattern).
146
+ */
147
+ useLockfile?: boolean;
148
+ }
149
+ /**
150
+ * ParseResult extended with an optional sidecar write error.
151
+ * When sidecar_write_error is present, the parse succeeded but the
152
+ * sidecar append failed; the caller should treat the parse as valid
153
+ * and log/report the write error separately.
154
+ */
155
+ export interface ParseResultWithSidecar extends ParseResult {
156
+ sidecar_write_error?: string;
157
+ }
158
+ /**
159
+ * Parse candidate records from structured lane-output text.
160
+ *
161
+ * This is a pure function: no filesystem writes, no store lookups, no I/O.
162
+ * The caller is responsible for store lookup, constructing the ArtifactInput,
163
+ * and setting artifact_status based on lookup outcome.
164
+ *
165
+ * @param input Structured artifact metadata and raw text.
166
+ * @param flags Caller-controlled acceptance flags and format version.
167
+ * @returns Parsed candidates, invocation envelope, and diagnostics.
168
+ */
169
+ export declare function parseCandidates(input: ArtifactInput, flags: ParseFlags): ParseResult;
170
+ /**
171
+ * Parse candidates and append the invocation envelope + candidate records
172
+ * to the sidecar JSONL file.
173
+ *
174
+ * parseCandidates remains pure (no I/O). This wrapper adds sidecar
175
+ * persistence: on success the envelope + candidates are appended to
176
+ * `.swarm/lane-results/{batchDigest}/candidates.jsonl`; on append
177
+ * failure the parse still succeeds and sidecar_write_error is populated
178
+ * (SC-023).
179
+ *
180
+ * batchDigest is derived as SHA-256(batchId) when not explicitly provided
181
+ * in options (Option A — consistent with lane-output-store.ts internals).
182
+ *
183
+ * @param input Structured artifact metadata and raw text.
184
+ * @param flags Caller-controlled acceptance flags and format version.
185
+ * @param options Persistence options (projectRoot, optional batchDigest).
186
+ * @returns Parse result with optional sidecar_write_error field.
187
+ */
188
+ export declare function parseAndPersist(input: ArtifactInput, flags: ParseFlags, options: ParsePersistOptions): ParseResultWithSidecar;
189
+ export {};
@@ -0,0 +1,56 @@
1
+ export interface SidecarStoreOptions {
2
+ /** Project root directory (the OpenCode process working directory). */
3
+ projectRoot: string;
4
+ /** Override the batch digest. When omitted, SHA-256(batchId) is used. */
5
+ batchDigest?: string;
6
+ /**
7
+ * When true, acquire a `proper-lockfile` lock on the batch directory
8
+ * before the append and release it afterwards. Default: false (no lock —
9
+ * matches the existing append-only pattern the codebase already uses).
10
+ *
11
+ * On lock acquisition failure the function throws; the caller
12
+ * (`parseAndPersist`) catches and records `sidecar_write_error`.
13
+ */
14
+ useLockfile?: boolean;
15
+ }
16
+ /**
17
+ * Sanitize a single string value for sidecar persistence.
18
+ *
19
+ * Transformations applied in order:
20
+ * 1. NUL bytes (`\x00`) → `\u0000` escape (preserves information).
21
+ * 2. ANSI escape sequences (`\x1B[...]`) → entire sequence stripped.
22
+ * Handles CSI (`ESC [ params intermediate final`), OSC (`ESC ] ... BEL/ST`),
23
+ * and two-character escape sequences.
24
+ * 3. Unicode bidi markers (U+202A–U+202E, U+2066–U+2069) → stripped.
25
+ *
26
+ * All other characters pass through unchanged.
27
+ *
28
+ * @param value - Raw string value (may contain NUL bytes, ANSI, bidi markers).
29
+ * @returns Sanitized string safe for JSONL persistence.
30
+ */
31
+ export declare function sanitizeString(value: string): string;
32
+ /**
33
+ * Append an invocation envelope followed by zero or more candidate records
34
+ * to the sidecar JSONL file for the given batch.
35
+ *
36
+ * The envelope is always the first record in the append batch (SC-015).
37
+ * Cross-skill coexistence is enabled via the `producer` field on the
38
+ * envelope (FR-019).
39
+ *
40
+ * Content sanitization (FR-021) is applied to the persisted copy: NUL bytes
41
+ * are escaped to `\u0000`, ANSI ESC bytes are stripped, and Unicode bidi
42
+ * markers are stripped. The caller's in-memory records are NOT mutated.
43
+ *
44
+ * Concurrency safety (FR-014): when `options.useLockfile` is true, a
45
+ * `proper-lockfile` lock is acquired on the batch directory before the
46
+ * append and released afterwards. Lock acquisition failures propagate as
47
+ * throws. Default behaviour (useLockfile omitted or false) is lockless
48
+ * append — the existing pattern used throughout the codebase.
49
+ *
50
+ * @param options Store configuration (projectRoot, optional batchDigest, useLockfile).
51
+ * @param batchId The batch identifier (used to derive batchDigest when not provided).
52
+ * @param envelope The invocation envelope record (validated before write).
53
+ * @param candidates Candidate records to append after the envelope (validated before write).
54
+ * @throws If schema validation fails, lock acquisition fails, or the filesystem write fails.
55
+ */
56
+ export declare function appendToSidecar(options: SidecarStoreOptions, batchId: string, envelope: unknown, candidates: unknown[]): void;
@@ -12,8 +12,8 @@ import {
12
12
  shouldRunOnStartup,
13
13
  writeBackupArtifact,
14
14
  writeDoctorArtifact
15
- } from "./index-1cb4wxnm.js";
16
- import"./index-q9h0wb04.js";
15
+ } from "./index-819xp49y.js";
16
+ import"./index-0asbrmdx.js";
17
17
  import"./index-5e4e2hvv.js";
18
18
  import"./index-p0arc26j.js";
19
19
  import"./index-zgwm4ryv.js";
@@ -1,14 +1,14 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailExplain
4
- } from "./index-amwa268r.js";
5
- import"./index-kz1bmebr.js";
6
- import"./index-5hvbw5xh.js";
4
+ } from "./index-tt5aehrb.js";
5
+ import"./index-4td9ef53.js";
6
+ import"./index-g00qm2gf.js";
7
7
  import"./index-yhsmmv2z.js";
8
8
  import"./index-32axfg6h.js";
9
9
  import"./index-e8pk68cc.js";
10
- import"./index-1cb4wxnm.js";
11
- import"./index-q9h0wb04.js";
10
+ import"./index-819xp49y.js";
11
+ import"./index-0asbrmdx.js";
12
12
  import"./index-8y7qetpg.js";
13
13
  import"./index-adz3nk9b.js";
14
14
  import"./index-v4fcn4tr.js";
@@ -1,9 +1,9 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailLog
4
- } from "./index-5vpe6vq9.js";
5
- import"./index-5hvbw5xh.js";
6
- import"./index-q9h0wb04.js";
4
+ } from "./index-vjsr9bqt.js";
5
+ import"./index-g00qm2gf.js";
6
+ import"./index-0asbrmdx.js";
7
7
  import"./index-5e4e2hvv.js";
8
8
  import"./index-p0arc26j.js";
9
9
  import"./index-zgwm4ryv.js";
@@ -187,6 +187,10 @@ var TOOL_METADATA = {
187
187
  "test_engineer"
188
188
  ]
189
189
  },
190
+ parse_lane_candidates: {
191
+ description: "Parse [CANDIDATE] rows from a dispatch_lanes or collect_lane_results artifact (by output_ref), produce structured records with provenance, optionally persist to a per-batch sidecar JSONL. Pure-parser variant exists as internal module.",
192
+ agents: ["architect"]
193
+ },
190
194
  test_runner: {
191
195
  description: "auto-detect and run tests",
192
196
  agents: ["architect", "reviewer", "test_engineer"]