aipanel-cli 0.1.3 → 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 +61 -41
- 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 +19 -7
- package/dist/src/app/CommandRouter.js.map +1 -1
- package/dist/src/app/ProfileLoader.d.ts +3 -3
- package/dist/src/app/ProfileLoader.js +3 -6
- 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 +9 -23
- package/dist/src/domain/run.js +55 -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.map +1 -1
- package/dist/src/providers/ClaudeCodeAdapter.d.ts +1 -0
- package/dist/src/providers/ClaudeCodeAdapter.js +1 -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 +1 -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 +2 -1
- package/dist/src/usecases/ConsultUseCase.js +8 -8
- package/dist/src/usecases/ConsultUseCase.js.map +1 -1
- package/dist/src/usecases/DebugUseCase.js +20 -8
- 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 -256
- 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
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,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AC;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;AACrB,CAAC;AAED,SAAS,cAAc,CAAC,KAAe;IACrC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5C,CAAC;AAED,SAAS,eAAe,CAAC,KAAe;IACtC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACzE,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,UAAU,
|
|
1
|
+
{"version":3,"file":"ResponseNormalizer.js","sourceRoot":"","sources":["../../../src/compare/ResponseNormalizer.ts"],"names":[],"mappings":"AAgCA,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,IAAI;S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B,CAAC,oBAAoB,IAAI,GAAG,MAAM,aAAa;YACjE,MAAM;YACN,QAAQ,EAAE,gBAAgB,CAAC,QAAQ;YACnC,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC;YAC9B,QAAQ,EAAE,eAAe,CAAC,KAAK,CAAC;YAChC,WAAW,EAAE,kBAAkB,CAAC,KAAK,CAAC;YACtC,SAAS,EAAE,gBAAgB,CAAC,SAAS,IAAI,EAAE;YAC3C,UAAU,EAAE;gBACV,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ;gBAClD,MAAM,EAAE,gBAAgB,CAAC,OAAO;oBAC9B,CAAC,CAAC,wCAAwC;oBAC1C,CAAC,CAAC,oCAAoC;aACzC;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { systemClock } from "../shared/clock.js";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type ContextEntryKind = "file" | "diff" | "log";
|
|
3
|
+
interface ContextEntry {
|
|
4
4
|
path: string;
|
|
5
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,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAqCpD,SAAS,WAAW,CAAC,OAAe;IAClC,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,mBAAmB,
|
|
1
|
+
{"version":3,"file":"ContextCollector.js","sourceRoot":"","sources":["../../../src/context/ContextCollector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAA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YAC7C,QAAQ,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QACvD,CAAC;QAED,KAAK,MAAM,GAAG,IAAI,aAAa,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;YAC3C,QAAQ,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACpD,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,KAAe,EACf,IAAsB,EACtB,GAAW;QAEX,MAAM,OAAO,GAAmB,EAAE,CAAC;QAEnC,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE,CAAC;YAC5B,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YAC3C,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YACrD,OAAO,CAAC,IAAI,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;
|
|
@@ -119,7 +119,7 @@ export declare class ProviderResponse {
|
|
|
119
119
|
readonly externalRefs: ExternalRef[];
|
|
120
120
|
readonly createdAt: IsoDateString;
|
|
121
121
|
constructor(props: ProviderResponseProps);
|
|
122
|
-
static create(params: Omit<ProviderResponseProps,
|
|
122
|
+
static create(params: Omit<ProviderResponseProps, "responseId" | "createdAt"> & {
|
|
123
123
|
responseId?: string;
|
|
124
124
|
createdAt?: IsoDateString;
|
|
125
125
|
clock?: Clock;
|
|
@@ -150,7 +150,7 @@ export declare class NormalizedResponse {
|
|
|
150
150
|
readonly confidence: ConfidenceScore | null;
|
|
151
151
|
readonly createdAt: IsoDateString;
|
|
152
152
|
constructor(props: NormalizedResponseProps);
|
|
153
|
-
static create(params: Omit<NormalizedResponseProps,
|
|
153
|
+
static create(params: Omit<NormalizedResponseProps, "normalizedResponseId" | "createdAt"> & {
|
|
154
154
|
normalizedResponseId?: string;
|
|
155
155
|
createdAt?: IsoDateString;
|
|
156
156
|
clock?: Clock;
|
|
@@ -179,7 +179,7 @@ export declare class ComparisonReport {
|
|
|
179
179
|
readonly recommendation: string | null;
|
|
180
180
|
readonly createdAt: IsoDateString;
|
|
181
181
|
constructor(props: ComparisonReportProps);
|
|
182
|
-
static create(params: Omit<ComparisonReportProps,
|
|
182
|
+
static create(params: Omit<ComparisonReportProps, "reportId" | "createdAt"> & {
|
|
183
183
|
reportId?: string;
|
|
184
184
|
createdAt?: IsoDateString;
|
|
185
185
|
clock?: Clock;
|
|
@@ -195,13 +195,10 @@ export interface RunProps {
|
|
|
195
195
|
command: string;
|
|
196
196
|
mode: string;
|
|
197
197
|
status: RunStatus;
|
|
198
|
-
planVersion: string;
|
|
199
198
|
createdAt: IsoDateString;
|
|
200
199
|
updatedAt: IsoDateString;
|
|
201
|
-
plan?: Record<string, unknown> | null;
|
|
202
200
|
finalSummary?: string | null;
|
|
203
201
|
validationStatus?: string | null;
|
|
204
|
-
errorMessage?: string | null;
|
|
205
202
|
tasks?: RunTaskProps[];
|
|
206
203
|
taskResults?: TaskResultProps[];
|
|
207
204
|
contextBundles?: ContextBundleProps[];
|
|
@@ -216,13 +213,10 @@ export declare class Run {
|
|
|
216
213
|
readonly command: string;
|
|
217
214
|
readonly mode: string;
|
|
218
215
|
status: RunStatus;
|
|
219
|
-
readonly planVersion: string;
|
|
220
216
|
readonly createdAt: IsoDateString;
|
|
221
217
|
updatedAt: IsoDateString;
|
|
222
|
-
plan: Record<string, unknown> | null;
|
|
223
218
|
finalSummary: string | null;
|
|
224
219
|
validationStatus: string | null;
|
|
225
|
-
errorMessage: string | null;
|
|
226
220
|
tasks: RunTask[];
|
|
227
221
|
taskResults: TaskResult[];
|
|
228
222
|
contextBundles: ContextBundle[];
|
|
@@ -236,15 +230,12 @@ export declare class Run {
|
|
|
236
230
|
command: string;
|
|
237
231
|
mode?: string;
|
|
238
232
|
status?: RunStatus;
|
|
239
|
-
planVersion?: string;
|
|
240
|
-
plan?: Record<string, unknown> | null;
|
|
241
233
|
createdAt?: IsoDateString;
|
|
242
234
|
updatedAt?: IsoDateString;
|
|
243
235
|
clock?: Clock;
|
|
244
236
|
idGenerator?: IdGenerator;
|
|
245
237
|
}): Run;
|
|
246
238
|
static fromJSON(input: RunProps): Run;
|
|
247
|
-
setPlan(plan: Record<string, unknown> | null, updatedAt?: IsoDateString): void;
|
|
248
239
|
transition(status: RunStatus, updatedAt?: IsoDateString): void;
|
|
249
240
|
addTask(task: RunTask, updatedAt?: IsoDateString): void;
|
|
250
241
|
addTaskResult(taskResult: TaskResult, updatedAt?: IsoDateString): void;
|
|
@@ -252,11 +243,6 @@ export declare class Run {
|
|
|
252
243
|
addProviderResponse(providerResponse: ProviderResponse, updatedAt?: IsoDateString): void;
|
|
253
244
|
addNormalizedResponse(normalizedResponse: NormalizedResponse, updatedAt?: IsoDateString): void;
|
|
254
245
|
addComparisonReport(comparisonReport: ComparisonReport, updatedAt?: IsoDateString): void;
|
|
255
|
-
complete(params?: {
|
|
256
|
-
finalSummary?: string | null;
|
|
257
|
-
validationStatus?: string | null;
|
|
258
|
-
updatedAt?: IsoDateString;
|
|
259
|
-
}): void;
|
|
260
|
-
fail(message: string, status?: RunStatus, updatedAt?: IsoDateString): void;
|
|
261
246
|
toJSON(): RunProps;
|
|
262
247
|
}
|
|
248
|
+
export {};
|
package/dist/src/domain/run.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SCHEMA_VERSION, compactObject, defaultClock, defaultIdGenerator, ensureArray,
|
|
1
|
+
import { SCHEMA_VERSION, compactObject, defaultClock, defaultIdGenerator, ensureArray, } from "./base.js";
|
|
2
2
|
import { Citation, ConfidenceScore, DiffRef, ExternalRef, FileRef, LogRef, TaskDependency, Usage, } from "./value-objects.js";
|
|
3
3
|
export class RunTask {
|
|
4
4
|
taskId;
|
|
@@ -29,7 +29,7 @@ export class RunTask {
|
|
|
29
29
|
const createdAt = params.createdAt ?? clock();
|
|
30
30
|
const updatedAt = params.updatedAt ?? createdAt;
|
|
31
31
|
return new RunTask({
|
|
32
|
-
taskId: params.taskId ?? idGenerator(
|
|
32
|
+
taskId: params.taskId ?? idGenerator("task"),
|
|
33
33
|
runId: params.runId,
|
|
34
34
|
taskKind: params.taskKind,
|
|
35
35
|
role: params.role,
|
|
@@ -37,7 +37,9 @@ export class RunTask {
|
|
|
37
37
|
createdAt,
|
|
38
38
|
updatedAt,
|
|
39
39
|
...(params.provider !== undefined ? { provider: params.provider } : {}),
|
|
40
|
-
...(params.dependsOn !== undefined
|
|
40
|
+
...(params.dependsOn !== undefined
|
|
41
|
+
? { dependsOn: params.dependsOn }
|
|
42
|
+
: {}),
|
|
41
43
|
...(params.input !== undefined ? { input: params.input } : {}),
|
|
42
44
|
});
|
|
43
45
|
}
|
|
@@ -86,14 +88,20 @@ export class TaskResult {
|
|
|
86
88
|
const clock = params.clock ?? defaultClock;
|
|
87
89
|
const idGenerator = params.idGenerator ?? defaultIdGenerator;
|
|
88
90
|
return new TaskResult({
|
|
89
|
-
resultId: params.resultId ?? idGenerator(
|
|
91
|
+
resultId: params.resultId ?? idGenerator("result"),
|
|
90
92
|
taskId: params.taskId,
|
|
91
93
|
summary: params.summary,
|
|
92
94
|
createdAt: params.createdAt ?? clock(),
|
|
93
95
|
...(params.findings !== undefined ? { findings: params.findings } : {}),
|
|
94
|
-
...(params.citations !== undefined
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
...(params.citations !== undefined
|
|
97
|
+
? { citations: params.citations }
|
|
98
|
+
: {}),
|
|
99
|
+
...(params.confidence !== undefined
|
|
100
|
+
? { confidence: params.confidence }
|
|
101
|
+
: {}),
|
|
102
|
+
...(params.sourceArtifactIds !== undefined
|
|
103
|
+
? { sourceArtifactIds: params.sourceArtifactIds }
|
|
104
|
+
: {}),
|
|
97
105
|
});
|
|
98
106
|
}
|
|
99
107
|
static fromJSON(input) {
|
|
@@ -135,7 +143,7 @@ export class ContextBundle {
|
|
|
135
143
|
const clock = params.clock ?? defaultClock;
|
|
136
144
|
const idGenerator = params.idGenerator ?? defaultIdGenerator;
|
|
137
145
|
return new ContextBundle({
|
|
138
|
-
contextId: params.contextId ?? idGenerator(
|
|
146
|
+
contextId: params.contextId ?? idGenerator("context"),
|
|
139
147
|
runId: params.runId,
|
|
140
148
|
summary: params.summary,
|
|
141
149
|
createdAt: params.createdAt ?? clock(),
|
|
@@ -188,16 +196,24 @@ export class ProviderResponse {
|
|
|
188
196
|
const clock = params.clock ?? defaultClock;
|
|
189
197
|
const idGenerator = params.idGenerator ?? defaultIdGenerator;
|
|
190
198
|
return new ProviderResponse({
|
|
191
|
-
responseId: params.responseId ?? idGenerator(
|
|
199
|
+
responseId: params.responseId ?? idGenerator("provider_response"),
|
|
192
200
|
taskId: params.taskId,
|
|
193
201
|
provider: params.provider,
|
|
194
202
|
model: params.model,
|
|
195
203
|
createdAt: params.createdAt ?? clock(),
|
|
196
|
-
...(params.rawTextRef !== undefined
|
|
197
|
-
|
|
204
|
+
...(params.rawTextRef !== undefined
|
|
205
|
+
? { rawTextRef: params.rawTextRef }
|
|
206
|
+
: {}),
|
|
207
|
+
...(params.rawJsonRef !== undefined
|
|
208
|
+
? { rawJsonRef: params.rawJsonRef }
|
|
209
|
+
: {}),
|
|
198
210
|
...(params.usage !== undefined ? { usage: params.usage } : {}),
|
|
199
|
-
...(params.latencyMs !== undefined
|
|
200
|
-
|
|
211
|
+
...(params.latencyMs !== undefined
|
|
212
|
+
? { latencyMs: params.latencyMs }
|
|
213
|
+
: {}),
|
|
214
|
+
...(params.externalRefs !== undefined
|
|
215
|
+
? { externalRefs: params.externalRefs }
|
|
216
|
+
: {}),
|
|
201
217
|
});
|
|
202
218
|
}
|
|
203
219
|
static fromJSON(input) {
|
|
@@ -243,15 +259,21 @@ export class NormalizedResponse {
|
|
|
243
259
|
const clock = params.clock ?? defaultClock;
|
|
244
260
|
const idGenerator = params.idGenerator ?? defaultIdGenerator;
|
|
245
261
|
return new NormalizedResponse({
|
|
246
|
-
normalizedResponseId: params.normalizedResponseId ?? idGenerator(
|
|
262
|
+
normalizedResponseId: params.normalizedResponseId ?? idGenerator("normalized_response"),
|
|
247
263
|
taskId: params.taskId,
|
|
248
264
|
provider: params.provider,
|
|
249
265
|
summary: params.summary,
|
|
250
266
|
createdAt: params.createdAt ?? clock(),
|
|
251
267
|
...(params.findings !== undefined ? { findings: params.findings } : {}),
|
|
252
|
-
...(params.suggestions !== undefined
|
|
253
|
-
|
|
254
|
-
|
|
268
|
+
...(params.suggestions !== undefined
|
|
269
|
+
? { suggestions: params.suggestions }
|
|
270
|
+
: {}),
|
|
271
|
+
...(params.citations !== undefined
|
|
272
|
+
? { citations: params.citations }
|
|
273
|
+
: {}),
|
|
274
|
+
...(params.confidence !== undefined
|
|
275
|
+
? { confidence: params.confidence }
|
|
276
|
+
: {}),
|
|
255
277
|
});
|
|
256
278
|
}
|
|
257
279
|
static fromJSON(input) {
|
|
@@ -294,14 +316,22 @@ export class ComparisonReport {
|
|
|
294
316
|
const clock = params.clock ?? defaultClock;
|
|
295
317
|
const idGenerator = params.idGenerator ?? defaultIdGenerator;
|
|
296
318
|
return new ComparisonReport({
|
|
297
|
-
reportId: params.reportId ?? idGenerator(
|
|
319
|
+
reportId: params.reportId ?? idGenerator("comparison_report"),
|
|
298
320
|
runId: params.runId,
|
|
299
321
|
topic: params.topic,
|
|
300
322
|
createdAt: params.createdAt ?? clock(),
|
|
301
|
-
...(params.responseIds !== undefined
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
...(params.
|
|
323
|
+
...(params.responseIds !== undefined
|
|
324
|
+
? { responseIds: params.responseIds }
|
|
325
|
+
: {}),
|
|
326
|
+
...(params.agreements !== undefined
|
|
327
|
+
? { agreements: params.agreements }
|
|
328
|
+
: {}),
|
|
329
|
+
...(params.differences !== undefined
|
|
330
|
+
? { differences: params.differences }
|
|
331
|
+
: {}),
|
|
332
|
+
...(params.recommendation !== undefined
|
|
333
|
+
? { recommendation: params.recommendation }
|
|
334
|
+
: {}),
|
|
305
335
|
});
|
|
306
336
|
}
|
|
307
337
|
static fromJSON(input) {
|
|
@@ -327,13 +357,10 @@ export class Run {
|
|
|
327
357
|
command;
|
|
328
358
|
mode;
|
|
329
359
|
status;
|
|
330
|
-
planVersion;
|
|
331
360
|
createdAt;
|
|
332
361
|
updatedAt;
|
|
333
|
-
plan;
|
|
334
362
|
finalSummary;
|
|
335
363
|
validationStatus;
|
|
336
|
-
errorMessage;
|
|
337
364
|
tasks;
|
|
338
365
|
taskResults;
|
|
339
366
|
contextBundles;
|
|
@@ -347,13 +374,10 @@ export class Run {
|
|
|
347
374
|
this.command = props.command;
|
|
348
375
|
this.mode = props.mode;
|
|
349
376
|
this.status = props.status;
|
|
350
|
-
this.planVersion = props.planVersion;
|
|
351
377
|
this.createdAt = props.createdAt;
|
|
352
378
|
this.updatedAt = props.updatedAt;
|
|
353
|
-
this.plan = props.plan ?? null;
|
|
354
379
|
this.finalSummary = props.finalSummary ?? null;
|
|
355
380
|
this.validationStatus = props.validationStatus ?? null;
|
|
356
|
-
this.errorMessage = props.errorMessage ?? null;
|
|
357
381
|
this.tasks = ensureArray(props.tasks).map((item) => RunTask.fromJSON(item));
|
|
358
382
|
this.taskResults = ensureArray(props.taskResults).map((item) => TaskResult.fromJSON(item));
|
|
359
383
|
this.contextBundles = ensureArray(props.contextBundles).map((item) => ContextBundle.fromJSON(item));
|
|
@@ -367,13 +391,11 @@ export class Run {
|
|
|
367
391
|
const createdAt = params.createdAt ?? clock();
|
|
368
392
|
const updatedAt = params.updatedAt ?? createdAt;
|
|
369
393
|
return new Run({
|
|
370
|
-
runId: params.runId ?? idGenerator(
|
|
394
|
+
runId: params.runId ?? idGenerator("run"),
|
|
371
395
|
sessionId: params.sessionId ?? null,
|
|
372
396
|
command: params.command,
|
|
373
|
-
mode: params.mode ??
|
|
374
|
-
status: params.status ??
|
|
375
|
-
planVersion: params.planVersion ?? 'phase1',
|
|
376
|
-
plan: params.plan ?? null,
|
|
397
|
+
mode: params.mode ?? "direct",
|
|
398
|
+
status: params.status ?? "created",
|
|
377
399
|
createdAt,
|
|
378
400
|
updatedAt,
|
|
379
401
|
});
|
|
@@ -381,10 +403,6 @@ export class Run {
|
|
|
381
403
|
static fromJSON(input) {
|
|
382
404
|
return new Run(input);
|
|
383
405
|
}
|
|
384
|
-
setPlan(plan, updatedAt = defaultClock()) {
|
|
385
|
-
this.plan = plan;
|
|
386
|
-
this.updatedAt = updatedAt;
|
|
387
|
-
}
|
|
388
406
|
transition(status, updatedAt = defaultClock()) {
|
|
389
407
|
this.status = status;
|
|
390
408
|
this.updatedAt = updatedAt;
|
|
@@ -422,17 +440,6 @@ export class Run {
|
|
|
422
440
|
this.comparisonReports.push(comparisonReport);
|
|
423
441
|
this.updatedAt = updatedAt;
|
|
424
442
|
}
|
|
425
|
-
complete(params = {}) {
|
|
426
|
-
this.finalSummary = params.finalSummary ?? this.finalSummary;
|
|
427
|
-
this.validationStatus = params.validationStatus ?? this.validationStatus;
|
|
428
|
-
this.status = 'completed';
|
|
429
|
-
this.updatedAt = params.updatedAt ?? defaultClock();
|
|
430
|
-
}
|
|
431
|
-
fail(message, status = 'failed', updatedAt = defaultClock()) {
|
|
432
|
-
this.errorMessage = message;
|
|
433
|
-
this.status = status;
|
|
434
|
-
this.updatedAt = updatedAt;
|
|
435
|
-
}
|
|
436
443
|
toJSON() {
|
|
437
444
|
return compactObject({
|
|
438
445
|
schemaVersion: this.schemaVersion,
|
|
@@ -441,13 +448,10 @@ export class Run {
|
|
|
441
448
|
command: this.command,
|
|
442
449
|
mode: this.mode,
|
|
443
450
|
status: this.status,
|
|
444
|
-
planVersion: this.planVersion,
|
|
445
451
|
createdAt: this.createdAt,
|
|
446
452
|
updatedAt: this.updatedAt,
|
|
447
|
-
plan: this.plan,
|
|
448
453
|
finalSummary: this.finalSummary,
|
|
449
454
|
validationStatus: this.validationStatus,
|
|
450
|
-
errorMessage: this.errorMessage,
|
|
451
455
|
tasks: this.tasks.map((item) => item.toJSON()),
|
|
452
456
|
taskResults: this.taskResults.map((item) => item.toJSON()),
|
|
453
457
|
contextBundles: this.contextBundles.map((item) => item.toJSON()),
|