@lesliechan721/aw 0.1.0-beta.11 → 0.1.0-beta.12

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/dist/authoring/scripts/validate-plugin.mjs +33 -42
  2. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
  3. package/dist/src/commands/operation-planner.js +11 -1
  4. package/dist/src/commands/operation-planner.js.map +1 -1
  5. package/dist/src/commands/rebuild-command.d.ts +12 -0
  6. package/dist/src/commands/rebuild-command.js +72 -17
  7. package/dist/src/commands/rebuild-command.js.map +1 -1
  8. package/dist/src/commands/rebuild-integration.d.ts +1 -0
  9. package/dist/src/commands/rebuild-integration.js +138 -41
  10. package/dist/src/commands/rebuild-integration.js.map +1 -1
  11. package/dist/src/commands/status-v6.js +6 -6
  12. package/dist/src/commands/status-v6.js.map +1 -1
  13. package/dist/src/index.js +52 -14
  14. package/dist/src/index.js.map +1 -1
  15. package/dist/src/portable/materializer.js +5 -3
  16. package/dist/src/portable/materializer.js.map +1 -1
  17. package/dist/src/tui/console-app-v4.js +1 -21
  18. package/dist/src/tui/console-app-v4.js.map +1 -1
  19. package/dist/src/tui/controller-runtime.js +165 -48
  20. package/dist/src/tui/controller-runtime.js.map +1 -1
  21. package/dist/src/tui/controller.d.ts +4 -4
  22. package/dist/src/tui/controller.js +19 -7
  23. package/dist/src/tui/controller.js.map +1 -1
  24. package/dist/src/tui/diagnostics.js +6 -6
  25. package/dist/src/tui/diagnostics.js.map +1 -1
  26. package/dist/src/tui/operation-review-planner.js +66 -19
  27. package/dist/src/tui/operation-review-planner.js.map +1 -1
  28. package/dist/src/utils/artifact-plan.d.ts +2 -2
  29. package/dist/src/utils/artifact-plan.js +8 -6
  30. package/dist/src/utils/artifact-plan.js.map +1 -1
  31. package/dist/src/utils/artifact-renderer.js +96 -77
  32. package/dist/src/utils/artifact-renderer.js.map +1 -1
  33. package/dist/src/utils/artifact-request.d.ts +5 -0
  34. package/dist/src/utils/artifact-request.js +40 -0
  35. package/dist/src/utils/artifact-request.js.map +1 -1
  36. package/dist/src/utils/plugin-config-impact.d.ts +33 -0
  37. package/dist/src/utils/plugin-config-impact.js +298 -0
  38. package/dist/src/utils/plugin-config-impact.js.map +1 -0
  39. package/dist/src/utils/plugin-config-write.d.ts +22 -2
  40. package/dist/src/utils/plugin-config-write.js +368 -104
  41. package/dist/src/utils/plugin-config-write.js.map +1 -1
  42. package/dist/src/utils/plugin-config.d.ts +10 -0
  43. package/dist/src/utils/plugin-config.js +39 -22
  44. package/dist/src/utils/plugin-config.js.map +1 -1
  45. package/dist/src/utils/plugin-scripts.js +47 -39
  46. package/dist/src/utils/plugin-scripts.js.map +1 -1
  47. package/dist/src/utils/project-boundary.js +22 -9
  48. package/dist/src/utils/project-boundary.js.map +1 -1
  49. package/dist/src/utils/sensitive-content.d.ts +3 -0
  50. package/dist/src/utils/sensitive-content.js +28 -7
  51. package/dist/src/utils/sensitive-content.js.map +1 -1
  52. package/package.json +3 -3
@@ -1706,35 +1706,6 @@ function defaultConfigValues(manifest) {
1706
1706
  }
1707
1707
  return values;
1708
1708
  }
1709
- function collectScalarLeafTokens(value) {
1710
- if (typeof value === 'string')
1711
- return value === '' ? [] : [value];
1712
- if (typeof value === 'number' || typeof value === 'boolean')
1713
- return [String(value)];
1714
- if (value === null || typeof value !== 'object')
1715
- return [];
1716
- return Object.values(value).flatMap(collectScalarLeafTokens);
1717
- }
1718
- function collectSensitiveDefaultConfigValues(manifest) {
1719
- return Object.values(manifest.config?.fields ?? {}).flatMap((field) => {
1720
- if (!isRecord(field) || !Object.prototype.hasOwnProperty.call(field, 'default')) {
1721
- return [];
1722
- }
1723
- const value = field.default;
1724
- if (field.sensitive === true)
1725
- return collectScalarLeafTokens(value);
1726
- if (field.type !== 'object' || value === null || typeof value !== 'object') {
1727
- return [];
1728
- }
1729
- return Object.entries(value).flatMap(([property, childValue]) => {
1730
- const child = field.properties?.[property]
1731
- ?? (field.additionalProperties === false ? undefined : field.additionalProperties);
1732
- return isRecord(child) && child.sensitive === true
1733
- ? collectScalarLeafTokens(childValue)
1734
- : [];
1735
- });
1736
- });
1737
- }
1738
1709
  function configFieldContainsSensitiveValue(field) {
1739
1710
  if (!isRecord(field))
1740
1711
  return false;
@@ -1941,10 +1912,15 @@ function validateArtifactTargetEntry(entry, index, manifest, pluginDir) {
1941
1912
  error(`${fieldName}.refreshKeys[${refreshIndex}]: unknown config key "${refreshKey}"`);
1942
1913
  continue;
1943
1914
  }
1944
- if (delivery?.mode === 'codex-native'
1945
- && configFieldContainsSensitiveValue(manifest.config?.fields?.[refreshKey])) {
1946
- error(`codexNativeRenderSensitiveRefreshKey: ${fieldName}.refreshKeys[${refreshIndex}]: ` +
1947
- `codex-native renderers cannot read sensitive config field "${refreshKey}"`);
1915
+ const sensitiveRefreshKey = configFieldContainsSensitiveValue(manifest.config?.fields?.[refreshKey]);
1916
+ const skillTarget = artifactTarget === 'codex.skill'
1917
+ || artifactTarget === 'claude.skill'
1918
+ || artifactTarget === 'agent-skills.skill';
1919
+ if (skillTarget && sensitiveRefreshKey) {
1920
+ const native = delivery?.mode === 'codex-native';
1921
+ error(`${native ? 'codexNativeRenderSensitiveRefreshKey' : 'skillRenderSensitiveRefreshKey'}: ` +
1922
+ `${fieldName}.refreshKeys[${refreshIndex}]: ` +
1923
+ `${native ? 'codex-native renderers' : 'Skill renderers'} cannot read sensitive config field "${refreshKey}"`);
1948
1924
  }
1949
1925
  }
1950
1926
  if (target.requiresCodexProjectConfig !== undefined &&
@@ -2382,15 +2358,11 @@ function validateRenderedSkillTree(options) {
2382
2358
  if (!readme || readme.toString('utf8').trim() === '') {
2383
2359
  error(`${fieldName} final file tree must contain a non-empty README.md`);
2384
2360
  }
2385
- const sensitiveValues = collectSensitiveDefaultConfigValues(manifest);
2386
2361
  for (const [relativePath, content] of files) {
2387
2362
  const text = content.toString('utf8');
2388
2363
  if (/\{\{[^{}]+\}\}/u.test(text)) {
2389
2364
  error(`${fieldName} final file tree contains an unresolved template in "${relativePath}"`);
2390
2365
  }
2391
- if (sensitiveValues.some((value) => text.includes(value))) {
2392
- error(`${fieldName} final file tree exposes sensitive config in "${relativePath}"`);
2393
- }
2394
2366
  }
2395
2367
  if (declaration.target === 'codex.skill') {
2396
2368
  const openAiYaml = files.get('agents/openai.yaml');
@@ -2586,7 +2558,7 @@ function validateRenderedArtifactPlan(plan, declarations, scopeLabel, options) {
2586
2558
  }
2587
2559
  }
2588
2560
  }
2589
- function resolveArtifactRendererFixtureRequests(declarations) {
2561
+ function resolveArtifactRendererFixtureRequests(declarations, manifest) {
2590
2562
  const awOwned = new Map();
2591
2563
  const codexNative = new Map();
2592
2564
  for (const declaration of declarations) {
@@ -2619,21 +2591,40 @@ function resolveArtifactRendererFixtureRequests(declarations) {
2619
2591
  awOwned.set(key, request);
2620
2592
  }
2621
2593
  }
2622
- return [...awOwned.values(), ...codexNative.values()];
2594
+ const partitionedAwOwned = [...awOwned.values()].flatMap((request) => {
2595
+ const hasSkill = request.declarations.some((declaration) => declaration.target === 'codex.skill'
2596
+ || declaration.target === 'claude.skill'
2597
+ || declaration.target === 'agent-skills.skill');
2598
+ const hasSensitiveNonSkill = request.declarations.some((declaration) => declaration.target !== 'codex.skill'
2599
+ && declaration.target !== 'claude.skill'
2600
+ && declaration.target !== 'agent-skills.skill'
2601
+ && declaration.refreshKeys.some((key) => configFieldContainsSensitiveValue(manifest.config?.fields?.[key])));
2602
+ if (!hasSkill || !hasSensitiveNonSkill)
2603
+ return [request];
2604
+ const skillDeclarations = request.declarations.filter((declaration) => declaration.target === 'codex.skill'
2605
+ || declaration.target === 'claude.skill'
2606
+ || declaration.target === 'agent-skills.skill');
2607
+ const nonSkillDeclarations = request.declarations.filter((declaration) => !skillDeclarations.includes(declaration));
2608
+ return [
2609
+ { ...request, declarations: skillDeclarations },
2610
+ { ...request, declarations: nonSkillDeclarations },
2611
+ ];
2612
+ });
2613
+ return [...partitionedAwOwned, ...codexNative.values()];
2623
2614
  }
2624
2615
  function runArtifactRendererFixture(pluginDir, manifest, renderEntry, declarations, resolvedRuntimeImports, skillValidationTools) {
2625
2616
  if (!renderEntry || declarations.length === 0)
2626
2617
  return;
2627
- const requests = resolveArtifactRendererFixtureRequests(declarations);
2618
+ const requests = resolveArtifactRendererFixtureRequests(declarations, manifest);
2628
2619
  const values = defaultConfigValues(manifest);
2629
2620
  const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'aw-artifact-render-'));
2630
2621
  try {
2631
- for (const request of requests) {
2622
+ for (const [requestIndex, request] of requests.entries()) {
2632
2623
  const { kind, surface, scope, configScope, declarations: scopedDeclarations, } = request;
2633
2624
  const distribution = surface === 'agent-skills' ? surface : undefined;
2634
2625
  const platform = distribution ? undefined : surface;
2635
2626
  const event = distribution ? 'materialize' : 'install';
2636
- const requestRoot = path.join(tempRoot, `${kind}-${surface}-${scope}`);
2627
+ const requestRoot = path.join(tempRoot, `${requestIndex}-${kind}-${surface}-${scope}`);
2637
2628
  const rendererAwHome = path.join(requestRoot, 'aw-home');
2638
2629
  const rendererCodexHome = path.join(requestRoot, 'codex-home');
2639
2630
  const rendererClaudeHome = path.join(requestRoot, 'claude-home');