@dench.com/cli 3.11.16-staging.551 → 3.11.18-staging.567
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/app-sdk.d.ts +76 -18
- package/crm.ts +57 -2
- package/lib/api-schemas.ts +88 -23
- package/lib/app-sdk-catalog.generated.ts +2 -0
- package/lib/command-registry.ts +33 -5
- package/lib/crm-enrichment.ts +18 -5
- package/lib/references.generated.json +12 -12
- package/package.json +1 -1
- package/tools.ts +1 -1
package/app-sdk.d.ts
CHANGED
|
@@ -1166,12 +1166,14 @@ export interface ApiRequests {
|
|
|
1166
1166
|
description?: string;
|
|
1167
1167
|
/** Index for filter/search/sort. */
|
|
1168
1168
|
indexed?: boolean;
|
|
1169
|
-
/** Enrichment binding that lets the field auto-fill
|
|
1169
|
+
/** Enrichment binding that lets the field auto-fill. */
|
|
1170
1170
|
enrichment?: {
|
|
1171
1171
|
category: "people" | "company";
|
|
1172
1172
|
key: string;
|
|
1173
|
-
|
|
1173
|
+
/** Dotted path to the value in the enrichment result. Required. */
|
|
1174
|
+
responsePath?: string;
|
|
1174
1175
|
inputFieldName?: string;
|
|
1176
|
+
[key: string]: unknown;
|
|
1175
1177
|
};
|
|
1176
1178
|
/** Read-only campaign activity boolean on people or lead (through Contact), not an expression. Cannot be required, indexed, enriched or have a default value. */
|
|
1177
1179
|
calculation?: {
|
|
@@ -1194,12 +1196,14 @@ export interface ApiRequests {
|
|
|
1194
1196
|
enumColors?: string[];
|
|
1195
1197
|
enumMultiple?: boolean;
|
|
1196
1198
|
indexed?: boolean;
|
|
1197
|
-
/** Enrichment binding that lets the field auto-fill
|
|
1199
|
+
/** Enrichment binding that lets the field auto-fill. */
|
|
1198
1200
|
enrichment?: {
|
|
1199
1201
|
category: "people" | "company";
|
|
1200
1202
|
key: string;
|
|
1201
|
-
|
|
1203
|
+
/** Dotted path to the value in the enrichment result. Required. */
|
|
1204
|
+
responsePath?: string;
|
|
1202
1205
|
inputFieldName?: string;
|
|
1206
|
+
[key: string]: unknown;
|
|
1203
1207
|
};
|
|
1204
1208
|
clearEnrichment?: boolean;
|
|
1205
1209
|
/** Replace an existing calculation's metric/source. Stored fields cannot be converted; create a new column instead. */
|
|
@@ -2345,6 +2349,23 @@ export interface ApiRequests {
|
|
|
2345
2349
|
"crm.automations.list": Record<string, unknown>;
|
|
2346
2350
|
/** Enable or disable a CRM automation. — `dench crm automations enable|disable` — PATCH /api/v1/crm/automations/{automationId} */
|
|
2347
2351
|
"crm.automations.setEnabled": Record<string, unknown>;
|
|
2352
|
+
/** Start a server-side CSV export of a CRM object into the workspace files (/exports). Returns at once; one export runs per workspace, and a second start returns the running one. — `dench crm exports start` — POST /api/v1/crm/exports */
|
|
2353
|
+
"crm.exports.start": {
|
|
2354
|
+
objectName: string;
|
|
2355
|
+
/** Fields to export, in order. Default: every field except the long-text Notes. */
|
|
2356
|
+
columns?: string[];
|
|
2357
|
+
/** Filter in the crm.query DSL, e.g. {"Status":"Open"} or {"Score":{"$gte":50}}. Field names are case-sensitive. */
|
|
2358
|
+
where?: Record<string, unknown>;
|
|
2359
|
+
/** Personal scope: "me" (the signed-in member / the human behind an agent session), "unassigned", or a member userId or email. Adds one has_any / is_empty rule on the object's assignee user field; rows, totalCount, sums and analytics all follow it. Never saved onto the view. */
|
|
2360
|
+
assignedTo?: string;
|
|
2361
|
+
/** Which `user` field "assigned" means. Default: the analytics owner role, else the task `Assignee`, else a user field named like owner/assignee, else the first user field. */
|
|
2362
|
+
assigneeField?: string;
|
|
2363
|
+
};
|
|
2364
|
+
/** Read a CRM CSV export's progress, and its file path and download link once done. — `dench crm exports get` — GET /api/v1/crm/exports/{jobId} */
|
|
2365
|
+
"crm.exports.get": {
|
|
2366
|
+
/** jobId returned by crm.exports.start. */
|
|
2367
|
+
jobId: string;
|
|
2368
|
+
};
|
|
2348
2369
|
/** List meetings, newest first, with status and participants. — `dench meetings list` — GET /api/v1/meetings */
|
|
2349
2370
|
"meetings.list": {
|
|
2350
2371
|
limit?: number;
|
|
@@ -6345,6 +6366,50 @@ export interface ApiResponses {
|
|
|
6345
6366
|
"crm.templates.removeSampleData": unknown;
|
|
6346
6367
|
"crm.automations.list": unknown;
|
|
6347
6368
|
"crm.automations.setEnabled": unknown;
|
|
6369
|
+
"crm.exports.start": {
|
|
6370
|
+
jobId: string;
|
|
6371
|
+
status: "running" | "done" | "failed";
|
|
6372
|
+
objectName: string;
|
|
6373
|
+
rowsDone: number;
|
|
6374
|
+
/** Estimated total, only for an unfiltered, unscoped export. */
|
|
6375
|
+
totalRows?: number;
|
|
6376
|
+
/** The export stopped at its 50,000-row cap and more records may match. */
|
|
6377
|
+
truncated: boolean;
|
|
6378
|
+
/** Workspace path once done. */
|
|
6379
|
+
filePath?: string;
|
|
6380
|
+
/** Signed link once done. */
|
|
6381
|
+
downloadUrl?: string;
|
|
6382
|
+
bytes?: number;
|
|
6383
|
+
error?: string;
|
|
6384
|
+
/** One-line status to show the person. */
|
|
6385
|
+
message: string;
|
|
6386
|
+
/** start returned the workspace's running export instead. */
|
|
6387
|
+
alreadyRunning?: boolean;
|
|
6388
|
+
createdAt: number;
|
|
6389
|
+
finishedAt?: number;
|
|
6390
|
+
};
|
|
6391
|
+
"crm.exports.get": {
|
|
6392
|
+
jobId: string;
|
|
6393
|
+
status: "running" | "done" | "failed";
|
|
6394
|
+
objectName: string;
|
|
6395
|
+
rowsDone: number;
|
|
6396
|
+
/** Estimated total, only for an unfiltered, unscoped export. */
|
|
6397
|
+
totalRows?: number;
|
|
6398
|
+
/** The export stopped at its 50,000-row cap and more records may match. */
|
|
6399
|
+
truncated: boolean;
|
|
6400
|
+
/** Workspace path once done. */
|
|
6401
|
+
filePath?: string;
|
|
6402
|
+
/** Signed link once done. */
|
|
6403
|
+
downloadUrl?: string;
|
|
6404
|
+
bytes?: number;
|
|
6405
|
+
error?: string;
|
|
6406
|
+
/** One-line status to show the person. */
|
|
6407
|
+
message: string;
|
|
6408
|
+
/** start returned the workspace's running export instead. */
|
|
6409
|
+
alreadyRunning?: boolean;
|
|
6410
|
+
createdAt: number;
|
|
6411
|
+
finishedAt?: number;
|
|
6412
|
+
};
|
|
6348
6413
|
"meetings.list": unknown;
|
|
6349
6414
|
"meetings.transcript.list": unknown;
|
|
6350
6415
|
"meetings.transcript.append": unknown;
|
|
@@ -7961,10 +8026,6 @@ export interface ApiResponses {
|
|
|
7961
8026
|
entities?: Record<string, unknown>[];
|
|
7962
8027
|
[key: string]: unknown;
|
|
7963
8028
|
}[];
|
|
7964
|
-
resolvedSearchType?: string;
|
|
7965
|
-
autopromptString?: string;
|
|
7966
|
-
requestId?: string;
|
|
7967
|
-
costDollars?: Record<string, unknown>;
|
|
7968
8029
|
[key: string]: unknown;
|
|
7969
8030
|
};
|
|
7970
8031
|
"search.contents": {
|
|
@@ -7984,10 +8045,6 @@ export interface ApiResponses {
|
|
|
7984
8045
|
entities?: Record<string, unknown>[];
|
|
7985
8046
|
[key: string]: unknown;
|
|
7986
8047
|
}[];
|
|
7987
|
-
resolvedSearchType?: string;
|
|
7988
|
-
autopromptString?: string;
|
|
7989
|
-
requestId?: string;
|
|
7990
|
-
costDollars?: Record<string, unknown>;
|
|
7991
8048
|
[key: string]: unknown;
|
|
7992
8049
|
};
|
|
7993
8050
|
"search.answer": {
|
|
@@ -8008,7 +8065,6 @@ export interface ApiResponses {
|
|
|
8008
8065
|
entities?: Record<string, unknown>[];
|
|
8009
8066
|
[key: string]: unknown;
|
|
8010
8067
|
}[];
|
|
8011
|
-
costDollars?: Record<string, unknown>;
|
|
8012
8068
|
[key: string]: unknown;
|
|
8013
8069
|
};
|
|
8014
8070
|
"web.scrape": unknown;
|
|
@@ -8113,8 +8169,6 @@ export interface ApiResponses {
|
|
|
8113
8169
|
reconnect?: Record<string, unknown>;
|
|
8114
8170
|
[key: string]: unknown;
|
|
8115
8171
|
}>;
|
|
8116
|
-
/** Deprecated: the unprocessed provider response. Do not depend on it. */
|
|
8117
|
-
raw: unknown;
|
|
8118
8172
|
[key: string]: unknown;
|
|
8119
8173
|
};
|
|
8120
8174
|
"apps.list": unknown;
|
|
@@ -8165,8 +8219,6 @@ export interface ApiResponses {
|
|
|
8165
8219
|
reconnect?: Record<string, unknown>;
|
|
8166
8220
|
[key: string]: unknown;
|
|
8167
8221
|
}>;
|
|
8168
|
-
/** Deprecated: the unprocessed provider response. Do not depend on it. */
|
|
8169
|
-
raw: unknown;
|
|
8170
8222
|
[key: string]: unknown;
|
|
8171
8223
|
};
|
|
8172
8224
|
"tool.connect": {
|
|
@@ -8235,7 +8287,7 @@ export interface ApiResponses {
|
|
|
8235
8287
|
};
|
|
8236
8288
|
"tool.labels.list": {
|
|
8237
8289
|
labels: {
|
|
8238
|
-
|
|
8290
|
+
connectionId: string;
|
|
8239
8291
|
displayName: string;
|
|
8240
8292
|
}[];
|
|
8241
8293
|
};
|
|
@@ -9206,6 +9258,12 @@ export type DenchApiTree = {
|
|
|
9206
9258
|
/** Update many CRM entries. (`dench crm entries update-many`) */
|
|
9207
9259
|
updateMany(args: Req<"crm.entries.updateMany">): Promise<Res<"crm.entries.updateMany">>;
|
|
9208
9260
|
};
|
|
9261
|
+
exports: {
|
|
9262
|
+
/** Read a CRM CSV export's progress, and its file path and download link once done. (`dench crm exports get`) */
|
|
9263
|
+
get(args: Req<"crm.exports.get">): Promise<Res<"crm.exports.get">>;
|
|
9264
|
+
/** Start a server-side CSV export of a CRM object into the workspace files (/exports). Returns at once; one export runs per workspace, and a second start returns the running one. (`dench crm exports start`) */
|
|
9265
|
+
start(args: Req<"crm.exports.start">): Promise<Res<"crm.exports.start">>;
|
|
9266
|
+
};
|
|
9209
9267
|
fields: {
|
|
9210
9268
|
/** Create a CRM field or read-only campaign activity boolean column. (`dench crm fields create`) */
|
|
9211
9269
|
create(args: Req<"crm.fields.create">): Promise<Res<"crm.fields.create">>;
|
package/crm.ts
CHANGED
|
@@ -1116,6 +1116,10 @@ const api = {
|
|
|
1116
1116
|
"functions/crm/automations:setEnabled",
|
|
1117
1117
|
),
|
|
1118
1118
|
},
|
|
1119
|
+
exports: {
|
|
1120
|
+
start: makeFunctionReference<"mutation">("functions/crm/export:start"),
|
|
1121
|
+
get: makeFunctionReference<"query">("functions/crm/export:get"),
|
|
1122
|
+
},
|
|
1119
1123
|
templates: {
|
|
1120
1124
|
listAvailable: makeFunctionReference<"query">(
|
|
1121
1125
|
"functions/crm/templates:listAvailable",
|
|
@@ -1223,6 +1227,8 @@ Example: dench crm aggregate deal --field Stage --sum Amount --json`);
|
|
|
1223
1227
|
return await runImportCommand(ctx);
|
|
1224
1228
|
case "export":
|
|
1225
1229
|
return await runExportCommand(ctx);
|
|
1230
|
+
case "exports":
|
|
1231
|
+
return await runExportsCommand(ctx);
|
|
1226
1232
|
case "transaction":
|
|
1227
1233
|
return await runTransactionCommand(ctx);
|
|
1228
1234
|
case "people":
|
|
@@ -1289,6 +1295,7 @@ const CRM_SUBCOMMANDS = [
|
|
|
1289
1295
|
"batch",
|
|
1290
1296
|
"import",
|
|
1291
1297
|
"export",
|
|
1298
|
+
"exports",
|
|
1292
1299
|
"transaction",
|
|
1293
1300
|
"people",
|
|
1294
1301
|
"companies",
|
|
@@ -3984,6 +3991,49 @@ async function runExportCommand(ctx: CrmCliContext): Promise<void> {
|
|
|
3984
3991
|
);
|
|
3985
3992
|
}
|
|
3986
3993
|
|
|
3994
|
+
/**
|
|
3995
|
+
* `crm exports start|get`: the server-side export. It builds the CSV in the
|
|
3996
|
+
* workspace files (/exports) as a background job, so it works without a
|
|
3997
|
+
* local filesystem; `crm export` still writes to stdout here.
|
|
3998
|
+
*/
|
|
3999
|
+
async function runExportsCommand(ctx: CrmCliContext): Promise<void> {
|
|
4000
|
+
const verb = ctx.args.shift();
|
|
4001
|
+
if (verb === "start") {
|
|
4002
|
+
const objectName = shift(ctx.args, "object name");
|
|
4003
|
+
const columns = getFlag(ctx.args, "--columns")
|
|
4004
|
+
?.split(",")
|
|
4005
|
+
.map((name) => name.trim())
|
|
4006
|
+
.filter(Boolean);
|
|
4007
|
+
const whereRaw = getFlag(ctx.args, "--where");
|
|
4008
|
+
const where =
|
|
4009
|
+
whereRaw === undefined
|
|
4010
|
+
? undefined
|
|
4011
|
+
: requireNonEmptyJsonRecord(parseJson(whereRaw), "--where");
|
|
4012
|
+
const scope = resolveAssigneeScopeFlags(ctx.args);
|
|
4013
|
+
assertNoUnknownFlags(ctx.args, "crm exports start");
|
|
4014
|
+
out(
|
|
4015
|
+
ctx,
|
|
4016
|
+
await callMutation(ctx, api.exports.start, {
|
|
4017
|
+
objectName,
|
|
4018
|
+
...(columns?.length ? { columns } : {}),
|
|
4019
|
+
// $-operators cannot be Convex object keys: send the filter as JSON.
|
|
4020
|
+
...(where ? { filterJson: JSON.stringify(where) } : {}),
|
|
4021
|
+
...scope,
|
|
4022
|
+
}),
|
|
4023
|
+
);
|
|
4024
|
+
return;
|
|
4025
|
+
}
|
|
4026
|
+
if (verb === "get") {
|
|
4027
|
+
const jobId = shift(ctx.args, "export job id");
|
|
4028
|
+
assertNoUnknownFlags(ctx.args, "crm exports get");
|
|
4029
|
+
out(ctx, await callQuery(ctx, api.exports.get, { jobId }));
|
|
4030
|
+
return;
|
|
4031
|
+
}
|
|
4032
|
+
throw new CrmCliError(
|
|
4033
|
+
"Usage: dench crm exports start <object> [--columns A,B] [--where '<JSON>'] [--assigned-to me] | dench crm exports get <jobId>",
|
|
4034
|
+
);
|
|
4035
|
+
}
|
|
4036
|
+
|
|
3987
4037
|
export function parseCsv(
|
|
3988
4038
|
text: string,
|
|
3989
4039
|
colMap: Record<string, string>,
|
|
@@ -4262,8 +4312,8 @@ function readFieldEnrichment(
|
|
|
4262
4312
|
typeof candidate.category === "string" ? candidate.category : undefined,
|
|
4263
4313
|
);
|
|
4264
4314
|
const key = typeof candidate.key === "string" ? candidate.key : undefined;
|
|
4265
|
-
const apolloPath
|
|
4266
|
-
|
|
4315
|
+
const storedPath = candidate.apolloPath ?? candidate.responsePath;
|
|
4316
|
+
const apolloPath = typeof storedPath === "string" ? storedPath : undefined;
|
|
4267
4317
|
const inputFieldName =
|
|
4268
4318
|
typeof candidate.inputFieldName === "string"
|
|
4269
4319
|
? candidate.inputFieldName
|
|
@@ -5291,6 +5341,11 @@ Import / export:
|
|
|
5291
5341
|
dench crm export <object> --format csv|jsonl [--limit N]
|
|
5292
5342
|
Pages with a real cursor and verifies no duplicate ids before
|
|
5293
5343
|
emitting; a summary (exportedCount/uniqueIds) is printed to stderr.
|
|
5344
|
+
dench crm exports start <object> [--columns Name,Email] [--where '<JSON>'] [--assigned-to me|unassigned|<userId|email>] [--assignee-field <Field>]
|
|
5345
|
+
Builds the CSV on the server into the workspace files (/exports) and
|
|
5346
|
+
returns a jobId at once. Up to 50,000 rows; one export per workspace.
|
|
5347
|
+
dench crm exports get <jobId>
|
|
5348
|
+
Progress; once done, the file path and a download link.
|
|
5294
5349
|
For calls with transcripts / action items / attendees, use
|
|
5295
5350
|
\`dench meetings import\` instead — same flags, plus the side tables.
|
|
5296
5351
|
|
package/lib/api-schemas.ts
CHANGED
|
@@ -348,22 +348,53 @@ const assigneeScopeResponse = z
|
|
|
348
348
|
.nullable()
|
|
349
349
|
.describe("The personal assignee scope that was applied, or null.");
|
|
350
350
|
|
|
351
|
+
/** One CRM CSV export's state (crm.exports.start / crm.exports.get). */
|
|
352
|
+
const crmExportStatus = z.object({
|
|
353
|
+
jobId: z.string(),
|
|
354
|
+
status: z.enum(["running", "done", "failed"]),
|
|
355
|
+
objectName: z.string(),
|
|
356
|
+
rowsDone: z.number(),
|
|
357
|
+
totalRows: z
|
|
358
|
+
.number()
|
|
359
|
+
.optional()
|
|
360
|
+
.describe("Estimated total, only for an unfiltered, unscoped export."),
|
|
361
|
+
truncated: z
|
|
362
|
+
.boolean()
|
|
363
|
+
.describe(
|
|
364
|
+
"The export stopped at its 50,000-row cap and more records may match.",
|
|
365
|
+
),
|
|
366
|
+
filePath: z.string().optional().describe("Workspace path once done."),
|
|
367
|
+
downloadUrl: z.string().optional().describe("Signed link once done."),
|
|
368
|
+
bytes: z.number().optional(),
|
|
369
|
+
error: z.string().optional(),
|
|
370
|
+
message: z.string().describe("One-line status to show the person."),
|
|
371
|
+
alreadyRunning: z
|
|
372
|
+
.boolean()
|
|
373
|
+
.optional()
|
|
374
|
+
.describe("start returned the workspace's running export instead."),
|
|
375
|
+
createdAt: z.number(),
|
|
376
|
+
finishedAt: z.number().optional(),
|
|
377
|
+
});
|
|
378
|
+
|
|
351
379
|
const cellValue = z
|
|
352
380
|
.unknown()
|
|
353
381
|
.describe(
|
|
354
382
|
"Cell value. Enum=option string, tags=string array, user=one member userId or a userId array, relation=related entry id, boolean=true/false.",
|
|
355
383
|
);
|
|
356
384
|
|
|
385
|
+
// `passthrough` keeps the pre-rename key older CLIs still send.
|
|
357
386
|
const enrichmentConfig = z
|
|
358
387
|
.object({
|
|
359
388
|
category: z.enum(["people", "company"]),
|
|
360
389
|
key: z.string(),
|
|
361
|
-
|
|
390
|
+
responsePath: z
|
|
391
|
+
.string()
|
|
392
|
+
.optional()
|
|
393
|
+
.describe("Dotted path to the value in the enrichment result. Required."),
|
|
362
394
|
inputFieldName: z.string().optional(),
|
|
363
395
|
})
|
|
364
|
-
.
|
|
365
|
-
|
|
366
|
-
);
|
|
396
|
+
.passthrough()
|
|
397
|
+
.describe("Enrichment binding that lets the field auto-fill.");
|
|
367
398
|
|
|
368
399
|
const crmOp = z
|
|
369
400
|
.union([
|
|
@@ -1904,10 +1935,6 @@ const exaResultItem = z
|
|
|
1904
1935
|
const exaSearchResponse = z
|
|
1905
1936
|
.object({
|
|
1906
1937
|
results: z.array(exaResultItem),
|
|
1907
|
-
resolvedSearchType: z.string().optional(),
|
|
1908
|
-
autopromptString: z.string().optional(),
|
|
1909
|
-
requestId: z.string().optional(),
|
|
1910
|
-
costDollars: z.record(z.string(), z.unknown()).optional(),
|
|
1911
1938
|
})
|
|
1912
1939
|
.passthrough()
|
|
1913
1940
|
.describe("A web search response.");
|
|
@@ -1916,7 +1943,6 @@ const exaAnswerResponse = z
|
|
|
1916
1943
|
.object({
|
|
1917
1944
|
answer: z.string(),
|
|
1918
1945
|
citations: z.array(exaResultItem).optional(),
|
|
1919
|
-
costDollars: z.record(z.string(), z.unknown()).optional(),
|
|
1920
1946
|
})
|
|
1921
1947
|
.passthrough()
|
|
1922
1948
|
.describe(
|
|
@@ -1951,7 +1977,7 @@ const imageEnvelope = z
|
|
|
1951
1977
|
.optional(),
|
|
1952
1978
|
})
|
|
1953
1979
|
.passthrough()
|
|
1954
|
-
.describe("
|
|
1980
|
+
.describe("Generated or edited image, saved to the workspace.");
|
|
1955
1981
|
|
|
1956
1982
|
const composioConnection = z
|
|
1957
1983
|
.object({
|
|
@@ -1980,11 +2006,6 @@ const composioConnectionsResponse = z
|
|
|
1980
2006
|
connections: z
|
|
1981
2007
|
.array(composioConnection)
|
|
1982
2008
|
.describe("Alias of items for older clients."),
|
|
1983
|
-
raw: z
|
|
1984
|
-
.unknown()
|
|
1985
|
-
.describe(
|
|
1986
|
-
"Deprecated: the unprocessed provider response. Do not depend on it.",
|
|
1987
|
-
),
|
|
1988
2009
|
})
|
|
1989
2010
|
.passthrough();
|
|
1990
2011
|
|
|
@@ -4824,6 +4845,27 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
|
|
|
4824
4845
|
"Number field to sum/avg per bucket (e.g. Amount grouped by Stage). Defaults to the group field itself.",
|
|
4825
4846
|
),
|
|
4826
4847
|
}),
|
|
4848
|
+
"crm.exports.start": z.object({
|
|
4849
|
+
objectName: z.string(),
|
|
4850
|
+
columns: z
|
|
4851
|
+
.array(z.string().min(1))
|
|
4852
|
+
.min(1)
|
|
4853
|
+
.max(100)
|
|
4854
|
+
.optional()
|
|
4855
|
+
.describe(
|
|
4856
|
+
"Fields to export, in order. Default: every field except the long-text Notes.",
|
|
4857
|
+
),
|
|
4858
|
+
where: z
|
|
4859
|
+
.record(z.string(), z.unknown())
|
|
4860
|
+
.optional()
|
|
4861
|
+
.describe(
|
|
4862
|
+
'Filter in the crm.query DSL, e.g. {"Status":"Open"} or {"Score":{"$gte":50}}. Field names are case-sensitive.',
|
|
4863
|
+
),
|
|
4864
|
+
...assigneeScopeRequest,
|
|
4865
|
+
}),
|
|
4866
|
+
"crm.exports.get": z.object({
|
|
4867
|
+
jobId: z.string().describe("jobId returned by crm.exports.start."),
|
|
4868
|
+
}),
|
|
4827
4869
|
"crm.enrich.cell": z.object({
|
|
4828
4870
|
objectName: z.string(),
|
|
4829
4871
|
entryId: z.string(),
|
|
@@ -6347,6 +6389,8 @@ export const responseSchemas: Record<string, ZodTypeAny> = {
|
|
|
6347
6389
|
"me.avatar.uploadUrl": z.string().describe("One-time upload URL."),
|
|
6348
6390
|
"me.avatar.set": z.object({ image: z.string() }),
|
|
6349
6391
|
"me.avatar.clear": okResponse,
|
|
6392
|
+
"crm.exports.start": crmExportStatus,
|
|
6393
|
+
"crm.exports.get": crmExportStatus,
|
|
6350
6394
|
"crm.reports.generate": z.object({
|
|
6351
6395
|
spec: z.object({
|
|
6352
6396
|
objectName: z.string(),
|
|
@@ -6707,7 +6751,7 @@ export const responseSchemas: Record<string, ZodTypeAny> = {
|
|
|
6707
6751
|
.describe("Delete response."),
|
|
6708
6752
|
"tool.labels.list": z.object({
|
|
6709
6753
|
labels: z.array(
|
|
6710
|
-
z.object({
|
|
6754
|
+
z.object({ connectionId: z.string(), displayName: z.string() }),
|
|
6711
6755
|
),
|
|
6712
6756
|
}),
|
|
6713
6757
|
"tool.label.set": z.object({
|
|
@@ -6811,6 +6855,13 @@ export const convexExtras: Record<string, ConvexExtras> = {
|
|
|
6811
6855
|
"crm.search": {
|
|
6812
6856
|
withReferencesFunctionName: "functions/crm/query:searchWithReferences",
|
|
6813
6857
|
},
|
|
6858
|
+
// `$` operators cannot be Convex object keys: the filter travels as JSON.
|
|
6859
|
+
"crm.exports.start": {
|
|
6860
|
+
transformArgs: ({ where, ...input }) => ({
|
|
6861
|
+
...input,
|
|
6862
|
+
...(where !== undefined ? { filterJson: JSON.stringify(where) } : {}),
|
|
6863
|
+
}),
|
|
6864
|
+
},
|
|
6814
6865
|
|
|
6815
6866
|
"campaigns.steps.replace": {
|
|
6816
6867
|
transformArgs: ({ allowSingleBraces: _allowSingleBraces, ...input }) =>
|
|
@@ -7124,6 +7175,11 @@ export const requestExamples: Record<string, unknown> = {
|
|
|
7124
7175
|
},
|
|
7125
7176
|
"crm.comments.update": { body: "Kickoff went well — proposal sent." },
|
|
7126
7177
|
"crm.watch.set": { watching: true },
|
|
7178
|
+
"crm.exports.start": {
|
|
7179
|
+
objectName: "people",
|
|
7180
|
+
columns: ["Name", "Email", "Status"],
|
|
7181
|
+
where: { Status: "Customer" },
|
|
7182
|
+
},
|
|
7127
7183
|
"crm.tasks.createForEntry": {
|
|
7128
7184
|
name: "Send proposal",
|
|
7129
7185
|
assigneeUserId: "user_bob",
|
|
@@ -7773,6 +7829,20 @@ export const responseExamples: Record<string, unknown> = {
|
|
|
7773
7829
|
updatedAt: 1765612800000,
|
|
7774
7830
|
},
|
|
7775
7831
|
"crm.objects.create": { id: "obj_lead01" },
|
|
7832
|
+
"crm.exports.get": {
|
|
7833
|
+
jobId: "k57export0001",
|
|
7834
|
+
status: "done",
|
|
7835
|
+
objectName: "people",
|
|
7836
|
+
rowsDone: 1250,
|
|
7837
|
+
truncated: false,
|
|
7838
|
+
filePath: "/exports/people-2026-10-26-rt0001.csv",
|
|
7839
|
+
downloadUrl: "https://files.example.com/storage/0b1c2d3e",
|
|
7840
|
+
bytes: 184320,
|
|
7841
|
+
message:
|
|
7842
|
+
"Exported 1,250 rows of people to /exports/people-2026-10-26-rt0001.csv.",
|
|
7843
|
+
createdAt: 1793016000000,
|
|
7844
|
+
finishedAt: 1793016042000,
|
|
7845
|
+
},
|
|
7776
7846
|
"crm.objects.update": { ok: true },
|
|
7777
7847
|
"crm.objects.rename": { ok: true },
|
|
7778
7848
|
"crm.objects.delete": { ok: true },
|
|
@@ -8660,9 +8730,6 @@ export const responseExamples: Record<string, unknown> = {
|
|
|
8660
8730
|
id: "https://example.com/ai-crm",
|
|
8661
8731
|
},
|
|
8662
8732
|
],
|
|
8663
|
-
resolvedSearchType: "neural",
|
|
8664
|
-
requestId: "req_abc123",
|
|
8665
|
-
costDollars: { total: 0.005 },
|
|
8666
8733
|
},
|
|
8667
8734
|
"search.contents": {
|
|
8668
8735
|
results: [
|
|
@@ -8673,7 +8740,6 @@ export const responseExamples: Record<string, unknown> = {
|
|
|
8673
8740
|
summary: "AI CRMs automate lead routing.",
|
|
8674
8741
|
},
|
|
8675
8742
|
],
|
|
8676
|
-
costDollars: { total: 0.002 },
|
|
8677
8743
|
},
|
|
8678
8744
|
"search.answer": {
|
|
8679
8745
|
answer: "Dench is an AI agent workspace with a built-in CRM.",
|
|
@@ -8684,7 +8750,6 @@ export const responseExamples: Record<string, unknown> = {
|
|
|
8684
8750
|
id: "https://www.dench.com",
|
|
8685
8751
|
},
|
|
8686
8752
|
],
|
|
8687
|
-
costDollars: { total: 0.005 },
|
|
8688
8753
|
},
|
|
8689
8754
|
"image.generate": {
|
|
8690
8755
|
ok: true,
|
|
@@ -8959,11 +9024,11 @@ export const responseExamples: Record<string, unknown> = {
|
|
|
8959
9024
|
bootstrap: { completed: false, template: "Welcome! Let's set up." },
|
|
8960
9025
|
},
|
|
8961
9026
|
"agentConfig.model.default": {
|
|
8962
|
-
defaultChatModelId: "
|
|
9027
|
+
defaultChatModelId: "model_default",
|
|
8963
9028
|
},
|
|
8964
9029
|
"agentConfig.model.thread": {
|
|
8965
9030
|
threadId: "th_abc123",
|
|
8966
|
-
modelOverride: "
|
|
9031
|
+
modelOverride: "model_alternate",
|
|
8967
9032
|
},
|
|
8968
9033
|
"agentConfig.daily.today": {
|
|
8969
9034
|
agentConfig: {
|
|
@@ -322,6 +322,8 @@ export const APP_SDK_OPERATIONS: readonly AppSdkOperationInfo[] = [
|
|
|
322
322
|
{"id":"crm.templates.removeSampleData","group":"crm","summary":"Delete a CRM template's sample rows (tagged \"Sample\"); schema, views, and automations stay.","cli":"dench crm templates remove-sample-data","method":"POST","path":"/crm/templates/{templateId}/remove-sample-data","permission":"crm:write","pathParams":["templateId"]},
|
|
323
323
|
{"id":"crm.automations.list","group":"crm","summary":"List deterministic CRM automations (rules that fire inside entry writes, e.g. qualified prospect → opportunity).","cli":"dench crm automations list","method":"GET","path":"/crm/automations","permission":"crm:read","pathParams":[]},
|
|
324
324
|
{"id":"crm.automations.setEnabled","group":"crm","summary":"Enable or disable a CRM automation.","cli":"dench crm automations enable|disable","method":"PATCH","path":"/crm/automations/{automationId}","permission":"crm:write","pathParams":["automationId"]},
|
|
325
|
+
{"id":"crm.exports.start","group":"crm","summary":"Start a server-side CSV export of a CRM object into the workspace files (/exports). Returns at once; one export runs per workspace, and a second start returns the running one.","cli":"dench crm exports start","method":"POST","path":"/crm/exports","permission":"crm:write","pathParams":[]},
|
|
326
|
+
{"id":"crm.exports.get","group":"crm","summary":"Read a CRM CSV export's progress, and its file path and download link once done.","cli":"dench crm exports get","method":"GET","path":"/crm/exports/{jobId}","permission":"crm:read","pathParams":["jobId"]},
|
|
325
327
|
{"id":"meetings.list","group":"meetings","summary":"List meetings, newest first, with status and participants.","cli":"dench meetings list","method":"GET","path":"/meetings","permission":"meetings:read","pathParams":[]},
|
|
326
328
|
{"id":"meetings.transcript.list","group":"meetings","summary":"Read a meeting's transcript, in order, one page at a time.","cli":"dench meetings transcript get","method":"GET","path":"/meetings/{meetingEntryId}/transcript","permission":"meetings:read","pathParams":["meetingEntryId"]},
|
|
327
329
|
{"id":"meetings.transcript.append","group":"meetings","summary":"Append up to 500 transcript segments to a meeting (speakers with an email link to existing people).","cli":"dench meetings transcript set","method":"POST","path":"/meetings/{meetingEntryId}/transcript","permission":"meetings:write","pathParams":["meetingEntryId"]},
|
package/lib/command-registry.ts
CHANGED
|
@@ -13,11 +13,12 @@ export type ConvexOperation = {
|
|
|
13
13
|
tokenArg?: "sessionToken" | "apiKey";
|
|
14
14
|
/**
|
|
15
15
|
* With `tokenArg: "apiKey"`: the Convex function validates a `dch_agent_*`
|
|
16
|
-
* session passed as `apiKey` itself (org-scoped, like CRM reads
|
|
17
|
-
* agent session goes through as-is instead of being
|
|
18
|
-
* workspace gateway key. The narrow key a
|
|
19
|
-
* session (MCP, Dench Code
|
|
20
|
-
*
|
|
16
|
+
* session passed as `apiKey` itself (org-scoped, like CRM reads and
|
|
17
|
+
* writes), so an agent session goes through as-is instead of being
|
|
18
|
+
* exchanged for the workspace gateway key. The narrow key a
|
|
19
|
+
* `connectedAppAccess: "none"` session (MCP, Dench Code, the direct chat
|
|
20
|
+
* harness) exchanges for carries no `files:*` scope. Workspace file
|
|
21
|
+
* operations only: the CLI already calls these functions with the session.
|
|
21
22
|
*/
|
|
22
23
|
agentSessionAsApiKey?: true;
|
|
23
24
|
includeRunId?: boolean;
|
|
@@ -3483,6 +3484,30 @@ const rawApiOperations = [
|
|
|
3483
3484
|
"Writes a CSV to the caller's local filesystem. Over the API, call POST /crm/query and format CSV client-side.",
|
|
3484
3485
|
),
|
|
3485
3486
|
}),
|
|
3487
|
+
op({
|
|
3488
|
+
id: "crm.exports.start",
|
|
3489
|
+
group: "crm",
|
|
3490
|
+
summary:
|
|
3491
|
+
"Start a server-side CSV export of a CRM object into the workspace files (/exports). Returns at once; one export runs per workspace, and a second start returns the running one.",
|
|
3492
|
+
cli: "dench crm exports start",
|
|
3493
|
+
method: "POST",
|
|
3494
|
+
path: "/crm/exports",
|
|
3495
|
+
requestSchema: anyObject,
|
|
3496
|
+
responseSchema: anyResponse,
|
|
3497
|
+
backend: convex("mutation", "functions/crm/export:start"),
|
|
3498
|
+
}),
|
|
3499
|
+
op({
|
|
3500
|
+
id: "crm.exports.get",
|
|
3501
|
+
group: "crm",
|
|
3502
|
+
summary:
|
|
3503
|
+
"Read a CRM CSV export's progress, and its file path and download link once done.",
|
|
3504
|
+
cli: "dench crm exports get",
|
|
3505
|
+
method: "GET",
|
|
3506
|
+
path: "/crm/exports/{jobId}",
|
|
3507
|
+
requestSchema: noBody,
|
|
3508
|
+
responseSchema: anyResponse,
|
|
3509
|
+
backend: convex("query", "functions/crm/export:get"),
|
|
3510
|
+
}),
|
|
3486
3511
|
|
|
3487
3512
|
// Meetings. A meeting is an ordinary CRM record (`/crm/objects/meeting/…`
|
|
3488
3513
|
// creates, updates and deletes it); these endpoints reach the side tables
|
|
@@ -4965,6 +4990,7 @@ const rawApiOperations = [
|
|
|
4965
4990
|
responseSchema: anyResponse,
|
|
4966
4991
|
backend: convex("action", "functions/files:editFileFromUI", "bearer", {
|
|
4967
4992
|
tokenArg: "apiKey",
|
|
4993
|
+
agentSessionAsApiKey: true,
|
|
4968
4994
|
}),
|
|
4969
4995
|
}),
|
|
4970
4996
|
op({
|
|
@@ -4994,6 +5020,7 @@ const rawApiOperations = [
|
|
|
4994
5020
|
responseSchema: anyResponse,
|
|
4995
5021
|
backend: convex("mutation", "functions/files:deleteFile", "bearer", {
|
|
4996
5022
|
tokenArg: "apiKey",
|
|
5023
|
+
agentSessionAsApiKey: true,
|
|
4997
5024
|
}),
|
|
4998
5025
|
}),
|
|
4999
5026
|
op({
|
|
@@ -5019,6 +5046,7 @@ const rawApiOperations = [
|
|
|
5019
5046
|
responseSchema: anyResponse,
|
|
5020
5047
|
backend: convex("mutation", "functions/files:recordDirCreate", "bearer", {
|
|
5021
5048
|
tokenArg: "apiKey",
|
|
5049
|
+
agentSessionAsApiKey: true,
|
|
5022
5050
|
}),
|
|
5023
5051
|
}),
|
|
5024
5052
|
op({
|
package/lib/crm-enrichment.ts
CHANGED
|
@@ -121,7 +121,11 @@ export const PEOPLE_ENRICHMENT_COLUMNS: readonly EnrichmentColumnDef[] = [
|
|
|
121
121
|
fieldType: "url",
|
|
122
122
|
apolloPath: "person.linkedin_url",
|
|
123
123
|
requiredFields: ["linkedinID"],
|
|
124
|
-
extractionFallbacks: [
|
|
124
|
+
extractionFallbacks: [
|
|
125
|
+
"linkedin_url",
|
|
126
|
+
"URLs.linkedin",
|
|
127
|
+
"person.URLs.linkedin",
|
|
128
|
+
],
|
|
125
129
|
},
|
|
126
130
|
{
|
|
127
131
|
label: "Twitter URL",
|
|
@@ -254,7 +258,8 @@ export function findEnrichmentColumn(args: {
|
|
|
254
258
|
columns.find((column) => {
|
|
255
259
|
return (
|
|
256
260
|
(args.key !== undefined && column.key === args.key) ||
|
|
257
|
-
(args.apolloPath !== undefined &&
|
|
261
|
+
(args.apolloPath !== undefined &&
|
|
262
|
+
column.apolloPath === args.apolloPath) ||
|
|
258
263
|
(normalizedLabel !== undefined &&
|
|
259
264
|
column.label.toLowerCase() === normalizedLabel)
|
|
260
265
|
);
|
|
@@ -387,13 +392,20 @@ export function parseEnrichmentMeta(
|
|
|
387
392
|
const enrichment = (parsed as { enrichment?: unknown }).enrichment;
|
|
388
393
|
if (!enrichment || typeof enrichment !== "object") return null;
|
|
389
394
|
const meta = enrichment as Record<string, unknown>;
|
|
395
|
+
// The API returns the path as `responsePath`; older servers and the
|
|
396
|
+
// stored shape use `apolloPath`.
|
|
397
|
+
const apolloPath = meta.apolloPath ?? meta.responsePath;
|
|
390
398
|
if (
|
|
391
399
|
(meta.category === "people" || meta.category === "company") &&
|
|
392
400
|
typeof meta.key === "string" &&
|
|
393
|
-
typeof
|
|
401
|
+
typeof apolloPath === "string" &&
|
|
394
402
|
typeof meta.inputFieldName === "string"
|
|
395
403
|
) {
|
|
396
|
-
|
|
404
|
+
const { responsePath: _responsePath, ...stored } = meta;
|
|
405
|
+
return {
|
|
406
|
+
...(parsed as Record<string, unknown>),
|
|
407
|
+
enrichment: { ...stored, apolloPath },
|
|
408
|
+
} as EnrichmentFieldMeta;
|
|
397
409
|
}
|
|
398
410
|
} catch {
|
|
399
411
|
// Not enrichment metadata.
|
|
@@ -450,7 +462,8 @@ function computeFullName(payload: Record<string, unknown>): string | null {
|
|
|
450
462
|
return explicit.trim();
|
|
451
463
|
}
|
|
452
464
|
const parts = [person.first_name, person.last_name].filter(
|
|
453
|
-
(part): part is string =>
|
|
465
|
+
(part): part is string =>
|
|
466
|
+
typeof part === "string" && part.trim().length > 0,
|
|
454
467
|
);
|
|
455
468
|
return parts.length > 0 ? parts.join(" ") : null;
|
|
456
469
|
}
|