@sentry/junior 0.84.1 → 0.85.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-TFPY6V3T.js → agent-hooks-AV7CHLUO.js} +6 -6
- package/dist/app.js +140 -42
- package/dist/chat/current-instruction.d.ts +6 -0
- package/dist/chat/respond-helpers.d.ts +1 -2
- package/dist/{chunk-ALL7GG6U.js → chunk-BU2AWPEN.js} +42 -4
- package/dist/{chunk-BAPRSWNW.js → chunk-C2PSUWK3.js} +1 -1
- package/dist/{chunk-FPN7NYTE.js → chunk-EENOFKDN.js} +3 -3
- package/dist/{chunk-SBYMRDH7.js → chunk-ENEWQMRJ.js} +1 -1
- package/dist/{chunk-LSG6PQF4.js → chunk-FYPO4K7C.js} +2 -2
- package/dist/{chunk-JK7376UT.js → chunk-GY7L6VCT.js} +6 -11
- package/dist/{chunk-T2YRJZ5A.js → chunk-MHEV3T2Y.js} +53 -16
- package/dist/{chunk-CWMMGUWM.js → chunk-MTE5NRPJ.js} +1 -1
- package/dist/{chunk-QWKB6NJV.js → chunk-QTTTRBNB.js} +2 -2
- package/dist/{chunk-MJ4E2PK7.js → chunk-RUB77TGS.js} +1 -1
- package/dist/{chunk-SVFA43LT.js → chunk-SSUEWAVS.js} +2 -2
- package/dist/{chunk-AL6ZFV7U.js → chunk-UVNV67EC.js} +4 -4
- package/dist/cli/chat.js +4 -4
- package/dist/cli/plugins.js +6 -6
- package/dist/cli/snapshot-warmup.js +3 -3
- package/dist/cli/upgrade.js +6 -6
- package/dist/{db-ELRCNB4A.js → db-S3HYBLUS.js} +3 -3
- package/dist/handlers/github-webhook/issue-comment.d.ts +3 -0
- package/dist/handlers/github-webhook/pull-request-review-comment.d.ts +3 -0
- package/dist/nitro.js +3 -3
- package/dist/reporting.js +23 -12
- package/dist/{runner-2XU6QQND.js → runner-IMQH6V2B.js} +9 -9
- package/package.json +6 -6
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
getPlugins,
|
|
12
12
|
setPlugins,
|
|
13
13
|
validatePlugins
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-UVNV67EC.js";
|
|
15
|
+
import "./chunk-MTE5NRPJ.js";
|
|
16
|
+
import "./chunk-QTTTRBNB.js";
|
|
17
17
|
import "./chunk-G3E7SCME.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-RUB77TGS.js";
|
|
19
|
+
import "./chunk-C2PSUWK3.js";
|
|
20
|
+
import "./chunk-BU2AWPEN.js";
|
|
21
21
|
import "./chunk-DR75T7J3.js";
|
|
22
22
|
import "./chunk-IXTBFABZ.js";
|
|
23
23
|
import "./chunk-KF7522P3.js";
|
package/dist/app.js
CHANGED
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
updateConversationStats,
|
|
69
69
|
uploadFilesToThread,
|
|
70
70
|
upsertConversationMessage
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-MHEV3T2Y.js";
|
|
72
72
|
import {
|
|
73
73
|
CONVERSATION_WORK_CHECK_IN_INTERVAL_MS,
|
|
74
74
|
CONVERSATION_WORK_STALE_ENQUEUE_MS,
|
|
@@ -88,17 +88,17 @@ import {
|
|
|
88
88
|
requestConversationContinuation,
|
|
89
89
|
requestConversationWork,
|
|
90
90
|
startConversationWork
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-EENOFKDN.js";
|
|
92
92
|
import {
|
|
93
93
|
JUNIOR_THREAD_STATE_TTL_MS,
|
|
94
94
|
coerceThreadConversationState
|
|
95
95
|
} from "./chunk-66NX7MNW.js";
|
|
96
|
-
import "./chunk-
|
|
96
|
+
import "./chunk-FYPO4K7C.js";
|
|
97
97
|
import {
|
|
98
98
|
getVercelConversationWorkQueue,
|
|
99
99
|
resolveConversationWorkQueueTopic,
|
|
100
100
|
verifyConversationQueueMessage
|
|
101
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-ENEWQMRJ.js";
|
|
102
102
|
import {
|
|
103
103
|
PLUGIN_TASK_QUEUE_TOPIC,
|
|
104
104
|
createVercelQueueClient,
|
|
@@ -111,12 +111,11 @@ import {
|
|
|
111
111
|
resolveSlackChannelTypeFromMessage,
|
|
112
112
|
resolveSlackConversationContext,
|
|
113
113
|
setConversationTitle
|
|
114
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-SSUEWAVS.js";
|
|
115
115
|
import {
|
|
116
116
|
abandonAgentTurnSessionRecord,
|
|
117
117
|
buildSlackOutputMessage,
|
|
118
118
|
commitMessages,
|
|
119
|
-
escapeXml,
|
|
120
119
|
failAgentTurnSessionRecord,
|
|
121
120
|
getAgentTurnSessionRecord,
|
|
122
121
|
getInterruptionMarker,
|
|
@@ -127,7 +126,7 @@ import {
|
|
|
127
126
|
recordAuthorizationCompleted,
|
|
128
127
|
splitSlackReplyText,
|
|
129
128
|
truncateStatusText
|
|
130
|
-
} from "./chunk-
|
|
129
|
+
} from "./chunk-GY7L6VCT.js";
|
|
131
130
|
import {
|
|
132
131
|
validatePluginEgressCredentialHooks,
|
|
133
132
|
validatePluginRegistrations
|
|
@@ -147,20 +146,20 @@ import {
|
|
|
147
146
|
setPlugins,
|
|
148
147
|
validatePlugins,
|
|
149
148
|
verifySlackDirectCredentialSubject
|
|
150
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-UVNV67EC.js";
|
|
151
150
|
import {
|
|
152
151
|
createPluginLogger,
|
|
153
152
|
createPluginState
|
|
154
|
-
} from "./chunk-
|
|
153
|
+
} from "./chunk-MTE5NRPJ.js";
|
|
155
154
|
import {
|
|
156
155
|
getConversationStore,
|
|
157
156
|
getDb
|
|
158
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-QTTTRBNB.js";
|
|
159
158
|
import "./chunk-G3E7SCME.js";
|
|
160
159
|
import {
|
|
161
160
|
acquireActiveLock,
|
|
162
161
|
getStateAdapter
|
|
163
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-RUB77TGS.js";
|
|
164
163
|
import {
|
|
165
164
|
SlackActionError,
|
|
166
165
|
createSlackDestination,
|
|
@@ -173,13 +172,14 @@ import {
|
|
|
173
172
|
parseDestination,
|
|
174
173
|
requireSlackDestination,
|
|
175
174
|
sameDestination
|
|
176
|
-
} from "./chunk-
|
|
175
|
+
} from "./chunk-C2PSUWK3.js";
|
|
177
176
|
import {
|
|
178
177
|
FUNCTION_TIMEOUT_BUFFER_SECONDS,
|
|
179
178
|
GEN_AI_PROVIDER_NAME,
|
|
180
179
|
botConfig,
|
|
181
180
|
completeObject,
|
|
182
181
|
completeText,
|
|
182
|
+
escapeXml,
|
|
183
183
|
getChatConfig,
|
|
184
184
|
getRuntimeMetadata,
|
|
185
185
|
getSlackBotToken,
|
|
@@ -191,8 +191,9 @@ import {
|
|
|
191
191
|
normalizeSlackEmojiName,
|
|
192
192
|
setSlackReactionConfig,
|
|
193
193
|
stripRuntimeTurnContext,
|
|
194
|
-
trimTrailingAssistantMessages
|
|
195
|
-
|
|
194
|
+
trimTrailingAssistantMessages,
|
|
195
|
+
unwrapCurrentInstruction
|
|
196
|
+
} from "./chunk-BU2AWPEN.js";
|
|
196
197
|
import {
|
|
197
198
|
parseSlackThreadId,
|
|
198
199
|
resolveSlackChannelIdFromMessage,
|
|
@@ -2349,16 +2350,58 @@ function normalizeGitHubCheckSuiteEvents(deliveryId, body) {
|
|
|
2349
2350
|
});
|
|
2350
2351
|
}
|
|
2351
2352
|
|
|
2352
|
-
// src/handlers/github-webhook/
|
|
2353
|
+
// src/handlers/github-webhook/issue-comment.ts
|
|
2353
2354
|
import { z as z4 } from "zod";
|
|
2354
|
-
var
|
|
2355
|
+
var issueCommentWebhookSchema = z4.object({
|
|
2355
2356
|
action: z4.string(),
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2357
|
+
comment: z4.object({
|
|
2358
|
+
body: z4.string(),
|
|
2359
|
+
user: z4.object({
|
|
2360
|
+
login: z4.string().optional()
|
|
2361
|
+
}).strip().optional()
|
|
2362
|
+
}).strip(),
|
|
2363
|
+
issue: z4.object({
|
|
2364
|
+
number: z4.number(),
|
|
2365
|
+
pull_request: z4.object({
|
|
2366
|
+
url: z4.string().min(1)
|
|
2367
|
+
}).strip().optional()
|
|
2368
|
+
}).strip(),
|
|
2360
2369
|
repository: z4.object({
|
|
2361
2370
|
full_name: z4.string().min(1)
|
|
2371
|
+
}).strip()
|
|
2372
|
+
}).strip();
|
|
2373
|
+
function normalizeGitHubIssueCommentEvent(deliveryId, body) {
|
|
2374
|
+
const parsed = issueCommentWebhookSchema.safeParse(body);
|
|
2375
|
+
if (!parsed.success || parsed.data.action !== "created" || !parsed.data.issue.pull_request) {
|
|
2376
|
+
return void 0;
|
|
2377
|
+
}
|
|
2378
|
+
const eventType = "comment.created";
|
|
2379
|
+
const resource = gitHubPullRequestResource({
|
|
2380
|
+
pullRequestNumber: parsed.data.issue.number,
|
|
2381
|
+
repositoryFullName: parsed.data.repository.full_name
|
|
2382
|
+
});
|
|
2383
|
+
const author = parsed.data.comment.user?.login;
|
|
2384
|
+
return {
|
|
2385
|
+
eventKey: gitHubEventKey(deliveryId, eventType),
|
|
2386
|
+
eventType,
|
|
2387
|
+
occurredAtMs: Date.now(),
|
|
2388
|
+
provider: "github",
|
|
2389
|
+
resourceRef: resource.resourceRef,
|
|
2390
|
+
trustedSummary: `${resource.label} received a comment${author ? ` from ${author}` : ""}.`,
|
|
2391
|
+
untrustedText: parsed.data.comment.body
|
|
2392
|
+
};
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
// src/handlers/github-webhook/pull-request.ts
|
|
2396
|
+
import { z as z5 } from "zod";
|
|
2397
|
+
var pullRequestWebhookSchema = z5.object({
|
|
2398
|
+
action: z5.string(),
|
|
2399
|
+
pull_request: z5.object({
|
|
2400
|
+
merged: z5.boolean().optional(),
|
|
2401
|
+
number: z5.number()
|
|
2402
|
+
}),
|
|
2403
|
+
repository: z5.object({
|
|
2404
|
+
full_name: z5.string().min(1)
|
|
2362
2405
|
})
|
|
2363
2406
|
});
|
|
2364
2407
|
function normalizeGitHubPullRequestEvent(deliveryId, body) {
|
|
@@ -2382,21 +2425,60 @@ function normalizeGitHubPullRequestEvent(deliveryId, body) {
|
|
|
2382
2425
|
};
|
|
2383
2426
|
}
|
|
2384
2427
|
|
|
2428
|
+
// src/handlers/github-webhook/pull-request-review-comment.ts
|
|
2429
|
+
import { z as z6 } from "zod";
|
|
2430
|
+
var pullRequestReviewCommentWebhookSchema = z6.object({
|
|
2431
|
+
action: z6.string(),
|
|
2432
|
+
comment: z6.object({
|
|
2433
|
+
body: z6.string(),
|
|
2434
|
+
user: z6.object({
|
|
2435
|
+
login: z6.string().optional()
|
|
2436
|
+
}).strip().optional()
|
|
2437
|
+
}).strip(),
|
|
2438
|
+
pull_request: z6.object({
|
|
2439
|
+
number: z6.number()
|
|
2440
|
+
}).strip(),
|
|
2441
|
+
repository: z6.object({
|
|
2442
|
+
full_name: z6.string().min(1)
|
|
2443
|
+
}).strip()
|
|
2444
|
+
}).strip();
|
|
2445
|
+
function normalizeGitHubPullRequestReviewCommentEvent(deliveryId, body) {
|
|
2446
|
+
const parsed = pullRequestReviewCommentWebhookSchema.safeParse(body);
|
|
2447
|
+
if (!parsed.success || parsed.data.action !== "created") {
|
|
2448
|
+
return void 0;
|
|
2449
|
+
}
|
|
2450
|
+
const eventType = "review_comment.created";
|
|
2451
|
+
const resource = gitHubPullRequestResource({
|
|
2452
|
+
pullRequestNumber: parsed.data.pull_request.number,
|
|
2453
|
+
repositoryFullName: parsed.data.repository.full_name
|
|
2454
|
+
});
|
|
2455
|
+
const author = parsed.data.comment.user?.login;
|
|
2456
|
+
return {
|
|
2457
|
+
eventKey: gitHubEventKey(deliveryId, eventType),
|
|
2458
|
+
eventType,
|
|
2459
|
+
occurredAtMs: Date.now(),
|
|
2460
|
+
provider: "github",
|
|
2461
|
+
resourceRef: resource.resourceRef,
|
|
2462
|
+
trustedSummary: `${resource.label} received an inline review comment${author ? ` from ${author}` : ""}.`,
|
|
2463
|
+
untrustedText: parsed.data.comment.body
|
|
2464
|
+
};
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2385
2467
|
// src/handlers/github-webhook/pull-request-review.ts
|
|
2386
|
-
import { z as
|
|
2387
|
-
var pullRequestReviewWebhookSchema =
|
|
2388
|
-
action:
|
|
2389
|
-
pull_request:
|
|
2390
|
-
number:
|
|
2468
|
+
import { z as z7 } from "zod";
|
|
2469
|
+
var pullRequestReviewWebhookSchema = z7.object({
|
|
2470
|
+
action: z7.string(),
|
|
2471
|
+
pull_request: z7.object({
|
|
2472
|
+
number: z7.number()
|
|
2391
2473
|
}),
|
|
2392
|
-
repository:
|
|
2393
|
-
full_name:
|
|
2474
|
+
repository: z7.object({
|
|
2475
|
+
full_name: z7.string().min(1)
|
|
2394
2476
|
}),
|
|
2395
|
-
review:
|
|
2396
|
-
body:
|
|
2397
|
-
state:
|
|
2398
|
-
user:
|
|
2399
|
-
login:
|
|
2477
|
+
review: z7.object({
|
|
2478
|
+
body: z7.string().optional().nullable(),
|
|
2479
|
+
state: z7.string(),
|
|
2480
|
+
user: z7.object({
|
|
2481
|
+
login: z7.string().optional()
|
|
2400
2482
|
}).optional()
|
|
2401
2483
|
})
|
|
2402
2484
|
});
|
|
@@ -2406,7 +2488,7 @@ function normalizeGitHubPullRequestReviewEvent(deliveryId, body) {
|
|
|
2406
2488
|
return void 0;
|
|
2407
2489
|
}
|
|
2408
2490
|
const reviewState = parsed.data.review.state.toUpperCase();
|
|
2409
|
-
const eventType = reviewState === "APPROVED" ? "review.approved" : reviewState === "CHANGES_REQUESTED" ? "review.changes_requested" : void 0;
|
|
2491
|
+
const eventType = reviewState === "APPROVED" ? "review.approved" : reviewState === "CHANGES_REQUESTED" ? "review.changes_requested" : reviewState === "COMMENTED" ? "review.commented" : void 0;
|
|
2410
2492
|
if (!eventType) {
|
|
2411
2493
|
return void 0;
|
|
2412
2494
|
}
|
|
@@ -2421,7 +2503,7 @@ function normalizeGitHubPullRequestReviewEvent(deliveryId, body) {
|
|
|
2421
2503
|
occurredAtMs: Date.now(),
|
|
2422
2504
|
provider: "github",
|
|
2423
2505
|
resourceRef: resource.resourceRef,
|
|
2424
|
-
trustedSummary: eventType === "review.approved" ? `${resource.label} was approved${reviewer ? ` by ${reviewer}` : ""}.` : `${resource.label} received requested changes${reviewer ? ` from ${reviewer}` : ""}.`,
|
|
2506
|
+
trustedSummary: eventType === "review.approved" ? `${resource.label} was approved${reviewer ? ` by ${reviewer}` : ""}.` : eventType === "review.changes_requested" ? `${resource.label} received requested changes${reviewer ? ` from ${reviewer}` : ""}.` : `${resource.label} received a review comment${reviewer ? ` from ${reviewer}` : ""}.`,
|
|
2425
2507
|
untrustedText: parsed.data.review.body ?? void 0
|
|
2426
2508
|
};
|
|
2427
2509
|
}
|
|
@@ -2457,6 +2539,20 @@ function normalizeGitHubResourceEvents(args) {
|
|
|
2457
2539
|
);
|
|
2458
2540
|
return event ? [event] : [];
|
|
2459
2541
|
}
|
|
2542
|
+
case "issue_comment": {
|
|
2543
|
+
const event = normalizeGitHubIssueCommentEvent(
|
|
2544
|
+
args.deliveryId,
|
|
2545
|
+
args.body
|
|
2546
|
+
);
|
|
2547
|
+
return event ? [event] : [];
|
|
2548
|
+
}
|
|
2549
|
+
case "pull_request_review_comment": {
|
|
2550
|
+
const event = normalizeGitHubPullRequestReviewCommentEvent(
|
|
2551
|
+
args.deliveryId,
|
|
2552
|
+
args.body
|
|
2553
|
+
);
|
|
2554
|
+
return event ? [event] : [];
|
|
2555
|
+
}
|
|
2460
2556
|
case "check_suite":
|
|
2461
2557
|
return normalizeGitHubCheckSuiteEvents(args.deliveryId, args.body);
|
|
2462
2558
|
default:
|
|
@@ -6913,14 +7009,14 @@ function registerVercelPluginTaskDevConsumer() {
|
|
|
6913
7009
|
}
|
|
6914
7010
|
|
|
6915
7011
|
// src/chat/services/subscribed-decision.ts
|
|
6916
|
-
import { z as
|
|
6917
|
-
var replyDecisionSchema =
|
|
6918
|
-
should_reply:
|
|
6919
|
-
should_unsubscribe:
|
|
7012
|
+
import { z as z8 } from "zod";
|
|
7013
|
+
var replyDecisionSchema = z8.object({
|
|
7014
|
+
should_reply: z8.boolean().describe("Whether Junior should respond to this thread message."),
|
|
7015
|
+
should_unsubscribe: z8.boolean().describe(
|
|
6920
7016
|
"Whether Junior should unsubscribe from this thread because the user clearly asked it to stop participating."
|
|
6921
7017
|
),
|
|
6922
|
-
confidence:
|
|
6923
|
-
reason:
|
|
7018
|
+
confidence: z8.number().min(0).max(1).describe("Classifier confidence from 0 to 1."),
|
|
7019
|
+
reason: z8.string().optional().describe("Short reason for the decision.")
|
|
6924
7020
|
}).strict();
|
|
6925
7021
|
var ROUTER_CONFIDENCE_THRESHOLD = 0.8;
|
|
6926
7022
|
var ROUTER_CLASSIFIER_MAX_TOKENS = 240;
|
|
@@ -8059,10 +8155,12 @@ function textPart(value) {
|
|
|
8059
8155
|
}
|
|
8060
8156
|
function messageText(message) {
|
|
8061
8157
|
const content = message.content;
|
|
8158
|
+
const unwrapTask = message.role === "user";
|
|
8159
|
+
const displayText = (text) => unwrapTask ? unwrapCurrentInstruction(text) ?? text : text;
|
|
8062
8160
|
if (!Array.isArray(content)) {
|
|
8063
|
-
return typeof content === "string" ? content : "";
|
|
8161
|
+
return typeof content === "string" ? displayText(content) : "";
|
|
8064
8162
|
}
|
|
8065
|
-
return content.map(textPart).filter(Boolean).join("\n").trim();
|
|
8163
|
+
return content.map(textPart).filter((text) => Boolean(text)).map(displayText).join("\n").trim();
|
|
8066
8164
|
}
|
|
8067
8165
|
function sanitizeText(text) {
|
|
8068
8166
|
return text.replace(
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Render the active user task in a stable prompt boundary. */
|
|
2
|
+
export declare function renderCurrentInstruction(instruction: string): string;
|
|
3
|
+
/** Read the exact body from a standalone current-task prompt boundary. */
|
|
4
|
+
export declare function extractCurrentInstructionBody(text: string): string | undefined;
|
|
5
|
+
/** Recover display text from the internal current-task prompt boundary. */
|
|
6
|
+
export declare function unwrapCurrentInstruction(text: string): string | undefined;
|
|
@@ -43,8 +43,7 @@ export declare function toObservablePromptPart(part: {
|
|
|
43
43
|
/** Truncate message text for log attributes. */
|
|
44
44
|
export declare function summarizeMessageText(text: string): string;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
* exists. Structured thread XML is already a top-level prompt block.
|
|
46
|
+
* Keep thread text separate from the canonical active task boundary.
|
|
48
47
|
*/
|
|
49
48
|
export declare function buildUserTurnText(userInput: string, conversationContext?: string): string;
|
|
50
49
|
/** Encode a non-image attachment as base64 XML for the prompt. */
|
|
@@ -13,6 +13,41 @@ import {
|
|
|
13
13
|
withSpan
|
|
14
14
|
} from "./chunk-KF7522P3.js";
|
|
15
15
|
|
|
16
|
+
// src/chat/xml.ts
|
|
17
|
+
function escapeXml(value) {
|
|
18
|
+
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// src/chat/current-instruction.ts
|
|
22
|
+
var CURRENT_INSTRUCTION_TAG = "current-instruction";
|
|
23
|
+
var CURRENT_INSTRUCTION_PATTERN = new RegExp(
|
|
24
|
+
`<${CURRENT_INSTRUCTION_TAG}>\\n([\\s\\S]*?)\\n</${CURRENT_INSTRUCTION_TAG}>`
|
|
25
|
+
);
|
|
26
|
+
var STANDALONE_CURRENT_INSTRUCTION_PATTERN = new RegExp(
|
|
27
|
+
`^<${CURRENT_INSTRUCTION_TAG}>\\n([\\s\\S]*?)\\n</${CURRENT_INSTRUCTION_TAG}>$`
|
|
28
|
+
);
|
|
29
|
+
function unescapeXml(value) {
|
|
30
|
+
return value.replaceAll(""", '"').replaceAll("'", "'").replaceAll(">", ">").replaceAll("<", "<").replaceAll("&", "&");
|
|
31
|
+
}
|
|
32
|
+
function renderCurrentInstruction(instruction) {
|
|
33
|
+
return [
|
|
34
|
+
`<${CURRENT_INSTRUCTION_TAG}>`,
|
|
35
|
+
escapeXml(instruction),
|
|
36
|
+
`</${CURRENT_INSTRUCTION_TAG}>`
|
|
37
|
+
].join("\n");
|
|
38
|
+
}
|
|
39
|
+
function extractCurrentInstructionBody(text) {
|
|
40
|
+
const match = text.match(STANDALONE_CURRENT_INSTRUCTION_PATTERN);
|
|
41
|
+
return match?.[1];
|
|
42
|
+
}
|
|
43
|
+
function unwrapCurrentInstruction(text) {
|
|
44
|
+
const match = text.match(CURRENT_INSTRUCTION_PATTERN);
|
|
45
|
+
if (!match) {
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
return unescapeXml(match[1]);
|
|
49
|
+
}
|
|
50
|
+
|
|
16
51
|
// src/chat/turn-context-tag.ts
|
|
17
52
|
var TURN_CONTEXT_TAG = "runtime-turn-context";
|
|
18
53
|
|
|
@@ -109,15 +144,14 @@ function renderThreadContextForPrompt(context) {
|
|
|
109
144
|
}
|
|
110
145
|
function buildUserTurnText(userInput, conversationContext) {
|
|
111
146
|
const trimmedContext = conversationContext?.trim();
|
|
147
|
+
const currentInstruction = renderCurrentInstruction(userInput);
|
|
112
148
|
if (!trimmedContext) {
|
|
113
|
-
return
|
|
149
|
+
return currentInstruction;
|
|
114
150
|
}
|
|
115
151
|
return [
|
|
116
152
|
renderThreadContextForPrompt(trimmedContext),
|
|
117
153
|
"",
|
|
118
|
-
|
|
119
|
-
userInput,
|
|
120
|
-
"</current-instruction>"
|
|
154
|
+
currentInstruction
|
|
121
155
|
].join("\n");
|
|
122
156
|
}
|
|
123
157
|
function encodeNonImageAttachmentForPrompt(attachment) {
|
|
@@ -857,6 +891,10 @@ function setSlackReactionConfig(overrides) {
|
|
|
857
891
|
|
|
858
892
|
export {
|
|
859
893
|
toOptionalTrimmed,
|
|
894
|
+
escapeXml,
|
|
895
|
+
renderCurrentInstruction,
|
|
896
|
+
extractCurrentInstructionBody,
|
|
897
|
+
unwrapCurrentInstruction,
|
|
860
898
|
TURN_CONTEXT_TAG,
|
|
861
899
|
getSessionIdentifiers,
|
|
862
900
|
isExecutionEscapeResponse,
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
getDefaultRedisStateAdapterFor,
|
|
6
6
|
getStateAdapter
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RUB77TGS.js";
|
|
8
8
|
import {
|
|
9
9
|
parseDestination,
|
|
10
10
|
sameDestination
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-C2PSUWK3.js";
|
|
12
12
|
import {
|
|
13
13
|
getChatConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-BU2AWPEN.js";
|
|
15
15
|
import {
|
|
16
16
|
parseStoredSlackRequester
|
|
17
17
|
} from "./chunk-IXTBFABZ.js";
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-G3E7SCME.js";
|
|
4
4
|
import {
|
|
5
5
|
getStateAdapter
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RUB77TGS.js";
|
|
7
7
|
import {
|
|
8
8
|
toOptionalTrimmed
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BU2AWPEN.js";
|
|
10
10
|
import {
|
|
11
11
|
pluginCatalogRuntime
|
|
12
12
|
} from "./chunk-BQ3ITJA6.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getConversationStore
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QTTTRBNB.js";
|
|
4
4
|
import {
|
|
5
5
|
SANDBOX_DATA_ROOT,
|
|
6
6
|
SANDBOX_WORKSPACE_ROOT,
|
|
@@ -9,15 +9,16 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
getConnectedStateContext,
|
|
11
11
|
getStateAdapter
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-RUB77TGS.js";
|
|
13
13
|
import {
|
|
14
14
|
parseDestination
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-C2PSUWK3.js";
|
|
16
16
|
import {
|
|
17
17
|
TURN_CONTEXT_TAG,
|
|
18
18
|
botConfig,
|
|
19
|
+
escapeXml,
|
|
19
20
|
getChatConfig
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-BU2AWPEN.js";
|
|
21
22
|
import {
|
|
22
23
|
parseRequester,
|
|
23
24
|
storedSlackRequesterSchema,
|
|
@@ -658,11 +659,6 @@ async function commitMessages(args) {
|
|
|
658
659
|
};
|
|
659
660
|
}
|
|
660
661
|
|
|
661
|
-
// src/chat/xml.ts
|
|
662
|
-
function escapeXml(value) {
|
|
663
|
-
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
664
|
-
}
|
|
665
|
-
|
|
666
662
|
// src/chat/prompt.ts
|
|
667
663
|
import fs from "fs";
|
|
668
664
|
import path from "path";
|
|
@@ -1651,7 +1647,7 @@ function buildTurnContextPrompt(params) {
|
|
|
1651
1647
|
const sections = [
|
|
1652
1648
|
`<${TURN_CONTEXT_TAG}>`,
|
|
1653
1649
|
TURN_CONTEXT_HEADER,
|
|
1654
|
-
"The current user instruction appears after this block in the same message.",
|
|
1650
|
+
"The current user instruction appears after this block in `<current-instruction>` in the same message.",
|
|
1655
1651
|
...runtimeSections,
|
|
1656
1652
|
`</${TURN_CONTEXT_TAG}>`
|
|
1657
1653
|
].filter((section) => Boolean(section));
|
|
@@ -2189,7 +2185,6 @@ export {
|
|
|
2189
2185
|
normalizeSlackStatusText,
|
|
2190
2186
|
splitSlackReplyText,
|
|
2191
2187
|
buildSlackOutputMessage,
|
|
2192
|
-
escapeXml,
|
|
2193
2188
|
JUNIOR_PERSONALITY,
|
|
2194
2189
|
buildPluginSystemPromptContributions,
|
|
2195
2190
|
buildSystemPrompt,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
isSnapshotMissingError,
|
|
11
11
|
resolveRuntimeDependencySnapshot,
|
|
12
12
|
runNonInteractiveCommand
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-FYPO4K7C.js";
|
|
14
14
|
import {
|
|
15
15
|
pluginTaskId,
|
|
16
16
|
pluginTaskParamsSchema,
|
|
@@ -22,7 +22,6 @@ import {
|
|
|
22
22
|
buildPluginSystemPromptContributions,
|
|
23
23
|
buildSystemPrompt,
|
|
24
24
|
buildTurnContextPrompt,
|
|
25
|
-
escapeXml,
|
|
26
25
|
getAgentTurnSessionRecord,
|
|
27
26
|
loadConnectedMcpProviders,
|
|
28
27
|
recordAuthorizationRequested,
|
|
@@ -31,7 +30,7 @@ import {
|
|
|
31
30
|
recordSubagentStarted,
|
|
32
31
|
recordToolExecutionStarted,
|
|
33
32
|
upsertAgentTurnSessionRecord
|
|
34
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-GY7L6VCT.js";
|
|
35
34
|
import {
|
|
36
35
|
createPluginEmbedder,
|
|
37
36
|
createPluginHookRunner,
|
|
@@ -42,14 +41,14 @@ import {
|
|
|
42
41
|
getPlugins,
|
|
43
42
|
getSlackToolContext,
|
|
44
43
|
resolveChannelCapabilities
|
|
45
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-UVNV67EC.js";
|
|
46
45
|
import {
|
|
47
46
|
createPluginLogger,
|
|
48
47
|
createPluginState
|
|
49
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-MTE5NRPJ.js";
|
|
50
49
|
import {
|
|
51
50
|
getDb
|
|
52
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-QTTTRBNB.js";
|
|
53
52
|
import {
|
|
54
53
|
SANDBOX_DATA_ROOT,
|
|
55
54
|
SANDBOX_SKILLS_ROOT,
|
|
@@ -60,7 +59,7 @@ import {
|
|
|
60
59
|
import {
|
|
61
60
|
acquireActiveLock,
|
|
62
61
|
getStateAdapter
|
|
63
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-RUB77TGS.js";
|
|
64
63
|
import {
|
|
65
64
|
SlackActionError,
|
|
66
65
|
downloadPrivateSlackFile,
|
|
@@ -71,7 +70,7 @@ import {
|
|
|
71
70
|
normalizeSlackConversationId,
|
|
72
71
|
parseDestination,
|
|
73
72
|
withSlackRetries
|
|
74
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-C2PSUWK3.js";
|
|
75
74
|
import {
|
|
76
75
|
GEN_AI_PROVIDER_NAME,
|
|
77
76
|
GEN_AI_SERVER_ADDRESS,
|
|
@@ -82,7 +81,9 @@ import {
|
|
|
82
81
|
completeObject,
|
|
83
82
|
completeText,
|
|
84
83
|
encodeNonImageAttachmentForPrompt,
|
|
84
|
+
escapeXml,
|
|
85
85
|
extractAssistantText,
|
|
86
|
+
extractCurrentInstructionBody,
|
|
86
87
|
getGatewayApiKey,
|
|
87
88
|
getPiGatewayApiKey,
|
|
88
89
|
getPiMessageRole,
|
|
@@ -98,13 +99,14 @@ import {
|
|
|
98
99
|
nextProviderRetry,
|
|
99
100
|
normalizeSlackEmojiName,
|
|
100
101
|
normalizeToolNameFromResult,
|
|
102
|
+
renderCurrentInstruction,
|
|
101
103
|
resolveGatewayModel,
|
|
102
104
|
stripRuntimeTurnContext,
|
|
103
105
|
summarizeMessageText,
|
|
104
106
|
toObservablePromptPart,
|
|
105
107
|
trimTrailingAssistantMessages,
|
|
106
108
|
upsertActiveSkill
|
|
107
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-BU2AWPEN.js";
|
|
108
110
|
import {
|
|
109
111
|
parseSlackThreadId,
|
|
110
112
|
resolveConversationPrivacy,
|
|
@@ -680,6 +682,7 @@ function markTurnFailed(args) {
|
|
|
680
682
|
// src/chat/respond.ts
|
|
681
683
|
import { Agent as Agent2 } from "@earendil-works/pi-agent-core";
|
|
682
684
|
import { THREAD_STATE_TTL_MS as THREAD_STATE_TTL_MS4 } from "chat";
|
|
685
|
+
import { z as z4 } from "zod";
|
|
683
686
|
|
|
684
687
|
// src/chat/capabilities/catalog.ts
|
|
685
688
|
var cachedCatalog;
|
|
@@ -10862,11 +10865,7 @@ function buildClassifierPrompt(args) {
|
|
|
10862
10865
|
);
|
|
10863
10866
|
}
|
|
10864
10867
|
}
|
|
10865
|
-
sections.push(
|
|
10866
|
-
"<current-instruction>",
|
|
10867
|
-
args.messageText.trim() || "[empty]",
|
|
10868
|
-
"</current-instruction>"
|
|
10869
|
-
);
|
|
10868
|
+
sections.push(renderCurrentInstruction(args.messageText.trim() || "[empty]"));
|
|
10870
10869
|
for (const block of args.currentTurnBlocks ?? []) {
|
|
10871
10870
|
const trimmed = block.trim();
|
|
10872
10871
|
if (!trimmed) {
|
|
@@ -12824,6 +12823,10 @@ function waitForAbortSettlement(promise, timeoutMs) {
|
|
|
12824
12823
|
}
|
|
12825
12824
|
var startupDiscoveryLogged = false;
|
|
12826
12825
|
var MAX_ROUTER_ATTACHMENT_PREVIEW_CHARS = 2e3;
|
|
12826
|
+
var legacyStoredTextPartSchema = z4.object({
|
|
12827
|
+
text: z4.string(),
|
|
12828
|
+
type: z4.literal("text")
|
|
12829
|
+
}).strict();
|
|
12827
12830
|
function buildOmittedImageAttachmentNotice(count) {
|
|
12828
12831
|
return [
|
|
12829
12832
|
"<omitted-image-attachments>",
|
|
@@ -12988,7 +12991,7 @@ function buildUserTurnInput(args) {
|
|
|
12988
12991
|
}
|
|
12989
12992
|
function buildSteeringPiMessage(message) {
|
|
12990
12993
|
const { userContentParts } = buildUserTurnInput({
|
|
12991
|
-
userTurnText: message.text,
|
|
12994
|
+
userTurnText: buildUserTurnText(message.text),
|
|
12992
12995
|
userAttachments: message.userAttachments,
|
|
12993
12996
|
omittedImageAttachmentCount: message.omittedImageAttachmentCount ?? 0
|
|
12994
12997
|
});
|
|
@@ -13006,11 +13009,45 @@ function withoutTrailingUncheckpointedUserPrompt(messages, userContentParts) {
|
|
|
13006
13009
|
if (lastMessage?.role !== "user") {
|
|
13007
13010
|
return messages;
|
|
13008
13011
|
}
|
|
13009
|
-
|
|
13012
|
+
const comparableLastMessage = stripRuntimeTurnContext([
|
|
13013
|
+
lastMessage
|
|
13014
|
+
])[0];
|
|
13015
|
+
if (!userPromptContentMatches(comparableLastMessage?.content, userContentParts)) {
|
|
13010
13016
|
return messages;
|
|
13011
13017
|
}
|
|
13012
13018
|
return messages.slice(0, -1);
|
|
13013
13019
|
}
|
|
13020
|
+
function userPromptContentMatches(storedContent, currentContent) {
|
|
13021
|
+
if (JSON.stringify(storedContent) === JSON.stringify(currentContent)) {
|
|
13022
|
+
return true;
|
|
13023
|
+
}
|
|
13024
|
+
if (!Array.isArray(storedContent)) {
|
|
13025
|
+
return false;
|
|
13026
|
+
}
|
|
13027
|
+
if (storedContent.length !== currentContent.length) {
|
|
13028
|
+
return false;
|
|
13029
|
+
}
|
|
13030
|
+
return storedContent.every((storedPart, index) => {
|
|
13031
|
+
const currentPart = currentContent[index];
|
|
13032
|
+
if (index === 0 && currentPart?.type === "text") {
|
|
13033
|
+
const legacyTextPart = legacyStoredTextPartSchema.safeParse(storedPart);
|
|
13034
|
+
if (legacyTextPart.success) {
|
|
13035
|
+
return legacyTextPartMatchesCurrentText(
|
|
13036
|
+
legacyTextPart.data.text,
|
|
13037
|
+
currentPart.text
|
|
13038
|
+
);
|
|
13039
|
+
}
|
|
13040
|
+
}
|
|
13041
|
+
return JSON.stringify(storedPart) === JSON.stringify(currentPart);
|
|
13042
|
+
});
|
|
13043
|
+
}
|
|
13044
|
+
function legacyTextPartMatchesCurrentText(storedText, currentText) {
|
|
13045
|
+
const storedInstructionBody = extractCurrentInstructionBody(storedText);
|
|
13046
|
+
if (storedInstructionBody !== void 0) {
|
|
13047
|
+
return renderCurrentInstruction(storedInstructionBody) === currentText;
|
|
13048
|
+
}
|
|
13049
|
+
return renderCurrentInstruction(storedText) === currentText;
|
|
13050
|
+
}
|
|
13014
13051
|
async function generateAssistantReply(messageText2, context) {
|
|
13015
13052
|
const conversationPrivacy = resolveConversationPrivacy({
|
|
13016
13053
|
channelId: context.correlation?.channelId,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseDestination,
|
|
3
3
|
sameDestination
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-C2PSUWK3.js";
|
|
5
5
|
import {
|
|
6
6
|
getChatConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BU2AWPEN.js";
|
|
8
8
|
import {
|
|
9
9
|
parseStoredSlackRequester
|
|
10
10
|
} from "./chunk-IXTBFABZ.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getStateAdapter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RUB77TGS.js";
|
|
4
4
|
import {
|
|
5
5
|
normalizeSlackConversationId
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-C2PSUWK3.js";
|
|
7
7
|
import {
|
|
8
8
|
parseSlackThreadId
|
|
9
9
|
} from "./chunk-DR75T7J3.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPluginLogger,
|
|
3
3
|
createPluginState
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MTE5NRPJ.js";
|
|
5
5
|
import {
|
|
6
6
|
getDb
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QTTTRBNB.js";
|
|
8
8
|
import {
|
|
9
9
|
SANDBOX_WORKSPACE_ROOT
|
|
10
10
|
} from "./chunk-G3E7SCME.js";
|
|
@@ -13,12 +13,12 @@ import {
|
|
|
13
13
|
isConversationScopedChannel,
|
|
14
14
|
isDmChannel,
|
|
15
15
|
normalizeSlackConversationId
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-C2PSUWK3.js";
|
|
17
17
|
import {
|
|
18
18
|
botConfig,
|
|
19
19
|
completeObject,
|
|
20
20
|
embedTexts
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-BU2AWPEN.js";
|
|
22
22
|
import {
|
|
23
23
|
isActorUserId,
|
|
24
24
|
parseActorUserId
|
package/dist/cli/chat.js
CHANGED
|
@@ -130,10 +130,10 @@ async function configureLocalChatPlugins(pluginSet) {
|
|
|
130
130
|
databaseModule
|
|
131
131
|
] = await Promise.all([
|
|
132
132
|
import("../plugins-PZMDS7AT.js"),
|
|
133
|
-
import("../agent-hooks-
|
|
133
|
+
import("../agent-hooks-AV7CHLUO.js"),
|
|
134
134
|
import("../catalog-runtime-XOD7YPRS.js"),
|
|
135
135
|
import("../validation-MBNJKWPQ.js"),
|
|
136
|
-
import("../db-
|
|
136
|
+
import("../db-S3HYBLUS.js")
|
|
137
137
|
]);
|
|
138
138
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
139
139
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
@@ -195,7 +195,7 @@ async function runPrompt(options, io, pluginSet) {
|
|
|
195
195
|
defaultStateAdapterForLocalChat();
|
|
196
196
|
await configureLocalChatPlugins(pluginSet);
|
|
197
197
|
const conversationId = newRunConversationId();
|
|
198
|
-
const { runLocalAgentTurn } = await import("../runner-
|
|
198
|
+
const { runLocalAgentTurn } = await import("../runner-IMQH6V2B.js");
|
|
199
199
|
const result = await runLocalAgentTurn(
|
|
200
200
|
{
|
|
201
201
|
conversationId,
|
|
@@ -219,7 +219,7 @@ async function runInteractive(io, pluginSet) {
|
|
|
219
219
|
defaultStateAdapterForLocalChat();
|
|
220
220
|
await configureLocalChatPlugins(pluginSet);
|
|
221
221
|
const conversationId = newRunConversationId();
|
|
222
|
-
const { runLocalAgentTurn } = await import("../runner-
|
|
222
|
+
const { runLocalAgentTurn } = await import("../runner-IMQH6V2B.js");
|
|
223
223
|
const rl = readline.createInterface({
|
|
224
224
|
input: io.input,
|
|
225
225
|
output: io.output,
|
package/dist/cli/plugins.js
CHANGED
|
@@ -10,17 +10,17 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
setPlugins,
|
|
12
12
|
validatePlugins
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-UVNV67EC.js";
|
|
14
14
|
import {
|
|
15
15
|
createPluginLogger
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-MTE5NRPJ.js";
|
|
17
17
|
import {
|
|
18
18
|
getDb
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-QTTTRBNB.js";
|
|
20
20
|
import "../chunk-G3E7SCME.js";
|
|
21
|
-
import "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
21
|
+
import "../chunk-RUB77TGS.js";
|
|
22
|
+
import "../chunk-C2PSUWK3.js";
|
|
23
|
+
import "../chunk-BU2AWPEN.js";
|
|
24
24
|
import "../chunk-DR75T7J3.js";
|
|
25
25
|
import {
|
|
26
26
|
loadAppPluginSet
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveRuntimeDependencySnapshot
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-FYPO4K7C.js";
|
|
4
4
|
import "../chunk-G3E7SCME.js";
|
|
5
5
|
import {
|
|
6
6
|
disconnectStateAdapter
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-RUB77TGS.js";
|
|
8
|
+
import "../chunk-BU2AWPEN.js";
|
|
9
9
|
import "../chunk-DR75T7J3.js";
|
|
10
10
|
import {
|
|
11
11
|
pluginCatalogRuntime
|
package/dist/cli/upgrade.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
recordConversationActivity,
|
|
5
5
|
recordConversationExecution,
|
|
6
6
|
requestConversationWork
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-EENOFKDN.js";
|
|
8
8
|
import {
|
|
9
9
|
JUNIOR_THREAD_STATE_TTL_MS,
|
|
10
10
|
coerceThreadConversationState
|
|
@@ -18,23 +18,23 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
createPluginLogger,
|
|
20
20
|
createPluginState
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-MTE5NRPJ.js";
|
|
22
22
|
import {
|
|
23
23
|
createJuniorSqlExecutor,
|
|
24
24
|
createSqlStore,
|
|
25
25
|
getDb
|
|
26
|
-
} from "../chunk-
|
|
26
|
+
} from "../chunk-QTTTRBNB.js";
|
|
27
27
|
import {
|
|
28
28
|
disconnectStateAdapter,
|
|
29
29
|
getConnectedStateContext
|
|
30
|
-
} from "../chunk-
|
|
30
|
+
} from "../chunk-RUB77TGS.js";
|
|
31
31
|
import {
|
|
32
32
|
parseDestination,
|
|
33
33
|
sameDestination
|
|
34
|
-
} from "../chunk-
|
|
34
|
+
} from "../chunk-C2PSUWK3.js";
|
|
35
35
|
import {
|
|
36
36
|
getChatConfig
|
|
37
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-BU2AWPEN.js";
|
|
38
38
|
import "../chunk-DR75T7J3.js";
|
|
39
39
|
import {
|
|
40
40
|
loadAppPluginSet
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
closeDb,
|
|
3
3
|
getConversationStore,
|
|
4
4
|
getDb
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-QTTTRBNB.js";
|
|
6
|
+
import "./chunk-C2PSUWK3.js";
|
|
7
|
+
import "./chunk-BU2AWPEN.js";
|
|
8
8
|
import "./chunk-DR75T7J3.js";
|
|
9
9
|
import "./chunk-IXTBFABZ.js";
|
|
10
10
|
import "./chunk-KF7522P3.js";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IngestResourceEventInput } from "@/chat/resource-events/ingest";
|
|
2
|
+
/** Normalize GitHub `issue_comment` webhooks for PR-level comments. */
|
|
3
|
+
export declare function normalizeGitHubIssueCommentEvent(deliveryId: string, body: unknown): IngestResourceEventInput | undefined;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IngestResourceEventInput } from "@/chat/resource-events/ingest";
|
|
2
|
+
/** Normalize GitHub `pull_request_review_comment` webhooks for inline PR comments. */
|
|
3
|
+
export declare function normalizeGitHubPullRequestReviewCommentEvent(deliveryId: string, body: unknown): IngestResourceEventInput | undefined;
|
package/dist/nitro.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveConversationWorkQueueTopic
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ENEWQMRJ.js";
|
|
4
4
|
import {
|
|
5
5
|
PLUGIN_TASK_QUEUE_TOPIC
|
|
6
6
|
} from "./chunk-KNFROR7R.js";
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
pluginCatalogConfigFromPluginSet,
|
|
9
9
|
pluginRuntimeRegistrationsFromPluginSet
|
|
10
10
|
} from "./chunk-SG5WAA7H.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-C2PSUWK3.js";
|
|
12
|
+
import "./chunk-BU2AWPEN.js";
|
|
13
13
|
import "./chunk-DR75T7J3.js";
|
|
14
14
|
import {
|
|
15
15
|
loadPluginSetFromModule,
|
package/dist/reporting.js
CHANGED
|
@@ -6,26 +6,28 @@ import {
|
|
|
6
6
|
getConversationDetails,
|
|
7
7
|
getConversationDetailsForIds,
|
|
8
8
|
resolveSlackConversationContextFromThreadId
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SSUEWAVS.js";
|
|
10
10
|
import {
|
|
11
11
|
buildSystemPrompt,
|
|
12
12
|
getAgentTurnSessionRecord,
|
|
13
13
|
listAgentTurnSessionSummariesForConversation,
|
|
14
14
|
loadActivityEntries
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GY7L6VCT.js";
|
|
16
16
|
import {
|
|
17
17
|
getPluginOperationalReports
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-UVNV67EC.js";
|
|
19
|
+
import "./chunk-MTE5NRPJ.js";
|
|
20
20
|
import {
|
|
21
21
|
getConversationStore
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-QTTTRBNB.js";
|
|
23
23
|
import "./chunk-G3E7SCME.js";
|
|
24
24
|
import {
|
|
25
25
|
getStateAdapter
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import
|
|
26
|
+
} from "./chunk-RUB77TGS.js";
|
|
27
|
+
import "./chunk-C2PSUWK3.js";
|
|
28
|
+
import {
|
|
29
|
+
unwrapCurrentInstruction
|
|
30
|
+
} from "./chunk-BU2AWPEN.js";
|
|
29
31
|
import {
|
|
30
32
|
canExposeConversationPayload,
|
|
31
33
|
parseSlackThreadId,
|
|
@@ -783,9 +785,10 @@ function recordField(value, names) {
|
|
|
783
785
|
}
|
|
784
786
|
return void 0;
|
|
785
787
|
}
|
|
786
|
-
function normalizeTranscriptPart(part) {
|
|
788
|
+
function normalizeTranscriptPart(part, options = {}) {
|
|
789
|
+
const displayText = (text) => options.unwrapCurrentTask ? unwrapCurrentInstruction(text) ?? text : text;
|
|
787
790
|
if (typeof part === "string") {
|
|
788
|
-
return textPart(part);
|
|
791
|
+
return textPart(displayText(part));
|
|
789
792
|
}
|
|
790
793
|
if (!isRecord(part)) {
|
|
791
794
|
return { type: "unknown", output: part };
|
|
@@ -794,7 +797,7 @@ function normalizeTranscriptPart(part) {
|
|
|
794
797
|
if (rawType === "text") {
|
|
795
798
|
const text = recordField(part, ["text", "content"]);
|
|
796
799
|
return textPart(
|
|
797
|
-
typeof text === "string" ? text : JSON.stringify(text) ?? ""
|
|
800
|
+
typeof text === "string" ? displayText(text) : JSON.stringify(text) ?? ""
|
|
798
801
|
);
|
|
799
802
|
}
|
|
800
803
|
if (rawType === "toolCall") {
|
|
@@ -851,7 +854,15 @@ function normalizeTranscriptMessage(message) {
|
|
|
851
854
|
return {
|
|
852
855
|
role,
|
|
853
856
|
...typeof record.timestamp === "number" ? { timestamp: record.timestamp } : {},
|
|
854
|
-
parts: role === "toolResult" ? [normalizeToolResultMessage(record)] : Array.isArray(content) ? content.map(
|
|
857
|
+
parts: role === "toolResult" ? [normalizeToolResultMessage(record)] : Array.isArray(content) ? content.map(
|
|
858
|
+
(part) => normalizeTranscriptPart(part, {
|
|
859
|
+
unwrapCurrentTask: role === "user"
|
|
860
|
+
})
|
|
861
|
+
) : [
|
|
862
|
+
normalizeTranscriptPart(content, {
|
|
863
|
+
unwrapCurrentTask: role === "user"
|
|
864
|
+
})
|
|
865
|
+
]
|
|
855
866
|
};
|
|
856
867
|
}
|
|
857
868
|
function transcriptRole(role) {
|
|
@@ -14,26 +14,26 @@ import {
|
|
|
14
14
|
startActiveTurn,
|
|
15
15
|
updateConversationStats,
|
|
16
16
|
upsertConversationMessage
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-MHEV3T2Y.js";
|
|
18
18
|
import {
|
|
19
19
|
coerceThreadConversationState
|
|
20
20
|
} from "./chunk-66NX7MNW.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-FYPO4K7C.js";
|
|
22
22
|
import "./chunk-KNFROR7R.js";
|
|
23
23
|
import {
|
|
24
24
|
commitMessages,
|
|
25
25
|
loadProjection
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
26
|
+
} from "./chunk-GY7L6VCT.js";
|
|
27
|
+
import "./chunk-UVNV67EC.js";
|
|
28
|
+
import "./chunk-MTE5NRPJ.js";
|
|
29
|
+
import "./chunk-QTTTRBNB.js";
|
|
30
30
|
import "./chunk-G3E7SCME.js";
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-RUB77TGS.js";
|
|
32
|
+
import "./chunk-C2PSUWK3.js";
|
|
33
33
|
import {
|
|
34
34
|
stripRuntimeTurnContext,
|
|
35
35
|
trimTrailingAssistantMessages
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-BU2AWPEN.js";
|
|
37
37
|
import "./chunk-DR75T7J3.js";
|
|
38
38
|
import "./chunk-64ACM6AP.js";
|
|
39
39
|
import "./chunk-BQ3ITJA6.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"pg": "^8.16.3",
|
|
71
71
|
"yaml": "^2.9.0",
|
|
72
72
|
"zod": "^4.4.3",
|
|
73
|
-
"@sentry/junior-plugin-api": "0.
|
|
73
|
+
"@sentry/junior-plugin-api": "0.85.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@emnapi/core": "^1.10.0",
|
|
@@ -86,10 +86,10 @@
|
|
|
86
86
|
"typescript": "^6.0.3",
|
|
87
87
|
"vercel": "^54.4.0",
|
|
88
88
|
"vitest": "^4.1.7",
|
|
89
|
-
"@sentry/junior-github": "0.
|
|
90
|
-
"@sentry/junior-
|
|
91
|
-
"@sentry/junior-memory": "0.
|
|
92
|
-
"@sentry/junior-
|
|
89
|
+
"@sentry/junior-github": "0.85.0",
|
|
90
|
+
"@sentry/junior-scheduler": "0.85.0",
|
|
91
|
+
"@sentry/junior-memory": "0.85.0",
|
|
92
|
+
"@sentry/junior-testing": "0.0.0"
|
|
93
93
|
},
|
|
94
94
|
"scripts": {
|
|
95
95
|
"build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",
|