paperclip-github-plugin 0.9.4 → 0.9.5

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.
package/dist/manifest.js CHANGED
@@ -642,7 +642,7 @@ var PULL_REQUEST_ASSET_API_ROUTE_URL_PATH = `/api/plugins/${GITHUB_SYNC_PLUGIN_I
642
642
  var require2 = createRequire(import.meta.url);
643
643
  var packageJson = require2("../package.json");
644
644
  var SCHEDULE_TICK_CRON = "* * * * *";
645
- var MANIFEST_VERSION = "0.9.4"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
645
+ var MANIFEST_VERSION = "0.9.5"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
646
646
  var manifest = {
647
647
  id: GITHUB_SYNC_PLUGIN_ID,
648
648
  apiVersion: 1,
package/dist/ui/index.js CHANGED
@@ -28575,6 +28575,24 @@ async function syncGitHubTokenPropagationForAgents(params) {
28575
28575
  );
28576
28576
  }
28577
28577
  }
28578
+ function normalizeTrimmedString(value) {
28579
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
28580
+ }
28581
+ function resolveGitHubTokenSecretRefForPropagation(params) {
28582
+ const explicitSecretRef = normalizeTrimmedString(params.explicitSecretRef);
28583
+ if (explicitSecretRef) {
28584
+ return explicitSecretRef;
28585
+ }
28586
+ const settingsSecretRef = normalizeTrimmedString(params.settingsSecretRef);
28587
+ if (settingsSecretRef) {
28588
+ return settingsSecretRef;
28589
+ }
28590
+ const companyId = normalizeTrimmedString(params.companyId);
28591
+ if (!companyId || !params.pluginConfig) {
28592
+ return void 0;
28593
+ }
28594
+ return normalizePluginConfig(params.pluginConfig).githubTokenRefs?.[companyId];
28595
+ }
28578
28596
  function normalizeCliAuthPollIntervalMs(value) {
28579
28597
  if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
28580
28598
  return CLI_AUTH_POLL_INTERVAL_FALLBACK_MS;
@@ -32636,8 +32654,12 @@ function GitHubSyncSettingsPage() {
32636
32654
  if (selectedAgentIds.length === 0 && previousAgentIds.length === 0) {
32637
32655
  return;
32638
32656
  }
32639
- let githubTokenSecretRef = typeof options.githubTokenSecretRef === "string" && options.githubTokenSecretRef.trim() ? options.githubTokenSecretRef.trim() : void 0;
32640
32657
  const companyId = hostContext.companyId;
32658
+ let githubTokenSecretRef = resolveGitHubTokenSecretRefForPropagation({
32659
+ explicitSecretRef: options.githubTokenSecretRef,
32660
+ settingsSecretRef: currentSettings?.githubTokenConfigSyncRef ?? settings.data?.githubTokenConfigSyncRef,
32661
+ companyId
32662
+ });
32641
32663
  if (!githubTokenSecretRef) {
32642
32664
  if (!companyId) {
32643
32665
  throw new Error("Company context is required to propagate the GitHub token.");
@@ -32647,8 +32669,10 @@ function GitHubSyncSettingsPage() {
32647
32669
  throw new Error("Plugin id is required to propagate the GitHub token to selected agents.");
32648
32670
  }
32649
32671
  const currentConfigResponse = await fetchJson(`/api/plugins/${pluginId}/config`);
32650
- const normalizedConfig = normalizePluginConfig(currentConfigResponse?.configJson);
32651
- githubTokenSecretRef = normalizedConfig.githubTokenRefs?.[companyId];
32672
+ githubTokenSecretRef = resolveGitHubTokenSecretRefForPropagation({
32673
+ companyId,
32674
+ pluginConfig: normalizePluginConfig(currentConfigResponse?.configJson)
32675
+ });
32652
32676
  }
32653
32677
  if (!githubTokenSecretRef) {
32654
32678
  throw new Error("GitHub token propagation requires a GitHub token saved through this settings page.");
@@ -32918,9 +32942,15 @@ function GitHubSyncSettingsPage() {
32918
32942
  });
32919
32943
  let propagationError = null;
32920
32944
  try {
32945
+ const githubTokenSecretRef = resolveGitHubTokenSecretRefForPropagation({
32946
+ explicitSecretRef: result.githubTokenConfigSyncRef,
32947
+ settingsSecretRef: currentSettings?.githubTokenConfigSyncRef ?? settings.data?.githubTokenConfigSyncRef,
32948
+ companyId
32949
+ });
32921
32950
  await propagateGitHubTokenToSelectedAgents({
32922
32951
  selectedAgentIds: normalizeAgentIds(normalizeAdvancedSettings(result.advancedSettings).githubTokenPropagationAgentIds),
32923
- previousAgentIds: normalizeAgentIds(currentSettings?.advancedSettings?.githubTokenPropagationAgentIds)
32952
+ previousAgentIds: normalizeAgentIds(currentSettings?.advancedSettings?.githubTokenPropagationAgentIds),
32953
+ githubTokenSecretRef
32924
32954
  });
32925
32955
  } catch (error) {
32926
32956
  propagationError = error;
@@ -35286,6 +35316,7 @@ export {
35286
35316
  index_default as default,
35287
35317
  patchPluginConfig,
35288
35318
  resolveGitHubIssueDetailTabState,
35319
+ resolveGitHubTokenSecretRefForPropagation,
35289
35320
  resolveOrCreateProject,
35290
35321
  resolvePreviewPersonLabels,
35291
35322
  resolveSavedTokenUiState,