@apotech-os/support-kit 8.4.0 → 10.1.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/README.md +43 -12
- package/dist/{chunk-D3QGGJAI.js → chunk-KEPXRZ7R.js} +879 -107
- package/dist/chunk-KEPXRZ7R.js.map +1 -0
- package/dist/index.cjs +1850 -204
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +260 -21
- package/dist/index.d.ts +260 -21
- package/dist/index.js +918 -93
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +466 -178
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +340 -531
- package/dist/ui/index.js.map +1 -1
- package/package.json +13 -13
- package/dist/chunk-D3QGGJAI.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -53,6 +53,20 @@ interface Conversation {
|
|
|
53
53
|
* match and divergence alone stays blind to it.
|
|
54
54
|
*/
|
|
55
55
|
lastAgentReplyAt: Date | null;
|
|
56
|
+
/**
|
|
57
|
+
* Channels Gorgias reports this ticket can be answered on (`reply_options`).
|
|
58
|
+
* Empty on a payload written before the capture existed — which reads as
|
|
59
|
+
* "no channel path", the safe side.
|
|
60
|
+
*/
|
|
61
|
+
answerableChannels: string[];
|
|
62
|
+
/**
|
|
63
|
+
* The customer's address on `sourceChannel` (`customer.channels[]`): an
|
|
64
|
+
* Instagram or Facebook id, never an email — that one lives in
|
|
65
|
+
* `customer.email`, because the email path has always had it.
|
|
66
|
+
*/
|
|
67
|
+
customerChannelAddress: string | null;
|
|
68
|
+
/** Our own address on `sourceChannel`, read off the inbound message's `source.to`. */
|
|
69
|
+
accountChannelAddress: string | null;
|
|
56
70
|
/**
|
|
57
71
|
* True when a CUSTOMER message carries an attachment. Agent messages and
|
|
58
72
|
* internal notes do not count — an agent attaching a document must not hold
|
|
@@ -177,6 +191,52 @@ type WhatsappMode = (typeof WHATSAPP_MODES)[number];
|
|
|
177
191
|
* the string literal.
|
|
178
192
|
*/
|
|
179
193
|
declare const DEFAULT_WHATSAPP_MODE: WhatsappMode;
|
|
194
|
+
/**
|
|
195
|
+
* The Gorgias channels a ticket can arrive on, as `Conversation.sourceChannel`
|
|
196
|
+
* reports them (`isWhatsappTicket(raw) ? 'whatsapp' : raw.channel`).
|
|
197
|
+
*
|
|
198
|
+
* Exists so an operator can say WHERE auto-send applies instead of
|
|
199
|
+
* discovering the answer in a hold — `act` used to decide publication with a
|
|
200
|
+
* binary (WhatsApp, or else email) in a world that has more than two
|
|
201
|
+
* channels.
|
|
202
|
+
*
|
|
203
|
+
* Census of a live Gorgias account, 28/09/2026, 3 000 most recent tickets
|
|
204
|
+
* (count / of which carry an email address):
|
|
205
|
+
* instagram-comment 1858/0 · email 643/643 · instagram-direct-message
|
|
206
|
+
* 202/0 · whatsapp 141/133 · phone 113/86 · chat 19/19 ·
|
|
207
|
+
* instagram-mention 13/0 · facebook 7/0 · facebook-messenger 2/0 ·
|
|
208
|
+
* instagram-ad-comment 1/0 · internal-note 1/1.
|
|
209
|
+
*
|
|
210
|
+
* Listed in that order, so the Réglages checkboxes read in the order an
|
|
211
|
+
* operator meets them. `sms` and `contact-form` are Gorgias channels this
|
|
212
|
+
* account has never seen; they are kept because an allowlist that omits a
|
|
213
|
+
* channel turns it into a silent non-send — the very failure the census was
|
|
214
|
+
* run to avoid, after a first draft of this list missed `instagram-comment`
|
|
215
|
+
* (41 % of the account's volume).
|
|
216
|
+
*
|
|
217
|
+
* A channel this list does not name is deliberately NOT restricted — see
|
|
218
|
+
* `isAutoSendChannel` in `verdict/policy.ts`. The list can only take away
|
|
219
|
+
* what an operator can see and give back.
|
|
220
|
+
*/
|
|
221
|
+
declare const SUPPORT_CHANNELS: readonly ["email", "whatsapp", "phone", "chat", "sms", "contact-form", "instagram-direct-message", "instagram-comment", "instagram-mention", "instagram-ad-comment", "facebook", "facebook-messenger"];
|
|
222
|
+
type SupportChannel = (typeof SUPPORT_CHANNELS)[number];
|
|
223
|
+
/**
|
|
224
|
+
* Exactly the channels that were auto-sending BEFORE this setting existed —
|
|
225
|
+
* every one that reaches a customer through the email path, plus WhatsApp.
|
|
226
|
+
*
|
|
227
|
+
* Two defaults were wrong before this one. `['email', 'whatsapp']` would
|
|
228
|
+
* have switched off `chat` (census: 19/19 carry an address) and `phone`
|
|
229
|
+
* (86/113), both auto-sending in production (tickets 597912560, 597887833).
|
|
230
|
+
* The whole catalogue would have been right while no social channel COULD
|
|
231
|
+
* publish — but `domain/publication.ts` now gives Instagram and Facebook a
|
|
232
|
+
* real path, so leaving them checked would start auto-replying there the day
|
|
233
|
+
* this deploys, on a payload shape nobody has validated against the live API
|
|
234
|
+
* (`replyOnChannel`'s own doc).
|
|
235
|
+
*
|
|
236
|
+
* So the social channels ship OFF. Turning one on is an operator's explicit
|
|
237
|
+
* act, after a test ticket has proved the send works.
|
|
238
|
+
*/
|
|
239
|
+
declare const DEFAULT_AUTO_SEND_CHANNELS: SupportChannel[];
|
|
180
240
|
/**
|
|
181
241
|
* Iso-behaviour mapping (§9.1) from the old boolean to the new mode:
|
|
182
242
|
* `true → escalate_only`, `false → draft_only`. `auto_reply` is never
|
|
@@ -329,6 +389,8 @@ interface AgentProfile {
|
|
|
329
389
|
senderEmail: string | null;
|
|
330
390
|
minConfidence: number;
|
|
331
391
|
requireHighTriage: boolean;
|
|
392
|
+
/** Where auto-send applies (`SUPPORT_CHANNELS`). An allowlist: a channel absent from it never sends. */
|
|
393
|
+
channels: string[];
|
|
332
394
|
};
|
|
333
395
|
rename: {
|
|
334
396
|
enabled: boolean;
|
|
@@ -391,6 +453,19 @@ type OutboundReply = {
|
|
|
391
453
|
bodyText: string;
|
|
392
454
|
/** Forwarded to channels that support it, as defence in depth only — see guarantee below. */
|
|
393
455
|
idempotencyKey: string;
|
|
456
|
+
} | {
|
|
457
|
+
/** A reply on the ticket's OWN channel — Instagram DM, Facebook Messenger. */
|
|
458
|
+
mode: 'channel';
|
|
459
|
+
channel: string;
|
|
460
|
+
bodyText: string;
|
|
461
|
+
bodyHtml: string;
|
|
462
|
+
/** The customer's address on that channel, not an email (`domain/publication.ts`). */
|
|
463
|
+
toAddress: string;
|
|
464
|
+
/** The brand's own address on that channel. */
|
|
465
|
+
fromAddress: string;
|
|
466
|
+
receiverName: string | null;
|
|
467
|
+
/** Forwarded to channels that support it, as defence in depth only — see guarantee below. */
|
|
468
|
+
idempotencyKey: string;
|
|
394
469
|
};
|
|
395
470
|
interface ReplyPort {
|
|
396
471
|
/**
|
|
@@ -481,6 +556,13 @@ interface CompletionRequest {
|
|
|
481
556
|
label?: string;
|
|
482
557
|
resolve?: boolean;
|
|
483
558
|
};
|
|
559
|
+
/**
|
|
560
|
+
* The `vars` the node handed `PromptPort.resolve` for this prompt,
|
|
561
|
+
* forwarded to `ctx.api.llm.complete` so the platform records them on the
|
|
562
|
+
* generation (spec MCP §5.4.3: `explain_ticket` shows them). Absent when
|
|
563
|
+
* the prompt was resolved without variables.
|
|
564
|
+
*/
|
|
565
|
+
promptVariables?: Record<string, string>;
|
|
484
566
|
/** Forwarded verbatim to `ctx.api.llm.complete` v2's `trace` (S2). */
|
|
485
567
|
trace?: {
|
|
486
568
|
sessionId?: string;
|
|
@@ -786,6 +868,48 @@ interface Verdict {
|
|
|
786
868
|
observationId?: string | null;
|
|
787
869
|
}
|
|
788
870
|
|
|
871
|
+
/**
|
|
872
|
+
* HOW a reply can be published on a conversation — the one question `act`
|
|
873
|
+
* used to answer with a binary (WhatsApp, or else email).
|
|
874
|
+
*
|
|
875
|
+
* That binary sent every Instagram and Facebook thread down the email
|
|
876
|
+
* branch, where the contact has no address, and killed it there
|
|
877
|
+
* (`customer_email_missing`, tickets 597737746/597892224). The mistake was
|
|
878
|
+
* not the missing address: it was treating "an email address" as the
|
|
879
|
+
* universal recipient. A Gorgias ticket says otherwise — it carries
|
|
880
|
+
* `reply_options`, naming the channels it can be answered on, and the
|
|
881
|
+
* customer carries one address PER channel (an Instagram id, a Facebook id,
|
|
882
|
+
* an email).
|
|
883
|
+
*
|
|
884
|
+
* So the address requirement belongs to the EMAIL path alone, and every
|
|
885
|
+
* other channel is publishable exactly when Gorgias says it is and both
|
|
886
|
+
* endpoints of the conversation are known.
|
|
887
|
+
*/
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* - `whatsapp_note` — the chevron-prefixed internal note the WhatsApp bridge
|
|
891
|
+
* forwards; needs no recipient address of any kind.
|
|
892
|
+
* - `email` — an outbound email; needs the customer's email address.
|
|
893
|
+
* - `channel` — a reply posted on the ticket's own channel (Instagram DM,
|
|
894
|
+
* Facebook Messenger…), addressed by the two channel ids.
|
|
895
|
+
*/
|
|
896
|
+
type PublicationMode = 'whatsapp_note' | 'email' | 'channel';
|
|
897
|
+
/**
|
|
898
|
+
* The mode a reply would go out on, or `null` when this conversation cannot
|
|
899
|
+
* be answered automatically at all.
|
|
900
|
+
*
|
|
901
|
+
* Order matters and is deliberately conservative:
|
|
902
|
+
* 1. WhatsApp keeps its note path, unchanged.
|
|
903
|
+
* 2. A customer WITH an email address keeps the email path, unchanged —
|
|
904
|
+
* that is how `chat` and `phone` tickets have been auto-answering all
|
|
905
|
+
* along (census 28/09/2026: chat 19/19 and phone 86/113 carry one), and
|
|
906
|
+
* this is not the change to start rerouting them.
|
|
907
|
+
* 3. Only then, a channel Gorgias declares answerable and whose two
|
|
908
|
+
* endpoints are known. This is the new path, and the only one it opens
|
|
909
|
+
* is for contacts that had no address at all.
|
|
910
|
+
*/
|
|
911
|
+
declare function publicationMode(conversation: Conversation | null): PublicationMode | null;
|
|
912
|
+
|
|
789
913
|
/**
|
|
790
914
|
* `origin` — which pass of the pipeline produced a `triage-decision` /
|
|
791
915
|
* `generated-response` row (spec-gorgias-followup-webhook-v1 §7.2).
|
|
@@ -849,6 +973,8 @@ declare const OUTCOMES: readonly ["sent", "ready", "needs_human", "guardrail_hol
|
|
|
849
973
|
type Outcome = (typeof OUTCOMES)[number] | null;
|
|
850
974
|
/** `outcome` reaches the UI as untrusted JSONB — parse at that boundary. */
|
|
851
975
|
declare function isOutcome(value: unknown): value is NonNullable<Outcome>;
|
|
976
|
+
/** Why a run that could otherwise have sent did not. `null` when the question never arose. */
|
|
977
|
+
type IneligibleReason = 'no_publication_path' | null;
|
|
852
978
|
interface TicketRunState {
|
|
853
979
|
conversation: Conversation | null;
|
|
854
980
|
classification: Classification | null;
|
|
@@ -857,6 +983,15 @@ interface TicketRunState {
|
|
|
857
983
|
verdict: Verdict | null;
|
|
858
984
|
reviseCount: 0 | 1;
|
|
859
985
|
guardrailHits: string[];
|
|
986
|
+
/**
|
|
987
|
+
* Why auto-send was inapplicable, when the run knew a FACT the stored
|
|
988
|
+
* settings cannot express (28/09/2026). Today's only value: nothing could
|
|
989
|
+
* have published a reply on this conversation — Gorgias did not declare
|
|
990
|
+
* the channel answerable, or an email-mode contact had no address. The
|
|
991
|
+
* ticket timeline reads it rather than re-deriving it, because nothing it
|
|
992
|
+
* can see says what a customer's addresses were six weeks ago.
|
|
993
|
+
*/
|
|
994
|
+
ineligibleReason: IneligibleReason;
|
|
860
995
|
proposedActions: ProposedAction[];
|
|
861
996
|
outcome: Outcome;
|
|
862
997
|
}
|
|
@@ -1097,6 +1232,24 @@ declare const STOP_PHRASES: ReadonlySet<string>;
|
|
|
1097
1232
|
*/
|
|
1098
1233
|
declare const AGENT_GUARDRAILS: readonly ["whatsapp", "whatsapp_stop", "not_customer_turn", "judgeme", "noreply_sender", "triage_not_high", "escalated", "blocklist", "attachment", "short_answer", "uncertainty_marker", "evaluation_missing"];
|
|
1099
1234
|
type GuardrailId = (typeof AGENT_GUARDRAILS)[number];
|
|
1235
|
+
/**
|
|
1236
|
+
* The OTHER half of the catalogue: `act`'s send-time anti-collision checks
|
|
1237
|
+
* (I8), which land in the same `guardrailHits` as the list above but are
|
|
1238
|
+
* NEVER profile-configurable — hence a separate constant rather than more
|
|
1239
|
+
* entries in `AGENT_GUARDRAILS`, whose whole contract is "what a tenant can
|
|
1240
|
+
* toggle" (see that list's own doc, which draws this line explicitly).
|
|
1241
|
+
*
|
|
1242
|
+
* Declared here anyway, and not left as bare literals in `act.ts`, because
|
|
1243
|
+
* two readers need the names: `ui/tickets/guardrail-labels.ts` (a hit with
|
|
1244
|
+
* no label renders as a raw identifier to an operator) and
|
|
1245
|
+
* `ui/test/verdict-summary.ts` (which splits collision hits from content
|
|
1246
|
+
* hits). Both used to carry their own copy; a sixth check added to `act`
|
|
1247
|
+
* silently missed them.
|
|
1248
|
+
*
|
|
1249
|
+
* Order matches `act`'s own evaluation order, which I8 freezes.
|
|
1250
|
+
*/
|
|
1251
|
+
declare const COLLISION_GUARDRAILS: readonly ["customer_email_missing", "ticket_closed", "agent_replied", "diverged", "run_deadline"];
|
|
1252
|
+
type CollisionGuardrailId = (typeof COLLISION_GUARDRAILS)[number];
|
|
1100
1253
|
|
|
1101
1254
|
/**
|
|
1102
1255
|
* Superset-compatible with `@wopilo/gorgias-client`'s `RawGorgiasTicketPayload`
|
|
@@ -1126,20 +1279,58 @@ interface RawTicketMessage {
|
|
|
1126
1279
|
stripped_html?: string | null;
|
|
1127
1280
|
attachments?: unknown[];
|
|
1128
1281
|
created_datetime?: string | null;
|
|
1129
|
-
/**
|
|
1282
|
+
/**
|
|
1283
|
+
* `type` feeds `isInternalNoteChannel` (B2). `to` is read for one thing
|
|
1284
|
+
* only: OUR address on a social channel, which appears nowhere else in the
|
|
1285
|
+
* payload — the inbound message is addressed to the brand's own channel id
|
|
1286
|
+
* (`domain/publication.ts`).
|
|
1287
|
+
*/
|
|
1130
1288
|
source?: {
|
|
1131
1289
|
type?: string;
|
|
1290
|
+
to?: Array<{
|
|
1291
|
+
address?: string | null;
|
|
1292
|
+
}> | null;
|
|
1132
1293
|
} | null;
|
|
1133
1294
|
}
|
|
1295
|
+
/** One of `customer.channels[]` — the customer's address on a given channel. */
|
|
1296
|
+
interface RawTicketCustomerChannel {
|
|
1297
|
+
type?: string | null;
|
|
1298
|
+
address?: string | null;
|
|
1299
|
+
preferred?: boolean;
|
|
1300
|
+
}
|
|
1134
1301
|
interface RawTicket {
|
|
1135
1302
|
channel?: string | null;
|
|
1136
1303
|
subject?: string | null;
|
|
1137
1304
|
status?: string | null;
|
|
1138
1305
|
customer?: {
|
|
1139
1306
|
email?: string | null;
|
|
1307
|
+
channels?: RawTicketCustomerChannel[] | null;
|
|
1140
1308
|
} | null;
|
|
1309
|
+
/**
|
|
1310
|
+
* Gorgias' own answer to "where can this ticket be replied to", keyed by
|
|
1311
|
+
* channel. Authoritative and per-ticket, which is why nothing here guesses
|
|
1312
|
+
* it from the channel name (`domain/publication.ts`).
|
|
1313
|
+
*/
|
|
1314
|
+
reply_options?: Record<string, {
|
|
1315
|
+
answerable?: boolean;
|
|
1316
|
+
} | null> | null;
|
|
1141
1317
|
messages?: RawTicketMessage[];
|
|
1142
1318
|
}
|
|
1319
|
+
/** Channels `reply_options` marks answerable. Empty when the payload has no such key. */
|
|
1320
|
+
declare function answerableChannels(raw: RawTicket | null | undefined): string[];
|
|
1321
|
+
/**
|
|
1322
|
+
* The customer's address on `channel`, preferring the entry Gorgias marks
|
|
1323
|
+
* `preferred` — a contact can carry several (an Instagram DM id AND an
|
|
1324
|
+
* Instagram handle, on the same ticket).
|
|
1325
|
+
*/
|
|
1326
|
+
declare function customerChannelAddress(raw: RawTicket | null | undefined, channel: string | null): string | null;
|
|
1327
|
+
/**
|
|
1328
|
+
* Our own address on `channel`: the destination of the customer's own
|
|
1329
|
+
* message. Read off the FIRST inbound message on that channel — the brand's
|
|
1330
|
+
* channel id does not change mid-thread, and a later agent message would
|
|
1331
|
+
* have it as the sender instead.
|
|
1332
|
+
*/
|
|
1333
|
+
declare function accountChannelAddress(raw: RawTicket | null | undefined, channel: string | null): string | null;
|
|
1143
1334
|
declare const WHATSAPP_NOTE_CHEVRON = ">";
|
|
1144
1335
|
/**
|
|
1145
1336
|
* True for a `from_agent` internal note whose body starts with the
|
|
@@ -1221,6 +1412,46 @@ declare function runGuardrails(input: RunGuardrailsInput): string[];
|
|
|
1221
1412
|
*/
|
|
1222
1413
|
declare function guardrailBucket(hit: string): string;
|
|
1223
1414
|
|
|
1415
|
+
interface ReconstructHoldInput {
|
|
1416
|
+
/** The conversation as the run saw it when it drafted — rebuilt from the record's own `tracedInput` and generation-time snapshot. */
|
|
1417
|
+
generatedFrom: Conversation;
|
|
1418
|
+
/** The conversation as `act` would have re-read it, rebuilt from the Gorgias ticket truncated at the instant the run ended. */
|
|
1419
|
+
atSend: Conversation;
|
|
1420
|
+
/** The triage-decision this response was written under. */
|
|
1421
|
+
classification: Classification | null;
|
|
1422
|
+
/** The text the run drafted — `generated-response.responseText`. */
|
|
1423
|
+
draftText: string;
|
|
1424
|
+
/** Today's settings, as a profile. The approximation this module's own doc warns about. */
|
|
1425
|
+
profile: Pick<AgentProfile, 'guardrails' | 'autoSend'>;
|
|
1426
|
+
/** When the run ended, for `act`'s agent-reply window. `null` falls back to generation time. */
|
|
1427
|
+
queuedAt: Date | null;
|
|
1428
|
+
}
|
|
1429
|
+
/**
|
|
1430
|
+
* The hits the run would have recorded, in the order it would have recorded
|
|
1431
|
+
* them. Empty means "cannot be explained from what survives" — an honest
|
|
1432
|
+
* result the caller must report as unknown, not as "no guardrail fired".
|
|
1433
|
+
*/
|
|
1434
|
+
declare function reconstructGuardrailHits(input: ReconstructHoldInput): string[];
|
|
1435
|
+
/** The three moving facts `act`'s re-read would have seen, as of one instant. */
|
|
1436
|
+
interface RawTicketFactsAt {
|
|
1437
|
+
messageCount: number;
|
|
1438
|
+
lastMessageAt: Date | null;
|
|
1439
|
+
lastAgentReplyAt: Date | null;
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* What a Gorgias ticket looked like at `instant` — the only way to ask what
|
|
1443
|
+
* `act`'s fresh re-read saw, months later, from a payload that has kept
|
|
1444
|
+
* growing since.
|
|
1445
|
+
*
|
|
1446
|
+
* Messages are dropped by `created_datetime`, then the ticket is handed to
|
|
1447
|
+
* the SAME counting and agent-reply rules the live mapping uses
|
|
1448
|
+
* (`adapters/conversation-mapping.ts`), so a reconstruction cannot disagree
|
|
1449
|
+
* with production about what counts as a message. A message with no
|
|
1450
|
+
* timestamp at all is kept: it predates nothing we can prove, and keeping it
|
|
1451
|
+
* errs toward finding a hold rather than inventing a clean run.
|
|
1452
|
+
*/
|
|
1453
|
+
declare function rawTicketFactsAt(raw: RawTicket, instant: Date): RawTicketFactsAt;
|
|
1454
|
+
|
|
1224
1455
|
/**
|
|
1225
1456
|
* A judged candidate reply, as produced by the evaluation agent (agent 4).
|
|
1226
1457
|
* @deprecated Legacy `verifyReply` vocabulary — see this module's header
|
|
@@ -1448,12 +1679,23 @@ declare function isSendable(verdict: Verdict | null, profile: AgentProfile): boo
|
|
|
1448
1679
|
* from `guardrail_hold`+tag to `ready`+no tag — losing the tag is a bigger
|
|
1449
1680
|
* behaviour change than the one this predicate closes.
|
|
1450
1681
|
*
|
|
1451
|
-
* Whatsapp spec §4.4: `autoSend.senderEmail` is
|
|
1452
|
-
*
|
|
1453
|
-
*
|
|
1454
|
-
*
|
|
1455
|
-
*
|
|
1456
|
-
*
|
|
1682
|
+
* Whatsapp spec §4.4: `autoSend.senderEmail` is the address an email goes
|
|
1683
|
+
* out FROM, so the EMAIL path is the only one that needs it — asked of
|
|
1684
|
+
* `publicationMode` rather than re-derived from the channel here, so the
|
|
1685
|
+
* requirement follows the one decision that names the path.
|
|
1686
|
+
*
|
|
1687
|
+
* That answer also covers the conversation no path can reach at all
|
|
1688
|
+
* (`publicationMode` → `null`), which deliberately does NOT need a sender:
|
|
1689
|
+
* failing eligibility on it here would skip the `guardrails` node entirely,
|
|
1690
|
+
* and `hasPublicationPath` below exists precisely so that question is asked
|
|
1691
|
+
* after they have had their say.
|
|
1692
|
+
*
|
|
1693
|
+
* Reading the mode replaces an exemption scoped to `whatsappMode ===
|
|
1694
|
+
* 'auto_reply'`, which kept a sender-less tenant's `escalate_only` WhatsApp
|
|
1695
|
+
* tickets OUT of the guardrails — they ended `ready` with no tag, where the
|
|
1696
|
+
* `whatsapp` guardrail would have held them for a human. That hit is the
|
|
1697
|
+
* audit trail §5.1 asks for; a missing email address was never a reason to
|
|
1698
|
+
* lose it.
|
|
1457
1699
|
*/
|
|
1458
1700
|
declare function isAutoSendEligible(state: TicketRunState, deps: Pick<NodeDeps, 'profile' | 'category'>): boolean;
|
|
1459
1701
|
/**
|
|
@@ -1897,7 +2139,7 @@ declare const SUPPORT_KIT_SETTINGS_FIELDS: SettingsField[];
|
|
|
1897
2139
|
* French translation is now a COMPILE ERROR in that map, not a silent
|
|
1898
2140
|
* English leak an operator discovers on a live settings page.
|
|
1899
2141
|
*/
|
|
1900
|
-
type SettingsIssueKey = 'sourceViewId' | 'nodes' | 'nodePrompt' | 'senderEmail';
|
|
2142
|
+
type SettingsIssueKey = 'sourceViewId' | 'appScopeTag' | 'nodes' | 'nodePrompt' | 'senderEmail';
|
|
1901
2143
|
interface SettingsValidationIssue {
|
|
1902
2144
|
/** The offending settings key. */
|
|
1903
2145
|
key: SettingsIssueKey;
|
|
@@ -1905,8 +2147,8 @@ interface SettingsValidationIssue {
|
|
|
1905
2147
|
message: string;
|
|
1906
2148
|
}
|
|
1907
2149
|
/**
|
|
1908
|
-
* The two cross-field rules the spec names,
|
|
1909
|
-
* schema can express: `nodes.triage` must be configured. `nodes` has no
|
|
2150
|
+
* The two cross-field rules the spec names, the app's own ticket tag, plus
|
|
2151
|
+
* the one shape rule no schema can express: `nodes.triage` must be configured. `nodes` has no
|
|
1910
2152
|
* default (a defaulted "every step null" would install a pipeline that
|
|
1911
2153
|
* triages nothing), and `AgentProfile.nodes.triage` is non-nullable — this
|
|
1912
2154
|
* check is what makes both safe. Per-field typing (e.g. `batchLimit` being a
|
|
@@ -1927,7 +2169,7 @@ declare function validateSettings(settings: Record<string, unknown>): SettingsVa
|
|
|
1927
2169
|
* written in French straight away — unlike `validateSettings`' own, they are
|
|
1928
2170
|
* never logged, never returned by a handler, and so need no translation layer.
|
|
1929
2171
|
*/
|
|
1930
|
-
type SettingsWarningKey = 'appScopeTagVetoesFollowups' | 'appScopeTagCollision' | '
|
|
2172
|
+
type SettingsWarningKey = 'appScopeTagVetoesFollowups' | 'appScopeTagCollision' | 'noAutoSendChannels';
|
|
1931
2173
|
interface SettingsWarning {
|
|
1932
2174
|
key: SettingsWarningKey;
|
|
1933
2175
|
/** Operator-facing French, safe to show as-is. */
|
|
@@ -1952,16 +2194,13 @@ declare function settingsWarnings(settings: Record<string, unknown>): SettingsWa
|
|
|
1952
2194
|
* - `responseTtlMinutes` → `schedule.fastResponseTtlMinutes`, `batchLimit`
|
|
1953
2195
|
* → `schedule.triageBatchLimit`.
|
|
1954
2196
|
*
|
|
1955
|
-
*
|
|
2197
|
+
* Two settings have no profile counterpart on purpose:
|
|
1956
2198
|
* `dryRun` (read by the HANDLERS — `functions/triage-tick.ts` and
|
|
1957
2199
|
* `functions/process-response.ts` swap the `reply`/`state` ports for the
|
|
1958
2200
|
* recorders of `adapters/recording-ports.ts` and force `send: {mode:
|
|
1959
2201
|
* 'none'}` — not by the graph, which must run identically either way),
|
|
1960
|
-
* `statsTimezone` (a §3.8 rendering concern)
|
|
1961
|
-
*
|
|
1962
|
-
* account this app may answer a follow-up on is a routing decision, read by
|
|
1963
|
-
* the webhook's own gates, never by a node). `to-profile.spec.ts` pins that
|
|
1964
|
-
* list, so a new settings field cannot be forgotten here.
|
|
2202
|
+
* and `statsTimezone` (a §3.8 rendering concern). `to-profile.spec.ts` pins
|
|
2203
|
+
* that list, so a new settings field cannot be forgotten here.
|
|
1965
2204
|
*
|
|
1966
2205
|
* `prompts` is a PARAMETER, not derived here: `prompts.draft` is the agent
|
|
1967
2206
|
* record's own Langfuse binding (§3.4), which a settings blob cannot know.
|
|
@@ -2042,12 +2281,12 @@ interface SupportKitSettings {
|
|
|
2042
2281
|
autoRepliedTag: string;
|
|
2043
2282
|
needsReviewTag: string;
|
|
2044
2283
|
followupTag: string;
|
|
2045
|
-
/**
|
|
2046
|
-
webhookScopeTag: string;
|
|
2047
|
-
/** The tag this app stamps on every ticket its triage sees. Empty = stamps nothing (see `settings/fields.ts`). */
|
|
2284
|
+
/** The app's ticket tag: stamped by the triage, required by the follow-up webhook, served to the extension (see `settings/fields.ts`). */
|
|
2048
2285
|
appScopeTag: string;
|
|
2049
2286
|
autoSendEnabled: boolean;
|
|
2050
2287
|
senderEmail: string;
|
|
2288
|
+
/** Optional: apps deployed before the field existed have no value stored. */
|
|
2289
|
+
autoSendChannels?: string[];
|
|
2051
2290
|
requireHighTriageConfidence: boolean;
|
|
2052
2291
|
whatsappMode: WhatsappMode;
|
|
2053
2292
|
responseTtlMinutes: number;
|
|
@@ -2207,4 +2446,4 @@ interface SupportPipelineFragments {
|
|
|
2207
2446
|
}
|
|
2208
2447
|
declare function buildSupportPipeline(config: SupportPipelineConfig): SupportPipelineFragments;
|
|
2209
2448
|
|
|
2210
|
-
export { AGENT_GUARDRAILS, AGENT_STATUSES, AGENT_TOOLS, ATTACHMENT_MARKER_ONLY, type ActionDecision, type AgentProfile, type AgentStatus, type AuditTags, type AutoReplyGuardSettings, type Budget, CANDIDATE_MIN_LENGTH, type CatalogueTool, type CategoryPolicy, type CategoryReferentialEntry, type ChannelKind, type ChatMessage, type Classification, type ClockPort, type CompletionRequest, type CompletionResult, type Conversation, type ConversationPort, type ConversationRef, type CostLedger, type CustomerInfo, DECISION_ORIGINS, DEFAULT_CHANNEL_PROMPT_EMAIL, DEFAULT_CHANNEL_PROMPT_WHATSAPP, DEFAULT_DECISION_ORIGIN, DEFAULT_LLM_PROVIDER, DEFAULT_PROFILE_KEY, DEFAULT_WHATSAPP_MODE, type DecisionOrigin, type Draft, type DraftAttribution, type DraftNodeConfig, EVALUATION_VERDICTS, type EscalateNodeConfig, type EvaluateNodeConfig, type EvaluationVerdict, GENERATED_RESPONSE_STATUSES, type GeneratedResponseStatus, type GuardrailId, InvalidStatusTransitionError, type JsonSchema, type JudgedReply, type KnowledgeHit, type LlmPort, type Message, MissingPromptError, NODE_NAMES, type Node, type NodeCost, type NodeDeps, type NodeKey, type NodeName, type NodeStep, ORIGIN_DESCRIPTION, OUTCOMES, type OrderSummary, type OutboundReply, type Outcome, PROMPT_SLOTS, type PlatformPromptReader, type PortName, type PromptCacheEntry, type PromptCachePort, type PromptDegradedEvent, type PromptNameConfig, type PromptPort, type PromptRef, type PromptReference, type PromptResolverDeps, type PromptSlot, type PromptTableKey, type ProposedAction, REASONING_MAX_LEN, type RawPrompt, type RawPromptConfig, type RawTicket, type ReasoningEffort, type RecordDef, type ReplyPort, type ResolvedPrompt, type ResumeFrom, type ReviseNodeConfig, type RunGuardrailsInput, type RunStamp, type RunTicketOptions, type RunUntil, STOP_PHRASES, SUPPORT_KIT_SETTINGS_FIELDS, type SettingsIssueKey, type SettingsValidationIssue, type SettingsWarning, type SettingsWarningKey, type SimilarTicket, type SourceDescriptor, type StatePort, type SupportKitNodeSettings, type SupportKitSettings, type SupportPipelineConfig, type SupportPipelineFragments, type TicketRunState, type ToolCallRecord, type ToolCallRequest, type ToolContext, type ToolPolicy, type ToolSpec, type TrackingSummary, type TriageNodeConfig, UNCERTAINTY_MARKERS, type Usage, type Verdict, type VerifyReplyInput, type VerifyReplyResult, WHATSAPP_MODES, WHATSAPP_NOTE_CHEVRON, type WhatsappMode, agentRecord, assertTransition, buildCategoryRecord, buildDiffAnalysisRecord, buildEvaluationRecord, buildGeneratedResponseRecord, buildResponseComparisonRecord, buildSupportKitRecords, buildSupportPipeline, buildTriageDecisionRecord, canTransition, categoryGroupRecord, channelPreGates, createBudget, createPromptResolver, diffAnalysisUniqueKey, firstCustomerMessage, guardrailBucket, hasCustomerAttachment, hasReferences, initialState, isAutoSendEligible, isAutomatedSenderEmail, isAutomatedSenderTicket, isCustomerTurnWithWords, isDecisionOrigin, isEvaluationVerdict, isGeneratedResponseStatus, isJudgemeConversation, isJudgemeTicket, isOutcome, isSendable, isSendableVerdict, isTerminalStatus, isTicketClosed, isWhatsappChevronNote, isWhatsappTicket, lastCustomerMessage, needsRevision, openTicketKeyFor, parseReferences, pipelineStateRecord, promptCacheRecord, reclaimStalledSend, requiresFollowup, resolvePromptName, runGuardrails, runTicket, settingsToProfile, settingsWarnings, stopOptOut, targetRefFor, toDecisionOrigin, validateSettings, verifyReply, whatsappModeFromLegacyBoolean };
|
|
2449
|
+
export { AGENT_GUARDRAILS, AGENT_STATUSES, AGENT_TOOLS, ATTACHMENT_MARKER_ONLY, type ActionDecision, type AgentProfile, type AgentStatus, type AuditTags, type AutoReplyGuardSettings, type Budget, CANDIDATE_MIN_LENGTH, COLLISION_GUARDRAILS, type CatalogueTool, type CategoryPolicy, type CategoryReferentialEntry, type ChannelKind, type ChatMessage, type Classification, type ClockPort, type CollisionGuardrailId, type CompletionRequest, type CompletionResult, type Conversation, type ConversationPort, type ConversationRef, type CostLedger, type CustomerInfo, DECISION_ORIGINS, DEFAULT_AUTO_SEND_CHANNELS, DEFAULT_CHANNEL_PROMPT_EMAIL, DEFAULT_CHANNEL_PROMPT_WHATSAPP, DEFAULT_DECISION_ORIGIN, DEFAULT_LLM_PROVIDER, DEFAULT_PROFILE_KEY, DEFAULT_WHATSAPP_MODE, type DecisionOrigin, type Draft, type DraftAttribution, type DraftNodeConfig, EVALUATION_VERDICTS, type EscalateNodeConfig, type EvaluateNodeConfig, type EvaluationVerdict, GENERATED_RESPONSE_STATUSES, type GeneratedResponseStatus, type GuardrailId, type IneligibleReason, InvalidStatusTransitionError, type JsonSchema, type JudgedReply, type KnowledgeHit, type LlmPort, type Message, MissingPromptError, NODE_NAMES, type Node, type NodeCost, type NodeDeps, type NodeKey, type NodeName, type NodeStep, ORIGIN_DESCRIPTION, OUTCOMES, type OrderSummary, type OutboundReply, type Outcome, PROMPT_SLOTS, type PlatformPromptReader, type PortName, type PromptCacheEntry, type PromptCachePort, type PromptDegradedEvent, type PromptNameConfig, type PromptPort, type PromptRef, type PromptReference, type PromptResolverDeps, type PromptSlot, type PromptTableKey, type ProposedAction, type PublicationMode, REASONING_MAX_LEN, type RawPrompt, type RawPromptConfig, type RawTicket, type RawTicketFactsAt, type ReasoningEffort, type ReconstructHoldInput, type RecordDef, type ReplyPort, type ResolvedPrompt, type ResumeFrom, type ReviseNodeConfig, type RunGuardrailsInput, type RunStamp, type RunTicketOptions, type RunUntil, STOP_PHRASES, SUPPORT_CHANNELS, SUPPORT_KIT_SETTINGS_FIELDS, type SettingsIssueKey, type SettingsValidationIssue, type SettingsWarning, type SettingsWarningKey, type SimilarTicket, type SourceDescriptor, type StatePort, type SupportChannel, type SupportKitNodeSettings, type SupportKitSettings, type SupportPipelineConfig, type SupportPipelineFragments, type TicketRunState, type ToolCallRecord, type ToolCallRequest, type ToolContext, type ToolPolicy, type ToolSpec, type TrackingSummary, type TriageNodeConfig, UNCERTAINTY_MARKERS, type Usage, type Verdict, type VerifyReplyInput, type VerifyReplyResult, WHATSAPP_MODES, WHATSAPP_NOTE_CHEVRON, type WhatsappMode, accountChannelAddress, agentRecord, answerableChannels, assertTransition, buildCategoryRecord, buildDiffAnalysisRecord, buildEvaluationRecord, buildGeneratedResponseRecord, buildResponseComparisonRecord, buildSupportKitRecords, buildSupportPipeline, buildTriageDecisionRecord, canTransition, categoryGroupRecord, channelPreGates, createBudget, createPromptResolver, customerChannelAddress, diffAnalysisUniqueKey, firstCustomerMessage, guardrailBucket, hasCustomerAttachment, hasReferences, initialState, isAutoSendEligible, isAutomatedSenderEmail, isAutomatedSenderTicket, isCustomerTurnWithWords, isDecisionOrigin, isEvaluationVerdict, isGeneratedResponseStatus, isJudgemeConversation, isJudgemeTicket, isOutcome, isSendable, isSendableVerdict, isTerminalStatus, isTicketClosed, isWhatsappChevronNote, isWhatsappTicket, lastCustomerMessage, needsRevision, openTicketKeyFor, parseReferences, pipelineStateRecord, promptCacheRecord, publicationMode, rawTicketFactsAt, reclaimStalledSend, reconstructGuardrailHits, requiresFollowup, resolvePromptName, runGuardrails, runTicket, settingsToProfile, settingsWarnings, stopOptOut, targetRefFor, toDecisionOrigin, validateSettings, verifyReply, whatsappModeFromLegacyBoolean };
|