@sentry/junior 0.93.0 → 0.94.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/app.js
CHANGED
|
@@ -106,7 +106,7 @@ import {
|
|
|
106
106
|
shouldEmitDevAgentTrace,
|
|
107
107
|
shouldPropagateSandboxEgressTrace,
|
|
108
108
|
startOAuthFlow
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-KRMANDHI.js";
|
|
110
110
|
import {
|
|
111
111
|
CooperativeTurnYieldError,
|
|
112
112
|
TurnInputCommitLostError,
|
|
@@ -3916,24 +3916,28 @@ async function resumeSlackTurn(args) {
|
|
|
3916
3916
|
}
|
|
3917
3917
|
const activeReplyContext = runArgs.replyContext;
|
|
3918
3918
|
if (!activeReplyContext) {
|
|
3919
|
-
throw new Error(
|
|
3920
|
-
"Resumed turn requires replyContext.routing.actor.userId"
|
|
3921
|
-
);
|
|
3922
|
-
}
|
|
3923
|
-
const resumeActor = activeReplyContext.routing.actor;
|
|
3924
|
-
if (!isUserActor(resumeActor)) {
|
|
3925
|
-
throw new Error(
|
|
3926
|
-
"Resumed turn requires replyContext.routing.actor.userId"
|
|
3927
|
-
);
|
|
3919
|
+
throw new Error("Resumed turn requires replyContext");
|
|
3928
3920
|
}
|
|
3929
3921
|
const credentialContext = activeReplyContext.routing.credentialContext;
|
|
3930
3922
|
if (!credentialContext) {
|
|
3931
3923
|
throw new Error("Resumed turn requires replyContext.credentialContext");
|
|
3932
3924
|
}
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
)
|
|
3925
|
+
const routingActor = activeReplyContext.routing.actor;
|
|
3926
|
+
let resumeActor;
|
|
3927
|
+
if ("type" in credentialContext.actor) {
|
|
3928
|
+
if (!isUserActor(routingActor) || credentialContext.actor.userId !== routingActor.userId) {
|
|
3929
|
+
throw new Error(
|
|
3930
|
+
"Resumed turn credential actor must match replyContext.routing.actor.userId"
|
|
3931
|
+
);
|
|
3932
|
+
}
|
|
3933
|
+
resumeActor = routingActor;
|
|
3934
|
+
} else {
|
|
3935
|
+
if (routingActor && (routingActor.platform !== "system" || routingActor.name !== credentialContext.actor.name)) {
|
|
3936
|
+
throw new Error(
|
|
3937
|
+
"Resumed turn system credential actor must match replyContext.routing.actor"
|
|
3938
|
+
);
|
|
3939
|
+
}
|
|
3940
|
+
resumeActor = credentialContext.actor;
|
|
3937
3941
|
}
|
|
3938
3942
|
if (runArgs.messageTs) {
|
|
3939
3943
|
processingReaction = await startSlackProcessingReactionForMessage({
|
|
@@ -3975,7 +3979,7 @@ async function resumeSlackTurn(args) {
|
|
|
3975
3979
|
deferredPauseKind = "auth";
|
|
3976
3980
|
deferredAuthInfo = {
|
|
3977
3981
|
providerDisplayName: outcome.providerDisplayName,
|
|
3978
|
-
actorId: resumeActor.userId
|
|
3982
|
+
actorId: isUserActor(resumeActor) ? resumeActor.userId : void 0
|
|
3979
3983
|
};
|
|
3980
3984
|
deferredPauseHandler = async () => {
|
|
3981
3985
|
await onAuthPause({
|
|
@@ -4027,7 +4031,7 @@ async function resumeSlackTurn(args) {
|
|
|
4027
4031
|
currentUsage: reply.diagnostics.usage,
|
|
4028
4032
|
destination: replyContext.routing.destination,
|
|
4029
4033
|
source: replyContext.routing.source,
|
|
4030
|
-
actor:
|
|
4034
|
+
actor: resumeActor,
|
|
4031
4035
|
surface: "slack",
|
|
4032
4036
|
logContext: {
|
|
4033
4037
|
threadId: replyContext.routing.correlation.threadId,
|
|
@@ -9836,7 +9840,7 @@ function createReplyToThread(deps) {
|
|
|
9836
9840
|
startedAtMs: turnStartedAtMs,
|
|
9837
9841
|
state: "running",
|
|
9838
9842
|
surface: "slack",
|
|
9839
|
-
actor,
|
|
9843
|
+
actor: executionActor,
|
|
9840
9844
|
destination,
|
|
9841
9845
|
destinationVisibility,
|
|
9842
9846
|
source,
|
|
@@ -11162,19 +11166,32 @@ async function continueSlackAgentRun(payload, options) {
|
|
|
11162
11166
|
payload.destination,
|
|
11163
11167
|
"Slack continuation"
|
|
11164
11168
|
);
|
|
11165
|
-
const
|
|
11166
|
-
|
|
11167
|
-
|
|
11168
|
-
|
|
11169
|
-
|
|
11170
|
-
}
|
|
11171
|
-
|
|
11172
|
-
await failStrandedSessionWithFallback({
|
|
11169
|
+
const systemActor = activeSessionRecord.actor?.platform === "system" ? activeSessionRecord.actor : void 0;
|
|
11170
|
+
let actor;
|
|
11171
|
+
let credentialContext;
|
|
11172
|
+
if (systemActor) {
|
|
11173
|
+
credentialContext = { actor: systemActor };
|
|
11174
|
+
} else {
|
|
11175
|
+
actor = await resolveContinuationActor({
|
|
11173
11176
|
conversationId: payload.conversationId,
|
|
11174
|
-
|
|
11175
|
-
|
|
11177
|
+
sessionRecordActor: activeSessionRecord.actor,
|
|
11178
|
+
teamId: destination.teamId,
|
|
11179
|
+
userId: userMessage2.author.userId
|
|
11176
11180
|
});
|
|
11177
|
-
|
|
11181
|
+
if (!actor) {
|
|
11182
|
+
await failStrandedSessionWithFallback({
|
|
11183
|
+
conversationId: payload.conversationId,
|
|
11184
|
+
errorMessage: "Stored Slack actor missing for continuation",
|
|
11185
|
+
sessionRecord: activeSessionRecord
|
|
11186
|
+
});
|
|
11187
|
+
return false;
|
|
11188
|
+
}
|
|
11189
|
+
credentialContext = {
|
|
11190
|
+
actor: {
|
|
11191
|
+
type: "user",
|
|
11192
|
+
userId: actor.userId
|
|
11193
|
+
}
|
|
11194
|
+
};
|
|
11178
11195
|
}
|
|
11179
11196
|
if (!activeSessionRecord.source) {
|
|
11180
11197
|
await failAgentTurnSessionRecord({
|
|
@@ -11195,13 +11212,8 @@ async function continueSlackAgentRun(payload, options) {
|
|
|
11195
11212
|
...getTurnUserReplyAttachmentContext(userMessage2)
|
|
11196
11213
|
},
|
|
11197
11214
|
routing: {
|
|
11198
|
-
credentialContext
|
|
11199
|
-
|
|
11200
|
-
type: "user",
|
|
11201
|
-
userId: actor.userId
|
|
11202
|
-
}
|
|
11203
|
-
},
|
|
11204
|
-
actor,
|
|
11215
|
+
credentialContext,
|
|
11216
|
+
...actor ? { actor } : {},
|
|
11205
11217
|
destination: payload.destination,
|
|
11206
11218
|
source: activeSessionRecord.source,
|
|
11207
11219
|
correlation: {
|
|
@@ -11209,7 +11221,7 @@ async function continueSlackAgentRun(payload, options) {
|
|
|
11209
11221
|
turnId: payload.sessionId,
|
|
11210
11222
|
channelId: thread.channelId,
|
|
11211
11223
|
threadTs: thread.threadTs,
|
|
11212
|
-
actorId: actor.userId
|
|
11224
|
+
...actor ? { actorId: actor.userId } : {}
|
|
11213
11225
|
},
|
|
11214
11226
|
toolChannelId: artifacts.assistantContextChannelId ?? thread.channelId
|
|
11215
11227
|
},
|
|
@@ -15,7 +15,7 @@ export type CredentialedEgressHttpInterceptor = (input: {
|
|
|
15
15
|
}) => Promise<Response | undefined>;
|
|
16
16
|
/** Runtime dependencies for the credentialed provider forwarding step. */
|
|
17
17
|
export interface CredentialedEgressDeps {
|
|
18
|
-
clearCredentialLease?: (provider: string,
|
|
18
|
+
clearCredentialLease?: (provider: string, grant: SandboxEgressCredentialLease["grant"], credentialContext: SandboxEgressCredentialContext) => Promise<void>;
|
|
19
19
|
fetch?: typeof fetch;
|
|
20
20
|
issueCredentialLease?: (provider: string, selection: SandboxEgressGrantSelection, credentialContext: SandboxEgressCredentialContext) => Promise<SandboxEgressCredentialLease>;
|
|
21
21
|
interceptHttp?: CredentialedEgressHttpInterceptor;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const sandboxEgressGrantSchema: z.ZodObject<{
|
|
3
3
|
access: z.ZodUnion<readonly [z.ZodLiteral<"read">, z.ZodLiteral<"write">]>;
|
|
4
|
+
leaseScope: z.ZodOptional<z.ZodString>;
|
|
4
5
|
name: z.ZodString;
|
|
5
6
|
reason: z.ZodOptional<z.ZodString>;
|
|
6
7
|
requirements: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -45,6 +46,7 @@ export declare const sandboxEgressCredentialLeaseSchema: z.ZodObject<{
|
|
|
45
46
|
}, z.core.$strict>>;
|
|
46
47
|
grant: z.ZodObject<{
|
|
47
48
|
access: z.ZodUnion<readonly [z.ZodLiteral<"read">, z.ZodLiteral<"write">]>;
|
|
49
|
+
leaseScope: z.ZodOptional<z.ZodString>;
|
|
48
50
|
name: z.ZodString;
|
|
49
51
|
reason: z.ZodOptional<z.ZodString>;
|
|
50
52
|
requirements: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -64,6 +66,7 @@ export declare const sandboxEgressAuthRequiredSignalSchema: z.ZodObject<{
|
|
|
64
66
|
}, z.core.$strict>>;
|
|
65
67
|
grant: z.ZodObject<{
|
|
66
68
|
access: z.ZodUnion<readonly [z.ZodLiteral<"read">, z.ZodLiteral<"write">]>;
|
|
69
|
+
leaseScope: z.ZodOptional<z.ZodString>;
|
|
67
70
|
name: z.ZodString;
|
|
68
71
|
reason: z.ZodOptional<z.ZodString>;
|
|
69
72
|
requirements: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -85,6 +88,7 @@ export declare const sandboxEgressPermissionDeniedSignalSchema: z.ZodObject<{
|
|
|
85
88
|
acceptedPermissions: z.ZodOptional<z.ZodString>;
|
|
86
89
|
grant: z.ZodObject<{
|
|
87
90
|
access: z.ZodUnion<readonly [z.ZodLiteral<"read">, z.ZodLiteral<"write">]>;
|
|
91
|
+
leaseScope: z.ZodOptional<z.ZodString>;
|
|
88
92
|
name: z.ZodString;
|
|
89
93
|
reason: z.ZodOptional<z.ZodString>;
|
|
90
94
|
requirements: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -31,9 +31,9 @@ export declare function setSandboxEgressCredentialLease(context: SandboxEgressCr
|
|
|
31
31
|
/**
|
|
32
32
|
* Load cached credential header transforms for the exact actor/context/grant.
|
|
33
33
|
*/
|
|
34
|
-
export declare function getSandboxEgressCredentialLease(provider: string,
|
|
34
|
+
export declare function getSandboxEgressCredentialLease(provider: string, grant: SandboxEgressCredentialLease["grant"], context: SandboxEgressCredentialContext): Promise<SandboxEgressCredentialLease | undefined>;
|
|
35
35
|
/** Clear a cached lease after the upstream provider rejects its auth headers. */
|
|
36
|
-
export declare function clearSandboxEgressCredentialLease(provider: string,
|
|
36
|
+
export declare function clearSandboxEgressCredentialLease(provider: string, grant: SandboxEgressCredentialLease["grant"], context: SandboxEgressCredentialContext): Promise<void>;
|
|
37
37
|
/**
|
|
38
38
|
* Record that credential issuance needs user authorization for this command.
|
|
39
39
|
*
|
|
@@ -7327,7 +7327,7 @@ function createStateAdvisorSessionStore() {
|
|
|
7327
7327
|
|
|
7328
7328
|
// src/chat/tools/advisor/tool.ts
|
|
7329
7329
|
import { z as z33 } from "zod";
|
|
7330
|
-
var ADVISOR_TOOL_DESCRIPTION = "
|
|
7330
|
+
var ADVISOR_TOOL_DESCRIPTION = "High-reasoning technical advisor for planning and reviewing non-trivial work. Use it at two high-leverage checkpoints: (1) after enough investigation to understand the problem, but before implementation, to challenge the proposed approach, architecture, risks, alternatives, and verification plan; and (2) after implementation and initial validation, but before finalizing, committing, opening a PR, or reporting completion, to review the diff and results for correctness, regressions, omissions, and insufficient testing. Also consult it when requirements remain ambiguous, risk is unusually high, or repeated attempts have failed. Ask a focused question and provide self-contained, curated context such as requirements, exact evidence, constraints, relevant code, command output, proposed plan, alternatives considered, diff, and validation results. The advisor does not automatically receive the parent transcript and may use read-only tools to verify supplied context. For follow-ups, include new evidence, changes made, or the specific unresolved concern. Do not use it for greetings, routine formatting, simple deterministic edits, or as a substitute for direct investigation and validation.";
|
|
7331
7331
|
var ADVISOR_SYSTEM_PROMPT = [
|
|
7332
7332
|
"You are a senior technical advisor for the executor.",
|
|
7333
7333
|
"Analyze the executor-supplied context deeply. Use read-only tools when direct inspection or verification would materially improve the advice.",
|
|
@@ -9726,10 +9726,11 @@ var SANDBOX_EGRESS_AUTH_SIGNAL_PREFIX = "sandbox-egress-auth-required";
|
|
|
9726
9726
|
var SANDBOX_EGRESS_PERMISSION_SIGNAL_PREFIX = "sandbox-egress-permission-denied";
|
|
9727
9727
|
var SANDBOX_EGRESS_LEASE_PREFIX = "sandbox-egress-lease";
|
|
9728
9728
|
var DEFAULT_SESSION_TTL_MS = 30 * 60 * 1e3;
|
|
9729
|
-
function leaseKey(provider,
|
|
9729
|
+
function leaseKey(provider, grant, context) {
|
|
9730
9730
|
const actor = context.credentials.actor;
|
|
9731
9731
|
const actorKey = "type" in actor ? `user:${actor.userId}` : `system:${actor.name}`;
|
|
9732
|
-
|
|
9732
|
+
const grantKey = grant.leaseScope ? `${grant.name}:${grant.leaseScope}` : grant.name;
|
|
9733
|
+
return `${SANDBOX_EGRESS_LEASE_PREFIX}:${provider}:${grantKey}:${actorKey}:${context.egressId}:${context.contextId}`;
|
|
9733
9734
|
}
|
|
9734
9735
|
function authSignalKey(egressId, access) {
|
|
9735
9736
|
return `${SANDBOX_EGRESS_AUTH_SIGNAL_PREFIX}:${egressId}:${access}`;
|
|
@@ -9830,21 +9831,17 @@ async function setSandboxEgressCredentialLease(context, lease) {
|
|
|
9830
9831
|
);
|
|
9831
9832
|
const state = getStateAdapter();
|
|
9832
9833
|
await state.connect();
|
|
9833
|
-
await state.set(
|
|
9834
|
-
leaseKey(lease.provider, lease.grant.name, context),
|
|
9835
|
-
lease,
|
|
9836
|
-
ttlMs2
|
|
9837
|
-
);
|
|
9834
|
+
await state.set(leaseKey(lease.provider, lease.grant, context), lease, ttlMs2);
|
|
9838
9835
|
}
|
|
9839
|
-
async function getSandboxEgressCredentialLease(provider,
|
|
9836
|
+
async function getSandboxEgressCredentialLease(provider, grant, context) {
|
|
9840
9837
|
const state = getStateAdapter();
|
|
9841
9838
|
await state.connect();
|
|
9842
|
-
return parseLease(await state.get(leaseKey(provider,
|
|
9839
|
+
return parseLease(await state.get(leaseKey(provider, grant, context)));
|
|
9843
9840
|
}
|
|
9844
|
-
async function clearSandboxEgressCredentialLease(provider,
|
|
9841
|
+
async function clearSandboxEgressCredentialLease(provider, grant, context) {
|
|
9845
9842
|
const state = getStateAdapter();
|
|
9846
9843
|
await state.connect();
|
|
9847
|
-
await state.delete(leaseKey(provider,
|
|
9844
|
+
await state.delete(leaseKey(provider, grant, context));
|
|
9848
9845
|
}
|
|
9849
9846
|
async function setSandboxEgressAuthRequiredSignal(context, signal) {
|
|
9850
9847
|
const ttlMs2 = Math.max(1, context.expiresAtMs - Date.now());
|
|
@@ -12494,7 +12491,7 @@ async function sandboxEgressCredentialLease(provider, selection, context) {
|
|
|
12494
12491
|
const { grant } = selection;
|
|
12495
12492
|
const cached = await getSandboxEgressCredentialLease(
|
|
12496
12493
|
provider,
|
|
12497
|
-
grant
|
|
12494
|
+
grant,
|
|
12498
12495
|
context
|
|
12499
12496
|
);
|
|
12500
12497
|
if (cached) {
|
|
@@ -13096,7 +13093,7 @@ async function executeCredentialedEgressRequest(input) {
|
|
|
13096
13093
|
if (!isEgressAuthRequired(error)) {
|
|
13097
13094
|
throw error;
|
|
13098
13095
|
}
|
|
13099
|
-
await clearCredentialLease(provider, lease.grant
|
|
13096
|
+
await clearCredentialLease(provider, lease.grant, credentialContext);
|
|
13100
13097
|
await recordAuthRequired({
|
|
13101
13098
|
credentialContext,
|
|
13102
13099
|
provider,
|
|
@@ -13153,7 +13150,7 @@ async function executeCredentialedEgressRequest(input) {
|
|
|
13153
13150
|
upstream.status === UPSTREAM_TOKEN_REJECTION_STATUS ? "Sandbox egress upstream auth rejected injected credential" : "Sandbox egress upstream permission denied"
|
|
13154
13151
|
);
|
|
13155
13152
|
if (upstream.status === UPSTREAM_TOKEN_REJECTION_STATUS) {
|
|
13156
|
-
await clearCredentialLease(provider, lease.grant
|
|
13153
|
+
await clearCredentialLease(provider, lease.grant, credentialContext);
|
|
13157
13154
|
await recordAuthRequired({
|
|
13158
13155
|
credentialContext,
|
|
13159
13156
|
provider,
|
|
@@ -13169,7 +13166,7 @@ async function executeCredentialedEgressRequest(input) {
|
|
|
13169
13166
|
`
|
|
13170
13167
|
});
|
|
13171
13168
|
} else {
|
|
13172
|
-
await clearCredentialLease(provider, lease.grant
|
|
13169
|
+
await clearCredentialLease(provider, lease.grant, credentialContext);
|
|
13173
13170
|
await recordPermissionDenied({
|
|
13174
13171
|
credentialContext,
|
|
13175
13172
|
provider,
|
package/dist/cli/chat.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.94.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"pg": "^8.16.3",
|
|
79
79
|
"yaml": "^2.9.0",
|
|
80
80
|
"zod": "^4.4.3",
|
|
81
|
-
"@sentry/junior-plugin-api": "0.
|
|
81
|
+
"@sentry/junior-plugin-api": "0.94.0"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@emnapi/core": "^1.10.0",
|
|
@@ -94,10 +94,10 @@
|
|
|
94
94
|
"typescript": "^6.0.3",
|
|
95
95
|
"vercel": "^54.4.0",
|
|
96
96
|
"vitest": "^4.1.7",
|
|
97
|
-
"@sentry/junior-
|
|
98
|
-
"@sentry/junior-
|
|
99
|
-
"@sentry/junior-
|
|
100
|
-
"@sentry/junior-
|
|
97
|
+
"@sentry/junior-github": "0.94.0",
|
|
98
|
+
"@sentry/junior-memory": "0.94.0",
|
|
99
|
+
"@sentry/junior-scheduler": "0.94.0",
|
|
100
|
+
"@sentry/junior-testing": "0.0.0"
|
|
101
101
|
},
|
|
102
102
|
"scripts": {
|
|
103
103
|
"build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",
|