@zapier/zapier-sdk 0.105.0 → 0.107.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { DEFAULT_PAGE_SIZE, apiPluginRef, workflowIdResolver, extractErrorDetail, ZapierApiError, durableRunIdResolver, ZapierConflictError, workflowVersionIdResolver, workflowDraftIdResolver, workflowRunIdResolver, zapierSdkPlugin, ZapierValidationError, ZapierConfigurationError, zapierCoreOptions, SDK_OPTIONS_ID } from './chunk-NF7CPRHH.mjs';
2
- export { ACTION_RUNS_PATH, API_ID, ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMillisecondsPropertySchema, ActionTimeoutSecondsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthMechanism, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONNECTIONS_ID, CONTEXT, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MILLISECONDS, CORE_ERROR_SYMBOL, CORE_OPTIONS_ID, CORE_SIGNAL_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreCancelledSignal, CoreDisposeError, CoreErrorCode, CoreSignal, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MILLISECONDS, DEFAULT_APPROVAL_TIMEOUT_MILLISECONDS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DEPRECATION_NOTICE_EVENT, DebugPropertySchema, DrainTriggerInboxSchema, EVENT_EMISSION_ID, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MANIFEST_ID, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RESOLVE_CREDENTIALS_ID, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, SDK_OPTIONS_ID, TablePropertySchema, TablesPropertySchema, TriggerInboxKeyPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, WatchTriggerInboxSchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MILLISECONDS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, addPlugin, apiPlugin, apiPluginRef, appKeyResolver, appsPlugin, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, connectionsPluginRef, createActionRunPlugin, createBaseEvent, createClientCredentialsPlugin, createController, createCorePlugin, createFunction, createMemoryCache, createPaginatedFunction, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierSdkWithoutRegistry, declareMethod, declareOptionalProperty, declarePlugin, declareProperty, defineFormatter, defineLegacyMerge, defineMethod, defineMethodOverride, defineOverride, definePlugin, defineProperty, defineResolver, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, disposeSdk, durableRunIdResolver, eventEmissionHookPlugin, eventEmissionPlugin, eventEmissionPluginRef, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, fromFunctionPlugin, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getActionRunPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCallerContext, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getNegatable, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getRegistryPlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierCausationId, getZapierCorrelationId, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreCancelledSignal, isCoreError, isCoreSignal, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, isZapierAbortDrainSignal, isZapierActionError, isZapierAppNotFoundError, isZapierApprovalError, isZapierAuthenticationError, isZapierBundleError, isZapierConflictError, isZapierError, isZapierNotFoundError, isZapierRateLimitError, isZapierReleaseTriggerMessageSignal, isZapierResourceNotFoundError, isZapierSignal, isZapierTimeoutError, isZapierValidationError, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, manifestPluginRef, omitExports, operationAnnotatorPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuth, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, resolveCredentialsPlugin, resolveCredentialsPluginRef, resolvePlugin, runActionPlugin, runInMethodScope, runWithCallerContext, runWithTelemetryContext, sdkOptionsPluginRef, selectExports, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowDraftIdResolver, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError, zapierCoreOptions, zapierSdkPlugin } from './chunk-NF7CPRHH.mjs';
1
+ import { DEFAULT_PAGE_SIZE, apiPluginRef, workflowIdResolver, extractErrorDetail, ZapierApiError, durableRunIdResolver, ZapierConflictError, workflowVersionIdResolver, workflowDraftIdResolver, workflowRunIdResolver, zapierSdkPlugin, ZapierValidationError, ZapierConfigurationError, zapierCoreOptions, SDK_OPTIONS_ID } from './chunk-XGSFXI2W.mjs';
2
+ export { ACTION_RUNS_PATH, API_ID, ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMillisecondsPropertySchema, ActionTimeoutSecondsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthMechanism, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONNECTIONS_ID, CONTEXT, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MILLISECONDS, CORE_ERROR_SYMBOL, CORE_OPTIONS_ID, CORE_SIGNAL_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreCancelledSignal, CoreDisposeError, CoreErrorCode, CoreSignal, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MILLISECONDS, DEFAULT_APPROVAL_TIMEOUT_MILLISECONDS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DEPRECATION_NOTICE_EVENT, DebugPropertySchema, DrainTriggerInboxSchema, EVENT_EMISSION_ID, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MANIFEST_ID, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RESOLVE_CREDENTIALS_ID, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, SDK_OPTIONS_ID, TablePropertySchema, TablesPropertySchema, TriggerInboxKeyPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, WatchTriggerInboxSchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MILLISECONDS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, addPlugin, apiPlugin, apiPluginRef, appKeyResolver, appsPlugin, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, connectionsPluginRef, createActionRunPlugin, createBaseEvent, createClientCredentialsPlugin, createController, createCorePlugin, createFunction, createMemoryCache, createPaginatedFunction, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierSdkWithoutRegistry, declareMethod, declareOptionalProperty, declarePlugin, declareProperty, defineFormatter, defineLegacyMerge, defineMethod, defineMethodOverride, defineOverride, definePlugin, defineProperty, defineResolver, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, disposeSdk, durableRunIdResolver, eventEmissionHookPlugin, eventEmissionPlugin, eventEmissionPluginRef, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, fromFunctionPlugin, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getActionRunPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCallerContext, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getNegatable, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getRegistryPlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierCausationId, getZapierCorrelationId, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreCancelledSignal, isCoreError, isCoreSignal, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, isZapierAbortDrainSignal, isZapierActionError, isZapierAppNotFoundError, isZapierApprovalError, isZapierAuthenticationError, isZapierBundleError, isZapierConflictError, isZapierError, isZapierNotFoundError, isZapierRateLimitError, isZapierReleaseTriggerMessageSignal, isZapierResourceNotFoundError, isZapierSignal, isZapierTimeoutError, isZapierValidationError, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, manifestPluginRef, omitExports, operationAnnotatorPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuth, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, resolveCredentialsPlugin, resolveCredentialsPluginRef, resolvePlugin, runActionPlugin, runInMethodScope, runWithCallerContext, runWithTelemetryContext, sdkOptionsPluginRef, selectExports, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowDraftIdResolver, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError, zapierCoreOptions, zapierSdkPlugin } from './chunk-XGSFXI2W.mjs';
3
3
  import './chunk-Y6FXYEAI.mjs';
4
4
  import { defineMethod, openEnum, defineResolver, definePlugin, createSdk, CORE_OPTIONS_ID } from '@zapier/kitcore';
5
5
  import { z } from 'zod';
@@ -2382,6 +2382,315 @@ var createFormPlugin = defineMethod({
2382
2382
  }
2383
2383
  });
2384
2384
 
2385
+ // src/plugins/agenticManagement/shared.ts
2386
+ var agenticManagementDefaults = {
2387
+ categories: ["code-workflow"],
2388
+ stability: "experimental"
2389
+ };
2390
+ var AGENTIC_MANAGEMENT_API = "/agentic-management/v0";
2391
+ var AGENTIC_MANAGEMENT_RESOURCE_TYPE = "workflow";
2392
+ var AGENTIC_MODES_EXPLAINED = "A mode is what Agentic Management watches for and what it changes in response. `heal` monitors runs for errors and, when something breaks, diagnoses the cause and drafts and tests a fix; it is the mode a workflow gets by default. `expand` grows what the workflow covers: it reviews runs that succeeded without actually doing anything \u2014 a lookup that matched nothing, a filter that passed no items, a trigger payload no branch handles \u2014 and proposes a new branch or step to handle that case, rather than rewriting the ones that already work. `harden` watches the AI steps: when an AI step keeps doing the same work the same way, it converts that step into fixed code, so the workflow runs faster, costs less, and behaves the same way every time. Modes stack \u2014 each one you name runs alongside the others, and a mode you leave out does nothing, so a workflow on `expand` alone does not repair failed runs. Whether a change goes live on its own or waits for someone to approve it is `autoApprove`, not the mode.";
2393
+ var AgenticModeSchema = z.enum(["heal", "expand", "harden"]).describe(
2394
+ `An agentic mode Agentic Management runs for the workflow. ${AGENTIC_MODES_EXPLAINED}`
2395
+ );
2396
+ var AgenticModeOutputSchema = z.enum(["heal", "expand", "harden", "migrate", "optimize"]).describe(
2397
+ `An agentic mode the workflow is set to run. ${AGENTIC_MODES_EXPLAINED} Two more can be reported but not chosen: \`migrate\` for a workflow set up elsewhere, and \`optimize\`, which is retired and lingers only on workflows that had it.`
2398
+ );
2399
+ var AgenticModesInputSchema = z.array(AgenticModeSchema).min(1, {
2400
+ message: "modes must name at least one mode. An empty list is not a way to turn everything off \u2014 call disableAgenticManagement to stop Agentic Management for the workflow."
2401
+ }).refine((modes) => new Set(modes).size === modes.length, {
2402
+ message: "modes must not repeat a mode."
2403
+ }).describe(
2404
+ `The modes to run. The list you pass replaces the whole current set in one step; it is not added to what is already active. Omit it and enable starts the workflow on \`heal\` alone, while update leaves the active modes as they are. ${AGENTIC_MODES_EXPLAINED}`
2405
+ );
2406
+ var UUID_PATTERN2 = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
2407
+ var AutoApproveSchema = z.boolean().describe(
2408
+ "Apply the fixes Agentic Management proposes without asking first. Set it to false and each proposed fix waits for someone to approve it before anything changes."
2409
+ ).meta({ negatable: true });
2410
+ var WorkflowPropertySchema2 = z.string().regex(UUID_PATTERN2, "workflow must be a UUID.").describe("ID of the workflow to manage.");
2411
+ var VersionPropertySchema = z.string().regex(UUID_PATTERN2, "version must be a UUID.").describe(
2412
+ "The workflow version the intent belongs to. Each version stores its own intent, and a version never picks up the intent of another, so publishing a new version starts it with none. Omit this to use the workflow's current published version."
2413
+ );
2414
+ var AgenticManagementIntentSchema = z.object({
2415
+ workflow_id: z.string().describe("The workflow the intent belongs to."),
2416
+ workflow_version_id: z.string().nullable().describe(
2417
+ "The version this read or write actually landed on, so you can tell which one answered when you omitted `version`. `null` only when you read a workflow that has nothing published yet."
2418
+ ),
2419
+ intent: z.string().nullable().describe(
2420
+ "The intent stored for this version, or `null` when this version has none. Intent is never carried over from another version."
2421
+ ),
2422
+ updated_at: z.string().nullable().optional().describe("When the intent was last written; `null` when never captured.")
2423
+ });
2424
+
2425
+ // src/plugins/agenticManagement/enableAgenticManagement/schemas.ts
2426
+ var EnableAgenticManagementSchema = z.object({
2427
+ workflow: WorkflowPropertySchema2.describe(
2428
+ "ID of the workflow to put under agentic management."
2429
+ ),
2430
+ modes: AgenticModesInputSchema.optional().describe(
2431
+ `The modes to run for this workflow. Omit it and the workflow starts on \`heal\` alone. ${AGENTIC_MODES_EXPLAINED}`
2432
+ ),
2433
+ autoApprove: AutoApproveSchema.optional().describe(
2434
+ "Apply the fixes Agentic Management proposes without asking first. Set it to false and each fix waits for someone to approve it. Omit it and fixes are applied without asking, which is what a workflow enabled for the first time gets; a workflow being re-enabled keeps the setting it had before."
2435
+ )
2436
+ }).describe(
2437
+ "Put one workflow under Agentic Management. A workflow disabled earlier comes back with the modes and auto-approve choice it had, unless you pass new ones here."
2438
+ );
2439
+ var EnableAgenticManagementItemSchema = z.object({
2440
+ manager_id: z.string().describe(
2441
+ "ID of the manager automation Zapier provisioned to watch this workflow."
2442
+ )
2443
+ });
2444
+
2445
+ // src/plugins/agenticManagement/enableAgenticManagement/index.ts
2446
+ var enableAgenticManagementPlugin = defineMethod({
2447
+ ...agenticManagementDefaults,
2448
+ name: "enableAgenticManagement",
2449
+ imports: [apiPluginRef],
2450
+ resolvers: { workflow: workflowIdResolver },
2451
+ type: "create",
2452
+ itemType: "AgenticManagementEnableResult",
2453
+ inputSchema: EnableAgenticManagementSchema,
2454
+ outputSchema: EnableAgenticManagementItemSchema,
2455
+ output: "item",
2456
+ run: async ({ imports, input }) => {
2457
+ const body = { workflow_id: input.workflow };
2458
+ if (input.modes !== void 0) body.modes = input.modes;
2459
+ if (input.autoApprove !== void 0) body.auto_approve = input.autoApprove;
2460
+ const data = await imports.api.post(
2461
+ AGENTIC_MANAGEMENT_API,
2462
+ body,
2463
+ {
2464
+ authRequired: true,
2465
+ resource: {
2466
+ type: AGENTIC_MANAGEMENT_RESOURCE_TYPE,
2467
+ id: input.workflow
2468
+ }
2469
+ }
2470
+ );
2471
+ return { data };
2472
+ }
2473
+ });
2474
+ var DisableAgenticManagementSchema = z.object({
2475
+ workflow: WorkflowPropertySchema2.describe(
2476
+ "ID of the workflow to take out of agentic management."
2477
+ )
2478
+ }).describe(
2479
+ "Stop Agentic Management from working on one workflow. Its settings are kept, not deleted: the modes and auto-approve choice stay on file, so calling enableAgenticManagement later resumes with those settings instead of the defaults."
2480
+ );
2481
+ var DisableAgenticManagementItemSchema = z.object({
2482
+ ok: z.boolean().describe(
2483
+ "True when Zapier accepted the request to stop managing the workflow."
2484
+ )
2485
+ });
2486
+
2487
+ // src/plugins/agenticManagement/disableAgenticManagement/index.ts
2488
+ var disableAgenticManagementPlugin = defineMethod({
2489
+ ...agenticManagementDefaults,
2490
+ name: "disableAgenticManagement",
2491
+ imports: [apiPluginRef],
2492
+ resolvers: { workflow: workflowIdResolver },
2493
+ type: "delete",
2494
+ confirm: "delete",
2495
+ itemType: "AgenticManagementDisableResult",
2496
+ inputSchema: DisableAgenticManagementSchema,
2497
+ outputSchema: DisableAgenticManagementItemSchema,
2498
+ output: "item",
2499
+ run: async ({ imports, input }) => {
2500
+ const data = await imports.api.delete(
2501
+ `${AGENTIC_MANAGEMENT_API}/${encodeURIComponent(input.workflow)}`,
2502
+ void 0,
2503
+ {
2504
+ authRequired: true,
2505
+ resource: {
2506
+ type: AGENTIC_MANAGEMENT_RESOURCE_TYPE,
2507
+ id: input.workflow
2508
+ }
2509
+ }
2510
+ );
2511
+ return { data };
2512
+ }
2513
+ });
2514
+ var GetAgenticManagementConfigSchema = z.object({
2515
+ workflow: WorkflowPropertySchema2.describe("ID of the workflow to read.")
2516
+ }).describe("Read the Agentic Management config for one workflow.");
2517
+ var GetAgenticManagementConfigItemSchema = z.object({
2518
+ workflow_id: z.string().describe("The workflow this config describes."),
2519
+ enabled: z.boolean().describe(
2520
+ "Whether Agentic Management is currently active for this workflow."
2521
+ ),
2522
+ auto_approve: z.boolean().describe(
2523
+ "Whether fixes are applied without asking for approval first. `false` when Agentic Management has never been set up for this workflow."
2524
+ ),
2525
+ modes: z.array(AgenticModeOutputSchema).describe(
2526
+ "The modes the workflow runs. Still listed while `enabled` is false, because the settings are kept for a later re-enable \u2014 so read `enabled` to tell whether they are in effect, not this list."
2527
+ ),
2528
+ manager_id: z.string().nullable().optional().describe(
2529
+ "ID of the manager automation Zapier provisioned for this workflow, once one exists; `null` otherwise. Use it to link to that automation to see the runs it has taken."
2530
+ )
2531
+ });
2532
+
2533
+ // src/plugins/agenticManagement/getAgenticManagementConfig/index.ts
2534
+ var getAgenticManagementConfigPlugin = defineMethod({
2535
+ ...agenticManagementDefaults,
2536
+ name: "getAgenticManagementConfig",
2537
+ imports: [apiPluginRef],
2538
+ resolvers: { workflow: workflowIdResolver },
2539
+ type: "item",
2540
+ itemType: "AgenticManagementConfig",
2541
+ inputSchema: GetAgenticManagementConfigSchema,
2542
+ outputSchema: GetAgenticManagementConfigItemSchema,
2543
+ output: "item",
2544
+ run: async ({ imports, input }) => {
2545
+ const data = await imports.api.get(
2546
+ `${AGENTIC_MANAGEMENT_API}/${encodeURIComponent(input.workflow)}`,
2547
+ {
2548
+ authRequired: true,
2549
+ resource: {
2550
+ type: AGENTIC_MANAGEMENT_RESOURCE_TYPE,
2551
+ id: input.workflow
2552
+ }
2553
+ }
2554
+ );
2555
+ return { data };
2556
+ }
2557
+ });
2558
+ var UpdateAgenticManagementConfigSchema = z.object({
2559
+ workflow: WorkflowPropertySchema2.describe("ID of the workflow to update."),
2560
+ modes: AgenticModesInputSchema.optional().describe(
2561
+ `The modes to run. The list you pass replaces the whole current set in one step; it is not added to what is already active. Omit it to leave the active modes as they are. ${AGENTIC_MODES_EXPLAINED}`
2562
+ ),
2563
+ autoApprove: AutoApproveSchema.optional().describe(
2564
+ "Apply the fixes Agentic Management proposes without asking first. Set it to false and each fix waits for someone to approve it before anything changes. Omit it to leave the current setting alone."
2565
+ )
2566
+ }).refine(
2567
+ (input) => input.modes !== void 0 || input.autoApprove !== void 0,
2568
+ {
2569
+ message: "Pass modes, autoApprove, or both. An update with neither would change nothing, and Zapier rejects it."
2570
+ }
2571
+ ).describe(
2572
+ "Change the modes a workflow runs, whether fixes are applied without approval, or both. A `modes` list replaces the whole current set rather than adding to it."
2573
+ );
2574
+ var UpdateAgenticManagementConfigItemSchema = z.object({
2575
+ workflow_id: z.string().describe("The workflow whose config was updated."),
2576
+ modes: z.array(AgenticModeOutputSchema).describe("The modes the workflow runs after this update."),
2577
+ auto_approve: z.boolean().describe("Whether fixes are applied without approval after this update.")
2578
+ });
2579
+
2580
+ // src/plugins/agenticManagement/updateAgenticManagementConfig/index.ts
2581
+ var updateAgenticManagementConfigPlugin = defineMethod({
2582
+ ...agenticManagementDefaults,
2583
+ name: "updateAgenticManagementConfig",
2584
+ imports: [apiPluginRef],
2585
+ resolvers: { workflow: workflowIdResolver },
2586
+ type: "update",
2587
+ itemType: "AgenticManagementConfig",
2588
+ inputSchema: UpdateAgenticManagementConfigSchema,
2589
+ outputSchema: UpdateAgenticManagementConfigItemSchema,
2590
+ output: "item",
2591
+ run: async ({ imports, input }) => {
2592
+ const body = {};
2593
+ if (input.modes !== void 0) body.modes = input.modes;
2594
+ if (input.autoApprove !== void 0) body.auto_approve = input.autoApprove;
2595
+ const data = await imports.api.patch(
2596
+ `${AGENTIC_MANAGEMENT_API}/${encodeURIComponent(input.workflow)}`,
2597
+ body,
2598
+ {
2599
+ authRequired: true,
2600
+ resource: {
2601
+ type: AGENTIC_MANAGEMENT_RESOURCE_TYPE,
2602
+ id: input.workflow
2603
+ }
2604
+ }
2605
+ );
2606
+ return { data };
2607
+ }
2608
+ });
2609
+ var GetAgenticManagementIntentSchema = z.object({
2610
+ workflow: WorkflowPropertySchema2.describe("ID of the workflow to read."),
2611
+ version: VersionPropertySchema.optional().describe(
2612
+ "The workflow version the intent belongs to. Each version stores its own intent, and a version never picks up the intent of another, so publishing a new version starts it with none. Omit this to use the workflow's current published version."
2613
+ )
2614
+ }).describe(
2615
+ "Read the intent recorded for one workflow version: the plain-language description of what that version of the workflow is meant to do."
2616
+ );
2617
+
2618
+ // src/plugins/agenticManagement/getAgenticManagementIntent/index.ts
2619
+ var getAgenticManagementIntentPlugin = defineMethod({
2620
+ ...agenticManagementDefaults,
2621
+ name: "getAgenticManagementIntent",
2622
+ imports: [apiPluginRef],
2623
+ resolvers: { workflow: workflowIdResolver },
2624
+ type: "item",
2625
+ itemType: "AgenticManagementIntent",
2626
+ inputSchema: GetAgenticManagementIntentSchema,
2627
+ outputSchema: AgenticManagementIntentSchema,
2628
+ output: "item",
2629
+ run: async ({ imports, input }) => {
2630
+ const searchParams = {};
2631
+ if (input.version !== void 0) {
2632
+ searchParams.workflow_version_id = input.version;
2633
+ }
2634
+ const data = await imports.api.get(
2635
+ `${AGENTIC_MANAGEMENT_API}/${encodeURIComponent(input.workflow)}/intent`,
2636
+ {
2637
+ authRequired: true,
2638
+ searchParams,
2639
+ resource: {
2640
+ type: AGENTIC_MANAGEMENT_RESOURCE_TYPE,
2641
+ id: input.workflow
2642
+ }
2643
+ }
2644
+ );
2645
+ return { data };
2646
+ }
2647
+ });
2648
+ var UpdateAgenticManagementIntentSchema = z.object({
2649
+ workflow: WorkflowPropertySchema2.describe(
2650
+ "ID of the workflow to write to."
2651
+ ),
2652
+ intent: z.string().min(1).max(8e3).describe(
2653
+ "What this version of the workflow is for, in your own words: the outcome it produces, what sets it off, and anything that must always hold true. Plain prose, not code."
2654
+ ),
2655
+ version: VersionPropertySchema.optional().describe(
2656
+ "The workflow version the intent belongs to. Each version stores its own intent, and a version never picks up the intent of another, so publishing a new version starts it with none. Omit this to use the workflow's current published version."
2657
+ )
2658
+ }).describe(
2659
+ "Record what one workflow version is meant to do. Writing again for the same version replaces the text already stored, so there is no separate create and update."
2660
+ );
2661
+
2662
+ // src/plugins/agenticManagement/updateAgenticManagementIntent/index.ts
2663
+ var updateAgenticManagementIntentPlugin = defineMethod({
2664
+ ...agenticManagementDefaults,
2665
+ name: "updateAgenticManagementIntent",
2666
+ imports: [apiPluginRef],
2667
+ resolvers: { workflow: workflowIdResolver },
2668
+ type: "update",
2669
+ itemType: "AgenticManagementIntent",
2670
+ inputSchema: UpdateAgenticManagementIntentSchema,
2671
+ outputSchema: AgenticManagementIntentSchema,
2672
+ output: "item",
2673
+ run: async ({ imports, input }) => {
2674
+ const searchParams = {};
2675
+ if (input.version !== void 0) {
2676
+ searchParams.workflow_version_id = input.version;
2677
+ }
2678
+ const data = await imports.api.put(
2679
+ `${AGENTIC_MANAGEMENT_API}/${encodeURIComponent(input.workflow)}/intent`,
2680
+ { intent: input.intent },
2681
+ {
2682
+ authRequired: true,
2683
+ searchParams,
2684
+ resource: {
2685
+ type: AGENTIC_MANAGEMENT_RESOURCE_TYPE,
2686
+ id: input.workflow
2687
+ }
2688
+ }
2689
+ );
2690
+ return { data };
2691
+ }
2692
+ });
2693
+
2385
2694
  // src/experimental.ts
2386
2695
  var zapierExperimentalSdkPlugin = definePlugin({
2387
2696
  namespace: "zapier",
@@ -2418,8 +2727,18 @@ var zapierExperimentalSdkPlugin = definePlugin({
2418
2727
  getTriggerRunPlugin,
2419
2728
  validateWorkflowPlugin,
2420
2729
  // Human input (experimental). Routed through the Public API Gateway
2421
- // rather than the sdkapi proxy — see the `/forms` entry in api/client.ts.
2422
- createFormPlugin
2730
+ // rather than the sdkapi proxy — see the `/forms` entry in api/routing/config.ts.
2731
+ createFormPlugin,
2732
+ // Agentic Management (experimental). Also routed through the Public API
2733
+ // Gateway — see the `/agentic-management` entry in api/routing/config.ts.
2734
+ // The gateway route is staff-gated, and a non-staff caller gets a generic
2735
+ // 404 — see the note on AGENTIC_MANAGEMENT_API.
2736
+ enableAgenticManagementPlugin,
2737
+ disableAgenticManagementPlugin,
2738
+ getAgenticManagementConfigPlugin,
2739
+ updateAgenticManagementConfigPlugin,
2740
+ getAgenticManagementIntentPlugin,
2741
+ updateAgenticManagementIntentPlugin
2423
2742
  ]
2424
2743
  });
2425
2744
  function createZapierSdk(options = {}) {