@sentry/junior 0.294.0 → 0.296.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/{admin-vt8aSiCD.js → admin-z_lgDi-z.js} +2 -2
- package/dist/{agent-runner-DJu7w6mI.js → agent-runner-HoQiUKLL.js} +318 -199
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +5 -5
- package/dist/api.d.ts +1 -1
- package/dist/api.js +321 -331
- package/dist/{app--a5RLOrr.d.ts → app-C75Ft-A_.d.ts} +3 -3
- package/dist/app.d.ts +2 -2
- package/dist/app.js +33 -34
- package/dist/{automation-BM-OBsKW.js → automation-yJX3C7i3.js} +3 -3
- package/dist/{background-compaction-queue-D2j-0XkH.js → background-compaction-queue-Cre1wFt9.js} +7 -9
- package/dist/{briefs-JOAoCb6d.js → briefs-BXECHduJ.js} +3 -3
- package/dist/{catalog-runtime-CLMA9AXd.js → catalog-runtime-CpCmlD9L.js} +1 -1
- package/dist/cli/chat.d.ts +1 -1
- package/dist/cli/chat.js +15 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +2 -0
- 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 +4 -4
- package/dist/cli/upgrade.d.ts +2 -2
- package/dist/cli/upgrade.js +3 -3
- package/dist/{config-mIZeGEWv.js → config-CCPHvTqx.js} +59 -2
- package/dist/{connections-XhdVg7OR.js → connections-B5pWh8e2.js} +6 -6
- package/dist/{conversation-CDWejM4R.js → conversation-CMkSmi02.js} +2 -11
- package/dist/{conversation-pending-messages-Dh2tfbaw.js → conversation-feed-BVAOga0H.js} +27 -2
- package/dist/{conversation-privacy-C6h-X2cZ.js → conversation-privacy-CZD5soDW.js} +1 -1
- package/dist/{credential-sync-zigBlXS3.js → credential-sync-DwLkIvXI.js} +16 -15
- package/dist/{db-DV5AbcGM.d.ts → db-B3iyr_Or.d.ts} +6 -1
- package/dist/{db--xuNV7g6.js → db-C1M1y-bh.js} +64 -26
- package/dist/{executor-BItuRqAR.js → executor-DUSEwXaO.js} +16 -5
- package/dist/instrumentation.js +19 -2
- package/dist/{logging-Cb6MGvdt.js → logging-D0svFM8r.js} +2 -1
- package/dist/{message-BTGgSmaH.js → message-BFnIwKpx.js} +9 -9
- package/dist/nitro.d.ts +2 -2
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-Dvh1aOIi.js → oauth-callback-server-BXRtD6Fk.js} +2 -2
- package/dist/{oauth-relay-D6xxVywK.js → oauth-relay-CsfIazeF.js} +2 -1
- package/dist/{plugins-DtmjkTza.d.ts → plugins-B_0Cr0MO.d.ts} +0 -1
- package/dist/{projection-DLQgfO5N.js → projection-B6VS7kbo.js} +386 -108
- package/dist/{prompt-qp_LdxLX.js → prompt-CD11tfG8.js} +4 -4
- package/dist/{registry-MtwokaqW.js → registry-CHewwYEo.js} +3 -13
- package/dist/{resolve-BnJA0UNE.js → resolve-1owMH4qo.js} +3 -3
- package/dist/{result-ChL-1KyW.js → result-CEqQFrEf.js} +8 -8
- package/dist/{runner-BONN7Dp2.js → runner-BtWvJslp.js} +8 -8
- package/dist/{sandbox-egress-signals-nmlmI5Ab.js → sandbox-egress-signals-ByftwJVt.js} +1 -1
- package/dist/{schema-DgvcyJ1y.d.ts → schema-Ct1Zf2xy.d.ts} +66 -14
- package/dist/{schema-yr0ccDni.js → schema-D2iGyYIp.js} +24 -6
- package/dist/secrets-DebYU866.js +18 -0
- package/dist/{service-account-Bd0lBaGr.js → service-account-BZEuMKdo.js} +3 -3
- package/dist/{service-account-kio5nXSD.js → service-account-DLoeoHww.js} +42 -26
- package/dist/{session-stop-CeCXL3j9.js → session-stop-hYNTNpVf.js} +23 -778
- package/dist/{skills-e3DDNlKO.js → skills-DXgd5Inh.js} +3 -3
- package/dist/{spawn--cRxITWQ.js → spawn-YeqlNDv8.js} +5 -5
- package/dist/{adapter-DxLhJEnO.js → state-C3CbtD_m.js} +132 -2
- package/dist/{stop-Iai5N2PU.js → stop-Cze_pEL8.js} +351 -255
- package/dist/{store-C8LsaJwS.js → store-CZ9vqR4P.js} +3 -3
- package/dist/{task-runner-Dw7exu0-.js → task-runner-CMiNGsER.js} +275 -251
- package/dist/{turn-failure-response-BqTTx3XG.js → turn-failure-response-pXhZ2wMK.js} +12 -9
- package/dist/{validation-BrGahtnv.js → validation-Du7NdkOR.js} +1 -1
- package/dist/{version-Bdqhx8Qh.js → version-EN3Wnq-R.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-CjRFHR5U.js → viewer-Agxi_o5c.js} +3 -3
- package/dist/warmup-CY2ArYag.js +2017 -0
- package/dist/{work-BWBG1EGV.js → work-EA98F0ia.js} +11 -11
- package/dist/{worker-DAnBIVMs.js → worker-BALVdWbv.js} +6 -6
- package/migrations/0098_review_item_plugin_actions.sql +5 -0
- package/migrations/0099_conversation_last_message_at.sql +1 -0
- package/migrations/0100_automation_task_kind_repair.sql +48 -0
- package/migrations/0101_drop_legacy_columns.sql +12 -0
- package/migrations/meta/0098_snapshot.json +4490 -0
- package/migrations/meta/0099_snapshot.json +4720 -0
- package/migrations/meta/0100_snapshot.json +4496 -0
- package/migrations/meta/0101_snapshot.json +4496 -0
- package/migrations/meta/_journal.json +28 -0
- package/package.json +6 -5
- package/dist/assistant-reply-iTtEdDyc.js +0 -58
- package/dist/warmup-DuxCtzKC.js +0 -1039
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { h as logWarn } from "./logging-
|
|
2
|
+
import { h as logWarn } from "./logging-D0svFM8r.js";
|
|
3
3
|
import { s as skillRoots } from "./package-discovery-DJhGdS4c.js";
|
|
4
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
4
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-CpCmlD9L.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import * as z from "zod";
|
|
7
7
|
import fs from "node:fs/promises";
|
|
@@ -265,7 +265,7 @@ function isCommonEnvironmentVariable(name) {
|
|
|
265
265
|
function parseSkillInvocation(messageText, availableSkills) {
|
|
266
266
|
const trimmed = messageText.trim();
|
|
267
267
|
const escapePattern = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
268
|
-
for (const match of trimmed.matchAll(/(
|
|
268
|
+
for (const match of trimmed.matchAll(/(?<![\w$])\$([a-z0-9]+(?:-[a-z0-9]+)*)/gi)) {
|
|
269
269
|
const skillName = match[1]?.toLowerCase();
|
|
270
270
|
if (!skillName) continue;
|
|
271
271
|
if (isCommonEnvironmentVariable(skillName)) continue;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import {
|
|
4
|
-
import { A as juniorConversations } from "./executor-
|
|
5
|
-
import { en as AgentDepthLimitError, hn as toolInvocationDestination, mn as actorFromRun } from "./agent-runner-
|
|
6
|
-
import { n as createAndEnqueueAgentInvocation } from "./work-
|
|
2
|
+
import { n as botConfig } from "./config-CCPHvTqx.js";
|
|
3
|
+
import { O as conversationKindFromRow, o as getDb } from "./db-C1M1y-bh.js";
|
|
4
|
+
import { A as juniorConversations } from "./executor-DUSEwXaO.js";
|
|
5
|
+
import { en as AgentDepthLimitError, hn as toolInvocationDestination, mn as actorFromRun } from "./agent-runner-HoQiUKLL.js";
|
|
6
|
+
import { n as createAndEnqueueAgentInvocation } from "./work-EA98F0ia.js";
|
|
7
7
|
import { desc, eq, sql } from "drizzle-orm";
|
|
8
8
|
// src/chat/conversations/lineage.ts
|
|
9
9
|
/**
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { i as getChatConfig } from "./config-
|
|
1
|
+
import { i as getChatConfig } from "./config-CCPHvTqx.js";
|
|
2
|
+
import { h as logWarn } from "./logging-D0svFM8r.js";
|
|
2
3
|
import { t as ACTIVE_LOCK_TTL_MS } from "./locks-D-0h111u.js";
|
|
4
|
+
import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
|
|
3
5
|
import { createMemoryState } from "@chat-adapter/state-memory";
|
|
4
6
|
import { createRedisState } from "@chat-adapter/state-redis";
|
|
5
7
|
// src/chat/state/adapter.ts
|
|
@@ -253,4 +255,132 @@ async function disconnectStateAdapter() {
|
|
|
253
255
|
redisStateAdapter = void 0;
|
|
254
256
|
}
|
|
255
257
|
}
|
|
256
|
-
|
|
258
|
+
// src/chat/encryption/secret.ts
|
|
259
|
+
/**
|
|
260
|
+
* Encrypt secrets that Junior keeps at rest, such as provider credentials.
|
|
261
|
+
*
|
|
262
|
+
* AES-256-GCM with keys from `JUNIOR_ENCRYPTION_KEYS` (see `keyring.ts`).
|
|
263
|
+
* Each value is bound to a context, usually its storage key, and to its key
|
|
264
|
+
* id as additional authenticated data. A value copied to another key does not
|
|
265
|
+
* decrypt.
|
|
266
|
+
*
|
|
267
|
+
* New values use the active key. Any listed key decrypts. A value from a key
|
|
268
|
+
* that is not active reports `stale`, so its owner can save it again with the
|
|
269
|
+
* active key. A value that cannot be decrypted gives `UnreadableSecretError`:
|
|
270
|
+
* `unknown_key` when its key id is not listed, `invalid` when it is malformed,
|
|
271
|
+
* altered, or bound to another context.
|
|
272
|
+
*
|
|
273
|
+
* There is no per-value salt. The keys are random, not passwords, and each
|
|
274
|
+
* value has a random IV. The storage key in the AAD already names the
|
|
275
|
+
* identity that owns the value.
|
|
276
|
+
*
|
|
277
|
+
* Envelope: `jenc:v1:<keyId>:<iv>.<ciphertext>.<tag>` (base64url parts).
|
|
278
|
+
*/
|
|
279
|
+
const ENVELOPE_PREFIX = "jenc:v1:";
|
|
280
|
+
const ALGORITHM = "aes-256-gcm";
|
|
281
|
+
const IV_BYTES = 12;
|
|
282
|
+
const TAG_BYTES = 16;
|
|
283
|
+
/** A stored secret that cannot be decrypted with the configured keys. */
|
|
284
|
+
var UnreadableSecretError = class extends Error {
|
|
285
|
+
reason;
|
|
286
|
+
constructor(reason) {
|
|
287
|
+
super(reason === "unknown_key" ? "Stored secret was encrypted with a key that is not configured" : "Stored secret is malformed or failed authentication");
|
|
288
|
+
this.name = "UnreadableSecretError";
|
|
289
|
+
this.reason = reason;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
function additionalData(keyId, context) {
|
|
293
|
+
return Buffer.from(`${ENVELOPE_PREFIX}${keyId}\0${context}`, "utf8");
|
|
294
|
+
}
|
|
295
|
+
/** Check whether a stored value is an encryption envelope. */
|
|
296
|
+
function isEncryptedSecret(value) {
|
|
297
|
+
return typeof value === "string" && value.startsWith(ENVELOPE_PREFIX);
|
|
298
|
+
}
|
|
299
|
+
/** Encrypt one secret with the active key and bind it to `context`. */
|
|
300
|
+
function encryptSecret(plaintext, context, keyring = getChatConfig().encryption) {
|
|
301
|
+
const { id, key } = keyring.active;
|
|
302
|
+
const iv = randomBytes(IV_BYTES);
|
|
303
|
+
const cipher = createCipheriv(ALGORITHM, key, iv, { authTagLength: TAG_BYTES });
|
|
304
|
+
cipher.setAAD(additionalData(id, context));
|
|
305
|
+
const parts = [
|
|
306
|
+
iv,
|
|
307
|
+
Buffer.concat([cipher.update(plaintext, "utf8"), cipher.final()]),
|
|
308
|
+
cipher.getAuthTag()
|
|
309
|
+
].map((part) => part.toString("base64url"));
|
|
310
|
+
return `${ENVELOPE_PREFIX}${id}:${parts.join(".")}`;
|
|
311
|
+
}
|
|
312
|
+
/** Decrypt an `encryptSecret` envelope with the same `context`. */
|
|
313
|
+
function decryptSecret(envelope, context, keyring = getChatConfig().encryption) {
|
|
314
|
+
if (!isEncryptedSecret(envelope)) throw new Error("Stored secret is not an encryption envelope");
|
|
315
|
+
const [keyId, payload] = envelope.slice(8).split(":");
|
|
316
|
+
const [iv, ciphertext, tag] = (payload ?? "").split(".").map((part) => Buffer.from(part, "base64url"));
|
|
317
|
+
if (!keyId || !iv || iv.length !== IV_BYTES || !ciphertext || !tag || tag.length !== TAG_BYTES) throw new UnreadableSecretError("invalid");
|
|
318
|
+
const match = keyring.keys.find((candidate) => candidate.id === keyId);
|
|
319
|
+
if (!match) throw new UnreadableSecretError("unknown_key");
|
|
320
|
+
const decipher = createDecipheriv(ALGORITHM, match.key, iv, { authTagLength: TAG_BYTES });
|
|
321
|
+
decipher.setAAD(additionalData(keyId, context));
|
|
322
|
+
decipher.setAuthTag(tag);
|
|
323
|
+
let text;
|
|
324
|
+
try {
|
|
325
|
+
text = Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString("utf8");
|
|
326
|
+
} catch {
|
|
327
|
+
throw new UnreadableSecretError("invalid");
|
|
328
|
+
}
|
|
329
|
+
return {
|
|
330
|
+
stale: match.id !== keyring.active.id,
|
|
331
|
+
text
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
// src/chat/encryption/state.ts
|
|
335
|
+
/**
|
|
336
|
+
* Decrypt one stored envelope. The storage key is the encryption context.
|
|
337
|
+
* A value that cannot be decrypted, such as one from a key that is no longer
|
|
338
|
+
* configured or one that was altered, reads as missing. The owner then asks
|
|
339
|
+
* for the credential again and saves it with the active key.
|
|
340
|
+
*/
|
|
341
|
+
function decode(key, envelope) {
|
|
342
|
+
let decrypted;
|
|
343
|
+
try {
|
|
344
|
+
decrypted = decryptSecret(envelope, key);
|
|
345
|
+
} catch (error) {
|
|
346
|
+
if (!(error instanceof UnreadableSecretError)) throw error;
|
|
347
|
+
logWarn("encryption.secret_unreadable", { "error.type": error.reason });
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
return {
|
|
351
|
+
stale: decrypted.stale,
|
|
352
|
+
value: JSON.parse(decrypted.text)
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Wrap a state adapter so values are JSON-encoded and encrypted before they
|
|
357
|
+
* reach storage. Keys and TTLs stay readable. Use it for credentials and
|
|
358
|
+
* other secrets; delete, lock, and keep plain state on the base adapter.
|
|
359
|
+
*/
|
|
360
|
+
function createEncryptedState(state) {
|
|
361
|
+
return {
|
|
362
|
+
async get(key) {
|
|
363
|
+
const stored = await state.get(key);
|
|
364
|
+
if (!isEncryptedSecret(stored)) return void 0;
|
|
365
|
+
return decode(key, stored)?.value;
|
|
366
|
+
},
|
|
367
|
+
async set(key, value, ttlMs) {
|
|
368
|
+
await state.set(key, encryptSecret(JSON.stringify(value), key), ttlMs);
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Read a value and report whether it is stale: encrypted with a key that is
|
|
374
|
+
* not active, or saved before encryption. Long-lived owners save stale values
|
|
375
|
+
* again, so they move to the active key.
|
|
376
|
+
*/
|
|
377
|
+
async function readEncryptedState(state, key) {
|
|
378
|
+
const stored = await state.get(key);
|
|
379
|
+
if (stored === null || stored === void 0) return void 0;
|
|
380
|
+
if (!isEncryptedSecret(stored)) return {
|
|
381
|
+
stale: true,
|
|
382
|
+
value: stored
|
|
383
|
+
};
|
|
384
|
+
return decode(key, stored);
|
|
385
|
+
}
|
|
386
|
+
export { getStateAdapter as a, getDefaultRedisStateAdapterFor as i, readEncryptedState as n, getStateValues as o, disconnectStateAdapter as r, setStateValues as s, createEncryptedState as t };
|