@trops/dash-core 0.1.366 → 0.1.368

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.
@@ -64977,6 +64977,7 @@ async function getDashboardPublishPlan$1(
64977
64977
  ) {
64978
64978
  try {
64979
64979
  const { resolvePackages } = registryApiController$3;
64980
+ const { getRegistryProfile } = registryAuthController$2;
64980
64981
 
64981
64982
  const deps = await collectDashboardDependencies$1(
64982
64983
  appId,
@@ -64988,14 +64989,35 @@ async function getDashboardPublishPlan$1(
64988
64989
  return { success: false, error: deps.error };
64989
64990
  }
64990
64991
 
64992
+ // Local scopes (e.g. `@ai-built/…` for AI-generated widgets) differ
64993
+ // from the registry scope — widgets always publish under the caller's
64994
+ // username. Resolve against the caller's scope so "exists / owned /
64995
+ // latest version" reflect reality.
64996
+ const profile = await getRegistryProfile().catch(() => null);
64997
+ const callerScope = profile?.username || null;
64998
+
64999
+ const publishScopeFor = (w) => {
65000
+ if (!w.scope || !w.packageName) return null;
65001
+ return callerScope || w.scope;
65002
+ };
65003
+
65004
+ // Dedupe by publish-scope/name — many components share the same
65005
+ // package, and duplicate refs waste registry calls.
64991
65006
  const refs = [];
65007
+ const seenRefs = new Set();
64992
65008
  for (const w of deps.widgets) {
64993
- if (w.scope && w.packageName) {
64994
- refs.push({ scope: w.scope, name: w.packageName });
64995
- }
65009
+ const scope = publishScopeFor(w);
65010
+ if (!scope || !w.packageName) continue;
65011
+ const key = `${scope}/${w.packageName}`;
65012
+ if (seenRefs.has(key)) continue;
65013
+ seenRefs.add(key);
65014
+ refs.push({ scope, name: w.packageName });
64996
65015
  }
64997
65016
  if (deps.theme && deps.theme.scope && deps.theme.name) {
64998
- refs.push({ scope: deps.theme.scope, name: deps.theme.name });
65017
+ refs.push({
65018
+ scope: callerScope || deps.theme.scope,
65019
+ name: deps.theme.name,
65020
+ });
64999
65021
  }
65000
65022
 
65001
65023
  let registryError = null;
@@ -65012,22 +65034,28 @@ async function getDashboardPublishPlan$1(
65012
65034
  }
65013
65035
 
65014
65036
  const widgets = deps.widgets.map((w) => {
65037
+ const publishScope = publishScopeFor(w);
65015
65038
  const key =
65016
- w.scope && w.packageName ? `${w.scope}/${w.packageName}` : null;
65039
+ publishScope && w.packageName
65040
+ ? `${publishScope}/${w.packageName}`
65041
+ : null;
65017
65042
  return {
65018
65043
  ...w,
65044
+ publishScope,
65019
65045
  registry: key ? resolvedByKey.get(key) || null : null,
65020
65046
  };
65021
65047
  });
65022
65048
 
65023
65049
  let theme = null;
65024
65050
  if (deps.theme) {
65051
+ const themeScope = callerScope || deps.theme.scope;
65025
65052
  const key =
65026
- deps.theme.scope && deps.theme.name
65027
- ? `${deps.theme.scope}/${deps.theme.name}`
65053
+ themeScope && deps.theme.name
65054
+ ? `${themeScope}/${deps.theme.name}`
65028
65055
  : null;
65029
65056
  theme = {
65030
65057
  ...deps.theme,
65058
+ publishScope: themeScope,
65031
65059
  registry: key ? resolvedByKey.get(key) || null : null,
65032
65060
  };
65033
65061
  }
@@ -65036,6 +65064,7 @@ async function getDashboardPublishPlan$1(
65036
65064
  success: true,
65037
65065
  widgets,
65038
65066
  theme,
65067
+ callerScope,
65039
65068
  ...(registryError ? { registryError } : {}),
65040
65069
  };
65041
65070
  } catch (error) {