@untools/devflow 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.
Files changed (106) hide show
  1. package/dist/agent/client.d.ts +50 -0
  2. package/dist/agent/client.d.ts.map +1 -0
  3. package/dist/agent/client.js +52 -0
  4. package/dist/agent/client.js.map +1 -0
  5. package/dist/auth/github-token.d.ts +16 -0
  6. package/dist/auth/github-token.d.ts.map +1 -0
  7. package/dist/auth/github-token.js +69 -0
  8. package/dist/auth/github-token.js.map +1 -0
  9. package/dist/auth/oauth.d.ts +16 -0
  10. package/dist/auth/oauth.d.ts.map +1 -0
  11. package/dist/auth/oauth.js +146 -0
  12. package/dist/auth/oauth.js.map +1 -0
  13. package/dist/cli.d.ts +2 -0
  14. package/dist/cli.d.ts.map +1 -0
  15. package/dist/cli.js +363 -0
  16. package/dist/cli.js.map +1 -0
  17. package/dist/config.d.ts +35 -0
  18. package/dist/config.d.ts.map +1 -0
  19. package/dist/config.js +78 -0
  20. package/dist/config.js.map +1 -0
  21. package/dist/copilot/client.d.ts +75 -0
  22. package/dist/copilot/client.d.ts.map +1 -0
  23. package/dist/copilot/client.js +226 -0
  24. package/dist/copilot/client.js.map +1 -0
  25. package/dist/copilot/flows/base.d.ts +47 -0
  26. package/dist/copilot/flows/base.d.ts.map +1 -0
  27. package/dist/copilot/flows/base.js +235 -0
  28. package/dist/copilot/flows/base.js.map +1 -0
  29. package/dist/copilot/flows/explain.d.ts +5 -0
  30. package/dist/copilot/flows/explain.d.ts.map +1 -0
  31. package/dist/copilot/flows/explain.js +76 -0
  32. package/dist/copilot/flows/explain.js.map +1 -0
  33. package/dist/copilot/flows/feature.d.ts +5 -0
  34. package/dist/copilot/flows/feature.d.ts.map +1 -0
  35. package/dist/copilot/flows/feature.js +83 -0
  36. package/dist/copilot/flows/feature.js.map +1 -0
  37. package/dist/copilot/flows/fix-bug.d.ts +5 -0
  38. package/dist/copilot/flows/fix-bug.d.ts.map +1 -0
  39. package/dist/copilot/flows/fix-bug.js +56 -0
  40. package/dist/copilot/flows/fix-bug.js.map +1 -0
  41. package/dist/copilot/flows/index.d.ts +17 -0
  42. package/dist/copilot/flows/index.d.ts.map +1 -0
  43. package/dist/copilot/flows/index.js +41 -0
  44. package/dist/copilot/flows/index.js.map +1 -0
  45. package/dist/copilot/flows/review-pr.d.ts +5 -0
  46. package/dist/copilot/flows/review-pr.d.ts.map +1 -0
  47. package/dist/copilot/flows/review-pr.js +84 -0
  48. package/dist/copilot/flows/review-pr.js.map +1 -0
  49. package/dist/copilot/session-registry.d.ts +12 -0
  50. package/dist/copilot/session-registry.d.ts.map +1 -0
  51. package/dist/copilot/session-registry.js +39 -0
  52. package/dist/copilot/session-registry.js.map +1 -0
  53. package/dist/copilot/tools/files.d.ts +53 -0
  54. package/dist/copilot/tools/files.d.ts.map +1 -0
  55. package/dist/copilot/tools/files.js +250 -0
  56. package/dist/copilot/tools/files.js.map +1 -0
  57. package/dist/copilot/tools/git.d.ts +37 -0
  58. package/dist/copilot/tools/git.d.ts.map +1 -0
  59. package/dist/copilot/tools/git.js +246 -0
  60. package/dist/copilot/tools/git.js.map +1 -0
  61. package/dist/copilot/tools/github.d.ts +36 -0
  62. package/dist/copilot/tools/github.d.ts.map +1 -0
  63. package/dist/copilot/tools/github.js +216 -0
  64. package/dist/copilot/tools/github.js.map +1 -0
  65. package/dist/copilot/tools/index.d.ts +26 -0
  66. package/dist/copilot/tools/index.d.ts.map +1 -0
  67. package/dist/copilot/tools/index.js +25 -0
  68. package/dist/copilot/tools/index.js.map +1 -0
  69. package/dist/copilot/tools/progress.d.ts +19 -0
  70. package/dist/copilot/tools/progress.d.ts.map +1 -0
  71. package/dist/copilot/tools/progress.js +87 -0
  72. package/dist/copilot/tools/progress.js.map +1 -0
  73. package/dist/copilot/tools/tests.d.ts +29 -0
  74. package/dist/copilot/tools/tests.d.ts.map +1 -0
  75. package/dist/copilot/tools/tests.js +136 -0
  76. package/dist/copilot/tools/tests.js.map +1 -0
  77. package/dist/copilot/tools/utils.d.ts +14 -0
  78. package/dist/copilot/tools/utils.d.ts.map +1 -0
  79. package/dist/copilot/tools/utils.js +89 -0
  80. package/dist/copilot/tools/utils.js.map +1 -0
  81. package/dist/credentials.d.ts +21 -0
  82. package/dist/credentials.d.ts.map +1 -0
  83. package/dist/credentials.js +62 -0
  84. package/dist/credentials.js.map +1 -0
  85. package/dist/devflow/client.d.ts +16 -0
  86. package/dist/devflow/client.d.ts.map +1 -0
  87. package/dist/devflow/client.js +61 -0
  88. package/dist/devflow/client.js.map +1 -0
  89. package/dist/index.d.ts +2 -0
  90. package/dist/index.d.ts.map +1 -0
  91. package/dist/index.js +7 -0
  92. package/dist/index.js.map +1 -0
  93. package/dist/pinga/client.d.ts +16 -0
  94. package/dist/pinga/client.d.ts.map +1 -0
  95. package/dist/pinga/client.js +61 -0
  96. package/dist/pinga/client.js.map +1 -0
  97. package/dist/types.d.ts +58 -0
  98. package/dist/types.d.ts.map +1 -0
  99. package/dist/types.js +2 -0
  100. package/dist/types.js.map +1 -0
  101. package/dist/verify-full-flow.d.ts +2 -0
  102. package/dist/verify-full-flow.d.ts.map +1 -0
  103. package/dist/verify-full-flow.js +81 -0
  104. package/dist/verify-full-flow.js.map +1 -0
  105. package/package.json +8 -1
  106. package/.versionrc.json +0 -53
@@ -0,0 +1,89 @@
1
+ // Utility functions for tool operations
2
+ import * as fs from "fs/promises";
3
+ import * as path from "path";
4
+ import { execSync } from "child_process";
5
+ export class ToolError extends Error {
6
+ constructor(message, tool, code) {
7
+ super(message);
8
+ this.tool = tool;
9
+ this.code = code;
10
+ this.name = "ToolError";
11
+ }
12
+ }
13
+ export async function ensureRepoStoragePath() {
14
+ const storagePath = process.env.REPO_STORAGE_PATH || "/tmp/devflow-repos";
15
+ try {
16
+ await fs.mkdir(storagePath, { recursive: true });
17
+ return storagePath;
18
+ }
19
+ catch (error) {
20
+ throw new ToolError(`Failed to create storage directory: ${error}`, "storage");
21
+ }
22
+ }
23
+ export async function getRepoPath(repo, storagePath, localPath) {
24
+ if (localPath)
25
+ return localPath;
26
+ const storage = storagePath || (await ensureRepoStoragePath());
27
+ return path.join(storage, repo.replace("/", "-"));
28
+ }
29
+ export function executeCommand(command, cwd, timeout = 60000) {
30
+ try {
31
+ const result = execSync(command, {
32
+ cwd,
33
+ encoding: "utf-8",
34
+ maxBuffer: 10 * 1024 * 1024, // 10MB buffer
35
+ timeout,
36
+ stdio: "pipe",
37
+ });
38
+ return result;
39
+ }
40
+ catch (error) {
41
+ const errorMsg = error instanceof Error ? error.message : String(error);
42
+ throw new ToolError(`Command failed: ${errorMsg}`, "exec", "EXEC_FAILED");
43
+ }
44
+ }
45
+ export async function fileExists(filePath) {
46
+ try {
47
+ await fs.access(filePath);
48
+ return true;
49
+ }
50
+ catch {
51
+ return false;
52
+ }
53
+ }
54
+ export async function readFile(filePath) {
55
+ try {
56
+ return await fs.readFile(filePath, "utf-8");
57
+ }
58
+ catch (error) {
59
+ throw new ToolError(`Failed to read file: ${error}`, "read_file", "FILE_READ_FAILED");
60
+ }
61
+ }
62
+ export async function writeFile(filePath, content) {
63
+ try {
64
+ const dir = path.dirname(filePath);
65
+ await fs.mkdir(dir, { recursive: true });
66
+ await fs.writeFile(filePath, content, "utf-8");
67
+ }
68
+ catch (error) {
69
+ throw new ToolError(`Failed to write file: ${error}`, "write_file", "FILE_WRITE_FAILED");
70
+ }
71
+ }
72
+ export async function listFiles(dirPath, pattern) {
73
+ try {
74
+ const files = await fs.readdir(dirPath, { recursive: true });
75
+ return pattern ? files.filter((f) => pattern.test(f)) : files;
76
+ }
77
+ catch (error) {
78
+ throw new ToolError(`Failed to list files: ${error}`, "list_files", "LIST_FAILED");
79
+ }
80
+ }
81
+ export async function removeDirectory(dirPath) {
82
+ try {
83
+ await fs.rm(dirPath, { recursive: true, force: true });
84
+ }
85
+ catch (error) {
86
+ throw new ToolError(`Failed to remove directory: ${error}`, "cleanup", "CLEANUP_FAILED");
87
+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 */
5
+ export declare class CredentialDecryption {
6
+ private encryptionKey;
7
+ constructor(key?: string);
8
+ /**
9
+ * Decrypts a string encrypted by the platform
10
+ */
11
+ decrypt(encrypted: string): string;
12
+ }
13
+ /**
14
+ * Safely decrypts credentials from a task context
15
+ */
16
+ export declare function decryptCredentials(credentials?: {
17
+ github?: string;
18
+ }, encryptionKey?: string): {
19
+ github?: string;
20
+ };
21
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,aAAa,CAAS;gBAElB,GAAG,CAAC,EAAE,MAAM;IAkBxB;;OAEG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;CA4BnC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EACjC,aAAa,CAAC,EAAE,MAAM,GACrB;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAiBrB"}
@@ -0,0 +1,62 @@
1
+ import crypto from "crypto";
2
+ /**
3
+ * Agent-host credential decryption utility.
4
+ * Mirrors the encryption from the platform.
5
+ */
6
+ export class CredentialDecryption {
7
+ constructor(key) {
8
+ if (!key) {
9
+ const envKey = process.env.CREDENTIAL_ENCRYPTION_KEY;
10
+ if (!envKey) {
11
+ // For self-hosted mode, encryption key is optional
12
+ this.encryptionKey = Buffer.alloc(0);
13
+ return;
14
+ }
15
+ key = envKey;
16
+ }
17
+ // Ensure key is exactly 32 bytes for AES-256
18
+ if (key.length < 32) {
19
+ throw new Error("Encryption key must be at least 32 bytes");
20
+ }
21
+ this.encryptionKey = Buffer.from(key.substring(0, 32));
22
+ }
23
+ /**
24
+ * Decrypts a string encrypted by the platform
25
+ */
26
+ decrypt(encrypted) {
27
+ if (!this.encryptionKey.length) {
28
+ throw new Error("Encryption key not available. Set CREDENTIAL_ENCRYPTION_KEY environment variable.");
29
+ }
30
+ const parts = encrypted.split(":");
31
+ if (parts.length !== 3) {
32
+ throw new Error("Invalid encrypted format");
33
+ }
34
+ const iv = Buffer.from(parts[0], "hex");
35
+ const ciphertext = parts[1];
36
+ const authTag = Buffer.from(parts[2], "hex");
37
+ const decipher = crypto.createDecipheriv("aes-256-gcm", this.encryptionKey, iv);
38
+ decipher.setAuthTag(authTag);
39
+ let decrypted = decipher.update(ciphertext, "hex", "utf-8");
40
+ decrypted += decipher.final("utf-8");
41
+ return decrypted;
42
+ }
43
+ }
44
+ /**
45
+ * Safely decrypts credentials from a task context
46
+ */
47
+ export function decryptCredentials(credentials, encryptionKey) {
48
+ if (!credentials?.github) {
49
+ return {};
50
+ }
51
+ try {
52
+ const decryptor = new CredentialDecryption(encryptionKey);
53
+ return {
54
+ github: decryptor.decrypt(credentials.github),
55
+ };
56
+ }
57
+ catch (error) {
58
+ console.error("[Credential Decryption] Failed to decrypt credentials:", error instanceof Error ? error.message : error);
59
+ throw error;
60
+ }
61
+ }
62
+ //# sourceMappingURL=credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAG/B,YAAY,GAAY;QACtB,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC;YACrD,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,mDAAmD;gBACnD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACrC,OAAO;YACT,CAAC;YACD,GAAG,GAAG,MAAM,CAAC;QACf,CAAC;QAED,6CAA6C;QAC7C,IAAI,GAAG,CAAC,MAAM,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,WAAW,EAAE,MAAM,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,IAAI,oBAAoB,CAAC,aAAa,CAAC,CAAC;QAC1D,OAAO;YACL,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC;SAC9C,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CACX,wDAAwD,EACxD,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAC/C,CAAC;QACF,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { ProgressUpdate } from "../types.js";
2
+ declare class DevflowClient {
3
+ private apiUrl;
4
+ private apiSecret;
5
+ constructor(apiUrl: string, token: string);
6
+ sendProgressUpdate(update: ProgressUpdate): Promise<void>;
7
+ notifyCompletion(taskId: string, result: {
8
+ prUrl?: string;
9
+ output?: string;
10
+ summary?: string;
11
+ }): Promise<void>;
12
+ notifyError(taskId: string, error: string): Promise<void>;
13
+ sendLog(taskId: string, level: "info" | "warn" | "error", message: string): Promise<void>;
14
+ }
15
+ export default DevflowClient;
16
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/devflow/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,cAAM,aAAa;IACjB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAKnC,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAmCzD,gBAAgB,CACpB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE;QACN,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GACA,OAAO,CAAC,IAAI,CAAC;IAWV,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASzD,OAAO,CACX,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,EAChC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC;CASjB;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,61 @@
1
+ import axios from "axios";
2
+ class DevflowClient {
3
+ constructor(apiUrl, token) {
4
+ this.apiUrl = apiUrl;
5
+ this.apiSecret = token; // Resusing variable name for minimal diff, but it stores token
6
+ }
7
+ async sendProgressUpdate(update) {
8
+ try {
9
+ console.log(`[DevflowClient] Sending update for task ${update.taskId}: ${update.status} - ${update.step}`);
10
+ const response = await axios.post(`${this.apiUrl}/api/copilot/task-update`, update, {
11
+ headers: {
12
+ Authorization: `Bearer ${this.apiSecret}`,
13
+ "Content-Type": "application/json",
14
+ },
15
+ timeout: 10000, // 10 second timeout
16
+ });
17
+ console.log(`[DevflowClient] Update sent successfully (${response.status})`);
18
+ }
19
+ catch (error) {
20
+ const errorMsg = axios.isAxiosError(error)
21
+ ? `Request failed: ${error.message} (Status: ${error.response?.status}, URL: ${this.apiUrl}/api/copilot/task-update)`
22
+ : String(error);
23
+ console.error(`[DevflowClient] Failed to update progress: ${errorMsg}`);
24
+ // Log response data if available for debugging
25
+ if (axios.isAxiosError(error) && error.response?.data) {
26
+ console.error(`[DevflowClient] Response data: ${JSON.stringify(error.response.data)}`);
27
+ }
28
+ // throw error; // Optional: rethrow if caller needs to know, but suppressing spam is goal
29
+ }
30
+ }
31
+ async notifyCompletion(taskId, result) {
32
+ console.log(`[DevflowClient] Notifying completion for task: ${taskId}`);
33
+ await this.sendProgressUpdate({
34
+ taskId,
35
+ status: "completed",
36
+ step: "Task completed",
37
+ progress: 1.0,
38
+ details: JSON.stringify(result),
39
+ });
40
+ }
41
+ async notifyError(taskId, error) {
42
+ await this.sendProgressUpdate({
43
+ taskId,
44
+ status: "failed",
45
+ step: "Task failed",
46
+ progress: 0,
47
+ error,
48
+ });
49
+ }
50
+ async sendLog(taskId, level, message) {
51
+ await this.sendProgressUpdate({
52
+ taskId,
53
+ status: "in_progress",
54
+ step: "logging",
55
+ progress: 0, // No progress change
56
+ logs: [{ level, message, timestamp: Date.now() }],
57
+ }).catch((err) => console.error("Failed to send log:", err));
58
+ }
59
+ }
60
+ export default DevflowClient;
61
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/devflow/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,aAAa;IAIjB,YAAY,MAAc,EAAE,KAAa;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC,+DAA+D;IACzF,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,MAAsB;QAC7C,IAAI,CAAC;YACH,OAAO,CAAC,GAAG,CACT,2CAA2C,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,MAAM,MAAM,CAAC,IAAI,EAAE,CAC9F,CAAC;YACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAC/B,GAAG,IAAI,CAAC,MAAM,0BAA0B,EACxC,MAAM,EACN;gBACE,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,CAAC,SAAS,EAAE;oBACzC,cAAc,EAAE,kBAAkB;iBACnC;gBACD,OAAO,EAAE,KAAK,EAAE,oBAAoB;aACrC,CACF,CAAC;YACF,OAAO,CAAC,GAAG,CACT,6CAA6C,QAAQ,CAAC,MAAM,GA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CAAC,kBAAkB,CAAC;YAC5B,MAAM;YACN,MAAM,EAAE,aAAa;YACrB,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,CAAC,EAAE,qBAAqB;YAClC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;SAClD,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC,CAAC;IAC/D,CAAC;CACF;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import { runCLI } from "./cli.js";
2
+ // Main entry point
3
+ runCLI().catch((error) => {
4
+ console.error("Fatal error:", error);
5
+ process.exit(1);
6
+ });
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,mBAAmB;AACnB,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAChC,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { ProgressUpdate } from "../types.js";
2
+ declare class PingaClient {
3
+ private apiUrl;
4
+ private apiSecret;
5
+ constructor(apiUrl: string, token: string);
6
+ sendProgressUpdate(update: ProgressUpdate): Promise<void>;
7
+ notifyCompletion(taskId: string, result: {
8
+ prUrl?: string;
9
+ output?: string;
10
+ summary?: string;
11
+ }): Promise<void>;
12
+ notifyError(taskId: string, error: string): Promise<void>;
13
+ sendLog(taskId: string, level: "info" | "warn" | "error", message: string): Promise<void>;
14
+ }
15
+ export default PingaClient;
16
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/pinga/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,cAAM,WAAW;IACf,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAKnC,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAmCzD,gBAAgB,CACpB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE;QACN,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GACA,OAAO,CAAC,IAAI,CAAC;IAWV,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASzD,OAAO,CACX,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,EAChC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC;CASjB;AAED,eAAe,WAAW,CAAC"}
@@ -0,0 +1,61 @@
1
+ import axios from "axios";
2
+ class PingaClient {
3
+ constructor(apiUrl, token) {
4
+ this.apiUrl = apiUrl;
5
+ this.apiSecret = token; // Resusing variable name for minimal diff, but it stores token
6
+ }
7
+ async sendProgressUpdate(update) {
8
+ try {
9
+ console.log(`[PingaClient] Sending update for task ${update.taskId}: ${update.status} - ${update.step}`);
10
+ const response = await axios.post(`${this.apiUrl}/api/copilot/task-update`, update, {
11
+ headers: {
12
+ Authorization: `Bearer ${this.apiSecret}`,
13
+ "Content-Type": "application/json",
14
+ },
15
+ timeout: 10000, // 10 second timeout
16
+ });
17
+ console.log(`[PingaClient] Update sent successfully (${response.status})`);
18
+ }
19
+ catch (error) {
20
+ const errorMsg = axios.isAxiosError(error)
21
+ ? `Request failed: ${error.message} (Status: ${error.response?.status}, URL: ${this.apiUrl}/api/copilot/task-update)`
22
+ : String(error);
23
+ console.error(`[PingaClient] Failed to update progress: ${errorMsg}`);
24
+ // Log response data if available for debugging
25
+ if (axios.isAxiosError(error) && error.response?.data) {
26
+ console.error(`[PingaClient] Response data: ${JSON.stringify(error.response.data)}`);
27
+ }
28
+ // throw error; // Optional: rethrow if caller needs to know, but suppressing spam is goal
29
+ }
30
+ }
31
+ async notifyCompletion(taskId, result) {
32
+ console.log(`[PingaClient] Notifying completion for task: ${taskId}`);
33
+ await this.sendProgressUpdate({
34
+ taskId,
35
+ status: "completed",
36
+ step: "Task completed",
37
+ progress: 1.0,
38
+ details: JSON.stringify(result),
39
+ });
40
+ }
41
+ async notifyError(taskId, error) {
42
+ await this.sendProgressUpdate({
43
+ taskId,
44
+ status: "failed",
45
+ step: "Task failed",
46
+ progress: 0,
47
+ error,
48
+ });
49
+ }
50
+ async sendLog(taskId, level, message) {
51
+ await this.sendProgressUpdate({
52
+ taskId,
53
+ status: "in_progress",
54
+ step: "logging",
55
+ progress: 0, // No progress change
56
+ logs: [{ level, message, timestamp: Date.now() }],
57
+ }).catch((err) => console.error("Failed to send log:", err));
58
+ }
59
+ }
60
+ export default PingaClient;
61
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/pinga/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW;IAIf,YAAY,MAAc,EAAE,KAAa;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,C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AED,OAAO,CAAC,GAAG,CAAC,gDAAgD,MAAM,EAAE,CAAC,CAAC;QACtE,MAAM,IAAI,CAAC,kBAAkB,CAAC;YAC5B,MAAM;YACN,MAAM,EAAE,WAAW;YACnB,IAAI,EAAE,gBAAgB;YACtB,QAAQ,EAAE,GAAG;YACb,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;SAChC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,MAAc,EAAE,KAAa;QAC7C,MAAM,IAAI,CAAC,kBAAkB,CAAC;YAC5B,MAAM;YACN,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,aAAa;YACnB,QAAQ,EAAE,CAAC;YACX,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,OAAO,CACX,MAAc,EACd,KAAgC,EAChC,OAAe;QAEf,MAAM,IAAI,CAAC,kBAAkB,CAAC;YAC5B,MAAM;YACN,MAAM,EAAE,aAAa;YACrB,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,CAAC,EAAE,qBAAqB;YAClC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;SAClD,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC,CAAC;IAC/D,CAAC;CACF;AAED,eAAe,WAAW,CAAC"}
@@ -0,0 +1,58 @@
1
+ export interface TaskPayload {
2
+ intent: "fix-bug" | "feature" | "explain" | "review-pr" | "deploy";
3
+ repo: string;
4
+ branch?: string;
5
+ localPath?: string;
6
+ naturalLanguage: string;
7
+ context?: Record<string, any>;
8
+ }
9
+ export interface CommandRequest {
10
+ taskId: string;
11
+ source: {
12
+ channel: "telegram" | "slack";
13
+ chatId: string;
14
+ messageId: string;
15
+ };
16
+ payload: TaskPayload;
17
+ credentials?: {
18
+ github?: string;
19
+ };
20
+ }
21
+ export interface CommandResponse {
22
+ accepted: boolean;
23
+ taskId: string;
24
+ error?: string;
25
+ }
26
+ export interface ProgressUpdate {
27
+ taskId: string;
28
+ status: "in_progress" | "completed" | "failed";
29
+ step: string;
30
+ progress: number;
31
+ details?: string;
32
+ logs?: {
33
+ level: "info" | "warn" | "error";
34
+ message: string;
35
+ timestamp?: number;
36
+ }[];
37
+ error?: string;
38
+ timestamp?: number;
39
+ }
40
+ export interface ToolExecution {
41
+ toolName: string;
42
+ status: "pending" | "running" | "completed" | "failed";
43
+ startTime: number;
44
+ endTime?: number;
45
+ input?: Record<string, any>;
46
+ output?: Record<string, any>;
47
+ error?: string;
48
+ }
49
+ export interface AgentSession {
50
+ taskId: string;
51
+ intent: string;
52
+ repo: string;
53
+ createdAt: number;
54
+ status: "pending" | "active" | "completed" | "failed";
55
+ toolExecutions: ToolExecution[];
56
+ error?: string;
57
+ }
58
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QACN,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC;QAC9B,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,OAAO,EAAE,WAAW,CAAC;IAErB,WAAW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,aAAa,EAAE,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=verify-full-flow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-full-flow.d.ts","sourceRoot":"","sources":["../src/verify-full-flow.ts"],"names":[],"mappings":""}
@@ -0,0 +1,81 @@
1
+ import { FeatureWorkflow } from "./copilot/flows/feature.js";
2
+ import DevflowClient from "./devflow/client.js";
3
+ // Mock DevflowClient
4
+ const originalSendProgressUpdate = DevflowClient.prototype.sendProgressUpdate;
5
+ const originalNotifyCompletion = DevflowClient.prototype.notifyCompletion;
6
+ const originalNotifyError = DevflowClient.prototype.notifyError;
7
+ const originalSendLog = DevflowClient.prototype.sendLog;
8
+ DevflowClient.prototype.sendProgressUpdate = async (update) => {
9
+ console.log(`[DevFlow Mock] Progress: ${update.step} (${(update.progress * 100).toFixed(0)}%)`);
10
+ };
11
+ DevflowClient.prototype.notifyCompletion = async (taskId, result) => {
12
+ console.log(`[DevFlow Mock] Completion: ${JSON.stringify(result, null, 2)}`);
13
+ };
14
+ DevflowClient.prototype.notifyError = async (taskId, error) => {
15
+ console.error(`[DevFlow Mock] Error: ${error}`);
16
+ };
17
+ DevflowClient.prototype.sendLog = async (taskId, level, message) => {
18
+ console.log(`[DevFlow Mock] Log [${level}]: ${message}`);
19
+ };
20
+ async function main() {
21
+ console.log("🚀 Starting Full Flow Verification (Dynamic Token)...");
22
+ // In a real scenario, we would have encrypted credentials.
23
+ // For this test, we mimic what happens inside setupSession:
24
+ // 1. It receives context.credentials
25
+ // 2. It decrypts (or tries to)
26
+ // 3. It passes extracted github token to createSession
27
+ // Since we can't easily mock the decryption key logic without env vars,
28
+ // we will verify that IF 'github' field is present in context.credentials,
29
+ // it gets passed to CopilotClient.createSession.
30
+ // To verify this, we can rely on CopilotClient logging "Re-initializing SDK with provided user token".
31
+ // NOTE: For this test to succeed, we typically need a valid token.
32
+ // If we pass a dummy token, CopilotClient will try to auth and FAIL, which validates the flow reached that point.
33
+ // If we don't pass any token, it might use Env Var or fail differently.
34
+ const context = {
35
+ taskId: "verify-token-123",
36
+ intent: "feature",
37
+ repo: "owner/repo",
38
+ localPath: process.cwd(),
39
+ naturalLanguage: "List files (Token Test)",
40
+ source: {
41
+ channel: "cli",
42
+ chatId: "local",
43
+ messageId: "verify-token-123",
44
+ },
45
+ // Mock credentials that need decryption
46
+ credentials: {
47
+ github: "dummy-encrypted-string",
48
+ },
49
+ };
50
+ // We need to Mock decryptCredentials to return a "decrypted" token from the "dummy-encrypted-string"
51
+ // Since we can't easily patch the imported module in this script without complexity,
52
+ // we'll rely on the behavior:
53
+ // - If decryption fails (no key), it likely returns undefined or throws.
54
+ // - We want to see if we can trigger the "Using decrypted user credentials" log.
55
+ // Let's rely on the module execution.
56
+ // We can set CREDENTIAL_ENCRYPTION_KEY to something dummy, and provide a properly encrypted string?
57
+ // No, that's complex.
58
+ // Alternative: We can modify the context to simulate what happens AFTER decryption?
59
+ // No, context.credentials IS the input.
60
+ // Let's run it and expect "Failed to decrypt" or "Re-initializing" if we can trick credentials.js?
61
+ // apps/agent/src/credentials.ts returns {} if decryption fails/no key.
62
+ // If decryption fails, userGitHubToken is undefined.
63
+ // CopilotClient init will NOT re-init.
64
+ // This confirms the logic: Dynamic token requires valid key + matched encrypted string.
65
+ const workflow = new FeatureWorkflow("http://mock-devflow", "mock-token");
66
+ try {
67
+ // This expects to fail auth since we don't have a valid token (decryption returns empty -> undefined -> SDK uses env if any -> or fails)
68
+ await workflow.execute(context);
69
+ console.log("Executed? (Should have failed if no default token)");
70
+ }
71
+ catch (error) {
72
+ if (String(error).includes("Copilot Authentication Failed")) {
73
+ console.log("✅ Caught expected Auth failure (proving it tried to use a session)");
74
+ }
75
+ else {
76
+ console.error("❌ Unexpected error:", error);
77
+ }
78
+ }
79
+ }
80
+ main();
81
+ //# sourceMappingURL=verify-full-flow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-full-flow.js","sourceRoot":"","sources":["../src/verify-full-flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD,qBAAqB;AACrB,MAAM,0BAA0B,GAAG,aAAa,CAAC,SAAS,CAAC,kBAAkB,CAAC;AAC9E,MAAM,wBAAwB,GAAG,aAAa,CAAC,SAAS,CAAC,gBAAgB,CAAC;AAC1E,MAAM,mBAAmB,GAAG,aAAa,CAAC,SAAS,CAAC,WAAW,CAAC;AAChE,MAAM,eAAe,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC;AAExD,aAAa,CAAC,SAAS,CAAC,kBAAkB,GAAG,KAAK,EAAE,MAAM,EAAE,EAAE;IAC5D,OAAO,CAAC,GAAG,CACT,4BAA4B,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CACnF,CAAC;AACJ,CAAC,CAAC;AAEF,aAAa,CAAC,SAAS,CAAC,gBAAgB,GAAG,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;IAClE,OAAO,CAAC,GAAG,CAAC,8BAA8B,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAC/E,CAAC,CAAC;AAEF,aAAa,CAAC,SAAS,CAAC,WAAW,GAAG,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;IAC5D,OAAO,CAAC,KAAK,CAAC,yBAAyB,KAAK,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,aAAa,C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,KAAK,EAAE,CAAC;QACf,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,+BAA+B,CAAC,EAAE,CAAC;YAC5D,OAAO,CAAC,GAAG,CACT,oEAAoE,CACrE,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@untools/devflow",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "description": "Self-hosted AI DevOps agent for DevFlow platform",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,6 +10,13 @@
10
10
  "exports": {
11
11
  ".": "./dist/index.js"
12
12
  },
13
+ "files": [
14
+ "dist",
15
+ "bin",
16
+ "README.md",
17
+ "fix-imports.js"
18
+ ],
19
+ "readme": "./README.md",
13
20
  "repository": {
14
21
  "type": "git",
15
22
  "url": "https://github.com/miracleonyenma/devflow.git"
package/.versionrc.json DELETED
@@ -1,53 +0,0 @@
1
- {
2
- "types": [
3
- {
4
- "type": "feat",
5
- "section": "Features",
6
- "hidden": false
7
- },
8
- {
9
- "type": "fix",
10
- "section": "Bug Fixes",
11
- "hidden": false
12
- },
13
- {
14
- "type": "perf",
15
- "section": "Performance",
16
- "hidden": false
17
- },
18
- {
19
- "type": "docs",
20
- "section": "Documentation",
21
- "hidden": false
22
- },
23
- {
24
- "type": "style",
25
- "section": "Styling",
26
- "hidden": true
27
- },
28
- {
29
- "type": "refactor",
30
- "section": "Code Refactoring",
31
- "hidden": false
32
- },
33
- {
34
- "type": "test",
35
- "section": "Tests",
36
- "hidden": true
37
- },
38
- {
39
- "type": "chore",
40
- "section": "Chores",
41
- "hidden": true
42
- }
43
- ],
44
- "commitUrlFormat": "https://github.com/miracleonyenma/devflow/commit/{{hash}}",
45
- "compareUrlFormat": "https://github.com/miracleonyenma/devflow/compare/{{previousTag}}...{{currentTag}}",
46
- "issueUrlFormat": "https://github.com/miracleonyenma/devflow/issues/{{id}}",
47
- "userUrlFormat": "https://github.com/{{user}}",
48
- "releaseCommitMessageFormat": "chore(release): {{currentTag}}",
49
- "issuePrefixes": ["#"],
50
- "skipBump": false,
51
- "skipCommit": false,
52
- "skipTag": false
53
- }