@a4hgehad/weave-mcp 0.8.5 → 0.8.7

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 (130) hide show
  1. package/README.md +23 -8
  2. package/dist/agents/agent-builder.d.ts +49 -0
  3. package/dist/agents/builtin-agents.d.ts +34 -0
  4. package/dist/agents/custom-agent-factory.d.ts +24 -0
  5. package/dist/agents/dynamic-prompt-builder.d.ts +35 -0
  6. package/dist/agents/index.d.ts +12 -0
  7. package/dist/agents/loom/default.d.ts +2 -0
  8. package/dist/agents/loom/index.d.ts +11 -0
  9. package/dist/agents/loom/prompt-composer.d.ts +35 -0
  10. package/dist/agents/model-resolution.d.ts +27 -0
  11. package/dist/agents/pattern/default.d.ts +2 -0
  12. package/dist/agents/pattern/index.d.ts +2 -0
  13. package/dist/agents/prompt-loader.d.ts +9 -0
  14. package/dist/agents/prompt-utils.d.ts +2 -0
  15. package/dist/agents/shuttle/default.d.ts +2 -0
  16. package/dist/agents/shuttle/index.d.ts +2 -0
  17. package/dist/agents/spindle/default.d.ts +2 -0
  18. package/dist/agents/spindle/index.d.ts +2 -0
  19. package/dist/agents/tapestry/default.d.ts +2 -0
  20. package/dist/agents/tapestry/index.d.ts +9 -0
  21. package/dist/agents/tapestry/prompt-composer.d.ts +24 -0
  22. package/dist/agents/thread/default.d.ts +2 -0
  23. package/dist/agents/thread/index.d.ts +2 -0
  24. package/dist/agents/types.d.ts +82 -0
  25. package/dist/agents/warp/default.d.ts +2 -0
  26. package/dist/agents/warp/index.d.ts +2 -0
  27. package/dist/agents/weft/default.d.ts +2 -0
  28. package/dist/agents/weft/index.d.ts +2 -0
  29. package/dist/config/index.d.ts +3 -0
  30. package/dist/config/loader.d.ts +2 -0
  31. package/dist/config/merge.d.ts +3 -0
  32. package/dist/config/schema.d.ts +344 -0
  33. package/dist/create-managers.d.ts +21 -0
  34. package/dist/create-tools.d.ts +16 -0
  35. package/dist/features/analytics/adherence.d.ts +10 -0
  36. package/dist/features/analytics/fingerprint.d.ts +33 -0
  37. package/dist/features/analytics/format-metrics.d.ts +10 -0
  38. package/dist/features/analytics/generate-metrics-report.d.ts +17 -0
  39. package/dist/features/analytics/git-diff.d.ts +7 -0
  40. package/dist/features/analytics/index.d.ts +29 -0
  41. package/dist/features/analytics/plan-parser.d.ts +7 -0
  42. package/dist/features/analytics/plan-token-aggregator.d.ts +11 -0
  43. package/dist/features/analytics/session-tracker.d.ts +68 -0
  44. package/dist/features/analytics/storage.d.ts +40 -0
  45. package/dist/features/analytics/suggestions.d.ts +10 -0
  46. package/dist/features/analytics/token-report.d.ts +14 -0
  47. package/dist/features/analytics/types.d.ts +194 -0
  48. package/dist/features/builtin-commands/commands.d.ts +2 -0
  49. package/dist/features/builtin-commands/index.d.ts +2 -0
  50. package/dist/features/builtin-commands/templates/metrics.d.ts +1 -0
  51. package/dist/features/builtin-commands/templates/run-workflow.d.ts +1 -0
  52. package/dist/features/builtin-commands/templates/start-work.d.ts +1 -0
  53. package/dist/features/builtin-commands/types.d.ts +16 -0
  54. package/dist/features/evals/baseline.d.ts +4 -0
  55. package/dist/features/evals/evaluators/deterministic.d.ts +2 -0
  56. package/dist/features/evals/evaluators/llm-judge.d.ts +2 -0
  57. package/dist/features/evals/executors/model-response.d.ts +2 -0
  58. package/dist/features/evals/executors/prompt-renderer.d.ts +2 -0
  59. package/dist/features/evals/index.d.ts +24 -0
  60. package/dist/features/evals/loader.d.ts +8 -0
  61. package/dist/features/evals/reporter.d.ts +2 -0
  62. package/dist/features/evals/runner.d.ts +7 -0
  63. package/dist/features/evals/schema.d.ts +478 -0
  64. package/dist/features/evals/storage.d.ts +7 -0
  65. package/dist/features/evals/targets/builtin-agent-target.d.ts +2 -0
  66. package/dist/features/evals/types.d.ts +223 -0
  67. package/dist/features/skill-loader/discovery.d.ts +12 -0
  68. package/dist/features/skill-loader/index.d.ts +6 -0
  69. package/dist/features/skill-loader/loader.d.ts +7 -0
  70. package/dist/features/skill-loader/opencode-client.d.ts +2 -0
  71. package/dist/features/skill-loader/resolver.d.ts +6 -0
  72. package/dist/features/skill-loader/types.d.ts +18 -0
  73. package/dist/features/task-system/index.d.ts +6 -0
  74. package/dist/features/task-system/storage.d.ts +38 -0
  75. package/dist/features/task-system/todo-sync.d.ts +38 -0
  76. package/dist/features/task-system/tools/index.d.ts +3 -0
  77. package/dist/features/task-system/tools/task-create.d.ts +9 -0
  78. package/dist/features/task-system/tools/task-list.d.ts +5 -0
  79. package/dist/features/task-system/tools/task-update.d.ts +7 -0
  80. package/dist/features/task-system/types.d.ts +63 -0
  81. package/dist/features/work-state/constants.d.ts +8 -0
  82. package/dist/features/work-state/index.d.ts +5 -0
  83. package/dist/features/work-state/storage.d.ts +53 -0
  84. package/dist/features/work-state/types.d.ts +35 -0
  85. package/dist/features/work-state/validation-types.d.ts +26 -0
  86. package/dist/features/work-state/validation.d.ts +9 -0
  87. package/dist/features/workflow/commands.d.ts +17 -0
  88. package/dist/features/workflow/completion.d.ts +31 -0
  89. package/dist/features/workflow/constants.d.ts +12 -0
  90. package/dist/features/workflow/context.d.ts +16 -0
  91. package/dist/features/workflow/discovery.d.ts +19 -0
  92. package/dist/features/workflow/engine.d.ts +49 -0
  93. package/dist/features/workflow/hook.d.ts +47 -0
  94. package/dist/features/workflow/index.d.ts +15 -0
  95. package/dist/features/workflow/schema.d.ts +118 -0
  96. package/dist/features/workflow/storage.d.ts +51 -0
  97. package/dist/features/workflow/types.d.ts +142 -0
  98. package/dist/hooks/context-window-monitor.d.ts +19 -0
  99. package/dist/hooks/create-hooks.d.ts +40 -0
  100. package/dist/hooks/first-message-variant.d.ts +5 -0
  101. package/dist/hooks/index.d.ts +14 -0
  102. package/dist/hooks/keyword-detector.d.ts +8 -0
  103. package/dist/hooks/pattern-md-only.d.ts +13 -0
  104. package/dist/hooks/rules-injector.d.ts +6 -0
  105. package/dist/hooks/session-token-state.d.ts +42 -0
  106. package/dist/hooks/start-work-hook.d.ts +25 -0
  107. package/dist/hooks/verification-reminder.d.ts +22 -0
  108. package/dist/hooks/work-continuation.d.ts +26 -0
  109. package/dist/hooks/write-existing-file-guard.d.ts +14 -0
  110. package/dist/index.d.ts +5 -0
  111. package/dist/index.js +37 -8
  112. package/dist/managers/background-manager.d.ts +88 -0
  113. package/dist/managers/config-handler.d.ts +54 -0
  114. package/dist/managers/index.d.ts +6 -0
  115. package/dist/managers/skill-mcp-manager.d.ts +30 -0
  116. package/dist/mcp/agent-defaults.d.ts +12 -0
  117. package/dist/mcp/index.d.ts +16 -0
  118. package/dist/mcp/types.d.ts +26 -0
  119. package/dist/plugin/index.d.ts +1 -0
  120. package/dist/plugin/plugin-interface.d.ts +17 -0
  121. package/dist/plugin/types.d.ts +5 -0
  122. package/dist/shared/agent-display-names.d.ts +45 -0
  123. package/dist/shared/index.d.ts +5 -0
  124. package/dist/shared/log.d.ts +11 -0
  125. package/dist/shared/types.d.ts +6 -0
  126. package/dist/shared/version.d.ts +5 -0
  127. package/dist/tools/index.d.ts +4 -0
  128. package/dist/tools/permissions.d.ts +18 -0
  129. package/dist/tools/registry.d.ts +29 -0
  130. package/package.json +1 -1
package/README.md CHANGED
@@ -301,14 +301,25 @@ All hooks are enabled by default and can be disabled via the `disabled_hooks` co
301
301
 
302
302
  Weave supports MCP servers for extended capabilities. Built-in MCPs are:
303
303
 
304
- | MCP Server | Purpose | Default Agents |
305
- |------------|---------|----------------|
306
- | `websearch` | Web search via Exa AI | loom, tapestry, weft, warp |
307
- | `context7` | Library documentation lookup | loom, tapestry, spindle |
308
- | `grep_app` | Enhanced code search | loom, tapestry, thread, spindle, warp, shuttle |
304
+ | MCP Server | Purpose | Type | Default Agents |
305
+ |------------|---------|------|----------------|
306
+ | `websearch` | Web search via Exa AI | Remote | loom, tapestry, weft, warp |
307
+ | `context7` | Library documentation lookup | Remote | loom, tapestry, spindle |
308
+ | `grep_app` | Enhanced code search | Remote | loom, tapestry, thread, spindle, warp, shuttle |
309
309
 
310
310
  > **Note**: Orchestrator agents (loom, tapestry) get all MCPs by default for maximum capability.
311
311
 
312
+ #### Websearch Configuration
313
+
314
+ The `websearch` MCP uses **EXA's remote MCP server** for web search capabilities. It works out-of-the-box with rate-limited access, but for production use we recommend setting up your EXA API key:
315
+
316
+ ```bash
317
+ # Set EXA API key environment variable
318
+ export EXA_API_KEY="your-exa-api-key"
319
+ ```
320
+
321
+ The plugin automatically detects the `EXA_API_KEY` environment variable and includes it in requests for authenticated access with higher rate limits.
322
+
312
323
  #### Configuration
313
324
 
314
325
  ```jsonc
@@ -326,9 +337,9 @@ Weave supports MCP servers for extended capabilities. Built-in MCPs are:
326
337
  "mcp": {
327
338
  "servers": {
328
339
  "my-server": {
329
- "type": "stdio",
330
- "command": "npx",
331
- "args": ["-y", "my-mcp-server"]
340
+ "type": "local",
341
+ "command": ["npx", "-y", "my-mcp-server"],
342
+ "timeout": 60000
332
343
  }
333
344
  }
334
345
  },
@@ -345,6 +356,10 @@ Weave supports MCP servers for extended capabilities. Built-in MCPs are:
345
356
  }
346
357
  ```
347
358
 
359
+ > **MCP Server Types**:
360
+ > - `local` — Runs a local MCP server via command (stdio)
361
+ > - `remote` — Connects to a remote MCP server via HTTP
362
+
348
363
  See [Provider Configurations](./docs/provider-configurations.md) for model recommendations per agent.
349
364
 
350
365
  ### Skills
@@ -0,0 +1,49 @@
1
+ import type { AgentConfig } from '@opencode-ai/sdk';
2
+ import type { CategoriesConfig } from '../config/schema';
3
+ import type { AgentSource } from './types';
4
+ export type ResolveSkillsFn = (skillNames: string[], disabledSkills?: Set<string>) => string;
5
+ export type BuildAgentOptions = {
6
+ categories?: CategoriesConfig;
7
+ disabledSkills?: Set<string>;
8
+ resolveSkills?: ResolveSkillsFn;
9
+ disabledAgents?: Set<string>;
10
+ agentName?: string;
11
+ mcpConfig?: string[];
12
+ enabledMcps?: Set<string>;
13
+ };
14
+ /**
15
+ * Map from agent config key (lowercase) to display name variants that
16
+ * might appear in prompt text. Used by stripDisabledAgentReferences to
17
+ * remove lines that mention disabled agents.
18
+ *
19
+ * Exported for test cleanup — tests that call addBuiltinNameVariant
20
+ * must restore original arrays in afterEach to avoid state pollution.
21
+ */
22
+ export declare const AGENT_NAME_VARIANTS: Record<string, string[]>;
23
+ /**
24
+ * Reset the mutable name variants map to its initial state.
25
+ * Used by tests to prevent cross-test state pollution.
26
+ */
27
+ export declare function resetNameVariants(): void;
28
+ /**
29
+ * Register name variants for a custom agent so that
30
+ * `stripDisabledAgentReferences` can strip its references from prompts.
31
+ * Does not override existing (builtin) entries.
32
+ */
33
+ export declare function registerAgentNameVariants(name: string, variants?: string[]): void;
34
+ /**
35
+ * Add additional name variants for a builtin agent.
36
+ * Used when a user sets a custom display_name — the custom name
37
+ * must be included in variants so stripDisabledAgentReferences
38
+ * can match it when the agent is disabled.
39
+ * No-op if the config key has no existing variant entry or the variant is already present.
40
+ */
41
+ export declare function addBuiltinNameVariant(configKey: string, variant: string): void;
42
+ /**
43
+ * Remove lines from a prompt that reference disabled agents.
44
+ * Only strips lines where an agent name appears as a standalone concept
45
+ * (e.g. "Use thread (codebase explorer)"), not incidental word matches.
46
+ * Uses word-boundary matching to avoid false positives.
47
+ */
48
+ export declare function stripDisabledAgentReferences(prompt: string, disabled: Set<string>): string;
49
+ export declare function buildAgent(source: AgentSource, model: string, options?: BuildAgentOptions): AgentConfig;
@@ -0,0 +1,34 @@
1
+ import type { AgentConfig } from '@opencode-ai/sdk';
2
+ import type { AgentOverrideConfig, CategoriesConfig } from '../config/schema';
3
+ import type { ProjectFingerprint } from '../features/analytics/types';
4
+ import type { ResolveSkillsFn } from './agent-builder';
5
+ import type { AvailableAgent } from './dynamic-prompt-builder';
6
+ import type { AgentPromptMetadata, WeaveAgentName } from './types';
7
+ export interface CreateBuiltinAgentsOptions {
8
+ disabledAgents?: string[];
9
+ agentOverrides?: Record<string, AgentOverrideConfig>;
10
+ categories?: CategoriesConfig;
11
+ uiSelectedModel?: string;
12
+ systemDefaultModel?: string;
13
+ availableModels?: Set<string>;
14
+ disabledSkills?: Set<string>;
15
+ resolveSkills?: ResolveSkillsFn;
16
+ /** Project fingerprint for injecting project context into agent prompts */
17
+ fingerprint?: ProjectFingerprint | null;
18
+ /** Custom agent metadata for Loom's dynamic delegation prompt */
19
+ customAgentMetadata?: AvailableAgent[];
20
+ /** Set of enabled MCP servers */
21
+ enabledMcps?: Set<string>;
22
+ }
23
+ export declare const AGENT_METADATA: Record<WeaveAgentName, AgentPromptMetadata>;
24
+ /**
25
+ * Register metadata for a custom agent. Used by create-managers.ts
26
+ * to integrate custom agents into Loom's dynamic prompt builder.
27
+ */
28
+ export declare function registerCustomAgentMetadata(name: string, metadata: AgentPromptMetadata): void;
29
+ /**
30
+ * Get all agent metadata — builtins + registered custom agents.
31
+ * Returns a new merged record on each call.
32
+ */
33
+ export declare function getAllAgentMetadata(): Record<string, AgentPromptMetadata>;
34
+ export declare function createBuiltinAgents(options?: CreateBuiltinAgentsOptions): Record<string, AgentConfig>;
@@ -0,0 +1,24 @@
1
+ import type { AgentConfig } from "@opencode-ai/sdk";
2
+ import type { CustomAgentConfig } from "../config/schema";
3
+ import type { AgentPromptMetadata } from "./types";
4
+ import type { ResolveSkillsFn } from "./agent-builder";
5
+ export interface BuildCustomAgentOptions {
6
+ resolveSkills?: ResolveSkillsFn;
7
+ disabledSkills?: Set<string>;
8
+ availableModels?: Set<string>;
9
+ systemDefaultModel?: string;
10
+ uiSelectedModel?: string;
11
+ /** Base directory for resolving relative prompt_file paths */
12
+ configDir?: string;
13
+ }
14
+ /**
15
+ * Build an AgentConfig from a custom agent definition.
16
+ * Handles prompt resolution (inline, file, or skills), model resolution,
17
+ * and display name registration.
18
+ */
19
+ export declare function buildCustomAgent(name: string, config: CustomAgentConfig, options?: BuildCustomAgentOptions): AgentConfig;
20
+ /**
21
+ * Build AgentPromptMetadata for a custom agent from its config.
22
+ * Used to integrate custom agents into Loom's delegation table.
23
+ */
24
+ export declare function buildCustomAgentMetadata(name: string, config: CustomAgentConfig): AgentPromptMetadata;
@@ -0,0 +1,35 @@
1
+ import type { AgentPromptMetadata } from "./types";
2
+ import type { ProjectFingerprint } from "../features/analytics/types";
3
+ export interface AvailableAgent {
4
+ name: string;
5
+ description: string;
6
+ metadata: AgentPromptMetadata;
7
+ }
8
+ export interface AvailableTool {
9
+ name: string;
10
+ category: "lsp" | "ast" | "search" | "session" | "command" | "other";
11
+ }
12
+ export interface AvailableSkill {
13
+ name: string;
14
+ description: string;
15
+ location: "user" | "project" | "builtin";
16
+ }
17
+ export interface AvailableCategory {
18
+ name: string;
19
+ description: string;
20
+ model?: string;
21
+ }
22
+ export declare function categorizeTools(toolNames: string[]): AvailableTool[];
23
+ export declare function buildKeyTriggersSection(agents: AvailableAgent[], _skills?: AvailableSkill[]): string;
24
+ export declare function buildToolSelectionTable(agents: AvailableAgent[], tools?: AvailableTool[], _skills?: AvailableSkill[]): string;
25
+ export declare function buildThreadSection(agents: AvailableAgent[]): string;
26
+ export declare function buildSpindleSection(agents: AvailableAgent[]): string;
27
+ export declare function buildWeftSection(agents: AvailableAgent[]): string;
28
+ export declare function buildWarpSection(agents: AvailableAgent[]): string;
29
+ export declare function buildDelegationTable(agents: AvailableAgent[]): string;
30
+ export declare function buildCategorySkillsDelegationGuide(categories: AvailableCategory[], skills: AvailableSkill[]): string;
31
+ /**
32
+ * Build a project context section from a codebase fingerprint.
33
+ * Returns an empty string if no fingerprint is available.
34
+ */
35
+ export declare function buildProjectContextSection(fingerprint: ProjectFingerprint | null | undefined): string;
@@ -0,0 +1,12 @@
1
+ export { createBuiltinAgents, AGENT_METADATA, registerCustomAgentMetadata, getAllAgentMetadata } from "./builtin-agents";
2
+ export type { CreateBuiltinAgentsOptions } from "./builtin-agents";
3
+ export { buildAgent, stripDisabledAgentReferences } from "./agent-builder";
4
+ export type { BuildAgentOptions, ResolveSkillsFn } from "./agent-builder";
5
+ export { resolveAgentModel, AGENT_MODEL_REQUIREMENTS } from "./model-resolution";
6
+ export type { FallbackEntry, AgentModelRequirement, ResolveAgentModelOptions } from "./model-resolution";
7
+ export { buildCustomAgent, buildCustomAgentMetadata } from "./custom-agent-factory";
8
+ export type { BuildCustomAgentOptions } from "./custom-agent-factory";
9
+ export { loadPromptFile } from "./prompt-loader";
10
+ export * from "./dynamic-prompt-builder";
11
+ export type { AgentMode, AgentFactory, AgentSource, AgentCategory, AgentCost, DelegationTrigger, AgentPromptMetadata, WeaveAgentName, } from "./types";
12
+ export { isFactory, isGptModel } from "./types";
@@ -0,0 +1,2 @@
1
+ import type { AgentConfig } from "@opencode-ai/sdk";
2
+ export declare const LOOM_DEFAULTS: AgentConfig;
@@ -0,0 +1,11 @@
1
+ import type { AgentConfig } from "@opencode-ai/sdk";
2
+ import type { AgentFactory } from "../types";
3
+ import type { AvailableAgent } from "../dynamic-prompt-builder";
4
+ import type { ProjectFingerprint } from "../../features/analytics/types";
5
+ export { composeLoomPrompt } from "./prompt-composer";
6
+ export type { LoomPromptOptions } from "./prompt-composer";
7
+ /**
8
+ * Create a Loom agent config with optional disabled agents, fingerprint, and custom agents for prompt composition.
9
+ */
10
+ export declare function createLoomAgentWithOptions(model: string, disabledAgents?: Set<string>, fingerprint?: ProjectFingerprint | null, customAgents?: AvailableAgent[]): AgentConfig;
11
+ export declare const createLoomAgent: AgentFactory;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Loom prompt composer — assembles the Loom system prompt from sections,
3
+ * conditionally including/excluding content based on enabled agents.
4
+ *
5
+ * Default behavior (no disabled agents) produces identical output to the
6
+ * hardcoded LOOM_DEFAULTS.prompt string.
7
+ */
8
+ import type { ProjectFingerprint } from "../../features/analytics/types";
9
+ import type { AvailableAgent } from "../dynamic-prompt-builder";
10
+ export interface LoomPromptOptions {
11
+ /** Set of disabled agent names (lowercase config keys) */
12
+ disabledAgents?: Set<string>;
13
+ /** Project fingerprint for injecting project context into the prompt */
14
+ fingerprint?: ProjectFingerprint | null;
15
+ /** Custom agent metadata for dynamic delegation sections */
16
+ customAgents?: AvailableAgent[];
17
+ }
18
+ export declare function buildRoleSection(): string;
19
+ export declare function buildDisciplineSection(): string;
20
+ export declare function buildSidebarTodosSection(): string;
21
+ export declare function buildDelegationSection(disabled: Set<string>): string;
22
+ export declare function buildDelegationNarrationSection(disabled?: Set<string>): string;
23
+ export declare function buildPlanWorkflowSection(disabled: Set<string>): string;
24
+ export declare function buildReviewWorkflowSection(disabled: Set<string>): string;
25
+ export declare function buildStyleSection(): string;
26
+ /**
27
+ * Build a delegation section for custom agents.
28
+ * Returns empty string if no enabled custom agents exist.
29
+ */
30
+ export declare function buildCustomAgentDelegationSection(customAgents: AvailableAgent[], disabled: Set<string>): string;
31
+ /**
32
+ * Compose the full Loom system prompt from sections.
33
+ * When no agents are disabled, produces identical output to LOOM_DEFAULTS.prompt.
34
+ */
35
+ export declare function composeLoomPrompt(options?: LoomPromptOptions): string;
@@ -0,0 +1,27 @@
1
+ import type { AgentMode, WeaveAgentName } from "./types";
2
+ export type FallbackEntry = {
3
+ providers: string[];
4
+ model: string;
5
+ variant?: string;
6
+ };
7
+ export type AgentModelRequirement = {
8
+ fallbackChain: FallbackEntry[];
9
+ };
10
+ export declare const AGENT_MODEL_REQUIREMENTS: Record<WeaveAgentName, AgentModelRequirement>;
11
+ export type ResolveAgentModelOptions = {
12
+ availableModels: Set<string>;
13
+ agentMode: AgentMode;
14
+ uiSelectedModel?: string;
15
+ categoryModel?: string;
16
+ overrideModel?: string;
17
+ systemDefaultModel?: string;
18
+ /** Custom fallback chain for agents not in AGENT_MODEL_REQUIREMENTS */
19
+ customFallbackChain?: FallbackEntry[];
20
+ };
21
+ /**
22
+ * Resolve the model for an agent. Accepts any string agent name.
23
+ * Built-in agents use AGENT_MODEL_REQUIREMENTS for fallback chains.
24
+ * Custom agents use the customFallbackChain option, or fall through
25
+ * to system default / hardcoded fallback.
26
+ */
27
+ export declare function resolveAgentModel(agentName: string, options: ResolveAgentModelOptions): string;
@@ -0,0 +1,2 @@
1
+ import type { AgentConfig } from "@opencode-ai/sdk";
2
+ export declare const PATTERN_DEFAULTS: AgentConfig;
@@ -0,0 +1,2 @@
1
+ import type { AgentFactory } from "../types";
2
+ export declare const createPatternAgent: AgentFactory;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Load a prompt from a file path. Supports .md and .txt files.
3
+ * Paths are sandboxed to basePath (or cwd) — traversal outside is rejected.
4
+ *
5
+ * @param promptFilePath - Path to the prompt file (relative to basePath; absolute paths are rejected)
6
+ * @param basePath - Base directory for resolving relative paths (defaults to cwd)
7
+ * @returns The file contents as a string, or null if the file doesn't exist or path escapes the sandbox
8
+ */
9
+ export declare function loadPromptFile(promptFilePath: string, basePath?: string): string | null;
@@ -0,0 +1,2 @@
1
+ /** Check whether an agent is enabled (not in the disabled set). */
2
+ export declare function isAgentEnabled(name: string, disabled: Set<string>): boolean;
@@ -0,0 +1,2 @@
1
+ import type { AgentConfig } from "@opencode-ai/sdk";
2
+ export declare const SHUTTLE_DEFAULTS: AgentConfig;
@@ -0,0 +1,2 @@
1
+ import type { AgentFactory } from "../types";
2
+ export declare const createShuttleAgent: AgentFactory;
@@ -0,0 +1,2 @@
1
+ import type { AgentConfig } from "@opencode-ai/sdk";
2
+ export declare const SPINDLE_DEFAULTS: AgentConfig;
@@ -0,0 +1,2 @@
1
+ import type { AgentFactory } from "../types";
2
+ export declare const createSpindleAgent: AgentFactory;
@@ -0,0 +1,2 @@
1
+ import type { AgentConfig } from "@opencode-ai/sdk";
2
+ export declare const TAPESTRY_DEFAULTS: AgentConfig;
@@ -0,0 +1,9 @@
1
+ import type { AgentConfig } from "@opencode-ai/sdk";
2
+ import type { AgentFactory } from "../types";
3
+ export { composeTapestryPrompt } from "./prompt-composer";
4
+ export type { TapestryPromptOptions } from "./prompt-composer";
5
+ /**
6
+ * Create a Tapestry agent config with optional disabled agents for prompt composition.
7
+ */
8
+ export declare function createTapestryAgentWithOptions(model: string, disabledAgents?: Set<string>): AgentConfig;
9
+ export declare const createTapestryAgent: AgentFactory;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Tapestry prompt composer — assembles the Tapestry system prompt from sections,
3
+ * conditionally including/excluding content based on enabled agents.
4
+ *
5
+ * Default behavior (no disabled agents) produces identical output to the
6
+ * hardcoded TAPESTRY_DEFAULTS.prompt string.
7
+ */
8
+ export interface TapestryPromptOptions {
9
+ /** Set of disabled agent names (lowercase config keys) */
10
+ disabledAgents?: Set<string>;
11
+ }
12
+ export declare function buildTapestryRoleSection(): string;
13
+ export declare function buildTapestryDisciplineSection(): string;
14
+ export declare function buildTapestrySidebarTodosSection(): string;
15
+ export declare function buildTapestryPlanExecutionSection(disabled?: Set<string>): string;
16
+ export declare function buildTapestryVerificationSection(): string;
17
+ export declare function buildTapestryPostExecutionReviewSection(disabled: Set<string>): string;
18
+ export declare function buildTapestryExecutionSection(): string;
19
+ export declare function buildTapestryStyleSection(): string;
20
+ /**
21
+ * Compose the full Tapestry system prompt from sections.
22
+ * When no agents are disabled, produces identical output to TAPESTRY_DEFAULTS.prompt.
23
+ */
24
+ export declare function composeTapestryPrompt(options?: TapestryPromptOptions): string;
@@ -0,0 +1,2 @@
1
+ import type { AgentConfig } from "@opencode-ai/sdk";
2
+ export declare const THREAD_DEFAULTS: AgentConfig;
@@ -0,0 +1,2 @@
1
+ import type { AgentFactory } from "../types";
2
+ export declare const createThreadAgent: AgentFactory;
@@ -0,0 +1,82 @@
1
+ import type { AgentConfig } from "@opencode-ai/sdk";
2
+ /**
3
+ * Agent mode determines UI model selection behavior:
4
+ * - "primary": Respects user's UI-selected model (loom, tapestry)
5
+ * - "subagent": Uses own fallback chain, ignores UI selection (pattern, thread, spindle)
6
+ * - "all": Available in both contexts (shuttle)
7
+ */
8
+ export type AgentMode = "primary" | "subagent" | "all";
9
+ /**
10
+ * Agent factory function with static mode property.
11
+ * Mode is exposed as static property for pre-instantiation access.
12
+ */
13
+ export type AgentFactory = ((model: string) => AgentConfig) & {
14
+ mode: AgentMode;
15
+ };
16
+ /**
17
+ * Agent source is either a factory (called with model) or a static config (cloned)
18
+ */
19
+ export type AgentSource = AgentFactory | AgentConfig;
20
+ /**
21
+ * Agent category for grouping in Loom prompt sections
22
+ */
23
+ export type AgentCategory = "exploration" | "specialist" | "advisor" | "utility";
24
+ /**
25
+ * Cost classification for Tool Selection table
26
+ */
27
+ export type AgentCost = "FREE" | "CHEAP" | "EXPENSIVE";
28
+ /**
29
+ * Delegation trigger for Loom prompt's Delegation Table
30
+ */
31
+ export interface DelegationTrigger {
32
+ /** Domain of work (e.g., "Frontend UI/UX") */
33
+ domain: string;
34
+ /** When to delegate (e.g., "Visual changes only...") */
35
+ trigger: string;
36
+ }
37
+ /**
38
+ * Metadata for generating Loom prompt sections dynamically.
39
+ * Allows adding/removing agents without manually updating the Loom prompt.
40
+ */
41
+ export interface AgentPromptMetadata {
42
+ /** Category for grouping in prompt sections */
43
+ category: AgentCategory;
44
+ /** Cost classification for Tool Selection table */
45
+ cost: AgentCost;
46
+ /** Domain triggers for Delegation Table */
47
+ triggers: DelegationTrigger[];
48
+ /** When to use this agent (for detailed sections) */
49
+ useWhen?: string[];
50
+ /** When NOT to use this agent */
51
+ avoidWhen?: string[];
52
+ /** Optional dedicated prompt section (markdown) */
53
+ dedicatedSection?: string;
54
+ /** Nickname/alias used in prompt (e.g., "Pattern" instead of "pattern") */
55
+ promptAlias?: string;
56
+ /** Key trigger that should appear in Phase 0 quick checks */
57
+ keyTrigger?: string;
58
+ }
59
+ /**
60
+ * The 8 built-in Weave agent names
61
+ */
62
+ export type WeaveAgentName = "loom" | "tapestry" | "shuttle" | "pattern" | "thread" | "spindle" | "weft" | "warp";
63
+ /**
64
+ * Override config for a single agent — all fields optional
65
+ */
66
+ export type AgentOverrideConfig = Partial<AgentConfig> & {
67
+ prompt_append?: string;
68
+ variant?: string;
69
+ fallback_models?: string | string[];
70
+ };
71
+ /**
72
+ * Map of agent name to override config
73
+ */
74
+ export type AgentOverrides = Partial<Record<WeaveAgentName, AgentOverrideConfig>>;
75
+ /**
76
+ * Returns true if the model string identifies a GPT/OpenAI model.
77
+ */
78
+ export declare function isGptModel(model: string): boolean;
79
+ /**
80
+ * Type guard: returns true if source is an AgentFactory (callable with .mode).
81
+ */
82
+ export declare function isFactory(source: AgentSource): source is AgentFactory;
@@ -0,0 +1,2 @@
1
+ import type { AgentConfig } from "@opencode-ai/sdk";
2
+ export declare const WARP_DEFAULTS: AgentConfig;
@@ -0,0 +1,2 @@
1
+ import type { AgentFactory } from "../types";
2
+ export declare const createWarpAgent: AgentFactory;
@@ -0,0 +1,2 @@
1
+ import type { AgentConfig } from "@opencode-ai/sdk";
2
+ export declare const WEFT_DEFAULTS: AgentConfig;
@@ -0,0 +1,2 @@
1
+ import type { AgentFactory } from "../types";
2
+ export declare const createWeftAgent: AgentFactory;
@@ -0,0 +1,3 @@
1
+ export * from "./schema";
2
+ export { loadWeaveConfig } from "./loader";
3
+ export { mergeConfigs } from "./merge";
@@ -0,0 +1,2 @@
1
+ import { type WeaveConfig } from "./schema";
2
+ export declare function loadWeaveConfig(directory: string, _ctx?: unknown, _homeDir?: string): WeaveConfig;
@@ -0,0 +1,3 @@
1
+ import type { WeaveConfig } from "./schema";
2
+ import type { DeepPartial } from "../shared/types";
3
+ export declare function mergeConfigs(user: DeepPartial<WeaveConfig>, project: DeepPartial<WeaveConfig>): DeepPartial<WeaveConfig>;