@sentry/junior 0.202.0 → 0.204.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-CMyTD4DD.js +17509 -0
- package/dist/agent-hooks-Bbcp9e33.js +4040 -0
- package/dist/agent-runner-DNb1A49M.js +678 -0
- package/dist/api/schema.d.ts +2728 -2639
- package/dist/api/schema.js +4 -169
- package/dist/api.d.ts +23 -17
- package/dist/api.js +3881 -5326
- package/dist/app-B1TOqBI8.d.ts +246 -0
- package/dist/app.d.ts +4 -520
- package/dist/app.js +9522 -11875
- package/dist/auth-pause-state-DosEalIG.js +168 -0
- package/dist/catalog-runtime-BReos-D4.js +7 -0
- package/dist/checkpoint-CNrPyRJN.js +2450 -0
- package/dist/cli/chat.d.ts +20 -0
- package/dist/cli/chat.js +229 -336
- package/dist/cli/check.d.ts +8 -0
- package/dist/cli/check.js +513 -806
- package/dist/cli/env.d.ts +13 -0
- package/dist/cli/env.js +63 -12
- package/dist/cli/init.d.ts +3 -0
- package/dist/cli/init.js +90 -159
- package/dist/cli/main.d.ts +6 -0
- package/dist/cli/main.js +43 -64
- package/dist/cli/plugins.d.ts +13 -0
- package/dist/cli/plugins.js +148 -227
- package/dist/cli/run.d.ts +16 -0
- package/dist/cli/run.js +52 -8
- package/dist/cli/snapshot-create.d.ts +4 -0
- package/dist/cli/snapshot-create.js +71 -125
- package/dist/cli/upgrade.d.ts +15 -0
- package/dist/cli/upgrade.js +232 -335
- package/dist/config-nGCW1OTG.js +941 -0
- package/dist/context-B45_WqVX.js +298 -0
- package/dist/conversation-privacy-B4voFRSm.js +182 -0
- package/dist/conversation-work-C6y3T5Hx.js +51 -0
- package/dist/credential-sync-kXr1hvO1.js +2660 -0
- package/dist/db-BeyXKJOI.d.ts +5 -0
- package/dist/destinations-BeBiJeEM.js +29 -0
- package/dist/execution-stats-DWfSihcH.js +373 -0
- package/dist/executor-DcMSlI5c.js +721 -0
- package/dist/experimental-CIXf7Uye.js +46 -0
- package/dist/history-ClE4toxe.d.ts +32 -0
- package/dist/history-CqTuSAdI.js +441 -0
- package/dist/instrumentation.d.ts +3 -3
- package/dist/instrumentation.js +130 -176
- package/dist/job-queue-Drn_LXlM.js +63 -0
- package/dist/logging-BzAk1S_s.js +1210 -0
- package/dist/model-profile-CZmVoGdX.js +49 -0
- package/dist/nitro.d.ts +31 -36
- package/dist/nitro.js +275 -456
- package/dist/oauth-callback-server-JiftokvA.js +130 -0
- package/dist/oauth-relay-CdCnu80W.js +62 -0
- package/dist/package-discovery-7a9YqLhE.js +455 -0
- package/dist/pending-auth-CWmSdZVg.js +185 -0
- package/dist/plugin-module-BKGOXca2.js +81 -0
- package/dist/plugins-BI9A1vKA.d.ts +95 -0
- package/dist/plugins-egKWjgue.js +99 -0
- package/dist/private-trace-result-BLvBjy_e.js +16 -0
- package/dist/profile-CrT5nXbw.js +861 -0
- package/dist/registry-DH1xUo2N.js +1419 -0
- package/dist/reporting-schema-DosTN__Q.js +105 -0
- package/dist/resolve-CZHnfxaS.js +546 -0
- package/dist/rolldown-runtime-B4FMCO8f.js +28 -0
- package/dist/runner-CZV2sC46.js +392 -0
- package/dist/sandbox-egress-signals-bHZfmhbd.js +46 -0
- package/dist/schema-Rn8-XEaN.js +1140 -0
- package/dist/sentry-CD3SdJl-.js +26 -0
- package/dist/skills-CIcDQSgM.js +316 -0
- package/dist/spawn-DdkUFRmq.js +29 -0
- package/dist/stats-DTUbAb88.js +2634 -0
- package/dist/store-C5qxF2ac.d.ts +208 -0
- package/dist/task-queue-CJIR4RF7.js +136 -0
- package/dist/task-runner-D-O3A-Cp.js +639 -0
- package/dist/thread-state-CRc9jTJS.js +431 -0
- package/dist/turn-execution-BkinIdJF.js +47 -0
- package/dist/turn-lifecycle-DQV19VTW.js +54 -0
- package/dist/usage-D3EbSO7w.js +296 -0
- package/dist/usage-schema-CKaDkH_j.js +20 -0
- package/dist/validation-C2CR-OX3.js +40 -0
- package/dist/vercel-queue-DIkVcfK4.js +167 -0
- package/dist/vercel.d.ts +6 -6
- package/dist/vercel.js +14 -6
- package/dist/version-CnXZ614E.d.ts +5 -0
- package/dist/version-DxcWdoKa.js +8 -0
- package/dist/version.d.ts +2 -4
- package/dist/version.js +2 -6
- package/dist/web-authorization-RMBxAR_t.js +76 -0
- package/dist/web-input-3EPfpf55.js +494 -0
- package/dist/work-fGofI7Op.js +509 -0
- package/dist/worker-CsOLq-mR.js +625 -0
- package/package.json +9 -9
- package/dist/agent-hooks-UXITLYOK.js +0 -51
- package/dist/catalog-runtime-BG3JLLK2.js +0 -14
- package/dist/chunk-2LYHWMR4.js +0 -46
- package/dist/chunk-2MK3QBGA.js +0 -321
- package/dist/chunk-3PGQSKJV.js +0 -692
- package/dist/chunk-3UI3WFTX.js +0 -519
- package/dist/chunk-3Y47VMHV.js +0 -6
- package/dist/chunk-4UO6FK4G.js +0 -64
- package/dist/chunk-5NOPO64K.js +0 -198
- package/dist/chunk-5PKWYPFT.js +0 -2943
- package/dist/chunk-63NKKFJL.js +0 -1228
- package/dist/chunk-6AYH6252.js +0 -787
- package/dist/chunk-6Y5B5PEX.js +0 -80
- package/dist/chunk-7DHZP5KJ.js +0 -333
- package/dist/chunk-7H2VZTWN.js +0 -103
- package/dist/chunk-7NL7T6VU.js +0 -406
- package/dist/chunk-A76OIMYN.js +0 -102
- package/dist/chunk-AWMS3SPP.js +0 -58
- package/dist/chunk-B3LY5RCL.js +0 -229
- package/dist/chunk-BD2KT3OB.js +0 -36
- package/dist/chunk-BXCX5QKA.js +0 -2086
- package/dist/chunk-C6VVF43U.js +0 -81
- package/dist/chunk-CEMMLV5L.js +0 -98
- package/dist/chunk-CM5HNV2W.js +0 -131
- package/dist/chunk-DA2KGZZI.js +0 -13
- package/dist/chunk-DBVY6HLX.js +0 -64
- package/dist/chunk-DIB4GX3G.js +0 -8
- package/dist/chunk-DKIJ2RP5.js +0 -68
- package/dist/chunk-DL2KLKVH.js +0 -931
- package/dist/chunk-DWPN6SCH.js +0 -172
- package/dist/chunk-ELWOYVOY.js +0 -206
- package/dist/chunk-EWT7H65X.js +0 -506
- package/dist/chunk-FA6POGLH.js +0 -70
- package/dist/chunk-HMREVIO2.js +0 -135
- package/dist/chunk-IIWUT4FO.js +0 -820
- package/dist/chunk-JAL3CH4G.js +0 -27
- package/dist/chunk-JSJQEWBJ.js +0 -3295
- package/dist/chunk-KHKKHDLD.js +0 -387
- package/dist/chunk-LA6R4A7Q.js +0 -706
- package/dist/chunk-LOOU2DUR.js +0 -20428
- package/dist/chunk-M6FHWXE3.js +0 -700
- package/dist/chunk-M76HMB7M.js +0 -1856
- package/dist/chunk-MAGNK5J4.js +0 -1520
- package/dist/chunk-MTM5IFCY.js +0 -1190
- package/dist/chunk-N7TMSOZH.js +0 -235
- package/dist/chunk-NHJU2ZAL.js +0 -56
- package/dist/chunk-NSXKRGRT.js +0 -717
- package/dist/chunk-OWMPFXJA.js +0 -1764
- package/dist/chunk-PDO5BLNM.js +0 -22
- package/dist/chunk-PEQXYSSE.js +0 -45
- package/dist/chunk-PW4P4JYF.js +0 -1135
- package/dist/chunk-QB54UQUS.js +0 -320
- package/dist/chunk-QP3OGJXF.js +0 -105
- package/dist/chunk-RC745GGZ.js +0 -122
- package/dist/chunk-REOIRYPR.js +0 -37
- package/dist/chunk-SCOZRLZ4.js +0 -164
- package/dist/chunk-TXJSXBV5.js +0 -1433
- package/dist/chunk-TXKUKMVO.js +0 -417
- package/dist/chunk-U2GPUYAL.js +0 -3656
- package/dist/chunk-UIE3R5XU.js +0 -17
- package/dist/chunk-UXPG6ZIN.js +0 -84
- package/dist/chunk-VFUK3X5B.js +0 -50
- package/dist/chunk-WQSHDTTI.js +0 -1163
- package/dist/chunk-X6GDDWQH.js +0 -60
- package/dist/chunk-Y2CM7HXH.js +0 -111
- package/dist/chunk-Y7X25LFY.js +0 -15
- package/dist/chunk-YDUR3ZYW.js +0 -10
- package/dist/conversation-work-VIOQ5ZF3.js +0 -54
- package/dist/db-3L2MCVRI.js +0 -26
- package/dist/discovery-DWVDM7UK.js +0 -44
- package/dist/experimental-P5FZM4CU.js +0 -12
- package/dist/oauth-callback-server-YVV6C6T2.js +0 -243
- package/dist/oauth-relay-5XPVRPYB.js +0 -8
- package/dist/plugins-YTYJMMJF.js +0 -14
- package/dist/runner-LQ7RETDP.js +0 -522
- package/dist/sandbox-egress-signals-FIL7EGPR.js +0 -73
- package/dist/sentry-MB3NL3IR.js +0 -42
- package/dist/skills-XRWYEDCD.js +0 -27
- package/dist/spawn-RC6SJUAI.js +0 -42
- package/dist/task-runner-7DY7ARYH.js +0 -36
- package/dist/validation-7MNQGCJA.js +0 -17
- package/dist/work-COALHUCG.js +0 -51
- package/dist/worker-6MURZIPD.js +0 -24
package/dist/chunk-C6VVF43U.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
pluginCatalogRuntime
|
|
3
|
-
} from "./chunk-YDUR3ZYW.js";
|
|
4
|
-
|
|
5
|
-
// src/chat/plugins/validation.ts
|
|
6
|
-
import { isDeepStrictEqual } from "util";
|
|
7
|
-
function validatePluginRegistrations(registrations) {
|
|
8
|
-
const loadedPlugins = new Map(
|
|
9
|
-
pluginCatalogRuntime.getProviders().map((plugin) => [plugin.manifest.name, plugin])
|
|
10
|
-
);
|
|
11
|
-
for (const registration of registrations) {
|
|
12
|
-
const loadedPlugin = loadedPlugins.get(registration.manifest.name);
|
|
13
|
-
if (!loadedPlugin) {
|
|
14
|
-
throw new Error(
|
|
15
|
-
`Plugin registration "${registration.manifest.name}" does not have a matching plugin manifest. Add an inline manifest, packageName, or app-local plugin.yaml with the same name.`
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
const effectiveRegistrationManifest = pluginCatalogRuntime.parseConfiguredInlineManifest(
|
|
19
|
-
registration.manifest,
|
|
20
|
-
loadedPlugin.dir
|
|
21
|
-
);
|
|
22
|
-
if (!isDeepStrictEqual(effectiveRegistrationManifest, loadedPlugin.manifest)) {
|
|
23
|
-
throw new Error(
|
|
24
|
-
`Plugin registration "${registration.manifest.name}" manifest does not match the loaded plugin manifest. Use one canonical manifest source for runtime hook plugins.`
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function validatePluginEgressCredentialHooks(registrations) {
|
|
30
|
-
const plugins = new Map(
|
|
31
|
-
registrations.map((registration) => [
|
|
32
|
-
registration.manifest.name,
|
|
33
|
-
registration
|
|
34
|
-
])
|
|
35
|
-
);
|
|
36
|
-
for (const provider of pluginCatalogRuntime.getProviders()) {
|
|
37
|
-
const hooks = plugins.get(provider.manifest.name)?.hooks;
|
|
38
|
-
const hasGrantHook = Boolean(hooks?.grantForEgress);
|
|
39
|
-
const hasIssueHook = Boolean(hooks?.issueCredential);
|
|
40
|
-
const hasGenericCredentials = Boolean(
|
|
41
|
-
provider.manifest.credentials || provider.manifest.apiHeaders
|
|
42
|
-
);
|
|
43
|
-
const hasDomains = Boolean(provider.manifest.domains?.length);
|
|
44
|
-
const hasHookManagedOAuth = Boolean(
|
|
45
|
-
provider.manifest.oauth && !provider.manifest.credentials
|
|
46
|
-
);
|
|
47
|
-
if (!hasGrantHook && !hasIssueHook) {
|
|
48
|
-
if (hasDomains && !hasGenericCredentials) {
|
|
49
|
-
throw new Error(
|
|
50
|
-
`Plugin "${provider.manifest.name}" manifest.domains requires egress credential hooks when no generic credentials or apiHeaders are configured.`
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
if (hasHookManagedOAuth) {
|
|
54
|
-
throw new Error(
|
|
55
|
-
`Plugin "${provider.manifest.name}" manifest.oauth without oauth-bearer credentials requires egress credential hooks.`
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
if (!hasGrantHook || !hasIssueHook) {
|
|
61
|
-
throw new Error(
|
|
62
|
-
`Plugin "${provider.manifest.name}" egress credential hooks must include both grantForEgress and issueCredential.`
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
if (hasGenericCredentials) {
|
|
66
|
-
throw new Error(
|
|
67
|
-
`Plugin "${provider.manifest.name}" egress credential hooks must use manifest.domains instead of generic credentials or apiHeaders.`
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
if (!hasDomains) {
|
|
71
|
-
throw new Error(
|
|
72
|
-
`Plugin "${provider.manifest.name}" egress credential hooks require manifest.domains to list sandbox egress hosts.`
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export {
|
|
79
|
-
validatePluginRegistrations,
|
|
80
|
-
validatePluginEgressCredentialHooks
|
|
81
|
-
};
|
package/dist/chunk-CEMMLV5L.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
parseActorUserId
|
|
3
|
-
} from "./chunk-N7TMSOZH.js";
|
|
4
|
-
|
|
5
|
-
// src/chat/credentials/context.ts
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
var exactActorIdSchema = z.string().refine((value) => parseActorUserId(value) === value);
|
|
8
|
-
var exactNonBlankStringSchema = z.string().min(1).refine((value) => value === value.trim());
|
|
9
|
-
var slackDirectCredentialSubjectBindingSchema = z.object({
|
|
10
|
-
type: z.literal("slack-direct-conversation"),
|
|
11
|
-
teamId: z.string().min(1),
|
|
12
|
-
channelId: z.string().min(1),
|
|
13
|
-
signature: z.string().min(1)
|
|
14
|
-
}).strict();
|
|
15
|
-
var scheduledTaskCredentialSubjectBindingSchema = z.object({
|
|
16
|
-
type: z.literal("scheduled-task"),
|
|
17
|
-
plugin: z.string().min(1),
|
|
18
|
-
taskId: exactNonBlankStringSchema,
|
|
19
|
-
signature: z.string().min(1)
|
|
20
|
-
}).strict();
|
|
21
|
-
var eventTaskCredentialSubjectBindingSchema = z.object({
|
|
22
|
-
type: z.literal("event-task"),
|
|
23
|
-
plugin: z.string().min(1),
|
|
24
|
-
taskId: exactNonBlankStringSchema,
|
|
25
|
-
signature: z.string().min(1)
|
|
26
|
-
}).strict();
|
|
27
|
-
var credentialSubjectBindingSchema = z.discriminatedUnion("type", [
|
|
28
|
-
slackDirectCredentialSubjectBindingSchema,
|
|
29
|
-
scheduledTaskCredentialSubjectBindingSchema,
|
|
30
|
-
eventTaskCredentialSubjectBindingSchema
|
|
31
|
-
]);
|
|
32
|
-
var credentialUserActorSchema = z.object({
|
|
33
|
-
type: z.literal("user"),
|
|
34
|
-
userId: exactActorIdSchema
|
|
35
|
-
}).strict();
|
|
36
|
-
var credentialSystemActorSchema = z.object({
|
|
37
|
-
platform: z.literal("system"),
|
|
38
|
-
name: exactActorIdSchema
|
|
39
|
-
}).strict();
|
|
40
|
-
var credentialSubjectSchema = z.discriminatedUnion("allowedWhen", [
|
|
41
|
-
z.object({
|
|
42
|
-
type: z.literal("user"),
|
|
43
|
-
userId: exactActorIdSchema,
|
|
44
|
-
allowedWhen: z.literal("private-direct-conversation"),
|
|
45
|
-
binding: slackDirectCredentialSubjectBindingSchema
|
|
46
|
-
}).strict(),
|
|
47
|
-
z.object({
|
|
48
|
-
type: z.literal("user"),
|
|
49
|
-
userId: exactActorIdSchema,
|
|
50
|
-
allowedWhen: z.literal("scheduled-task"),
|
|
51
|
-
taskId: exactNonBlankStringSchema,
|
|
52
|
-
binding: scheduledTaskCredentialSubjectBindingSchema
|
|
53
|
-
}).strict().refine((subject) => subject.binding.taskId === subject.taskId, {
|
|
54
|
-
message: "Scheduled task credential subject requires task binding",
|
|
55
|
-
path: ["binding"]
|
|
56
|
-
}),
|
|
57
|
-
z.object({
|
|
58
|
-
type: z.literal("user"),
|
|
59
|
-
userId: exactActorIdSchema,
|
|
60
|
-
allowedWhen: z.literal("event-task"),
|
|
61
|
-
taskId: exactNonBlankStringSchema,
|
|
62
|
-
binding: eventTaskCredentialSubjectBindingSchema
|
|
63
|
-
}).strict().refine((subject) => subject.binding.taskId === subject.taskId, {
|
|
64
|
-
message: "Event task credential subject requires task binding",
|
|
65
|
-
path: ["binding"]
|
|
66
|
-
})
|
|
67
|
-
]);
|
|
68
|
-
var credentialContextSchema = z.union([
|
|
69
|
-
z.object({
|
|
70
|
-
actor: credentialUserActorSchema
|
|
71
|
-
}).strict(),
|
|
72
|
-
z.object({
|
|
73
|
-
actor: credentialSystemActorSchema,
|
|
74
|
-
subject: credentialSubjectSchema.optional()
|
|
75
|
-
}).strict()
|
|
76
|
-
]);
|
|
77
|
-
function credentialContextForActor(actor, subject) {
|
|
78
|
-
if (actor.platform === "system") {
|
|
79
|
-
return subject ? { actor, subject } : { actor };
|
|
80
|
-
}
|
|
81
|
-
if (subject) {
|
|
82
|
-
throw new TypeError("Delegated credential subjects require a system actor");
|
|
83
|
-
}
|
|
84
|
-
return { actor: { type: "user", userId: actor.userId } };
|
|
85
|
-
}
|
|
86
|
-
function credentialUserSubjectId(context) {
|
|
87
|
-
if ("type" in context.actor) {
|
|
88
|
-
return context.actor.userId;
|
|
89
|
-
}
|
|
90
|
-
return "subject" in context ? context.subject?.userId : void 0;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export {
|
|
94
|
-
credentialSubjectSchema,
|
|
95
|
-
credentialContextSchema,
|
|
96
|
-
credentialContextForActor,
|
|
97
|
-
credentialUserSubjectId
|
|
98
|
-
};
|
package/dist/chunk-CM5HNV2W.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
// src/plugins.ts
|
|
2
|
-
function cloneManifests(manifests) {
|
|
3
|
-
return manifests ? structuredClone(manifests) : void 0;
|
|
4
|
-
}
|
|
5
|
-
function cloneInlineManifests(registrations) {
|
|
6
|
-
const inlineManifests = registrations.flatMap(
|
|
7
|
-
(plugin) => plugin.manifest ? [
|
|
8
|
-
{
|
|
9
|
-
manifest: {
|
|
10
|
-
...structuredClone(plugin.manifest),
|
|
11
|
-
configKeys: plugin.manifest.configKeys?.map(
|
|
12
|
-
(key) => key.includes(".") ? key : `${plugin.manifest.name}.${key}`
|
|
13
|
-
) ?? [],
|
|
14
|
-
...plugin.manifest.target ? {
|
|
15
|
-
target: {
|
|
16
|
-
...plugin.manifest.target,
|
|
17
|
-
configKey: plugin.manifest.target.configKey.includes(".") ? plugin.manifest.target.configKey : `${plugin.manifest.name}.${plugin.manifest.target.configKey}`
|
|
18
|
-
}
|
|
19
|
-
} : void 0
|
|
20
|
-
},
|
|
21
|
-
...plugin.packageName ? { packageName: plugin.packageName } : void 0
|
|
22
|
-
}
|
|
23
|
-
] : []
|
|
24
|
-
);
|
|
25
|
-
return inlineManifests.length > 0 ? inlineManifests : void 0;
|
|
26
|
-
}
|
|
27
|
-
function assertUniquePluginNames(registrations) {
|
|
28
|
-
const seen = /* @__PURE__ */ new Set();
|
|
29
|
-
for (const plugin of registrations) {
|
|
30
|
-
const name = plugin.manifest.name;
|
|
31
|
-
if (seen.has(name)) {
|
|
32
|
-
throw new Error(`Duplicate plugin registration name "${name}"`);
|
|
33
|
-
}
|
|
34
|
-
seen.add(name);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function assertUniquePackageNames(packageNames) {
|
|
38
|
-
const seen = /* @__PURE__ */ new Set();
|
|
39
|
-
for (const packageName of packageNames) {
|
|
40
|
-
if (seen.has(packageName)) {
|
|
41
|
-
throw new Error(`Duplicate plugin package name "${packageName}"`);
|
|
42
|
-
}
|
|
43
|
-
seen.add(packageName);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function normalizePluginInput(input) {
|
|
47
|
-
if (typeof input === "string") {
|
|
48
|
-
return { packageName: input };
|
|
49
|
-
}
|
|
50
|
-
return { registration: input };
|
|
51
|
-
}
|
|
52
|
-
function defineJuniorPlugins(inputs, options = {}) {
|
|
53
|
-
const normalized = inputs.map(normalizePluginInput);
|
|
54
|
-
const packageNames = normalized.flatMap(
|
|
55
|
-
(input) => input.packageName ? [input.packageName] : []
|
|
56
|
-
);
|
|
57
|
-
const registrations = normalized.flatMap(
|
|
58
|
-
(input) => input.registration ? [input.registration] : []
|
|
59
|
-
);
|
|
60
|
-
assertUniquePackageNames(packageNames);
|
|
61
|
-
assertUniquePluginNames(registrations);
|
|
62
|
-
const manifests = cloneManifests(options.manifests);
|
|
63
|
-
return {
|
|
64
|
-
packageNames,
|
|
65
|
-
registrations: registrations.map((plugin) => ({ ...plugin })),
|
|
66
|
-
...manifests ? { manifests } : void 0
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function pluginCatalogConfigFromPluginSet(pluginSet) {
|
|
70
|
-
if (!pluginSet) {
|
|
71
|
-
return void 0;
|
|
72
|
-
}
|
|
73
|
-
const packages = [
|
|
74
|
-
.../* @__PURE__ */ new Set([
|
|
75
|
-
...pluginSet.packageNames,
|
|
76
|
-
...pluginSet.registrations.flatMap(
|
|
77
|
-
(plugin) => plugin.packageName ? [plugin.packageName] : []
|
|
78
|
-
)
|
|
79
|
-
])
|
|
80
|
-
];
|
|
81
|
-
const manifests = cloneManifests(pluginSet.manifests);
|
|
82
|
-
const inlineManifests = cloneInlineManifests(pluginSet.registrations);
|
|
83
|
-
if (packages.length === 0 && !manifests && !inlineManifests) {
|
|
84
|
-
return void 0;
|
|
85
|
-
}
|
|
86
|
-
return {
|
|
87
|
-
...inlineManifests ? { inlineManifests } : void 0,
|
|
88
|
-
...packages.length > 0 ? { packages } : void 0,
|
|
89
|
-
...manifests ? { manifests } : void 0
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
function readEnvPluginPackages(env = process.env) {
|
|
93
|
-
const value = env.JUNIOR_PLUGIN_PACKAGES;
|
|
94
|
-
if (!value) {
|
|
95
|
-
return void 0;
|
|
96
|
-
}
|
|
97
|
-
let parsed;
|
|
98
|
-
try {
|
|
99
|
-
parsed = JSON.parse(value);
|
|
100
|
-
} catch (error) {
|
|
101
|
-
throw new Error("JUNIOR_PLUGIN_PACKAGES must be valid JSON", {
|
|
102
|
-
cause: error
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
if (!Array.isArray(parsed) || parsed.some((item) => typeof item !== "string" || !item.trim())) {
|
|
106
|
-
throw new Error(
|
|
107
|
-
"JUNIOR_PLUGIN_PACKAGES must be a JSON array of package names"
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
return parsed;
|
|
111
|
-
}
|
|
112
|
-
function pluginCatalogConfigFromEnv(env = process.env) {
|
|
113
|
-
const packages = readEnvPluginPackages(env);
|
|
114
|
-
return packages ? { packages } : void 0;
|
|
115
|
-
}
|
|
116
|
-
function pluginRuntimeRegistrationsFromPluginSet(pluginSet) {
|
|
117
|
-
return pluginSet?.registrations.filter(
|
|
118
|
-
(plugin) => plugin.hooks || plugin.tasks || plugin.userPages?.length
|
|
119
|
-
) ?? [];
|
|
120
|
-
}
|
|
121
|
-
function pluginCliRegistrationsFromPluginSet(pluginSet) {
|
|
122
|
-
return pluginSet?.registrations.filter((plugin) => plugin.cli) ?? [];
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export {
|
|
126
|
-
defineJuniorPlugins,
|
|
127
|
-
pluginCatalogConfigFromPluginSet,
|
|
128
|
-
pluginCatalogConfigFromEnv,
|
|
129
|
-
pluginRuntimeRegistrationsFromPluginSet,
|
|
130
|
-
pluginCliRegistrationsFromPluginSet
|
|
131
|
-
};
|
package/dist/chunk-DA2KGZZI.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// src/chat/state/turn-id.ts
|
|
2
|
-
function buildDeterministicTurnId(messageId) {
|
|
3
|
-
const sanitized = messageId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
4
|
-
return `turn_${sanitized}`;
|
|
5
|
-
}
|
|
6
|
-
function buildDeterministicAssistantMessageId(turnId) {
|
|
7
|
-
return `${turnId}:assistant:1`;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
buildDeterministicTurnId,
|
|
12
|
-
buildDeterministicAssistantMessageId
|
|
13
|
-
};
|
package/dist/chunk-DBVY6HLX.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getConversationEventStore
|
|
3
|
-
} from "./chunk-M76HMB7M.js";
|
|
4
|
-
|
|
5
|
-
// src/chat/conversations/turn-lifecycle.ts
|
|
6
|
-
var ConversationTurnLifecycleService = class {
|
|
7
|
-
constructor(events) {
|
|
8
|
-
this.events = events;
|
|
9
|
-
}
|
|
10
|
-
events;
|
|
11
|
-
/** Record the turn start once after every input message is durable. */
|
|
12
|
-
async start(input) {
|
|
13
|
-
await this.events.append(input.conversationId, [
|
|
14
|
-
{
|
|
15
|
-
idempotencyKey: `turn:${input.turnId}:started`,
|
|
16
|
-
createdAtMs: input.createdAtMs,
|
|
17
|
-
data: {
|
|
18
|
-
type: "turn_started",
|
|
19
|
-
turnId: input.turnId,
|
|
20
|
-
inputMessageIds: input.inputMessageIds,
|
|
21
|
-
surface: input.surface
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
]);
|
|
25
|
-
}
|
|
26
|
-
/** Record successful or intentional-silence completion once. */
|
|
27
|
-
async complete(input) {
|
|
28
|
-
await this.events.append(input.conversationId, [
|
|
29
|
-
{
|
|
30
|
-
idempotencyKey: `turn:${input.turnId}:terminal`,
|
|
31
|
-
createdAtMs: input.createdAtMs,
|
|
32
|
-
data: {
|
|
33
|
-
type: "turn_completed",
|
|
34
|
-
turnId: input.turnId,
|
|
35
|
-
outcome: input.outcome
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
]);
|
|
39
|
-
}
|
|
40
|
-
/** Record a classified failure once. Do not store raw error text. */
|
|
41
|
-
async fail(input) {
|
|
42
|
-
await this.events.append(input.conversationId, [
|
|
43
|
-
{
|
|
44
|
-
idempotencyKey: `turn:${input.turnId}:terminal`,
|
|
45
|
-
createdAtMs: input.createdAtMs,
|
|
46
|
-
data: {
|
|
47
|
-
type: "turn_failed",
|
|
48
|
-
turnId: input.turnId,
|
|
49
|
-
failureCode: input.failureCode,
|
|
50
|
-
...input.failureReason ? { failureReason: input.failureReason } : void 0,
|
|
51
|
-
...input.eventId ? { eventId: input.eventId } : void 0
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
]);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
function getTurnLifecycle() {
|
|
58
|
-
return new ConversationTurnLifecycleService(getConversationEventStore());
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export {
|
|
62
|
-
ConversationTurnLifecycleService,
|
|
63
|
-
getTurnLifecycle
|
|
64
|
-
};
|
package/dist/chunk-DIB4GX3G.js
DELETED
package/dist/chunk-DKIJ2RP5.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
conversationQueueMessageSchema
|
|
3
|
-
} from "./chunk-JAL3CH4G.js";
|
|
4
|
-
import {
|
|
5
|
-
QUEUE_SIGNATURE_MAX_AGE_MS,
|
|
6
|
-
createVercelQueueClient,
|
|
7
|
-
signQueueMessage,
|
|
8
|
-
verifyQueueMessage
|
|
9
|
-
} from "./chunk-7H2VZTWN.js";
|
|
10
|
-
|
|
11
|
-
// src/chat/task-execution/queue-signing.ts
|
|
12
|
-
var conversationQueueSign = {
|
|
13
|
-
context: "junior.conversation_work_queue.v2",
|
|
14
|
-
schema: conversationQueueMessageSchema,
|
|
15
|
-
separator: ":",
|
|
16
|
-
signatureVersion: "v2",
|
|
17
|
-
parts: (message) => [message.conversationId]
|
|
18
|
-
};
|
|
19
|
-
var CONVERSATION_WORK_QUEUE_SIGNATURE_MAX_SKEW_MS = QUEUE_SIGNATURE_MAX_AGE_MS;
|
|
20
|
-
function signConversationQueueMessage(message, nowMs = Date.now()) {
|
|
21
|
-
return signQueueMessage(conversationQueueSign, message, nowMs);
|
|
22
|
-
}
|
|
23
|
-
function verifyConversationQueueMessage(value, nowMs = Date.now()) {
|
|
24
|
-
return verifyQueueMessage(conversationQueueSign, value, nowMs);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// src/chat/task-execution/vercel-queue.ts
|
|
28
|
-
var DEFAULT_CONVERSATION_WORK_QUEUE_TOPIC = "junior_conversation_work";
|
|
29
|
-
var CONVERSATION_WORK_QUEUE_RETENTION_SECONDS = CONVERSATION_WORK_QUEUE_SIGNATURE_MAX_SKEW_MS / 1e3;
|
|
30
|
-
var defaultQueue;
|
|
31
|
-
function resolveConversationWorkQueueTopic(options = {}) {
|
|
32
|
-
const topic = options.topic?.trim();
|
|
33
|
-
return topic || process.env.JUNIOR_CONVERSATION_WORK_QUEUE_TOPIC?.trim() || DEFAULT_CONVERSATION_WORK_QUEUE_TOPIC;
|
|
34
|
-
}
|
|
35
|
-
function toDelaySeconds(options) {
|
|
36
|
-
if (!options?.delayMs || options.delayMs <= 0) {
|
|
37
|
-
return void 0;
|
|
38
|
-
}
|
|
39
|
-
return Math.ceil(options.delayMs / 1e3);
|
|
40
|
-
}
|
|
41
|
-
function createVercelConversationWorkQueue(options = {}) {
|
|
42
|
-
const topic = resolveConversationWorkQueueTopic(options);
|
|
43
|
-
const client = options.client ?? createVercelQueueClient();
|
|
44
|
-
return {
|
|
45
|
-
async send(message, sendOptions) {
|
|
46
|
-
const result = await client.send(
|
|
47
|
-
topic,
|
|
48
|
-
signConversationQueueMessage(message),
|
|
49
|
-
{
|
|
50
|
-
idempotencyKey: sendOptions?.idempotencyKey,
|
|
51
|
-
delaySeconds: toDelaySeconds(sendOptions),
|
|
52
|
-
retentionSeconds: options.retentionSeconds ?? CONVERSATION_WORK_QUEUE_RETENTION_SECONDS
|
|
53
|
-
}
|
|
54
|
-
);
|
|
55
|
-
return result.messageId ? { messageId: result.messageId } : {};
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
function getVercelConversationWorkQueue() {
|
|
60
|
-
defaultQueue ??= createVercelConversationWorkQueue();
|
|
61
|
-
return defaultQueue;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export {
|
|
65
|
-
verifyConversationQueueMessage,
|
|
66
|
-
resolveConversationWorkQueueTopic,
|
|
67
|
-
getVercelConversationWorkQueue
|
|
68
|
-
};
|