@sentry/junior 0.136.0 → 0.137.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/dist/{agent-hooks-TQSI2FKN.js → agent-hooks-MZOKEP3J.js} +9 -9
- package/dist/api/conversations/projection.d.ts +1 -0
- package/dist/api/conversations/stats.d.ts +1 -0
- package/dist/api/schema/conversation.d.ts +2 -0
- package/dist/api/schema.js +1 -1
- package/dist/api.js +185 -47
- package/dist/app.d.ts +1 -1
- package/dist/app.js +293 -193
- package/dist/{catalog-runtime-VXL5EO2X.js → catalog-runtime-MD66YLFV.js} +5 -5
- package/dist/chat/configuration/defaults.d.ts +1 -1
- package/dist/chat/conversations/store.d.ts +2 -1
- package/dist/chat/pi/client.d.ts +1 -8
- package/dist/chat/pi/gateway-auth.d.ts +16 -0
- package/dist/chat/sandbox/docker.d.ts +17 -0
- package/dist/chat/services/agent-continue.d.ts +2 -0
- package/dist/chat/services/subscribed-reply-router-policy.d.ts +12 -0
- package/dist/chat/services/turn-session-routing.d.ts +17 -0
- package/dist/chat/slack/message.d.ts +6 -1
- package/dist/chat/slack/source-link.d.ts +8 -2
- package/dist/chat/slack/team-domain.d.ts +4 -0
- package/dist/chat/source.d.ts +5 -5
- package/dist/{chunk-IUSO5QUB.js → chunk-36EG34YI.js} +1 -1
- package/dist/{chunk-QCX3TRIM.js → chunk-3Q342EJJ.js} +2 -2
- package/dist/{chunk-5I3MXBNV.js → chunk-5G34IEK2.js} +1 -1
- package/dist/{chunk-ZIYDJIWQ.js → chunk-5PNJMOY5.js} +1 -1
- package/dist/{chunk-6ABWAONM.js → chunk-6QW2RRQT.js} +5 -5
- package/dist/{chunk-4VDQGQHY.js → chunk-BZAMASJP.js} +1 -1
- package/dist/{chunk-XRC4TXJ4.js → chunk-DQXAAVTR.js} +43 -20
- package/dist/{chunk-HEGTNY2S.js → chunk-EWDSB24B.js} +7 -7
- package/dist/{chunk-TRZSM67C.js → chunk-HCIVH3JS.js} +1 -0
- package/dist/{chunk-CGZ6O74P.js → chunk-K2NCQJKH.js} +3 -3
- package/dist/{chunk-3NLQQ7DC.js → chunk-KJ4HGRHN.js} +24 -26
- package/dist/{chunk-3TOCJOYJ.js → chunk-POBSY47Q.js} +6 -4
- package/dist/{chunk-BTBTQEXF.js → chunk-RB4NJKEX.js} +1 -1
- package/dist/{chunk-UIAZI7UJ.js → chunk-SYCX4DOK.js} +34 -17
- package/dist/{chunk-BECYUPSQ.js → chunk-T6Z5S6PQ.js} +1 -1
- package/dist/{chunk-QE4DN7JQ.js → chunk-UG6ZYPBI.js} +42 -19
- package/dist/{chunk-CTKCGKWB.js → chunk-UOXATPSI.js} +203 -77
- package/dist/{chunk-2E5D3Z3U.js → chunk-UZQ4VY3M.js} +1 -1
- package/dist/{chunk-76Y5A57F.js → chunk-WPPXIAFB.js} +5 -5
- package/dist/{chunk-DO37VD6O.js → chunk-XZ7NPXAB.js} +2 -1
- package/dist/{chunk-KRUSDASP.js → chunk-YNFERGKP.js} +1 -1
- package/dist/{chunk-3UUDZPO5.js → chunk-YRPC6MJY.js} +1 -1
- package/dist/{chunk-4ULSYOL6.js → chunk-ZFS67WIR.js} +4 -7
- package/dist/cli/chat.js +24 -24
- package/dist/cli/check.js +7 -7
- package/dist/cli/plugins.js +12 -12
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +7 -7
- package/dist/{db-NN6T27OO.js → db-66E7VDNC.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-VJQ27ITN.js → oauth-callback-server-7QPD4Q7P.js} +17 -17
- package/dist/{runner-ZHI3GQII.js → runner-L2BKJKOD.js} +11 -11
- package/dist/{skills-YT5ZSNAW.js → skills-HOQ2NSPW.js} +6 -6
- package/dist/{validation-EKUNT5IY.js → validation-ENHI7S2C.js} +6 -6
- package/dist/version.js +1 -1
- package/package.json +6 -5
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pluginCatalogRuntime
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-36EG34YI.js";
|
|
4
|
+
import "./chunk-BZAMASJP.js";
|
|
5
5
|
import "./chunk-77VDLF3Z.js";
|
|
6
6
|
import "./chunk-HZF5P5UN.js";
|
|
7
7
|
import "./chunk-F3B2YJ76.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-T6Z5S6PQ.js";
|
|
9
9
|
import "./chunk-6GWA276C.js";
|
|
10
10
|
import "./chunk-OOUNJNMR.js";
|
|
11
11
|
import "./chunk-H4HBKISO.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-5PNJMOY5.js";
|
|
13
|
+
import "./chunk-XZ7NPXAB.js";
|
|
14
14
|
import "./chunk-MLKGABMK.js";
|
|
15
15
|
export {
|
|
16
16
|
pluginCatalogRuntime
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Store install-wide
|
|
1
|
+
/** Store install-wide configuration defaults. */
|
|
2
2
|
export declare function setConfigDefaults(defaults: Record<string, unknown> | undefined): void;
|
|
3
3
|
/** Return the install-wide configuration defaults (empty object when none set). */
|
|
4
4
|
export declare function getConfigDefaults(): Record<string, unknown>;
|
|
@@ -32,7 +32,8 @@ export interface Conversation {
|
|
|
32
32
|
source?: ConversationSource;
|
|
33
33
|
/**
|
|
34
34
|
* Structured inbound Source locator for this conversation session.
|
|
35
|
-
* Session-stable (Slack
|
|
35
|
+
* Session-stable (threaded Slack keeps threadTs; channel-level turns omit
|
|
36
|
+
* it; never stores per-message ts). Set-once.
|
|
36
37
|
*/
|
|
37
38
|
sessionSource?: SessionSource;
|
|
38
39
|
title?: string;
|
package/dist/chat/pi/client.d.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { type Message, type Model, type ThinkingLevel } from "@/chat/pi/sdk";
|
|
2
|
+
export { getGatewayApiKey, MISSING_GATEWAY_CREDENTIALS_ERROR, resolveGatewayCredential, type GatewayCredential, } from "@/chat/pi/gateway-auth";
|
|
2
3
|
import type { ZodTypeAny, z } from "zod";
|
|
3
4
|
export declare const GEN_AI_PROVIDER_NAME: "vercel-ai-gateway";
|
|
4
5
|
export declare const GEN_AI_SERVER_ADDRESS = "ai-gateway.vercel.sh";
|
|
5
6
|
export declare const GEN_AI_SERVER_PORT = 443;
|
|
6
|
-
export declare const MISSING_GATEWAY_CREDENTIALS_ERROR = "Missing AI gateway credentials (AI_GATEWAY_API_KEY or VERCEL_OIDC_TOKEN)";
|
|
7
|
-
/**
|
|
8
|
-
* Resolve the documented AI Gateway env credentials for the paths that need
|
|
9
|
-
* the bearer token string directly.
|
|
10
|
-
*/
|
|
11
|
-
export declare function getGatewayApiKey(): string | undefined;
|
|
12
|
-
/** Return the Gateway credential shape expected by Pi Agent getApiKey hooks. */
|
|
13
|
-
export declare function getPiGatewayApiKey(): string | undefined;
|
|
14
7
|
/**
|
|
15
8
|
* Look up a gateway model by id. Throws `Unknown AI Gateway model id: …` if
|
|
16
9
|
* the id is not in pi-ai's registry — callers at the config boundary can use
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type GatewayCredential = {
|
|
2
|
+
mode: "oidc" | "api_key";
|
|
3
|
+
token: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const MISSING_GATEWAY_CREDENTIALS_ERROR = "Missing AI gateway credentials (enable Vercel OIDC or set AI_GATEWAY_API_KEY)";
|
|
6
|
+
/**
|
|
7
|
+
* Resolve the preferred AI Gateway bearer credential.
|
|
8
|
+
*
|
|
9
|
+
* Order:
|
|
10
|
+
* 1. Vercel OIDC via `@vercel/oidc` (request header `x-vercel-oidc-token`,
|
|
11
|
+
* then `VERCEL_OIDC_TOKEN`, with local refresh when needed)
|
|
12
|
+
* 2. Explicit `AI_GATEWAY_API_KEY` / pi-ai env mapping for vercel-ai-gateway
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveGatewayCredential(): Promise<GatewayCredential | undefined>;
|
|
15
|
+
/** Resolve the bearer token string for Authorization headers and Pi getApiKey. */
|
|
16
|
+
export declare function getGatewayApiKey(): Promise<string | undefined>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SandboxWorkspace } from "@/chat/sandbox/workspace";
|
|
2
|
+
/** Docker daemon config for Vercel sandbox guests (nested containers). */
|
|
3
|
+
export declare const DOCKER_DAEMON_JSON = "{\n \"storage-driver\": \"overlay2\",\n \"live-restore\": false\n}\n";
|
|
4
|
+
/**
|
|
5
|
+
* Start dockerd when the socket is missing and wait until `docker info` works.
|
|
6
|
+
* Re-execs through sudo so the sandbox user can call it without root.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DOCKER_ENSURE_SCRIPT = "#!/bin/sh\nset -eu\n\nif [ \"$(id -u)\" -ne 0 ]; then\n exec sudo -n \"$0\" \"$@\"\nfi\n\nSOCK=/var/run/docker.sock\nPIDFILE=/var/run/docker.pid\nLOG=/var/log/junior-dockerd.log\n\nis_ready() {\n [ -S \"$SOCK\" ] && /usr/bin/docker info >/dev/null 2>&1\n}\n\nif is_ready; then\n chmod 666 \"$SOCK\" 2>/dev/null || true\n exit 0\nfi\n\nmkdir -p /etc/docker /var/lib/docker /var/run /var/log\nif [ ! -f /etc/docker/daemon.json ]; then\n cat > /etc/docker/daemon.json <<'EOF'\n{\n \"storage-driver\": \"overlay2\",\n \"live-restore\": false\n}\nEOF\nfi\n\nif [ -f \"$PIDFILE\" ]; then\n oldpid=\"$(cat \"$PIDFILE\" 2>/dev/null || true)\"\n if [ -n \"${oldpid:-}\" ] && ! kill -0 \"$oldpid\" 2>/dev/null; then\n rm -f \"$PIDFILE\"\n fi\nfi\n\nif [ ! -f \"$PIDFILE\" ] || ! kill -0 \"$(cat \"$PIDFILE\" 2>/dev/null)\" 2>/dev/null; then\n # dockerd must outlive this helper; nohup + background is intentional.\n nohup dockerd --host=\"unix://$SOCK\" --pidfile=\"$PIDFILE\" >\"$LOG\" 2>&1 &\nfi\n\ni=0\nwhile [ \"$i\" -lt 50 ]; do\n if is_ready; then\n chmod 666 \"$SOCK\" 2>/dev/null || true\n exit 0\n fi\n i=$((i + 1))\n sleep 0.1\ndone\n\necho \"junior-ensure-docker: dockerd failed to become ready\" >&2\nif [ -f \"$LOG\" ]; then\n tail -n 50 \"$LOG\" >&2 || true\nfi\nexit 1\n";
|
|
9
|
+
/** PATH wrapper so plain `docker` starts the daemon on first use. */
|
|
10
|
+
export declare const DOCKER_CLI_WRAPPER_SCRIPT = "#!/bin/sh\nset -eu\nif command -v junior-ensure-docker >/dev/null 2>&1; then\n junior-ensure-docker\nfi\nexec /usr/bin/docker \"$@\"\n";
|
|
11
|
+
/** PATH wrapper so plain `docker-compose` starts the daemon on first use. */
|
|
12
|
+
export declare const DOCKER_COMPOSE_CLI_WRAPPER_SCRIPT = "#!/bin/sh\nset -eu\nif command -v junior-ensure-docker >/dev/null 2>&1; then\n junior-ensure-docker\nfi\nexec /usr/local/libexec/junior-docker-compose \"$@\"\n";
|
|
13
|
+
/**
|
|
14
|
+
* Best-effort dockerd start during sandbox prepare.
|
|
15
|
+
* Missing helper is a no-op so tests and base sandboxes stay green.
|
|
16
|
+
*/
|
|
17
|
+
export declare function ensureDockerDaemon(sandbox: Pick<SandboxWorkspace, "runCommand">, signal?: AbortSignal): Promise<void>;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { StateAdapter } from "chat";
|
|
8
8
|
import type { Destination } from "@sentry/junior-plugin-api";
|
|
9
|
+
import type { ConversationStore } from "@/chat/conversations/store";
|
|
9
10
|
import type { ConversationWorkQueue } from "@/chat/task-execution/queue";
|
|
10
11
|
export interface AgentContinueRequest {
|
|
11
12
|
conversationId: string;
|
|
@@ -21,6 +22,7 @@ export interface ScheduleAgentContinueOptions {
|
|
|
21
22
|
/** Build the queue request for an awaiting automatic agent continuation. */
|
|
22
23
|
export declare function getAwaitingAgentContinueRequest(args: {
|
|
23
24
|
conversationId: string;
|
|
25
|
+
conversationStore?: ConversationStore;
|
|
24
26
|
sessionId: string;
|
|
25
27
|
}): Promise<AgentContinueRequest | undefined>;
|
|
26
28
|
/** Schedule durable conversation work to continue a paused agent run. */
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passive subscribed-thread reply router policy.
|
|
3
|
+
*
|
|
4
|
+
* Modeled after Junior's Guardian action-review policy shape and the open-source
|
|
5
|
+
* Codex Guardian evidence/prompt pattern:
|
|
6
|
+
* https://github.com/openai/codex/tree/main/codex-rs/core/src/guardian
|
|
7
|
+
*
|
|
8
|
+
* Guardian judges one planned tool action from bounded transcript evidence.
|
|
9
|
+
* This router judges one inbound Slack message from bounded visible
|
|
10
|
+
* user/assistant thread evidence and decides whether Junior should reply.
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildSubscribedReplyRouterPolicy(assistantName: string): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load turn-session routing from durable conversation metadata.
|
|
3
|
+
*
|
|
4
|
+
* SQL owns destination and session source. Resume paths query those columns
|
|
5
|
+
* directly — no redis fallback and no derived rebuild of missing fields.
|
|
6
|
+
*/
|
|
7
|
+
import type { Destination, Source } from "@sentry/junior-plugin-api";
|
|
8
|
+
import type { ConversationStore } from "@/chat/conversations/store";
|
|
9
|
+
export interface TurnSessionRouting {
|
|
10
|
+
destination: Destination;
|
|
11
|
+
source: Source;
|
|
12
|
+
}
|
|
13
|
+
/** Require conversation destination and session source from SQL. */
|
|
14
|
+
export declare function resolveTurnSessionRouting(args: {
|
|
15
|
+
conversationId: string;
|
|
16
|
+
conversationStore?: ConversationStore;
|
|
17
|
+
}): Promise<TurnSessionRouting>;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Message } from "chat";
|
|
2
2
|
import { type SlackMessageTs } from "@/chat/slack/timestamp";
|
|
3
3
|
/**
|
|
4
4
|
* Preserve the native Slack message timestamp when a synthetic message ID is
|
|
5
5
|
* used for routing or deduplication.
|
|
6
6
|
*/
|
|
7
7
|
export declare function getSlackMessageTs(message: Pick<Message, "id" | "raw">): SlackMessageTs | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Return the Chat SDK's canonical formatted representation by default.
|
|
10
|
+
* Fall back to plain text only when the message has no formatted content.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getSlackMessageText(message: Pick<Message, "formatted" | "text">): string;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Parse a Slack workspace subdomain used in `https://{domain}.slack.com` URLs. */
|
|
2
|
+
export declare function parseSlackTeamDomain(value: unknown): string | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* Build a direct Slack archive URL for a thread when the workspace domain is
|
|
5
|
+
* known. Omits a link rather than falling back to `app_redirect`.
|
|
6
|
+
*/
|
|
2
7
|
export declare function buildSlackSourceUrl(args: {
|
|
3
8
|
channelId: string;
|
|
4
|
-
|
|
9
|
+
teamDomain: string;
|
|
10
|
+
threadTs: string;
|
|
5
11
|
}): string | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Resolve a workspace subdomain via `team.info`, cached by team id. */
|
|
2
|
+
export declare function resolveSlackTeamDomain(teamId: string): Promise<string | undefined>;
|
|
3
|
+
/** Resolve workspace subdomains for the distinct team ids in one API response. */
|
|
4
|
+
export declare function resolveSlackTeamDomains(teamIds: Iterable<string>): Promise<ReadonlyMap<string, string>>;
|
package/dist/chat/source.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import { type Source } from "@sentry/junior-plugin-api";
|
|
|
2
2
|
/** Source coordinates reduced to the stable locator for one conversation. */
|
|
3
3
|
export type SessionSource = Extract<Source, {
|
|
4
4
|
platform: "local";
|
|
5
|
-
}> |
|
|
5
|
+
}> | Omit<Extract<Source, {
|
|
6
6
|
platform: "slack";
|
|
7
|
-
}>, "messageTs"
|
|
8
|
-
threadTs: string;
|
|
9
|
-
});
|
|
7
|
+
}>, "messageTs">;
|
|
10
8
|
/**
|
|
11
9
|
* Normalize a turn Source into the session-stable locator persisted on a
|
|
12
|
-
* conversation. Drops per-message timestamps
|
|
10
|
+
* conversation. Drops per-message timestamps. Threaded Slack turns keep their
|
|
11
|
+
* thread anchor; channel-level turns (scheduled/event dispatch) keep the
|
|
12
|
+
* channel locator without inventing a threadTs.
|
|
13
13
|
*/
|
|
14
14
|
export declare function normalizeSessionSource(value: Source | undefined): SessionSource | undefined;
|
|
15
15
|
/** Parse a serialized Source into the stable locator stored on a conversation. */
|
|
@@ -3,19 +3,19 @@ import {
|
|
|
3
3
|
} from "./chunk-UTL3MHPC.js";
|
|
4
4
|
import {
|
|
5
5
|
parseSlackThreadId
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YRPC6MJY.js";
|
|
7
7
|
import {
|
|
8
8
|
normalizeSlackConversationId
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-WPPXIAFB.js";
|
|
10
10
|
import {
|
|
11
11
|
getDb
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZFS67WIR.js";
|
|
13
13
|
import {
|
|
14
14
|
juniorTaskExecutions
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-RB4NJKEX.js";
|
|
16
16
|
import {
|
|
17
17
|
logWarn
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-T6Z5S6PQ.js";
|
|
19
19
|
|
|
20
20
|
// src/handlers/health.ts
|
|
21
21
|
function readHealthReport() {
|
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
getTurnUserSlackMessageTs,
|
|
13
13
|
persistAuthPauseTurnState,
|
|
14
14
|
requireTurnFailureEventId,
|
|
15
|
+
resolveTurnSessionRouting,
|
|
15
16
|
scheduleSessionCompletedPluginTasks
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-SYCX4DOK.js";
|
|
17
18
|
import {
|
|
18
19
|
buildSentryConversationUrl
|
|
19
20
|
} from "./chunk-4CODA7P5.js";
|
|
@@ -40,7 +41,7 @@ import {
|
|
|
40
41
|
resolveBaseUrl,
|
|
41
42
|
resolvePluginOAuthAccount,
|
|
42
43
|
truncateStatusText
|
|
43
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-EWDSB24B.js";
|
|
44
45
|
import {
|
|
45
46
|
JUNIOR_THREAD_STATE_TTL_MS,
|
|
46
47
|
TurnSliceLimitExceededError,
|
|
@@ -72,13 +73,13 @@ import {
|
|
|
72
73
|
recordDeliveredAssistantMessage,
|
|
73
74
|
turnHasReply,
|
|
74
75
|
updateConversationStats
|
|
75
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-POBSY47Q.js";
|
|
76
77
|
import {
|
|
77
78
|
parseSlackThreadId,
|
|
78
79
|
readSlackRawMessageContext,
|
|
79
80
|
resolveSlackChannelIdFromMessage,
|
|
80
81
|
resolveSlackChannelIdFromThreadId
|
|
81
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-YRPC6MJY.js";
|
|
82
83
|
import {
|
|
83
84
|
SlackActionError,
|
|
84
85
|
getDashboardConversationLink,
|
|
@@ -87,19 +88,19 @@ import {
|
|
|
87
88
|
getSlackClient,
|
|
88
89
|
isDmChannel,
|
|
89
90
|
normalizeSlackConversationId
|
|
90
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-WPPXIAFB.js";
|
|
91
92
|
import {
|
|
92
93
|
getConversationEventStore,
|
|
93
94
|
getConversationStore,
|
|
94
95
|
parseDestination,
|
|
95
96
|
requireSlackDestination,
|
|
96
97
|
sameDestination
|
|
97
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-ZFS67WIR.js";
|
|
98
99
|
import {
|
|
99
100
|
acquireActiveLock,
|
|
100
101
|
getDefaultRedisStateAdapterFor,
|
|
101
102
|
getStateAdapter
|
|
102
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-5G34IEK2.js";
|
|
103
104
|
import {
|
|
104
105
|
FUNCTION_TIMEOUT_BUFFER_SECONDS,
|
|
105
106
|
botConfig,
|
|
@@ -108,18 +109,18 @@ import {
|
|
|
108
109
|
getRuntimeMetadata,
|
|
109
110
|
normalizeSlackEmojiName,
|
|
110
111
|
standardModelId
|
|
111
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-UG6ZYPBI.js";
|
|
112
113
|
import {
|
|
113
114
|
discoverSkills
|
|
114
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-3Q342EJJ.js";
|
|
115
116
|
import {
|
|
116
117
|
pluginCatalogRuntime
|
|
117
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-36EG34YI.js";
|
|
118
119
|
import {
|
|
119
120
|
buildOAuthTokenRequest,
|
|
120
121
|
hasRequiredOAuthScope,
|
|
121
122
|
parseOAuthTokenResponse
|
|
122
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-BZAMASJP.js";
|
|
123
124
|
import {
|
|
124
125
|
createSlackResumeActor,
|
|
125
126
|
isUserActor,
|
|
@@ -138,7 +139,7 @@ import {
|
|
|
138
139
|
toOptionalNumber,
|
|
139
140
|
toOptionalString,
|
|
140
141
|
withLogContext
|
|
141
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-T6Z5S6PQ.js";
|
|
142
143
|
import {
|
|
143
144
|
homeDir
|
|
144
145
|
} from "./chunk-H4HBKISO.js";
|
|
@@ -3152,12 +3153,24 @@ async function getAwaitingAgentContinueRequest(args) {
|
|
|
3152
3153
|
if (!sessionRecord || sessionRecord.state !== "awaiting_resume" || sessionRecord.resumeReason !== "timeout" && sessionRecord.resumeReason !== "yield" && sessionRecord.resumeReason !== "retry" || sessionRecord.resumeReason === "timeout" && sessionRecord.sliceId < 2) {
|
|
3153
3154
|
return void 0;
|
|
3154
3155
|
}
|
|
3155
|
-
|
|
3156
|
+
let routing;
|
|
3157
|
+
try {
|
|
3158
|
+
routing = await resolveTurnSessionRouting({
|
|
3159
|
+
conversationId: args.conversationId,
|
|
3160
|
+
conversationStore: args.conversationStore
|
|
3161
|
+
});
|
|
3162
|
+
} catch (error) {
|
|
3163
|
+
await failAgentTurnSessionRecord({
|
|
3164
|
+
conversationId: args.conversationId,
|
|
3165
|
+
expectedVersion: sessionRecord.version,
|
|
3166
|
+
sessionId: args.sessionId,
|
|
3167
|
+
errorMessage: error instanceof Error ? error.message : String(error)
|
|
3168
|
+
});
|
|
3156
3169
|
return void 0;
|
|
3157
3170
|
}
|
|
3158
3171
|
return {
|
|
3159
3172
|
conversationId: args.conversationId,
|
|
3160
|
-
destination:
|
|
3173
|
+
destination: routing.destination,
|
|
3161
3174
|
sessionId: args.sessionId,
|
|
3162
3175
|
expectedVersion: sessionRecord.version
|
|
3163
3176
|
};
|
|
@@ -3444,12 +3457,17 @@ async function resumeAuthorizedMcpTurn(args) {
|
|
|
3444
3457
|
});
|
|
3445
3458
|
return false;
|
|
3446
3459
|
}
|
|
3447
|
-
|
|
3460
|
+
let routing;
|
|
3461
|
+
try {
|
|
3462
|
+
routing = await resolveTurnSessionRouting({
|
|
3463
|
+
conversationId: authSession.conversationId
|
|
3464
|
+
});
|
|
3465
|
+
} catch (error) {
|
|
3448
3466
|
await failAgentTurnSessionRecord({
|
|
3449
3467
|
conversationId: authSession.conversationId,
|
|
3450
3468
|
expectedVersion: lockedSessionRecord.version,
|
|
3451
3469
|
sessionId: lockedSessionId,
|
|
3452
|
-
errorMessage:
|
|
3470
|
+
errorMessage: error instanceof Error ? error.message : String(error)
|
|
3453
3471
|
});
|
|
3454
3472
|
return false;
|
|
3455
3473
|
}
|
|
@@ -3483,7 +3501,7 @@ async function resumeAuthorizedMcpTurn(args) {
|
|
|
3483
3501
|
},
|
|
3484
3502
|
actor,
|
|
3485
3503
|
destination,
|
|
3486
|
-
source:
|
|
3504
|
+
source: routing.source,
|
|
3487
3505
|
toolChannelId: authSession.toolChannelId ?? lockedArtifacts.assistantContextChannelId ?? authSession.channelId
|
|
3488
3506
|
},
|
|
3489
3507
|
policy: {
|
|
@@ -4073,12 +4091,17 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
|
|
|
4073
4091
|
});
|
|
4074
4092
|
return false;
|
|
4075
4093
|
}
|
|
4076
|
-
|
|
4094
|
+
let routing;
|
|
4095
|
+
try {
|
|
4096
|
+
routing = await resolveTurnSessionRouting({
|
|
4097
|
+
conversationId: stored.resumeConversationId
|
|
4098
|
+
});
|
|
4099
|
+
} catch (error) {
|
|
4077
4100
|
await failAgentTurnSessionRecord({
|
|
4078
4101
|
conversationId: stored.resumeConversationId,
|
|
4079
4102
|
expectedVersion: lockedSessionRecord.version,
|
|
4080
4103
|
sessionId: lockedSessionId,
|
|
4081
|
-
errorMessage:
|
|
4104
|
+
errorMessage: error instanceof Error ? error.message : String(error)
|
|
4082
4105
|
});
|
|
4083
4106
|
return false;
|
|
4084
4107
|
}
|
|
@@ -4117,7 +4140,7 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
|
|
|
4117
4140
|
},
|
|
4118
4141
|
actor,
|
|
4119
4142
|
destination,
|
|
4120
|
-
source:
|
|
4143
|
+
source: routing.source,
|
|
4121
4144
|
toolChannelId: lockedArtifacts.assistantContextChannelId ?? stored.channelId
|
|
4122
4145
|
},
|
|
4123
4146
|
policy: {
|
|
@@ -6,25 +6,25 @@ import {
|
|
|
6
6
|
isDmChannel,
|
|
7
7
|
normalizeSlackConversationId,
|
|
8
8
|
withSlackRetries
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-WPPXIAFB.js";
|
|
10
10
|
import {
|
|
11
11
|
getDb,
|
|
12
12
|
parseDestination
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ZFS67WIR.js";
|
|
14
14
|
import {
|
|
15
15
|
acquireActiveLock,
|
|
16
16
|
getStateAdapter,
|
|
17
17
|
sleep
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-5G34IEK2.js";
|
|
19
19
|
import {
|
|
20
20
|
normalizeSlackEmojiName
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-UG6ZYPBI.js";
|
|
22
22
|
import {
|
|
23
23
|
pluginCatalogRuntime
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-36EG34YI.js";
|
|
25
25
|
import {
|
|
26
26
|
fetchWithBoundedOAuthErrorBodies
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-BZAMASJP.js";
|
|
28
28
|
import {
|
|
29
29
|
parseSlackMessageTs,
|
|
30
30
|
parseSlackUserId
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
isRecord,
|
|
34
34
|
logInfo,
|
|
35
35
|
logWarn
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-T6Z5S6PQ.js";
|
|
37
37
|
|
|
38
38
|
// src/chat/capabilities/router.ts
|
|
39
39
|
var ProviderCredentialRouter = class {
|
|
@@ -433,6 +433,7 @@ var conversationStatsItemSchema = z2.object({
|
|
|
433
433
|
tokens: z2.number().optional()
|
|
434
434
|
}).strict();
|
|
435
435
|
var conversationMetricDaySchema = z2.object({
|
|
436
|
+
conversations: z2.number(),
|
|
436
437
|
costUsd: z2.number().optional(),
|
|
437
438
|
date: z2.string(),
|
|
438
439
|
durationMs: z2.number(),
|
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
canRouteResourceEvents,
|
|
6
6
|
getPlugins
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WPPXIAFB.js";
|
|
8
8
|
import {
|
|
9
9
|
getDb
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ZFS67WIR.js";
|
|
11
11
|
import {
|
|
12
12
|
juniorEventTasks,
|
|
13
13
|
juniorSchedulerRuns,
|
|
14
14
|
juniorSchedulerTasks,
|
|
15
15
|
juniorStats
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-RB4NJKEX.js";
|
|
17
17
|
import {
|
|
18
18
|
juniorDestinations
|
|
19
19
|
} from "./chunk-VFUK3X5B.js";
|