@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.
- package/.agents/skills/bug-fix/SKILL.md +91 -0
- package/.flue/agents/bug-fix.ts +107 -0
- package/.flue/app.ts +16 -0
- package/Dockerfile +8 -0
- package/LICENSE +21 -0
- package/README.md +251 -0
- package/dist-node/agent/bug-fix-skill.d.ts +2 -0
- package/dist-node/agent/bug-fix-skill.d.ts.map +1 -0
- package/dist-node/agent/bug-fix-skill.js +64 -0
- package/dist-node/agent/bug-fix-skill.js.map +1 -0
- package/dist-node/agent/client.d.ts +14 -0
- package/dist-node/agent/client.d.ts.map +1 -0
- package/dist-node/agent/client.js +110 -0
- package/dist-node/agent/client.js.map +1 -0
- package/dist-node/cli/commands/deploy.d.ts +3 -0
- package/dist-node/cli/commands/deploy.d.ts.map +1 -0
- package/dist-node/cli/commands/deploy.js +94 -0
- package/dist-node/cli/commands/deploy.js.map +1 -0
- package/dist-node/cli/commands/init.d.ts +3 -0
- package/dist-node/cli/commands/init.d.ts.map +1 -0
- package/dist-node/cli/commands/init.js +115 -0
- package/dist-node/cli/commands/init.js.map +1 -0
- package/dist-node/cli/commands/pickup.d.ts +11 -0
- package/dist-node/cli/commands/pickup.d.ts.map +1 -0
- package/dist-node/cli/commands/pickup.js +43 -0
- package/dist-node/cli/commands/pickup.js.map +1 -0
- package/dist-node/cli/commands/setup.d.ts +3 -0
- package/dist-node/cli/commands/setup.d.ts.map +1 -0
- package/dist-node/cli/commands/setup.js +163 -0
- package/dist-node/cli/commands/setup.js.map +1 -0
- package/dist-node/cli/commands/status.d.ts +3 -0
- package/dist-node/cli/commands/status.d.ts.map +1 -0
- package/dist-node/cli/commands/status.js +26 -0
- package/dist-node/cli/commands/status.js.map +1 -0
- package/dist-node/cli/index.d.ts +3 -0
- package/dist-node/cli/index.d.ts.map +1 -0
- package/dist-node/cli/index.js +36 -0
- package/dist-node/cli/index.js.map +1 -0
- package/dist-node/cli/paths.d.ts +7 -0
- package/dist-node/cli/paths.d.ts.map +1 -0
- package/dist-node/cli/paths.js +29 -0
- package/dist-node/cli/paths.js.map +1 -0
- package/dist-node/cli/state.d.ts +16 -0
- package/dist-node/cli/state.d.ts.map +1 -0
- package/dist-node/cli/state.js +214 -0
- package/dist-node/cli/state.js.map +1 -0
- package/dist-node/core/pickup.d.ts +14 -0
- package/dist-node/core/pickup.d.ts.map +1 -0
- package/dist-node/core/pickup.js +42 -0
- package/dist-node/core/pickup.js.map +1 -0
- package/dist-node/github/index.d.ts +3 -0
- package/dist-node/github/index.d.ts.map +1 -0
- package/dist-node/github/index.js +2 -0
- package/dist-node/github/index.js.map +1 -0
- package/dist-node/github/manifest.d.ts +34 -0
- package/dist-node/github/manifest.d.ts.map +1 -0
- package/dist-node/github/manifest.js +71 -0
- package/dist-node/github/manifest.js.map +1 -0
- package/dist-node/integrations/github.d.ts +29 -0
- package/dist-node/integrations/github.d.ts.map +1 -0
- package/dist-node/integrations/github.js +199 -0
- package/dist-node/integrations/github.js.map +1 -0
- package/dist-node/integrations/linear.d.ts +15 -0
- package/dist-node/integrations/linear.d.ts.map +1 -0
- package/dist-node/integrations/linear.js +146 -0
- package/dist-node/integrations/linear.js.map +1 -0
- package/dist-node/integrations/telegram.d.ts +24 -0
- package/dist-node/integrations/telegram.d.ts.map +1 -0
- package/dist-node/integrations/telegram.js +39 -0
- package/dist-node/integrations/telegram.js.map +1 -0
- package/dist-node/integrations/webhooks.d.ts +3 -0
- package/dist-node/integrations/webhooks.d.ts.map +1 -0
- package/dist-node/integrations/webhooks.js +37 -0
- package/dist-node/integrations/webhooks.js.map +1 -0
- package/dist-node/sandbox/github-token.d.ts +7 -0
- package/dist-node/sandbox/github-token.d.ts.map +1 -0
- package/dist-node/sandbox/github-token.js +66 -0
- package/dist-node/sandbox/github-token.js.map +1 -0
- package/dist-node/sandbox/index.d.ts +2 -0
- package/dist-node/sandbox/index.d.ts.map +1 -0
- package/dist-node/sandbox/index.js +2 -0
- package/dist-node/sandbox/index.js.map +1 -0
- package/dist-node/server/app.d.ts +9 -0
- package/dist-node/server/app.d.ts.map +1 -0
- package/dist-node/server/app.js +216 -0
- package/dist-node/server/app.js.map +1 -0
- package/dist-node/shared/config.d.ts +5 -0
- package/dist-node/shared/config.d.ts.map +1 -0
- package/dist-node/shared/config.js +135 -0
- package/dist-node/shared/config.js.map +1 -0
- package/dist-node/shared/constants.d.ts +16 -0
- package/dist-node/shared/constants.d.ts.map +1 -0
- package/dist-node/shared/constants.js +29 -0
- package/dist-node/shared/constants.js.map +1 -0
- package/dist-node/shared/format.d.ts +12 -0
- package/dist-node/shared/format.d.ts.map +1 -0
- package/dist-node/shared/format.js +71 -0
- package/dist-node/shared/format.js.map +1 -0
- package/dist-node/shared/index.d.ts +7 -0
- package/dist-node/shared/index.d.ts.map +1 -0
- package/dist-node/shared/index.js +7 -0
- package/dist-node/shared/index.js.map +1 -0
- package/dist-node/shared/readiness.d.ts +3 -0
- package/dist-node/shared/readiness.d.ts.map +1 -0
- package/dist-node/shared/readiness.js +91 -0
- package/dist-node/shared/readiness.js.map +1 -0
- package/dist-node/shared/run-state.d.ts +5 -0
- package/dist-node/shared/run-state.d.ts.map +1 -0
- package/dist-node/shared/run-state.js +26 -0
- package/dist-node/shared/run-state.js.map +1 -0
- package/dist-node/shared/types.d.ts +230 -0
- package/dist-node/shared/types.d.ts.map +1 -0
- package/dist-node/shared/types.js +5 -0
- package/dist-node/shared/types.js.map +1 -0
- package/dist-node/sources/github.d.ts +15 -0
- package/dist-node/sources/github.d.ts.map +1 -0
- package/dist-node/sources/github.js +44 -0
- package/dist-node/sources/github.js.map +1 -0
- package/dist-node/sources/index.d.ts +6 -0
- package/dist-node/sources/index.d.ts.map +1 -0
- package/dist-node/sources/index.js +16 -0
- package/dist-node/sources/index.js.map +1 -0
- package/dist-node/sources/linear.d.ts +15 -0
- package/dist-node/sources/linear.d.ts.map +1 -0
- package/dist-node/sources/linear.js +32 -0
- package/dist-node/sources/linear.js.map +1 -0
- package/dist-node/sources/types.d.ts +15 -0
- package/dist-node/sources/types.d.ts.map +1 -0
- package/dist-node/sources/types.js +2 -0
- package/dist-node/sources/types.js.map +1 -0
- package/docs/RELEASING.md +52 -0
- package/docs/SETUP.md +439 -0
- package/package.json +64 -0
- package/src/agent/bug-fix-skill.ts +63 -0
- package/src/agent/client.ts +156 -0
- package/src/cli/commands/deploy.ts +106 -0
- package/src/cli/commands/init.ts +119 -0
- package/src/cli/commands/pickup.ts +44 -0
- package/src/cli/commands/setup.ts +217 -0
- package/src/cli/commands/status.ts +24 -0
- package/src/cli/index.ts +38 -0
- package/src/cli/paths.ts +29 -0
- package/src/cli/state.ts +228 -0
- package/src/core/pickup.ts +66 -0
- package/src/github/index.ts +2 -0
- package/src/github/manifest.ts +97 -0
- package/src/integrations/github.ts +241 -0
- package/src/integrations/linear.ts +195 -0
- package/src/integrations/telegram.ts +48 -0
- package/src/integrations/webhooks.ts +53 -0
- package/src/sandbox/github-token.ts +92 -0
- package/src/sandbox/index.ts +1 -0
- package/src/server/app.ts +292 -0
- package/src/shared/config.ts +154 -0
- package/src/shared/constants.ts +30 -0
- package/src/shared/format.ts +84 -0
- package/src/shared/index.ts +6 -0
- package/src/shared/readiness.ts +116 -0
- package/src/shared/run-state.ts +32 -0
- package/src/shared/types.ts +257 -0
- package/src/sources/github.ts +57 -0
- package/src/sources/index.ts +20 -0
- package/src/sources/linear.ts +44 -0
- package/src/sources/types.ts +16 -0
- package/tsconfig.json +25 -0
- package/tsconfig.node.json +16 -0
- 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
|
+
}
|