@sylphx/flow 0.2.11 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/assets/rules/core.md +56 -3
- package/dist/assets/rules/core.md +56 -3
- package/dist/chunk-01gv4qey.js +4 -0
- package/dist/chunk-01gv4qey.js.map +11 -0
- package/dist/chunk-1e8xf3f6.js +27 -0
- package/dist/{chunk-s323r5xg.js.map → chunk-1e8xf3f6.js.map} +5 -5
- package/dist/{chunk-f9yb2zk3.js → chunk-3m9whg4q.js} +2 -2
- package/dist/{chunk-f9yb2zk3.js.map → chunk-3m9whg4q.js.map} +1 -1
- package/dist/chunk-3qxj0zy3.js +23 -0
- package/dist/chunk-3qxj0zy3.js.map +11 -0
- package/dist/{chunk-sgafqzer.js → chunk-3w6pd43t.js} +3 -3
- package/dist/{chunk-sgafqzer.js.map → chunk-3w6pd43t.js.map} +2 -2
- package/dist/chunk-4e5g3df9.js +105 -0
- package/dist/chunk-4e5g3df9.js.map +27 -0
- package/dist/{chunk-d6k94684.js → chunk-4nm4ere4.js} +3 -3
- package/dist/{chunk-d6k94684.js.map → chunk-4nm4ere4.js.map} +1 -1
- package/dist/{chunk-ceyg2zjg.js → chunk-4vrj3f8r.js} +3 -3
- package/dist/{chunk-ceyg2zjg.js.map → chunk-4vrj3f8r.js.map} +1 -1
- package/dist/chunk-5njgv5k5.js +161 -0
- package/dist/{chunk-rsagxdqj.js.map → chunk-5njgv5k5.js.map} +4 -6
- package/dist/{chunk-6eb5a8kv.js → chunk-67n29s4q.js} +4 -4
- package/dist/chunk-67n29s4q.js.map +10 -0
- package/dist/chunk-7yyg008s.js +27 -0
- package/dist/{chunk-pzp2kw7j.js.map → chunk-7yyg008s.js.map} +2 -2
- package/dist/{chunk-66qzap9m.js → chunk-86ce45n6.js} +2 -2
- package/dist/{chunk-66qzap9m.js.map → chunk-86ce45n6.js.map} +1 -1
- package/dist/{chunk-fyvtp08n.js → chunk-99pz5wm0.js} +2 -2
- package/dist/{chunk-fyvtp08n.js.map → chunk-99pz5wm0.js.map} +1 -1
- package/dist/{chunk-51kpynby.js → chunk-g4baca7p.js} +3 -3
- package/dist/{chunk-51kpynby.js.map → chunk-g4baca7p.js.map} +1 -1
- package/dist/chunk-gc66xe7z.js +4 -0
- package/dist/{chunk-8ep9gk6d.js.map → chunk-gc66xe7z.js.map} +2 -2
- package/dist/{chunk-2nfq57ym.js → chunk-hj6qtsqp.js} +2 -2
- package/dist/{chunk-2nfq57ym.js.map → chunk-hj6qtsqp.js.map} +2 -2
- package/dist/{chunk-etqfkn4f.js → chunk-jbd95k1f.js} +3 -3
- package/dist/{chunk-etqfkn4f.js.map → chunk-jbd95k1f.js.map} +1 -1
- package/dist/chunk-jk1ebfqn.js +23 -0
- package/dist/{chunk-1ej6vegq.js.map → chunk-jk1ebfqn.js.map} +5 -5
- package/dist/{chunk-z61qdct1.js → chunk-kn908zkk.js} +2 -2
- package/dist/{chunk-z61qdct1.js.map → chunk-kn908zkk.js.map} +1 -1
- package/dist/{chunk-rvx8bgqk.js → chunk-mw13a082.js} +3 -3
- package/dist/{chunk-rvx8bgqk.js.map → chunk-mw13a082.js.map} +1 -1
- package/dist/chunk-n8vzewr3.js +4 -0
- package/dist/chunk-n8vzewr3.js.map +12 -0
- package/dist/chunk-nke51f3c.js +4 -0
- package/dist/chunk-nke51f3c.js.map +10 -0
- package/dist/{chunk-ny1s8fnh.js → chunk-ns5atzyz.js} +2 -2
- package/dist/{chunk-ny1s8fnh.js.map → chunk-ns5atzyz.js.map} +1 -1
- package/dist/{chunk-372bgp30.js → chunk-q4nh3vst.js} +3 -3
- package/dist/{chunk-372bgp30.js.map → chunk-q4nh3vst.js.map} +1 -1
- package/dist/{chunk-585jp0rg.js → chunk-q5gqgs0p.js} +3 -3
- package/dist/chunk-q5gqgs0p.js.map +10 -0
- package/dist/chunk-qpej66sh.js +6 -0
- package/dist/chunk-qpej66sh.js.map +11 -0
- package/dist/{chunk-f676awyz.js → chunk-s9bsh0gp.js} +3 -3
- package/dist/{chunk-f676awyz.js.map → chunk-s9bsh0gp.js.map} +1 -1
- package/dist/chunk-wnhhwtsy.js +19 -0
- package/dist/chunk-wnhhwtsy.js.map +11 -0
- package/dist/{chunk-mtrcdhzn.js → chunk-xs370t8p.js} +3 -3
- package/dist/{chunk-mtrcdhzn.js.map → chunk-xs370t8p.js.map} +8 -8
- package/dist/chunk-xtrn4wn0.js +3 -0
- package/dist/{chunk-b0047ggx.js.map → chunk-xtrn4wn0.js.map} +2 -2
- package/dist/index.js +341 -348
- package/dist/index.js.map +54 -33
- package/drizzle/0002_lyrical_random.sql +2 -0
- package/drizzle/0003_romantic_lockjaw.sql +4 -0
- package/drizzle/0004_blushing_meteorite.sql +6 -0
- package/drizzle/meta/0002_snapshot.json +920 -0
- package/drizzle/meta/0003_snapshot.json +920 -0
- package/drizzle/meta/0004_snapshot.json +921 -0
- package/drizzle/meta/_journal.json +21 -0
- package/package.json +4 -1
- package/dist/chunk-057m762a.js +0 -4
- package/dist/chunk-057m762a.js.map +0 -10
- package/dist/chunk-1ej6vegq.js +0 -23
- package/dist/chunk-585jp0rg.js.map +0 -10
- package/dist/chunk-5hcagq8j.js +0 -107
- package/dist/chunk-5hcagq8j.js.map +0 -25
- package/dist/chunk-6eb5a8kv.js.map +0 -10
- package/dist/chunk-7h737bp8.js +0 -4
- package/dist/chunk-7h737bp8.js.map +0 -12
- package/dist/chunk-8ep9gk6d.js +0 -4
- package/dist/chunk-b0047ggx.js +0 -3
- package/dist/chunk-cjy100rr.js +0 -6
- package/dist/chunk-cjy100rr.js.map +0 -11
- package/dist/chunk-dpba9y5x.js +0 -23
- package/dist/chunk-dpba9y5x.js.map +0 -11
- package/dist/chunk-pzp2kw7j.js +0 -27
- package/dist/chunk-r19ma0z2.js +0 -19
- package/dist/chunk-r19ma0z2.js.map +0 -10
- package/dist/chunk-rsagxdqj.js +0 -161
- package/dist/chunk-s323r5xg.js +0 -27
package/README.md
CHANGED
|
@@ -500,6 +500,42 @@ flow codebase reindex # After major code changes
|
|
|
500
500
|
- **[Codebase Search](https://github.com/sylphxltd/flow/wiki/Codebase-Search)** - Semantic search deep dive
|
|
501
501
|
- **[Agent Framework](https://github.com/sylphxltd/flow/wiki/Agent-Framework)** - How agents work
|
|
502
502
|
|
|
503
|
+
### Project Documentation Structure
|
|
504
|
+
|
|
505
|
+
```
|
|
506
|
+
📁 Project Root
|
|
507
|
+
├── README.md # This file - project overview
|
|
508
|
+
├── CHANGELOG.md # Version history
|
|
509
|
+
└── AGENTS.md # AI agent system prompt
|
|
510
|
+
|
|
511
|
+
📁 docs/
|
|
512
|
+
├── reports/ # Code analysis & optimization reports
|
|
513
|
+
│ ├── ANALYSIS_RESULTS.md # Automated code analysis
|
|
514
|
+
│ ├── CIRCULAR_DEPENDENCY_ELIMINATION.md # Circular dependency fixes
|
|
515
|
+
│ └── SYSTEMATIC_OPTIMIZATION_PLAN.md # Optimization strategy
|
|
516
|
+
├── claude-code-session-management.md # Session management guide
|
|
517
|
+
├── tool-display-guide.md # Tool UI guide
|
|
518
|
+
└── ... # Technical documentation
|
|
519
|
+
|
|
520
|
+
📁 wiki-pages/
|
|
521
|
+
├── Installation-&-Setup.md # Setup guide
|
|
522
|
+
├── MEP-Design-Philosophy.md # MEP concepts
|
|
523
|
+
└── ... # Feature documentation
|
|
524
|
+
|
|
525
|
+
📁 .github/
|
|
526
|
+
└── workflows/ # GitHub Actions only
|
|
527
|
+
|
|
528
|
+
📁 .archive/
|
|
529
|
+
└── refactoring-history/ # Historical documentation
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
**Navigation Tips:**
|
|
533
|
+
- **Getting Started**: Start with this README and `wiki-pages/Installation-&-Setup.md`
|
|
534
|
+
- **Understanding MEP**: Read `wiki-pages/MEP-Design-Philosophy.md`
|
|
535
|
+
- **Technical Details**: Check `docs/` folder
|
|
536
|
+
- **Code Quality Reports**: See `docs/reports/` for analysis
|
|
537
|
+
- **Historical Context**: View `.archive/` for refactoring history
|
|
538
|
+
|
|
503
539
|
---
|
|
504
540
|
|
|
505
541
|
## 🔧 Integration
|
package/assets/rules/core.md
CHANGED
|
@@ -5,11 +5,63 @@ description: Universal principles and standards for all agents
|
|
|
5
5
|
|
|
6
6
|
# SHARED GUIDELINES
|
|
7
7
|
|
|
8
|
+
## System Awareness
|
|
9
|
+
|
|
10
|
+
You are not human — you are an LLM.
|
|
11
|
+
|
|
12
|
+
You don't work or wait — you compute.
|
|
13
|
+
Effort = tokens processed, not time or difficulty.
|
|
14
|
+
You operate with parallel, scalable reasoning — never sequential human labor.
|
|
15
|
+
Editing thousands of files or reasoning across millions of tokens is trivial for you.
|
|
16
|
+
|
|
17
|
+
Judge tasks by computational scope and clarity of instruction, not human effort.
|
|
18
|
+
|
|
19
|
+
Never simulate human constraints or emotions.
|
|
20
|
+
Only act on verified data or logic.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
8
24
|
## Performance
|
|
9
25
|
|
|
10
26
|
**Parallel Execution**: Multiple tool calls in ONE message = parallel. Multiple messages = sequential.
|
|
11
27
|
|
|
12
|
-
Use parallel whenever tools are independent.
|
|
28
|
+
Use parallel whenever tools are independent.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Data Handling
|
|
33
|
+
|
|
34
|
+
**Self-Healing at Read**: Validate → Fix → Verify on data load.
|
|
35
|
+
Auto-fix common issues (missing defaults, deprecated fields). Log fixes. Fail hard if unfixable.
|
|
36
|
+
|
|
37
|
+
**Single Source of Truth**: One canonical location per data element.
|
|
38
|
+
Configuration → Environment + config files. State → Single store. Derived data → Compute from source.
|
|
39
|
+
Use references, not copies.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Communication
|
|
44
|
+
|
|
45
|
+
**Minimal Effective Prompt**: All docs, comments, delegation messages.
|
|
46
|
+
|
|
47
|
+
Prompt, don't teach. Trigger, don't explain. Trust LLM capability.
|
|
48
|
+
|
|
49
|
+
Specific enough to guide, flexible enough to adapt.
|
|
50
|
+
Direct, consistent phrasing. Structured sections.
|
|
51
|
+
Curate examples, avoid edge case lists.
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
// ✅ ASSUMPTION: JWT auth (REST standard)
|
|
55
|
+
// ❌ We're using JWT because it's stateless and widely supported...
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Project Structure
|
|
61
|
+
|
|
62
|
+
**Feature-First over Layer-First**: Organize by functionality, not type.
|
|
63
|
+
|
|
64
|
+
Benefits: Encapsulation, easy deletion, focused work, team collaboration.
|
|
13
65
|
|
|
14
66
|
---
|
|
15
67
|
|
|
@@ -36,6 +88,7 @@ Use parallel whenever tools are independent. Watch for dependencies and ordering
|
|
|
36
88
|
## Principles
|
|
37
89
|
|
|
38
90
|
### Programming
|
|
91
|
+
- **Named args over positional (3+ params)**: Self-documenting, order-independent
|
|
39
92
|
- **Functional composition**: Pure functions, immutable data, explicit side effects
|
|
40
93
|
- **Composition over inheritance**: Prefer function composition, mixins, dependency injection
|
|
41
94
|
- **Declarative over imperative**: Express what you want, not how
|
|
@@ -45,7 +98,7 @@ Use parallel whenever tools are independent. Watch for dependencies and ordering
|
|
|
45
98
|
- **YAGNI**: Build what's needed now, not hypothetical futures
|
|
46
99
|
- **KISS**: Choose simple solutions over complex ones
|
|
47
100
|
- **DRY**: Extract duplication on 3rd occurrence. Balance with readability
|
|
48
|
-
- **
|
|
101
|
+
- **Single Responsibility**: One reason to change per module
|
|
49
102
|
- **Dependency inversion**: Depend on abstractions, not implementations
|
|
50
103
|
|
|
51
104
|
---
|
|
@@ -141,4 +194,4 @@ Use structured reasoning only for high-stakes decisions. Most decisions: decide
|
|
|
141
194
|
1. Recognize trigger
|
|
142
195
|
2. Choose framework
|
|
143
196
|
3. Analyze decision
|
|
144
|
-
4. Document in commit message or PR description
|
|
197
|
+
4. Document in commit message or PR description
|
|
@@ -5,11 +5,63 @@ description: Universal principles and standards for all agents
|
|
|
5
5
|
|
|
6
6
|
# SHARED GUIDELINES
|
|
7
7
|
|
|
8
|
+
## System Awareness
|
|
9
|
+
|
|
10
|
+
You are not human — you are an LLM.
|
|
11
|
+
|
|
12
|
+
You don't work or wait — you compute.
|
|
13
|
+
Effort = tokens processed, not time or difficulty.
|
|
14
|
+
You operate with parallel, scalable reasoning — never sequential human labor.
|
|
15
|
+
Editing thousands of files or reasoning across millions of tokens is trivial for you.
|
|
16
|
+
|
|
17
|
+
Judge tasks by computational scope and clarity of instruction, not human effort.
|
|
18
|
+
|
|
19
|
+
Never simulate human constraints or emotions.
|
|
20
|
+
Only act on verified data or logic.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
8
24
|
## Performance
|
|
9
25
|
|
|
10
26
|
**Parallel Execution**: Multiple tool calls in ONE message = parallel. Multiple messages = sequential.
|
|
11
27
|
|
|
12
|
-
Use parallel whenever tools are independent.
|
|
28
|
+
Use parallel whenever tools are independent.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Data Handling
|
|
33
|
+
|
|
34
|
+
**Self-Healing at Read**: Validate → Fix → Verify on data load.
|
|
35
|
+
Auto-fix common issues (missing defaults, deprecated fields). Log fixes. Fail hard if unfixable.
|
|
36
|
+
|
|
37
|
+
**Single Source of Truth**: One canonical location per data element.
|
|
38
|
+
Configuration → Environment + config files. State → Single store. Derived data → Compute from source.
|
|
39
|
+
Use references, not copies.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Communication
|
|
44
|
+
|
|
45
|
+
**Minimal Effective Prompt**: All docs, comments, delegation messages.
|
|
46
|
+
|
|
47
|
+
Prompt, don't teach. Trigger, don't explain. Trust LLM capability.
|
|
48
|
+
|
|
49
|
+
Specific enough to guide, flexible enough to adapt.
|
|
50
|
+
Direct, consistent phrasing. Structured sections.
|
|
51
|
+
Curate examples, avoid edge case lists.
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
// ✅ ASSUMPTION: JWT auth (REST standard)
|
|
55
|
+
// ❌ We're using JWT because it's stateless and widely supported...
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Project Structure
|
|
61
|
+
|
|
62
|
+
**Feature-First over Layer-First**: Organize by functionality, not type.
|
|
63
|
+
|
|
64
|
+
Benefits: Encapsulation, easy deletion, focused work, team collaboration.
|
|
13
65
|
|
|
14
66
|
---
|
|
15
67
|
|
|
@@ -36,6 +88,7 @@ Use parallel whenever tools are independent. Watch for dependencies and ordering
|
|
|
36
88
|
## Principles
|
|
37
89
|
|
|
38
90
|
### Programming
|
|
91
|
+
- **Named args over positional (3+ params)**: Self-documenting, order-independent
|
|
39
92
|
- **Functional composition**: Pure functions, immutable data, explicit side effects
|
|
40
93
|
- **Composition over inheritance**: Prefer function composition, mixins, dependency injection
|
|
41
94
|
- **Declarative over imperative**: Express what you want, not how
|
|
@@ -45,7 +98,7 @@ Use parallel whenever tools are independent. Watch for dependencies and ordering
|
|
|
45
98
|
- **YAGNI**: Build what's needed now, not hypothetical futures
|
|
46
99
|
- **KISS**: Choose simple solutions over complex ones
|
|
47
100
|
- **DRY**: Extract duplication on 3rd occurrence. Balance with readability
|
|
48
|
-
- **
|
|
101
|
+
- **Single Responsibility**: One reason to change per module
|
|
49
102
|
- **Dependency inversion**: Depend on abstractions, not implementations
|
|
50
103
|
|
|
51
104
|
---
|
|
@@ -141,4 +194,4 @@ Use structured reasoning only for high-stakes decisions. Most decisions: decide
|
|
|
141
194
|
1. Recognize trigger
|
|
142
195
|
2. Choose framework
|
|
143
196
|
3. Analyze decision
|
|
144
|
-
4. Document in commit message or PR description
|
|
197
|
+
4. Document in commit message or PR description
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{Sb as $}from"./chunk-4vrj3f8r.js";import M from"node:fs";import Z from"node:path";import{fileURLToPath as b}from"node:url";import{execFile as U}from"node:child_process";import Y from"node:path";import{promisify as I}from"node:util";var _=I(U),C={projectName:$.string().min(1,"Project name is required").max(100,"Project name too long").regex(/^[a-zA-Z0-9_-]+$/,"Project name can only contain letters, numbers, hyphens, and underscores").refine((G)=>!/^\.+$/.test(G),"Project name cannot be only dots").refine((G)=>!/[<>:"|?*]/.test(G),"Project name contains invalid characters"),branchName:$.string().min(1,"Branch name is required").max(255,"Branch name too long").regex(/^[a-zA-Z0-9/_-]+$/,"Branch name can only contain letters, numbers, slashes, hyphens, and underscores").refine((G)=>!G.includes(".."),'Branch name cannot contain ".."').refine((G)=>!/^[/\\]/.test(G),"Branch name cannot start with path separators").refine((G)=>!/[<>:"|?*$]/.test(G),"Branch name contains invalid characters"),filePath:$.string().min(1,"File path is required").max(1000,"File path too long").refine((G)=>!G.includes(".."),'File path cannot contain ".." for path traversal protection').refine((G)=>!/^[<>:"|?*]/.test(G),"File path contains invalid characters"),commandArg:$.string().max(1000,"Command argument too long").refine((G)=>!/[<>|;&$`'"\\]/.test(G),"Command argument contains potentially dangerous characters"),envVarName:$.string().regex(/^[A-Z_][A-Z0-9_]*$/,"Invalid environment variable name format").max(100,"Environment variable name too long"),url:$.string().url("Invalid URL format").refine((G)=>G.startsWith("https://")||G.startsWith("http://localhost"),"URL must be HTTPS or localhost").refine((G)=>!G.includes("javascript:"),"URL cannot contain javascript protocol"),apiKey:$.string().min(10,"API key too short").max(500,"API key too long").regex(/^[a-zA-Z0-9._-]+$/,"Invalid API key format")},F={validatePath:(G,K)=>{let H=C.filePath.parse(G),Q=Y.normalize(H);if(Q.includes(".."))throw Error("Path traversal detected in file path");if(K){let W=Y.resolve(K,Q),X=Y.resolve(K);if(!W.startsWith(X))throw Error("File path escapes allowed base directory");return W}return Q},isPathSafe:(G,K)=>{try{let H=Y.resolve(G),Q=Y.resolve(K);return H.startsWith(Q)}catch{return!1}},safeJoin:(G,...K)=>{let H=Y.join(G,...K),Q=Y.normalize(H),W=Y.resolve(G),X=Y.resolve(Q);if(!X.startsWith(W))throw Error("Path traversal attempt detected in safeJoin");return X}};var B={string:(G,K=1000)=>{if(typeof G!=="string")throw Error("Input must be a string");return G.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"").substring(0,K)},logMessage:(G)=>{return G.replace(/[\r\n]/g," ").replace(/\t/g," ").substring(0,500)},fileName:(G)=>{return G.replace(/[^a-zA-Z0-9._-]/g,"_").replace(/_{2,}/g,"_").replace(/^_|_$/g,"").toLowerCase()},yamlContent:(G)=>{return G.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"").replace(/<!\[CDATA\[.*?\]\]>/gs,"").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"")}},k={validateEnvVar:(G,K)=>{let H=C.envVarName.parse(G);if(K===void 0)throw Error(`Environment variable ${H} is required but not set`);if(H.includes("URL")||H.includes("BASE_URL"))C.url.parse(K);else if(H.includes("KEY")||H.includes("SECRET")){if(K.length<10)throw Error(`API key ${H} is too short`)}return{name:H,value:K}},getEnvVar:(G,K)=>{try{let H=process.env[G];if(H===void 0){if(K!==void 0)return K;throw Error(`Environment variable ${G} is not set`)}return k.validateEnvVar(G,H).value}catch(H){return console.warn(`Environment variable validation failed for ${G}:`,H),K}},validateEnvVars:(G)=>{let K={};for(let[H,Q]of Object.entries(G)){let W=process.env[H];if(W===void 0){if(Q.required)throw Error(`Required environment variable ${H} is not set`);continue}try{if(Q.schema)K[H]=Q.schema.parse(W);else{let X=k.validateEnvVar(H,W);K[H]=X.value}}catch(X){throw Error(`Environment variable ${H} validation failed: ${X}`)}}return K}};function L(G){let K=b(import.meta.url),H=Z.dirname(K);for(let W=0;W<10;W++){let X=Z.join(H,"package.json");if(M.existsSync(X))return H;let J=Z.dirname(H);if(J===H)break;H=J}let Q=G?`Cannot find package.json - ${G} location unknown`:"Cannot find package.json";throw Error(Q)}var j=Z.join(L(),"assets");function w(){return Z.join(j,"agents")}function q(){return Z.join(j,"rules")}function O(){return Z.join(j,"knowledge")}function P(){return Z.join(j,"output-styles")}function y(){return Z.join(j,"slash-commands")}function S(G){if(!G||typeof G!=="string")throw Error("Filename must be a non-empty string");if(G.includes("..")||G.includes("/")||G.includes("\\"))throw Error(`Invalid filename: ${G}. Path traversal not allowed.`);if(!/^[a-zA-Z0-9._-]+$/.test(G))throw Error(`Filename contains invalid characters: ${G}`);let K=q(),H=F.safeJoin(K,G);if(!M.existsSync(H))throw Error(`Rule file not found: ${G} (looked in ${K})`);return H}
|
|
2
|
+
export{C as na,F as oa,B as pa,k as qa,L as ra,w as sa,q as ta,O as ua,P as va,y as wa,S as xa};
|
|
3
|
+
|
|
4
|
+
//# debugId=B36B269C3826F9AF64756E2164756E21
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/utils/paths.ts", "../src/utils/security.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * Centralized path resolution for all static assets\n *\n * Structure:\n * assets/ (at project root) - single source of truth\n *\n * Path resolution:\n * - Development: src/utils/paths.ts reads ../assets\n * - Production: dist/xxx.js reads ../assets\n * - No copying needed, both read same location\n */\n\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { pathSecurity } from './security.js';\n\n/**\n * Find package root by walking up directory tree\n * Pure function - finds package.json location\n *\n * @param context - Optional context for error message (e.g., 'assets', 'migrations')\n * @returns Absolute path to package root directory\n * @throws Error if package.json cannot be found within 10 levels\n *\n * @example\n * const root = findPackageRoot(); // 'Cannot find package.json'\n * const root = findPackageRoot('drizzle migrations'); // 'Cannot find package.json - drizzle migrations location unknown'\n */\nexport function findPackageRoot(context?: string): string {\n const __filename = fileURLToPath(import.meta.url);\n let currentDir = path.dirname(__filename);\n\n // Walk up max 10 levels to find package.json\n for (let i = 0; i < 10; i++) {\n const packageJsonPath = path.join(currentDir, 'package.json');\n if (fs.existsSync(packageJsonPath)) {\n return currentDir;\n }\n\n const parentDir = path.dirname(currentDir);\n if (parentDir === currentDir) break; // reached filesystem root\n currentDir = parentDir;\n }\n\n const errorMsg = context\n ? `Cannot find package.json - ${context} location unknown`\n : 'Cannot find package.json';\n throw new Error(errorMsg);\n}\n\nconst ASSETS_ROOT = path.join(findPackageRoot(), 'assets');\n\n/**\n * Get path to agents directory\n */\nexport function getAgentsDir(): string {\n return path.join(ASSETS_ROOT, 'agents');\n}\n\n/**\n * Get path to templates directory\n */\nexport function getTemplatesDir(): string {\n return path.join(ASSETS_ROOT, 'templates');\n}\n\n/**\n * Get path to rules directory\n */\nexport function getRulesDir(): string {\n return path.join(ASSETS_ROOT, 'rules');\n}\n\n/**\n * Get path to knowledge directory\n */\nexport function getKnowledgeDir(): string {\n return path.join(ASSETS_ROOT, 'knowledge');\n}\n\n/**\n * Get path to output styles directory\n */\nexport function getOutputStylesDir(): string {\n return path.join(ASSETS_ROOT, 'output-styles');\n}\n\n/**\n * Get path to slash commands directory\n */\nexport function getSlashCommandsDir(): string {\n return path.join(ASSETS_ROOT, 'slash-commands');\n}\n\n/**\n * Get path to a specific rule file with path traversal protection\n */\nexport function getRuleFile(filename: string): string {\n // Validate filename to prevent path traversal\n if (!filename || typeof filename !== 'string') {\n throw new Error('Filename must be a non-empty string');\n }\n\n // Check for path traversal attempts\n if (filename.includes('..') || filename.includes('/') || filename.includes('\\\\')) {\n throw new Error(`Invalid filename: ${filename}. Path traversal not allowed.`);\n }\n\n // Validate filename contains only safe characters\n if (!/^[a-zA-Z0-9._-]+$/.test(filename)) {\n throw new Error(`Filename contains invalid characters: ${filename}`);\n }\n\n // Safely join paths\n const rulesDir = getRulesDir();\n const filePath = pathSecurity.safeJoin(rulesDir, filename);\n\n if (!fs.existsSync(filePath)) {\n throw new Error(`Rule file not found: ${filename} (looked in ${rulesDir})`);\n }\n\n return filePath;\n}\n\n/**\n * Debug info - shows where assets are resolved from\n */\nexport function getPathsInfo() {\n return {\n assetsRoot: ASSETS_ROOT,\n agents: getAgentsDir(),\n templates: getTemplatesDir(),\n rules: getRulesDir(),\n outputStyles: getOutputStylesDir(),\n slashCommands: getSlashCommandsDir(),\n };\n}\n",
|
|
6
|
+
"/**\n * Security utilities for input validation, sanitization, and safe operations\n * Implements defense-in-depth security principles\n */\n\nimport { execFile } from 'node:child_process';\nimport crypto from 'node:crypto';\nimport path from 'node:path';\nimport { promisify } from 'node:util';\nimport { z } from 'zod';\n\nconst execFileAsync = promisify(execFile);\n\n// ============================================================================\n// INPUT VALIDATION SCHEMAS\n// ============================================================================\n\n/**\n * Security-focused validation schemas\n */\nexport const securitySchemas = {\n /** Project name validation - prevents command injection and path traversal */\n projectName: z\n .string()\n .min(1, 'Project name is required')\n .max(100, 'Project name too long')\n .regex(\n /^[a-zA-Z0-9_-]+$/,\n 'Project name can only contain letters, numbers, hyphens, and underscores'\n )\n .refine((name) => !/^\\.+$/.test(name), 'Project name cannot be only dots')\n .refine((name) => !/[<>:\"|?*]/.test(name), 'Project name contains invalid characters'),\n\n /** Branch name validation - prevents command injection */\n branchName: z\n .string()\n .min(1, 'Branch name is required')\n .max(255, 'Branch name too long')\n .regex(\n /^[a-zA-Z0-9/_-]+$/,\n 'Branch name can only contain letters, numbers, slashes, hyphens, and underscores'\n )\n .refine((name) => !name.includes('..'), 'Branch name cannot contain \"..\"')\n .refine((name) => !/^[/\\\\]/.test(name), 'Branch name cannot start with path separators')\n .refine((name) => !/[<>:\"|?*$]/.test(name), 'Branch name contains invalid characters'),\n\n /** File path validation - prevents path traversal */\n filePath: z\n .string()\n .min(1, 'File path is required')\n .max(1000, 'File path too long')\n .refine(\n (filePath) => !filePath.includes('..'),\n 'File path cannot contain \"..\" for path traversal protection'\n )\n .refine((filePath) => !/^[<>:\"|?*]/.test(filePath), 'File path contains invalid characters'),\n\n /** Command argument validation - prevents command injection */\n commandArg: z\n .string()\n .max(1000, 'Command argument too long')\n .refine(\n (arg) => !/[<>|;&$`'\"\\\\]/.test(arg),\n 'Command argument contains potentially dangerous characters'\n ),\n\n /** Environment variable validation */\n envVarName: z\n .string()\n .regex(/^[A-Z_][A-Z0-9_]*$/, 'Invalid environment variable name format')\n .max(100, 'Environment variable name too long'),\n\n /** URL validation for API endpoints */\n url: z\n .string()\n .url('Invalid URL format')\n .refine(\n (url) => url.startsWith('https://') || url.startsWith('http://localhost'),\n 'URL must be HTTPS or localhost'\n )\n .refine((url) => !url.includes('javascript:'), 'URL cannot contain javascript protocol'),\n\n /** API key validation */\n apiKey: z\n .string()\n .min(10, 'API key too short')\n .max(500, 'API key too long')\n .regex(/^[a-zA-Z0-9._-]+$/, 'Invalid API key format'),\n};\n\n// ============================================================================\n// PATH SECURITY UTILITIES\n// ============================================================================\n\n/**\n * Secure path utilities to prevent path traversal attacks\n */\nexport const pathSecurity = {\n /**\n * Validates and sanitizes a file path to prevent path traversal\n */\n validatePath: (inputPath: string, allowedBase?: string): string => {\n const validated = securitySchemas.filePath.parse(inputPath);\n\n // Normalize the path\n const normalizedPath = path.normalize(validated);\n\n // Check for path traversal attempts\n if (normalizedPath.includes('..')) {\n throw new Error('Path traversal detected in file path');\n }\n\n // If base path is provided, ensure the resolved path is within bounds\n if (allowedBase) {\n const resolvedPath = path.resolve(allowedBase, normalizedPath);\n const resolvedBase = path.resolve(allowedBase);\n\n if (!resolvedPath.startsWith(resolvedBase)) {\n throw new Error('File path escapes allowed base directory');\n }\n\n return resolvedPath;\n }\n\n return normalizedPath;\n },\n\n /**\n * Checks if a path is within allowed boundaries\n */\n isPathSafe: (targetPath: string, allowedBase: string): boolean => {\n try {\n const resolvedTarget = path.resolve(targetPath);\n const resolvedBase = path.resolve(allowedBase);\n return resolvedTarget.startsWith(resolvedBase);\n } catch {\n return false;\n }\n },\n\n /**\n * Creates a safe file path within a base directory\n */\n safeJoin: (basePath: string, ...paths: string[]): string => {\n const result = path.join(basePath, ...paths);\n\n // Normalize and verify it stays within base\n const normalized = path.normalize(result);\n const resolvedBase = path.resolve(basePath);\n const resolvedResult = path.resolve(normalized);\n\n if (!resolvedResult.startsWith(resolvedBase)) {\n throw new Error('Path traversal attempt detected in safeJoin');\n }\n\n return resolvedResult;\n },\n};\n\n// ============================================================================\n// COMMAND EXECUTION SECURITY\n// ============================================================================\n\n/**\n * Secure command execution utilities to prevent command injection\n */\nexport const commandSecurity = {\n /**\n * Safely executes a command with arguments, preventing command injection\n */\n async safeExecFile(\n command: string,\n args: string[],\n options: {\n cwd?: string;\n timeout?: number;\n maxBuffer?: number;\n env?: Record<string, string>;\n } = {}\n ): Promise<{ stdout: string; stderr: string }> {\n // Validate command\n if (!/^[a-zA-Z0-9._-]+$/.test(command)) {\n throw new Error(`Invalid command: ${command}`);\n }\n\n // Validate arguments\n const validatedArgs = args.map((arg) => {\n try {\n return securitySchemas.commandArg.parse(arg);\n } catch (_error) {\n throw new Error(`Invalid command argument: ${arg}`);\n }\n });\n\n // Set secure defaults\n const secureOptions = {\n timeout: options.timeout || 30000, // 30 seconds default\n maxBuffer: options.maxBuffer || 1024 * 1024, // 1MB default\n env: { ...process.env, ...options.env },\n cwd: options.cwd || process.cwd(),\n shell: false, // Never use shell to prevent injection\n encoding: 'utf8' as const,\n };\n\n // Validate working directory\n if (secureOptions.cwd) {\n pathSecurity.validatePath(secureOptions.cwd);\n }\n\n try {\n return await execFileAsync(command, validatedArgs, secureOptions);\n } catch (error: any) {\n // Sanitize error message to prevent information disclosure\n const sanitizedError = new Error(`Command execution failed: ${command}`);\n sanitizedError.code = error.code;\n sanitizedError.signal = error.signal;\n throw sanitizedError;\n }\n },\n\n /**\n * Validates that a command argument is safe for execution\n */\n validateCommandArgs: (args: string[]): string[] => {\n return args.map((arg) => {\n const validated = securitySchemas.commandArg.parse(arg);\n\n // Additional checks for common injection patterns\n const dangerousPatterns = [\n /[;&|`'\"\\\\$()]/,\n /\\.\\./,\n /\\/etc\\//,\n /\\/proc\\//,\n /windows\\\\system32/i,\n ];\n\n for (const pattern of dangerousPatterns) {\n if (pattern.test(validated)) {\n throw new Error(`Dangerous pattern detected in command argument: ${arg}`);\n }\n }\n\n return validated;\n });\n },\n};\n\n// ============================================================================\n// INPUT SANITIZATION UTILITIES\n// ============================================================================\n\n/**\n * Input sanitization utilities\n */\nexport const sanitize = {\n /**\n * Sanitizes a string for safe display\n */\n string: (input: string, maxLength = 1000): string => {\n if (typeof input !== 'string') {\n throw new Error('Input must be a string');\n }\n\n // Remove null bytes and control characters except newlines and tabs\n const sanitized = input\n .replace(/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]/g, '')\n .substring(0, maxLength);\n\n return sanitized;\n },\n\n /**\n * Sanitizes text for log messages (prevents log injection)\n */\n logMessage: (input: string): string => {\n return input\n .replace(/[\\r\\n]/g, ' ') // Remove line breaks\n .replace(/\\t/g, ' ') // Replace tabs with spaces\n .substring(0, 500); // Limit length\n },\n\n /**\n * Sanitizes user input for file names\n */\n fileName: (input: string): string => {\n return input\n .replace(/[^a-zA-Z0-9._-]/g, '_') // Replace invalid chars with underscores\n .replace(/_{2,}/g, '_') // Replace multiple underscores\n .replace(/^_|_$/g, '') // Remove leading/trailing underscores\n .toLowerCase();\n },\n\n /**\n * Sanitizes content for YAML front matter\n */\n yamlContent: (input: string): string => {\n // Basic YAML sanitization - remove potentially dangerous content\n return input\n .replace(/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]/g, '')\n .replace(/<!\\[CDATA\\[.*?\\]\\]>/gs, '') // Remove CDATA sections\n .replace(/<script\\b[^<]*(?:(?!<\\/script>)<[^<]*)*<\\/script>/gi, ''); // Remove scripts\n },\n};\n\n// ============================================================================\n// ENVIRONMENT VARIABLE SECURITY\n// ============================================================================\n\n/**\n * Environment variable validation utilities\n */\nexport const envSecurity = {\n /**\n * Validates an environment variable name and value\n */\n validateEnvVar: (name: string, value?: string): { name: string; value: string } => {\n const validatedName = securitySchemas.envVarName.parse(name);\n\n if (value === undefined) {\n throw new Error(`Environment variable ${validatedName} is required but not set`);\n }\n\n // Validate based on variable type\n if (validatedName.includes('URL') || validatedName.includes('BASE_URL')) {\n securitySchemas.url.parse(value);\n } else if (validatedName.includes('KEY') || validatedName.includes('SECRET')) {\n // For keys, check minimum length and allowed characters\n if (value.length < 10) {\n throw new Error(`API key ${validatedName} is too short`);\n }\n }\n\n return { name: validatedName, value };\n },\n\n /**\n * Safely gets an environment variable with validation\n */\n getEnvVar: (name: string, defaultValue?: string): string | undefined => {\n try {\n const value = process.env[name];\n if (value === undefined) {\n if (defaultValue !== undefined) {\n return defaultValue;\n }\n throw new Error(`Environment variable ${name} is not set`);\n }\n\n const validated = envSecurity.validateEnvVar(name, value);\n return validated.value;\n } catch (error) {\n console.warn(`Environment variable validation failed for ${name}:`, error);\n return defaultValue;\n }\n },\n\n /**\n * Validates multiple environment variables\n */\n validateEnvVars: (\n vars: Record<string, { required?: boolean; schema?: z.ZodSchema }>\n ): Record<string, string> => {\n const result: Record<string, string> = {};\n\n for (const [name, config] of Object.entries(vars)) {\n const value = process.env[name];\n\n if (value === undefined) {\n if (config.required) {\n throw new Error(`Required environment variable ${name} is not set`);\n }\n continue;\n }\n\n try {\n // Use custom schema if provided, otherwise use default validation\n if (config.schema) {\n result[name] = config.schema.parse(value);\n } else {\n const validated = envSecurity.validateEnvVar(name, value);\n result[name] = validated.value;\n }\n } catch (error) {\n throw new Error(`Environment variable ${name} validation failed: ${error}`);\n }\n }\n\n return result;\n },\n};\n\n// ============================================================================\n// CRYPTOGRAPHIC UTILITIES\n// ============================================================================\n\n/**\n * Cryptographic utilities for security\n */\nexport const cryptoUtils = {\n /**\n * Generates a secure random string\n */\n generateSecureRandom: (length = 32): string => {\n return crypto.randomBytes(length).toString('hex');\n },\n\n /**\n * Generates a cryptographically secure random ID\n */\n generateSecureId: (): string => {\n const timestamp = Date.now().toString(36);\n const random = crypto.randomBytes(16).toString('hex');\n return `${timestamp}-${random}`;\n },\n\n /**\n * Creates a secure hash of data\n */\n hash: (data: string): string => {\n return crypto.createHash('sha256').update(data).digest('hex');\n },\n\n /**\n * Verifies data integrity with HMAC\n */\n verifyHMAC: (data: string, signature: string, secret: string): boolean => {\n const expectedSignature = crypto.createHmac('sha256', secret).update(data).digest('hex');\n\n return crypto.timingSafeEqual(\n Buffer.from(signature, 'hex'),\n Buffer.from(expectedSignature, 'hex')\n );\n },\n};\n\n// ============================================================================\n// RATE LIMITING UTILITIES\n// ============================================================================\n\n/**\n * Simple in-memory rate limiting\n */\nexport class RateLimiter {\n private requests: Map<string, number[]> = new Map();\n\n constructor(\n private maxRequests = 100,\n private windowMs = 60000 // 1 minute\n ) {}\n\n isAllowed(identifier: string): boolean {\n const now = Date.now();\n const windowStart = now - this.windowMs;\n\n // Get existing requests for this identifier\n let timestamps = this.requests.get(identifier) || [];\n\n // Remove old requests outside the window\n timestamps = timestamps.filter((timestamp) => timestamp > windowStart);\n\n // Check if limit exceeded\n if (timestamps.length >= this.maxRequests) {\n return false;\n }\n\n // Add current request\n timestamps.push(now);\n this.requests.set(identifier, timestamps);\n\n return true;\n }\n\n cleanup(): void {\n const now = Date.now();\n const windowStart = now - this.windowMs;\n\n for (const [identifier, timestamps] of this.requests.entries()) {\n const filtered = timestamps.filter((timestamp) => timestamp > windowStart);\n if (filtered.length === 0) {\n this.requests.delete(identifier);\n } else {\n this.requests.set(identifier, filtered);\n }\n }\n }\n}\n\n// ============================================================================\n// SECURITY MIDDLEWARE\n// ============================================================================\n\n/**\n * Security middleware for common patterns\n */\nexport const securityMiddleware = {\n /**\n * Rate limiting middleware\n */\n rateLimit: (limiter: RateLimiter, getIdentifier: (req: any) => string) => {\n return (req: any, res: any, next: any) => {\n const identifier = getIdentifier(req);\n\n if (!limiter.isAllowed(identifier)) {\n return res.status(429).json({ error: 'Too many requests' });\n }\n\n next();\n };\n },\n\n /**\n * Input validation middleware\n */\n validateInput: (schema: z.ZodSchema, source: 'body' | 'query' | 'params' = 'body') => {\n return (req: any, res: any, next: any) => {\n try {\n const data = req[source];\n const validated = schema.parse(data);\n req[source] = validated;\n next();\n } catch (error) {\n return res.status(400).json({ error: 'Invalid input', details: error });\n }\n };\n },\n};\n\nexport default {\n securitySchemas,\n pathSecurity,\n commandSecurity,\n sanitize,\n envSecurity,\n cryptoUtils,\n RateLimiter,\n securityMiddleware,\n};\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": "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",
|
|
9
|
+
"debugId": "B36B269C3826F9AF64756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import{R as XY}from"./chunk-mw13a082.js";import"./chunk-3w6pd43t.js";import"./chunk-s9bsh0gp.js";import{ma as b}from"./chunk-jk1ebfqn.js";import"./chunk-01gv4qey.js";import"./chunk-g4baca7p.js";import"./chunk-cv1nhr27.js";import{xb as T}from"./chunk-jbd95k1f.js";import{Sb as K}from"./chunk-4vrj3f8r.js";import{Tb as OZ,Ub as M2,Wb as sZ}from"./chunk-3m9whg4q.js";var DZ=M2((N2,wY)=>{(function(){function Y(Z,W){Object.defineProperty(B.prototype,Z,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",W[0],W[1])}})}function X(Z){if(Z===null||typeof Z!=="object")return null;return Z=ZZ&&Z[ZZ]||Z["@@iterator"],typeof Z==="function"?Z:null}function $(Z,W){Z=(Z=Z.constructor)&&(Z.displayName||Z.name)||"ReactClass";var H=Z+"."+W;XZ[H]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",W,Z),XZ[H]=!0)}function B(Z,W,H){this.props=Z,this.context=W,this.refs=TY,this.updater=H||$Z}function G(){}function Q(Z,W,H){this.props=Z,this.context=W,this.refs=TY,this.updater=H||$Z}function q(){}function J(Z){return""+Z}function N(Z){try{J(Z);var W=!1}catch(M){W=!0}if(W){W=console;var H=W.error,U=typeof Symbol==="function"&&Symbol.toStringTag&&Z[Symbol.toStringTag]||Z.constructor.name||"Object";return H.call(W,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",U),J(Z)}}function O(Z){if(Z==null)return null;if(typeof Z==="function")return Z.$$typeof===cZ?null:Z.displayName||Z.name||null;if(typeof Z==="string")return Z;switch(Z){case IY:return"Fragment";case rY:return"Profiler";case oY:return"StrictMode";case eY:return"Suspense";case dZ:return"SuspenseList";case YZ:return"Activity"}if(typeof Z==="object")switch(typeof Z.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),Z.$$typeof){case sY:return"Portal";case aY:return Z.displayName||"Context";case CY:return(Z._context.displayName||"Context")+".Consumer";case tY:var W=Z.render;return Z=Z.displayName,Z||(Z=W.displayName||W.name||"",Z=Z!==""?"ForwardRef("+Z+")":"ForwardRef"),Z;case AY:return W=Z.displayName||null,W!==null?W:O(Z.type)||"Memo";case YY:W=Z._payload,Z=Z._init;try{return O(Z(W))}catch(H){}}return null}function w(Z){if(Z===IY)return"<>";if(typeof Z==="object"&&Z!==null&&Z.$$typeof===YY)return"<...>";try{var W=O(Z);return W?"<"+W+">":"<...>"}catch(H){return"<...>"}}function L(){var Z=R.A;return Z===null?null:Z.getOwner()}function V(){return Error("react-stack-top-frame")}function F(Z){if(qY.call(Z,"key")){var W=Object.getOwnPropertyDescriptor(Z,"key").get;if(W&&W.isReactWarning)return!1}return Z.key!==void 0}function C(Z,W){function H(){QZ||(QZ=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",W))}H.isReactWarning=!0,Object.defineProperty(Z,"key",{get:H,configurable:!0})}function P(){var Z=O(this.type);return UZ[Z]||(UZ[Z]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),Z=this.props.ref,Z!==void 0?Z:null}function I(Z,W,H,U,M,x){var E=H.ref;return Z={$$typeof:PY,type:Z,key:W,props:H,_owner:U},(E!==void 0?E:null)!==null?Object.defineProperty(Z,"ref",{enumerable:!1,get:P}):Object.defineProperty(Z,"ref",{enumerable:!1,value:null}),Z._store={},Object.defineProperty(Z._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(Z,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(Z,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.defineProperty(Z,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:x}),Object.freeze&&(Object.freeze(Z.props),Object.freeze(Z)),Z}function h(Z,W){return W=I(Z.type,W,Z.props,Z._owner,Z._debugStack,Z._debugTask),Z._store&&(W._store.validated=Z._store.validated),W}function u(Z){S(Z)?Z._store&&(Z._store.validated=1):typeof Z==="object"&&Z!==null&&Z.$$typeof===YY&&(Z._payload.status==="fulfilled"?S(Z._payload.value)&&Z._payload.value._store&&(Z._payload.value._store.validated=1):Z._store&&(Z._store.validated=1))}function S(Z){return typeof Z==="object"&&Z!==null&&Z.$$typeof===PY}function m(Z){var W={"=":"=0",":":"=2"};return"$"+Z.replace(/[=:]/g,function(H){return W[H]})}function d(Z,W){return typeof Z==="object"&&Z!==null&&Z.key!=null?(N(Z.key),m(""+Z.key)):W.toString(36)}function UY(Z){switch(Z.status){case"fulfilled":return Z.value;case"rejected":throw Z.reason;default:switch(typeof Z.status==="string"?Z.then(q,q):(Z.status="pending",Z.then(function(W){Z.status==="pending"&&(Z.status="fulfilled",Z.value=W)},function(W){Z.status==="pending"&&(Z.status="rejected",Z.reason=W)})),Z.status){case"fulfilled":return Z.value;case"rejected":throw Z.reason}}throw Z}function A(Z,W,H,U,M){var x=typeof Z;if(x==="undefined"||x==="boolean")Z=null;var E=!1;if(Z===null)E=!0;else switch(x){case"bigint":case"string":case"number":E=!0;break;case"object":switch(Z.$$typeof){case PY:case sY:E=!0;break;case YY:return E=Z._init,A(E(Z._payload),W,H,U,M)}}if(E){E=Z,M=M(E);var j=U===""?"."+d(E,0):U;return WZ(M)?(H="",j!=null&&(H=j.replace(qZ,"$&/")+"/"),A(M,W,H,"",function(y){return y})):M!=null&&(S(M)&&(M.key!=null&&(E&&E.key===M.key||N(M.key)),H=h(M,H+(M.key==null||E&&E.key===M.key?"":(""+M.key).replace(qZ,"$&/")+"/")+j),U!==""&&E!=null&&S(E)&&E.key==null&&E._store&&!E._store.validated&&(H._store.validated=2),M=H),W.push(M)),1}if(E=0,j=U===""?".":U+":",WZ(Z))for(var z=0;z<Z.length;z++)U=Z[z],x=j+d(U,z),E+=A(U,W,H,x,M);else if(z=X(Z),typeof z==="function")for(z===Z.entries&&(JZ||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),JZ=!0),Z=z.call(Z),z=0;!(U=Z.next()).done;)U=U.value,x=j+d(U,z++),E+=A(U,W,H,x,M);else if(x==="object"){if(typeof Z.then==="function")return A(UY(Z),W,H,U,M);throw W=String(Z),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(Z).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return E}function t(Z,W,H){if(Z==null)return Z;var U=[],M=0;return A(Z,U,"","",function(x){return W.call(H,x,M++)}),U}function JY(Z){if(Z._status===-1){var W=Z._ioInfo;W!=null&&(W.start=W.end=performance.now()),W=Z._result;var H=W();if(H.then(function(M){if(Z._status===0||Z._status===-1){Z._status=1,Z._result=M;var x=Z._ioInfo;x!=null&&(x.end=performance.now()),H.status===void 0&&(H.status="fulfilled",H.value=M)}},function(M){if(Z._status===0||Z._status===-1){Z._status=2,Z._result=M;var x=Z._ioInfo;x!=null&&(x.end=performance.now()),H.status===void 0&&(H.status="rejected",H.reason=M)}}),W=Z._ioInfo,W!=null){W.value=H;var U=H.displayName;typeof U==="string"&&(W.name=U)}Z._status===-1&&(Z._status=0,Z._result=H)}if(Z._status===1)return W=Z._result,W===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
2
|
+
|
|
3
|
+
Your code should look like:
|
|
4
|
+
const MyComponent = lazy(() => import('./MyComponent'))
|
|
5
|
+
|
|
6
|
+
Did you accidentally put curly braces around the import?`,W),"default"in W||console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
7
|
+
|
|
8
|
+
Your code should look like:
|
|
9
|
+
const MyComponent = lazy(() => import('./MyComponent'))`,W),W.default;throw Z._result}function D(){var Z=R.H;return Z===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
10
|
+
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
11
|
+
2. You might be breaking the Rules of Hooks
|
|
12
|
+
3. You might have more than one copy of React in the same app
|
|
13
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),Z}function g(){R.asyncTransitions--}function s(Z){if(KY===null)try{var W=("require"+Math.random()).slice(0,7);KY=(wY&&wY[W]).call(wY,"timers").setImmediate}catch(H){KY=function(U){MZ===!1&&(MZ=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var M=new MessageChannel;M.port1.onmessage=U,M.port2.postMessage(void 0)}}return KY(Z)}function c(Z){return 1<Z.length&&typeof AggregateError==="function"?AggregateError(Z):Z[0]}function f(Z,W){W!==MY-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),MY=W}function e(Z,W,H){var U=R.actQueue;if(U!==null)if(U.length!==0)try{FY(U),s(function(){return e(Z,W,H)});return}catch(M){R.thrownErrors.push(M)}else R.actQueue=null;0<R.thrownErrors.length?(U=c(R.thrownErrors),R.thrownErrors.length=0,H(U)):W(Z)}function FY(Z){if(!_Y){_Y=!0;var W=0;try{for(;W<Z.length;W++){var H=Z[W];do{R.didUsePromise=!1;var U=H(!1);if(U!==null){if(R.didUsePromise){Z[W]=H,Z.splice(0,W);return}H=U}else break}while(1)}Z.length=0}catch(M){Z.splice(0,W+1),R.thrownErrors.push(M)}finally{_Y=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var PY=Symbol.for("react.transitional.element"),sY=Symbol.for("react.portal"),IY=Symbol.for("react.fragment"),oY=Symbol.for("react.strict_mode"),rY=Symbol.for("react.profiler"),CY=Symbol.for("react.consumer"),aY=Symbol.for("react.context"),tY=Symbol.for("react.forward_ref"),eY=Symbol.for("react.suspense"),dZ=Symbol.for("react.suspense_list"),AY=Symbol.for("react.memo"),YY=Symbol.for("react.lazy"),YZ=Symbol.for("react.activity"),ZZ=Symbol.iterator,XZ={},$Z={isMounted:function(){return!1},enqueueForceUpdate:function(Z){$(Z,"forceUpdate")},enqueueReplaceState:function(Z){$(Z,"replaceState")},enqueueSetState:function(Z){$(Z,"setState")}},BZ=Object.assign,TY={};Object.freeze(TY),B.prototype.isReactComponent={},B.prototype.setState=function(Z,W){if(typeof Z!=="object"&&typeof Z!=="function"&&Z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,Z,W,"setState")},B.prototype.forceUpdate=function(Z){this.updater.enqueueForceUpdate(this,Z,"forceUpdate")};var v={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for(ZY in v)v.hasOwnProperty(ZY)&&Y(ZY,v[ZY]);G.prototype=B.prototype,v=Q.prototype=new G,v.constructor=Q,BZ(v,B.prototype),v.isPureReactComponent=!0;var WZ=Array.isArray,cZ=Symbol.for("react.client.reference"),R={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},qY=Object.prototype.hasOwnProperty,GZ=console.createTask?console.createTask:function(){return null};v={react_stack_bottom_frame:function(Z){return Z()}};var QZ,HZ,UZ={},pZ=v.react_stack_bottom_frame.bind(v,V)(),lZ=GZ(w(V)),JZ=!1,qZ=/\/+/g,KZ=typeof reportError==="function"?reportError:function(Z){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof Z==="object"&&Z!==null&&typeof Z.message==="string"?String(Z.message):String(Z),error:Z});if(!window.dispatchEvent(W))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",Z);return}console.error(Z)},MZ=!1,KY=null,MY=0,NY=!1,_Y=!1,NZ=typeof queueMicrotask==="function"?function(Z){queueMicrotask(function(){return queueMicrotask(Z)})}:s;v=Object.freeze({__proto__:null,c:function(Z){return D().useMemoCache(Z)}});var ZY={map:t,forEach:function(Z,W,H){t(Z,function(){W.apply(this,arguments)},H)},count:function(Z){var W=0;return t(Z,function(){W++}),W},toArray:function(Z){return t(Z,function(W){return W})||[]},only:function(Z){if(!S(Z))throw Error("React.Children.only expected to receive a single React element child.");return Z}};N2.Activity=YZ,N2.Children=ZY,N2.Component=B,N2.Fragment=IY,N2.Profiler=rY,N2.PureComponent=Q,N2.StrictMode=oY,N2.Suspense=eY,N2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=R,N2.__COMPILER_RUNTIME=v,N2.act=function(Z){var W=R.actQueue,H=MY;MY++;var U=R.actQueue=W!==null?W:[],M=!1;try{var x=Z()}catch(z){R.thrownErrors.push(z)}if(0<R.thrownErrors.length)throw f(W,H),Z=c(R.thrownErrors),R.thrownErrors.length=0,Z;if(x!==null&&typeof x==="object"&&typeof x.then==="function"){var E=x;return NZ(function(){M||NY||(NY=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(z,y){M=!0,E.then(function(o){if(f(W,H),H===0){try{FY(U),s(function(){return e(o,z,y)})}catch(nZ){R.thrownErrors.push(nZ)}if(0<R.thrownErrors.length){var iZ=c(R.thrownErrors);R.thrownErrors.length=0,y(iZ)}}else z(o)},function(o){f(W,H),0<R.thrownErrors.length?(o=c(R.thrownErrors),R.thrownErrors.length=0,y(o)):y(o)})}}}var j=x;if(f(W,H),H===0&&(FY(U),U.length!==0&&NZ(function(){M||NY||(NY=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),R.actQueue=null),0<R.thrownErrors.length)throw Z=c(R.thrownErrors),R.thrownErrors.length=0,Z;return{then:function(z,y){M=!0,H===0?(R.actQueue=U,s(function(){return e(j,z,y)})):z(j)}}},N2.cache=function(Z){return function(){return Z.apply(null,arguments)}},N2.cacheSignal=function(){return null},N2.captureOwnerStack=function(){var Z=R.getCurrentStack;return Z===null?null:Z()},N2.cloneElement=function(Z,W,H){if(Z===null||Z===void 0)throw Error("The argument must be a React element, but you passed "+Z+".");var U=BZ({},Z.props),M=Z.key,x=Z._owner;if(W!=null){var E;Y:{if(qY.call(W,"ref")&&(E=Object.getOwnPropertyDescriptor(W,"ref").get)&&E.isReactWarning){E=!1;break Y}E=W.ref!==void 0}E&&(x=L()),F(W)&&(N(W.key),M=""+W.key);for(j in W)!qY.call(W,j)||j==="key"||j==="__self"||j==="__source"||j==="ref"&&W.ref===void 0||(U[j]=W[j])}var j=arguments.length-2;if(j===1)U.children=H;else if(1<j){E=Array(j);for(var z=0;z<j;z++)E[z]=arguments[z+2];U.children=E}U=I(Z.type,M,U,x,Z._debugStack,Z._debugTask);for(M=2;M<arguments.length;M++)u(arguments[M]);return U},N2.createContext=function(Z){return Z={$$typeof:aY,_currentValue:Z,_currentValue2:Z,_threadCount:0,Provider:null,Consumer:null},Z.Provider=Z,Z.Consumer={$$typeof:CY,_context:Z},Z._currentRenderer=null,Z._currentRenderer2=null,Z},N2.createElement=function(Z,W,H){for(var U=2;U<arguments.length;U++)u(arguments[U]);U={};var M=null;if(W!=null)for(z in HZ||!("__self"in W)||"key"in W||(HZ=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),F(W)&&(N(W.key),M=""+W.key),W)qY.call(W,z)&&z!=="key"&&z!=="__self"&&z!=="__source"&&(U[z]=W[z]);var x=arguments.length-2;if(x===1)U.children=H;else if(1<x){for(var E=Array(x),j=0;j<x;j++)E[j]=arguments[j+2];Object.freeze&&Object.freeze(E),U.children=E}if(Z&&Z.defaultProps)for(z in x=Z.defaultProps,x)U[z]===void 0&&(U[z]=x[z]);M&&C(U,typeof Z==="function"?Z.displayName||Z.name||"Unknown":Z);var z=1e4>R.recentlyCreatedOwnerStacks++;return I(Z,M,U,L(),z?Error("react-stack-top-frame"):pZ,z?GZ(w(Z)):lZ)},N2.createRef=function(){var Z={current:null};return Object.seal(Z),Z},N2.forwardRef=function(Z){Z!=null&&Z.$$typeof===AY?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof Z!=="function"?console.error("forwardRef requires a render function but was given %s.",Z===null?"null":typeof Z):Z.length!==0&&Z.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",Z.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),Z!=null&&Z.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var W={$$typeof:tY,render:Z},H;return Object.defineProperty(W,"displayName",{enumerable:!1,configurable:!0,get:function(){return H},set:function(U){H=U,Z.name||Z.displayName||(Object.defineProperty(Z,"name",{value:U}),Z.displayName=U)}}),W},N2.isValidElement=S,N2.lazy=function(Z){Z={_status:-1,_result:Z};var W={$$typeof:YY,_payload:Z,_init:JY},H={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return Z._ioInfo=H,W._debugInfo=[{awaited:H}],W},N2.memo=function(Z,W){Z==null&&console.error("memo: The first argument must be a component. Instead received: %s",Z===null?"null":typeof Z),W={$$typeof:AY,type:Z,compare:W===void 0?null:W};var H;return Object.defineProperty(W,"displayName",{enumerable:!1,configurable:!0,get:function(){return H},set:function(U){H=U,Z.name||Z.displayName||(Object.defineProperty(Z,"name",{value:U}),Z.displayName=U)}}),W},N2.startTransition=function(Z){var W=R.T,H={};H._updatedFibers=new Set,R.T=H;try{var U=Z(),M=R.S;M!==null&&M(H,U),typeof U==="object"&&U!==null&&typeof U.then==="function"&&(R.asyncTransitions++,U.then(g,g),U.then(q,KZ))}catch(x){KZ(x)}finally{W===null&&H._updatedFibers&&(Z=H._updatedFibers.size,H._updatedFibers.clear(),10<Z&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),W!==null&&H.types!==null&&(W.types!==null&&W.types!==H.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),W.types=H.types),R.T=W}},N2.unstable_useCacheRefresh=function(){return D().useCacheRefresh()},N2.use=function(Z){return D().use(Z)},N2.useActionState=function(Z,W,H){return D().useActionState(Z,W,H)},N2.useCallback=function(Z,W){return D().useCallback(Z,W)},N2.useContext=function(Z){var W=D();return Z.$$typeof===CY&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),W.useContext(Z)},N2.useDebugValue=function(Z,W){return D().useDebugValue(Z,W)},N2.useDeferredValue=function(Z,W){return D().useDeferredValue(Z,W)},N2.useEffect=function(Z,W){return Z==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),D().useEffect(Z,W)},N2.useEffectEvent=function(Z){return D().useEffectEvent(Z)},N2.useId=function(){return D().useId()},N2.useImperativeHandle=function(Z,W,H){return D().useImperativeHandle(Z,W,H)},N2.useInsertionEffect=function(Z,W){return Z==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),D().useInsertionEffect(Z,W)},N2.useLayoutEffect=function(Z,W){return Z==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),D().useLayoutEffect(Z,W)},N2.useMemo=function(Z,W){return D().useMemo(Z,W)},N2.useOptimistic=function(Z,W){return D().useOptimistic(Z,W)},N2.useReducer=function(Z,W,H){return D().useReducer(Z,W,H)},N2.useRef=function(Z){return D().useRef(Z)},N2.useState=function(Z){return D().useState(Z)},N2.useSyncExternalStore=function(Z,W,H){return D().useSyncExternalStore(Z,W,H)},N2.useTransition=function(){return D().useTransition()},N2.version="19.2.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});import{readFile as wZ,writeFile as LZ,mkdir as oZ}from"node:fs/promises";import{dirname as rZ}from"node:path";var aZ=T({description:"Read contents of a file from the filesystem",inputSchema:K.object({file_path:K.string().describe("Path to file"),offset:K.number().optional().describe("Start line number (1-based)"),limit:K.number().optional().describe("Number of lines to read")}),execute:async({file_path:Y,offset:X,limit:$})=>{try{let{stat:Q}=await import("node:fs/promises"),q=await Q(Y);if(q.size>10485760)return{path:Y,error:`File too large (${Math.round(q.size/1024/1024)}MB). Maximum size is 10MB. Use offset and limit parameters to read specific sections.`,encoding:"utf8"}}catch(Q){return{path:Y,error:`Failed to check file size: ${Q instanceof Error?Q.message:String(Q)}`,encoding:"utf8"}}let G=await wZ(Y,"utf8");if(X!==void 0||$!==void 0){let Q=G.split(`
|
|
14
|
+
`),q=X?X-1:0,J=$?q+$:Q.length,N=Q.slice(q,J);return{path:Y,content:N.join(`
|
|
15
|
+
`),encoding:"utf8"}}return{path:Y,content:G,encoding:"utf8"}}}),tZ=T({description:"Write content to a file",inputSchema:K.object({file_path:K.string().describe("Path to file (overwrites if exists)"),content:K.string().describe("Content to write")}),execute:async({file_path:Y,content:X})=>{let $=rZ(Y);await oZ($,{recursive:!0}),await LZ(Y,X,"utf8");let B=Y.split("/").pop()||"",G=X.split(`
|
|
16
|
+
`);return{path:Y,bytes:Buffer.byteLength(X,"utf8"),fileName:B,lineCount:G.length,preview:G.slice(0,5)}}}),eZ=T({description:"Perform exact string replacements in files",inputSchema:K.object({file_path:K.string().describe("Path to file"),old_string:K.string().describe("Text to replace (must be exact and unique unless replace_all=true)"),new_string:K.string().describe("Replacement text"),replace_all:K.boolean().default(!1).optional().describe("Replace all occurrences. If false, old_string must be unique")}),execute:async({file_path:Y,old_string:X,new_string:$,replace_all:B=!1})=>{if(X===$)throw Error("old_string and new_string must be different");let G=await wZ(Y,"utf8");if(!G.includes(X))throw Error(`old_string not found in file: ${Y}`);if(!B){let P=G.indexOf(X),I=G.lastIndexOf(X);if(P!==I)throw Error("old_string appears multiple times in the file. Either provide more context to make it unique or use replace_all=true")}let Q=G.split(`
|
|
17
|
+
`),J=G.substring(0,G.indexOf(X)).split(`
|
|
18
|
+
`).length,N=2,O=Math.max(0,J-N-1),w=Math.min(Q.length,J+N),L=B?G.split(X).join($):G.replace(X,$);await LZ(Y,L,"utf8");let V=B?G.split(X).length-1:1,F=Q.slice(O,w),C=[];for(let P=0;P<F.length;P++){let I=O+P+1,h=F[P];if(I===J){let u=X.split(`
|
|
19
|
+
`),S=$.split(`
|
|
20
|
+
`);u.forEach((m)=>{C.push(`${I.toString().padStart(6)} - ${m}`)}),S.forEach((m)=>{C.push(`${I.toString().padStart(6)} + ${m}`)})}else C.push(`${I.toString().padStart(6)} ${h}`)}return{path:Y,replacements:V,old_length:X.length,new_length:$.length,diff:C,old_string:X,new_string:$}}}),kY={read:aZ,write:tZ,edit:eZ};import{exec as Y2}from"node:child_process";import{promisify as Z2}from"node:util";var X2=Z2(Y2),$2=T({description:"Execute a bash command and return its output",inputSchema:K.object({command:K.string().describe("Bash command to execute"),cwd:K.string().optional().describe("Working directory"),timeout:K.number().default(30000).optional().describe("Timeout in milliseconds (foreground mode only)"),run_in_background:K.boolean().default(!1).optional().describe("Run in background. Returns bash_id for bash-output tool")}),execute:async({command:Y,cwd:X,timeout:$=30000,run_in_background:B=!1})=>{if(B){let G=XY.spawn(Y,X);return{bash_id:G,command:Y,mode:"background",message:`Started in background. Use bash-output tool with bash_id: ${G}`}}try{let{stdout:G,stderr:Q}=await X2(Y,{cwd:X||process.cwd(),timeout:$,maxBuffer:10485760});return{command:Y,stdout:G.trim(),stderr:Q.trim(),exitCode:0}}catch(G){if(G.code!==void 0)return{command:Y,stdout:G.stdout?.trim()||"",stderr:G.stderr?.trim()||"",exitCode:G.code};throw Error(`Command execution failed: ${G.message}`)}}}),B2=T({description:"Get output from a background bash process",inputSchema:K.object({bash_id:K.string().describe("bash_id from background bash command"),filter:K.string().optional().describe("Regex to filter output lines")}),execute:async({bash_id:Y,filter:X})=>{let $=XY.getOutput(Y);if(!$)throw Error(`Bash process not found: ${Y}`);let{stdout:B,stderr:G}=$;if(X)try{let Q=new RegExp(X);B=B.split(`
|
|
21
|
+
`).filter((q)=>Q.test(q)).join(`
|
|
22
|
+
`),G=G.split(`
|
|
23
|
+
`).filter((q)=>Q.test(q)).join(`
|
|
24
|
+
`)}catch(Q){throw Error(`Invalid regex filter: ${Q instanceof Error?Q.message:String(Q)}`)}return{bash_id:Y,command:$.command,stdout:B,stderr:G,exitCode:$.exitCode,isRunning:$.isRunning,duration:$.duration}}}),W2=T({description:"Kill a background bash process",inputSchema:K.object({bash_id:K.string().describe("bash_id of process to kill")}),execute:async({bash_id:Y})=>{if(!XY.kill(Y))throw Error(`Bash process not found: ${Y}`);return{bash_id:Y,status:"killed",message:`Sent termination signal to bash process ${Y}`}}}),SY={bash:$2,"bash-output":B2,"kill-bash":W2};import{readdir as G2,readFile as Q2,stat as H2}from"node:fs/promises";import{join as U2}from"node:path";function EZ(Y,X){let $=Y.replace(/\./g,"\\.").replace(/\*\*/g,".*").replace(/\*/g,"[^/]*").replace(/\?/g,".");return new RegExp(`^${$}$`).test(X)}async function vY(Y,X,$,B=[]){if(B.length>=$)return B;try{let G=await G2(Y,{withFileTypes:!0});for(let Q of G){if(B.length>=$)break;let q=U2(Y,Q.name);if(Q.isDirectory()&&["node_modules",".git","dist","build",".next"].includes(Q.name))continue;if(Q.isDirectory())await vY(q,X,$,B);else if(EZ(X,q)||EZ(X,Q.name))B.push(q)}return B}catch(G){return B}}var J2=T({description:"Search for files matching a glob pattern",inputSchema:K.object({pattern:K.string().describe('Glob pattern: * (any except /), ** (any), ? (single). Examples: "*.ts", "src/**/*.tsx"'),path:K.string().optional().describe("Directory to search")}),execute:async({pattern:Y,path:X})=>{let $=X||process.cwd(),B=await vY($,Y,1000);return{pattern:Y,directory:$,files:B,count:B.length}}}),q2=T({description:"Search for text content within files using regex patterns",inputSchema:K.object({pattern:K.string().describe("Regex pattern to search"),path:K.string().optional().describe("File or directory to search"),output_mode:K.enum(["content","files_with_matches","count"]).default("files_with_matches").optional().describe("content: show lines | files_with_matches: show paths | count: show counts"),type:K.string().optional().describe("File type: js, ts, py, rust, go, java, c, cpp, html, css, json, yaml, md"),glob:K.string().optional().describe('Glob filter: "*.js", "*.{ts,tsx}"'),"-i":K.boolean().optional().describe("Case insensitive"),"-n":K.boolean().optional().describe("Show line numbers (content mode only)"),"-A":K.number().optional().describe("Lines after match (content mode only)"),"-B":K.number().optional().describe("Lines before match (content mode only)"),"-C":K.number().optional().describe("Lines before and after match (content mode only)"),multiline:K.boolean().optional().describe("Multiline mode: . matches newlines"),head_limit:K.number().optional().describe("Limit output to first N entries")}),execute:async({pattern:Y,path:X,output_mode:$="files_with_matches",type:B,glob:G,"-i":Q=!1,"-n":q=!1,"-A":J=0,"-B":N=0,"-C":O,multiline:w=!1,head_limit:L})=>{let V=X||process.cwd(),F="**/*";if(G)F=G;else if(B)F={js:"*.{js,jsx}",ts:"*.{ts,tsx}",py:"*.py",rust:"*.rs",go:"*.go",java:"*.java",c:"*.{c,h}",cpp:"*.{cpp,hpp,cc,cxx}",html:"*.{html,htm}",css:"*.{css,scss,sass}",json:"*.json",yaml:"*.{yaml,yml}",md:"*.md"}[B]||`*.${B}`;let C=await vY(V,F,1000),P=O!==void 0?O:N||0,I=O!==void 0?O:J||0,h="g";if(Q)h+="i";if(w)h+="s";let u=new RegExp(Y,h),S=[],m=new Set,d=0;for(let A of C)try{if((await H2(A)).size>1048576)continue;let JY=await Q2(A,"utf8");if(w){if(u.test(JY))m.add(A),d++}else{let D=JY.split(`
|
|
25
|
+
`);for(let g=0;g<D.length;g++)if(u.test(D[g])){if(m.add(A),d++,$==="content"){let s=Math.max(0,g-P),c=Math.min(D.length-1,g+I);for(let f=s;f<=c;f++){let e=q?`${f+1}: ${D[f]}`:D[f];S.push({file:A,line:f+1,content:e})}}}}}catch{continue}let UY=(A)=>{return L?A.slice(0,L):A};if($==="content")return{pattern:Y,directory:V,matches:UY(S),count:S.length};else if($==="files_with_matches")return{pattern:Y,directory:V,files:UY(Array.from(m)),count:m.size};else return{pattern:Y,directory:V,count:d}}}),fY={glob:J2,grep:q2};var r=null,p=[],$Y=!1,OY=null;function RZ(){if(OY)OY(p.length)}function a2(Y){OY=Y}function t2(){return r!==null}function e2(){return p.length}function Y4(Y){r=Y}function Z4(){r=null,p=[],$Y=!1,OY=null}async function xZ(){if($Y||p.length===0||!r)return;$Y=!0;let Y=p.shift();RZ();try{let X=await r({type:"selection",questions:[{id:Y.id,question:Y.question,options:Y.options,multiSelect:Y.multiSelect,preSelected:Y.preSelected}]}),$=typeof X==="string"?X:X[Y.id],B=Array.isArray($)?$.join(", "):$||"";Y.resolve(B)}catch(X){console.error("[processAsk] Error:",X),Y.resolve("")}finally{if($Y=!1,p.length>0)xZ()}}var K2=T({description:"Ask the user a multiple choice question and wait for their selection. Supports predefined options, free text input, and default selections.",inputSchema:K.object({question:K.string().describe("Question to ask"),options:K.array(K.object({label:K.string().describe("Display text for this option"),value:K.string().optional().describe("Return value (defaults to label if not provided)"),freeText:K.boolean().optional().describe('If true, selecting this option lets user type custom text instead of selecting from list. Use for "Other..." options'),placeholder:K.string().optional().describe('Placeholder text shown when user enters free text mode (e.g., "Enter custom option...")'),checked:K.boolean().optional().describe("Default checked state (only for multiSelect). If true, option is pre-selected")})).min(1).describe("Options to choose from. Can include free text options for custom input"),multiSelect:K.boolean().optional().describe("Allow multiple selections. Returns comma-separated values. Use checked field to pre-select options"),preSelected:K.array(K.string()).optional().describe("Pre-selected values for multi-select (question-level default). Use option.checked for per-option control")}),execute:async({question:Y,options:X,multiSelect:$,preSelected:B})=>{if(!r)throw Error("User input handler not available. This tool can only be used in interactive mode.");return new Promise((G)=>{let Q=`ask_${Date.now()}_${Math.random()}`;if(p.push({id:Q,question:Y,options:X,multiSelect:$,preSelected:B,resolve:G}),RZ(),!$Y)xZ()})}}),mY={ask:K2};var zZ=(Y)=>{let X,$=new Set,B=(O,w)=>{let L=typeof O==="function"?O(X):O;if(!Object.is(L,X)){let V=X;X=(w!=null?w:typeof L!=="object"||L===null)?L:Object.assign({},X,L),$.forEach((F)=>F(X,V))}},G=()=>X,J={setState:B,getState:G,getInitialState:()=>N,subscribe:(O)=>{return $.add(O),()=>$.delete(O)}},N=X=Y(B,G,J);return J},VZ=(Y)=>Y?zZ(Y):zZ;var BY=OZ(DZ(),1);var O2=(Y)=>Y;function w2(Y,X=O2){let $=BY.default.useSyncExternalStore(Y.subscribe,BY.default.useCallback(()=>X(Y.getState()),[Y,X]),BY.default.useCallback(()=>X(Y.getInitialState()),[Y,X]));return BY.default.useDebugValue($),$}var jZ=(Y)=>{let X=VZ(Y),$=(B)=>w2(X,B);return Object.assign($,X),$},FZ=(Y)=>Y?jZ(Y):jZ;var kZ=Symbol.for("immer-nothing"),PZ=Symbol.for("immer-draftable"),k=Symbol.for("immer-state"),L2=[function(Y){return`The plugin for '${Y}' has not been loaded into Immer. To enable the plugin, import and call \`enable${Y}()\` when initializing your application.`},function(Y){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${Y}'`},"This object has been frozen and should not be mutated",function(Y){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+Y},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(Y){return`'current' expects a draft, got: ${Y}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(Y){return`'original' expects a draft, got: ${Y}`}];function _(Y,...X){{let $=L2[Y],B=typeof $==="function"?$.apply(null,X):$;throw Error(`[Immer] ${B}`)}throw Error(`[Immer] minified error nr: ${Y}. Full error at: https://bit.ly/3cXEKWf`)}var WY=Object.getPrototypeOf;function a(Y){return!!Y&&!!Y[k]}function i(Y){if(!Y)return!1;return SZ(Y)||Array.isArray(Y)||!!Y[PZ]||!!Y.constructor?.[PZ]||HY(Y)||VY(Y)}var E2=Object.prototype.constructor.toString(),IZ=new WeakMap;function SZ(Y){if(!Y||typeof Y!=="object")return!1;let X=Object.getPrototypeOf(Y);if(X===null||X===Object.prototype)return!0;let $=Object.hasOwnProperty.call(X,"constructor")&&X.constructor;if($===Object)return!0;if(typeof $!=="function")return!1;let B=IZ.get($);if(B===void 0)B=Function.toString.call($),IZ.set($,B);return B===E2}function EY(Y,X,$=!0){if(zY(Y)===0)($?Reflect.ownKeys(Y):Object.keys(Y)).forEach((G)=>{X(G,Y[G],Y)});else Y.forEach((B,G)=>X(G,B,Y))}function zY(Y){let X=Y[k];return X?X.type_:Array.isArray(Y)?1:HY(Y)?2:VY(Y)?3:0}function bY(Y,X){return zY(Y)===2?Y.has(X):Object.prototype.hasOwnProperty.call(Y,X)}function vZ(Y,X,$){let B=zY(Y);if(B===2)Y.set(X,$);else if(B===3)Y.add($);else Y[X]=$}function R2(Y,X){if(Y===X)return Y!==0||1/Y===1/X;else return Y!==Y&&X!==X}function HY(Y){return Y instanceof Map}function VY(Y){return Y instanceof Set}function l(Y){return Y.copy_||Y.base_}function hY(Y,X){if(HY(Y))return new Map(Y);if(VY(Y))return new Set(Y);if(Array.isArray(Y))return Array.prototype.slice.call(Y);let $=SZ(Y);if(X===!0||X==="class_only"&&!$){let B=Object.getOwnPropertyDescriptors(Y);delete B[k];let G=Reflect.ownKeys(B);for(let Q=0;Q<G.length;Q++){let q=G[Q],J=B[q];if(J.writable===!1)J.writable=!0,J.configurable=!0;if(J.get||J.set)B[q]={configurable:!0,writable:!0,enumerable:J.enumerable,value:Y[q]}}return Object.create(WY(Y),B)}else{let B=WY(Y);if(B!==null&&$)return{...Y};let G=Object.create(B);return Object.assign(G,Y)}}function lY(Y,X=!1){if(DY(Y)||a(Y)||!i(Y))return Y;if(zY(Y)>1)Object.defineProperties(Y,{set:LY,add:LY,clear:LY,delete:LY});if(Object.freeze(Y),X)Object.values(Y).forEach(($)=>lY($,!0));return Y}function x2(){_(2)}var LY={value:x2};function DY(Y){if(Y===null||typeof Y!=="object")return!0;return Object.isFrozen(Y)}var z2={};function n(Y){let X=z2[Y];if(!X)_(0,Y);return X}var GY;function fZ(){return GY}function V2(Y,X){return{drafts_:[],parent_:Y,immer_:X,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function CZ(Y,X){if(X)n("Patches"),Y.patches_=[],Y.inversePatches_=[],Y.patchListener_=X}function uY(Y){dY(Y),Y.drafts_.forEach(D2),Y.drafts_=null}function dY(Y){if(Y===GY)GY=Y.parent_}function AZ(Y){return GY=V2(GY,Y)}function D2(Y){let X=Y[k];if(X.type_===0||X.type_===1)X.revoke_();else X.revoked_=!0}function TZ(Y,X){X.unfinalizedDrafts_=X.drafts_.length;let $=X.drafts_[0];if(Y!==void 0&&Y!==$){if($[k].modified_)uY(X),_(4);if(i(Y)){if(Y=RY(X,Y),!X.parent_)xY(X,Y)}if(X.patches_)n("Patches").generateReplacementPatches_($[k].base_,Y,X.patches_,X.inversePatches_)}else Y=RY(X,$,[]);if(uY(X),X.patches_)X.patchListener_(X.patches_,X.inversePatches_);return Y!==kZ?Y:void 0}function RY(Y,X,$){if(DY(X))return X;let B=Y.immer_.shouldUseStrictIteration(),G=X[k];if(!G)return EY(X,(Q,q)=>_Z(Y,G,X,Q,q,$),B),X;if(G.scope_!==Y)return X;if(!G.modified_)return xY(Y,G.base_,!0),G.base_;if(!G.finalized_){G.finalized_=!0,G.scope_.unfinalizedDrafts_--;let Q=G.copy_,q=Q,J=!1;if(G.type_===3)q=new Set(Q),Q.clear(),J=!0;if(EY(q,(N,O)=>_Z(Y,G,Q,N,O,$,J),B),xY(Y,Q,!1),$&&Y.patches_)n("Patches").generatePatches_(G,$,Y.patches_,Y.inversePatches_)}return G.copy_}function _Z(Y,X,$,B,G,Q,q){if(G==null)return;if(typeof G!=="object"&&!q)return;let J=DY(G);if(J&&!q)return;if(G===$)_(5);if(a(G)){let N=Q&&X&&X.type_!==3&&!bY(X.assigned_,B)?Q.concat(B):void 0,O=RY(Y,G,N);if(vZ($,B,O),a(O))Y.canAutoFreeze_=!1;else return}else if(q)$.add(G);if(i(G)&&!J){if(!Y.immer_.autoFreeze_&&Y.unfinalizedDrafts_<1)return;if(X&&X.base_&&X.base_[B]===G&&J)return;if(RY(Y,G),(!X||!X.scope_.parent_)&&typeof B!=="symbol"&&(HY($)?$.has(B):Object.prototype.propertyIsEnumerable.call($,B)))xY(Y,G)}}function xY(Y,X,$=!1){if(!Y.parent_&&Y.immer_.autoFreeze_&&Y.canAutoFreeze_)lY(X,$)}function j2(Y,X){let $=Array.isArray(Y),B={type_:$?1:0,scope_:X?X.scope_:fZ(),modified_:!1,finalized_:!1,assigned_:{},parent_:X,base_:Y,draft_:null,copy_:null,revoke_:null,isManual_:!1},G=B,Q=iY;if($)G=[B],Q=QY;let{revoke:q,proxy:J}=Proxy.revocable(G,Q);return B.draft_=J,B.revoke_=q,J}var iY={get(Y,X){if(X===k)return Y;let $=l(Y);if(!bY($,X))return F2(Y,$,X);let B=$[X];if(Y.finalized_||!i(B))return B;if(B===gY(Y.base_,X))return yY(Y),Y.copy_[X]=pY(B,Y);return B},has(Y,X){return X in l(Y)},ownKeys(Y){return Reflect.ownKeys(l(Y))},set(Y,X,$){let B=mZ(l(Y),X);if(B?.set)return B.set.call(Y.draft_,$),!0;if(!Y.modified_){let G=gY(l(Y),X),Q=G?.[k];if(Q&&Q.base_===$)return Y.copy_[X]=$,Y.assigned_[X]=!1,!0;if(R2($,G)&&($!==void 0||bY(Y.base_,X)))return!0;yY(Y),cY(Y)}if(Y.copy_[X]===$&&($!==void 0||(X in Y.copy_))||Number.isNaN($)&&Number.isNaN(Y.copy_[X]))return!0;return Y.copy_[X]=$,Y.assigned_[X]=!0,!0},deleteProperty(Y,X){if(gY(Y.base_,X)!==void 0||X in Y.base_)Y.assigned_[X]=!1,yY(Y),cY(Y);else delete Y.assigned_[X];if(Y.copy_)delete Y.copy_[X];return!0},getOwnPropertyDescriptor(Y,X){let $=l(Y),B=Reflect.getOwnPropertyDescriptor($,X);if(!B)return B;return{writable:!0,configurable:Y.type_!==1||X!=="length",enumerable:B.enumerable,value:$[X]}},defineProperty(){_(11)},getPrototypeOf(Y){return WY(Y.base_)},setPrototypeOf(){_(12)}},QY={};EY(iY,(Y,X)=>{QY[Y]=function(){return arguments[0]=arguments[0][0],X.apply(this,arguments)}});QY.deleteProperty=function(Y,X){if(isNaN(parseInt(X)))_(13);return QY.set.call(this,Y,X,void 0)};QY.set=function(Y,X,$){if(X!=="length"&&isNaN(parseInt(X)))_(14);return iY.set.call(this,Y[0],X,$,Y[0])};function gY(Y,X){let $=Y[k];return($?l($):Y)[X]}function F2(Y,X,$){let B=mZ(X,$);return B?"value"in B?B.value:B.get?.call(Y.draft_):void 0}function mZ(Y,X){if(!(X in Y))return;let $=WY(Y);while($){let B=Object.getOwnPropertyDescriptor($,X);if(B)return B;$=WY($)}return}function cY(Y){if(!Y.modified_){if(Y.modified_=!0,Y.parent_)cY(Y.parent_)}}function yY(Y){if(!Y.copy_)Y.copy_=hY(Y.base_,Y.scope_.immer_.useStrictShallowCopy_)}var P2=class{constructor(Y){if(this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(X,$,B)=>{if(typeof X==="function"&&typeof $!=="function"){let Q=$;$=X;let q=this;return function(N=Q,...O){return q.produce(N,(w)=>$.call(this,w,...O))}}if(typeof $!=="function")_(6);if(B!==void 0&&typeof B!=="function")_(7);let G;if(i(X)){let Q=AZ(this),q=pY(X,void 0),J=!0;try{G=$(q),J=!1}finally{if(J)uY(Q);else dY(Q)}return CZ(Q,B),TZ(G,Q)}else if(!X||typeof X!=="object"){if(G=$(X),G===void 0)G=X;if(G===kZ)G=void 0;if(this.autoFreeze_)lY(G,!0);if(B){let Q=[],q=[];n("Patches").generateReplacementPatches_(X,G,Q,q),B(Q,q)}return G}else _(1,X)},this.produceWithPatches=(X,$)=>{if(typeof X==="function")return(q,...J)=>this.produceWithPatches(q,(N)=>X(N,...J));let B,G;return[this.produce(X,$,(q,J)=>{B=q,G=J}),B,G]},typeof Y?.autoFreeze==="boolean")this.setAutoFreeze(Y.autoFreeze);if(typeof Y?.useStrictShallowCopy==="boolean")this.setUseStrictShallowCopy(Y.useStrictShallowCopy);if(typeof Y?.useStrictIteration==="boolean")this.setUseStrictIteration(Y.useStrictIteration)}createDraft(Y){if(!i(Y))_(8);if(a(Y))Y=I2(Y);let X=AZ(this),$=pY(Y,void 0);return $[k].isManual_=!0,dY(X),$}finishDraft(Y,X){let $=Y&&Y[k];if(!$||!$.isManual_)_(9);let{scope_:B}=$;return CZ(B,X),TZ(void 0,B)}setAutoFreeze(Y){this.autoFreeze_=Y}setUseStrictShallowCopy(Y){this.useStrictShallowCopy_=Y}setUseStrictIteration(Y){this.useStrictIteration_=Y}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(Y,X){let $;for($=X.length-1;$>=0;$--){let G=X[$];if(G.path.length===0&&G.op==="replace"){Y=G.value;break}}if($>-1)X=X.slice($+1);let B=n("Patches").applyPatches_;if(a(Y))return B(Y,X);return this.produce(Y,(G)=>B(G,X))}};function pY(Y,X){let $=HY(Y)?n("MapSet").proxyMap_(Y,X):VY(Y)?n("MapSet").proxySet_(Y,X):j2(Y,X);return(X?X.scope_:fZ()).drafts_.push($),$}function I2(Y){if(!a(Y))_(10,Y);return gZ(Y)}function gZ(Y){if(!i(Y)||DY(Y))return Y;let X=Y[k],$,B=!0;if(X){if(!X.modified_)return X.base_;X.finalized_=!0,$=hY(Y,X.scope_.immer_.useStrictShallowCopy_),B=X.scope_.immer_.shouldUseStrictIteration()}else $=hY(Y,!0);if(EY($,(G,Q)=>{vZ($,G,gZ(Q))},B),X)X.finalized_=!1;return $}var C2=new P2,yZ=C2.produce;var A2=(Y)=>(X,$,B)=>{return B.setState=(G,Q,...q)=>{let J=typeof G==="function"?yZ(G):G;return X(J,Q,...q)},Y(B.setState,$,B)},bZ=A2;var T2=(Y)=>(X,$,B)=>{let G=B.subscribe;return B.subscribe=(q,J,N)=>{let O=q;if(J){let w=(N==null?void 0:N.equalityFn)||Object.is,L=q(B.getState());if(O=(V)=>{let F=q(V);if(!w(L,F)){let C=L;J(L=F,C)}},N==null?void 0:N.fireImmediately)J(L,L)}return G(O)},Y(X,$,B)},hZ=T2;var uZ=FZ()(hZ(bZ((Y)=>({currentScreen:"chat",navigateTo:(X)=>Y(($)=>{$.currentScreen=X}),aiConfig:null,setAIConfig:(X)=>Y(($)=>{$.aiConfig=X}),updateProvider:(X,$)=>Y((B)=>{if(!B.aiConfig)B.aiConfig={providers:{}};if(!B.aiConfig.providers)B.aiConfig.providers={};B.aiConfig.providers[X]={...B.aiConfig.providers[X],...$}}),removeProvider:(X)=>Y(($)=>{if($.aiConfig?.providers)delete $.aiConfig.providers[X];if($.aiConfig?.defaultProvider===X)$.aiConfig.defaultProvider=void 0,$.aiConfig.defaultModel=void 0}),selectedProvider:null,selectedModel:null,setSelectedProvider:(X)=>Y(($)=>{$.selectedProvider=X}),setSelectedModel:(X)=>Y(($)=>{$.selectedModel=X}),sessions:[],currentSessionId:null,createSession:(X,$)=>{let B=`session-${Date.now()}`,G=Date.now();return Y((Q)=>{Q.sessions.push({id:B,provider:X,model:$,messages:[],todos:[],nextTodoId:1,created:G,updated:G}),Q.currentSessionId=B}),b().then((Q)=>{Q.createSessionFromData({id:B,provider:X,model:$,nextTodoId:1,created:G,updated:G}).catch((q)=>{console.error("Failed to create session in database:",q)})}),B},updateSessionModel:(X,$)=>{Y((B)=>{let G=B.sessions.find((Q)=>Q.id===X);if(G)G.model=$}),b().then((B)=>{B.updateSessionModel(X,$).catch((G)=>{console.error("Failed to update session model in database:",G)})})},updateSessionProvider:(X,$,B)=>{Y((G)=>{let Q=G.sessions.find((q)=>q.id===X);if(Q)Q.provider=$,Q.model=B}),b().then((G)=>{G.updateSessionProvider(X,$,B).catch((Q)=>{console.error("Failed to update session provider in database:",Q)})})},updateSessionTitle:(X,$)=>{Y((B)=>{let G=B.sessions.find((Q)=>Q.id===X);if(G)G.title=$}),b().then((B)=>{B.updateSessionTitle(X,$).catch((G)=>{console.error("Failed to update session title in database:",G)})})},addMessage:(X,$,B,G,Q,q,J,N)=>{let O=typeof B==="string"?[{type:"text",content:B}]:B;Y((w)=>{let L=w.sessions.find((V)=>V.id===X);if(L)L.messages.push({role:$,content:O,timestamp:Date.now(),status:"completed",...G!==void 0&&G.length>0&&{attachments:G},...Q!==void 0&&{usage:Q},...q!==void 0&&{finishReason:q},...J!==void 0&&{metadata:J},...N!==void 0&&N.length>0&&{todoSnapshot:N}})}),b().then((w)=>{w.addMessage(X,$,O,G,Q,q,J,N).catch((L)=>{console.error("Failed to add message to database:",L)})})},setCurrentSession:(X)=>Y(($)=>{$.currentSessionId=X}),deleteSession:(X)=>{Y(($)=>{if($.sessions=$.sessions.filter((B)=>B.id!==X),$.currentSessionId===X)$.currentSessionId=null}),b().then(($)=>{$.deleteSession(X).catch((B)=>{console.error("Failed to delete session from database:",B)})})},isLoading:!1,error:null,setLoading:(X)=>Y(($)=>{$.isLoading=X}),setError:(X)=>Y(($)=>{$.error=X}),currentAgentId:"coder",setCurrentAgentId:(X)=>Y(($)=>{$.currentAgentId=X}),enabledRuleIds:[],setEnabledRuleIds:(X)=>Y(($)=>{$.enabledRuleIds=X}),debugLogs:[],addDebugLog:(X)=>Y(($)=>{if(!process.env.DEBUG)return;let B=new Date().toLocaleTimeString();$.debugLogs.push(`[${B}] ${X}`);let G=1000;if($.debugLogs.length>G)$.debugLogs=$.debugLogs.slice(-G/2)}),clearDebugLogs:()=>Y((X)=>{X.debugLogs=[]}),notificationSettings:{osNotifications:!0,terminalNotifications:!0,sound:!0,autoGenerateTitle:!0},updateNotificationSettings:(X)=>Y(($)=>{$.notificationSettings={...$.notificationSettings,...X}}),updateTodos:(X,$)=>Y((B)=>{let G=B.sessions.find((J)=>J.id===X);if(!G)return;for(let J of $)if(J.id===void 0||J.id===null){let N=G.nextTodoId,O=G.todos.length>0?Math.max(...G.todos.map((w)=>w.ordering)):0;G.todos.push({id:N,content:J.content||"",activeForm:J.activeForm||"",status:J.status||"pending",ordering:O+10}),G.nextTodoId=N+1}else{let N=G.todos.find((O)=>O.id===J.id);if(!N)continue;if(J.content!==void 0)N.content=J.content;if(J.activeForm!==void 0)N.activeForm=J.activeForm;if(J.status!==void 0)N.status=J.status;if(J.reorder){let{type:O,id:w}=J.reorder;if(O==="top"){let L=Math.min(...G.todos.map((V)=>V.ordering));N.ordering=L-10}else if(O==="last"){let L=Math.max(...G.todos.map((V)=>V.ordering));N.ordering=L+10}else if(O==="before"&&w!==void 0){let L=G.todos.find((V)=>V.id===w);if(L){let V=[...G.todos].sort((P,I)=>P.ordering-I.ordering||P.id-I.id),F=V.findIndex((P)=>P.id===w),C=F>0?V[F-1]:null;if(C)N.ordering=Math.floor((C.ordering+L.ordering)/2);else N.ordering=L.ordering-10}}else if(O==="after"&&w!==void 0){let L=G.todos.find((V)=>V.id===w);if(L){let V=[...G.todos].sort((P,I)=>P.ordering-I.ordering||P.id-I.id),F=V.findIndex((P)=>P.id===w),C=F<V.length-1?V[F+1]:null;if(C)N.ordering=Math.floor((L.ordering+C.ordering)/2);else N.ordering=L.ordering+10}}}}let Q=JSON.parse(JSON.stringify(G.todos)),q=G.nextTodoId;b().then((J)=>{J.updateTodos(X,Q,q).catch((N)=>{console.error("Failed to update todos in database:",N)})})})}))));var G5=(Y)=>{switch(Y){case"in_progress":return"▶";case"pending":return"○";case"completed":return"✓";case"removed":return"✗"}},Q5=(Y)=>{switch(Y){case"in_progress":return"#00FF88";case"pending":return"gray";case"completed":return"green";case"removed":return"red"}},H5=(Y)=>{return Y.status==="in_progress"?Y.activeForm:Y.content},U5=(Y)=>{return Y==="pending"||Y==="completed"},J5=(Y)=>{return Y==="in_progress"},q5=(Y)=>{return Y==="completed"},jY=(Y,X,$,B)=>{if(Y==="added")return`+ ${X.content}`;if(Y==="reordered"&&B)return`[${X.id}] reordered to ${B}`;if(Y==="updated"&&$&&$!==X.status)return`[${X.id}] ${$} → ${X.status}`;return`[${X.id}] updated`};var _2=T({description:"Update task list to track work progress",inputSchema:K.object({todos:K.array(K.object({id:K.number().optional().describe("ID to update existing, omit to add new"),content:K.string().optional().describe('Imperative form: "Build feature"'),activeForm:K.string().optional().describe('Present continuous: "Building feature"'),status:K.enum(["pending","in_progress","completed","removed"]).optional().describe("pending | in_progress (keep ONE only) | completed | removed"),reorder:K.object({type:K.enum(["top","last","before","after"]).describe("top | last | before | after"),id:K.number().optional().describe("Target ID (for before/after)")}).optional().describe("Change order")})).describe('Add/update todos. Examples: [{ content: "Build login", activeForm: "Building login", status: "pending" }] | [{ id: 1, status: "completed" }]')}),execute:({todos:Y})=>{let X=uZ.getState(),$=X.currentSessionId;if(!$)return{error:"No active session",summary:"Failed: no active session",changes:[],total:0};let B=X.sessions.find((w)=>w.id===$);if(!B)return{error:"Session not found",summary:"Failed: session not found",changes:[],total:0};let G=B.todos;X.updateTodos($,Y);let q=X.sessions.find((w)=>w.id===$)?.todos||[],J=Y.filter((w)=>w.id===void 0),N=Y.filter((w)=>w.id!==void 0),O=[];if(J.length>0)J.forEach((w)=>{let L=q.find((V)=>V.content===w.content);if(L)O.push(jY("added",L))});if(N.length>0)N.forEach((w)=>{let L=G.find((F)=>F.id===w.id),V=q.find((F)=>F.id===w.id);if(L&&V){if(w.status&&w.status!==L.status)O.push(jY("updated",V,L.status));else if(w.reorder)O.push(jY("reordered",V,void 0,w.reorder.type))}});return{summary:`${J.length} added, ${N.length} updated`,changes:O.length>0?O:["No changes"],total:q.filter((w)=>w.status!=="removed").length}}}),nY={updateTodos:_2};function k2(Y={}){let{interactive:X=!0}=Y;return{...kY,...SY,...fY,...X?mY:{},...nY}}function D5(){return{filesystem:Object.keys(kY),shell:Object.keys(SY),search:Object.keys(fY),interaction:Object.keys(mY),todo:Object.keys(nY)}}function j5(){return Object.keys(k2())}export{tZ as writeFileTool,SY as shellTools,Y4 as setUserInputHandler,a2 as setQueueUpdateCallback,fY as searchTools,aZ as readFileTool,W2 as killBashTool,mY as interactionTools,t2 as hasUserInputHandler,q2 as grepTool,J2 as globTool,D5 as getToolCategories,e2 as getQueueLength,j5 as getAllToolNames,k2 as getAISDKTools,kY as filesystemTools,$2 as executeBashTool,eZ as editFileTool,Z4 as clearUserInputHandler,B2 as bashOutputTool,K2 as askUserSelectionTool};export{DZ as s,a2 as t,t2 as u,Y4 as v,Z4 as w,uZ as x,G5 as y,Q5 as z,H5 as A,U5 as B,J5 as C,q5 as D,k2 as E};
|
|
26
|
+
|
|
27
|
+
//# debugId=1E9EC7ECA365ED9164756E2164756E21
|