opencode-swarm 6.32.4 → 6.33.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.
@@ -0,0 +1 @@
1
+ export {};
package/dist/cli/index.js CHANGED
@@ -39929,6 +39929,47 @@ async function executeWriteRetro(args, directory) {
39929
39929
  message: "Invalid summary: must be a non-empty string"
39930
39930
  }, null, 2);
39931
39931
  }
39932
+ if (args.task_id !== undefined) {
39933
+ const tid = args.task_id;
39934
+ if (!tid || tid.length === 0 || tid.length > 200) {
39935
+ return JSON.stringify({
39936
+ success: false,
39937
+ phase,
39938
+ message: "Invalid task ID: must match pattern"
39939
+ }, null, 2);
39940
+ }
39941
+ if (/\0/.test(tid)) {
39942
+ return JSON.stringify({
39943
+ success: false,
39944
+ phase,
39945
+ message: "Invalid task ID: contains null bytes"
39946
+ }, null, 2);
39947
+ }
39948
+ for (let i = 0;i < tid.length; i++) {
39949
+ if (tid.charCodeAt(i) < 32) {
39950
+ return JSON.stringify({
39951
+ success: false,
39952
+ phase,
39953
+ message: "Invalid task ID: contains control characters"
39954
+ }, null, 2);
39955
+ }
39956
+ }
39957
+ if (tid.includes("..") || tid.includes("/") || tid.includes("\\")) {
39958
+ return JSON.stringify({
39959
+ success: false,
39960
+ phase,
39961
+ message: "Invalid task ID: path traversal detected"
39962
+ }, null, 2);
39963
+ }
39964
+ const VALID_TASK_ID = /^(retro-\d+|\d+\.\d+(\.\d+)*)$/;
39965
+ if (!VALID_TASK_ID.test(tid)) {
39966
+ return JSON.stringify({
39967
+ success: false,
39968
+ phase,
39969
+ message: "Invalid task ID: must match pattern"
39970
+ }, null, 2);
39971
+ }
39972
+ }
39932
39973
  const taskId = args.task_id ?? `retro-${phase}`;
39933
39974
  const retroEntry = {
39934
39975
  task_id: taskId,
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Verification tests for callID→evidenceTaskId map in delegation-gate.ts
3
+ *
4
+ * Tests verify the map behavior indirectly through evidence recording outcomes:
5
+ * 1. Map stores callID→evidenceTaskId after determining the taskId
6
+ * 2. Map is checked first before getEvidenceTaskId fallback
7
+ * 3. Map entry is cleaned up after successful evidence recording
8
+ * 4. Map entry is cleaned up even when evidence recording errors
9
+ * 5. Fallback works when storedTaskId is not in map
10
+ */
11
+ export {};
@@ -0,0 +1,57 @@
1
+ /**
2
+ * TRAJECTORY LOGGER (v6.31 Task 3.2)
3
+ *
4
+ * tool.execute.after hook that appends per-task tool call trajectories to a
5
+ * .swarm/evidence/{taskId}/trajectory.jsonl file. Only logs INSIDE delegation
6
+ * scope (when delegationActive is true on the session).
7
+ *
8
+ * Trajectories are used for post-hoc analysis, audit trails, and replay.
9
+ */
10
+ export interface TrajectoryConfig {
11
+ enabled: boolean;
12
+ max_lines: number;
13
+ }
14
+ export interface TrajectoryEntry {
15
+ tool: string;
16
+ args_summary: string;
17
+ verdict: string;
18
+ timestamp: string;
19
+ agent: string;
20
+ elapsed_ms: number;
21
+ }
22
+ /**
23
+ * Truncates a trajectory file to the newest half when maxLines is exceeded.
24
+ * Reads all lines, keeps the newest half, rewrites the file.
25
+ *
26
+ * @param filePath - Absolute path to the trajectory.jsonl file
27
+ * @param maxLines - Maximum number of lines to retain
28
+ */
29
+ export declare function truncateTrajectoryFile(filePath: string, maxLines: number): Promise<void>;
30
+ /**
31
+ * Creates the trajectory logger hook pair.
32
+ *
33
+ * @param config - TrajectoryConfig { enabled: boolean (default true), max_lines: number (default 500) }
34
+ * @param _directory - Reserved for future use (evidence path derived from session taskId)
35
+ * @returns Object with toolAfter handler
36
+ */
37
+ export declare function createTrajectoryLoggerHook(config: Partial<TrajectoryConfig>, _directory: string): {
38
+ toolAfter: (input: {
39
+ tool: string;
40
+ sessionID: string;
41
+ callID: string;
42
+ args?: Record<string, unknown>;
43
+ }, output: {
44
+ title: string;
45
+ output: string;
46
+ metadata: unknown;
47
+ }) => Promise<void>;
48
+ };
49
+ /**
50
+ * Records the start time for a tool call (called from toolBefore).
51
+ * Stored in a module-level Map for correlation with toolAfter.
52
+ *
53
+ * @param sessionId - Session identifier
54
+ * @param callID - Tool call identifier
55
+ * @param startTime - Start timestamp in milliseconds
56
+ */
57
+ export declare function recordToolCallStart(sessionId: string, callID: string, startTime: number): void;
package/dist/index.js CHANGED
@@ -48749,6 +48749,47 @@ async function executeWriteRetro(args2, directory) {
48749
48749
  message: "Invalid summary: must be a non-empty string"
48750
48750
  }, null, 2);
48751
48751
  }
48752
+ if (args2.task_id !== undefined) {
48753
+ const tid = args2.task_id;
48754
+ if (!tid || tid.length === 0 || tid.length > 200) {
48755
+ return JSON.stringify({
48756
+ success: false,
48757
+ phase,
48758
+ message: "Invalid task ID: must match pattern"
48759
+ }, null, 2);
48760
+ }
48761
+ if (/\0/.test(tid)) {
48762
+ return JSON.stringify({
48763
+ success: false,
48764
+ phase,
48765
+ message: "Invalid task ID: contains null bytes"
48766
+ }, null, 2);
48767
+ }
48768
+ for (let i2 = 0;i2 < tid.length; i2++) {
48769
+ if (tid.charCodeAt(i2) < 32) {
48770
+ return JSON.stringify({
48771
+ success: false,
48772
+ phase,
48773
+ message: "Invalid task ID: contains control characters"
48774
+ }, null, 2);
48775
+ }
48776
+ }
48777
+ if (tid.includes("..") || tid.includes("/") || tid.includes("\\")) {
48778
+ return JSON.stringify({
48779
+ success: false,
48780
+ phase,
48781
+ message: "Invalid task ID: path traversal detected"
48782
+ }, null, 2);
48783
+ }
48784
+ const VALID_TASK_ID = /^(retro-\d+|\d+\.\d+(\.\d+)*)$/;
48785
+ if (!VALID_TASK_ID.test(tid)) {
48786
+ return JSON.stringify({
48787
+ success: false,
48788
+ phase,
48789
+ message: "Invalid task ID: must match pattern"
48790
+ }, null, 2);
48791
+ }
48792
+ }
48752
48793
  const taskId = args2.task_id ?? `retro-${phase}`;
48753
48794
  const retroEntry = {
48754
48795
  task_id: taskId,
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "6.32.4",
3
+ "version": "6.33.0",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",