maskweaver 0.9.4 → 0.9.6

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 (229) hide show
  1. package/README.ko.md +638 -592
  2. package/README.md +671 -667
  3. package/dist/cli/doctor.js +5 -21
  4. package/dist/cli/install.d.ts +0 -8
  5. package/dist/cli/install.js +0 -39
  6. package/dist/context/config.d.ts +0 -22
  7. package/dist/context/config.js +0 -28
  8. package/dist/context/feature.d.ts +0 -39
  9. package/dist/context/feature.js +0 -77
  10. package/dist/context/files.d.ts +0 -13
  11. package/dist/context/files.js +1 -24
  12. package/dist/context/index.d.ts +0 -7
  13. package/dist/context/index.js +0 -12
  14. package/dist/context/project.d.ts +0 -21
  15. package/dist/context/project.js +0 -30
  16. package/dist/context/types.d.ts +0 -48
  17. package/dist/context/types.js +0 -12
  18. package/dist/context/utils.d.ts +0 -18
  19. package/dist/context/utils.js +0 -27
  20. package/dist/core/engine/promptBuilder.d.ts +0 -17
  21. package/dist/core/engine/promptBuilder.js +0 -28
  22. package/dist/core/index.d.ts +0 -6
  23. package/dist/core/index.js +0 -9
  24. package/dist/core/loader/MaskLoader.d.ts +0 -23
  25. package/dist/core/loader/MaskLoader.js +0 -29
  26. package/dist/core/schema/types.d.ts +0 -47
  27. package/dist/core/schema/types.js +0 -6
  28. package/dist/core/schema/validator.d.ts +0 -14
  29. package/dist/core/schema/validator.js +0 -18
  30. package/dist/i18n/index.d.ts +0 -18
  31. package/dist/i18n/index.js +4 -23
  32. package/dist/index.d.ts +0 -8
  33. package/dist/index.js +0 -8
  34. package/dist/lib.d.ts +0 -5
  35. package/dist/lib.js +0 -12
  36. package/dist/memory/chunking.d.ts +0 -22
  37. package/dist/memory/chunking.js +2 -37
  38. package/dist/memory/core.d.ts +0 -29
  39. package/dist/memory/core.js +1 -52
  40. package/dist/memory/index.d.ts +0 -5
  41. package/dist/memory/index.js +0 -10
  42. package/dist/memory/indexer.d.ts +0 -21
  43. package/dist/memory/indexer.js +0 -44
  44. package/dist/memory/providers/examples.d.ts +0 -5
  45. package/dist/memory/providers/examples.js +4 -64
  46. package/dist/memory/providers/factory.d.ts +0 -44
  47. package/dist/memory/providers/factory.js +0 -46
  48. package/dist/memory/providers/index.d.ts +0 -26
  49. package/dist/memory/providers/index.js +0 -28
  50. package/dist/memory/providers/ollama.d.ts +0 -6
  51. package/dist/memory/providers/ollama.js +1 -8
  52. package/dist/memory/providers/openai.d.ts +0 -6
  53. package/dist/memory/providers/openai.js +1 -8
  54. package/dist/memory/providers/openrouter.d.ts +0 -6
  55. package/dist/memory/providers/openrouter.js +0 -8
  56. package/dist/memory/providers/text-only.d.ts +0 -13
  57. package/dist/memory/providers/text-only.js +0 -17
  58. package/dist/memory/providers/types.d.ts +0 -39
  59. package/dist/memory/providers/types.js +0 -7
  60. package/dist/memory/providers/voyage.d.ts +0 -22
  61. package/dist/memory/providers/voyage.js +1 -24
  62. package/dist/memory/search/hybrid.d.ts +0 -12
  63. package/dist/memory/search/hybrid.js +1 -22
  64. package/dist/memory/store/sqlite.d.ts +0 -72
  65. package/dist/memory/store/sqlite.js +4 -127
  66. package/dist/plugin/config/index.d.ts +0 -112
  67. package/dist/plugin/config/index.js +0 -115
  68. package/dist/plugin/index.d.ts +0 -13
  69. package/dist/plugin/index.js +1 -123
  70. package/dist/plugin/tools/command-registry.d.ts +0 -6
  71. package/dist/plugin/tools/command-registry.js +0 -14
  72. package/dist/plugin/tools/context.d.ts +0 -12
  73. package/dist/plugin/tools/context.js +0 -58
  74. package/dist/plugin/tools/maskSave.d.ts +0 -3
  75. package/dist/plugin/tools/maskSave.js +0 -3
  76. package/dist/plugin/tools/memoryGet.d.ts +0 -3
  77. package/dist/plugin/tools/memoryGet.js +0 -3
  78. package/dist/plugin/tools/memoryIndexer.d.ts +0 -3
  79. package/dist/plugin/tools/memoryIndexer.js +0 -10
  80. package/dist/plugin/tools/memorySearch.d.ts +0 -31
  81. package/dist/plugin/tools/memorySearch.js +0 -79
  82. package/dist/plugin/tools/memoryWrite.d.ts +0 -8
  83. package/dist/plugin/tools/memoryWrite.js +0 -32
  84. package/dist/plugin/tools/retrospect.d.ts +0 -3
  85. package/dist/plugin/tools/retrospect.js +0 -3
  86. package/dist/plugin/tools/slashcommand.d.ts +0 -11
  87. package/dist/plugin/tools/slashcommand.js +0 -38
  88. package/dist/plugin/tools/squad.d.ts +0 -12
  89. package/dist/plugin/tools/squad.js +11 -83
  90. package/dist/plugin/tools/weave.d.ts +0 -6
  91. package/dist/plugin/tools/weave.js +0 -78
  92. package/dist/plugin/types.d.ts +0 -20
  93. package/dist/plugin/types.js +0 -7
  94. package/dist/retrospect/index.d.ts +0 -7
  95. package/dist/retrospect/index.js +0 -9
  96. package/dist/retrospect/mask-save.d.ts +0 -12
  97. package/dist/retrospect/mask-save.js +1 -80
  98. package/dist/retrospect/retrospect.d.ts +0 -18
  99. package/dist/retrospect/retrospect.js +0 -63
  100. package/dist/retrospect/strategies/base.d.ts +0 -15
  101. package/dist/retrospect/strategies/base.js +0 -7
  102. package/dist/retrospect/strategies/deep.d.ts +0 -12
  103. package/dist/retrospect/strategies/deep.js +0 -24
  104. package/dist/retrospect/strategies/index.d.ts +0 -12
  105. package/dist/retrospect/strategies/index.js +0 -12
  106. package/dist/retrospect/strategies/quick.d.ts +0 -12
  107. package/dist/retrospect/strategies/quick.js +0 -19
  108. package/dist/retrospect/strategies/standard.d.ts +0 -12
  109. package/dist/retrospect/strategies/standard.js +0 -15
  110. package/dist/retrospect/types.d.ts +0 -7
  111. package/dist/retrospect/types.js +0 -7
  112. package/dist/shared/config.d.ts +0 -105
  113. package/dist/shared/config.js +0 -33
  114. package/dist/shared/errors.d.ts +0 -18
  115. package/dist/shared/errors.js +0 -19
  116. package/dist/shared/generate-agents.d.ts +0 -69
  117. package/dist/shared/generate-agents.js +2 -86
  118. package/dist/shared/image.d.ts +0 -67
  119. package/dist/shared/image.js +6 -104
  120. package/dist/shared/index.d.ts +0 -5
  121. package/dist/shared/index.js +0 -7
  122. package/dist/shared/model-registry.d.ts +0 -72
  123. package/dist/shared/model-registry.js +5 -95
  124. package/dist/shared/types.d.ts +0 -15
  125. package/dist/shared/types.js +0 -3
  126. package/dist/shared-context/dag.d.ts +0 -105
  127. package/dist/shared-context/dag.js +3 -114
  128. package/dist/shared-context/index.d.ts +0 -5
  129. package/dist/shared-context/index.js +0 -15
  130. package/dist/shared-context/logger.d.ts +0 -37
  131. package/dist/shared-context/logger.js +0 -41
  132. package/dist/shared-context/parallel-executor.d.ts +0 -54
  133. package/dist/shared-context/parallel-executor.js +4 -56
  134. package/dist/shared-context/session.d.ts +0 -56
  135. package/dist/shared-context/session.js +0 -47
  136. package/dist/shared-context/squad.d.ts +0 -68
  137. package/dist/shared-context/squad.js +0 -63
  138. package/dist/shared-context/storage.d.ts +0 -132
  139. package/dist/shared-context/storage.js +0 -116
  140. package/dist/shared-context/task.d.ts +0 -120
  141. package/dist/shared-context/task.js +0 -152
  142. package/dist/shared-context/test/dag.test.js +9 -14
  143. package/dist/shared-context/test/logger.test.d.ts +0 -8
  144. package/dist/shared-context/test/logger.test.js +0 -52
  145. package/dist/shared-context/test/session.test.d.ts +0 -7
  146. package/dist/shared-context/test/session.test.js +0 -63
  147. package/dist/shared-context/test/squad.test.d.ts +0 -10
  148. package/dist/shared-context/test/squad.test.js +2 -68
  149. package/dist/shared-context/test/storage.test.d.ts +0 -8
  150. package/dist/shared-context/test/storage.test.js +0 -68
  151. package/dist/shared-context/test/task.test.d.ts +0 -7
  152. package/dist/shared-context/test/task.test.js +0 -54
  153. package/dist/shared-context/test/watchdog.test.d.ts +0 -7
  154. package/dist/shared-context/test/watchdog.test.js +3 -58
  155. package/dist/shared-context/types.d.ts +0 -215
  156. package/dist/shared-context/types.js +0 -125
  157. package/dist/shared-context/watchdog.d.ts +0 -127
  158. package/dist/shared-context/watchdog.js +0 -148
  159. package/dist/shared-context/worktree.d.ts +0 -68
  160. package/dist/shared-context/worktree.js +2 -34
  161. package/dist/verify/budget.d.ts +0 -29
  162. package/dist/verify/budget.js +0 -34
  163. package/dist/verify/critical-files.d.ts +0 -17
  164. package/dist/verify/critical-files.js +0 -37
  165. package/dist/verify/escalation.d.ts +0 -20
  166. package/dist/verify/escalation.js +0 -22
  167. package/dist/verify/index.d.ts +0 -5
  168. package/dist/verify/index.js +0 -11
  169. package/dist/verify/prompts.d.ts +0 -20
  170. package/dist/verify/prompts.js +0 -20
  171. package/dist/verify/types.d.ts +0 -26
  172. package/dist/verify/types.js +1 -12
  173. package/dist/verify/verifier.d.ts +0 -29
  174. package/dist/verify/verifier.js +0 -54
  175. package/dist/version.d.ts +1 -16
  176. package/dist/version.js +1 -16
  177. package/dist/weave/bridge.d.ts +0 -35
  178. package/dist/weave/bridge.js +0 -51
  179. package/dist/weave/environment/detector.d.ts +0 -6
  180. package/dist/weave/environment/detector.js +4 -45
  181. package/dist/weave/environment/index.d.ts +0 -19
  182. package/dist/weave/environment/index.js +1 -39
  183. package/dist/weave/environment/issues.d.ts +0 -35
  184. package/dist/weave/environment/issues.js +0 -59
  185. package/dist/weave/git.d.ts +0 -8
  186. package/dist/weave/git.js +0 -8
  187. package/dist/weave/index.d.ts +0 -13
  188. package/dist/weave/index.js +2 -28
  189. package/dist/weave/knowledge/global.d.ts +0 -39
  190. package/dist/weave/knowledge/global.js +2 -78
  191. package/dist/weave/loop.js +0 -3
  192. package/dist/weave/orchestrator.d.ts +0 -69
  193. package/dist/weave/orchestrator.js +1 -101
  194. package/dist/weave/phase-manager.d.ts +0 -64
  195. package/dist/weave/phase-manager.js +0 -89
  196. package/dist/weave/security/secret-scan.d.ts +0 -14
  197. package/dist/weave/security/secret-scan.js +0 -19
  198. package/dist/weave/stages/build.js +0 -15
  199. package/dist/weave/stages/execute.d.ts +0 -42
  200. package/dist/weave/stages/execute.js +4 -86
  201. package/dist/weave/stages/handoff.d.ts +0 -7
  202. package/dist/weave/stages/handoff.js +0 -43
  203. package/dist/weave/stages/index.d.ts +0 -3
  204. package/dist/weave/stages/index.js +0 -3
  205. package/dist/weave/stages/intake.d.ts +0 -8
  206. package/dist/weave/stages/intake.js +5 -65
  207. package/dist/weave/stages/map.d.ts +0 -1
  208. package/dist/weave/stages/openspec.d.ts +0 -1
  209. package/dist/weave/stages/plan.d.ts +0 -11
  210. package/dist/weave/stages/plan.js +1 -53
  211. package/dist/weave/stages/refine.d.ts +0 -7
  212. package/dist/weave/stages/refine.js +0 -7
  213. package/dist/weave/stages/research.d.ts +0 -6
  214. package/dist/weave/stages/research.js +0 -6
  215. package/dist/weave/stages/spec.d.ts +0 -12
  216. package/dist/weave/stages/spec.js +0 -17
  217. package/dist/weave/types.d.ts +0 -20
  218. package/dist/weave/types.js +0 -5
  219. package/dist/weave/verification/commands.d.ts +0 -12
  220. package/dist/weave/verification/commands.js +0 -19
  221. package/dist/weave/verification/index.d.ts +0 -6
  222. package/dist/weave/verification/index.js +1 -19
  223. package/dist/weave/verification/playwright.d.ts +0 -47
  224. package/dist/weave/verification/playwright.js +1 -90
  225. package/dist/weave/worktree.d.ts +0 -16
  226. package/dist/weave/worktree.js +0 -23
  227. package/dist/weave/yaml-repair.d.ts +0 -39
  228. package/dist/weave/yaml-repair.js +13 -116
  229. package/package.json +1 -1
@@ -1,9 +1,6 @@
1
1
  import * as fs from "node:fs";
2
2
  import * as os from "node:os";
3
3
  import * as path from "node:path";
4
- /**
5
- * Default configuration
6
- */
7
4
  export const DEFAULT_CONFIG = {
8
5
  features: {
9
6
  context: { enabled: true },
@@ -12,24 +9,16 @@ export const DEFAULT_CONFIG = {
12
9
  level: "info",
13
10
  },
14
11
  };
15
- /** Type guard for pool format */
16
12
  export function isPoolConfig(config) {
17
13
  return 'pool' in config && Array.isArray(config.pool);
18
14
  }
19
- /**
20
- * Normalize legacy config to pool entries.
21
- * Converts { flash: "model-a", human: "model-b", premium: "model-c" }
22
- * into ModelPoolEntry[] with sensible defaults.
23
- */
24
15
  export function normalizeDummyHumansConfig(config) {
25
- // Defensive guard: if called with null/undefined at runtime, return empty
26
16
  if (!config || typeof config !== 'object') {
27
17
  return [];
28
18
  }
29
19
  if (isPoolConfig(config)) {
30
20
  return config.pool;
31
21
  }
32
- // Legacy format → convert to pool entries
33
22
  const tierDefaults = {
34
23
  flash: { tier: 'flash', costTier: 'low', maxConcurrent: 5, capabilities: ['search', 'formatting', 'simple-coding', 'file-ops'] },
35
24
  human: { tier: 'human', costTier: 'medium', maxConcurrent: 2, capabilities: ['coding', 'testing', 'refactoring'] },
@@ -48,16 +37,7 @@ export function normalizeDummyHumansConfig(config) {
48
37
  }
49
38
  let cachedRuntimeConfig = null;
50
39
  let cachedConfigPath = null;
51
- /**
52
- * Load maskweaver.config.json from project root or global config
53
- *
54
- * Searches in order:
55
- * 1. {basePath}/maskweaver.config.json
56
- * 2. {basePath}/.opencode/maskweaver.config.json
57
- * 3. ~/.config/opencode/maskweaver.config.json (global fallback)
58
- */
59
40
  export function loadRuntimeConfig(basePath = process.cwd()) {
60
- // Return cached config if same path
61
41
  if (cachedRuntimeConfig && cachedConfigPath === basePath) {
62
42
  return cachedRuntimeConfig;
63
43
  }
@@ -80,35 +60,22 @@ export function loadRuntimeConfig(basePath = process.cwd()) {
80
60
  }
81
61
  }
82
62
  }
83
- // Return empty config if not found
84
63
  cachedRuntimeConfig = {};
85
64
  cachedConfigPath = basePath;
86
65
  return {};
87
66
  }
88
- /**
89
- * Get memory provider configuration from runtime config
90
- */
91
67
  export function getMemoryProviderConfig(basePath = process.cwd()) {
92
68
  const config = loadRuntimeConfig(basePath);
93
69
  return config.memory;
94
70
  }
95
- /**
96
- * Get GDC integration configuration from runtime config
97
- */
98
71
  export function getGdcConfig(basePath = process.cwd()) {
99
72
  const config = loadRuntimeConfig(basePath);
100
73
  return config.gdc;
101
74
  }
102
- /**
103
- * Get operator model configuration from runtime config
104
- */
105
75
  export function getOperatorConfig(basePath = process.cwd()) {
106
76
  const config = loadRuntimeConfig(basePath);
107
77
  return config.operator;
108
78
  }
109
- /**
110
- * Clear cached runtime config (for testing)
111
- */
112
79
  export function clearRuntimeConfigCache() {
113
80
  cachedRuntimeConfig = null;
114
81
  cachedConfigPath = null;
@@ -1,35 +1,17 @@
1
- /**
2
- * Error handling for Maskweaver
3
- */
4
- /**
5
- * Base error class for all Maskweaver errors
6
- */
7
1
  export declare class MaskweaverError extends Error {
8
2
  readonly code?: string | undefined;
9
3
  readonly context?: Record<string, unknown> | undefined;
10
4
  constructor(message: string, code?: string | undefined, context?: Record<string, unknown> | undefined);
11
5
  }
12
- /**
13
- * Configuration error
14
- */
15
6
  export declare class ConfigError extends MaskweaverError {
16
7
  constructor(message: string, context?: Record<string, unknown>);
17
8
  }
18
- /**
19
- * Provider error (for memory providers, etc.)
20
- */
21
9
  export declare class ProviderError extends MaskweaverError {
22
10
  constructor(message: string, context?: Record<string, unknown>);
23
11
  }
24
- /**
25
- * Storage error
26
- */
27
12
  export declare class StorageError extends MaskweaverError {
28
13
  constructor(message: string, context?: Record<string, unknown>);
29
14
  }
30
- /**
31
- * Validation error
32
- */
33
15
  export declare class ValidationError extends MaskweaverError {
34
16
  constructor(message: string, context?: Record<string, unknown>);
35
17
  }
@@ -1,9 +1,3 @@
1
- /**
2
- * Error handling for Maskweaver
3
- */
4
- /**
5
- * Base error class for all Maskweaver errors
6
- */
7
1
  export class MaskweaverError extends Error {
8
2
  code;
9
3
  context;
@@ -12,42 +6,29 @@ export class MaskweaverError extends Error {
12
6
  this.code = code;
13
7
  this.context = context;
14
8
  this.name = "MaskweaverError";
15
- // Maintains proper stack trace for where our error was thrown (only available on V8)
16
9
  if (Error.captureStackTrace) {
17
10
  Error.captureStackTrace(this, MaskweaverError);
18
11
  }
19
12
  }
20
13
  }
21
- /**
22
- * Configuration error
23
- */
24
14
  export class ConfigError extends MaskweaverError {
25
15
  constructor(message, context) {
26
16
  super(message, "CONFIG_ERROR", context);
27
17
  this.name = "ConfigError";
28
18
  }
29
19
  }
30
- /**
31
- * Provider error (for memory providers, etc.)
32
- */
33
20
  export class ProviderError extends MaskweaverError {
34
21
  constructor(message, context) {
35
22
  super(message, "PROVIDER_ERROR", context);
36
23
  this.name = "ProviderError";
37
24
  }
38
25
  }
39
- /**
40
- * Storage error
41
- */
42
26
  export class StorageError extends MaskweaverError {
43
27
  constructor(message, context) {
44
28
  super(message, "STORAGE_ERROR", context);
45
29
  this.name = "StorageError";
46
30
  }
47
31
  }
48
- /**
49
- * Validation error
50
- */
51
32
  export class ValidationError extends MaskweaverError {
52
33
  constructor(message, context) {
53
34
  super(message, "VALIDATION_ERROR", context);
@@ -1,65 +1,22 @@
1
- /**
2
- * Generate Agent Files from Pool Configuration
3
- *
4
- * Shared utility to create/update dummy-human agent .md files from
5
- * maskweaver.config.json pool entries. Used by both:
6
- * - Plugin startup (auto-generate if not exists)
7
- * - `weave sync-agents` command (force overwrite from user config)
8
- */
9
1
  import type { ModelPoolEntry } from './config.js';
10
2
  export interface GenerateAgentsResult {
11
- /** Files that were created (did not exist before) */
12
3
  created: string[];
13
- /** Files that were updated (existed and were overwritten) */
14
4
  updated: string[];
15
- /** Files that were skipped (existed and force was false) */
16
5
  skipped: string[];
17
- /** Error messages */
18
6
  errors: string[];
19
7
  }
20
8
  export interface GenerateAgentsOptions {
21
- /** Force overwrite existing files (default: false) */
22
9
  force?: boolean;
23
- /** Base project directory */
24
10
  projectDir?: string;
25
- /** Custom agents output directory (default: {projectDir}/.opencode/agents) */
26
11
  agentsDir?: string;
27
- /** Custom pool entries (if not provided, reads from config) */
28
12
  pool?: ModelPoolEntry[];
29
13
  }
30
- /**
31
- * Generate agent files from a ModelPoolEntry array.
32
- *
33
- * @param pool - Array of model pool entries
34
- * @param agentsDir - Output directory for agent .md files
35
- * @param options - Force overwrite option
36
- * @returns Result summary
37
- */
38
14
  export declare function generatePoolAgentFiles(pool: ModelPoolEntry[], agentsDir: string, options?: {
39
15
  force?: boolean;
40
16
  }): GenerateAgentsResult;
41
- /**
42
- * Read maskweaver.config.json (project or global) and generate agent files.
43
- *
44
- * Search order:
45
- * 1. {projectDir}/maskweaver.config.json
46
- * 2. {projectDir}/.opencode/maskweaver.config.json
47
- * 3. ~/.config/opencode/maskweaver.config.json (user global)
48
- *
49
- * @param projectDir - Project base directory
50
- * @param agentsDir - Output directory for agent .md files
51
- * @param options - Force overwrite and other options
52
- * @returns Result summary
53
- */
54
17
  export declare function generatePoolAgentFilesFromConfig(projectDir: string, agentsDir: string, options?: {
55
18
  force?: boolean;
56
19
  }): GenerateAgentsResult;
57
- /**
58
- * Default runtime config template (maskweaver.config.json).
59
- *
60
- * This is a minimal template with the standard tier entries but WITHOUT
61
- * model names — users must fill in their actual model IDs.
62
- */
63
20
  export declare const DEFAULT_RUNTIME_CONFIG_TEMPLATE: {
64
21
  readonly dummyHumans: {
65
22
  readonly pool: readonly [{
@@ -120,9 +77,6 @@ export declare const DEFAULT_RUNTIME_CONFIG_TEMPLATE: {
120
77
  };
121
78
  readonly language: "ko";
122
79
  };
123
- /**
124
- * Default plugin config template (.opencode/maskweaver.json).
125
- */
126
80
  export declare const DEFAULT_PLUGIN_CONFIG_TEMPLATE: {
127
81
  $schema: string;
128
82
  masks: {
@@ -137,29 +91,6 @@ export declare const DEFAULT_PLUGIN_CONFIG_TEMPLATE: {
137
91
  };
138
92
  };
139
93
  };
140
- /**
141
- * Write a default maskweaver.config.json to the project directory.
142
- * Does NOT overwrite if the file already exists.
143
- *
144
- * @param projectDir - Project base directory
145
- * @returns The path to the created file, or null if it already existed
146
- */
147
94
  export declare function writeDefaultRuntimeConfig(projectDir: string): string | null;
148
- /**
149
- * Write a default .opencode/maskweaver.json (plugin config) to the project.
150
- * Does NOT overwrite if the file already exists.
151
- *
152
- * @param projectDir - Project base directory
153
- * @returns The path to the created file, or null if it already existed
154
- */
155
95
  export declare function writeDefaultPluginConfig(projectDir: string): string | null;
156
- /**
157
- * Check if a user-level config exists at ~/.config/opencode/ and return it.
158
- *
159
- * Search order:
160
- * 1. ~/.config/opencode/maskweaver.config.json
161
- * 2. ~/.config/opencode/maskweaver.json (plugin config with agents)
162
- *
163
- * @returns The config path if found, or null
164
- */
165
96
  export declare function findUserGlobalConfig(): string | null;
@@ -1,21 +1,7 @@
1
- /**
2
- * Generate Agent Files from Pool Configuration
3
- *
4
- * Shared utility to create/update dummy-human agent .md files from
5
- * maskweaver.config.json pool entries. Used by both:
6
- * - Plugin startup (auto-generate if not exists)
7
- * - `weave sync-agents` command (force overwrite from user config)
8
- */
9
1
  import * as fs from 'node:fs';
10
2
  import * as path from 'node:path';
11
3
  import * as os from 'node:os';
12
4
  import { loadRuntimeConfig, normalizeDummyHumansConfig } from './config.js';
13
- // ============================================================================
14
- // Agent File Template
15
- // ============================================================================
16
- /**
17
- * Generate the content for a dummy-human agent .md file
18
- */
19
5
  function buildAgentFileContent(entry) {
20
6
  const lines = [
21
7
  '---',
@@ -34,17 +20,6 @@ function buildAgentFileContent(entry) {
34
20
  ];
35
21
  return lines.join('\n');
36
22
  }
37
- // ============================================================================
38
- // Agent File Generation
39
- // ============================================================================
40
- /**
41
- * Generate agent files from a ModelPoolEntry array.
42
- *
43
- * @param pool - Array of model pool entries
44
- * @param agentsDir - Output directory for agent .md files
45
- * @param options - Force overwrite option
46
- * @returns Result summary
47
- */
48
23
  export function generatePoolAgentFiles(pool, agentsDir, options = {}) {
49
24
  const result = {
50
25
  created: [],
@@ -56,7 +31,6 @@ export function generatePoolAgentFiles(pool, agentsDir, options = {}) {
56
31
  result.errors.push('Pool is empty or undefined. No agents to generate.');
57
32
  return result;
58
33
  }
59
- // Ensure agents directory exists
60
34
  if (!fs.existsSync(agentsDir)) {
61
35
  try {
62
36
  fs.mkdirSync(agentsDir, { recursive: true });
@@ -74,7 +48,6 @@ export function generatePoolAgentFiles(pool, agentsDir, options = {}) {
74
48
  result.skipped.push(agentPath);
75
49
  continue;
76
50
  }
77
- // Validate: model must not be empty
78
51
  if (!entry.model || entry.model.trim() === '') {
79
52
  result.errors.push(`Entry "${entry.id}" has no model configured. Skipping.`);
80
53
  continue;
@@ -95,24 +68,7 @@ export function generatePoolAgentFiles(pool, agentsDir, options = {}) {
95
68
  }
96
69
  return result;
97
70
  }
98
- // ============================================================================
99
- // Config-Based Agent Generation
100
- // ============================================================================
101
- /**
102
- * Read maskweaver.config.json (project or global) and generate agent files.
103
- *
104
- * Search order:
105
- * 1. {projectDir}/maskweaver.config.json
106
- * 2. {projectDir}/.opencode/maskweaver.config.json
107
- * 3. ~/.config/opencode/maskweaver.config.json (user global)
108
- *
109
- * @param projectDir - Project base directory
110
- * @param agentsDir - Output directory for agent .md files
111
- * @param options - Force overwrite and other options
112
- * @returns Result summary
113
- */
114
71
  export function generatePoolAgentFilesFromConfig(projectDir, agentsDir, options = {}) {
115
- // Try project config first
116
72
  const projectConfig = loadRuntimeConfig(projectDir);
117
73
  if (projectConfig.dummyHumans) {
118
74
  const pool = normalizeDummyHumansConfig(projectConfig.dummyHumans);
@@ -120,7 +76,6 @@ export function generatePoolAgentFilesFromConfig(projectDir, agentsDir, options
120
76
  return generatePoolAgentFiles(pool, agentsDir, options);
121
77
  }
122
78
  }
123
- // Try user global config (~/.config/opencode/maskweaver.config.json)
124
79
  const homeDir = os.homedir();
125
80
  const globalConfigPath = path.join(homeDir, '.config', 'opencode', 'maskweaver.config.json');
126
81
  if (fs.existsSync(globalConfigPath)) {
@@ -145,15 +100,6 @@ export function generatePoolAgentFilesFromConfig(projectDir, agentsDir, options
145
100
  errors: ['No maskweaver.config.json found with dummyHumans configuration. Create one or run `weave init-config` to generate a default.'],
146
101
  };
147
102
  }
148
- // ============================================================================
149
- // Default Config File Creator
150
- // ============================================================================
151
- /**
152
- * Default runtime config template (maskweaver.config.json).
153
- *
154
- * This is a minimal template with the standard tier entries but WITHOUT
155
- * model names — users must fill in their actual model IDs.
156
- */
157
103
  export const DEFAULT_RUNTIME_CONFIG_TEMPLATE = {
158
104
  dummyHumans: {
159
105
  pool: [
@@ -220,9 +166,6 @@ export const DEFAULT_RUNTIME_CONFIG_TEMPLATE = {
220
166
  },
221
167
  language: 'ko',
222
168
  };
223
- /**
224
- * Default plugin config template (.opencode/maskweaver.json).
225
- */
226
169
  export const DEFAULT_PLUGIN_CONFIG_TEMPLATE = {
227
170
  $schema: 'https://raw.githubusercontent.com/ulgerang/maskweaver/master/schemas/plugin-config.json',
228
171
  masks: {
@@ -237,17 +180,10 @@ export const DEFAULT_PLUGIN_CONFIG_TEMPLATE = {
237
180
  },
238
181
  },
239
182
  };
240
- /**
241
- * Write a default maskweaver.config.json to the project directory.
242
- * Does NOT overwrite if the file already exists.
243
- *
244
- * @param projectDir - Project base directory
245
- * @returns The path to the created file, or null if it already existed
246
- */
247
183
  export function writeDefaultRuntimeConfig(projectDir) {
248
184
  const targetPath = path.join(projectDir, 'maskweaver.config.json');
249
185
  if (fs.existsSync(targetPath)) {
250
- return null; // Already exists, don't overwrite
186
+ return null;
251
187
  }
252
188
  try {
253
189
  fs.writeFileSync(targetPath, JSON.stringify(DEFAULT_RUNTIME_CONFIG_TEMPLATE, null, 2) + '\n', 'utf-8');
@@ -257,20 +193,12 @@ export function writeDefaultRuntimeConfig(projectDir) {
257
193
  return null;
258
194
  }
259
195
  }
260
- /**
261
- * Write a default .opencode/maskweaver.json (plugin config) to the project.
262
- * Does NOT overwrite if the file already exists.
263
- *
264
- * @param projectDir - Project base directory
265
- * @returns The path to the created file, or null if it already existed
266
- */
267
196
  export function writeDefaultPluginConfig(projectDir) {
268
197
  const opencodeDir = path.join(projectDir, '.opencode');
269
198
  const targetPath = path.join(opencodeDir, 'maskweaver.json');
270
199
  if (fs.existsSync(targetPath)) {
271
- return null; // Already exists, don't overwrite
200
+ return null;
272
201
  }
273
- // Ensure .opencode directory exists
274
202
  if (!fs.existsSync(opencodeDir)) {
275
203
  try {
276
204
  fs.mkdirSync(opencodeDir, { recursive: true });
@@ -287,18 +215,6 @@ export function writeDefaultPluginConfig(projectDir) {
287
215
  return null;
288
216
  }
289
217
  }
290
- // ============================================================================
291
- // User Config Detection
292
- // ============================================================================
293
- /**
294
- * Check if a user-level config exists at ~/.config/opencode/ and return it.
295
- *
296
- * Search order:
297
- * 1. ~/.config/opencode/maskweaver.config.json
298
- * 2. ~/.config/opencode/maskweaver.json (plugin config with agents)
299
- *
300
- * @returns The config path if found, or null
301
- */
302
218
  export function findUserGlobalConfig() {
303
219
  const homeDir = os.homedir();
304
220
  const candidates = [
@@ -1,32 +1,14 @@
1
- /**
2
- * @maskweaver/shared - Image Normalization Utilities
3
- *
4
- * LLM Vision API를 위한 이미지 정규화 유틸리티
5
- * 모든 주요 LLM (OpenAI, Claude, Gemini, Kimi)이 지원하는 포맷으로 변환
6
- *
7
- * 지원 포맷: JPEG, PNG, WebP, GIF (모든 LLM 공통)
8
- * 권장 설정: JPEG (최대 호환성), 2048x2048 이하
9
- */
10
1
  export interface ImageNormalizeOptions {
11
- /** Target format (default: 'jpeg' for max compatibility) */
12
2
  format?: "jpeg" | "png" | "webp";
13
- /** Max dimension in pixels (default: 2048) */
14
3
  maxDimension?: number;
15
- /** JPEG quality 1-100 (default: 85) */
16
4
  quality?: number;
17
- /** Remove metadata/EXIF (default: true) */
18
5
  stripMetadata?: boolean;
19
6
  }
20
7
  export interface NormalizedImage {
21
- /** Base64 encoded image data */
22
8
  base64: string;
23
- /** MIME type (e.g., 'image/jpeg') */
24
9
  mimeType: string;
25
- /** Original file path (if from file) */
26
10
  originalPath?: string;
27
- /** Whether conversion was performed */
28
11
  converted: boolean;
29
- /** Warning messages if any */
30
12
  warnings?: string[];
31
13
  }
32
14
  export interface ImageInfo {
@@ -36,66 +18,17 @@ export interface ImageInfo {
36
18
  sizeBytes: number;
37
19
  hasAlpha?: boolean;
38
20
  }
39
- /** Get image info without external dependencies */
40
21
  export declare function getImageInfo(input: Buffer | string): ImageInfo | null;
41
- /** Check if format is supported by all LLMs */
42
22
  export declare function isSupported(format: string): boolean;
43
- /** Check if image needs conversion */
44
23
  export declare function needsConversion(info: ImageInfo, options?: ImageNormalizeOptions): {
45
24
  needsConversion: boolean;
46
25
  reasons: string[];
47
26
  };
48
- /**
49
- * Normalize an image for LLM Vision API compatibility
50
- *
51
- * This is the main entry point. It will:
52
- * 1. Detect image format
53
- * 2. Check if conversion is needed
54
- * 3. Convert if necessary (requires sharp)
55
- * 4. Return base64-encoded result
56
- *
57
- * @example
58
- * ```typescript
59
- * import { normalizeImage } from 'maskweaver/shared';
60
- *
61
- * // From file path
62
- * const result = await normalizeImage('/path/to/screenshot.png');
63
- * console.log(result.base64); // Use in LLM API
64
- *
65
- * // From buffer
66
- * const buffer = fs.readFileSync('/path/to/image.bmp');
67
- * const result = await normalizeImage(buffer, { format: 'jpeg' });
68
- * ```
69
- */
70
27
  export declare function normalizeImage(input: Buffer | string, options?: ImageNormalizeOptions): Promise<NormalizedImage>;
71
- /**
72
- * Normalize image and save to file
73
- *
74
- * @example
75
- * ```typescript
76
- * const outputPath = await normalizeImageToFile(
77
- * '/path/to/screenshot.bmp',
78
- * '/path/to/output.jpg',
79
- * { format: 'jpeg', quality: 90 }
80
- * );
81
- * ```
82
- */
83
28
  export declare function normalizeImageToFile(input: Buffer | string, outputPath: string, options?: ImageNormalizeOptions): Promise<string>;
84
- /**
85
- * Quick check if an image file is LLM-compatible without loading full file
86
- */
87
29
  export declare function isLLMCompatible(filePath: string): {
88
30
  compatible: boolean;
89
31
  format: string | null;
90
32
  issues: string[];
91
33
  };
92
- /**
93
- * Create LLM-ready image data URL
94
- *
95
- * @example
96
- * ```typescript
97
- * const dataUrl = await createImageDataUrl('/path/to/image.png');
98
- * // Returns: "data:image/png;base64,iVBORw0KGgo..."
99
- * ```
100
- */
101
34
  export declare function createImageDataUrl(input: Buffer | string, options?: ImageNormalizeOptions): Promise<string>;