maskweaver 0.8.4 → 0.8.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.
- package/README.ko.md +31 -3
- package/README.md +44 -4
- package/assets/commands/weave-init.md +23 -11
- package/dist/plugin/config/index.d.ts +23 -0
- package/dist/plugin/config/index.d.ts.map +1 -1
- package/dist/plugin/config/index.js +24 -0
- package/dist/plugin/config/index.js.map +1 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +86 -22
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/tools/slashcommand.d.ts.map +1 -1
- package/dist/plugin/tools/slashcommand.js +16 -3
- package/dist/plugin/tools/slashcommand.js.map +1 -1
- package/dist/plugin/tools/weave.d.ts +26 -2
- package/dist/plugin/tools/weave.d.ts.map +1 -1
- package/dist/plugin/tools/weave.js +1467 -50
- package/dist/plugin/tools/weave.js.map +1 -1
- package/dist/shared/config.d.ts +5 -0
- package/dist/shared/config.d.ts.map +1 -1
- package/dist/shared/config.js.map +1 -1
- package/dist/weave/bridge.d.ts +2 -4
- package/dist/weave/bridge.d.ts.map +1 -1
- package/dist/weave/bridge.js +3 -4
- package/dist/weave/bridge.js.map +1 -1
- package/dist/weave/change-artifacts.d.ts +25 -0
- package/dist/weave/change-artifacts.d.ts.map +1 -0
- package/dist/weave/change-artifacts.js +184 -0
- package/dist/weave/change-artifacts.js.map +1 -0
- package/dist/weave/gdc.d.ts +5 -0
- package/dist/weave/gdc.d.ts.map +1 -1
- package/dist/weave/gdc.js +5 -0
- package/dist/weave/gdc.js.map +1 -1
- package/dist/weave/loop.d.ts +99 -0
- package/dist/weave/loop.d.ts.map +1 -0
- package/dist/weave/loop.js +426 -0
- package/dist/weave/loop.js.map +1 -0
- package/dist/weave/phase-manager.d.ts.map +1 -1
- package/dist/weave/phase-manager.js +36 -0
- package/dist/weave/phase-manager.js.map +1 -1
- package/dist/weave/stages/archive.d.ts +14 -0
- package/dist/weave/stages/archive.d.ts.map +1 -0
- package/dist/weave/stages/archive.js +38 -0
- package/dist/weave/stages/archive.js.map +1 -0
- package/dist/weave/stages/execute.d.ts.map +1 -1
- package/dist/weave/stages/execute.js +102 -0
- package/dist/weave/stages/execute.js.map +1 -1
- package/dist/weave/stages/handoff.d.ts.map +1 -1
- package/dist/weave/stages/handoff.js +50 -0
- package/dist/weave/stages/handoff.js.map +1 -1
- package/dist/weave/stages/plan.d.ts.map +1 -1
- package/dist/weave/stages/plan.js +261 -10
- package/dist/weave/stages/plan.js.map +1 -1
- package/dist/weave/types.d.ts +75 -0
- package/dist/weave/types.d.ts.map +1 -1
- package/dist/weave/verification/commands.d.ts +2 -1
- package/dist/weave/verification/commands.d.ts.map +1 -1
- package/dist/weave/verification/commands.js +53 -0
- package/dist/weave/verification/commands.js.map +1 -1
- package/dist/weave/worktree.d.ts +5 -0
- package/dist/weave/worktree.d.ts.map +1 -1
- package/dist/weave/worktree.js +52 -2
- package/dist/weave/worktree.js.map +1 -1
- package/package.json +22 -32
package/README.ko.md
CHANGED
|
@@ -81,9 +81,37 @@ OpenCode 설정에 추가하면 끝!
|
|
|
81
81
|
|
|
82
82
|
OpenCode가 시작 시 자동으로 `~/.cache/opencode/node_modules/`에 플러그인을 설치합니다.
|
|
83
83
|
|
|
84
|
-
**Windows:** `%USERPROFILE%\.config\opencode\opencode.json`
|
|
85
|
-
|
|
86
|
-
###
|
|
84
|
+
**Windows:** `%USERPROFILE%\.config\opencode\opencode.json`
|
|
85
|
+
|
|
86
|
+
### 완료 알림 소리 (선택)
|
|
87
|
+
|
|
88
|
+
Maskweaver는 생성이 끝나서 세션이 idle 상태가 되면(`session.idle`) 알림 소리를 재생할 수 있습니다.
|
|
89
|
+
|
|
90
|
+
`.opencode/maskweaver.json`(프로젝트) 또는 `~/.config/opencode/maskweaver.json`(전역)에 설정하세요:
|
|
91
|
+
|
|
92
|
+
```jsonc
|
|
93
|
+
{
|
|
94
|
+
"notifications": {
|
|
95
|
+
"completionSound": {
|
|
96
|
+
"enabled": true
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
끄려면:
|
|
103
|
+
|
|
104
|
+
```jsonc
|
|
105
|
+
{
|
|
106
|
+
"notifications": {
|
|
107
|
+
"completionSound": {
|
|
108
|
+
"enabled": false
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 설치된 버전 확인
|
|
87
115
|
|
|
88
116
|
Maskweaver 버전을 확인하는 여러 방법:
|
|
89
117
|
|
package/README.md
CHANGED
|
@@ -100,9 +100,37 @@ Add to your OpenCode config - that's it!
|
|
|
100
100
|
|
|
101
101
|
OpenCode automatically installs the plugin to `~/.cache/opencode/node_modules/` on startup.
|
|
102
102
|
|
|
103
|
-
**Windows:** `%USERPROFILE%\.config\opencode\opencode.json`
|
|
104
|
-
|
|
105
|
-
###
|
|
103
|
+
**Windows:** `%USERPROFILE%\.config\opencode\opencode.json`
|
|
104
|
+
|
|
105
|
+
### Completion Sound (Optional)
|
|
106
|
+
|
|
107
|
+
Maskweaver can play a notification sound when generation finishes (`session.idle`).
|
|
108
|
+
|
|
109
|
+
Create `.opencode/maskweaver.json` (project) or `~/.config/opencode/maskweaver.json` (global):
|
|
110
|
+
|
|
111
|
+
```jsonc
|
|
112
|
+
{
|
|
113
|
+
"notifications": {
|
|
114
|
+
"completionSound": {
|
|
115
|
+
"enabled": true
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Turn it off:
|
|
122
|
+
|
|
123
|
+
```jsonc
|
|
124
|
+
{
|
|
125
|
+
"notifications": {
|
|
126
|
+
"completionSound": {
|
|
127
|
+
"enabled": false
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Checking Installed Version
|
|
106
134
|
|
|
107
135
|
Multiple ways to verify your Maskweaver version:
|
|
108
136
|
|
|
@@ -256,11 +284,17 @@ Weave integrates with [GDC](https://github.com/ulgerang/gdc) (Graph-Driven Codeb
|
|
|
256
284
|
|
|
257
285
|
**Research Enhancement:**
|
|
258
286
|
- Automatic `.gdc` workspace detection
|
|
287
|
+
- `weave init` probe chain (`version`/`sync`/`check`/`stats`) for quick integration health check
|
|
259
288
|
- GDC `stats`, `graph`, and `check` results embedded in `tasks/research.md`
|
|
260
289
|
- Dependency blast radius analysis from graph edges
|
|
261
290
|
- Candidate reuse nodes matched against feature keywords
|
|
262
291
|
- New report sections: `GDC Node Coverage`, `Dependency Blast Radius`, `Existing Spec vs Implementation Drift`, `Candidate Reuse Nodes`
|
|
263
292
|
|
|
293
|
+
**Execution Enhancements:**
|
|
294
|
+
- `weave craft` can generate node context files via `gdc extract` and link them in `tasks/todo.md`
|
|
295
|
+
- `weave status` includes GDC node/check metrics (`total/implemented/tested`, issue summary)
|
|
296
|
+
- `weave worktree create` can bootstrap `.gdc/config.yaml` and `.gdc/nodes/**` (without `.gdc/graph.db`)
|
|
297
|
+
|
|
264
298
|
**Pre-Verify Gate:**
|
|
265
299
|
When GDC is detected, `weave verify` and `weave flow` automatically run:
|
|
266
300
|
1. `gdc sync --machine` - Sync specs with implementation
|
|
@@ -274,7 +308,12 @@ Blocking errors from GDC check will halt verification (configurable via `strictV
|
|
|
274
308
|
"gdc": {
|
|
275
309
|
"enabled": "auto",
|
|
276
310
|
"strictVerify": false,
|
|
277
|
-
"autoSyncOnPrepare": true
|
|
311
|
+
"autoSyncOnPrepare": true,
|
|
312
|
+
"extractContext": {
|
|
313
|
+
"withImpl": true,
|
|
314
|
+
"withTests": true,
|
|
315
|
+
"withCallers": true
|
|
316
|
+
}
|
|
278
317
|
}
|
|
279
318
|
}
|
|
280
319
|
```
|
|
@@ -282,6 +321,7 @@ Blocking errors from GDC check will halt verification (configurable via `strictV
|
|
|
282
321
|
- `enabled`: `true` | `false` | `"auto"` (default: auto-detect from `.gdc` directory)
|
|
283
322
|
- `strictVerify`: If `true`, GDC check failures block verification; if `false`, continues with warning
|
|
284
323
|
- `autoSyncOnPrepare`: Run `gdc sync` during `weave prepare`
|
|
324
|
+
- `extractContext`: Controls `gdc extract` evidence flags during `weave craft`
|
|
285
325
|
|
|
286
326
|
#### Autonomous Mask Selection
|
|
287
327
|
|
|
@@ -30,13 +30,13 @@ description: Weave 워크플로우 초기화 (프로젝트별 1회)
|
|
|
30
30
|
|
|
31
31
|
만약 `.ignore` 파일이 이미 있다면, `!.opencode/weave/` 줄만 추가합니다 (중복 방지).
|
|
32
32
|
|
|
33
|
-
### 2. 디렉토리 구조 생성
|
|
33
|
+
### 2. 디렉토리 구조 생성
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
36
|
mkdir -p .opencode/weave/plans
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
### 3. `state.yaml` 초기화
|
|
39
|
+
### 3. `state.yaml` 초기화
|
|
40
40
|
|
|
41
41
|
`.opencode/weave/state.yaml` 파일을 생성합니다:
|
|
42
42
|
|
|
@@ -46,14 +46,26 @@ mkdir -p .opencode/weave/plans
|
|
|
46
46
|
active_plan: null
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
### 4. 기존 PLAN.yaml 마이그레이션 (해당 시)
|
|
49
|
+
### 4. 기존 PLAN.yaml 마이그레이션 (해당 시)
|
|
50
50
|
|
|
51
51
|
만약 `.opencode/weave/PLAN.yaml` (구버전 단일 플랜)이 존재하면:
|
|
52
|
-
1. PLAN
|
|
53
|
-
2.
|
|
54
|
-
3.
|
|
55
|
-
|
|
56
|
-
5.
|
|
52
|
+
1. 기존 PLAN을 읽어 multi-plan 포맷으로 저장
|
|
53
|
+
2. `state.yaml`의 `active_plan`을 해당 플랜으로 설정
|
|
54
|
+
3. 기존 PLAN.yaml 삭제 (가능한 경우)
|
|
55
|
+
|
|
56
|
+
### 5. GDC 연동 점검 및 그래프 동기화
|
|
57
|
+
|
|
58
|
+
`weave init`은 GDC 연동 상태를 확인합니다.
|
|
59
|
+
|
|
60
|
+
- `.gdc` 워크스페이스 미감지 시:
|
|
61
|
+
- 안내 메시지 출력 (`gdc init --language <lang>`)
|
|
62
|
+
- 감지 + 연동 활성화 시:
|
|
63
|
+
- `gdc version --machine`
|
|
64
|
+
- `gdc sync --machine`
|
|
65
|
+
- `gdc check --machine`
|
|
66
|
+
- `gdc stats --machine`
|
|
67
|
+
|
|
68
|
+
이 단계는 **정보 제공 및 부트스트랩 목적**이며, 실패해도 Weave 초기화 자체는 완료됩니다.
|
|
57
69
|
|
|
58
70
|
---
|
|
59
71
|
|
|
@@ -67,9 +79,9 @@ active_plan: null
|
|
|
67
79
|
- `.opencode/weave/state.yaml` — 플랜 상태 추적
|
|
68
80
|
- `.opencode/weave/plans/` — 플랜 저장 디렉토리
|
|
69
81
|
|
|
70
|
-
### 다음 단계
|
|
71
|
-
프로젝트 계획을 세우려면:
|
|
72
|
-
|
|
82
|
+
### 다음 단계
|
|
83
|
+
프로젝트 계획을 세우려면:
|
|
84
|
+
`weave command=prepare docsPath="docs/"`
|
|
73
85
|
```
|
|
74
86
|
|
|
75
87
|
---
|
|
@@ -46,6 +46,19 @@ export interface LoggingConfig {
|
|
|
46
46
|
/** Enable verbose logging */
|
|
47
47
|
verbose?: boolean;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Completion sound notification configuration
|
|
51
|
+
*/
|
|
52
|
+
export interface CompletionSoundConfig {
|
|
53
|
+
/** Play sound when the active session becomes idle */
|
|
54
|
+
enabled?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Notification configuration
|
|
58
|
+
*/
|
|
59
|
+
export interface NotificationsConfig {
|
|
60
|
+
completionSound?: CompletionSoundConfig;
|
|
61
|
+
}
|
|
49
62
|
/**
|
|
50
63
|
* Maskweaver Plugin Configuration
|
|
51
64
|
*/
|
|
@@ -62,6 +75,8 @@ export interface MaskweaverPluginConfig {
|
|
|
62
75
|
masks?: MaskConfig;
|
|
63
76
|
/** Logging configuration */
|
|
64
77
|
logging?: LoggingConfig;
|
|
78
|
+
/** Notifications configuration */
|
|
79
|
+
notifications?: NotificationsConfig;
|
|
65
80
|
}
|
|
66
81
|
/**
|
|
67
82
|
* Load plugin configuration from directory
|
|
@@ -127,6 +142,13 @@ export declare function getAgentOverride(config: MaskweaverPluginConfig, agentNa
|
|
|
127
142
|
* @returns true if verbose logging is enabled, false otherwise
|
|
128
143
|
*/
|
|
129
144
|
export declare function isVerboseLoggingEnabled(config: MaskweaverPluginConfig): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Check if completion sound notification is enabled
|
|
147
|
+
*
|
|
148
|
+
* @param config - Plugin configuration
|
|
149
|
+
* @returns true if completion sound is enabled, false otherwise
|
|
150
|
+
*/
|
|
151
|
+
export declare function isCompletionSoundEnabled(config: MaskweaverPluginConfig): boolean;
|
|
130
152
|
/**
|
|
131
153
|
* Validate configuration structure
|
|
132
154
|
*
|
|
@@ -142,6 +164,7 @@ declare const _default: {
|
|
|
142
164
|
isAutoActivateEnabled: typeof isAutoActivateEnabled;
|
|
143
165
|
getAgentOverride: typeof getAgentOverride;
|
|
144
166
|
isVerboseLoggingEnabled: typeof isVerboseLoggingEnabled;
|
|
167
|
+
isCompletionSoundEnabled: typeof isCompletionSoundEnabled;
|
|
145
168
|
validateConfig: typeof validateConfig;
|
|
146
169
|
};
|
|
147
170
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugin/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH;;GAEG;AACH,UAAU,mBAAmB;IAC3B,MAAM,EAAE;QACN,GAAG,EAAE;YACH,GAAG,CAAC,KAAK,EAAE;gBAAE,OAAO,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAC;gBAAC,OAAO,EAAE,MAAM,CAAA;aAAE,G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AC3B,MAAM,EAAE,sBAAsB,EAC9B,MAAM,EAAE,MAAM,GACb,OAAO,CAMT;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,GAAG,SAAS,CAEjF;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAE7E;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,sBAAsB,EAC9B,SAAS,EAAE,MAAM,GAChB,aAAa,GAAG,SAAS,CAE3B;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAE/E;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAEhF;AAMD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,EAAE,CA6DvE;;;;;;;;;;;;AAMD,wBAUE"}
|
|
@@ -170,6 +170,15 @@ export function getAgentOverride(config, agentName) {
|
|
|
170
170
|
export function isVerboseLoggingEnabled(config) {
|
|
171
171
|
return config.logging?.verbose ?? false;
|
|
172
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Check if completion sound notification is enabled
|
|
175
|
+
*
|
|
176
|
+
* @param config - Plugin configuration
|
|
177
|
+
* @returns true if completion sound is enabled, false otherwise
|
|
178
|
+
*/
|
|
179
|
+
export function isCompletionSoundEnabled(config) {
|
|
180
|
+
return config.notifications?.completionSound?.enabled ?? false;
|
|
181
|
+
}
|
|
173
182
|
// ============================================================================
|
|
174
183
|
// Configuration Validation
|
|
175
184
|
// ============================================================================
|
|
@@ -218,6 +227,20 @@ export function validateConfig(config) {
|
|
|
218
227
|
}
|
|
219
228
|
}
|
|
220
229
|
}
|
|
230
|
+
// Validate notifications
|
|
231
|
+
if (config.notifications) {
|
|
232
|
+
if (typeof config.notifications !== 'object') {
|
|
233
|
+
errors.push('notifications must be an object');
|
|
234
|
+
}
|
|
235
|
+
else if (config.notifications.completionSound &&
|
|
236
|
+
typeof config.notifications.completionSound !== 'object') {
|
|
237
|
+
errors.push('notifications.completionSound must be an object');
|
|
238
|
+
}
|
|
239
|
+
else if (config.notifications.completionSound?.enabled !== undefined &&
|
|
240
|
+
typeof config.notifications.completionSound.enabled !== 'boolean') {
|
|
241
|
+
errors.push('notifications.completionSound.enabled must be a boolean');
|
|
242
|
+
}
|
|
243
|
+
}
|
|
221
244
|
return errors;
|
|
222
245
|
}
|
|
223
246
|
// ============================================================================
|
|
@@ -231,6 +254,7 @@ export default {
|
|
|
231
254
|
isAutoActivateEnabled,
|
|
232
255
|
getAgentOverride,
|
|
233
256
|
isVerboseLoggingEnabled,
|
|
257
|
+
isCompletionSoundEnabled,
|
|
234
258
|
validateConfig,
|
|
235
259
|
};
|
|
236
260
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugin/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugin/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAqF9B,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E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OAAO,EAAE,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxG,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C,CAAC,CAAC;AA81BH,eAAO,MAAM,gBAAgB,EAAE,MAyd9B,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
package/dist/plugin/index.js
CHANGED
|
@@ -18,10 +18,11 @@ const tool = (input) => input;
|
|
|
18
18
|
import * as fs from 'node:fs';
|
|
19
19
|
import * as path from 'node:path';
|
|
20
20
|
import * as os from 'node:os';
|
|
21
|
+
import { spawnSync } from 'node:child_process';
|
|
21
22
|
import { fileURLToPath } from 'node:url';
|
|
22
23
|
import { parse as parseYaml } from 'yaml';
|
|
23
24
|
import { VERSION } from '../version.js';
|
|
24
|
-
import { loadPluginConfig, isMaskEnabled, isToolEnabled, getDefaultMask, isAutoActivateEnabled, getAgentOverride, isVerboseLoggingEnabled, validateConfig, } from './config/index.js';
|
|
25
|
+
import { loadPluginConfig, isMaskEnabled, isToolEnabled, getDefaultMask, isAutoActivateEnabled, getAgentOverride, isVerboseLoggingEnabled, isCompletionSoundEnabled, validateConfig, } from './config/index.js';
|
|
25
26
|
// New tool imports
|
|
26
27
|
import { createMemorySearchTool } from './tools/memorySearch.js';
|
|
27
28
|
import { createMemoryWriteTool } from './tools/memoryWrite.js';
|
|
@@ -553,6 +554,53 @@ Active mask: ${active ? `${active.profile.name} (${active.metadata.id})` : 'none
|
|
|
553
554
|
},
|
|
554
555
|
};
|
|
555
556
|
}
|
|
557
|
+
function getSessionId(event) {
|
|
558
|
+
if (typeof event.sessionID === 'string')
|
|
559
|
+
return event.sessionID;
|
|
560
|
+
if (typeof event.sessionId === 'string')
|
|
561
|
+
return event.sessionId;
|
|
562
|
+
return null;
|
|
563
|
+
}
|
|
564
|
+
function runSoundCommand(command, args) {
|
|
565
|
+
try {
|
|
566
|
+
const result = spawnSync(command, args, {
|
|
567
|
+
stdio: 'ignore',
|
|
568
|
+
windowsHide: true,
|
|
569
|
+
timeout: 2500,
|
|
570
|
+
});
|
|
571
|
+
return !result.error && result.status === 0;
|
|
572
|
+
}
|
|
573
|
+
catch {
|
|
574
|
+
return false;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
function playCompletionSound(config) {
|
|
578
|
+
if (!isCompletionSoundEnabled(config))
|
|
579
|
+
return;
|
|
580
|
+
let played = false;
|
|
581
|
+
if (process.platform === 'win32') {
|
|
582
|
+
played = runSoundCommand('powershell', [
|
|
583
|
+
'-NoProfile',
|
|
584
|
+
'-NonInteractive',
|
|
585
|
+
'-Command',
|
|
586
|
+
'[console]::beep(880,220)',
|
|
587
|
+
]);
|
|
588
|
+
}
|
|
589
|
+
else if (process.platform === 'darwin') {
|
|
590
|
+
played = runSoundCommand('afplay', ['/System/Library/Sounds/Glass.aiff']);
|
|
591
|
+
}
|
|
592
|
+
else if (process.platform === 'linux') {
|
|
593
|
+
played = runSoundCommand('canberra-gtk-play', ['-i', 'complete', '-d', 'maskweaver']);
|
|
594
|
+
}
|
|
595
|
+
if (!played) {
|
|
596
|
+
try {
|
|
597
|
+
process.stdout.write('\u0007');
|
|
598
|
+
}
|
|
599
|
+
catch {
|
|
600
|
+
// Ignore failures - notification sound is best-effort only.
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
556
604
|
let state = null;
|
|
557
605
|
function parseAgentMarkdown(content) {
|
|
558
606
|
const parts = content.split('---');
|
|
@@ -677,12 +725,14 @@ export const MaskweaverPlugin = async ({ client, directory }) => {
|
|
|
677
725
|
const projectMasksDir = path.join(directory, '.opencode', 'masks');
|
|
678
726
|
// Priority: project masks > global masks
|
|
679
727
|
const masksDir = fs.existsSync(projectMasksDir) ? projectMasksDir : globalMasksDir;
|
|
680
|
-
|
|
728
|
+
const pluginState = {
|
|
681
729
|
maskLoader: null,
|
|
682
730
|
activeMask: null,
|
|
683
731
|
masksDir,
|
|
684
732
|
config: pluginConfig,
|
|
733
|
+
currentSessionID: null,
|
|
685
734
|
};
|
|
735
|
+
state = pluginState;
|
|
686
736
|
// Log plugin loaded
|
|
687
737
|
client.app.log({
|
|
688
738
|
service: 'maskweaver',
|
|
@@ -690,9 +740,9 @@ export const MaskweaverPlugin = async ({ client, directory }) => {
|
|
|
690
740
|
message: `Maskweaver plugin loaded v${VERSION}`,
|
|
691
741
|
});
|
|
692
742
|
if (fs.existsSync(masksDir)) {
|
|
693
|
-
|
|
743
|
+
pluginState.maskLoader = new MaskLoader(masksDir, pluginConfig);
|
|
694
744
|
try {
|
|
695
|
-
await
|
|
745
|
+
await pluginState.maskLoader.loadCatalog();
|
|
696
746
|
if (verbose) {
|
|
697
747
|
client.app.log({
|
|
698
748
|
service: 'maskweaver',
|
|
@@ -707,7 +757,7 @@ export const MaskweaverPlugin = async ({ client, directory }) => {
|
|
|
707
757
|
level: 'warn',
|
|
708
758
|
message: `Failed to load masks: ${e}`,
|
|
709
759
|
});
|
|
710
|
-
|
|
760
|
+
pluginState.maskLoader = null;
|
|
711
761
|
}
|
|
712
762
|
}
|
|
713
763
|
// ==========================================================================
|
|
@@ -715,11 +765,11 @@ export const MaskweaverPlugin = async ({ client, directory }) => {
|
|
|
715
765
|
// ==========================================================================
|
|
716
766
|
const defaultMaskId = getDefaultMask(pluginConfig);
|
|
717
767
|
const autoActivate = isAutoActivateEnabled(pluginConfig);
|
|
718
|
-
if (defaultMaskId && autoActivate &&
|
|
768
|
+
if (defaultMaskId && autoActivate && pluginState.maskLoader) {
|
|
719
769
|
try {
|
|
720
|
-
const defaultMask = await
|
|
770
|
+
const defaultMask = await pluginState.maskLoader.load(defaultMaskId);
|
|
721
771
|
if (defaultMask) {
|
|
722
|
-
|
|
772
|
+
pluginState.activeMask = defaultMask;
|
|
723
773
|
client.app.log({
|
|
724
774
|
service: 'maskweaver',
|
|
725
775
|
level: 'info',
|
|
@@ -745,10 +795,9 @@ export const MaskweaverPlugin = async ({ client, directory }) => {
|
|
|
745
795
|
// ==========================================================================
|
|
746
796
|
// 5. Helper functions for tool factories
|
|
747
797
|
// ==========================================================================
|
|
748
|
-
const getActiveMask = () =>
|
|
798
|
+
const getActiveMask = () => pluginState.activeMask;
|
|
749
799
|
const setActiveMask = (mask) => {
|
|
750
|
-
|
|
751
|
-
state.activeMask = mask;
|
|
800
|
+
pluginState.activeMask = mask;
|
|
752
801
|
};
|
|
753
802
|
// ==========================================================================
|
|
754
803
|
// 6. Conditional tool registration (oh-my-opencode pattern)
|
|
@@ -770,14 +819,14 @@ export const MaskweaverPlugin = async ({ client, directory }) => {
|
|
|
770
819
|
return schema;
|
|
771
820
|
};
|
|
772
821
|
const tools = {};
|
|
773
|
-
if (
|
|
822
|
+
if (pluginState.maskLoader) {
|
|
774
823
|
if (isToolActive('list_masks')) {
|
|
775
|
-
const tool = createListMasksTool(
|
|
824
|
+
const tool = createListMasksTool(pluginState.maskLoader, getActiveMask);
|
|
776
825
|
tool.args = wrapSchema(tool.args);
|
|
777
826
|
tools.list_masks = tool;
|
|
778
827
|
}
|
|
779
828
|
if (isToolActive('select_mask')) {
|
|
780
|
-
const tool = createSelectMaskTool(
|
|
829
|
+
const tool = createSelectMaskTool(pluginState.maskLoader, getActiveMask, setActiveMask);
|
|
781
830
|
tool.args = wrapSchema(tool.args);
|
|
782
831
|
tools.select_mask = tool;
|
|
783
832
|
}
|
|
@@ -787,13 +836,13 @@ export const MaskweaverPlugin = async ({ client, directory }) => {
|
|
|
787
836
|
tools.deselect_mask = tool;
|
|
788
837
|
}
|
|
789
838
|
if (isToolActive('get_mask_prompt')) {
|
|
790
|
-
const tool = createGetMaskPromptTool(
|
|
839
|
+
const tool = createGetMaskPromptTool(pluginState.maskLoader, getActiveMask);
|
|
791
840
|
tool.args = wrapSchema(tool.args);
|
|
792
841
|
tools.get_mask_prompt = tool;
|
|
793
842
|
}
|
|
794
843
|
}
|
|
795
844
|
if (isToolActive('maskweaver_status')) {
|
|
796
|
-
const tool = createMaskweaverStatusTool(
|
|
845
|
+
const tool = createMaskweaverStatusTool(pluginState.maskLoader, masksDir, getActiveMask);
|
|
797
846
|
tool.args = wrapSchema(tool.args);
|
|
798
847
|
tools.maskweaver_status = tool;
|
|
799
848
|
}
|
|
@@ -1000,10 +1049,11 @@ ${buildRichPrompt(state.activeMask)}
|
|
|
1000
1049
|
event: async ({ event }) => {
|
|
1001
1050
|
// Session created - log available masks
|
|
1002
1051
|
if (event.type === 'session.created') {
|
|
1003
|
-
|
|
1052
|
+
pluginState.currentSessionID = getSessionId(event);
|
|
1053
|
+
if (pluginState.maskLoader && verbose) {
|
|
1004
1054
|
try {
|
|
1005
|
-
const masks = await
|
|
1006
|
-
const categories = await
|
|
1055
|
+
const masks = await pluginState.maskLoader.listAll();
|
|
1056
|
+
const categories = await pluginState.maskLoader.listCategories();
|
|
1007
1057
|
client.app.log({
|
|
1008
1058
|
service: 'maskweaver',
|
|
1009
1059
|
level: 'info',
|
|
@@ -1015,11 +1065,25 @@ ${buildRichPrompt(state.activeMask)}
|
|
|
1015
1065
|
}
|
|
1016
1066
|
}
|
|
1017
1067
|
}
|
|
1068
|
+
// Session idle - generation completed
|
|
1069
|
+
if (event.type === 'session.idle') {
|
|
1070
|
+
const idleSessionID = getSessionId(event);
|
|
1071
|
+
const isCurrentSession = !idleSessionID ||
|
|
1072
|
+
!pluginState.currentSessionID ||
|
|
1073
|
+
idleSessionID === pluginState.currentSessionID;
|
|
1074
|
+
if (isCurrentSession) {
|
|
1075
|
+
playCompletionSound(pluginState.config);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1018
1078
|
// Session deleted - cleanup
|
|
1019
1079
|
if (event.type === 'session.deleted') {
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1080
|
+
const deletedSessionID = getSessionId(event);
|
|
1081
|
+
if (!deletedSessionID || deletedSessionID === pluginState.currentSessionID) {
|
|
1082
|
+
pluginState.currentSessionID = null;
|
|
1083
|
+
}
|
|
1084
|
+
if (verbose) {
|
|
1085
|
+
const wasActive = pluginState.activeMask !== null;
|
|
1086
|
+
pluginState.activeMask = null;
|
|
1023
1087
|
if (wasActive) {
|
|
1024
1088
|
client.app.log({
|
|
1025
1089
|
service: 'maskweaver',
|