@sentry/junior 0.111.0 → 0.113.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-QQ2IWKOP.js → agent-hooks-BKEMWR3Z.js} +8 -8
- package/dist/api/conversations/cursor.d.ts +17 -0
- package/dist/api/conversations/detail.d.ts +16 -18
- package/dist/api/conversations/event-list.d.ts +91 -0
- package/dist/api/conversations/event-page.d.ts +18 -0
- package/dist/api/conversations/events.d.ts +5 -1
- package/dist/api/conversations/projection.d.ts +6 -1
- package/dist/api/people/profile.d.ts +1 -0
- package/dist/api/schema/conversation.d.ts +132 -51
- package/dist/api/schema/person.d.ts +2 -0
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +7 -1
- package/dist/api.js +445 -138
- package/dist/app.js +50 -27
- package/dist/{catalog-runtime-D22W6QEJ.js → catalog-runtime-6XYOUVRZ.js} +5 -5
- package/dist/chat/pi/transcript.d.ts +2 -0
- package/dist/chat/runtime/agent-run-outcome.d.ts +1 -0
- 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/plugin-auth-orchestration.d.ts +2 -1
- package/dist/chat/services/provider-error.d.ts +39 -0
- package/dist/chat/services/provider-retry.d.ts +3 -6
- package/dist/chat/task-execution/state.d.ts +2 -2
- package/dist/chat/task-execution/store.d.ts +1 -1
- package/dist/chat/tools/resource-events.d.ts +3 -129
- package/dist/{chunk-J7APPQIJ.js → chunk-36UJA3OD.js} +1 -1
- package/dist/{chunk-Z2W4SJZ7.js → chunk-3CTIAKSS.js} +1 -1
- package/dist/{chunk-B45FPP2A.js → chunk-4VKFQPCW.js} +4 -4
- package/dist/{chunk-BTRNMS6A.js → chunk-4WZ7YKDF.js} +2 -2
- package/dist/{chunk-SL3ZKNLQ.js → chunk-DXRPHBOU.js} +132 -23
- package/dist/{chunk-OOLU34J4.js → chunk-H5ON7XTE.js} +125 -62
- package/dist/{chunk-PYKKM4MM.js → chunk-HMRVILWZ.js} +1 -1
- package/dist/{chunk-L6JPKANW.js → chunk-K5BXPM74.js} +1 -1
- package/dist/{chunk-ZRZ4SVWG.js → chunk-LLKDNPYV.js} +2 -2
- package/dist/{chunk-WSRBFHPX.js → chunk-LR2SKL5Y.js} +1 -1
- package/dist/{chunk-MPVES2IC.js → chunk-NP7TYFYR.js} +1 -1
- package/dist/{chunk-XQAYFRWT.js → chunk-OXE5ZUTS.js} +1 -1
- package/dist/{chunk-IFAHK54X.js → chunk-QTS66GMR.js} +2 -2
- package/dist/{chunk-NQLWOTY4.js → chunk-RCBUZGIT.js} +217 -199
- package/dist/{chunk-FPK7XY3F.js → chunk-UKGNSJQQ.js} +51 -42
- package/dist/{chunk-PZELBSHC.js → chunk-WBB22ANL.js} +20 -15
- package/dist/{chunk-QQIVLZW4.js → chunk-YJ44UT7D.js} +5 -5
- package/dist/{chunk-Z4G3WCP3.js → chunk-ZRSUCJGA.js} +1 -1
- package/dist/cli/chat.js +19 -19
- package/dist/cli/check.js +6 -6
- package/dist/cli/plugins.js +11 -11
- package/dist/cli/snapshot-warmup.js +8 -8
- package/dist/cli/upgrade.js +5 -5
- package/dist/{db-WXQOQESG.js → db-2ASK6MV6.js} +5 -5
- package/dist/instrumentation.js +2 -2
- package/dist/nitro.js +2 -2
- package/dist/{runner-4QY4XH4B.js → runner-L363K62Z.js} +12 -13
- package/dist/{skills-P5MU4EBX.js → skills-VCPG3NOO.js} +6 -6
- package/dist/{validation-PQF5OP6T.js → validation-GY7AJBLC.js} +6 -6
- package/dist/version.js +1 -1
- package/package.json +5 -5
package/dist/app.js
CHANGED
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
processPluginTask,
|
|
7
7
|
requireTurnFailureEventId,
|
|
8
8
|
scheduleSessionCompletedPluginTasks
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-WBB22ANL.js";
|
|
10
10
|
import {
|
|
11
11
|
GET,
|
|
12
12
|
buildSentryConversationUrl,
|
|
13
13
|
conversationVisibilityFromSlackChannelType,
|
|
14
14
|
resolveSlackChannelTypeFromMessage,
|
|
15
15
|
resolveSlackConversationContext
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-K5BXPM74.js";
|
|
17
17
|
import "./chunk-2ZTTXTSZ.js";
|
|
18
18
|
import {
|
|
19
19
|
ConversationQueueMessageRejectedError,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
import {
|
|
32
32
|
validatePluginEgressCredentialHooks,
|
|
33
33
|
validatePluginRegistrations
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-3CTIAKSS.js";
|
|
35
35
|
import {
|
|
36
36
|
defineJuniorPlugins,
|
|
37
37
|
pluginCatalogConfigFromEnv,
|
|
@@ -84,7 +84,7 @@ import {
|
|
|
84
84
|
splitSlackReplyText,
|
|
85
85
|
startOAuthFlow,
|
|
86
86
|
truncateStatusText
|
|
87
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-H5ON7XTE.js";
|
|
88
88
|
import {
|
|
89
89
|
ConversationTurnBoundaryError,
|
|
90
90
|
CooperativeTurnYieldError,
|
|
@@ -140,11 +140,13 @@ import {
|
|
|
140
140
|
recordAuthorizationCompleted,
|
|
141
141
|
recordDeliveredAssistantMessage,
|
|
142
142
|
startActiveTurn,
|
|
143
|
+
stripRuntimeTurnContext,
|
|
144
|
+
trimTrailingAssistantMessages,
|
|
143
145
|
turnHasReply,
|
|
144
146
|
updateConversationStats,
|
|
145
147
|
upsertConversationMessage
|
|
146
|
-
} from "./chunk-
|
|
147
|
-
import "./chunk-
|
|
148
|
+
} from "./chunk-DXRPHBOU.js";
|
|
149
|
+
import "./chunk-4VKFQPCW.js";
|
|
148
150
|
import "./chunk-MU6HHZEN.js";
|
|
149
151
|
import "./chunk-PDO5BLNM.js";
|
|
150
152
|
import "./chunk-UIE3R5XU.js";
|
|
@@ -163,12 +165,12 @@ import {
|
|
|
163
165
|
validatePlugins,
|
|
164
166
|
verifyScheduledTaskCredentialSubject,
|
|
165
167
|
verifySlackDirectCredentialSubject
|
|
166
|
-
} from "./chunk-
|
|
168
|
+
} from "./chunk-YJ44UT7D.js";
|
|
167
169
|
import {
|
|
168
170
|
acquireActiveLock,
|
|
169
171
|
getDefaultRedisStateAdapterFor,
|
|
170
172
|
getStateAdapter
|
|
171
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-HMRVILWZ.js";
|
|
172
174
|
import {
|
|
173
175
|
SlackActionError,
|
|
174
176
|
downloadPrivateSlackFile,
|
|
@@ -179,7 +181,7 @@ import {
|
|
|
179
181
|
normalizeSlackConversationId,
|
|
180
182
|
runWithSlackInstallationToken,
|
|
181
183
|
runWithWorkspaceTeamId
|
|
182
|
-
} from "./chunk-
|
|
184
|
+
} from "./chunk-QTS66GMR.js";
|
|
183
185
|
import {
|
|
184
186
|
contextProvenance,
|
|
185
187
|
createSlackDestination,
|
|
@@ -193,7 +195,7 @@ import {
|
|
|
193
195
|
requireSlackDestination,
|
|
194
196
|
sameDestination,
|
|
195
197
|
withConversationEventLock
|
|
196
|
-
} from "./chunk-
|
|
198
|
+
} from "./chunk-LLKDNPYV.js";
|
|
197
199
|
import {
|
|
198
200
|
juniorConversationEvents,
|
|
199
201
|
juniorConversations
|
|
@@ -219,10 +221,8 @@ import {
|
|
|
219
221
|
modelIdForProfile,
|
|
220
222
|
normalizeSlackEmojiName,
|
|
221
223
|
setSlackReactionConfig,
|
|
222
|
-
standardModelId
|
|
223
|
-
|
|
224
|
-
trimTrailingAssistantMessages
|
|
225
|
-
} from "./chunk-NQLWOTY4.js";
|
|
224
|
+
standardModelId
|
|
225
|
+
} from "./chunk-RCBUZGIT.js";
|
|
226
226
|
import {
|
|
227
227
|
juniorDestinations
|
|
228
228
|
} from "./chunk-VFUK3X5B.js";
|
|
@@ -234,16 +234,16 @@ import {
|
|
|
234
234
|
} from "./chunk-6Y5L4BOM.js";
|
|
235
235
|
import {
|
|
236
236
|
discoverSkills
|
|
237
|
-
} from "./chunk-
|
|
237
|
+
} from "./chunk-4WZ7YKDF.js";
|
|
238
238
|
import {
|
|
239
239
|
pluginCatalogRuntime
|
|
240
|
-
} from "./chunk-
|
|
240
|
+
} from "./chunk-LR2SKL5Y.js";
|
|
241
241
|
import {
|
|
242
242
|
buildOAuthTokenRequest,
|
|
243
243
|
credentialSubjectSchema,
|
|
244
244
|
hasRequiredOAuthScope,
|
|
245
245
|
parseOAuthTokenResponse
|
|
246
|
-
} from "./chunk-
|
|
246
|
+
} from "./chunk-OXE5ZUTS.js";
|
|
247
247
|
import {
|
|
248
248
|
createActor,
|
|
249
249
|
createSlackActor,
|
|
@@ -268,7 +268,7 @@ import {
|
|
|
268
268
|
setTags,
|
|
269
269
|
withContext,
|
|
270
270
|
withSpan
|
|
271
|
-
} from "./chunk-
|
|
271
|
+
} from "./chunk-36UJA3OD.js";
|
|
272
272
|
import {
|
|
273
273
|
isRecord,
|
|
274
274
|
parseSlackChannelId,
|
|
@@ -285,10 +285,10 @@ import {
|
|
|
285
285
|
} from "./chunk-3V7OFJZC.js";
|
|
286
286
|
import {
|
|
287
287
|
JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE
|
|
288
|
-
} from "./chunk-
|
|
288
|
+
} from "./chunk-NP7TYFYR.js";
|
|
289
289
|
import {
|
|
290
290
|
JUNIOR_VERSION
|
|
291
|
-
} from "./chunk-
|
|
291
|
+
} from "./chunk-ZRSUCJGA.js";
|
|
292
292
|
import "./chunk-MLKGABMK.js";
|
|
293
293
|
|
|
294
294
|
// src/app.ts
|
|
@@ -4111,9 +4111,26 @@ async function startSlackProcessingReactionForMessage(args) {
|
|
|
4111
4111
|
}
|
|
4112
4112
|
|
|
4113
4113
|
// src/chat/services/auth-pause-response.ts
|
|
4114
|
-
|
|
4114
|
+
var MAX_AUTH_REQUEST_LENGTH = 200;
|
|
4115
|
+
function formatAuthRequest(requestText) {
|
|
4116
|
+
const normalized = requestText.replace(/\s+/g, " ").trim();
|
|
4117
|
+
if (!normalized) {
|
|
4118
|
+
return void 0;
|
|
4119
|
+
}
|
|
4120
|
+
const bounded = normalized.length > MAX_AUTH_REQUEST_LENGTH ? `${normalized.slice(0, MAX_AUTH_REQUEST_LENGTH - 1).trimEnd()}\u2026` : normalized;
|
|
4121
|
+
return bounded.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
4122
|
+
}
|
|
4123
|
+
function buildAuthPauseResponse(slackUserId, providerDisplayName, requestText) {
|
|
4115
4124
|
const mention = slackUserId ? `<@${slackUserId}> ` : "";
|
|
4116
|
-
|
|
4125
|
+
const request = requestText ? formatAuthRequest(requestText) : void 0;
|
|
4126
|
+
if (!request) {
|
|
4127
|
+
return `${mention}I'll need you to authorize ${providerDisplayName}. I sent you a link.`;
|
|
4128
|
+
}
|
|
4129
|
+
return `${mention}I need access to ${providerDisplayName} to continue.
|
|
4130
|
+
|
|
4131
|
+
*Why:* ${request}
|
|
4132
|
+
|
|
4133
|
+
I sent you a link.`;
|
|
4117
4134
|
}
|
|
4118
4135
|
|
|
4119
4136
|
// src/chat/runtime/request-deadline.ts
|
|
@@ -4564,7 +4581,8 @@ async function resumeSlackTurn(args) {
|
|
|
4564
4581
|
if (outcome.status === "awaiting_auth" && onAuthPause) {
|
|
4565
4582
|
deferredAuthInfo = {
|
|
4566
4583
|
providerDisplayName: outcome.providerDisplayName,
|
|
4567
|
-
actorId: isUserActor(resumeActor) ? resumeActor.userId : void 0
|
|
4584
|
+
actorId: isUserActor(resumeActor) ? resumeActor.userId : void 0,
|
|
4585
|
+
...outcome.requestText ? { requestText: outcome.requestText } : {}
|
|
4568
4586
|
};
|
|
4569
4587
|
deferredPauseHandler = async () => {
|
|
4570
4588
|
await onAuthPause({
|
|
@@ -4718,7 +4736,8 @@ async function resumeSlackTurn(args) {
|
|
|
4718
4736
|
runArgs.threadTs,
|
|
4719
4737
|
buildAuthPauseResponse(
|
|
4720
4738
|
deferredAuthInfo.actorId,
|
|
4721
|
-
deferredAuthInfo.providerDisplayName
|
|
4739
|
+
deferredAuthInfo.providerDisplayName,
|
|
4740
|
+
deferredAuthInfo.requestText
|
|
4722
4741
|
),
|
|
4723
4742
|
runArgs.conversationId
|
|
4724
4743
|
);
|
|
@@ -10870,13 +10889,14 @@ function createReplyToThread(deps) {
|
|
|
10870
10889
|
beforeFirstResponsePostCalled = true;
|
|
10871
10890
|
await options.beforeFirstResponsePost?.();
|
|
10872
10891
|
};
|
|
10873
|
-
const postAuthPauseNotice = async (providerDisplayName) => {
|
|
10892
|
+
const postAuthPauseNotice = async (providerDisplayName, requestText) => {
|
|
10874
10893
|
if (!actor) {
|
|
10875
10894
|
throw new Error("Slack auth pause notice requires an actor");
|
|
10876
10895
|
}
|
|
10877
10896
|
const text = buildAuthPauseResponse(
|
|
10878
10897
|
actor.userId,
|
|
10879
|
-
providerDisplayName
|
|
10898
|
+
providerDisplayName,
|
|
10899
|
+
requestText
|
|
10880
10900
|
);
|
|
10881
10901
|
try {
|
|
10882
10902
|
await beforeFirstResponsePost();
|
|
@@ -11545,7 +11565,10 @@ function createReplyToThread(deps) {
|
|
|
11545
11565
|
shouldPersistFailureState = false;
|
|
11546
11566
|
return;
|
|
11547
11567
|
}
|
|
11548
|
-
await postAuthPauseNotice(
|
|
11568
|
+
await postAuthPauseNotice(
|
|
11569
|
+
outcome.providerDisplayName,
|
|
11570
|
+
outcome.requestText
|
|
11571
|
+
);
|
|
11549
11572
|
completeAuthPauseTurn({
|
|
11550
11573
|
conversation: preparedState.conversation,
|
|
11551
11574
|
sessionId: turnId
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pluginCatalogRuntime
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-LR2SKL5Y.js";
|
|
4
|
+
import "./chunk-OXE5ZUTS.js";
|
|
5
5
|
import "./chunk-C4MZ3GP5.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-36UJA3OD.js";
|
|
7
7
|
import "./chunk-42WRQLJ6.js";
|
|
8
8
|
import "./chunk-6GWA276C.js";
|
|
9
9
|
import "./chunk-B3IT5END.js";
|
|
10
10
|
import "./chunk-3V7OFJZC.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-NP7TYFYR.js";
|
|
12
|
+
import "./chunk-ZRSUCJGA.js";
|
|
13
13
|
import "./chunk-MLKGABMK.js";
|
|
14
14
|
export {
|
|
15
15
|
pluginCatalogRuntime
|
|
@@ -19,6 +19,8 @@ export declare function isToolResultError(result: unknown): boolean;
|
|
|
19
19
|
export declare function normalizeToolNameFromResult(result: unknown): string | undefined;
|
|
20
20
|
/** Extract role string from a raw Pi message. */
|
|
21
21
|
export declare function getPiMessageRole(value: unknown): string | undefined;
|
|
22
|
+
/** Return whether Pi can continue directly from the current history tail. */
|
|
23
|
+
export declare function isContinuablePiBoundary(messages: readonly PiMessage[]): boolean;
|
|
22
24
|
/** Concatenate text content parts from an assistant message. */
|
|
23
25
|
export declare function extractAssistantText(message: AssistantMessage): string;
|
|
24
26
|
/** Return assistant messages that belong to the terminal post-tool reply phase. */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Build the visible Slack thread note for an auth-paused turn. */
|
|
2
|
-
export declare function buildAuthPauseResponse(slackUserId: string | undefined, providerDisplayName: string): string;
|
|
2
|
+
export declare function buildAuthPauseResponse(slackUserId: string | undefined, providerDisplayName: string, requestText?: string): string;
|
|
@@ -10,7 +10,8 @@ export declare class AuthorizationPauseError extends Error {
|
|
|
10
10
|
readonly kind: AuthorizationPauseKind;
|
|
11
11
|
readonly provider: string;
|
|
12
12
|
readonly providerDisplayName: string;
|
|
13
|
-
|
|
13
|
+
readonly requestText?: string;
|
|
14
|
+
constructor(kind: AuthorizationPauseKind, provider: string, providerDisplayName: string, disposition: AuthorizationPauseDisposition, requestText?: string);
|
|
14
15
|
}
|
|
15
16
|
/** Error indicating an authorization pause could not be made durable. */
|
|
16
17
|
export declare class AuthPausePersistenceError extends Error {
|
|
@@ -13,7 +13,7 @@ import type { ThreadArtifactsState } from "@/chat/state/artifacts";
|
|
|
13
13
|
import type { ConversationPendingAuthState } from "@/chat/state/conversation";
|
|
14
14
|
import type { PluginDefinition } from "@/chat/plugins/types";
|
|
15
15
|
export declare class McpAuthorizationPauseError extends AuthorizationPauseError {
|
|
16
|
-
constructor(provider: string, providerDisplayName: string, disposition: "link_already_sent" | "link_sent");
|
|
16
|
+
constructor(provider: string, providerDisplayName: string, disposition: "link_already_sent" | "link_sent", requestText?: string);
|
|
17
17
|
}
|
|
18
18
|
export interface McpAuthOrchestrationInput {
|
|
19
19
|
abortAgent: () => void;
|
|
@@ -15,7 +15,7 @@ import type { UserTokenStore } from "@/chat/credentials/user-token-store";
|
|
|
15
15
|
import { AuthorizationPauseError, type AuthorizationFlowMode } from "@/chat/services/auth-pause";
|
|
16
16
|
import type { ConversationPendingAuthState } from "@/chat/state/conversation";
|
|
17
17
|
export declare class PluginAuthorizationPauseError extends AuthorizationPauseError {
|
|
18
|
-
constructor(provider: string, providerDisplayName: string, disposition: "link_already_sent" | "link_sent");
|
|
18
|
+
constructor(provider: string, providerDisplayName: string, disposition: "link_already_sent" | "link_sent", requestText?: string);
|
|
19
19
|
}
|
|
20
20
|
export declare class PluginCredentialFailureError extends Error {
|
|
21
21
|
readonly provider: string;
|
|
@@ -30,6 +30,7 @@ export interface PluginAuthOrchestrationInput {
|
|
|
30
30
|
destination?: Destination;
|
|
31
31
|
source?: Source;
|
|
32
32
|
threadTs?: string;
|
|
33
|
+
userMessage?: string;
|
|
33
34
|
pendingAuth?: ConversationPendingAuthState;
|
|
34
35
|
recordPendingAuth?: (pendingAuth: ConversationPendingAuthState) => void | Promise<void>;
|
|
35
36
|
authorizationFlowMode?: AuthorizationFlowMode;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize failures at the model-provider boundary.
|
|
3
|
+
*
|
|
4
|
+
* Junior owns stable failure kinds, safe user copy, and telemetry fields. Pi
|
|
5
|
+
* remains the source of truth for retrying assistant error messages.
|
|
6
|
+
*/
|
|
7
|
+
export type ProviderErrorKind = "auth" | "permission" | "rate_limit" | "capacity" | "timeout" | "network" | "server" | "invalid_request" | "invalid_response" | "quota" | "content_policy" | "unknown";
|
|
8
|
+
interface ProviderErrorOptions {
|
|
9
|
+
kind?: ProviderErrorKind;
|
|
10
|
+
modelId?: string;
|
|
11
|
+
/** Pi's decision for an assistant error; explicit terminal kinds still win. */
|
|
12
|
+
retryable?: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface ProviderErrorDetails {
|
|
15
|
+
kind: ProviderErrorKind;
|
|
16
|
+
modelId?: string;
|
|
17
|
+
retryable: boolean;
|
|
18
|
+
retryAfterMs?: number;
|
|
19
|
+
status?: number;
|
|
20
|
+
}
|
|
21
|
+
/** Structured failure produced at an AI provider boundary. */
|
|
22
|
+
export declare class ProviderError extends Error {
|
|
23
|
+
readonly code = "provider_error";
|
|
24
|
+
readonly kind: ProviderErrorKind;
|
|
25
|
+
readonly modelId?: string;
|
|
26
|
+
readonly retryable: boolean;
|
|
27
|
+
readonly retryAfterMs?: number;
|
|
28
|
+
readonly status?: number;
|
|
29
|
+
constructor(details: ProviderErrorDetails);
|
|
30
|
+
}
|
|
31
|
+
/** Normalize SDK, Gateway, and Pi failures into one provider error contract. */
|
|
32
|
+
export declare function createProviderError(error: unknown, options?: ProviderErrorOptions): ProviderError;
|
|
33
|
+
/** Return whether a provider-boundary error should be retried. */
|
|
34
|
+
export declare function isProviderRetryError(error: unknown): error is ProviderError;
|
|
35
|
+
/** Return stable, sanitized copy suitable for a terminal user response. */
|
|
36
|
+
export declare function getProviderErrorUserMessage(error: ProviderError): string;
|
|
37
|
+
/** Return safe structured fields for terminal failure telemetry. */
|
|
38
|
+
export declare function getProviderErrorAttributes(error: ProviderError): Record<string, unknown>;
|
|
39
|
+
export {};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
+
import { type AssistantMessage } from "@earendil-works/pi-ai";
|
|
1
2
|
import type { PiMessage } from "@/chat/pi/messages";
|
|
2
|
-
/**
|
|
3
|
-
export declare function createProviderError(error: unknown): Error;
|
|
4
|
-
/** Return whether a provider-boundary error should be retried by the worker. */
|
|
5
|
-
export declare function isProviderRetryError(error: unknown): boolean;
|
|
6
|
-
/** Build the next provider retry step from Pi history, if the turn can resume. */
|
|
3
|
+
/** Apply Junior's retry budget to a retryable Pi assistant failure. */
|
|
7
4
|
export declare function nextProviderRetry(args: {
|
|
8
5
|
attempt: number;
|
|
6
|
+
failure?: AssistantMessage;
|
|
9
7
|
messages: PiMessage[];
|
|
10
|
-
retryableFailure: boolean;
|
|
11
8
|
}): {
|
|
12
9
|
delayMs: number;
|
|
13
10
|
messages: PiMessage[];
|
|
@@ -16,8 +16,8 @@ export declare const CONVERSATION_WORK_MAX_DELIVERY_ATTEMPTS = 5;
|
|
|
16
16
|
declare const inboundMessageSourceSchema: z.ZodEnum<{
|
|
17
17
|
slack: "slack";
|
|
18
18
|
plugin: "plugin";
|
|
19
|
-
api: "api";
|
|
20
19
|
local: "local";
|
|
20
|
+
api: "api";
|
|
21
21
|
internal: "internal";
|
|
22
22
|
resource_event: "resource_event";
|
|
23
23
|
scheduler: "scheduler";
|
|
@@ -66,8 +66,8 @@ export declare const inboundMessageSchema: z.ZodObject<{
|
|
|
66
66
|
source: z.ZodEnum<{
|
|
67
67
|
slack: "slack";
|
|
68
68
|
plugin: "plugin";
|
|
69
|
-
api: "api";
|
|
70
69
|
local: "local";
|
|
70
|
+
api: "api";
|
|
71
71
|
internal: "internal";
|
|
72
72
|
resource_event: "resource_event";
|
|
73
73
|
scheduler: "scheduler";
|
|
@@ -114,7 +114,7 @@ export declare function drainConversationMailbox(args: Parameters<typeof workSta
|
|
|
114
114
|
metadata?: Record<string, unknown> | undefined;
|
|
115
115
|
};
|
|
116
116
|
receivedAtMs: number;
|
|
117
|
-
source: "slack" | "plugin" | "
|
|
117
|
+
source: "slack" | "plugin" | "local" | "api" | "internal" | "resource_event" | "scheduler";
|
|
118
118
|
attemptCount?: number | undefined;
|
|
119
119
|
injectedAtMs?: number | undefined;
|
|
120
120
|
}[]>;
|
|
@@ -1,130 +1,4 @@
|
|
|
1
|
+
import type { ToolRegistry } from "@/chat/tools/definition";
|
|
1
2
|
import type { ToolRuntimeContext } from "@/chat/tools/types";
|
|
2
|
-
/**
|
|
3
|
-
export declare function
|
|
4
|
-
/** Create the tool that subscribes the current conversation to resource events. */
|
|
5
|
-
export declare function createSubscribeToResourceEventsTool(context: ToolRuntimeContext): Omit<import("./definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
6
|
-
inputSchema: import("./definition").JsonSchemaObject;
|
|
7
|
-
outputSchema: import("./definition").JsonSchemaObject;
|
|
8
|
-
prepareArguments(args: unknown): {
|
|
9
|
-
resourceRef: string;
|
|
10
|
-
provider: string;
|
|
11
|
-
resourceType: string;
|
|
12
|
-
label: string;
|
|
13
|
-
events: string[];
|
|
14
|
-
intent: string;
|
|
15
|
-
ttlMs?: number | undefined;
|
|
16
|
-
};
|
|
17
|
-
execute?: ((input: unknown, options: import("./definition").ToolExecuteOptions) => {
|
|
18
|
-
[x: string]: unknown;
|
|
19
|
-
ok: boolean;
|
|
20
|
-
status: "error" | "success";
|
|
21
|
-
target?: string | undefined;
|
|
22
|
-
data?: unknown;
|
|
23
|
-
truncated?: boolean | undefined;
|
|
24
|
-
continuation?: {
|
|
25
|
-
arguments: Record<string, unknown>;
|
|
26
|
-
reason?: string | undefined;
|
|
27
|
-
} | undefined;
|
|
28
|
-
error?: string | {
|
|
29
|
-
kind: string;
|
|
30
|
-
message: string;
|
|
31
|
-
retryable?: boolean | undefined;
|
|
32
|
-
} | undefined;
|
|
33
|
-
} | Promise<{
|
|
34
|
-
[x: string]: unknown;
|
|
35
|
-
ok: boolean;
|
|
36
|
-
status: "error" | "success";
|
|
37
|
-
target?: string | undefined;
|
|
38
|
-
data?: unknown;
|
|
39
|
-
truncated?: boolean | undefined;
|
|
40
|
-
continuation?: {
|
|
41
|
-
arguments: Record<string, unknown>;
|
|
42
|
-
reason?: string | undefined;
|
|
43
|
-
} | undefined;
|
|
44
|
-
error?: string | {
|
|
45
|
-
kind: string;
|
|
46
|
-
message: string;
|
|
47
|
-
retryable?: boolean | undefined;
|
|
48
|
-
} | undefined;
|
|
49
|
-
}>) | undefined;
|
|
50
|
-
};
|
|
51
|
-
/** Create the tool that lists active resource subscriptions for this conversation. */
|
|
52
|
-
export declare function createListResourceEventSubscriptionsTool(context: ToolRuntimeContext): Omit<import("./definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
53
|
-
inputSchema: import("./definition").JsonSchemaObject;
|
|
54
|
-
outputSchema: import("./definition").JsonSchemaObject;
|
|
55
|
-
prepareArguments(args: unknown): Record<string, never>;
|
|
56
|
-
execute?: ((input: unknown, options: import("./definition").ToolExecuteOptions) => {
|
|
57
|
-
[x: string]: unknown;
|
|
58
|
-
ok: boolean;
|
|
59
|
-
status: "error" | "success";
|
|
60
|
-
target?: string | undefined;
|
|
61
|
-
data?: unknown;
|
|
62
|
-
truncated?: boolean | undefined;
|
|
63
|
-
continuation?: {
|
|
64
|
-
arguments: Record<string, unknown>;
|
|
65
|
-
reason?: string | undefined;
|
|
66
|
-
} | undefined;
|
|
67
|
-
error?: string | {
|
|
68
|
-
kind: string;
|
|
69
|
-
message: string;
|
|
70
|
-
retryable?: boolean | undefined;
|
|
71
|
-
} | undefined;
|
|
72
|
-
} | Promise<{
|
|
73
|
-
[x: string]: unknown;
|
|
74
|
-
ok: boolean;
|
|
75
|
-
status: "error" | "success";
|
|
76
|
-
target?: string | undefined;
|
|
77
|
-
data?: unknown;
|
|
78
|
-
truncated?: boolean | undefined;
|
|
79
|
-
continuation?: {
|
|
80
|
-
arguments: Record<string, unknown>;
|
|
81
|
-
reason?: string | undefined;
|
|
82
|
-
} | undefined;
|
|
83
|
-
error?: string | {
|
|
84
|
-
kind: string;
|
|
85
|
-
message: string;
|
|
86
|
-
retryable?: boolean | undefined;
|
|
87
|
-
} | undefined;
|
|
88
|
-
}>) | undefined;
|
|
89
|
-
};
|
|
90
|
-
/** Create the tool that cancels a current-conversation resource subscription. */
|
|
91
|
-
export declare function createCancelResourceEventSubscriptionTool(context: ToolRuntimeContext): Omit<import("./definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
92
|
-
inputSchema: import("./definition").JsonSchemaObject;
|
|
93
|
-
outputSchema: import("./definition").JsonSchemaObject;
|
|
94
|
-
prepareArguments(args: unknown): {
|
|
95
|
-
subscriptionId: string;
|
|
96
|
-
};
|
|
97
|
-
execute?: ((input: unknown, options: import("./definition").ToolExecuteOptions) => {
|
|
98
|
-
[x: string]: unknown;
|
|
99
|
-
ok: boolean;
|
|
100
|
-
status: "error" | "success";
|
|
101
|
-
target?: string | undefined;
|
|
102
|
-
data?: unknown;
|
|
103
|
-
truncated?: boolean | undefined;
|
|
104
|
-
continuation?: {
|
|
105
|
-
arguments: Record<string, unknown>;
|
|
106
|
-
reason?: string | undefined;
|
|
107
|
-
} | undefined;
|
|
108
|
-
error?: string | {
|
|
109
|
-
kind: string;
|
|
110
|
-
message: string;
|
|
111
|
-
retryable?: boolean | undefined;
|
|
112
|
-
} | undefined;
|
|
113
|
-
} | Promise<{
|
|
114
|
-
[x: string]: unknown;
|
|
115
|
-
ok: boolean;
|
|
116
|
-
status: "error" | "success";
|
|
117
|
-
target?: string | undefined;
|
|
118
|
-
data?: unknown;
|
|
119
|
-
truncated?: boolean | undefined;
|
|
120
|
-
continuation?: {
|
|
121
|
-
arguments: Record<string, unknown>;
|
|
122
|
-
reason?: string | undefined;
|
|
123
|
-
} | undefined;
|
|
124
|
-
error?: string | {
|
|
125
|
-
kind: string;
|
|
126
|
-
message: string;
|
|
127
|
-
retryable?: boolean | undefined;
|
|
128
|
-
} | undefined;
|
|
129
|
-
}>) | undefined;
|
|
130
|
-
};
|
|
3
|
+
/** Build the complete resource-watch tool set allowed by this runtime context. */
|
|
4
|
+
export declare function createResourceEventTools(context: ToolRuntimeContext): ToolRegistry;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SANDBOX_WORKSPACE_ROOT,
|
|
3
3
|
getStateAdapter
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HMRVILWZ.js";
|
|
5
5
|
import {
|
|
6
6
|
sleep
|
|
7
7
|
} from "./chunk-4ZNGQH7C.js";
|
|
8
8
|
import {
|
|
9
9
|
toOptionalTrimmed
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-RCBUZGIT.js";
|
|
11
11
|
import {
|
|
12
12
|
pluginCatalogRuntime
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-LR2SKL5Y.js";
|
|
14
14
|
import {
|
|
15
15
|
setSpanAttributes,
|
|
16
16
|
setSpanStatus,
|
|
17
17
|
withSpan
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-36UJA3OD.js";
|
|
19
19
|
|
|
20
20
|
// src/chat/sandbox/runtime-dependencies.ts
|
|
21
21
|
var GLOBAL_RUNTIME_DEPENDENCIES = [
|