@sentry/junior 0.306.0 → 0.307.1
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/{adapter-context-CnY-i32r.js → adapter-context-HrBTD8rJ.js} +2 -2
- package/dist/{admin-BLLdLnXh.js → admin-B78_KmfR.js} +2 -2
- package/dist/{agent-runner-BaLjEjPR.js → agent-runner-DxivxUYd.js} +226 -137
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +4 -4
- package/dist/api.d.ts +1 -1
- package/dist/api.js +328 -298
- package/dist/{app-DvYbM9UD.d.ts → app-EZur8cVC.d.ts} +12 -3
- package/dist/app.d.ts +2 -2
- package/dist/app.js +84 -44
- package/dist/background-compaction-queue-HlljT9ql.js +231 -0
- package/dist/{briefs-DvyzXfrF.js → briefs-DR8mp-TK.js} +2 -2
- package/dist/{catalog-runtime-B1R-nHd3.js → catalog-runtime-Se9idiDR.js} +1 -1
- package/dist/cli/chat.d.ts +1 -1
- package/dist/cli/chat.js +17 -16
- package/dist/cli/check.js +58 -48
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.d.ts +1 -1
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.d.ts +2 -2
- package/dist/cli/upgrade.js +3 -8
- package/dist/{config-DUD-zMvp.js → config-DY5c1E0l.js} +74 -38
- package/dist/{connections-CDhsqPcC.js → connections-C-SqzubG.js} +10 -8
- package/dist/{continue-in-slack-BXQizz9o.js → continue-in-slack-DNkrrWuQ.js} +5 -5
- package/dist/{conversation-privacy-YE54gMN8.js → conversation-privacy-CVj9vSrP.js} +1 -1
- package/dist/{conversation-turn-BzdmrHb0.js → conversation-turn-CkzrIfJ2.js} +19 -47
- package/dist/{credential-sync-Cdm-e1vJ.js → credential-sync-B9CIkgOT.js} +28 -28
- package/dist/{db-DV2ZUb1Y.js → db-C21CyyTE.js} +140 -11
- package/dist/{db-pH357Dkt.d.ts → db-C41UgdBj.d.ts} +1 -1
- package/dist/{executor-CjNhwwnj.js → executor-DfNoVVGd.js} +93 -32
- package/dist/{install-DbD7C5td.js → install-lYZs8UCL.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{lineage-BFdIPb3o.js → lineage-BJTSY53A.js} +2 -2
- package/dist/{logging-oYpJYr-S.js → logging-DjW7LjgJ.js} +1 -1
- package/dist/{message-BBPcMKJY.js → message-BPPZpdoZ.js} +8 -8
- package/dist/{model-input-DYYF3a8B.js → model-input-DKqiLFGa.js} +3 -3
- package/dist/nitro.d.ts +2 -2
- package/dist/nitro.js +12 -5
- package/dist/{oauth-callback-server-C7Q987su.js → oauth-callback-server-OJP8Y4Ca.js} +2 -2
- package/dist/{oauth-relay-DAmfVmJu.js → oauth-relay-KwDz41Z3.js} +1 -1
- package/dist/{plugins-B_0Cr0MO.d.ts → plugins-fBrz8PCV.d.ts} +2 -0
- package/dist/{projection-CWXDE0f6.js → projection-D47mlszd.js} +1112 -693
- package/dist/{prompt-P3eRqO8C.js → prompt-DuWH_YIb.js} +3 -3
- package/dist/{registry-1pzXmplY.js → registry-yht0oxq6.js} +19 -9
- package/dist/{resolve-n87oXY-d.js → resolve-gZ-hVMYl.js} +3 -3
- package/dist/{result-BmF9v9bv.js → result-CP99Ok0_.js} +13 -11
- package/dist/{runner-4j7ZsxP5.js → runner-eVlnUkY7.js} +9 -9
- package/dist/{sandbox-egress-signals-BRQI8HvT.js → sandbox-egress-signals-DZL_0lnG.js} +1 -1
- package/dist/{schedule-CHPWQn-x.js → schedule-BG1tEbRF.js} +34 -4
- package/dist/{schema-CVbIjrF3.d.ts → schema-CRXcj4fj.d.ts} +350 -143
- package/dist/{schema-D7iIEh6t.js → schema-D4jdesIu.js} +12 -4
- package/dist/{service-account-DzQiOmqa.js → service-account-CZneZHh7.js} +8 -6
- package/dist/{service-account-BDQ9xzta.js → service-account-tI3LBg2_.js} +3 -3
- package/dist/{session-stop-BQxgHR4X.js → session-stop-D3S7mSkX.js} +36 -23
- package/dist/{skills-CPf4vNuC.js → skills-Bm6uSO9V.js} +32 -28
- package/dist/{slack-conversation-unfurl-B1KEptUg.js → slack-conversation-unfurl-BeBvg3xU.js} +10 -10
- package/dist/{spawn-CjGddiAU.js → spawn-vhMAmLuh.js} +6 -6
- package/dist/{state-9wfj6aSD.js → state-3Yiy2FvP.js} +4 -4
- package/dist/{stop-CsQGuN5n.js → stop-Bh53GUoX.js} +146 -158
- package/dist/{store-Dz3YZ7gQ.js → store-BZJdHYR7.js} +5 -5
- package/dist/{background-compaction-queue-D2wzxtGU.js → task-queue-BEl5G38v.js} +164 -180
- package/dist/{task-runner-frzlUvFD.js → task-runner-C6Bujc6h.js} +11 -8
- package/dist/{thread-context-C4QuZlM8.js → thread-context-DxMQGGd_.js} +6 -6
- package/dist/{turn-session-routing-BXaubz2w.js → turn-session-routing-CmQY0T60.js} +24 -5
- package/dist/{turn-user-message-DNC0eRZ7.js → turn-user-message-Dfbr3Ud9.js} +3 -3
- package/dist/{users-XCCKn3xW.js → users-6rSdqXXk.js} +1 -1
- package/dist/{validation-L5fdjmFX.js → validation--hsjOLRL.js} +1 -1
- package/dist/{version-BFmuwgxP.js → version-9iMT25Hq.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-DKOeHpv3.js → viewer-De1vmuEA.js} +3 -3
- package/dist/{warmup-mTMIatCV.js → warmup-C0IblNtf.js} +596 -281
- package/dist/{web-message-id-CUaSiGme.js → web-message-id-BT8Mg8LL.js} +1 -1
- package/dist/{worker-Bz4KNxjI.js → worker-CiyRr2q7.js} +8 -7
- package/migrations/0115_automation_creator_slack_index.sql +1 -0
- package/migrations/0116_conversation_event_search.sql +25 -0
- package/migrations/0117_automation_last_run.sql +46 -0
- package/migrations/0118_automation_last_run_index.sql +1 -0
- package/migrations/0119_money_micro_usd.sql +29 -0
- package/migrations/0120_conversation_cost_micro_usd.sql +8 -0
- package/migrations/meta/0115_snapshot.json +5225 -0
- package/migrations/meta/0116_snapshot.json +5388 -0
- package/migrations/meta/0117_snapshot.json +5413 -0
- package/migrations/meta/0118_snapshot.json +5428 -0
- package/migrations/meta/0119_snapshot.json +5441 -0
- package/migrations/meta/0120_snapshot.json +5441 -0
- package/migrations/meta/_journal.json +42 -0
- package/package.json +10 -9
- package/dist/queue-7FSijgqG.js +0 -115
- package/dist/secrets-DHaJ5TTn.js +0 -18
- package/dist/task-queue-CFlrJguF.js +0 -89
|
@@ -806,6 +806,48 @@
|
|
|
806
806
|
"when": 1794825420550,
|
|
807
807
|
"tag": "0114_plan_items",
|
|
808
808
|
"breakpoints": true
|
|
809
|
+
},
|
|
810
|
+
{
|
|
811
|
+
"idx": 115,
|
|
812
|
+
"version": "7",
|
|
813
|
+
"when": 1794909660518,
|
|
814
|
+
"tag": "0115_automation_creator_slack_index",
|
|
815
|
+
"breakpoints": true
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
"idx": 116,
|
|
819
|
+
"version": "7",
|
|
820
|
+
"when": 1794921922374,
|
|
821
|
+
"tag": "0116_conversation_event_search",
|
|
822
|
+
"breakpoints": true
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
"idx": 117,
|
|
826
|
+
"version": "7",
|
|
827
|
+
"when": 1794933607046,
|
|
828
|
+
"tag": "0117_automation_last_run",
|
|
829
|
+
"breakpoints": true
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
"idx": 118,
|
|
833
|
+
"version": "7",
|
|
834
|
+
"when": 1794933647013,
|
|
835
|
+
"tag": "0118_automation_last_run_index",
|
|
836
|
+
"breakpoints": true
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
"idx": 119,
|
|
840
|
+
"version": "7",
|
|
841
|
+
"when": 1794949484361,
|
|
842
|
+
"tag": "0119_money_micro_usd",
|
|
843
|
+
"breakpoints": true
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
"idx": 120,
|
|
847
|
+
"version": "7",
|
|
848
|
+
"when": 1794949505801,
|
|
849
|
+
"tag": "0120_conversation_cost_micro_usd",
|
|
850
|
+
"breakpoints": true
|
|
809
851
|
}
|
|
810
852
|
]
|
|
811
853
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.307.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -64,10 +64,11 @@
|
|
|
64
64
|
"@logtape/logtape": "^2.1.1",
|
|
65
65
|
"@modelcontextprotocol/sdk": "1.32.0",
|
|
66
66
|
"@neondatabase/serverless": "^1.1.0",
|
|
67
|
-
"@sentry/junior-plugin-api": "0.
|
|
68
|
-
"@sentry/
|
|
69
|
-
"@sentry/
|
|
70
|
-
"@sentry/
|
|
67
|
+
"@sentry/junior-plugin-api": "0.307.1",
|
|
68
|
+
"@sentry/junior-search": "0.307.1",
|
|
69
|
+
"@sentry/nitro": "11.14.0",
|
|
70
|
+
"@sentry/node": "11.14.0",
|
|
71
|
+
"@sentry/server-utils": "11.14.0",
|
|
71
72
|
"@sinclair/typebox": "^0.34.49",
|
|
72
73
|
"@slack/types": "^2.21.1",
|
|
73
74
|
"@slack/web-api": "^7.16.0",
|
|
@@ -115,10 +116,10 @@
|
|
|
115
116
|
"@emnapi/core": "^1.10.0",
|
|
116
117
|
"@emnapi/runtime": "^1.10.0",
|
|
117
118
|
"@hono/node-server": "2.1.3",
|
|
118
|
-
"@sentry/junior-github": "0.
|
|
119
|
-
"@sentry/junior-memory": "0.
|
|
120
|
-
"@sentry/junior-notion": "0.
|
|
121
|
-
"@sentry/junior-sentry": "0.
|
|
119
|
+
"@sentry/junior-github": "0.307.1",
|
|
120
|
+
"@sentry/junior-memory": "0.307.1",
|
|
121
|
+
"@sentry/junior-notion": "0.307.1",
|
|
122
|
+
"@sentry/junior-sentry": "0.307.1",
|
|
122
123
|
"@sentry/junior-testing": "0.0.0",
|
|
123
124
|
"@types/node": "^24.19.2",
|
|
124
125
|
"@types/pg": "^8.15.6",
|
package/dist/queue-7FSijgqG.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { i as getChatConfig } from "./config-DUD-zMvp.js";
|
|
2
|
-
import { h as logWarn } from "./logging-oYpJYr-S.js";
|
|
3
|
-
import { a as queueCallback, d as verifyQueueMessage, f as getQueueProvider, l as QUEUE_SIGNATURE_MAX_AGE_MS, u as signQueueMessage } from "./background-compaction-queue-D2wzxtGU.js";
|
|
4
|
-
import * as z from "zod";
|
|
5
|
-
import { createHash } from "node:crypto";
|
|
6
|
-
// src/chat/sandbox/snapshot/job-queue.ts
|
|
7
|
-
/** Send Workspace snapshot build messages. */
|
|
8
|
-
const SIGNATURE_CONTEXT = "junior.workspace_snapshot_queue.v1";
|
|
9
|
-
const SIGNATURE_VERSION = "v1";
|
|
10
|
-
const WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC = "junior_workspace_snapshots";
|
|
11
|
-
const workspaceSnapshotJobSign = {
|
|
12
|
-
context: SIGNATURE_CONTEXT,
|
|
13
|
-
schema: z.object({
|
|
14
|
-
workspaceId: z.string().uuid(),
|
|
15
|
-
profileHash: z.string().min(1)
|
|
16
|
-
}).strict(),
|
|
17
|
-
signatureVersion: SIGNATURE_VERSION,
|
|
18
|
-
parts: (message) => [message.workspaceId, message.profileHash]
|
|
19
|
-
};
|
|
20
|
-
function jobId(message) {
|
|
21
|
-
return `workspace-snapshot_${createHash("sha256").update(message.workspaceId).update("\0").update(message.profileHash).digest("hex").slice(0, 32)}`;
|
|
22
|
-
}
|
|
23
|
-
/** Sign a Workspace snapshot job for tests and local checks. */
|
|
24
|
-
function signWorkspaceSnapshotJobMessage(message, nowMs = Date.now()) {
|
|
25
|
-
return signQueueMessage(workspaceSnapshotJobSign, message, nowMs);
|
|
26
|
-
}
|
|
27
|
-
/** Check that a recent queue message came from Junior. */
|
|
28
|
-
function verifyWorkspaceSnapshotJobMessage(value, nowMs = Date.now()) {
|
|
29
|
-
return verifyQueueMessage(workspaceSnapshotJobSign, value, nowMs);
|
|
30
|
-
}
|
|
31
|
-
async function send(message, idempotencyKey) {
|
|
32
|
-
const options = { retentionSeconds: QUEUE_SIGNATURE_MAX_AGE_MS / 1e3 };
|
|
33
|
-
if (idempotencyKey) options.idempotencyKey = idempotencyKey;
|
|
34
|
-
await getQueueProvider().send(WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, signWorkspaceSnapshotJobMessage(message), options);
|
|
35
|
-
}
|
|
36
|
-
/** Send a job unless the same Workspace build already has one. */
|
|
37
|
-
async function sendWorkspaceSnapshotJob(message) {
|
|
38
|
-
await send(message, jobId(message));
|
|
39
|
-
}
|
|
40
|
-
/** Send the next job for a Workspace build that is still running. */
|
|
41
|
-
async function sendNextWorkspaceSnapshotJob(message) {
|
|
42
|
-
await send(message);
|
|
43
|
-
}
|
|
44
|
-
// src/chat/cache-warming/queue.ts
|
|
45
|
-
/** Send and receive delayed cache warmup messages. */
|
|
46
|
-
/** Deploy topic name. Keep stable for Vercel queue wiring. */
|
|
47
|
-
const CACHE_WARMUP_QUEUE_TOPIC = "junior_cache_warmups";
|
|
48
|
-
const CACHE_WARMUP_DEV_CONSUMER_GROUP = "junior_cache_warmups_dev";
|
|
49
|
-
const cacheWarmupSign = {
|
|
50
|
-
context: "junior.cache_warmup_queue.v1",
|
|
51
|
-
schema: z.discriminatedUnion("kind", [z.object({
|
|
52
|
-
kind: z.literal("warmup"),
|
|
53
|
-
conversationId: z.string().min(1),
|
|
54
|
-
cycle: z.number().int().positive(),
|
|
55
|
-
generation: z.string().min(1),
|
|
56
|
-
cacheExpiresAtMs: z.number().int().positive()
|
|
57
|
-
}).strict(), z.object({
|
|
58
|
-
kind: z.literal("horizon"),
|
|
59
|
-
conversationId: z.string().min(1),
|
|
60
|
-
generation: z.string().min(1)
|
|
61
|
-
}).strict()]),
|
|
62
|
-
signatureVersion: "v1",
|
|
63
|
-
parts: (message) => [
|
|
64
|
-
message.kind,
|
|
65
|
-
message.conversationId,
|
|
66
|
-
message.generation,
|
|
67
|
-
message.kind === "warmup" ? String(message.cycle) : "",
|
|
68
|
-
message.kind === "warmup" ? String(message.cacheExpiresAtMs) : ""
|
|
69
|
-
]
|
|
70
|
-
};
|
|
71
|
-
/** Send a cache warming message that is delivered after `delayMs`. */
|
|
72
|
-
async function sendCacheWarmup(message, delayMs) {
|
|
73
|
-
await getQueueProvider().send(CACHE_WARMUP_QUEUE_TOPIC, signQueueMessage(cacheWarmupSign, message), {
|
|
74
|
-
delaySeconds: Math.max(0, Math.floor(delayMs / 1e3)),
|
|
75
|
-
retentionSeconds: message.kind === "warmup" ? Math.min(QUEUE_SIGNATURE_MAX_AGE_MS / 1e3, Math.ceil(Math.max(0, delayMs) / 1e3) + 120) : QUEUE_SIGNATURE_MAX_AGE_MS / 1e3,
|
|
76
|
-
idempotencyKey: `cache-warmup_${message.generation}_${message.kind === "warmup" ? message.cycle : message.kind}`
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
function logCacheWarmupRejected(reason, metadata, error) {
|
|
80
|
-
logWarn("cache_warming.queue_message.rejected", {
|
|
81
|
-
"app.queue.consumer_group": metadata.consumerGroup,
|
|
82
|
-
"app.queue.delivery_count": metadata.deliveryCount,
|
|
83
|
-
"app.queue.message_id": metadata.messageId,
|
|
84
|
-
"app.queue.reject_reason": reason,
|
|
85
|
-
"app.queue.topic_name": metadata.topicName,
|
|
86
|
-
...error instanceof Error ? { "exception.message": error.message } : void 0
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function cacheWarmupCallback() {
|
|
90
|
-
return queueCallback({
|
|
91
|
-
consumerGroup: CACHE_WARMUP_DEV_CONSUMER_GROUP,
|
|
92
|
-
maxDeliveries: 1,
|
|
93
|
-
onRejected: logCacheWarmupRejected,
|
|
94
|
-
run: async (message) => {
|
|
95
|
-
const { runCacheWarmup } = await import("./warmup-mTMIatCV.js").then((n) => n.s);
|
|
96
|
-
await runCacheWarmup(message);
|
|
97
|
-
},
|
|
98
|
-
skip: () => !getChatConfig().cacheWarmingEnabled,
|
|
99
|
-
topic: CACHE_WARMUP_QUEUE_TOPIC,
|
|
100
|
-
verify: (value) => verifyQueueMessage(cacheWarmupSign, value)
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
/** Create the HTTP route for cache warmup messages. */
|
|
104
|
-
function createVercelCacheWarmupCallback() {
|
|
105
|
-
return cacheWarmupCallback().create();
|
|
106
|
-
}
|
|
107
|
-
/** Return the queue consumer for cache warmups, for a pulling queue worker. */
|
|
108
|
-
function cacheWarmupQueueConsumer() {
|
|
109
|
-
return cacheWarmupCallback().consumer;
|
|
110
|
-
}
|
|
111
|
-
/** Receive cache warmup messages during local development. */
|
|
112
|
-
function registerVercelCacheWarmupDevConsumer() {
|
|
113
|
-
return cacheWarmupCallback().registerDev();
|
|
114
|
-
}
|
|
115
|
-
export { sendCacheWarmup as a, sendWorkspaceSnapshotJob as c, registerVercelCacheWarmupDevConsumer as i, verifyWorkspaceSnapshotJobMessage as l, cacheWarmupQueueConsumer as n, WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC as o, createVercelCacheWarmupCallback as r, sendNextWorkspaceSnapshotJob as s, CACHE_WARMUP_QUEUE_TOPIC as t };
|
package/dist/secrets-DHaJ5TTn.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// src/chat/secrets.ts
|
|
2
|
-
/** Read the server secret that signs internal tokens and payloads. */
|
|
3
|
-
function readJuniorSecret() {
|
|
4
|
-
return process.env["JUNIOR_SECRET"]?.trim() || void 0;
|
|
5
|
-
}
|
|
6
|
-
/** Read the raw dashboard session secret, with `JUNIOR_SECRET` as fallback. */
|
|
7
|
-
function readSignInSecret() {
|
|
8
|
-
return process.env["BETTER_AUTH_SECRET"] ?? process.env["JUNIOR_SECRET"];
|
|
9
|
-
}
|
|
10
|
-
/** Read the bearer secret that internal cron requests must send. */
|
|
11
|
-
function readSchedulerSecret() {
|
|
12
|
-
return process.env["JUNIOR_SCHEDULER_SECRET"]?.trim() || process.env["CRON_SECRET"]?.trim();
|
|
13
|
-
}
|
|
14
|
-
/** Read the VAPID private key that signs web push messages. */
|
|
15
|
-
function readWebPushPrivateKey() {
|
|
16
|
-
return process.env["JUNIOR_WEB_PUSH_PRIVATE_KEY"]?.trim();
|
|
17
|
-
}
|
|
18
|
-
export { readWebPushPrivateKey as i, readSchedulerSecret as n, readSignInSecret as r, readJuniorSecret as t };
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { h as logWarn } from "./logging-oYpJYr-S.js";
|
|
2
|
-
import { a as queueCallback, d as verifyQueueMessage, f as getQueueProvider, l as QUEUE_SIGNATURE_MAX_AGE_MS, u as signQueueMessage } from "./background-compaction-queue-D2wzxtGU.js";
|
|
3
|
-
import * as z from "zod";
|
|
4
|
-
import { createHash } from "node:crypto";
|
|
5
|
-
// src/chat/plugins/task-queue.ts
|
|
6
|
-
/**
|
|
7
|
-
* Delivery for plugin-registered tasks.
|
|
8
|
-
*
|
|
9
|
-
* Plugins register named tasks. This module owns the shared signed message,
|
|
10
|
-
* send path, and HTTP/local callback. Core keeps one topic and one runner.
|
|
11
|
-
*/
|
|
12
|
-
/** Deploy topic name. Keep stable for Vercel queue wiring. */
|
|
13
|
-
const PLUGIN_TASK_QUEUE_TOPIC = "junior_plugin_tasks";
|
|
14
|
-
const PLUGIN_TASK_DEV_CONSUMER_GROUP = "junior_plugin_tasks_dev";
|
|
15
|
-
const PLUGIN_TASK_MAX_DELIVERIES = 5;
|
|
16
|
-
const PLUGIN_TASK_SIGN_CONTEXT = "junior.plugin_task_queue.v1";
|
|
17
|
-
const PLUGIN_TASK_SIGN_VERSION = "v1";
|
|
18
|
-
const pluginTaskParamsSchema = z.object({
|
|
19
|
-
conversationId: z.string().min(1),
|
|
20
|
-
sessionId: z.string().min(1)
|
|
21
|
-
}).strict();
|
|
22
|
-
const pluginTaskSign = {
|
|
23
|
-
context: PLUGIN_TASK_SIGN_CONTEXT,
|
|
24
|
-
schema: z.object({
|
|
25
|
-
name: z.string().min(1),
|
|
26
|
-
params: pluginTaskParamsSchema,
|
|
27
|
-
plugin: z.string().min(1)
|
|
28
|
-
}).strict(),
|
|
29
|
-
signatureVersion: PLUGIN_TASK_SIGN_VERSION,
|
|
30
|
-
parts: (message) => [
|
|
31
|
-
message.plugin,
|
|
32
|
-
message.name,
|
|
33
|
-
message.params.conversationId,
|
|
34
|
-
message.params.sessionId
|
|
35
|
-
]
|
|
36
|
-
};
|
|
37
|
-
/** Build the stable id used for delivery dedupe and tracing. */
|
|
38
|
-
function pluginTaskId(args) {
|
|
39
|
-
return `plugin-task_${createHash("sha256").update(args.plugin).update("\0").update(args.name).update("\0").update(args.params.conversationId).update("\0").update(args.params.sessionId).digest("hex").slice(0, 32)}`;
|
|
40
|
-
}
|
|
41
|
-
/** Sign a plugin task message for tests and local checks. */
|
|
42
|
-
function signPluginTaskQueueMessage(message, nowMs = Date.now()) {
|
|
43
|
-
return signQueueMessage(pluginTaskSign, message, nowMs);
|
|
44
|
-
}
|
|
45
|
-
function verifyPluginTaskQueueMessage(value, nowMs = Date.now()) {
|
|
46
|
-
return verifyQueueMessage(pluginTaskSign, value, nowMs);
|
|
47
|
-
}
|
|
48
|
-
function logPluginTaskQueueMessageRejected(reason, metadata) {
|
|
49
|
-
logWarn("plugin.task.queue_message.rejected", {
|
|
50
|
-
"app.queue.consumer_group": metadata.consumerGroup,
|
|
51
|
-
"app.queue.delivery_count": metadata.deliveryCount,
|
|
52
|
-
"app.queue.message_id": metadata.messageId,
|
|
53
|
-
"app.queue.reject_reason": reason,
|
|
54
|
-
"app.queue.topic_name": metadata.topicName
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
function pluginTaskCallback() {
|
|
58
|
-
return queueCallback({
|
|
59
|
-
consumerGroup: PLUGIN_TASK_DEV_CONSUMER_GROUP,
|
|
60
|
-
maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
|
|
61
|
-
onRejected: logPluginTaskQueueMessageRejected,
|
|
62
|
-
run: async (message) => {
|
|
63
|
-
const { processPluginTask } = await import("./task-runner-frzlUvFD.js").then((n) => n.r);
|
|
64
|
-
await processPluginTask(message);
|
|
65
|
-
},
|
|
66
|
-
topic: PLUGIN_TASK_QUEUE_TOPIC,
|
|
67
|
-
verify: verifyPluginTaskQueueMessage
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
/** Send one plugin task through the shared signed delivery path. */
|
|
71
|
-
async function sendVercelPluginTask(message) {
|
|
72
|
-
await getQueueProvider().send(PLUGIN_TASK_QUEUE_TOPIC, signPluginTaskQueueMessage(message), {
|
|
73
|
-
idempotencyKey: pluginTaskId(message),
|
|
74
|
-
retentionSeconds: QUEUE_SIGNATURE_MAX_AGE_MS / 1e3
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
/** Create the HTTP callback for plugin tasks. */
|
|
78
|
-
function createVercelPluginTaskCallback() {
|
|
79
|
-
return pluginTaskCallback().create();
|
|
80
|
-
}
|
|
81
|
-
/** Return the queue consumer for plugin tasks, for a pulling queue worker. */
|
|
82
|
-
function pluginTaskQueueConsumer() {
|
|
83
|
-
return pluginTaskCallback().consumer;
|
|
84
|
-
}
|
|
85
|
-
/** Register the local-dev consumer for plugin tasks. */
|
|
86
|
-
function registerVercelPluginTaskDevConsumer() {
|
|
87
|
-
return pluginTaskCallback().registerDev();
|
|
88
|
-
}
|
|
89
|
-
export { pluginTaskQueueConsumer as a, pluginTaskParamsSchema as i, createVercelPluginTaskCallback as n, registerVercelPluginTaskDevConsumer as o, pluginTaskId as r, sendVercelPluginTask as s, PLUGIN_TASK_QUEUE_TOPIC as t };
|