@elasto/nyx-cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/README.md +136 -0
  2. package/bin/nyx.js +3 -0
  3. package/dist/agent/index.d.ts +29 -0
  4. package/dist/agent/index.d.ts.map +1 -0
  5. package/dist/agent/index.js +362 -0
  6. package/dist/agent/index.js.map +1 -0
  7. package/dist/agent/prompt.d.ts +16 -0
  8. package/dist/agent/prompt.d.ts.map +1 -0
  9. package/dist/agent/prompt.js +487 -0
  10. package/dist/agent/prompt.js.map +1 -0
  11. package/dist/agent/templates/index.d.ts +2 -0
  12. package/dist/agent/templates/index.d.ts.map +1 -0
  13. package/dist/agent/templates/index.js +44 -0
  14. package/dist/agent/templates/index.js.map +1 -0
  15. package/dist/auth/index.d.ts +23 -0
  16. package/dist/auth/index.d.ts.map +1 -0
  17. package/dist/auth/index.js +161 -0
  18. package/dist/auth/index.js.map +1 -0
  19. package/dist/commands/login.d.ts +3 -0
  20. package/dist/commands/login.d.ts.map +1 -0
  21. package/dist/commands/login.js +32 -0
  22. package/dist/commands/login.js.map +1 -0
  23. package/dist/commands/logout.d.ts +3 -0
  24. package/dist/commands/logout.d.ts.map +1 -0
  25. package/dist/commands/logout.js +13 -0
  26. package/dist/commands/logout.js.map +1 -0
  27. package/dist/commands/logs.d.ts +3 -0
  28. package/dist/commands/logs.d.ts.map +1 -0
  29. package/dist/commands/logs.js +29 -0
  30. package/dist/commands/logs.js.map +1 -0
  31. package/dist/commands/root.d.ts +3 -0
  32. package/dist/commands/root.d.ts.map +1 -0
  33. package/dist/commands/root.js +27 -0
  34. package/dist/commands/root.js.map +1 -0
  35. package/dist/commands/run.d.ts +3 -0
  36. package/dist/commands/run.d.ts.map +1 -0
  37. package/dist/commands/run.js +74 -0
  38. package/dist/commands/run.js.map +1 -0
  39. package/dist/commands/session.d.ts +3 -0
  40. package/dist/commands/session.d.ts.map +1 -0
  41. package/dist/commands/session.js +61 -0
  42. package/dist/commands/session.js.map +1 -0
  43. package/dist/config/index.d.ts +22 -0
  44. package/dist/config/index.d.ts.map +1 -0
  45. package/dist/config/index.js +110 -0
  46. package/dist/config/index.js.map +1 -0
  47. package/dist/db/index.d.ts +5 -0
  48. package/dist/db/index.d.ts.map +1 -0
  49. package/dist/db/index.js +72 -0
  50. package/dist/db/index.js.map +1 -0
  51. package/dist/events/index.d.ts +3 -0
  52. package/dist/events/index.d.ts.map +1 -0
  53. package/dist/events/index.js +45 -0
  54. package/dist/events/index.js.map +1 -0
  55. package/dist/filetracker/index.d.ts +8 -0
  56. package/dist/filetracker/index.d.ts.map +1 -0
  57. package/dist/filetracker/index.js +21 -0
  58. package/dist/filetracker/index.js.map +1 -0
  59. package/dist/hooks/index.d.ts +13 -0
  60. package/dist/hooks/index.d.ts.map +1 -0
  61. package/dist/hooks/index.js +42 -0
  62. package/dist/hooks/index.js.map +1 -0
  63. package/dist/index.d.ts +2 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +140 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/logging/index.d.ts +16 -0
  68. package/dist/logging/index.d.ts.map +1 -0
  69. package/dist/logging/index.js +76 -0
  70. package/dist/logging/index.js.map +1 -0
  71. package/dist/lsp/index.d.ts +10 -0
  72. package/dist/lsp/index.d.ts.map +1 -0
  73. package/dist/lsp/index.js +130 -0
  74. package/dist/lsp/index.js.map +1 -0
  75. package/dist/mcp/index.d.ts +11 -0
  76. package/dist/mcp/index.d.ts.map +1 -0
  77. package/dist/mcp/index.js +102 -0
  78. package/dist/mcp/index.js.map +1 -0
  79. package/dist/permissions/index.d.ts +13 -0
  80. package/dist/permissions/index.d.ts.map +1 -0
  81. package/dist/permissions/index.js +96 -0
  82. package/dist/permissions/index.js.map +1 -0
  83. package/dist/session/index.d.ts +25 -0
  84. package/dist/session/index.d.ts.map +1 -0
  85. package/dist/session/index.js +100 -0
  86. package/dist/session/index.js.map +1 -0
  87. package/dist/shell/index.d.ts +8 -0
  88. package/dist/shell/index.d.ts.map +1 -0
  89. package/dist/shell/index.js +29 -0
  90. package/dist/shell/index.js.map +1 -0
  91. package/dist/skills/index.d.ts +9 -0
  92. package/dist/skills/index.d.ts.map +1 -0
  93. package/dist/skills/index.js +53 -0
  94. package/dist/skills/index.js.map +1 -0
  95. package/dist/tools/bash.d.ts +35 -0
  96. package/dist/tools/bash.d.ts.map +1 -0
  97. package/dist/tools/bash.js +44 -0
  98. package/dist/tools/bash.js.map +1 -0
  99. package/dist/tools/diagnostics.d.ts +19 -0
  100. package/dist/tools/diagnostics.d.ts.map +1 -0
  101. package/dist/tools/diagnostics.js +45 -0
  102. package/dist/tools/diagnostics.js.map +1 -0
  103. package/dist/tools/edit.d.ts +31 -0
  104. package/dist/tools/edit.d.ts.map +1 -0
  105. package/dist/tools/edit.js +72 -0
  106. package/dist/tools/edit.js.map +1 -0
  107. package/dist/tools/glob.d.ts +23 -0
  108. package/dist/tools/glob.d.ts.map +1 -0
  109. package/dist/tools/glob.js +40 -0
  110. package/dist/tools/glob.js.map +1 -0
  111. package/dist/tools/grep.d.ts +31 -0
  112. package/dist/tools/grep.d.ts.map +1 -0
  113. package/dist/tools/grep.js +72 -0
  114. package/dist/tools/grep.js.map +1 -0
  115. package/dist/tools/index.d.ts +9 -0
  116. package/dist/tools/index.d.ts.map +1 -0
  117. package/dist/tools/index.js +78 -0
  118. package/dist/tools/index.js.map +1 -0
  119. package/dist/tools/job_output.d.ts +49 -0
  120. package/dist/tools/job_output.d.ts.map +1 -0
  121. package/dist/tools/job_output.js +57 -0
  122. package/dist/tools/job_output.js.map +1 -0
  123. package/dist/tools/ls.d.ts +19 -0
  124. package/dist/tools/ls.d.ts.map +1 -0
  125. package/dist/tools/ls.js +55 -0
  126. package/dist/tools/ls.js.map +1 -0
  127. package/dist/tools/todos.d.ts +41 -0
  128. package/dist/tools/todos.d.ts.map +1 -0
  129. package/dist/tools/todos.js +54 -0
  130. package/dist/tools/todos.js.map +1 -0
  131. package/dist/tools/view.d.ts +27 -0
  132. package/dist/tools/view.d.ts.map +1 -0
  133. package/dist/tools/view.js +59 -0
  134. package/dist/tools/view.js.map +1 -0
  135. package/dist/tools/web_fetch.d.ts +24 -0
  136. package/dist/tools/web_fetch.d.ts.map +1 -0
  137. package/dist/tools/web_fetch.js +43 -0
  138. package/dist/tools/web_fetch.js.map +1 -0
  139. package/dist/tools/web_search.d.ts +23 -0
  140. package/dist/tools/web_search.d.ts.map +1 -0
  141. package/dist/tools/web_search.js +41 -0
  142. package/dist/tools/web_search.js.map +1 -0
  143. package/dist/tools/write.d.ts +23 -0
  144. package/dist/tools/write.d.ts.map +1 -0
  145. package/dist/tools/write.js +39 -0
  146. package/dist/tools/write.js.map +1 -0
  147. package/dist/types/index.d.ts +136 -0
  148. package/dist/types/index.d.ts.map +1 -0
  149. package/dist/types/index.js +3 -0
  150. package/dist/types/index.js.map +1 -0
  151. package/dist/ui/index.d.ts +3 -0
  152. package/dist/ui/index.d.ts.map +1 -0
  153. package/dist/ui/index.js +318 -0
  154. package/dist/ui/index.js.map +1 -0
  155. package/dist/util/diff.d.ts +17 -0
  156. package/dist/util/diff.d.ts.map +1 -0
  157. package/dist/util/diff.js +74 -0
  158. package/dist/util/diff.js.map +1 -0
  159. package/dist/util/index.d.ts +6 -0
  160. package/dist/util/index.d.ts.map +1 -0
  161. package/dist/util/index.js +33 -0
  162. package/dist/util/index.js.map +1 -0
  163. package/dist/workspace/index.d.ts +6 -0
  164. package/dist/workspace/index.d.ts.map +1 -0
  165. package/dist/workspace/index.js +133 -0
  166. package/dist/workspace/index.js.map +1 -0
  167. package/package.json +47 -0
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jobKillTool = exports.jobOutputTool = void 0;
4
+ exports.registerJob = registerJob;
5
+ exports.getJob = getJob;
6
+ exports.removeJob = removeJob;
7
+ const bgJobs = new Map();
8
+ function registerJob(id, job) {
9
+ bgJobs.set(id, job);
10
+ }
11
+ function getJob(id) { return bgJobs.get(id); }
12
+ function removeJob(id) { bgJobs.delete(id); }
13
+ exports.jobOutputTool = {
14
+ definition: {
15
+ name: 'job_output',
16
+ description: 'Read the output of a background shell command by its ID. Returns current output or completion status.',
17
+ parameters: {
18
+ type: 'object',
19
+ properties: {
20
+ shell_id: { type: 'string', description: 'The shell ID returned by bash when run_in_background was used' },
21
+ },
22
+ required: ['shell_id'],
23
+ },
24
+ },
25
+ execute: async (args, _cwd) => {
26
+ const job = bgJobs.get(args.shell_id);
27
+ if (!job) {
28
+ return { id: '', success: false, output: '', error: `Job ${args.shell_id} not found`, tool: 'job_output', args };
29
+ }
30
+ const status = job.done ? `(completed, exit code ${job.exitCode})` : '(still running)';
31
+ const output = `${status}\n${job.stdout}${job.stderr ? '\n' + job.stderr : ''}`;
32
+ return { id: '', success: true, output, tool: 'job_output', args };
33
+ },
34
+ };
35
+ exports.jobKillTool = {
36
+ definition: {
37
+ name: 'job_kill',
38
+ description: 'Terminate a background shell command by its ID.',
39
+ parameters: {
40
+ type: 'object',
41
+ properties: {
42
+ shell_id: { type: 'string', description: 'The shell ID returned by bash when run_in_background was used' },
43
+ },
44
+ required: ['shell_id'],
45
+ },
46
+ },
47
+ execute: async (args, _cwd) => {
48
+ const job = bgJobs.get(args.shell_id);
49
+ if (!job) {
50
+ return { id: '', success: false, output: '', error: `Job ${args.shell_id} not found`, tool: 'job_kill', args };
51
+ }
52
+ job.done = true;
53
+ bgJobs.delete(args.shell_id);
54
+ return { id: '', success: true, output: `Terminated job ${args.shell_id}`, tool: 'job_kill', args };
55
+ },
56
+ };
57
+ //# sourceMappingURL=job_output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"job_output.js","sourceRoot":"","sources":["../../src/tools/job_output.ts"],"names":[],"mappings":";;;AAIA,kCAEC;AAED,wBAA4D;AAC5D,8BAA2D;AAP3D,MAAM,MAAM,GAAG,IAAI,GAAG,EAA+E,CAAA;AAEr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EAAE,EAAE,CAAA;QAC/E,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAA;IACpE,CAAC;CACF,CAAA;AAEY,QAAA,WAAW,GAAG;IACzB,UAAU,EAAE;QACV,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,iDAAiD;QAC9D,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+DAA+D,EAAE;aAC3G;YACD,QAAQ,EAAE,CAAC,UAAU,CAAC;SACvB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,IAAS,EAAE,IAAY,EAAuB,EAAE;QAC9D,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACrC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,IAAI,CAAC,QAAQ,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAA;QAChH,CAAC;QACD,GAAG,CAAC,IAAI,GAAG,IAAI,CAAA;QACf,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC5B,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,kBAAkB,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAA;IACrG,CAAC;CACF,CAAA"}
@@ -0,0 +1,19 @@
1
+ import type { ToolResult } from '../types/index.js';
2
+ export declare const lsTool: {
3
+ definition: {
4
+ name: string;
5
+ description: string;
6
+ parameters: {
7
+ type: string;
8
+ properties: {
9
+ path: {
10
+ type: string;
11
+ description: string;
12
+ };
13
+ };
14
+ required: string[];
15
+ };
16
+ };
17
+ execute: (args: any, cwd: string) => Promise<ToolResult>;
18
+ };
19
+ //# sourceMappingURL=ls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../src/tools/ls.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAGnE,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;oBAYK,GAAG,OAAO,MAAM,KAAG,OAAO,CAAC,UAAU,CAAC;CAyB7D,CAAA"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lsTool = void 0;
4
+ const fs_1 = require("fs");
5
+ const path_1 = require("path");
6
+ const index_js_1 = require("../util/index.js");
7
+ exports.lsTool = {
8
+ definition: {
9
+ name: 'ls',
10
+ description: 'List files and directories in a given path. Shows file sizes and modification times.',
11
+ parameters: {
12
+ type: 'object',
13
+ properties: {
14
+ path: { type: 'string', description: 'Directory path to list' },
15
+ },
16
+ required: ['path'],
17
+ },
18
+ },
19
+ execute: async (args, cwd) => {
20
+ const dirPath = (0, path_1.resolve)(cwd, args.path);
21
+ const entries = (0, fs_1.readdirSync)(dirPath, { withFileTypes: true });
22
+ const output = entries
23
+ .filter((e) => !e.name.startsWith('.') && !(0, index_js_1.isIgnoredDir)(e.name))
24
+ .map((e) => {
25
+ const full = (0, path_1.join)(dirPath, e.name);
26
+ let prefix = '';
27
+ let size = '';
28
+ try {
29
+ const stat = (0, fs_1.statSync)(full);
30
+ if (stat.isDirectory())
31
+ prefix = '[DIR] ';
32
+ else
33
+ size = ` ${formatSize(stat.size)}`;
34
+ }
35
+ catch { }
36
+ return `${prefix}${e.name}${size}`;
37
+ })
38
+ .join('\n');
39
+ return {
40
+ id: '',
41
+ success: true,
42
+ output: output || '(empty directory)',
43
+ tool: 'ls',
44
+ args,
45
+ };
46
+ },
47
+ };
48
+ function formatSize(bytes) {
49
+ if (bytes < 1024)
50
+ return `${bytes}B`;
51
+ if (bytes < 1024 * 1024)
52
+ return `${(bytes / 1024).toFixed(1)}KB`;
53
+ return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
54
+ }
55
+ //# sourceMappingURL=ls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ls.js","sourceRoot":"","sources":["../../src/tools/ls.ts"],"names":[],"mappings":";;;AAAA,2BAA0C;AAC1C,+BAAoC;AAEpC,+CAA+C;AAElC,QAAA,MAAM,GAAG;IACpB,UAAU,EAAE;QACV,IAAI,EAAE,IAAI;QACV,WAAW,EAAE,sFAAsF;QACnG,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE;aAChE;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,IAAS,EAAE,GAAW,EAAuB,EAAE;QAC7D,MAAM,OAAO,GAAG,IAAA,cAAO,EAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;QACvC,MAAM,OAAO,GAAG,IAAA,gBAAW,EAAC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;QAC7D,MAAM,MAAM,GAAG,OAAO;aACnB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAA,uBAAY,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC;aAC/D,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACT,MAAM,IAAI,GAAG,IAAA,WAAI,EAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAA;YAClC,IAAI,MAAM,GAAG,EAAE,CAAA;YACf,IAAI,IAAI,GAAG,EAAE,CAAA;YACb,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,IAAA,aAAQ,EAAC,IAAI,CAAC,CAAA;gBAC3B,IAAI,IAAI,CAAC,WAAW,EAAE;oBAAE,MAAM,GAAG,QAAQ,CAAA;;oBACpC,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAA;YACzC,CAAC;YAAC,MAAM,CAAC,CAAA,CAAC;YACV,OAAO,GAAG,MAAM,GAAG,CAAC,CAAC,IAAI,GAAG,IAAI,EAAE,CAAA;QACpC,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,CAAA;QACb,OAAO;YACL,EAAE,EAAE,EAAE;YACN,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,MAAM,IAAI,mBAAmB;YACrC,IAAI,EAAE,IAAI;YACV,IAAI;SACL,CAAA;IACH,CAAC;CACF,CAAA;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,GAAG,KAAK,GAAG,CAAA;IACpC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAA;IAChE,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAA;AAClD,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { ToolResult } from '../types/index.js';
2
+ interface Todo {
3
+ id: string;
4
+ content: string;
5
+ status: 'pending' | 'done' | 'wontdo';
6
+ }
7
+ export declare const todosTool: {
8
+ definition: {
9
+ name: string;
10
+ description: string;
11
+ parameters: {
12
+ type: string;
13
+ properties: {
14
+ action: {
15
+ type: string;
16
+ enum: string[];
17
+ description: string;
18
+ };
19
+ content: {
20
+ type: string;
21
+ description: string;
22
+ };
23
+ id: {
24
+ type: string;
25
+ description: string;
26
+ };
27
+ status: {
28
+ type: string;
29
+ enum: string[];
30
+ description: string;
31
+ };
32
+ };
33
+ required: string[];
34
+ };
35
+ };
36
+ execute: (args: any, _cwd: string) => Promise<ToolResult>;
37
+ };
38
+ export declare function getTodos(): Todo[];
39
+ export declare function clearTodos(): void;
40
+ export {};
41
+ //# sourceMappingURL=todos.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"todos.d.ts","sourceRoot":"","sources":["../../src/tools/todos.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnE,UAAU,IAAI;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAA;CACtC;AAKD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAeE,GAAG,QAAQ,MAAM,KAAG,OAAO,CAAC,UAAU,CAAC;CA0B9D,CAAA;AAED,wBAAgB,QAAQ,IAAI,IAAI,EAAE,CAAiB;AACnD,wBAAgB,UAAU,SAA6B"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.todosTool = void 0;
4
+ exports.getTodos = getTodos;
5
+ exports.clearTodos = clearTodos;
6
+ let todos = [];
7
+ let nextId = 1;
8
+ exports.todosTool = {
9
+ definition: {
10
+ name: 'todos',
11
+ description: 'Manage a todo list for the current session. Use this to track tasks and progress.',
12
+ parameters: {
13
+ type: 'object',
14
+ properties: {
15
+ action: { type: 'string', enum: ['add', 'update', 'delete', 'list'], description: 'Action to perform' },
16
+ content: { type: 'string', description: 'Todo item content (required for add)' },
17
+ id: { type: 'string', description: 'Todo item ID (required for update/delete)' },
18
+ status: { type: 'string', enum: ['pending', 'done', 'wontdo'], description: 'New status (for update)' },
19
+ },
20
+ required: ['action'],
21
+ },
22
+ },
23
+ execute: async (args, _cwd) => {
24
+ switch (args.action) {
25
+ case 'add': {
26
+ if (!args.content)
27
+ return { id: '', success: false, output: '', error: 'content required', tool: 'todos', args };
28
+ const id = String(nextId++);
29
+ todos.push({ id, content: args.content, status: 'pending' });
30
+ return { id: '', success: true, output: `Added todo: ${args.content}`, tool: 'todos', args };
31
+ }
32
+ case 'update': {
33
+ const todo = todos.find((t) => t.id === args.id);
34
+ if (!todo)
35
+ return { id: '', success: false, output: '', error: `Todo ${args.id} not found`, tool: 'todos', args };
36
+ todo.status = args.status || todo.status;
37
+ return { id: '', success: true, output: `Updated todo ${args.id}: ${args.status}`, tool: 'todos', args };
38
+ }
39
+ case 'delete': {
40
+ todos = todos.filter((t) => t.id !== args.id);
41
+ return { id: '', success: true, output: `Deleted todo ${args.id}`, tool: 'todos', args };
42
+ }
43
+ case 'list': {
44
+ const list = todos.map((t) => `[${t.status === 'done' ? 'x' : ' '}] ${t.id}: ${t.content}`).join('\n');
45
+ return { id: '', success: true, output: list || 'No todos', tool: 'todos', args };
46
+ }
47
+ default:
48
+ return { id: '', success: false, output: '', error: `Unknown action: ${args.action}`, tool: 'todos', args };
49
+ }
50
+ },
51
+ };
52
+ function getTodos() { return todos; }
53
+ function clearTodos() { todos = []; nextId = 1; }
54
+ //# sourceMappingURL=todos.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"todos.js","sourceRoot":"","sources":["../../src/tools/todos.ts"],"names":[],"mappings":";;;AAsDA,4BAAmD;AACnD,gCAAuD;AA/CvD,IAAI,KAAK,GAAW,EAAE,CAAA;AACtB,IAAI,MAAM,GAAG,CAAC,CAAA;AAED,QAAA,SAAS,GAAG;IACvB,UAAU,EAAE;QACV,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,mFAAmF;QAChG,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,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AAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;YACnF,CAAC;YACD;gBACE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,mBAAmB,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;QAC/G,CAAC;IACH,CAAC;CACF,CAAA;AAED,SAAgB,QAAQ,KAAa,OAAO,KAAK,CAAA,CAAC,CAAC;AACnD,SAAgB,UAAU,KAAK,KAAK,GAAG,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { ToolResult } from '../types/index.js';
2
+ export declare const viewTool: {
3
+ definition: {
4
+ name: string;
5
+ description: string;
6
+ parameters: {
7
+ type: string;
8
+ properties: {
9
+ file_path: {
10
+ type: string;
11
+ description: string;
12
+ };
13
+ offset: {
14
+ type: string;
15
+ description: string;
16
+ };
17
+ limit: {
18
+ type: string;
19
+ description: string;
20
+ };
21
+ };
22
+ required: string[];
23
+ };
24
+ };
25
+ execute: (args: any, cwd: string) => Promise<ToolResult>;
26
+ };
27
+ //# sourceMappingURL=view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/tools/view.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAKnE,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;oBAcG,GAAG,OAAO,MAAM,KAAG,OAAO,CAAC,UAAU,CAAC;CAiC7D,CAAA"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.viewTool = void 0;
4
+ const fs_1 = require("fs");
5
+ const path_1 = require("path");
6
+ const DEFAULT_READ_LIMIT = 2000;
7
+ const MAX_VIEW_SIZE = 200 * 1024;
8
+ exports.viewTool = {
9
+ definition: {
10
+ name: 'view',
11
+ description: 'Read a file by path with line numbers; supports offset and line limit (default 2000, max 200KB returned file content section); renders images (PNG, JPEG, GIF, WebP); use ls for directories.',
12
+ parameters: {
13
+ type: 'object',
14
+ properties: {
15
+ file_path: { type: 'string', description: 'The path to the file to read' },
16
+ offset: { type: 'number', description: 'The line number to start reading from (0-based)' },
17
+ limit: { type: 'number', description: 'The number of lines to read (defaults to 2000)' },
18
+ },
19
+ required: ['file_path'],
20
+ },
21
+ },
22
+ execute: async (args, cwd) => {
23
+ if (!args.file_path) {
24
+ return { id: '', success: false, output: '', error: 'file_path is required', tool: 'view', args };
25
+ }
26
+ const filePath = (0, path_1.resolve)(cwd, args.file_path);
27
+ let stat;
28
+ try {
29
+ stat = (0, fs_1.statSync)(filePath);
30
+ }
31
+ catch {
32
+ return { id: '', success: false, output: '', error: `File not found: ${args.file_path}`, tool: 'view', args };
33
+ }
34
+ if (stat.isDirectory()) {
35
+ return { id: '', success: false, output: '', error: `Path is a directory, not a file: ${args.file_path}`, tool: 'view', args };
36
+ }
37
+ if (stat.size > MAX_VIEW_SIZE) {
38
+ return { id: '', success: false, output: '', error: `Content section is too large (${stat.size} bytes). Maximum size is ${MAX_VIEW_SIZE} bytes`, tool: 'view', args };
39
+ }
40
+ const content = (0, fs_1.readFileSync)(filePath, 'utf-8');
41
+ const lines = content.split('\n');
42
+ const offset = args.offset || 0;
43
+ const limit = args.limit || DEFAULT_READ_LIMIT;
44
+ const selected = lines.slice(offset, offset + limit);
45
+ const hasMore = lines.length > offset + limit;
46
+ let output = '<file>\n';
47
+ for (let i = 0; i < selected.length; i++) {
48
+ const lineNum = i + offset + 1;
49
+ const numStr = String(lineNum).padStart(6);
50
+ output += `${numStr}|${selected[i]}\n`;
51
+ }
52
+ if (hasMore) {
53
+ output += `\n(File has more lines. Use 'offset' parameter to read beyond line ${offset + limit})\n`;
54
+ }
55
+ output += '</file>\n';
56
+ return { id: '', success: true, output, tool: 'view', args };
57
+ },
58
+ };
59
+ //# sourceMappingURL=view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/tools/view.ts"],"names":[],"mappings":";;;AAAA,2BAA2C;AAC3C,+BAA8B;AAG9B,MAAM,kBAAkB,GAAG,IAAI,CAAA;AAC/B,MAAM,aAAa,GAAG,GAAG,GAAG,IAAI,CAAA;AAEnB,QAAA,QAAQ,GAAG;IACtB,UAAU,EAAE;QACV,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,+LAA+L;QAC5M,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8BAA8B,EAAE;gBAC1E,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,iDAAiD,EAAE;gBAC1F,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gDAAgD,EAAE;aACzF;YACD,QAAQ,EAAE,CAAC,WAAW,CAAC;SACxB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,IAAS,EAAE,GAAW,EAAuB,EAAE;QAC7D,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,uBAAuB,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;QACnG,CAAC;QACD,MAAM,QAAQ,GAAG,IAAA,cAAO,EAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;QAC7C,IAAI,IAAI,CAAA;QACR,IAAI,CAAC;YAAC,IAAI,GAAG,IAAA,aAAQ,EAAC,QAAQ,CAAC,CAAA;QAA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EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,MAAM,OAAO,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,CAAA;YAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;YAC1C,MAAM,IAAI,GAAG,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA;QACxC,CAAC;QACD,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,IAAI,sEAAsE,MAAM,GAAG,KAAK,KAAK,CAAA;QACrG,CAAC;QACD,MAAM,IAAI,WAAW,CAAA;QACrB,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;IAC9D,CAAC;CACF,CAAA"}
@@ -0,0 +1,24 @@
1
+ import type { ToolResult } from '../types/index.js';
2
+ export declare const webFetchTool: {
3
+ definition: {
4
+ name: string;
5
+ description: string;
6
+ parameters: {
7
+ type: string;
8
+ properties: {
9
+ url: {
10
+ type: string;
11
+ description: string;
12
+ };
13
+ format: {
14
+ type: string;
15
+ enum: string[];
16
+ description: string;
17
+ };
18
+ };
19
+ required: string[];
20
+ };
21
+ };
22
+ execute: (args: any, _cwd: string) => Promise<ToolResult>;
23
+ };
24
+ //# sourceMappingURL=web_fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web_fetch.d.ts","sourceRoot":"","sources":["../../src/tools/web_fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;oBAaD,GAAG,QAAQ,MAAM,KAAG,OAAO,CAAC,UAAU,CAAC;CAwB9D,CAAA"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.webFetchTool = void 0;
4
+ exports.webFetchTool = {
5
+ definition: {
6
+ name: 'web_fetch',
7
+ description: 'Fetch content from a URL. Use this to read documentation, APIs, or web pages.',
8
+ parameters: {
9
+ type: 'object',
10
+ properties: {
11
+ url: { type: 'string', description: 'URL to fetch' },
12
+ format: { type: 'string', enum: ['text', 'markdown', 'html'], description: 'Response format' },
13
+ },
14
+ required: ['url'],
15
+ },
16
+ },
17
+ execute: async (args, _cwd) => {
18
+ try {
19
+ const res = await fetch(args.url, {
20
+ headers: { 'User-Agent': 'Nyx-CLI/1.0' },
21
+ signal: AbortSignal.timeout(15000),
22
+ });
23
+ if (!res.ok) {
24
+ return {
25
+ id: '', success: false, output: '', error: `HTTP ${res.status}: ${res.statusText}`,
26
+ tool: 'web_fetch', args,
27
+ };
28
+ }
29
+ const text = await res.text();
30
+ return {
31
+ id: '', success: true, output: text.substring(0, 10000),
32
+ tool: 'web_fetch', args,
33
+ };
34
+ }
35
+ catch (err) {
36
+ return {
37
+ id: '', success: false, output: '', error: err.message,
38
+ tool: 'web_fetch', args,
39
+ };
40
+ }
41
+ },
42
+ };
43
+ //# sourceMappingURL=web_fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web_fetch.js","sourceRoot":"","sources":["../../src/tools/web_fetch.ts"],"names":[],"mappings":";;;AAEa,QAAA,YAAY,GAAG;IAC1B,UAAU,EAAE;QACV,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,+EAA+E;QAC5F,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE;gBACpD,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,WAAW,EAAE,iBAAiB,EAAE;aAC/F;YACD,QAAQ,EAAE,CAAC,KAAK,CAAC;SAClB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,IAAS,EAAE,IAAY,EAAuB,EAAE;QAC9D,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;gBAChC,OAAO,EAAE,EAAE,YAAY,EAAE,aAAa,EAAE;gBACxC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC;aACnC,CAAC,CAAA;YACF,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;gBACZ,OAAO;oBACL,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,UAAU,EAAE;oBAClF,IAAI,EAAE,WAAW,EAAE,IAAI;iBACxB,CAAA;YACH,CAAC;YACD,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAA;YAC7B,OAAO;gBACL,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC;gBACvD,IAAI,EAAE,WAAW,EAAE,IAAI;aACxB,CAAA;QACH,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO;gBACL,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO;gBACtD,IAAI,EAAE,WAAW,EAAE,IAAI;aACxB,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA"}
@@ -0,0 +1,23 @@
1
+ import type { ToolResult } from '../types/index.js';
2
+ export declare const webSearchTool: {
3
+ definition: {
4
+ name: string;
5
+ description: string;
6
+ parameters: {
7
+ type: string;
8
+ properties: {
9
+ query: {
10
+ type: string;
11
+ description: string;
12
+ };
13
+ maxResults: {
14
+ type: string;
15
+ description: string;
16
+ };
17
+ };
18
+ required: string[];
19
+ };
20
+ };
21
+ execute: (args: any, _cwd: string) => Promise<ToolResult>;
22
+ };
23
+ //# sourceMappingURL=web_search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web_search.d.ts","sourceRoot":"","sources":["../../src/tools/web_search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAInE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;oBAaF,GAAG,QAAQ,MAAM,KAAG,OAAO,CAAC,UAAU,CAAC;CAuB9D,CAAA"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.webSearchTool = void 0;
4
+ const SEARCH_API_URL = 'https://api.duckduckgo.com';
5
+ exports.webSearchTool = {
6
+ definition: {
7
+ name: 'web_search',
8
+ description: 'Search the web for information. Returns relevant snippets and URLs.',
9
+ parameters: {
10
+ type: 'object',
11
+ properties: {
12
+ query: { type: 'string', description: 'Search query' },
13
+ maxResults: { type: 'number', description: 'Maximum results to return' },
14
+ },
15
+ required: ['query'],
16
+ },
17
+ },
18
+ execute: async (args, _cwd) => {
19
+ try {
20
+ const res = await fetch(`${SEARCH_API_URL}/?q=${encodeURIComponent(args.query)}&format=json`, { signal: AbortSignal.timeout(10000) });
21
+ if (!res.ok)
22
+ throw new Error(`Search failed: ${res.status}`);
23
+ const data = await res.json();
24
+ const results = data.RelatedTopics?.slice(0, args.maxResults || 5)
25
+ .map((r) => r.Text || r.Result)
26
+ .filter(Boolean)
27
+ .join('\n\n') || 'No results found';
28
+ return {
29
+ id: '', success: true, output: results,
30
+ tool: 'web_search', args,
31
+ };
32
+ }
33
+ catch (err) {
34
+ return {
35
+ id: '', success: false, output: '', error: err.message,
36
+ tool: 'web_search', args,
37
+ };
38
+ }
39
+ },
40
+ };
41
+ //# sourceMappingURL=web_search.js.map
@@ -0,0 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E,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO;gBACtC,IAAI,EAAE,YAAY,EAAE,IAAI;aACzB,CAAA;QACH,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO;gBACL,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO;gBACtD,IAAI,EAAE,YAAY,EAAE,IAAI;aACzB,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA"}
@@ -0,0 +1,23 @@
1
+ import type { ToolResult } from '../types/index.js';
2
+ export declare const writeTool: {
3
+ definition: {
4
+ name: string;
5
+ description: string;
6
+ parameters: {
7
+ type: string;
8
+ properties: {
9
+ file_path: {
10
+ type: string;
11
+ description: string;
12
+ };
13
+ content: {
14
+ type: string;
15
+ description: string;
16
+ };
17
+ };
18
+ required: string[];
19
+ };
20
+ };
21
+ execute: (args: any, cwd: string) => Promise<ToolResult>;
22
+ };
23
+ //# sourceMappingURL=write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/tools/write.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnE,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;oBAaE,GAAG,OAAO,MAAM,KAAG,OAAO,CAAC,UAAU,CAAC;CAkB7D,CAAA"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.writeTool = void 0;
4
+ const fs_1 = require("fs");
5
+ const path_1 = require("path");
6
+ exports.writeTool = {
7
+ definition: {
8
+ name: 'write',
9
+ description: 'Create or overwrite a file with given content; auto-creates parent dirs. Cannot append. Read the file first to avoid conflicts. For surgical changes use edit or multiedit.',
10
+ parameters: {
11
+ type: 'object',
12
+ properties: {
13
+ file_path: { type: 'string', description: 'The path to the file to write' },
14
+ content: { type: 'string', description: 'The content to write to the file' },
15
+ },
16
+ required: ['file_path', 'content'],
17
+ },
18
+ },
19
+ execute: async (args, cwd) => {
20
+ const filePath = (0, path_1.resolve)(cwd, args.file_path);
21
+ let exists = false;
22
+ try {
23
+ const stat = (0, fs_1.statSync)(filePath);
24
+ if (stat.isDirectory()) {
25
+ return { id: '', success: false, output: '', error: `Path is a directory, not a file: ${args.file_path}`, tool: 'write', args };
26
+ }
27
+ exists = true;
28
+ const oldContent = (0, fs_1.readFileSync)(filePath, 'utf-8');
29
+ if (oldContent === args.content) {
30
+ return { id: '', success: false, output: '', error: `File ${args.file_path} already contains the exact content. No changes made.`, tool: 'write', args };
31
+ }
32
+ }
33
+ catch { }
34
+ (0, fs_1.mkdirSync)((0, path_1.dirname)(filePath), { recursive: true });
35
+ (0, fs_1.writeFileSync)(filePath, args.content, 'utf-8');
36
+ return { id: '', success: true, output: `<result>\nFile successfully written: ${args.file_path}\n</result>`, tool: 'write', args };
37
+ },
38
+ };
39
+ //# sourceMappingURL=write.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/tools/write.ts"],"names":[],"mappings":";;;AAAA,2BAAqE;AACrE,+BAAuC;AAG1B,QAAA,SAAS,GAAG;IACvB,UAAU,EAAE;QACV,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,6KAA6K;QAC1L,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+BAA+B,EAAE;gBAC3E,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kCAAkC,EAAE;aAC7E;YACD,QAAQ,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC;SACnC;KACF;IACD,OAAO,EAAE,KAAK,EAAE,IAAS,EAAE,GAAW,EAAuB,EAAE;QAC7D,MAAM,QAAQ,GA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