@dench.com/cli 3.11.37-staging.815 → 3.11.39-staging.859
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 +2 -2
- package/cron.ts +36 -16
- package/dench.ts +1 -0
- package/lib/app-sdk-catalog.generated.ts +1 -1
- package/lib/command-registry.ts +5 -1
- package/lib/references.generated.json +10 -10
- package/package.json +1 -1
package/app-sdk.d.ts
CHANGED
|
@@ -3560,7 +3560,7 @@ export interface ApiRequests {
|
|
|
3560
3560
|
account?: string;
|
|
3561
3561
|
model?: string;
|
|
3562
3562
|
};
|
|
3563
|
-
/** Run an external tool action. SLACK_* slugs (SLACK_SEND_MESSAGE with Block Kit blocks/buttons, SLACK_FETCH_HISTORY, SLACK_LIST_CHANNELS, …) run through Dench's in-house Slack app install — any channel in the connected workspace — and are always preferred over any third-party Slack connection. — `dench tool run` — POST /api/v1/tools/run */
|
|
3563
|
+
/** Run an external tool action. SLACK_* slugs (SLACK_SEND_MESSAGE with Block Kit blocks/buttons, SLACK_FETCH_HISTORY, SLACK_LIST_CHANNELS, …) run through Dench's in-house Slack app install — any channel in the connected workspace — and are always preferred over any third-party Slack connection. Slack writes (send, react, upload, edit, delete) are shared-only: they act as the shared Dench bot, so a personal CLI session or chat is refused with `slack_shared_only`; ask Dench in Slack, or create a shared Slack automation there. — `dench tool run` — POST /api/v1/tools/run */
|
|
3564
3564
|
"tool.run": {
|
|
3565
3565
|
/** Execution ref from a prior search, OR pass session_id+tool_slug. */
|
|
3566
3566
|
execution_ref?: string;
|
|
@@ -9792,7 +9792,7 @@ export type DenchApiTree = {
|
|
|
9792
9792
|
/** List human names given to connected accounts. (`dench tool labels`) */
|
|
9793
9793
|
list(args?: Req<"tool.labels.list">): Promise<Res<"tool.labels.list">>;
|
|
9794
9794
|
};
|
|
9795
|
-
/** Run an external tool action. SLACK_* slugs (SLACK_SEND_MESSAGE with Block Kit blocks/buttons, SLACK_FETCH_HISTORY, SLACK_LIST_CHANNELS, …) run through Dench's in-house Slack app install — any channel in the connected workspace — and are always preferred over any third-party Slack connection. (`dench tool run`) */
|
|
9795
|
+
/** Run an external tool action. SLACK_* slugs (SLACK_SEND_MESSAGE with Block Kit blocks/buttons, SLACK_FETCH_HISTORY, SLACK_LIST_CHANNELS, …) run through Dench's in-house Slack app install — any channel in the connected workspace — and are always preferred over any third-party Slack connection. Slack writes (send, react, upload, edit, delete) are shared-only: they act as the shared Dench bot, so a personal CLI session or chat is refused with `slack_shared_only`; ask Dench in Slack, or create a shared Slack automation there. (`dench tool run`) */
|
|
9796
9796
|
run(args: Req<"tool.run">): Promise<Res<"tool.run">>;
|
|
9797
9797
|
/** Search for external tool actions. (`dench tool search`) */
|
|
9798
9798
|
search(args: Req<"tool.search">): Promise<Res<"tool.search">>;
|
package/cron.ts
CHANGED
|
@@ -64,6 +64,12 @@ type CronCliContext = {
|
|
|
64
64
|
args: string[];
|
|
65
65
|
jsonOutput: boolean;
|
|
66
66
|
sessionToken?: string;
|
|
67
|
+
/**
|
|
68
|
+
* API origin of the backend this invocation targets (`--staging`, `--prod`,
|
|
69
|
+
* `--host`, the saved default, or the sandbox's `DENCH_API_URL`) — the same
|
|
70
|
+
* value every other CLI command uses (`runtime.host`).
|
|
71
|
+
*/
|
|
72
|
+
apiBase?: string;
|
|
67
73
|
};
|
|
68
74
|
|
|
69
75
|
function shift(args: string[], expected: string): string {
|
|
@@ -89,15 +95,24 @@ function out(ctx: CronCliContext, value: unknown): void {
|
|
|
89
95
|
|
|
90
96
|
// ─── Auth helpers (mirror cli/agent.ts shape) ─────────────────────────────
|
|
91
97
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
/**
|
|
99
|
+
* REST origin for cron routes that live in Next (run-now, delete, secret,
|
|
100
|
+
* events, app/CRM create, the printed webhook URL). Env overrides win, then
|
|
101
|
+
* the backend the CLI resolved for this invocation. There is deliberately no
|
|
102
|
+
* localhost (or production) default: a missing origin is an error, never a
|
|
103
|
+
* silent jump to another tier (DEN-238).
|
|
104
|
+
*/
|
|
105
|
+
export function getApiBase(ctx: Pick<CronCliContext, "apiBase">): string {
|
|
106
|
+
let base =
|
|
107
|
+
process.env.DENCH_API_URL?.trim() ||
|
|
108
|
+
process.env.DENCH_BASE_URL?.trim() ||
|
|
109
|
+
ctx.apiBase?.trim() ||
|
|
110
|
+
"";
|
|
111
|
+
// Strip trailing slashes without a backtracking-prone regex.
|
|
112
|
+
while (base.endsWith("/")) base = base.slice(0, -1);
|
|
98
113
|
if (!base) {
|
|
99
114
|
throw new CronCliError(
|
|
100
|
-
"
|
|
115
|
+
"Could not resolve the Dench API host. Pass --staging, --prod or --host <url>, or set DENCH_API_URL.",
|
|
101
116
|
);
|
|
102
117
|
}
|
|
103
118
|
return base;
|
|
@@ -489,7 +504,7 @@ async function runCreate(ctx: CronCliContext): Promise<void> {
|
|
|
489
504
|
}
|
|
490
505
|
out(ctx, {
|
|
491
506
|
...created,
|
|
492
|
-
webhookUrl: automationWebhookUrl(created.jobId),
|
|
507
|
+
webhookUrl: automationWebhookUrl(ctx, created.jobId),
|
|
493
508
|
webhookAccess: "open",
|
|
494
509
|
note: "Live now — plain POSTs to webhookUrl fire this automation. Keep the URL private. `dench cron secret <jobId>` turns on HMAC signing.",
|
|
495
510
|
});
|
|
@@ -498,8 +513,11 @@ async function runCreate(ctx: CronCliContext): Promise<void> {
|
|
|
498
513
|
out(ctx, created);
|
|
499
514
|
}
|
|
500
515
|
|
|
501
|
-
function automationWebhookUrl(
|
|
502
|
-
|
|
516
|
+
function automationWebhookUrl(
|
|
517
|
+
ctx: Pick<CronCliContext, "apiBase">,
|
|
518
|
+
jobId: string,
|
|
519
|
+
): string {
|
|
520
|
+
return `${getApiBase(ctx)}/api/webhooks/automation/${encodeURIComponent(jobId)}`;
|
|
503
521
|
}
|
|
504
522
|
|
|
505
523
|
/**
|
|
@@ -515,7 +533,7 @@ async function mintAutomationSecret(
|
|
|
515
533
|
webhookSecret: string | null;
|
|
516
534
|
webhookAccess: "signed";
|
|
517
535
|
}> {
|
|
518
|
-
const url = `${getApiBase()}/api/cron/jobs/${encodeURIComponent(jobId)}/webhook-signing`;
|
|
536
|
+
const url = `${getApiBase(ctx)}/api/cron/jobs/${encodeURIComponent(jobId)}/webhook-signing`;
|
|
519
537
|
const res = (await postJson(
|
|
520
538
|
url,
|
|
521
539
|
apiKeyHeaders(ctx.sessionToken ?? ""),
|
|
@@ -531,7 +549,7 @@ async function mintAutomationSecret(
|
|
|
531
549
|
async function runSecret(ctx: CronCliContext): Promise<void> {
|
|
532
550
|
const jobId = shift(ctx.args, "job id");
|
|
533
551
|
if (hasFlag(ctx.args, "--off")) {
|
|
534
|
-
const url = `${getApiBase()}/api/cron/jobs/${encodeURIComponent(jobId)}/webhook-signing`;
|
|
552
|
+
const url = `${getApiBase(ctx)}/api/cron/jobs/${encodeURIComponent(jobId)}/webhook-signing`;
|
|
535
553
|
const res = (await deleteJson(
|
|
536
554
|
url,
|
|
537
555
|
apiKeyHeaders(ctx.sessionToken ?? ""),
|
|
@@ -695,7 +713,7 @@ async function runCreateAppOrCrm(
|
|
|
695
713
|
base: AppOrCrmCreateBase,
|
|
696
714
|
): Promise<void> {
|
|
697
715
|
const body = buildAppOrCrmCreateBody(ctx.args, base);
|
|
698
|
-
const url = `${getApiBase()}/api/cron/jobs`;
|
|
716
|
+
const url = `${getApiBase(ctx)}/api/cron/jobs`;
|
|
699
717
|
const created = await postJson(
|
|
700
718
|
url,
|
|
701
719
|
apiKeyHeaders(ctx.sessionToken ?? ""),
|
|
@@ -714,7 +732,7 @@ async function runEvents(ctx: CronCliContext): Promise<void> {
|
|
|
714
732
|
ctx.args,
|
|
715
733
|
"toolkit slug (e.g. github — run `dench apps --json` to see each app's slug)",
|
|
716
734
|
);
|
|
717
|
-
const url = `${getApiBase()}/api/cron/trigger-types?toolkit=${encodeURIComponent(toolkit)}`;
|
|
735
|
+
const url = `${getApiBase(ctx)}/api/cron/trigger-types?toolkit=${encodeURIComponent(toolkit)}`;
|
|
718
736
|
const result = (await getJson(
|
|
719
737
|
url,
|
|
720
738
|
apiKeyHeaders(ctx.sessionToken ?? ""),
|
|
@@ -783,7 +801,7 @@ async function runUpdate(ctx: CronCliContext): Promise<void> {
|
|
|
783
801
|
async function runDelete(ctx: CronCliContext): Promise<void> {
|
|
784
802
|
const jobId = shift(ctx.args, "job id");
|
|
785
803
|
const result = await deleteJson(
|
|
786
|
-
`${getApiBase()}/api/cron/jobs/${encodeURIComponent(jobId)}`,
|
|
804
|
+
`${getApiBase(ctx)}/api/cron/jobs/${encodeURIComponent(jobId)}`,
|
|
787
805
|
apiKeyHeaders(ctx.sessionToken ?? ""),
|
|
788
806
|
);
|
|
789
807
|
out(ctx, result);
|
|
@@ -801,7 +819,7 @@ async function runEnable(ctx: CronCliContext, enabled: boolean): Promise<void> {
|
|
|
801
819
|
async function runRunNow(ctx: CronCliContext): Promise<void> {
|
|
802
820
|
const jobId = shift(ctx.args, "job id");
|
|
803
821
|
const wait = hasFlag(ctx.args, "--wait");
|
|
804
|
-
const url = `${getApiBase()}/api/cron/jobs/${encodeURIComponent(jobId)}/run-now`;
|
|
822
|
+
const url = `${getApiBase(ctx)}/api/cron/jobs/${encodeURIComponent(jobId)}/run-now`;
|
|
805
823
|
const fired = (await postJson(
|
|
806
824
|
url,
|
|
807
825
|
apiKeyHeaders(ctx.sessionToken ?? ""),
|
|
@@ -968,6 +986,7 @@ export async function runCronCommand(opts: {
|
|
|
968
986
|
convex: ConvexHttpClient;
|
|
969
987
|
args: string[];
|
|
970
988
|
sessionToken?: string;
|
|
989
|
+
apiBase?: string;
|
|
971
990
|
}): Promise<void> {
|
|
972
991
|
const args = [...opts.args];
|
|
973
992
|
const jsonOutput = hasFlag(args, "--json");
|
|
@@ -976,6 +995,7 @@ export async function runCronCommand(opts: {
|
|
|
976
995
|
args,
|
|
977
996
|
jsonOutput,
|
|
978
997
|
sessionToken: opts.sessionToken,
|
|
998
|
+
apiBase: opts.apiBase,
|
|
979
999
|
};
|
|
980
1000
|
const subcommand = args.shift();
|
|
981
1001
|
if (!subcommand || subcommand === "help" || subcommand === "--help") {
|
package/dench.ts
CHANGED
|
@@ -476,7 +476,7 @@ export const APP_SDK_OPERATIONS: readonly AppSdkOperationInfo[] = [
|
|
|
476
476
|
{"id":"tool.status","group":"gateway","summary":"List connected tool accounts.","cli":"dench tool status","method":"GET","path":"/tools/status","permission":"integrations:read","pathParams":[]},
|
|
477
477
|
{"id":"tool.connect","group":"gateway","summary":"Create a tool OAuth connection link. Slack is in-house, never a third-party connection: for toolkit slack the CLI prints the first-party install URL (/api/slack/install?slug=<workspace>, org admin) instead of calling this endpoint.","cli":"dench tool connect","method":"POST","path":"/tools/connections","permission":"integrations:write","pathParams":[]},
|
|
478
478
|
{"id":"tool.search","group":"gateway","summary":"Search for external tool actions.","cli":"dench tool search","method":"POST","path":"/tools/search","permission":"integrations:read","pathParams":[]},
|
|
479
|
-
{"id":"tool.run","group":"gateway","summary":"Run an external tool action. SLACK_* slugs (SLACK_SEND_MESSAGE with Block Kit blocks/buttons, SLACK_FETCH_HISTORY, SLACK_LIST_CHANNELS, …) run through Dench's in-house Slack app install — any channel in the connected workspace — and are always preferred over any third-party Slack connection.","cli":"dench tool run","method":"POST","path":"/tools/run","permission":"integrations:write","pathParams":[]},
|
|
479
|
+
{"id":"tool.run","group":"gateway","summary":"Run an external tool action. SLACK_* slugs (SLACK_SEND_MESSAGE with Block Kit blocks/buttons, SLACK_FETCH_HISTORY, SLACK_LIST_CHANNELS, …) run through Dench's in-house Slack app install — any channel in the connected workspace — and are always preferred over any third-party Slack connection. Slack writes (send, react, upload, edit, delete) are shared-only: they act as the shared Dench bot, so a personal CLI session or chat is refused with `slack_shared_only`; ask Dench in Slack, or create a shared Slack automation there.","cli":"dench tool run","method":"POST","path":"/tools/run","permission":"integrations:write","pathParams":[]},
|
|
480
480
|
{"id":"tool.disconnect","group":"gateway","summary":"Disconnect an external tool account.","cli":"dench tool disconnect","method":"DELETE","path":"/tools/connections/{connectionId}","permission":"integrations:write","pathParams":["connectionId"]},
|
|
481
481
|
{"id":"tool.labels.list","group":"gateway","summary":"List human names given to connected accounts.","cli":"dench tool labels","method":"GET","path":"/tools/labels","permission":"integrations:read","pathParams":[]},
|
|
482
482
|
{"id":"tool.label.set","group":"gateway","summary":"Name a connected account, or clear its name with an empty string.","cli":"dench tool label","method":"PUT","path":"/tools/connections/{connectionId}/label","permission":"integrations:write","pathParams":["connectionId"]},
|
package/lib/command-registry.ts
CHANGED
|
@@ -5469,7 +5469,11 @@ const rawApiOperations = [
|
|
|
5469
5469
|
"with Block Kit blocks/buttons, SLACK_FETCH_HISTORY, " +
|
|
5470
5470
|
"SLACK_LIST_CHANNELS, …) run through Dench's in-house Slack app " +
|
|
5471
5471
|
"install — any channel in the connected workspace — and are always " +
|
|
5472
|
-
"preferred over any third-party Slack connection."
|
|
5472
|
+
"preferred over any third-party Slack connection. Slack writes (send, " +
|
|
5473
|
+
"react, upload, edit, delete) are shared-only: they act as the shared " +
|
|
5474
|
+
"Dench bot, so a personal CLI session or chat is refused with " +
|
|
5475
|
+
"`slack_shared_only`; ask Dench in Slack, or create a shared Slack " +
|
|
5476
|
+
"automation there.",
|
|
5473
5477
|
cli: "dench tool run",
|
|
5474
5478
|
method: "POST",
|
|
5475
5479
|
path: "/tools/run",
|