aipanel-cli 0.1.2 → 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/README.md +77 -43
- package/dist/src/app/AipanelApp.d.ts +6 -3
- package/dist/src/app/AipanelApp.js +22 -14
- package/dist/src/app/AipanelApp.js.map +1 -1
- package/dist/src/app/CommandRouter.js +27 -6
- package/dist/src/app/CommandRouter.js.map +1 -1
- package/dist/src/app/ProfileLoader.d.ts +3 -2
- package/dist/src/app/ProfileLoader.js +6 -5
- package/dist/src/app/ProfileLoader.js.map +1 -1
- package/dist/src/artifact/ArtifactRepository.d.ts +4 -9
- package/dist/src/artifact/ArtifactRepository.js +24 -60
- package/dist/src/artifact/ArtifactRepository.js.map +1 -1
- package/dist/src/cli/aipanel.js +2 -1
- package/dist/src/cli/aipanel.js.map +1 -1
- package/dist/src/compare/ComparisonEngine.d.ts +10 -1
- package/dist/src/compare/ComparisonEngine.js.map +1 -1
- package/dist/src/compare/ResponseNormalizer.d.ts +3 -2
- package/dist/src/compare/ResponseNormalizer.js +4 -2
- package/dist/src/compare/ResponseNormalizer.js.map +1 -1
- package/dist/src/context/ContextCollector.d.ts +5 -4
- package/dist/src/context/ContextCollector.js +4 -2
- package/dist/src/context/ContextCollector.js.map +1 -1
- package/dist/src/domain/artifact.d.ts +3 -2
- package/dist/src/domain/artifact.js +7 -7
- package/dist/src/domain/base.d.ts +0 -1
- package/dist/src/domain/base.js +1 -7
- package/dist/src/domain/base.js.map +1 -1
- package/dist/src/domain/run.d.ts +11 -23
- package/dist/src/domain/run.js +59 -51
- package/dist/src/domain/run.js.map +1 -1
- package/dist/src/domain/session.d.ts +6 -5
- package/dist/src/domain/session.js +9 -7
- package/dist/src/domain/session.js.map +1 -1
- package/dist/src/domain/value-objects.js +3 -1
- package/dist/src/domain/value-objects.js.map +1 -1
- package/dist/src/output/ResultRenderer.d.ts +3 -2
- package/dist/src/output/ResultRenderer.js +3 -0
- package/dist/src/output/ResultRenderer.js.map +1 -1
- package/dist/src/providers/ClaudeCodeAdapter.d.ts +1 -0
- package/dist/src/providers/ClaudeCodeAdapter.js +3 -0
- package/dist/src/providers/ClaudeCodeAdapter.js.map +1 -1
- package/dist/src/providers/CodexExecAdapter.d.ts +5 -0
- package/dist/src/providers/CodexExecAdapter.js +128 -0
- package/dist/src/providers/CodexExecAdapter.js.map +1 -0
- package/dist/src/providers/ProviderAdapter.d.ts +2 -0
- package/dist/src/providers/ProviderRegistry.d.ts +3 -2
- package/dist/src/providers/ProviderRegistry.js +3 -3
- package/dist/src/providers/ProviderRegistry.js.map +1 -1
- package/dist/src/run/RunCoordinator.d.ts +10 -16
- package/dist/src/run/RunCoordinator.js +5 -20
- package/dist/src/run/RunCoordinator.js.map +1 -1
- package/dist/src/run/RunRepository.d.ts +3 -7
- package/dist/src/run/RunRepository.js +9 -45
- package/dist/src/run/RunRepository.js.map +1 -1
- package/dist/src/session/SessionManager.d.ts +5 -3
- package/dist/src/session/SessionManager.js +5 -6
- package/dist/src/session/SessionManager.js.map +1 -1
- package/dist/src/session/SessionRepository.d.ts +3 -5
- package/dist/src/session/SessionRepository.js +14 -28
- package/dist/src/session/SessionRepository.js.map +1 -1
- package/dist/src/shared/clock.d.ts +0 -1
- package/dist/src/shared/clock.js +0 -3
- package/dist/src/shared/clock.js.map +1 -1
- package/dist/src/shared/file-system.d.ts +0 -6
- package/dist/src/shared/file-system.js +1 -23
- package/dist/src/shared/file-system.js.map +1 -1
- package/dist/src/usecases/ConsultUseCase.d.ts +4 -1
- package/dist/src/usecases/ConsultUseCase.js +10 -6
- package/dist/src/usecases/ConsultUseCase.js.map +1 -1
- package/dist/src/usecases/DebugUseCase.d.ts +4 -1
- package/dist/src/usecases/DebugUseCase.js +25 -6
- package/dist/src/usecases/DebugUseCase.js.map +1 -1
- package/dist/src/usecases/FollowupUseCase.js.map +1 -1
- package/package.json +19 -63
- package/dist/src/app/WorkflowSelector.d.ts +0 -4
- package/dist/src/app/WorkflowSelector.js +0 -6
- package/dist/src/app/WorkflowSelector.js.map +0 -1
- package/dist/src/app/index.d.ts +0 -4
- package/dist/src/app/index.js +0 -5
- package/dist/src/app/index.js.map +0 -1
- package/dist/src/app/types.d.ts +0 -36
- package/dist/src/app/types.js +0 -2
- package/dist/src/app/types.js.map +0 -1
- package/dist/src/artifact/index.d.ts +0 -1
- package/dist/src/artifact/index.js +0 -2
- package/dist/src/artifact/index.js.map +0 -1
- package/dist/src/compare/index.d.ts +0 -3
- package/dist/src/compare/index.js +0 -3
- package/dist/src/compare/index.js.map +0 -1
- package/dist/src/context/index.d.ts +0 -2
- package/dist/src/context/index.js +0 -2
- package/dist/src/context/index.js.map +0 -1
- package/dist/src/domain/index.d.ts +0 -5
- package/dist/src/domain/index.js +0 -6
- package/dist/src/domain/index.js.map +0 -1
- package/dist/src/index.d.ts +0 -16
- package/dist/src/index.js +0 -16
- package/dist/src/index.js.map +0 -1
- package/dist/src/orchestrator/PlanBuilder.d.ts +0 -6
- package/dist/src/orchestrator/PlanBuilder.js +0 -59
- package/dist/src/orchestrator/PlanBuilder.js.map +0 -1
- package/dist/src/orchestrator/ResultMerger.d.ts +0 -10
- package/dist/src/orchestrator/ResultMerger.js +0 -19
- package/dist/src/orchestrator/ResultMerger.js.map +0 -1
- package/dist/src/orchestrator/TaskExecutor.d.ts +0 -20
- package/dist/src/orchestrator/TaskExecutor.js +0 -81
- package/dist/src/orchestrator/TaskExecutor.js.map +0 -1
- package/dist/src/orchestrator/TaskScheduler.d.ts +0 -4
- package/dist/src/orchestrator/TaskScheduler.js +0 -19
- package/dist/src/orchestrator/TaskScheduler.js.map +0 -1
- package/dist/src/orchestrator/ValidationRunner.d.ts +0 -4
- package/dist/src/orchestrator/ValidationRunner.js +0 -22
- package/dist/src/orchestrator/ValidationRunner.js.map +0 -1
- package/dist/src/orchestrator/index.d.ts +0 -5
- package/dist/src/orchestrator/index.js +0 -6
- package/dist/src/orchestrator/index.js.map +0 -1
- package/dist/src/output/index.d.ts +0 -1
- package/dist/src/output/index.js +0 -2
- package/dist/src/output/index.js.map +0 -1
- package/dist/src/providers/index.d.ts +0 -3
- package/dist/src/providers/index.js +0 -4
- package/dist/src/providers/index.js.map +0 -1
- package/dist/src/run/index.d.ts +0 -2
- package/dist/src/run/index.js +0 -3
- package/dist/src/run/index.js.map +0 -1
- package/dist/src/session/index.d.ts +0 -2
- package/dist/src/session/index.js +0 -3
- package/dist/src/session/index.js.map +0 -1
- package/dist/src/shared/contracts.d.ts +0 -254
- package/dist/src/shared/contracts.js +0 -2
- package/dist/src/shared/contracts.js.map +0 -1
- package/dist/src/shared/errors.d.ts +0 -9
- package/dist/src/shared/errors.js +0 -11
- package/dist/src/shared/errors.js.map +0 -1
- package/dist/src/shared/index.d.ts +0 -4
- package/dist/src/shared/index.js +0 -5
- package/dist/src/shared/index.js.map +0 -1
- package/dist/src/usecases/CompareUseCase.d.ts +0 -6
- package/dist/src/usecases/CompareUseCase.js +0 -9
- package/dist/src/usecases/CompareUseCase.js.map +0 -1
- package/dist/src/usecases/helpers.d.ts +0 -9
- package/dist/src/usecases/helpers.js +0 -31
- package/dist/src/usecases/helpers.js.map +0 -1
- package/dist/src/usecases/index.d.ts +0 -5
- package/dist/src/usecases/index.js +0 -6
- package/dist/src/usecases/index.js.map +0 -1
|
@@ -1,41 +1,25 @@
|
|
|
1
|
-
import { mkdir,
|
|
2
|
-
import path from
|
|
3
|
-
import { Artifact,
|
|
1
|
+
import { mkdir, stat, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { Artifact, } from "../domain/artifact.js";
|
|
4
|
+
import { defaultClock, defaultIdGenerator, } from "../domain/base.js";
|
|
4
5
|
export class ArtifactRepository {
|
|
5
6
|
storageRoot;
|
|
6
7
|
clock;
|
|
7
8
|
idGenerator;
|
|
8
9
|
constructor(options = {}) {
|
|
9
|
-
this.storageRoot =
|
|
10
|
+
this.storageRoot =
|
|
11
|
+
options.storageRoot ?? path.join(process.cwd(), ".aipanel");
|
|
10
12
|
this.clock = options.clock ?? defaultClock;
|
|
11
13
|
this.idGenerator = options.idGenerator ?? defaultIdGenerator;
|
|
12
14
|
}
|
|
13
|
-
get artifactsDirectory() {
|
|
14
|
-
return path.join(this.storageRoot, 'artifacts');
|
|
15
|
-
}
|
|
16
|
-
runDirectory(runId) {
|
|
17
|
-
return path.join(this.artifactsDirectory, runId ?? '_shared');
|
|
18
|
-
}
|
|
19
|
-
metadataPathFor(artifactId, runId) {
|
|
20
|
-
return path.join(this.runDirectory(runId), `${artifactId}.artifact.json`);
|
|
21
|
-
}
|
|
22
|
-
async saveMetadata(artifact) {
|
|
23
|
-
const metadataPath = artifact.metadataPath ?? this.metadataPathFor(artifact.artifactId, artifact.runId);
|
|
24
|
-
await mkdir(path.dirname(metadataPath), { recursive: true });
|
|
25
|
-
await writeFile(metadataPath, JSON.stringify(artifact.toJSON(), null, 2), 'utf8');
|
|
26
|
-
return Artifact.fromJSON({
|
|
27
|
-
...artifact.toJSON(),
|
|
28
|
-
metadataPath,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
15
|
async writeTextArtifact(params) {
|
|
32
|
-
const artifactId = this.idGenerator(
|
|
33
|
-
const runDirectory = this.
|
|
34
|
-
const extension = params.extension ??
|
|
35
|
-
const contentPath = path.join(runDirectory, `${artifactId}${extension.startsWith(
|
|
36
|
-
const metadataPath =
|
|
16
|
+
const artifactId = this.idGenerator("artifact");
|
|
17
|
+
const runDirectory = path.join(this.storageRoot, "artifacts", params.runId ?? "_shared");
|
|
18
|
+
const extension = params.extension ?? ".txt";
|
|
19
|
+
const contentPath = path.join(runDirectory, `${artifactId}${extension.startsWith(".") ? extension : `.${extension}`}`);
|
|
20
|
+
const metadataPath = path.join(runDirectory, `${artifactId}.artifact.json`);
|
|
37
21
|
await mkdir(runDirectory, { recursive: true });
|
|
38
|
-
await writeFile(contentPath, params.content,
|
|
22
|
+
await writeFile(contentPath, params.content, "utf8");
|
|
39
23
|
const fileStat = await stat(contentPath);
|
|
40
24
|
const artifact = Artifact.create({
|
|
41
25
|
artifactId,
|
|
@@ -44,48 +28,28 @@ export class ArtifactRepository {
|
|
|
44
28
|
metadataPath,
|
|
45
29
|
sizeBytes: fileStat.size,
|
|
46
30
|
createdAt: this.clock(),
|
|
47
|
-
...(params.sessionId !== undefined
|
|
31
|
+
...(params.sessionId !== undefined
|
|
32
|
+
? { sessionId: params.sessionId }
|
|
33
|
+
: {}),
|
|
48
34
|
...(params.runId !== undefined ? { runId: params.runId } : {}),
|
|
49
35
|
...(params.turnId !== undefined ? { turnId: params.turnId } : {}),
|
|
50
36
|
...(params.mimeType !== undefined ? { mimeType: params.mimeType } : {}),
|
|
51
37
|
});
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
const resolvedMetadataPath = artifact.metadataPath ?? metadataPath;
|
|
39
|
+
await mkdir(path.dirname(resolvedMetadataPath), { recursive: true });
|
|
40
|
+
await writeFile(resolvedMetadataPath, JSON.stringify(artifact.toJSON(), null, 2), "utf8");
|
|
41
|
+
return Artifact.fromJSON({
|
|
42
|
+
...artifact.toJSON(),
|
|
43
|
+
metadataPath: resolvedMetadataPath,
|
|
44
|
+
});
|
|
54
45
|
}
|
|
55
46
|
async writeJsonArtifact(params) {
|
|
56
47
|
return this.writeTextArtifact({
|
|
57
48
|
...params,
|
|
58
49
|
content: JSON.stringify(params.content, null, 2),
|
|
59
|
-
extension: params.extension ??
|
|
60
|
-
mimeType:
|
|
50
|
+
extension: params.extension ?? ".json",
|
|
51
|
+
mimeType: "application/json",
|
|
61
52
|
});
|
|
62
53
|
}
|
|
63
|
-
async get(artifactId, runId) {
|
|
64
|
-
try {
|
|
65
|
-
const raw = await readFile(this.metadataPathFor(artifactId, runId), 'utf8');
|
|
66
|
-
const parsed = JSON.parse(raw);
|
|
67
|
-
return Artifact.fromJSON(parsed);
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
if (error.code === 'ENOENT') {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
throw error;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
async listByRun(runId) {
|
|
77
|
-
const directory = this.runDirectory(runId);
|
|
78
|
-
await mkdir(directory, { recursive: true });
|
|
79
|
-
const entries = await readdir(directory, { withFileTypes: true });
|
|
80
|
-
const artifacts = await Promise.all(entries
|
|
81
|
-
.filter((entry) => entry.isFile() && entry.name.endsWith('.artifact.json'))
|
|
82
|
-
.map(async (entry) => {
|
|
83
|
-
const artifactId = entry.name.replace(/\.artifact\.json$/u, '');
|
|
84
|
-
return this.get(artifactId, runId);
|
|
85
|
-
}));
|
|
86
|
-
return artifacts
|
|
87
|
-
.filter((artifact) => Boolean(artifact))
|
|
88
|
-
.sort((left, right) => left.createdAt.localeCompare(right.createdAt));
|
|
89
|
-
}
|
|
90
54
|
}
|
|
91
55
|
//# sourceMappingURL=ArtifactRepository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArtifactRepository.js","sourceRoot":"","sources":["../../../src/artifact/ArtifactRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ArtifactRepository.js","sourceRoot":"","sources":["../../../src/artifact/ArtifactRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,QAAQ,GACT,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,YAAY,EACZ,kBAAkB,GAGnB,MAAM,mBAAmB,CAAC;AAkB3B,MAAM,OAAO,kBAAkB;IACZ,WAAW,CAAS;IACpB,KAAK,CAAQ;IACb,WAAW,CAAc;IAE1C,YAAY,UAAqC,EAAE;QACjD,IAAI,CAAC,WAAW;YACd,OAAO,CAAC,WAAW,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG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AAE,kBAAkB;SAC7B,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/src/cli/aipanel.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { pathToFileURL } from "node:url";
|
|
3
|
-
import { AipanelApp
|
|
3
|
+
import { AipanelApp } from "../app/AipanelApp.js";
|
|
4
|
+
import { CommandRouter } from "../app/CommandRouter.js";
|
|
4
5
|
export async function runCli(argv = process.argv.slice(2), output = process) {
|
|
5
6
|
const app = new AipanelApp();
|
|
6
7
|
const router = new CommandRouter(app);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aipanel.js","sourceRoot":"","sources":["../../../src/cli/aipanel.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"aipanel.js","sourceRoot":"","sources":["../../../src/cli/aipanel.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,OAAiB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EACtC,SAAoD,OAAO;IAE3D,MAAM,GAAG,GAAG,IAAI,UAAU,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC;IAEtC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,CAAC,MAAM,CAAC,KAAK,CACjB,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,IAAI,CACpE,CAAC;QACF,OAAO,MAAM,CAAC,QAAQ,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;QACpC,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,OAAO,MAAM,EAAE,CAAC;AAClB,CAAC;AAED,SAAS,iBAAiB;IACxB,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;AAC5D,CAAC;AAED,IAAI,iBAAiB,EAAE,EAAE,CAAC;IACxB,MAAM,QAAQ,GAAG,MAAM,IAAI,EAAE,CAAC;IAC9B,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import type { ComparisonReportData } from "../shared/contracts.js";
|
|
2
1
|
import type { NormalizedResponseLike } from "./ResponseNormalizer.js";
|
|
2
|
+
interface ComparisonReportData {
|
|
3
|
+
reportId: string | null;
|
|
4
|
+
runId: string | null;
|
|
5
|
+
topic: string;
|
|
6
|
+
responseIds: string[];
|
|
7
|
+
agreements: string[];
|
|
8
|
+
differences: string[];
|
|
9
|
+
recommendation: string | null;
|
|
10
|
+
}
|
|
3
11
|
export declare class ComparisonEngine {
|
|
4
12
|
compare(topic: string, normalizedResponses: NormalizedResponseLike[]): ComparisonReportData;
|
|
5
13
|
}
|
|
14
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComparisonEngine.js","sourceRoot":"","sources":["../../../src/compare/ComparisonEngine.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ComparisonEngine.js","sourceRoot":"","sources":["../../../src/compare/ComparisonEngine.ts"],"names":[],"mappings":"AAYA,MAAM,OAAO,gBAAgB;IAC3B,OAAO,CACL,KAAa,EACb,mBAA6C;QAE7C,MAAM,SAAS,GAAG,mBAAmB;aAClC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;aACnC,MAAM,CAAC,OAAO,CAAC,CAAC;QAEnB,MAAM,QAAQ,GAAG,mBAAmB,CAAC,OAAO,CAC1C,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,IAAI,EAAE,CACtC,CAAC;QACF,MAAM,cAAc,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;QAE9C,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,IAAI;YACX,KAAK;YACL,WAAW,EAAE,mBAAmB,CAAC,GAAG,CAClC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAC5C;YACD,UAAU,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;YACjD,WAAW,EAAE,mBAAmB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;YACjE,cAAc,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,8BAA8B;SAC/D,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
interface ProviderResponseLike {
|
|
2
2
|
normalizedResponseId?: string;
|
|
3
3
|
provider: string;
|
|
4
4
|
rawText?: string;
|
|
@@ -29,8 +29,9 @@ export interface NormalizedResponseLike {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
export declare class ResponseNormalizer {
|
|
32
|
-
normalize({ taskId, providerResponse }: {
|
|
32
|
+
normalize({ taskId, providerResponse, }: {
|
|
33
33
|
taskId: string;
|
|
34
34
|
providerResponse: ProviderResponseLike;
|
|
35
35
|
}): NormalizedResponseLike;
|
|
36
36
|
}
|
|
37
|
+
export {};
|
|
@@ -10,7 +10,9 @@ function extractSummary(lines) {
|
|
|
10
10
|
function extractFindings(lines) {
|
|
11
11
|
const bulletLike = lines.filter((line) => /^([-*]|\d+\.)\s+/.test(line));
|
|
12
12
|
if (bulletLike.length > 0) {
|
|
13
|
-
return bulletLike
|
|
13
|
+
return bulletLike
|
|
14
|
+
.slice(0, 8)
|
|
15
|
+
.map((line) => line.replace(/^([-*]|\d+\.)\s+/, "").trim());
|
|
14
16
|
}
|
|
15
17
|
return lines.slice(0, 5);
|
|
16
18
|
}
|
|
@@ -20,7 +22,7 @@ function extractSuggestions(lines) {
|
|
|
20
22
|
.slice(0, 5);
|
|
21
23
|
}
|
|
22
24
|
export class ResponseNormalizer {
|
|
23
|
-
normalize({ taskId, providerResponse }) {
|
|
25
|
+
normalize({ taskId, providerResponse, }) {
|
|
24
26
|
const text = providerResponse.rawText ?? "";
|
|
25
27
|
const lines = extractLines(text);
|
|
26
28
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponseNormalizer.js","sourceRoot":"","sources":["../../../src/compare/ResponseNormalizer.ts"],"names":[],"mappings":"AAgCA,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,IAAI;SACR,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC1B,MAAM,CAAC,OAAO,CAAC,CAAC;A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
5
|
absolutePath: string;
|
|
6
6
|
purpose: ContextEntryKind;
|
|
@@ -23,7 +23,7 @@ export interface ContextBundleLike {
|
|
|
23
23
|
collectedAt: string;
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
interface ContextCollectInput {
|
|
27
27
|
question?: string;
|
|
28
28
|
files?: string[];
|
|
29
29
|
diffs?: string[];
|
|
@@ -34,10 +34,11 @@ export declare class ContextCollector {
|
|
|
34
34
|
#private;
|
|
35
35
|
readonly cwd: string;
|
|
36
36
|
readonly clock: typeof systemClock;
|
|
37
|
-
constructor({ cwd, clock }?: {
|
|
37
|
+
constructor({ cwd, clock, }?: {
|
|
38
38
|
cwd?: string;
|
|
39
39
|
clock?: typeof systemClock;
|
|
40
40
|
});
|
|
41
41
|
collect({ question, files, diffs, logs, cwd, }?: ContextCollectInput): Promise<ContextBundleLike>;
|
|
42
42
|
formatForPrompt(contextBundle: ContextBundleLike): string;
|
|
43
43
|
}
|
|
44
|
+
export {};
|
|
@@ -14,12 +14,14 @@ function summarizeCollection(files, diffs, logs) {
|
|
|
14
14
|
parts.push(`${diffs.length} diffs`);
|
|
15
15
|
if (logs.length > 0)
|
|
16
16
|
parts.push(`${logs.length} logs`);
|
|
17
|
-
return parts.length > 0
|
|
17
|
+
return parts.length > 0
|
|
18
|
+
? `Collected ${parts.join(", ")}.`
|
|
19
|
+
: "No external context was collected.";
|
|
18
20
|
}
|
|
19
21
|
export class ContextCollector {
|
|
20
22
|
cwd;
|
|
21
23
|
clock;
|
|
22
|
-
constructor({ cwd = process.cwd(), clock = systemClock } = {}) {
|
|
24
|
+
constructor({ cwd = process.cwd(), clock = systemClock, } = {}) {
|
|
23
25
|
this.cwd = cwd;
|
|
24
26
|
this.clock = clock;
|
|
25
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextCollector.js","sourceRoot":"","sources":["../../../src/context/ContextCollector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UA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,CAAC;gBACX,IAAI,EAAE,OAAO;gBACb,YAAY;gBACZ,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE,IAAI;gBACZ,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC;gBAC9B,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;gBAC/B,OAAO,EAAE,GAAG,IAAI,SAAS,OAAO,EAAE;gBAClC,OAAO;aACR,CAAC,CAAC;QACL,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Clock, type IdGenerator, type IsoDateString } from "./base.js";
|
|
2
|
-
|
|
2
|
+
interface ArtifactProps {
|
|
3
3
|
schemaVersion?: number;
|
|
4
4
|
artifactId: string;
|
|
5
5
|
kind: string;
|
|
@@ -25,7 +25,7 @@ export declare class Artifact {
|
|
|
25
25
|
readonly mimeType: string | null;
|
|
26
26
|
readonly sizeBytes: number | null;
|
|
27
27
|
constructor(props: ArtifactProps);
|
|
28
|
-
static create(params: Omit<ArtifactProps,
|
|
28
|
+
static create(params: Omit<ArtifactProps, "artifactId" | "createdAt"> & {
|
|
29
29
|
artifactId?: string;
|
|
30
30
|
createdAt?: IsoDateString;
|
|
31
31
|
clock?: Clock;
|
|
@@ -34,3 +34,4 @@ export declare class Artifact {
|
|
|
34
34
|
static fromJSON(input: ArtifactProps): Artifact;
|
|
35
35
|
toJSON(): ArtifactProps;
|
|
36
36
|
}
|
|
37
|
+
export {};
|
|
@@ -28,16 +28,16 @@ export class Artifact {
|
|
|
28
28
|
const clock = params.clock ?? defaultClock;
|
|
29
29
|
const idGenerator = params.idGenerator ?? defaultIdGenerator;
|
|
30
30
|
return new Artifact({
|
|
31
|
-
artifactId: params.artifactId ?? idGenerator(
|
|
31
|
+
artifactId: params.artifactId ?? idGenerator("artifact"),
|
|
32
32
|
kind: params.kind,
|
|
33
33
|
path: params.path,
|
|
34
34
|
createdAt: params.createdAt ?? clock(),
|
|
35
|
-
...optionalProp(
|
|
36
|
-
...optionalProp(
|
|
37
|
-
...optionalProp(
|
|
38
|
-
...optionalProp(
|
|
39
|
-
...optionalProp(
|
|
40
|
-
...optionalProp(
|
|
35
|
+
...optionalProp("sessionId", params.sessionId),
|
|
36
|
+
...optionalProp("runId", params.runId),
|
|
37
|
+
...optionalProp("turnId", params.turnId),
|
|
38
|
+
...optionalProp("metadataPath", params.metadataPath),
|
|
39
|
+
...optionalProp("mimeType", params.mimeType),
|
|
40
|
+
...optionalProp("sizeBytes", params.sizeBytes),
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
static fromJSON(input) {
|
|
@@ -5,6 +5,5 @@ export type IdGenerator = (prefix: string) => string;
|
|
|
5
5
|
export declare const defaultClock: Clock;
|
|
6
6
|
export declare const defaultIdGenerator: IdGenerator;
|
|
7
7
|
export declare function ensureArray<T>(value: T[] | null | undefined): T[];
|
|
8
|
-
export declare function coerceRecord(value: unknown): Record<string, unknown>;
|
|
9
8
|
export declare function compactObject<T extends Record<string, unknown>>(value: T): T;
|
|
10
9
|
export declare function optionalProp<K extends string, V>(key: K, value: V | undefined): Partial<Record<K, V>>;
|
package/dist/src/domain/base.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import crypto from
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
2
|
export const SCHEMA_VERSION = 1;
|
|
3
3
|
export const defaultClock = () => new Date().toISOString();
|
|
4
4
|
export const defaultIdGenerator = (prefix) => `${prefix}_${crypto.randomUUID()}`;
|
|
5
5
|
export function ensureArray(value) {
|
|
6
6
|
return Array.isArray(value) ? value : [];
|
|
7
7
|
}
|
|
8
|
-
export function coerceRecord(value) {
|
|
9
|
-
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
10
|
-
return {};
|
|
11
|
-
}
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
14
8
|
export function compactObject(value) {
|
|
15
9
|
return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== undefined));
|
|
16
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/domain/base.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAU,CAAC;AAMzC,MAAM,CAAC,MAAM,YAAY,GAAU,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAClE,MAAM,CAAC,MAAM,kBAAkB,GAAgB,CAAC,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/domain/base.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAU,CAAC;AAMzC,MAAM,CAAC,MAAM,YAAY,GAAU,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAClE,MAAM,CAAC,MAAM,kBAAkB,GAAgB,CAAC,MAAM,EAAE,EAAE,CACxD,GAAG,MAAM,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;AAErC,MAAM,UAAU,WAAW,CAAI,KAA6B;IAC1D,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,aAAa,CAAoC,KAAQ;IACvE,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAC1D,CAAC;AACT,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,GAAM,EACN,KAAoB;IAEpB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAA2B,CAAC;AACnD,CAAC"}
|
package/dist/src/domain/run.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Clock, type IdGenerator, type IsoDateString } from "./base.js";
|
|
2
2
|
import { Citation, ConfidenceScore, DiffRef, ExternalRef, FileRef, LogRef, TaskDependency, Usage, type CitationProps, type ConfidenceScoreProps, type DiffRefProps, type ExternalRefProps, type FileRefProps, type LogRefProps, type TaskDependencyProps, type UsageProps } from "./value-objects.js";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type RunStatus = "created" | "planned" | "running" | "completed" | "partial";
|
|
4
|
+
type TaskStatus = "created" | "queued" | "running" | "completed" | "failed" | "skipped" | "partial";
|
|
5
5
|
export interface RunTaskProps {
|
|
6
6
|
taskId: string;
|
|
7
7
|
runId: string;
|
|
@@ -26,7 +26,7 @@ export declare class RunTask {
|
|
|
26
26
|
readonly createdAt: IsoDateString;
|
|
27
27
|
updatedAt: IsoDateString;
|
|
28
28
|
constructor(props: RunTaskProps);
|
|
29
|
-
static create(params: Omit<RunTaskProps,
|
|
29
|
+
static create(params: Omit<RunTaskProps, "taskId" | "createdAt" | "updatedAt"> & {
|
|
30
30
|
taskId?: string;
|
|
31
31
|
createdAt?: IsoDateString;
|
|
32
32
|
updatedAt?: IsoDateString;
|
|
@@ -57,7 +57,7 @@ export declare class TaskResult {
|
|
|
57
57
|
readonly sourceArtifactIds: string[];
|
|
58
58
|
readonly createdAt: IsoDateString;
|
|
59
59
|
constructor(props: TaskResultProps);
|
|
60
|
-
static create(params: Omit<TaskResultProps,
|
|
60
|
+
static create(params: Omit<TaskResultProps, "resultId" | "createdAt"> & {
|
|
61
61
|
resultId?: string;
|
|
62
62
|
createdAt?: IsoDateString;
|
|
63
63
|
clock?: Clock;
|
|
@@ -86,7 +86,7 @@ export declare class ContextBundle {
|
|
|
86
86
|
readonly metadata: Record<string, unknown>;
|
|
87
87
|
readonly createdAt: IsoDateString;
|
|
88
88
|
constructor(props: ContextBundleProps);
|
|
89
|
-
static create(params: Omit<ContextBundleProps,
|
|
89
|
+
static create(params: Omit<ContextBundleProps, "contextId" | "createdAt"> & {
|
|
90
90
|
contextId?: string;
|
|
91
91
|
createdAt?: IsoDateString;
|
|
92
92
|
clock?: Clock;
|
|
@@ -99,6 +99,7 @@ export interface ProviderResponseProps {
|
|
|
99
99
|
responseId: string;
|
|
100
100
|
taskId: string;
|
|
101
101
|
provider: string;
|
|
102
|
+
model: string;
|
|
102
103
|
rawTextRef?: string | null;
|
|
103
104
|
rawJsonRef?: string | null;
|
|
104
105
|
usage?: UsageProps | null;
|
|
@@ -110,6 +111,7 @@ export declare class ProviderResponse {
|
|
|
110
111
|
readonly responseId: string;
|
|
111
112
|
readonly taskId: string;
|
|
112
113
|
readonly provider: string;
|
|
114
|
+
readonly model: string;
|
|
113
115
|
readonly rawTextRef: string | null;
|
|
114
116
|
readonly rawJsonRef: string | null;
|
|
115
117
|
readonly usage: Usage | null;
|
|
@@ -117,7 +119,7 @@ export declare class ProviderResponse {
|
|
|
117
119
|
readonly externalRefs: ExternalRef[];
|
|
118
120
|
readonly createdAt: IsoDateString;
|
|
119
121
|
constructor(props: ProviderResponseProps);
|
|
120
|
-
static create(params: Omit<ProviderResponseProps,
|
|
122
|
+
static create(params: Omit<ProviderResponseProps, "responseId" | "createdAt"> & {
|
|
121
123
|
responseId?: string;
|
|
122
124
|
createdAt?: IsoDateString;
|
|
123
125
|
clock?: Clock;
|
|
@@ -148,7 +150,7 @@ export declare class NormalizedResponse {
|
|
|
148
150
|
readonly confidence: ConfidenceScore | null;
|
|
149
151
|
readonly createdAt: IsoDateString;
|
|
150
152
|
constructor(props: NormalizedResponseProps);
|
|
151
|
-
static create(params: Omit<NormalizedResponseProps,
|
|
153
|
+
static create(params: Omit<NormalizedResponseProps, "normalizedResponseId" | "createdAt"> & {
|
|
152
154
|
normalizedResponseId?: string;
|
|
153
155
|
createdAt?: IsoDateString;
|
|
154
156
|
clock?: Clock;
|
|
@@ -177,7 +179,7 @@ export declare class ComparisonReport {
|
|
|
177
179
|
readonly recommendation: string | null;
|
|
178
180
|
readonly createdAt: IsoDateString;
|
|
179
181
|
constructor(props: ComparisonReportProps);
|
|
180
|
-
static create(params: Omit<ComparisonReportProps,
|
|
182
|
+
static create(params: Omit<ComparisonReportProps, "reportId" | "createdAt"> & {
|
|
181
183
|
reportId?: string;
|
|
182
184
|
createdAt?: IsoDateString;
|
|
183
185
|
clock?: Clock;
|
|
@@ -193,13 +195,10 @@ export interface RunProps {
|
|
|
193
195
|
command: string;
|
|
194
196
|
mode: string;
|
|
195
197
|
status: RunStatus;
|
|
196
|
-
planVersion: string;
|
|
197
198
|
createdAt: IsoDateString;
|
|
198
199
|
updatedAt: IsoDateString;
|
|
199
|
-
plan?: Record<string, unknown> | null;
|
|
200
200
|
finalSummary?: string | null;
|
|
201
201
|
validationStatus?: string | null;
|
|
202
|
-
errorMessage?: string | null;
|
|
203
202
|
tasks?: RunTaskProps[];
|
|
204
203
|
taskResults?: TaskResultProps[];
|
|
205
204
|
contextBundles?: ContextBundleProps[];
|
|
@@ -214,13 +213,10 @@ export declare class Run {
|
|
|
214
213
|
readonly command: string;
|
|
215
214
|
readonly mode: string;
|
|
216
215
|
status: RunStatus;
|
|
217
|
-
readonly planVersion: string;
|
|
218
216
|
readonly createdAt: IsoDateString;
|
|
219
217
|
updatedAt: IsoDateString;
|
|
220
|
-
plan: Record<string, unknown> | null;
|
|
221
218
|
finalSummary: string | null;
|
|
222
219
|
validationStatus: string | null;
|
|
223
|
-
errorMessage: string | null;
|
|
224
220
|
tasks: RunTask[];
|
|
225
221
|
taskResults: TaskResult[];
|
|
226
222
|
contextBundles: ContextBundle[];
|
|
@@ -234,15 +230,12 @@ export declare class Run {
|
|
|
234
230
|
command: string;
|
|
235
231
|
mode?: string;
|
|
236
232
|
status?: RunStatus;
|
|
237
|
-
planVersion?: string;
|
|
238
|
-
plan?: Record<string, unknown> | null;
|
|
239
233
|
createdAt?: IsoDateString;
|
|
240
234
|
updatedAt?: IsoDateString;
|
|
241
235
|
clock?: Clock;
|
|
242
236
|
idGenerator?: IdGenerator;
|
|
243
237
|
}): Run;
|
|
244
238
|
static fromJSON(input: RunProps): Run;
|
|
245
|
-
setPlan(plan: Record<string, unknown> | null, updatedAt?: IsoDateString): void;
|
|
246
239
|
transition(status: RunStatus, updatedAt?: IsoDateString): void;
|
|
247
240
|
addTask(task: RunTask, updatedAt?: IsoDateString): void;
|
|
248
241
|
addTaskResult(taskResult: TaskResult, updatedAt?: IsoDateString): void;
|
|
@@ -250,11 +243,6 @@ export declare class Run {
|
|
|
250
243
|
addProviderResponse(providerResponse: ProviderResponse, updatedAt?: IsoDateString): void;
|
|
251
244
|
addNormalizedResponse(normalizedResponse: NormalizedResponse, updatedAt?: IsoDateString): void;
|
|
252
245
|
addComparisonReport(comparisonReport: ComparisonReport, updatedAt?: IsoDateString): void;
|
|
253
|
-
complete(params?: {
|
|
254
|
-
finalSummary?: string | null;
|
|
255
|
-
validationStatus?: string | null;
|
|
256
|
-
updatedAt?: IsoDateString;
|
|
257
|
-
}): void;
|
|
258
|
-
fail(message: string, status?: RunStatus, updatedAt?: IsoDateString): void;
|
|
259
246
|
toJSON(): RunProps;
|
|
260
247
|
}
|
|
248
|
+
export {};
|