@slates/provider 1.0.0-rc.18 → 1.0.0-rc.19

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.d.cts CHANGED
@@ -2,6 +2,66 @@ import z, { z as z$1 } from 'zod';
2
2
  import { AxiosResponse, AxiosError, CreateAxiosDefaults, AxiosInstance } from 'axios';
3
3
  import { ServiceError, ErrorRecord, ErrorData } from '@lowerdeck/error';
4
4
 
5
+ interface SlateAttachmentUrlContent {
6
+ type: 'url';
7
+ url: string;
8
+ headers?: Record<string, string>;
9
+ query?: Record<string, string>;
10
+ refreshReference?: unknown;
11
+ refreshAt?: string;
12
+ }
13
+ interface SlateAttachmentInlineContent {
14
+ type: 'content';
15
+ encoding: 'base64' | 'utf-8';
16
+ content: string;
17
+ }
18
+ interface SlateAttachmentUploadReferenceContent {
19
+ type: 'upload_reference';
20
+ referenceId: string;
21
+ }
22
+ interface SlateAttachment {
23
+ mimeType?: string;
24
+ attachmentHash?: string;
25
+ content: SlateAttachmentUrlContent | SlateAttachmentInlineContent | SlateAttachmentUploadReferenceContent;
26
+ }
27
+ declare let createUrlAttachment: (url: string, opts?: {
28
+ mimeType?: string;
29
+ attachmentHash?: string;
30
+ headers?: Record<string, string>;
31
+ query?: Record<string, string>;
32
+ refreshReference?: unknown;
33
+ refreshAt?: string;
34
+ }) => SlateAttachment;
35
+ declare let createBase64Attachment: (content: string, mimeType?: string, attachmentHash?: string) => SlateAttachment;
36
+ declare let createTextAttachment: (content: string, mimeType?: string, attachmentHash?: string) => SlateAttachment;
37
+
38
+ /**
39
+ * Placeholder prefix used to mark a redacted auth-config secret. Must match the hub's
40
+ * AuthConfigSecretSerializer (oss/src/slates/apps/hub/src/lib/secretSerializer.ts) exactly --
41
+ * the hub resolves these placeholders back to live secret values when it proxies an attachment.
42
+ */
43
+ declare let AUTH_CONFIG_SECRET_PLACEHOLDER_PREFIX: string;
44
+ /**
45
+ * Walks an auth config object and replaces any string value that exactly matches one of its
46
+ * leaf values with a `$$MT$secret$authConfig$<path>` placeholder. Literal, whole-value
47
+ * substitution only -- not a substring scan, and not a heuristic key-name/value-shape guess
48
+ * like the http trace redactor in '../axios/trace'.
49
+ */
50
+ declare class AuthConfigSecretRedactor {
51
+ private readonly secretToPlaceholder;
52
+ constructor(authConfig: Record<string, unknown> | undefined);
53
+ redact<T>(value: T): T;
54
+ private buildSecretMap;
55
+ private transform;
56
+ private isPlainObject;
57
+ }
58
+ /**
59
+ * Applied to every finalized attachment list right before it's sent over
60
+ * `slates/action.tool.invoke` (see @slates/provider-handler). Only `type: 'url'` attachments
61
+ * carry headers/query -- content/upload_reference attachments pass through untouched.
62
+ */
63
+ declare let redactUrlAttachmentSecrets: (attachments: SlateAttachment[] | undefined, authConfig: Record<string, unknown> | undefined) => SlateAttachment[] | undefined;
64
+
5
65
  interface SlateHttpTraceTextBody {
6
66
  contentType?: string;
7
67
  text: string;
@@ -28,6 +88,19 @@ interface SlateHttpTrace {
28
88
  };
29
89
  }
30
90
 
91
+ interface SlateLiveInvocationInfo {
92
+ token: string;
93
+ baseUrl: string;
94
+ maxAttachmentSizeBytes: number;
95
+ }
96
+ interface SlateDirectUploadInput {
97
+ live: SlateLiveInvocationInfo;
98
+ mimeType?: string;
99
+ filename?: string;
100
+ body: ReadableStream<Uint8Array> | Uint8Array;
101
+ }
102
+ declare let uploadAttachmentDirect: (d: SlateDirectUploadInput) => Promise<SlateAttachment>;
103
+
31
104
  type SlateLogType = 'info' | 'warn' | 'error' | 'progress';
32
105
  type SlateLogFields = Record<string, unknown>;
33
106
  type SlateLogMessageInput = string | Error | boolean | number | null | undefined | object | SlateLogMessageInput[];
@@ -74,7 +147,6 @@ type SlateAuthWithOauth<InputType extends {}, OutputType extends {
74
147
  scopes: {
75
148
  title: string;
76
149
  description?: string;
77
- defaultChecked?: boolean;
78
150
  scope: string;
79
151
  }[];
80
152
  docs?: SlateAuthDocsReference[];
@@ -358,11 +430,27 @@ declare class SlateSpecification<ConfigType extends {}, AuthType extends {}> {
358
430
  }
359
431
  declare let spec: <ConfigType extends {}, AuthType extends {}>(params: SlateSpecificationCreateParameters<ConfigType, AuthType>) => SlateSpecification<ConfigType, AuthType>;
360
432
 
433
+ type SlateAddAttachmentContent = Buffer | Uint8Array | ArrayBuffer | ReadableStream<Uint8Array> | NodeJS.ReadableStream | Response;
434
+ type SlateAddAttachmentInput = {
435
+ type: 'url';
436
+ url: string | URL;
437
+ mimeType?: string;
438
+ filename?: string;
439
+ headers?: Record<string, string>;
440
+ query?: Record<string, string>;
441
+ refreshReference?: unknown;
442
+ refreshAt?: string;
443
+ } | {
444
+ type: 'content';
445
+ content: SlateAddAttachmentContent;
446
+ mimeType?: string;
447
+ filename?: string;
448
+ };
361
449
  declare class SlatePublicContext<InputType extends {}> {
362
450
  #private;
363
451
  private readonly spec;
364
452
  private readonly logger;
365
- constructor(input: InputType, spec: SlateSpecification<any, any>, logger: SlateLogger);
453
+ constructor(input: InputType, spec: SlateSpecification<any, any>, logger: SlateLogger, liveInvocation?: SlateLiveInvocationInfo | null);
366
454
  get specification(): SlateSpecification<any, any>;
367
455
  get input(): Readonly<InputType>;
368
456
  get event(): Readonly<InputType>;
@@ -394,34 +482,21 @@ declare class SlatePublicContext<InputType extends {}> {
394
482
  warn(message: SlateLogMessageInput): void;
395
483
  error(message: SlateLogMessageInput): void;
396
484
  progress(message: SlateLogMessageInput): void;
485
+ addAttachment(input: SlateAddAttachmentInput): Promise<void>;
486
+ _finalizeAttachments(): Promise<SlateAttachment[]>;
487
+ _getAuthConfigForRedaction(): Record<string, unknown> | undefined;
397
488
  }
398
489
  declare class SlateContext<ConfigType extends {}, AuthType extends {}, InputType extends {}> extends SlatePublicContext<InputType> {
399
490
  #private;
400
- constructor(config: ConfigType, input: InputType, auth: AuthType, spec: SlateSpecification<ConfigType, AuthType>, logger: SlateLogger);
491
+ constructor(config: ConfigType, input: InputType, auth: AuthType, spec: SlateSpecification<ConfigType, AuthType>, logger: SlateLogger, liveInvocation?: SlateLiveInvocationInfo | null);
401
492
  get config(): Readonly<ConfigType>;
402
493
  get auth(): Readonly<AuthType>;
494
+ _getAuthConfigForRedaction(): Record<string, unknown> | undefined;
403
495
  }
404
496
 
405
497
  declare let runWithContext: <InputType extends {}, RV>(context: SlatePublicContext<InputType>, fn: () => Promise<RV>) => Promise<RV>;
406
498
  declare let getCurrentContext: <ConfigType extends {}, AuthType extends {}, InputType extends {}>() => SlateContext<ConfigType, AuthType, InputType>;
407
499
 
408
- interface SlateAttachmentUrlContent {
409
- type: 'url';
410
- url: string;
411
- }
412
- interface SlateAttachmentInlineContent {
413
- type: 'content';
414
- encoding: 'base64' | 'utf-8';
415
- content: string;
416
- }
417
- interface SlateAttachment {
418
- mimeType?: string;
419
- content: SlateAttachmentUrlContent | SlateAttachmentInlineContent;
420
- }
421
- declare let createUrlAttachment: (url: string, mimeType?: string) => SlateAttachment;
422
- declare let createBase64Attachment: (content: string, mimeType?: string) => SlateAttachment;
423
- declare let createTextAttachment: (content: string, mimeType?: string) => SlateAttachment;
424
-
425
500
  type SlateActionType = 'tool' | 'trigger';
426
501
  interface SlateActionScopeClause {
427
502
  OR: string[];
@@ -616,6 +691,22 @@ declare class SlateTool<ConfigType extends {}, AuthType extends {}, InputType ex
616
691
  }
617
692
  declare let tool: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, false>;
618
693
 
694
+ declare let GET_FILE_URL_TOOL_ID: string;
695
+ declare let getFileUrlToolInputSchema: z$1.ZodObject<{
696
+ url: z$1.ZodString;
697
+ reference: z$1.ZodNullable<z$1.ZodAny>;
698
+ }, z$1.core.$strip>;
699
+ type GetFileUrlToolInput = z$1.infer<typeof getFileUrlToolInputSchema>;
700
+ declare let getFileUrlToolOutputSchema: z$1.ZodObject<{
701
+ url: z$1.ZodString;
702
+ expiresAt: z$1.ZodString;
703
+ headers: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
704
+ query: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
705
+ }, z$1.core.$strip>;
706
+ type GetFileUrlToolOutput = z$1.infer<typeof getFileUrlToolOutputSchema>;
707
+ type GetFileUrlHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, GetFileUrlToolInput>) => Promise<GetFileUrlToolOutput>;
708
+ declare let getFileUrlTool: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, handleGetFileUrl: GetFileUrlHandler<ConfigType, AuthType>) => SlateTool<ConfigType, AuthType, any, any>;
709
+
619
710
  interface SlatePublicToolParameters<InputType extends {}, OutputType extends {}> extends SlateActionParameters {
620
711
  handleInvocation: SlatePublicToolInvocationHandler<InputType, OutputType>;
621
712
  }
@@ -914,7 +1005,7 @@ declare const graphWebhookHttp: {
914
1005
  declare let getGraphWebhookValidationResponse: (request: Request) => SlateWebhookHttpResponseInit | null;
915
1006
 
916
1007
  declare const metaWebhookHttp: {
917
- methods: ("GET" | "POST")[];
1008
+ methods: ("POST" | "GET")[];
918
1009
  sync: {
919
1010
  mode: "match";
920
1011
  match: {
@@ -925,4 +1016,4 @@ declare const metaWebhookHttp: {
925
1016
  };
926
1017
  declare let getMetaWebhookVerificationResponse: (request: Request, expectedVerifyToken: string | undefined) => SlateWebhookHttpResponseInit | null;
927
1018
 
928
- export { type ApiErrorBuildHelpers, type ApiErrorDetailOptions, type ApiErrorResponse, type ApiErrorStatus, type ApiServiceError, type BuildApiServiceErrorOptions, type CreateHmacSignatureOptions, type NormalizeOAuthTokenResponseOptions, type OAuthExpiresAtOptions, type OAuthRefreshTokenFallbackMode, type OAuthTokenResponse, Slate, SlateAction, SlateActionBuilder, type SlateActionCreateParameters, type SlateActionDocsReference, type SlateActionParameters, type SlateActionParametersAny, type SlateActionParametersTool, type SlateActionParametersTrigger, type SlateActionScopeClause, type SlateActionScopeClauseInput, type SlateActionScopeValue, type SlateActionScopes, type SlateActionScopesInput, type SlateActionType, SlateAdapter, type SlateAdapterCapability, SlateAdapterSpec, type SlateAdapterSpecParameters, type SlateAttachment, type SlateAttachmentInlineContent, type SlateAttachmentUrlContent, SlateAuth, type SlateAuthDocsReference, type SlateAuthType, type SlateAuthWithCustomData, type SlateAuthWithNone, type SlateAuthWithOauth, type SlateAuthWithServiceAccount, type SlateAuthWithToken, type SlateAuthenticatedAxiosDefaults, type SlateAxiosDefaults, type SlateAxiosErrorAdapter, type SlateAxiosErrorOptions, SlateConfig, type SlateConfigDocsReference, SlateContext, SlateDeclarationError, SlateDefaultPollingIntervalSeconds, type SlateDocsReference, SlateError, type SlateErrorInput, type SlateErrorIssue, type SlateErrorKind, type SlateErrorProviderInfo, type SlateErrorResponse, type SlateErrorUpstreamInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type SlatePollingOptions, type SlateProviderDocsReference, SlatePublicContext, SlatePublicTool, type SlatePublicToolInvocationHandler, type SlatePublicToolParameters, type SlateServiceErrorData, SlateSpecification, type SlateSpecificationCreateParameters, type SlateSpecificationParameters, SlateTool, type SlateToolInvocationHandler, type SlateToolParameters, SlateTrigger, type SlateTriggerMappingHandler, type SlateTriggerParameters, type SlateTriggerPollingHandler, type SlateTriggerWebhookAutoRegistrationHandler, type SlateTriggerWebhookAutoUnregistrationHandler, type SlateTriggerWebhookRequestHandler, type SlateTypedDocsReference, type SlateWebhookHttpMethod, type SlateWebhookHttpOptions, type SlateWebhookHttpResponseInit, type SlateWebhookRequestMatcher, type VerifyHmacSignatureOptions, adapterSpec, allOf, anyOf, auth, axios, buildApiServiceError, collectApiErrorDetails, config, createApiServiceError, createAuthenticatedAxios, createAxios, createBase64Attachment, createHmacSignature, createSlateError, createTextAttachment, createUrlAttachment, extractApiErrorMessage, getApiErrorResponse, getApiErrorStatus, getBase64ByteLength, getCurrentContext, getGraphWebhookValidationResponse, getMetaWebhookVerificationResponse, getOAuthExpiresAtFromExpiresIn, getResponseHeaderValue, getServiceErrorData, graphWebhookHttp, inferSlateErrorFromAxios, isApiErrorRecord, isAxiosErrorLike, isServiceErrorData, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, metaWebhookHttp, normalizeOAuthTokenResponse, pickDefined, publicTool, requestAxios, requestAxiosData, runWithContext, scopeClause, setIfDefined, spec, statusLabelForApiError, tool, trigger, validateScopes, verifyHmacSignature };
1019
+ export { AUTH_CONFIG_SECRET_PLACEHOLDER_PREFIX, type ApiErrorBuildHelpers, type ApiErrorDetailOptions, type ApiErrorResponse, type ApiErrorStatus, type ApiServiceError, AuthConfigSecretRedactor, type BuildApiServiceErrorOptions, type CreateHmacSignatureOptions, GET_FILE_URL_TOOL_ID, type GetFileUrlHandler, type GetFileUrlToolInput, type GetFileUrlToolOutput, type NormalizeOAuthTokenResponseOptions, type OAuthExpiresAtOptions, type OAuthRefreshTokenFallbackMode, type OAuthTokenResponse, Slate, SlateAction, SlateActionBuilder, type SlateActionCreateParameters, type SlateActionDocsReference, type SlateActionParameters, type SlateActionParametersAny, type SlateActionParametersTool, type SlateActionParametersTrigger, type SlateActionScopeClause, type SlateActionScopeClauseInput, type SlateActionScopeValue, type SlateActionScopes, type SlateActionScopesInput, type SlateActionType, SlateAdapter, type SlateAdapterCapability, SlateAdapterSpec, type SlateAdapterSpecParameters, type SlateAddAttachmentContent, type SlateAddAttachmentInput, type SlateAttachment, type SlateAttachmentInlineContent, type SlateAttachmentUploadReferenceContent, type SlateAttachmentUrlContent, SlateAuth, type SlateAuthDocsReference, type SlateAuthType, type SlateAuthWithCustomData, type SlateAuthWithNone, type SlateAuthWithOauth, type SlateAuthWithServiceAccount, type SlateAuthWithToken, type SlateAuthenticatedAxiosDefaults, type SlateAxiosDefaults, type SlateAxiosErrorAdapter, type SlateAxiosErrorOptions, SlateConfig, type SlateConfigDocsReference, SlateContext, SlateDeclarationError, SlateDefaultPollingIntervalSeconds, type SlateDirectUploadInput, type SlateDocsReference, SlateError, type SlateErrorInput, type SlateErrorIssue, type SlateErrorKind, type SlateErrorProviderInfo, type SlateErrorResponse, type SlateErrorUpstreamInfo, type SlateLiveInvocationInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type SlatePollingOptions, type SlateProviderDocsReference, SlatePublicContext, SlatePublicTool, type SlatePublicToolInvocationHandler, type SlatePublicToolParameters, type SlateServiceErrorData, SlateSpecification, type SlateSpecificationCreateParameters, type SlateSpecificationParameters, SlateTool, type SlateToolInvocationHandler, type SlateToolParameters, SlateTrigger, type SlateTriggerMappingHandler, type SlateTriggerParameters, type SlateTriggerPollingHandler, type SlateTriggerWebhookAutoRegistrationHandler, type SlateTriggerWebhookAutoUnregistrationHandler, type SlateTriggerWebhookRequestHandler, type SlateTypedDocsReference, type SlateWebhookHttpMethod, type SlateWebhookHttpOptions, type SlateWebhookHttpResponseInit, type SlateWebhookRequestMatcher, type VerifyHmacSignatureOptions, adapterSpec, allOf, anyOf, auth, axios, buildApiServiceError, collectApiErrorDetails, config, createApiServiceError, createAuthenticatedAxios, createAxios, createBase64Attachment, createHmacSignature, createSlateError, createTextAttachment, createUrlAttachment, extractApiErrorMessage, getApiErrorResponse, getApiErrorStatus, getBase64ByteLength, getCurrentContext, getFileUrlTool, getFileUrlToolInputSchema, getFileUrlToolOutputSchema, getGraphWebhookValidationResponse, getMetaWebhookVerificationResponse, getOAuthExpiresAtFromExpiresIn, getResponseHeaderValue, getServiceErrorData, graphWebhookHttp, inferSlateErrorFromAxios, isApiErrorRecord, isAxiosErrorLike, isServiceErrorData, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, metaWebhookHttp, normalizeOAuthTokenResponse, pickDefined, publicTool, redactUrlAttachmentSecrets, requestAxios, requestAxiosData, runWithContext, scopeClause, setIfDefined, spec, statusLabelForApiError, tool, trigger, uploadAttachmentDirect, validateScopes, verifyHmacSignature };
package/dist/index.d.ts CHANGED
@@ -2,6 +2,66 @@ import z, { z as z$1 } from 'zod';
2
2
  import { AxiosResponse, AxiosError, CreateAxiosDefaults, AxiosInstance } from 'axios';
3
3
  import { ServiceError, ErrorRecord, ErrorData } from '@lowerdeck/error';
4
4
 
5
+ interface SlateAttachmentUrlContent {
6
+ type: 'url';
7
+ url: string;
8
+ headers?: Record<string, string>;
9
+ query?: Record<string, string>;
10
+ refreshReference?: unknown;
11
+ refreshAt?: string;
12
+ }
13
+ interface SlateAttachmentInlineContent {
14
+ type: 'content';
15
+ encoding: 'base64' | 'utf-8';
16
+ content: string;
17
+ }
18
+ interface SlateAttachmentUploadReferenceContent {
19
+ type: 'upload_reference';
20
+ referenceId: string;
21
+ }
22
+ interface SlateAttachment {
23
+ mimeType?: string;
24
+ attachmentHash?: string;
25
+ content: SlateAttachmentUrlContent | SlateAttachmentInlineContent | SlateAttachmentUploadReferenceContent;
26
+ }
27
+ declare let createUrlAttachment: (url: string, opts?: {
28
+ mimeType?: string;
29
+ attachmentHash?: string;
30
+ headers?: Record<string, string>;
31
+ query?: Record<string, string>;
32
+ refreshReference?: unknown;
33
+ refreshAt?: string;
34
+ }) => SlateAttachment;
35
+ declare let createBase64Attachment: (content: string, mimeType?: string, attachmentHash?: string) => SlateAttachment;
36
+ declare let createTextAttachment: (content: string, mimeType?: string, attachmentHash?: string) => SlateAttachment;
37
+
38
+ /**
39
+ * Placeholder prefix used to mark a redacted auth-config secret. Must match the hub's
40
+ * AuthConfigSecretSerializer (oss/src/slates/apps/hub/src/lib/secretSerializer.ts) exactly --
41
+ * the hub resolves these placeholders back to live secret values when it proxies an attachment.
42
+ */
43
+ declare let AUTH_CONFIG_SECRET_PLACEHOLDER_PREFIX: string;
44
+ /**
45
+ * Walks an auth config object and replaces any string value that exactly matches one of its
46
+ * leaf values with a `$$MT$secret$authConfig$<path>` placeholder. Literal, whole-value
47
+ * substitution only -- not a substring scan, and not a heuristic key-name/value-shape guess
48
+ * like the http trace redactor in '../axios/trace'.
49
+ */
50
+ declare class AuthConfigSecretRedactor {
51
+ private readonly secretToPlaceholder;
52
+ constructor(authConfig: Record<string, unknown> | undefined);
53
+ redact<T>(value: T): T;
54
+ private buildSecretMap;
55
+ private transform;
56
+ private isPlainObject;
57
+ }
58
+ /**
59
+ * Applied to every finalized attachment list right before it's sent over
60
+ * `slates/action.tool.invoke` (see @slates/provider-handler). Only `type: 'url'` attachments
61
+ * carry headers/query -- content/upload_reference attachments pass through untouched.
62
+ */
63
+ declare let redactUrlAttachmentSecrets: (attachments: SlateAttachment[] | undefined, authConfig: Record<string, unknown> | undefined) => SlateAttachment[] | undefined;
64
+
5
65
  interface SlateHttpTraceTextBody {
6
66
  contentType?: string;
7
67
  text: string;
@@ -28,6 +88,19 @@ interface SlateHttpTrace {
28
88
  };
29
89
  }
30
90
 
91
+ interface SlateLiveInvocationInfo {
92
+ token: string;
93
+ baseUrl: string;
94
+ maxAttachmentSizeBytes: number;
95
+ }
96
+ interface SlateDirectUploadInput {
97
+ live: SlateLiveInvocationInfo;
98
+ mimeType?: string;
99
+ filename?: string;
100
+ body: ReadableStream<Uint8Array> | Uint8Array;
101
+ }
102
+ declare let uploadAttachmentDirect: (d: SlateDirectUploadInput) => Promise<SlateAttachment>;
103
+
31
104
  type SlateLogType = 'info' | 'warn' | 'error' | 'progress';
32
105
  type SlateLogFields = Record<string, unknown>;
33
106
  type SlateLogMessageInput = string | Error | boolean | number | null | undefined | object | SlateLogMessageInput[];
@@ -74,7 +147,6 @@ type SlateAuthWithOauth<InputType extends {}, OutputType extends {
74
147
  scopes: {
75
148
  title: string;
76
149
  description?: string;
77
- defaultChecked?: boolean;
78
150
  scope: string;
79
151
  }[];
80
152
  docs?: SlateAuthDocsReference[];
@@ -358,11 +430,27 @@ declare class SlateSpecification<ConfigType extends {}, AuthType extends {}> {
358
430
  }
359
431
  declare let spec: <ConfigType extends {}, AuthType extends {}>(params: SlateSpecificationCreateParameters<ConfigType, AuthType>) => SlateSpecification<ConfigType, AuthType>;
360
432
 
433
+ type SlateAddAttachmentContent = Buffer | Uint8Array | ArrayBuffer | ReadableStream<Uint8Array> | NodeJS.ReadableStream | Response;
434
+ type SlateAddAttachmentInput = {
435
+ type: 'url';
436
+ url: string | URL;
437
+ mimeType?: string;
438
+ filename?: string;
439
+ headers?: Record<string, string>;
440
+ query?: Record<string, string>;
441
+ refreshReference?: unknown;
442
+ refreshAt?: string;
443
+ } | {
444
+ type: 'content';
445
+ content: SlateAddAttachmentContent;
446
+ mimeType?: string;
447
+ filename?: string;
448
+ };
361
449
  declare class SlatePublicContext<InputType extends {}> {
362
450
  #private;
363
451
  private readonly spec;
364
452
  private readonly logger;
365
- constructor(input: InputType, spec: SlateSpecification<any, any>, logger: SlateLogger);
453
+ constructor(input: InputType, spec: SlateSpecification<any, any>, logger: SlateLogger, liveInvocation?: SlateLiveInvocationInfo | null);
366
454
  get specification(): SlateSpecification<any, any>;
367
455
  get input(): Readonly<InputType>;
368
456
  get event(): Readonly<InputType>;
@@ -394,34 +482,21 @@ declare class SlatePublicContext<InputType extends {}> {
394
482
  warn(message: SlateLogMessageInput): void;
395
483
  error(message: SlateLogMessageInput): void;
396
484
  progress(message: SlateLogMessageInput): void;
485
+ addAttachment(input: SlateAddAttachmentInput): Promise<void>;
486
+ _finalizeAttachments(): Promise<SlateAttachment[]>;
487
+ _getAuthConfigForRedaction(): Record<string, unknown> | undefined;
397
488
  }
398
489
  declare class SlateContext<ConfigType extends {}, AuthType extends {}, InputType extends {}> extends SlatePublicContext<InputType> {
399
490
  #private;
400
- constructor(config: ConfigType, input: InputType, auth: AuthType, spec: SlateSpecification<ConfigType, AuthType>, logger: SlateLogger);
491
+ constructor(config: ConfigType, input: InputType, auth: AuthType, spec: SlateSpecification<ConfigType, AuthType>, logger: SlateLogger, liveInvocation?: SlateLiveInvocationInfo | null);
401
492
  get config(): Readonly<ConfigType>;
402
493
  get auth(): Readonly<AuthType>;
494
+ _getAuthConfigForRedaction(): Record<string, unknown> | undefined;
403
495
  }
404
496
 
405
497
  declare let runWithContext: <InputType extends {}, RV>(context: SlatePublicContext<InputType>, fn: () => Promise<RV>) => Promise<RV>;
406
498
  declare let getCurrentContext: <ConfigType extends {}, AuthType extends {}, InputType extends {}>() => SlateContext<ConfigType, AuthType, InputType>;
407
499
 
408
- interface SlateAttachmentUrlContent {
409
- type: 'url';
410
- url: string;
411
- }
412
- interface SlateAttachmentInlineContent {
413
- type: 'content';
414
- encoding: 'base64' | 'utf-8';
415
- content: string;
416
- }
417
- interface SlateAttachment {
418
- mimeType?: string;
419
- content: SlateAttachmentUrlContent | SlateAttachmentInlineContent;
420
- }
421
- declare let createUrlAttachment: (url: string, mimeType?: string) => SlateAttachment;
422
- declare let createBase64Attachment: (content: string, mimeType?: string) => SlateAttachment;
423
- declare let createTextAttachment: (content: string, mimeType?: string) => SlateAttachment;
424
-
425
500
  type SlateActionType = 'tool' | 'trigger';
426
501
  interface SlateActionScopeClause {
427
502
  OR: string[];
@@ -616,6 +691,22 @@ declare class SlateTool<ConfigType extends {}, AuthType extends {}, InputType ex
616
691
  }
617
692
  declare let tool: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"tool", ConfigType, AuthType, {}, {}, SlateTool<ConfigType, AuthType, any, any>, false>;
618
693
 
694
+ declare let GET_FILE_URL_TOOL_ID: string;
695
+ declare let getFileUrlToolInputSchema: z$1.ZodObject<{
696
+ url: z$1.ZodString;
697
+ reference: z$1.ZodNullable<z$1.ZodAny>;
698
+ }, z$1.core.$strip>;
699
+ type GetFileUrlToolInput = z$1.infer<typeof getFileUrlToolInputSchema>;
700
+ declare let getFileUrlToolOutputSchema: z$1.ZodObject<{
701
+ url: z$1.ZodString;
702
+ expiresAt: z$1.ZodString;
703
+ headers: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
704
+ query: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
705
+ }, z$1.core.$strip>;
706
+ type GetFileUrlToolOutput = z$1.infer<typeof getFileUrlToolOutputSchema>;
707
+ type GetFileUrlHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, GetFileUrlToolInput>) => Promise<GetFileUrlToolOutput>;
708
+ declare let getFileUrlTool: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, handleGetFileUrl: GetFileUrlHandler<ConfigType, AuthType>) => SlateTool<ConfigType, AuthType, any, any>;
709
+
619
710
  interface SlatePublicToolParameters<InputType extends {}, OutputType extends {}> extends SlateActionParameters {
620
711
  handleInvocation: SlatePublicToolInvocationHandler<InputType, OutputType>;
621
712
  }
@@ -914,7 +1005,7 @@ declare const graphWebhookHttp: {
914
1005
  declare let getGraphWebhookValidationResponse: (request: Request) => SlateWebhookHttpResponseInit | null;
915
1006
 
916
1007
  declare const metaWebhookHttp: {
917
- methods: ("GET" | "POST")[];
1008
+ methods: ("POST" | "GET")[];
918
1009
  sync: {
919
1010
  mode: "match";
920
1011
  match: {
@@ -925,4 +1016,4 @@ declare const metaWebhookHttp: {
925
1016
  };
926
1017
  declare let getMetaWebhookVerificationResponse: (request: Request, expectedVerifyToken: string | undefined) => SlateWebhookHttpResponseInit | null;
927
1018
 
928
- export { type ApiErrorBuildHelpers, type ApiErrorDetailOptions, type ApiErrorResponse, type ApiErrorStatus, type ApiServiceError, type BuildApiServiceErrorOptions, type CreateHmacSignatureOptions, type NormalizeOAuthTokenResponseOptions, type OAuthExpiresAtOptions, type OAuthRefreshTokenFallbackMode, type OAuthTokenResponse, Slate, SlateAction, SlateActionBuilder, type SlateActionCreateParameters, type SlateActionDocsReference, type SlateActionParameters, type SlateActionParametersAny, type SlateActionParametersTool, type SlateActionParametersTrigger, type SlateActionScopeClause, type SlateActionScopeClauseInput, type SlateActionScopeValue, type SlateActionScopes, type SlateActionScopesInput, type SlateActionType, SlateAdapter, type SlateAdapterCapability, SlateAdapterSpec, type SlateAdapterSpecParameters, type SlateAttachment, type SlateAttachmentInlineContent, type SlateAttachmentUrlContent, SlateAuth, type SlateAuthDocsReference, type SlateAuthType, type SlateAuthWithCustomData, type SlateAuthWithNone, type SlateAuthWithOauth, type SlateAuthWithServiceAccount, type SlateAuthWithToken, type SlateAuthenticatedAxiosDefaults, type SlateAxiosDefaults, type SlateAxiosErrorAdapter, type SlateAxiosErrorOptions, SlateConfig, type SlateConfigDocsReference, SlateContext, SlateDeclarationError, SlateDefaultPollingIntervalSeconds, type SlateDocsReference, SlateError, type SlateErrorInput, type SlateErrorIssue, type SlateErrorKind, type SlateErrorProviderInfo, type SlateErrorResponse, type SlateErrorUpstreamInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type SlatePollingOptions, type SlateProviderDocsReference, SlatePublicContext, SlatePublicTool, type SlatePublicToolInvocationHandler, type SlatePublicToolParameters, type SlateServiceErrorData, SlateSpecification, type SlateSpecificationCreateParameters, type SlateSpecificationParameters, SlateTool, type SlateToolInvocationHandler, type SlateToolParameters, SlateTrigger, type SlateTriggerMappingHandler, type SlateTriggerParameters, type SlateTriggerPollingHandler, type SlateTriggerWebhookAutoRegistrationHandler, type SlateTriggerWebhookAutoUnregistrationHandler, type SlateTriggerWebhookRequestHandler, type SlateTypedDocsReference, type SlateWebhookHttpMethod, type SlateWebhookHttpOptions, type SlateWebhookHttpResponseInit, type SlateWebhookRequestMatcher, type VerifyHmacSignatureOptions, adapterSpec, allOf, anyOf, auth, axios, buildApiServiceError, collectApiErrorDetails, config, createApiServiceError, createAuthenticatedAxios, createAxios, createBase64Attachment, createHmacSignature, createSlateError, createTextAttachment, createUrlAttachment, extractApiErrorMessage, getApiErrorResponse, getApiErrorStatus, getBase64ByteLength, getCurrentContext, getGraphWebhookValidationResponse, getMetaWebhookVerificationResponse, getOAuthExpiresAtFromExpiresIn, getResponseHeaderValue, getServiceErrorData, graphWebhookHttp, inferSlateErrorFromAxios, isApiErrorRecord, isAxiosErrorLike, isServiceErrorData, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, metaWebhookHttp, normalizeOAuthTokenResponse, pickDefined, publicTool, requestAxios, requestAxiosData, runWithContext, scopeClause, setIfDefined, spec, statusLabelForApiError, tool, trigger, validateScopes, verifyHmacSignature };
1019
+ export { AUTH_CONFIG_SECRET_PLACEHOLDER_PREFIX, type ApiErrorBuildHelpers, type ApiErrorDetailOptions, type ApiErrorResponse, type ApiErrorStatus, type ApiServiceError, AuthConfigSecretRedactor, type BuildApiServiceErrorOptions, type CreateHmacSignatureOptions, GET_FILE_URL_TOOL_ID, type GetFileUrlHandler, type GetFileUrlToolInput, type GetFileUrlToolOutput, type NormalizeOAuthTokenResponseOptions, type OAuthExpiresAtOptions, type OAuthRefreshTokenFallbackMode, type OAuthTokenResponse, Slate, SlateAction, SlateActionBuilder, type SlateActionCreateParameters, type SlateActionDocsReference, type SlateActionParameters, type SlateActionParametersAny, type SlateActionParametersTool, type SlateActionParametersTrigger, type SlateActionScopeClause, type SlateActionScopeClauseInput, type SlateActionScopeValue, type SlateActionScopes, type SlateActionScopesInput, type SlateActionType, SlateAdapter, type SlateAdapterCapability, SlateAdapterSpec, type SlateAdapterSpecParameters, type SlateAddAttachmentContent, type SlateAddAttachmentInput, type SlateAttachment, type SlateAttachmentInlineContent, type SlateAttachmentUploadReferenceContent, type SlateAttachmentUrlContent, SlateAuth, type SlateAuthDocsReference, type SlateAuthType, type SlateAuthWithCustomData, type SlateAuthWithNone, type SlateAuthWithOauth, type SlateAuthWithServiceAccount, type SlateAuthWithToken, type SlateAuthenticatedAxiosDefaults, type SlateAxiosDefaults, type SlateAxiosErrorAdapter, type SlateAxiosErrorOptions, SlateConfig, type SlateConfigDocsReference, SlateContext, SlateDeclarationError, SlateDefaultPollingIntervalSeconds, type SlateDirectUploadInput, type SlateDocsReference, SlateError, type SlateErrorInput, type SlateErrorIssue, type SlateErrorKind, type SlateErrorProviderInfo, type SlateErrorResponse, type SlateErrorUpstreamInfo, type SlateLiveInvocationInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type SlatePollingOptions, type SlateProviderDocsReference, SlatePublicContext, SlatePublicTool, type SlatePublicToolInvocationHandler, type SlatePublicToolParameters, type SlateServiceErrorData, SlateSpecification, type SlateSpecificationCreateParameters, type SlateSpecificationParameters, SlateTool, type SlateToolInvocationHandler, type SlateToolParameters, SlateTrigger, type SlateTriggerMappingHandler, type SlateTriggerParameters, type SlateTriggerPollingHandler, type SlateTriggerWebhookAutoRegistrationHandler, type SlateTriggerWebhookAutoUnregistrationHandler, type SlateTriggerWebhookRequestHandler, type SlateTypedDocsReference, type SlateWebhookHttpMethod, type SlateWebhookHttpOptions, type SlateWebhookHttpResponseInit, type SlateWebhookRequestMatcher, type VerifyHmacSignatureOptions, adapterSpec, allOf, anyOf, auth, axios, buildApiServiceError, collectApiErrorDetails, config, createApiServiceError, createAuthenticatedAxios, createAxios, createBase64Attachment, createHmacSignature, createSlateError, createTextAttachment, createUrlAttachment, extractApiErrorMessage, getApiErrorResponse, getApiErrorStatus, getBase64ByteLength, getCurrentContext, getFileUrlTool, getFileUrlToolInputSchema, getFileUrlToolOutputSchema, getGraphWebhookValidationResponse, getMetaWebhookVerificationResponse, getOAuthExpiresAtFromExpiresIn, getResponseHeaderValue, getServiceErrorData, graphWebhookHttp, inferSlateErrorFromAxios, isApiErrorRecord, isAxiosErrorLike, isServiceErrorData, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, metaWebhookHttp, normalizeOAuthTokenResponse, pickDefined, publicTool, redactUrlAttachmentSecrets, requestAxios, requestAxiosData, runWithContext, scopeClause, setIfDefined, spec, statusLabelForApiError, tool, trigger, uploadAttachmentDirect, validateScopes, verifyHmacSignature };