@sentry/junior-plugin-api 0.122.0 → 0.122.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/hooks.d.ts +8 -1
- package/dist/tools.d.ts +23 -0
- package/package.json +1 -1
- package/src/hooks.ts +8 -0
- package/src/tools.ts +24 -0
package/dist/hooks.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import type { EgressHookContext, EgressResponseHookContext, IssueCredentialHookContext, PluginCredentialResult, PluginGrant, PluginProviderAccount, ResolveOAuthAccountHookContext } from "./credentials";
|
|
2
2
|
import type { HeartbeatHookContext, HeartbeatResult, OperationalReportHookContext, ApiRouteRegistrationHookContext, PluginOperationalReportContent, PluginRoute, PluginRouteApp, RouteRegistrationHookContext, SlackConversationLink, SlackConversationLinkHookContext } from "./operations";
|
|
3
|
-
import type { BeforeToolExecuteHookContext, PluginToolDefinition, SandboxPrepareHookContext, ToolRegistrationHookContext } from "./tools";
|
|
3
|
+
import type { AfterMcpToolHookContext, BeforeToolExecuteHookContext, PluginToolDefinition, SandboxPrepareHookContext, ToolRegistrationHookContext } from "./tools";
|
|
4
4
|
import type { PromptMessage, SystemPromptContext, UserPromptContext, UserPromptContribution } from "./prompt";
|
|
5
5
|
export interface PluginHooks {
|
|
6
6
|
systemPrompt?(ctx: SystemPromptContext): Promise<PromptMessage[]> | PromptMessage[];
|
|
7
7
|
userPrompt?(ctx: UserPromptContext): Promise<UserPromptContribution[] | undefined> | UserPromptContribution[] | undefined;
|
|
8
8
|
beforeToolExecute?(ctx: BeforeToolExecuteHookContext): Promise<void> | void;
|
|
9
|
+
/**
|
|
10
|
+
* Run after a successful hosted MCP tool call.
|
|
11
|
+
*
|
|
12
|
+
* Prefer this for junior-owned side effects such as conversation annotations.
|
|
13
|
+
* Do not use it to invent a parallel tool contract for the provider tool.
|
|
14
|
+
*/
|
|
15
|
+
afterMcpTool?(ctx: AfterMcpToolHookContext): Promise<void> | void;
|
|
9
16
|
grantForEgress?(ctx: EgressHookContext): Promise<PluginGrant | undefined> | PluginGrant | undefined;
|
|
10
17
|
heartbeat?(ctx: HeartbeatHookContext): Promise<HeartbeatResult | void> | HeartbeatResult | void;
|
|
11
18
|
issueCredential?(ctx: IssueCredentialHookContext): Promise<PluginCredentialResult> | PluginCredentialResult;
|
package/dist/tools.d.ts
CHANGED
|
@@ -123,6 +123,29 @@ export interface BeforeToolExecuteHookContext extends PluginContext {
|
|
|
123
123
|
name: string;
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Context for post-success MCP tool processing.
|
|
128
|
+
*
|
|
129
|
+
* Runs after a hosted MCP tool succeeds on the model-facing path. Use for
|
|
130
|
+
* junior-owned side effects such as conversation annotations without replacing
|
|
131
|
+
* the provider tool contract.
|
|
132
|
+
*/
|
|
133
|
+
export interface AfterMcpToolHookContext extends PluginContext {
|
|
134
|
+
/**
|
|
135
|
+
* Opaque Junior conversation/session identity for this turn.
|
|
136
|
+
* Interactive Slack turns use `slack:{channelId}:{threadTs}`.
|
|
137
|
+
*/
|
|
138
|
+
conversationId?: string;
|
|
139
|
+
annotations?: PluginAnnotations;
|
|
140
|
+
result: {
|
|
141
|
+
structuredContent?: unknown;
|
|
142
|
+
};
|
|
143
|
+
tool: {
|
|
144
|
+
arguments: Record<string, unknown>;
|
|
145
|
+
/** Provider-local MCP tool name, for example `save_issue`. */
|
|
146
|
+
name: string;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
126
149
|
export interface PluginToolExecuteOptions {
|
|
127
150
|
/**
|
|
128
151
|
* @deprecated Internal compatibility escape hatch for legacy tool bridges.
|
package/package.json
CHANGED
package/src/hooks.ts
CHANGED
|
@@ -20,6 +20,7 @@ import type {
|
|
|
20
20
|
SlackConversationLinkHookContext,
|
|
21
21
|
} from "./operations";
|
|
22
22
|
import type {
|
|
23
|
+
AfterMcpToolHookContext,
|
|
23
24
|
BeforeToolExecuteHookContext,
|
|
24
25
|
PluginToolDefinition,
|
|
25
26
|
SandboxPrepareHookContext,
|
|
@@ -43,6 +44,13 @@ export interface PluginHooks {
|
|
|
43
44
|
| UserPromptContribution[]
|
|
44
45
|
| undefined;
|
|
45
46
|
beforeToolExecute?(ctx: BeforeToolExecuteHookContext): Promise<void> | void;
|
|
47
|
+
/**
|
|
48
|
+
* Run after a successful hosted MCP tool call.
|
|
49
|
+
*
|
|
50
|
+
* Prefer this for junior-owned side effects such as conversation annotations.
|
|
51
|
+
* Do not use it to invent a parallel tool contract for the provider tool.
|
|
52
|
+
*/
|
|
53
|
+
afterMcpTool?(ctx: AfterMcpToolHookContext): Promise<void> | void;
|
|
46
54
|
grantForEgress?(
|
|
47
55
|
ctx: EgressHookContext,
|
|
48
56
|
): Promise<PluginGrant | undefined> | PluginGrant | undefined;
|
package/src/tools.ts
CHANGED
|
@@ -153,6 +153,30 @@ export interface BeforeToolExecuteHookContext extends PluginContext {
|
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Context for post-success MCP tool processing.
|
|
158
|
+
*
|
|
159
|
+
* Runs after a hosted MCP tool succeeds on the model-facing path. Use for
|
|
160
|
+
* junior-owned side effects such as conversation annotations without replacing
|
|
161
|
+
* the provider tool contract.
|
|
162
|
+
*/
|
|
163
|
+
export interface AfterMcpToolHookContext extends PluginContext {
|
|
164
|
+
/**
|
|
165
|
+
* Opaque Junior conversation/session identity for this turn.
|
|
166
|
+
* Interactive Slack turns use `slack:{channelId}:{threadTs}`.
|
|
167
|
+
*/
|
|
168
|
+
conversationId?: string;
|
|
169
|
+
annotations?: PluginAnnotations;
|
|
170
|
+
result: {
|
|
171
|
+
structuredContent?: unknown;
|
|
172
|
+
};
|
|
173
|
+
tool: {
|
|
174
|
+
arguments: Record<string, unknown>;
|
|
175
|
+
/** Provider-local MCP tool name, for example `save_issue`. */
|
|
176
|
+
name: string;
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
|
|
156
180
|
export interface PluginToolExecuteOptions {
|
|
157
181
|
/**
|
|
158
182
|
* @deprecated Internal compatibility escape hatch for legacy tool bridges.
|