paperclip-github-plugin 0.11.0 → 0.13.0

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/ui/index.js CHANGED
@@ -5,7 +5,11 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
8
+ try {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ } catch (e) {
11
+ throw mod = 0, e;
12
+ }
9
13
  };
10
14
  var __export = (target, all5) => {
11
15
  for (var name2 in all5)
@@ -22431,8 +22435,7 @@ function resolvePaperclipAuthControlsPolicy(value) {
22431
22435
  const health = normalizePaperclipHealthResponse(value);
22432
22436
  return {
22433
22437
  boardAccessRequired: requiresPaperclipBoardAccessForHealth(health),
22434
- boardAccessSettingsVisible: shouldShowPaperclipBoardAccessSettingsForHealth(health),
22435
- githubTokenPropagationSettingsVisible: true
22438
+ boardAccessSettingsVisible: shouldShowPaperclipBoardAccessSettingsForHealth(health)
22436
22439
  };
22437
22440
  }
22438
22441
 
@@ -23124,8 +23127,7 @@ function usePaperclipBoardAccessRequirement() {
23124
23127
  const [state, setState] = useState2({
23125
23128
  status: "loading",
23126
23129
  required: false,
23127
- settingsVisible: false,
23128
- githubTokenPropagationSettingsVisible: true
23130
+ settingsVisible: false
23129
23131
  });
23130
23132
  useEffect2(() => {
23131
23133
  let cancelled = false;
@@ -23139,8 +23141,7 @@ function usePaperclipBoardAccessRequirement() {
23139
23141
  setState({
23140
23142
  status: "unknown",
23141
23143
  required: policy2.boardAccessRequired,
23142
- settingsVisible: policy2.boardAccessSettingsVisible,
23143
- githubTokenPropagationSettingsVisible: policy2.githubTokenPropagationSettingsVisible
23144
+ settingsVisible: policy2.boardAccessSettingsVisible
23144
23145
  });
23145
23146
  return;
23146
23147
  }
@@ -23148,8 +23149,7 @@ function usePaperclipBoardAccessRequirement() {
23148
23149
  setState({
23149
23150
  status: policy.boardAccessRequired ? "required" : "not_required",
23150
23151
  required: policy.boardAccessRequired,
23151
- settingsVisible: policy.boardAccessSettingsVisible,
23152
- githubTokenPropagationSettingsVisible: policy.githubTokenPropagationSettingsVisible
23152
+ settingsVisible: policy.boardAccessSettingsVisible
23153
23153
  });
23154
23154
  })();
23155
23155
  return () => {
@@ -26974,12 +26974,6 @@ function normalizeIgnoredIssueAuthorUsernames(value) {
26974
26974
  rawEntries.map((entry) => typeof entry === "string" ? normalizeGitHubUsername(entry) : null).filter((entry) => Boolean(entry))
26975
26975
  )];
26976
26976
  }
26977
- function normalizeAgentIds(value) {
26978
- const rawEntries = Array.isArray(value) ? value : [];
26979
- return [...new Set(
26980
- rawEntries.map((entry) => typeof entry === "string" && entry.trim() ? entry.trim() : null).filter((entry) => Boolean(entry))
26981
- )].sort((left, right) => left.localeCompare(right));
26982
- }
26983
26977
  function normalizeAdvancedSettingsAssigneeOverride(record, keys2) {
26984
26978
  const rawUserId = record[keys2.userId];
26985
26979
  const userId = typeof rawUserId === "string" && rawUserId.trim() ? rawUserId.trim() : void 0;
@@ -27020,8 +27014,7 @@ function normalizeAdvancedSettings(value) {
27020
27014
  userId: "approverAssigneeUserId"
27021
27015
  }),
27022
27016
  defaultStatus: normalizePaperclipIssueStatus(record.defaultStatus),
27023
- ignoredIssueAuthorUsernames: "ignoredIssueAuthorUsernames" in record ? normalizeIgnoredIssueAuthorUsernames(record.ignoredIssueAuthorUsernames) : DEFAULT_ADVANCED_SETTINGS.ignoredIssueAuthorUsernames,
27024
- ...normalizeAgentIds(record.githubTokenPropagationAgentIds).length > 0 ? { githubTokenPropagationAgentIds: normalizeAgentIds(record.githubTokenPropagationAgentIds) } : {}
27017
+ ignoredIssueAuthorUsernames: "ignoredIssueAuthorUsernames" in record ? normalizeIgnoredIssueAuthorUsernames(record.ignoredIssueAuthorUsernames) : DEFAULT_ADVANCED_SETTINGS.ignoredIssueAuthorUsernames
27025
27018
  };
27026
27019
  }
27027
27020
  function getComparableMappings(mappings) {
@@ -27045,8 +27038,7 @@ function getComparableAdvancedSettings(value) {
27045
27038
  ...settings.approverAssigneeAgentId ? { approverAssigneeAgentId: settings.approverAssigneeAgentId } : {},
27046
27039
  ...settings.approverAssigneeUserId ? { approverAssigneeUserId: settings.approverAssigneeUserId } : {},
27047
27040
  defaultStatus: settings.defaultStatus,
27048
- ignoredIssueAuthorUsernames: [...settings.ignoredIssueAuthorUsernames].sort((left, right) => left.localeCompare(right)),
27049
- ...settings.githubTokenPropagationAgentIds?.length ? { githubTokenPropagationAgentIds: [...settings.githubTokenPropagationAgentIds].sort((left, right) => left.localeCompare(right)) } : {}
27041
+ ignoredIssueAuthorUsernames: [...settings.ignoredIssueAuthorUsernames].sort((left, right) => left.localeCompare(right))
27050
27042
  };
27051
27043
  }
27052
27044
  function formatAssigneeOptionLabel(option) {
@@ -27137,21 +27129,7 @@ function getAvailableAssigneeOptions(options, selectedAssignees) {
27137
27129
  }
27138
27130
  return normalizedOptions.sort(compareAssigneeOptions);
27139
27131
  }
27140
- function getAvailablePropagationAgentOptions(options, selectedAgentIds) {
27141
- const normalizedOptions = [...(options ?? []).filter((option) => option.kind === "agent")];
27142
- const selectedIds = normalizeAgentIds(selectedAgentIds);
27143
- for (const selectedAgentId of selectedIds) {
27144
- if (!normalizedOptions.some((option) => option.id === selectedAgentId)) {
27145
- normalizedOptions.push({
27146
- kind: "agent",
27147
- id: selectedAgentId,
27148
- name: "Unavailable agent"
27149
- });
27150
- }
27151
- }
27152
- return normalizedOptions.sort(compareAssigneeOptions);
27153
- }
27154
- function formatAdvancedSettingsSummary(advancedSettings, availableAssignees, options) {
27132
+ function formatAdvancedSettingsSummary(advancedSettings, availableAssignees) {
27155
27133
  const resolveAssigneeLabel = (principal, fallbackLabel = "None") => {
27156
27134
  return principal ? formatAssigneeOptionLabel(
27157
27135
  availableAssignees.find((option) => getAssigneeOptionKey(option) === getAssigneeOptionKey(principal)) ?? {
@@ -27168,10 +27146,6 @@ function formatAdvancedSettingsSummary(advancedSettings, availableAssignees, opt
27168
27146
  const statusLabel = PAPERCLIP_STATUS_OPTIONS.find((option) => option.value === advancedSettings.defaultStatus)?.label ?? "Backlog";
27169
27147
  const ignoredAuthorsLabel = advancedSettings.ignoredIssueAuthorUsernames.length > 0 ? advancedSettings.ignoredIssueAuthorUsernames.join(", ") : "none";
27170
27148
  const handoffLabel = `Back to work: ${executorLabel} \xB7 Review: ${reviewerLabel} \xB7 Approval: ${approverLabel}`;
27171
- if (options?.includePropagation) {
27172
- const propagatedAgentsLabel = advancedSettings.githubTokenPropagationAgentIds?.length ? `${advancedSettings.githubTokenPropagationAgentIds.length} selected` : "none";
27173
- return `Import: ${assigneeLabel} \xB7 ${handoffLabel} \xB7 Status: ${statusLabel} \xB7 Ignore: ${ignoredAuthorsLabel} \xB7 Propagate: ${propagatedAgentsLabel}`;
27174
- }
27175
27149
  return `Import: ${assigneeLabel} \xB7 ${handoffLabel} \xB7 Status: ${statusLabel} \xB7 Ignore: ${ignoredAuthorsLabel}`;
27176
27150
  }
27177
27151
  function resolveSavedTokenUiState(params) {
@@ -27190,19 +27164,6 @@ function resolveSavedTokenUiState(params) {
27190
27164
  validatedLogin: null
27191
27165
  };
27192
27166
  }
27193
- function formatAgentMultiSelectionLabel(values, options) {
27194
- if (values.length === 0) {
27195
- return "No agents selected";
27196
- }
27197
- const labels = values.map((value) => options.find((option) => option.value === value)?.label ?? "Unavailable agent").filter((label) => label.trim().length > 0);
27198
- if (labels.length === 0) {
27199
- return "No agents selected";
27200
- }
27201
- if (labels.length <= 2) {
27202
- return labels.join(", ");
27203
- }
27204
- return `${labels.length} agents selected`;
27205
- }
27206
27167
  function PickerChevronIcon() {
27207
27168
  return /* @__PURE__ */ jsx2("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("path", { d: "M4 6.5L8 10.5L12 6.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
27208
27169
  }
@@ -27380,122 +27341,6 @@ function SettingsAssigneePicker(props) {
27380
27341
  ] }) : null
27381
27342
  ] });
27382
27343
  }
27383
- function SettingsAgentMultiPicker(props) {
27384
- const { id, values, options, disabled, onChange } = props;
27385
- const [open, setOpen] = useState2(false);
27386
- const [query, setQuery] = useState2("");
27387
- const rootRef = useRef(null);
27388
- const searchInputRef = useRef(null);
27389
- const selectedValues = normalizeAgentIds(values);
27390
- const selectedValueSet = new Set(selectedValues);
27391
- const normalizedQuery = query.trim().toLowerCase();
27392
- const filteredOptions = normalizedQuery ? options.filter((option) => option.label.toLowerCase().includes(normalizedQuery)) : options;
27393
- const selectedLabel = formatAgentMultiSelectionLabel(selectedValues, options);
27394
- useEffect2(() => {
27395
- if (!open) {
27396
- setQuery("");
27397
- return;
27398
- }
27399
- const handlePointerDown = (event) => {
27400
- const target = event.target;
27401
- if (target instanceof Node && rootRef.current?.contains(target)) {
27402
- return;
27403
- }
27404
- setOpen(false);
27405
- };
27406
- const handleKeyDown = (event) => {
27407
- if (event.key === "Escape") {
27408
- setOpen(false);
27409
- }
27410
- };
27411
- document.addEventListener("pointerdown", handlePointerDown);
27412
- document.addEventListener("keydown", handleKeyDown);
27413
- globalThis.setTimeout(() => {
27414
- searchInputRef.current?.focus();
27415
- searchInputRef.current?.select();
27416
- }, 0);
27417
- return () => {
27418
- document.removeEventListener("pointerdown", handlePointerDown);
27419
- document.removeEventListener("keydown", handleKeyDown);
27420
- };
27421
- }, [open]);
27422
- useEffect2(() => {
27423
- if (disabled && open) {
27424
- setOpen(false);
27425
- }
27426
- }, [disabled, open]);
27427
- return /* @__PURE__ */ jsxs2("div", { className: "ghsync__picker ghsync__picker--full", ref: rootRef, children: [
27428
- /* @__PURE__ */ jsxs2(
27429
- "button",
27430
- {
27431
- id,
27432
- type: "button",
27433
- className: "ghsync__picker-trigger ghsync__picker-trigger--assignee",
27434
- disabled,
27435
- "aria-haspopup": "dialog",
27436
- "aria-expanded": open,
27437
- onClick: () => {
27438
- if (disabled) {
27439
- return;
27440
- }
27441
- setOpen((current) => !current);
27442
- },
27443
- children: [
27444
- /* @__PURE__ */ jsxs2("span", { className: "ghsync__picker-trigger-main", children: [
27445
- /* @__PURE__ */ jsx2("span", { className: "ghsync__picker-agent-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx2(AgentIcon, {}) }),
27446
- /* @__PURE__ */ jsx2("span", { className: "ghsync__picker-trigger-label", children: selectedLabel })
27447
- ] }),
27448
- /* @__PURE__ */ jsx2("span", { className: "ghsync__picker-trigger-icon", children: /* @__PURE__ */ jsx2(PickerChevronIcon, {}) })
27449
- ]
27450
- }
27451
- ),
27452
- open ? /* @__PURE__ */ jsxs2("div", { className: "ghsync__picker-panel ghsync__picker-panel--assignee", role: "dialog", "aria-label": "Choose agents", children: [
27453
- /* @__PURE__ */ jsx2("div", { className: "ghsync__picker-search", children: /* @__PURE__ */ jsx2(
27454
- "input",
27455
- {
27456
- ref: searchInputRef,
27457
- type: "text",
27458
- className: "ghsync__picker-search-input",
27459
- placeholder: "Search agents...",
27460
- value: query,
27461
- onChange: (event) => {
27462
- setQuery(event.currentTarget.value);
27463
- },
27464
- onKeyDown: (event) => {
27465
- if (event.key === "Escape") {
27466
- event.preventDefault();
27467
- setOpen(false);
27468
- }
27469
- }
27470
- }
27471
- ) }),
27472
- /* @__PURE__ */ jsx2("div", { className: "ghsync__picker-list", role: "listbox", "aria-labelledby": id, "aria-multiselectable": "true", children: filteredOptions.length > 0 ? filteredOptions.map((option) => {
27473
- const selected = selectedValueSet.has(option.value);
27474
- return /* @__PURE__ */ jsxs2(
27475
- "button",
27476
- {
27477
- type: "button",
27478
- role: "option",
27479
- "aria-selected": selected,
27480
- className: `ghsync__picker-option${selected ? " ghsync__picker-option--selected" : ""}`,
27481
- onClick: () => {
27482
- const nextValues = selected ? selectedValues.filter((value) => value !== option.value) : normalizeAgentIds([...selectedValues, option.value]);
27483
- onChange(nextValues);
27484
- },
27485
- children: [
27486
- /* @__PURE__ */ jsxs2("span", { className: "ghsync__picker-trigger-main", children: [
27487
- option.icon ? /* @__PURE__ */ jsx2("span", { className: "ghsync__picker-agent-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx2(SettingsSelectIcon, { icon: option.icon }) }) : null,
27488
- /* @__PURE__ */ jsx2("span", { className: "ghsync__picker-option-label", children: option.label })
27489
- ] }),
27490
- /* @__PURE__ */ jsx2("span", { className: "ghsync__picker-option-check", "aria-hidden": "true", children: selected ? /* @__PURE__ */ jsx2(PickerCheckIcon, {}) : null })
27491
- ]
27492
- },
27493
- option.value
27494
- );
27495
- }) : /* @__PURE__ */ jsx2("div", { className: "ghsync__picker-empty", children: "No agents match." }) })
27496
- ] }) : null
27497
- ] });
27498
- }
27499
27344
  function SettingsStatusPicker(props) {
27500
27345
  const { id, value, options, disabled, onChange } = props;
27501
27346
  const [open, setOpen] = useState2(false);
@@ -28508,137 +28353,6 @@ async function patchPluginConfig(pluginId, patch5) {
28508
28353
  await writePluginConfig(pluginId, safeConfig);
28509
28354
  }
28510
28355
  }
28511
- var GITHUB_TOKEN_PROPAGATION_CONCURRENCY_LIMIT = 4;
28512
- function normalizeAgentAdapterConfig(value) {
28513
- return value && typeof value === "object" && !Array.isArray(value) ? { ...value } : {};
28514
- }
28515
- function normalizeAgentEnvBindings(value) {
28516
- return value && typeof value === "object" && !Array.isArray(value) ? { ...value } : {};
28517
- }
28518
- function isMatchingSecretRefEnvBinding(value, secretId) {
28519
- if (!value || typeof value !== "object" || Array.isArray(value)) {
28520
- return false;
28521
- }
28522
- const record = value;
28523
- return record.type === "secret_ref" && record.secretId === secretId;
28524
- }
28525
- function getAgentPropagationPatch(params) {
28526
- const adapterConfig = normalizeAgentAdapterConfig(params.adapterConfig);
28527
- const currentEnv = normalizeAgentEnvBindings(adapterConfig.env);
28528
- if (params.mode === "ensure") {
28529
- const nextEnv2 = {
28530
- ...currentEnv,
28531
- GITHUB_TOKEN: {
28532
- type: "secret_ref",
28533
- secretId: params.githubTokenSecretRef,
28534
- version: "latest"
28535
- }
28536
- };
28537
- if (JSON.stringify(nextEnv2) === JSON.stringify(currentEnv)) {
28538
- return null;
28539
- }
28540
- return {
28541
- ...adapterConfig,
28542
- env: nextEnv2
28543
- };
28544
- }
28545
- if (!isMatchingSecretRefEnvBinding(currentEnv.GITHUB_TOKEN, params.githubTokenSecretRef)) {
28546
- return null;
28547
- }
28548
- const nextEnv = { ...currentEnv };
28549
- delete nextEnv.GITHUB_TOKEN;
28550
- const nextAdapterConfig = {
28551
- ...adapterConfig
28552
- };
28553
- if (Object.keys(nextEnv).length > 0) {
28554
- nextAdapterConfig.env = nextEnv;
28555
- } else {
28556
- delete nextAdapterConfig.env;
28557
- }
28558
- return nextAdapterConfig;
28559
- }
28560
- async function runWithConcurrencyLimit(items, concurrencyLimit, worker) {
28561
- if (items.length === 0) {
28562
- return;
28563
- }
28564
- let nextIndex = 0;
28565
- const runnerCount = Math.min(concurrencyLimit, items.length);
28566
- await Promise.all(
28567
- Array.from({ length: runnerCount }, async () => {
28568
- while (nextIndex < items.length) {
28569
- const currentIndex = nextIndex;
28570
- nextIndex += 1;
28571
- await worker(items[currentIndex]);
28572
- }
28573
- })
28574
- );
28575
- }
28576
- async function applyGitHubTokenPropagationUpdate(params) {
28577
- const agent = await fetchJson(`/api/agents/${params.agentId}`);
28578
- const nextAdapterConfig = getAgentPropagationPatch({
28579
- adapterConfig: agent?.adapterConfig,
28580
- githubTokenSecretRef: params.githubTokenSecretRef,
28581
- mode: params.mode
28582
- });
28583
- if (!nextAdapterConfig) {
28584
- return;
28585
- }
28586
- await fetchJson(`/api/agents/${params.agentId}`, {
28587
- method: "PATCH",
28588
- body: JSON.stringify({
28589
- adapterConfig: nextAdapterConfig,
28590
- replaceAdapterConfig: true
28591
- })
28592
- });
28593
- }
28594
- async function syncGitHubTokenPropagationForAgents(params) {
28595
- const selectedAgentIds = normalizeAgentIds(params.selectedAgentIds);
28596
- const selectedAgentIdSet = new Set(selectedAgentIds);
28597
- const previousAgentIds = normalizeAgentIds(params.previousAgentIds);
28598
- const failures = /* @__PURE__ */ new Set();
28599
- const operations = [
28600
- ...selectedAgentIds.map((agentId) => ({ agentId, mode: "ensure" })),
28601
- ...previousAgentIds.filter((agentId) => !selectedAgentIdSet.has(agentId)).map((agentId) => ({ agentId, mode: "remove" }))
28602
- ];
28603
- await runWithConcurrencyLimit(
28604
- operations,
28605
- GITHUB_TOKEN_PROPAGATION_CONCURRENCY_LIMIT,
28606
- async (operation) => {
28607
- try {
28608
- await applyGitHubTokenPropagationUpdate({
28609
- agentId: operation.agentId,
28610
- githubTokenSecretRef: params.githubTokenSecretRef,
28611
- mode: operation.mode
28612
- });
28613
- } catch {
28614
- failures.add(operation.agentId);
28615
- }
28616
- }
28617
- );
28618
- if (failures.size > 0) {
28619
- throw new Error(
28620
- `GitHub token propagation could not update these agents: ${[...failures].join(", ")}.`
28621
- );
28622
- }
28623
- }
28624
- function normalizeTrimmedString(value) {
28625
- return typeof value === "string" && value.trim() ? value.trim() : void 0;
28626
- }
28627
- function resolveGitHubTokenSecretRefForPropagation(params) {
28628
- const explicitSecretRef = normalizeTrimmedString(params.explicitSecretRef);
28629
- if (explicitSecretRef) {
28630
- return explicitSecretRef;
28631
- }
28632
- const settingsSecretRef = normalizeTrimmedString(params.settingsSecretRef);
28633
- if (settingsSecretRef) {
28634
- return settingsSecretRef;
28635
- }
28636
- const companyId = normalizeTrimmedString(params.companyId);
28637
- if (!companyId || !params.pluginConfig) {
28638
- return void 0;
28639
- }
28640
- return normalizePluginConfig(params.pluginConfig).githubTokenRefs?.[companyId];
28641
- }
28642
28356
  function normalizeCliAuthPollIntervalMs(value) {
28643
28357
  if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
28644
28358
  return CLI_AUTH_POLL_INTERVAL_FALLBACK_MS;
@@ -32259,14 +31973,6 @@ function GitHubSyncSettingsPage() {
32259
31973
  [companyId]: secretRef
32260
31974
  }
32261
31975
  });
32262
- const selectedAgentIds = normalizeAgentIds(settings.data?.advancedSettings?.githubTokenPropagationAgentIds);
32263
- if (selectedAgentIds.length > 0) {
32264
- await propagateGitHubTokenToSelectedAgents({
32265
- selectedAgentIds,
32266
- previousAgentIds: selectedAgentIds,
32267
- githubTokenSecretRef: secretRef
32268
- });
32269
- }
32270
31976
  if (cancelled) {
32271
31977
  return;
32272
31978
  }
@@ -32300,7 +32006,6 @@ function GitHubSyncSettingsPage() {
32300
32006
  }, [
32301
32007
  hostContext.companyId,
32302
32008
  pluginIdFromLocation,
32303
- settings.data?.advancedSettings?.githubTokenPropagationAgentIds,
32304
32009
  settings.data?.githubTokenNeedsConfigSync,
32305
32010
  settings.data?.githubTokenConfigSyncRef,
32306
32011
  settings.refresh,
@@ -32434,7 +32139,6 @@ function GitHubSyncSettingsPage() {
32434
32139
  const boardAccessConfigured = Boolean(form.paperclipBoardAccessConfigured);
32435
32140
  const boardAccessRequired = boardAccessRequirement.required;
32436
32141
  const boardAccessSettingsVisible = boardAccessRequirement.settingsVisible;
32437
- const githubTokenPropagationSettingsVisible = boardAccessRequirement.githubTokenPropagationSettingsVisible;
32438
32142
  const boardAccessReady = !boardAccessRequired || hasCompanyContext && boardAccessConfigured;
32439
32143
  const tokenStatus = tokenStatusOverride ?? (hasSavedToken ? "valid" : "required");
32440
32144
  const tokenTone = tokenStatus === "valid" ? "success" : tokenStatus === "invalid" ? "danger" : "warning";
@@ -32462,10 +32166,6 @@ function GitHubSyncSettingsPage() {
32462
32166
  getAdvancedSettingsAssigneePrincipal(form.advancedSettings, "approver")
32463
32167
  ]
32464
32168
  );
32465
- const propagationAgents = getAvailablePropagationAgentOptions(
32466
- (currentSettings?.availableAssignees?.length ? currentSettings.availableAssignees : null) ?? (form.availableAssignees?.length ? form.availableAssignees : null) ?? browserAvailableAssignees,
32467
- form.advancedSettings.githubTokenPropagationAgentIds
32468
- );
32469
32169
  const savedMappingsSource = currentSettings ? currentSettings.mappings ?? [] : form.mappings;
32470
32170
  const savedMappings = getComparableMappings(savedMappingsSource);
32471
32171
  const draftMappings = getComparableMappings(form.mappings);
@@ -32542,9 +32242,7 @@ function GitHubSyncSettingsPage() {
32542
32242
  const manualSyncScopePillClass = hasCompanyContext ? "ghsync__scope-pill ghsync__scope-pill--company" : "ghsync__scope-pill ghsync__scope-pill--mixed";
32543
32243
  const manualSyncScopePillLabel = hasCompanyContext ? "This company" : "All companies";
32544
32244
  const manualSyncButtonLabel = hasCompanyContext ? "Run sync for this company" : "Run sync across all companies";
32545
- const advancedSettingsSummary = formatAdvancedSettingsSummary(form.advancedSettings, availableAssignees, {
32546
- includePropagation: githubTokenPropagationSettingsVisible
32547
- });
32245
+ const advancedSettingsSummary = formatAdvancedSettingsSummary(form.advancedSettings, availableAssignees);
32548
32246
  const assigneeSelectOptions = [
32549
32247
  { value: "", label: "Unassigned" },
32550
32248
  ...availableAssignees.map((option) => ({
@@ -32561,11 +32259,6 @@ function GitHubSyncSettingsPage() {
32561
32259
  icon: option.kind
32562
32260
  }))
32563
32261
  ];
32564
- const propagationAgentOptions = propagationAgents.map((option) => ({
32565
- value: option.id,
32566
- label: formatAssigneeOptionLabel(option),
32567
- icon: "agent"
32568
- }));
32569
32262
  const statusSelectOptions = PAPERCLIP_STATUS_OPTIONS.map((option) => ({
32570
32263
  value: option.value,
32571
32264
  label: option.label,
@@ -32696,41 +32389,6 @@ function GitHubSyncSettingsPage() {
32696
32389
  };
32697
32390
  });
32698
32391
  }
32699
- async function propagateGitHubTokenToSelectedAgents(options) {
32700
- const selectedAgentIds = normalizeAgentIds(options.selectedAgentIds);
32701
- const previousAgentIds = normalizeAgentIds(options.previousAgentIds);
32702
- if (selectedAgentIds.length === 0 && previousAgentIds.length === 0) {
32703
- return;
32704
- }
32705
- const companyId = hostContext.companyId;
32706
- let githubTokenSecretRef = resolveGitHubTokenSecretRefForPropagation({
32707
- explicitSecretRef: options.githubTokenSecretRef,
32708
- settingsSecretRef: currentSettings?.githubTokenConfigSyncRef ?? settings.data?.githubTokenConfigSyncRef,
32709
- companyId
32710
- });
32711
- if (!githubTokenSecretRef) {
32712
- if (!companyId) {
32713
- throw new Error("Company context is required to propagate the GitHub token.");
32714
- }
32715
- const pluginId = await resolveCurrentPluginId(pluginIdFromLocation);
32716
- if (!pluginId) {
32717
- throw new Error("Plugin id is required to propagate the GitHub token to selected agents.");
32718
- }
32719
- const currentConfigResponse = await fetchJson(`/api/plugins/${pluginId}/config`);
32720
- githubTokenSecretRef = resolveGitHubTokenSecretRefForPropagation({
32721
- companyId,
32722
- pluginConfig: normalizePluginConfig(currentConfigResponse?.configJson)
32723
- });
32724
- }
32725
- if (!githubTokenSecretRef) {
32726
- throw new Error("GitHub token propagation requires a GitHub token saved through this settings page.");
32727
- }
32728
- await syncGitHubTokenPropagationForAgents({
32729
- githubTokenSecretRef,
32730
- selectedAgentIds,
32731
- previousAgentIds
32732
- });
32733
- }
32734
32392
  async function handleSaveToken(event) {
32735
32393
  event.preventDefault();
32736
32394
  setSubmittingToken(true);
@@ -32791,17 +32449,6 @@ function GitHubSyncSettingsPage() {
32791
32449
  } catch (error) {
32792
32450
  availabilityWarning = error;
32793
32451
  }
32794
- const selectedAgentIds = normalizeAgentIds(currentSettings?.advancedSettings?.githubTokenPropagationAgentIds);
32795
- let propagationError = null;
32796
- try {
32797
- await propagateGitHubTokenToSelectedAgents({
32798
- selectedAgentIds,
32799
- previousAgentIds: selectedAgentIds,
32800
- githubTokenSecretRef: secret.id
32801
- });
32802
- } catch (error) {
32803
- propagationError = error;
32804
- }
32805
32452
  setForm((current) => ({
32806
32453
  ...current,
32807
32454
  githubTokenConfigured: true
@@ -32816,16 +32463,6 @@ function GitHubSyncSettingsPage() {
32816
32463
  body: "Token saved.",
32817
32464
  tone: "success"
32818
32465
  });
32819
- if (propagationError) {
32820
- toast({
32821
- title: "GitHub token saved, but agent propagation needs attention",
32822
- body: getActionErrorMessage(
32823
- propagationError,
32824
- "GitHub Sync could not update the selected agents with the saved token."
32825
- ),
32826
- tone: "error"
32827
- });
32828
- }
32829
32466
  if (availabilityWarning) {
32830
32467
  toast({
32831
32468
  title: "GitHub token saved, but worker token access needs attention",
@@ -32988,21 +32625,6 @@ function GitHubSyncSettingsPage() {
32988
32625
  scheduleFrequencyMinutes,
32989
32626
  ...trustedPaperclipApiBaseUrl ? { paperclipApiBaseUrl: trustedPaperclipApiBaseUrl } : {}
32990
32627
  });
32991
- let propagationError = null;
32992
- try {
32993
- const githubTokenSecretRef = resolveGitHubTokenSecretRefForPropagation({
32994
- explicitSecretRef: result.githubTokenConfigSyncRef,
32995
- settingsSecretRef: currentSettings?.githubTokenConfigSyncRef ?? settings.data?.githubTokenConfigSyncRef,
32996
- companyId
32997
- });
32998
- await propagateGitHubTokenToSelectedAgents({
32999
- selectedAgentIds: normalizeAgentIds(normalizeAdvancedSettings(result.advancedSettings).githubTokenPropagationAgentIds),
33000
- previousAgentIds: normalizeAgentIds(currentSettings?.advancedSettings?.githubTokenPropagationAgentIds),
33001
- githubTokenSecretRef
33002
- });
33003
- } catch (error) {
33004
- propagationError = error;
33005
- }
33006
32628
  setForm((current) => ({
33007
32629
  ...current,
33008
32630
  mappings: result.mappings.length > 0 ? result.mappings : [createEmptyMapping(0)],
@@ -33021,16 +32643,6 @@ function GitHubSyncSettingsPage() {
33021
32643
  body: `Advanced defaults, mappings, and automatic sync are saved for ${currentCompanyName}.`,
33022
32644
  tone: "success"
33023
32645
  });
33024
- if (propagationError) {
33025
- toast({
33026
- title: "Settings saved, but agent propagation needs attention",
33027
- body: getActionErrorMessage(
33028
- propagationError,
33029
- "GitHub Sync could not apply the selected agent token propagation updates."
33030
- ),
33031
- tone: "error"
33032
- });
33033
- }
33034
32646
  notifyGitHubSyncSettingsChanged();
33035
32647
  try {
33036
32648
  await settings.refresh();
@@ -33613,29 +33225,7 @@ function GitHubSyncSettingsPage() {
33613
33225
  }
33614
33226
  ),
33615
33227
  /* @__PURE__ */ jsx2("p", { className: "ghsync__hint", children: "Comma or newline separated." })
33616
- ] }),
33617
- githubTokenPropagationSettingsVisible ? /* @__PURE__ */ jsxs2("div", { className: "ghsync__field", children: [
33618
- /* @__PURE__ */ jsx2("label", { htmlFor: "advanced-token-propagation", children: "Propagate GitHub token to agents" }),
33619
- /* @__PURE__ */ jsx2(
33620
- SettingsAgentMultiPicker,
33621
- {
33622
- id: "advanced-token-propagation",
33623
- values: form.advancedSettings.githubTokenPropagationAgentIds ?? [],
33624
- options: propagationAgentOptions,
33625
- disabled: settingsMutationsLocked || tokenStatus !== "valid",
33626
- onChange: (nextValues) => {
33627
- setForm((current) => ({
33628
- ...current,
33629
- advancedSettings: {
33630
- ...current.advancedSettings,
33631
- ...nextValues.length > 0 ? { githubTokenPropagationAgentIds: nextValues } : { githubTokenPropagationAgentIds: void 0 }
33632
- }
33633
- }));
33634
- }
33635
- }
33636
- ),
33637
- /* @__PURE__ */ jsx2("p", { className: "ghsync__hint", children: tokenStatus === "valid" ? "Selected agents receive `GITHUB_TOKEN` from the saved GitHub secret when you save settings." : "Save a valid GitHub token before choosing agents to propagate it to." })
33638
- ] }) : null
33228
+ ] })
33639
33229
  ] }) : null
33640
33230
  ] }),
33641
33231
  /* @__PURE__ */ jsxs2("section", { className: "ghsync__section", children: [
@@ -35447,12 +35037,10 @@ export {
35447
35037
  patchPluginConfig,
35448
35038
  resolveGitHubIssueDetailTabState,
35449
35039
  resolveGitHubIssueTaskDetailContext,
35450
- resolveGitHubTokenSecretRefForPropagation,
35451
35040
  resolveOrCreateProject,
35452
35041
  resolvePreviewPersonLabels,
35453
35042
  resolveSavedTokenUiState,
35454
35043
  resolveToolbarButtonState,
35455
- shouldExpectGitHubIssueTaskDetailContext,
35456
- syncGitHubTokenPropagationForAgents
35044
+ shouldExpectGitHubIssueTaskDetailContext
35457
35045
  };
35458
35046
  //# sourceMappingURL=index.js.map