@sentry/junior 0.52.0 → 0.54.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.
- package/README.md +3 -2
- package/dist/api-reference.d.ts +7 -0
- package/dist/app.d.ts +5 -10
- package/dist/app.js +1671 -1219
- package/dist/build/copy-build-content.d.ts +4 -0
- package/dist/build/glob-to-regex.d.ts +2 -0
- package/dist/build/rolldown-workarounds.d.ts +14 -0
- package/dist/build/virtual-config.d.ts +4 -0
- package/dist/chat/app/factory.d.ts +10 -0
- package/dist/chat/app/production.d.ts +6 -0
- package/dist/chat/app/services.d.ts +17 -0
- package/dist/chat/capabilities/catalog.d.ts +16 -0
- package/dist/chat/capabilities/factory.d.ts +10 -0
- package/dist/chat/capabilities/jr-rpc-command.d.ts +26 -0
- package/dist/chat/capabilities/router.d.ts +19 -0
- package/dist/chat/coerce.d.ts +6 -0
- package/dist/chat/config.d.ts +46 -0
- package/dist/chat/configuration/defaults.d.ts +4 -0
- package/dist/chat/configuration/service.d.ts +2 -0
- package/dist/chat/configuration/types.d.ts +37 -0
- package/dist/chat/configuration/validation.d.ts +2 -0
- package/dist/chat/credentials/broker.d.ts +22 -0
- package/dist/chat/credentials/header-transforms.d.ts +3 -0
- package/dist/chat/credentials/oauth-scope.d.ts +4 -0
- package/dist/chat/credentials/state-adapter-token-store.d.ts +9 -0
- package/dist/chat/credentials/test-broker.d.ts +19 -0
- package/dist/chat/credentials/unlink-provider.d.ts +2 -0
- package/dist/chat/credentials/user-token-store.d.ts +11 -0
- package/dist/chat/discovery.d.ts +47 -0
- package/dist/chat/ingress/junior-chat.d.ts +26 -0
- package/dist/chat/ingress/message-changed.d.ts +50 -0
- package/dist/chat/ingress/message-router.d.ts +9 -0
- package/dist/chat/ingress/slash-command.d.ts +3 -0
- package/dist/chat/ingress/workspace-membership.d.ts +10 -0
- package/dist/chat/interruption-marker.d.ts +2 -0
- package/dist/chat/logging.d.ts +88 -0
- package/dist/chat/mcp/auth-store.d.ts +41 -0
- package/dist/chat/mcp/client.d.ts +34 -0
- package/dist/chat/mcp/errors.d.ts +8 -0
- package/dist/chat/mcp/oauth-provider.d.ts +27 -0
- package/dist/chat/mcp/oauth.d.ts +17 -0
- package/dist/chat/mcp/tool-manager.d.ts +60 -0
- package/dist/chat/oauth-flow.d.ts +45 -0
- package/dist/chat/optional-string.d.ts +5 -0
- package/dist/chat/pi/client.d.ts +49 -0
- package/dist/chat/pi/messages.d.ts +3 -0
- package/dist/chat/pi/traced-stream.d.ts +9 -0
- package/dist/chat/plugins/auth/api-headers-broker.d.ts +6 -0
- package/dist/chat/plugins/auth/auth-token-placeholder.d.ts +3 -0
- package/dist/chat/plugins/auth/github-app-broker.d.ts +4 -0
- package/dist/chat/plugins/auth/oauth-bearer-broker.d.ts +6 -0
- package/dist/chat/plugins/auth/oauth-request.d.ts +18 -0
- package/dist/chat/plugins/command-env.d.ts +3 -0
- package/dist/chat/plugins/manifest.d.ts +3 -0
- package/dist/chat/plugins/package-discovery.d.ts +14 -0
- package/dist/chat/plugins/registry.d.ts +23 -0
- package/dist/chat/plugins/types.d.ts +146 -0
- package/dist/chat/prompt.d.ts +39 -0
- package/dist/chat/queue/thread-message-dispatcher.d.ts +33 -0
- package/dist/chat/respond-helpers.d.ts +77 -0
- package/dist/chat/respond.d.ts +64 -0
- package/dist/chat/runtime/auth-pause-state.d.ts +11 -0
- package/dist/chat/runtime/delivered-turn-state.d.ts +15 -0
- package/dist/chat/runtime/dev-agent-trace.d.ts +1 -0
- package/dist/chat/runtime/processing-reaction.d.ts +25 -0
- package/dist/chat/runtime/reply-executor.d.ts +56 -0
- package/dist/chat/runtime/report-progress.d.ts +3 -0
- package/dist/chat/runtime/slack-resume.d.ts +50 -0
- package/dist/chat/runtime/slack-runtime.d.ts +100 -0
- package/dist/chat/runtime/thread-context.d.ts +22 -0
- package/dist/chat/runtime/thread-state.d.ts +28 -0
- package/dist/chat/runtime/turn-preparation.d.ts +43 -0
- package/dist/chat/runtime/turn-user-message.d.ts +12 -0
- package/dist/chat/runtime/turn.d.ts +69 -0
- package/dist/chat/sandbox/credentials.d.ts +11 -0
- package/dist/chat/sandbox/egress-oidc.d.ts +3 -0
- package/dist/chat/sandbox/egress-policy.d.ts +11 -0
- package/dist/chat/sandbox/egress-proxy.d.ts +10 -0
- package/dist/chat/sandbox/egress-session.d.ts +27 -0
- package/dist/chat/sandbox/errors.d.ts +12 -0
- package/dist/chat/sandbox/eval-gh-stub.d.ts +2 -0
- package/dist/chat/sandbox/eval-oauth-stub.d.ts +2 -0
- package/dist/chat/sandbox/eval-sentry-stub.d.ts +2 -0
- package/dist/chat/sandbox/fault-injection.d.ts +2 -0
- package/dist/chat/sandbox/http-error-details.d.ts +18 -0
- package/dist/chat/sandbox/noninteractive-command.d.ts +17 -0
- package/dist/chat/sandbox/paths.d.ts +5 -0
- package/dist/chat/sandbox/runtime-dependency-snapshots.d.ts +20 -0
- package/dist/chat/sandbox/sandbox.d.ts +52 -0
- package/dist/chat/sandbox/session.d.ts +53 -0
- package/dist/chat/sandbox/skill-sandbox.d.ts +42 -0
- package/dist/chat/sandbox/skill-sync.d.ts +17 -0
- package/dist/chat/sandbox/workspace.d.ts +55 -0
- package/dist/chat/sentry.d.ts +2 -0
- package/dist/chat/services/attachment-claims.d.ts +2 -0
- package/dist/chat/services/auth-pause-response.d.ts +2 -0
- package/dist/chat/services/auth-pause.d.ts +12 -0
- package/dist/chat/services/channel-intent.d.ts +2 -0
- package/dist/chat/services/conversation-memory.d.ts +33 -0
- package/dist/chat/services/mcp-auth-orchestration.d.ts +29 -0
- package/dist/chat/services/pending-auth.d.ts +27 -0
- package/dist/chat/services/plugin-auth-orchestration.d.ts +36 -0
- package/dist/chat/services/provider-default-config.d.ts +9 -0
- package/dist/chat/services/provider-retry.d.ts +6 -0
- package/dist/chat/services/reply-delivery-plan.d.ts +17 -0
- package/dist/chat/services/subscribed-decision.d.ts +63 -0
- package/dist/chat/services/subscribed-reply-policy.d.ts +23 -0
- package/dist/chat/services/timeout-resume.d.ts +17 -0
- package/dist/chat/services/turn-checkpoint.d.ts +74 -0
- package/dist/chat/services/turn-continuation-response.d.ts +2 -0
- package/dist/chat/services/turn-failure-response.d.ts +15 -0
- package/dist/chat/services/turn-result.d.ts +55 -0
- package/dist/chat/services/turn-thinking-level.d.ts +49 -0
- package/dist/chat/services/vision-context.d.ts +61 -0
- package/dist/chat/skills.d.ts +48 -0
- package/dist/chat/slack/adapter.d.ts +9 -0
- package/dist/chat/slack/app-home.d.ts +11 -0
- package/dist/chat/slack/assistant-thread/lifecycle.d.ts +13 -0
- package/dist/chat/slack/assistant-thread/status-render.d.ts +28 -0
- package/dist/chat/slack/assistant-thread/status-scheduler.d.ts +23 -0
- package/dist/chat/slack/assistant-thread/status-send.d.ts +31 -0
- package/dist/chat/slack/assistant-thread/status.d.ts +36 -0
- package/dist/chat/slack/assistant-thread/title.d.ts +28 -0
- package/dist/chat/slack/canvas-references.d.ts +2 -0
- package/dist/chat/slack/channel.d.ts +48 -0
- package/dist/chat/slack/client.d.ts +52 -0
- package/dist/chat/slack/context.d.ts +9 -0
- package/dist/chat/slack/emoji.d.ts +1 -0
- package/dist/chat/slack/errors.d.ts +6 -0
- package/dist/chat/slack/footer.d.ts +42 -0
- package/dist/chat/slack/legacy-attachments.d.ts +4 -0
- package/dist/chat/slack/message.d.ts +6 -0
- package/dist/chat/slack/mrkdwn.d.ts +12 -0
- package/dist/chat/slack/outbound.d.ts +57 -0
- package/dist/chat/slack/output.d.ts +54 -0
- package/dist/chat/slack/reply.d.ts +33 -0
- package/dist/chat/slack/status-format.d.ts +2 -0
- package/dist/chat/slack/turn-continuation-notice.d.ts +8 -0
- package/dist/chat/slack/user.d.ts +7 -0
- package/dist/chat/slack/users.d.ts +39 -0
- package/dist/chat/state/adapter.d.ts +9 -0
- package/dist/chat/state/artifacts.d.ts +29 -0
- package/dist/chat/state/conversation.d.ts +81 -0
- package/dist/chat/state/pi-session-message-store.d.ts +15 -0
- package/dist/chat/state/turn-id.d.ts +2 -0
- package/dist/chat/state/turn-session-store.d.ts +49 -0
- package/dist/chat/tools/advisor/session-store.d.ts +9 -0
- package/dist/chat/tools/advisor/tool.d.ts +33 -0
- package/dist/chat/tools/agent-tools.d.ts +9 -0
- package/dist/chat/tools/channel-capabilities.d.ts +11 -0
- package/dist/chat/tools/definition.d.ts +17 -0
- package/dist/chat/tools/execution/build-sandbox-input.d.ts +2 -0
- package/dist/chat/tools/execution/normalize-result.d.ts +6 -0
- package/dist/chat/tools/execution/tool-error-handler.d.ts +3 -0
- package/dist/chat/tools/execution/tool-input-error.d.ts +6 -0
- package/dist/chat/tools/idempotency.d.ts +1 -0
- package/dist/chat/tools/index.d.ts +5 -0
- package/dist/chat/tools/runtime/report-progress.d.ts +4 -0
- package/dist/chat/tools/sandbox/attach-file.d.ts +7 -0
- package/dist/chat/tools/sandbox/bash.d.ts +5 -0
- package/dist/chat/tools/sandbox/edit-file.d.ts +37 -0
- package/dist/chat/tools/sandbox/file-utils.d.ts +52 -0
- package/dist/chat/tools/sandbox/find-files.d.ts +24 -0
- package/dist/chat/tools/sandbox/grep.d.ts +33 -0
- package/dist/chat/tools/sandbox/list-dir.d.ts +22 -0
- package/dist/chat/tools/sandbox/read-file.d.ts +32 -0
- package/dist/chat/tools/sandbox/text-edits.d.ts +28 -0
- package/dist/chat/tools/sandbox/write-file.d.ts +5 -0
- package/dist/chat/tools/skill/call-mcp-tool.d.ts +7 -0
- package/dist/chat/tools/skill/load-skill.d.ts +22 -0
- package/dist/chat/tools/skill/mcp-tool-summary.d.ts +31 -0
- package/dist/chat/tools/skill/search-mcp-tools.d.ts +8 -0
- package/dist/chat/tools/slack/canvas-tools.d.ts +29 -0
- package/dist/chat/tools/slack/canvases.d.ts +45 -0
- package/dist/chat/tools/slack/channel-list-messages.d.ts +9 -0
- package/dist/chat/tools/slack/channel-post-message.d.ts +4 -0
- package/dist/chat/tools/slack/list-tools.d.ts +21 -0
- package/dist/chat/tools/slack/lists.d.ts +42 -0
- package/dist/chat/tools/slack/message-add-reaction.d.ts +4 -0
- package/dist/chat/tools/slack/slack-message-url.d.ts +18 -0
- package/dist/chat/tools/slack/thread-read.d.ts +9 -0
- package/dist/chat/tools/slack/user-lookup.d.ts +8 -0
- package/dist/chat/tools/system-time.d.ts +1 -0
- package/dist/chat/tools/types.d.ts +55 -0
- package/dist/chat/tools/web/constants.d.ts +6 -0
- package/dist/chat/tools/web/fetch-content.d.ts +23 -0
- package/dist/chat/tools/web/fetch-tool.d.ts +5 -0
- package/dist/chat/tools/web/image-generate.d.ts +4 -0
- package/dist/chat/tools/web/network.d.ts +6 -0
- package/dist/chat/tools/web/search.d.ts +5 -0
- package/dist/chat/turn-context-tag.d.ts +6 -0
- package/dist/chat/usage.d.ts +24 -0
- package/dist/chat/xml.d.ts +1 -0
- package/dist/{chunk-XPXD3FCE.js → chunk-5LUISFEY.js} +189 -35
- package/dist/{chunk-KCOKQLBF.js → chunk-7WTXNEPF.js} +120 -15
- package/dist/{chunk-ZNFNY53B.js → chunk-QCHPJ4FD.js} +2 -2
- package/dist/{chunk-Q3FDONU7.js → chunk-YITDDLS3.js} +34 -28
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +1 -0
- package/dist/cli/snapshot-warmup.js +3 -3
- package/dist/handlers/diagnostics-dashboard.d.ts +2 -0
- package/dist/handlers/diagnostics.d.ts +2 -0
- package/dist/handlers/health.d.ts +4 -0
- package/dist/handlers/mcp-oauth-callback.d.ts +2 -0
- package/dist/handlers/oauth-callback.d.ts +2 -0
- package/dist/handlers/oauth-html.d.ts +2 -0
- package/dist/handlers/sandbox-egress-proxy.d.ts +4 -0
- package/dist/handlers/turn-resume.d.ts +3 -0
- package/dist/handlers/types.d.ts +2 -0
- package/dist/handlers/webhooks.d.ts +15 -0
- package/dist/instrumentation.d.ts +1 -3
- package/dist/nitro.d.ts +4 -7
- package/dist/nitro.js +112 -54
- package/dist/package-resolution.d.ts +13 -0
- package/dist/vercel.d.ts +2 -4
- package/package.json +25 -25
- package/dist/cli/check.d.ts +0 -8
- package/dist/cli/env.d.ts +0 -7
- package/dist/cli/init.d.ts +0 -3
- package/dist/cli/run.d.ts +0 -12
- package/dist/cli/snapshot-warmup.d.ts +0 -3
- package/dist/types-X_iCClPb.d.ts +0 -75
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Client } from "@modelcontextprotocol/sdk/client";
|
|
2
|
+
import { type OAuthClientProvider } from "@modelcontextprotocol/sdk/client/auth.js";
|
|
3
|
+
import type { PluginDefinition } from "@/chat/plugins/types";
|
|
4
|
+
type ListedTool = Awaited<ReturnType<Client["listTools"]>>["tools"][number];
|
|
5
|
+
type ToolCallResult = Awaited<ReturnType<Client["callTool"]>>;
|
|
6
|
+
export declare class McpAuthorizationRequiredError extends Error {
|
|
7
|
+
readonly provider: string;
|
|
8
|
+
constructor(provider: string, message: string);
|
|
9
|
+
}
|
|
10
|
+
export interface PluginMcpClientOptions {
|
|
11
|
+
authProvider?: OAuthClientProvider;
|
|
12
|
+
fetch?: typeof fetch;
|
|
13
|
+
}
|
|
14
|
+
export declare class PluginMcpClient {
|
|
15
|
+
private readonly plugin;
|
|
16
|
+
private readonly options;
|
|
17
|
+
private client?;
|
|
18
|
+
private lastAttemptedTransportSessionId?;
|
|
19
|
+
private transport?;
|
|
20
|
+
private listedTools?;
|
|
21
|
+
constructor(plugin: PluginDefinition, options?: PluginMcpClientOptions);
|
|
22
|
+
listTools(): Promise<ListedTool[]>;
|
|
23
|
+
callTool(name: string, args: Record<string, unknown> | undefined): Promise<ToolCallResult>;
|
|
24
|
+
close(): Promise<void>;
|
|
25
|
+
private withSessionRecovery;
|
|
26
|
+
private getClient;
|
|
27
|
+
private wrapAuth;
|
|
28
|
+
private shouldResetMissingSession;
|
|
29
|
+
private disposeClient;
|
|
30
|
+
private getStoredTransportSessionId;
|
|
31
|
+
private clearStoredTransportSessionId;
|
|
32
|
+
private syncTransportSessionId;
|
|
33
|
+
}
|
|
34
|
+
export type { ListedTool as PluginMcpListedTool, ToolCallResult as PluginMcpToolCallResult, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Thrown when an MCP tool returns an error result. */
|
|
2
|
+
export declare class McpToolError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
/** Return the OpenTelemetry error.type value for MCP-aware tool failures. */
|
|
6
|
+
export declare function getMcpAwareErrorType(error: unknown, fallback: string): string;
|
|
7
|
+
/** Return the display-safe error message for MCP-aware tool failures. */
|
|
8
|
+
export declare function getMcpAwareErrorMessage(error: unknown): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { OAuthClientInformationMixed, OAuthClientMetadata, OAuthTokens } from "@modelcontextprotocol/sdk/shared/auth.js";
|
|
2
|
+
import type { OAuthClientProvider, OAuthDiscoveryState } from "@modelcontextprotocol/sdk/client/auth.js";
|
|
3
|
+
import { type McpAuthSessionState } from "./auth-store";
|
|
4
|
+
export declare class StateBackedMcpOAuthClientProvider implements OAuthClientProvider {
|
|
5
|
+
readonly authSessionId: string;
|
|
6
|
+
private readonly callbackUrl;
|
|
7
|
+
private readonly sessionContext?;
|
|
8
|
+
readonly clientMetadata: OAuthClientMetadata;
|
|
9
|
+
constructor(authSessionId: string, callbackUrl: string, sessionContext?: Omit<McpAuthSessionState, "authSessionId" | "authorizationUrl" | "codeVerifier" | "createdAtMs" | "updatedAtMs"> | undefined);
|
|
10
|
+
get redirectUrl(): string;
|
|
11
|
+
state(): Promise<string>;
|
|
12
|
+
clientInformation(): Promise<OAuthClientInformationMixed | undefined>;
|
|
13
|
+
saveClientInformation(clientInformation: OAuthClientInformationMixed): Promise<void>;
|
|
14
|
+
tokens(): Promise<OAuthTokens | undefined>;
|
|
15
|
+
saveTokens(tokens: OAuthTokens): Promise<void>;
|
|
16
|
+
redirectToAuthorization(authorizationUrl: URL): Promise<void>;
|
|
17
|
+
saveCodeVerifier(codeVerifier: string): Promise<void>;
|
|
18
|
+
codeVerifier(): Promise<string>;
|
|
19
|
+
saveDiscoveryState(state: OAuthDiscoveryState): Promise<void>;
|
|
20
|
+
discoveryState(): Promise<OAuthDiscoveryState | undefined>;
|
|
21
|
+
invalidateCredentials(scope: "all" | "client" | "tokens" | "verifier" | "discovery"): Promise<void>;
|
|
22
|
+
getMcpServerSessionId(): Promise<string | undefined>;
|
|
23
|
+
saveMcpServerSessionId(sessionId: string | undefined): Promise<void>;
|
|
24
|
+
private getCredentialContext;
|
|
25
|
+
private ensureSession;
|
|
26
|
+
private requireSession;
|
|
27
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ThreadArtifactsState } from "@/chat/state/artifacts";
|
|
2
|
+
import { type McpAuthSessionState } from "./auth-store";
|
|
3
|
+
import { StateBackedMcpOAuthClientProvider } from "./oauth-provider";
|
|
4
|
+
export declare function getMcpOAuthCallbackPath(provider: string): string;
|
|
5
|
+
export declare function createMcpOAuthClientProvider(input: {
|
|
6
|
+
provider: string;
|
|
7
|
+
conversationId: string;
|
|
8
|
+
sessionId: string;
|
|
9
|
+
userId: string;
|
|
10
|
+
userMessage: string;
|
|
11
|
+
channelId?: string;
|
|
12
|
+
threadTs?: string;
|
|
13
|
+
toolChannelId?: string;
|
|
14
|
+
configuration?: Record<string, unknown>;
|
|
15
|
+
artifactState?: ThreadArtifactsState;
|
|
16
|
+
}): Promise<StateBackedMcpOAuthClientProvider>;
|
|
17
|
+
export declare function finalizeMcpAuthorization(provider: string, authSessionId: string, authorizationCode: string): Promise<McpAuthSessionState>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ImageContent, TextContent } from "@earendil-works/pi-ai";
|
|
2
|
+
import type { OAuthClientProvider } from "@modelcontextprotocol/sdk/client/auth.js";
|
|
3
|
+
import type { SkillMetadata } from "@/chat/skills";
|
|
4
|
+
import type { PluginDefinition } from "@/chat/plugins/types";
|
|
5
|
+
import { McpAuthorizationRequiredError, type PluginMcpToolCallResult } from "./client";
|
|
6
|
+
export interface McpToolManagerOptions {
|
|
7
|
+
authProviderFactory?: (plugin: PluginDefinition) => OAuthClientProvider | undefined | Promise<OAuthClientProvider | undefined>;
|
|
8
|
+
fetch?: typeof fetch;
|
|
9
|
+
onAuthorizationRequired?: (provider: string, error: McpAuthorizationRequiredError) => Promise<boolean | void> | boolean | void;
|
|
10
|
+
}
|
|
11
|
+
export interface ManagedMcpToolResult {
|
|
12
|
+
content: Array<TextContent | ImageContent>;
|
|
13
|
+
details: {
|
|
14
|
+
provider: string;
|
|
15
|
+
tool: string;
|
|
16
|
+
rawResult: PluginMcpToolCallResult;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface ManagedMcpToolDescriptor {
|
|
20
|
+
name: string;
|
|
21
|
+
rawName: string;
|
|
22
|
+
title?: string;
|
|
23
|
+
description: string;
|
|
24
|
+
parameters: Record<string, unknown>;
|
|
25
|
+
outputSchema?: Record<string, unknown>;
|
|
26
|
+
annotations?: Record<string, unknown>;
|
|
27
|
+
provider: string;
|
|
28
|
+
}
|
|
29
|
+
type ActiveMcpSkillScope = Pick<SkillMetadata, "pluginProvider">;
|
|
30
|
+
type ActiveMcpSkill = Pick<SkillMetadata, "name" | "pluginProvider">;
|
|
31
|
+
export interface ManagedMcpTool extends ManagedMcpToolDescriptor {
|
|
32
|
+
execute: (args: Record<string, unknown>) => Promise<ManagedMcpToolResult>;
|
|
33
|
+
}
|
|
34
|
+
export declare class McpToolManager {
|
|
35
|
+
private readonly options;
|
|
36
|
+
private readonly pluginsByProvider;
|
|
37
|
+
private readonly activeProviders;
|
|
38
|
+
private readonly authorizationPendingProviders;
|
|
39
|
+
private readonly clientsByProvider;
|
|
40
|
+
private readonly toolsByProvider;
|
|
41
|
+
constructor(plugins: PluginDefinition[], options?: McpToolManagerOptions);
|
|
42
|
+
getActiveProviders(): string[];
|
|
43
|
+
activateForSkill(skill: ActiveMcpSkill): Promise<boolean>;
|
|
44
|
+
activateProvider(provider: string): Promise<boolean>;
|
|
45
|
+
close(): Promise<void>;
|
|
46
|
+
getActiveToolCatalog(skills: ActiveMcpSkillScope[], options?: {
|
|
47
|
+
provider?: string;
|
|
48
|
+
}): ManagedMcpToolDescriptor[];
|
|
49
|
+
private filterListedTools;
|
|
50
|
+
private getClient;
|
|
51
|
+
private toManagedTool;
|
|
52
|
+
private handleAuthorizationRequired;
|
|
53
|
+
/** Return all active ManagedMcpTool objects for the given skill scope. */
|
|
54
|
+
getResolvedActiveTools(skills: ActiveMcpSkillScope[], options?: {
|
|
55
|
+
provider?: string;
|
|
56
|
+
}): ManagedMcpTool[];
|
|
57
|
+
private resolveProviderTools;
|
|
58
|
+
private toToolDescriptor;
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ChannelConfigurationService } from "@/chat/configuration/types";
|
|
2
|
+
type PrivateDeliveryResult = "in_context" | "fallback_dm" | false;
|
|
3
|
+
export type OAuthStatePayload = {
|
|
4
|
+
userId: string;
|
|
5
|
+
provider: string;
|
|
6
|
+
channelId?: string;
|
|
7
|
+
threadTs?: string;
|
|
8
|
+
pendingMessage?: string;
|
|
9
|
+
configuration?: Record<string, unknown>;
|
|
10
|
+
resumeConversationId?: string;
|
|
11
|
+
resumeSessionId?: string;
|
|
12
|
+
};
|
|
13
|
+
type OAuthFlowInput = {
|
|
14
|
+
requesterId: string;
|
|
15
|
+
channelId?: string;
|
|
16
|
+
threadTs?: string;
|
|
17
|
+
userMessage?: string;
|
|
18
|
+
channelConfiguration?: ChannelConfigurationService;
|
|
19
|
+
activeSkillName?: string;
|
|
20
|
+
resumeConversationId?: string;
|
|
21
|
+
resumeSessionId?: string;
|
|
22
|
+
};
|
|
23
|
+
/** Capitalize the first letter of a provider name for display. */
|
|
24
|
+
export declare function formatProviderLabel(provider: string): string;
|
|
25
|
+
/** Resolve the public base URL from environment variables (JUNIOR_BASE_URL or Vercel). */
|
|
26
|
+
export declare function resolveBaseUrl(): string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Authorization links must only be visible to the requesting user.
|
|
29
|
+
* Try in-context private delivery first, then fall back to a DM.
|
|
30
|
+
*/
|
|
31
|
+
export declare function deliverPrivateMessage(input: {
|
|
32
|
+
channelId?: string;
|
|
33
|
+
threadTs?: string;
|
|
34
|
+
userId: string;
|
|
35
|
+
text: string;
|
|
36
|
+
}): Promise<PrivateDeliveryResult>;
|
|
37
|
+
/** Initiate an OAuth authorization code flow for a provider and deliver the auth link to the user. */
|
|
38
|
+
export declare function startOAuthFlow(provider: string, input: OAuthFlowInput): Promise<{
|
|
39
|
+
ok: false;
|
|
40
|
+
error: string;
|
|
41
|
+
} | {
|
|
42
|
+
ok: true;
|
|
43
|
+
delivery: PrivateDeliveryResult;
|
|
44
|
+
}>;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type Message, type Model, type ThinkingLevel } from "@earendil-works/pi-ai";
|
|
2
|
+
import type { ZodTypeAny, z } from "zod";
|
|
3
|
+
export declare const GEN_AI_PROVIDER_NAME: "vercel-ai-gateway";
|
|
4
|
+
export declare const MISSING_GATEWAY_CREDENTIALS_ERROR = "Missing AI gateway credentials (AI_GATEWAY_API_KEY or VERCEL_OIDC_TOKEN)";
|
|
5
|
+
/**
|
|
6
|
+
* Resolve the documented AI Gateway env credentials for the paths that need
|
|
7
|
+
* the bearer token string directly.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getGatewayApiKey(): string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Let pi-ai read AI_GATEWAY_API_KEY from env itself and only override the
|
|
12
|
+
* token when auth comes from VERCEL_OIDC_TOKEN.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getPiGatewayApiKeyOverride(): string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Look up a gateway model by id. Throws `Unknown AI Gateway model id: …` if
|
|
17
|
+
* the id is not in pi-ai's registry — callers at the config boundary can use
|
|
18
|
+
* this to fail fast at startup instead of mid-turn.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveGatewayModel(modelId: string): Model<any>;
|
|
21
|
+
/** Execute a direct chat completion inside a dedicated `gen_ai.chat` span. */
|
|
22
|
+
export declare function completeText(params: {
|
|
23
|
+
modelId: string;
|
|
24
|
+
system?: string;
|
|
25
|
+
messages: Message[];
|
|
26
|
+
thinkingLevel?: ThinkingLevel;
|
|
27
|
+
temperature?: number;
|
|
28
|
+
maxTokens?: number;
|
|
29
|
+
signal?: AbortSignal;
|
|
30
|
+
metadata?: Record<string, unknown>;
|
|
31
|
+
}): Promise<{
|
|
32
|
+
message: import("@earendil-works/pi-ai").AssistantMessage;
|
|
33
|
+
text: string;
|
|
34
|
+
}>;
|
|
35
|
+
/** Execute a schema-constrained completion using the traced text path above. */
|
|
36
|
+
export declare function completeObject<TSchema extends ZodTypeAny>(params: {
|
|
37
|
+
modelId: string;
|
|
38
|
+
schema: TSchema;
|
|
39
|
+
system?: string;
|
|
40
|
+
prompt: string;
|
|
41
|
+
thinkingLevel?: ThinkingLevel;
|
|
42
|
+
temperature?: number;
|
|
43
|
+
maxTokens?: number;
|
|
44
|
+
signal?: AbortSignal;
|
|
45
|
+
metadata?: Record<string, unknown>;
|
|
46
|
+
}): Promise<{
|
|
47
|
+
object: z.infer<TSchema>;
|
|
48
|
+
text: string;
|
|
49
|
+
}>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { StreamFn } from "@earendil-works/pi-agent-core";
|
|
2
|
+
/**
|
|
3
|
+
* Wraps pi-ai's `streamSimple` so each LLM call inside a pi-agent-core agent
|
|
4
|
+
* loop produces its own `gen_ai.chat` Sentry span. The returned function is
|
|
5
|
+
* passed to `new Agent({ streamFn: ... })` and runs once per loop iteration.
|
|
6
|
+
*
|
|
7
|
+
* The base argument exists so tests can inject a stub stream function.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createTracedStreamFn(base?: StreamFn): StreamFn;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CredentialBroker, CredentialHeaderTransform } from "@/chat/credentials/broker";
|
|
2
|
+
import type { PluginManifest } from "@/chat/plugins/types";
|
|
3
|
+
/** Resolve plugin-level API headers into sandbox header transforms. */
|
|
4
|
+
export declare function resolveApiHeaderTransforms(manifest: PluginManifest): CredentialHeaderTransform[];
|
|
5
|
+
/** Issue host-managed API header transforms backed by deployment env vars. */
|
|
6
|
+
export declare function createApiHeadersBroker(manifest: PluginManifest): CredentialBroker;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { GitHubAppCredentials, OAuthBearerCredentials } from "../types";
|
|
2
|
+
/** Resolve the non-secret sandbox token placeholder for token-backed credentials. */
|
|
3
|
+
export declare function resolveAuthTokenPlaceholder(credentials: OAuthBearerCredentials | GitHubAppCredentials): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CredentialBroker } from "@/chat/credentials/broker";
|
|
2
|
+
import type { GitHubAppCredentials, PluginManifest } from "../types";
|
|
3
|
+
/** Create a broker that keeps GitHub App tokens on the host while authorizing provider traffic. */
|
|
4
|
+
export declare function createGitHubAppBroker(manifest: PluginManifest, credentials: GitHubAppCredentials): CredentialBroker;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CredentialBroker } from "@/chat/credentials/broker";
|
|
2
|
+
import type { UserTokenStore } from "@/chat/credentials/user-token-store";
|
|
3
|
+
import type { OAuthBearerCredentials, PluginManifest } from "../types";
|
|
4
|
+
export declare function createOAuthBearerBroker(manifest: PluginManifest, credentials: OAuthBearerCredentials, deps: {
|
|
5
|
+
userTokenStore: UserTokenStore;
|
|
6
|
+
}): CredentialBroker;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type OAuthTokenRequestInput = {
|
|
2
|
+
clientId: string;
|
|
3
|
+
clientSecret: string;
|
|
4
|
+
payload: Record<string, string>;
|
|
5
|
+
tokenAuthMethod?: "body" | "basic";
|
|
6
|
+
tokenExtraHeaders?: Record<string, string>;
|
|
7
|
+
};
|
|
8
|
+
export declare function buildOAuthTokenRequest(input: OAuthTokenRequestInput): {
|
|
9
|
+
headers: Record<string, string>;
|
|
10
|
+
body: BodyInit;
|
|
11
|
+
};
|
|
12
|
+
export declare function parseOAuthTokenResponse(data: Record<string, unknown>, fallbackScope?: string): {
|
|
13
|
+
accessToken: string;
|
|
14
|
+
refreshToken: string;
|
|
15
|
+
expiresAt?: number;
|
|
16
|
+
scope?: string;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface InstalledPluginPackageContent {
|
|
2
|
+
packageNames: string[];
|
|
3
|
+
manifestRoots: string[];
|
|
4
|
+
skillRoots: string[];
|
|
5
|
+
tracingIncludes: string[];
|
|
6
|
+
}
|
|
7
|
+
/** Normalize and validate configured plugin package names. */
|
|
8
|
+
export declare function normalizePluginPackageNames(packageNames: unknown): string[];
|
|
9
|
+
export interface DiscoverInstalledPluginPackageContentOptions {
|
|
10
|
+
nodeModulesDirs?: string[];
|
|
11
|
+
packageNames?: unknown;
|
|
12
|
+
}
|
|
13
|
+
/** Discover plugin package content from explicitly declared package names. */
|
|
14
|
+
export declare function discoverInstalledPluginPackageContent(cwd?: string, options?: DiscoverInstalledPluginPackageContentOptions): InstalledPluginPackageContent;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CapabilityProviderDefinition } from "@/chat/capabilities/catalog";
|
|
2
|
+
import type { CredentialBroker } from "@/chat/credentials/broker";
|
|
3
|
+
import { type InstalledPluginPackageContent } from "./package-discovery";
|
|
4
|
+
import type { PluginBrokerDeps, PluginConfig, PluginDefinition, OAuthProviderConfig, PluginRuntimeDependency, PluginRuntimePostinstallCommand } from "./types";
|
|
5
|
+
/** Set install-wide plugin configuration and return the previous value for rollback. */
|
|
6
|
+
export declare function setPluginConfig(config: PluginConfig | undefined): PluginConfig | undefined;
|
|
7
|
+
/** Return installed plugin package content from the active plugin configuration. */
|
|
8
|
+
export declare function getPluginPackageContent(): InstalledPluginPackageContent;
|
|
9
|
+
/** Return the current plugin catalog signature used for cache invalidation. */
|
|
10
|
+
export declare function getPluginCatalogSignature(): string;
|
|
11
|
+
export declare function getPluginCapabilityProviders(): CapabilityProviderDefinition[];
|
|
12
|
+
export declare function getPluginProviders(): PluginDefinition[];
|
|
13
|
+
export declare function getPluginMcpProviders(): PluginDefinition[];
|
|
14
|
+
export declare function getPluginRuntimeDependencies(): PluginRuntimeDependency[];
|
|
15
|
+
export declare function getPluginRuntimePostinstall(): PluginRuntimePostinstallCommand[];
|
|
16
|
+
export declare function getPluginOAuthConfig(provider: string): OAuthProviderConfig | undefined;
|
|
17
|
+
export declare function getPluginSkillRoots(): string[];
|
|
18
|
+
export declare function getPluginForSkillPath(skillPath: string): PluginDefinition | undefined;
|
|
19
|
+
export declare function getPluginDefinition(provider: string): PluginDefinition | undefined;
|
|
20
|
+
export declare function isPluginProvider(provider: string): boolean;
|
|
21
|
+
export declare function isPluginCapability(capability: string): boolean;
|
|
22
|
+
export declare function isPluginConfigKey(key: string): boolean;
|
|
23
|
+
export declare function createPluginBroker(provider: string, deps: PluginBrokerDeps): CredentialBroker;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { UserTokenStore } from "@/chat/credentials/user-token-store";
|
|
2
|
+
export interface PluginOAuthConfig {
|
|
3
|
+
clientIdEnv: string;
|
|
4
|
+
clientSecretEnv: string;
|
|
5
|
+
authorizeEndpoint: string;
|
|
6
|
+
tokenEndpoint: string;
|
|
7
|
+
scope?: string;
|
|
8
|
+
authorizeParams?: Record<string, string>;
|
|
9
|
+
tokenAuthMethod?: "body" | "basic";
|
|
10
|
+
tokenExtraHeaders?: Record<string, string>;
|
|
11
|
+
}
|
|
12
|
+
export interface OAuthProviderConfig extends PluginOAuthConfig {
|
|
13
|
+
callbackPath: string;
|
|
14
|
+
}
|
|
15
|
+
export interface OAuthBearerCredentials {
|
|
16
|
+
type: "oauth-bearer";
|
|
17
|
+
domains: string[];
|
|
18
|
+
apiHeaders?: Record<string, string>;
|
|
19
|
+
authTokenEnv: string;
|
|
20
|
+
authTokenPlaceholder?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface GitHubAppCredentials {
|
|
23
|
+
type: "github-app";
|
|
24
|
+
domains: string[];
|
|
25
|
+
apiHeaders?: Record<string, string>;
|
|
26
|
+
authTokenEnv: string;
|
|
27
|
+
authTokenPlaceholder?: string;
|
|
28
|
+
appIdEnv: string;
|
|
29
|
+
privateKeyEnv: string;
|
|
30
|
+
installationIdEnv: string;
|
|
31
|
+
}
|
|
32
|
+
export type PluginCredentials = OAuthBearerCredentials | GitHubAppCredentials;
|
|
33
|
+
export interface PluginNpmRuntimeDependency {
|
|
34
|
+
type: "npm";
|
|
35
|
+
package: string;
|
|
36
|
+
version: string;
|
|
37
|
+
}
|
|
38
|
+
export interface PluginSystemRuntimeDependency {
|
|
39
|
+
type: "system";
|
|
40
|
+
package: string;
|
|
41
|
+
}
|
|
42
|
+
export interface PluginSystemRuntimeDependencyFromUrl {
|
|
43
|
+
type: "system";
|
|
44
|
+
url: string;
|
|
45
|
+
sha256: string;
|
|
46
|
+
}
|
|
47
|
+
export type PluginRuntimeDependency = PluginNpmRuntimeDependency | PluginSystemRuntimeDependency | PluginSystemRuntimeDependencyFromUrl;
|
|
48
|
+
export interface PluginRuntimePostinstallCommand {
|
|
49
|
+
cmd: string;
|
|
50
|
+
args?: string[];
|
|
51
|
+
sudo?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface PluginMcpHttpConfig {
|
|
54
|
+
transport: "http";
|
|
55
|
+
url: string;
|
|
56
|
+
headers?: Record<string, string>;
|
|
57
|
+
allowedTools?: string[];
|
|
58
|
+
}
|
|
59
|
+
export type PluginMcpConfig = PluginMcpHttpConfig;
|
|
60
|
+
export interface PluginEnvVarDeclaration {
|
|
61
|
+
default?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface PluginManifest {
|
|
64
|
+
name: string;
|
|
65
|
+
description: string;
|
|
66
|
+
capabilities: string[];
|
|
67
|
+
configKeys: string[];
|
|
68
|
+
domains?: string[];
|
|
69
|
+
apiHeaders?: Record<string, string>;
|
|
70
|
+
commandEnv?: Record<string, string>;
|
|
71
|
+
envVars?: Record<string, PluginEnvVarDeclaration>;
|
|
72
|
+
credentials?: PluginCredentials;
|
|
73
|
+
runtimeDependencies?: PluginRuntimeDependency[];
|
|
74
|
+
runtimePostinstall?: PluginRuntimePostinstallCommand[];
|
|
75
|
+
mcp?: PluginMcpConfig;
|
|
76
|
+
oauth?: PluginOAuthConfig;
|
|
77
|
+
target?: {
|
|
78
|
+
type: string;
|
|
79
|
+
configKey: string;
|
|
80
|
+
commandFlags?: string[];
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
type PluginRuntimeDependencyConfig = {
|
|
84
|
+
type: "npm";
|
|
85
|
+
package: string;
|
|
86
|
+
version?: string;
|
|
87
|
+
} | {
|
|
88
|
+
type: "system";
|
|
89
|
+
package: string;
|
|
90
|
+
} | {
|
|
91
|
+
type: "system";
|
|
92
|
+
url: string;
|
|
93
|
+
sha256: string;
|
|
94
|
+
};
|
|
95
|
+
interface PluginOAuthConfigPatch extends Omit<Partial<PluginOAuthConfig>, "authorizeParams" | "tokenExtraHeaders"> {
|
|
96
|
+
authorizeParams?: Record<string, string | null> | null;
|
|
97
|
+
tokenExtraHeaders?: Record<string, string | null> | null;
|
|
98
|
+
}
|
|
99
|
+
/** Install-level changes applied to one plugin manifest before validation. */
|
|
100
|
+
export interface PluginManifestConfig {
|
|
101
|
+
description?: string;
|
|
102
|
+
capabilities?: string[];
|
|
103
|
+
configKeys?: string[];
|
|
104
|
+
domains?: string[] | null;
|
|
105
|
+
apiHeaders?: Record<string, string | null> | null;
|
|
106
|
+
commandEnv?: Record<string, string | null> | null;
|
|
107
|
+
envVars?: Record<string, PluginEnvVarDeclaration | null> | null;
|
|
108
|
+
credentials?: {
|
|
109
|
+
type?: "oauth-bearer" | "github-app";
|
|
110
|
+
domains?: string[];
|
|
111
|
+
apiHeaders?: Record<string, string | null> | null;
|
|
112
|
+
authTokenEnv?: string;
|
|
113
|
+
authTokenPlaceholder?: string | null;
|
|
114
|
+
appIdEnv?: string;
|
|
115
|
+
privateKeyEnv?: string;
|
|
116
|
+
installationIdEnv?: string;
|
|
117
|
+
} | null;
|
|
118
|
+
runtimeDependencies?: PluginRuntimeDependencyConfig[] | null;
|
|
119
|
+
runtimePostinstall?: PluginRuntimePostinstallCommand[] | null;
|
|
120
|
+
mcp?: {
|
|
121
|
+
transport?: "http";
|
|
122
|
+
url?: string;
|
|
123
|
+
headers?: Record<string, string | null> | null;
|
|
124
|
+
allowedTools?: string[] | null;
|
|
125
|
+
} | null;
|
|
126
|
+
oauth?: PluginOAuthConfigPatch | null;
|
|
127
|
+
target?: {
|
|
128
|
+
type?: string;
|
|
129
|
+
configKey?: string;
|
|
130
|
+
commandFlags?: string[] | null;
|
|
131
|
+
} | null;
|
|
132
|
+
}
|
|
133
|
+
/** Install-level plugin package list and manifest configuration. */
|
|
134
|
+
export interface PluginConfig {
|
|
135
|
+
packages?: string[];
|
|
136
|
+
manifests?: Record<string, PluginManifestConfig>;
|
|
137
|
+
}
|
|
138
|
+
export interface PluginBrokerDeps {
|
|
139
|
+
userTokenStore: UserTokenStore;
|
|
140
|
+
}
|
|
141
|
+
export interface PluginDefinition {
|
|
142
|
+
manifest: PluginManifest;
|
|
143
|
+
dir: string;
|
|
144
|
+
skillsDir: string;
|
|
145
|
+
}
|
|
146
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ThreadArtifactsState } from "@/chat/state/artifacts";
|
|
2
|
+
import type { Skill, SkillMetadata, SkillInvocation } from "@/chat/skills";
|
|
3
|
+
import type { ActiveMcpCatalogSummary } from "@/chat/tools/skill/mcp-tool-summary";
|
|
4
|
+
export declare const JUNIOR_PERSONALITY: string;
|
|
5
|
+
export declare const JUNIOR_WORLD: string | null;
|
|
6
|
+
interface ToolPromptContext {
|
|
7
|
+
name: string;
|
|
8
|
+
promptGuidelines?: string[];
|
|
9
|
+
promptSnippet?: string;
|
|
10
|
+
}
|
|
11
|
+
type TurnContextPromptInput = {
|
|
12
|
+
availableSkills: SkillMetadata[];
|
|
13
|
+
activeSkills: Skill[];
|
|
14
|
+
activeMcpCatalogs?: ActiveMcpCatalogSummary[];
|
|
15
|
+
toolGuidance?: ToolPromptContext[];
|
|
16
|
+
runtime?: {
|
|
17
|
+
conversationId?: string;
|
|
18
|
+
traceId?: string;
|
|
19
|
+
};
|
|
20
|
+
invocation: SkillInvocation | null;
|
|
21
|
+
requester?: {
|
|
22
|
+
userName?: string;
|
|
23
|
+
fullName?: string;
|
|
24
|
+
userId?: string;
|
|
25
|
+
};
|
|
26
|
+
artifactState?: ThreadArtifactsState;
|
|
27
|
+
configuration?: Record<string, unknown>;
|
|
28
|
+
/**
|
|
29
|
+
* Whether this turn is a fresh prompt or a resume from a prior checkpoint
|
|
30
|
+
* (OAuth pause or timeout-resume). Surfaced in <context> so the model knows
|
|
31
|
+
* it is continuing rather than starting fresh.
|
|
32
|
+
*/
|
|
33
|
+
turnState?: "fresh" | "resumed";
|
|
34
|
+
};
|
|
35
|
+
/** Return byte-stable platform instructions shared by every conversation and turn. */
|
|
36
|
+
export declare function buildSystemPrompt(): string;
|
|
37
|
+
/** Build volatile runtime context that belongs in the user turn, not the system prompt. */
|
|
38
|
+
export declare function buildTurnContextPrompt(params: TurnContextPromptInput): string;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Message, Thread } from "chat";
|
|
2
|
+
import type { SlackTurnRuntime } from "@/chat/runtime/slack-runtime";
|
|
3
|
+
import { downloadPrivateSlackFile as downloadPrivateSlackFileImpl } from "@/chat/slack/client";
|
|
4
|
+
export type ThreadMessageKind = "new_mention" | "subscribed_message";
|
|
5
|
+
export interface ThreadMessageDispatchArgs {
|
|
6
|
+
beforeFirstResponsePost?: () => Promise<void>;
|
|
7
|
+
kind: ThreadMessageKind;
|
|
8
|
+
message: Message;
|
|
9
|
+
thread: Thread;
|
|
10
|
+
}
|
|
11
|
+
export type ThreadMessageRuntime = Pick<SlackTurnRuntime<unknown>, "handleNewMention" | "handleSubscribedMessage">;
|
|
12
|
+
export type ThreadMessageDispatcher = (args: ThreadMessageDispatchArgs) => Promise<void>;
|
|
13
|
+
export interface CreateThreadMessageDispatcherOptions {
|
|
14
|
+
downloadPrivateSlackFile?: typeof downloadPrivateSlackFileImpl;
|
|
15
|
+
runtime: ThreadMessageRuntime;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Attach Slack private-file download functions to deserialized attachments.
|
|
19
|
+
*
|
|
20
|
+
* The Chat SDK's `concurrency: "queue"` strategy serializes queued messages
|
|
21
|
+
* via `Message.toJSON()`, which strips `fetchData` (a function) and `data`
|
|
22
|
+
* (a Buffer). When dequeued, attachments have a `url` but no fetcher.
|
|
23
|
+
* This re-attaches a bot-token-auth'd download callback.
|
|
24
|
+
*
|
|
25
|
+
* No-ops when `fetchData` is already present, so safe to call unconditionally.
|
|
26
|
+
*/
|
|
27
|
+
export declare function rehydrateAttachmentFetchers(message: {
|
|
28
|
+
attachments: Array<{
|
|
29
|
+
fetchData?: unknown;
|
|
30
|
+
url?: string;
|
|
31
|
+
}>;
|
|
32
|
+
}, downloadPrivateSlackFile?: typeof downloadPrivateSlackFileImpl): void;
|
|
33
|
+
export declare function createThreadMessageDispatcher(options: CreateThreadMessageDispatcherOptions): ThreadMessageDispatcher;
|