@hamsterbase/evidra 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/sdk/main.d.ts +7 -1
  2. package/dist/sdk/main.js +14 -9
  3. package/dist/service/cli.js +20 -7
  4. package/package.json +1 -1
  5. package/dist/types/modules/core/contracts/comparison.d.ts +0 -41
  6. package/dist/types/modules/core/contracts/config.d.ts +0 -19
  7. package/dist/types/modules/core/contracts/context.d.ts +0 -6
  8. package/dist/types/modules/core/contracts/functions/addCase.d.ts +0 -128
  9. package/dist/types/modules/core/contracts/functions/addTask.d.ts +0 -14
  10. package/dist/types/modules/core/contracts/functions/approve.d.ts +0 -8
  11. package/dist/types/modules/core/contracts/functions/baselineChanges.d.ts +0 -14
  12. package/dist/types/modules/core/contracts/functions/compare.d.ts +0 -14
  13. package/dist/types/modules/core/contracts/functions/compareTask.d.ts +0 -6
  14. package/dist/types/modules/core/contracts/functions/compareTasks.d.ts +0 -18
  15. package/dist/types/modules/core/contracts/functions/deleteBaselineFile.d.ts +0 -8
  16. package/dist/types/modules/core/contracts/functions/finishTask.d.ts +0 -8
  17. package/dist/types/modules/core/contracts/functions/getBaseline.d.ts +0 -10
  18. package/dist/types/modules/core/contracts/functions/getBaselineChanges.d.ts +0 -6
  19. package/dist/types/modules/core/contracts/functions/getGitChanges.d.ts +0 -6
  20. package/dist/types/modules/core/contracts/functions/getGitDiff.d.ts +0 -8
  21. package/dist/types/modules/core/contracts/functions/getTaskCase.d.ts +0 -23
  22. package/dist/types/modules/core/contracts/functions/getTaskTree.d.ts +0 -21
  23. package/dist/types/modules/core/contracts/functions/gitChanges.d.ts +0 -25
  24. package/dist/types/modules/core/contracts/functions/index.d.ts +0 -18
  25. package/dist/types/modules/core/contracts/functions/listBaselines.d.ts +0 -5
  26. package/dist/types/modules/core/contracts/functions/listRuns.d.ts +0 -7
  27. package/dist/types/modules/core/contracts/functions/listTaskSummaries.d.ts +0 -15
  28. package/dist/types/modules/core/contracts/functions/listTasks.d.ts +0 -15
  29. package/dist/types/modules/core/contracts/functions/loadConfig.d.ts +0 -5
  30. package/dist/types/modules/core/contracts/functions/readProjectInfo.d.ts +0 -5
  31. package/dist/types/modules/core/contracts/functions/readTaskReport.d.ts +0 -6
  32. package/dist/types/modules/core/contracts/functions/resolveConfig.d.ts +0 -6
  33. package/dist/types/modules/core/contracts/functions/reviewBaselineChanges.d.ts +0 -9
  34. package/dist/types/modules/core/contracts/functions/reviewCodeChanges.d.ts +0 -9
  35. package/dist/types/modules/core/contracts/functions/taskRecords.d.ts +0 -6
  36. package/dist/types/modules/core/contracts/functions/updateBaseline.d.ts +0 -20
  37. package/dist/types/modules/core/contracts/git.d.ts +0 -14
  38. package/dist/types/modules/core/contracts/imageDiffPool.d.ts +0 -5
  39. package/dist/types/modules/core/contracts/index.d.ts +0 -30
  40. package/dist/types/modules/core/contracts/internal/compare.d.ts +0 -14
  41. package/dist/types/modules/core/contracts/internal/getBaseline.d.ts +0 -10
  42. package/dist/types/modules/core/contracts/internal/listTasks.d.ts +0 -12
  43. package/dist/types/modules/core/contracts/internal/taskRecords.d.ts +0 -6
  44. package/dist/types/modules/core/contracts/internal/updateBaseline.d.ts +0 -20
  45. package/dist/types/modules/core/contracts/model.d.ts +0 -80
  46. package/dist/types/modules/core/contracts/report.d.ts +0 -52
  47. package/dist/types/modules/core/contracts/repository.d.ts +0 -5
  48. package/dist/types/modules/core/contracts/requests.d.ts +0 -23
  49. package/dist/types/modules/core/contracts/scanCases.d.ts +0 -15
  50. package/dist/types/modules/core/contracts/shared.d.ts +0 -6
  51. package/dist/types/modules/core/contracts/snapshots.d.ts +0 -6
  52. package/dist/types/modules/core/contracts/taskRecord.d.ts +0 -76
  53. package/dist/types/modules/core/implementations/Functions/addCase.d.ts +0 -4
  54. package/dist/types/modules/core/implementations/Functions/addTask.d.ts +0 -4
  55. package/dist/types/modules/core/implementations/Functions/approve.d.ts +0 -6
  56. package/dist/types/modules/core/implementations/Functions/compare.d.ts +0 -15
  57. package/dist/types/modules/core/implementations/Functions/compareTask.d.ts +0 -3
  58. package/dist/types/modules/core/implementations/Functions/compareTasks.d.ts +0 -5
  59. package/dist/types/modules/core/implementations/Functions/deleteBaselineFile.d.ts +0 -4
  60. package/dist/types/modules/core/implementations/Functions/finishTask.d.ts +0 -4
  61. package/dist/types/modules/core/implementations/Functions/getBaseline.d.ts +0 -4
  62. package/dist/types/modules/core/implementations/Functions/getBaselineChanges.d.ts +0 -4
  63. package/dist/types/modules/core/implementations/Functions/getGitChanges.d.ts +0 -3
  64. package/dist/types/modules/core/implementations/Functions/getGitDiff.d.ts +0 -3
  65. package/dist/types/modules/core/implementations/Functions/getTaskCase.d.ts +0 -5
  66. package/dist/types/modules/core/implementations/Functions/getTaskTree.d.ts +0 -5
  67. package/dist/types/modules/core/implementations/Functions/listBaselines.d.ts +0 -3
  68. package/dist/types/modules/core/implementations/Functions/listTaskSummaries.d.ts +0 -2
  69. package/dist/types/modules/core/implementations/Functions/listTasks.d.ts +0 -4
  70. package/dist/types/modules/core/implementations/Functions/loadConfig.d.ts +0 -3
  71. package/dist/types/modules/core/implementations/Functions/readProjectInfo.d.ts +0 -3
  72. package/dist/types/modules/core/implementations/Functions/readTaskReport.d.ts +0 -3
  73. package/dist/types/modules/core/implementations/Functions/resolveConfig.d.ts +0 -9
  74. package/dist/types/modules/core/implementations/Functions/reviewBaselineChanges.d.ts +0 -4
  75. package/dist/types/modules/core/implementations/Functions/reviewCodeChanges.d.ts +0 -4
  76. package/dist/types/modules/core/implementations/Functions/taskRecords.d.ts +0 -4
  77. package/dist/types/modules/core/implementations/Functions/updateBaseline.d.ts +0 -5
  78. package/dist/types/modules/core/implementations/Utils/assertNamespace.d.ts +0 -1
  79. package/dist/types/modules/core/implementations/Utils/canonical.d.ts +0 -1
  80. package/dist/types/modules/core/implementations/Utils/createTaskId.d.ts +0 -1
  81. package/dist/types/modules/core/implementations/Utils/deletionAllowed.d.ts +0 -2
  82. package/dist/types/modules/core/implementations/Utils/download.d.ts +0 -3
  83. package/dist/types/modules/core/implementations/Utils/hash.d.ts +0 -1
  84. package/dist/types/modules/core/implementations/Utils/imageDiffPool.d.ts +0 -18
  85. package/dist/types/modules/core/implementations/Utils/imageKey.d.ts +0 -1
  86. package/dist/types/modules/core/implementations/Utils/loadBaseline.d.ts +0 -4
  87. package/dist/types/modules/core/implementations/Utils/mapLimit.d.ts +0 -1
  88. package/dist/types/modules/core/implementations/Utils/observationKey.d.ts +0 -1
  89. package/dist/types/modules/core/implementations/Utils/pngSize.d.ts +0 -4
  90. package/dist/types/modules/core/implementations/Utils/readJson.d.ts +0 -1
  91. package/dist/types/modules/core/implementations/Utils/readTaskRecord.d.ts +0 -2
  92. package/dist/types/modules/core/implementations/Utils/scanCases.d.ts +0 -9
  93. package/dist/types/modules/core/implementations/Utils/taskDirectory.d.ts +0 -1
  94. package/dist/types/modules/core/implementations/Utils/toCase.d.ts +0 -3
  95. package/dist/types/modules/core/implementations/Utils/toObservation.d.ts +0 -3
  96. package/dist/types/modules/core/implementations/Utils/toSnapshot.d.ts +0 -3
  97. package/dist/types/modules/core/implementations/Utils/writeBytesAtomic.d.ts +0 -1
  98. package/dist/types/modules/core/implementations/Utils/writeJsonAtomic.d.ts +0 -1
  99. package/dist/types/modules/core/implementations/Utils/writeTextAtomic.d.ts +0 -1
  100. package/dist/types/modules/core/implementations/baselineChanges.d.ts +0 -6
  101. package/dist/types/modules/core/implementations/config.d.ts +0 -6
  102. package/dist/types/modules/core/implementations/content.d.ts +0 -1
  103. package/dist/types/modules/core/implementations/evidra.d.ts +0 -31
  104. package/dist/types/modules/core/implementations/git.d.ts +0 -11
  105. package/dist/types/modules/core/implementations/gitChanges.d.ts +0 -29
  106. package/dist/types/modules/core/implementations/index.d.ts +0 -17
  107. package/dist/types/modules/core/implementations/internal/compare.d.ts +0 -15
  108. package/dist/types/modules/core/implementations/internal/getBaseline.d.ts +0 -4
  109. package/dist/types/modules/core/implementations/internal/listTasks.d.ts +0 -2
  110. package/dist/types/modules/core/implementations/internal/taskRecords.d.ts +0 -4
  111. package/dist/types/modules/core/implementations/internal/updateBaseline.d.ts +0 -5
  112. package/dist/types/modules/core/implementations/paths.d.ts +0 -48
  113. package/dist/types/modules/core/implementations/report.d.ts +0 -3
  114. package/dist/types/modules/core/implementations/reportResources.d.ts +0 -4
  115. package/dist/types/modules/core/implementations/reportStatus.d.ts +0 -10
  116. package/dist/types/modules/core/implementations/reportTree.d.ts +0 -5
  117. package/dist/types/modules/core/implementations/repository.d.ts +0 -10
  118. package/dist/types/modules/core/implementations/requests.d.ts +0 -13
  119. package/dist/types/modules/core/implementations/snapshots.d.ts +0 -11
  120. package/dist/types/modules/core/implementations/storage/local.d.ts +0 -3
  121. package/dist/types/modules/core/implementations/storage/objects.d.ts +0 -3
  122. package/dist/types/modules/core/index.d.ts +0 -21
  123. package/dist/types/packages/sdk/src/index.d.ts +0 -21
  124. package/dist/types/packages/sdk/src/types.d.ts +0 -9
@@ -156,6 +156,12 @@ interface Comparison {
156
156
  cases: CaseDiff[];
157
157
  summary: ComparisonSummary;
158
158
  }
159
+ declare const CompareTaskInputSchema: z.ZodObject<{
160
+ repoRoot: z.ZodString;
161
+ taskId: z.ZodString;
162
+ concurrency: z.ZodOptional<z.ZodNumber>;
163
+ }, z.core.$strip>;
164
+ type CompareTaskInput = z.infer<typeof CompareTaskInputSchema>;
159
165
  declare const ResolveConfigInputSchema: z.ZodObject<{
160
166
  repoRoot: z.ZodString;
161
167
  namespace: z.ZodOptional<z.ZodString>;
@@ -171,6 +177,6 @@ export declare function createEvidra(options: Pick<ResolveConfigInput, 'repoRoot
171
177
  }>;
172
178
  case(id: string, input: CaseInput): Promise<void>;
173
179
  finish(id: string): Promise<void>;
174
- compare(taskId: string): Promise<Comparison>;
180
+ compare(taskId: string, options?: Pick<CompareTaskInput, "concurrency">): Promise<Comparison>;
175
181
  }>;
176
182
  export {};
package/dist/sdk/main.js CHANGED
@@ -9,6 +9,7 @@ import pixelmatch from "pixelmatch";
9
9
  import { PNG } from "pngjs";
10
10
  import { Worker } from "node:worker_threads";
11
11
  import { parseEnv } from "node:util";
12
+ import { availableParallelism } from "node:os";
12
13
  // modules/core/contracts/functions/resolveConfig.ts
13
14
  const ResolveConfigInputSchema = z.object({
14
15
  repoRoot: z.string(),
@@ -623,7 +624,8 @@ async function finishTask(input) {
623
624
  // modules/core/contracts/functions/compareTask.ts
624
625
  const CompareTaskInputSchema = z.object({
625
626
  repoRoot: z.string(),
626
- taskId: z.string()
627
+ taskId: z.string(),
628
+ concurrency: z.number().int().min(1).max(32).optional()
627
629
  });
628
630
  // modules/core/contracts/internal/compare.ts
629
631
  const CompareInputSchema = z.object({ taskId: z.string().min(1) });
@@ -642,9 +644,11 @@ async function download(_cwd, storage, key) {
642
644
  * 因此函数体只能使用参数,不得引用模块作用域或定义内部函数。
643
645
  */
644
646
  function diffPng(png, match, oldBytes, newBytes) {
645
- if (Buffer.from(oldBytes).equals(Buffer.from(newBytes))) return { diffPixels: 0 };
646
- const oldImage = png.sync.read(Buffer.from(oldBytes));
647
- const newImage = png.sync.read(Buffer.from(newBytes));
647
+ const oldBuffer = Buffer.from(oldBytes);
648
+ const newBuffer = Buffer.from(newBytes);
649
+ if (oldBuffer.equals(newBuffer)) return { diffPixels: 0 };
650
+ const oldImage = png.sync.read(oldBuffer);
651
+ const newImage = png.sync.read(newBuffer);
648
652
  if (oldImage.width !== newImage.width || oldImage.height !== newImage.height) return { dimensionMismatch: true };
649
653
  const diff = new png({
650
654
  width: oldImage.width,
@@ -652,7 +656,7 @@ function diffPng(png, match, oldBytes, newBytes) {
652
656
  });
653
657
  return {
654
658
  diffPixels: match(oldImage.data, newImage.data, diff.data, diff.width, diff.height, { threshold: .1 }),
655
- png: png.sync.write(diff)
659
+ png: png.sync.write(diff, { deflateLevel: 1 })
656
660
  };
657
661
  }
658
662
  function localImageDiff(oldBytes, newBytes) {
@@ -1206,9 +1210,9 @@ function storageFor(reportDir, repoRoot) {
1206
1210
  }
1207
1211
  // modules/core/implementations/Functions/compareTask.ts
1208
1212
  async function compareTask(input) {
1209
- const { repoRoot: root, taskId } = CompareTaskInputSchema.parse(input);
1213
+ const { repoRoot: root, taskId, concurrency } = CompareTaskInputSchema.parse(input);
1210
1214
  const reportDir = await reportRoot(root);
1211
- return compare({ taskId }, reportDir, reportDir, storageFor(reportDir, root));
1215
+ return compare({ taskId }, reportDir, reportDir, storageFor(reportDir, root), concurrency ?? Math.min(4, availableParallelism()));
1212
1216
  }
1213
1217
  z.object({
1214
1218
  repoRoot: z.string(),
@@ -1340,10 +1344,11 @@ async function createEvidra(options) {
1340
1344
  taskId: id
1341
1345
  });
1342
1346
  },
1343
- async compare(taskId) {
1347
+ async compare(taskId, options = {}) {
1344
1348
  return compareTask({
1345
1349
  repoRoot,
1346
- taskId
1350
+ taskId,
1351
+ ...options
1347
1352
  });
1348
1353
  }
1349
1354
  };
@@ -469,7 +469,11 @@ var FinishTaskInputSchema = z7.object({
469
469
 
470
470
  // modules/core/contracts/functions/compareTask.ts
471
471
  import { z as z8 } from "zod";
472
- var CompareTaskInputSchema = z8.object({ repoRoot: z8.string(), taskId: z8.string() });
472
+ var CompareTaskInputSchema = z8.object({
473
+ repoRoot: z8.string(),
474
+ taskId: z8.string(),
475
+ concurrency: z8.number().int().min(1).max(32).optional()
476
+ });
473
477
 
474
478
  // modules/core/implementations/internal/compare.ts
475
479
  import { access } from "node:fs/promises";
@@ -495,9 +499,11 @@ async function download(_cwd, storage, key) {
495
499
  import pixelmatch from "pixelmatch";
496
500
  import { PNG } from "pngjs";
497
501
  function diffPng(png, match, oldBytes, newBytes) {
498
- if (Buffer.from(oldBytes).equals(Buffer.from(newBytes))) return { diffPixels: 0 };
499
- const oldImage = png.sync.read(Buffer.from(oldBytes));
500
- const newImage = png.sync.read(Buffer.from(newBytes));
502
+ const oldBuffer = Buffer.from(oldBytes);
503
+ const newBuffer = Buffer.from(newBytes);
504
+ if (oldBuffer.equals(newBuffer)) return { diffPixels: 0 };
505
+ const oldImage = png.sync.read(oldBuffer);
506
+ const newImage = png.sync.read(newBuffer);
501
507
  if (oldImage.width !== newImage.width || oldImage.height !== newImage.height) {
502
508
  return { dimensionMismatch: true };
503
509
  }
@@ -505,7 +511,7 @@ function diffPng(png, match, oldBytes, newBytes) {
505
511
  const diffPixels = match(oldImage.data, newImage.data, diff.data, diff.width, diff.height, {
506
512
  threshold: 0.1
507
513
  });
508
- return { diffPixels, png: png.sync.write(diff) };
514
+ return { diffPixels, png: png.sync.write(diff, { deflateLevel: 1 }) };
509
515
  }
510
516
  function localImageDiff(oldBytes, newBytes) {
511
517
  return diffPng(PNG, pixelmatch, oldBytes, newBytes);
@@ -1114,10 +1120,17 @@ async function taskPathOf(root, id) {
1114
1120
  }
1115
1121
 
1116
1122
  // modules/core/implementations/Functions/compareTask.ts
1123
+ import { availableParallelism } from "node:os";
1117
1124
  async function compareTask(input) {
1118
- const { repoRoot: root, taskId } = CompareTaskInputSchema.parse(input);
1125
+ const { repoRoot: root, taskId, concurrency } = CompareTaskInputSchema.parse(input);
1119
1126
  const reportDir = await reportRoot(root);
1120
- return compare({ taskId }, reportDir, reportDir, storageFor(reportDir, root));
1127
+ return compare(
1128
+ { taskId },
1129
+ reportDir,
1130
+ reportDir,
1131
+ storageFor(reportDir, root),
1132
+ concurrency ?? Math.min(4, availableParallelism())
1133
+ );
1121
1134
  }
1122
1135
 
1123
1136
  // modules/core/contracts/functions/approve.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hamsterbase/evidra",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "bin": {
5
5
  "evidra": "bin/evidra.mjs"
6
6
  },
@@ -1,41 +0,0 @@
1
- import type { BaselineCase, Case, Snapshot } from './model.js';
2
- export type Change = 'added' | 'modified' | 'deleted' | 'same' | 'unavailable';
3
- export interface SnapshotDiff {
4
- id: string;
5
- change: Change;
6
- current?: Snapshot;
7
- baseline?: Snapshot;
8
- /** 内容(文本/像素)是否一致;change 还包含名称、布局等元数据比较。 */
9
- contentSame?: boolean;
10
- diffPixels?: number;
11
- maxDiffPixels?: number;
12
- /** 相对 reportDir 的差异图路径。 */
13
- diffFile?: string;
14
- /** 差异图绝对路径,供本地调用方使用。 */
15
- diffUrl?: string;
16
- }
17
- export interface CaseDiff {
18
- id: string;
19
- change: Change;
20
- current?: Case;
21
- baseline?: BaselineCase;
22
- baselineHash?: string;
23
- snapshots: SnapshotDiff[];
24
- }
25
- export interface ComparisonSummary {
26
- added: number;
27
- modified: number;
28
- deleted: number;
29
- same: number;
30
- unavailable: number;
31
- }
32
- export interface Comparison {
33
- taskId: string;
34
- namespace: string;
35
- /** 当前基线的稳定版本,用于审批冲突检测。 */
36
- baselineVersion: string;
37
- /** 是否允许把缺失用例/快照作为删除项。 */
38
- deletionAllowed: boolean;
39
- cases: CaseDiff[];
40
- summary: ComparisonSummary;
41
- }
@@ -1,19 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const NamespaceSchema: z.ZodObject<{
3
- id: z.ZodString;
4
- name: z.ZodString;
5
- }, z.core.$strip>;
6
- export declare const ConfigSchema: z.ZodObject<{
7
- reportDir: z.ZodOptional<z.ZodString>;
8
- namespaces: z.ZodArray<z.ZodObject<{
9
- id: z.ZodString;
10
- name: z.ZodString;
11
- }, z.core.$strip>>;
12
- }, z.core.$strip>;
13
- export type Config = {
14
- reportDir: string;
15
- namespaces: Array<{
16
- id: string;
17
- name: string;
18
- }>;
19
- };
@@ -1,6 +0,0 @@
1
- export interface FileStorage {
2
- /** 确保资源已落盘,返回本地绝对路径。 */
3
- localPath?(key: string): Promise<string>;
4
- upload(key: string, body: Uint8Array): Promise<void>;
5
- download(key: string): Promise<Uint8Array>;
6
- }
@@ -1,128 +0,0 @@
1
- import { z } from 'zod';
2
- import type { Case } from '../model.js';
3
- export declare const SnapshotInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4
- id: z.ZodString;
5
- name: z.ZodString;
6
- col: z.ZodOptional<z.ZodNumber>;
7
- type: z.ZodLiteral<"text">;
8
- body: z.ZodString;
9
- language: z.ZodOptional<z.ZodString>;
10
- }, z.core.$strip>, z.ZodObject<{
11
- id: z.ZodString;
12
- name: z.ZodString;
13
- col: z.ZodOptional<z.ZodNumber>;
14
- type: z.ZodLiteral<"image">;
15
- body: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
16
- contentType: z.ZodLiteral<"image/png">;
17
- maxDiffPixels: z.ZodOptional<z.ZodNumber>;
18
- }, z.core.$strip>], "type">;
19
- export type SnapshotInput = z.infer<typeof SnapshotInputSchema>;
20
- export declare const ObservationInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
21
- name: z.ZodString;
22
- type: z.ZodLiteral<"text">;
23
- body: z.ZodString;
24
- language: z.ZodOptional<z.ZodString>;
25
- }, z.core.$strip>, z.ZodObject<{
26
- name: z.ZodString;
27
- type: z.ZodLiteral<"image">;
28
- body: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
29
- contentType: z.ZodLiteral<"image/png">;
30
- }, z.core.$strip>], "type">;
31
- export type ObservationInput = z.infer<typeof ObservationInputSchema>;
32
- export declare const CaseInputSchema: z.ZodObject<{
33
- id: z.ZodString;
34
- name: z.ZodString;
35
- treePath: z.ZodArray<z.ZodObject<{
36
- key: z.ZodString;
37
- display: z.ZodString;
38
- }, z.core.$strip>>;
39
- snapshots: z.ZodNullable<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
40
- id: z.ZodString;
41
- name: z.ZodString;
42
- col: z.ZodOptional<z.ZodNumber>;
43
- type: z.ZodLiteral<"text">;
44
- body: z.ZodString;
45
- language: z.ZodOptional<z.ZodString>;
46
- }, z.core.$strip>, z.ZodObject<{
47
- id: z.ZodString;
48
- name: z.ZodString;
49
- col: z.ZodOptional<z.ZodNumber>;
50
- type: z.ZodLiteral<"image">;
51
- body: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
52
- contentType: z.ZodLiteral<"image/png">;
53
- maxDiffPixels: z.ZodOptional<z.ZodNumber>;
54
- }, z.core.$strip>], "type">>>;
55
- result: z.ZodObject<{
56
- status: z.ZodEnum<{
57
- passed: "passed";
58
- failed: "failed";
59
- skipped: "skipped";
60
- interrupted: "interrupted";
61
- }>;
62
- durationMs: z.ZodOptional<z.ZodNumber>;
63
- errors: z.ZodOptional<z.ZodArray<z.ZodString>>;
64
- }, z.core.$strip>;
65
- observations: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
66
- name: z.ZodString;
67
- type: z.ZodLiteral<"text">;
68
- body: z.ZodString;
69
- language: z.ZodOptional<z.ZodString>;
70
- }, z.core.$strip>, z.ZodObject<{
71
- name: z.ZodString;
72
- type: z.ZodLiteral<"image">;
73
- body: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
74
- contentType: z.ZodLiteral<"image/png">;
75
- }, z.core.$strip>], "type">>>;
76
- }, z.core.$strip>;
77
- export type CaseInput = z.infer<typeof CaseInputSchema>;
78
- export declare const AddCaseInputSchema: z.ZodObject<{
79
- repoRoot: z.ZodString;
80
- taskId: z.ZodString;
81
- case: z.ZodObject<{
82
- id: z.ZodString;
83
- name: z.ZodString;
84
- treePath: z.ZodArray<z.ZodObject<{
85
- key: z.ZodString;
86
- display: z.ZodString;
87
- }, z.core.$strip>>;
88
- snapshots: z.ZodNullable<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
89
- id: z.ZodString;
90
- name: z.ZodString;
91
- col: z.ZodOptional<z.ZodNumber>;
92
- type: z.ZodLiteral<"text">;
93
- body: z.ZodString;
94
- language: z.ZodOptional<z.ZodString>;
95
- }, z.core.$strip>, z.ZodObject<{
96
- id: z.ZodString;
97
- name: z.ZodString;
98
- col: z.ZodOptional<z.ZodNumber>;
99
- type: z.ZodLiteral<"image">;
100
- body: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
101
- contentType: z.ZodLiteral<"image/png">;
102
- maxDiffPixels: z.ZodOptional<z.ZodNumber>;
103
- }, z.core.$strip>], "type">>>;
104
- result: z.ZodObject<{
105
- status: z.ZodEnum<{
106
- passed: "passed";
107
- failed: "failed";
108
- skipped: "skipped";
109
- interrupted: "interrupted";
110
- }>;
111
- durationMs: z.ZodOptional<z.ZodNumber>;
112
- errors: z.ZodOptional<z.ZodArray<z.ZodString>>;
113
- }, z.core.$strip>;
114
- observations: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
115
- name: z.ZodString;
116
- type: z.ZodLiteral<"text">;
117
- body: z.ZodString;
118
- language: z.ZodOptional<z.ZodString>;
119
- }, z.core.$strip>, z.ZodObject<{
120
- name: z.ZodString;
121
- type: z.ZodLiteral<"image">;
122
- body: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
123
- contentType: z.ZodLiteral<"image/png">;
124
- }, z.core.$strip>], "type">>>;
125
- }, z.core.$strip>;
126
- }, z.core.$strip>;
127
- export type AddCaseInput = z.infer<typeof AddCaseInputSchema>;
128
- export type AddCaseOutput = Case;
@@ -1,14 +0,0 @@
1
- import { z } from 'zod';
2
- import type { Task } from '../model.js';
3
- export declare const AddTaskInputSchema: z.ZodObject<{
4
- repoRoot: z.ZodString;
5
- namespace: z.ZodString;
6
- name: z.ZodString;
7
- startedAt: z.ZodISODateTime;
8
- coverage: z.ZodOptional<z.ZodEnum<{
9
- partial: "partial";
10
- complete: "complete";
11
- }>>;
12
- }, z.core.$strip>;
13
- export type AddTaskInput = z.infer<typeof AddTaskInputSchema>;
14
- export type AddTaskOutput = Task;
@@ -1,8 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const ApproveInputSchema: z.ZodObject<{
3
- repoRoot: z.ZodString;
4
- taskId: z.ZodString;
5
- baselineVersion: z.ZodString;
6
- caseIds: z.ZodArray<z.ZodString>;
7
- }, z.core.$strip>;
8
- export type ApproveInput = z.infer<typeof ApproveInputSchema>;
@@ -1,14 +0,0 @@
1
- import type { CaseDiff } from '../comparison.js';
2
- export interface BaselineChange {
3
- namespace: string;
4
- namespaceName: string;
5
- item: CaseDiff;
6
- file: string;
7
- }
8
- export interface BaselineChanges {
9
- ref: string;
10
- sha: string;
11
- version: string;
12
- entries: BaselineChange[];
13
- reviewed: string[];
14
- }
@@ -1,14 +0,0 @@
1
- import { z } from 'zod';
2
- import type { Comparison } from '../comparison.js';
3
- import type { ImageDiffResult } from '../imageDiffPool.js';
4
- export declare const CompareInputSchema: z.ZodObject<{
5
- taskId: z.ZodString;
6
- }, z.core.$strip>;
7
- export type CompareInput = z.infer<typeof CompareInputSchema>;
8
- export type CompareOutput = Comparison;
9
- export interface CompareRecordOptions {
10
- concurrency?: number;
11
- pool?: {
12
- compare(oldBytes: Uint8Array, newBytes: Uint8Array): Promise<ImageDiffResult>;
13
- };
14
- }
@@ -1,6 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const CompareTaskInputSchema: z.ZodObject<{
3
- repoRoot: z.ZodString;
4
- taskId: z.ZodString;
5
- }, z.core.$strip>;
6
- export type CompareTaskInput = z.infer<typeof CompareTaskInputSchema>;
@@ -1,18 +0,0 @@
1
- import { z } from 'zod';
2
- import type { ComparisonSummary } from '../comparison.js';
3
- import type { TaskStatus } from '../model.js';
4
- export declare const CompareTasksInputSchema: z.ZodObject<{
5
- taskPaths: z.ZodArray<z.ZodString>;
6
- }, z.core.$strip>;
7
- export type CompareTasksInput = z.infer<typeof CompareTasksInputSchema>;
8
- export interface TaskComparisonSummary {
9
- taskPath: string;
10
- taskId: string;
11
- namespace: string;
12
- status: TaskStatus;
13
- deletionAllowed: boolean;
14
- summary: ComparisonSummary;
15
- }
16
- export interface CompareTasksOutput {
17
- tasks: TaskComparisonSummary[];
18
- }
@@ -1,8 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const DeleteBaselineFileInputSchema: z.ZodObject<{
3
- repoRoot: z.ZodString;
4
- namespace: z.ZodString;
5
- file: z.ZodString;
6
- version: z.ZodString;
7
- }, z.core.$strip>;
8
- export type DeleteBaselineFileInput = z.infer<typeof DeleteBaselineFileInputSchema>;
@@ -1,8 +0,0 @@
1
- import { z } from 'zod';
2
- import type { Task } from '../model.js';
3
- export declare const FinishTaskInputSchema: z.ZodObject<{
4
- repoRoot: z.ZodString;
5
- taskId: z.ZodString;
6
- }, z.core.$strip>;
7
- export type FinishTaskInput = z.infer<typeof FinishTaskInputSchema>;
8
- export type FinishTaskOutput = Task;
@@ -1,10 +0,0 @@
1
- import type { BaselineCase } from '../model.js';
2
- export interface GetBaselineOutput {
3
- candidates: {
4
- file: string;
5
- ignored: boolean;
6
- baseline: BaselineCase;
7
- }[];
8
- version: string;
9
- cases: BaselineCase[];
10
- }
@@ -1,6 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const GetBaselineChangesInputSchema: z.ZodObject<{
3
- repoRoot: z.ZodString;
4
- ref: z.ZodString;
5
- }, z.core.$strip>;
6
- export type GetBaselineChangesInput = z.infer<typeof GetBaselineChangesInputSchema>;
@@ -1,6 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const GetGitChangesInputSchema: z.ZodObject<{
3
- repoRoot: z.ZodString;
4
- ref: z.ZodString;
5
- }, z.core.$strip>;
6
- export type GetGitChangesInput = z.infer<typeof GetGitChangesInputSchema>;
@@ -1,8 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const GetGitDiffInputSchema: z.ZodObject<{
3
- repoRoot: z.ZodString;
4
- ref: z.ZodString;
5
- file: z.ZodString;
6
- version: z.ZodOptional<z.ZodString>;
7
- }, z.core.$strip>;
8
- export type GetGitDiffInput = z.infer<typeof GetGitDiffInputSchema>;
@@ -1,23 +0,0 @@
1
- import { z } from 'zod';
2
- import type { CaseDiff } from '../comparison.js';
3
- export declare const GetTaskCaseInputSchema: z.ZodObject<{
4
- taskPath: z.ZodString;
5
- caseId: z.ZodString;
6
- }, z.core.$strip>;
7
- export type GetTaskCaseInput = z.infer<typeof GetTaskCaseInputSchema>;
8
- export interface TaskCaseObservation {
9
- name: string;
10
- type: 'text' | 'image';
11
- text?: string;
12
- key?: string;
13
- contentType?: 'image/png';
14
- width?: number;
15
- height?: number;
16
- }
17
- export interface GetTaskCaseOutput {
18
- taskPath: string;
19
- diff: CaseDiff;
20
- currentText: Record<string, string>;
21
- baselineText: Record<string, string>;
22
- observations: TaskCaseObservation[];
23
- }
@@ -1,21 +0,0 @@
1
- import { z } from 'zod';
2
- import type { Change, ComparisonSummary } from '../comparison.js';
3
- import type { Task } from '../model.js';
4
- export declare const GetTaskTreeInputSchema: z.ZodObject<{
5
- taskPath: z.ZodString;
6
- }, z.core.$strip>;
7
- export type GetTaskTreeInput = z.infer<typeof GetTaskTreeInputSchema>;
8
- export interface TaskTreeNode {
9
- key: string;
10
- display: string;
11
- change: Change | 'mixed';
12
- counts: ComparisonSummary;
13
- caseIds: string[];
14
- children: TaskTreeNode[];
15
- }
16
- export interface GetTaskTreeOutput {
17
- task: Task;
18
- deletionAllowed: boolean;
19
- summary: ComparisonSummary;
20
- nodes: TaskTreeNode[];
21
- }
@@ -1,25 +0,0 @@
1
- export interface CodeChange {
2
- path: string;
3
- oldPath?: string;
4
- status: 'added' | 'modified' | 'deleted' | 'renamed';
5
- /** 审核键:路径、两侧内容和文件模式共同决定,内容变化后需要重新审核。 */
6
- reviewKey: string;
7
- }
8
- export interface CodeChanges {
9
- sha: string;
10
- files: CodeChange[];
11
- reviewed: string[];
12
- }
13
- export interface CodeDiff {
14
- path: string;
15
- oldPath?: string;
16
- status: CodeChange['status'];
17
- original: string;
18
- modified: string;
19
- isBinary: boolean;
20
- tooLarge: boolean;
21
- }
22
- export interface CodeReviewInput {
23
- path: string;
24
- key: string;
25
- }
@@ -1,18 +0,0 @@
1
- export { AddCaseInputSchema, CaseInputSchema, ObservationInputSchema, SnapshotInputSchema, } from './addCase.js';
2
- export type { AddCaseInput, AddCaseOutput, CaseInput, ObservationInput, SnapshotInput, } from './addCase.js';
3
- export { AddTaskInputSchema } from './addTask.js';
4
- export type { AddTaskInput, AddTaskOutput } from './addTask.js';
5
- export type { BaselineChange, BaselineChanges } from './baselineChanges.js';
6
- export { CompareInputSchema } from '../internal/compare.js';
7
- export type { CompareInput, CompareOutput, CompareRecordOptions } from '../internal/compare.js';
8
- export { FinishTaskInputSchema } from './finishTask.js';
9
- export type { FinishTaskInput, FinishTaskOutput } from './finishTask.js';
10
- export type { GetBaselineOutput } from '../internal/getBaseline.js';
11
- export type { CodeChange, CodeChanges, CodeDiff, CodeReviewInput } from './gitChanges.js';
12
- export { ListTasksInputSchema } from '../internal/listTasks.js';
13
- export type { ListTasksInput, ListTasksOutput } from '../internal/listTasks.js';
14
- export type { TaskRecordEntry } from '../internal/taskRecords.js';
15
- export { UpdateBaselineInputSchema } from '../internal/updateBaseline.js';
16
- export type { UpdateBaselineInput, UpdateBaselineOutput } from '../internal/updateBaseline.js';
17
- export type { TaskSummaryItem } from './listTaskSummaries.js';
18
- export type { TaskListItem } from '../internal/listTasks.js';
@@ -1,5 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const ListBaselinesInputSchema: z.ZodObject<{
3
- repoRoot: z.ZodString;
4
- }, z.core.$strip>;
5
- export type ListBaselinesInput = z.infer<typeof ListBaselinesInputSchema>;
@@ -1,7 +0,0 @@
1
- import type { Task } from '../model.js';
2
- /** Cross-namespace task list; details and image comparisons are loaded separately. */
3
- export interface RunListItem extends Pick<Task, 'id' | 'namespace' | 'name' | 'startedAt' | 'status' | 'finishedAt' | 'coverage' | 'caseCount'> {
4
- failedCount: number;
5
- cached: boolean;
6
- counts: Record<string, number>;
7
- }
@@ -1,15 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const ListTaskSummariesInputSchema: z.ZodObject<{
3
- repoRoot: z.ZodString;
4
- }, z.core.$strip>;
5
- export type ListTaskSummariesInput = z.infer<typeof ListTaskSummariesInputSchema>;
6
- import type { TaskDisplay } from '../report.js';
7
- import type { Task } from '../model.js';
8
- /** Cross-namespace task list; details and image comparisons are loaded separately. */
9
- export interface TaskSummaryItem extends Pick<Task, 'id' | 'namespace' | 'name' | 'startedAt' | 'status' | 'finishedAt' | 'coverage' | 'caseCount'> {
10
- namespaceName: string;
11
- display: TaskDisplay;
12
- failedCount: number;
13
- cached: boolean;
14
- counts: Record<string, number>;
15
- }
@@ -1,15 +0,0 @@
1
- import { z } from 'zod';
2
- import type { Task } from '../model.js';
3
- export declare const ListTasksInputSchema: z.ZodObject<{
4
- namespace: z.ZodOptional<z.ZodString>;
5
- cursor: z.ZodOptional<z.ZodString>;
6
- limit: z.ZodOptional<z.ZodNumber>;
7
- }, z.core.$strip>;
8
- export type ListTasksInput = z.infer<typeof ListTasksInputSchema>;
9
- export interface TaskListItem extends Task {
10
- failedCount: number;
11
- }
12
- export interface ListTasksOutput {
13
- tasks: TaskListItem[];
14
- nextCursor?: string;
15
- }
@@ -1,5 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const LoadConfigInputSchema: z.ZodObject<{
3
- repoRoot: z.ZodString;
4
- }, z.core.$strip>;
5
- export type LoadConfigInput = z.infer<typeof LoadConfigInputSchema>;
@@ -1,5 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const ReadProjectInfoInputSchema: z.ZodObject<{
3
- repoRoot: z.ZodString;
4
- }, z.core.$strip>;
5
- export type ReadProjectInfoInput = z.infer<typeof ReadProjectInfoInputSchema>;
@@ -1,6 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const ReadTaskReportInputSchema: z.ZodObject<{
3
- repoRoot: z.ZodString;
4
- taskId: z.ZodString;
5
- }, z.core.$strip>;
6
- export type ReadTaskReportInput = z.infer<typeof ReadTaskReportInputSchema>;