@sentry/junior 0.122.1 → 0.124.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-65WXVKKX.js → agent-hooks-RPQRUAGN.js} +7 -7
- package/dist/api/conversations/detail.d.ts +55 -0
- package/dist/api/conversations/event-list.d.ts +55 -0
- package/dist/api/conversations/events.d.ts +1 -1
- package/dist/api/conversations/stats.d.ts +15 -0
- package/dist/api/schema/conversation.d.ts +260 -0
- package/dist/api/schema.d.ts +1 -1
- package/dist/api/schema.js +1 -1
- package/dist/api.js +137 -22
- package/dist/app.js +33 -20
- package/dist/{catalog-runtime-VNNMSKCB.js → catalog-runtime-QM2W6BBD.js} +5 -5
- package/dist/chat/agent/action-confirmation-retry.d.ts +6 -0
- package/dist/chat/agent/tools.d.ts +12 -0
- package/dist/chat/config.d.ts +1 -0
- package/dist/chat/conversations/history.d.ts +91 -1
- package/dist/chat/conversations/projection.d.ts +24 -0
- package/dist/chat/conversations/provenance.d.ts +2 -0
- package/dist/chat/conversations/structured-events.d.ts +31 -0
- package/dist/chat/mcp/tool-manager.d.ts +1 -1
- package/dist/chat/pi/client.d.ts +6 -0
- package/dist/chat/pi/sdk.d.ts +1 -1
- package/dist/chat/pi/transcript.d.ts +2 -0
- package/dist/chat/plugins/agent-hooks.d.ts +2 -0
- package/dist/chat/plugins/conversation-events.d.ts +15 -0
- package/dist/chat/services/guardian-action-policy.d.ts +12 -0
- package/dist/chat/services/guardian-action-review.d.ts +9 -0
- package/dist/chat/services/provider-error.d.ts +2 -0
- package/dist/chat/tool-support/action-review-evidence.d.ts +4 -0
- package/dist/chat/tool-support/action-review-history.d.ts +117 -0
- package/dist/chat/tool-support/action-review.d.ts +142 -0
- package/dist/chat/tool-support/pi-tool-adapter.d.ts +2 -1
- package/dist/chat/tool-support/skill/mcp-tool-summary.d.ts +1 -6
- package/dist/chat/tool-support/zod-tool.d.ts +1 -0
- package/dist/chat/tools/definition.d.ts +23 -1
- package/dist/chat/tools/query-conversation-events.d.ts +1 -1
- package/dist/chat/tools/search-tools.d.ts +0 -20
- package/dist/chat/tools/skill/search-mcp-tools.d.ts +0 -20
- package/dist/{chunk-73TQBD5S.js → chunk-4HQMMFRL.js} +1 -1
- package/dist/{chunk-3KYLHUVC.js → chunk-4OWSABFE.js} +1474 -593
- package/dist/{chunk-LZ4XXS76.js → chunk-7S36LUYT.js} +3 -2
- package/dist/{chunk-4ZV2GNHX.js → chunk-APPWCJVJ.js} +1 -1
- package/dist/{chunk-O2ULQJWR.js → chunk-AYQZCJZJ.js} +47 -1
- package/dist/{chunk-XBYNPBPQ.js → chunk-EKVBTUVM.js} +2 -2
- package/dist/{chunk-VLRECFIC.js → chunk-GBIFLB5Y.js} +57 -11
- package/dist/{chunk-MSDKKTRG.js → chunk-HOVHXQQE.js} +4 -4
- package/dist/{chunk-TI7SYDD4.js → chunk-IYUHOYFA.js} +68 -4
- package/dist/{chunk-HGREP4UX.js → chunk-MG3L3UGS.js} +1 -1
- package/dist/{chunk-GPQLJDT5.js → chunk-PBZEJRYY.js} +20 -20
- package/dist/{chunk-QE33ATQW.js → chunk-PGLSOXFU.js} +19 -11
- package/dist/{chunk-MU6HHZEN.js → chunk-PR3M62LK.js} +74 -0
- package/dist/{chunk-WFJ2EG4E.js → chunk-RW6MD6ZV.js} +1 -1
- package/dist/{chunk-IEE5CSAP.js → chunk-TFO4SDCQ.js} +1 -1
- package/dist/{chunk-PYS4QZAF.js → chunk-UZAOIEAR.js} +1 -1
- package/dist/{chunk-4JPJTFUH.js → chunk-VLAWZSCB.js} +9 -4
- package/dist/chunk-W4YS2LXS.js +55 -0
- package/dist/{chunk-U5PRRZMZ.js → chunk-WFIXN6UU.js} +7 -7
- package/dist/{chunk-BXT63TNS.js → chunk-WKLA6WLW.js} +77 -6
- package/dist/{chunk-M7KAZXTE.js → chunk-YYAQ5ZNK.js} +30 -2
- package/dist/{chunk-PXPBBOIU.js → chunk-ZV2K3WM4.js} +1 -1
- package/dist/cli/chat.js +22 -22
- package/dist/cli/check.js +6 -6
- package/dist/cli/init.js +2 -1
- package/dist/cli/plugins.js +10 -10
- package/dist/cli/snapshot-create.js +8 -8
- package/dist/cli/upgrade.js +5 -5
- package/dist/{db-36HXKAKH.js → db-2W4KOPLN.js} +5 -5
- package/dist/instrumentation.js +2 -2
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-UKOO7KKP.js → oauth-callback-server-3TGRLQUD.js} +16 -15
- package/dist/{runner-M66KMCQ7.js → runner-NAVNNKQY.js} +11 -10
- package/dist/{skills-TTXTVFOG.js → skills-FIVS6EXW.js} +6 -6
- package/dist/{validation-TGASRGNN.js → validation-NX4DAKNV.js} +6 -6
- package/dist/version.js +1 -1
- package/migrations/0012_structured_conversation_events.sql +4 -0
- package/migrations/meta/0012_snapshot.json +1244 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +7 -6
- package/dist/chat/tool-support/schema-summary.d.ts +0 -2
|
@@ -2,6 +2,76 @@ import {
|
|
|
2
2
|
usageSchema
|
|
3
3
|
} from "./chunk-PDO5BLNM.js";
|
|
4
4
|
|
|
5
|
+
// src/chat/conversations/structured-events.ts
|
|
6
|
+
import {
|
|
7
|
+
conversationEventPresentationSchema,
|
|
8
|
+
defineConversationEvent
|
|
9
|
+
} from "@sentry/junior-plugin-api";
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
var JUNIOR_NATIVE_EVENT_NAMESPACE = "junior";
|
|
12
|
+
var authenticationEventContentSchema = z.object({
|
|
13
|
+
accountLabel: z.string().trim().min(1).max(120).optional(),
|
|
14
|
+
actorId: z.string().min(1),
|
|
15
|
+
authorizationId: z.string().min(1).optional(),
|
|
16
|
+
provider: z.string().regex(/^[a-z][a-z0-9-]*$/),
|
|
17
|
+
providerLabel: z.string().trim().min(1).max(80).optional()
|
|
18
|
+
}).strict();
|
|
19
|
+
function providerTitle(content) {
|
|
20
|
+
return content.providerLabel?.trim() || content.provider;
|
|
21
|
+
}
|
|
22
|
+
var authenticationLinkedEvent = defineConversationEvent({
|
|
23
|
+
name: "authentication_linked",
|
|
24
|
+
version: 1,
|
|
25
|
+
schema: authenticationEventContentSchema,
|
|
26
|
+
renderEvent(event) {
|
|
27
|
+
const provider = providerTitle(event);
|
|
28
|
+
return {
|
|
29
|
+
icon: "link",
|
|
30
|
+
title: `${provider} connected`,
|
|
31
|
+
...event.accountLabel ? { preview: `Connected as \`${event.accountLabel}\`` } : {},
|
|
32
|
+
details: [
|
|
33
|
+
{
|
|
34
|
+
title: `${provider} connected`,
|
|
35
|
+
...event.accountLabel ? { description: `Connected as \`${event.accountLabel}\`` } : {},
|
|
36
|
+
metadata: [event.provider]
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
var authenticationUnlinkedEvent = defineConversationEvent({
|
|
43
|
+
name: "authentication_unlinked",
|
|
44
|
+
version: 1,
|
|
45
|
+
schema: authenticationEventContentSchema,
|
|
46
|
+
renderEvent(event) {
|
|
47
|
+
const provider = providerTitle(event);
|
|
48
|
+
return {
|
|
49
|
+
icon: "key",
|
|
50
|
+
title: `${provider} disconnected`,
|
|
51
|
+
details: [
|
|
52
|
+
{
|
|
53
|
+
title: `${provider} disconnected`,
|
|
54
|
+
metadata: [event.provider]
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var NATIVE_EVENT_DEFINITIONS = [authenticationLinkedEvent, authenticationUnlinkedEvent];
|
|
61
|
+
function getJuniorNativeEventDefinition(args) {
|
|
62
|
+
return NATIVE_EVENT_DEFINITIONS.find(
|
|
63
|
+
(definition) => definition.eventName === args.name && definition.version === args.version
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
function renderJuniorNativeConversationEvent(args) {
|
|
67
|
+
if (args.namespace !== JUNIOR_NATIVE_EVENT_NAMESPACE) return void 0;
|
|
68
|
+
const definition = getJuniorNativeEventDefinition(args);
|
|
69
|
+
if (!definition) return void 0;
|
|
70
|
+
return conversationEventPresentationSchema.parse(
|
|
71
|
+
definition.renderEvent(definition.parse(args.content))
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
5
75
|
// src/chat/usage.ts
|
|
6
76
|
var agentTurnUsageSchema = usageSchema;
|
|
7
77
|
var COMPONENT_USAGE_FIELDS = [
|
|
@@ -93,6 +163,10 @@ function addAgentTurnUsage(...usages) {
|
|
|
93
163
|
}
|
|
94
164
|
|
|
95
165
|
export {
|
|
166
|
+
JUNIOR_NATIVE_EVENT_NAMESPACE,
|
|
167
|
+
authenticationLinkedEvent,
|
|
168
|
+
authenticationUnlinkedEvent,
|
|
169
|
+
renderJuniorNativeConversationEvent,
|
|
96
170
|
agentTurnUsageSchema,
|
|
97
171
|
hasAgentTurnUsage,
|
|
98
172
|
addAgentTurnUsage
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-6GWA276C.js";
|
|
14
14
|
import {
|
|
15
15
|
getDeploymentTelemetryAttributes
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-UZAOIEAR.js";
|
|
17
17
|
|
|
18
18
|
// src/chat/logging.ts
|
|
19
19
|
import path from "path";
|
|
@@ -948,10 +948,15 @@ var log = {
|
|
|
948
948
|
if (typeof sentryWithScope === "function" && typeof sentryCaptureException === "function") {
|
|
949
949
|
sentryWithScope((scope) => {
|
|
950
950
|
setSentryScopeContext(scope, getBoundLogContext());
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
951
|
+
const mergedAttributes = mergeAttributes(
|
|
952
|
+
getBoundLogAttributes(),
|
|
953
|
+
attrs
|
|
954
|
+
);
|
|
955
|
+
for (const [key, value] of Object.entries(mergedAttributes)) {
|
|
954
956
|
scope.setExtra(key, value);
|
|
957
|
+
if (SENTRY_TAG_ATTRIBUTE_KEYS.has(key) && typeof value === "string" && value.length > 0) {
|
|
958
|
+
scope.setTag(key, value);
|
|
959
|
+
}
|
|
955
960
|
}
|
|
956
961
|
eventId = sentryCaptureException(normalizedError);
|
|
957
962
|
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getPlugins
|
|
3
|
+
} from "./chunk-PGLSOXFU.js";
|
|
4
|
+
import {
|
|
5
|
+
getConversationEventStore
|
|
6
|
+
} from "./chunk-YYAQ5ZNK.js";
|
|
7
|
+
|
|
8
|
+
// src/chat/plugins/conversation-events.ts
|
|
9
|
+
function registeredDefinition(plugin, value) {
|
|
10
|
+
return plugin.conversationEvents?.find(
|
|
11
|
+
(definition) => definition === value.definition
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
function createPluginConversationEvents(args) {
|
|
15
|
+
return {
|
|
16
|
+
async emit(value) {
|
|
17
|
+
const definition = registeredDefinition(args.plugin, value);
|
|
18
|
+
if (!definition) {
|
|
19
|
+
throw new Error(
|
|
20
|
+
`Plugin "${args.plugin.manifest.name}" cannot emit an unregistered conversation event.`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
const content = definition.parse(value.data);
|
|
24
|
+
await getConversationEventStore().append(args.conversationId, [
|
|
25
|
+
{
|
|
26
|
+
createdAtMs: Date.now(),
|
|
27
|
+
idempotencyKey: `plugin:${args.plugin.manifest.name}:operation:${args.operationId}:event:${definition.eventName}@${definition.version}`,
|
|
28
|
+
data: {
|
|
29
|
+
type: "structured_event",
|
|
30
|
+
namespace: args.plugin.manifest.name,
|
|
31
|
+
name: definition.eventName,
|
|
32
|
+
version: definition.version,
|
|
33
|
+
turnId: args.turnId,
|
|
34
|
+
content
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function renderPluginConversationEvent(args) {
|
|
42
|
+
const plugin = getPlugins().find(
|
|
43
|
+
(candidate) => candidate.manifest.name === args.namespace
|
|
44
|
+
);
|
|
45
|
+
const definition = plugin?.conversationEvents?.find(
|
|
46
|
+
(candidate) => candidate.eventName === args.name && candidate.version === args.version
|
|
47
|
+
);
|
|
48
|
+
if (!definition) return void 0;
|
|
49
|
+
return definition.renderEvent(definition.parse(args.content));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
createPluginConversationEvents,
|
|
54
|
+
renderPluginConversationEvent
|
|
55
|
+
};
|
|
@@ -6,29 +6,29 @@ import {
|
|
|
6
6
|
isDmChannel,
|
|
7
7
|
normalizeSlackConversationId,
|
|
8
8
|
withSlackRetries
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PGLSOXFU.js";
|
|
10
10
|
import {
|
|
11
11
|
getDb,
|
|
12
12
|
parseDestination
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-YYAQ5ZNK.js";
|
|
14
14
|
import {
|
|
15
15
|
acquireActiveLock,
|
|
16
16
|
getStateAdapter,
|
|
17
17
|
sleep
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-RW6MD6ZV.js";
|
|
19
19
|
import {
|
|
20
20
|
normalizeSlackEmojiName
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-IYUHOYFA.js";
|
|
22
22
|
import {
|
|
23
23
|
pluginCatalogRuntime
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-4HQMMFRL.js";
|
|
25
25
|
import {
|
|
26
26
|
fetchWithBoundedOAuthErrorBodies
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-APPWCJVJ.js";
|
|
28
28
|
import {
|
|
29
29
|
logInfo,
|
|
30
30
|
logWarn
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-VLAWZSCB.js";
|
|
32
32
|
import {
|
|
33
33
|
isRecord
|
|
34
34
|
} from "./chunk-OB42YVAE.js";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
+
JUNIOR_NATIVE_EVENT_NAMESPACE,
|
|
2
3
|
addAgentTurnUsage,
|
|
3
|
-
agentTurnUsageSchema
|
|
4
|
-
|
|
4
|
+
agentTurnUsageSchema,
|
|
5
|
+
authenticationLinkedEvent,
|
|
6
|
+
authenticationUnlinkedEvent
|
|
7
|
+
} from "./chunk-PR3M62LK.js";
|
|
5
8
|
import {
|
|
6
9
|
agentHistoryItemSchema,
|
|
7
10
|
contextProvenance,
|
|
@@ -13,17 +16,17 @@ import {
|
|
|
13
16
|
instructionProvenanceFor,
|
|
14
17
|
sanitizePostgresJson,
|
|
15
18
|
withConversationEventLock
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-YYAQ5ZNK.js";
|
|
17
20
|
import {
|
|
18
21
|
getStateAdapter,
|
|
19
22
|
sleep
|
|
20
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-RW6MD6ZV.js";
|
|
21
24
|
import {
|
|
22
25
|
botConfig,
|
|
23
26
|
escapeXml,
|
|
24
27
|
resolveGatewayModel,
|
|
25
28
|
unwrapCurrentInstruction
|
|
26
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-IYUHOYFA.js";
|
|
27
30
|
import {
|
|
28
31
|
toStoredSlackActor
|
|
29
32
|
} from "./chunk-HZF5P5UN.js";
|
|
@@ -32,7 +35,7 @@ import {
|
|
|
32
35
|
logException,
|
|
33
36
|
logWarn,
|
|
34
37
|
setSpanAttributes
|
|
35
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-VLAWZSCB.js";
|
|
36
39
|
import {
|
|
37
40
|
isRecord,
|
|
38
41
|
toOptionalNumber,
|
|
@@ -134,6 +137,16 @@ function instructionTextForProjection(text) {
|
|
|
134
137
|
const withoutContext = text.replace(EMBEDDED_THREAD_CONTEXT_PATTERN, "").trim();
|
|
135
138
|
return unwrapCurrentInstruction(withoutContext) ?? withoutContext;
|
|
136
139
|
}
|
|
140
|
+
function getUserMessageInstructionText(message) {
|
|
141
|
+
if (getPiMessageRole(message) !== "user") {
|
|
142
|
+
return "";
|
|
143
|
+
}
|
|
144
|
+
const content = message.content;
|
|
145
|
+
const text = typeof content === "string" ? content : Array.isArray(content) ? content.flatMap(
|
|
146
|
+
(part) => part && typeof part === "object" && part.type === "text" && typeof part.text === "string" ? [part.text] : []
|
|
147
|
+
).join("\n") : "";
|
|
148
|
+
return instructionTextForProjection(text).trim();
|
|
149
|
+
}
|
|
137
150
|
function stripRuntimeTurnContext(messages) {
|
|
138
151
|
return messages.flatMap((message) => {
|
|
139
152
|
const content = userMessageContent(message);
|
|
@@ -1127,6 +1140,44 @@ async function recordAuthorizationCompleted(args) {
|
|
|
1127
1140
|
}
|
|
1128
1141
|
]);
|
|
1129
1142
|
}
|
|
1143
|
+
function authenticationEventIdempotencyKey(args) {
|
|
1144
|
+
if (args.authorizationId) {
|
|
1145
|
+
return `native:${JUNIOR_NATIVE_EVENT_NAMESPACE}:authentication_${args.action}:authorization:${args.authorizationId}`;
|
|
1146
|
+
}
|
|
1147
|
+
return `native:${JUNIOR_NATIVE_EVENT_NAMESPACE}:authentication_${args.action}:${args.provider}:actor:${args.actorId}`;
|
|
1148
|
+
}
|
|
1149
|
+
async function recordAuthenticationAccountChange(action, args) {
|
|
1150
|
+
const definition = action === "linked" ? authenticationLinkedEvent : authenticationUnlinkedEvent;
|
|
1151
|
+
const content = definition.parse({
|
|
1152
|
+
actorId: args.actorId,
|
|
1153
|
+
provider: args.provider,
|
|
1154
|
+
...args.accountLabel ? { accountLabel: args.accountLabel } : {},
|
|
1155
|
+
...args.authorizationId ? { authorizationId: args.authorizationId } : {},
|
|
1156
|
+
...args.providerLabel ? { providerLabel: args.providerLabel } : {}
|
|
1157
|
+
});
|
|
1158
|
+
await getConversationEventStore().append(args.conversationId, [
|
|
1159
|
+
{
|
|
1160
|
+
createdAtMs: Date.now(),
|
|
1161
|
+
idempotencyKey: authenticationEventIdempotencyKey({
|
|
1162
|
+
action,
|
|
1163
|
+
actorId: args.actorId,
|
|
1164
|
+
authorizationId: args.authorizationId,
|
|
1165
|
+
provider: args.provider
|
|
1166
|
+
}),
|
|
1167
|
+
data: {
|
|
1168
|
+
type: "structured_event",
|
|
1169
|
+
namespace: JUNIOR_NATIVE_EVENT_NAMESPACE,
|
|
1170
|
+
name: definition.eventName,
|
|
1171
|
+
version: definition.version,
|
|
1172
|
+
...args.turnId ? { turnId: args.turnId } : {},
|
|
1173
|
+
content
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
]);
|
|
1177
|
+
}
|
|
1178
|
+
async function recordAuthenticationLinked(args) {
|
|
1179
|
+
await recordAuthenticationAccountChange("linked", args);
|
|
1180
|
+
}
|
|
1130
1181
|
async function loadTurnRoute(args) {
|
|
1131
1182
|
const event = await getConversationEventStore().loadByIdempotencyKey(
|
|
1132
1183
|
args.conversationId,
|
|
@@ -1169,6 +1220,23 @@ async function recordToolExecutionStarted(args) {
|
|
|
1169
1220
|
}
|
|
1170
1221
|
]);
|
|
1171
1222
|
}
|
|
1223
|
+
async function recordGuardianActionReviewed(args) {
|
|
1224
|
+
await getConversationEventStore().append(args.conversationId, [
|
|
1225
|
+
{
|
|
1226
|
+
data: {
|
|
1227
|
+
type: "guardian_action_reviewed",
|
|
1228
|
+
turnId: args.turnId,
|
|
1229
|
+
toolCallId: args.toolCallId,
|
|
1230
|
+
toolName: args.toolName,
|
|
1231
|
+
...args.costUsd !== void 0 ? { costUsd: args.costUsd } : {},
|
|
1232
|
+
decision: args.decision,
|
|
1233
|
+
riskLevel: args.riskLevel,
|
|
1234
|
+
userAuthorization: args.userAuthorization
|
|
1235
|
+
},
|
|
1236
|
+
createdAtMs: Date.now()
|
|
1237
|
+
}
|
|
1238
|
+
]);
|
|
1239
|
+
}
|
|
1172
1240
|
|
|
1173
1241
|
// src/chat/state/turn-id.ts
|
|
1174
1242
|
function buildDeterministicTurnId(messageId) {
|
|
@@ -2829,6 +2897,7 @@ export {
|
|
|
2829
2897
|
hasRuntimeTurnContext,
|
|
2830
2898
|
retainRuntimeTurnContext,
|
|
2831
2899
|
instructionTextForProjection,
|
|
2900
|
+
getUserMessageInstructionText,
|
|
2832
2901
|
stripRuntimeTurnContext,
|
|
2833
2902
|
historyItemFromPiMessage,
|
|
2834
2903
|
piMessageFromHistoryItem,
|
|
@@ -2858,9 +2927,11 @@ export {
|
|
|
2858
2927
|
recordMcpProviderConnected,
|
|
2859
2928
|
recordAuthorizationRequested,
|
|
2860
2929
|
recordAuthorizationCompleted,
|
|
2930
|
+
recordAuthenticationLinked,
|
|
2861
2931
|
loadTurnRoute,
|
|
2862
2932
|
recordTurnRoute,
|
|
2863
2933
|
recordToolExecutionStarted,
|
|
2934
|
+
recordGuardianActionReviewed,
|
|
2864
2935
|
buildDeterministicTurnId,
|
|
2865
2936
|
buildDeterministicAssistantMessageId,
|
|
2866
2937
|
ConversationTurnBoundaryError,
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
TURN_REASONING_LEVELS,
|
|
10
10
|
getChatConfig,
|
|
11
11
|
modelProfileSchema
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-IYUHOYFA.js";
|
|
13
13
|
import {
|
|
14
14
|
juniorDestinations
|
|
15
15
|
} from "./chunk-VFUK3X5B.js";
|
|
16
16
|
import {
|
|
17
17
|
normalizeIdentityEmail
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-VLAWZSCB.js";
|
|
19
19
|
import {
|
|
20
20
|
parseSlackChannelReferenceId,
|
|
21
21
|
parseSlackTeamId
|
|
@@ -770,6 +770,11 @@ function actorIdentityKey(actor) {
|
|
|
770
770
|
}
|
|
771
771
|
return actor.platform === "slack" ? `slack\0${actor.teamId}\0${actor.userId}` : `${actor.platform}\0${actor.userId}`;
|
|
772
772
|
}
|
|
773
|
+
function sameActorIdentity(left, right) {
|
|
774
|
+
return Boolean(
|
|
775
|
+
left && right && actorIdentityKey(left) === actorIdentityKey(right)
|
|
776
|
+
);
|
|
777
|
+
}
|
|
773
778
|
function instructionActors(provenance) {
|
|
774
779
|
const seen = /* @__PURE__ */ new Set();
|
|
775
780
|
const actors = [];
|
|
@@ -881,6 +886,16 @@ var toolExecutionStartedEventDataSchema = z2.object({
|
|
|
881
886
|
toolCallId: z2.string().min(1),
|
|
882
887
|
toolName: z2.string().min(1)
|
|
883
888
|
}).strict();
|
|
889
|
+
var guardianActionReviewedEventDataSchema = z2.object({
|
|
890
|
+
type: z2.literal("guardian_action_reviewed"),
|
|
891
|
+
turnId: z2.string().min(1),
|
|
892
|
+
toolCallId: z2.string().min(1),
|
|
893
|
+
toolName: z2.string().min(1),
|
|
894
|
+
costUsd: z2.number().finite().nonnegative().optional(),
|
|
895
|
+
decision: z2.enum(["allow", "ask", "deny"]),
|
|
896
|
+
riskLevel: z2.enum(["low", "medium", "high", "critical"]),
|
|
897
|
+
userAuthorization: z2.enum(["high", "medium", "low", "unknown"])
|
|
898
|
+
}).strict();
|
|
884
899
|
var conversationMessageRoleSchema = z2.union([
|
|
885
900
|
z2.literal("user"),
|
|
886
901
|
z2.literal("assistant"),
|
|
@@ -951,6 +966,14 @@ var turnContextEventDataSchema = z2.object({
|
|
|
951
966
|
version: z2.number().int().positive(),
|
|
952
967
|
content: z2.record(z2.string(), z2.unknown())
|
|
953
968
|
}).strict();
|
|
969
|
+
var structuredConversationEventDataSchema = z2.object({
|
|
970
|
+
type: z2.literal("structured_event"),
|
|
971
|
+
namespace: z2.string().regex(/^[a-z][a-z0-9-]*$/),
|
|
972
|
+
name: z2.string().regex(/^[a-z][a-z0-9_]*$/),
|
|
973
|
+
version: z2.number().int().positive(),
|
|
974
|
+
turnId: z2.string().min(1).optional(),
|
|
975
|
+
content: z2.record(z2.string(), z2.unknown())
|
|
976
|
+
}).strict();
|
|
954
977
|
var turnCompletedEventDataSchema = z2.object({
|
|
955
978
|
type: z2.literal("turn_completed"),
|
|
956
979
|
turnId: z2.string().min(1),
|
|
@@ -989,10 +1012,12 @@ var appendableConversationEventDataSchema = z2.union([
|
|
|
989
1012
|
authorizationRequestedEventDataSchema,
|
|
990
1013
|
authorizationCompletedEventDataSchema,
|
|
991
1014
|
toolExecutionStartedEventDataSchema,
|
|
1015
|
+
guardianActionReviewedEventDataSchema,
|
|
992
1016
|
messageHandledEventDataSchema,
|
|
993
1017
|
messagesSummarizedEventDataSchema,
|
|
994
1018
|
turnStartedEventDataSchema,
|
|
995
1019
|
turnContextEventDataSchema,
|
|
1020
|
+
structuredConversationEventDataSchema,
|
|
996
1021
|
turnRoutedEventDataSchema,
|
|
997
1022
|
turnCompletedEventDataSchema,
|
|
998
1023
|
turnFailedEventDataSchema,
|
|
@@ -1013,10 +1038,12 @@ var KNOWN_CONVERSATION_EVENT_TYPES = [
|
|
|
1013
1038
|
"authorization_requested",
|
|
1014
1039
|
"authorization_completed",
|
|
1015
1040
|
"tool_execution_started",
|
|
1041
|
+
"guardian_action_reviewed",
|
|
1016
1042
|
"message_handled",
|
|
1017
1043
|
"messages_summarized",
|
|
1018
1044
|
"turn_started",
|
|
1019
1045
|
"turn_context",
|
|
1046
|
+
"structured_event",
|
|
1020
1047
|
"turn_routed",
|
|
1021
1048
|
"turn_completed",
|
|
1022
1049
|
"turn_failed",
|
|
@@ -1515,6 +1542,7 @@ export {
|
|
|
1515
1542
|
sameDestination,
|
|
1516
1543
|
instructionProvenanceFor,
|
|
1517
1544
|
contextProvenance,
|
|
1545
|
+
sameActorIdentity,
|
|
1518
1546
|
instructionActors,
|
|
1519
1547
|
agentHistoryItemSchema,
|
|
1520
1548
|
KNOWN_CONVERSATION_EVENT_TYPES,
|
package/dist/cli/chat.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAgentRunner,
|
|
3
3
|
executeAgentRun
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-4OWSABFE.js";
|
|
5
5
|
import "../chunk-DIB4GX3G.js";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-WFIXN6UU.js";
|
|
7
|
+
import "../chunk-WKLA6WLW.js";
|
|
8
8
|
import "../chunk-HDSDCEPK.js";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-HOVHXQQE.js";
|
|
10
|
+
import "../chunk-TFO4SDCQ.js";
|
|
11
|
+
import "../chunk-PR3M62LK.js";
|
|
12
12
|
import "../chunk-PDO5BLNM.js";
|
|
13
13
|
import "../chunk-UIE3R5XU.js";
|
|
14
14
|
import {
|
|
15
15
|
loadAppPluginSet
|
|
16
16
|
} from "../chunk-Y2CM7HXH.js";
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-PGLSOXFU.js";
|
|
18
|
+
import "../chunk-YYAQ5ZNK.js";
|
|
19
19
|
import "../chunk-GCGJGSQL.js";
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-
|
|
20
|
+
import "../chunk-RW6MD6ZV.js";
|
|
21
|
+
import "../chunk-IYUHOYFA.js";
|
|
22
22
|
import "../chunk-VFUK3X5B.js";
|
|
23
23
|
import "../chunk-S7G34U75.js";
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-
|
|
26
|
-
import "../chunk-
|
|
24
|
+
import "../chunk-EKVBTUVM.js";
|
|
25
|
+
import "../chunk-4HQMMFRL.js";
|
|
26
|
+
import "../chunk-APPWCJVJ.js";
|
|
27
27
|
import "../chunk-W3U3YQYI.js";
|
|
28
28
|
import "../chunk-HZF5P5UN.js";
|
|
29
|
-
import "../chunk-
|
|
29
|
+
import "../chunk-VLAWZSCB.js";
|
|
30
30
|
import "../chunk-OB42YVAE.js";
|
|
31
31
|
import "../chunk-F3B2YJ76.js";
|
|
32
32
|
import "../chunk-6GWA276C.js";
|
|
33
33
|
import "../chunk-OOUNJNMR.js";
|
|
34
34
|
import "../chunk-H4HBKISO.js";
|
|
35
|
-
import "../chunk-
|
|
36
|
-
import "../chunk-
|
|
35
|
+
import "../chunk-UZAOIEAR.js";
|
|
36
|
+
import "../chunk-7S36LUYT.js";
|
|
37
37
|
import "../chunk-MLKGABMK.js";
|
|
38
38
|
|
|
39
39
|
// src/cli/chat.ts
|
|
@@ -156,10 +156,10 @@ async function configureLocalChatPlugins(pluginSet) {
|
|
|
156
156
|
databaseModule
|
|
157
157
|
] = await Promise.all([
|
|
158
158
|
import("../plugins-HW4VWW6G.js"),
|
|
159
|
-
import("../agent-hooks-
|
|
160
|
-
import("../catalog-runtime-
|
|
161
|
-
import("../validation-
|
|
162
|
-
import("../db-
|
|
159
|
+
import("../agent-hooks-RPQRUAGN.js"),
|
|
160
|
+
import("../catalog-runtime-QM2W6BBD.js"),
|
|
161
|
+
import("../validation-NX4DAKNV.js"),
|
|
162
|
+
import("../db-2W4KOPLN.js")
|
|
163
163
|
]);
|
|
164
164
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
165
165
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
@@ -223,8 +223,8 @@ function localDevServerUrl() {
|
|
|
223
223
|
async function prepareLocalChatRun(io, pluginSet) {
|
|
224
224
|
defaultStateAdapterForLocalChat();
|
|
225
225
|
await configureLocalChatPlugins(pluginSet);
|
|
226
|
-
const { runLocalAgentTurn } = await import("../runner-
|
|
227
|
-
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-
|
|
226
|
+
const { runLocalAgentTurn } = await import("../runner-NAVNNKQY.js");
|
|
227
|
+
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-3TGRLQUD.js");
|
|
228
228
|
const { createLocalOAuthState } = await import("../oauth-relay-3ZU72UGL.js");
|
|
229
229
|
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-CDFAP67O.js");
|
|
230
230
|
const agentRunner = createAgentRunner(executeAgentRun);
|
package/dist/cli/check.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseSkillFile
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-EKVBTUVM.js";
|
|
4
|
+
import "../chunk-4HQMMFRL.js";
|
|
5
5
|
import {
|
|
6
6
|
parseInlinePluginManifest,
|
|
7
7
|
parsePluginManifest
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-APPWCJVJ.js";
|
|
9
9
|
import "../chunk-W3U3YQYI.js";
|
|
10
10
|
import "../chunk-HZF5P5UN.js";
|
|
11
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-VLAWZSCB.js";
|
|
12
12
|
import "../chunk-OB42YVAE.js";
|
|
13
13
|
import "../chunk-F3B2YJ76.js";
|
|
14
14
|
import "../chunk-6GWA276C.js";
|
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
|
|
19
19
|
JUNIOR_HEARTBEAT_ROUTE,
|
|
20
20
|
LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
21
|
+
} from "../chunk-UZAOIEAR.js";
|
|
22
|
+
import "../chunk-7S36LUYT.js";
|
|
23
23
|
import "../chunk-MLKGABMK.js";
|
|
24
24
|
|
|
25
25
|
// src/cli/check.ts
|
package/dist/cli/init.js
CHANGED
|
@@ -150,7 +150,7 @@ async function runInit(dir, log = console.log) {
|
|
|
150
150
|
"@sentry/junior": "latest",
|
|
151
151
|
"@sentry/junior-memory": "latest",
|
|
152
152
|
"@sentry/junior-maintenance": "latest",
|
|
153
|
-
hono: "^4.12.
|
|
153
|
+
hono: "^4.12.27"
|
|
154
154
|
},
|
|
155
155
|
devDependencies: {
|
|
156
156
|
"@types/node": "^25.9.1",
|
|
@@ -211,6 +211,7 @@ JUNIOR_SLASH_COMMAND=
|
|
|
211
211
|
JUNIOR_CROSS_ACTOR_MID_RUN_MODE=
|
|
212
212
|
AI_MODEL=
|
|
213
213
|
AI_FAST_MODEL=
|
|
214
|
+
AI_GUARDIAN_MODEL=
|
|
214
215
|
AI_HANDOFF_MODEL=
|
|
215
216
|
AI_MODEL_PROFILES=
|
|
216
217
|
AI_MEMORY_MODEL=
|
package/dist/cli/plugins.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
validatePluginEgressCredentialHooks,
|
|
3
3
|
validatePluginRegistrations
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-MG3L3UGS.js";
|
|
5
5
|
import {
|
|
6
6
|
pluginCatalogConfigFromPluginSet,
|
|
7
7
|
pluginCliRegistrationsFromPluginSet,
|
|
@@ -14,29 +14,29 @@ import {
|
|
|
14
14
|
createPluginLogger,
|
|
15
15
|
setPlugins,
|
|
16
16
|
validatePlugins
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-PGLSOXFU.js";
|
|
18
18
|
import {
|
|
19
19
|
getDb
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-YYAQ5ZNK.js";
|
|
21
21
|
import "../chunk-GCGJGSQL.js";
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
22
|
+
import "../chunk-RW6MD6ZV.js";
|
|
23
|
+
import "../chunk-IYUHOYFA.js";
|
|
24
24
|
import "../chunk-VFUK3X5B.js";
|
|
25
25
|
import "../chunk-S7G34U75.js";
|
|
26
26
|
import {
|
|
27
27
|
pluginCatalogRuntime
|
|
28
|
-
} from "../chunk-
|
|
29
|
-
import "../chunk-
|
|
28
|
+
} from "../chunk-4HQMMFRL.js";
|
|
29
|
+
import "../chunk-APPWCJVJ.js";
|
|
30
30
|
import "../chunk-W3U3YQYI.js";
|
|
31
31
|
import "../chunk-HZF5P5UN.js";
|
|
32
|
-
import "../chunk-
|
|
32
|
+
import "../chunk-VLAWZSCB.js";
|
|
33
33
|
import "../chunk-OB42YVAE.js";
|
|
34
34
|
import "../chunk-F3B2YJ76.js";
|
|
35
35
|
import "../chunk-6GWA276C.js";
|
|
36
36
|
import "../chunk-OOUNJNMR.js";
|
|
37
37
|
import "../chunk-H4HBKISO.js";
|
|
38
|
-
import "../chunk-
|
|
39
|
-
import "../chunk-
|
|
38
|
+
import "../chunk-UZAOIEAR.js";
|
|
39
|
+
import "../chunk-7S36LUYT.js";
|
|
40
40
|
import "../chunk-MLKGABMK.js";
|
|
41
41
|
|
|
42
42
|
// src/cli/plugins.ts
|