agent-scenario-loop 0.1.3 → 0.1.5

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 (52) hide show
  1. package/app/profile-session.ts +263 -17
  2. package/dist/core/artifact-contract.d.ts +6 -4
  3. package/dist/core/artifact-contract.js +164 -15
  4. package/dist/core/artifact-layout.d.ts +2 -0
  5. package/dist/core/artifact-layout.js +2 -0
  6. package/dist/core/planner.js +4 -3
  7. package/dist/core/schema-validator.d.ts +1 -0
  8. package/dist/core/schema-validator.js +1 -0
  9. package/dist/runner/android-adb-driver.d.ts +7 -2
  10. package/dist/runner/android-adb-driver.js +7 -1
  11. package/dist/runner/android-adb.d.ts +40 -5
  12. package/dist/runner/android-adb.js +1046 -664
  13. package/dist/runner/ios-simctl.d.ts +1 -0
  14. package/dist/runner/ios-simctl.js +1 -0
  15. package/dist/runner/profile-android.d.ts +11 -1
  16. package/dist/runner/profile-android.js +266 -25
  17. package/dist/runner/profile-ios.d.ts +3 -2
  18. package/dist/runner/profile-ios.js +252 -22
  19. package/dist/runner/profile-mobile.d.ts +63 -4
  20. package/dist/runner/profile-mobile.js +1002 -20
  21. package/dist/runner/validate-project.js +3 -0
  22. package/dist/scripts/consumer-rehearsal.d.ts +127 -0
  23. package/dist/scripts/consumer-rehearsal.js +774 -0
  24. package/dist/scripts/downstream-local-package-gate.d.ts +2 -0
  25. package/dist/scripts/downstream-local-package-gate.js +264 -0
  26. package/dist/scripts/package-smoke.d.ts +104 -0
  27. package/dist/scripts/package-smoke.js +2304 -0
  28. package/dist/scripts/release-check.d.ts +47 -0
  29. package/dist/scripts/release-check.js +117 -0
  30. package/dist/scripts/release-readiness.d.ts +2 -0
  31. package/dist/scripts/release-readiness.js +539 -0
  32. package/docs/adapters.md +3 -1
  33. package/docs/api.md +2 -2
  34. package/docs/authoring.md +34 -2
  35. package/docs/consumer-rehearsal.md +33 -1
  36. package/docs/contracts.md +16 -2
  37. package/docs/live-proofs.md +12 -4
  38. package/examples/mobile-app/runner-manifests/evidence-provider.json +3 -3
  39. package/examples/mobile-app/scripts/asl-capture-profiler-provider.mjs +25 -0
  40. package/examples/runners/README.md +3 -3
  41. package/examples/runners/axe-accessibility-provider.json +2 -2
  42. package/examples/runners/script-accessibility-provider.json +2 -2
  43. package/examples/runners/script-memory-provider.json +2 -2
  44. package/examples/runners/script-network-provider.json +2 -2
  45. package/examples/runners/script-profiler-provider.json +2 -2
  46. package/package.json +12 -4
  47. package/schemas/manifest.schema.json +73 -3
  48. package/schemas/profiler.schema.json +243 -0
  49. package/schemas/runner-capabilities.schema.json +8 -2
  50. package/schemas/scenario.schema.json +18 -2
  51. package/templates/evidence-provider.json +3 -3
  52. package/templates/scripts/asl-capture-profiler-provider.mjs +20 -0
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env node
2
+ type RunOptions = {
3
+ cwd: string;
4
+ env: NodeJS.ProcessEnv;
5
+ };
6
+ /**
7
+ * Creates a clean npm environment for repeatable release gates.
8
+ *
9
+ * @param {string} tempRoot
10
+ * @returns {NodeJS.ProcessEnv}
11
+ */
12
+ declare function createReleaseEnv(tempRoot: string): NodeJS.ProcessEnv;
13
+ /**
14
+ * Resolves the per-command timeout for release gate child processes.
15
+ *
16
+ * @param {NodeJS.ProcessEnv} env
17
+ * @returns {number}
18
+ */
19
+ declare function resolveCommandTimeoutMs(env: NodeJS.ProcessEnv): number;
20
+ /**
21
+ * Runs a release command with inherited output.
22
+ *
23
+ * @param {string} command
24
+ * @param {string[]} args
25
+ * @param {RunOptions} options
26
+ * @returns {void}
27
+ */
28
+ declare function run(command: string, args: string[], options: RunOptions): void;
29
+ /**
30
+ * Packs the package once for downstream release gates.
31
+ *
32
+ * @param {{env: NodeJS.ProcessEnv, packageRoot: string, packDir: string}} options
33
+ * @returns {string}
34
+ */
35
+ declare function packReleasePackage({ env, packageRoot, packDir, }: {
36
+ env: NodeJS.ProcessEnv;
37
+ packageRoot: string;
38
+ packDir: string;
39
+ }): string;
40
+ /**
41
+ * Runs the full release check while reusing one package tarball for install
42
+ * smoke and consumer rehearsal.
43
+ *
44
+ * @returns {void}
45
+ */
46
+ declare function main(): void;
47
+ export { createReleaseEnv, main, packReleasePackage, resolveCommandTimeoutMs, run, };
@@ -0,0 +1,117 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.createReleaseEnv = createReleaseEnv;
5
+ exports.main = main;
6
+ exports.packReleasePackage = packReleasePackage;
7
+ exports.resolveCommandTimeoutMs = resolveCommandTimeoutMs;
8
+ exports.run = run;
9
+ const assert = require('node:assert/strict');
10
+ const fs = require('node:fs');
11
+ const os = require('node:os');
12
+ const path = require('node:path');
13
+ const { execFileSync } = require('node:child_process');
14
+ const DEFAULT_COMMAND_TIMEOUT_MS = 180_000;
15
+ /**
16
+ * Creates a clean npm environment for repeatable release gates.
17
+ *
18
+ * @param {string} tempRoot
19
+ * @returns {NodeJS.ProcessEnv}
20
+ */
21
+ function createReleaseEnv(tempRoot) {
22
+ const env = { ...process.env };
23
+ for (const key of Object.keys(env)) {
24
+ if (key.toLowerCase().startsWith('npm_config_')) {
25
+ delete env[key];
26
+ }
27
+ }
28
+ env.npm_config_audit = 'false';
29
+ env.npm_config_cache = path.join(tempRoot, 'npm-cache');
30
+ env.npm_config_fund = 'false';
31
+ env.npm_config_update_notifier = 'false';
32
+ return env;
33
+ }
34
+ /**
35
+ * Resolves the per-command timeout for release gate child processes.
36
+ *
37
+ * @param {NodeJS.ProcessEnv} env
38
+ * @returns {number}
39
+ */
40
+ function resolveCommandTimeoutMs(env) {
41
+ const timeoutMs = Number.parseInt(env.ASL_PACKAGE_GATE_TIMEOUT_MS ?? '', 10);
42
+ return Number.isFinite(timeoutMs) && timeoutMs > 0
43
+ ? timeoutMs
44
+ : DEFAULT_COMMAND_TIMEOUT_MS;
45
+ }
46
+ /**
47
+ * Runs a release command with inherited output.
48
+ *
49
+ * @param {string} command
50
+ * @param {string[]} args
51
+ * @param {RunOptions} options
52
+ * @returns {void}
53
+ */
54
+ function run(command, args, options) {
55
+ execFileSync(command, args, {
56
+ cwd: options.cwd,
57
+ env: options.env,
58
+ stdio: 'inherit',
59
+ timeout: resolveCommandTimeoutMs(options.env),
60
+ });
61
+ }
62
+ /**
63
+ * Packs the package once for downstream release gates.
64
+ *
65
+ * @param {{env: NodeJS.ProcessEnv, packageRoot: string, packDir: string}} options
66
+ * @returns {string}
67
+ */
68
+ function packReleasePackage({ env, packageRoot, packDir, }) {
69
+ fs.mkdirSync(packDir, { recursive: true });
70
+ const packOutput = execFileSync('npm', ['pack', '--pack-destination', packDir], {
71
+ cwd: packageRoot,
72
+ encoding: 'utf8',
73
+ env,
74
+ stdio: ['ignore', 'pipe', 'inherit'],
75
+ timeout: resolveCommandTimeoutMs(env),
76
+ });
77
+ const tarballName = packOutput.trim().split(/\n/u).pop();
78
+ assert.ok(tarballName, 'npm pack did not print a tarball name');
79
+ const tarballPath = path.join(packDir, tarballName);
80
+ assert.equal(fs.existsSync(tarballPath), true, `missing packed tarball: ${tarballPath}`);
81
+ return tarballPath;
82
+ }
83
+ /**
84
+ * Runs the full release check while reusing one package tarball for install
85
+ * smoke and consumer rehearsal.
86
+ *
87
+ * @returns {void}
88
+ */
89
+ function main() {
90
+ const repoRoot = path.resolve(__dirname, '..', '..');
91
+ const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'asl-release-check-'));
92
+ const env = createReleaseEnv(tempRoot);
93
+ try {
94
+ run('pnpm', ['test'], { cwd: repoRoot, env });
95
+ run(process.execPath, [path.join(repoRoot, 'dist', 'scripts', 'release-readiness.js')], { cwd: repoRoot, env });
96
+ const tarballPath = packReleasePackage({
97
+ env,
98
+ packageRoot: repoRoot,
99
+ packDir: path.join(tempRoot, 'pack'),
100
+ });
101
+ const gateEnv = {
102
+ ...env,
103
+ ASL_PACKAGE_TARBALL: tarballPath,
104
+ };
105
+ run(process.execPath, [path.join(repoRoot, 'dist', 'scripts', 'package-smoke.js')], { cwd: repoRoot, env: gateEnv });
106
+ run(process.execPath, [path.join(repoRoot, 'dist', 'scripts', 'consumer-rehearsal.js')], { cwd: repoRoot, env: gateEnv });
107
+ process.stdout.write(`release check passed: ${tarballPath}\n`);
108
+ fs.rmSync(tempRoot, { recursive: true, force: true });
109
+ }
110
+ catch (error) {
111
+ console.error(`release check temp kept at: ${tempRoot}`);
112
+ throw error;
113
+ }
114
+ }
115
+ if (require.main === module) {
116
+ main();
117
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};