@keystrokehq/cli 0.1.78 → 0.1.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { $ as CredentialInstanceListResponseSchema, $n as WorkflowRunDetailResponseSchema, $t as PresignOrgLogoResponseSchema, A as ConnectAuthorizeUrlResponseSchema, An as TriggerRunListResponseSchema, At as ListCredentialsPageResponseSchema, B as CreateCustomAppRequestSchema, Bn as UpdateProjectMemberResponseSchema, Bt as ListProjectsResponseSchema, C as ChannelAccountListResponseSchema, Cn as StartOAuthConnectionInputSchema, D as CompleteProjectArtifactResponseSchema, Dn as TriggerDetailResponseSchema, Dr as resolvePublicPlatformOrigin, Dt as ListAppsResponseSchema, E as ChannelDirectoryListResponseSchema, En as SubmitTeamRequestRequestSchema, Er as resolveDocsMcpUrl, Et as ListApiKeysResponseSchema, F as CreateBillingPortalRequestSchema, Fn as UpdateManagedServiceCredentialRequestSchema, Ft as ListOrganizationsResponseSchema, G as CreateProjectRequestSchema, Gn as UpsertGatewayAttachmentBodySchema, Gt as OrganizationSidebarBrandingPatchSchema, H as CreateOrganizationRequestSchema, Hn as UpdateProjectSettingsRequestSchema, Ht as ManagedServiceKindSchema, I as CreateCredentialInstanceBodySchema, In as UpdateOrganizationMemberRequestSchema, It as ListProjectDeploymentsResponseSchema, J as CredentialAssignmentListQuerySchema, Jn as UserPreferencesPatchSchema, Jt as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, K as CreateProjectResponseSchema, Kn as UserAvatarPatchSchema, Kt as OrganizationSidebarBrandingSchema, L as CreateCredentialsRequestSchema, Ln as UpdateOrganizationMemberResponseSchema, Lt as ListProjectFilesResponseSchema, M as ConnectProvidersResponseSchema, Mn as UpdateChannelBindingBodySchema, Mt as ListOrganizationInvitationsResponseSchema, N as CreateApiKeyRequestSchema, Nn as UpdateCredentialInstanceBodySchema, Nt as ListOrganizationMembersPageQuerySchema, O as ConfirmCheckoutRequestSchema, On as TriggerListResponseSchema, Or as slugifyAppName, Ot as ListChannelPlatformsResponseSchema, P as CreateApiKeyResponseSchema, Pn as UpdateCredentialRequestSchema, Pt as ListOrganizationMembersPageResponseSchema, Q as CredentialConsumerListResponseSchema, Qn as WorkflowCanvasSchema, Qt as PresignOrgLogoRequestSchema, R as CreateCredentialsResponseSchema, Rn as UpdateOrganizationRequestSchema, Rt as ListProjectMembersResponseSchema, S as CatalogAppsPageResponseSchema, Sn as StartMcpOAuthConnectionResultSchema, Sr as parseErrorResponse, St as InviteProjectMembersResponseSchema, T as ChannelConnectionSchema, Tn as SubmitMarketingContactRequestSchema, Tr as resolveConnectAppSlug, Tt as ListAgentWorkspaceFilesResponseSchema, U as CreateOrganizationResponseSchema, Un as UploadProjectSourceManifestRequestSchema, Ut as McpDiscoverResponseSchema, V as CreateCustomAppResponseSchema, Vn as UpdateProjectRequestSchema, Vt as ManagedServiceCredentialSchema, W as CreateProjectArtifactResponseSchema, Wn as UploadProjectSourceResponseSchema, Wt as OpenApiDiscoverResponseSchema, X as CredentialAssignmentRecordSchema, Xn as WorkflowCanvasCredentialBindingsSchema, Xt as PresignChatAttachmentRequestSchema, Y as CredentialAssignmentListResponseSchema, Yn as UserPreferencesSchema, Yt as PollRunResponseSchema, Z as CredentialConsumerListQuerySchema, Zn as WorkflowCanvasRunSchema, Zt as PresignChatAttachmentResponseSchema, _ as BillingUsageResponseSchema, _n as SkillSummaryListResponseSchema, _r as isAcceptableInstallExit, _t as HistoryRunListQuerySchema, a as AgentSessionDetailResponseSchema, an as ProjectReachabilityResponseSchema, ar as WorkflowSummaryDetailResponseSchema, at as DownloadActiveProjectArtifactResponseSchema, b as CatalogActionsPageResponseSchema, bn as StartKeystrokeConnectionResultSchema, bt as InviteOrganizationMembersResponseSchema, c as AgentSummaryListResponseSchema, cn as ProjectSlugAvailabilityResponseSchema, cr as WorkspaceTriggerFileSchema, ct as ExecuteKeystrokeToolRequestSchema, d as AssignCredentialBodySchema, dr as WorkspaceTriggerRunListResponseSchema, dt as GetCredentialResponseSchema, en as PresignProjectSourceRequestSchema, er as WorkflowRunHooksResponseSchema, et as CredentialInstanceRecordSchema, f as AutoTopupSummarySchema, fn as QueuedAgentPromptResponseSchema, fr as WorkspaceWorkflowOverviewSchema, ft as GetCustomAppResponseSchema, g as BillingSummaryResponseSchema, gn as SkillSummaryDetailResponseSchema, gr as detectProjectPackageManagerFromSnapshot, gt as HistoryRunDetailResponseSchema, h as BillingRedirectResponseSchema, hn as RecentResourceListResponseSchema, hr as deriveCustomAppDisplay, ht as HistoryRunCancelResponseSchema, i as AgentSessionChatStateResponseSchema, in as ProjectPullStateSchema, ir as WorkflowRunResponseSchema, it as DeclineOrganizationInvitationResponseSchema, j as ConnectManagedServiceCredentialRequestSchema, jn as UpdateAutoTopupRequestSchema, jt as ListManagedServiceCredentialsResponseSchema, k as ConfirmCheckoutResponseSchema, kn as TriggerRunDetailResponseSchema, kt as ListCredentialsPageQuerySchema, l as AgentTriggerSummaryListResponseSchema, ln as PromptInputSchema, lr as WorkspaceTriggerListResponseSchema, lt as GatewayAttachmentRecordSchema, m as BillingInvoiceUrlResponseSchema, mt as HealthResponseSchema, n as AcceptOrganizationInvitationResponseSchema, nn as PresignUserAvatarRequestSchema, nr as WorkflowRunInputsSchema, nt as DOCS_QUERY_TOOL, o as AgentSessionListResponseSchema, on as ProjectResponseSchema, or as WorkflowSummaryListResponseSchema, ot as DownloadActiveProjectSourceResponseSchema, p as BillingActivityResponseSchema, pn as QueuedRunResponseSchema, pr as buildConnectDeeplink, pt as GraphqlDiscoverResponseSchema, q as CreateSubscriptionCheckoutRequestSchema, qn as UserAvatarSchema, qt as PROJECT_PULL_STATE_RELATIVE_PATH, r as ActiveOrganizationResponseSchema, rn as PresignUserAvatarResponseSchema, rr as WorkflowRunListResponseSchema, rt as DOCS_SEARCH_TOOL, s as AgentSummaryDetailResponseSchema, sn as ProjectSettingsResponseSchema, sr as WorkspaceTriggerDetailSchema, st as ErrorResponseSchema, t as ACTIVE_ORG_HEADER, tn as PresignProjectSourceResponseSchema, tr as WorkflowRunInputsPutBodySchema, u as AppSlugAvailabilityResponseSchema, un as PromptResponseSchema, ur as WorkspaceTriggerOverviewSchema, ut as GetAppCatalogEntryResponseSchema, v as BindChannelBodySchema, vn as SlugAvailabilityResponseSchema, vr as listenPortFromPublicUrl, vt as HistoryRunListResponseSchema, w as ChannelConnectionListResponseSchema, wn as StartOAuthConnectionResultSchema, wt as ListAgentMemoryFilesResponseSchema, x as CatalogAppDetailResponseSchema, xn as StartMcpOAuthConnectionInputSchema, xr as parseAppSlug, xt as InviteProjectMembersRequestSchema, y as CatalogActionDetailResponseSchema, yn as StartKeystrokeConnectionInputSchema, yt as InviteOrganizationMembersRequestSchema, z as CreateCreditsCheckoutRequestSchema, zn as UpdateProjectMemberRequestSchema, zt as ListProjectMetricsResponseSchema } from "./dist-DI9IeZPy.mjs";
3
- import { i as packProjectArtifact, n as withMcpReadClient, r as mergeFilteredArtifact, t as mapInParallelBatches } from "./dist-DONjp1Vu.mjs";
4
- import { _ as resolvePlatformUrlForWebUrl, a as installPlaygroundDependencies, c as isNewerVersion, d as getConfigDir, f as getEffectiveApiTarget, h as DEFAULT_PLATFORM_URL, i as installDependencies$1, l as createCliConfig, m as getWebUrl, n as buildPlaygroundWorkspace, o as resolvePackageManager, p as getPlatformUrl, s as resolveCliRoot, t as readCliVersion, u as getCliConfigDir } from "./version-DtkdnpP8.mjs";
2
+ import { $ as CredentialInstanceListResponseSchema, $n as WorkflowCanvasSchema, $t as PresignProjectSourceRequestSchema, A as ConnectAuthorizeUrlResponseSchema, An as TriggerRunDetailResponseSchema, At as ListCredentialsPageResponseSchema, B as CreateCustomAppRequestSchema, Bn as UpdateProjectMemberRequestSchema, Bt as ListProjectsResponseSchema, C as ChannelAccountListResponseSchema, Cn as StartOAuthConnectionResultSchema, Cr as parseErrorResponse, D as CompleteProjectArtifactResponseSchema, Dn as TriggerInvokeInputsSchema, Dr as resolveDocsMcpUrl, Dt as ListAppsResponseSchema, E as ChannelDirectoryListResponseSchema, En as TriggerDetailResponseSchema, Er as resolveConnectAppSlug, Et as ListApiKeysResponseSchema, F as CreateBillingPortalRequestSchema, Fn as UpdateCredentialRequestSchema, Ft as ListOrganizationsResponseSchema, G as CreateProjectRequestSchema, Gn as UploadProjectSourceResponseSchema, Gt as OrganizationSidebarBrandingPatchSchema, H as CreateOrganizationRequestSchema, Hn as UpdateProjectRequestSchema, Ht as ManagedServiceKindSchema, I as CreateCredentialInstanceBodySchema, In as UpdateManagedServiceCredentialRequestSchema, It as ListProjectDeploymentsResponseSchema, J as CredentialAssignmentListQuerySchema, Jn as UserAvatarSchema, Jt as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, K as CreateProjectResponseSchema, Kn as UpsertGatewayAttachmentBodySchema, Kt as OrganizationSidebarBrandingSchema, L as CreateCredentialsRequestSchema, Ln as UpdateOrganizationMemberRequestSchema, Lt as ListProjectFilesResponseSchema, M as ConnectProvidersResponseSchema, Mn as UpdateAutoTopupRequestSchema, Mt as ListOrganizationInvitationsResponseSchema, N as CreateApiKeyRequestSchema, Nn as UpdateChannelBindingBodySchema, Nt as ListOrganizationMembersPageQuerySchema, O as ConfirmCheckoutRequestSchema, On as TriggerInvokeResponseSchema, Or as resolvePublicPlatformOrigin, Ot as ListChannelPlatformsResponseSchema, P as CreateApiKeyResponseSchema, Pn as UpdateCredentialInstanceBodySchema, Pt as ListOrganizationMembersPageResponseSchema, Q as CredentialConsumerListResponseSchema, Qn as WorkflowCanvasRunSchema, Qt as PresignOrgLogoResponseSchema, R as CreateCredentialsResponseSchema, Rn as UpdateOrganizationMemberResponseSchema, Rt as ListProjectMembersResponseSchema, S as CatalogAppsPageResponseSchema, Sn as StartOAuthConnectionInputSchema, Sr as parseAppSlug, St as InviteProjectMembersResponseSchema, T as ChannelConnectionSchema, Tn as SubmitTeamRequestRequestSchema, Tt as ListAgentWorkspaceFilesResponseSchema, U as CreateOrganizationResponseSchema, Un as UpdateProjectSettingsRequestSchema, Ut as McpDiscoverResponseSchema, V as CreateCustomAppResponseSchema, Vn as UpdateProjectMemberResponseSchema, Vt as ManagedServiceCredentialSchema, W as CreateProjectArtifactResponseSchema, Wn as UploadProjectSourceManifestRequestSchema, Wt as OpenApiDiscoverResponseSchema, X as CredentialAssignmentRecordSchema, Xn as UserPreferencesSchema, Xt as PresignChatAttachmentResponseSchema, Y as CredentialAssignmentListResponseSchema, Yn as UserPreferencesPatchSchema, Yt as PresignChatAttachmentRequestSchema, Z as CredentialConsumerListQuerySchema, Zn as WorkflowCanvasCredentialBindingsSchema, Zt as PresignOrgLogoRequestSchema, _ as BillingUsageResponseSchema, _n as SlugAvailabilityResponseSchema, _r as detectProjectPackageManagerFromSnapshot, _t as HistoryRunListQuerySchema, a as AgentSessionDetailResponseSchema, an as ProjectResponseSchema, ar as WorkflowRunResponseSchema, at as DownloadActiveProjectArtifactResponseSchema, b as CatalogActionsPageResponseSchema, bn as StartMcpOAuthConnectionInputSchema, bt as InviteOrganizationMembersResponseSchema, c as AgentSummaryListResponseSchema, cn as PromptInputSchema, cr as WorkspaceTriggerDetailSchema, ct as ExecuteKeystrokeToolRequestSchema, d as AssignCredentialBodySchema, dn as QueuedAgentPromptResponseSchema, dr as WorkspaceTriggerOverviewSchema, dt as GetCredentialResponseSchema, en as PresignProjectSourceResponseSchema, er as WorkflowRunDetailResponseSchema, et as CredentialInstanceRecordSchema, f as AutoTopupSummarySchema, fn as QueuedRunResponseSchema, fr as WorkspaceTriggerRunListResponseSchema, ft as GetCustomAppResponseSchema, g as BillingSummaryResponseSchema, gn as SkillSummaryListResponseSchema, gr as deriveCustomAppDisplay, gt as HistoryRunDetailResponseSchema, h as BillingRedirectResponseSchema, hn as SkillSummaryDetailResponseSchema, ht as HistoryRunCancelResponseSchema, i as AgentSessionChatStateResponseSchema, in as ProjectReachabilityResponseSchema, ir as WorkflowRunListResponseSchema, it as DeclineOrganizationInvitationResponseSchema, j as ConnectManagedServiceCredentialRequestSchema, jn as TriggerRunListResponseSchema, jt as ListManagedServiceCredentialsResponseSchema, k as ConfirmCheckoutResponseSchema, kn as TriggerListResponseSchema, kr as slugifyAppName, kt as ListCredentialsPageQuerySchema, l as AgentTriggerSummaryListResponseSchema, ln as PromptResponseSchema, lr as WorkspaceTriggerFileSchema, lt as GatewayAttachmentRecordSchema, m as BillingInvoiceUrlResponseSchema, mn as RecentResourceListResponseSchema, mr as buildConnectDeeplink, mt as HealthResponseSchema, n as AcceptOrganizationInvitationResponseSchema, nn as PresignUserAvatarResponseSchema, nr as WorkflowRunInputsPutBodySchema, nt as DOCS_QUERY_TOOL, o as AgentSessionListResponseSchema, on as ProjectSettingsResponseSchema, or as WorkflowSummaryDetailResponseSchema, ot as DownloadActiveProjectSourceResponseSchema, p as BillingActivityResponseSchema, pr as WorkspaceWorkflowOverviewSchema, pt as GraphqlDiscoverResponseSchema, q as CreateSubscriptionCheckoutRequestSchema, qn as UserAvatarPatchSchema, qt as PROJECT_PULL_STATE_RELATIVE_PATH, r as ActiveOrganizationResponseSchema, rn as ProjectPullStateSchema, rr as WorkflowRunInputsSchema, rt as DOCS_SEARCH_TOOL, s as AgentSummaryDetailResponseSchema, sn as ProjectSlugAvailabilityResponseSchema, sr as WorkflowSummaryListResponseSchema, st as ErrorResponseSchema, t as ACTIVE_ORG_HEADER, tn as PresignUserAvatarRequestSchema, tr as WorkflowRunHooksResponseSchema, u as AppSlugAvailabilityResponseSchema, ur as WorkspaceTriggerListResponseSchema, ut as GetAppCatalogEntryResponseSchema, v as BindChannelBodySchema, vn as StartKeystrokeConnectionInputSchema, vr as isAcceptableInstallExit, vt as HistoryRunListResponseSchema, w as ChannelConnectionListResponseSchema, wn as SubmitMarketingContactRequestSchema, wt as ListAgentMemoryFilesResponseSchema, x as CatalogAppDetailResponseSchema, xn as StartMcpOAuthConnectionResultSchema, xt as InviteProjectMembersRequestSchema, y as CatalogActionDetailResponseSchema, yn as StartKeystrokeConnectionResultSchema, yr as listenPortFromPublicUrl, yt as InviteOrganizationMembersRequestSchema, z as CreateCreditsCheckoutRequestSchema, zn as UpdateOrganizationRequestSchema, zt as ListProjectMetricsResponseSchema } from "./dist-hlO_zOcR.mjs";
3
+ import { i as packProjectArtifact, n as withMcpReadClient, r as mergeFilteredArtifact, t as mapInParallelBatches } from "./dist-BIB3Iubo.mjs";
4
+ import { _ as resolvePlatformUrlForWebUrl, a as installPlaygroundDependencies, c as isNewerVersion, d as getConfigDir, f as getEffectiveApiTarget, h as DEFAULT_PLATFORM_URL, i as installDependencies$1, l as createCliConfig, m as getWebUrl, n as buildPlaygroundWorkspace, o as resolvePackageManager, p as getPlatformUrl, s as resolveCliRoot, t as readCliVersion, u as getCliConfigDir } from "./version-DJCgo5_v.mjs";
5
5
  import { createRequire } from "node:module";
6
6
  import { Command } from "commander";
7
7
  import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
@@ -1489,13 +1489,6 @@ function createOpenApiResource(http) {
1489
1489
  }
1490
1490
  } };
1491
1491
  }
1492
- function pollRunBody(options) {
1493
- if (!options?.workflows?.length && !options?.attachments?.length) return;
1494
- return {
1495
- ...options.workflows?.length ? { workflows: options.workflows } : {},
1496
- ...options.attachments?.length ? { attachments: options.attachments } : {}
1497
- };
1498
- }
1499
1492
  function listRunsSearchParams$1(query) {
1500
1493
  if (!query) return {};
1501
1494
  const params = {};
@@ -1548,24 +1541,6 @@ function createTriggersResource$1(http) {
1548
1541
  throw await toKeystrokeError(error);
1549
1542
  }
1550
1543
  },
1551
- async poll(id, options = {}) {
1552
- try {
1553
- const { group, ...target } = options;
1554
- const json = pollRunBody(target);
1555
- const path = group ? `triggers/polls/${id}/run` : `triggers/${id}/poll`;
1556
- const data = await readJson(await http.post(path, json ? { json } : void 0));
1557
- PollRunResponseSchema.parse(data);
1558
- return data;
1559
- } catch (error) {
1560
- throw await toKeystrokeError(error);
1561
- }
1562
- },
1563
- async runPollGroup(pollId, options = {}) {
1564
- return this.poll(pollId, {
1565
- ...options,
1566
- group: true
1567
- });
1568
- },
1569
1544
  async listRuns(attachmentId, query) {
1570
1545
  try {
1571
1546
  const data = await http.get(`triggers/${attachmentId}/runs`, { searchParams: listRunsSearchParams$1(query) }).json();
@@ -4054,6 +4029,27 @@ function createTriggersResource(http) {
4054
4029
  } catch (error) {
4055
4030
  throw await toPlatformError(error);
4056
4031
  }
4032
+ },
4033
+ /** Form metadata for the dashboard invoke popover (webhook schemas / cron static payload). */
4034
+ async getInvokeInputs(triggerId) {
4035
+ try {
4036
+ const data = await http.get(`api/triggers/${encodeURIComponent(triggerId)}/invoke-inputs`).json();
4037
+ return TriggerInvokeInputsSchema.parse(data);
4038
+ } catch (error) {
4039
+ throw await toPlatformError(error);
4040
+ }
4041
+ },
4042
+ /**
4043
+ * Manually invoke a trigger. Webhook invokes validate `input` against stored attachment
4044
+ * schemas; cron/poll reject `input` and fire with their normal payload path.
4045
+ */
4046
+ async invoke(triggerId, body = {}) {
4047
+ try {
4048
+ const data = await http.post(`api/triggers/${encodeURIComponent(triggerId)}/invoke`, { json: body }).json();
4049
+ return TriggerInvokeResponseSchema.parse(data);
4050
+ } catch (error) {
4051
+ throw await toPlatformError(error);
4052
+ }
4057
4053
  }
4058
4054
  };
4059
4055
  }
@@ -6765,7 +6761,7 @@ function registerBuildCommand(program) {
6765
6761
  try {
6766
6762
  const root = resolveProjectRoot(options.dir);
6767
6763
  await ensureSdkCurrent(root);
6768
- const { buildApp } = await import("./dist-D3z59-5y.mjs");
6764
+ const { buildApp } = await import("./dist-CPKw37uL.mjs");
6769
6765
  await buildApp({ root });
6770
6766
  process.stdout.write(`Built ${root}\n`);
6771
6767
  } catch (error) {
@@ -6890,7 +6886,7 @@ async function sleep(ms) {
6890
6886
  }
6891
6887
  async function buildDeployArchive(client, root, projectId, filter) {
6892
6888
  if (filter?.length) {
6893
- const { buildFilteredApp } = await import("./dist-D3z59-5y.mjs");
6889
+ const { buildFilteredApp } = await import("./dist-CPKw37uL.mjs");
6894
6890
  const filtered = await buildFilteredApp({
6895
6891
  root,
6896
6892
  filter,
@@ -6912,7 +6908,7 @@ async function buildDeployArchive(client, root, projectId, filter) {
6912
6908
  sourceFiles: filtered.sourceFiles
6913
6909
  };
6914
6910
  }
6915
- const { buildApp } = await import("./dist-D3z59-5y.mjs");
6911
+ const { buildApp } = await import("./dist-CPKw37uL.mjs");
6916
6912
  const { sourceFiles } = await buildApp({
6917
6913
  root,
6918
6914
  collectSources: true,
@@ -7034,7 +7030,7 @@ function runtimeChildEnv(parentEnv, overrides) {
7034
7030
  //#region src/project/bootstrap-run.ts
7035
7031
  /** Node args + env for `@keystrokehq/build` bootstrap (shared by start + dev). */
7036
7032
  async function resolveBootstrapRun(options) {
7037
- const { resolveRuntimeBuildArtifact } = await import("./dist-D3z59-5y.mjs");
7033
+ const { resolveRuntimeBuildArtifact } = await import("./dist-CPKw37uL.mjs");
7038
7034
  const loader = pathToFileURL(resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/runtime-loader.mjs")).href;
7039
7035
  const bootstrap = resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/standalone-bootstrap.mjs");
7040
7036
  const args = [`--import=${loader}`];
@@ -7183,7 +7179,7 @@ async function runDev(options) {
7183
7179
  process.on("SIGINT", shutdown);
7184
7180
  process.on("SIGTERM", shutdown);
7185
7181
  try {
7186
- const { watchApp } = await import("./dist-D3z59-5y.mjs");
7182
+ const { watchApp } = await import("./dist-CPKw37uL.mjs");
7187
7183
  await watchApp({
7188
7184
  root,
7189
7185
  clean: false,
@@ -8226,7 +8222,7 @@ async function runStart(options) {
8226
8222
  const apiPort = Number(new URL(serverUrl).port || 80);
8227
8223
  const runtimeNodeModules = resolveCliRuntimeNodeModules(resolveCliRoot(import.meta.url));
8228
8224
  ensureNativeDeps(runtimeNodeModules);
8229
- const { buildApp } = await import("./dist-D3z59-5y.mjs");
8225
+ const { buildApp } = await import("./dist-CPKw37uL.mjs");
8230
8226
  await buildApp({
8231
8227
  root,
8232
8228
  clean: false
@@ -8284,21 +8280,6 @@ function registerTriggerUrlCommand(trigger) {
8284
8280
  }));
8285
8281
  }
8286
8282
  //#endregion
8287
- //#region src/commands/triggers/poll.ts
8288
- function collect(value, previous) {
8289
- return [...previous, value];
8290
- }
8291
- function registerTriggerPollCommand(trigger) {
8292
- trigger.command("poll").description("Run a poll trigger on demand").argument("<id>", "Poll attachment key, or poll source id with --group").option("--group", "Run all attachments that share this poll source id").option("--workflow <key>", "Only trigger this workflow (repeatable)", collect, []).option("--attachment <key>", "Only trigger this attachment (repeatable)", collect, []).action((id, options) => runProjectCliCommand("Poll trigger failed", async ({ client }) => {
8293
- const result = await client.triggers.poll(id, {
8294
- ...options.group ? { group: true } : {},
8295
- ...options.workflow.length > 0 ? { workflows: options.workflow } : {},
8296
- ...options.attachment.length > 0 ? { attachments: options.attachment } : {}
8297
- });
8298
- process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
8299
- }));
8300
- }
8301
- //#endregion
8302
8283
  //#region src/commands/triggers/resolve-trigger-attachment.ts
8303
8284
  async function loadTrigger(platform, triggerRef) {
8304
8285
  let trigger = await platform.triggers.get(triggerRef);
@@ -8339,6 +8320,55 @@ function attachmentSlugForRuns(attachments) {
8339
8320
  throw new Error(`Trigger has ${attachments.length} attachments — pass --workflow or --agent to list runs for one target`);
8340
8321
  }
8341
8322
  //#endregion
8323
+ //#region src/commands/triggers/invoke.ts
8324
+ function resolveTarget$2(options) {
8325
+ if (options.workflow && options.agent) throw new Error("Pass only one of --workflow or --agent");
8326
+ if (options.workflow) return {
8327
+ kind: "workflow",
8328
+ slug: options.workflow
8329
+ };
8330
+ if (options.agent) return {
8331
+ kind: "agent",
8332
+ slug: options.agent
8333
+ };
8334
+ }
8335
+ function registerTriggerInvokeCommand(trigger) {
8336
+ trigger.command("invoke").description("Manually invoke a trigger (webhook, cron, or poll)").argument("<trigger-slug>", "Trigger id or slug").option("--input <json>", "JSON body for webhook triggers only").option("--workflow <slug>", "Only the attachment bound to this workflow").option("--agent <slug>", "Only the attachment bound to this agent").addHelpText("after", `
8337
+ Examples:
8338
+ ${cliBinaryName()} triggers invoke incoming-message --input '{"text":"hi"}'
8339
+ ${cliBinaryName()} triggers invoke morning --workflow report
8340
+ ${cliBinaryName()} triggers invoke inbox-sync
8341
+ `).action(async (triggerRef, options) => {
8342
+ const config = createCliConfig();
8343
+ try {
8344
+ const target = resolveTarget$2(options);
8345
+ const inputProvided = options.input !== void 0;
8346
+ await withActivePlatformClient(config, async (platform) => {
8347
+ const { trigger } = await resolveTriggerAttachments(platform, triggerRef, target);
8348
+ if (inputProvided && trigger.type !== "webhook") throw new Error(`input is only supported for webhook triggers (got ${trigger.type})`);
8349
+ const result = await platform.triggers.invoke(trigger.id, {
8350
+ ...inputProvided ? { input: parseJsonOption(options.input, "--input") } : {},
8351
+ ...options.workflow ? { workflow: options.workflow } : {},
8352
+ ...options.agent ? { agent: options.agent } : {}
8353
+ });
8354
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
8355
+ const targetHint = options.workflow != null ? ` --workflow ${options.workflow}` : options.agent != null ? ` --agent ${options.agent}` : "";
8356
+ process.stderr.write(`Trigger invoked. Track progress:\n ${cliBinaryName()} triggers runs list ${trigger.slug}${targetHint}\n`);
8357
+ });
8358
+ } catch (error) {
8359
+ process.stderr.write(`${formatCliError(error, "Invoke trigger failed", {
8360
+ serverUrl: getPlatformUrl(config),
8361
+ webUrl: getWebUrl(config),
8362
+ usage: {
8363
+ command: `${cliBinaryName()} triggers invoke ${triggerRef}`,
8364
+ flag: options.input !== void 0 ? "--input" : void 0
8365
+ }
8366
+ })}\n`);
8367
+ process.exitCode = 1;
8368
+ }
8369
+ });
8370
+ }
8371
+ //#endregion
8342
8372
  //#region src/commands/triggers/runs.ts
8343
8373
  function resolveTarget$1(options) {
8344
8374
  if (options.workflow && options.agent) throw new Error("Pass only one of --workflow or --agent");
@@ -8452,7 +8482,7 @@ function registerTriggersCommand(program) {
8452
8482
  registerTriggerListCommand(triggers);
8453
8483
  registerTriggerGetCommand(triggers);
8454
8484
  registerTriggerUrlCommand(triggers);
8455
- registerTriggerPollCommand(triggers);
8485
+ registerTriggerInvokeCommand(triggers);
8456
8486
  registerTriggerRunsCommand(triggers);
8457
8487
  registerTriggerToggleCommands(triggers);
8458
8488
  }
@@ -8822,7 +8852,7 @@ function createProgram() {
8822
8852
  return program;
8823
8853
  }
8824
8854
  async function runCli(argv) {
8825
- const { maybeAutoUpdate } = await import("./maybe-auto-update-DzLYjlyI.mjs");
8855
+ const { maybeAutoUpdate } = await import("./maybe-auto-update-I4VJVddd.mjs");
8826
8856
  await maybeAutoUpdate(argv);
8827
8857
  createProgram().parse(argv);
8828
8858
  }