@lesliechan721/aw 0.1.0-beta.27 → 0.1.0-beta.28

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.
@@ -5,6 +5,7 @@ import type { CatalogOperationContext } from '../utils/catalog-operation-context
5
5
  import { type NativeCliRunner } from '../utils/native-cli.js';
6
6
  import { createCodexNativeObservationSession, type CodexNativeObservationSession } from '../utils/codex-native-observation.js';
7
7
  import type { ArtifactCollisionEvidence } from '../utils/ownership.js';
8
+ import { type PluginIntentStateObservation } from '../utils/plugin-intent-state.js';
8
9
  import { type SystemCodexInspection } from '../utils/codex-manager.js';
9
10
  export interface StatusV8CatalogSource {
10
11
  id: string;
@@ -258,6 +259,8 @@ declare function statusCommandV8InSession(options: {
258
259
  hasErrors: boolean;
259
260
  pluginSummaries: StatusV8PluginSummary[];
260
261
  targetRevisions: StatusTargetRevision[];
262
+ projectRoot?: string;
263
+ projectIntentObservation: PluginIntentStateObservation;
261
264
  }>;
262
265
  export declare function statusCommandV8(options: {
263
266
  plugins?: string[];
@@ -19,7 +19,7 @@ import { resolveAwHome } from '../utils/paths.js';
19
19
  import { codexProjectConfigAliasesUserHome, createProjectLocationKey, getClaudeHome, getCodexHome, resolveCanonicalRepoProjectKey, } from '../utils/state-paths.js';
20
20
  import { resolveEffectivePluginConfig, resolveProjectArtifactRenderConfig, } from '../utils/plugin-config.js';
21
21
  import { readCodexConfigFile } from '../utils/codex-config.js';
22
- import { readPluginIntentState, } from '../utils/plugin-intent-state.js';
22
+ import { observePluginIntentState, } from '../utils/plugin-intent-state.js';
23
23
  import { IMPLEMENTED_AW_CAPABILITIES } from './aw-capabilities.js';
24
24
  import { createDependencyPlacementPlan } from './dependency-operation-plan.js';
25
25
  import { getCodexOperationRequirement } from '../utils/agent-version.js';
@@ -251,7 +251,8 @@ function inventoryErrorMatchesSelection(options) {
251
251
  if (relevance.global)
252
252
  return true;
253
253
  if (relevance.projectLocationKey
254
- && relevance.projectLocationKey !== options.currentProjectLocationKey)
254
+ && (!options.currentProjectLocationKey
255
+ || relevance.projectLocationKey !== options.currentProjectLocationKey))
255
256
  return false;
256
257
  if (options.platformExplicit && relevance.platform
257
258
  && !options.platforms.includes(relevance.platform))
@@ -680,21 +681,24 @@ async function statusCommandV8InSession(options) {
680
681
  const snapshot = await readCatalogSourcesConfigSnapshot(env);
681
682
  const intentErrors = [];
682
683
  const readIntent = async (scope) => {
683
- try {
684
- return await readPluginIntentState({ scope, cwd: options.cwd, env });
685
- }
686
- catch {
684
+ const observation = await observePluginIntentState({ scope, cwd: options.cwd, env });
685
+ if (observation.state === 'invalid' || observation.state === 'unavailable') {
687
686
  intentErrors.push({
688
687
  code: 'pluginIntentStateInvalid',
689
688
  message: `pluginIntentStateInvalid: ${scope} plugin intent state is invalid.`,
690
689
  });
691
- return emptyIntent();
692
690
  }
691
+ return observation;
693
692
  };
694
- const [userIntent, projectIntent] = await Promise.all([
693
+ const [userIntentObservation, initialProjectIntentObservation] = await Promise.all([
695
694
  readIntent('user'),
696
695
  readIntent('project'),
697
696
  ]);
697
+ const userIntent = userIntentObservation.state === 'ready'
698
+ ? userIntentObservation.value : emptyIntent();
699
+ let projectIntentObservation = initialProjectIntentObservation;
700
+ let projectIntent = projectIntentObservation.state === 'ready'
701
+ ? projectIntentObservation.value : emptyIntent();
698
702
  const codexConfigErrors = [];
699
703
  const readActivationConfig = async (scope) => {
700
704
  try {
@@ -714,8 +718,29 @@ async function statusCommandV8InSession(options) {
714
718
  readActivationConfig('user'),
715
719
  codexScopePathsAlias ? undefined : readActivationConfig('project'),
716
720
  ]);
717
- const currentProjectKey = await resolveCanonicalRepoProjectKey(options.cwd);
718
- const currentProjectLocationKey = createProjectLocationKey(currentProjectKey);
721
+ let projectRoot;
722
+ try {
723
+ projectRoot = await resolveCanonicalRepoProjectKey(options.cwd);
724
+ }
725
+ catch (error) {
726
+ if (error instanceof Error && error.name === 'AbortError')
727
+ throw error;
728
+ projectIntentObservation = {
729
+ state: 'unavailable',
730
+ code: 'pluginIntentStateUnavailable',
731
+ message: '无法确定当前项目位置,不能读取插件声明。',
732
+ };
733
+ projectIntent = emptyIntent();
734
+ if (!intentErrors.some((error) => error.message.includes('project plugin intent'))) {
735
+ intentErrors.push({
736
+ code: 'pluginIntentStateInvalid',
737
+ message: 'pluginIntentStateInvalid: project plugin intent state is unavailable.',
738
+ });
739
+ }
740
+ }
741
+ const currentProjectKey = projectRoot;
742
+ const currentProjectLocationKey = currentProjectKey
743
+ ? createProjectLocationKey(currentProjectKey) : undefined;
719
744
  const inventoryErrors = [];
720
745
  const readInventory = options.inventoryCatalogSourceReferences
721
746
  ?? inventoryCatalogSourceReferences;
@@ -2603,6 +2628,8 @@ async function statusCommandV8InSession(options) {
2603
2628
  output: options.json ? JSON.stringify(payload) : renderStatusV8(payload, options.verbose === true),
2604
2629
  hasErrors,
2605
2630
  targetRevisions,
2631
+ ...(projectRoot ? { projectRoot } : {}),
2632
+ projectIntentObservation,
2606
2633
  pluginSummaries: available.map((entry) => {
2607
2634
  const sourceEntries = available.filter((candidate) => candidate.source.id === entry.source.id);
2608
2635
  const byName = new Map(sourceEntries.map((candidate) => [candidate.name, candidate]));