@sentry/junior 0.53.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 +1934 -1658
- 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,74 @@
|
|
|
1
|
+
import { type AgentTurnSessionCheckpoint } from "@/chat/state/turn-session-store";
|
|
2
|
+
import type { PiMessage } from "@/chat/pi/messages";
|
|
3
|
+
import { type AgentTurnUsage } from "@/chat/usage";
|
|
4
|
+
export interface TurnCheckpointContext {
|
|
5
|
+
conversationId?: string;
|
|
6
|
+
sessionId?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface TurnCheckpointState {
|
|
9
|
+
canUseTurnSession: boolean;
|
|
10
|
+
resumedFromCheckpoint: boolean;
|
|
11
|
+
currentSliceId: number;
|
|
12
|
+
existingCheckpoint?: AgentTurnSessionCheckpoint;
|
|
13
|
+
}
|
|
14
|
+
interface CheckpointLogContext {
|
|
15
|
+
threadId?: string;
|
|
16
|
+
requesterId?: string;
|
|
17
|
+
channelId?: string;
|
|
18
|
+
runId?: string;
|
|
19
|
+
assistantUserName?: string;
|
|
20
|
+
modelId: string;
|
|
21
|
+
}
|
|
22
|
+
/** Load turn checkpoint state for a conversation/session pair. */
|
|
23
|
+
export declare function loadTurnCheckpoint(ctx: TurnCheckpointContext): Promise<TurnCheckpointState>;
|
|
24
|
+
/** Persist the latest safe in-progress boundary without scheduling continuation. */
|
|
25
|
+
export declare function persistRunningCheckpoint(args: {
|
|
26
|
+
conversationId: string;
|
|
27
|
+
sessionId: string;
|
|
28
|
+
sliceId: number;
|
|
29
|
+
messages: PiMessage[];
|
|
30
|
+
loadedSkillNames: string[];
|
|
31
|
+
logContext: CheckpointLogContext;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
/** Persist a completed turn checkpoint. */
|
|
34
|
+
export declare function persistCompletedCheckpoint(args: {
|
|
35
|
+
conversationId: string;
|
|
36
|
+
currentDurationMs?: number;
|
|
37
|
+
currentUsage?: AgentTurnUsage;
|
|
38
|
+
sessionId: string;
|
|
39
|
+
sliceId: number;
|
|
40
|
+
allMessages: PiMessage[];
|
|
41
|
+
loadedSkillNames: string[];
|
|
42
|
+
logContext: CheckpointLogContext;
|
|
43
|
+
}): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Persist an auth-pause checkpoint. Returns the durable checkpoint only when
|
|
46
|
+
* the caller can safely hand the user to an authorization resume flow.
|
|
47
|
+
*/
|
|
48
|
+
export declare function persistAuthPauseCheckpoint(args: {
|
|
49
|
+
conversationId: string;
|
|
50
|
+
sessionId: string;
|
|
51
|
+
currentSliceId: number;
|
|
52
|
+
currentDurationMs?: number;
|
|
53
|
+
currentUsage?: AgentTurnUsage;
|
|
54
|
+
messages: PiMessage[];
|
|
55
|
+
loadedSkillNames: string[];
|
|
56
|
+
errorMessage: string;
|
|
57
|
+
logContext: CheckpointLogContext;
|
|
58
|
+
}): Promise<AgentTurnSessionCheckpoint | undefined>;
|
|
59
|
+
/**
|
|
60
|
+
* Persist a timeout checkpoint at the last safe boundary. Returns the durable
|
|
61
|
+
* checkpoint when persistence succeeds so callers can enqueue a continuation.
|
|
62
|
+
*/
|
|
63
|
+
export declare function persistTimeoutCheckpoint(args: {
|
|
64
|
+
conversationId: string;
|
|
65
|
+
sessionId: string;
|
|
66
|
+
currentSliceId: number;
|
|
67
|
+
currentDurationMs?: number;
|
|
68
|
+
currentUsage?: AgentTurnUsage;
|
|
69
|
+
messages: PiMessage[];
|
|
70
|
+
loadedSkillNames: string[];
|
|
71
|
+
errorMessage: string;
|
|
72
|
+
logContext: CheckpointLogContext;
|
|
73
|
+
}): Promise<AgentTurnSessionCheckpoint | undefined>;
|
|
74
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LogContext } from "@/chat/logging";
|
|
2
|
+
import type { AssistantReply } from "@/chat/services/turn-result";
|
|
3
|
+
type LogException = (error: unknown, eventName: string, context?: LogContext, attributes?: Record<string, unknown>, body?: string) => string | undefined;
|
|
4
|
+
/** Require captured turn failures to carry a real Sentry event reference. */
|
|
5
|
+
export declare function requireTurnFailureEventId(eventId: string | undefined, eventName: string): string;
|
|
6
|
+
/** Keep failed-turn Sentry captures and completion spans on the same keys. */
|
|
7
|
+
export declare function getAgentTurnDiagnosticsAttributes(reply: AssistantReply): Record<string, unknown>;
|
|
8
|
+
/** Enforce one captured, event-ID-bearing failure response before delivery. */
|
|
9
|
+
export declare function finalizeFailedTurnReply(args: {
|
|
10
|
+
reply: AssistantReply;
|
|
11
|
+
logException: LogException;
|
|
12
|
+
context: LogContext;
|
|
13
|
+
attributes?: Record<string, unknown>;
|
|
14
|
+
}): AssistantReply;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { FileUpload } from "chat";
|
|
2
|
+
import type { LogContext } from "@/chat/logging";
|
|
3
|
+
import type { TurnThinkingSelection } from "@/chat/services/turn-thinking-level";
|
|
4
|
+
import type { AgentTurnUsage } from "@/chat/usage";
|
|
5
|
+
import { type ReplyDeliveryPlan } from "@/chat/services/reply-delivery-plan";
|
|
6
|
+
import type { ThreadArtifactsState } from "@/chat/state/artifacts";
|
|
7
|
+
export interface AgentTurnDiagnostics {
|
|
8
|
+
assistantMessageCount: number;
|
|
9
|
+
durationMs?: number;
|
|
10
|
+
errorMessage?: string;
|
|
11
|
+
providerError?: unknown;
|
|
12
|
+
modelId: string;
|
|
13
|
+
outcome: "success" | "execution_failure" | "provider_error";
|
|
14
|
+
thinkingLevel?: TurnThinkingSelection["thinkingLevel"];
|
|
15
|
+
stopReason?: string;
|
|
16
|
+
toolCalls: string[];
|
|
17
|
+
toolErrorCount: number;
|
|
18
|
+
toolResultCount: number;
|
|
19
|
+
usage?: AgentTurnUsage;
|
|
20
|
+
usedPrimaryText: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface AssistantReply {
|
|
23
|
+
text: string;
|
|
24
|
+
files?: FileUpload[];
|
|
25
|
+
artifactStatePatch?: Partial<ThreadArtifactsState>;
|
|
26
|
+
deliveryPlan?: ReplyDeliveryPlan;
|
|
27
|
+
deliveryMode?: "thread" | "channel_only";
|
|
28
|
+
sandboxId?: string;
|
|
29
|
+
sandboxDependencyProfileHash?: string;
|
|
30
|
+
diagnostics: AgentTurnDiagnostics;
|
|
31
|
+
}
|
|
32
|
+
export interface TurnResultInput {
|
|
33
|
+
newMessages: unknown[];
|
|
34
|
+
userInput: string;
|
|
35
|
+
replyFiles: FileUpload[];
|
|
36
|
+
artifactStatePatch: Partial<ThreadArtifactsState>;
|
|
37
|
+
toolCalls: string[];
|
|
38
|
+
sandboxId?: string;
|
|
39
|
+
sandboxDependencyProfileHash?: string;
|
|
40
|
+
durationMs?: number;
|
|
41
|
+
generatedFileCount: number;
|
|
42
|
+
shouldTrace: boolean;
|
|
43
|
+
spanContext: LogContext;
|
|
44
|
+
usage?: AgentTurnUsage;
|
|
45
|
+
thinkingSelection: TurnThinkingSelection;
|
|
46
|
+
correlation?: {
|
|
47
|
+
threadId?: string;
|
|
48
|
+
requesterId?: string;
|
|
49
|
+
channelId?: string;
|
|
50
|
+
runId?: string;
|
|
51
|
+
};
|
|
52
|
+
assistantUserName?: string;
|
|
53
|
+
}
|
|
54
|
+
/** Process raw agent messages into a structured AssistantReply. */
|
|
55
|
+
export declare function buildTurnResult(input: TurnResultInput): AssistantReply;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ThinkingLevel as AgentThinkingLevel } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import type { ThinkingLevel as ProviderThinkingLevel } from "@earendil-works/pi-ai";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
declare const TURN_THINKING_LEVELS: readonly ["none", "low", "medium", "high", "xhigh"];
|
|
5
|
+
declare const turnExecutionProfileSchema: z.ZodObject<{
|
|
6
|
+
thinking_level: z.ZodEnum<{
|
|
7
|
+
low: "low";
|
|
8
|
+
medium: "medium";
|
|
9
|
+
high: "high";
|
|
10
|
+
xhigh: "xhigh";
|
|
11
|
+
none: "none";
|
|
12
|
+
}>;
|
|
13
|
+
confidence: z.ZodPreprocess<z.ZodNumber>;
|
|
14
|
+
reason: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
type TurnThinkingLevel = (typeof TURN_THINKING_LEVELS)[number];
|
|
17
|
+
export interface TurnThinkingSelection {
|
|
18
|
+
confidence?: number;
|
|
19
|
+
thinkingLevel: TurnThinkingLevel;
|
|
20
|
+
reason: string;
|
|
21
|
+
}
|
|
22
|
+
/** Choose the thinking level for the upcoming assistant turn. */
|
|
23
|
+
export declare function selectTurnThinkingLevel(args: {
|
|
24
|
+
completeObject: (args: {
|
|
25
|
+
modelId: string;
|
|
26
|
+
schema: typeof turnExecutionProfileSchema;
|
|
27
|
+
maxTokens: number;
|
|
28
|
+
metadata: Record<string, string>;
|
|
29
|
+
prompt: string;
|
|
30
|
+
thinkingLevel?: ProviderThinkingLevel;
|
|
31
|
+
system: string;
|
|
32
|
+
temperature: number;
|
|
33
|
+
}) => Promise<{
|
|
34
|
+
object: unknown;
|
|
35
|
+
}>;
|
|
36
|
+
conversationContext?: string;
|
|
37
|
+
context?: {
|
|
38
|
+
channelId?: string;
|
|
39
|
+
requesterId?: string;
|
|
40
|
+
runId?: string;
|
|
41
|
+
threadId?: string;
|
|
42
|
+
};
|
|
43
|
+
currentTurnBlocks?: string[];
|
|
44
|
+
fastModelId: string;
|
|
45
|
+
messageText: string;
|
|
46
|
+
}): Promise<TurnThinkingSelection>;
|
|
47
|
+
/** Convert a routing bucket into the Pi Agent thinking level for a main turn. */
|
|
48
|
+
export declare function toAgentThinkingLevel(level: TurnThinkingSelection["thinkingLevel"]): AgentThinkingLevel | "off";
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Attachment } from "chat";
|
|
2
|
+
import type { completeText } from "@/chat/pi/client";
|
|
3
|
+
import type { ThreadConversationState } from "@/chat/state/conversation";
|
|
4
|
+
export interface UserInputAttachment {
|
|
5
|
+
data?: Buffer;
|
|
6
|
+
mediaType: string;
|
|
7
|
+
filename?: string;
|
|
8
|
+
promptText?: string;
|
|
9
|
+
}
|
|
10
|
+
interface VisionThreadFile {
|
|
11
|
+
id?: string;
|
|
12
|
+
mimetype?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
size?: number;
|
|
15
|
+
url_private?: string;
|
|
16
|
+
url_private_download?: string;
|
|
17
|
+
}
|
|
18
|
+
interface VisionThreadReply {
|
|
19
|
+
ts?: string;
|
|
20
|
+
subtype?: string;
|
|
21
|
+
bot_id?: string;
|
|
22
|
+
files?: VisionThreadFile[];
|
|
23
|
+
}
|
|
24
|
+
export interface VisionContextDeps {
|
|
25
|
+
completeText: typeof completeText;
|
|
26
|
+
downloadFile: (url: string) => Promise<Buffer>;
|
|
27
|
+
listThreadReplies: (input: {
|
|
28
|
+
channelId: string;
|
|
29
|
+
threadTs: string;
|
|
30
|
+
limit?: number;
|
|
31
|
+
maxPages?: number;
|
|
32
|
+
targetMessageTs?: string[];
|
|
33
|
+
}) => Promise<VisionThreadReply[]>;
|
|
34
|
+
}
|
|
35
|
+
export interface VisionContextService {
|
|
36
|
+
hydrateConversationVisionContext: (conversation: ThreadConversationState, context: {
|
|
37
|
+
threadId?: string;
|
|
38
|
+
channelId?: string;
|
|
39
|
+
requesterId?: string;
|
|
40
|
+
runId?: string;
|
|
41
|
+
threadTs?: string;
|
|
42
|
+
}) => Promise<void>;
|
|
43
|
+
resolveUserAttachments: (attachments: Attachment[] | undefined, context: ResolveUserAttachmentsContext) => Promise<UserInputAttachment[]>;
|
|
44
|
+
}
|
|
45
|
+
interface ResolveUserAttachmentsContext {
|
|
46
|
+
threadId?: string;
|
|
47
|
+
requesterId?: string;
|
|
48
|
+
channelId?: string;
|
|
49
|
+
runId?: string;
|
|
50
|
+
conversation?: ThreadConversationState;
|
|
51
|
+
messageTs?: string;
|
|
52
|
+
}
|
|
53
|
+
/** Report whether the current Slack message carries an image that needs vision hydration. */
|
|
54
|
+
export declare function hasPotentialImageAttachment(attachments: Attachment[] | undefined): boolean;
|
|
55
|
+
/** Count image-bearing Slack attachments before vision filtering removes them. */
|
|
56
|
+
export declare function countPotentialImageAttachments(attachments: Attachment[] | undefined): number;
|
|
57
|
+
/** Report whether a dedicated vision model is configured for image analysis. */
|
|
58
|
+
export declare function isVisionEnabled(): boolean;
|
|
59
|
+
/** Build the vision service that owns thread image hydration and attachment preprocessing. */
|
|
60
|
+
export declare function createVisionContextService(deps: VisionContextDeps): VisionContextService;
|
|
61
|
+
export {};
|
|
@@ -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;
|