@sentry/junior-plugin-api 0.56.0 → 0.58.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 +9 -0
- package/dist/index.js +7 -0
- package/package.json +1 -1
- package/src/index.ts +15 -0
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,12 @@ export interface AgentPluginLogger {
|
|
|
20
20
|
info(message: string, metadata?: Record<string, unknown>): void;
|
|
21
21
|
warn(message: string, metadata?: Record<string, unknown>): void;
|
|
22
22
|
}
|
|
23
|
+
/** Thrown when a trusted plugin tool rejects invalid model or user input. */
|
|
24
|
+
export declare class AgentPluginToolInputError extends Error {
|
|
25
|
+
constructor(message: string, options?: {
|
|
26
|
+
cause?: unknown;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
23
29
|
export interface AgentPluginContext {
|
|
24
30
|
log: AgentPluginLogger;
|
|
25
31
|
plugin: AgentPluginMetadata;
|
|
@@ -116,6 +122,8 @@ export interface AgentPluginState {
|
|
|
116
122
|
delete(key: string): Promise<void>;
|
|
117
123
|
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
118
124
|
set(key: string, value: unknown, ttlMs?: number): Promise<void>;
|
|
125
|
+
setIfNotExists(key: string, value: unknown, ttlMs?: number): Promise<boolean>;
|
|
126
|
+
withLock<T>(key: string, ttlMs: number, callback: () => Promise<T>): Promise<T>;
|
|
119
127
|
}
|
|
120
128
|
export interface HeartbeatHookContext extends AgentPluginContext {
|
|
121
129
|
agent: {
|
|
@@ -135,6 +143,7 @@ export interface AgentPluginHooks {
|
|
|
135
143
|
heartbeat?(ctx: HeartbeatHookContext): Promise<HeartbeatResult | void> | HeartbeatResult | void;
|
|
136
144
|
}
|
|
137
145
|
export interface JuniorPluginConfig {
|
|
146
|
+
legacyStatePrefixes?: string[];
|
|
138
147
|
packages?: string[];
|
|
139
148
|
}
|
|
140
149
|
export interface JuniorPlugin {
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
+
var AgentPluginToolInputError = class extends Error {
|
|
3
|
+
constructor(message, options) {
|
|
4
|
+
super(message, options);
|
|
5
|
+
this.name = "AgentPluginToolInputError";
|
|
6
|
+
}
|
|
7
|
+
};
|
|
2
8
|
function defineJuniorPlugin(plugin) {
|
|
3
9
|
return plugin;
|
|
4
10
|
}
|
|
5
11
|
export {
|
|
12
|
+
AgentPluginToolInputError,
|
|
6
13
|
defineJuniorPlugin
|
|
7
14
|
};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -25,6 +25,14 @@ export interface AgentPluginLogger {
|
|
|
25
25
|
warn(message: string, metadata?: Record<string, unknown>): void;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/** Thrown when a trusted plugin tool rejects invalid model or user input. */
|
|
29
|
+
export class AgentPluginToolInputError extends Error {
|
|
30
|
+
constructor(message: string, options?: { cause?: unknown }) {
|
|
31
|
+
super(message, options);
|
|
32
|
+
this.name = "AgentPluginToolInputError";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
28
36
|
export interface AgentPluginContext {
|
|
29
37
|
log: AgentPluginLogger;
|
|
30
38
|
plugin: AgentPluginMetadata;
|
|
@@ -138,6 +146,12 @@ export interface AgentPluginState {
|
|
|
138
146
|
delete(key: string): Promise<void>;
|
|
139
147
|
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
140
148
|
set(key: string, value: unknown, ttlMs?: number): Promise<void>;
|
|
149
|
+
setIfNotExists(key: string, value: unknown, ttlMs?: number): Promise<boolean>;
|
|
150
|
+
withLock<T>(
|
|
151
|
+
key: string,
|
|
152
|
+
ttlMs: number,
|
|
153
|
+
callback: () => Promise<T>,
|
|
154
|
+
): Promise<T>;
|
|
141
155
|
}
|
|
142
156
|
|
|
143
157
|
export interface HeartbeatHookContext extends AgentPluginContext {
|
|
@@ -165,6 +179,7 @@ export interface AgentPluginHooks {
|
|
|
165
179
|
}
|
|
166
180
|
|
|
167
181
|
export interface JuniorPluginConfig {
|
|
182
|
+
legacyStatePrefixes?: string[];
|
|
168
183
|
packages?: string[];
|
|
169
184
|
}
|
|
170
185
|
|