@lesliechan721/aw 0.1.0-beta.14 → 0.1.0-beta.16

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 (49) hide show
  1. package/dist/src/commands/aw-capabilities.d.ts +1 -1
  2. package/dist/src/commands/aw-capabilities.js +1 -0
  3. package/dist/src/commands/aw-capabilities.js.map +1 -1
  4. package/dist/src/commands/review-inspection.d.ts +169 -0
  5. package/dist/src/commands/review-inspection.js +916 -0
  6. package/dist/src/commands/review-inspection.js.map +1 -0
  7. package/dist/src/commands/skill-eval.d.ts +5 -0
  8. package/dist/src/commands/skill-eval.js +86 -63
  9. package/dist/src/commands/skill-eval.js.map +1 -1
  10. package/dist/src/commands/status-v6.d.ts +2 -1
  11. package/dist/src/commands/status-v6.js +7 -1
  12. package/dist/src/commands/status-v6.js.map +1 -1
  13. package/dist/src/eval/manifest-v1.js +0 -5
  14. package/dist/src/eval/manifest-v1.js.map +1 -1
  15. package/dist/src/index.js +39 -6
  16. package/dist/src/index.js.map +1 -1
  17. package/dist/src/portable/commands.d.ts +1 -0
  18. package/dist/src/portable/commands.js +43 -1
  19. package/dist/src/portable/commands.js.map +1 -1
  20. package/dist/src/portable/materializer.d.ts +12 -0
  21. package/dist/src/portable/materializer.js +67 -41
  22. package/dist/src/portable/materializer.js.map +1 -1
  23. package/dist/src/review/eval-source-input.d.ts +43 -0
  24. package/dist/src/review/eval-source-input.js +207 -0
  25. package/dist/src/review/eval-source-input.js.map +1 -0
  26. package/dist/src/review/source-binding.d.ts +170 -0
  27. package/dist/src/review/source-binding.js +622 -0
  28. package/dist/src/review/source-binding.js.map +1 -0
  29. package/dist/src/tui/console-app-v4.js +523 -133
  30. package/dist/src/tui/console-app-v4.js.map +1 -1
  31. package/dist/src/tui/controller-runtime.js +59 -37
  32. package/dist/src/tui/controller-runtime.js.map +1 -1
  33. package/dist/src/tui/controller.d.ts +15 -1
  34. package/dist/src/tui/controller.js +86 -3
  35. package/dist/src/tui/controller.js.map +1 -1
  36. package/dist/src/tui/model.js +2 -3
  37. package/dist/src/tui/model.js.map +1 -1
  38. package/dist/src/tui/operation-review-planner.js +22 -1
  39. package/dist/src/tui/operation-review-planner.js.map +1 -1
  40. package/dist/src/tui/plugin-write-task.d.ts +2 -1
  41. package/dist/src/tui/plugin-write-task.js +17 -0
  42. package/dist/src/tui/plugin-write-task.js.map +1 -1
  43. package/dist/src/tui/router.d.ts +1 -0
  44. package/dist/src/tui/router.js +13 -5
  45. package/dist/src/tui/router.js.map +1 -1
  46. package/dist/src/tui/screen-registry.d.ts +21 -1
  47. package/dist/src/tui/screen-registry.js +5 -1
  48. package/dist/src/tui/screen-registry.js.map +1 -1
  49. package/package.json +3 -3
@@ -0,0 +1,207 @@
1
+ import crypto from 'node:crypto';
2
+ import path from 'node:path';
3
+ import { canonicalJson, } from '@lesliechan721/agent-skill-eval';
4
+ import fs from 'fs-extra';
5
+ import { resolveAwSkillEvalCustomCommand, } from '../eval/manifest-v1.js';
6
+ import { calculateFileDigest } from '../utils/bundle-integrity.js';
7
+ const digestPattern = /^sha256:[0-9a-f]{64}$/u;
8
+ const safeSegmentPattern = /^[A-Za-z0-9][A-Za-z0-9._-]*$/u;
9
+ const compareText = (left, right) => left < right ? -1 : left > right ? 1 : 0;
10
+ function digestCanonical(value) {
11
+ return `sha256:${crypto.createHash('sha256').update(canonicalJson(value)).digest('hex')}`;
12
+ }
13
+ function strictRecord(value, keys) {
14
+ return !!value
15
+ && typeof value === 'object'
16
+ && !Array.isArray(value)
17
+ && Object.keys(value).length === keys.length
18
+ && Object.keys(value).every((key) => keys.includes(key));
19
+ }
20
+ function digestString(value) {
21
+ return typeof value === 'string' && digestPattern.test(value);
22
+ }
23
+ function safeSegment(value) {
24
+ return typeof value === 'string' && safeSegmentPattern.test(value);
25
+ }
26
+ function normalizeRelativePath(value) {
27
+ if (typeof value !== 'string'
28
+ || value === ''
29
+ || value.includes('\\')
30
+ || path.posix.isAbsolute(value)
31
+ || path.win32.isAbsolute(value)
32
+ || path.posix.normalize(value) !== value
33
+ || value === '..'
34
+ || value.startsWith('../'))
35
+ throw new Error('Eval source input path must be a safe relative POSIX path.');
36
+ return value;
37
+ }
38
+ function workspaceRelativePath(workspaceRoot, target) {
39
+ const relative = path.relative(workspaceRoot, target).split(path.sep).join('/');
40
+ return normalizeRelativePath(relative);
41
+ }
42
+ function evalInputDigest(input) {
43
+ return digestCanonical(input);
44
+ }
45
+ export function parseAwSourceBindingEvalInput(value) {
46
+ const row = value;
47
+ if (!strictRecord(row, [
48
+ 'manifestPath',
49
+ 'casesPath',
50
+ 'selectedCaseIds',
51
+ 'suiteDefaultsDigest',
52
+ 'selectedCasesDigest',
53
+ 'fixturesDigest',
54
+ 'providerDigest',
55
+ 'inputDigest',
56
+ ])
57
+ || !Array.isArray(row.selectedCaseIds)
58
+ || row.selectedCaseIds.length === 0
59
+ || !digestString(row.suiteDefaultsDigest)
60
+ || !digestString(row.selectedCasesDigest)
61
+ || !digestString(row.fixturesDigest)
62
+ || !digestString(row.providerDigest)
63
+ || !digestString(row.inputDigest))
64
+ throw new Error('Eval source input is invalid.');
65
+ const selectedCaseIds = row.selectedCaseIds.map((entry) => {
66
+ if (!safeSegment(entry))
67
+ throw new Error('Eval source input case id is invalid.');
68
+ return entry;
69
+ });
70
+ if (new Set(selectedCaseIds).size !== selectedCaseIds.length) {
71
+ throw new Error('Eval source input case ids must be unique.');
72
+ }
73
+ const unsigned = {
74
+ manifestPath: normalizeRelativePath(row.manifestPath),
75
+ casesPath: normalizeRelativePath(row.casesPath),
76
+ selectedCaseIds,
77
+ suiteDefaultsDigest: row.suiteDefaultsDigest,
78
+ selectedCasesDigest: row.selectedCasesDigest,
79
+ fixturesDigest: row.fixturesDigest,
80
+ providerDigest: row.providerDigest,
81
+ };
82
+ if (row.inputDigest !== evalInputDigest(unsigned)) {
83
+ throw new Error('Eval source input digest is invalid.');
84
+ }
85
+ return { ...unsigned, inputDigest: row.inputDigest };
86
+ }
87
+ export function selectAwSourceBindingEvalCases(document, selection) {
88
+ if ('caseIds' in selection) {
89
+ if (selection.caseIds.length === 0
90
+ || selection.caseIds.some((caseId) => !safeSegment(caseId))
91
+ || new Set(selection.caseIds).size !== selection.caseIds.length)
92
+ throw new Error('Eval case id selection is invalid.');
93
+ const requested = new Set(selection.caseIds);
94
+ const cases = document.cases.filter((entry) => requested.has(entry.id));
95
+ if (cases.length !== requested.size)
96
+ throw new Error('Eval case selection matched no cases.');
97
+ return { ...document, cases };
98
+ }
99
+ if (selection.split !== null && selection.split !== 'all' && !safeSegment(selection.split)) {
100
+ throw new Error('Eval split must be a safe path segment or all.');
101
+ }
102
+ if (selection.caseId !== null && !safeSegment(selection.caseId)) {
103
+ throw new Error('Eval case id must be a safe path segment.');
104
+ }
105
+ const splitCases = selection.split === null || selection.split === 'all'
106
+ ? document.cases
107
+ : document.cases.filter((entry) => entry.split === selection.split);
108
+ const cases = selection.caseId === null
109
+ ? splitCases
110
+ : splitCases.filter((entry) => entry.id === selection.caseId);
111
+ if (cases.length === 0)
112
+ throw new Error('Eval case selection matched no cases.');
113
+ return { ...document, cases };
114
+ }
115
+ export function computeAwSourceBindingSelectedCasesDigest(document) {
116
+ return digestCanonical(document);
117
+ }
118
+ export function computeAwSourceBindingSuiteDefaultsDigest(suite, defaults) {
119
+ return digestCanonical({ suite, defaults });
120
+ }
121
+ export async function resolveAwSourceBindingEvalProvider(options) {
122
+ if (options.suite.kind === 'trigger')
123
+ return 'codex-trigger';
124
+ if (options.suite.kind === 'conversation')
125
+ return 'codex-conversation';
126
+ const resolved = await resolveAwSkillEvalCustomCommand(options.evalRoot, options.suite.provider);
127
+ const command = [...resolved.command];
128
+ for (const [index, { prefix, relative }] of resolved.localArguments) {
129
+ if (!await fs.pathExists(path.join(options.preparedEvalRoot, relative))) {
130
+ throw new Error(`Prepared custom provider asset is missing: ${relative}`);
131
+ }
132
+ command[index] = `${prefix}workspace/eval/${relative}`;
133
+ }
134
+ return options.suite.provider.type === 'custom-process'
135
+ ? { type: 'custom-process', command }
136
+ : {
137
+ type: 'codex-workflow',
138
+ command,
139
+ allowedModels: options.suite.provider.allowedModels,
140
+ };
141
+ }
142
+ async function collectFixtureRecords(root, excludedPaths) {
143
+ const rootInfo = await fs.lstat(root);
144
+ if (!rootInfo.isDirectory() || rootInfo.isSymbolicLink()) {
145
+ throw new Error('Eval fixture root must be a regular directory.');
146
+ }
147
+ const directories = [];
148
+ const files = [];
149
+ const walk = async (directory, relativeDirectory = '') => {
150
+ const entries = await fs.readdir(directory, { withFileTypes: true });
151
+ entries.sort((left, right) => compareText(left.name, right.name));
152
+ for (const entry of entries) {
153
+ const absolutePath = path.join(directory, entry.name);
154
+ const relativePath = path.posix.join(relativeDirectory, entry.name);
155
+ if (excludedPaths.has(relativePath))
156
+ continue;
157
+ const info = await fs.lstat(absolutePath);
158
+ if (info.isSymbolicLink())
159
+ throw new Error(`Eval fixture path contains a symbolic link: ${relativePath}`);
160
+ if (info.isDirectory()) {
161
+ directories.push(relativePath);
162
+ await walk(absolutePath, relativePath);
163
+ }
164
+ else if (info.isFile()) {
165
+ files.push({
166
+ path: relativePath,
167
+ mode: process.platform !== 'win32' && (info.mode & 0o111) !== 0 ? '100755' : '100644',
168
+ digest: await calculateFileDigest(absolutePath),
169
+ });
170
+ }
171
+ else {
172
+ throw new Error(`Eval fixture path has an unsupported node: ${relativePath}`);
173
+ }
174
+ }
175
+ };
176
+ await walk(root);
177
+ directories.sort(compareText);
178
+ files.sort((left, right) => compareText(left.path, right.path));
179
+ return { directories, files };
180
+ }
181
+ export async function resolveEvalSourceBindingInput(options) {
182
+ const selectedCases = selectAwSourceBindingEvalCases(options.cases, options.selection);
183
+ if (!digestString(options.providerDigest))
184
+ throw new Error('Eval provider digest is invalid.');
185
+ const fixtureRecords = await collectFixtureRecords(options.evalRoot, new Set(['manifest.json', ...options.corpusPaths]));
186
+ const fixturesDigest = digestCanonical(fixtureRecords);
187
+ if (options.preparedEvalRoot) {
188
+ const preparedFixtures = await collectFixtureRecords(options.preparedEvalRoot, new Set());
189
+ if (digestCanonical(preparedFixtures) !== fixturesDigest) {
190
+ throw new Error('Prepared Eval fixtures do not match the current source fixtures.');
191
+ }
192
+ }
193
+ const unsigned = {
194
+ manifestPath: workspaceRelativePath(options.workspaceRoot, options.manifestPath),
195
+ casesPath: workspaceRelativePath(options.workspaceRoot, path.join(options.evalRoot, options.suite.cases)),
196
+ selectedCaseIds: selectedCases.cases.map((entry) => entry.id),
197
+ suiteDefaultsDigest: computeAwSourceBindingSuiteDefaultsDigest(options.suite, options.defaults),
198
+ selectedCasesDigest: computeAwSourceBindingSelectedCasesDigest(selectedCases),
199
+ fixturesDigest,
200
+ providerDigest: options.providerDigest,
201
+ };
202
+ return {
203
+ selectedCases,
204
+ input: { ...unsigned, inputDigest: evalInputDigest(unsigned) },
205
+ };
206
+ }
207
+ //# sourceMappingURL=eval-source-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eval-source-input.js","sourceRoot":"","sources":["../../../src/review/eval-source-input.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EACL,aAAa,GAGd,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,MAAM,UAAU,CAAA;AAEzB,OAAO,EACL,+BAA+B,GAGhC,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAElE,MAAM,aAAa,GAAG,wBAAwB,CAAA;AAC9C,MAAM,kBAAkB,GAAG,+BAA+B,CAAA;AAC1D,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,KAAa,EAAU,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAiCrG,SAA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in-core';
2
+ import type { AwSkillEvalMaterializationProfile } from '../../scripts/aw-skill-eval-materializer.js';
3
+ import { type AwSkillEvalManifestV1Profile } from '../eval/manifest-v1.js';
4
+ import type { CatalogSourceResolution, PluginMeta, Scope } from '../types.js';
5
+ import { type ResolvedArtifactRenderConfig } from '../utils/artifact-renderer.js';
6
+ import { type AwSourceBindingEvalInput } from './eval-source-input.js';
7
+ export { computeAwSourceBindingSelectedCasesDigest, computeAwSourceBindingSuiteDefaultsDigest, resolveAwSourceBindingEvalProvider, resolveEvalSourceBindingInput, selectAwSourceBindingEvalCases, type AwSourceBindingEvalCaseSelection, type AwSourceBindingEvalInput, type ResolvedEvalSourceBindingInput, } from './eval-source-input.js';
8
+ export declare const AW_SOURCE_BINDING_FILENAME = "aw-source-binding.json";
9
+ export interface AwWorkspaceBindingSource {
10
+ kind: 'workspace';
11
+ workspaceIdentity: string;
12
+ sourceIdentity: string;
13
+ }
14
+ export interface AwCatalogSnapshotBindingSource {
15
+ kind: 'catalog-snapshot';
16
+ sourceId: string;
17
+ catalogSourceIdentity: string;
18
+ logicalIdentity: string;
19
+ snapshotDigest: string;
20
+ workspaceIdentity: string;
21
+ workspaceSourceIdentity: string;
22
+ }
23
+ export type AwSourceBindingSource = AwWorkspaceBindingSource | AwCatalogSnapshotBindingSource;
24
+ export interface AwSourceBindingSubject {
25
+ plugin: string;
26
+ skill?: string;
27
+ suite?: string;
28
+ }
29
+ export type AwSourceBindingProfile = {
30
+ kind: 'eval';
31
+ id: string;
32
+ scope: Scope;
33
+ inputDigest: string;
34
+ } | {
35
+ kind: 'portable';
36
+ id: `agent-skills-${Scope}`;
37
+ scope: Scope;
38
+ inputDigest: string;
39
+ };
40
+ export type AwSourceBindingArtifact = {
41
+ kind: 'eval-target';
42
+ skill: string;
43
+ path: string;
44
+ digest: string;
45
+ } | {
46
+ kind: 'eval-workspace';
47
+ path: string;
48
+ digest: string;
49
+ } | {
50
+ kind: 'eval-cases';
51
+ path: string;
52
+ digest: string;
53
+ } | {
54
+ kind: 'portable-skill';
55
+ plugin: string;
56
+ skill: string;
57
+ path: string;
58
+ digest: string;
59
+ };
60
+ export type AwSourceBindingArtifactInput = {
61
+ kind: 'eval-target';
62
+ skill: string;
63
+ path: string;
64
+ } | {
65
+ kind: 'eval-workspace';
66
+ path: string;
67
+ } | {
68
+ kind: 'eval-cases';
69
+ path: string;
70
+ } | {
71
+ kind: 'portable-skill';
72
+ plugin: string;
73
+ skill: string;
74
+ path: string;
75
+ };
76
+ export type AwSourceBindingVerifiedOutput = AwSourceBindingArtifact;
77
+ export interface AwSourceBindingV1 {
78
+ schemaVersion: 1;
79
+ kind: 'aw-source-binding';
80
+ source: AwSourceBindingSource;
81
+ subject: AwSourceBindingSubject;
82
+ profile: AwSourceBindingProfile;
83
+ evalInput?: AwSourceBindingEvalInput;
84
+ artifacts: AwSourceBindingArtifact[];
85
+ finalDigest: string;
86
+ }
87
+ export interface AwSourceBindingIssue {
88
+ code: 'sourceBindingMissing' | 'sourceBindingInvalid' | 'sourceBindingSubjectDrift' | 'sourceBindingSourceDrift' | 'sourceBindingProfileDrift' | 'sourceBindingEvalInputDrift' | 'sourceBindingArtifactDrift';
89
+ message: string;
90
+ }
91
+ export type AwSourceBindingValidation = {
92
+ state: 'verified';
93
+ binding: AwSourceBindingV1;
94
+ outputs: AwSourceBindingVerifiedOutput[];
95
+ issues: [];
96
+ } | {
97
+ state: 'incomplete' | 'invalid' | 'drifted';
98
+ binding: AwSourceBindingV1 | null;
99
+ outputs: [];
100
+ issues: AwSourceBindingIssue[];
101
+ };
102
+ export interface WriteAwSourceBindingOptions {
103
+ rootDir: string;
104
+ source: AwSourceBindingSource;
105
+ subject: AwSourceBindingSubject;
106
+ profile: AwSourceBindingProfile;
107
+ evalInput?: AwSourceBindingEvalInput;
108
+ artifacts: AwSourceBindingArtifactInput[];
109
+ }
110
+ export interface AwSourceBindingWorkspaceValidationContext {
111
+ workspace: CatalogWorkspace;
112
+ source: AwWorkspaceBindingSource;
113
+ }
114
+ export interface EvalProfileBindingInput {
115
+ profile: AwSourceBindingProfile & {
116
+ kind: 'eval';
117
+ };
118
+ materializationProfile: AwSkillEvalMaterializationProfile;
119
+ }
120
+ export interface PortablePluginProfileConfig {
121
+ config: ResolvedArtifactRenderConfig;
122
+ digest: string;
123
+ }
124
+ export declare function parseAwSourceBinding(value: unknown): AwSourceBindingV1;
125
+ export declare function writeAwSourceBinding(options: WriteAwSourceBindingOptions): Promise<{
126
+ bindingPath: string;
127
+ binding: AwSourceBindingV1;
128
+ }>;
129
+ export declare function resolveWorkspaceBindingSource(workspace: Pick<CatalogWorkspace, 'workspaceRoot' | 'workspaceIdentity' | 'metadataPath' | 'plugins'>): Promise<AwWorkspaceBindingSource>;
130
+ export declare function resolveCatalogSnapshotBindingSource(source: Pick<CatalogSourceResolution, 'sourceId' | 'sourceIdentity' | 'logicalIdentity' | 'snapshotDigest' | 'rootDir'>): Promise<AwCatalogSnapshotBindingSource>;
131
+ export declare function resolveEvalProfileBindingInput(profile: AwSkillEvalManifestV1Profile, plugins: readonly PluginMeta[]): EvalProfileBindingInput;
132
+ export declare function resolvePortablePluginProfileConfig(options: {
133
+ plugin: PluginMeta;
134
+ scope: Scope;
135
+ cwd: string;
136
+ env?: NodeJS.ProcessEnv;
137
+ sourceId?: string;
138
+ catalogSourceIdentity?: string;
139
+ logicalIdentity?: string;
140
+ }): Promise<PortablePluginProfileConfig>;
141
+ export declare function resolvePortableProfileBindingInput(options: {
142
+ plugins: readonly PluginMeta[];
143
+ pluginName: string;
144
+ scope: Scope;
145
+ cwd: string;
146
+ env?: NodeJS.ProcessEnv;
147
+ sourceId?: string;
148
+ catalogSourceIdentity?: string;
149
+ logicalIdentity?: string;
150
+ }): Promise<AwSourceBindingProfile & {
151
+ kind: 'portable';
152
+ }>;
153
+ export declare function resolveCurrentWorkspaceAwSourceBinding(options: {
154
+ context: AwSourceBindingWorkspaceValidationContext;
155
+ binding: AwSourceBindingV1;
156
+ cwd?: string;
157
+ env?: NodeJS.ProcessEnv;
158
+ }): Promise<{
159
+ source: AwWorkspaceBindingSource;
160
+ profile: AwSourceBindingProfile;
161
+ }>;
162
+ export declare function createAwSourceBindingWorkspaceValidationContext(workspaceRoot: string): Promise<AwSourceBindingWorkspaceValidationContext>;
163
+ export declare function readAwSourceBinding(bindingPath: string): Promise<AwSourceBindingV1>;
164
+ export declare function validateAwSourceBindingForWorkspace(options: {
165
+ bindingPath: string;
166
+ context: AwSourceBindingWorkspaceValidationContext;
167
+ expectedSubject: AwSourceBindingSubject;
168
+ cwd?: string;
169
+ env?: NodeJS.ProcessEnv;
170
+ }): Promise<AwSourceBindingValidation>;