opencode-swarm 7.29.3 → 7.30.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.
@@ -55,4 +55,4 @@ export declare function buildCouncilWorkflow(council?: CouncilWorkflowConfig): s
55
55
  * BRAINSTORM, and PLAN inline paths stay in lockstep.
56
56
  */
57
57
  export declare function buildQaGateSelectionDialogue(modeLabel: 'BRAINSTORM' | 'SPECIFY' | 'PLAN'): string;
58
- export declare function createArchitectAgent(model: string, customPrompt?: string, customAppendPrompt?: string, adversarialTesting?: AdversarialTestingConfig, council?: CouncilWorkflowConfig, uiReview?: UIReviewConfig): AgentDefinition;
58
+ export declare function createArchitectAgent(model: string, customPrompt?: string, customAppendPrompt?: string, adversarialTesting?: AdversarialTestingConfig, council?: CouncilWorkflowConfig, uiReview?: UIReviewConfig, memoryEnabled?: boolean): AgentDefinition;
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.29.3",
37
+ version: "7.30.0",
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",
@@ -16225,6 +16225,8 @@ var init_tool_names = __esm(() => {
16225
16225
  "skill_improve",
16226
16226
  "spec_write",
16227
16227
  "knowledge_ack",
16228
+ "swarm_memory_recall",
16229
+ "swarm_memory_propose",
16228
16230
  "swarm_command",
16229
16231
  "lean_turbo_plan_lanes",
16230
16232
  "lean_turbo_acquire_locks",
@@ -16757,6 +16759,8 @@ var init_constants = __esm(() => {
16757
16759
  skill_improve: "run the skill_improver agent to review and refine skills",
16758
16760
  spec_write: "author or update .swarm/spec.md for the current project",
16759
16761
  knowledge_ack: "record an explicit KNOWLEDGE_APPLIED/IGNORED/VIOLATED acknowledgment",
16762
+ swarm_memory_recall: "recall scoped Swarm memory for the current repository as untrusted background",
16763
+ swarm_memory_propose: "create a pending Swarm memory proposal; does not write durable memory directly",
16760
16764
  swarm_command: "run supported /swarm commands through the canonical command registry",
16761
16765
  lean_turbo_plan_lanes: "partition phase tasks into parallel lanes based on file-scope conflicts for Lean Turbo execution",
16762
16766
  lean_turbo_acquire_locks: "acquire file locks for all files in a lane (all-or-nothing) before lane execution",
@@ -16868,7 +16872,7 @@ function getCanonicalAgentRole(agentName, generatedAgentNames) {
16868
16872
  function stripKnownSwarmPrefix(agentName) {
16869
16873
  return getCanonicalAgentRole(agentName);
16870
16874
  }
16871
- var SEPARATORS, CANONICAL_ROLES_LONGEST_FIRST, CANONICAL_ROLES_SET, AgentOverrideConfigSchema, SwarmConfigSchema, HooksConfigSchema, ScoringWeightsSchema, DecisionDecaySchema, TokenRatiosSchema, ScoringConfigSchema, ContextBudgetConfigSchema, EvidenceConfigSchema, GateFeatureSchema, PlaceholderScanConfigSchema, QualityBudgetConfigSchema, GateConfigSchema, PipelineConfigSchema, PhaseCompleteConfigSchema, SummaryConfigSchema, ReviewPassesConfigSchema, AdversarialDetectionConfigSchema, AdversarialTestingConfigSchemaBase, AdversarialTestingConfigSchema, IntegrationAnalysisConfigSchema, DocsConfigSchema, UIReviewConfigSchema, CompactionAdvisoryConfigSchema, LintConfigSchema, SecretscanConfigSchema, GuardrailsProfileSchema, DEFAULT_AGENT_PROFILES, DEFAULT_ARCHITECT_PROFILE, GuardrailsConfigSchema, WatchdogConfigSchema, SelfReviewConfigSchema, ToolFilterConfigSchema, PlanCursorConfigSchema, CheckpointConfigSchema, AutomationModeSchema, AutomationCapabilitiesSchema, AutomationConfigSchemaBase, AutomationConfigSchema, KnowledgeConfigSchema, CuratorConfigSchema, KnowledgeApplicationConfigSchema, SkillImproverConfigSchema, SpecWriterConfigSchema, SlopDetectorConfigSchema, IncrementalVerifyConfigSchema, CompactionConfigSchema, PrmConfigSchema, AgentAuthorityRuleSchema, AuthorityConfigSchema, GeneralCouncilMemberConfigSchema, GeneralCouncilConfigSchema, CouncilConfigSchema, ParallelizationConfigSchema, LeanTurboConfigSchema, StandardTurboConfigSchema, LeanTurboStrategyConfigSchema, TurboConfigSchema, PluginConfigSchema;
16875
+ var SEPARATORS, CANONICAL_ROLES_LONGEST_FIRST, CANONICAL_ROLES_SET, AgentOverrideConfigSchema, SwarmConfigSchema, HooksConfigSchema, ScoringWeightsSchema, DecisionDecaySchema, TokenRatiosSchema, ScoringConfigSchema, ContextBudgetConfigSchema, EvidenceConfigSchema, GateFeatureSchema, PlaceholderScanConfigSchema, QualityBudgetConfigSchema, GateConfigSchema, PipelineConfigSchema, PhaseCompleteConfigSchema, SummaryConfigSchema, ReviewPassesConfigSchema, AdversarialDetectionConfigSchema, AdversarialTestingConfigSchemaBase, AdversarialTestingConfigSchema, IntegrationAnalysisConfigSchema, DocsConfigSchema, UIReviewConfigSchema, CompactionAdvisoryConfigSchema, LintConfigSchema, SecretscanConfigSchema, GuardrailsProfileSchema, DEFAULT_AGENT_PROFILES, DEFAULT_ARCHITECT_PROFILE, GuardrailsConfigSchema, WatchdogConfigSchema, SelfReviewConfigSchema, ToolFilterConfigSchema, PlanCursorConfigSchema, CheckpointConfigSchema, AutomationModeSchema, AutomationCapabilitiesSchema, AutomationConfigSchemaBase, AutomationConfigSchema, KnowledgeConfigSchema, MemoryConfigSchema, CuratorConfigSchema, KnowledgeApplicationConfigSchema, SkillImproverConfigSchema, SpecWriterConfigSchema, SlopDetectorConfigSchema, IncrementalVerifyConfigSchema, CompactionConfigSchema, PrmConfigSchema, AgentAuthorityRuleSchema, AuthorityConfigSchema, GeneralCouncilMemberConfigSchema, GeneralCouncilConfigSchema, CouncilConfigSchema, ParallelizationConfigSchema, LeanTurboConfigSchema, StandardTurboConfigSchema, LeanTurboStrategyConfigSchema, TurboConfigSchema, PluginConfigSchema;
16872
16876
  var init_schema = __esm(() => {
16873
16877
  init_zod();
16874
16878
  init_constants();
@@ -17320,6 +17324,23 @@ var init_schema = __esm(() => {
17320
17324
  todo_max_phases: exports_external.number().int().positive().default(3),
17321
17325
  sweep_enabled: exports_external.boolean().default(true)
17322
17326
  });
17327
+ MemoryConfigSchema = exports_external.object({
17328
+ enabled: exports_external.boolean().default(false),
17329
+ provider: exports_external.literal("local-jsonl").default("local-jsonl"),
17330
+ storageDir: exports_external.string().default(".swarm/memory"),
17331
+ recall: exports_external.object({
17332
+ defaultMaxItems: exports_external.number().int().min(1).max(20).default(8),
17333
+ defaultTokenBudget: exports_external.number().int().min(100).max(5000).default(1200),
17334
+ minScore: exports_external.number().min(0).max(1).default(0.05)
17335
+ }).default({ defaultMaxItems: 8, defaultTokenBudget: 1200, minScore: 0.05 }),
17336
+ writes: exports_external.object({
17337
+ mode: exports_external.literal("propose").default("propose")
17338
+ }).default({ mode: "propose" }),
17339
+ redaction: exports_external.object({
17340
+ rejectDurableSecrets: exports_external.boolean().default(true)
17341
+ }).default({ rejectDurableSecrets: true }),
17342
+ hardDelete: exports_external.boolean().default(false)
17343
+ });
17323
17344
  CuratorConfigSchema = exports_external.object({
17324
17345
  enabled: exports_external.boolean().default(true),
17325
17346
  init_enabled: exports_external.boolean().default(true),
@@ -17527,6 +17548,7 @@ var init_schema = __esm(() => {
17527
17548
  checkpoint: CheckpointConfigSchema.optional(),
17528
17549
  automation: AutomationConfigSchema.optional(),
17529
17550
  knowledge: KnowledgeConfigSchema.optional(),
17551
+ memory: MemoryConfigSchema.optional(),
17530
17552
  curator: CuratorConfigSchema.optional(),
17531
17553
  knowledge_application: KnowledgeApplicationConfigSchema.optional(),
17532
17554
  skill_improver: SkillImproverConfigSchema.optional(),
@@ -19857,15 +19879,36 @@ function validateProjectRoot(directory) {
19857
19879
  throw new Error(`Cannot verify project root for "${directory}" \u2014 directory may not exist or is inaccessible`);
19858
19880
  }
19859
19881
  let current = resolved;
19882
+ let depth = 0;
19860
19883
  while (true) {
19884
+ if (depth >= MAX_DEPTH)
19885
+ break;
19886
+ depth++;
19861
19887
  const parent = path7.dirname(current);
19862
19888
  if (parent === current)
19863
19889
  break;
19864
19890
  const parentSwarm = path7.join(parent, ".swarm");
19865
19891
  try {
19866
19892
  if (statSync4(parentSwarm).isDirectory()) {
19867
- warn(`[evidence] Rejecting write to subdirectory "${resolved}" \u2014 parent "${parent}" already contains .swarm/`);
19868
- throw new Error(`Cannot write evidence in "${resolved}" \u2014 parent directory "${parent}" already contains a .swarm/ folder. Evidence must be written to the project root.`);
19893
+ let hasProjectIndicator = false;
19894
+ for (const indicator of PROJECT_INDICATORS) {
19895
+ try {
19896
+ const indicatorStat = statSync4(path7.join(parent, indicator));
19897
+ if (indicatorStat.isFile() || indicatorStat.isDirectory()) {
19898
+ hasProjectIndicator = true;
19899
+ break;
19900
+ }
19901
+ } catch (error49) {
19902
+ if (error49 instanceof Error && "code" in error49 && error49.code === "ENOENT") {} else {
19903
+ hasProjectIndicator = true;
19904
+ break;
19905
+ }
19906
+ }
19907
+ }
19908
+ if (hasProjectIndicator) {
19909
+ warn(`[evidence] Rejecting write to subdirectory "${resolved}" \u2014 parent "${parent}" already contains .swarm/`);
19910
+ throw new Error(`Cannot write evidence in "${resolved}" \u2014 parent directory "${parent}" already contains a .swarm/ folder. Evidence must be written to the project root.`);
19911
+ }
19869
19912
  }
19870
19913
  } catch (error49) {
19871
19914
  if (error49 instanceof Error && error49.message.startsWith("Cannot write evidence")) {
@@ -20108,7 +20151,7 @@ async function archiveEvidence(directory, maxAgeDays, maxBundles) {
20108
20151
  }
20109
20152
  return archived;
20110
20153
  }
20111
- var VALID_EVIDENCE_TYPES, sanitizeTaskId2, LEGACY_TASK_COMPLEXITY_MAP, _internals5;
20154
+ var VALID_EVIDENCE_TYPES, sanitizeTaskId2, MAX_DEPTH = 20, PROJECT_INDICATORS, LEGACY_TASK_COMPLEXITY_MAP, _internals5;
20112
20155
  var init_manager2 = __esm(() => {
20113
20156
  init_zod();
20114
20157
  init_evidence_schema();
@@ -20133,6 +20176,19 @@ var init_manager2 = __esm(() => {
20133
20176
  "secretscan"
20134
20177
  ];
20135
20178
  sanitizeTaskId2 = sanitizeTaskId;
20179
+ PROJECT_INDICATORS = [
20180
+ "package.json",
20181
+ ".git",
20182
+ ".opencode",
20183
+ "Cargo.toml",
20184
+ "go.mod",
20185
+ "pyproject.toml",
20186
+ "Gemfile",
20187
+ "composer.json",
20188
+ "pom.xml",
20189
+ "build.gradle",
20190
+ "CMakeLists.txt"
20191
+ ];
20136
20192
  LEGACY_TASK_COMPLEXITY_MAP = {
20137
20193
  low: "simple",
20138
20194
  medium: "moderate",
@@ -40693,10 +40749,10 @@ function detectStraySwarmDirs(projectRoot) {
40693
40749
  "__pycache__",
40694
40750
  ".tox"
40695
40751
  ]);
40696
- const MAX_DEPTH = 10;
40752
+ const MAX_DEPTH2 = 10;
40697
40753
  const MAX_CONTENTS_ENTRIES = 20;
40698
40754
  function walk(dir, depth) {
40699
- if (depth > MAX_DEPTH)
40755
+ if (depth > MAX_DEPTH2)
40700
40756
  return;
40701
40757
  let entries;
40702
40758
  try {
@@ -10,6 +10,8 @@ export type QAAgentName = (typeof QA_AGENTS)[number];
10
10
  export type PipelineAgentName = (typeof PIPELINE_AGENTS)[number];
11
11
  export type AgentName = (typeof ALL_AGENT_NAMES)[number];
12
12
  export declare const AGENT_TOOL_MAP: Record<AgentName, ToolName[]>;
13
+ export declare const MEMORY_TOOL_NAMES: readonly ["swarm_memory_recall", "swarm_memory_propose"];
14
+ export declare const MEMORY_AGENT_TOOL_MAP: Partial<Record<AgentName, ToolName[]>>;
13
15
  /**
14
16
  * Human-readable descriptions for tools shown in the architect Available Tools block.
15
17
  * Used to generate the Available Tools section of the architect prompt at construction time.
@@ -18,7 +18,7 @@ export declare const _internals: {
18
18
  };
19
19
  export type { MigrationStatus, Phase, PhaseStatus, Plan, Task, TaskSize, TaskStatus, } from './plan-schema';
20
20
  export { MigrationStatusSchema, PhaseSchema, PhaseStatusSchema, PlanSchema, TaskSchema, TaskSizeSchema, TaskStatusSchema, } from './plan-schema';
21
- export type { AgentOverrideConfig, AutomationCapabilities, AutomationConfig, AutomationMode, LeanTurboConfig, PhaseCompleteConfig, PipelineConfig, PluginConfig, SwarmConfig, TurboConfig, } from './schema';
22
- export { AgentOverrideConfigSchema, AutomationCapabilitiesSchema, AutomationConfigSchema, AutomationModeSchema, LeanTurboConfigSchema, PhaseCompleteConfigSchema, PipelineConfigSchema, PluginConfigSchema, SwarmConfigSchema, TurboConfigSchema, } from './schema';
21
+ export type { AgentOverrideConfig, AutomationCapabilities, AutomationConfig, AutomationMode, LeanTurboConfig, MemoryConfig, PhaseCompleteConfig, PipelineConfig, PluginConfig, SwarmConfig, TurboConfig, } from './schema';
22
+ export { AgentOverrideConfigSchema, AutomationCapabilitiesSchema, AutomationConfigSchema, AutomationModeSchema, LeanTurboConfigSchema, MemoryConfigSchema, PhaseCompleteConfigSchema, PipelineConfigSchema, PluginConfigSchema, SwarmConfigSchema, TurboConfigSchema, } from './schema';
23
23
  export type { DeltaSpec, Obligation, SpecDelta, SpecRequirement, SpecScenario, SpecSection, SwarmSpec, } from './spec-schema';
24
24
  export { DeltaSpecSchema, ObligationSchema, SpecDeltaSchema, SpecRequirementSchema, SpecScenarioSchema, SpecSectionSchema, SwarmSpecSchema, validateSpecContent, } from './spec-schema';
@@ -502,6 +502,24 @@ export declare const KnowledgeConfigSchema: z.ZodObject<{
502
502
  sweep_enabled: z.ZodDefault<z.ZodBoolean>;
503
503
  }, z.core.$strip>;
504
504
  export type KnowledgeConfig = z.infer<typeof KnowledgeConfigSchema>;
505
+ export declare const MemoryConfigSchema: z.ZodObject<{
506
+ enabled: z.ZodDefault<z.ZodBoolean>;
507
+ provider: z.ZodDefault<z.ZodLiteral<"local-jsonl">>;
508
+ storageDir: z.ZodDefault<z.ZodString>;
509
+ recall: z.ZodDefault<z.ZodObject<{
510
+ defaultMaxItems: z.ZodDefault<z.ZodNumber>;
511
+ defaultTokenBudget: z.ZodDefault<z.ZodNumber>;
512
+ minScore: z.ZodDefault<z.ZodNumber>;
513
+ }, z.core.$strip>>;
514
+ writes: z.ZodDefault<z.ZodObject<{
515
+ mode: z.ZodDefault<z.ZodLiteral<"propose">>;
516
+ }, z.core.$strip>>;
517
+ redaction: z.ZodDefault<z.ZodObject<{
518
+ rejectDurableSecrets: z.ZodDefault<z.ZodBoolean>;
519
+ }, z.core.$strip>>;
520
+ hardDelete: z.ZodDefault<z.ZodBoolean>;
521
+ }, z.core.$strip>;
522
+ export type MemoryConfig = z.infer<typeof MemoryConfigSchema>;
505
523
  export declare const CuratorConfigSchema: z.ZodObject<{
506
524
  enabled: z.ZodDefault<z.ZodBoolean>;
507
525
  init_enabled: z.ZodDefault<z.ZodBoolean>;
@@ -1135,6 +1153,23 @@ export declare const PluginConfigSchema: z.ZodObject<{
1135
1153
  todo_max_phases: z.ZodDefault<z.ZodNumber>;
1136
1154
  sweep_enabled: z.ZodDefault<z.ZodBoolean>;
1137
1155
  }, z.core.$strip>>;
1156
+ memory: z.ZodOptional<z.ZodObject<{
1157
+ enabled: z.ZodDefault<z.ZodBoolean>;
1158
+ provider: z.ZodDefault<z.ZodLiteral<"local-jsonl">>;
1159
+ storageDir: z.ZodDefault<z.ZodString>;
1160
+ recall: z.ZodDefault<z.ZodObject<{
1161
+ defaultMaxItems: z.ZodDefault<z.ZodNumber>;
1162
+ defaultTokenBudget: z.ZodDefault<z.ZodNumber>;
1163
+ minScore: z.ZodDefault<z.ZodNumber>;
1164
+ }, z.core.$strip>>;
1165
+ writes: z.ZodDefault<z.ZodObject<{
1166
+ mode: z.ZodDefault<z.ZodLiteral<"propose">>;
1167
+ }, z.core.$strip>>;
1168
+ redaction: z.ZodDefault<z.ZodObject<{
1169
+ rejectDurableSecrets: z.ZodDefault<z.ZodBoolean>;
1170
+ }, z.core.$strip>>;
1171
+ hardDelete: z.ZodDefault<z.ZodBoolean>;
1172
+ }, z.core.$strip>>;
1138
1173
  curator: z.ZodOptional<z.ZodObject<{
1139
1174
  enabled: z.ZodDefault<z.ZodBoolean>;
1140
1175
  init_enabled: z.ZodDefault<z.ZodBoolean>;
@@ -38,11 +38,17 @@ export declare function isQualityBudgetEvidence(evidence: Evidence): evidence is
38
38
  export declare function isSecretscanEvidence(evidence: Evidence): evidence is SecretscanEvidence;
39
39
  import { sanitizeTaskId as _sanitizeTaskId } from '../validation/task-id';
40
40
  export declare const sanitizeTaskId: typeof _sanitizeTaskId;
41
+ /** Maximum depth to walk up the directory tree before stopping (fail-open). */
42
+ export declare const MAX_DEPTH = 20;
43
+ /** File/directory names that indicate a real project root. */
44
+ export declare const PROJECT_INDICATORS: readonly ["package.json", ".git", ".opencode", "Cargo.toml", "go.mod", "pyproject.toml", "Gemfile", "composer.json", "pom.xml", "build.gradle", "CMakeLists.txt"];
41
45
  /**
42
46
  * Defense-in-depth: verify that `directory` is the project root and not a subdirectory
43
47
  * of a project that already has a .swarm/ at its root.
44
- * Walks up the directory tree to filesystem root looking for a parent .swarm/ directory.
45
- * @throws Error if a parent directory contains .swarm/
48
+ * Walks up the directory tree (bounded by MAX_DEPTH) looking for a parent .swarm/ directory.
49
+ * When .swarm/ is found, checks for at least one PROJECT_INDICATORS entry to distinguish
50
+ * real projects from stray artifacts (e.g. `C:\.swarm`).
51
+ * @throws Error if a parent directory contains both .swarm/ and a project indicator
46
52
  */
47
53
  export declare function validateProjectRoot(directory: string): void;
48
54
  /**