@ai-devkit/agent-manager 0.3.0 → 0.5.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 (50) hide show
  1. package/dist/adapters/AgentAdapter.d.ts +2 -0
  2. package/dist/adapters/AgentAdapter.d.ts.map +1 -1
  3. package/dist/adapters/ClaudeCodeAdapter.d.ts +49 -38
  4. package/dist/adapters/ClaudeCodeAdapter.d.ts.map +1 -1
  5. package/dist/adapters/ClaudeCodeAdapter.js +286 -293
  6. package/dist/adapters/ClaudeCodeAdapter.js.map +1 -1
  7. package/dist/adapters/CodexAdapter.d.ts +32 -30
  8. package/dist/adapters/CodexAdapter.d.ts.map +1 -1
  9. package/dist/adapters/CodexAdapter.js +148 -284
  10. package/dist/adapters/CodexAdapter.js.map +1 -1
  11. package/dist/index.d.ts +1 -3
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +1 -10
  14. package/dist/index.js.map +1 -1
  15. package/dist/utils/index.d.ts +6 -3
  16. package/dist/utils/index.d.ts.map +1 -1
  17. package/dist/utils/index.js +12 -11
  18. package/dist/utils/index.js.map +1 -1
  19. package/dist/utils/matching.d.ts +39 -0
  20. package/dist/utils/matching.d.ts.map +1 -0
  21. package/dist/utils/matching.js +103 -0
  22. package/dist/utils/matching.js.map +1 -0
  23. package/dist/utils/process.d.ts +25 -40
  24. package/dist/utils/process.d.ts.map +1 -1
  25. package/dist/utils/process.js +151 -105
  26. package/dist/utils/process.js.map +1 -1
  27. package/dist/utils/session.d.ts +30 -0
  28. package/dist/utils/session.d.ts.map +1 -0
  29. package/dist/utils/session.js +101 -0
  30. package/dist/utils/session.js.map +1 -0
  31. package/package.json +2 -2
  32. package/src/__tests__/AgentManager.test.ts +0 -25
  33. package/src/__tests__/adapters/ClaudeCodeAdapter.test.ts +921 -205
  34. package/src/__tests__/adapters/CodexAdapter.test.ts +468 -269
  35. package/src/__tests__/utils/matching.test.ts +191 -0
  36. package/src/__tests__/utils/process.test.ts +202 -0
  37. package/src/__tests__/utils/session.test.ts +117 -0
  38. package/src/adapters/AgentAdapter.ts +3 -0
  39. package/src/adapters/ClaudeCodeAdapter.ts +341 -418
  40. package/src/adapters/CodexAdapter.ts +155 -420
  41. package/src/index.ts +1 -3
  42. package/src/utils/index.ts +6 -3
  43. package/src/utils/matching.ts +92 -0
  44. package/src/utils/process.ts +133 -119
  45. package/src/utils/session.ts +92 -0
  46. package/dist/utils/file.d.ts +0 -52
  47. package/dist/utils/file.d.ts.map +0 -1
  48. package/dist/utils/file.js +0 -135
  49. package/dist/utils/file.js.map +0 -1
  50. package/src/utils/file.ts +0 -100
@@ -1,135 +0,0 @@
1
- "use strict";
2
- /**
3
- * File Utilities
4
- *
5
- * Helper functions for reading files efficiently
6
- */
7
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
- if (k2 === undefined) k2 = k;
9
- var desc = Object.getOwnPropertyDescriptor(m, k);
10
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
- desc = { enumerable: true, get: function() { return m[k]; } };
12
- }
13
- Object.defineProperty(o, k2, desc);
14
- }) : (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- o[k2] = m[k];
17
- }));
18
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
- Object.defineProperty(o, "default", { enumerable: true, value: v });
20
- }) : function(o, v) {
21
- o["default"] = v;
22
- });
23
- var __importStar = (this && this.__importStar) || (function () {
24
- var ownKeys = function(o) {
25
- ownKeys = Object.getOwnPropertyNames || function (o) {
26
- var ar = [];
27
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
- return ar;
29
- };
30
- return ownKeys(o);
31
- };
32
- return function (mod) {
33
- if (mod && mod.__esModule) return mod;
34
- var result = {};
35
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
- __setModuleDefault(result, mod);
37
- return result;
38
- };
39
- })();
40
- Object.defineProperty(exports, "__esModule", { value: true });
41
- exports.readLastLines = readLastLines;
42
- exports.readJsonLines = readJsonLines;
43
- exports.fileExists = fileExists;
44
- exports.readJson = readJson;
45
- const fs = __importStar(require("fs"));
46
- /**
47
- * Read last N lines from a file efficiently
48
- *
49
- * @param filePath Path to the file
50
- * @param lineCount Number of lines to read from the end (default: 100)
51
- * @returns Array of lines
52
- *
53
- * @example
54
- * ```typescript
55
- * const lastLines = readLastLines('/path/to/log.txt', 50);
56
- * ```
57
- */
58
- function readLastLines(filePath, lineCount = 100) {
59
- if (!fs.existsSync(filePath)) {
60
- return [];
61
- }
62
- try {
63
- const content = fs.readFileSync(filePath, 'utf-8');
64
- const allLines = content.trim().split('\n');
65
- // Return last N lines (or all if file has fewer lines)
66
- return allLines.slice(-lineCount);
67
- }
68
- catch (error) {
69
- console.error(`Failed to read ${filePath}:`, error);
70
- return [];
71
- }
72
- }
73
- /**
74
- * Read a JSONL (JSON Lines) file and parse each line
75
- *
76
- * @param filePath Path to the JSONL file
77
- * @param maxLines Maximum number of lines to read from end (default: 1000)
78
- * @returns Array of parsed objects
79
- *
80
- * @example
81
- * ```typescript
82
- * const entries = readJsonLines<MyType>('/path/to/data.jsonl');
83
- * const recent = readJsonLines<MyType>('/path/to/data.jsonl', 100);
84
- * ```
85
- */
86
- function readJsonLines(filePath, maxLines = 1000) {
87
- const lines = readLastLines(filePath, maxLines);
88
- return lines.map(line => {
89
- try {
90
- return JSON.parse(line);
91
- }
92
- catch {
93
- return null;
94
- }
95
- }).filter((entry) => entry !== null);
96
- }
97
- /**
98
- * Check if a file exists
99
- *
100
- * @param filePath Path to check
101
- * @returns True if file exists
102
- */
103
- function fileExists(filePath) {
104
- try {
105
- return fs.existsSync(filePath);
106
- }
107
- catch {
108
- return false;
109
- }
110
- }
111
- /**
112
- * Read a JSON file safely
113
- *
114
- * @param filePath Path to JSON file
115
- * @returns Parsed JSON object or null if error
116
- *
117
- * @example
118
- * ```typescript
119
- * const config = readJson<ConfigType>('/path/to/config.json');
120
- * ```
121
- */
122
- function readJson(filePath) {
123
- if (!fs.existsSync(filePath)) {
124
- return null;
125
- }
126
- try {
127
- const content = fs.readFileSync(filePath, 'utf-8');
128
- return JSON.parse(content);
129
- }
130
- catch (error) {
131
- console.error(`Failed to parse JSON from ${filePath}:`, error);
132
- return null;
133
- }
134
- }
135
- //# sourceMappingURL=file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/utils/file.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBH,sCAeC;AAeD,sCAUC;AAQD,gCAMC;AAaD,4BAYC;AA7FD,uCAAyB;AAEzB;;;;;;;;;;;GAWG;AACH,SAAgB,aAAa,CAAC,QAAgB,EAAE,YAAoB,GAAG;IACnE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3B,OAAO,EAAE,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACD,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACnD,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE5C,uDAAuD;QACvD,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,kBAAkB,QAAQ,GAAG,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO,EAAE,CAAC;IACd,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,aAAa,CAAc,QAAgB,EAAE,WAAmB,IAAI;IAChF,MAAM,KAAK,GAAG,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAEhD,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACpB,IAAI,CAAC;YACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAC;QACjC,CAAC;QAAC,MAAM,CAAC;YACL,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAc,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,QAAgB;IACvC,IAAI,CAAC;QACD,OAAO,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,QAAQ,CAAc,QAAgB;IAClD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,CAAC;QACD,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAM,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,6BAA6B,QAAQ,GAAG,EAAE,KAAK,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC"}
package/src/utils/file.ts DELETED
@@ -1,100 +0,0 @@
1
- /**
2
- * File Utilities
3
- *
4
- * Helper functions for reading files efficiently
5
- */
6
-
7
- import * as fs from 'fs';
8
-
9
- /**
10
- * Read last N lines from a file efficiently
11
- *
12
- * @param filePath Path to the file
13
- * @param lineCount Number of lines to read from the end (default: 100)
14
- * @returns Array of lines
15
- *
16
- * @example
17
- * ```typescript
18
- * const lastLines = readLastLines('/path/to/log.txt', 50);
19
- * ```
20
- */
21
- export function readLastLines(filePath: string, lineCount: number = 100): string[] {
22
- if (!fs.existsSync(filePath)) {
23
- return [];
24
- }
25
-
26
- try {
27
- const content = fs.readFileSync(filePath, 'utf-8');
28
- const allLines = content.trim().split('\n');
29
-
30
- // Return last N lines (or all if file has fewer lines)
31
- return allLines.slice(-lineCount);
32
- } catch (error) {
33
- console.error(`Failed to read ${filePath}:`, error);
34
- return [];
35
- }
36
- }
37
-
38
- /**
39
- * Read a JSONL (JSON Lines) file and parse each line
40
- *
41
- * @param filePath Path to the JSONL file
42
- * @param maxLines Maximum number of lines to read from end (default: 1000)
43
- * @returns Array of parsed objects
44
- *
45
- * @example
46
- * ```typescript
47
- * const entries = readJsonLines<MyType>('/path/to/data.jsonl');
48
- * const recent = readJsonLines<MyType>('/path/to/data.jsonl', 100);
49
- * ```
50
- */
51
- export function readJsonLines<T = unknown>(filePath: string, maxLines: number = 1000): T[] {
52
- const lines = readLastLines(filePath, maxLines);
53
-
54
- return lines.map(line => {
55
- try {
56
- return JSON.parse(line) as T;
57
- } catch {
58
- return null;
59
- }
60
- }).filter((entry): entry is T => entry !== null);
61
- }
62
-
63
- /**
64
- * Check if a file exists
65
- *
66
- * @param filePath Path to check
67
- * @returns True if file exists
68
- */
69
- export function fileExists(filePath: string): boolean {
70
- try {
71
- return fs.existsSync(filePath);
72
- } catch {
73
- return false;
74
- }
75
- }
76
-
77
- /**
78
- * Read a JSON file safely
79
- *
80
- * @param filePath Path to JSON file
81
- * @returns Parsed JSON object or null if error
82
- *
83
- * @example
84
- * ```typescript
85
- * const config = readJson<ConfigType>('/path/to/config.json');
86
- * ```
87
- */
88
- export function readJson<T = unknown>(filePath: string): T | null {
89
- if (!fs.existsSync(filePath)) {
90
- return null;
91
- }
92
-
93
- try {
94
- const content = fs.readFileSync(filePath, 'utf-8');
95
- return JSON.parse(content) as T;
96
- } catch (error) {
97
- console.error(`Failed to parse JSON from ${filePath}:`, error);
98
- return null;
99
- }
100
- }