@sentry/junior 0.72.0 → 0.73.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/bin/junior.mjs +12 -10
- package/dist/app.d.ts +11 -2
- package/dist/app.js +936 -13042
- package/dist/chat/agent-dispatch/runner.d.ts +2 -0
- package/dist/chat/agent-dispatch/store.d.ts +2 -2
- package/dist/chat/agent-dispatch/types.d.ts +6 -3
- package/dist/chat/agent-dispatch/validation.d.ts +2 -3
- package/dist/chat/app/production.d.ts +8 -1
- package/dist/chat/app/services.d.ts +7 -0
- package/dist/chat/destination.d.ts +3 -1
- package/dist/chat/logging.d.ts +3 -0
- package/dist/chat/oauth-flow.d.ts +1 -1
- package/dist/chat/plugins/registry.d.ts +2 -0
- package/dist/chat/plugins/types.d.ts +2 -0
- package/dist/chat/prompt.d.ts +4 -1
- package/dist/chat/requester.d.ts +19 -12
- package/dist/chat/respond.d.ts +6 -2
- package/dist/chat/runtime/agent-continue-runner.d.ts +1 -1
- package/dist/chat/runtime/reply-executor.d.ts +3 -1
- package/dist/chat/runtime/slack-resume.d.ts +3 -3
- package/dist/chat/runtime/slack-runtime.d.ts +13 -3
- package/dist/chat/runtime/turn.d.ts +15 -1
- package/dist/chat/sandbox/egress-credentials.d.ts +5 -2
- package/dist/chat/sandbox/egress-policy.d.ts +5 -1
- package/dist/chat/sandbox/egress-proxy.d.ts +2 -0
- package/dist/chat/sandbox/egress-schemas.d.ts +4 -0
- package/dist/chat/sandbox/egress-session.d.ts +3 -1
- package/dist/chat/sandbox/egress-tracing.d.ts +7 -0
- package/dist/chat/sandbox/sandbox.d.ts +2 -0
- package/dist/chat/sandbox/session.d.ts +3 -2
- package/dist/chat/services/auth-pause-response.d.ts +1 -1
- package/dist/chat/services/auth-pause.d.ts +2 -1
- package/dist/chat/services/mcp-auth-orchestration.d.ts +1 -1
- package/dist/chat/services/message-actor-identity.d.ts +2 -2
- package/dist/chat/services/plugin-auth-orchestration.d.ts +9 -8
- package/dist/chat/services/turn-result.d.ts +3 -0
- package/dist/chat/slack/user.d.ts +2 -2
- package/dist/chat/task-execution/store.d.ts +1 -1
- package/dist/chat/tools/slack/canvas-tools.d.ts +3 -2
- package/dist/chat/tools/slack/channel-list-messages.d.ts +2 -2
- package/dist/chat/tools/slack/channel-post-message.d.ts +3 -2
- package/dist/chat/tools/slack/context.d.ts +15 -2
- package/dist/chat/tools/slack/message-add-reaction.d.ts +3 -2
- package/dist/chat/tools/slack/thread-read.d.ts +2 -2
- package/dist/chat/tools/types.d.ts +19 -19
- package/dist/{chunk-6GEYPE6T.js → chunk-3BYAPS6B.js} +30 -6
- package/dist/{chunk-GB3AL54K.js → chunk-7Q5YOUUT.js} +10 -2
- package/dist/{chunk-HNMUVGSR.js → chunk-AL5T52ZD.js} +6 -6
- package/dist/{chunk-PP7AGSBU.js → chunk-CYUI7JU5.js} +18 -8
- package/dist/{chunk-3FYPXHPL.js → chunk-DIMX5F3T.js} +1 -1
- package/dist/{chunk-4JXCSGSA.js → chunk-M4FLLXXD.js} +1 -1
- package/dist/chunk-OQSYYOLM.js +12787 -0
- package/dist/{chunk-55XEZFGD.js → chunk-OR6NQJ5E.js} +2 -2
- package/dist/{chunk-VLIO6RQR.js → chunk-RY6AL5C7.js} +4 -4
- package/dist/chunk-SJHUF3DP.js +43 -0
- package/dist/{chunk-ICKIDP7G.js → chunk-UOTZ3EEQ.js} +1 -1
- package/dist/{chunk-VSNA5KAB.js → chunk-UZVHXZ7V.js} +1276 -1481
- package/dist/{chunk-XC33FJZN.js → chunk-V4VYUY4A.js} +25 -4
- package/dist/{chunk-ZJQPA67D.js → chunk-WS2EG3GW.js} +224 -224
- package/dist/chunk-ZDA2HYX5.js +275 -0
- package/dist/cli/chat.js +205 -0
- package/dist/cli/check.js +9 -10
- package/dist/cli/run.js +10 -2
- package/dist/cli/snapshot-warmup.js +7 -7
- package/dist/cli/upgrade.js +8 -8
- package/dist/deployment.d.ts +4 -0
- package/dist/handlers/agent-dispatch.d.ts +6 -1
- package/dist/handlers/mcp-oauth-callback.d.ts +6 -1
- package/dist/handlers/oauth-callback.d.ts +6 -1
- package/dist/handlers/sandbox-egress-proxy.d.ts +2 -0
- package/dist/handlers/webhooks.d.ts +4 -2
- package/dist/instrumentation.js +17 -2
- package/dist/nitro.js +9 -10
- package/dist/reporting.js +19 -17
- package/dist/runner-LMAM4OGD.js +259 -0
- package/package.json +3 -3
- package/dist/chunk-6YY4Q3D4.js +0 -12
- package/dist/chunk-Z3YD6NHK.js +0 -12
|
@@ -3,9 +3,8 @@ import type { ChannelConfigurationService } from "@/chat/configuration/types";
|
|
|
3
3
|
import type { UserTokenStore } from "@/chat/credentials/user-token-store";
|
|
4
4
|
import { AuthorizationPauseError, type AuthorizationFlowMode } from "@/chat/services/auth-pause";
|
|
5
5
|
import type { ConversationPendingAuthState } from "@/chat/state/conversation";
|
|
6
|
-
import type { Skill } from "@/chat/skills";
|
|
7
6
|
export declare class PluginAuthorizationPauseError extends AuthorizationPauseError {
|
|
8
|
-
constructor(provider: string, disposition: "link_already_sent" | "link_sent");
|
|
7
|
+
constructor(provider: string, providerDisplayName: string, disposition: "link_already_sent" | "link_sent");
|
|
9
8
|
}
|
|
10
9
|
export declare class PluginCredentialFailureError extends Error {
|
|
11
10
|
readonly provider: string;
|
|
@@ -26,14 +25,16 @@ export interface PluginAuthOrchestrationDeps {
|
|
|
26
25
|
userTokenStore?: UserTokenStore;
|
|
27
26
|
}
|
|
28
27
|
export interface PluginAuthOrchestration {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Inspect a sandbox tool result for an `auth_required` signal from the
|
|
30
|
+
* egress proxy. If one is present and an OAuth flow is available, parks the
|
|
31
|
+
* current turn and sends the user an authorization link. No-ops when the
|
|
32
|
+
* result carries no auth signal.
|
|
33
|
+
*/
|
|
34
|
+
maybeHandleAuthSignal: (details: unknown) => Promise<void>;
|
|
34
35
|
getPendingPause: () => PluginAuthorizationPauseError | undefined;
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
37
|
-
* Start plugin OAuth from
|
|
38
|
+
* Start plugin OAuth from a sandbox egress auth signal and park the turn.
|
|
38
39
|
*/
|
|
39
40
|
export declare function createPluginAuthOrchestration(deps: PluginAuthOrchestrationDeps, abortAgent: () => void): PluginAuthOrchestration;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FileUpload } from "chat";
|
|
2
2
|
import type { LogContext } from "@/chat/logging";
|
|
3
|
+
import type { PiMessage } from "@/chat/pi/messages";
|
|
3
4
|
import type { TurnThinkingSelection } from "@/chat/services/turn-thinking-level";
|
|
4
5
|
import type { AgentTurnUsage } from "@/chat/usage";
|
|
5
6
|
import { type ReplyDeliveryPlan } from "@/chat/services/reply-delivery-plan";
|
|
@@ -27,6 +28,7 @@ export interface AssistantReply {
|
|
|
27
28
|
deliveryMode?: "thread" | "channel_only";
|
|
28
29
|
sandboxId?: string;
|
|
29
30
|
sandboxDependencyProfileHash?: string;
|
|
31
|
+
piMessages?: PiMessage[];
|
|
30
32
|
diagnostics: AgentTurnDiagnostics;
|
|
31
33
|
}
|
|
32
34
|
export interface TurnResultInput {
|
|
@@ -37,6 +39,7 @@ export interface TurnResultInput {
|
|
|
37
39
|
toolCalls: string[];
|
|
38
40
|
sandboxId?: string;
|
|
39
41
|
sandboxDependencyProfileHash?: string;
|
|
42
|
+
piMessages?: PiMessage[];
|
|
40
43
|
durationMs?: number;
|
|
41
44
|
generatedFileCount: number;
|
|
42
45
|
shouldTrace: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type SlackRequester } from "@/chat/requester";
|
|
2
2
|
interface SlackUserLookupResult {
|
|
3
3
|
userName?: string;
|
|
4
4
|
fullName?: string;
|
|
@@ -7,5 +7,5 @@ interface SlackUserLookupResult {
|
|
|
7
7
|
/** Fetch Slack user profile info with in-memory TTL cache to avoid repeated API calls. */
|
|
8
8
|
export declare function lookupSlackUser(teamId: string, userId?: string): Promise<SlackUserLookupResult | null>;
|
|
9
9
|
/** Resolve the canonical Slack requester from Slack profile data. */
|
|
10
|
-
export declare function lookupSlackRequester(teamId: string, userId: string): Promise<
|
|
10
|
+
export declare function lookupSlackRequester(teamId: string, userId: string): Promise<SlackRequester>;
|
|
11
11
|
export {};
|
|
@@ -7,7 +7,7 @@ export declare const CONVERSATION_ACTIVE_INDEX_KEY = "junior:conversation:active
|
|
|
7
7
|
export declare const CONVERSATION_WORK_LEASE_TTL_MS = 90000;
|
|
8
8
|
export declare const CONVERSATION_WORK_CHECK_IN_INTERVAL_MS = 15000;
|
|
9
9
|
export declare const CONVERSATION_WORK_STALE_ENQUEUE_MS = 60000;
|
|
10
|
-
export type Source = "api" | "internal" | "plugin" | "scheduler" | "slack";
|
|
10
|
+
export type Source = "api" | "internal" | "local" | "plugin" | "scheduler" | "slack";
|
|
11
11
|
export type ExecutionStatus = "awaiting_resume" | "idle" | "pending" | "running";
|
|
12
12
|
export interface AgentInput {
|
|
13
13
|
attachments?: unknown[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SlackToolContext } from "@/chat/tools/slack/context";
|
|
2
|
+
import type { ToolState } from "@/chat/tools/types";
|
|
2
3
|
/** Create a tool that provisions a new Slack canvas in the active channel. */
|
|
3
|
-
export declare function createSlackCanvasCreateTool(context:
|
|
4
|
+
export declare function createSlackCanvasCreateTool(context: SlackToolContext, state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
4
5
|
title: import("@sinclair/typebox").TString;
|
|
5
6
|
markdown: import("@sinclair/typebox").TString;
|
|
6
7
|
}>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function createSlackChannelListMessagesTool(context:
|
|
1
|
+
import type { SlackToolContext } from "@/chat/tools/slack/context";
|
|
2
|
+
export declare function createSlackChannelListMessagesTool(context: SlackToolContext): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
3
3
|
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
4
4
|
cursor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
5
5
|
oldest: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { SlackToolContext } from "@/chat/tools/slack/context";
|
|
2
|
+
import type { ToolState } from "@/chat/tools/types";
|
|
3
|
+
export declare function createSlackChannelPostMessageTool(context: SlackToolContext, state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
3
4
|
text: import("@sinclair/typebox").TString;
|
|
4
5
|
}>>;
|
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
import type { ToolRuntimeContext } from "@/chat/tools/types";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import type { SlackDestination } from "@sentry/junior-plugin-api";
|
|
3
|
+
import type { SlackSource } from "@sentry/junior-plugin-api";
|
|
4
|
+
import type { SlackRequester } from "@/chat/requester";
|
|
5
|
+
export interface SlackToolContext {
|
|
6
|
+
destination?: SlackDestination;
|
|
7
|
+
source: SlackSource;
|
|
8
|
+
requester?: SlackRequester;
|
|
9
|
+
destinationChannelId?: string;
|
|
10
|
+
messageTs?: string;
|
|
11
|
+
sourceChannelId: string;
|
|
12
|
+
teamId: string;
|
|
13
|
+
threadTs?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Resolve Slack-specific tool context from the active source/destination/requester. */
|
|
16
|
+
export declare function getSlackToolContext(context: ToolRuntimeContext): SlackToolContext | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { SlackToolContext } from "@/chat/tools/slack/context";
|
|
2
|
+
import type { ToolState } from "@/chat/tools/types";
|
|
3
|
+
export declare function createSlackMessageAddReactionTool(context: SlackToolContext, state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
3
4
|
emoji: import("@sinclair/typebox").TString;
|
|
4
5
|
}>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SlackToolContext } from "@/chat/tools/slack/context";
|
|
2
2
|
/** Create a tool that reads a Slack thread from a shared message URL or explicit coordinates. */
|
|
3
|
-
export declare function createSlackThreadReadTool(context:
|
|
3
|
+
export declare function createSlackThreadReadTool(context: SlackToolContext): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
4
4
|
url: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
5
5
|
channel_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
6
6
|
ts: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { FileUpload } from "chat";
|
|
2
|
-
import type { Destination } from "@sentry/junior-plugin-api";
|
|
2
|
+
import type { Destination, LocalDestination, LocalSource, SlackDestination, SlackSource, Source } from "@sentry/junior-plugin-api";
|
|
3
3
|
import type { McpToolManager } from "@/chat/mcp/tool-manager";
|
|
4
4
|
import type { SandboxWorkspace } from "@/chat/sandbox/workspace";
|
|
5
5
|
import type { ThreadArtifactsState } from "@/chat/state/artifacts";
|
|
6
6
|
import type { Skill } from "@/chat/skills";
|
|
7
7
|
import type { LoadSkillMetadata } from "@/chat/tools/skill/load-skill";
|
|
8
8
|
import type { AdvisorToolRuntimeContext } from "@/chat/tools/advisor/tool";
|
|
9
|
-
import type { Requester } from "@/chat/requester";
|
|
9
|
+
import type { LocalRequester, Requester, SlackRequester } from "@/chat/requester";
|
|
10
10
|
export interface ImageGenerateToolDeps {
|
|
11
11
|
fetch?: typeof fetch;
|
|
12
12
|
}
|
|
@@ -34,20 +34,8 @@ export interface ToolHooks {
|
|
|
34
34
|
webSearch?: WebSearchToolDeps;
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
interface BaseToolRuntimeContext {
|
|
38
38
|
advisor?: AdvisorToolRuntimeContext;
|
|
39
|
-
/**
|
|
40
|
-
* Raw Slack channel/conversation container for this turn: `C...`, `D...`,
|
|
41
|
-
* or `G...`. Never overridden by assistant context. Stable binding key for
|
|
42
|
-
* state scoped to a Slack conversation. Passed to plugin hooks as-is via
|
|
43
|
-
* `ToolRegistrationHookContext.channelId`.
|
|
44
|
-
*/
|
|
45
|
-
channelId?: string;
|
|
46
|
-
/**
|
|
47
|
-
* Slack channel used by first-class delivery tools when assistant context
|
|
48
|
-
* points at a source channel different from the raw conversation channel.
|
|
49
|
-
*/
|
|
50
|
-
deliveryChannelId?: string;
|
|
51
39
|
/**
|
|
52
40
|
* Opaque Junior conversation/session identity for this turn.
|
|
53
41
|
* Interactive Slack turns use `slack:{channelId}:{threadTs}`.
|
|
@@ -55,18 +43,29 @@ export interface ToolRuntimeContext {
|
|
|
55
43
|
* Do not parse as Slack unless the value starts with `slack:`.
|
|
56
44
|
*/
|
|
57
45
|
conversationId?: string;
|
|
58
|
-
/** Runtime-owned destination
|
|
46
|
+
/** Runtime-owned default outbound destination, if this invocation has one. */
|
|
59
47
|
destination?: Destination;
|
|
60
48
|
requester?: Requester;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
threadTs?: string;
|
|
49
|
+
/** Runtime-owned source where this invocation came from. */
|
|
50
|
+
source: Source;
|
|
64
51
|
userText?: string;
|
|
65
52
|
artifactState?: ThreadArtifactsState;
|
|
66
53
|
configuration?: Record<string, unknown>;
|
|
67
54
|
mcpToolManager?: McpToolManager;
|
|
68
55
|
sandbox: SandboxWorkspace;
|
|
69
56
|
}
|
|
57
|
+
interface SlackToolRuntimeContext extends BaseToolRuntimeContext {
|
|
58
|
+
destination?: SlackDestination;
|
|
59
|
+
requester?: SlackRequester;
|
|
60
|
+
source: SlackSource;
|
|
61
|
+
}
|
|
62
|
+
interface LocalToolRuntimeContext extends BaseToolRuntimeContext {
|
|
63
|
+
destination?: LocalDestination;
|
|
64
|
+
requester?: LocalRequester;
|
|
65
|
+
source: LocalSource;
|
|
66
|
+
slack?: never;
|
|
67
|
+
}
|
|
68
|
+
export type ToolRuntimeContext = LocalToolRuntimeContext | SlackToolRuntimeContext;
|
|
70
69
|
export interface ToolState {
|
|
71
70
|
artifactState: ThreadArtifactsState;
|
|
72
71
|
patchArtifactState: (patch: Partial<ThreadArtifactsState>) => void | Promise<void>;
|
|
@@ -74,3 +73,4 @@ export interface ToolState {
|
|
|
74
73
|
getOperationResult: <T>(operationKey: string) => T | undefined;
|
|
75
74
|
setOperationResult: (operationKey: string, result: unknown) => void;
|
|
76
75
|
}
|
|
76
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
getDeploymentTelemetryAttributes,
|
|
2
3
|
sentry_exports
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SJHUF3DP.js";
|
|
4
5
|
|
|
5
6
|
// src/chat/logging.ts
|
|
6
7
|
import { AsyncLocalStorage } from "async_hooks";
|
|
@@ -76,6 +77,7 @@ function normalizeGenAiFinishReasons(value) {
|
|
|
76
77
|
}
|
|
77
78
|
var contextStorage = new AsyncLocalStorage();
|
|
78
79
|
var logRecordSinks = /* @__PURE__ */ new Set();
|
|
80
|
+
var deploymentLogAttributes = getDeploymentTelemetryAttributes();
|
|
79
81
|
var LOGTAPE_BODY_KEY = "__logtape_body";
|
|
80
82
|
var ROOT_LOGGER_CATEGORY = ["junior"];
|
|
81
83
|
var CONSOLE_PRIORITY_KEYS = [
|
|
@@ -820,11 +822,17 @@ function emitRecord(category, level, eventName, attrs = {}, body) {
|
|
|
820
822
|
const message = body ? redactSecrets(body) : normalizedEventName;
|
|
821
823
|
const source = getLogSource([...ROOT_LOGGER_CATEGORY, ...category]);
|
|
822
824
|
const contextAttributes = ownsLogTapeBackend ? void 0 : contextStorage.getStore();
|
|
823
|
-
const attributes = mergeAttributes(
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
825
|
+
const attributes = mergeAttributes(
|
|
826
|
+
contextAttributes,
|
|
827
|
+
traceAttributes,
|
|
828
|
+
{
|
|
829
|
+
"event.name": normalizedEventName,
|
|
830
|
+
...source ? { "app.log.source": source } : {},
|
|
831
|
+
...attrs
|
|
832
|
+
},
|
|
833
|
+
// Deployment identity is process-owned and must win over event-local attrs.
|
|
834
|
+
deploymentLogAttributes
|
|
835
|
+
);
|
|
828
836
|
if (usesDirectEmissionFallback) {
|
|
829
837
|
emitDirect(level, normalizedEventName, message, attributes);
|
|
830
838
|
return;
|
|
@@ -1138,6 +1146,21 @@ async function withSpan(name, op, context, callback, attributes = {}) {
|
|
|
1138
1146
|
);
|
|
1139
1147
|
});
|
|
1140
1148
|
}
|
|
1149
|
+
function getTracePropagationHeaders() {
|
|
1150
|
+
const sentry = sentry_exports;
|
|
1151
|
+
const traceData = sentry.getTraceData?.({ propagateTraceparent: true });
|
|
1152
|
+
if (!traceData) {
|
|
1153
|
+
return {};
|
|
1154
|
+
}
|
|
1155
|
+
const headers = {};
|
|
1156
|
+
for (const key of ["sentry-trace", "baggage", "traceparent"]) {
|
|
1157
|
+
const value = traceData[key];
|
|
1158
|
+
if (typeof value === "string" && value.trim()) {
|
|
1159
|
+
headers[key] = value;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
return headers;
|
|
1163
|
+
}
|
|
1141
1164
|
function setSpanAttributes(attributes) {
|
|
1142
1165
|
const sentry = sentry_exports;
|
|
1143
1166
|
const span = sentry.getActiveSpan?.();
|
|
@@ -1341,6 +1364,7 @@ export {
|
|
|
1341
1364
|
createRequestContext,
|
|
1342
1365
|
withContext,
|
|
1343
1366
|
withSpan,
|
|
1367
|
+
getTracePropagationHeaders,
|
|
1344
1368
|
setSpanAttributes,
|
|
1345
1369
|
setSpanStatus,
|
|
1346
1370
|
getActiveTraceId,
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
} from "./chunk-KVZL5NZS.js";
|
|
6
6
|
import {
|
|
7
7
|
parseActorUserId
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CYUI7JU5.js";
|
|
9
9
|
import {
|
|
10
10
|
logInfo,
|
|
11
11
|
logWarn,
|
|
12
12
|
setSpanAttributes
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3BYAPS6B.js";
|
|
14
14
|
|
|
15
15
|
// src/chat/plugins/manifest.ts
|
|
16
16
|
import { z } from "zod";
|
|
@@ -101,6 +101,7 @@ function inlineTargetSource(name, target) {
|
|
|
101
101
|
function inlineManifestSource(manifest) {
|
|
102
102
|
const result = {};
|
|
103
103
|
setDefined(result, "name", manifest.name);
|
|
104
|
+
setDefined(result, "display-name", manifest.displayName);
|
|
104
105
|
setDefined(result, "description", manifest.description);
|
|
105
106
|
setDefined(
|
|
106
107
|
result,
|
|
@@ -316,6 +317,7 @@ var manifestSourceSchema = z.object({
|
|
|
316
317
|
name: z.string().refine((value) => PLUGIN_NAME_RE.test(value), {
|
|
317
318
|
error: "invalid"
|
|
318
319
|
}),
|
|
320
|
+
"display-name": nonEmptyTrimmedString,
|
|
319
321
|
description: nonEmptyTrimmedString,
|
|
320
322
|
capabilities: z.array(z.string(), {
|
|
321
323
|
error: "must be an array when provided"
|
|
@@ -355,6 +357,7 @@ function setDefined2(target, key, value) {
|
|
|
355
357
|
}
|
|
356
358
|
function manifestConfigPatch(config) {
|
|
357
359
|
const result = {};
|
|
360
|
+
setDefined2(result, "display-name", config.displayName);
|
|
358
361
|
setDefined2(result, "description", config.description);
|
|
359
362
|
setDefined2(result, "capabilities", config.capabilities);
|
|
360
363
|
setDefined2(result, "config-keys", config.configKeys);
|
|
@@ -952,6 +955,7 @@ function parseManifestSource(parsedSource, dir, config, options) {
|
|
|
952
955
|
const mcp = data.mcp ? normalizeMcp(data.mcp, envVars, data.name) : void 0;
|
|
953
956
|
const manifest = {
|
|
954
957
|
name: data.name,
|
|
958
|
+
displayName: data["display-name"],
|
|
955
959
|
description: data.description,
|
|
956
960
|
capabilities,
|
|
957
961
|
configKeys,
|
|
@@ -1887,6 +1891,9 @@ function getPluginForSkillPath(skillPath) {
|
|
|
1887
1891
|
function getPluginDefinition(provider) {
|
|
1888
1892
|
return ensurePluginsLoaded().pluginsByName.get(provider);
|
|
1889
1893
|
}
|
|
1894
|
+
function getPluginDisplayName(provider) {
|
|
1895
|
+
return ensurePluginsLoaded().pluginsByName.get(provider)?.manifest.displayName;
|
|
1896
|
+
}
|
|
1890
1897
|
function isPluginProvider(provider) {
|
|
1891
1898
|
return ensurePluginsLoaded().pluginsByName.has(provider);
|
|
1892
1899
|
}
|
|
@@ -1940,6 +1947,7 @@ export {
|
|
|
1940
1947
|
getPluginSkillRoots,
|
|
1941
1948
|
getPluginForSkillPath,
|
|
1942
1949
|
getPluginDefinition,
|
|
1950
|
+
getPluginDisplayName,
|
|
1943
1951
|
isPluginProvider,
|
|
1944
1952
|
isPluginConfigKey,
|
|
1945
1953
|
createPluginBroker
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseDestination,
|
|
3
3
|
sameDestination
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-V4VYUY4A.js";
|
|
5
5
|
import {
|
|
6
6
|
getDefaultRedisStateAdapterFor,
|
|
7
7
|
getStateAdapter
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-DIMX5F3T.js";
|
|
9
9
|
import {
|
|
10
10
|
getChatConfig
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WS2EG3GW.js";
|
|
12
12
|
import {
|
|
13
13
|
parseStoredSlackRequester
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CYUI7JU5.js";
|
|
15
15
|
import {
|
|
16
16
|
isRecord,
|
|
17
17
|
toOptionalNumber,
|
|
18
18
|
toOptionalString
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-3BYAPS6B.js";
|
|
20
20
|
|
|
21
21
|
// src/chat/state/ttl.ts
|
|
22
22
|
var JUNIOR_THREAD_STATE_TTL_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
@@ -75,7 +75,7 @@ function uniqueStrings(values) {
|
|
|
75
75
|
return [...new Set(values)];
|
|
76
76
|
}
|
|
77
77
|
function normalizeSource(value) {
|
|
78
|
-
if (value === "api" || value === "internal" || value === "plugin" || value === "scheduler" || value === "slack") {
|
|
78
|
+
if (value === "api" || value === "internal" || value === "local" || value === "plugin" || value === "scheduler" || value === "slack") {
|
|
79
79
|
return value;
|
|
80
80
|
}
|
|
81
81
|
return void 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isSlackTeamId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3BYAPS6B.js";
|
|
4
4
|
|
|
5
5
|
// src/chat/requester.ts
|
|
6
6
|
import { z } from "zod";
|
|
@@ -58,6 +58,10 @@ function isActorUserId(value) {
|
|
|
58
58
|
return parseActorUserId(value) === value;
|
|
59
59
|
}
|
|
60
60
|
function createRequester(input, context) {
|
|
61
|
+
const platform = context.platform ?? input?.platform;
|
|
62
|
+
if (!platform) {
|
|
63
|
+
return void 0;
|
|
64
|
+
}
|
|
61
65
|
const contextUserId = parseActorUserId(context.userId);
|
|
62
66
|
if (context.userId !== void 0 && !contextUserId) {
|
|
63
67
|
return void 0;
|
|
@@ -66,6 +70,10 @@ function createRequester(input, context) {
|
|
|
66
70
|
if (input?.userId !== void 0 && !inputUserId) {
|
|
67
71
|
return void 0;
|
|
68
72
|
}
|
|
73
|
+
const requesterUserId = contextUserId ?? inputUserId;
|
|
74
|
+
if (!requesterUserId) {
|
|
75
|
+
return void 0;
|
|
76
|
+
}
|
|
69
77
|
const contextTeamId = parseSlackTeamId(context.teamId);
|
|
70
78
|
if (context.teamId !== void 0 && !contextTeamId) {
|
|
71
79
|
return void 0;
|
|
@@ -74,24 +82,26 @@ function createRequester(input, context) {
|
|
|
74
82
|
if (input?.teamId !== void 0 && !inputTeamId) {
|
|
75
83
|
return void 0;
|
|
76
84
|
}
|
|
77
|
-
const requesterUserId = contextUserId ?? inputUserId;
|
|
78
85
|
const requesterTeamId = contextTeamId ?? inputTeamId;
|
|
79
|
-
if (
|
|
86
|
+
if (platform === "slack" && !requesterTeamId) {
|
|
80
87
|
return void 0;
|
|
81
88
|
}
|
|
82
|
-
const canUseInputProfile = (!contextUserId || !inputUserId || contextUserId === inputUserId) && (!contextTeamId || !inputTeamId || contextTeamId === inputTeamId);
|
|
83
|
-
|
|
89
|
+
const canUseInputProfile = (!contextUserId || !inputUserId || contextUserId === inputUserId) && (platform !== "slack" || !contextTeamId || !inputTeamId || contextTeamId === inputTeamId);
|
|
90
|
+
const requester = {
|
|
84
91
|
...canUseInputProfile && cleanRequesterEmail(input?.email) ? { email: cleanRequesterEmail(input?.email) } : {},
|
|
85
92
|
...canUseInputProfile && cleanRequesterDisplayName(input?.fullName, requesterUserId) ? {
|
|
86
93
|
fullName: cleanRequesterDisplayName(input?.fullName, requesterUserId)
|
|
87
94
|
} : {},
|
|
88
|
-
platform
|
|
89
|
-
teamId: requesterTeamId,
|
|
95
|
+
platform,
|
|
90
96
|
userId: requesterUserId,
|
|
91
97
|
...canUseInputProfile && cleanRequesterDisplayName(input?.userName, requesterUserId) ? {
|
|
92
98
|
userName: cleanRequesterDisplayName(input?.userName, requesterUserId)
|
|
93
99
|
} : {}
|
|
94
100
|
};
|
|
101
|
+
if (platform === "slack") {
|
|
102
|
+
return { ...requester, platform, teamId: requesterTeamId };
|
|
103
|
+
}
|
|
104
|
+
return { ...requester, platform };
|
|
95
105
|
}
|
|
96
106
|
function createSlackRequester(teamId, userId, profile) {
|
|
97
107
|
const actorUserId = parseActorUserId(userId);
|
|
@@ -110,7 +120,7 @@ function createSlackRequester(teamId, userId, profile) {
|
|
|
110
120
|
},
|
|
111
121
|
{ teamId: actorTeamId, userId: actorUserId }
|
|
112
122
|
);
|
|
113
|
-
if (!requester) {
|
|
123
|
+
if (!requester || requester.platform !== "slack") {
|
|
114
124
|
throw new Error("Slack requester requires team and user ids");
|
|
115
125
|
}
|
|
116
126
|
return requester;
|