@weapp-vite/acceptance 0.1.0 → 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/dist/index.d.mts CHANGED
@@ -1,6 +1,4 @@
1
1
  import { z } from "zod";
2
- //#region ../agent-core/dist/security-f90O15-4.d.mts
3
- //#region src/config.d.ts
4
2
  declare const verificationSchema: z.ZodObject<{
5
3
  kind: z.ZodEnum<{
6
4
  typecheck: "typecheck";
@@ -78,8 +76,6 @@ declare function configurationSource(config: ProjectConfig): string | undefined;
78
76
  declare function loadAcceptanceConfig(root: string, explicit?: string): Promise<ProjectConfig | undefined>;
79
77
  declare function stateRoot(): string;
80
78
  declare function projectFingerprint(root: string, config: ProjectConfig): Promise<string>;
81
- //#endregion
82
- //#region src/types.d.ts
83
79
  interface ImageInput {
84
80
  type: 'image';
85
81
  data: string;
@@ -126,8 +122,6 @@ declare function redactor(environment?: NodeJS.ProcessEnv): (text: string) => st
126
122
  /** Canonicalize ancestors even for new files: symlink escapes cannot bypass the boundary. */
127
123
  declare function safePath(root: string, file: string): Promise<string>;
128
124
  declare function redactValue<T>(value: T, clean?: (text: string) => string): T;
129
- //#endregion
130
- //#region src/runtime.d.ts
131
125
  export interface RuntimeConnection {
132
126
  tools: Tool[];
133
127
  close: () => Promise<void>;
@@ -137,8 +131,6 @@ export type RuntimeConnector = (server: McpConfig, context: ToolContext, options
137
131
  fingerprint: string;
138
132
  builtin: boolean;
139
133
  }) => Promise<RuntimeConnection>;
140
- //#endregion
141
- //#region src/scenario.d.ts
142
134
  export declare const scenarioSchema: z.ZodObject<{
143
135
  version: z.ZodLiteral<1>;
144
136
  name: z.ZodString;
@@ -183,8 +175,6 @@ export interface ScenarioStepResult {
183
175
  /** A task owns one connection; all operations use the same scoped runtime. */
184
176
  export declare function runtimeInvoker(connection: RuntimeConnection, context: ToolContext): (name: string, args: Record<string, unknown>) => Promise<Record<string, any>>;
185
177
  export declare function runScenario(scenario: Scenario, invoke: ReturnType<typeof runtimeInvoker>, context: ToolContext, onStep: (step: ScenarioStepResult) => Promise<void>, capture: () => Promise<string>): Promise<void>;
186
- //#endregion
187
- //#region src/verify.d.ts
188
178
  export interface CheckResult {
189
179
  kind: VerificationCommand['kind'];
190
180
  status: 'passed' | 'failed' | 'unverified';
@@ -199,8 +189,6 @@ export interface VerificationReport {
199
189
  }
200
190
  export declare function verifyProject(config: ProjectConfig, context: ToolContext, originalFingerprint: string, onCheck?: (check: CheckResult) => Promise<void>, skipKinds?: CheckResult['kind'][]): Promise<VerificationReport>;
201
191
  export declare function verificationTool(config: ProjectConfig, fingerprint: string): Tool;
202
- //#endregion
203
- //#region src/acceptance.d.ts
204
192
  export type AcceptanceStatus = 'running' | 'passed' | 'failed' | 'unverified' | 'action_required' | 'cancelled' | 'timed_out' | 'interrupted';
205
193
  export interface AcceptanceReport {
206
194
  version: 2;
@@ -273,16 +261,11 @@ export declare class AcceptanceService {
273
261
  }>;
274
262
  close(): Promise<void>;
275
263
  }
276
- //#endregion
277
- //#region src/project.d.ts
278
264
  export declare function exists(file: string): Promise<boolean>;
279
265
  export declare function findProjectRoot(cwd: string): Promise<string>;
280
266
  export declare function detectProject(root: string): Promise<ProjectInfo>;
281
267
  export declare function defaultVerification(project: ProjectInfo): VerificationCommand[];
282
268
  export declare function projectInstructions(project: ProjectInfo): Promise<string>;
283
- //#endregion
284
- //#region src/snapshot.d.ts
285
269
  /** Include untracked source/config files, without executing Git hooks or Vite config. */
286
270
  export declare function sourceSnapshot(project: ProjectInfo): Promise<string>;
287
- //#endregion
288
271
  export { type ProjectConfig, type ToolContext, configurationSource, loadAcceptanceConfig, projectConfigSchema, projectFingerprint, redactValue, redactor, safePath, stateRoot };
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import { homedir } from "node:os";
6
6
  import { z } from "zod";
7
7
  import { setTimeout } from "node:timers/promises";
8
8
  import { execa } from "execa";
9
- //#region ../agent-core/dist/text-EVMG4Jiq.mjs
9
+ // ../agent-core/dist/text-BiiwJgsr.mjs
10
10
  var ApprovalRequired = class extends Error {
11
11
  constructor(message) {
12
12
  super(message);
@@ -223,8 +223,7 @@ async function trustProject(root, fingerprint) {
223
223
  function bounded(text, max = 4e4) {
224
224
  return text.length > max ? `${text.slice(0, max)}\n[truncated: ${text.length - max} more characters]` : text;
225
225
  }
226
- //#endregion
227
- //#region src/persistence.ts
226
+ // src/persistence.ts
228
227
  /** 通过一次临时文件写入和原子替换发布完整、已脱敏的报告。 */
229
228
  async function atomicJson(file, data, platform = process.platform) {
230
229
  const temp = `${file}.${randomUUID()}.tmp`;
@@ -241,8 +240,7 @@ async function atomicJson(file, data, platform = process.platform) {
241
240
  await setTimeout(Math.min((retry + 1) * 10, 100));
242
241
  }
243
242
  }
244
- //#endregion
245
- //#region src/project.ts
243
+ // src/project.ts
246
244
  async function json(file) {
247
245
  try {
248
246
  return JSON.parse(await readFile(file, "utf8"));
@@ -358,8 +356,7 @@ async function projectInstructions(project) {
358
356
  for (const name of names.filter((n) => /^(?:README|ai|cli|getting-started|configuration).*\.md$/i.test(n)).slice(0, 4)) snippets.push(`Installed weapp-vite documentation (${name}):\n${bounded(await readFile(path.join(docs, name), "utf8"), 6e3)}`);
359
357
  return `Project facts:\n${JSON.stringify(project)}\n${snippets.join("\n\n")}`;
360
358
  }
361
- //#endregion
362
- //#region src/scenario.ts
359
+ // src/scenario.ts
363
360
  const selector = z.string().trim().min(1);
364
361
  const timeoutMs = z.number().int().min(100).max(6e4).default(5e3);
365
362
  const scenarioSchema = z.strictObject({
@@ -490,8 +487,7 @@ async function runScenario(scenario, invoke, context, onStep, capture) {
490
487
  }
491
488
  }
492
489
  }
493
- //#endregion
494
- //#region src/snapshot.ts
490
+ // src/snapshot.ts
495
491
  const excluded = /* @__PURE__ */ new Set([
496
492
  "node_modules",
497
493
  ".git",
@@ -529,8 +525,7 @@ async function sourceSnapshot(project) {
529
525
  await walk(project.root);
530
526
  return hash.digest("hex");
531
527
  }
532
- //#endregion
533
- //#region src/verify.ts
528
+ // src/verify.ts
534
529
  async function verifyProject(config, context, originalFingerprint, onCheck, skipKinds = []) {
535
530
  await requireTrust(context);
536
531
  const checks = [];
@@ -591,8 +586,7 @@ function verificationTool(config, fingerprint) {
591
586
  }
592
587
  };
593
588
  }
594
- //#endregion
595
- //#region src/acceptance.ts
589
+ // src/acceptance.ts
596
590
  async function resolveProjectConfig(root, file) {
597
591
  return await loadAcceptanceConfig(root, file) ?? projectConfigSchema.parse({ verification: defaultVerification(await detectProject(root)) });
598
592
  }
@@ -1014,5 +1008,4 @@ var AcceptanceService = class AcceptanceService {
1014
1008
  await Promise.allSettled([...this.jobs.values()].map((job) => job.done));
1015
1009
  }
1016
1010
  };
1017
- //#endregion
1018
1011
  export { AcceptanceService, configurationSource, defaultVerification, detectProject, exists, findProjectRoot, loadAcceptanceConfig, projectConfigSchema, projectFingerprint, projectInstructions, redactValue, redactor, resolveProjectConfig, runScenario, runtimeInvoker, safePath, scenarioSchema, sourceSnapshot, stateRoot, verificationTool, verifyProject };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@weapp-vite/acceptance",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "description": "Deterministic mini-program acceptance and evidence",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/weapp-vite/weapp-vite#readme",
@@ -34,11 +34,11 @@
34
34
  "dist"
35
35
  ],
36
36
  "engines": {
37
- "node": ">=22.12.0"
37
+ "node": "^22.23.4 || ^24.22.1 || >=26.12.1"
38
38
  },
39
39
  "dependencies": {
40
- "execa": "10.1.0",
41
- "zod": "^4.6.5"
40
+ "execa": "10.2.1",
41
+ "zod": "^4.6.7"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@weapp-agent/core": "0.0.0"