@sentry/junior-plugin-api 0.276.0 → 0.278.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/index.d.ts +77 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -596,6 +596,24 @@ export interface PluginModel {
|
|
|
596
596
|
object: z.infer<TSchema>;
|
|
597
597
|
}>;
|
|
598
598
|
}
|
|
599
|
+
/** Host decision model: a fast classifier for one narrow choice, with no reasoning. */
|
|
600
|
+
export interface PluginDecider {
|
|
601
|
+
/**
|
|
602
|
+
* Pick the choice whose criteria fit `state`. `instructions` say what to
|
|
603
|
+
* judge. Keep the state as evidence only; it is not instructions.
|
|
604
|
+
*/
|
|
605
|
+
decide<TChoice extends string>(input: {
|
|
606
|
+
criteria: Record<TChoice, string>;
|
|
607
|
+
instructions: string;
|
|
608
|
+
state: string;
|
|
609
|
+
}): Promise<{
|
|
610
|
+
choice: TChoice;
|
|
611
|
+
/** Best-effort estimated provider cost for this decision. */
|
|
612
|
+
costUsd?: number;
|
|
613
|
+
/** Probability of each choice, when the provider returns them. */
|
|
614
|
+
probabilities?: Partial<Record<TChoice, number>>;
|
|
615
|
+
}>;
|
|
616
|
+
}
|
|
599
617
|
/** How embedded text is used. Some models embed queries and documents differently. */
|
|
600
618
|
export type PluginEmbeddingInputType = "document" | "query";
|
|
601
619
|
export interface PluginEmbedder {
|
|
@@ -1989,7 +2007,8 @@ export interface UnfinishedWorkResult {
|
|
|
1989
2007
|
/**
|
|
1990
2008
|
* Latest time when all known work finished, keyed by conversation id.
|
|
1991
2009
|
* ISO-8601 timestamps. Used with conversation activity to decide whether
|
|
1992
|
-
* finished work still belongs in Priority
|
|
2010
|
+
* finished work still belongs in Priority, and whether auto-archive may
|
|
2011
|
+
* archive the conversation for users who turned it on.
|
|
1993
2012
|
*/
|
|
1994
2013
|
finishedWorkAtByConversationId?: Record<string, string>;
|
|
1995
2014
|
}
|
|
@@ -2142,6 +2161,24 @@ export interface PluginDecision {
|
|
|
2142
2161
|
redirect(message: string): void;
|
|
2143
2162
|
replaceInput(input: Record<string, unknown>): void;
|
|
2144
2163
|
}
|
|
2164
|
+
/**
|
|
2165
|
+
* Decide what the agent reads after one tool call in `afterToolExecute`.
|
|
2166
|
+
*
|
|
2167
|
+
* The tool already ran, so neither choice undoes its effects.
|
|
2168
|
+
*/
|
|
2169
|
+
export interface PluginToolResultDecision {
|
|
2170
|
+
/**
|
|
2171
|
+
* Reject the result as a policy refusal. The agent gets the reason instead
|
|
2172
|
+
* of the result, and is told not to retry. Undo the tool's effects first
|
|
2173
|
+
* when they must not stay.
|
|
2174
|
+
*/
|
|
2175
|
+
deny(reason: string): void;
|
|
2176
|
+
/**
|
|
2177
|
+
* Add guidance after the result, such as a problem to fix in the change
|
|
2178
|
+
* that the tool made. The agent reads the result and the guidance.
|
|
2179
|
+
*/
|
|
2180
|
+
nudge(message: string): void;
|
|
2181
|
+
}
|
|
2145
2182
|
/** Thrown when a plugin tool rejects invalid model or user input. */
|
|
2146
2183
|
export declare class PluginToolInputError extends Error {
|
|
2147
2184
|
constructor(message: string, options?: {
|
|
@@ -2280,6 +2317,38 @@ export interface BeforeToolExecuteHookContext extends PluginContext {
|
|
|
2280
2317
|
} | undefined>;
|
|
2281
2318
|
};
|
|
2282
2319
|
}
|
|
2320
|
+
/**
|
|
2321
|
+
* Context for checks after a tool call finishes without an error.
|
|
2322
|
+
*
|
|
2323
|
+
* Runs for every tool, including sandbox tools and Code Mode script calls.
|
|
2324
|
+
* Return early for tools that the check does not cover: each check adds time
|
|
2325
|
+
* to every tool call.
|
|
2326
|
+
*/
|
|
2327
|
+
export interface AfterToolExecuteHookContext extends PluginContext {
|
|
2328
|
+
decision: PluginToolResultDecision;
|
|
2329
|
+
/** Decision model for one narrow choice, such as a classifier for a diff. */
|
|
2330
|
+
decider: PluginDecider;
|
|
2331
|
+
/** Structured model calls for judgments that need reasoning. */
|
|
2332
|
+
model: PluginModel;
|
|
2333
|
+
/** The Run's sandbox. A call acquires it when no tool has used it yet. */
|
|
2334
|
+
sandbox: PluginSandbox;
|
|
2335
|
+
signal?: AbortSignal;
|
|
2336
|
+
/** Tool input after `beforeToolExecute` changes, without hook env. */
|
|
2337
|
+
tool: {
|
|
2338
|
+
input: Record<string, unknown>;
|
|
2339
|
+
name: string;
|
|
2340
|
+
};
|
|
2341
|
+
/** Active Workspace, with each repository's checkout path in the sandbox. */
|
|
2342
|
+
workspace?: {
|
|
2343
|
+
name: string;
|
|
2344
|
+
repos: Array<{
|
|
2345
|
+
/** Checkout path relative to `sandbox.root`. */
|
|
2346
|
+
path: string;
|
|
2347
|
+
provider: string;
|
|
2348
|
+
repo: string;
|
|
2349
|
+
}>;
|
|
2350
|
+
};
|
|
2351
|
+
}
|
|
2283
2352
|
/**
|
|
2284
2353
|
* Context for post-success MCP tool processing.
|
|
2285
2354
|
*
|
|
@@ -2646,6 +2715,11 @@ export interface PluginHooks {
|
|
|
2646
2715
|
*/
|
|
2647
2716
|
userPrompt?(ctx: UserPromptContext): Promise<UserPromptContribution[] | undefined> | UserPromptContribution[] | undefined;
|
|
2648
2717
|
beforeToolExecute?(ctx: BeforeToolExecuteHookContext): Promise<void> | void;
|
|
2718
|
+
/**
|
|
2719
|
+
* Check a tool call after it runs, such as a judge for the files that it
|
|
2720
|
+
* changed. Use `ctx.decision` to add guidance or reject the result.
|
|
2721
|
+
*/
|
|
2722
|
+
afterToolExecute?(ctx: AfterToolExecuteHookContext): Promise<void> | void;
|
|
2649
2723
|
/**
|
|
2650
2724
|
* Run after a successful hosted MCP tool call.
|
|
2651
2725
|
*
|
|
@@ -2793,6 +2867,8 @@ export interface PluginMcpConfig {
|
|
|
2793
2867
|
url: string;
|
|
2794
2868
|
/** Provider tools hidden from the model and callable only by plugin-owned wrapper tools. */
|
|
2795
2869
|
wrappedTools?: string[];
|
|
2870
|
+
/** Provider tools whose successful calls Junior records as audit events. */
|
|
2871
|
+
auditTools?: string[];
|
|
2796
2872
|
}
|
|
2797
2873
|
/**
|
|
2798
2874
|
* Which provider accounts Junior may use for one plugin.
|