agent-scenario-loop 0.1.2 → 0.1.4

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 (87) hide show
  1. package/README.md +9 -9
  2. package/app/profile-session.ts +352 -12
  3. package/dist/core/agent-summary.d.ts +3 -2
  4. package/dist/core/agent-summary.js +44 -2
  5. package/dist/core/artifact-contract.d.ts +28 -8
  6. package/dist/core/artifact-contract.js +676 -26
  7. package/dist/core/comparison.d.ts +57 -3
  8. package/dist/core/comparison.js +113 -1
  9. package/dist/core/planner.d.ts +32 -1
  10. package/dist/core/planner.js +144 -0
  11. package/dist/core/run-index.d.ts +4 -0
  12. package/dist/core/run-index.js +55 -1
  13. package/dist/core/schema-validator.d.ts +2 -0
  14. package/dist/core/schema-validator.js +2 -0
  15. package/dist/runner/android-adb-driver.d.ts +7 -2
  16. package/dist/runner/android-adb-driver.js +7 -1
  17. package/dist/runner/android-adb.d.ts +40 -5
  18. package/dist/runner/android-adb.js +1046 -664
  19. package/dist/runner/compare-latest.d.ts +8 -4
  20. package/dist/runner/compare-latest.js +24 -5
  21. package/dist/runner/example-android-live.d.ts +10 -1
  22. package/dist/runner/example-android-live.js +55 -0
  23. package/dist/runner/example-ios-live.d.ts +10 -1
  24. package/dist/runner/example-ios-live.js +55 -0
  25. package/dist/runner/ios-simctl.d.ts +6 -0
  26. package/dist/runner/ios-simctl.js +7 -0
  27. package/dist/runner/live-comparison.d.ts +2 -2
  28. package/dist/runner/live-comparison.js +2 -1
  29. package/dist/runner/live-proof-summary.d.ts +5 -4
  30. package/dist/runner/live-proof-summary.js +12 -2
  31. package/dist/runner/live-proof.d.ts +3 -2
  32. package/dist/runner/live-proof.js +9 -2
  33. package/dist/runner/profile-android.d.ts +16 -1
  34. package/dist/runner/profile-android.js +364 -26
  35. package/dist/runner/profile-ios.d.ts +13 -2
  36. package/dist/runner/profile-ios.js +341 -19
  37. package/dist/runner/profile-mobile.d.ts +39 -3
  38. package/dist/runner/profile-mobile.js +1054 -42
  39. package/dist/runner/validate-project.js +3 -0
  40. package/dist/scripts/consumer-rehearsal.d.ts +119 -0
  41. package/dist/scripts/consumer-rehearsal.js +757 -0
  42. package/dist/scripts/downstream-local-package-gate.d.ts +2 -0
  43. package/dist/scripts/downstream-local-package-gate.js +264 -0
  44. package/dist/scripts/package-smoke.d.ts +96 -0
  45. package/dist/scripts/package-smoke.js +2282 -0
  46. package/dist/scripts/release-readiness.d.ts +2 -0
  47. package/dist/scripts/release-readiness.js +520 -0
  48. package/docs/adapters.md +7 -1
  49. package/docs/api.md +2 -2
  50. package/docs/architecture.md +90 -0
  51. package/docs/authoring.md +39 -3
  52. package/docs/concepts.md +3 -24
  53. package/docs/consumer-rehearsal.md +31 -1
  54. package/docs/contracts.md +45 -101
  55. package/docs/external-adapter-protocol.md +219 -0
  56. package/docs/live-proofs.md +86 -3
  57. package/docs/principles.md +9 -15
  58. package/examples/mobile-app/README.md +12 -0
  59. package/examples/mobile-app/runner-manifests/evidence-provider.json +3 -3
  60. package/examples/mobile-app/runner-manifests/primary-runner.json +1 -0
  61. package/examples/mobile-app/scripts/asl-capture-profiler-provider.mjs +25 -0
  62. package/examples/runners/README.md +4 -3
  63. package/examples/runners/adb-android.json +1 -0
  64. package/examples/runners/agent-device-android.json +1 -0
  65. package/examples/runners/agent-device-ios.json +1 -0
  66. package/examples/runners/argent-android.json +1 -0
  67. package/examples/runners/argent-ios.json +1 -0
  68. package/examples/runners/axe-accessibility-provider.json +2 -2
  69. package/examples/runners/script-accessibility-provider.json +2 -2
  70. package/examples/runners/script-memory-provider.json +2 -2
  71. package/examples/runners/script-network-provider.json +2 -2
  72. package/examples/runners/script-profiler-provider.json +2 -2
  73. package/examples/runners/xcodebuildmcp-ios.json +1 -0
  74. package/package.json +12 -3
  75. package/schemas/causal-run.schema.json +85 -2
  76. package/schemas/comparison.schema.json +130 -2
  77. package/schemas/external-adapter-message.schema.json +693 -0
  78. package/schemas/health.schema.json +72 -0
  79. package/schemas/live-proof-set.schema.json +1 -1
  80. package/schemas/live-proof.schema.json +14 -6
  81. package/schemas/manifest.schema.json +515 -4
  82. package/schemas/profiler.schema.json +243 -0
  83. package/schemas/runner-capabilities.schema.json +28 -2
  84. package/schemas/scenario.schema.json +34 -2
  85. package/templates/evidence-provider.json +3 -3
  86. package/templates/primary-runner.json +1 -0
  87. package/templates/scripts/asl-capture-profiler-provider.mjs +20 -0
@@ -541,6 +541,9 @@ function escapeRegExp(value) {
541
541
  * @returns {boolean}
542
542
  */
543
543
  function hasNamedExport(source, exportName) {
544
+ if (/^\s*export\s+\*\s+from\s+['"][^'"]*agent-scenario-loop\/app\/profile-session['"]\s*;?/mu.test(source)) {
545
+ return true;
546
+ }
544
547
  const escapedName = escapeRegExp(exportName);
545
548
  const directExport = new RegExp(`^\\s*export\\s+(?:async\\s+)?(?:function|const|let|var)\\s+${escapedName}\\b`, 'mu');
546
549
  if (directExport.test(source)) {
@@ -0,0 +1,119 @@
1
+ #!/usr/bin/env node
2
+ type RunOptions = {
3
+ cwd: string;
4
+ env: NodeJS.ProcessEnv;
5
+ };
6
+ type FailedRunOutput = {
7
+ status: number | null;
8
+ stderr: string;
9
+ stdout: string;
10
+ };
11
+ /**
12
+ * Creates a clean npm environment for local tarball install rehearsals.
13
+ *
14
+ * @param {string} tempRoot
15
+ * @returns {NodeJS.ProcessEnv}
16
+ */
17
+ declare function createRehearsalEnv(tempRoot: string): NodeJS.ProcessEnv;
18
+ /**
19
+ * Runs a command and returns stdout while preserving child stderr on failure.
20
+ *
21
+ * @param {string} command
22
+ * @param {string[]} args
23
+ * @param {RunOptions} options
24
+ * @returns {string}
25
+ */
26
+ declare function run(command: string, args: string[], options: RunOptions): string;
27
+ /**
28
+ * Runs a command that must fail and returns captured output.
29
+ *
30
+ * @param {string} command
31
+ * @param {string[]} args
32
+ * @param {RunOptions} options
33
+ * @returns {FailedRunOutput}
34
+ */
35
+ declare function runExpectFailure(command: string, args: string[], options: RunOptions): FailedRunOutput;
36
+ /**
37
+ * Reads and parses a JSON file.
38
+ *
39
+ * @param {string} filePath
40
+ * @returns {Record<string, unknown>}
41
+ */
42
+ declare function readJson(filePath: string): Record<string, unknown>;
43
+ /**
44
+ * Writes stable formatted JSON.
45
+ *
46
+ * @param {string} filePath
47
+ * @param {unknown} value
48
+ * @returns {void}
49
+ */
50
+ declare function writeJson(filePath: string, value: unknown): void;
51
+ /**
52
+ * Resolves a package binary path inside a temporary npm app.
53
+ *
54
+ * @param {string} appRoot
55
+ * @param {string} name
56
+ * @returns {string}
57
+ */
58
+ declare function packageBinPath(appRoot: string, name: string): string;
59
+ /**
60
+ * Packs the current repo and returns the tarball path.
61
+ *
62
+ * @param {{env: NodeJS.ProcessEnv, packageRoot: string, packDir: string}} options
63
+ * @returns {string}
64
+ */
65
+ declare function packPackage({ env, packageRoot, packDir, }: {
66
+ env: NodeJS.ProcessEnv;
67
+ packageRoot: string;
68
+ packDir: string;
69
+ }): string;
70
+ /**
71
+ * Creates an existing app layout before Agent Scenario Loop initialization.
72
+ *
73
+ * @param {string} appRoot
74
+ * @returns {void}
75
+ */
76
+ declare function writeExistingAppFixture(appRoot: string): void;
77
+ /**
78
+ * Writes deterministic profile-event logs for the initialized consumer scenario.
79
+ *
80
+ * @param {string} appRoot
81
+ * @returns {{androidEvents: string, iosEvents: string}}
82
+ */
83
+ declare function writeProfileEventFixtures(appRoot: string): {
84
+ androidEvents: string;
85
+ iosEvents: string;
86
+ };
87
+ /**
88
+ * Writes a tiny Argent-compatible command for consumer-script rehearsal.
89
+ *
90
+ * @param {string} filePath
91
+ * @returns {void}
92
+ */
93
+ declare function writeFakeArgent(filePath: string): void;
94
+ /**
95
+ * Merges generated Agent Scenario Loop package-script snippets into the app package.json.
96
+ *
97
+ * @param {string} appRoot
98
+ * @returns {Record<string, string>}
99
+ */
100
+ declare function mergeGeneratedScripts(appRoot: string): Record<string, string>;
101
+ /**
102
+ * Replaces scaffold placeholders with realistic app identifiers before validation.
103
+ *
104
+ * @param {string} appRoot
105
+ * @returns {void}
106
+ */
107
+ declare function replaceConfigPlaceholders(appRoot: string): void;
108
+ /**
109
+ * Asserts that the installed package can initialize and validate an existing app.
110
+ *
111
+ * @param {{appRoot: string, env: NodeJS.ProcessEnv, tarballPath: string}} options
112
+ * @returns {void}
113
+ */
114
+ declare function rehearseConsumerInstall({ appRoot, env, tarballPath, }: {
115
+ appRoot: string;
116
+ env: NodeJS.ProcessEnv;
117
+ tarballPath: string;
118
+ }): void;
119
+ export { createRehearsalEnv, mergeGeneratedScripts, packageBinPath, packPackage, readJson, rehearseConsumerInstall, replaceConfigPlaceholders, run, runExpectFailure, writeFakeArgent, writeExistingAppFixture, writeProfileEventFixtures, writeJson, };