@sentry/junior 0.53.0 → 0.55.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 +4 -3
- package/dist/api-reference.d.ts +7 -0
- package/dist/app.d.ts +14 -12
- package/dist/app.js +12977 -10333
- 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/agent-dispatch/context.d.ts +6 -0
- package/dist/chat/agent-dispatch/heartbeat.d.ts +14 -0
- package/dist/chat/agent-dispatch/runner.d.ts +9 -0
- package/dist/chat/agent-dispatch/signing.d.ts +5 -0
- package/dist/chat/agent-dispatch/store.d.ts +29 -0
- package/dist/chat/agent-dispatch/types.d.ts +57 -0
- package/dist/chat/agent-dispatch/validation.d.ts +3 -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 +47 -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/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 +9 -0
- package/dist/chat/interruption-marker.d.ts +2 -0
- package/dist/chat/logging.d.ts +90 -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/agent-hooks.d.ts +32 -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/logging.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/state.d.ts +3 -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 +75 -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 +24 -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 +17 -0
- package/dist/chat/sandbox/egress-session.d.ts +27 -0
- package/dist/chat/sandbox/errors.d.ts +12 -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 +54 -0
- package/dist/chat/sandbox/session.d.ts +54 -0
- package/dist/chat/sandbox/skill-sandbox.d.ts +42 -0
- package/dist/chat/sandbox/skill-sync.d.ts +16 -0
- package/dist/chat/sandbox/workspace.d.ts +55 -0
- package/dist/chat/scheduler/cadence.d.ts +24 -0
- package/dist/chat/scheduler/plugin.d.ts +2 -0
- package/dist/chat/scheduler/prompt.d.ts +7 -0
- package/dist/chat/scheduler/store.d.ts +49 -0
- package/dist/chat/scheduler/types.d.ts +86 -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 +19 -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 +30 -0
- package/dist/chat/services/pending-auth.d.ts +27 -0
- package/dist/chat/services/plugin-auth-orchestration.d.ts +37 -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/ids.d.ts +4 -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 +8 -0
- package/dist/chat/slack/users.d.ts +39 -0
- package/dist/chat/slack/workspace-context.d.ts +4 -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 +10 -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/schedule-tools.d.ts +29 -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 +61 -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-ZNFNY53B.js → chunk-D3G3YOU4.js} +2 -2
- package/dist/chunk-SCQPBJAU.js +21 -0
- package/dist/{chunk-Q3FDONU7.js → chunk-TTUY467K.js} +47 -37
- package/dist/{chunk-KCOKQLBF.js → chunk-XI3CFWTA.js} +168 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +6 -1
- package/dist/cli/snapshot-warmup.js +3 -3
- package/dist/handlers/agent-dispatch.d.ts +3 -0
- 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/heartbeat.d.ts +3 -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 +9 -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/dist/vercel.js +3 -12
- package/package.json +32 -26
- 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,48 @@
|
|
|
1
|
+
export interface ParsedSkillFile {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
body: string;
|
|
5
|
+
metadata?: Record<string, unknown>;
|
|
6
|
+
compatibility?: string;
|
|
7
|
+
license?: string;
|
|
8
|
+
allowedTools?: string[];
|
|
9
|
+
disableModelInvocation?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Strip YAML frontmatter from a skill file, returning only the body. */
|
|
12
|
+
export declare function stripFrontmatter(raw: string): string;
|
|
13
|
+
/** Parse a SKILL.md file's frontmatter and body. */
|
|
14
|
+
export declare function parseSkillFile(raw: string, expectedName?: string): {
|
|
15
|
+
ok: true;
|
|
16
|
+
skill: ParsedSkillFile;
|
|
17
|
+
} | {
|
|
18
|
+
ok: false;
|
|
19
|
+
error: string;
|
|
20
|
+
};
|
|
21
|
+
export interface SkillMetadata {
|
|
22
|
+
name: string;
|
|
23
|
+
description: string;
|
|
24
|
+
skillPath: string;
|
|
25
|
+
pluginProvider?: string;
|
|
26
|
+
allowedTools?: string[];
|
|
27
|
+
disableModelInvocation?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface Skill extends SkillMetadata {
|
|
30
|
+
body: string;
|
|
31
|
+
}
|
|
32
|
+
export interface SkillInvocation {
|
|
33
|
+
skillName: string;
|
|
34
|
+
args: string;
|
|
35
|
+
}
|
|
36
|
+
export interface DiscoverSkillsOptions {
|
|
37
|
+
additionalRoots?: string[];
|
|
38
|
+
}
|
|
39
|
+
/** Clear the cached skill discovery results so the next call re-scans disk. */
|
|
40
|
+
export declare function resetSkillDiscoveryCache(): void;
|
|
41
|
+
/** Scan all configured skill roots and return discovered skill metadata, using a cache when roots match. */
|
|
42
|
+
export declare function discoverSkills(options?: DiscoverSkillsOptions): Promise<SkillMetadata[]>;
|
|
43
|
+
/** Extract a skill invocation (name + args) from a user message, or return null if none matches. */
|
|
44
|
+
export declare function parseSkillInvocation(messageText: string, availableSkills: SkillMetadata[]): SkillInvocation | null;
|
|
45
|
+
/** Look up a skill by name from the available set. */
|
|
46
|
+
export declare function findSkillByName(skillName: string, available: SkillMetadata[]): SkillMetadata | null;
|
|
47
|
+
/** Load full skill bodies for a list of skill names, reading SKILL.md files from disk. */
|
|
48
|
+
export declare function loadSkillsByName(skillNames: string[], available: SkillMetadata[]): Promise<Skill[]>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type SlackAdapter, type SlackAdapterConfig } from "@chat-adapter/slack";
|
|
2
|
+
/**
|
|
3
|
+
* Create the repository's Slack adapter.
|
|
4
|
+
*
|
|
5
|
+
* Junior used to patch private Slack adapter internals to alter native stream
|
|
6
|
+
* buffering. Visible reply delivery now relies on finalized thread posts plus
|
|
7
|
+
* assistant status updates, so we keep the adapter on the documented surface.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createJuniorSlackAdapter(config?: SlackAdapterConfig): SlackAdapter;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { WebClient, KnownBlock } from "@slack/web-api";
|
|
2
|
+
import type { UserTokenStore } from "@/chat/credentials/user-token-store";
|
|
3
|
+
interface HomeView {
|
|
4
|
+
type: "home";
|
|
5
|
+
blocks: KnownBlock[];
|
|
6
|
+
}
|
|
7
|
+
/** Build the Slack App Home tab view showing skills, connected accounts, and version. */
|
|
8
|
+
export declare function buildHomeView(userId: string, userTokenStore: UserTokenStore): Promise<HomeView>;
|
|
9
|
+
/** Publish the App Home view to a specific Slack user. */
|
|
10
|
+
export declare function publishAppHomeView(slackClient: WebClient, userId: string, userTokenStore: UserTokenStore): Promise<void>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SlackAdapter } from "@chat-adapter/slack";
|
|
2
|
+
interface AssistantThreadLifecycleEvent {
|
|
3
|
+
channelId: string;
|
|
4
|
+
threadTs: string;
|
|
5
|
+
sourceChannelId?: string;
|
|
6
|
+
getSlackAdapter: () => SlackAdapter;
|
|
7
|
+
onContextChannelResolved: (sourceChannelId: string) => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
/** Initialize a newly started Slack assistant thread. */
|
|
10
|
+
export declare function initializeAssistantThread(event: AssistantThreadLifecycleEvent): Promise<void>;
|
|
11
|
+
/** Refresh Slack assistant thread context without resetting the thread title. */
|
|
12
|
+
export declare function refreshAssistantThreadContext(event: AssistantThreadLifecycleEvent): Promise<void>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const DEFAULT_STATUS_CONTEXTS: {
|
|
2
|
+
readonly thinking: "…";
|
|
3
|
+
readonly searching: "sources";
|
|
4
|
+
readonly reading: "task";
|
|
5
|
+
readonly reviewing: "results";
|
|
6
|
+
readonly drafting: "reply";
|
|
7
|
+
readonly running: "tasks";
|
|
8
|
+
};
|
|
9
|
+
type AssistantStatusVerb = keyof typeof DEFAULT_STATUS_CONTEXTS;
|
|
10
|
+
export interface AssistantStatusSpec {
|
|
11
|
+
text: string;
|
|
12
|
+
}
|
|
13
|
+
interface AssistantStatusPresentation {
|
|
14
|
+
key: string;
|
|
15
|
+
visible: string;
|
|
16
|
+
}
|
|
17
|
+
/** Build assistant progress text from a verb and optional context. */
|
|
18
|
+
export declare function makeAssistantStatus(verb: AssistantStatusVerb, context?: string): AssistantStatusSpec;
|
|
19
|
+
/** Normalize a progress update into the visible Slack loading copy. */
|
|
20
|
+
export declare function renderAssistantStatus(args: {
|
|
21
|
+
status: AssistantStatusSpec;
|
|
22
|
+
}): AssistantStatusPresentation;
|
|
23
|
+
/** Select and normalize the loading messages used for Slack status rotation. */
|
|
24
|
+
export declare function selectAssistantLoadingMessages(args: {
|
|
25
|
+
messages: string[];
|
|
26
|
+
random?: () => number;
|
|
27
|
+
}): string[] | undefined;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type AssistantStatusSpec } from "@/chat/slack/assistant-thread/status-render";
|
|
2
|
+
export type TimerHandle = ReturnType<typeof setTimeout>;
|
|
3
|
+
export interface AssistantStatusSession {
|
|
4
|
+
start: () => void;
|
|
5
|
+
stop: () => Promise<void>;
|
|
6
|
+
update: (status: AssistantStatusSpec) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Pace assistant loading-state writes for a single turn.
|
|
10
|
+
*
|
|
11
|
+
* This layer owns only local scheduling policy: debounce, minimum visible
|
|
12
|
+
* duration, refresh cadence, and write ordering. It deals in user-visible
|
|
13
|
+
* progress copy; the transport decides how that maps onto Slack's `status`
|
|
14
|
+
* versus `loading_messages` fields.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createAssistantStatusScheduler(args: {
|
|
17
|
+
sendStatus: (text: string, loadingMessages?: string[]) => Promise<void>;
|
|
18
|
+
loadingMessages?: string[];
|
|
19
|
+
now?: () => number;
|
|
20
|
+
setTimer?: (callback: () => void, delayMs: number) => TimerHandle;
|
|
21
|
+
clearTimer?: (timer: TimerHandle) => void;
|
|
22
|
+
random?: () => number;
|
|
23
|
+
}): AssistantStatusSession;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { SlackAdapter } from "@chat-adapter/slack";
|
|
2
|
+
import { getSlackClient } from "@/chat/slack/client";
|
|
3
|
+
/**
|
|
4
|
+
* Slack's assistant loading UI accepts both `status` and `loading_messages`,
|
|
5
|
+
* but product policy keeps `status` stable and generic. User-visible progress
|
|
6
|
+
* copy belongs in `loading_messages`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SLACK_ASSISTANT_ACTIVE_STATUS = "is working on your request...";
|
|
9
|
+
type AssistantStatusSender = (text: string, loadingMessages?: string[]) => Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Build a best-effort sender for Slack's assistant loading state.
|
|
12
|
+
*
|
|
13
|
+
* The `text` argument is internal progress copy. This transport maps it onto
|
|
14
|
+
* Slack's loading surface and keeps the raw Slack `status` field fixed.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createSlackAdapterStatusSender(args: {
|
|
17
|
+
channelId?: string;
|
|
18
|
+
threadTs?: string;
|
|
19
|
+
getSlackAdapter: () => Pick<SlackAdapter, "setAssistantStatus">;
|
|
20
|
+
}): AssistantStatusSender;
|
|
21
|
+
/**
|
|
22
|
+
* Build a best-effort sender for Slack's assistant loading state over raw Web
|
|
23
|
+
* API calls. As with the adapter-backed path, the dynamic copy goes to
|
|
24
|
+
* `loading_messages` while `status` stays fixed and generic.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createSlackWebApiStatusSender(args: {
|
|
27
|
+
channelId?: string;
|
|
28
|
+
threadTs?: string;
|
|
29
|
+
getSlackClient?: typeof getSlackClient;
|
|
30
|
+
}): AssistantStatusSender;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { SlackAdapter } from "@chat-adapter/slack";
|
|
2
|
+
import { getSlackClient } from "@/chat/slack/client";
|
|
3
|
+
import { type AssistantStatusSession, type TimerHandle } from "@/chat/slack/assistant-thread/status-scheduler";
|
|
4
|
+
export { makeAssistantStatus, type AssistantStatusSpec, } from "@/chat/slack/assistant-thread/status-render";
|
|
5
|
+
export type { AssistantStatusSession } from "@/chat/slack/assistant-thread/status-scheduler";
|
|
6
|
+
/**
|
|
7
|
+
* Create a Slack adapter-backed session for Slack's assistant loading state.
|
|
8
|
+
*
|
|
9
|
+
* The session accepts internal progress updates and leaves it to the sender to
|
|
10
|
+
* map them onto Slack's fixed generic `status` field plus dynamic
|
|
11
|
+
* `loading_messages`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createSlackAdapterAssistantStatusSession(args: {
|
|
14
|
+
channelId?: string;
|
|
15
|
+
threadTs?: string;
|
|
16
|
+
getSlackAdapter: () => Pick<SlackAdapter, "setAssistantStatus">;
|
|
17
|
+
loadingMessages?: string[];
|
|
18
|
+
now?: () => number;
|
|
19
|
+
setTimer?: (callback: () => void, delayMs: number) => TimerHandle;
|
|
20
|
+
clearTimer?: (timer: TimerHandle) => void;
|
|
21
|
+
random?: () => number;
|
|
22
|
+
}): AssistantStatusSession;
|
|
23
|
+
/**
|
|
24
|
+
* Create a Web API-backed session for Slack's assistant loading state in
|
|
25
|
+
* resume/callback flows that do not use the adapter thread object.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createSlackWebApiAssistantStatusSession(args: {
|
|
28
|
+
channelId?: string;
|
|
29
|
+
threadTs?: string;
|
|
30
|
+
getSlackClient?: typeof getSlackClient;
|
|
31
|
+
loadingMessages?: string[];
|
|
32
|
+
now?: () => number;
|
|
33
|
+
setTimer?: (callback: () => void, delayMs: number) => TimerHandle;
|
|
34
|
+
clearTimer?: (timer: TimerHandle) => void;
|
|
35
|
+
random?: () => number;
|
|
36
|
+
}): AssistantStatusSession;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { SlackAdapter } from "@chat-adapter/slack";
|
|
2
|
+
import { type ConversationMemoryService } from "@/chat/services/conversation-memory";
|
|
3
|
+
import type { ThreadArtifactsState } from "@/chat/state/artifacts";
|
|
4
|
+
import type { ThreadConversationState } from "@/chat/state/conversation";
|
|
5
|
+
/**
|
|
6
|
+
* Best-effort assistant-thread title update for DM assistant threads.
|
|
7
|
+
*
|
|
8
|
+
* Title generation is intentionally detached from reply generation and visible
|
|
9
|
+
* reply delivery. Stable Slack permission failures are treated as a terminal
|
|
10
|
+
* skip for the current source message so later turns do not keep paying for
|
|
11
|
+
* the same fast-model title generation call.
|
|
12
|
+
*/
|
|
13
|
+
export declare function maybeUpdateAssistantTitle(args: {
|
|
14
|
+
assistantThreadContext?: {
|
|
15
|
+
channelId: string;
|
|
16
|
+
threadTs: string;
|
|
17
|
+
};
|
|
18
|
+
assistantUserName: string;
|
|
19
|
+
artifacts: ThreadArtifactsState;
|
|
20
|
+
channelId?: string;
|
|
21
|
+
conversation: ThreadConversationState;
|
|
22
|
+
generateThreadTitle: ConversationMemoryService["generateThreadTitle"];
|
|
23
|
+
getSlackAdapter: () => Pick<SlackAdapter, "setAssistantTitle">;
|
|
24
|
+
modelId: string;
|
|
25
|
+
requesterId?: string;
|
|
26
|
+
runId?: string;
|
|
27
|
+
threadId?: string;
|
|
28
|
+
}): Promise<string | undefined>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface SlackChannelMessage {
|
|
2
|
+
ts?: string;
|
|
3
|
+
user?: string;
|
|
4
|
+
text?: string;
|
|
5
|
+
thread_ts?: string;
|
|
6
|
+
subtype?: string;
|
|
7
|
+
bot_id?: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
attachments?: unknown[];
|
|
10
|
+
}
|
|
11
|
+
export interface SlackFileRef {
|
|
12
|
+
id?: string;
|
|
13
|
+
mimetype?: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
size?: number;
|
|
16
|
+
url_private?: string;
|
|
17
|
+
url_private_download?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SlackThreadReply {
|
|
20
|
+
ts?: string;
|
|
21
|
+
user?: string;
|
|
22
|
+
text?: string;
|
|
23
|
+
thread_ts?: string;
|
|
24
|
+
subtype?: string;
|
|
25
|
+
bot_id?: string;
|
|
26
|
+
type?: string;
|
|
27
|
+
files?: SlackFileRef[];
|
|
28
|
+
attachments?: unknown[];
|
|
29
|
+
}
|
|
30
|
+
export declare function listChannelMessages(input: {
|
|
31
|
+
channelId: string;
|
|
32
|
+
limit: number;
|
|
33
|
+
cursor?: string;
|
|
34
|
+
oldest?: string;
|
|
35
|
+
latest?: string;
|
|
36
|
+
inclusive?: boolean;
|
|
37
|
+
maxPages?: number;
|
|
38
|
+
}): Promise<{
|
|
39
|
+
messages: SlackChannelMessage[];
|
|
40
|
+
nextCursor?: string;
|
|
41
|
+
}>;
|
|
42
|
+
export declare function listThreadReplies(input: {
|
|
43
|
+
channelId: string;
|
|
44
|
+
threadTs: string;
|
|
45
|
+
limit?: number;
|
|
46
|
+
maxPages?: number;
|
|
47
|
+
targetMessageTs?: string[];
|
|
48
|
+
}): Promise<SlackThreadReply[]>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { WebClient } from "@slack/web-api";
|
|
2
|
+
export type SlackActionErrorCode = "missing_token" | "missing_scope" | "rate_limited" | "feature_unavailable" | "canvas_creation_failed" | "canvas_editing_failed" | "invalid_arguments" | "not_found" | "not_in_channel" | "already_reacted" | "no_reaction" | "internal_error";
|
|
3
|
+
export declare class SlackActionError extends Error {
|
|
4
|
+
code: SlackActionErrorCode;
|
|
5
|
+
apiError?: string;
|
|
6
|
+
needed?: string;
|
|
7
|
+
provided?: string;
|
|
8
|
+
statusCode?: number;
|
|
9
|
+
requestId?: string;
|
|
10
|
+
errorData?: string;
|
|
11
|
+
retryAfterSeconds?: number;
|
|
12
|
+
detail?: string;
|
|
13
|
+
detailLine?: number;
|
|
14
|
+
detailRule?: string;
|
|
15
|
+
constructor(message: string, code: SlackActionErrorCode, options?: {
|
|
16
|
+
apiError?: string;
|
|
17
|
+
needed?: string;
|
|
18
|
+
provided?: string;
|
|
19
|
+
statusCode?: number;
|
|
20
|
+
requestId?: string;
|
|
21
|
+
errorData?: string;
|
|
22
|
+
retryAfterSeconds?: number;
|
|
23
|
+
detail?: string;
|
|
24
|
+
detailLine?: number;
|
|
25
|
+
detailRule?: string;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
interface SlackRetryContext {
|
|
29
|
+
action?: string;
|
|
30
|
+
attributes?: Record<string, string | number | boolean>;
|
|
31
|
+
}
|
|
32
|
+
/** Extract a header value by case-insensitive name from a raw headers object. */
|
|
33
|
+
export declare function getHeaderString(headers: unknown, name: string): string | undefined;
|
|
34
|
+
export declare function normalizeSlackConversationId(channelId: string | undefined): string | undefined;
|
|
35
|
+
export declare function withSlackRetries<T>(task: () => Promise<T>, maxAttempts?: number, context?: SlackRetryContext): Promise<T>;
|
|
36
|
+
export declare function getSlackClient(): WebClient;
|
|
37
|
+
/**
|
|
38
|
+
* Slack channel ID prefixes:
|
|
39
|
+
* - C: public channel
|
|
40
|
+
* - G: private channel / group DM
|
|
41
|
+
* - D: direct message (1:1)
|
|
42
|
+
*/
|
|
43
|
+
export declare function isDmChannel(channelId: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Conversation-scoped Slack contexts backed by a concrete conversation ID.
|
|
46
|
+
* Includes channels/groups/DMs (C/G/D).
|
|
47
|
+
*/
|
|
48
|
+
export declare function isConversationScopedChannel(channelId: string | undefined): boolean;
|
|
49
|
+
export declare function isConversationChannel(channelId: string | undefined): boolean;
|
|
50
|
+
export declare function getFilePermalink(fileId: string): Promise<string | undefined>;
|
|
51
|
+
export declare function downloadPrivateSlackFile(url: string): Promise<Buffer>;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Extract channelId and threadTs from a `slack:<channel>:<ts>` thread identifier. */
|
|
2
|
+
export declare function parseSlackThreadId(threadId: string | undefined): {
|
|
3
|
+
channelId: string;
|
|
4
|
+
threadTs: string;
|
|
5
|
+
} | undefined;
|
|
6
|
+
/** Resolve the Slack channel ID from a `slack:<channel>:<ts>` thread identifier. */
|
|
7
|
+
export declare function resolveSlackChannelIdFromThreadId(threadId: string | undefined): string | undefined;
|
|
8
|
+
/** Best-effort channel ID extraction from a raw Slack message payload. */
|
|
9
|
+
export declare function resolveSlackChannelIdFromMessage(message: unknown): string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalizeSlackEmojiName(value: string): string | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Extract Slack's stable API error code from Web API errors. */
|
|
2
|
+
export declare function getSlackApiErrorCode(error: unknown): string | undefined;
|
|
3
|
+
/** Convert Slack Web API error details into the repository's trace attributes. */
|
|
4
|
+
export declare function getSlackErrorObservabilityAttributes(error: unknown): Record<string, string | number>;
|
|
5
|
+
/** Report whether Slack rejected assistant title updates for stable auth reasons. */
|
|
6
|
+
export declare function isSlackTitlePermissionError(error: unknown): boolean;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { TurnThinkingSelection } from "@/chat/services/turn-thinking-level";
|
|
2
|
+
import type { AgentTurnUsage } from "@/chat/usage";
|
|
3
|
+
interface SlackMrkdwnTextObject {
|
|
4
|
+
text: string;
|
|
5
|
+
type: "mrkdwn";
|
|
6
|
+
}
|
|
7
|
+
/** Slack-flavored Markdown block — accepts a standard Markdown subset and Slack renders it natively. */
|
|
8
|
+
interface SlackMarkdownBlock {
|
|
9
|
+
text: string;
|
|
10
|
+
type: "markdown";
|
|
11
|
+
}
|
|
12
|
+
interface SlackSectionBlock {
|
|
13
|
+
text: SlackMrkdwnTextObject;
|
|
14
|
+
type: "section";
|
|
15
|
+
}
|
|
16
|
+
interface SlackContextBlock {
|
|
17
|
+
elements: SlackMrkdwnTextObject[];
|
|
18
|
+
type: "context";
|
|
19
|
+
}
|
|
20
|
+
export type SlackMessageBlock = SlackMarkdownBlock | SlackSectionBlock | SlackContextBlock;
|
|
21
|
+
interface SlackReplyFooterItem {
|
|
22
|
+
label: string;
|
|
23
|
+
url?: string;
|
|
24
|
+
value: string;
|
|
25
|
+
}
|
|
26
|
+
export interface SlackReplyFooter {
|
|
27
|
+
items: SlackReplyFooterItem[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Build a compact footer for the finalized Slack reply.
|
|
31
|
+
*
|
|
32
|
+
* This is reply metadata, not part of the in-flight assistant loading state.
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildSlackReplyFooter(args: {
|
|
35
|
+
conversationId?: string;
|
|
36
|
+
durationMs?: number;
|
|
37
|
+
thinkingLevel?: TurnThinkingSelection["thinkingLevel"];
|
|
38
|
+
usage?: AgentTurnUsage;
|
|
39
|
+
}): SlackReplyFooter | undefined;
|
|
40
|
+
/** Build Slack blocks for a reply chunk using the Slack-flavored markdown block for the body. */
|
|
41
|
+
export declare function buildSlackReplyBlocks(text: string, footer: SlackReplyFooter | undefined): SlackMessageBlock[] | undefined;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Render legacy Slack attachment fields so attachment-only messages still carry context. */
|
|
2
|
+
export declare function renderSlackLegacyAttachmentText(input: unknown): string;
|
|
3
|
+
/** Append legacy Slack attachment text to the message text used by routing and replies. */
|
|
4
|
+
export declare function appendSlackLegacyAttachmentText(baseText: string | undefined, rawMessageOrAttachments: unknown): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Insert blank lines between content blocks so Slack renders them with visual separation. */
|
|
2
|
+
export declare function ensureBlockSpacing(text: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Render model-authored markdown into Slack-friendly `mrkdwn`.
|
|
5
|
+
*
|
|
6
|
+
* Slack reply delivery owns chunking and continuation markers separately.
|
|
7
|
+
* This helper only normalizes text into the repository's canonical Slack
|
|
8
|
+
* rendering form.
|
|
9
|
+
*/
|
|
10
|
+
export declare function renderSlackMrkdwn(text: string): string;
|
|
11
|
+
/** Normalize assistant status text before handing it to Slack. */
|
|
12
|
+
export declare function normalizeSlackStatusText(text: string): string;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { SlackMessageBlock } from "@/chat/slack/footer";
|
|
2
|
+
/** Post Slack `mrkdwn` text to a conversation or thread via the shared outbound boundary. */
|
|
3
|
+
export declare function postSlackMessage(input: {
|
|
4
|
+
blocks?: SlackMessageBlock[];
|
|
5
|
+
channelId: string;
|
|
6
|
+
text: string;
|
|
7
|
+
threadTs?: string;
|
|
8
|
+
includePermalink?: boolean;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
ts: string;
|
|
11
|
+
permalink?: string;
|
|
12
|
+
}>;
|
|
13
|
+
/** Delete a previously posted Slack message through the shared outbound boundary. */
|
|
14
|
+
export declare function deleteSlackMessage(input: {
|
|
15
|
+
channelId: string;
|
|
16
|
+
timestamp: string;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Post an ephemeral Slack message. Delivery is best-effort on Slack's side, but
|
|
20
|
+
* request validation and Web API behavior are centralized here.
|
|
21
|
+
*/
|
|
22
|
+
export declare function postSlackEphemeralMessage(input: {
|
|
23
|
+
channelId: string;
|
|
24
|
+
userId: string;
|
|
25
|
+
text: string;
|
|
26
|
+
threadTs?: string;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
messageTs?: string;
|
|
29
|
+
}>;
|
|
30
|
+
/** Upload files into a Slack thread via the shared outbound file boundary. */
|
|
31
|
+
export declare function uploadFilesToThread(input: {
|
|
32
|
+
channelId: string;
|
|
33
|
+
threadTs: string;
|
|
34
|
+
files: Array<{
|
|
35
|
+
data: Buffer;
|
|
36
|
+
filename: string;
|
|
37
|
+
}>;
|
|
38
|
+
}): Promise<void>;
|
|
39
|
+
/** Add a reaction to a Slack message, treating `already_reacted` as idempotent success. */
|
|
40
|
+
export declare function addReactionToMessage(input: {
|
|
41
|
+
channelId: string;
|
|
42
|
+
timestamp: string;
|
|
43
|
+
emoji: string;
|
|
44
|
+
}): Promise<{
|
|
45
|
+
ok: true;
|
|
46
|
+
}>;
|
|
47
|
+
/** Remove a reaction from a Slack message, treating `no_reaction` as idempotent success. */
|
|
48
|
+
export declare function removeReactionFromMessage(input: {
|
|
49
|
+
channelId: string;
|
|
50
|
+
timestamp: string;
|
|
51
|
+
emoji: string;
|
|
52
|
+
}): Promise<{
|
|
53
|
+
ok: true;
|
|
54
|
+
}>;
|
|
55
|
+
export declare const slackOutboundPolicy: {
|
|
56
|
+
maxMessageTextChars: number;
|
|
57
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { FileUpload, PostableMessage } from "chat";
|
|
2
|
+
/** Return the first continuation-safe chunk plus any remaining text. */
|
|
3
|
+
export declare function takeSlackContinuationPrefix(text: string, options?: {
|
|
4
|
+
forceSplit?: boolean;
|
|
5
|
+
maxChars?: number;
|
|
6
|
+
maxLines?: number;
|
|
7
|
+
}): {
|
|
8
|
+
prefix: string;
|
|
9
|
+
renderedPrefix: string;
|
|
10
|
+
rest: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Take the largest Slack-safe inline prefix from `text` under the configured
|
|
14
|
+
* character and line budgets. Returns the consumed prefix plus remaining text.
|
|
15
|
+
*/
|
|
16
|
+
export declare function takeSlackInlinePrefix(text: string, options?: {
|
|
17
|
+
maxChars?: number;
|
|
18
|
+
maxLines?: number;
|
|
19
|
+
}): {
|
|
20
|
+
prefix: string;
|
|
21
|
+
rest: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Split a normalized Slack reply into multiple inline-safe thread messages.
|
|
25
|
+
*
|
|
26
|
+
* Replies split across more than two messages receive explicit continuation
|
|
27
|
+
* markers on non-final chunks. When
|
|
28
|
+
* `interrupted` is true, the final chunk receives an interruption marker.
|
|
29
|
+
*/
|
|
30
|
+
export declare function splitSlackReplyText(text: string, options?: {
|
|
31
|
+
interrupted?: boolean;
|
|
32
|
+
}): string[];
|
|
33
|
+
/** Return the marker added to non-final overflow chunks. */
|
|
34
|
+
export declare function getSlackContinuationMarker(): string;
|
|
35
|
+
/** Return the marker added when a visible reply ended mid-execution. */
|
|
36
|
+
export declare function getSlackInterruptionMarker(): string;
|
|
37
|
+
/**
|
|
38
|
+
* Return true when `text` already fits the repository's inline Slack reply
|
|
39
|
+
* budget without needing continuation messages.
|
|
40
|
+
*/
|
|
41
|
+
export declare function fitsSlackInlineBudget(text: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Reserve enough inline budget for a continuation suffix on the current chunk.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getSlackContinuationBudget(): {
|
|
46
|
+
maxChars: number;
|
|
47
|
+
maxLines: number;
|
|
48
|
+
};
|
|
49
|
+
/** Normalize text for Slack and wrap it as a PostableMessage with optional file attachments. */
|
|
50
|
+
export declare function buildSlackOutputMessage(text: string, files?: FileUpload[]): PostableMessage;
|
|
51
|
+
export declare const slackOutputPolicy: {
|
|
52
|
+
maxInlineChars: number;
|
|
53
|
+
maxInlineLines: number;
|
|
54
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { FileUpload } from "chat";
|
|
2
|
+
import type { AssistantReply } from "@/chat/respond";
|
|
3
|
+
import { type SlackReplyFooter } from "@/chat/slack/footer";
|
|
4
|
+
export type PlannedSlackReplyStage = "thread_reply" | "thread_reply_continuation" | "thread_reply_files_followup";
|
|
5
|
+
export interface PlannedSlackReplyPost {
|
|
6
|
+
files?: FileUpload[];
|
|
7
|
+
stage: PlannedSlackReplyStage;
|
|
8
|
+
text: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Plan the Slack thread posts needed to realize a completed assistant reply,
|
|
12
|
+
* including chunking, interruption markers, and file delivery.
|
|
13
|
+
*/
|
|
14
|
+
export declare function planSlackReplyPosts(args: {
|
|
15
|
+
reply: AssistantReply;
|
|
16
|
+
}): PlannedSlackReplyPost[];
|
|
17
|
+
/**
|
|
18
|
+
* Deliver planned Slack reply posts over raw Slack Web API calls for resume and
|
|
19
|
+
* callback handlers that do not have a Chat SDK thread object.
|
|
20
|
+
*/
|
|
21
|
+
export declare function postSlackApiReplyPosts(args: {
|
|
22
|
+
beforePost?: () => Promise<void>;
|
|
23
|
+
footer?: SlackReplyFooter;
|
|
24
|
+
channelId: string;
|
|
25
|
+
fileUploadFailureMode?: "best_effort" | "strict";
|
|
26
|
+
onPostError?: (context: {
|
|
27
|
+
error: unknown;
|
|
28
|
+
messageTs?: string;
|
|
29
|
+
stage: PlannedSlackReplyStage;
|
|
30
|
+
}) => Promise<void> | void;
|
|
31
|
+
threadTs?: string;
|
|
32
|
+
posts: PlannedSlackReplyPost[];
|
|
33
|
+
}): Promise<string | undefined>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type SlackMessageBlock } from "@/chat/slack/footer";
|
|
2
|
+
/** Build the Slack timeout-continuation acknowledgement with correlation-only metadata. */
|
|
3
|
+
export declare function buildSlackTurnContinuationNotice(args: {
|
|
4
|
+
conversationId?: string;
|
|
5
|
+
}): {
|
|
6
|
+
blocks?: SlackMessageBlock[];
|
|
7
|
+
text: string;
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface SlackUserLookupResult {
|
|
2
|
+
userName?: string;
|
|
3
|
+
fullName?: string;
|
|
4
|
+
email?: string;
|
|
5
|
+
}
|
|
6
|
+
/** Fetch Slack user profile info with in-memory TTL cache to avoid repeated API calls. */
|
|
7
|
+
export declare function lookupSlackUser(userId?: string): Promise<SlackUserLookupResult | null>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Normalized Slack user profile with custom fields from the Slack workspace. */
|
|
2
|
+
export interface SlackUserProfile {
|
|
3
|
+
id: string;
|
|
4
|
+
team_id?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
real_name?: string;
|
|
7
|
+
display_name?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
email?: string;
|
|
10
|
+
status_text?: string;
|
|
11
|
+
status_emoji?: string;
|
|
12
|
+
is_bot: boolean;
|
|
13
|
+
is_deleted: boolean;
|
|
14
|
+
timezone?: string;
|
|
15
|
+
profile_fields?: Array<{
|
|
16
|
+
id: string;
|
|
17
|
+
label?: string;
|
|
18
|
+
value?: string;
|
|
19
|
+
alt?: string;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
/** Look up a Slack user by ID, returning the full profile including custom fields. */
|
|
23
|
+
export declare function lookupSlackUserProfile(userId: string): Promise<SlackUserProfile>;
|
|
24
|
+
/** Look up a Slack user by email. Returns null when no user matches. */
|
|
25
|
+
export declare function lookupSlackUserByEmail(email: string): Promise<SlackUserProfile | null>;
|
|
26
|
+
export interface SlackUserSearchResult {
|
|
27
|
+
users: SlackUserProfile[];
|
|
28
|
+
searched_pages: number;
|
|
29
|
+
searched_user_count: number;
|
|
30
|
+
truncated: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** Search workspace users by name with bounded pagination through `users.list`. */
|
|
33
|
+
export declare function searchSlackUsers(options: {
|
|
34
|
+
query: string;
|
|
35
|
+
limit?: number;
|
|
36
|
+
maxPages?: number;
|
|
37
|
+
includeDeleted?: boolean;
|
|
38
|
+
includeBots?: boolean;
|
|
39
|
+
}): Promise<SlackUserSearchResult>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Run a callback with the Slack workspace team ID for the inbound webhook. */
|
|
2
|
+
export declare function runWithWorkspaceTeamId<T>(teamId: string | undefined, fn: () => T): T;
|
|
3
|
+
/** Return the Slack workspace team ID for the current inbound webhook. */
|
|
4
|
+
export declare function getWorkspaceTeamId(): string | undefined;
|