opencode-swarm 6.33.1 → 6.33.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/README.md +59 -7
- package/dist/cli/index.js +73 -10
- package/dist/config/evidence-schema.d.ts +79 -0
- package/dist/config/schema.d.ts +6 -0
- package/dist/evidence/manager.d.ts +8 -4
- package/dist/hooks/delegation-gate.getEvidenceTaskId.test.d.ts +20 -0
- package/dist/index.js +811 -258
- package/dist/model-fallback.adversarial.test.d.ts +22 -0
- package/dist/model-fallback.test.d.ts +12 -0
- package/dist/session/snapshot-writer.d.ts +8 -0
- package/dist/state.d.ts +8 -0
- package/dist/tools/doc-scan.d.ts +38 -0
- package/dist/tools/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adversarial tests for model fallback schema and state (v6.33)
|
|
3
|
+
*
|
|
4
|
+
* Tests attack vectors against:
|
|
5
|
+
* 1. AgentOverrideConfigSchema fallback_models field
|
|
6
|
+
* 2. AgentSessionState model_fallback_index and modelFallbackExhausted
|
|
7
|
+
*
|
|
8
|
+
* ADVERSARIAL TEST CASES:
|
|
9
|
+
* 1. fallback_models with 1000 entries — should Zod-reject (max 3)
|
|
10
|
+
* 2. fallback_models with non-string values (numbers, objects, null)
|
|
11
|
+
* 3. fallback_models with empty strings ""
|
|
12
|
+
* 4. fallback_models with extremely long model name strings (10K chars)
|
|
13
|
+
* 5. model_fallback_index set to NaN — should it be NaN or coerced?
|
|
14
|
+
* 6. model_fallback_index set to -1 — negative index
|
|
15
|
+
* 7. model_fallback_index set to MAX_SAFE_INTEGER — overflow risk?
|
|
16
|
+
* 8. modelFallbackExhausted set to undefined in deserialization — should default to false
|
|
17
|
+
* 9. Circular reference in fallback_models array elements
|
|
18
|
+
* 10. Prototype pollution via __proto__ in fallback_models
|
|
19
|
+
* 11. AgentOverrideConfigSchema.parse with all fields including fallback_models, verify no field collision
|
|
20
|
+
* 12. Serialization with model_fallback_index as a float (3.14) — should survive round-trip
|
|
21
|
+
*/
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for model fallback schema and state (v6.33)
|
|
3
|
+
*
|
|
4
|
+
* Covers:
|
|
5
|
+
* 1. AgentOverrideConfigSchema fallback_models field parsing
|
|
6
|
+
* 2. State initialization of model_fallback_index and modelFallbackExhausted
|
|
7
|
+
* 3. Serialization round-trip for both fields
|
|
8
|
+
* 4. Deserialization defaults when fields are missing
|
|
9
|
+
* 5. Migration safety via ensureAgentSession
|
|
10
|
+
* 6. Edge cases for schema and state
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
@@ -41,6 +41,14 @@ export interface SerializedAgentSession {
|
|
|
41
41
|
taskWorkflowStates?: Record<string, string>;
|
|
42
42
|
/** Flag for one-shot scope violation warning injection (omitted when undefined for additive-only schema) */
|
|
43
43
|
scopeViolationDetected?: boolean;
|
|
44
|
+
/** Current index into the fallback_models array (v6.33) */
|
|
45
|
+
model_fallback_index: number;
|
|
46
|
+
/** Flag set when all fallback models have been exhausted (v6.33) */
|
|
47
|
+
modelFallbackExhausted: boolean;
|
|
48
|
+
/** Number of coder revisions in the current task (v6.33) */
|
|
49
|
+
coderRevisions: number;
|
|
50
|
+
/** Flag set when coder revisions hit the configured ceiling (v6.33) */
|
|
51
|
+
revisionLimitHit: boolean;
|
|
44
52
|
}
|
|
45
53
|
/**
|
|
46
54
|
* Minimal interface for serialized InvocationWindow
|
package/dist/state.d.ts
CHANGED
|
@@ -106,6 +106,10 @@ export interface AgentSessionState {
|
|
|
106
106
|
scopeViolationDetected?: boolean;
|
|
107
107
|
/** Files modified by the current coder task (populated by guardrails toolBefore/toolAfter, reset on new coder delegation) */
|
|
108
108
|
modifiedFilesThisCoderTask: string[];
|
|
109
|
+
/** Number of coder revisions in the current task (incremented on each coder delegation completion) */
|
|
110
|
+
coderRevisions: number;
|
|
111
|
+
/** Flag set when coder revisions hit the configured ceiling */
|
|
112
|
+
revisionLimitHit: boolean;
|
|
109
113
|
/** Timestamp of most recent phase completion */
|
|
110
114
|
lastPhaseCompleteTimestamp: number;
|
|
111
115
|
/** Phase number of most recent phase completion */
|
|
@@ -114,6 +118,10 @@ export interface AgentSessionState {
|
|
|
114
118
|
phaseAgentsDispatched: Set<string>;
|
|
115
119
|
/** Set of agents dispatched in the most recently completed phase (persisted across phase reset) */
|
|
116
120
|
lastCompletedPhaseAgentsDispatched: Set<string>;
|
|
121
|
+
/** Current index into the fallback_models array (0 = primary model, incremented on transient failure) */
|
|
122
|
+
model_fallback_index: number;
|
|
123
|
+
/** Flag set when all fallback models have been exhausted */
|
|
124
|
+
modelFallbackExhausted: boolean;
|
|
117
125
|
/** Session-scoped Turbo Mode flag for controlling LLM inference speed */
|
|
118
126
|
turboMode: boolean;
|
|
119
127
|
/** Sliding window of last 10 Task delegation hashes for loop detection */
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createSwarmTool } from './create-tool.js';
|
|
2
|
+
export interface DocManifestFile {
|
|
3
|
+
path: string;
|
|
4
|
+
title: string;
|
|
5
|
+
summary: string;
|
|
6
|
+
lines: number;
|
|
7
|
+
mtime: number;
|
|
8
|
+
}
|
|
9
|
+
export interface DocManifest {
|
|
10
|
+
schema_version: 1;
|
|
11
|
+
scanned_at: string;
|
|
12
|
+
files: DocManifestFile[];
|
|
13
|
+
}
|
|
14
|
+
export declare function scanDocIndex(directory: string): Promise<{
|
|
15
|
+
manifest: DocManifest;
|
|
16
|
+
cached: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Extract actionable constraints from project documentation relevant to a task.
|
|
20
|
+
*
|
|
21
|
+
* Algorithm:
|
|
22
|
+
* 1. Read .swarm/doc-manifest.json (or generate via scanDocIndex if missing)
|
|
23
|
+
* 2. Score each doc against task files + description using Jaccard bigram similarity
|
|
24
|
+
* 3. For docs with score > RELEVANCE_THRESHOLD, read full content and extract constraints
|
|
25
|
+
* 4. Dedup against existing knowledge entries before appending
|
|
26
|
+
* 5. Return extraction statistics
|
|
27
|
+
*/
|
|
28
|
+
export declare function extractDocConstraints(directory: string, taskFiles: string[], taskDescription: string): Promise<{
|
|
29
|
+
extracted: number;
|
|
30
|
+
skipped: number;
|
|
31
|
+
details: {
|
|
32
|
+
path: string;
|
|
33
|
+
score: number;
|
|
34
|
+
constraints: string[];
|
|
35
|
+
}[];
|
|
36
|
+
}>;
|
|
37
|
+
export declare const doc_scan: ReturnType<typeof createSwarmTool>;
|
|
38
|
+
export declare const doc_extract: ReturnType<typeof createSwarmTool>;
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { complexity_hotspots } from './complexity-hotspots';
|
|
|
5
5
|
export { curator_analyze } from './curator-analyze';
|
|
6
6
|
export { declare_scope } from './declare-scope';
|
|
7
7
|
export { type DiffErrorResult, type DiffResult, diff } from './diff';
|
|
8
|
+
export { doc_extract, doc_scan } from './doc-scan';
|
|
8
9
|
export { detect_domains } from './domain-detector';
|
|
9
10
|
export { evidence_check } from './evidence-check';
|
|
10
11
|
export { extract_code_blocks } from './file-extractor';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "6.33.
|
|
3
|
+
"version": "6.33.2",
|
|
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",
|