conduyt-mcp 4.105.42 → 4.105.43
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/tool-annotations.js +1 -0
- package/dist/tools/automations.d.ts +3 -1
- package/dist/tools/automations.js +13 -2
- package/dist/tools/bulk.js +1 -1
- package/dist/tools/custom-fields.js +6 -6
- package/dist/tools/deals.d.ts +2 -0
- package/dist/tools/deals.js +20 -9
- package/dist/tools/formula-fields.d.ts +16 -0
- package/dist/tools/formula-fields.js +18 -7
- package/package.json +1 -1
- package/scripts/coverage-matrix.json +10 -4
package/dist/tool-annotations.js
CHANGED
|
@@ -83,6 +83,7 @@ export const TOOL_ANNOTATIONS = {
|
|
|
83
83
|
conduyt_create_automation: create("Create Automation"),
|
|
84
84
|
conduyt_update_automation: row("Update Automation", false, true, false), // webhook secret rotate/clear revokes the old credential; every config write bumps configRevision (automations/[id]/route.ts:248-275,726-739,1576-1579)
|
|
85
85
|
conduyt_publish_automation: row("Publish Automation", false, false, false), // each repeat can publish another numbered version (automations/[id]/publish/route.ts:218,291)
|
|
86
|
+
conduyt_cancel_automation_run: destroy("Cancel Automation Run"), // tears down ONE run's waiting steps for good (a cancelled run never resumes); a repeat answers 200 changed false (POST /automation-executions/{id}/cancel)
|
|
86
87
|
conduyt_resolve_names: ro("Resolve Names to IDs"),
|
|
87
88
|
conduyt_list_sequences: ro("List Sequences"),
|
|
88
89
|
conduyt_get_sequence: ro("Get Sequence"),
|
|
@@ -6,8 +6,10 @@ export declare const CARD_OWNERSHIP_ACTIONS_NOTE = " Card ownership per lane: as
|
|
|
6
6
|
export declare const DEAL_NODES_ACTIONS_NOTE = " Deal nodes: find_opportunity config {version: 2, pipelineIds (ordered; the first pipeline holding a match wins; empty = every pipeline), status (open default | won | lost | abandoned | any), excludeSources (lead sources never matched, case-insensitive), excludeCreatedByAutomationIds (automations whose create_deal cards are skipped; cards created from 2026-10-13 on), matchField {fieldKey, value} (searches the WHOLE WORKSPACE, any contact, for the card whose deal custom field equals the value, merge fields allowed e.g. {{trigger.oes}}; a card is found when its field holds the searched value (trimmed) as the same text exactly (no case folding); a value written with separators such as dashes or spaces also matches its digits as text; it matches a stored number only when the value (or those digits) is a plain number with no leading zero and at most 15 significant digits that a number holds exactly (007 is text and does not match the number 7; a 16-digit value, 1e-400 or 3e-324 is text only); booleans and differently formatted stored values never match; status, pipelines and exclusions still apply; exactly one match is found, several are ambiguous and take not found; a found card becomes the run's contact when the run has none; the field must exist; an empty rendered value finds nothing), resolution}: searches the run's contact's cards; FOUND makes the card the run's deal and follows nextIfTrue (else next), NOT FOUND is a normal outcome that follows nextIfFalse (else next) and leaves the run's existing deal unchanged (a later deal step on the false branch still acts on the deal the run already had); without version 2 the step keeps the original single-pipeline lookup (a miss fails the step). Prerequisite: a version 2 find needs step cursors on this workspace, and publishing refuses (find_needs_step_cursors) with \"Find opportunity needs step cursors on this workspace; ask support\"; every version 2 find must hold its own live step cursor or it hard-stops the run without selecting or routing. A version 2 find cannot be retried on its own: retrying a failed one alone answers 409, so re-trigger the automation for the contact. An automation definition that touches deals needs the `deals` scope on an API key: without it the write answers 403. link_appointment_to_deal config {stageId, pipelineId (needs stageId), lostReason}: in an appointment-triggered run, links the trigger's appointment to the run's deal (its appointment fields follow it; a newer booking is never displaced; the appointment must be the deal's contact's), then optionally moves the card; it needs an appointment trigger and the run's deal (find_opportunity first, or a booking made with a deal id). update_deal_field config {systemField: \"source\", value, overwriteExisting}: sets the deal's own lead source instead of a custom field (a value only, trimmed, at most 500 characters; overwriteExisting false writes only while the source is the Unknown label).";
|
|
7
7
|
/** (sendonce54, app) send_email's "at most once per contact" option; the catalog does not carry action config */
|
|
8
8
|
export declare const SEND_ONCE_EMAIL_NOTE = " Send once per contact: send_email config {sendKey, sendKeyDays}: sendKey (1 to 64 lowercase letters, digits or dashes, e.g. \"welcome-first-email\") makes the step send at most once per contact per sendKeyDays days (a whole number 1 to 365, default 30) ACROSS automations: a contact already e-mailed under the same key by any workflow inside the window is skipped cleanly (no e-mail, the run continues; the step output carries reasonCode send_key_already_sent, earlierMessageId and earlierSentAt; the dry run and the node test say \"would be skipped\"). A send that definitely failed before reaching the provider does not count; an unknown outcome does. Not combinable with an explicit To list, nor with CC or BCC (a keyed e-mail is sent through the outbox, which carries no CC / BCC); a malformed key or window is refused by validate / import / publish (field action.config.sendKey or sendKeyDays). Omit sendKey for no limit.";
|
|
9
|
+
/** (parity64, app batonaudit64, live OpenAPI POST /automations/{id}/publish) publish judges a baton step's configured stages by the rule the run applies */
|
|
10
|
+
export declare const BATON_STAGE_REFUSED_NOTE = " Publish checks a baton step's configured stages by the rule the run applies (app batonaudit64): a handoff_and_keep stageId that is a Won, Lost, holding or finished-work stage, or a handoff_and_keep or credit_baton_source parkedStageId that is a Won, Lost or holding stage or one without Finished work, is a publish ERROR with code baton_stage_refused (422; the key in `field`, naming the stage and the reason, in data.errors), unless that same setting (the same step, the same action, the same stage) was already live in the published graph: then it is a WARNING with the same code (in data.warnings), so the automation stays editable.";
|
|
9
11
|
/** (handoffkeep55, app) the baton hand-off actions; the catalog does not carry action config */
|
|
10
|
-
export declare const BATON_HANDOFF_ACTIONS_NOTE
|
|
12
|
+
export declare const BATON_HANDOFF_ACTIONS_NOTE: string;
|
|
11
13
|
/** (#124, automation unknown keys / types) the refusal codes the write paths answer; surfaced verbatim by the client (details JSON object last), never retried */
|
|
12
14
|
export declare const AUTOMATION_KEY_REFUSALS_NOTE = " Unknown action keys are refused, never ignored: an action config key the action does not read (a typo such as `laneSoruce`) answers code `unknown_action_config_key` with the node, the key and, when one is close, a suggestion (\"Did you mean `laneSource`?\"); an action `type` no registry entry defines answers `unknown_action_type` (with 'Did you mean' when a registered type is close). Create and update answer 400 (an update that does not write `actions` is never refused for a key stored earlier), conduyt_workflow_validate answers 200 with valid false and the `errors` list (nodeId, field, code, message), and publish / a version restore answer 422 (the preflight refusal wraps `data.message`, `data.errors`, `data.warnings`). Read the suggestion, fix the key and send again; a stored workflow is never refused on read. A trigger condition or trigger node naming a deal MIRROR key (deal.customFields.<key>) answers 422 mirror_not_triggerable (#1292): trigger on the source field's own change (Contact Updated / Company Updated).";
|
|
13
15
|
/** (idleoff57) the conditional switch-off, documented for an agent; (idleroute58) sent to POST /automations/:id/deactivate-if-idle */
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { WEBHOOK_NAME_TAG_DOC } from "./user-fields-doc.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { formatResult, formatToolError } from "../client.js";
|
|
4
|
+
import { strictInput } from "./strict.js";
|
|
4
5
|
/** (card ownership per lane, app 10-08/09) the action options an agent can set; the catalog does not carry action config, so this is the one place they are documented */
|
|
5
6
|
export const CARD_OWNERSHIP_ACTIONS_NOTE = " Card ownership per lane: assign_to_user config {userId | userIds (round robin) | groupId, mode (single | round_robin | trigger_host), target|applyTo: contact|deal|both, overwriteExisting, previousOwner, laneSource, lanePipelineId, laneStageId}: laneSource names a card lane (the Deal.source its Auto-Create step wrote, e.g. 'GSM', max 500 chars) and makes the deal leg assign the contact's newest OPEN card from that lane (inside lanePipelineId when set) instead of the run's deal; when the contact has none and lanePipelineId is set, the card is created there (laneStageId, else the pipeline's first stage) already owned by the user; lanePipelineId or laneStageId without laneSource, or laneStageId without lanePipelineId, is refused; a lane never applies to an 'Assign to: contact' step. assign_to_user mode 'trigger_host' assigns to the appointment's booked host (appointment.booked runs only; fails closed when the run has no host). previousOwner (release | keep_as_collaborator; default release) says what happens to the previous owner when the step changes an owner: release means they lose the lead unless something else explains their access (e.g. another open card of theirs), keep_as_collaborator keeps them as a collaborator of the contact (they still see the lead and its cards, read-only); any other value is refused, and keep_as_collaborator is refused on a step with a card lane (laneSource) unless it assigns the contact only (validate and publish answer a field error on action.config.previousOwner). create_deal config {pipelineId (required), stageId, dealName, dealValue, allowDuplicates, status, source, assignedTo, assigneeMode, leaveUnassigned}: leaveUnassigned true leaves the card unassigned when no assignee is set (default false: the card goes to the lead's owner). assigneeMode 'trigger_host' assigns the card to the appointment's booked host (appointment.booked runs only; wins over assignedTo; fails closed when the run has no host, creating nothing). The condition field 'Booked host' (trigger.hostUserId) exists on appointment.booked, whose payload now carries hostUserId. close_other_open_deals config {lostReason (required)}: closes the contact's OTHER open cards as lost with that reason, keeping the run's own card (each moves to its pipeline's lost stage with the usual stage-change effects; cards already won/lost, in the DPP Post-Close pipeline or in a pipeline with no lost stage are skipped; a re-run closes nothing twice); it needs the run's own deal, so use a deal trigger or a find_opportunity step first.";
|
|
6
7
|
/** (deal nodes, app 10-13) find_opportunity v2, link_appointment_to_deal, update_deal_field systemField source; the catalog does not carry action config */
|
|
7
8
|
export const DEAL_NODES_ACTIONS_NOTE = " Deal nodes: find_opportunity config {version: 2, pipelineIds (ordered; the first pipeline holding a match wins; empty = every pipeline), status (open default | won | lost | abandoned | any), excludeSources (lead sources never matched, case-insensitive), excludeCreatedByAutomationIds (automations whose create_deal cards are skipped; cards created from 2026-10-13 on), matchField {fieldKey, value} (searches the WHOLE WORKSPACE, any contact, for the card whose deal custom field equals the value, merge fields allowed e.g. {{trigger.oes}}; a card is found when its field holds the searched value (trimmed) as the same text exactly (no case folding); a value written with separators such as dashes or spaces also matches its digits as text; it matches a stored number only when the value (or those digits) is a plain number with no leading zero and at most 15 significant digits that a number holds exactly (007 is text and does not match the number 7; a 16-digit value, 1e-400 or 3e-324 is text only); booleans and differently formatted stored values never match; status, pipelines and exclusions still apply; exactly one match is found, several are ambiguous and take not found; a found card becomes the run's contact when the run has none; the field must exist; an empty rendered value finds nothing), resolution}: searches the run's contact's cards; FOUND makes the card the run's deal and follows nextIfTrue (else next), NOT FOUND is a normal outcome that follows nextIfFalse (else next) and leaves the run's existing deal unchanged (a later deal step on the false branch still acts on the deal the run already had); without version 2 the step keeps the original single-pipeline lookup (a miss fails the step). Prerequisite: a version 2 find needs step cursors on this workspace, and publishing refuses (find_needs_step_cursors) with \"Find opportunity needs step cursors on this workspace; ask support\"; every version 2 find must hold its own live step cursor or it hard-stops the run without selecting or routing. A version 2 find cannot be retried on its own: retrying a failed one alone answers 409, so re-trigger the automation for the contact. An automation definition that touches deals needs the `deals` scope on an API key: without it the write answers 403. link_appointment_to_deal config {stageId, pipelineId (needs stageId), lostReason}: in an appointment-triggered run, links the trigger's appointment to the run's deal (its appointment fields follow it; a newer booking is never displaced; the appointment must be the deal's contact's), then optionally moves the card; it needs an appointment trigger and the run's deal (find_opportunity first, or a booking made with a deal id). update_deal_field config {systemField: \"source\", value, overwriteExisting}: sets the deal's own lead source instead of a custom field (a value only, trimmed, at most 500 characters; overwriteExisting false writes only while the source is the Unknown label).";
|
|
8
9
|
/** (sendonce54, app) send_email's "at most once per contact" option; the catalog does not carry action config */
|
|
9
10
|
export const SEND_ONCE_EMAIL_NOTE = " Send once per contact: send_email config {sendKey, sendKeyDays}: sendKey (1 to 64 lowercase letters, digits or dashes, e.g. \"welcome-first-email\") makes the step send at most once per contact per sendKeyDays days (a whole number 1 to 365, default 30) ACROSS automations: a contact already e-mailed under the same key by any workflow inside the window is skipped cleanly (no e-mail, the run continues; the step output carries reasonCode send_key_already_sent, earlierMessageId and earlierSentAt; the dry run and the node test say \"would be skipped\"). A send that definitely failed before reaching the provider does not count; an unknown outcome does. Not combinable with an explicit To list, nor with CC or BCC (a keyed e-mail is sent through the outbox, which carries no CC / BCC); a malformed key or window is refused by validate / import / publish (field action.config.sendKey or sendKeyDays). Omit sendKey for no limit.";
|
|
11
|
+
/** (parity64, app batonaudit64, live OpenAPI POST /automations/{id}/publish) publish judges a baton step's configured stages by the rule the run applies */
|
|
12
|
+
export const BATON_STAGE_REFUSED_NOTE = " Publish checks a baton step's configured stages by the rule the run applies (app batonaudit64): a handoff_and_keep stageId that is a Won, Lost, holding or finished-work stage, or a handoff_and_keep or credit_baton_source parkedStageId that is a Won, Lost or holding stage or one without Finished work, is a publish ERROR with code baton_stage_refused (422; the key in `field`, naming the stage and the reason, in data.errors), unless that same setting (the same step, the same action, the same stage) was already live in the published graph: then it is a WARNING with the same code (in data.warnings), so the automation stays editable.";
|
|
10
13
|
/** (handoffkeep55, app) the baton hand-off actions; the catalog does not carry action config */
|
|
11
|
-
export const BATON_HANDOFF_ACTIONS_NOTE = " Baton hand-off (app handoffkeep55): handoff_and_keep config {pipelineId (required, the receiver's pipeline), stageId, assignedTo (required, the receiver: a user id or one merge field naming a user on the trigger, such as {{trigger.userId}} or {{trigger.assignedTo}}; it must render to an active member who can see the receiver's pipeline, never the card's own owner, else the step is refused with a review task), parkedStageId (required, a finished-work stage (isParked) of the run's card's OWN pipeline), destinationEntryAutomations (fire default | suppress), copyNotes, listDocuments, source}: opens a NEW card for the receiver and, in the same transaction, credits the run's card: it moves to parkedStageId with status still OPEN (never Won: no deal.won, no Hyros sale, no #wins post, no master status change, no Post-Close card) and gets a write-once receipt (deal fields handedOffAt = the credit date, handedOffToDealId, handedOffByExecutionId); a card already handed off answers skipped already_handed_off; a Won, Lost or holding stage anywhere, a finished-work stage as the receiver's stage or as the card's current stage, the receiver being the owner (same_person) or a Post-Close target or source is refused; a later webhook step reads the receiver's card as {{deal.handed_off_to_deal_id}}. credit_baton_source config {sourcePipelineId (required), parkedStageId (required), matchField and/or leadIdField (existing deal custom fields both cards carry), ownerField (an existing user or text deal field; a missing or wrong-type field blocks publish and fails the run visibly with field_missing / field_wrong_type and a review task), lookbackDays (1-90, default 30), windowMinutes (5-1440, default 120), reviewerIds}: on a receiver's card a form created, credits the ONE earlier open card of the same contact in sourcePipelineId (same receipt, same stage rule); none = nothing, two or more = no credit and a review task (default reviewers: owners and admins); decided once per card (deal fields batonResolution bound | none | ambiguous, batonBoundDealId); it refuses (too_early) until windowMinutes after the card was created, so put a delay before it.";
|
|
14
|
+
export const BATON_HANDOFF_ACTIONS_NOTE = " Baton hand-off (app handoffkeep55): handoff_and_keep config {pipelineId (required, the receiver's pipeline), stageId, assignedTo (required, the receiver: a user id or one merge field naming a user on the trigger, such as {{trigger.userId}} or {{trigger.assignedTo}}; it must render to an active member who can see the receiver's pipeline, never the card's own owner, else the step is refused with a review task), parkedStageId (required, a finished-work stage (isParked) of the run's card's OWN pipeline), destinationEntryAutomations (fire default | suppress), copyNotes, listDocuments, source}: opens a NEW card for the receiver and, in the same transaction, credits the run's card: it moves to parkedStageId with status still OPEN (never Won: no deal.won, no Hyros sale, no #wins post, no master status change, no Post-Close card) and gets a write-once receipt (deal fields handedOffAt = the credit date, handedOffToDealId, handedOffByExecutionId); a card already handed off answers skipped already_handed_off; a Won, Lost or holding stage anywhere, a finished-work stage as the receiver's stage or as the card's current stage, the receiver being the owner (same_person) or a Post-Close target or source is refused; a later webhook step reads the receiver's card as {{deal.handed_off_to_deal_id}}. credit_baton_source config {sourcePipelineId (required), parkedStageId (required), matchField and/or leadIdField (existing deal custom fields both cards carry), ownerField (an existing user or text deal field; a missing or wrong-type field blocks publish and fails the run visibly with field_missing / field_wrong_type and a review task), lookbackDays (1-90, default 30), windowMinutes (5-1440, default 120), reviewerIds}: on a receiver's card a form created, credits the ONE earlier open card of the same contact in sourcePipelineId (same receipt, same stage rule); none = nothing, two or more = no credit and a review task (default reviewers: owners and admins); decided once per card (deal fields batonResolution bound | none | ambiguous, batonBoundDealId); it refuses (too_early) until windowMinutes after the card was created, so put a delay before it." + BATON_STAGE_REFUSED_NOTE;
|
|
12
15
|
/** (#124, automation unknown keys / types) the refusal codes the write paths answer; surfaced verbatim by the client (details JSON object last), never retried */
|
|
13
16
|
export const AUTOMATION_KEY_REFUSALS_NOTE = " Unknown action keys are refused, never ignored: an action config key the action does not read (a typo such as `laneSoruce`) answers code `unknown_action_config_key` with the node, the key and, when one is close, a suggestion (\"Did you mean `laneSource`?\"); an action `type` no registry entry defines answers `unknown_action_type` (with 'Did you mean' when a registered type is close). Create and update answer 400 (an update that does not write `actions` is never refused for a key stored earlier), conduyt_workflow_validate answers 200 with valid false and the `errors` list (nodeId, field, code, message), and publish / a version restore answer 422 (the preflight refusal wraps `data.message`, `data.errors`, `data.warnings`). Read the suggestion, fix the key and send again; a stored workflow is never refused on read. A trigger condition or trigger node naming a deal MIRROR key (deal.customFields.<key>) answers 422 mirror_not_triggerable (#1292): trigger on the source field's own change (Contact Updated / Company Updated).";
|
|
14
17
|
/** (idleoff57) the conditional switch-off, documented for an agent; (idleroute58) sent to POST /automations/:id/deactivate-if-idle */
|
|
@@ -112,7 +115,7 @@ export function registerAutomationTools(server, client) {
|
|
|
112
115
|
const result = await client.patch(`/api/v1/automations/${id}`, updates);
|
|
113
116
|
return formatResult(result);
|
|
114
117
|
});
|
|
115
|
-
server.tool("conduyt_publish_automation", "Publish an automation — copies the draft actions to the live published version. The automation must have actions defined. The publish is bound to the draft revision you reviewed (fetched automatically unless you pass expectedConfigRevision)." + AUTOMATION_KEY_REFUSALS_NOTE + AUTOMATION_ENROLLMENT_REFUSALS_NOTE, {
|
|
118
|
+
server.tool("conduyt_publish_automation", "Publish an automation — copies the draft actions to the live published version. The automation must have actions defined. The publish is bound to the draft revision you reviewed (fetched automatically unless you pass expectedConfigRevision)." + AUTOMATION_KEY_REFUSALS_NOTE + BATON_STAGE_REFUSED_NOTE + AUTOMATION_ENROLLMENT_REFUSALS_NOTE, {
|
|
116
119
|
id: z.string().describe("Automation UUID"),
|
|
117
120
|
expectedConfigRevision: z.number().int().nonnegative().optional().describe("The configRevision of the draft you reviewed (from conduyt_get_automation); fetched automatically when omitted"),
|
|
118
121
|
}, async ({ id, expectedConfigRevision }) => {
|
|
@@ -125,6 +128,14 @@ export function registerAutomationTools(server, client) {
|
|
|
125
128
|
const result = await client.post(`/api/v1/automations/${id}/publish`, { expectedConfigRevision: revision });
|
|
126
129
|
return formatResult(result);
|
|
127
130
|
});
|
|
131
|
+
// (parity64, app cancelrun64, live OpenAPI POST /automation-executions/{id}/cancel) stop ONE run of an automation
|
|
132
|
+
strictInput(server.tool("conduyt_cancel_automation_run", "Stop ONE run of an automation (POST /api/v1/automation-executions/{id}/cancel; the id is the run's execution id). The run is marked cancelled and its waiting steps (delays, waits, queued retries, drip batches not yet released) are cancelled, so no worker ever resumes them. A step a worker is executing at this moment is not interrupted: it is counted in inProgressSteps / inProgressBatches and the run stays open (leftOpenReason says why); call again once it settles. Idempotent: a run that already finished or was cancelled answers 200 with its status and changed false. Answers { executionId, status (cancelled when the run was closed, otherwise its current status: completed, failed, waiting, running, ...), changed, cancelledSteps, cancelledBatches, inProgressSteps, inProgressBatches, leftOpenReason (a string or null) }. reason (a string of at most 300 characters) is written on the run, its cancelled steps and the audit line; a longer one answers 400. Requires the automations edit permission (the same as switching the automation off): 403 without it. Another account's run and an unknown id are both 404. Consent rules are unaffected. One audit line (automation_execution.cancelled) per call that changed something. This stops one run only: to stop an automation from starting new runs use conduyt_update_automation with isActive false.", {
|
|
133
|
+
executionId: z.string().uuid().describe("The automation run (execution log) UUID to stop"),
|
|
134
|
+
reason: z.string().max(300).optional().describe("Why the run is stopped (at most 300 characters); written on the run, its cancelled steps and the audit line"),
|
|
135
|
+
}, async ({ executionId, reason }) => {
|
|
136
|
+
const result = await client.post(`/api/v1/automation-executions/${encodeURIComponent(executionId)}/cancel`, { ...(reason !== undefined ? { reason } : {}) });
|
|
137
|
+
return formatResult(result);
|
|
138
|
+
}));
|
|
128
139
|
server.tool("conduyt_resolve_names", "Resolve human-readable names to UUIDs. Use this before creating automations — converts tag names, pipeline names, user names, and custom field labels to their UUIDs.", {
|
|
129
140
|
tags: z.array(z.string()).optional().describe("Tag names to resolve (e.g. ['new-lead', 'hot'])"),
|
|
130
141
|
pipelines: z.array(z.string()).optional().describe("Pipeline names to resolve (e.g. ['Sales Pipeline'])"),
|
package/dist/tools/bulk.js
CHANGED
|
@@ -195,7 +195,7 @@ export function registerBulkTools(server, client) {
|
|
|
195
195
|
const result = await client.post("/api/v1/bulk/deals/update", params);
|
|
196
196
|
return formatResult(result);
|
|
197
197
|
});
|
|
198
|
-
server.tool("conduyt_import_preflight", "Pre-check a contact import BEFORE running it — returns criticalWarnings (phone-less list bound for SMS, heavy create-only duplicate skips, double-mapped columns), duplicate/existing-match estimates, invalid emails, DNC/litigator hits, SMS-provider readiness, and plan-limit impact. Same engine the import wizard uses; call this before conduyt_ai_import_contacts on any sizeable list. A workspace whose identifier index is still being built answers 503 `IDENTITY_INDEX_NOT_READY` (nothing checked; retry later).", {
|
|
198
|
+
server.tool("conduyt_import_preflight", "Pre-check a contact import BEFORE running it — returns criticalWarnings (phone-less list bound for SMS, heavy create-only duplicate skips, double-mapped columns), duplicate/existing-match estimates, invalid emails, DNC/litigator hits, SMS-provider readiness, and plan-limit impact. Same engine the import wizard uses; call this before conduyt_ai_import_contacts on any sizeable list. A workspace whose identifier index is still being built answers 503 `IDENTITY_INDEX_NOT_READY` (nothing checked; retry later). For objectType opportunities (deal files; absent for contacts and companies) the answer also carries dealPipelines (app dealverify64): the pipelines the deal import itself matches rows against, every pipeline of the account including archived ones (an archived pipeline keeps its [Archived] name prefix; a row naming that stored name is matched and refused with the row code pipeline_archived, because no deal can be added to an archived pipeline), each as { id, name, archived, stages: [{ name, isSystem }] } with its live stages in order. Judge a row's Pipeline and Stage cells against this list, as the import does.", {
|
|
199
199
|
objectType: z.enum(["contacts", "opportunities", "companies"]).default("contacts").describe("What the import creates"),
|
|
200
200
|
importMode: z.enum(["create_and_update", "create_only", "update_only"]).optional().describe("Duplicate handling mode the import will use"),
|
|
201
201
|
totalRows: z.number().describe("Total rows in the file/payload"),
|
|
@@ -3,7 +3,7 @@ import { ConduytApiError, formatResult } from "../client.js";
|
|
|
3
3
|
import { USER_NOTE } from "./user-fields-doc.js";
|
|
4
4
|
import { OPTIONS_CAP_NOTE, OPTIONS_MAX, TYPE_CHANGE_NOTE } from "./lender-options.js";
|
|
5
5
|
import { REMOVE_NOTE, RESOLVE_NOTE, SEARCH_NOTE, SET_NOTE, STORE_LIST_NOTE, STORE_UPDATE_NOTE, optionRowSchema, setRowsProblem, storeCreateProblem, storeUpdateProblem, writeFlags, writeQuery } from "./store-options.js";
|
|
6
|
-
import { CUSTOM_FIELD_TYPES, DELANCEY_ID_NOTE, fail, formulaCreateProblem, formulaUpdateProblem, FORMULA_DEFINITION_NOTE, SECURE_IDENTIFIER_NOTE } from "./formula-fields.js";
|
|
6
|
+
import { CUSTOM_FIELD_TYPES, DELANCEY_ID_NOTE, fail, formulaCreateProblem, formulaUpdateProblem, FORMULA_DEFINITION_NOTE, FORMULA_EXPRESSION_NOTE, SECURE_IDENTIFIER_NOTE } from "./formula-fields.js";
|
|
7
7
|
// (parity1292, batch30 #1292 Ship 1) Secure custom fields: the flag, its reveal set, and the codes. There is NO reveal tool: the reveal
|
|
8
8
|
// routes (POST /{contacts|deals|companies}/{id}/custom-fields/{key}/reveal) refuse an API key (403 reveal_requires_session), and this
|
|
9
9
|
// server always signs in with one.
|
|
@@ -26,13 +26,13 @@ export function registerCustomFieldTools(server, client) {
|
|
|
26
26
|
const result = await client.get(`/api/v1/custom-fields?${params}`);
|
|
27
27
|
return formatResult(result);
|
|
28
28
|
});
|
|
29
|
-
server.tool("conduyt_create_custom_field", "Create a new custom field definition for contacts, deals, or companies. Field types: text, textarea, number, date, datetime, url, select, radio, multiselect, boolean, phone, email, formula, user. " + FORMULA_DEFINITION_NOTE + " " + SECURE_IDENTIFIER_NOTE + " " + SECURE_NOTE + " " + OPTIONS_CAP_NOTE + " " + DELANCEY_ID_NOTE + " " + USER_NOTE + " " + STORE_LIST_NOTE, {
|
|
29
|
+
server.tool("conduyt_create_custom_field", "Create a new custom field definition for contacts, deals, or companies. Field types: text, textarea, number, date, datetime, url, select, radio, multiselect, boolean, phone, email, formula, user. " + FORMULA_DEFINITION_NOTE + " " + FORMULA_EXPRESSION_NOTE + " " + SECURE_IDENTIFIER_NOTE + " " + SECURE_NOTE + " " + OPTIONS_CAP_NOTE + " " + DELANCEY_ID_NOTE + " " + USER_NOTE + " " + STORE_LIST_NOTE, {
|
|
30
30
|
entityType: z.enum(["contact", "deal", "company"]).describe("Entity type this field applies to"),
|
|
31
31
|
fieldKey: z.string().describe("Unique field key (alphanumeric + underscores, e.g. 'lead_score'). On deals, delancey_deal_id is RESERVED (the Delancey Street deal ID the push writes: 422 reserved_field_key, never Secure, never edited or deleted); oes_number and dpp_oes_raw are allowed only as plain optional text fields and are never Secure"),
|
|
32
32
|
label: z.string().describe("Human-readable label (e.g. 'Lead Score')"),
|
|
33
|
-
fieldType: z.enum(CUSTOM_FIELD_TYPES).describe("Field data type; formula is computed at read time
|
|
33
|
+
fieldType: z.enum(CUSTOM_FIELD_TYPES).describe("Field data type; formula is computed at read time: two number fields (options { op, left, right, format }) or an expression (options { expression, format })"),
|
|
34
34
|
section: z.string().optional().describe("Section grouping for UI display"),
|
|
35
|
-
options: z.any().optional().describe("Options for select/multiselect fields (array of strings, up to 1000, each 1 to 200 characters); for fieldType formula the object { op: add|sub|mul|div, left: <number field key>, right: <number field key or a number>, format: number|currency|percent }"),
|
|
35
|
+
options: z.any().optional().describe("Options for select/multiselect fields (array of strings, up to 1000, each 1 to 200 characters); for fieldType formula the object { op: add|sub|mul|div, left: <number field key>, right: <number field key or a number>, format: number|currency|percent } or { expression: <text, e.g. DAYS_BETWEEN({start_date}, TODAY())>, format: number|currency|percent }"),
|
|
36
36
|
optionList: z.literal("store").optional().describe("\"store\" = a STORE-BACKED select (typeahead): the list lives in the option store, starts empty, filled with conduyt_set_custom_field_options; needs fieldType select and allowOther; options may carry only { visibility } (no inline choices)"),
|
|
37
37
|
allowOther: z.boolean().optional().describe("Store-backed select, REQUIRED with optionList: true = a typed value that is not on the list is also accepted, false = strict (custom_field_value_not_on_list). Refused 422 custom_field_allow_other_refused on a partner creditor field (contact creditor_1..creditor_7 or a Creditors Relief list)"),
|
|
38
38
|
isRequired: z.boolean().optional().describe("Whether this field is required"),
|
|
@@ -54,11 +54,11 @@ export function registerCustomFieldTools(server, client) {
|
|
|
54
54
|
const result = await client.post("/api/v1/custom-fields", { ...params, ...(store ?? {}) });
|
|
55
55
|
return formatResult(result);
|
|
56
56
|
});
|
|
57
|
-
server.tool("conduyt_update_custom_field", "Update a custom field's label, options, required status, Secure flag or reveal set. Cannot change the field key or entity type. A FORMULA field's options (op / left / right / format), Secure flag and required flag are re-judged with its inputs locked: 422 formula_invalid, 422 formula_secure_input; turning Secure on for a number field a non-Secure formula computes from is 409 formula_secure_input naming the formulas. A deal MIRROR (conduyt_create_mirror_field) takes only section and sortOrder; anything else answers 422 invalid_mirror_definition. Turning Secure OFF (isSecure false) makes every stored value visible and needs confirmUnsecure true, else 409 secure_unsecure_unconfirmed. " + SECURE_NOTE + " " + OPTIONS_CAP_NOTE + " " + TYPE_CHANGE_NOTE + " " + DELANCEY_ID_NOTE + " " + USER_NOTE + " " + STORE_UPDATE_NOTE, {
|
|
57
|
+
server.tool("conduyt_update_custom_field", "Update a custom field's label, options, required status, Secure flag or reveal set. Cannot change the field key or entity type. A FORMULA field's options (op / left / right / format, or expression / format: an expression the parser refuses is 400 formula_expression_invalid with reason and position), Secure flag and required flag are re-judged with its inputs locked: 422 formula_invalid, 422 formula_secure_input; a text field an expression formula reads cannot become a user field (409 field_type_change_refused naming the formulas); turning Secure on for a number field a non-Secure formula computes from is 409 formula_secure_input naming the formulas. A deal MIRROR (conduyt_create_mirror_field) takes only section and sortOrder; anything else answers 422 invalid_mirror_definition. Turning Secure OFF (isSecure false) makes every stored value visible and needs confirmUnsecure true, else 409 secure_unsecure_unconfirmed. " + SECURE_NOTE + " " + OPTIONS_CAP_NOTE + " " + TYPE_CHANGE_NOTE + " " + DELANCEY_ID_NOTE + " " + USER_NOTE + " " + STORE_UPDATE_NOTE, {
|
|
58
58
|
id: z.string().describe("Custom field UUID"),
|
|
59
59
|
label: z.string().optional().describe("Updated label"),
|
|
60
60
|
section: z.string().max(120).nullable().optional().describe("Updated section grouping (null clears); the one place besides sortOrder a deal MIRROR can be edited"),
|
|
61
|
-
options: z.any().optional().describe("Updated options for select/multiselect; for a formula field the object { op, left, right, format } (re-judged with its inputs locked)"),
|
|
61
|
+
options: z.any().optional().describe("Updated options for select/multiselect; for a formula field the object { op, left, right, format } or { expression, format } (re-judged with its inputs locked; the expression grammar and functions are in conduyt_create_custom_field)"),
|
|
62
62
|
optionList: z.literal("store").optional().describe("\"store\" = CONVERT a select with inline choices into a STORE-BACKED list (owner / admin signed in only; sent alone with allowOther)"),
|
|
63
63
|
allowOther: z.boolean().optional().describe("Store-backed select: true = accept a typed value that is not on the list, false = strict. Never true on a partner creditor field (422 custom_field_allow_other_refused). Alone it switches allowOther in place"),
|
|
64
64
|
isRequired: z.boolean().optional().describe("Updated required status"),
|
package/dist/tools/deals.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import { ConduytClient } from "../client.js";
|
|
3
|
+
/** (parity64, app dealupdate63, live OpenAPI POST /imports importMode and ImportJobRead.unchangedRows) updating existing deals from the deal import */
|
|
4
|
+
export declare const DEAL_IMPORT_UPDATE_DOC = " UPDATING deals (app dealupdate63): importMode create_and_update (the default when omitted) updates the deal a row's dealId names and creates the rows without one; update_only updates by dealId and never creates (a row without a dealId is not applied); create_only creates every row (a dealId is not read: the create behaviour above). The ONLY matching key is the Deal ID, the deal's UUID (from conduyt_list_deals, or the last column, Deal ID, of conduyt_export_deals); nothing else (title, contact) ever matches a deal. An update writes only the non-blank cells that differ from the deal (a blank cell keeps the stored value; there is no clear), through the same write as PATCH /deals/{id} (its validation, permission, row-level edit rule and side effects: deal.updated webhooks and automations, activities, mirrors, audit), so, unlike the create path, an update DOES fire them. It never changes the stage, pipeline or status (a differing cell is noted on the row, code stage_status_not_changed). A dealId that is malformed, unknown, of another account, deleted, or of a deal the importer may not edit: the row is not applied, with one note (the same text for each). A field value that cannot be applied is noted (code deal_field_not_applied) and the row's other fields still apply. A matched row with nothing to change is unchanged (no write, no event). A non-blank cell of a Secure custom field is always written, never compared, so the outcome never tells whether it matched the stored value. A mirrored field the linked record refuses is not applied (deal_field_not_applied) and the row's other fields still apply. The answer counts updatedRows and unchangedRows beside the created / skipped / duplicate counts (unchangedRows are also counted in skippedRows: skippedRows = failedRows + duplicateRows + unchangedRows on a deal import); stage_status_not_changed and deal_field_not_applied come back in errorLog like the other row notes. title and pipelineName are required only on a create row.";
|
|
3
5
|
/** The six Pipeline health checks (GET /deals health_check, GET /deals/inspection check). */
|
|
4
6
|
export declare const PIPELINE_HEALTH_CHECKS: readonly ["high_value_idle", "stale", "unassigned", "needs_action", "missing_close_date", "missing_contact"];
|
|
5
7
|
/** GET /deals board_snapshot=true limits (the app's lib/deal-board-snapshot-limits, contract at 5729bc7b4). */
|
package/dist/tools/deals.js
CHANGED
|
@@ -9,6 +9,8 @@ import { KEEP_PREVIOUS_OWNER_NEEDS_ASSIGNEE } from "./contacts.js";
|
|
|
9
9
|
import { CONTACT_TIMEZONE_NOTE, appendContactTimezone, contactTimezoneSchema } from "./contact-timezone.js";
|
|
10
10
|
import { DEAL_VIEW_AUDIENCE_DOC, DEAL_VIEW_RULES_DOC, dealViewFields } from "./deal-views.js";
|
|
11
11
|
// (mirror1292, batch31 #1292 Ship 3) deal MIRROR fields: a write-through view of a contact / company field, named on the deal tools
|
|
12
|
+
/** (parity64, app dealupdate63, live OpenAPI POST /imports importMode and ImportJobRead.unchangedRows) updating existing deals from the deal import */
|
|
13
|
+
export const DEAL_IMPORT_UPDATE_DOC = " UPDATING deals (app dealupdate63): importMode create_and_update (the default when omitted) updates the deal a row's dealId names and creates the rows without one; update_only updates by dealId and never creates (a row without a dealId is not applied); create_only creates every row (a dealId is not read: the create behaviour above). The ONLY matching key is the Deal ID, the deal's UUID (from conduyt_list_deals, or the last column, Deal ID, of conduyt_export_deals); nothing else (title, contact) ever matches a deal. An update writes only the non-blank cells that differ from the deal (a blank cell keeps the stored value; there is no clear), through the same write as PATCH /deals/{id} (its validation, permission, row-level edit rule and side effects: deal.updated webhooks and automations, activities, mirrors, audit), so, unlike the create path, an update DOES fire them. It never changes the stage, pipeline or status (a differing cell is noted on the row, code stage_status_not_changed). A dealId that is malformed, unknown, of another account, deleted, or of a deal the importer may not edit: the row is not applied, with one note (the same text for each). A field value that cannot be applied is noted (code deal_field_not_applied) and the row's other fields still apply. A matched row with nothing to change is unchanged (no write, no event). A non-blank cell of a Secure custom field is always written, never compared, so the outcome never tells whether it matched the stored value. A mirrored field the linked record refuses is not applied (deal_field_not_applied) and the row's other fields still apply. The answer counts updatedRows and unchangedRows beside the created / skipped / duplicate counts (unchangedRows are also counted in skippedRows: skippedRows = failedRows + duplicateRows + unchangedRows on a deal import); stage_status_not_changed and deal_field_not_applied come back in errorLog like the other row notes. title and pipelineName are required only on a create row.";
|
|
12
14
|
const MIRROR_READ_DOC = " Mirror fields (#1292): a deal custom field created as a MIRROR of a contact / company field answers that record's value in customFields, with mirrorFields[key] = { mirrored: true, source: { entityType, fieldKey }, unresolved? } beside it (unresolved: no_linked_contact | no_linked_company | source_field_missing, value null); a mirror of a Secure source answers the mask \u2022\u2022\u2022\u2022 like the source (passed through untouched).";
|
|
13
15
|
const MIRROR_WRITE_DOC = " A customFields key that is a deal MIRROR writes the linked contact / company through its own write path (nothing is stored on the deal): 409 mirror_unresolved (no linked record), 409 mirror_relink_conflict (the same request re-links it), 403 mirror_source_not_editable, 422 mirror_source_rejected, 409 mirror_source_changed, 409 mirror_source_conflict (the source's required state changed under the lock), 422 mirror_conflicting_values (two mirror keys of one source field with different values).";
|
|
14
16
|
/** The six Pipeline health checks (GET /deals health_check, GET /deals/inspection check). */
|
|
@@ -313,11 +315,12 @@ export function registerDealTools(server, client) {
|
|
|
313
315
|
const result = await client.del(`/api/v1/deals/${encodeURIComponent(id)}`);
|
|
314
316
|
return formatResult(result);
|
|
315
317
|
});
|
|
316
|
-
server.tool("conduyt_import_deals", "Bulk-import deals from a list of rows in one call. Runs on the canonical import engine — pipelines and stages are resolved by NAME (create them first with conduyt_create_pipeline), contacts by email.
|
|
318
|
+
server.tool("conduyt_import_deals", "Bulk-import deals from a list of rows in one call. Runs on the canonical import engine — pipelines and stages are resolved by NAME (create them first with conduyt_create_pipeline), contacts by email. CREATE rows are deduplicated on title + pipeline + contact and intentionally do NOT fire deal-created automations/webhooks/SMS/email (the create path is side-effect-free by design); an UPDATE row (below) is different. Requires an owner/admin API key. Returns the created/skipped/duplicate counts and any per-row errors. Row notes come back in the answer's errorLog as entries with a code: stage_not_found (the row named a stage its pipeline does not have; the deal went to the first stage) and probability_unreadable (the Probability cell could not be read; the deal has no probability). They are notes, not failures: the deal is created, the note is recorded only for a deal that was created, and the log keeps only the most recent 100 informational notes of ALL kinds together (these two share that budget with the other info notices, and older ones are dropped first), so a large import can carry more notes than it lists; read the stage and probability fields of the created deals for the rest." + DEAL_IMPORT_UPDATE_DOC + " A CONTACTS import job run (POST /imports/{id}/process or /resume, same refusal; the server documents this refusal for a contacts file only, and this tool imports opportunities, so it is not refused with it here) can be refused 422 import_nothing_ready { readyCount: 0, blockedCount, reasons: [{ code: required_field | missing_identifier | invalid_email, label, rowCount }] (most frequent first) } when the job has NO row that can import (every row misses a required field or fails an identifier rule: no name, email or phone, or an invalid email): refused before the first write, the job is left as it is; fix the rows and import again.", {
|
|
317
319
|
deals: z
|
|
318
320
|
.array(z.object({
|
|
319
|
-
title: z.string().describe("Deal title (
|
|
320
|
-
|
|
321
|
+
title: z.string().optional().describe("Deal title. Required on a CREATE row; an UPDATE row (one with a dealId, in a mode that reads it) may omit it. A blank title on a create row fails that row"),
|
|
322
|
+
dealId: z.string().uuid().optional().describe("The deal's UUID (from conduyt_list_deals, or the Deal ID column of conduyt_export_deals): the row updates that deal instead of creating one (importMode create_and_update, the default, or update_only; create_only does not read it). Never matched by title or contact. A malformed, unknown, other-account, deleted or not-editable id makes the row not applied, with one note"),
|
|
323
|
+
pipelineName: z.string().optional().describe("Pipeline name (resolved by name). Required on every CREATE row unless defaultPipelineId is given; a pipelineName in the row always wins over the default (a name that matches nothing still fails the row)"),
|
|
321
324
|
stageName: z.string().optional().describe("Stage name within the pipeline. Omitted or blank: the pipeline's first stage. A name the pipeline does not have also puts the deal in the first stage (the row is kept) and records a stage_not_found note in errorLog naming the text and the stage used. A name that is a system holding stage fails the row"),
|
|
322
325
|
contactEmail: z.string().optional().describe("Email of an existing contact to link (resolved by email)"),
|
|
323
326
|
companyId: z.string().optional().describe("Company UUID to link (must belong to your account; invalid/deleted/cross-account IDs are reported as row errors)"),
|
|
@@ -331,18 +334,26 @@ export function registerDealTools(server, client) {
|
|
|
331
334
|
}))
|
|
332
335
|
.describe("Deals to import (1 or more rows; max matches the account import cap)"),
|
|
333
336
|
defaultPipelineId: z.string().uuid().optional().describe("Optional UUID of a live (not archived) pipeline of this account, used for every row that has no pipelineName (or an empty one); a pipelineName in a row always wins. The API answers 400 when it is not a UUID, not a pipeline of this account, or archived; a pipeline deleted or archived while the import runs fails the rows that needed it"),
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
337
|
+
importMode: z.enum(["create_and_update", "create_only", "update_only"]).optional().describe("Duplicate handling for deals (omit for the API's default, create_and_update): create_and_update updates the deal a row's dealId names and creates the rows without one; update_only updates by dealId and never creates (a row without a dealId is not applied); create_only creates every row (a Deal ID column is not read). Any mode but create_only needs the edit permission of deals"),
|
|
338
|
+
}, async ({ deals, defaultPipelineId, importMode }) => {
|
|
339
|
+
// (parity64, app dealupdate63) a row is an UPDATE row when it carries a dealId and the mode reads it (create_only never does);
|
|
340
|
+
// update_only never creates, so no row of it is a create row. Only a CREATE row needs a title and a pipeline.
|
|
341
|
+
deals.forEach((d, i) => {
|
|
342
|
+
const createRow = importMode === "create_only" || (importMode !== "update_only" && d.dealId === undefined);
|
|
343
|
+
if (!createRow)
|
|
344
|
+
return;
|
|
345
|
+
if (d.title === undefined)
|
|
346
|
+
throw new Error(`deals[${i}].title is required unless the row has a dealId (an update row).`);
|
|
347
|
+
if (defaultPipelineId === undefined && (d.pipelineName === undefined || d.pipelineName.trim() === ""))
|
|
348
|
+
throw new Error(`deals[${i}].pipelineName is required unless defaultPipelineId is given.`);
|
|
349
|
+
});
|
|
340
350
|
const created = (await client.post("/api/v1/imports", {
|
|
341
351
|
objectType: "opportunities",
|
|
342
352
|
format: "json",
|
|
343
353
|
fileName: "deal-import.csv",
|
|
344
354
|
rows: deals,
|
|
345
355
|
...(defaultPipelineId !== undefined ? { defaultPipelineId } : {}),
|
|
356
|
+
...(importMode !== undefined ? { importMode } : {}),
|
|
346
357
|
}));
|
|
347
358
|
const jobId = created.data?.id;
|
|
348
359
|
if (!jobId) {
|
|
@@ -17,6 +17,11 @@ export declare const FORMULA_WRITE_NOTE = "A customFields key that is a FORMULA
|
|
|
17
17
|
export declare const FORMULA_FILTER_NOTE = "A filter naming a FORMULA custom field is refused: 422 formula_not_filterable (formulas are not filterable in v1).";
|
|
18
18
|
/** the definition-side rules, shared by the create and update tool descriptions */
|
|
19
19
|
export declare const FORMULA_DEFINITION_NOTE = "fieldType formula (#1292) is a COMPUTED field: options { op: add|sub|mul|div, left: <number field key>, right: <number field key or a number>, format: number|currency|percent }; left and right are number fields of the SAME entity (never the formula itself or another formula); the value is computed at read time (never stored), blank when an input is blank and on a division by zero; every record answer carries it in customFields plus computedFields[key] = { computed: true, readOnly: true, format }. A formula is read-only on every write path (422 formula_read_only), not filterable (422 formula_not_filterable), never required, and an input that is Secure needs a Secure formula (422 formula_secure_input; turning Secure on for an input a non-Secure formula computes from is 409 formula_secure_input naming the formulas). A formula needs a FRESH key (409 formula_key_in_use); malformed options, a non-number / formula / self input or a system-owned key is 422 formula_invalid. Deleting a field a formula computes from is 409 deletion_blocked (the formula in blockers).";
|
|
20
|
+
/** (formuladates65b) the EXPRESSION shape of a formula field, its functions and its counting rules (the server's lib/formula-expression.ts) */
|
|
21
|
+
export declare const FORMULA_EXPRESSION_MAX = 2000;
|
|
22
|
+
export declare const FORMULA_FUNCTIONS: readonly ["TODAY", "DAYS_BETWEEN", "WEEKDAYS_BETWEEN", "PERIODS_BETWEEN", "MIN", "MAX", "ROUND", "COALESCE"];
|
|
23
|
+
export declare const FORMULA_EXPRESSION_INPUT_TYPES: readonly ["number", "text", "textarea", "select", "radio", "date", "datetime"];
|
|
24
|
+
export declare const FORMULA_EXPRESSION_NOTE = "A formula may instead take options { expression: <text, at most 2000 characters>, format: number|currency|percent }. Grammar: numbers, {field_key}, \"text\", + - * / (also \u00D7 \u00F7), parentheses and the functions TODAY(), DAYS_BETWEEN(a, b), WEEKDAYS_BETWEEN(a, b), PERIODS_BETWEEN(start, end, frequency), MIN(...), MAX(...), ROUND(x, digits 0..10), COALESCE(...). Inputs: number, text, textarea, select, radio, date and datetime fields of the SAME entity (never another formula); a text value where a number goes is read as an amount (digits with at most 2 decimals, from 0 up to 100,000,000; \"$\", \",\" and spaces ignored; anything else, a negative or a larger amount is blank). TODAY() is the account's own calendar day (its time-zone setting). DAYS_BETWEEN and WEEKDAYS_BETWEEN count the days AFTER the first date up to and including the second (signed; weekdays = Monday to Friday, no holiday calendar). PERIODS_BETWEEN counts whole periods after the start up to and including the end: the start day itself is no period, a start on or after the end gives 0 (never negative); frequency daily (= weekdays), weekly (days / 7), bi-weekly (days / 14), monthly (whole months from the start, the day clamped to the month's last day) or semi-monthly (twice a month: the start day and 15 days later); an unknown frequency is blank. A blank input not wrapped in COALESCE makes the result blank; divide by zero is blank. Example: MAX(0, {amount_due} - {payment} * MAX(0, PERIODS_BETWEEN({start_date}, TODAY(), {frequency}) - COALESCE({missed}, 0))). An expression the parser refuses is 400 formula_expression_invalid with reason (empty, too_long, unexpected_token, unknown_function, wrong_argument_count, too_deep, too_many_nodes, too_many_references, ...) and position (a 0-based character offset); a value of the wrong kind (a date where a number goes, a number as a frequency, an unknown frequency text) is 422 formula_invalid with reason and position; an input of another type is 422 formula_invalid with allowedInputTypes. The formula is Secure-inherited from every field the expression references.";
|
|
20
25
|
export declare const SECURE_IDENTIFIER_NOTE = "A phone or email field, or a deal partner identifier (the OES # keys oes_number, dpp_oes_raw; the Delancey Street deal ID delancey_deal_id), identifies the record and can never be Secure: isSecure true on one is 422 secure_identifier_refused.";
|
|
21
26
|
/** the server's formula options object, strict */
|
|
22
27
|
export declare const formulaOptionsSchema: z.ZodObject<{
|
|
@@ -35,6 +40,17 @@ export declare const formulaOptionsSchema: z.ZodObject<{
|
|
|
35
40
|
right: string | number;
|
|
36
41
|
format: "number" | "currency" | "percent";
|
|
37
42
|
}>;
|
|
43
|
+
/** (formuladates65b) the server's expression options object, strict; the expression itself is parsed by the server (its 400 carries reason + position) */
|
|
44
|
+
export declare const formulaExpressionOptionsSchema: z.ZodObject<{
|
|
45
|
+
expression: z.ZodString;
|
|
46
|
+
format: z.ZodEnum<["number", "currency", "percent"]>;
|
|
47
|
+
}, "strict", z.ZodTypeAny, {
|
|
48
|
+
format: "number" | "currency" | "percent";
|
|
49
|
+
expression: string;
|
|
50
|
+
}, {
|
|
51
|
+
format: "number" | "currency" | "percent";
|
|
52
|
+
expression: string;
|
|
53
|
+
}>;
|
|
38
54
|
/** create: a formula carries its options object (never required); any other type never takes that object. Returns an error text or null */
|
|
39
55
|
export declare function formulaCreateProblem(p: {
|
|
40
56
|
fieldType?: unknown;
|
|
@@ -18,6 +18,11 @@ export const FORMULA_WRITE_NOTE = "A customFields key that is a FORMULA field (c
|
|
|
18
18
|
export const FORMULA_FILTER_NOTE = "A filter naming a FORMULA custom field is refused: 422 formula_not_filterable (formulas are not filterable in v1).";
|
|
19
19
|
/** the definition-side rules, shared by the create and update tool descriptions */
|
|
20
20
|
export const FORMULA_DEFINITION_NOTE = "fieldType formula (#1292) is a COMPUTED field: options { op: add|sub|mul|div, left: <number field key>, right: <number field key or a number>, format: number|currency|percent }; left and right are number fields of the SAME entity (never the formula itself or another formula); the value is computed at read time (never stored), blank when an input is blank and on a division by zero; every record answer carries it in customFields plus computedFields[key] = { computed: true, readOnly: true, format }. A formula is read-only on every write path (422 formula_read_only), not filterable (422 formula_not_filterable), never required, and an input that is Secure needs a Secure formula (422 formula_secure_input; turning Secure on for an input a non-Secure formula computes from is 409 formula_secure_input naming the formulas). A formula needs a FRESH key (409 formula_key_in_use); malformed options, a non-number / formula / self input or a system-owned key is 422 formula_invalid. Deleting a field a formula computes from is 409 deletion_blocked (the formula in blockers).";
|
|
21
|
+
/** (formuladates65b) the EXPRESSION shape of a formula field, its functions and its counting rules (the server's lib/formula-expression.ts) */
|
|
22
|
+
export const FORMULA_EXPRESSION_MAX = 2000;
|
|
23
|
+
export const FORMULA_FUNCTIONS = ["TODAY", "DAYS_BETWEEN", "WEEKDAYS_BETWEEN", "PERIODS_BETWEEN", "MIN", "MAX", "ROUND", "COALESCE"];
|
|
24
|
+
export const FORMULA_EXPRESSION_INPUT_TYPES = ["number", "text", "textarea", "select", "radio", "date", "datetime"];
|
|
25
|
+
export const FORMULA_EXPRESSION_NOTE = "A formula may instead take options { expression: <text, at most 2000 characters>, format: number|currency|percent }. Grammar: numbers, {field_key}, \"text\", + - * / (also × ÷), parentheses and the functions TODAY(), DAYS_BETWEEN(a, b), WEEKDAYS_BETWEEN(a, b), PERIODS_BETWEEN(start, end, frequency), MIN(...), MAX(...), ROUND(x, digits 0..10), COALESCE(...). Inputs: number, text, textarea, select, radio, date and datetime fields of the SAME entity (never another formula); a text value where a number goes is read as an amount (digits with at most 2 decimals, from 0 up to 100,000,000; \"$\", \",\" and spaces ignored; anything else, a negative or a larger amount is blank). TODAY() is the account's own calendar day (its time-zone setting). DAYS_BETWEEN and WEEKDAYS_BETWEEN count the days AFTER the first date up to and including the second (signed; weekdays = Monday to Friday, no holiday calendar). PERIODS_BETWEEN counts whole periods after the start up to and including the end: the start day itself is no period, a start on or after the end gives 0 (never negative); frequency daily (= weekdays), weekly (days / 7), bi-weekly (days / 14), monthly (whole months from the start, the day clamped to the month's last day) or semi-monthly (twice a month: the start day and 15 days later); an unknown frequency is blank. A blank input not wrapped in COALESCE makes the result blank; divide by zero is blank. Example: MAX(0, {amount_due} - {payment} * MAX(0, PERIODS_BETWEEN({start_date}, TODAY(), {frequency}) - COALESCE({missed}, 0))). An expression the parser refuses is 400 formula_expression_invalid with reason (empty, too_long, unexpected_token, unknown_function, wrong_argument_count, too_deep, too_many_nodes, too_many_references, ...) and position (a 0-based character offset); a value of the wrong kind (a date where a number goes, a number as a frequency, an unknown frequency text) is 422 formula_invalid with reason and position; an input of another type is 422 formula_invalid with allowedInputTypes. The formula is Secure-inherited from every field the expression references.";
|
|
21
26
|
export const SECURE_IDENTIFIER_NOTE = "A phone or email field, or a deal partner identifier (the OES # keys oes_number, dpp_oes_raw; the Delancey Street deal ID delancey_deal_id), identifies the record and can never be Secure: isSecure true on one is 422 secure_identifier_refused.";
|
|
22
27
|
const inputKey = z.string().trim().min(1).max(120).regex(KEY_RE);
|
|
23
28
|
/** the server's formula options object, strict */
|
|
@@ -27,16 +32,22 @@ export const formulaOptionsSchema = z.object({
|
|
|
27
32
|
right: z.union([inputKey, z.number().finite()]),
|
|
28
33
|
format: z.enum(FORMULA_FORMATS),
|
|
29
34
|
}).strict();
|
|
30
|
-
/** the server's
|
|
31
|
-
const
|
|
35
|
+
/** (formuladates65b) the server's expression options object, strict; the expression itself is parsed by the server (its 400 carries reason + position) */
|
|
36
|
+
export const formulaExpressionOptionsSchema = z.object({
|
|
37
|
+
expression: z.string(),
|
|
38
|
+
format: z.enum(FORMULA_FORMATS),
|
|
39
|
+
}).strict();
|
|
40
|
+
const anyFormulaOptions = (o) => formulaOptionsSchema.safeParse(o).success || formulaExpressionOptionsSchema.safeParse(o).success;
|
|
41
|
+
const SHAPES_TEXT = `{ op: ${FORMULA_OPS.join("|")}, left: <field key>, right: <field key or a number>, format: ${FORMULA_FORMATS.join("|")} } or { expression: <text>, format: ${FORMULA_FORMATS.join("|")} }`;
|
|
42
|
+
/** the server's formula option keys (two-operand and expression); its other object shapes (choices, options, numberFormat, currencyCode, allowedDomains, blockedDomains, visibility) never use them */
|
|
43
|
+
const FORMULA_KEYS = ["op", "left", "right", "format", "expression"];
|
|
32
44
|
const isFormulaShaped = (o) => o !== null && typeof o === "object" && !Array.isArray(o) && Object.keys(o).some((k) => FORMULA_KEYS.includes(k));
|
|
33
45
|
/** create: a formula carries its options object (never required); any other type never takes that object. Returns an error text or null */
|
|
34
46
|
export function formulaCreateProblem(p) {
|
|
35
47
|
const isObj = isFormulaShaped(p.options);
|
|
36
48
|
if (p.fieldType === "formula") {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return `A formula needs options { op: ${FORMULA_OPS.join("|")}, left: <field key>, right: <field key or a number>, format: ${FORMULA_FORMATS.join("|")} } and nothing else (422 formula_invalid).`;
|
|
49
|
+
if (!anyFormulaOptions(p.options))
|
|
50
|
+
return `A formula needs options ${SHAPES_TEXT} and nothing else (422 formula_invalid).`;
|
|
40
51
|
if (p.isRequired === true)
|
|
41
52
|
return "A formula is computed, never required (422 formula_invalid).";
|
|
42
53
|
}
|
|
@@ -55,8 +66,8 @@ export function formulaCreateProblem(p) {
|
|
|
55
66
|
}
|
|
56
67
|
/** update: a formula-shaped options object gets the shape check; any other option object (numberFormat, currencyCode, ...) goes to the server untouched */
|
|
57
68
|
export function formulaUpdateProblem(p) {
|
|
58
|
-
if (isFormulaShaped(p.options) && !
|
|
59
|
-
return `A formula's options are
|
|
69
|
+
if (isFormulaShaped(p.options) && !anyFormulaOptions(p.options))
|
|
70
|
+
return `A formula's options are ${SHAPES_TEXT} and nothing else (422 formula_invalid).`;
|
|
60
71
|
return null;
|
|
61
72
|
}
|
|
62
73
|
/** the binding's secureEgress, in the two shapes the server accepts (batch32, per partner): an OBJECT { creditors_relief: string[], delancey_street: string[] } (each list optional,
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generatedAt": "2026-11-
|
|
3
|
-
"toolCount":
|
|
4
|
-
"totalEndpoints":
|
|
2
|
+
"generatedAt": "2026-11-24T21:38:03.704Z",
|
|
3
|
+
"toolCount": 453,
|
|
4
|
+
"totalEndpoints": 1230,
|
|
5
5
|
"counts": {
|
|
6
|
-
"covered":
|
|
6
|
+
"covered": 403,
|
|
7
7
|
"excluded": 376,
|
|
8
8
|
"planned": 451,
|
|
9
9
|
"uncategorized": 0
|
|
@@ -755,6 +755,12 @@
|
|
|
755
755
|
"status": "planned",
|
|
756
756
|
"reason": "execution inspection"
|
|
757
757
|
},
|
|
758
|
+
"POST /api/v1/automation-executions/:id/cancel": {
|
|
759
|
+
"status": "covered",
|
|
760
|
+
"tools": [
|
|
761
|
+
"conduyt_cancel_automation_run"
|
|
762
|
+
]
|
|
763
|
+
},
|
|
758
764
|
"POST /api/v1/automation-executions/:id/recover": {
|
|
759
765
|
"status": "planned",
|
|
760
766
|
"reason": "execution inspection"
|