@apotech-os/support-kit 10.1.1 → 10.3.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.d.cts CHANGED
@@ -30,6 +30,12 @@ interface CustomerInfo {
30
30
  /** Rendered order/account context (may be absent — not every ticket has one). */
31
31
  orderContext: string | null;
32
32
  }
33
+ /** The first customer message still waiting for an answer (spec-delais-de-reponse-v1 D2). */
34
+ interface AwaitingSince {
35
+ at: Date;
36
+ /** Gorgias' message id; null when the payload carried none. */
37
+ messageId: string | null;
38
+ }
33
39
  interface Conversation {
34
40
  ref: ConversationRef;
35
41
  subject: string | null;
@@ -53,6 +59,13 @@ interface Conversation {
53
59
  * match and divergence alone stays blind to it.
54
60
  */
55
61
  lastAgentReplyAt: Date | null;
62
+ /**
63
+ * The first customer message still unanswered — where a `reply-timing`
64
+ * turn starts (spec-delais-de-reponse-v1 D2). Null when the agent has the
65
+ * last word. Optional so a consumer's own `Conversation` literal keeps
66
+ * compiling across the minor that added it (absent reads as "not known").
67
+ */
68
+ awaitingSince?: AwaitingSince | null;
56
69
  /**
57
70
  * Channels Gorgias reports this ticket can be answered on (`reply_options`).
58
71
  * Empty on a payload written before the capture existed — which reads as
@@ -110,13 +123,6 @@ interface Classification {
110
123
  reasoning: string;
111
124
  /** True when triage failed and this is the `unknown_tag` fallback decision (I1). */
112
125
  isFallback: boolean;
113
- /**
114
- * True when triage judged the LAST customer message closes the thread
115
- * (« merci », « ok parfait »…) — the graph then exits `no_reply_needed`
116
- * before `draft` ever runs (whatsapp spec §5.2). Optional: some existing
117
- * fixtures and older wire-decoded values omit it — absent means `false`.
118
- */
119
- conversationOver?: boolean;
120
126
  }
121
127
 
122
128
  type ActionDecision = 'auto' | 'needs_approval' | 'forbidden';
@@ -1262,6 +1268,10 @@ type CollisionGuardrailId = (typeof COLLISION_GUARDRAILS)[number];
1262
1268
  * apart again.
1263
1269
  */
1264
1270
  interface RawTicketMessage {
1271
+ /** Names the customer turn a `reply-timing` row measures (spec-delais-de-reponse-v1 §3). */
1272
+ id?: number | string | null;
1273
+ /** How Gorgias received the message: `api` (us), `helpdesk` (an agent), `rule` (an automation)… — spec-delais-de-reponse-v1 §4. */
1274
+ via?: string | null;
1265
1275
  channel?: string | null;
1266
1276
  from_agent?: boolean;
1267
1277
  body_text?: string | null;
@@ -1615,8 +1625,9 @@ declare function lastCustomerMessage(conversation: Conversation): string | null;
1615
1625
  * opening one).
1616
1626
  *
1617
1627
  * Split out from `channelPreGates` because the graph evaluates it EARLIER
1618
- * than its sibling: a STOP has to outrank the `no_reply_needed` exit, which
1619
- * applies no tag and would leave the opt-out no trace (T17/T18's concern).
1628
+ * than its sibling: a STOP has to outrank every quiet exit (and the
1629
+ * end-of-conversation step), which would leave the opt-out no trace
1630
+ * (T17/T18's concern).
1620
1631
  */
1621
1632
  declare function stopOptOut(conversation: Conversation): string[];
1622
1633
  /**
@@ -2044,6 +2055,27 @@ declare function buildEvaluationRecord(slug: string): ObjectDef;
2044
2055
  declare function diffAnalysisUniqueKey(agentId: string, promptName: string, promptVersion: number): string;
2045
2056
  declare function buildDiffAnalysisRecord(slug: string): ObjectDef;
2046
2057
 
2058
+ /**
2059
+ * `reply-timing` — spec-delais-de-reponse-v1 §3. One row per customer turn:
2060
+ * a ticket and its first unanswered customer message, from the moment the
2061
+ * pipeline sees it waiting until someone answers it.
2062
+ *
2063
+ * A row is OPEN while `repliedAt`/`responder` are null, which is why every
2064
+ * closing field is nullable — and why the open row is written with those
2065
+ * keys present as JSON null rather than absent: the platform's `ifMatch`
2066
+ * compares `data -> 'field'`, which only matches `null` on a key that exists.
2067
+ *
2068
+ * `turnKey` is unique: two passes over the same turn (a retried tick, a
2069
+ * webhook redelivered) land on one row, the database arbitrating the race.
2070
+ *
2071
+ * Its own record, not fields on `generated-response` (frozen since T20, D5):
2072
+ * a turn exists whether or not a draft was ever written — an escalation at
2073
+ * triage, a category with no draft opt-in — and those are exactly the
2074
+ * tickets whose human delay this measures.
2075
+ */
2076
+
2077
+ declare function buildReplyTimingRecord(slug: string): ObjectDef;
2078
+
2047
2079
  /**
2048
2080
  * `ObjectDef` plus the one manifest-level `records[]` property it doesn't
2049
2081
  * carry itself: `exposedToApps` (P2-10 bilateral consent, §3.4). Only
@@ -2086,7 +2118,8 @@ declare const promptCacheRecord: ObjectDef;
2086
2118
  declare function targetRefFor(slug: string, objectKey: string): string;
2087
2119
 
2088
2120
  /**
2089
- * All 10 records of §3.4, in the order the spec lists them, bound to the
2121
+ * All 11 records — §3.4's ten in the order that spec lists them, then
2122
+ * spec-delais-de-reponse-v1's `reply-timing` — bound to the
2090
2123
  * consuming app's `slug` — the single assembly point `buildSupportPipeline`
2091
2124
  * (T25) spreads into a manifest.
2092
2125
  *
@@ -2121,61 +2154,6 @@ declare function buildSupportKitRecords(slug: string): RecordDef[];
2121
2154
 
2122
2155
  declare const SUPPORT_KIT_SETTINGS_FIELDS: SettingsField[];
2123
2156
 
2124
- /**
2125
- * `validateSettings` — spec §3.6, single point of DRY validation shared by
2126
- * the SettingsPage and every handler.
2127
- *
2128
- * Returns a plain list of issues rather than throwing: a SettingsPage maps
2129
- * `issues` by `key` to show a per-field error, and a handler simply checks
2130
- * `issues.length > 0` to refuse a run — one shape, two callers, no
2131
- * try/catch-driven control flow on either side.
2132
- */
2133
- /**
2134
- * Every issue `validateSettings` can raise, by its own `key` — a closed
2135
- * union, not `string` (T27 rework, pass 2 of 2): `ui/shared/
2136
- * settings-issue-labels.ts`'s `SETTINGS_ISSUE_LABELS` is keyed on this same
2137
- * type, so a new issue this function starts raising without a matching
2138
- * French translation is now a COMPILE ERROR in that map, not a silent
2139
- * English leak an operator discovers on a live settings page.
2140
- */
2141
- type SettingsIssueKey = 'sourceViewId' | 'appScopeTag' | 'nodes' | 'nodePrompt' | 'senderEmail';
2142
- interface SettingsValidationIssue {
2143
- /** The offending settings key. */
2144
- key: SettingsIssueKey;
2145
- /** Human-readable reason, safe to show in the SettingsPage. */
2146
- message: string;
2147
- }
2148
- /**
2149
- * The two cross-field rules the spec names, the app's own ticket tag, plus
2150
- * the one shape rule no schema can express: `nodes.triage` must be configured. `nodes` has no
2151
- * default (a defaulted "every step null" would install a pipeline that
2152
- * triages nothing), and `AgentProfile.nodes.triage` is non-nullable — this
2153
- * check is what makes both safe. Per-field typing (e.g. `batchLimit` being a
2154
- * number) stays the settings API's job at write time, not this function's.
2155
- */
2156
- declare function validateSettings(settings: Record<string, unknown>): SettingsValidationIssue[];
2157
-
2158
- /**
2159
- * `settingsWarnings` — the settings problems that must NOT stop the app.
2160
- *
2161
- * Deliberately separate from `validateSettings`: nine handlers refuse to run
2162
- * as soon as that function reports a single issue, so routing a "this looks
2163
- * wrong" remark through it would take a working app off the air. Everything
2164
- * here describes a configuration that runs, and runs in a way its operator
2165
- * probably did not intend.
2166
- *
2167
- * Its only consumer is the SettingsPage, which is why these messages are
2168
- * written in French straight away — unlike `validateSettings`' own, they are
2169
- * never logged, never returned by a handler, and so need no translation layer.
2170
- */
2171
- type SettingsWarningKey = 'appScopeTagVetoesFollowups' | 'appScopeTagCollision' | 'noAutoSendChannels';
2172
- interface SettingsWarning {
2173
- key: SettingsWarningKey;
2174
- /** Operator-facing French, safe to show as-is. */
2175
- message: string;
2176
- }
2177
- declare function settingsWarnings(settings: Record<string, unknown>): SettingsWarning[];
2178
-
2179
2157
  /**
2180
2158
  * `settings` (§3.6) → `AgentProfile` (architecture_agent_graphe.md §5.3).
2181
2159
  *
@@ -2193,12 +2171,15 @@ declare function settingsWarnings(settings: Record<string, unknown>): SettingsWa
2193
2171
  * - `responseTtlMinutes` → `schedule.fastResponseTtlMinutes`, `batchLimit`
2194
2172
  * → `schedule.triageBatchLimit`.
2195
2173
  *
2196
- * Two settings have no profile counterpart on purpose:
2174
+ * Five settings have no profile counterpart on purpose:
2197
2175
  * `dryRun` (read by the HANDLERS — `functions/triage-tick.ts` and
2198
2176
  * `functions/process-response.ts` swap the `reply`/`state` ports for the
2199
2177
  * recorders of `adapters/recording-ports.ts` and force `send: {mode:
2200
2178
  * 'none'}` — not by the graph, which must run identically either way),
2201
- * and `statsTimezone` (a §3.8 rendering concern). `to-profile.spec.ts` pins
2179
+ * `statsTimezone` (a §3.8 rendering concern), and the three `conversationEnd*`
2180
+ * keys (read by `functions/triage-tick.ts` and the follow-up webhook, which run
2181
+ * the end-of-conversation judge and apply the end action themselves — D16; no
2182
+ * graph node sees them). `to-profile.spec.ts` pins
2202
2183
  * that list, so a new settings field cannot be forgotten here.
2203
2184
  *
2204
2185
  * `prompts` is a PARAMETER, not derived here: `prompts.draft` is the agent
@@ -2282,6 +2263,10 @@ interface SupportKitSettings {
2282
2263
  followupTag: string;
2283
2264
  /** The app's ticket tag: stamped by the triage, required by the follow-up webhook, served to the extension (see `settings/fields.ts`). */
2284
2265
  appScopeTag: string;
2266
+ /** spec-fin-de-conversation-v1 §5 — optional: apps deployed before 10.2.0 store none, read as `disabled`. */
2267
+ conversationEndAction?: ConversationEndAction;
2268
+ conversationEndTag?: string;
2269
+ conversationEndPrompt?: NodePromptSettings | null;
2285
2270
  autoSendEnabled: boolean;
2286
2271
  senderEmail: string;
2287
2272
  /** Optional: apps deployed before the field existed have no value stored. */
@@ -2301,6 +2286,85 @@ interface SupportKitSettings {
2301
2286
  }
2302
2287
  declare function settingsToProfile(settings: SupportKitSettings, prompts: Record<PromptTableKey, PromptRef>): AgentProfile;
2303
2288
 
2289
+ /**
2290
+ * The end-of-conversation settings (spec-fin-de-conversation-v1 §5), read
2291
+ * defensively: every field is optional because an app deployed before the
2292
+ * feature stores none of them, and that app must keep today's behaviour
2293
+ * exactly (D9) — absent reads as `disabled`.
2294
+ */
2295
+
2296
+ declare const CONVERSATION_END_ACTIONS: readonly ["disabled", "tag", "close"];
2297
+ type ConversationEndAction = (typeof CONVERSATION_END_ACTIONS)[number];
2298
+ declare const DEFAULT_CONVERSATION_END_TAG = "wai/conversation-ended";
2299
+ interface ConversationEndSettings {
2300
+ action: ConversationEndAction;
2301
+ /** Trimmed. Applied in `tag` mode only, but always read: D11 removes it whatever the mode. */
2302
+ tag: string;
2303
+ prompt: NodePromptSettings | null;
2304
+ }
2305
+ /** The end action of an app that has one — `null` stands for `disabled`. */
2306
+ interface ConversationEndConfig {
2307
+ action: 'tag' | 'close';
2308
+ tag: string;
2309
+ }
2310
+ declare function readConversationEnd(settings: SupportKitSettings | Record<string, unknown>): ConversationEndSettings;
2311
+ declare function toConversationEnd(settings: SupportKitSettings | Record<string, unknown>): ConversationEndConfig | null;
2312
+ /**
2313
+ * What a finished conversation does to the Gorgias ticket (D10): the tag, OR
2314
+ * the closure — never both. The webhook applies exactly this and the ticket
2315
+ * timeline names exactly this, so the two cannot drift apart.
2316
+ */
2317
+ declare function conversationEndEffects(end: ConversationEndConfig | null): {
2318
+ tags: string[];
2319
+ close: boolean;
2320
+ };
2321
+
2322
+ /**
2323
+ * Every issue `validateSettings` can raise, by its own `key` — a closed
2324
+ * union, not `string` (T27 rework, pass 2 of 2): `ui/shared/
2325
+ * settings-issue-labels.ts`'s `SETTINGS_ISSUE_LABELS` is keyed on this same
2326
+ * type, so a new issue this function starts raising without a matching
2327
+ * French translation is now a COMPILE ERROR in that map, not a silent
2328
+ * English leak an operator discovers on a live settings page.
2329
+ */
2330
+ type SettingsIssueKey = 'sourceViewId' | 'appScopeTag' | 'nodes' | 'nodePrompt' | 'senderEmail' | 'conversationEndTag' | 'conversationEndPrompt';
2331
+ interface SettingsValidationIssue {
2332
+ /** The offending settings key. */
2333
+ key: SettingsIssueKey;
2334
+ /** Human-readable reason, safe to show in the SettingsPage. */
2335
+ message: string;
2336
+ }
2337
+ /**
2338
+ * The two cross-field rules the spec names, the app's own ticket tag, plus
2339
+ * the one shape rule no schema can express: `nodes.triage` must be configured. `nodes` has no
2340
+ * default (a defaulted "every step null" would install a pipeline that
2341
+ * triages nothing), and `AgentProfile.nodes.triage` is non-nullable — this
2342
+ * check is what makes both safe. Per-field typing (e.g. `batchLimit` being a
2343
+ * number) stays the settings API's job at write time, not this function's.
2344
+ */
2345
+ declare function validateSettings(settings: Record<string, unknown>): SettingsValidationIssue[];
2346
+
2347
+ /**
2348
+ * `settingsWarnings` — the settings problems that must NOT stop the app.
2349
+ *
2350
+ * Deliberately separate from `validateSettings`: nine handlers refuse to run
2351
+ * as soon as that function reports a single issue, so routing a "this looks
2352
+ * wrong" remark through it would take a working app off the air. Everything
2353
+ * here describes a configuration that runs, and runs in a way its operator
2354
+ * probably did not intend.
2355
+ *
2356
+ * Its only consumer is the SettingsPage, which is why these messages are
2357
+ * written in French straight away — unlike `validateSettings`' own, they are
2358
+ * never logged, never returned by a handler, and so need no translation layer.
2359
+ */
2360
+ type SettingsWarningKey = 'appScopeTagVetoesFollowups' | 'appScopeTagCollision' | 'noAutoSendChannels';
2361
+ interface SettingsWarning {
2362
+ key: SettingsWarningKey;
2363
+ /** Operator-facing French, safe to show as-is. */
2364
+ message: string;
2365
+ }
2366
+ declare function settingsWarnings(settings: Record<string, unknown>): SettingsWarning[];
2367
+
2304
2368
  /**
2305
2369
  * `SupportKitFunctionConfig` — what each manifest fragment
2306
2370
  * (`triage-tick`/`sweep`/`handle-approval`/…) needs to build its
@@ -2445,4 +2509,4 @@ interface SupportPipelineFragments {
2445
2509
  }
2446
2510
  declare function buildSupportPipeline(config: SupportPipelineConfig): SupportPipelineFragments;
2447
2511
 
2448
- 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 };
2512
+ export { AGENT_GUARDRAILS, AGENT_STATUSES, AGENT_TOOLS, ATTACHMENT_MARKER_ONLY, type ActionDecision, type AgentProfile, type AgentStatus, type AuditTags, type AutoReplyGuardSettings, type AwaitingSince, type Budget, CANDIDATE_MIN_LENGTH, COLLISION_GUARDRAILS, CONVERSATION_END_ACTIONS, type CatalogueTool, type CategoryPolicy, type CategoryReferentialEntry, type ChannelKind, type ChatMessage, type Classification, type ClockPort, type CollisionGuardrailId, type CompletionRequest, type CompletionResult, type Conversation, type ConversationEndAction, type ConversationEndConfig, type ConversationEndSettings, type ConversationPort, type ConversationRef, type CostLedger, type CustomerInfo, DECISION_ORIGINS, DEFAULT_AUTO_SEND_CHANNELS, DEFAULT_CHANNEL_PROMPT_EMAIL, DEFAULT_CHANNEL_PROMPT_WHATSAPP, DEFAULT_CONVERSATION_END_TAG, 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, buildReplyTimingRecord, buildResponseComparisonRecord, buildSupportKitRecords, buildSupportPipeline, buildTriageDecisionRecord, canTransition, categoryGroupRecord, channelPreGates, conversationEndEffects, 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, readConversationEnd, reclaimStalledSend, reconstructGuardrailHits, requiresFollowup, resolvePromptName, runGuardrails, runTicket, settingsToProfile, settingsWarnings, stopOptOut, targetRefFor, toConversationEnd, toDecisionOrigin, validateSettings, verifyReply, whatsappModeFromLegacyBoolean };
package/dist/index.d.ts CHANGED
@@ -30,6 +30,12 @@ interface CustomerInfo {
30
30
  /** Rendered order/account context (may be absent — not every ticket has one). */
31
31
  orderContext: string | null;
32
32
  }
33
+ /** The first customer message still waiting for an answer (spec-delais-de-reponse-v1 D2). */
34
+ interface AwaitingSince {
35
+ at: Date;
36
+ /** Gorgias' message id; null when the payload carried none. */
37
+ messageId: string | null;
38
+ }
33
39
  interface Conversation {
34
40
  ref: ConversationRef;
35
41
  subject: string | null;
@@ -53,6 +59,13 @@ interface Conversation {
53
59
  * match and divergence alone stays blind to it.
54
60
  */
55
61
  lastAgentReplyAt: Date | null;
62
+ /**
63
+ * The first customer message still unanswered — where a `reply-timing`
64
+ * turn starts (spec-delais-de-reponse-v1 D2). Null when the agent has the
65
+ * last word. Optional so a consumer's own `Conversation` literal keeps
66
+ * compiling across the minor that added it (absent reads as "not known").
67
+ */
68
+ awaitingSince?: AwaitingSince | null;
56
69
  /**
57
70
  * Channels Gorgias reports this ticket can be answered on (`reply_options`).
58
71
  * Empty on a payload written before the capture existed — which reads as
@@ -110,13 +123,6 @@ interface Classification {
110
123
  reasoning: string;
111
124
  /** True when triage failed and this is the `unknown_tag` fallback decision (I1). */
112
125
  isFallback: boolean;
113
- /**
114
- * True when triage judged the LAST customer message closes the thread
115
- * (« merci », « ok parfait »…) — the graph then exits `no_reply_needed`
116
- * before `draft` ever runs (whatsapp spec §5.2). Optional: some existing
117
- * fixtures and older wire-decoded values omit it — absent means `false`.
118
- */
119
- conversationOver?: boolean;
120
126
  }
121
127
 
122
128
  type ActionDecision = 'auto' | 'needs_approval' | 'forbidden';
@@ -1262,6 +1268,10 @@ type CollisionGuardrailId = (typeof COLLISION_GUARDRAILS)[number];
1262
1268
  * apart again.
1263
1269
  */
1264
1270
  interface RawTicketMessage {
1271
+ /** Names the customer turn a `reply-timing` row measures (spec-delais-de-reponse-v1 §3). */
1272
+ id?: number | string | null;
1273
+ /** How Gorgias received the message: `api` (us), `helpdesk` (an agent), `rule` (an automation)… — spec-delais-de-reponse-v1 §4. */
1274
+ via?: string | null;
1265
1275
  channel?: string | null;
1266
1276
  from_agent?: boolean;
1267
1277
  body_text?: string | null;
@@ -1615,8 +1625,9 @@ declare function lastCustomerMessage(conversation: Conversation): string | null;
1615
1625
  * opening one).
1616
1626
  *
1617
1627
  * Split out from `channelPreGates` because the graph evaluates it EARLIER
1618
- * than its sibling: a STOP has to outrank the `no_reply_needed` exit, which
1619
- * applies no tag and would leave the opt-out no trace (T17/T18's concern).
1628
+ * than its sibling: a STOP has to outrank every quiet exit (and the
1629
+ * end-of-conversation step), which would leave the opt-out no trace
1630
+ * (T17/T18's concern).
1620
1631
  */
1621
1632
  declare function stopOptOut(conversation: Conversation): string[];
1622
1633
  /**
@@ -2044,6 +2055,27 @@ declare function buildEvaluationRecord(slug: string): ObjectDef;
2044
2055
  declare function diffAnalysisUniqueKey(agentId: string, promptName: string, promptVersion: number): string;
2045
2056
  declare function buildDiffAnalysisRecord(slug: string): ObjectDef;
2046
2057
 
2058
+ /**
2059
+ * `reply-timing` — spec-delais-de-reponse-v1 §3. One row per customer turn:
2060
+ * a ticket and its first unanswered customer message, from the moment the
2061
+ * pipeline sees it waiting until someone answers it.
2062
+ *
2063
+ * A row is OPEN while `repliedAt`/`responder` are null, which is why every
2064
+ * closing field is nullable — and why the open row is written with those
2065
+ * keys present as JSON null rather than absent: the platform's `ifMatch`
2066
+ * compares `data -> 'field'`, which only matches `null` on a key that exists.
2067
+ *
2068
+ * `turnKey` is unique: two passes over the same turn (a retried tick, a
2069
+ * webhook redelivered) land on one row, the database arbitrating the race.
2070
+ *
2071
+ * Its own record, not fields on `generated-response` (frozen since T20, D5):
2072
+ * a turn exists whether or not a draft was ever written — an escalation at
2073
+ * triage, a category with no draft opt-in — and those are exactly the
2074
+ * tickets whose human delay this measures.
2075
+ */
2076
+
2077
+ declare function buildReplyTimingRecord(slug: string): ObjectDef;
2078
+
2047
2079
  /**
2048
2080
  * `ObjectDef` plus the one manifest-level `records[]` property it doesn't
2049
2081
  * carry itself: `exposedToApps` (P2-10 bilateral consent, §3.4). Only
@@ -2086,7 +2118,8 @@ declare const promptCacheRecord: ObjectDef;
2086
2118
  declare function targetRefFor(slug: string, objectKey: string): string;
2087
2119
 
2088
2120
  /**
2089
- * All 10 records of §3.4, in the order the spec lists them, bound to the
2121
+ * All 11 records — §3.4's ten in the order that spec lists them, then
2122
+ * spec-delais-de-reponse-v1's `reply-timing` — bound to the
2090
2123
  * consuming app's `slug` — the single assembly point `buildSupportPipeline`
2091
2124
  * (T25) spreads into a manifest.
2092
2125
  *
@@ -2121,61 +2154,6 @@ declare function buildSupportKitRecords(slug: string): RecordDef[];
2121
2154
 
2122
2155
  declare const SUPPORT_KIT_SETTINGS_FIELDS: SettingsField[];
2123
2156
 
2124
- /**
2125
- * `validateSettings` — spec §3.6, single point of DRY validation shared by
2126
- * the SettingsPage and every handler.
2127
- *
2128
- * Returns a plain list of issues rather than throwing: a SettingsPage maps
2129
- * `issues` by `key` to show a per-field error, and a handler simply checks
2130
- * `issues.length > 0` to refuse a run — one shape, two callers, no
2131
- * try/catch-driven control flow on either side.
2132
- */
2133
- /**
2134
- * Every issue `validateSettings` can raise, by its own `key` — a closed
2135
- * union, not `string` (T27 rework, pass 2 of 2): `ui/shared/
2136
- * settings-issue-labels.ts`'s `SETTINGS_ISSUE_LABELS` is keyed on this same
2137
- * type, so a new issue this function starts raising without a matching
2138
- * French translation is now a COMPILE ERROR in that map, not a silent
2139
- * English leak an operator discovers on a live settings page.
2140
- */
2141
- type SettingsIssueKey = 'sourceViewId' | 'appScopeTag' | 'nodes' | 'nodePrompt' | 'senderEmail';
2142
- interface SettingsValidationIssue {
2143
- /** The offending settings key. */
2144
- key: SettingsIssueKey;
2145
- /** Human-readable reason, safe to show in the SettingsPage. */
2146
- message: string;
2147
- }
2148
- /**
2149
- * The two cross-field rules the spec names, the app's own ticket tag, plus
2150
- * the one shape rule no schema can express: `nodes.triage` must be configured. `nodes` has no
2151
- * default (a defaulted "every step null" would install a pipeline that
2152
- * triages nothing), and `AgentProfile.nodes.triage` is non-nullable — this
2153
- * check is what makes both safe. Per-field typing (e.g. `batchLimit` being a
2154
- * number) stays the settings API's job at write time, not this function's.
2155
- */
2156
- declare function validateSettings(settings: Record<string, unknown>): SettingsValidationIssue[];
2157
-
2158
- /**
2159
- * `settingsWarnings` — the settings problems that must NOT stop the app.
2160
- *
2161
- * Deliberately separate from `validateSettings`: nine handlers refuse to run
2162
- * as soon as that function reports a single issue, so routing a "this looks
2163
- * wrong" remark through it would take a working app off the air. Everything
2164
- * here describes a configuration that runs, and runs in a way its operator
2165
- * probably did not intend.
2166
- *
2167
- * Its only consumer is the SettingsPage, which is why these messages are
2168
- * written in French straight away — unlike `validateSettings`' own, they are
2169
- * never logged, never returned by a handler, and so need no translation layer.
2170
- */
2171
- type SettingsWarningKey = 'appScopeTagVetoesFollowups' | 'appScopeTagCollision' | 'noAutoSendChannels';
2172
- interface SettingsWarning {
2173
- key: SettingsWarningKey;
2174
- /** Operator-facing French, safe to show as-is. */
2175
- message: string;
2176
- }
2177
- declare function settingsWarnings(settings: Record<string, unknown>): SettingsWarning[];
2178
-
2179
2157
  /**
2180
2158
  * `settings` (§3.6) → `AgentProfile` (architecture_agent_graphe.md §5.3).
2181
2159
  *
@@ -2193,12 +2171,15 @@ declare function settingsWarnings(settings: Record<string, unknown>): SettingsWa
2193
2171
  * - `responseTtlMinutes` → `schedule.fastResponseTtlMinutes`, `batchLimit`
2194
2172
  * → `schedule.triageBatchLimit`.
2195
2173
  *
2196
- * Two settings have no profile counterpart on purpose:
2174
+ * Five settings have no profile counterpart on purpose:
2197
2175
  * `dryRun` (read by the HANDLERS — `functions/triage-tick.ts` and
2198
2176
  * `functions/process-response.ts` swap the `reply`/`state` ports for the
2199
2177
  * recorders of `adapters/recording-ports.ts` and force `send: {mode:
2200
2178
  * 'none'}` — not by the graph, which must run identically either way),
2201
- * and `statsTimezone` (a §3.8 rendering concern). `to-profile.spec.ts` pins
2179
+ * `statsTimezone` (a §3.8 rendering concern), and the three `conversationEnd*`
2180
+ * keys (read by `functions/triage-tick.ts` and the follow-up webhook, which run
2181
+ * the end-of-conversation judge and apply the end action themselves — D16; no
2182
+ * graph node sees them). `to-profile.spec.ts` pins
2202
2183
  * that list, so a new settings field cannot be forgotten here.
2203
2184
  *
2204
2185
  * `prompts` is a PARAMETER, not derived here: `prompts.draft` is the agent
@@ -2282,6 +2263,10 @@ interface SupportKitSettings {
2282
2263
  followupTag: string;
2283
2264
  /** The app's ticket tag: stamped by the triage, required by the follow-up webhook, served to the extension (see `settings/fields.ts`). */
2284
2265
  appScopeTag: string;
2266
+ /** spec-fin-de-conversation-v1 §5 — optional: apps deployed before 10.2.0 store none, read as `disabled`. */
2267
+ conversationEndAction?: ConversationEndAction;
2268
+ conversationEndTag?: string;
2269
+ conversationEndPrompt?: NodePromptSettings | null;
2285
2270
  autoSendEnabled: boolean;
2286
2271
  senderEmail: string;
2287
2272
  /** Optional: apps deployed before the field existed have no value stored. */
@@ -2301,6 +2286,85 @@ interface SupportKitSettings {
2301
2286
  }
2302
2287
  declare function settingsToProfile(settings: SupportKitSettings, prompts: Record<PromptTableKey, PromptRef>): AgentProfile;
2303
2288
 
2289
+ /**
2290
+ * The end-of-conversation settings (spec-fin-de-conversation-v1 §5), read
2291
+ * defensively: every field is optional because an app deployed before the
2292
+ * feature stores none of them, and that app must keep today's behaviour
2293
+ * exactly (D9) — absent reads as `disabled`.
2294
+ */
2295
+
2296
+ declare const CONVERSATION_END_ACTIONS: readonly ["disabled", "tag", "close"];
2297
+ type ConversationEndAction = (typeof CONVERSATION_END_ACTIONS)[number];
2298
+ declare const DEFAULT_CONVERSATION_END_TAG = "wai/conversation-ended";
2299
+ interface ConversationEndSettings {
2300
+ action: ConversationEndAction;
2301
+ /** Trimmed. Applied in `tag` mode only, but always read: D11 removes it whatever the mode. */
2302
+ tag: string;
2303
+ prompt: NodePromptSettings | null;
2304
+ }
2305
+ /** The end action of an app that has one — `null` stands for `disabled`. */
2306
+ interface ConversationEndConfig {
2307
+ action: 'tag' | 'close';
2308
+ tag: string;
2309
+ }
2310
+ declare function readConversationEnd(settings: SupportKitSettings | Record<string, unknown>): ConversationEndSettings;
2311
+ declare function toConversationEnd(settings: SupportKitSettings | Record<string, unknown>): ConversationEndConfig | null;
2312
+ /**
2313
+ * What a finished conversation does to the Gorgias ticket (D10): the tag, OR
2314
+ * the closure — never both. The webhook applies exactly this and the ticket
2315
+ * timeline names exactly this, so the two cannot drift apart.
2316
+ */
2317
+ declare function conversationEndEffects(end: ConversationEndConfig | null): {
2318
+ tags: string[];
2319
+ close: boolean;
2320
+ };
2321
+
2322
+ /**
2323
+ * Every issue `validateSettings` can raise, by its own `key` — a closed
2324
+ * union, not `string` (T27 rework, pass 2 of 2): `ui/shared/
2325
+ * settings-issue-labels.ts`'s `SETTINGS_ISSUE_LABELS` is keyed on this same
2326
+ * type, so a new issue this function starts raising without a matching
2327
+ * French translation is now a COMPILE ERROR in that map, not a silent
2328
+ * English leak an operator discovers on a live settings page.
2329
+ */
2330
+ type SettingsIssueKey = 'sourceViewId' | 'appScopeTag' | 'nodes' | 'nodePrompt' | 'senderEmail' | 'conversationEndTag' | 'conversationEndPrompt';
2331
+ interface SettingsValidationIssue {
2332
+ /** The offending settings key. */
2333
+ key: SettingsIssueKey;
2334
+ /** Human-readable reason, safe to show in the SettingsPage. */
2335
+ message: string;
2336
+ }
2337
+ /**
2338
+ * The two cross-field rules the spec names, the app's own ticket tag, plus
2339
+ * the one shape rule no schema can express: `nodes.triage` must be configured. `nodes` has no
2340
+ * default (a defaulted "every step null" would install a pipeline that
2341
+ * triages nothing), and `AgentProfile.nodes.triage` is non-nullable — this
2342
+ * check is what makes both safe. Per-field typing (e.g. `batchLimit` being a
2343
+ * number) stays the settings API's job at write time, not this function's.
2344
+ */
2345
+ declare function validateSettings(settings: Record<string, unknown>): SettingsValidationIssue[];
2346
+
2347
+ /**
2348
+ * `settingsWarnings` — the settings problems that must NOT stop the app.
2349
+ *
2350
+ * Deliberately separate from `validateSettings`: nine handlers refuse to run
2351
+ * as soon as that function reports a single issue, so routing a "this looks
2352
+ * wrong" remark through it would take a working app off the air. Everything
2353
+ * here describes a configuration that runs, and runs in a way its operator
2354
+ * probably did not intend.
2355
+ *
2356
+ * Its only consumer is the SettingsPage, which is why these messages are
2357
+ * written in French straight away — unlike `validateSettings`' own, they are
2358
+ * never logged, never returned by a handler, and so need no translation layer.
2359
+ */
2360
+ type SettingsWarningKey = 'appScopeTagVetoesFollowups' | 'appScopeTagCollision' | 'noAutoSendChannels';
2361
+ interface SettingsWarning {
2362
+ key: SettingsWarningKey;
2363
+ /** Operator-facing French, safe to show as-is. */
2364
+ message: string;
2365
+ }
2366
+ declare function settingsWarnings(settings: Record<string, unknown>): SettingsWarning[];
2367
+
2304
2368
  /**
2305
2369
  * `SupportKitFunctionConfig` — what each manifest fragment
2306
2370
  * (`triage-tick`/`sweep`/`handle-approval`/…) needs to build its
@@ -2445,4 +2509,4 @@ interface SupportPipelineFragments {
2445
2509
  }
2446
2510
  declare function buildSupportPipeline(config: SupportPipelineConfig): SupportPipelineFragments;
2447
2511
 
2448
- 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 };
2512
+ export { AGENT_GUARDRAILS, AGENT_STATUSES, AGENT_TOOLS, ATTACHMENT_MARKER_ONLY, type ActionDecision, type AgentProfile, type AgentStatus, type AuditTags, type AutoReplyGuardSettings, type AwaitingSince, type Budget, CANDIDATE_MIN_LENGTH, COLLISION_GUARDRAILS, CONVERSATION_END_ACTIONS, type CatalogueTool, type CategoryPolicy, type CategoryReferentialEntry, type ChannelKind, type ChatMessage, type Classification, type ClockPort, type CollisionGuardrailId, type CompletionRequest, type CompletionResult, type Conversation, type ConversationEndAction, type ConversationEndConfig, type ConversationEndSettings, type ConversationPort, type ConversationRef, type CostLedger, type CustomerInfo, DECISION_ORIGINS, DEFAULT_AUTO_SEND_CHANNELS, DEFAULT_CHANNEL_PROMPT_EMAIL, DEFAULT_CHANNEL_PROMPT_WHATSAPP, DEFAULT_CONVERSATION_END_TAG, 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, buildReplyTimingRecord, buildResponseComparisonRecord, buildSupportKitRecords, buildSupportPipeline, buildTriageDecisionRecord, canTransition, categoryGroupRecord, channelPreGates, conversationEndEffects, 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, readConversationEnd, reclaimStalledSend, reconstructGuardrailHits, requiresFollowup, resolvePromptName, runGuardrails, runTicket, settingsToProfile, settingsWarnings, stopOptOut, targetRefFor, toConversationEnd, toDecisionOrigin, validateSettings, verifyReply, whatsappModeFromLegacyBoolean };