@apotech-os/support-kit 3.0.1 → 3.0.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/index.cjs CHANGED
@@ -2439,12 +2439,11 @@ var SUPPORT_KIT_SETTINGS_FIELDS = [
2439
2439
  // `validateSettings` refuses to run until `nodes.triage` is configured.
2440
2440
  { key: "nodes", type: "json", label: "Graph node overrides" },
2441
2441
  // Audit tags
2442
- { key: "unknownTag", type: "string", label: "Unknown tag", default: "wai-tag/unknown" },
2443
- { key: "handledTag", type: "string", label: "Handled tag", default: "wai-tag/triaged" },
2444
- { key: "escalationTag", type: "string", label: "Escalation tag", default: "wai/human-required" },
2445
- { key: "needsHumanTag", type: "string", label: "Needs-human tag", default: "wai/needs-human" },
2442
+ { key: "unknownTag", type: "string", label: "Unknown tag", default: "wai/unknown" },
2443
+ { key: "handledTag", type: "string", label: "Handled tag", default: "wai/triaged" },
2444
+ { key: "escalationTag", type: "string", label: "Escalation tag", default: "wai/escalated" },
2446
2445
  { key: "autoRepliedTag", type: "string", label: "Auto-replied tag", default: "wai/auto-replied" },
2447
- { key: "needsReviewTag", type: "string", label: "Needs-review tag", default: "wai/needs-review" },
2446
+ { key: "needsReviewTag", type: "string", label: "Review-before-send tag", default: "wai/escalated" },
2448
2447
  { key: "followupTag", type: "string", label: "Followup tag", default: "wai/followup-required" },
2449
2448
  // Sending
2450
2449
  { key: "autoSendEnabled", type: "boolean", label: "Auto-send enabled", default: false },
@@ -3042,9 +3041,26 @@ async function readPipelineState(api) {
3042
3041
  return page.items[0] ?? null;
3043
3042
  }
3044
3043
  async function upsertPipelineState(api, patch) {
3045
- await api.upsert("pipeline-state", [{ data: { singletonKey: PIPELINE_STATE_SINGLETON_KEY, ...patch } }], {
3046
- uniqueBy: ["singletonKey"]
3047
- });
3044
+ const current = await readPipelineState(api);
3045
+ if (current) {
3046
+ await api.update("pipeline-state", current.id, patch);
3047
+ return;
3048
+ }
3049
+ await api.upsert(
3050
+ "pipeline-state",
3051
+ [
3052
+ {
3053
+ data: {
3054
+ singletonKey: PIPELINE_STATE_SINGLETON_KEY,
3055
+ sourceViewId: null,
3056
+ lastTriageAt: null,
3057
+ lastSweepAt: null,
3058
+ ...patch
3059
+ }
3060
+ }
3061
+ ],
3062
+ { uniqueBy: ["singletonKey"] }
3063
+ );
3048
3064
  }
3049
3065
 
3050
3066
  // src/functions/records.ts
@@ -5618,7 +5634,13 @@ var SUPPORT_KIT_GORGIAS_ACTIONS = [
5618
5634
  "renameTicket",
5619
5635
  "replyEmail"
5620
5636
  ];
5621
- var SUPPORT_KIT_CAPABILITIES = ["runs", "inbox", "approvals", "prompts", "langfuse"];
5637
+ var SUPPORT_KIT_CAPABILITIES = [
5638
+ "runs",
5639
+ "inbox",
5640
+ "approvals",
5641
+ "prompts",
5642
+ "langfuse"
5643
+ ];
5622
5644
  var SUPPORT_KIT_ACTIONS = [
5623
5645
  ...SUPPORT_KIT_GORGIAS_ACTIONS.map((action) => ({ provider: "gorgias", action })),
5624
5646
  { provider: "llm", action: "complete" }
@@ -5626,18 +5648,58 @@ var SUPPORT_KIT_ACTIONS = [
5626
5648
  var SUPPORT_KIT_EMITS = [TRIAGE_RUN_REQUESTED_EVENT];
5627
5649
  var FUNCTION_ASSEMBLY = [
5628
5650
  { key: "triage-tick", build: buildTriageTickFunctionDef, createHandler: createTriageTickHandler },
5629
- { key: "process-response", build: buildProcessResponseFunctionDef, createHandler: createProcessResponseHandler },
5651
+ {
5652
+ key: "process-response",
5653
+ build: buildProcessResponseFunctionDef,
5654
+ createHandler: createProcessResponseHandler
5655
+ },
5630
5656
  { key: "sweep", build: buildSweepFunctionDef, createHandler: () => createSweepHandler() },
5631
- { key: "handle-approval", build: buildHandleApprovalFunctionDef, createHandler: createHandleApprovalHandler },
5632
- { key: "run-triage-now", build: buildRunTriageNowFunctionDef, createHandler: createRunTriageNowHandler },
5633
- { key: "run-triage-batch", build: buildRunTriageBatchFunctionDef, createHandler: createRunTriageBatchHandler },
5634
- { key: "preview-triage", build: buildPreviewTriageFunctionDef, createHandler: createPreviewTriageHandler },
5635
- { key: "graph-dry-run", build: buildGraphDryRunFunctionDef, createHandler: createGraphDryRunHandler },
5657
+ {
5658
+ key: "handle-approval",
5659
+ build: buildHandleApprovalFunctionDef,
5660
+ createHandler: createHandleApprovalHandler
5661
+ },
5662
+ {
5663
+ key: "run-triage-now",
5664
+ build: buildRunTriageNowFunctionDef,
5665
+ createHandler: createRunTriageNowHandler
5666
+ },
5667
+ {
5668
+ key: "run-triage-batch",
5669
+ build: buildRunTriageBatchFunctionDef,
5670
+ createHandler: createRunTriageBatchHandler
5671
+ },
5672
+ {
5673
+ key: "preview-triage",
5674
+ build: buildPreviewTriageFunctionDef,
5675
+ createHandler: createPreviewTriageHandler
5676
+ },
5677
+ {
5678
+ key: "graph-dry-run",
5679
+ build: buildGraphDryRunFunctionDef,
5680
+ createHandler: createGraphDryRunHandler
5681
+ },
5636
5682
  { key: "test-agents", build: buildTestAgentsFunctionDef, createHandler: createTestAgentsHandler },
5637
- { key: "suggest-prompt", build: buildSuggestPromptFunctionDef, createHandler: createSuggestPromptHandler },
5638
- { key: "run-diff-analysis", build: buildRunDiffAnalysisFunctionDef, createHandler: createRunDiffAnalysisHandler },
5639
- { key: "list-gorgias-views", build: buildListGorgiasViewsFunctionDef, createHandler: createListGorgiasViewsHandler },
5640
- { key: "create-agent", build: buildCreateAgentFunctionDef, createHandler: () => createCreateAgentHandler() },
5683
+ {
5684
+ key: "suggest-prompt",
5685
+ build: buildSuggestPromptFunctionDef,
5686
+ createHandler: createSuggestPromptHandler
5687
+ },
5688
+ {
5689
+ key: "run-diff-analysis",
5690
+ build: buildRunDiffAnalysisFunctionDef,
5691
+ createHandler: createRunDiffAnalysisHandler
5692
+ },
5693
+ {
5694
+ key: "list-gorgias-views",
5695
+ build: buildListGorgiasViewsFunctionDef,
5696
+ createHandler: createListGorgiasViewsHandler
5697
+ },
5698
+ {
5699
+ key: "create-agent",
5700
+ build: buildCreateAgentFunctionDef,
5701
+ createHandler: () => createCreateAgentHandler()
5702
+ },
5641
5703
  {
5642
5704
  key: "set-default-agent",
5643
5705
  build: buildSetDefaultAgentFunctionDef,
@@ -5653,15 +5715,27 @@ var FUNCTION_ASSEMBLY = [
5653
5715
  build: buildSyncAgentPromptSnapshotFunctionDef,
5654
5716
  createHandler: () => createSyncAgentPromptSnapshotHandler()
5655
5717
  },
5656
- { key: "ext-models", build: buildExtModelsFunctionDef, createHandler: () => createExtModelsHandler() },
5657
- { key: "ext-categories", build: buildExtCategoriesFunctionDef, createHandler: () => createExtCategoriesHandler() },
5718
+ {
5719
+ key: "ext-models",
5720
+ build: buildExtModelsFunctionDef,
5721
+ createHandler: () => createExtModelsHandler()
5722
+ },
5723
+ {
5724
+ key: "ext-categories",
5725
+ build: buildExtCategoriesFunctionDef,
5726
+ createHandler: () => createExtCategoriesHandler()
5727
+ },
5658
5728
  { key: "ext-chat", build: buildExtChatFunctionDef, createHandler: () => createExtChatHandler() },
5659
5729
  {
5660
5730
  key: "ext-fast-response-check",
5661
5731
  build: buildExtFastResponseCheckFunctionDef,
5662
5732
  createHandler: () => createExtFastResponseCheckHandler()
5663
5733
  },
5664
- { key: "ext-evaluation", build: buildExtEvaluationFunctionDef, createHandler: () => createExtEvaluationHandler() },
5734
+ {
5735
+ key: "ext-evaluation",
5736
+ build: buildExtEvaluationFunctionDef,
5737
+ createHandler: () => createExtEvaluationHandler()
5738
+ },
5665
5739
  {
5666
5740
  key: "ext-response-comparison",
5667
5741
  build: buildExtResponseComparisonFunctionDef,
@@ -5705,8 +5779,14 @@ var KIT_PAGES = [
5705
5779
  { key: "escalations-page", path: "escalations", title: "Escalades", icon: "alert-triangle" },
5706
5780
  { key: "corrections-page", path: "corrections", title: "Corrections", icon: "git-compare" },
5707
5781
  { key: "graph-canvas-page", path: "graph-canvas", title: "Graphe", icon: "workflow" },
5708
- { key: "shared-prompts-page", path: "shared-prompts", title: "Prompts partag\xE9s", icon: "library" },
5709
- { key: "test-page", path: "test", title: "Banc de test", icon: "flask-conical" }
5782
+ {
5783
+ key: "shared-prompts-page",
5784
+ path: "shared-prompts",
5785
+ title: "Prompts partag\xE9s",
5786
+ icon: "library"
5787
+ },
5788
+ { key: "test-page", path: "test", title: "Banc de test", icon: "flask-conical" },
5789
+ { key: "quality-page", path: "quality", title: "Qualit\xE9", icon: "flask-conical" }
5710
5790
  ];
5711
5791
  function buildPages(config) {
5712
5792
  return KIT_PAGES.map(({ key, path, title, icon }) => ({