paperclip-github-plugin 0.17.1 → 0.17.2

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
@@ -22394,6 +22394,11 @@ function remarkGfm(options) {
22394
22394
  toMarkdownExtensions.push(gfmToMarkdown(settings));
22395
22395
  }
22396
22396
 
22397
+ // src/kpi-contract.ts
22398
+ var GITHUB_SYNC_PLUGIN_ID = "paperclip-github-plugin";
22399
+ var COMPANY_METRIC_API_ROUTE_PATH = "/company-metrics/events";
22400
+ var COMPANY_METRIC_API_ROUTE_URL_PATH = `/api/plugins/${GITHUB_SYNC_PLUGIN_ID}/api${COMPANY_METRIC_API_ROUTE_PATH}`;
22401
+
22397
22402
  // src/github-repo.ts
22398
22403
  function parseRepositoryReference(repositoryInput) {
22399
22404
  const trimmed = repositoryInput.trim();
@@ -22652,6 +22657,105 @@ async function fetchPaperclipHealth(origin) {
22652
22657
  }
22653
22658
  }
22654
22659
 
22660
+ // src/ui/host-secrets.ts
22661
+ var HOST_GITHUB_TOKEN_SECRET_NAMES = ["GITHUB_TOKEN", "GH_TOKEN", "PAPERCLIP_GITHUB_TOKEN"];
22662
+ var HOST_GITHUB_TOKEN_SECRET_NAME = HOST_GITHUB_TOKEN_SECRET_NAMES[0];
22663
+ function buildCompanySecretListRequest(companyId) {
22664
+ return {
22665
+ url: `/api/companies/${encodeURIComponent(companyId)}/secrets`
22666
+ };
22667
+ }
22668
+ function buildCompanySecretCreateRequest(companyId, name2, value) {
22669
+ return {
22670
+ url: `/api/companies/${encodeURIComponent(companyId)}/secrets`,
22671
+ init: {
22672
+ method: "POST",
22673
+ body: JSON.stringify({
22674
+ name: name2,
22675
+ value
22676
+ })
22677
+ }
22678
+ };
22679
+ }
22680
+ function buildCompanySecretRotateRequest(secretId, value) {
22681
+ return {
22682
+ url: `/api/secrets/${encodeURIComponent(secretId)}/rotate`,
22683
+ init: {
22684
+ method: "POST",
22685
+ body: JSON.stringify({
22686
+ value
22687
+ })
22688
+ }
22689
+ };
22690
+ }
22691
+ function findCompanySecretByName(secrets, name2, options = {}) {
22692
+ const caseSensitive = options.caseSensitive === true;
22693
+ const expectedName = caseSensitive ? name2 : name2.trim().toLowerCase();
22694
+ return secrets.find((secret) => {
22695
+ if (typeof secret?.name !== "string") {
22696
+ return false;
22697
+ }
22698
+ const candidate = caseSensitive ? secret.name : secret.name.trim().toLowerCase();
22699
+ return candidate === expectedName;
22700
+ }) ?? null;
22701
+ }
22702
+ async function resolveOrCreateCompanySecret(fetchJson2, companyId, name2, value, options = {}) {
22703
+ const listRequest = buildCompanySecretListRequest(companyId);
22704
+ const existingSecrets = await fetchJson2(listRequest.url, listRequest.init);
22705
+ const existing = findCompanySecretByName(Array.isArray(existingSecrets) ? existingSecrets : [], name2, options);
22706
+ if (existing) {
22707
+ const rotateRequest = buildCompanySecretRotateRequest(existing.id, value);
22708
+ return fetchJson2(rotateRequest.url, rotateRequest.init);
22709
+ }
22710
+ const createRequest = buildCompanySecretCreateRequest(companyId, name2, value);
22711
+ return fetchJson2(createRequest.url, createRequest.init);
22712
+ }
22713
+ async function exposeGitHubTokenToPaperclipHost(fetchJson2, companyId, token) {
22714
+ const trimmedCompanyId = companyId.trim();
22715
+ if (!trimmedCompanyId) {
22716
+ throw new Error("Company context is required to expose the GitHub token to Paperclip.");
22717
+ }
22718
+ const trimmedToken = token.trim();
22719
+ if (!trimmedToken) {
22720
+ throw new Error("A GitHub token is required to expose it to Paperclip.");
22721
+ }
22722
+ const listRequest = buildCompanySecretListRequest(trimmedCompanyId);
22723
+ const existingSecrets = await fetchJson2(listRequest.url, listRequest.init);
22724
+ const existing = findCompanySecretByName(
22725
+ Array.isArray(existingSecrets) ? existingSecrets : [],
22726
+ HOST_GITHUB_TOKEN_SECRET_NAME,
22727
+ {
22728
+ caseSensitive: true
22729
+ }
22730
+ );
22731
+ if (existing) {
22732
+ if (typeof existing.status === "string" && existing.status !== "active") {
22733
+ throw new Error(
22734
+ `The ${HOST_GITHUB_TOKEN_SECRET_NAME} company secret is ${existing.status}, not active. Re-activate it in Settings -> Secrets and save the token again, because Paperclip ignores a secret in this state.`
22735
+ );
22736
+ }
22737
+ const rotateRequest = buildCompanySecretRotateRequest(existing.id, trimmedToken);
22738
+ return fetchJson2(rotateRequest.url, rotateRequest.init);
22739
+ }
22740
+ const createRequest = buildCompanySecretCreateRequest(
22741
+ trimmedCompanyId,
22742
+ HOST_GITHUB_TOKEN_SECRET_NAME,
22743
+ trimmedToken
22744
+ );
22745
+ try {
22746
+ return await fetchJson2(createRequest.url, createRequest.init);
22747
+ } catch (error) {
22748
+ const message = error instanceof Error ? error.message : String(error);
22749
+ if (/already exists/i.test(message)) {
22750
+ throw new Error(
22751
+ `Paperclip already has a company secret that conflicts with ${HOST_GITHUB_TOKEN_SECRET_NAME} (${message}). Paperclip matches this name exactly, so rename or delete the conflicting secret, or set ${HOST_GITHUB_TOKEN_SECRET_NAME} manually in Settings -> Secrets.`,
22752
+ { cause: error }
22753
+ );
22754
+ }
22755
+ throw error;
22756
+ }
22757
+ }
22758
+
22655
22759
  // src/ui/plugin-installation.ts
22656
22760
  var SETTINGS_INDEX_HREF = "/instance/settings/plugins";
22657
22761
  var GITHUB_SYNC_PLUGIN_KEY = "paperclip-github-plugin";
@@ -22741,6 +22845,14 @@ function normalizeCompanySecretRefMap(value) {
22741
22845
  }
22742
22846
  return Object.fromEntries(entries);
22743
22847
  }
22848
+ function hasLegacyPluginSecretRefs(value) {
22849
+ if (!isPlainRecord(value)) {
22850
+ return false;
22851
+ }
22852
+ return [value.githubTokenRefs, value.paperclipBoardApiTokenRefs].some(
22853
+ (refs) => isPlainRecord(refs) && Object.values(refs).some((secretRef) => !isPluginSecretRefBinding(secretRef) && Boolean(normalizeOptionalString2(secretRef)))
22854
+ );
22855
+ }
22744
22856
  function normalizePluginConfigBoardTokenRefs(value) {
22745
22857
  return normalizeCompanySecretRefMap(value);
22746
22858
  }
@@ -22874,6 +22986,7 @@ function filterExistingProjectSyncCandidates(candidates, mappings) {
22874
22986
 
22875
22987
  // src/ui/index.tsx
22876
22988
  import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
22989
+ var GITHUB_SYNC_TOOL_ACCESS_DOCS_URL = "https://github.com/alvarosanchez/paperclip-github-plugin#granting-the-tools-to-agents";
22877
22990
  var HOST_BUTTON_BASE_CLASSNAME = [
22878
22991
  "inline-flex items-center justify-center whitespace-nowrap text-sm font-medium",
22879
22992
  "transition-[color,background-color,border-color,box-shadow,opacity]",
@@ -24071,6 +24184,33 @@ var PAGE_STYLES = `
24071
24184
  color: var(--ghsync-muted);
24072
24185
  }
24073
24186
 
24187
+ .ghsync__checkbox-field {
24188
+ display: flex;
24189
+ gap: 10px;
24190
+ align-items: flex-start;
24191
+ }
24192
+
24193
+ .ghsync__checkbox-field input[type="checkbox"] {
24194
+ margin-top: 2px;
24195
+ accent-color: var(--ghsync-accent, currentColor);
24196
+ }
24197
+
24198
+ .ghsync__checkbox-field-copy {
24199
+ display: grid;
24200
+ gap: 4px;
24201
+ }
24202
+
24203
+ .ghsync__checkbox-field-copy label {
24204
+ font-size: 12px;
24205
+ font-weight: 600;
24206
+ color: var(--ghsync-title);
24207
+ }
24208
+
24209
+ .ghsync__checkbox-field-copy span {
24210
+ font-size: 12px;
24211
+ color: var(--ghsync-muted);
24212
+ }
24213
+
24074
24214
  .ghsync__input:focus {
24075
24215
  border-color: var(--ghsync-border);
24076
24216
  }
@@ -24427,6 +24567,12 @@ var PAGE_STYLES = `
24427
24567
  line-height: 1.5;
24428
24568
  }
24429
24569
 
24570
+ .ghsync__permission-audit-item a {
24571
+ color: var(--ghsync-title);
24572
+ font-size: 12px;
24573
+ text-decoration: underline;
24574
+ }
24575
+
24430
24576
  .ghsync__sync-summary--success {
24431
24577
  border-color: var(--ghsync-success-border);
24432
24578
  background: var(--ghsync-success-bg);
@@ -26686,15 +26832,6 @@ var EXTENSION_SURFACE_STYLES = `
26686
26832
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
26687
26833
  }
26688
26834
 
26689
- .ghsync-extension-card--compact {
26690
- gap: 10px;
26691
- padding: 0;
26692
- border: 0;
26693
- border-radius: 0;
26694
- background: transparent;
26695
- box-shadow: none;
26696
- }
26697
-
26698
26835
  .ghsync-extension-heading {
26699
26836
  display: flex;
26700
26837
  justify-content: space-between;
@@ -26778,7 +26915,6 @@ var EXTENSION_SURFACE_STYLES = `
26778
26915
 
26779
26916
  .ghsync-extension-links,
26780
26917
  .ghsync-extension-labels,
26781
- .ghsync-comment-annotation,
26782
26918
  .ghsync-toolbar-button {
26783
26919
  display: flex;
26784
26920
  flex-wrap: wrap;
@@ -26819,14 +26955,6 @@ var EXTENSION_SURFACE_STYLES = `
26819
26955
  font-weight: 500;
26820
26956
  }
26821
26957
 
26822
- .ghsync-comment-annotation__label {
26823
- color: var(--ghsync-muted);
26824
- font-size: 11px;
26825
- font-weight: 700;
26826
- letter-spacing: 0.08em;
26827
- text-transform: uppercase;
26828
- }
26829
-
26830
26958
  .ghsync-extension-note {
26831
26959
  padding: 12px;
26832
26960
  border-radius: 14px;
@@ -27567,9 +27695,12 @@ async function fetchPluginDataResult(params) {
27567
27695
  function buildPluginConfigUrl(pluginId, companyId) {
27568
27696
  return `/api/plugins/${pluginId}/config?companyId=${encodeURIComponent(companyId)}`;
27569
27697
  }
27570
- async function readPluginConfig(pluginId, companyId) {
27698
+ async function readRawPluginConfig(pluginId, companyId) {
27571
27699
  const currentConfigResponse = await fetchJson(buildPluginConfigUrl(pluginId, companyId));
27572
- return normalizePluginConfig(currentConfigResponse?.configJson);
27700
+ return currentConfigResponse?.configJson;
27701
+ }
27702
+ async function readPluginConfig(pluginId, companyId) {
27703
+ return normalizePluginConfig(await readRawPluginConfig(pluginId, companyId));
27573
27704
  }
27574
27705
  async function syncTrustedPaperclipApiBaseUrl(pluginId, companyId) {
27575
27706
  const resolvedPluginId = await resolveCurrentPluginId(pluginId);
@@ -28315,24 +28446,8 @@ async function ensureProjectRepoBinding(projectId, repositoryUrl) {
28315
28446
  })
28316
28447
  });
28317
28448
  }
28318
- async function resolveOrCreateCompanySecret(companyId, name2, value) {
28319
- const existingSecrets = await fetchJson(`/api/companies/${companyId}/secrets`);
28320
- const existing = existingSecrets.find((secret) => secret.name.trim().toLowerCase() === name2.trim().toLowerCase());
28321
- if (existing) {
28322
- return fetchJson(`/api/secrets/${existing.id}/rotate`, {
28323
- method: "POST",
28324
- body: JSON.stringify({
28325
- value
28326
- })
28327
- });
28328
- }
28329
- return fetchJson(`/api/companies/${companyId}/secrets`, {
28330
- method: "POST",
28331
- body: JSON.stringify({
28332
- name: name2,
28333
- value
28334
- })
28335
- });
28449
+ function resolveOrCreateCompanySecret2(companyId, name2, value) {
28450
+ return resolveOrCreateCompanySecret(fetchJson, companyId, name2, value);
28336
28451
  }
28337
28452
  function isPluginSecretReferencesDisabledError(error) {
28338
28453
  return getActionErrorMessage(error, "").toLowerCase().includes("plugin secret references are disabled");
@@ -28384,9 +28499,12 @@ async function patchPluginConfig(pluginId, companyId, patch5) {
28384
28499
  if (!companyId) {
28385
28500
  throw new Error("Company context is required to save GitHub Sync plugin config.");
28386
28501
  }
28387
- const currentConfig = await readPluginConfig(pluginId, companyId);
28502
+ const rawCurrentConfig = await readRawPluginConfig(pluginId, companyId);
28503
+ const currentConfig = normalizePluginConfig(rawCurrentConfig);
28388
28504
  const nextConfig = mergePluginConfig(currentConfig, patch5);
28389
- if (JSON.stringify(nextConfig) === JSON.stringify(currentConfig)) {
28505
+ const isLegacySecretRefMigration = hasLegacyPluginSecretRefs(rawCurrentConfig);
28506
+ const isNormalizedConfigUnchanged = JSON.stringify(nextConfig) === JSON.stringify(currentConfig);
28507
+ if (!isLegacySecretRefMigration && isNormalizedConfigUnchanged) {
28390
28508
  return;
28391
28509
  }
28392
28510
  try {
@@ -28395,6 +28513,9 @@ async function patchPluginConfig(pluginId, companyId, patch5) {
28395
28513
  if (!isPluginSecretReferencesDisabledError(error)) {
28396
28514
  throw error;
28397
28515
  }
28516
+ if (isLegacySecretRefMigration && isNormalizedConfigUnchanged) {
28517
+ return;
28518
+ }
28398
28519
  const safeConfig = stripPluginSecretRefConfig(nextConfig);
28399
28520
  if (JSON.stringify(safeConfig) === JSON.stringify(nextConfig)) {
28400
28521
  throw error;
@@ -31873,6 +31994,7 @@ function GitHubSyncSettingsPage() {
31873
31994
  const [tokenDraft, setTokenDraft] = useState2("");
31874
31995
  const [showSavedTokenHint, setShowSavedTokenHint] = useState2(false);
31875
31996
  const [showTokenEditor, setShowTokenEditor] = useState2(false);
31997
+ const [exposeTokenAsHostSecret, setExposeTokenAsHostSecret] = useState2(false);
31876
31998
  const [showAdvancedSettings, setShowAdvancedSettings] = useState2(false);
31877
31999
  const [cachedSettings, setCachedSettings] = useState2(null);
31878
32000
  const [existingProjectCandidates, setExistingProjectCandidates] = useState2([]);
@@ -31892,6 +32014,9 @@ function GitHubSyncSettingsPage() {
31892
32014
  setCachedSettings(settings.data);
31893
32015
  }
31894
32016
  }, [settings.data]);
32017
+ useEffect2(() => {
32018
+ setExposeTokenAsHostSecret(false);
32019
+ }, [hostContext.companyId]);
31895
32020
  useEffect2(() => {
31896
32021
  if (!settings.data) {
31897
32022
  return;
@@ -32202,6 +32327,10 @@ function GitHubSyncSettingsPage() {
32202
32327
  const tokenPermissionAuditErrorVisible = hasCompanyContext && tokenStatus === "valid" && tokenPermissionAuditData?.status === "error";
32203
32328
  const tokenPermissionWarningVisible = hasCompanyContext && tokenStatus === "valid" && tokenPermissionWarnings.length > 0;
32204
32329
  const tokenPermissionUnknownVisible = hasCompanyContext && tokenStatus === "valid" && !tokenPermissionAuditErrorVisible && !tokenPermissionWarningVisible && tokenPermissionAuditData?.status === "ready" && tokenPermissionRepositories.length === 0;
32330
+ const agentToolAccess = settings.data?.agentToolAccess;
32331
+ const agentToolAccessWarningVisible = hasCompanyContext && agentToolAccess?.status === "ready" && agentToolAccess.toolsVisibleToAgents === 0;
32332
+ const agentToolAccessSampleLabel = agentToolAccess?.checkedAgentName ? `Agent ${agentToolAccess.checkedAgentName}` : "The checked agent";
32333
+ const agentToolAccessOtherAgentsHint = typeof agentToolAccess?.checkableAgentCount === "number" && agentToolAccess.checkableAgentCount > 1 ? ` of ${agentToolAccess.checkableAgentCount}` : "";
32205
32334
  const boardAccessTone = connectingBoardAccess ? "info" : boardAccessConfigured ? "success" : boardAccessRequired ? "warning" : "info";
32206
32335
  const boardAccessBannerLabel = connectingBoardAccess ? "Connecting" : boardAccessConfigured ? "Connected" : boardAccessRequired ? "Required" : boardAccessRequirement.status === "loading" ? "Checking" : "Optional";
32207
32336
  const boardAccessSectionDescription = "";
@@ -32475,7 +32604,7 @@ function GitHubSyncSettingsPage() {
32475
32604
  }
32476
32605
  const trimmedToken = tokenDraft.trim();
32477
32606
  const secretName = `github_sync_${companyId.replace(/[^a-z0-9]+/gi, "_").toLowerCase()}`;
32478
- const secret = await resolveOrCreateCompanySecret(companyId, secretName, trimmedToken);
32607
+ const secret = await resolveOrCreateCompanySecret2(companyId, secretName, trimmedToken);
32479
32608
  await patchPluginConfig(pluginId, companyId, {
32480
32609
  githubTokenRefs: {
32481
32610
  [companyId]: secret.id
@@ -32498,6 +32627,16 @@ function GitHubSyncSettingsPage() {
32498
32627
  } catch (error) {
32499
32628
  availabilityWarning = error;
32500
32629
  }
32630
+ let hostSecretExposureWarning = null;
32631
+ let hostSecretExposed = false;
32632
+ if (exposeTokenAsHostSecret) {
32633
+ try {
32634
+ await exposeGitHubTokenToPaperclipHost(fetchJson, companyId, trimmedToken);
32635
+ hostSecretExposed = true;
32636
+ } catch (error) {
32637
+ hostSecretExposureWarning = error;
32638
+ }
32639
+ }
32501
32640
  setForm((current) => ({
32502
32641
  ...current,
32503
32642
  githubTokenConfigured: true
@@ -32507,6 +32646,7 @@ function GitHubSyncSettingsPage() {
32507
32646
  setTokenStatusOverride("valid");
32508
32647
  setValidatedLogin(validation.login);
32509
32648
  setTokenDraft("");
32649
+ setExposeTokenAsHostSecret(false);
32510
32650
  toast({
32511
32651
  title: `Authenticated as ${validation.login}`,
32512
32652
  body: "Token saved.",
@@ -32522,6 +32662,23 @@ function GitHubSyncSettingsPage() {
32522
32662
  tone: "error"
32523
32663
  });
32524
32664
  }
32665
+ if (hostSecretExposed) {
32666
+ toast({
32667
+ title: `Paperclip secret ${HOST_GITHUB_TOKEN_SECRET_NAME} updated`,
32668
+ body: "Paperclip host GitHub features can now authenticate with this token.",
32669
+ tone: "success"
32670
+ });
32671
+ }
32672
+ if (hostSecretExposureWarning) {
32673
+ toast({
32674
+ title: `GitHub token saved, but ${HOST_GITHUB_TOKEN_SECRET_NAME} could not be updated`,
32675
+ body: getActionErrorMessage(
32676
+ hostSecretExposureWarning,
32677
+ `Paperclip could not create or rotate the ${HOST_GITHUB_TOKEN_SECRET_NAME} company secret.`
32678
+ ),
32679
+ tone: "error"
32680
+ });
32681
+ }
32525
32682
  notifyGitHubSyncSettingsChanged();
32526
32683
  try {
32527
32684
  await settings.refresh();
@@ -32569,7 +32726,7 @@ function GitHubSyncSettingsPage() {
32569
32726
  const boardApiToken = await waitForBoardAccessApproval(challenge);
32570
32727
  const boardIdentity = await fetchBoardAccessIdentity(boardApiToken);
32571
32728
  const secretName = `paperclip_board_api_${companyId.replace(/[^a-z0-9]+/gi, "_").toLowerCase()}`;
32572
- const secret = await resolveOrCreateCompanySecret(companyId, secretName, boardApiToken);
32729
+ const secret = await resolveOrCreateCompanySecret2(companyId, secretName, boardApiToken);
32573
32730
  await patchPluginConfig(pluginId, companyId, {
32574
32731
  paperclipBoardApiTokenRefs: {
32575
32732
  [companyId]: secret.id
@@ -32864,6 +33021,28 @@ function GitHubSyncSettingsPage() {
32864
33021
  }
32865
33022
  )
32866
33023
  ] }),
33024
+ /* @__PURE__ */ jsxs2("div", { className: "ghsync__checkbox-field", children: [
33025
+ /* @__PURE__ */ jsx2(
33026
+ "input",
33027
+ {
33028
+ id: "github-token-expose-host-secret",
33029
+ type: "checkbox",
33030
+ checked: exposeTokenAsHostSecret,
33031
+ disabled: settingsMutationsLocked,
33032
+ onChange: (event) => {
33033
+ setExposeTokenAsHostSecret(event.currentTarget.checked);
33034
+ }
33035
+ }
33036
+ ),
33037
+ /* @__PURE__ */ jsxs2("div", { className: "ghsync__checkbox-field-copy", children: [
33038
+ /* @__PURE__ */ jsx2("label", { htmlFor: "github-token-expose-host-secret", children: `Also expose this token to Paperclip as ${HOST_GITHUB_TOKEN_SECRET_NAME}` }),
33039
+ /* @__PURE__ */ jsxs2("span", { children: [
33040
+ `Creates or rotates a company secret named ${HOST_GITHUB_TOKEN_SECRET_NAME} so Paperclip's own GitHub features `,
33041
+ "(managed-checkout git credentials, merged-PR confirmation sweep, workspace reaper, external-object liveness) ",
33042
+ "can authenticate with the same token. GitHub Sync itself does not need it."
33043
+ ] })
33044
+ ] })
33045
+ ] }),
32867
33046
  /* @__PURE__ */ jsx2("div", { className: "ghsync__actions", children: /* @__PURE__ */ jsxs2("div", { className: "ghsync__button-row", children: [
32868
33047
  hasSavedToken ? /* @__PURE__ */ jsx2(
32869
33048
  "button",
@@ -32875,6 +33054,7 @@ function GitHubSyncSettingsPage() {
32875
33054
  setShowTokenEditor(false);
32876
33055
  setTokenDraft("");
32877
33056
  setTokenStatusOverride("valid");
33057
+ setExposeTokenAsHostSecret(false);
32878
33058
  },
32879
33059
  children: "Cancel"
32880
33060
  }
@@ -32936,6 +33116,30 @@ function GitHubSyncSettingsPage() {
32936
33116
  tokenPermissionUnknownVisible ? /* @__PURE__ */ jsxs2("div", { className: "ghsync__permission-audit", children: [
32937
33117
  /* @__PURE__ */ jsx2("div", { className: "ghsync__permission-audit-header", children: /* @__PURE__ */ jsx2("strong", { children: "Token permission audit pending" }) }),
32938
33118
  /* @__PURE__ */ jsx2("div", { className: "ghsync__permission-audit-list", children: /* @__PURE__ */ jsx2("div", { className: "ghsync__permission-audit-item", children: /* @__PURE__ */ jsx2("span", { children: tokenPermissionAuditData?.warnings[0] ?? "Add a mapped repository in this company so GitHub Sync can verify the token permissions it needs." }) }) })
33119
+ ] }) : null,
33120
+ agentToolAccessWarningVisible ? /* @__PURE__ */ jsxs2("div", { className: "ghsync__permission-audit ghsync__permission-audit--warning", children: [
33121
+ /* @__PURE__ */ jsxs2("div", { className: "ghsync__permission-audit-header", children: [
33122
+ /* @__PURE__ */ jsx2("strong", { children: `${agentToolAccessSampleLabel} cannot see the GitHub Sync tools` }),
33123
+ /* @__PURE__ */ jsx2("span", { className: "ghsync__badge ghsync__badge--warning", children: "Tool access" })
33124
+ ] }),
33125
+ /* @__PURE__ */ jsx2("div", { className: "ghsync__permission-audit-list", children: /* @__PURE__ */ jsxs2("div", { className: "ghsync__permission-audit-item", children: [
33126
+ /* @__PURE__ */ jsxs2("span", { children: [
33127
+ `Paperclip's tool gateway is fail-closed, and no tool profile that applies to ${agentToolAccessSampleLabel} includes any of the `,
33128
+ agentToolAccess?.totalToolCount ? `${agentToolAccess.totalToolCount} ` : "",
33129
+ `${GITHUB_SYNC_PLUGIN_ID}:* tools, so those tools will not be offered. `,
33130
+ "Bind a tool profile with tool_name include entries at company scope. ",
33131
+ `This is a sample of one agent${agentToolAccessOtherAgentsHint}: Paperclip evaluates tool profiles per agent, and an agent-scoped binding overrides the company one.`
33132
+ ] }),
33133
+ /* @__PURE__ */ jsx2(
33134
+ "a",
33135
+ {
33136
+ href: GITHUB_SYNC_TOOL_ACCESS_DOCS_URL,
33137
+ target: "_blank",
33138
+ rel: "noreferrer",
33139
+ children: "How to grant the tools to agents"
33140
+ }
33141
+ )
33142
+ ] }) })
32939
33143
  ] }) : null
32940
33144
  ] }),
32941
33145
  boardAccessSettingsVisible ? /* @__PURE__ */ jsxs2("section", { className: "ghsync__section", children: [
@@ -35035,47 +35239,8 @@ function GitHubSyncIssueTaskDetailView(props) {
35035
35239
  );
35036
35240
  }
35037
35241
  var GitHubSyncIssueDetailTab = GitHubSyncIssueTaskDetailView;
35038
- function GitHubSyncCommentAnnotation() {
35039
- const context = useHostContext();
35040
- const themeMode = useResolvedThemeMode();
35041
- const theme = themeMode === "light" ? LIGHT_PALETTE : DARK_PALETTE;
35042
- const themeVars = buildThemeVars(theme, themeMode);
35043
- const annotation = usePluginData("comment.annotation", {
35044
- ...context.companyId ? { companyId: context.companyId } : {},
35045
- ...context.entityId ? { commentId: context.entityId } : {},
35046
- ...context.parentEntityId ? { parentIssueId: context.parentEntityId } : {}
35047
- });
35048
- if (annotation.loading && !annotation.data) {
35049
- return null;
35050
- }
35051
- if (annotation.error || !annotation.data || annotation.data.links.length === 0) {
35052
- return null;
35053
- }
35054
- return /* @__PURE__ */ jsxs2("div", { className: "ghsync-extension-card ghsync-extension-card--compact", style: themeVars, children: [
35055
- /* @__PURE__ */ jsx2("style", { children: EXTENSION_SURFACE_STYLES }),
35056
- /* @__PURE__ */ jsxs2("div", { className: "ghsync-comment-annotation", children: [
35057
- /* @__PURE__ */ jsx2("span", { className: "ghsync-comment-annotation__label", children: "GitHub refs" }),
35058
- annotation.data.links.map((link3) => /* @__PURE__ */ jsx2(
35059
- "a",
35060
- {
35061
- href: link3.href,
35062
- target: "_blank",
35063
- rel: "noreferrer",
35064
- className: getPluginActionClassName({
35065
- variant: "secondary",
35066
- size: "sm",
35067
- extraClassName: "ghsync-extension-link"
35068
- }),
35069
- children: /* @__PURE__ */ jsx2(GitHubButtonLabel, { label: link3.label })
35070
- },
35071
- `${link3.type}:${link3.href}`
35072
- ))
35073
- ] })
35074
- ] });
35075
- }
35076
35242
  var index_default = GitHubSyncSettingsPage;
35077
35243
  export {
35078
- GitHubSyncCommentAnnotation,
35079
35244
  GitHubSyncDashboardWidget,
35080
35245
  GitHubSyncEntityToolbarButton,
35081
35246
  GitHubSyncGlobalToolbarButton,