@developerz.ai/aitm 0.0.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/LICENSE +21 -0
- package/README.md +30 -0
- package/dist/agent-config/agent-config-detector.d.ts +15 -0
- package/dist/agent-config/agent-config-detector.js +56 -0
- package/dist/agent-config/agent-config-detector.js.map +1 -0
- package/dist/cli/args.d.ts +37 -0
- package/dist/cli/args.js +238 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/cli.d.ts +15 -0
- package/dist/cli/cli.js +113 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/commands.d.ts +83 -0
- package/dist/cli/commands.js +521 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/compaction/compactor.d.ts +20 -0
- package/dist/compaction/compactor.js +75 -0
- package/dist/compaction/compactor.js.map +1 -0
- package/dist/config/config-loader.d.ts +25 -0
- package/dist/config/config-loader.js +275 -0
- package/dist/config/config-loader.js.map +1 -0
- package/dist/config/config-writer.d.ts +14 -0
- package/dist/config/config-writer.js +178 -0
- package/dist/config/config-writer.js.map +1 -0
- package/dist/config/schema.d.ts +85 -0
- package/dist/config/schema.js +38 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/credentials/credentials.d.ts +15 -0
- package/dist/credentials/credentials.js +58 -0
- package/dist/credentials/credentials.js.map +1 -0
- package/dist/credentials/defaults.d.ts +2 -0
- package/dist/credentials/defaults.js +21 -0
- package/dist/credentials/defaults.js.map +1 -0
- package/dist/fs/atomic-write.d.ts +1 -0
- package/dist/fs/atomic-write.js +27 -0
- package/dist/fs/atomic-write.js.map +1 -0
- package/dist/github/errors.d.ts +18 -0
- package/dist/github/errors.js +20 -0
- package/dist/github/errors.js.map +1 -0
- package/dist/github/github-client.d.ts +47 -0
- package/dist/github/github-client.js +417 -0
- package/dist/github/github-client.js.map +1 -0
- package/dist/github/schema.d.ts +44 -0
- package/dist/github/schema.js +23 -0
- package/dist/github/schema.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/logger/logger.d.ts +36 -0
- package/dist/logger/logger.js +123 -0
- package/dist/logger/logger.js.map +1 -0
- package/dist/loop/run-loop-adapter.d.ts +46 -0
- package/dist/loop/run-loop-adapter.js +270 -0
- package/dist/loop/run-loop-adapter.js.map +1 -0
- package/dist/loop/take-over-flow.d.ts +57 -0
- package/dist/loop/take-over-flow.js +183 -0
- package/dist/loop/take-over-flow.js.map +1 -0
- package/dist/loop/work-loop.d.ts +95 -0
- package/dist/loop/work-loop.js +211 -0
- package/dist/loop/work-loop.js.map +1 -0
- package/dist/mcp/mcp-client.d.ts +27 -0
- package/dist/mcp/mcp-client.js +123 -0
- package/dist/mcp/mcp-client.js.map +1 -0
- package/dist/mcp/schema.d.ts +53 -0
- package/dist/mcp/schema.js +39 -0
- package/dist/mcp/schema.js.map +1 -0
- package/dist/openrouter/client.d.ts +28 -0
- package/dist/openrouter/client.js +40 -0
- package/dist/openrouter/client.js.map +1 -0
- package/dist/openrouter/model-limits.d.ts +21 -0
- package/dist/openrouter/model-limits.js +39 -0
- package/dist/openrouter/model-limits.js.map +1 -0
- package/dist/openrouter/server-tools.d.ts +35 -0
- package/dist/openrouter/server-tools.js +25 -0
- package/dist/openrouter/server-tools.js.map +1 -0
- package/dist/orchestrator/orchestrator.d.ts +60 -0
- package/dist/orchestrator/orchestrator.js +180 -0
- package/dist/orchestrator/orchestrator.js.map +1 -0
- package/dist/orchestrator/subagent-tools.d.ts +44 -0
- package/dist/orchestrator/subagent-tools.js +133 -0
- package/dist/orchestrator/subagent-tools.js.map +1 -0
- package/dist/orchestrator/system-prompts.d.ts +4 -0
- package/dist/orchestrator/system-prompts.js +78 -0
- package/dist/orchestrator/system-prompts.js.map +1 -0
- package/dist/plan/plan-graph.d.ts +11 -0
- package/dist/plan/plan-graph.js +69 -0
- package/dist/plan/plan-graph.js.map +1 -0
- package/dist/plan/schema.d.ts +30 -0
- package/dist/plan/schema.js +24 -0
- package/dist/plan/schema.js.map +1 -0
- package/dist/state/schema.d.ts +88 -0
- package/dist/state/schema.js +53 -0
- package/dist/state/schema.js.map +1 -0
- package/dist/state/state-store.d.ts +16 -0
- package/dist/state/state-store.js +129 -0
- package/dist/state/state-store.js.map +1 -0
- package/dist/subagents/factory.d.ts +8 -0
- package/dist/subagents/factory.js +10 -0
- package/dist/subagents/factory.js.map +1 -0
- package/dist/subagents/planner.d.ts +31 -0
- package/dist/subagents/planner.js +83 -0
- package/dist/subagents/planner.js.map +1 -0
- package/dist/subagents/reviewer.d.ts +60 -0
- package/dist/subagents/reviewer.js +159 -0
- package/dist/subagents/reviewer.js.map +1 -0
- package/dist/subagents/worker.d.ts +71 -0
- package/dist/subagents/worker.js +180 -0
- package/dist/subagents/worker.js.map +1 -0
- package/dist/testing/temp-repo.d.ts +7 -0
- package/dist/testing/temp-repo.js +21 -0
- package/dist/testing/temp-repo.js.map +1 -0
- package/dist/tools/datetime.d.ts +12 -0
- package/dist/tools/datetime.js +42 -0
- package/dist/tools/datetime.js.map +1 -0
- package/dist/tools/fetch-html.d.ts +32 -0
- package/dist/tools/fetch-html.js +139 -0
- package/dist/tools/fetch-html.js.map +1 -0
- package/dist/tools/github-thread-tool.d.ts +10 -0
- package/dist/tools/github-thread-tool.js +36 -0
- package/dist/tools/github-thread-tool.js.map +1 -0
- package/dist/tools/web-fetch.d.ts +31 -0
- package/dist/tools/web-fetch.js +223 -0
- package/dist/tools/web-fetch.js.map +1 -0
- package/dist/workspace/worktree-pool.d.ts +21 -0
- package/dist/workspace/worktree-pool.js +104 -0
- package/dist/workspace/worktree-pool.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-client.js","sourceRoot":"","sources":["../../src/github/github-client.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,kGAAkG;AAElG,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;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H,CAAC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const PrStateSchema: z.ZodEnum<{
|
|
3
|
+
OPEN: "OPEN";
|
|
4
|
+
CLOSED: "CLOSED";
|
|
5
|
+
MERGED: "MERGED";
|
|
6
|
+
}>;
|
|
7
|
+
export type PrState = z.infer<typeof PrStateSchema>;
|
|
8
|
+
export declare const PullRequestSchema: z.ZodObject<{
|
|
9
|
+
number: z.ZodNumber;
|
|
10
|
+
state: z.ZodEnum<{
|
|
11
|
+
OPEN: "OPEN";
|
|
12
|
+
CLOSED: "CLOSED";
|
|
13
|
+
MERGED: "MERGED";
|
|
14
|
+
}>;
|
|
15
|
+
url: z.ZodString;
|
|
16
|
+
headRefName: z.ZodString;
|
|
17
|
+
baseRefName: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type PullRequest = z.infer<typeof PullRequestSchema>;
|
|
20
|
+
export declare const CheckStatusSchema: z.ZodEnum<{
|
|
21
|
+
success: "success";
|
|
22
|
+
pending: "pending";
|
|
23
|
+
failure: "failure";
|
|
24
|
+
cancelled: "cancelled";
|
|
25
|
+
skipped: "skipped";
|
|
26
|
+
}>;
|
|
27
|
+
export type CheckStatus = z.infer<typeof CheckStatusSchema>;
|
|
28
|
+
export declare const ReviewCommentSchema: z.ZodObject<{
|
|
29
|
+
id: z.ZodString;
|
|
30
|
+
body: z.ZodString;
|
|
31
|
+
author: z.ZodString;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export type ReviewComment = z.infer<typeof ReviewCommentSchema>;
|
|
34
|
+
export declare const ReviewThreadSchema: z.ZodObject<{
|
|
35
|
+
id: z.ZodString;
|
|
36
|
+
isResolved: z.ZodBoolean;
|
|
37
|
+
path: z.ZodNullable<z.ZodString>;
|
|
38
|
+
comments: z.ZodArray<z.ZodObject<{
|
|
39
|
+
id: z.ZodString;
|
|
40
|
+
body: z.ZodString;
|
|
41
|
+
author: z.ZodString;
|
|
42
|
+
}, z.core.$strip>>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
export type ReviewThread = z.infer<typeof ReviewThreadSchema>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// docs/github-integration.md — JSON shapes returned by `gh` (parsed through Zod).
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export const PrStateSchema = z.enum(['OPEN', 'CLOSED', 'MERGED']);
|
|
4
|
+
export const PullRequestSchema = z.object({
|
|
5
|
+
number: z.number().int().positive(),
|
|
6
|
+
state: PrStateSchema,
|
|
7
|
+
url: z.string().url(),
|
|
8
|
+
headRefName: z.string(),
|
|
9
|
+
baseRefName: z.string(),
|
|
10
|
+
});
|
|
11
|
+
export const CheckStatusSchema = z.enum(['pending', 'success', 'failure', 'cancelled', 'skipped']);
|
|
12
|
+
export const ReviewCommentSchema = z.object({
|
|
13
|
+
id: z.string(),
|
|
14
|
+
body: z.string(),
|
|
15
|
+
author: z.string(),
|
|
16
|
+
});
|
|
17
|
+
export const ReviewThreadSchema = z.object({
|
|
18
|
+
id: z.string(),
|
|
19
|
+
isResolved: z.boolean(),
|
|
20
|
+
path: z.string().nullable(),
|
|
21
|
+
comments: z.array(ReviewCommentSchema),
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/github/schema.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAElF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAGlE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACnC,KAAK,EAAE,aAAa;IACpB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACrB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;CACxB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;AAGnG,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;IACvB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC;CACvC,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type { AgentConfig } from './agent-config/agent-config-detector.ts';
|
|
2
|
+
export { AgentConfigDetector } from './agent-config/agent-config-detector.ts';
|
|
3
|
+
export { main } from './cli/cli.ts';
|
|
4
|
+
export { Compactor } from './compaction/compactor.ts';
|
|
5
|
+
export { ConfigLoader } from './config/config-loader.ts';
|
|
6
|
+
export { ConfigWriter } from './config/config-writer.ts';
|
|
7
|
+
export type { Capability, ConfigFile, ResolvedConfig } from './config/schema.ts';
|
|
8
|
+
export type { ModelHandles, Role } from './credentials/credentials.ts';
|
|
9
|
+
export { Credentials, ROLE_CAPABILITY } from './credentials/credentials.ts';
|
|
10
|
+
export { DEFAULT_PR_LABEL, GitHubClient } from './github/github-client.ts';
|
|
11
|
+
export { Logger } from './logger/logger.ts';
|
|
12
|
+
export { WorkLoop } from './loop/work-loop.ts';
|
|
13
|
+
export { McpClientManager } from './mcp/mcp-client.ts';
|
|
14
|
+
export type { McpServer, McpServers } from './mcp/schema.ts';
|
|
15
|
+
export { OpenRouterClient } from './openrouter/client.ts';
|
|
16
|
+
export { ModelLimitsRegistry } from './openrouter/model-limits.ts';
|
|
17
|
+
export { providerOptionsWithServerTools, webFetchServerTool, webSearchTool, } from './openrouter/server-tools.ts';
|
|
18
|
+
export { Orchestrator } from './orchestrator/orchestrator.ts';
|
|
19
|
+
export { PlanGraph } from './plan/plan-graph.ts';
|
|
20
|
+
export type { Plan, PlannedGroup, PlannedTask } from './plan/schema.ts';
|
|
21
|
+
export type { PrGroup, RunState } from './state/schema.ts';
|
|
22
|
+
export { StateStore } from './state/state-store.ts';
|
|
23
|
+
export { datetimeTool } from './tools/datetime.ts';
|
|
24
|
+
export { DEFAULT_IMPERSONATE_TARGETS, type FetchHtmlInput, fetchHtmlTool, isFetchHtmlAvailable, } from './tools/fetch-html.ts';
|
|
25
|
+
export { DEFAULT_STEALTH_HEADERS, webFetchTool } from './tools/web-fetch.ts';
|
|
26
|
+
export { WorktreePool } from './workspace/worktree-pool.ts';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Public surface. Keep this list narrow — most internals are not stable yet.
|
|
2
|
+
export { AgentConfigDetector } from "./agent-config/agent-config-detector.js";
|
|
3
|
+
export { main } from "./cli/cli.js";
|
|
4
|
+
export { Compactor } from "./compaction/compactor.js";
|
|
5
|
+
export { ConfigLoader } from "./config/config-loader.js";
|
|
6
|
+
export { ConfigWriter } from "./config/config-writer.js";
|
|
7
|
+
export { Credentials, ROLE_CAPABILITY } from "./credentials/credentials.js";
|
|
8
|
+
export { DEFAULT_PR_LABEL, GitHubClient } from "./github/github-client.js";
|
|
9
|
+
export { Logger } from "./logger/logger.js";
|
|
10
|
+
export { WorkLoop } from "./loop/work-loop.js";
|
|
11
|
+
export { McpClientManager } from "./mcp/mcp-client.js";
|
|
12
|
+
export { OpenRouterClient } from "./openrouter/client.js";
|
|
13
|
+
export { ModelLimitsRegistry } from "./openrouter/model-limits.js";
|
|
14
|
+
export { providerOptionsWithServerTools, webFetchServerTool, webSearchTool, } from "./openrouter/server-tools.js";
|
|
15
|
+
export { Orchestrator } from "./orchestrator/orchestrator.js";
|
|
16
|
+
export { PlanGraph } from "./plan/plan-graph.js";
|
|
17
|
+
export { StateStore } from "./state/state-store.js";
|
|
18
|
+
export { datetimeTool } from "./tools/datetime.js";
|
|
19
|
+
export { DEFAULT_IMPERSONATE_TARGETS, fetchHtmlTool, isFetchHtmlAvailable, } from "./tools/fetch-html.js";
|
|
20
|
+
export { DEFAULT_STEALTH_HEADERS, webFetchTool } from "./tools/web-fetch.js";
|
|
21
|
+
export { WorktreePool } from "./workspace/worktree-pool.js";
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAG7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,8BAA8B,EAC9B,kBAAkB,EAClB,aAAa,GACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EACL,2BAA2B,EAE3B,aAAa,EACb,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
2
|
+
export type LogRecord = {
|
|
3
|
+
level: LogLevel;
|
|
4
|
+
msg: string;
|
|
5
|
+
ts: string;
|
|
6
|
+
runId: string;
|
|
7
|
+
[k: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
export type LoggerLike = {
|
|
10
|
+
debug(msg: string, fields?: Record<string, unknown>): void;
|
|
11
|
+
info(msg: string, fields?: Record<string, unknown>): void;
|
|
12
|
+
warn(msg: string, fields?: Record<string, unknown>): void;
|
|
13
|
+
error(msg: string, fields?: Record<string, unknown>): void;
|
|
14
|
+
status(msg: string): void;
|
|
15
|
+
flush(): Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
export declare class Logger implements LoggerLike {
|
|
18
|
+
private readonly level;
|
|
19
|
+
private readonly runId;
|
|
20
|
+
private readonly logFile?;
|
|
21
|
+
private writeTail;
|
|
22
|
+
private parentEnsured;
|
|
23
|
+
private lastError;
|
|
24
|
+
constructor(level: LogLevel, runId: string, logFile?: string | undefined);
|
|
25
|
+
debug(msg: string, fields?: Record<string, unknown>): void;
|
|
26
|
+
info(msg: string, fields?: Record<string, unknown>): void;
|
|
27
|
+
warn(msg: string, fields?: Record<string, unknown>): void;
|
|
28
|
+
error(msg: string, fields?: Record<string, unknown>): void;
|
|
29
|
+
status(msg: string): void;
|
|
30
|
+
static redact(fields: Record<string, unknown>): Record<string, unknown>;
|
|
31
|
+
flush(): Promise<void>;
|
|
32
|
+
private emit;
|
|
33
|
+
private serialize;
|
|
34
|
+
private appendToFile;
|
|
35
|
+
private ensureParent;
|
|
36
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// docs/state.md (logs dir), docs/auth.md §Security (redaction policy)
|
|
2
|
+
// Structured logs to .ai-task-master/logs/run-{ts}.log; user-facing status to stdout.
|
|
3
|
+
// Redact /key|token|secret|authorization/i before serializing.
|
|
4
|
+
import { appendFile, mkdir } from 'node:fs/promises';
|
|
5
|
+
import { dirname } from 'node:path';
|
|
6
|
+
const LEVEL_RANK = {
|
|
7
|
+
debug: 10,
|
|
8
|
+
info: 20,
|
|
9
|
+
warn: 30,
|
|
10
|
+
error: 40,
|
|
11
|
+
};
|
|
12
|
+
const REDACT_KEY = /key|token|secret|authorization/i;
|
|
13
|
+
const REDACTED = '[REDACTED]';
|
|
14
|
+
export class Logger {
|
|
15
|
+
level;
|
|
16
|
+
runId;
|
|
17
|
+
logFile;
|
|
18
|
+
writeTail = Promise.resolve();
|
|
19
|
+
parentEnsured = false;
|
|
20
|
+
lastError = null;
|
|
21
|
+
constructor(level, runId, logFile) {
|
|
22
|
+
this.level = level;
|
|
23
|
+
this.runId = runId;
|
|
24
|
+
this.logFile = logFile;
|
|
25
|
+
}
|
|
26
|
+
debug(msg, fields) {
|
|
27
|
+
this.emit('debug', msg, fields);
|
|
28
|
+
}
|
|
29
|
+
info(msg, fields) {
|
|
30
|
+
this.emit('info', msg, fields);
|
|
31
|
+
}
|
|
32
|
+
warn(msg, fields) {
|
|
33
|
+
this.emit('warn', msg, fields);
|
|
34
|
+
}
|
|
35
|
+
error(msg, fields) {
|
|
36
|
+
this.emit('error', msg, fields);
|
|
37
|
+
}
|
|
38
|
+
status(msg) {
|
|
39
|
+
process.stdout.write(`${msg}\n`);
|
|
40
|
+
}
|
|
41
|
+
static redact(fields) {
|
|
42
|
+
const out = redactValue(fields);
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
// Flush pending file writes — tests and shutdown hooks await this.
|
|
46
|
+
async flush() {
|
|
47
|
+
await this.writeTail;
|
|
48
|
+
if (this.lastError) {
|
|
49
|
+
const err = this.lastError;
|
|
50
|
+
this.lastError = null;
|
|
51
|
+
throw err;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
emit(level, msg, fields) {
|
|
55
|
+
if (LEVEL_RANK[level] < LEVEL_RANK[this.level])
|
|
56
|
+
return;
|
|
57
|
+
const line = this.serialize(level, msg, fields);
|
|
58
|
+
process.stderr.write(line);
|
|
59
|
+
if (this.logFile !== undefined) {
|
|
60
|
+
this.appendToFile(this.logFile, line);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
serialize(level, msg, fields) {
|
|
64
|
+
const ts = new Date().toISOString();
|
|
65
|
+
try {
|
|
66
|
+
const safeFields = fields ? Logger.redact(fields) : {};
|
|
67
|
+
const record = { ...safeFields, level, msg, ts, runId: this.runId };
|
|
68
|
+
return `${JSON.stringify(record, bigintReplacer)}\n`;
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
const fallback = {
|
|
72
|
+
level: 'error',
|
|
73
|
+
msg: 'logger serialization failed',
|
|
74
|
+
ts,
|
|
75
|
+
runId: this.runId,
|
|
76
|
+
originalMsg: msg,
|
|
77
|
+
serializationError: err instanceof Error ? err.message : String(err),
|
|
78
|
+
};
|
|
79
|
+
return `${JSON.stringify(fallback)}\n`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
appendToFile(file, line) {
|
|
83
|
+
this.writeTail = this.writeTail.then(async () => {
|
|
84
|
+
try {
|
|
85
|
+
await this.ensureParent(file);
|
|
86
|
+
await appendFile(file, line);
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
// Surface failures via flush() but never crash callers.
|
|
90
|
+
this.lastError = err instanceof Error ? err : new Error(String(err));
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
async ensureParent(file) {
|
|
95
|
+
if (this.parentEnsured)
|
|
96
|
+
return;
|
|
97
|
+
await mkdir(dirname(file), { recursive: true });
|
|
98
|
+
this.parentEnsured = true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function redactValue(value, seen = new WeakSet()) {
|
|
102
|
+
if (Array.isArray(value)) {
|
|
103
|
+
if (seen.has(value))
|
|
104
|
+
return '[CYCLE]';
|
|
105
|
+
seen.add(value);
|
|
106
|
+
return value.map((v) => redactValue(v, seen));
|
|
107
|
+
}
|
|
108
|
+
if (value !== null && typeof value === 'object') {
|
|
109
|
+
if (seen.has(value))
|
|
110
|
+
return '[CYCLE]';
|
|
111
|
+
seen.add(value);
|
|
112
|
+
const out = {};
|
|
113
|
+
for (const [k, v] of Object.entries(value)) {
|
|
114
|
+
out[k] = REDACT_KEY.test(k) ? REDACTED : redactValue(v, seen);
|
|
115
|
+
}
|
|
116
|
+
return out;
|
|
117
|
+
}
|
|
118
|
+
return value;
|
|
119
|
+
}
|
|
120
|
+
function bigintReplacer(_key, value) {
|
|
121
|
+
return typeof value === 'bigint' ? value.toString() : value;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger/logger.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ED,SAAS,WAAW,CAAC,KAAc,EAAE,OAAwB,IAAI,OAAO,EAAE;IACxE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QACtC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAChB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;IACD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QACtC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAChB,MAAM,GAAG,GAA4B,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3C,GAAG,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,cAAc,CAAC,IAAY,EAAE,KAAc;IAClD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type Tool } from 'ai';
|
|
2
|
+
import type { RunLoopInput } from '../cli/commands.ts';
|
|
3
|
+
import type { GitHubClient } from '../github/github-client.ts';
|
|
4
|
+
import { McpClientManager } from '../mcp/mcp-client.ts';
|
|
5
|
+
import type { Plan } from '../plan/schema.ts';
|
|
6
|
+
import type { PrGroup, RunState } from '../state/schema.ts';
|
|
7
|
+
import { type PlannerTools } from '../subagents/planner.ts';
|
|
8
|
+
import { type GithubToolInput, type GithubToolOutput } from '../subagents/reviewer.ts';
|
|
9
|
+
import { type WorkerTools } from '../subagents/worker.ts';
|
|
10
|
+
import { type WorkLoopGithub, type WorkLoopOrchestrator, type WorkLoopResult } from './work-loop.ts';
|
|
11
|
+
export declare function localEditTools(cwd: string): WorkerTools;
|
|
12
|
+
export declare function localReadTools(cwd: string): PlannerTools;
|
|
13
|
+
export type AdapterStatePort = {
|
|
14
|
+
read(): Promise<RunState>;
|
|
15
|
+
update(mutator: (s: RunState) => RunState): Promise<RunState>;
|
|
16
|
+
readContext?(): Promise<string | null>;
|
|
17
|
+
};
|
|
18
|
+
export type PlanGroupsOutcome = {
|
|
19
|
+
kind: 'ok';
|
|
20
|
+
groups: PrGroup[];
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'blocked';
|
|
23
|
+
reason: string;
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'error';
|
|
26
|
+
error: string;
|
|
27
|
+
};
|
|
28
|
+
export type OrchestratorBridgeCtx = {
|
|
29
|
+
input: RunLoopInput;
|
|
30
|
+
mcp: McpClientManager;
|
|
31
|
+
rollingContext: string;
|
|
32
|
+
};
|
|
33
|
+
export type RunLoopAdapterSeams = {
|
|
34
|
+
planGroups?: (input: RunLoopInput, mcp: McpClientManager) => Promise<PlanGroupsOutcome>;
|
|
35
|
+
makeOrchestrator?: (ctx: OrchestratorBridgeCtx) => WorkLoopOrchestrator | Promise<WorkLoopOrchestrator>;
|
|
36
|
+
makePool?: (input: RunLoopInput) => WorkLoopPool;
|
|
37
|
+
makeGithub?: (input: RunLoopInput) => WorkLoopGithub;
|
|
38
|
+
makeMcp?: (input: RunLoopInput) => McpClientManager;
|
|
39
|
+
state?: AdapterStatePort;
|
|
40
|
+
};
|
|
41
|
+
export type WorkLoopPool = import('./work-loop.ts').WorkLoopPool;
|
|
42
|
+
export declare function runLoopAdapter(input: RunLoopInput, seams?: RunLoopAdapterSeams): Promise<WorkLoopResult>;
|
|
43
|
+
export declare function planToPrGroups(plan: Plan): PrGroup[];
|
|
44
|
+
type ThreadGithub = Pick<GitHubClient, 'replyToThread' | 'resolveThread'>;
|
|
45
|
+
export declare function githubThreadTool(github: ThreadGithub): Tool<GithubToolInput, GithubToolOutput>;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
// Production wiring for `aitm start`. Composes the WorkLoop's structural ports out of the
|
|
2
|
+
// real Planner, Orchestrator, WorktreePool, PlanGraph, MCP tools and GitHubClient.
|
|
3
|
+
//
|
|
4
|
+
// Symmetric counterpart to the merge-pr flow: `runStart` injects this as its `runLoop` seam
|
|
5
|
+
// (see src/cli/commands.ts `defaultRunLoop`). Every external dependency is reachable through
|
|
6
|
+
// a seam so the four WorkLoopResult branches are unit-testable without spawning subagents,
|
|
7
|
+
// git, or `gh` — the integration suite (test/integration/) covers the real stack.
|
|
8
|
+
//
|
|
9
|
+
// Flow:
|
|
10
|
+
// 1. Resume detection — if state already holds prGroups, reuse them; else run the Planner.
|
|
11
|
+
// 2. Persist the plan into RunState (status → working).
|
|
12
|
+
// 3. Build a *live* PlanGraph that re-reads the mirrored prGroups on every ready()/isComplete()
|
|
13
|
+
// so status transitions written by the loop are visible (PlanGraph snapshots at construction).
|
|
14
|
+
// 4. Bridge the Orchestrator/subagents into the WorkLoopOrchestrator port and run the loop.
|
|
15
|
+
import { resolve as resolvePath } from 'node:path';
|
|
16
|
+
import { bashTool, composeSystemPrompt, editFileTool, globTool, grepTool, multiEditTool, readFileTool, writeFileTool, } from '@developerz.ai/ai-claude-compat';
|
|
17
|
+
import { tool } from 'ai';
|
|
18
|
+
import { execa } from 'execa';
|
|
19
|
+
import { z } from 'zod';
|
|
20
|
+
import { McpClientManager } from "../mcp/mcp-client.js";
|
|
21
|
+
import { Orchestrator } from "../orchestrator/orchestrator.js";
|
|
22
|
+
import { PlanGraph } from "../plan/plan-graph.js";
|
|
23
|
+
import { createPlannerAgent, PLANNER_SYSTEM_PREFIX, runPlanner, } from "../subagents/planner.js";
|
|
24
|
+
import { createReviewerAgent, REVIEWER_SYSTEM_PREFIX, runReviewer as runReviewerSubagent, } from "../subagents/reviewer.js";
|
|
25
|
+
import { createWorkerAgent, runWorker as runWorkerSubagent, WORKER_SYSTEM_PREFIX, } from "../subagents/worker.js";
|
|
26
|
+
import { WorktreePool } from "../workspace/worktree-pool.js";
|
|
27
|
+
import { WorkLoop, } from "./work-loop.js";
|
|
28
|
+
// Worktree-scoped Claude-Code-style tools the Worker/Reviewer fall back to when no MCP server
|
|
29
|
+
// supplies them. aitm is MCP-first, but a bare `aitm start` (no `mcpServers` configured) must
|
|
30
|
+
// still be able to read, search, edit, commit and open a PR — so it uses the compat lib's
|
|
31
|
+
// tools, scoped to the active worktree.
|
|
32
|
+
export function localEditTools(cwd) {
|
|
33
|
+
return {
|
|
34
|
+
readFile: readFileTool({ cwd }),
|
|
35
|
+
writeFile: writeFileTool({ cwd }),
|
|
36
|
+
editFile: editFileTool({ cwd }),
|
|
37
|
+
multiEdit: multiEditTool({ cwd }),
|
|
38
|
+
grep: grepTool({ cwd }),
|
|
39
|
+
glob: globTool({ cwd }),
|
|
40
|
+
bash: bashTool({ cwd }),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
// Read-only subset for the Planner — survey the repo without write/edit/bash.
|
|
44
|
+
export function localReadTools(cwd) {
|
|
45
|
+
return {
|
|
46
|
+
readFile: readFileTool({ cwd }),
|
|
47
|
+
grep: grepTool({ cwd }),
|
|
48
|
+
glob: globTool({ cwd }),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export async function runLoopAdapter(input, seams = {}) {
|
|
52
|
+
const state = seams.state ?? input.state;
|
|
53
|
+
// MCP is only needed when a real Planner / Orchestrator default runs. When both are stubbed
|
|
54
|
+
// (unit tests), we never connect, so no transport is spawned.
|
|
55
|
+
const usesMcp = !seams.planGroups || !seams.makeOrchestrator;
|
|
56
|
+
const mcp = seams.makeMcp
|
|
57
|
+
? seams.makeMcp(input)
|
|
58
|
+
: new McpClientManager({ servers: input.resolved.mcpServers });
|
|
59
|
+
let mcpConnected = false;
|
|
60
|
+
try {
|
|
61
|
+
if (usesMcp && !seams.makeMcp) {
|
|
62
|
+
await mcp.connectAll();
|
|
63
|
+
mcpConnected = true;
|
|
64
|
+
}
|
|
65
|
+
const current = await state.read();
|
|
66
|
+
const rollingContext = (await state.readContext?.()) ?? '';
|
|
67
|
+
// ---- Plan (fresh) or resume (prior prGroups present) -------------------
|
|
68
|
+
let groups;
|
|
69
|
+
if (current.prGroups.length > 0) {
|
|
70
|
+
groups = current.prGroups;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const planFn = seams.planGroups ?? defaultPlanGroups;
|
|
74
|
+
const outcome = await planFn(input, mcp);
|
|
75
|
+
if (outcome.kind === 'blocked') {
|
|
76
|
+
return { kind: 'blocked', reason: outcome.reason, outcomes: [] };
|
|
77
|
+
}
|
|
78
|
+
if (outcome.kind === 'error') {
|
|
79
|
+
return { kind: 'blocked', reason: `planner error: ${outcome.error}`, outcomes: [] };
|
|
80
|
+
}
|
|
81
|
+
if (outcome.groups.length === 0) {
|
|
82
|
+
return { kind: 'blocked', reason: 'planner produced no PR groups', outcomes: [] };
|
|
83
|
+
}
|
|
84
|
+
groups = outcome.groups;
|
|
85
|
+
await state.update((s) => ({ ...s, status: 'working', prGroups: groups }));
|
|
86
|
+
}
|
|
87
|
+
// ---- Live graph + state proxy ------------------------------------------
|
|
88
|
+
// PlanGraph captures its groups at construction, so rebuild it per call against the
|
|
89
|
+
// mirror that workLoopState keeps in sync after every persisted update.
|
|
90
|
+
let liveGroups = groups;
|
|
91
|
+
const graph = {
|
|
92
|
+
ready: () => new PlanGraph([...liveGroups]).ready(),
|
|
93
|
+
isComplete: () => new PlanGraph([...liveGroups]).isComplete(),
|
|
94
|
+
};
|
|
95
|
+
const workLoopState = {
|
|
96
|
+
update: async (mutator) => {
|
|
97
|
+
const next = await state.update(mutator);
|
|
98
|
+
liveGroups = next.prGroups;
|
|
99
|
+
return next;
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
// ---- Remaining deps ----------------------------------------------------
|
|
103
|
+
const pool = seams.makePool?.(input) ??
|
|
104
|
+
new WorktreePool(input.cwd, resolvePath(input.cwd, '.ai-task-master'), input.resolved.concurrency);
|
|
105
|
+
const github = seams.makeGithub?.(input) ?? input.github;
|
|
106
|
+
const orchestrator = await (seams.makeOrchestrator ?? defaultMakeOrchestrator)({
|
|
107
|
+
input,
|
|
108
|
+
mcp,
|
|
109
|
+
rollingContext,
|
|
110
|
+
});
|
|
111
|
+
const loop = new WorkLoop({
|
|
112
|
+
orchestrator,
|
|
113
|
+
github,
|
|
114
|
+
state: workLoopState,
|
|
115
|
+
pool,
|
|
116
|
+
graph,
|
|
117
|
+
concurrency: input.resolved.concurrency,
|
|
118
|
+
autoMerge: input.resolved.autoMerge,
|
|
119
|
+
maxSessions: input.resolved.maxSessions,
|
|
120
|
+
mergeMethod: input.resolved.mergeMethod,
|
|
121
|
+
initialSessionCount: current.sessionCount,
|
|
122
|
+
});
|
|
123
|
+
return await loop.run();
|
|
124
|
+
}
|
|
125
|
+
finally {
|
|
126
|
+
if (mcpConnected) {
|
|
127
|
+
await mcp.close();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// ---- Plan ------------------------------------------------------------------
|
|
132
|
+
export function planToPrGroups(plan) {
|
|
133
|
+
return plan.groups.map((g) => ({
|
|
134
|
+
id: g.id,
|
|
135
|
+
title: g.title,
|
|
136
|
+
tasks: g.tasks.map((t) => t.description),
|
|
137
|
+
dependsOn: g.dependsOn,
|
|
138
|
+
branch: `aitm/${g.id}`,
|
|
139
|
+
pr: null,
|
|
140
|
+
status: 'pending',
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
async function defaultPlanGroups(input, mcp) {
|
|
144
|
+
const style = input.agentConfig.contents;
|
|
145
|
+
const agent = createPlannerAgent({
|
|
146
|
+
model: input.credentials.modelFor('planner'),
|
|
147
|
+
tools: resolvePlannerTools(mcp.toolsForRole('planner'), input.cwd),
|
|
148
|
+
systemPrompt: composeSystemPrompt(style, PLANNER_SYSTEM_PREFIX, input.cwd),
|
|
149
|
+
});
|
|
150
|
+
const result = await runPlanner(agent, {
|
|
151
|
+
goal: input.goal,
|
|
152
|
+
styleContents: style,
|
|
153
|
+
maxPrs: input.resolved.maxPrs,
|
|
154
|
+
...(input.criteria !== undefined ? { criteria: input.criteria } : {}),
|
|
155
|
+
});
|
|
156
|
+
if (result.kind === 'ok')
|
|
157
|
+
return { kind: 'ok', groups: planToPrGroups(result.plan) };
|
|
158
|
+
if (result.kind === 'blocked')
|
|
159
|
+
return { kind: 'blocked', reason: result.reason };
|
|
160
|
+
return { kind: 'error', error: result.error };
|
|
161
|
+
}
|
|
162
|
+
// ---- Orchestrator bridge ---------------------------------------------------
|
|
163
|
+
function defaultMakeOrchestrator(ctx) {
|
|
164
|
+
const { input, mcp, rollingContext } = ctx;
|
|
165
|
+
const style = input.agentConfig.contents;
|
|
166
|
+
const orch = new Orchestrator({
|
|
167
|
+
credentials: input.credentials,
|
|
168
|
+
agentConfig: input.agentConfig,
|
|
169
|
+
rollingContext,
|
|
170
|
+
maxSessions: input.resolved.maxSessions,
|
|
171
|
+
github: input.github,
|
|
172
|
+
});
|
|
173
|
+
return {
|
|
174
|
+
runWorker: async ({ group, worktree, baseBranch }) => {
|
|
175
|
+
// Prefer MCP-supplied tools; partial-fill any the server omits from the local set so a
|
|
176
|
+
// bare `aitm start` (no mcpServers configured) can still edit, commit and open a PR.
|
|
177
|
+
const tools = resolveWorkerTools(mcp.toolsForRole('worker'), worktree.path);
|
|
178
|
+
const agent = createWorkerAgent({
|
|
179
|
+
model: input.credentials.modelFor('worker'),
|
|
180
|
+
tools,
|
|
181
|
+
systemPrompt: composeSystemPrompt(style, WORKER_SYSTEM_PREFIX, worktree.path),
|
|
182
|
+
});
|
|
183
|
+
return runWorkerSubagent(agent, {
|
|
184
|
+
group,
|
|
185
|
+
worktreePath: worktree.path,
|
|
186
|
+
baseBranch,
|
|
187
|
+
styleContents: style,
|
|
188
|
+
rollingContext,
|
|
189
|
+
});
|
|
190
|
+
},
|
|
191
|
+
finalizeCommit: (group, delivery, worktreePath) => orch.finalizeCommit(group, delivery, worktreePath),
|
|
192
|
+
openPr: async (group, delivery, baseBranch) => {
|
|
193
|
+
// The Worker's commits live on the group branch in a linked worktree (shared object
|
|
194
|
+
// store). Push it to origin first — `gh pr create` won't open a PR for a branch that
|
|
195
|
+
// isn't on the remote ("No commits between … / Head ref must be a branch").
|
|
196
|
+
const head = group.branch ?? `aitm/${group.id}`;
|
|
197
|
+
await execa('git', ['push', '-u', 'origin', head], { cwd: input.cwd });
|
|
198
|
+
return orch.openPr(group, delivery, baseBranch);
|
|
199
|
+
},
|
|
200
|
+
runReviewer: async ({ pr, threads, worktree }) => {
|
|
201
|
+
const github = githubThreadTool(input.github);
|
|
202
|
+
// Same partial-fill as the Worker, plus the local `github` thread tool.
|
|
203
|
+
const tools = resolveReviewerTools(mcp.toolsForRole('reviewer'), worktree.path, github);
|
|
204
|
+
const agent = createReviewerAgent({
|
|
205
|
+
model: input.credentials.modelFor('reviewer'),
|
|
206
|
+
tools,
|
|
207
|
+
systemPrompt: composeSystemPrompt(style, REVIEWER_SYSTEM_PREFIX, worktree.path),
|
|
208
|
+
});
|
|
209
|
+
return runReviewerSubagent(agent, {
|
|
210
|
+
pr,
|
|
211
|
+
threads,
|
|
212
|
+
worktreePath: worktree.path,
|
|
213
|
+
styleContents: style,
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
// MCP exposes a dynamically-typed ToolSet. The subagents need a statically-shaped tool record.
|
|
219
|
+
// Rather than fail closed when a server only exports the legacy readFile/writeFile/bash, we
|
|
220
|
+
// partial-fill: prefer the MCP tool for each name, falling back to the local worktree-scoped
|
|
221
|
+
// tool for any the server omits. The shape is asserted once at this boundary.
|
|
222
|
+
function resolveWorkerTools(set, cwd) {
|
|
223
|
+
const local = localEditTools(cwd);
|
|
224
|
+
return {
|
|
225
|
+
readFile: set.readFile ?? local.readFile,
|
|
226
|
+
writeFile: set.writeFile ?? local.writeFile,
|
|
227
|
+
editFile: set.editFile ?? local.editFile,
|
|
228
|
+
multiEdit: set.multiEdit ?? local.multiEdit,
|
|
229
|
+
grep: set.grep ?? local.grep,
|
|
230
|
+
glob: set.glob ?? local.glob,
|
|
231
|
+
bash: set.bash ?? local.bash,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
function resolveReviewerTools(set, cwd, github) {
|
|
235
|
+
return { ...resolveWorkerTools(set, cwd), github };
|
|
236
|
+
}
|
|
237
|
+
// The Planner gets only the read-only subset, partial-filled the same way. This is also the fix
|
|
238
|
+
// for the latent no-MCP bug: previously the Planner was handed the raw MCP ToolSet with no local
|
|
239
|
+
// fallback, so a bare `aitm start` left it with zero tools despite its prompt promising
|
|
240
|
+
// readFile/grep/glob.
|
|
241
|
+
function resolvePlannerTools(set, cwd) {
|
|
242
|
+
const local = localReadTools(cwd);
|
|
243
|
+
return {
|
|
244
|
+
readFile: set.readFile ?? local.readFile,
|
|
245
|
+
grep: set.grep ?? local.grep,
|
|
246
|
+
glob: set.glob ?? local.glob,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
// Flat object, not a discriminatedUnion → no `oneOf` in the tool params (rejected by some
|
|
250
|
+
// OpenRouter-routed providers). `body` applies to replyToThread only.
|
|
251
|
+
const githubToolInputSchema = z.object({
|
|
252
|
+
action: z.enum(['replyToThread', 'resolveThread']),
|
|
253
|
+
threadId: z.string().min(1),
|
|
254
|
+
body: z.string().optional(),
|
|
255
|
+
});
|
|
256
|
+
export function githubThreadTool(github) {
|
|
257
|
+
return tool({
|
|
258
|
+
description: 'Reply to or resolve a PR review thread.',
|
|
259
|
+
inputSchema: githubToolInputSchema,
|
|
260
|
+
execute: async (input) => {
|
|
261
|
+
if (input.action === 'replyToThread') {
|
|
262
|
+
await github.replyToThread(input.threadId, input.body ?? '');
|
|
263
|
+
return { ok: true };
|
|
264
|
+
}
|
|
265
|
+
await github.resolveThread(input.threadId);
|
|
266
|
+
return { ok: true };
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=run-loop-adapter.js.map
|