@sentry/junior 0.84.0 → 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-XDS5DIVS.js → agent-hooks-AV7CHLUO.js} +7 -7
- package/dist/app.js +144 -46
- package/dist/{catalog-runtime-IVWRAPSI.js → catalog-runtime-XOD7YPRS.js} +2 -2
- package/dist/chat/current-instruction.d.ts +6 -0
- package/dist/chat/requester.d.ts +1 -1
- package/dist/chat/respond-helpers.d.ts +1 -2
- package/dist/{chunk-FAGWUF44.js → chunk-2TAIGJPQ.js} +1 -1
- package/dist/{chunk-WCXVEQPI.js → chunk-64ACM6AP.js} +1 -1
- package/dist/{chunk-TW23AT22.js → chunk-BQ3ITJA6.js} +1 -1
- package/dist/{chunk-ALL7GG6U.js → chunk-BU2AWPEN.js} +42 -4
- package/dist/{chunk-BAPRSWNW.js → chunk-C2PSUWK3.js} +1 -1
- package/dist/{chunk-S7SC5IUJ.js → chunk-EENOFKDN.js} +4 -4
- package/dist/{chunk-SBYMRDH7.js → chunk-ENEWQMRJ.js} +1 -1
- package/dist/{chunk-MZ4DUVFD.js → chunk-FYPO4K7C.js} +3 -3
- package/dist/{chunk-JUI6XIHU.js → chunk-GY7L6VCT.js} +7 -12
- package/dist/{chunk-ZPCGQRFJ.js → chunk-IXTBFABZ.js} +4 -5
- package/dist/{chunk-BFPOSIYV.js → chunk-MHEV3T2Y.js} +56 -19
- package/dist/{chunk-CWMMGUWM.js → chunk-MTE5NRPJ.js} +1 -1
- package/dist/{chunk-AAD2D7K3.js → chunk-QTTTRBNB.js} +3 -3
- package/dist/{chunk-MJ4E2PK7.js → chunk-RUB77TGS.js} +1 -1
- package/dist/{chunk-ZPD5YQFZ.js → chunk-SSUEWAVS.js} +3 -3
- package/dist/{chunk-KNVN4HUT.js → chunk-UVNV67EC.js} +5 -5
- package/dist/cli/chat.js +6 -6
- package/dist/cli/check.js +3 -3
- package/dist/cli/plugins.js +9 -9
- package/dist/cli/snapshot-warmup.js +5 -5
- package/dist/cli/upgrade.js +8 -8
- package/dist/{db-7RRWCYF3.js → db-S3HYBLUS.js} +4 -4
- 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 +26 -15
- package/dist/{runner-CJL5IKFO.js → runner-IMQH6V2B.js} +12 -12
- package/dist/{validation-TN6HMZAD.js → validation-MBNJKWPQ.js} +3 -3
- package/package.json +6 -6
|
@@ -11,15 +11,15 @@ 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
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-IXTBFABZ.js";
|
|
23
23
|
import "./chunk-KF7522P3.js";
|
|
24
24
|
import "./chunk-FTMXFBDC.js";
|
|
25
25
|
import "./chunk-3DA7X2U3.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,11 +126,11 @@ 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
|
|
134
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-2TAIGJPQ.js";
|
|
135
134
|
import {
|
|
136
135
|
defineJuniorPlugins,
|
|
137
136
|
pluginCatalogConfigFromEnv,
|
|
@@ -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,
|
|
@@ -200,13 +201,13 @@ import {
|
|
|
200
201
|
} from "./chunk-DR75T7J3.js";
|
|
201
202
|
import {
|
|
202
203
|
discoverSkills
|
|
203
|
-
} from "./chunk-
|
|
204
|
+
} from "./chunk-64ACM6AP.js";
|
|
204
205
|
import {
|
|
205
206
|
buildOAuthTokenRequest,
|
|
206
207
|
hasRequiredOAuthScope,
|
|
207
208
|
parseOAuthTokenResponse,
|
|
208
209
|
pluginCatalogRuntime
|
|
209
|
-
} from "./chunk-
|
|
210
|
+
} from "./chunk-BQ3ITJA6.js";
|
|
210
211
|
import {
|
|
211
212
|
createRequester,
|
|
212
213
|
createSlackRequester,
|
|
@@ -214,7 +215,7 @@ import {
|
|
|
214
215
|
isActorUserId,
|
|
215
216
|
parseActorUserId,
|
|
216
217
|
toStoredSlackRequester
|
|
217
|
-
} from "./chunk-
|
|
218
|
+
} from "./chunk-IXTBFABZ.js";
|
|
218
219
|
import {
|
|
219
220
|
homeDir
|
|
220
221
|
} from "./chunk-6APU57E6.js";
|
|
@@ -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;
|
package/dist/chat/requester.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export declare function createSlackRequester(teamId: string, userId: string, pro
|
|
|
59
59
|
export declare function parseStoredSlackRequester(value: unknown): StoredSlackRequester | undefined;
|
|
60
60
|
/** Convert a runtime Slack requester into its durable session shape. */
|
|
61
61
|
export declare function toStoredSlackRequester(requester: SlackRequester): StoredSlackRequester;
|
|
62
|
-
/** Resolve a Slack resume requester from stored
|
|
62
|
+
/** Resolve a Slack resume requester from stored profile data and the active actor. */
|
|
63
63
|
export declare function createSlackResumeRequester(args: {
|
|
64
64
|
requester?: Requester;
|
|
65
65
|
teamId: string;
|
|
@@ -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,17 +4,17 @@ 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
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-IXTBFABZ.js";
|
|
18
18
|
import {
|
|
19
19
|
isRecord,
|
|
20
20
|
toOptionalNumber,
|
|
@@ -3,13 +3,13 @@ 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
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-BQ3ITJA6.js";
|
|
13
13
|
import {
|
|
14
14
|
withSpan
|
|
15
15
|
} from "./chunk-KF7522P3.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,20 +9,21 @@ 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,
|
|
24
25
|
toStoredSlackRequester
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-IXTBFABZ.js";
|
|
26
27
|
import {
|
|
27
28
|
listReferenceFiles,
|
|
28
29
|
soulPathCandidates,
|
|
@@ -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,
|
|
@@ -157,11 +157,10 @@ function toStoredSlackRequester(requester) {
|
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
159
|
function createSlackResumeRequester(args) {
|
|
160
|
-
if (
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
throw new Error("Stored Slack requester did not match resume actor");
|
|
160
|
+
if (args.requester) {
|
|
161
|
+
if (args.requester.platform !== "slack" || args.requester.teamId !== args.teamId || args.requester.userId !== args.userId) {
|
|
162
|
+
throw new Error("Stored Slack requester did not match resume actor");
|
|
163
|
+
}
|
|
165
164
|
}
|
|
166
165
|
const requester = createRequester(args.requester, {
|
|
167
166
|
platform: "slack",
|