eve 0.13.1 → 0.13.3
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/CHANGELOG.md +13 -0
- package/dist/src/chunks/use-eve-agent-B18LYpfZ.js +5765 -0
- package/dist/src/chunks/use-eve-agent-BPI1nbo5.js +5795 -0
- package/dist/src/cli/dev/tui/provider-picker.d.ts +64 -0
- package/dist/src/cli/dev/tui/provider-picker.js +1 -0
- package/dist/src/cli/dev/tui/remote-auth-result.d.ts +21 -0
- package/dist/src/cli/dev/tui/remote-auth-result.js +1 -0
- package/dist/src/cli/dev/tui/remote-connection-probe.d.ts +9 -0
- package/dist/src/cli/dev/tui/remote-connection-probe.js +1 -0
- package/dist/src/cli/dev/tui/remote-connection-types.d.ts +67 -0
- package/dist/src/cli/dev/tui/remote-connection-types.js +1 -0
- package/dist/src/cli/dev/tui/remote-connection.d.ts +3 -0
- package/dist/src/cli/dev/tui/remote-connection.js +1 -0
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/setup-commands.d.ts +1 -1
- package/dist/src/cli/dev/tui/setup-commands.js +2 -2
- package/dist/src/cli/dev/tui/setup-flow.d.ts +3 -0
- package/dist/src/cli/dev/tui/setup-issues.d.ts +7 -0
- package/dist/src/cli/dev/tui/setup-issues.js +1 -1
- package/dist/src/cli/dev/tui/setup-panel.d.ts +25 -12
- package/dist/src/cli/dev/tui/setup-panel.js +3 -2
- package/dist/src/cli/dev/tui/target.d.ts +2 -0
- package/dist/src/cli/dev/tui/target.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.js +9 -9
- package/dist/src/cli/dev/tui/test/fake-setup-flow-renderer.js +1 -1
- package/dist/src/cli/dev/tui/tui.js +1 -1
- package/dist/src/cli/dev/tui/vercel-trusted-sources-policy.d.ts +22 -0
- package/dist/src/cli/dev/tui/vercel-trusted-sources-policy.js +1 -0
- package/dist/src/cli/dev/tui/vercel-trusted-sources.d.ts +48 -0
- package/dist/src/cli/dev/tui/vercel-trusted-sources.js +1 -0
- package/dist/src/client/agent-info-schema.d.ts +532 -0
- package/dist/src/client/agent-info-schema.js +1 -0
- package/dist/src/client/client.js +1 -1
- package/dist/src/client/types.d.ts +11 -169
- package/dist/src/client/types.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +4 -4
- package/dist/src/compiled/@chat-adapter/slack/_slack-web-api.d.ts +1 -0
- package/dist/src/compiled/@chat-adapter/slack/blocks.d.ts +160 -0
- package/dist/src/compiled/@chat-adapter/slack/blocks.js +8 -0
- package/dist/src/compiled/@chat-adapter/slack/index.d.ts +28 -3
- package/dist/src/compiled/@chat-adapter/slack/index.js +26 -26
- package/dist/src/compiled/_chunks/node/chunk-AYN7QRWH-Csu8sG38.js +1 -0
- package/dist/src/compiled/_chunks/node/{dist-BQYUcBqu.js → dist-W8yle6rh.js} +3 -3
- package/dist/src/compiled/chat/index.d.ts +4 -4
- package/dist/src/compiled/chat/index.js +1 -1
- package/dist/src/compiled/chat/{jsx-runtime-CFq1K_Ve.d.ts → jsx-runtime-CzthIo1o.d.ts} +6 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.1/node_modules/@vercel/sdk/esm/lib/primitives.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.1/node_modules/@vercel/sdk/esm/lib/schemas.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.1/node_modules/@vercel/sdk/esm/models/aclaction.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.1/node_modules/@vercel/sdk/esm/models/sdkvalidationerror.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.1/node_modules/@vercel/sdk/esm/models/updateprojectprojectsaction.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.1/node_modules/@vercel/sdk/esm/models/updateprojectprojectsoptionsallowlist.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.1/node_modules/@vercel/sdk/esm/types/defaultToZeroValue.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.1/node_modules/@vercel/sdk/esm/types/fp.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.1/node_modules/@vercel/sdk/esm/types/primitives.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.1/node_modules/@vercel/sdk/esm/types/rfcdate.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.1/node_modules/@vercel/sdk/esm/types/smartUnion.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.1/node_modules/@vercel/sdk/esm/types/unrecognized.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/ZodError.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/errors.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/external.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/helpers/errorUtil.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/helpers/parseUtil.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/helpers/util.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/index.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/locales/en.js +1 -0
- package/dist/src/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/types.js +1 -0
- package/dist/src/public/channels/slack/blocks.d.ts +3 -41
- package/dist/src/public/channels/slack/blocks.js +2 -3
- package/dist/src/public/channels/slack/defaults.js +3 -3
- package/dist/src/services/dev-client/client-options.js +1 -1
- package/dist/src/services/dev-client/credential-gate.d.ts +11 -6
- package/dist/src/services/dev-client/credential-gate.js +1 -1
- package/dist/src/services/dev-client/request-headers.d.ts +0 -12
- package/dist/src/services/dev-client/request-headers.js +1 -1
- package/dist/src/services/dev-client/vercel-auth-error.js +1 -1
- package/dist/src/setup/flows/model.d.ts +5 -5
- package/dist/src/setup/flows/model.js +1 -1
- package/dist/src/setup/flows/provider.d.ts +57 -0
- package/dist/src/setup/flows/provider.js +4 -0
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/guides/client/overview.mdx +24 -0
- package/docs/guides/dev-tui.md +4 -4
- package/docs/guides/instrumentation.md +1 -1
- package/package.json +5 -4
- package/dist/src/chunks/use-eve-agent-DEm_Jg4k.js +0 -1343
- package/dist/src/chunks/use-eve-agent-DsXOQMFZ.js +0 -1313
- package/dist/src/setup/flows/vercel.d.ts +0 -37
- package/dist/src/setup/flows/vercel.js +0 -2
|
@@ -3,8 +3,7 @@ import type { StandardJSONSchemaV1 } from "#compiled/@standard-schema/spec/index
|
|
|
3
3
|
import type { HandleMessageStreamEvent } from "#protocol/message.js";
|
|
4
4
|
import type { InputRequest, InputResponse } from "#runtime/input/types.js";
|
|
5
5
|
import type { JsonObject } from "#shared/json.js";
|
|
6
|
-
|
|
7
|
-
import type { ModelEndpointStatus } from "#shared/model-endpoint-status.js";
|
|
6
|
+
export type { AgentInfoChannelEntry, AgentInfoChannels, AgentInfoConnectionEntry, AgentInfoDynamicResolverEntry, AgentInfoEntry, AgentInfoFrameworkChannelEntry, AgentInfoFrameworkToolEntry, AgentInfoHookEntry, AgentInfoInstructions, AgentInfoInstructionsEntry, AgentInfoResult, AgentInfoSandboxEntry, AgentInfoScheduleEntry, AgentInfoSkillEntry, AgentInfoSource, AgentInfoSubagentEntry, AgentInfoToolEntry, AgentInfoTools, } from "./agent-info-schema.js";
|
|
8
7
|
/**
|
|
9
8
|
* Static credential value or per-request credential resolver.
|
|
10
9
|
*/
|
|
@@ -27,7 +26,17 @@ export type ClientAuth = {
|
|
|
27
26
|
};
|
|
28
27
|
} | {
|
|
29
28
|
readonly bearer: TokenValue;
|
|
29
|
+
} | {
|
|
30
|
+
readonly vercelOidc: {
|
|
31
|
+
readonly token: TokenValue;
|
|
32
|
+
};
|
|
30
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* Vercel header that presents a trusted OIDC token as proof the caller is
|
|
36
|
+
* authorized for a protected deployment. The client emits it alongside
|
|
37
|
+
* `Authorization` for the {@link ClientAuth} `vercelOidc` variant.
|
|
38
|
+
*/
|
|
39
|
+
export declare const VERCEL_TRUSTED_OIDC_IDP_TOKEN_HEADER = "x-vercel-trusted-oidc-idp-token";
|
|
31
40
|
/** Redirect modes supported by the configured fetch implementation. */
|
|
32
41
|
export type ClientRedirectPolicy = NonNullable<RequestInit["redirect"]>;
|
|
33
42
|
/**
|
|
@@ -182,173 +191,6 @@ export interface HealthResult {
|
|
|
182
191
|
readonly status: "ready";
|
|
183
192
|
readonly workflowId: string;
|
|
184
193
|
}
|
|
185
|
-
/**
|
|
186
|
-
* Source reference shared by entries in {@link AgentInfoResult}.
|
|
187
|
-
*/
|
|
188
|
-
export interface AgentInfoSource {
|
|
189
|
-
readonly exportName?: string;
|
|
190
|
-
readonly logicalPath: string;
|
|
191
|
-
readonly sourceId?: string;
|
|
192
|
-
readonly sourceKind: string;
|
|
193
|
-
}
|
|
194
|
-
export interface AgentInfoEntry extends AgentInfoSource {
|
|
195
|
-
readonly name: string;
|
|
196
|
-
}
|
|
197
|
-
export interface AgentInfoToolEntry extends AgentInfoEntry {
|
|
198
|
-
readonly description: string;
|
|
199
|
-
readonly hasAuth: boolean;
|
|
200
|
-
readonly hasExecute: boolean;
|
|
201
|
-
readonly hasModelOutputProjection: boolean;
|
|
202
|
-
readonly hasOutputSchema: boolean;
|
|
203
|
-
readonly inputSchema: unknown;
|
|
204
|
-
readonly origin: "authored" | "framework";
|
|
205
|
-
readonly outputSchema: unknown;
|
|
206
|
-
readonly replacesFrameworkTool: boolean;
|
|
207
|
-
readonly requiresApproval: boolean;
|
|
208
|
-
}
|
|
209
|
-
export interface AgentInfoFrameworkToolEntry extends AgentInfoToolEntry {
|
|
210
|
-
readonly disabledByAuthor: boolean;
|
|
211
|
-
readonly replacedByAuthoredTool: boolean;
|
|
212
|
-
readonly status: "active" | "disabled" | "replaced";
|
|
213
|
-
}
|
|
214
|
-
export interface AgentInfoDynamicResolverEntry extends AgentInfoSource {
|
|
215
|
-
readonly eventNames: readonly string[];
|
|
216
|
-
readonly origin: "authored" | "framework";
|
|
217
|
-
readonly slug: string;
|
|
218
|
-
}
|
|
219
|
-
export interface AgentInfoTools {
|
|
220
|
-
readonly authored: readonly AgentInfoToolEntry[];
|
|
221
|
-
readonly available: readonly AgentInfoToolEntry[];
|
|
222
|
-
readonly disabledFramework: readonly string[];
|
|
223
|
-
readonly dynamic: readonly AgentInfoDynamicResolverEntry[];
|
|
224
|
-
readonly framework: readonly AgentInfoFrameworkToolEntry[];
|
|
225
|
-
readonly reserved: readonly string[];
|
|
226
|
-
}
|
|
227
|
-
export interface AgentInfoSkillEntry extends AgentInfoEntry {
|
|
228
|
-
readonly description: string;
|
|
229
|
-
readonly license?: string;
|
|
230
|
-
readonly markdown: string;
|
|
231
|
-
readonly metadata?: Readonly<Record<string, string>>;
|
|
232
|
-
}
|
|
233
|
-
export interface AgentInfoInstructionsEntry extends AgentInfoEntry {
|
|
234
|
-
readonly markdown: string;
|
|
235
|
-
}
|
|
236
|
-
export interface AgentInfoInstructions {
|
|
237
|
-
readonly dynamic: readonly AgentInfoDynamicResolverEntry[];
|
|
238
|
-
readonly static: AgentInfoInstructionsEntry | null;
|
|
239
|
-
}
|
|
240
|
-
export interface AgentInfoScheduleEntry extends AgentInfoEntry {
|
|
241
|
-
readonly cron: string;
|
|
242
|
-
readonly hasRun: boolean;
|
|
243
|
-
readonly markdown?: string;
|
|
244
|
-
}
|
|
245
|
-
export interface AgentInfoSubagentEntry extends AgentInfoEntry {
|
|
246
|
-
readonly description: string;
|
|
247
|
-
readonly entryPath: string;
|
|
248
|
-
readonly nodeId: string;
|
|
249
|
-
readonly rootPath: string;
|
|
250
|
-
readonly summary: {
|
|
251
|
-
readonly channels: number;
|
|
252
|
-
readonly connections: number;
|
|
253
|
-
readonly hooks: number;
|
|
254
|
-
readonly instructions: boolean;
|
|
255
|
-
readonly schedules: number;
|
|
256
|
-
readonly skills: number;
|
|
257
|
-
readonly tools: number;
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
export interface AgentInfoChannelEntry extends AgentInfoEntry {
|
|
261
|
-
readonly adapterKind?: string;
|
|
262
|
-
readonly method: string;
|
|
263
|
-
readonly origin: "authored" | "framework";
|
|
264
|
-
readonly urlPath: string;
|
|
265
|
-
}
|
|
266
|
-
export interface AgentInfoFrameworkChannelEntry extends AgentInfoChannelEntry {
|
|
267
|
-
readonly disabledByAuthor: boolean;
|
|
268
|
-
readonly replacedByAuthoredChannel: boolean;
|
|
269
|
-
readonly status: "active" | "disabled" | "replaced";
|
|
270
|
-
}
|
|
271
|
-
export interface AgentInfoChannels {
|
|
272
|
-
readonly authored: readonly AgentInfoChannelEntry[];
|
|
273
|
-
readonly available: readonly AgentInfoChannelEntry[];
|
|
274
|
-
readonly disabledFramework: readonly string[];
|
|
275
|
-
readonly framework: readonly AgentInfoFrameworkChannelEntry[];
|
|
276
|
-
}
|
|
277
|
-
export interface AgentInfoConnectionEntry extends AgentInfoSource {
|
|
278
|
-
readonly connectionName: string;
|
|
279
|
-
readonly description: string;
|
|
280
|
-
readonly hasApproval: boolean;
|
|
281
|
-
readonly hasAuthorization: boolean;
|
|
282
|
-
readonly hasHeaders: boolean;
|
|
283
|
-
readonly protocol: string;
|
|
284
|
-
readonly toolFilter?: unknown;
|
|
285
|
-
readonly url: string;
|
|
286
|
-
}
|
|
287
|
-
export interface AgentInfoHookEntry extends AgentInfoSource {
|
|
288
|
-
readonly eventNames: readonly string[];
|
|
289
|
-
readonly slug: string;
|
|
290
|
-
}
|
|
291
|
-
export interface AgentInfoSandboxEntry extends AgentInfoSource {
|
|
292
|
-
readonly backendKind?: string;
|
|
293
|
-
readonly description?: string;
|
|
294
|
-
readonly hasBootstrap: boolean;
|
|
295
|
-
readonly hasOnSession: boolean;
|
|
296
|
-
readonly revalidationKey?: string;
|
|
297
|
-
readonly sourceHash?: string;
|
|
298
|
-
}
|
|
299
|
-
export interface AgentInfoResult {
|
|
300
|
-
readonly agent: {
|
|
301
|
-
readonly agentRoot: string;
|
|
302
|
-
readonly appRoot: string;
|
|
303
|
-
readonly configSource?: AgentInfoSource;
|
|
304
|
-
readonly description?: string;
|
|
305
|
-
readonly model: {
|
|
306
|
-
readonly contextWindowTokens?: number;
|
|
307
|
-
readonly id: string;
|
|
308
|
-
readonly providerOptions?: unknown;
|
|
309
|
-
readonly source?: AgentInfoSource;
|
|
310
|
-
/** How the model is routed (gateway vs external), decided at compile time. */
|
|
311
|
-
readonly routing?: ModelRouting;
|
|
312
|
-
/** Composed routing + runtime credential readiness; absent only on legacy payloads. */
|
|
313
|
-
readonly endpoint?: ModelEndpointStatus;
|
|
314
|
-
};
|
|
315
|
-
readonly name: string;
|
|
316
|
-
readonly outputSchema?: unknown;
|
|
317
|
-
};
|
|
318
|
-
readonly capabilities: {
|
|
319
|
-
readonly devRoutes: boolean;
|
|
320
|
-
};
|
|
321
|
-
readonly channels: AgentInfoChannels;
|
|
322
|
-
readonly connections: readonly AgentInfoConnectionEntry[];
|
|
323
|
-
readonly diagnostics: {
|
|
324
|
-
readonly discoveryErrors: number;
|
|
325
|
-
readonly discoveryWarnings: number;
|
|
326
|
-
};
|
|
327
|
-
readonly hooks: readonly AgentInfoHookEntry[];
|
|
328
|
-
readonly instructions: AgentInfoInstructions;
|
|
329
|
-
readonly kind: "eve-agent-info";
|
|
330
|
-
readonly mode: "development" | "production";
|
|
331
|
-
readonly sandbox: AgentInfoSandboxEntry | null;
|
|
332
|
-
readonly schedules: readonly AgentInfoScheduleEntry[];
|
|
333
|
-
readonly skills: {
|
|
334
|
-
readonly dynamic: readonly AgentInfoDynamicResolverEntry[];
|
|
335
|
-
readonly static: readonly AgentInfoSkillEntry[];
|
|
336
|
-
};
|
|
337
|
-
readonly subagents: {
|
|
338
|
-
readonly local: readonly AgentInfoSubagentEntry[];
|
|
339
|
-
readonly total: number;
|
|
340
|
-
};
|
|
341
|
-
readonly tools: AgentInfoTools;
|
|
342
|
-
readonly version: 1;
|
|
343
|
-
readonly workflow: {
|
|
344
|
-
readonly enabled: boolean;
|
|
345
|
-
readonly toolName: string;
|
|
346
|
-
};
|
|
347
|
-
readonly workspace: {
|
|
348
|
-
readonly resourceRoot: unknown;
|
|
349
|
-
readonly rootEntries: readonly string[];
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
194
|
/**
|
|
353
195
|
* Serializable session cursor. Persist this value and pass it back to
|
|
354
196
|
* {@link Client.session} to resume a conversation later.
|
package/dist/src/client/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
const VERCEL_TRUSTED_OIDC_IDP_TOKEN_HEADER=`x-vercel-trusted-oidc-idp-token`;export{VERCEL_TRUSTED_OIDC_IDP_TOKEN_HEADER};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"moduleVersions": {
|
|
3
3
|
"@ai-sdk/anthropic": "4.0.0-beta.67",
|
|
4
|
-
"chat": "4.
|
|
5
|
-
"@chat-adapter/slack": "4.
|
|
6
|
-
"@chat-adapter/state-memory": "4.
|
|
4
|
+
"chat": "4.31.0",
|
|
5
|
+
"@chat-adapter/slack": "4.31.0",
|
|
6
|
+
"@chat-adapter/state-memory": "4.31.0",
|
|
7
7
|
"chokidar": "5.0.0",
|
|
8
8
|
"commander": "14.0.3",
|
|
9
9
|
"experimental-ai-sdk-code-mode": "1.0.14",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"zod": "4.4.3",
|
|
30
30
|
"zod-validation-error": "5.0.0"
|
|
31
31
|
},
|
|
32
|
-
"scriptHash": "
|
|
32
|
+
"scriptHash": "30a61452a0da4601d006790b203839fe2d43fd4d89305bbf9f232ebf9d09d758"
|
|
33
33
|
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
type SlackButtonStyle = "danger" | "default" | "primary";
|
|
2
|
+
type SlackTextStyle = "bold" | "muted" | "plain";
|
|
3
|
+
type SlackTableAlignment = "center" | "left" | "right";
|
|
4
|
+
interface SlackCardElement {
|
|
5
|
+
children: SlackCardChild[];
|
|
6
|
+
imageUrl?: string;
|
|
7
|
+
subtitle?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
type: "card";
|
|
10
|
+
}
|
|
11
|
+
type SlackCardChild = SlackActionsElement | SlackDividerElement | SlackFieldsElement | SlackImageElement | SlackLinkElement | SlackSectionElement | SlackTableElement | SlackTextElement;
|
|
12
|
+
interface SlackTextElement {
|
|
13
|
+
content: string;
|
|
14
|
+
style?: SlackTextStyle;
|
|
15
|
+
type: "text";
|
|
16
|
+
}
|
|
17
|
+
interface SlackImageElement {
|
|
18
|
+
alt?: string;
|
|
19
|
+
type: "image";
|
|
20
|
+
url: string;
|
|
21
|
+
}
|
|
22
|
+
interface SlackDividerElement {
|
|
23
|
+
type: "divider";
|
|
24
|
+
}
|
|
25
|
+
interface SlackActionsElement {
|
|
26
|
+
children: (SlackButtonElement | SlackLinkButtonElement | SlackRadioSelectElement | SlackSelectElement)[];
|
|
27
|
+
type: "actions";
|
|
28
|
+
}
|
|
29
|
+
interface SlackButtonElement {
|
|
30
|
+
callbackUrl?: string;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
id: string;
|
|
33
|
+
label: string;
|
|
34
|
+
style?: SlackButtonStyle;
|
|
35
|
+
type: "button";
|
|
36
|
+
value?: string;
|
|
37
|
+
}
|
|
38
|
+
interface SlackLinkButtonElement {
|
|
39
|
+
id?: string;
|
|
40
|
+
label: string;
|
|
41
|
+
style?: SlackButtonStyle;
|
|
42
|
+
type: "link-button";
|
|
43
|
+
url: string;
|
|
44
|
+
}
|
|
45
|
+
interface SlackSelectOptionElement {
|
|
46
|
+
description?: string;
|
|
47
|
+
label: string;
|
|
48
|
+
value: string;
|
|
49
|
+
}
|
|
50
|
+
interface SlackSelectElement {
|
|
51
|
+
id: string;
|
|
52
|
+
initialOption?: string;
|
|
53
|
+
label: string;
|
|
54
|
+
options: SlackSelectOptionElement[];
|
|
55
|
+
placeholder?: string;
|
|
56
|
+
type: "select";
|
|
57
|
+
}
|
|
58
|
+
interface SlackRadioSelectElement {
|
|
59
|
+
id: string;
|
|
60
|
+
initialOption?: string;
|
|
61
|
+
label: string;
|
|
62
|
+
options: SlackSelectOptionElement[];
|
|
63
|
+
type: "radio_select";
|
|
64
|
+
}
|
|
65
|
+
interface SlackSectionElement {
|
|
66
|
+
children: SlackCardChild[];
|
|
67
|
+
type: "section";
|
|
68
|
+
}
|
|
69
|
+
interface SlackLinkElement {
|
|
70
|
+
label: string;
|
|
71
|
+
type: "link";
|
|
72
|
+
url: string;
|
|
73
|
+
}
|
|
74
|
+
interface SlackFieldElement {
|
|
75
|
+
label: string;
|
|
76
|
+
type: "field";
|
|
77
|
+
value: string;
|
|
78
|
+
}
|
|
79
|
+
interface SlackFieldsElement {
|
|
80
|
+
children: SlackFieldElement[];
|
|
81
|
+
type: "fields";
|
|
82
|
+
}
|
|
83
|
+
interface SlackTableElement {
|
|
84
|
+
align?: SlackTableAlignment[];
|
|
85
|
+
headers: string[];
|
|
86
|
+
rows: string[][];
|
|
87
|
+
type: "table";
|
|
88
|
+
}
|
|
89
|
+
interface SlackTextObject {
|
|
90
|
+
emoji?: boolean;
|
|
91
|
+
text: string;
|
|
92
|
+
type: "mrkdwn" | "plain_text";
|
|
93
|
+
}
|
|
94
|
+
interface SlackBlock {
|
|
95
|
+
block_id?: string;
|
|
96
|
+
type: string;
|
|
97
|
+
[key: string]: unknown;
|
|
98
|
+
}
|
|
99
|
+
interface SlackBlocksOptions {
|
|
100
|
+
convertEmoji?: (text: string) => string;
|
|
101
|
+
maxBlocks?: number;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
declare class SlackBlockError extends Error {
|
|
105
|
+
constructor(message: string);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
declare const SLACK_INPUT_ACTION_PREFIX = "input:";
|
|
109
|
+
declare const SLACK_FREEFORM_ACTION_PREFIX = "input-freeform:";
|
|
110
|
+
declare const SLACK_FREEFORM_CALLBACK_ID = "input-freeform-submit";
|
|
111
|
+
declare const SLACK_FREEFORM_BLOCK_ID = "input-freeform-block";
|
|
112
|
+
declare const SLACK_FREEFORM_ACTION_ID = "input-freeform-text";
|
|
113
|
+
interface SlackInputOption {
|
|
114
|
+
description?: string;
|
|
115
|
+
id: string;
|
|
116
|
+
label: string;
|
|
117
|
+
style?: SlackButtonStyle;
|
|
118
|
+
}
|
|
119
|
+
interface SlackInputRequest {
|
|
120
|
+
allowFreeform?: boolean;
|
|
121
|
+
display?: "buttons" | "radio" | "select";
|
|
122
|
+
options?: readonly SlackInputOption[];
|
|
123
|
+
prompt: string;
|
|
124
|
+
requestId: string;
|
|
125
|
+
}
|
|
126
|
+
interface SlackInputAction {
|
|
127
|
+
actionId: string;
|
|
128
|
+
selectedOptionValue?: string;
|
|
129
|
+
value?: string;
|
|
130
|
+
}
|
|
131
|
+
interface SlackInputResponse {
|
|
132
|
+
optionId?: string;
|
|
133
|
+
requestId: string;
|
|
134
|
+
}
|
|
135
|
+
interface SlackFreeformViewOptions {
|
|
136
|
+
metadata: unknown;
|
|
137
|
+
prompt?: string;
|
|
138
|
+
title?: string;
|
|
139
|
+
}
|
|
140
|
+
declare function inputRequestToSlackBlocks(request: SlackInputRequest): SlackBlock[];
|
|
141
|
+
declare function parseSlackInputResponse(action: SlackInputAction): SlackInputResponse | null;
|
|
142
|
+
declare function buildSlackFreeformView(options: SlackFreeformViewOptions): Record<string, unknown>;
|
|
143
|
+
declare function parseSlackFreeformValue(values: readonly {
|
|
144
|
+
actionId: string;
|
|
145
|
+
blockId: string;
|
|
146
|
+
value?: string;
|
|
147
|
+
}[]): string | undefined;
|
|
148
|
+
declare function answeredSlackInputBlocks(input: {
|
|
149
|
+
answer: string;
|
|
150
|
+
promptBlock?: unknown;
|
|
151
|
+
userId?: string;
|
|
152
|
+
}): SlackBlock[];
|
|
153
|
+
|
|
154
|
+
declare function cardToSlackBlocks(card: SlackCardElement, options?: SlackBlocksOptions): SlackBlock[];
|
|
155
|
+
declare const cardToBlockKit: typeof cardToSlackBlocks;
|
|
156
|
+
declare function cardToSlackFallbackText(card: SlackCardElement, options?: Pick<SlackBlocksOptions, "convertEmoji">): string;
|
|
157
|
+
declare const cardToFallbackText: typeof cardToSlackFallbackText;
|
|
158
|
+
declare function convertSlackEmojiPlaceholders(text: string): string;
|
|
159
|
+
|
|
160
|
+
export { SLACK_FREEFORM_ACTION_ID, SLACK_FREEFORM_ACTION_PREFIX, SLACK_FREEFORM_BLOCK_ID, SLACK_FREEFORM_CALLBACK_ID, SLACK_INPUT_ACTION_PREFIX, type SlackActionsElement, type SlackBlock, SlackBlockError, type SlackBlocksOptions, type SlackButtonElement, type SlackButtonStyle, type SlackCardChild, type SlackCardElement, type SlackDividerElement, type SlackFieldElement, type SlackFieldsElement, type SlackFreeformViewOptions, type SlackImageElement, type SlackInputAction, type SlackInputOption, type SlackInputRequest, type SlackInputResponse, type SlackLinkButtonElement, type SlackLinkElement, type SlackRadioSelectElement, type SlackSectionElement, type SlackSelectElement, type SlackSelectOptionElement, type SlackTableAlignment, type SlackTableElement, type SlackTextElement, type SlackTextObject, type SlackTextStyle, answeredSlackInputBlocks, buildSlackFreeformView, cardToBlockKit, cardToFallbackText, cardToSlackBlocks, cardToSlackFallbackText, convertSlackEmojiPlaceholders, inputRequestToSlackBlocks, parseSlackFreeformValue, parseSlackInputResponse };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{n as e}from"../../_chunks/node/chunk-AYN7QRWH-Csu8sG38.js";var t=class extends Error{constructor(e){super(e),this.name=`SlackBlockError`}},n={actionId:255,actionsElements:25,blockId:255,blocks:50,buttonText:75,buttonUrl:3e3,buttonValue:2e3,fields:10,fieldText:2e3,headerText:150,imageAlt:2e3,imageUrl:3e3,optionDescription:75,optionText:75,optionValue:150,options:100,placeholder:150,radioOptions:10,sectionText:3e3,tableColumns:20,tableRows:100,textObject:3e3},r=`input:`,i=`input-freeform:`,a=`input-freeform-submit`,o=`input-freeform-block`,s=`input-freeform-text`,c=/^(?<requestId>.+):button:\d+$/u;function l(e){let t={text:{text:v(e.prompt,n.sectionText),type:`mrkdwn`},type:`section`},r=e.options??[];if(r.length===0)return[t,{elements:[m(e.requestId)],type:`actions`}];let i=e.allowFreeform?[m(e.requestId)]:[];if(e.display===`radio`)return[t,{elements:[_(e),...i],type:`actions`}];if(e.display===`select`)return[t,{elements:[g(e),...i],type:`actions`}];let a=i.length>0?n.actionsElements-1:n.actionsElements;return[t,{elements:r.slice(0,a).map((t,n)=>h(e.requestId,t,n)).concat(i),type:`actions`}]}function u(e){if(!e.actionId.startsWith(`input:`))return null;let t=e.actionId.slice(r.length);if(e.selectedOptionValue!==void 0)return t?{optionId:e.selectedOptionValue,requestId:t}:null;let n=c.exec(t)?.groups?.requestId;return n&&e.value!==void 0?{optionId:e.value,requestId:n}:null}function d(e){let t=v(e.title??e.prompt??`Your answer`,24),r=[];return e.prompt&&r.push({text:{text:v(e.prompt,n.sectionText),type:`mrkdwn`},type:`section`}),r.push({block_id:o,element:{action_id:s,multiline:!0,type:`plain_text_input`},label:{text:`Answer`,type:`plain_text`},type:`input`}),{blocks:r,callback_id:a,close:{text:`Cancel`,type:`plain_text`},private_metadata:typeof e.metadata==`string`?e.metadata:JSON.stringify(e.metadata),submit:{text:`Submit`,type:`plain_text`},title:{text:t,type:`plain_text`},type:`modal`}}function f(e){return e.find(e=>e.blockId===`input-freeform-block`&&e.actionId===`input-freeform-text`)?.value}function p(e){let t=[];return e.promptBlock&&typeof e.promptBlock==`object`&&t.push(e.promptBlock),t.push({text:{text:`:white_check_mark: *${e.answer}*`,type:`mrkdwn`},type:`section`}),e.userId&&t.push({elements:[{text:`Answered by <@${e.userId}>`,type:`mrkdwn`}],type:`context`}),t}function m(e){return{action_id:`${i}${e}`,style:`primary`,text:{text:`Type your answer`,type:`plain_text`},type:`button`,value:e}}function h(e,t,i){return y({action_id:`${r}${e}:button:${i}`,style:t.style===`primary`||t.style===`danger`?t.style:void 0,text:{text:v(t.label,n.buttonText),type:`plain_text`},type:`button`,value:v(t.id,n.buttonValue)})}function g(e){let t=(e.options??[]).map(e=>({text:{text:v(e.label,n.optionText),type:`plain_text`},value:v(e.id,n.optionValue)}));return{action_id:`${r}${e.requestId}`,options:t.slice(0,n.options),placeholder:{text:`Choose an option`,type:`plain_text`},type:`static_select`}}function _(e){let t=(e.options??[]).map(e=>({text:{text:v(e.label,n.optionText),type:`plain_text`},value:v(e.id,n.optionValue)}));return t.length>n.radioOptions?g(e):{action_id:`${r}${e.requestId}`,options:t,type:`radio_buttons`}}function v(e,t){return e.length>t?e.slice(0,t):e}function y(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}var b=` `,x=/\{\{emoji:([a-zA-Z0-9_+-]+)\}\}/g;function S(e,t={}){let r=[],i={convertEmoji:t.convertEmoji??E,maxBlocks:t.maxBlocks??n.blocks,usedTable:!1};e.title&&r.push({text:U(e.title,i.convertEmoji,n.headerText),type:`header`}),e.subtitle&&r.push({elements:[H(e.subtitle,i.convertEmoji,n.textObject)],type:`context`}),e.imageUrl&&r.push({alt_text:K(i.convertEmoji(e.title||`Card image`),n.imageAlt),image_url:K(e.imageUrl,n.imageUrl),type:`image`});for(let t of e.children)r.push(...D(t,i));return r.slice(0,i.maxBlocks)}var C=S;function w(e,t={}){let n=t.convertEmoji??E,r=[];e.title&&r.push(`*${n(e.title)}*`),e.subtitle&&r.push(n(e.subtitle));for(let t of e.children){let e=V(t,n);e&&r.push(e)}return r.join(`
|
|
2
|
+
`)}var T=w;function E(e){return e.replace(x,`:$1:`)}function D(e,t){switch(e.type){case`actions`:return[j(e,t.convertEmoji)];case`divider`:return[{type:`divider`}];case`fields`:return[z(e,t.convertEmoji)];case`image`:return[k(e,t.convertEmoji)];case`link`:return[A(e,t.convertEmoji)];case`section`:return e.children.flatMap(e=>D(e,t));case`table`:return B(e,t);case`text`:return[O(e,t.convertEmoji)];default:return J(e)}}function O(t,r){let i=e(r(t.content));return t.style===`muted`?{elements:[H(i,e=>e,n.textObject)],type:`context`}:{text:H(t.style===`bold`?`*${i}*`:i,e=>e,n.sectionText),type:`section`}}function k(e,t){return{alt_text:K(t(e.alt||`Image`),n.imageAlt),image_url:K(e.url,n.imageUrl),type:`image`}}function A(e,t){return{text:H(`<${e.url}|${t(e.label)}>`,e=>e,n.sectionText),type:`section`}}function j(e,t){return{elements:e.children.slice(0,n.actionsElements).map(e=>M(e,t)),type:`actions`}}function M(e,t){switch(e.type){case`button`:return N(e,t);case`link-button`:return P(e,t);case`radio_select`:return I(e,t);case`select`:return F(e,t);default:return J(e)}}function N(e,t){return Y({action_id:K(e.id,n.actionId),style:G(e.style),text:U(e.label,t,n.buttonText),type:`button`,value:e.value===void 0?void 0:K(e.value,n.buttonValue)})}function P(e,t){return Y({action_id:K(e.id??`link-${e.url}`,n.actionId),style:G(e.style),text:U(e.label,t,n.buttonText),type:`button`,url:K(e.url,n.buttonUrl)})}function F(e,t){let r=e.options.slice(0,n.options).map(e=>R(e,t,`plain_text`));return Y({action_id:K(e.id,n.actionId),initial_option:L(r,e.initialOption),options:r,placeholder:e.placeholder?U(e.placeholder,t,n.placeholder):void 0,type:`static_select`})}function I(e,t){let r=e.options.slice(0,n.radioOptions).map(e=>R(e,t,`mrkdwn`));return Y({action_id:K(e.id,n.actionId),initial_option:L(r,e.initialOption),options:r,type:`radio_buttons`})}function L(e,t){if(t===void 0)return;let r=K(t,n.optionValue);return e.find(e=>e.value===r)}function R(e,t,r){return Y({description:e.description?{text:K(t(e.description),n.optionDescription),type:r}:void 0,text:{text:K(t(e.label),n.optionText),type:r},value:K(e.value,n.optionValue)})}function z(t,r){return{fields:t.children.slice(0,n.fields).map(t=>H(`*${e(r(t.label))}*
|
|
3
|
+
${e(r(t.value))}`,e=>e,n.fieldText)),type:`section`}}function B(e,t){return t.usedTable||e.rows.length+1>n.tableRows||e.headers.length>n.tableColumns?[{text:H(`\`\`\`
|
|
4
|
+
${X(e)}
|
|
5
|
+
\`\`\``,e=>e,n.sectionText),type:`section`}]:(t.usedTable=!0,[Y({column_settings:e.align?.slice(0,n.tableColumns).map(e=>e?{align:e}:null),rows:[e.headers.map(e=>W(e,t.convertEmoji)),...e.rows.map(e=>e.map(e=>W(e,t.convertEmoji)))],type:`table`})])}function V(e,t){switch(e.type){case`actions`:return;case`divider`:return`---`;case`fields`:return e.children.map(e=>`${t(e.label)}: ${t(e.value)}`).join(`
|
|
6
|
+
`);case`image`:return e.alt?t(e.alt):void 0;case`link`:return`${t(e.label)} (${e.url})`;case`section`:return e.children.map(e=>V(e,t)).filter(e=>!!e).join(`
|
|
7
|
+
`);case`table`:return X(e);case`text`:return t(e.content);default:return J(e)}}function H(e,t,n){return{text:q(K(t(e),n)),type:`mrkdwn`}}function U(e,t,n){return{emoji:!0,text:q(K(t(e),n)),type:`plain_text`}}function W(e,t){return{text:q(t(e)),type:`raw_text`}}function G(e){return e===`danger`||e===`primary`?e:void 0}function K(e,t){return e.length>t?e.slice(0,t):e}function q(e){return e.length>0?e:b}function J(e){throw new t(`Unsupported Slack card element: ${String(e)}`)}function Y(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}function X(e){let t=[e.headers,...e.rows],n=e.headers.map((e,n)=>Math.max(...t.map(e=>e[n]?.length??0)));return t.map(e=>e.map((e,t)=>(e??``).padEnd(n[t]??0)).join(` | `).trimEnd()).join(`
|
|
8
|
+
`)}export{s as SLACK_FREEFORM_ACTION_ID,i as SLACK_FREEFORM_ACTION_PREFIX,o as SLACK_FREEFORM_BLOCK_ID,a as SLACK_FREEFORM_CALLBACK_ID,r as SLACK_INPUT_ACTION_PREFIX,t as SlackBlockError,p as answeredSlackInputBlocks,d as buildSlackFreeformView,C as cardToBlockKit,T as cardToFallbackText,S as cardToSlackBlocks,w as cardToSlackFallbackText,E as convertSlackEmojiPlaceholders,l as inputRequestToSlackBlocks,f as parseSlackFreeformValue,u as parseSlackInputResponse};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
-
import { WebClient } from './_slack-web-api.js';
|
|
2
|
+
import { WebClientOptions, WebClient } from './_slack-web-api.js';
|
|
3
3
|
import { BaseFormatConverter, Root, AdapterPostableMessage, CardElement, Logger, Adapter, ChatInstance, UserInfo, WebhookOptions, OptionsLoadResult, ModalResponse, ModalElement, LinkPreview, Message, Attachment, RawMessage, EphemeralMessage, ScheduledMessage, FileUpload, PlanModel, PlanContent, EmojiValue, StreamChunk, StreamOptions, FetchOptions, FetchResult, ThreadInfo, ChannelVisibility, ListThreadsOptions, ListThreadsResult, ChannelInfo, FormattedContent } from '#compiled/chat/index.js';
|
|
4
|
+
import { y as SlackWebhookVerifier } from './types-AntsVifS.js';
|
|
4
5
|
export { EncryptedTokenData, decodeKey } from './_chat-adapter-shared.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -172,6 +173,30 @@ interface SlackAdapterConfig {
|
|
|
172
173
|
socketForwardingSecret?: string;
|
|
173
174
|
/** Override bot username (optional) */
|
|
174
175
|
userName?: string;
|
|
176
|
+
/**
|
|
177
|
+
* Options forwarded to the underlying `@slack/web-api` `WebClient` instances, both the
|
|
178
|
+
* default client and the per-token clients used for multi-workspace requests.
|
|
179
|
+
*
|
|
180
|
+
* Use this to tune Web API behavior the adapter does not otherwise expose, most
|
|
181
|
+
* notably `retryConfig` and `timeout`. By default the WebClient retries rate-limited
|
|
182
|
+
* (429) requests with `retryPolicies.tenRetriesInAboutThirtyMinutes`, so a single
|
|
183
|
+
* `chat.update`/`chat.postMessage` can block for ~30 minutes under sustained rate
|
|
184
|
+
* limiting. Callers that stream frequent edits (where a hung call can stall a whole
|
|
185
|
+
* turn) will typically want a bounded policy and/or a timeout. `timeout` applies to
|
|
186
|
+
* each HTTP request attempt, not the total retry period. Set
|
|
187
|
+
* `rejectRateLimitedCalls` to reject 429 responses without waiting for `Retry-After`.
|
|
188
|
+
*
|
|
189
|
+
* ```ts
|
|
190
|
+
* import { retryPolicies } from "./_slack-web-api.js";
|
|
191
|
+
* createSlackAdapter({
|
|
192
|
+
* signingSecret,
|
|
193
|
+
* webClientOptions: { retryConfig: retryPolicies.fiveRetriesInFiveMinutes, timeout: 15_000 },
|
|
194
|
+
* });
|
|
195
|
+
* ```
|
|
196
|
+
*
|
|
197
|
+
* Use `apiUrl` to override the Slack Web API base URL.
|
|
198
|
+
*/
|
|
199
|
+
webClientOptions?: Omit<WebClientOptions, "slackApiUrl">;
|
|
175
200
|
/**
|
|
176
201
|
* Custom webhook verifier. Used in place of `signingSecret`.
|
|
177
202
|
* Receives the incoming `Request` and the raw body text already
|
|
@@ -191,7 +216,7 @@ interface SlackAdapterConfig {
|
|
|
191
216
|
* equivalent freshness signal) to prevent replay of captured signed
|
|
192
217
|
* requests.
|
|
193
218
|
*/
|
|
194
|
-
webhookVerifier?:
|
|
219
|
+
webhookVerifier?: SlackWebhookVerifier;
|
|
195
220
|
}
|
|
196
221
|
|
|
197
222
|
/** Envelope for events forwarded from a socket mode listener via HTTP POST */
|
|
@@ -465,6 +490,7 @@ declare class SlackAdapter implements Adapter<SlackThreadId, unknown> {
|
|
|
465
490
|
protected readonly _client: WebClient;
|
|
466
491
|
protected readonly tokenClientCache: Map<string, WebClient>;
|
|
467
492
|
protected readonly slackApiUrl: string | undefined;
|
|
493
|
+
protected readonly webClientOptions: SlackAdapterConfig["webClientOptions"];
|
|
468
494
|
protected readonly signingSecret: string | undefined;
|
|
469
495
|
protected readonly webhookVerifier: ((request: Request, body: string) => unknown | Promise<unknown>) | undefined;
|
|
470
496
|
protected readonly defaultBotTokenProvider: (() => string | Promise<string>) | undefined;
|
|
@@ -671,7 +697,6 @@ declare class SlackAdapter implements Adapter<SlackThreadId, unknown> {
|
|
|
671
697
|
* No-op if not connected.
|
|
672
698
|
*/
|
|
673
699
|
disconnect(): Promise<void>;
|
|
674
|
-
protected verifySignature(body: string, timestamp: string | null, signature: string | null): boolean;
|
|
675
700
|
/**
|
|
676
701
|
* Handle message events from Slack.
|
|
677
702
|
* Bot message filtering (isMe) is handled centrally by the Chat class.
|