@sentry/junior 0.136.1 → 0.138.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-2KDSPPO4.js → agent-hooks-SCR74Q3E.js} +11 -9
- package/dist/api/conversations/projection.d.ts +1 -0
- package/dist/api/conversations/stats.d.ts +1 -0
- package/dist/api/schema/conversation.d.ts +2 -0
- package/dist/api/schema.js +1 -1
- package/dist/api.js +187 -46
- package/dist/app.d.ts +8 -1
- package/dist/app.js +519 -860
- package/dist/{catalog-runtime-WSZQGC4D.js → catalog-runtime-IU3QF4GG.js} +5 -5
- package/dist/chat/agent/request.d.ts +32 -2
- package/dist/chat/agent-dispatch/heartbeat.d.ts +5 -0
- package/dist/chat/agent-dispatch/types.d.ts +1 -1
- package/dist/chat/agent-invocations/errors.d.ts +8 -0
- package/dist/chat/agent-invocations/spawn.d.ts +12 -0
- package/dist/chat/agent-invocations/store.d.ts +44 -0
- package/dist/chat/agent-invocations/types.d.ts +449 -0
- package/dist/chat/agent-invocations/work.d.ts +31 -0
- package/dist/chat/config.d.ts +1 -0
- package/dist/chat/configuration/defaults.d.ts +1 -1
- package/dist/chat/conversations/sql/store.d.ts +8 -0
- package/dist/chat/conversations/store.d.ts +9 -1
- package/dist/chat/experimental.d.ts +16 -0
- package/dist/chat/pi/client.d.ts +1 -8
- package/dist/chat/pi/gateway-auth.d.ts +16 -0
- package/dist/chat/runtime/agent-runner.d.ts +2 -1
- package/dist/chat/sandbox/docker.d.ts +17 -0
- package/dist/chat/services/agent-continue.d.ts +2 -0
- package/dist/chat/services/auth-pause.d.ts +0 -1
- package/dist/chat/services/mcp-auth-orchestration.d.ts +3 -2
- package/dist/chat/services/plugin-auth-orchestration.d.ts +3 -2
- package/dist/chat/services/subscribed-reply-router-policy.d.ts +12 -0
- package/dist/chat/services/turn-session-routing.d.ts +17 -0
- package/dist/chat/slack/message.d.ts +6 -1
- package/dist/chat/slack/source-link.d.ts +8 -2
- package/dist/chat/slack/team-domain.d.ts +4 -0
- package/dist/chat/source.d.ts +5 -5
- package/dist/chat/state/turn-session.d.ts +0 -2
- package/dist/chat/task-execution/state.d.ts +23 -11
- package/dist/chat/task-execution/store.d.ts +20 -11
- package/dist/chat/task-execution/worker.d.ts +2 -2
- package/dist/chat/tools/runtime/spawn-agent.d.ts +31 -0
- package/dist/chat/tools/types.d.ts +2 -0
- package/dist/chunk-3Y47VMHV.js +6 -0
- package/dist/chunk-5IDFPCON.js +46 -0
- package/dist/chunk-5LTJ4ITU.js +1523 -0
- package/dist/{chunk-KLBYCSLJ.js → chunk-5MXWHTCK.js} +17 -434
- package/dist/{chunk-CZZDCH3Q.js → chunk-A7WCHXZV.js} +206 -78
- package/dist/{chunk-4YQ6I6VF.js → chunk-BOLJOV5T.js} +2 -56
- package/dist/{chunk-XCZ6COFO.js → chunk-BYW4B4PR.js} +90 -54
- package/dist/{chunk-JQRTXJHD.js → chunk-C7ZVPO4Z.js} +2 -1
- package/dist/{chunk-MW2QRPGW.js → chunk-DCLLQGS6.js} +119 -50
- package/dist/{chunk-CDVCCOMF.js → chunk-E5UYAIKJ.js} +75 -1475
- package/dist/{chunk-3SUK3UXX.js → chunk-ELKW5FIB.js} +5 -5
- package/dist/chunk-EM225ITJ.js +56 -0
- package/dist/{chunk-Y6JNHTRD.js → chunk-FEUNPTGV.js} +34 -70
- package/dist/{chunk-TYNMSQKA.js → chunk-FNLBTB4K.js} +1 -1
- package/dist/{chunk-TRZSM67C.js → chunk-HCIVH3JS.js} +1 -0
- package/dist/chunk-HIWJWWMT.js +668 -0
- package/dist/chunk-IUFM5JWV.js +24 -0
- package/dist/{chunk-XWPA5KZF.js → chunk-JNNJZURV.js} +1 -1
- package/dist/{chunk-6ZK6FZIV.js → chunk-KCBZSJRU.js} +6 -27
- package/dist/{chunk-BG3KWWDJ.js → chunk-KDCHVT25.js} +1 -1
- package/dist/{chunk-VH6MI4L7.js → chunk-KFRHRSCJ.js} +1 -1
- package/dist/chunk-LPVUNO2W.js +320 -0
- package/dist/{chunk-G66RYKRS.js → chunk-N7WARMC6.js} +16 -776
- package/dist/chunk-PB3CXNVL.js +41 -0
- package/dist/chunk-Q6QZTTLS.js +55 -0
- package/dist/{chunk-3QNJOHKG.js → chunk-QS527AV5.js} +1 -1
- package/dist/chunk-R776HKPK.js +81 -0
- package/dist/{chunk-OTJMQYVP.js → chunk-RZIBSCYC.js} +517 -608
- package/dist/chunk-SD3OFRWY.js +714 -0
- package/dist/{chunk-HIRIWTWD.js → chunk-SIPKWSXK.js} +58 -10
- package/dist/chunk-TCS76X5D.js +441 -0
- package/dist/{chunk-UX2TNH5D.js → chunk-TDJCLNDH.js} +3 -3
- package/dist/{chunk-NVVBEJUB.js → chunk-TUUDXEXU.js} +336 -300
- package/dist/{chunk-22Z6MGMK.js → chunk-VPZFVJND.js} +1 -1
- package/dist/{chunk-RFDD3Z2I.js → chunk-YU5QUF67.js} +1 -1
- package/dist/chunk-ZBSMCXKV.js +710 -0
- package/dist/{chunk-FSYXYBWU.js → chunk-ZXNTJJIE.js} +2 -2
- package/dist/cli/chat.js +65 -26
- package/dist/cli/check.js +7 -7
- package/dist/cli/plugins.js +14 -12
- package/dist/cli/snapshot-create.js +10 -9
- package/dist/cli/upgrade.js +7 -7
- package/dist/conversation-work-KATFHLG3.js +56 -0
- package/dist/db/schema/agent-invocations.d.ts +544 -0
- package/dist/db/schema.d.ts +543 -1
- package/dist/{db-Z2NNL2JC.js → db-UO2IWXGA.js} +7 -7
- package/dist/experimental-HH6OM6UH.js +13 -0
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +4 -3
- package/dist/{oauth-callback-server-PO3M5JMG.js → oauth-callback-server-MAQI43LX.js} +26 -18
- package/dist/{runner-QHQYZYJA.js → runner-PIUQEXKE.js} +26 -14
- package/dist/{skills-KXMT3DRA.js → skills-4ARJADHQ.js} +6 -6
- package/dist/spawn-G2AWPMCT.js +38 -0
- package/dist/{validation-Y42ULTT6.js → validation-S3EE3HWL.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/work-UARRUAW3.js +46 -0
- package/dist/worker-DOCIRVD3.js +24 -0
- package/migrations/0021_first_warhawk.sql +35 -0
- package/migrations/meta/0021_snapshot.json +2176 -0
- package/migrations/meta/_journal.json +8 -1
- package/package.json +6 -5
|
@@ -1,38 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
conversationQueueMessageSchema
|
|
3
|
+
} from "./chunk-IUFM5JWV.js";
|
|
1
4
|
import {
|
|
2
5
|
createVercelQueueClient
|
|
3
6
|
} from "./chunk-5I6ORJUY.js";
|
|
4
7
|
|
|
5
8
|
// src/chat/task-execution/queue-signing.ts
|
|
6
9
|
import { createHmac, timingSafeEqual } from "crypto";
|
|
7
|
-
import { z as z2 } from "zod";
|
|
8
|
-
|
|
9
|
-
// src/chat/task-execution/queue.ts
|
|
10
10
|
import { z } from "zod";
|
|
11
|
-
var conversationQueueMessageSchema = z.object({
|
|
12
|
-
conversationId: z.string().trim().min(1)
|
|
13
|
-
}).strict();
|
|
14
|
-
var ConversationQueueMessageRejectedError = class extends Error {
|
|
15
|
-
conversationId;
|
|
16
|
-
reason;
|
|
17
|
-
constructor(reason, message, options = {}) {
|
|
18
|
-
super(message);
|
|
19
|
-
this.name = "ConversationQueueMessageRejectedError";
|
|
20
|
-
this.reason = reason;
|
|
21
|
-
this.conversationId = options.conversationId;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
function isConversationQueueMessageRejectedError(error) {
|
|
25
|
-
return error instanceof ConversationQueueMessageRejectedError;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// src/chat/task-execution/queue-signing.ts
|
|
29
11
|
var CONVERSATION_WORK_QUEUE_SIGNATURE_CONTEXT = "junior.conversation_work_queue.v2";
|
|
30
12
|
var CONVERSATION_WORK_QUEUE_SIGNATURE_VERSION = "v2";
|
|
31
13
|
var CONVERSATION_WORK_QUEUE_SIGNATURE_MAX_SKEW_MS = 60 * 60 * 1e3;
|
|
32
14
|
var signedConversationQueueMessageSchema = conversationQueueMessageSchema.extend({
|
|
33
|
-
signature:
|
|
34
|
-
signatureVersion:
|
|
35
|
-
signedAtMs:
|
|
15
|
+
signature: z.string().trim().min(1),
|
|
16
|
+
signatureVersion: z.literal(CONVERSATION_WORK_QUEUE_SIGNATURE_VERSION),
|
|
17
|
+
signedAtMs: z.number().finite()
|
|
36
18
|
}).strict();
|
|
37
19
|
function getConversationWorkQueueSecret() {
|
|
38
20
|
return process.env.JUNIOR_SECRET?.trim() || void 0;
|
|
@@ -139,9 +121,6 @@ function getVercelConversationWorkQueue() {
|
|
|
139
121
|
}
|
|
140
122
|
|
|
141
123
|
export {
|
|
142
|
-
conversationQueueMessageSchema,
|
|
143
|
-
ConversationQueueMessageRejectedError,
|
|
144
|
-
isConversationQueueMessageRejectedError,
|
|
145
124
|
verifyConversationQueueMessage,
|
|
146
125
|
resolveConversationWorkQueueTopic,
|
|
147
126
|
getVercelConversationWorkQueue
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import {
|
|
2
|
+
authorizationId
|
|
3
|
+
} from "./chunk-DIB4GX3G.js";
|
|
4
|
+
import {
|
|
5
|
+
formatProviderLabel,
|
|
6
|
+
startOAuthFlow
|
|
7
|
+
} from "./chunk-SD3OFRWY.js";
|
|
8
|
+
import {
|
|
9
|
+
abandonReplacedPendingAuth,
|
|
10
|
+
canReusePendingAuthLink,
|
|
11
|
+
recordAuthorizationRequested
|
|
12
|
+
} from "./chunk-TUUDXEXU.js";
|
|
13
|
+
import {
|
|
14
|
+
parseSandboxEgressAuthRequiredSignal
|
|
15
|
+
} from "./chunk-EPBBYMNE.js";
|
|
16
|
+
import {
|
|
17
|
+
AGENT_INVOCATION_MAILBOX_STATUSES
|
|
18
|
+
} from "./chunk-DCLLQGS6.js";
|
|
19
|
+
import {
|
|
20
|
+
TURN_REASONING_LEVELS
|
|
21
|
+
} from "./chunk-BYW4B4PR.js";
|
|
22
|
+
import {
|
|
23
|
+
pluginCatalogRuntime
|
|
24
|
+
} from "./chunk-QS527AV5.js";
|
|
25
|
+
import {
|
|
26
|
+
credentialContextSchema
|
|
27
|
+
} from "./chunk-77VDLF3Z.js";
|
|
28
|
+
|
|
29
|
+
// src/chat/services/auth-pause.ts
|
|
30
|
+
var AuthorizationPauseError = class extends Error {
|
|
31
|
+
disposition;
|
|
32
|
+
kind;
|
|
33
|
+
provider;
|
|
34
|
+
providerDisplayName;
|
|
35
|
+
requestText;
|
|
36
|
+
constructor(kind, provider, providerDisplayName, disposition, requestText) {
|
|
37
|
+
super(
|
|
38
|
+
kind === "mcp" ? `MCP authorization started for ${provider}` : `Plugin authorization started for ${provider}`
|
|
39
|
+
);
|
|
40
|
+
this.name = kind === "mcp" ? "McpAuthorizationPauseError" : "PluginAuthorizationPauseError";
|
|
41
|
+
this.disposition = disposition;
|
|
42
|
+
this.kind = kind;
|
|
43
|
+
this.provider = provider;
|
|
44
|
+
this.providerDisplayName = providerDisplayName;
|
|
45
|
+
this.requestText = requestText;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var AuthPausePersistenceError = class extends Error {
|
|
49
|
+
constructor(conversationId, turnId, cause) {
|
|
50
|
+
super(
|
|
51
|
+
`Failed to persist auth pause for conversation=${conversationId} turn=${turnId}`,
|
|
52
|
+
cause === void 0 ? void 0 : { cause }
|
|
53
|
+
);
|
|
54
|
+
this.name = "AuthPausePersistenceError";
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var AuthorizationFlowDisabledError = class extends Error {
|
|
58
|
+
kind;
|
|
59
|
+
provider;
|
|
60
|
+
constructor(kind, provider) {
|
|
61
|
+
super(
|
|
62
|
+
`Authorization is required for ${provider}, but this turn cannot start an authorization flow.`
|
|
63
|
+
);
|
|
64
|
+
this.name = "AuthorizationFlowDisabledError";
|
|
65
|
+
this.kind = kind;
|
|
66
|
+
this.provider = provider;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// src/chat/services/plugin-auth-orchestration.ts
|
|
71
|
+
var PluginAuthorizationPauseError = class extends AuthorizationPauseError {
|
|
72
|
+
constructor(provider, providerDisplayName, disposition, requestText) {
|
|
73
|
+
super("plugin", provider, providerDisplayName, disposition, requestText);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var PluginCredentialFailureError = class extends Error {
|
|
77
|
+
provider;
|
|
78
|
+
constructor(provider, message) {
|
|
79
|
+
super(message);
|
|
80
|
+
this.name = "PluginCredentialFailureError";
|
|
81
|
+
this.provider = provider;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
function pluginAuthRequiredSignal(details) {
|
|
85
|
+
if (!details || typeof details !== "object") {
|
|
86
|
+
return void 0;
|
|
87
|
+
}
|
|
88
|
+
const signal = details.auth_required;
|
|
89
|
+
const parsedSignal = parseSandboxEgressAuthRequiredSignal(signal);
|
|
90
|
+
if (!parsedSignal) {
|
|
91
|
+
return void 0;
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
provider: parsedSignal.provider,
|
|
95
|
+
grant: parsedSignal.grant,
|
|
96
|
+
kind: parsedSignal.kind,
|
|
97
|
+
...parsedSignal.message ? { message: parsedSignal.message } : {},
|
|
98
|
+
...parsedSignal.authorization ? { authorization: parsedSignal.authorization } : {}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function createPluginAuthOrchestration(input) {
|
|
102
|
+
let pendingPause;
|
|
103
|
+
const startAuthorizationPause = async (provider, options) => {
|
|
104
|
+
if (pendingPause) {
|
|
105
|
+
throw pendingPause;
|
|
106
|
+
}
|
|
107
|
+
if (!input.actorId || !pluginCatalogRuntime.getOAuthConfig(provider)) {
|
|
108
|
+
throw new Error(`Cannot start plugin authorization for ${provider}`);
|
|
109
|
+
}
|
|
110
|
+
if (input.interactiveAuthEnabled === false) {
|
|
111
|
+
throw new AuthorizationFlowDisabledError("plugin", provider);
|
|
112
|
+
}
|
|
113
|
+
const recordPendingAuth = input.sessionId ? input.recordPendingAuth : void 0;
|
|
114
|
+
if (input.sessionId && !recordPendingAuth) {
|
|
115
|
+
throw new Error(
|
|
116
|
+
`Missing pending auth recorder for plugin authorization pause "${provider}"`
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
const providerLabel = formatProviderLabel(provider);
|
|
120
|
+
const reusingPendingLink = input.sessionId ? canReusePendingAuthLink({
|
|
121
|
+
pendingAuth: input.pendingAuth,
|
|
122
|
+
kind: "plugin",
|
|
123
|
+
provider,
|
|
124
|
+
actorId: input.actorId,
|
|
125
|
+
sessionId: input.sessionId,
|
|
126
|
+
...options?.scope ? { scope: options.scope } : {}
|
|
127
|
+
}) : false;
|
|
128
|
+
if (!reusingPendingLink) {
|
|
129
|
+
const oauthResult = await startOAuthFlow(provider, {
|
|
130
|
+
actorId: input.actorId,
|
|
131
|
+
channelId: input.channelId,
|
|
132
|
+
destination: input.destination,
|
|
133
|
+
source: input.source,
|
|
134
|
+
threadTs: input.threadTs,
|
|
135
|
+
...options?.scope ? { scope: options.scope } : {},
|
|
136
|
+
resumeConversationId: input.conversationId,
|
|
137
|
+
resumeSessionId: input.sessionId,
|
|
138
|
+
authorization: input.authorization
|
|
139
|
+
});
|
|
140
|
+
if (!oauthResult.ok) {
|
|
141
|
+
throw new Error(oauthResult.error);
|
|
142
|
+
}
|
|
143
|
+
if (!oauthResult.delivery) {
|
|
144
|
+
throw new Error(
|
|
145
|
+
`I need to connect your ${providerLabel} account first, but I wasn't able to send you a private authorization link. Please send me a direct message and try again.`
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (input.sessionId && recordPendingAuth) {
|
|
150
|
+
const nextPendingAuth = {
|
|
151
|
+
kind: "plugin",
|
|
152
|
+
provider,
|
|
153
|
+
actorId: input.actorId,
|
|
154
|
+
...options?.scope ? { scope: options.scope } : {},
|
|
155
|
+
sessionId: input.sessionId,
|
|
156
|
+
linkSentAtMs: reusingPendingLink ? input.pendingAuth.linkSentAtMs : Date.now()
|
|
157
|
+
};
|
|
158
|
+
await recordPendingAuth(nextPendingAuth);
|
|
159
|
+
await abandonReplacedPendingAuth({
|
|
160
|
+
conversationId: input.conversationId,
|
|
161
|
+
previousPendingAuth: input.pendingAuth,
|
|
162
|
+
nextPendingAuth
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
if (input.conversationId && input.sessionId) {
|
|
166
|
+
await recordAuthorizationRequested({
|
|
167
|
+
conversationId: input.conversationId,
|
|
168
|
+
kind: "plugin",
|
|
169
|
+
provider,
|
|
170
|
+
actorId: input.actorId,
|
|
171
|
+
authorizationId: authorizationId({
|
|
172
|
+
kind: "plugin",
|
|
173
|
+
provider,
|
|
174
|
+
sessionId: input.sessionId
|
|
175
|
+
}),
|
|
176
|
+
delivery: reusingPendingLink ? "private_link_reused" : "private_link_sent"
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
pendingPause = new PluginAuthorizationPauseError(
|
|
180
|
+
provider,
|
|
181
|
+
providerLabel,
|
|
182
|
+
reusingPendingLink ? "link_already_sent" : "link_sent",
|
|
183
|
+
input.userMessage
|
|
184
|
+
);
|
|
185
|
+
input.abortAgent();
|
|
186
|
+
throw pendingPause;
|
|
187
|
+
};
|
|
188
|
+
return {
|
|
189
|
+
maybeHandleAuthSignal: async (details) => {
|
|
190
|
+
const signal = pluginAuthRequiredSignal(details);
|
|
191
|
+
if (!signal) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const { provider, authorization } = signal;
|
|
195
|
+
if (signal.kind === "unavailable") {
|
|
196
|
+
throw new PluginCredentialFailureError(
|
|
197
|
+
provider,
|
|
198
|
+
signal.message ?? `${formatProviderLabel(provider)} credentials are unavailable.`
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
if (!authorization) {
|
|
202
|
+
throw new PluginCredentialFailureError(
|
|
203
|
+
provider,
|
|
204
|
+
signal.message ?? `${formatProviderLabel(provider)} credentials are required but no OAuth flow is available for this provider.`
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
if (!input.actorId || !input.userTokenStore) {
|
|
208
|
+
if (input.interactiveAuthEnabled === false) {
|
|
209
|
+
throw new AuthorizationFlowDisabledError("plugin", provider);
|
|
210
|
+
}
|
|
211
|
+
throw new PluginCredentialFailureError(
|
|
212
|
+
provider,
|
|
213
|
+
signal.message ?? `${formatProviderLabel(provider)} credentials are required. Please connect your ${formatProviderLabel(provider)} account and try again.`
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
if (!pluginCatalogRuntime.getOAuthConfig(authorization.provider)) {
|
|
217
|
+
throw new PluginCredentialFailureError(
|
|
218
|
+
provider,
|
|
219
|
+
signal.message ?? `${formatProviderLabel(provider)} credentials are required but the provider is not configured for OAuth.`
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
await startAuthorizationPause(
|
|
223
|
+
authorization.provider,
|
|
224
|
+
authorization.scope ? { scope: authorization.scope } : void 0
|
|
225
|
+
);
|
|
226
|
+
},
|
|
227
|
+
getPendingPause: () => pendingPause
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// src/chat/agent-invocations/errors.ts
|
|
232
|
+
var AgentInvocationBusyError = class extends Error {
|
|
233
|
+
constructor(name) {
|
|
234
|
+
super(`Named agent "${name}" already has active work`);
|
|
235
|
+
this.name = "AgentInvocationBusyError";
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
var AgentInvocationLimitError = class extends Error {
|
|
239
|
+
constructor(limit) {
|
|
240
|
+
super(
|
|
241
|
+
`Parent already has ${limit} active child agent invocations (limit ${limit})`
|
|
242
|
+
);
|
|
243
|
+
this.name = "AgentInvocationLimitError";
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
// src/chat/agent-invocations/types.ts
|
|
248
|
+
import {
|
|
249
|
+
actorSchema,
|
|
250
|
+
destinationSchema,
|
|
251
|
+
sourceSchema
|
|
252
|
+
} from "@sentry/junior-plugin-api";
|
|
253
|
+
import { z } from "zod";
|
|
254
|
+
var exactStringSchema = z.string().min(1).refine((value) => value === value.trim());
|
|
255
|
+
var agentNameSchema = exactStringSchema.max(64);
|
|
256
|
+
var agentInvocationMailboxStatusSchema = z.enum(
|
|
257
|
+
AGENT_INVOCATION_MAILBOX_STATUSES
|
|
258
|
+
);
|
|
259
|
+
var agentBindingSchema = z.object({
|
|
260
|
+
childConversationId: exactStringSchema,
|
|
261
|
+
name: agentNameSchema,
|
|
262
|
+
parentConversationId: exactStringSchema
|
|
263
|
+
}).strict();
|
|
264
|
+
var agentInvocationBaseSchema = z.object({
|
|
265
|
+
actor: actorSchema,
|
|
266
|
+
agentName: agentNameSchema.optional(),
|
|
267
|
+
childConversationId: exactStringSchema,
|
|
268
|
+
createdAtMs: z.number().finite(),
|
|
269
|
+
credentialContext: credentialContextSchema.optional(),
|
|
270
|
+
destination: destinationSchema,
|
|
271
|
+
destinationVisibility: z.enum(["public", "private"]).optional(),
|
|
272
|
+
input: exactStringSchema,
|
|
273
|
+
invocationId: exactStringSchema,
|
|
274
|
+
mailboxStatus: agentInvocationMailboxStatusSchema,
|
|
275
|
+
parentConversationId: exactStringSchema,
|
|
276
|
+
reasoningLevel: z.enum(TURN_REASONING_LEVELS).optional(),
|
|
277
|
+
source: sourceSchema,
|
|
278
|
+
updatedAtMs: z.number().finite()
|
|
279
|
+
}).strict();
|
|
280
|
+
var agentInvocationSchema = z.discriminatedUnion("status", [
|
|
281
|
+
agentInvocationBaseSchema.extend({
|
|
282
|
+
status: z.enum(["pending", "running", "awaiting_resume"])
|
|
283
|
+
}),
|
|
284
|
+
agentInvocationBaseSchema.extend({
|
|
285
|
+
result: z.string(),
|
|
286
|
+
status: z.literal("completed"),
|
|
287
|
+
terminalAtMs: z.number().finite()
|
|
288
|
+
}),
|
|
289
|
+
agentInvocationBaseSchema.extend({
|
|
290
|
+
errorMessage: z.string(),
|
|
291
|
+
status: z.enum(["blocked", "failed"]),
|
|
292
|
+
terminalAtMs: z.number().finite()
|
|
293
|
+
})
|
|
294
|
+
]);
|
|
295
|
+
var createAgentInvocationSchema = z.object({
|
|
296
|
+
actor: actorSchema,
|
|
297
|
+
agentName: agentNameSchema.optional(),
|
|
298
|
+
credentialContext: credentialContextSchema.optional(),
|
|
299
|
+
destination: destinationSchema,
|
|
300
|
+
destinationVisibility: z.enum(["public", "private"]).optional(),
|
|
301
|
+
idempotencyKey: exactStringSchema,
|
|
302
|
+
input: exactStringSchema,
|
|
303
|
+
parentConversationId: exactStringSchema,
|
|
304
|
+
reasoningLevel: z.enum(TURN_REASONING_LEVELS).optional(),
|
|
305
|
+
source: sourceSchema
|
|
306
|
+
}).strict();
|
|
307
|
+
|
|
308
|
+
export {
|
|
309
|
+
AuthorizationPauseError,
|
|
310
|
+
AuthPausePersistenceError,
|
|
311
|
+
AuthorizationFlowDisabledError,
|
|
312
|
+
AgentInvocationBusyError,
|
|
313
|
+
AgentInvocationLimitError,
|
|
314
|
+
agentNameSchema,
|
|
315
|
+
agentBindingSchema,
|
|
316
|
+
agentInvocationSchema,
|
|
317
|
+
createAgentInvocationSchema,
|
|
318
|
+
PluginCredentialFailureError,
|
|
319
|
+
createPluginAuthOrchestration
|
|
320
|
+
};
|