@apotech-os/support-kit 10.1.0 → 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';
@@ -340,8 +346,8 @@ interface AgentProfile {
340
346
  * Each optional step is nullable; `null` = step absent for this tenant.
341
347
  * Real modes: `draft: null` = tenant "triage only"; `evaluate: null` =
342
348
  * generation without evaluation (always `ready`, auto-send impossible).
343
- * `model`/`provider` are FALLBACKS ONLY: when the resolved Langfuse
344
- * prompt carries a model config, it wins (I16).
349
+ * `model`/`provider` are authoritative: the resolved Langfuse prompt's
350
+ * model config never overrides them.
345
351
  */
346
352
  nodes: {
347
353
  triage: TriageNodeConfig;
@@ -605,10 +611,9 @@ interface ResolvedPrompt {
605
611
  version: number;
606
612
  /**
607
613
  * Model config carried by the resolved Langfuse prompt, when it declares
608
- * one. WINS over `AgentProfile.nodes.<node>`'s own `model`/`provider`
609
- * (I16 — see `domain/profile.ts`'s `AgentProfile.nodes` doc: those fields
610
- * are fallbacks only). `null`/absent means "no override", the profile's
611
- * own settings apply unchanged.
614
+ * one. Informational only: no graph node or kit function calls the LLM
615
+ * with it — the model stored in the OS (`AgentProfile.nodes.<node>.model`,
616
+ * `agent.modelId`) always wins.
612
617
  */
613
618
  config?: {
614
619
  model: string;
@@ -1263,6 +1268,10 @@ type CollisionGuardrailId = (typeof COLLISION_GUARDRAILS)[number];
1263
1268
  * apart again.
1264
1269
  */
1265
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;
1266
1275
  channel?: string | null;
1267
1276
  from_agent?: boolean;
1268
1277
  body_text?: string | null;
@@ -1616,8 +1625,9 @@ declare function lastCustomerMessage(conversation: Conversation): string | null;
1616
1625
  * opening one).
1617
1626
  *
1618
1627
  * Split out from `channelPreGates` because the graph evaluates it EARLIER
1619
- * than its sibling: a STOP has to outrank the `no_reply_needed` exit, which
1620
- * 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).
1621
1631
  */
1622
1632
  declare function stopOptOut(conversation: Conversation): string[];
1623
1633
  /**
@@ -2045,6 +2055,27 @@ declare function buildEvaluationRecord(slug: string): ObjectDef;
2045
2055
  declare function diffAnalysisUniqueKey(agentId: string, promptName: string, promptVersion: number): string;
2046
2056
  declare function buildDiffAnalysisRecord(slug: string): ObjectDef;
2047
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
+
2048
2079
  /**
2049
2080
  * `ObjectDef` plus the one manifest-level `records[]` property it doesn't
2050
2081
  * carry itself: `exposedToApps` (P2-10 bilateral consent, §3.4). Only
@@ -2087,7 +2118,8 @@ declare const promptCacheRecord: ObjectDef;
2087
2118
  declare function targetRefFor(slug: string, objectKey: string): string;
2088
2119
 
2089
2120
  /**
2090
- * 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
2091
2123
  * consuming app's `slug` — the single assembly point `buildSupportPipeline`
2092
2124
  * (T25) spreads into a manifest.
2093
2125
  *
@@ -2122,61 +2154,6 @@ declare function buildSupportKitRecords(slug: string): RecordDef[];
2122
2154
 
2123
2155
  declare const SUPPORT_KIT_SETTINGS_FIELDS: SettingsField[];
2124
2156
 
2125
- /**
2126
- * `validateSettings` — spec §3.6, single point of DRY validation shared by
2127
- * the SettingsPage and every handler.
2128
- *
2129
- * Returns a plain list of issues rather than throwing: a SettingsPage maps
2130
- * `issues` by `key` to show a per-field error, and a handler simply checks
2131
- * `issues.length > 0` to refuse a run — one shape, two callers, no
2132
- * try/catch-driven control flow on either side.
2133
- */
2134
- /**
2135
- * Every issue `validateSettings` can raise, by its own `key` — a closed
2136
- * union, not `string` (T27 rework, pass 2 of 2): `ui/shared/
2137
- * settings-issue-labels.ts`'s `SETTINGS_ISSUE_LABELS` is keyed on this same
2138
- * type, so a new issue this function starts raising without a matching
2139
- * French translation is now a COMPILE ERROR in that map, not a silent
2140
- * English leak an operator discovers on a live settings page.
2141
- */
2142
- type SettingsIssueKey = 'sourceViewId' | 'appScopeTag' | 'nodes' | 'nodePrompt' | 'senderEmail';
2143
- interface SettingsValidationIssue {
2144
- /** The offending settings key. */
2145
- key: SettingsIssueKey;
2146
- /** Human-readable reason, safe to show in the SettingsPage. */
2147
- message: string;
2148
- }
2149
- /**
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
2152
- * default (a defaulted "every step null" would install a pipeline that
2153
- * triages nothing), and `AgentProfile.nodes.triage` is non-nullable — this
2154
- * check is what makes both safe. Per-field typing (e.g. `batchLimit` being a
2155
- * number) stays the settings API's job at write time, not this function's.
2156
- */
2157
- declare function validateSettings(settings: Record<string, unknown>): SettingsValidationIssue[];
2158
-
2159
- /**
2160
- * `settingsWarnings` — the settings problems that must NOT stop the app.
2161
- *
2162
- * Deliberately separate from `validateSettings`: nine handlers refuse to run
2163
- * as soon as that function reports a single issue, so routing a "this looks
2164
- * wrong" remark through it would take a working app off the air. Everything
2165
- * here describes a configuration that runs, and runs in a way its operator
2166
- * probably did not intend.
2167
- *
2168
- * Its only consumer is the SettingsPage, which is why these messages are
2169
- * written in French straight away — unlike `validateSettings`' own, they are
2170
- * never logged, never returned by a handler, and so need no translation layer.
2171
- */
2172
- type SettingsWarningKey = 'appScopeTagVetoesFollowups' | 'appScopeTagCollision' | 'noAutoSendChannels';
2173
- interface SettingsWarning {
2174
- key: SettingsWarningKey;
2175
- /** Operator-facing French, safe to show as-is. */
2176
- message: string;
2177
- }
2178
- declare function settingsWarnings(settings: Record<string, unknown>): SettingsWarning[];
2179
-
2180
2157
  /**
2181
2158
  * `settings` (§3.6) → `AgentProfile` (architecture_agent_graphe.md §5.3).
2182
2159
  *
@@ -2194,12 +2171,15 @@ declare function settingsWarnings(settings: Record<string, unknown>): SettingsWa
2194
2171
  * - `responseTtlMinutes` → `schedule.fastResponseTtlMinutes`, `batchLimit`
2195
2172
  * → `schedule.triageBatchLimit`.
2196
2173
  *
2197
- * Two settings have no profile counterpart on purpose:
2174
+ * Five settings have no profile counterpart on purpose:
2198
2175
  * `dryRun` (read by the HANDLERS — `functions/triage-tick.ts` and
2199
2176
  * `functions/process-response.ts` swap the `reply`/`state` ports for the
2200
2177
  * recorders of `adapters/recording-ports.ts` and force `send: {mode:
2201
2178
  * 'none'}` — not by the graph, which must run identically either way),
2202
- * 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
2203
2183
  * that list, so a new settings field cannot be forgotten here.
2204
2184
  *
2205
2185
  * `prompts` is a PARAMETER, not derived here: `prompts.draft` is the agent
@@ -2283,6 +2263,10 @@ interface SupportKitSettings {
2283
2263
  followupTag: string;
2284
2264
  /** The app's ticket tag: stamped by the triage, required by the follow-up webhook, served to the extension (see `settings/fields.ts`). */
2285
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;
2286
2270
  autoSendEnabled: boolean;
2287
2271
  senderEmail: string;
2288
2272
  /** Optional: apps deployed before the field existed have no value stored. */
@@ -2302,6 +2286,85 @@ interface SupportKitSettings {
2302
2286
  }
2303
2287
  declare function settingsToProfile(settings: SupportKitSettings, prompts: Record<PromptTableKey, PromptRef>): AgentProfile;
2304
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
+
2305
2368
  /**
2306
2369
  * `SupportKitFunctionConfig` — what each manifest fragment
2307
2370
  * (`triage-tick`/`sweep`/`handle-approval`/…) needs to build its
@@ -2446,4 +2509,4 @@ interface SupportPipelineFragments {
2446
2509
  }
2447
2510
  declare function buildSupportPipeline(config: SupportPipelineConfig): SupportPipelineFragments;
2448
2511
 
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 };
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';
@@ -340,8 +346,8 @@ interface AgentProfile {
340
346
  * Each optional step is nullable; `null` = step absent for this tenant.
341
347
  * Real modes: `draft: null` = tenant "triage only"; `evaluate: null` =
342
348
  * generation without evaluation (always `ready`, auto-send impossible).
343
- * `model`/`provider` are FALLBACKS ONLY: when the resolved Langfuse
344
- * prompt carries a model config, it wins (I16).
349
+ * `model`/`provider` are authoritative: the resolved Langfuse prompt's
350
+ * model config never overrides them.
345
351
  */
346
352
  nodes: {
347
353
  triage: TriageNodeConfig;
@@ -605,10 +611,9 @@ interface ResolvedPrompt {
605
611
  version: number;
606
612
  /**
607
613
  * Model config carried by the resolved Langfuse prompt, when it declares
608
- * one. WINS over `AgentProfile.nodes.<node>`'s own `model`/`provider`
609
- * (I16 — see `domain/profile.ts`'s `AgentProfile.nodes` doc: those fields
610
- * are fallbacks only). `null`/absent means "no override", the profile's
611
- * own settings apply unchanged.
614
+ * one. Informational only: no graph node or kit function calls the LLM
615
+ * with it — the model stored in the OS (`AgentProfile.nodes.<node>.model`,
616
+ * `agent.modelId`) always wins.
612
617
  */
613
618
  config?: {
614
619
  model: string;
@@ -1263,6 +1268,10 @@ type CollisionGuardrailId = (typeof COLLISION_GUARDRAILS)[number];
1263
1268
  * apart again.
1264
1269
  */
1265
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;
1266
1275
  channel?: string | null;
1267
1276
  from_agent?: boolean;
1268
1277
  body_text?: string | null;
@@ -1616,8 +1625,9 @@ declare function lastCustomerMessage(conversation: Conversation): string | null;
1616
1625
  * opening one).
1617
1626
  *
1618
1627
  * Split out from `channelPreGates` because the graph evaluates it EARLIER
1619
- * than its sibling: a STOP has to outrank the `no_reply_needed` exit, which
1620
- * 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).
1621
1631
  */
1622
1632
  declare function stopOptOut(conversation: Conversation): string[];
1623
1633
  /**
@@ -2045,6 +2055,27 @@ declare function buildEvaluationRecord(slug: string): ObjectDef;
2045
2055
  declare function diffAnalysisUniqueKey(agentId: string, promptName: string, promptVersion: number): string;
2046
2056
  declare function buildDiffAnalysisRecord(slug: string): ObjectDef;
2047
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
+
2048
2079
  /**
2049
2080
  * `ObjectDef` plus the one manifest-level `records[]` property it doesn't
2050
2081
  * carry itself: `exposedToApps` (P2-10 bilateral consent, §3.4). Only
@@ -2087,7 +2118,8 @@ declare const promptCacheRecord: ObjectDef;
2087
2118
  declare function targetRefFor(slug: string, objectKey: string): string;
2088
2119
 
2089
2120
  /**
2090
- * 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
2091
2123
  * consuming app's `slug` — the single assembly point `buildSupportPipeline`
2092
2124
  * (T25) spreads into a manifest.
2093
2125
  *
@@ -2122,61 +2154,6 @@ declare function buildSupportKitRecords(slug: string): RecordDef[];
2122
2154
 
2123
2155
  declare const SUPPORT_KIT_SETTINGS_FIELDS: SettingsField[];
2124
2156
 
2125
- /**
2126
- * `validateSettings` — spec §3.6, single point of DRY validation shared by
2127
- * the SettingsPage and every handler.
2128
- *
2129
- * Returns a plain list of issues rather than throwing: a SettingsPage maps
2130
- * `issues` by `key` to show a per-field error, and a handler simply checks
2131
- * `issues.length > 0` to refuse a run — one shape, two callers, no
2132
- * try/catch-driven control flow on either side.
2133
- */
2134
- /**
2135
- * Every issue `validateSettings` can raise, by its own `key` — a closed
2136
- * union, not `string` (T27 rework, pass 2 of 2): `ui/shared/
2137
- * settings-issue-labels.ts`'s `SETTINGS_ISSUE_LABELS` is keyed on this same
2138
- * type, so a new issue this function starts raising without a matching
2139
- * French translation is now a COMPILE ERROR in that map, not a silent
2140
- * English leak an operator discovers on a live settings page.
2141
- */
2142
- type SettingsIssueKey = 'sourceViewId' | 'appScopeTag' | 'nodes' | 'nodePrompt' | 'senderEmail';
2143
- interface SettingsValidationIssue {
2144
- /** The offending settings key. */
2145
- key: SettingsIssueKey;
2146
- /** Human-readable reason, safe to show in the SettingsPage. */
2147
- message: string;
2148
- }
2149
- /**
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
2152
- * default (a defaulted "every step null" would install a pipeline that
2153
- * triages nothing), and `AgentProfile.nodes.triage` is non-nullable — this
2154
- * check is what makes both safe. Per-field typing (e.g. `batchLimit` being a
2155
- * number) stays the settings API's job at write time, not this function's.
2156
- */
2157
- declare function validateSettings(settings: Record<string, unknown>): SettingsValidationIssue[];
2158
-
2159
- /**
2160
- * `settingsWarnings` — the settings problems that must NOT stop the app.
2161
- *
2162
- * Deliberately separate from `validateSettings`: nine handlers refuse to run
2163
- * as soon as that function reports a single issue, so routing a "this looks
2164
- * wrong" remark through it would take a working app off the air. Everything
2165
- * here describes a configuration that runs, and runs in a way its operator
2166
- * probably did not intend.
2167
- *
2168
- * Its only consumer is the SettingsPage, which is why these messages are
2169
- * written in French straight away — unlike `validateSettings`' own, they are
2170
- * never logged, never returned by a handler, and so need no translation layer.
2171
- */
2172
- type SettingsWarningKey = 'appScopeTagVetoesFollowups' | 'appScopeTagCollision' | 'noAutoSendChannels';
2173
- interface SettingsWarning {
2174
- key: SettingsWarningKey;
2175
- /** Operator-facing French, safe to show as-is. */
2176
- message: string;
2177
- }
2178
- declare function settingsWarnings(settings: Record<string, unknown>): SettingsWarning[];
2179
-
2180
2157
  /**
2181
2158
  * `settings` (§3.6) → `AgentProfile` (architecture_agent_graphe.md §5.3).
2182
2159
  *
@@ -2194,12 +2171,15 @@ declare function settingsWarnings(settings: Record<string, unknown>): SettingsWa
2194
2171
  * - `responseTtlMinutes` → `schedule.fastResponseTtlMinutes`, `batchLimit`
2195
2172
  * → `schedule.triageBatchLimit`.
2196
2173
  *
2197
- * Two settings have no profile counterpart on purpose:
2174
+ * Five settings have no profile counterpart on purpose:
2198
2175
  * `dryRun` (read by the HANDLERS — `functions/triage-tick.ts` and
2199
2176
  * `functions/process-response.ts` swap the `reply`/`state` ports for the
2200
2177
  * recorders of `adapters/recording-ports.ts` and force `send: {mode:
2201
2178
  * 'none'}` — not by the graph, which must run identically either way),
2202
- * 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
2203
2183
  * that list, so a new settings field cannot be forgotten here.
2204
2184
  *
2205
2185
  * `prompts` is a PARAMETER, not derived here: `prompts.draft` is the agent
@@ -2283,6 +2263,10 @@ interface SupportKitSettings {
2283
2263
  followupTag: string;
2284
2264
  /** The app's ticket tag: stamped by the triage, required by the follow-up webhook, served to the extension (see `settings/fields.ts`). */
2285
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;
2286
2270
  autoSendEnabled: boolean;
2287
2271
  senderEmail: string;
2288
2272
  /** Optional: apps deployed before the field existed have no value stored. */
@@ -2302,6 +2286,85 @@ interface SupportKitSettings {
2302
2286
  }
2303
2287
  declare function settingsToProfile(settings: SupportKitSettings, prompts: Record<PromptTableKey, PromptRef>): AgentProfile;
2304
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
+
2305
2368
  /**
2306
2369
  * `SupportKitFunctionConfig` — what each manifest fragment
2307
2370
  * (`triage-tick`/`sweep`/`handle-approval`/…) needs to build its
@@ -2446,4 +2509,4 @@ interface SupportPipelineFragments {
2446
2509
  }
2447
2510
  declare function buildSupportPipeline(config: SupportPipelineConfig): SupportPipelineFragments;
2448
2511
 
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 };
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 };