@apotech-os/support-kit 4.0.0 → 5.0.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/index.cjs CHANGED
@@ -1150,11 +1150,11 @@ var PRODUCTION_LABEL = "production";
1150
1150
  var DEFAULT_TTL_MS = 6e4;
1151
1151
  var MAX_COMPOSITION_DEPTH = 5;
1152
1152
  function cacheKey(name, label) {
1153
- return label === PRODUCTION_LABEL ? name : `${name}::${label}`;
1153
+ return label === PRODUCTION_LABEL ? name : `${name}\0${label}`;
1154
1154
  }
1155
1155
  function memoryKey(name, opts) {
1156
- if (opts.version !== void 0) return `${name}::v${opts.version}`;
1157
- return cacheKey(name, opts.label ?? PRODUCTION_LABEL);
1156
+ if (opts.version !== void 0) return JSON.stringify(["v", name, opts.version]);
1157
+ return JSON.stringify(["l", name, opts.label ?? PRODUCTION_LABEL]);
1158
1158
  }
1159
1159
  function substituteVars(text, vars) {
1160
1160
  if (!vars) return text;
@@ -5631,30 +5631,23 @@ function pageIdentifierFor(config, key) {
5631
5631
  }
5632
5632
  return id;
5633
5633
  }
5634
-
5635
- // src/pipeline.ts
5636
- var SUPPORT_KIT_GORGIAS_ACTIONS = [
5637
- "applyTags",
5638
- "buildTicketContext",
5639
- "fetchTicketsFromView",
5640
- "getRawTicket",
5641
- "getTicketUrlBase",
5642
- "getTicketWithContext",
5643
- "listViews",
5644
- "postWhatsappNote",
5645
- "renameTicket",
5646
- "replyEmail"
5647
- ];
5648
5634
  var SUPPORT_KIT_CAPABILITIES = [
5649
5635
  "runs",
5650
5636
  "inbox",
5651
5637
  "approvals",
5652
5638
  "prompts",
5653
- "langfuse"
5639
+ "langfuse",
5640
+ "llm"
5654
5641
  ];
5655
- var SUPPORT_KIT_ACTIONS = [
5656
- ...SUPPORT_KIT_GORGIAS_ACTIONS.map((action) => ({ provider: "gorgias", action })),
5657
- { provider: "llm", action: "complete" }
5642
+ var SUPPORT_KIT_GORGIAS_SCOPES = [
5643
+ "read_customers",
5644
+ "read_tickets",
5645
+ "read_views",
5646
+ "write_tags",
5647
+ "write_tickets"
5648
+ ];
5649
+ var SUPPORT_KIT_INTEGRATIONS = [
5650
+ { provider: "gorgias", scopes: [...SUPPORT_KIT_GORGIAS_SCOPES] }
5658
5651
  ];
5659
5652
  var SUPPORT_KIT_EMITS = [TRIAGE_RUN_REQUESTED_EVENT];
5660
5653
  var FUNCTION_ASSEMBLY = [
@@ -5761,8 +5754,14 @@ function dedupe(items, keyOf) {
5761
5754
  for (const item of items) seen.set(keyOf(item), item);
5762
5755
  return [...seen.values()];
5763
5756
  }
5764
- function mergeActionRefs(actions) {
5765
- return dedupe([...actions, ...SUPPORT_KIT_ACTIONS], (a) => `${a.provider}::${a.action}`);
5757
+ function mergeIntegrationRefs(integrations) {
5758
+ const byProvider = /* @__PURE__ */ new Map();
5759
+ for (const entry of [...integrations, ...SUPPORT_KIT_INTEGRATIONS]) {
5760
+ const scopes = byProvider.get(entry.provider) ?? /* @__PURE__ */ new Set();
5761
+ for (const scope of entry.scopes) scopes.add(scope);
5762
+ byProvider.set(entry.provider, scopes);
5763
+ }
5764
+ return [...byProvider.entries()].map(([provider, scopes]) => ({ provider, scopes: [...scopes].sort() })).sort((a, b) => a.provider.localeCompare(b.provider));
5766
5765
  }
5767
5766
  var KIT_READ_ONLY_OBJECT_KEYS = ["category", "category-group"];
5768
5767
  var KIT_WRITE_ONLY_OBJECT_KEYS = ["evaluation", "diff-analysis"];
@@ -5776,7 +5775,6 @@ function buildMergeRole(config) {
5776
5775
  ...role,
5777
5776
  reads: dedupe([...role.reads, ...kitReadRefs], (ref) => ref),
5778
5777
  writes: dedupe([...role.writes, ...kitWriteRefs], (ref) => ref),
5779
- actions: mergeActionRefs(role.actions),
5780
5778
  capabilities: dedupe([...role.capabilities ?? [], ...SUPPORT_KIT_CAPABILITIES], (c) => c),
5781
5779
  prompts: dedupe([...role.prompts ?? [], ...kitPrompts], (p) => p)
5782
5780
  });
@@ -5843,12 +5841,12 @@ function buildSupportPipeline(config) {
5843
5841
  pages: buildPages(config),
5844
5842
  navigation: buildNavigation(config),
5845
5843
  settingsPage: buildSettingsPage(config),
5846
- actions: SUPPORT_KIT_ACTIONS,
5844
+ integrations: SUPPORT_KIT_INTEGRATIONS,
5847
5845
  emits: SUPPORT_KIT_EMITS,
5848
5846
  defaultRole: "NO_ACCESS",
5849
5847
  handlers,
5850
5848
  mergeRole: buildMergeRole(config),
5851
- mergeActions: mergeActionRefs
5849
+ mergeIntegrations: mergeIntegrationRefs
5852
5850
  };
5853
5851
  }
5854
5852