@nairon-ai/aegis 0.2.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/.agents/skills/bug-fix/SKILL.md +91 -0
  2. package/.flue/agents/bug-fix.ts +107 -0
  3. package/.flue/app.ts +16 -0
  4. package/Dockerfile +8 -0
  5. package/LICENSE +21 -0
  6. package/README.md +251 -0
  7. package/dist-node/agent/bug-fix-skill.d.ts +2 -0
  8. package/dist-node/agent/bug-fix-skill.d.ts.map +1 -0
  9. package/dist-node/agent/bug-fix-skill.js +64 -0
  10. package/dist-node/agent/bug-fix-skill.js.map +1 -0
  11. package/dist-node/agent/client.d.ts +14 -0
  12. package/dist-node/agent/client.d.ts.map +1 -0
  13. package/dist-node/agent/client.js +110 -0
  14. package/dist-node/agent/client.js.map +1 -0
  15. package/dist-node/cli/commands/deploy.d.ts +3 -0
  16. package/dist-node/cli/commands/deploy.d.ts.map +1 -0
  17. package/dist-node/cli/commands/deploy.js +94 -0
  18. package/dist-node/cli/commands/deploy.js.map +1 -0
  19. package/dist-node/cli/commands/init.d.ts +3 -0
  20. package/dist-node/cli/commands/init.d.ts.map +1 -0
  21. package/dist-node/cli/commands/init.js +115 -0
  22. package/dist-node/cli/commands/init.js.map +1 -0
  23. package/dist-node/cli/commands/pickup.d.ts +11 -0
  24. package/dist-node/cli/commands/pickup.d.ts.map +1 -0
  25. package/dist-node/cli/commands/pickup.js +43 -0
  26. package/dist-node/cli/commands/pickup.js.map +1 -0
  27. package/dist-node/cli/commands/setup.d.ts +3 -0
  28. package/dist-node/cli/commands/setup.d.ts.map +1 -0
  29. package/dist-node/cli/commands/setup.js +163 -0
  30. package/dist-node/cli/commands/setup.js.map +1 -0
  31. package/dist-node/cli/commands/status.d.ts +3 -0
  32. package/dist-node/cli/commands/status.d.ts.map +1 -0
  33. package/dist-node/cli/commands/status.js +26 -0
  34. package/dist-node/cli/commands/status.js.map +1 -0
  35. package/dist-node/cli/index.d.ts +3 -0
  36. package/dist-node/cli/index.d.ts.map +1 -0
  37. package/dist-node/cli/index.js +36 -0
  38. package/dist-node/cli/index.js.map +1 -0
  39. package/dist-node/cli/paths.d.ts +7 -0
  40. package/dist-node/cli/paths.d.ts.map +1 -0
  41. package/dist-node/cli/paths.js +29 -0
  42. package/dist-node/cli/paths.js.map +1 -0
  43. package/dist-node/cli/state.d.ts +16 -0
  44. package/dist-node/cli/state.d.ts.map +1 -0
  45. package/dist-node/cli/state.js +214 -0
  46. package/dist-node/cli/state.js.map +1 -0
  47. package/dist-node/core/pickup.d.ts +14 -0
  48. package/dist-node/core/pickup.d.ts.map +1 -0
  49. package/dist-node/core/pickup.js +42 -0
  50. package/dist-node/core/pickup.js.map +1 -0
  51. package/dist-node/github/index.d.ts +3 -0
  52. package/dist-node/github/index.d.ts.map +1 -0
  53. package/dist-node/github/index.js +2 -0
  54. package/dist-node/github/index.js.map +1 -0
  55. package/dist-node/github/manifest.d.ts +34 -0
  56. package/dist-node/github/manifest.d.ts.map +1 -0
  57. package/dist-node/github/manifest.js +71 -0
  58. package/dist-node/github/manifest.js.map +1 -0
  59. package/dist-node/integrations/github.d.ts +29 -0
  60. package/dist-node/integrations/github.d.ts.map +1 -0
  61. package/dist-node/integrations/github.js +199 -0
  62. package/dist-node/integrations/github.js.map +1 -0
  63. package/dist-node/integrations/linear.d.ts +15 -0
  64. package/dist-node/integrations/linear.d.ts.map +1 -0
  65. package/dist-node/integrations/linear.js +146 -0
  66. package/dist-node/integrations/linear.js.map +1 -0
  67. package/dist-node/integrations/telegram.d.ts +24 -0
  68. package/dist-node/integrations/telegram.d.ts.map +1 -0
  69. package/dist-node/integrations/telegram.js +39 -0
  70. package/dist-node/integrations/telegram.js.map +1 -0
  71. package/dist-node/integrations/webhooks.d.ts +3 -0
  72. package/dist-node/integrations/webhooks.d.ts.map +1 -0
  73. package/dist-node/integrations/webhooks.js +37 -0
  74. package/dist-node/integrations/webhooks.js.map +1 -0
  75. package/dist-node/sandbox/github-token.d.ts +7 -0
  76. package/dist-node/sandbox/github-token.d.ts.map +1 -0
  77. package/dist-node/sandbox/github-token.js +66 -0
  78. package/dist-node/sandbox/github-token.js.map +1 -0
  79. package/dist-node/sandbox/index.d.ts +2 -0
  80. package/dist-node/sandbox/index.d.ts.map +1 -0
  81. package/dist-node/sandbox/index.js +2 -0
  82. package/dist-node/sandbox/index.js.map +1 -0
  83. package/dist-node/server/app.d.ts +9 -0
  84. package/dist-node/server/app.d.ts.map +1 -0
  85. package/dist-node/server/app.js +216 -0
  86. package/dist-node/server/app.js.map +1 -0
  87. package/dist-node/shared/config.d.ts +5 -0
  88. package/dist-node/shared/config.d.ts.map +1 -0
  89. package/dist-node/shared/config.js +135 -0
  90. package/dist-node/shared/config.js.map +1 -0
  91. package/dist-node/shared/constants.d.ts +16 -0
  92. package/dist-node/shared/constants.d.ts.map +1 -0
  93. package/dist-node/shared/constants.js +29 -0
  94. package/dist-node/shared/constants.js.map +1 -0
  95. package/dist-node/shared/format.d.ts +12 -0
  96. package/dist-node/shared/format.d.ts.map +1 -0
  97. package/dist-node/shared/format.js +71 -0
  98. package/dist-node/shared/format.js.map +1 -0
  99. package/dist-node/shared/index.d.ts +7 -0
  100. package/dist-node/shared/index.d.ts.map +1 -0
  101. package/dist-node/shared/index.js +7 -0
  102. package/dist-node/shared/index.js.map +1 -0
  103. package/dist-node/shared/readiness.d.ts +3 -0
  104. package/dist-node/shared/readiness.d.ts.map +1 -0
  105. package/dist-node/shared/readiness.js +91 -0
  106. package/dist-node/shared/readiness.js.map +1 -0
  107. package/dist-node/shared/run-state.d.ts +5 -0
  108. package/dist-node/shared/run-state.d.ts.map +1 -0
  109. package/dist-node/shared/run-state.js +26 -0
  110. package/dist-node/shared/run-state.js.map +1 -0
  111. package/dist-node/shared/types.d.ts +230 -0
  112. package/dist-node/shared/types.d.ts.map +1 -0
  113. package/dist-node/shared/types.js +5 -0
  114. package/dist-node/shared/types.js.map +1 -0
  115. package/dist-node/sources/github.d.ts +15 -0
  116. package/dist-node/sources/github.d.ts.map +1 -0
  117. package/dist-node/sources/github.js +44 -0
  118. package/dist-node/sources/github.js.map +1 -0
  119. package/dist-node/sources/index.d.ts +6 -0
  120. package/dist-node/sources/index.d.ts.map +1 -0
  121. package/dist-node/sources/index.js +16 -0
  122. package/dist-node/sources/index.js.map +1 -0
  123. package/dist-node/sources/linear.d.ts +15 -0
  124. package/dist-node/sources/linear.d.ts.map +1 -0
  125. package/dist-node/sources/linear.js +32 -0
  126. package/dist-node/sources/linear.js.map +1 -0
  127. package/dist-node/sources/types.d.ts +15 -0
  128. package/dist-node/sources/types.d.ts.map +1 -0
  129. package/dist-node/sources/types.js +2 -0
  130. package/dist-node/sources/types.js.map +1 -0
  131. package/docs/RELEASING.md +52 -0
  132. package/docs/SETUP.md +439 -0
  133. package/package.json +64 -0
  134. package/src/agent/bug-fix-skill.ts +63 -0
  135. package/src/agent/client.ts +156 -0
  136. package/src/cli/commands/deploy.ts +106 -0
  137. package/src/cli/commands/init.ts +119 -0
  138. package/src/cli/commands/pickup.ts +44 -0
  139. package/src/cli/commands/setup.ts +217 -0
  140. package/src/cli/commands/status.ts +24 -0
  141. package/src/cli/index.ts +38 -0
  142. package/src/cli/paths.ts +29 -0
  143. package/src/cli/state.ts +228 -0
  144. package/src/core/pickup.ts +66 -0
  145. package/src/github/index.ts +2 -0
  146. package/src/github/manifest.ts +97 -0
  147. package/src/integrations/github.ts +241 -0
  148. package/src/integrations/linear.ts +195 -0
  149. package/src/integrations/telegram.ts +48 -0
  150. package/src/integrations/webhooks.ts +53 -0
  151. package/src/sandbox/github-token.ts +92 -0
  152. package/src/sandbox/index.ts +1 -0
  153. package/src/server/app.ts +292 -0
  154. package/src/shared/config.ts +154 -0
  155. package/src/shared/constants.ts +30 -0
  156. package/src/shared/format.ts +84 -0
  157. package/src/shared/index.ts +6 -0
  158. package/src/shared/readiness.ts +116 -0
  159. package/src/shared/run-state.ts +32 -0
  160. package/src/shared/types.ts +257 -0
  161. package/src/sources/github.ts +57 -0
  162. package/src/sources/index.ts +20 -0
  163. package/src/sources/linear.ts +44 -0
  164. package/src/sources/types.ts +16 -0
  165. package/tsconfig.json +25 -0
  166. package/tsconfig.node.json +16 -0
  167. package/wrangler.jsonc +43 -0
@@ -0,0 +1,57 @@
1
+ import { GitHubClient } from "../integrations/github.js";
2
+ import type { AegisConfig, WorkItem } from "../shared/types.js";
3
+ import type { ClaimOptions, IssueSource } from "./types.js";
4
+
5
+ export class GitHubIssueSource implements IssueSource {
6
+ readonly name = "github" as const;
7
+ private readonly config: AegisConfig;
8
+ private readonly github: GitHubClient;
9
+
10
+ constructor(config: AegisConfig) {
11
+ this.config = config;
12
+ this.github = new GitHubClient(config);
13
+ }
14
+
15
+ listReadyBugs(): Promise<WorkItem[]> {
16
+ return this.github.listReadyIssues();
17
+ }
18
+
19
+ async claim(item: WorkItem, options: ClaimOptions): Promise<void> {
20
+ const number = requireIssueNumber(item);
21
+ await this.github.addLabels(item.repo, number, [this.config.inProgressLabel]);
22
+ await this.github.comment(
23
+ item.repo,
24
+ number,
25
+ `Aegis claimed this bug.\n\nRun: \`${options.runId}\`\nBranch: \`${options.branchName}\``,
26
+ );
27
+ }
28
+
29
+ async postNeedsInfo(item: WorkItem, question: string): Promise<void> {
30
+ const number = requireIssueNumber(item);
31
+ await this.github.addLabels(item.repo, number, [this.config.needsInfoLabel]);
32
+ await this.github.comment(item.repo, number, question);
33
+ }
34
+
35
+ async postPlan(item: WorkItem, body: string): Promise<void> {
36
+ await this.github.comment(item.repo, requireIssueNumber(item), body);
37
+ }
38
+
39
+ async linkPullRequest(item: WorkItem, prUrl: string): Promise<void> {
40
+ const number = requireIssueNumber(item);
41
+ await this.github.addLabels(item.repo, number, [this.config.prOpenedLabel]);
42
+ await this.github.removeLabel(item.repo, number, this.config.inProgressLabel);
43
+ await this.github.comment(item.repo, number, `Aegis opened a PR: ${prUrl}`);
44
+ }
45
+
46
+ async markBlocked(item: WorkItem, body: string): Promise<void> {
47
+ const number = requireIssueNumber(item);
48
+ await this.github.addLabels(item.repo, number, [this.config.blockedLabel]);
49
+ await this.github.removeLabel(item.repo, number, this.config.inProgressLabel);
50
+ await this.github.comment(item.repo, number, body);
51
+ }
52
+ }
53
+
54
+ function requireIssueNumber(item: WorkItem): number {
55
+ if (!item.number) throw new Error(`GitHub issue number missing for ${item.identifier}`);
56
+ return item.number;
57
+ }
@@ -0,0 +1,20 @@
1
+ import type { AegisConfig, WorkSource } from "../shared/types.js";
2
+ import { GitHubIssueSource } from "./github.js";
3
+ import { LinearIssueSource } from "./linear.js";
4
+ import type { IssueSource } from "./types.js";
5
+
6
+ export function createSources(config: AegisConfig): IssueSource[] {
7
+ const sources: IssueSource[] = [new GitHubIssueSource(config)];
8
+ if (config.linear?.apiKey && config.linear.teamId) {
9
+ sources.push(new LinearIssueSource(config));
10
+ }
11
+ return sources;
12
+ }
13
+
14
+ export function sourceFor(config: AegisConfig, source: WorkSource): IssueSource {
15
+ const match = createSources(config).find((candidate) => candidate.name === source);
16
+ if (!match) throw new Error(`${source} source is not configured`);
17
+ return match;
18
+ }
19
+
20
+ export type { IssueSource } from "./types.js";
@@ -0,0 +1,44 @@
1
+ import { LinearClient } from "../integrations/linear.js";
2
+ import type { AegisConfig, WorkItem } from "../shared/types.js";
3
+ import type { ClaimOptions, IssueSource } from "./types.js";
4
+
5
+ export class LinearIssueSource implements IssueSource {
6
+ readonly name = "linear" as const;
7
+ private readonly config: AegisConfig;
8
+ private readonly linear: LinearClient;
9
+
10
+ constructor(config: AegisConfig) {
11
+ this.config = config;
12
+ this.linear = new LinearClient(config);
13
+ }
14
+
15
+ listReadyBugs(): Promise<WorkItem[]> {
16
+ return this.linear.listReadyIssues();
17
+ }
18
+
19
+ async claim(item: WorkItem, options: ClaimOptions): Promise<void> {
20
+ await this.linear.moveToStatus(item.id, this.config.linear?.inProgressStatusName);
21
+ await this.linear.comment(
22
+ item.id,
23
+ `Aegis claimed this bug.\n\nRun: \`${options.runId}\`\nBranch: \`${options.branchName}\``,
24
+ );
25
+ }
26
+
27
+ async postNeedsInfo(item: WorkItem, question: string): Promise<void> {
28
+ await this.linear.moveToStatus(item.id, this.config.linear?.needsInfoStatusName);
29
+ await this.linear.comment(item.id, question);
30
+ }
31
+
32
+ async postPlan(item: WorkItem, body: string): Promise<void> {
33
+ await this.linear.comment(item.id, body);
34
+ }
35
+
36
+ async linkPullRequest(item: WorkItem, prUrl: string): Promise<void> {
37
+ await this.linear.linkPullRequest(item.id, prUrl);
38
+ }
39
+
40
+ async markBlocked(item: WorkItem, body: string): Promise<void> {
41
+ await this.linear.moveToStatus(item.id, this.config.linear?.blockedStatusName);
42
+ await this.linear.comment(item.id, body);
43
+ }
44
+ }
@@ -0,0 +1,16 @@
1
+ import type { WorkItem } from "../shared/types.js";
2
+
3
+ export type ClaimOptions = {
4
+ runId: string;
5
+ branchName: string;
6
+ };
7
+
8
+ export interface IssueSource {
9
+ name: "github" | "linear";
10
+ listReadyBugs(): Promise<WorkItem[]>;
11
+ claim(item: WorkItem, options: ClaimOptions): Promise<void>;
12
+ postNeedsInfo(item: WorkItem, question: string): Promise<void>;
13
+ postPlan(item: WorkItem, body: string): Promise<void>;
14
+ linkPullRequest(item: WorkItem, prUrl: string): Promise<void>;
15
+ markBlocked(item: WorkItem, body: string): Promise<void>;
16
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "lib": ["ESNext"],
7
+ "types": ["@cloudflare/workers-types/2023-07-01", "bun-types"],
8
+ "jsx": "react-jsx",
9
+ "jsxImportSource": "hono/jsx",
10
+ "strict": true,
11
+ "skipLibCheck": true,
12
+ "noEmit": true,
13
+ "esModuleInterop": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "resolveJsonModule": true,
16
+ "isolatedModules": true,
17
+ "verbatimModuleSyntax": true,
18
+ "paths": {
19
+ "@/*": ["./src/*"]
20
+ },
21
+ "baseUrl": "."
22
+ },
23
+ "include": ["src/**/*.ts", ".flue/**/*.ts"],
24
+ "exclude": ["node_modules", "dist"]
25
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "rootDir": "src",
7
+ "outDir": "dist-node",
8
+ "noEmit": false,
9
+ "declaration": true,
10
+ "declarationMap": true,
11
+ "sourceMap": true,
12
+ "types": ["node", "@cloudflare/workers-types/2023-07-01"]
13
+ },
14
+ "include": ["src/**/*.ts"],
15
+ "exclude": ["node_modules", "dist", "dist-node"]
16
+ }
package/wrangler.jsonc ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "$schema": "node_modules/wrangler/config-schema.json",
3
+ "name": "aegis-worker",
4
+ "main": "dist/_entry.ts",
5
+ "compatibility_date": "2026-05-01",
6
+ "compatibility_flags": ["nodejs_compat"],
7
+ "triggers": {
8
+ "crons": ["*/10 * * * *"]
9
+ },
10
+ "durable_objects": {
11
+ "bindings": [
12
+ {
13
+ "name": "Sandbox",
14
+ "class_name": "Sandbox"
15
+ }
16
+ ]
17
+ },
18
+ "migrations": [
19
+ {
20
+ "tag": "v1",
21
+ "new_sqlite_classes": ["Sandbox"]
22
+ }
23
+ ],
24
+ "containers": [
25
+ {
26
+ "class_name": "Sandbox",
27
+ "image": "./Dockerfile"
28
+ }
29
+ ],
30
+ "vars": {
31
+ "BASE_BRANCH": "main",
32
+ "AUTOMATION_MODE": "plan-first",
33
+ "CONTEXT_PROFILE": "minimal",
34
+ "MAX_CONCURRENT_RUNS": "1",
35
+ "READY_LABEL": "ready to implement",
36
+ "BUG_LABEL": "bug",
37
+ "IN_PROGRESS_LABEL": "aegis:in-progress",
38
+ "NEEDS_INFO_LABEL": "aegis:needs-info",
39
+ "BLOCKED_LABEL": "aegis:blocked",
40
+ "PR_OPENED_LABEL": "aegis:pr-opened",
41
+ "AGENT_MODEL": "openai/gpt-5.1"
42
+ }
43
+ }