@sentry/junior 0.110.0 → 0.112.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-ELT4ODFF.js → agent-hooks-6MVTPKP4.js} +8 -8
- package/dist/api/people/profile.d.ts +1 -0
- package/dist/api/schema/person.d.ts +2 -0
- package/dist/api/schema.js +1 -1
- package/dist/api.js +13 -12
- package/dist/app.js +551 -401
- package/dist/build/virtual-config.d.ts +2 -0
- package/dist/{catalog-runtime-4GI22PXK.js → catalog-runtime-UEO25P2J.js} +5 -5
- package/dist/chat/agent/request.d.ts +3 -6
- package/dist/chat/agent/sandbox.d.ts +36 -11
- package/dist/chat/agent/tools.d.ts +5 -8
- package/dist/chat/config.d.ts +8 -1
- package/dist/chat/pi/sdk.d.ts +1 -1
- package/dist/chat/plugins/agent-hooks.d.ts +2 -2
- package/dist/chat/runtime/agent-continue-runner.d.ts +7 -3
- package/dist/chat/runtime/agent-run-outcome.d.ts +1 -0
- package/dist/chat/runtime/slack-runtime.d.ts +1 -2
- package/dist/chat/runtime/thread-state.d.ts +3 -7
- package/dist/chat/runtime/turn-preparation.d.ts +2 -2
- package/dist/chat/sandbox/command-result.d.ts +91 -0
- package/dist/chat/sandbox/errors.d.ts +3 -1
- package/dist/chat/sandbox/ref.d.ts +5 -0
- package/dist/chat/sandbox/sandbox.d.ts +19 -46
- package/dist/chat/sandbox/session.d.ts +16 -20
- package/dist/chat/sandbox/skill-sync.d.ts +2 -2
- package/dist/chat/sandbox/workspace.d.ts +14 -12
- package/dist/chat/services/auth-pause-response.d.ts +1 -1
- package/dist/chat/services/auth-pause.d.ts +2 -1
- package/dist/chat/services/mcp-auth-orchestration.d.ts +1 -1
- package/dist/chat/services/plugin-auth-orchestration.d.ts +2 -1
- package/dist/chat/services/turn-result.d.ts +3 -4
- package/dist/chat/task-execution/slack-work.d.ts +3 -1
- package/dist/chat/task-execution/state.d.ts +75 -22
- package/dist/chat/task-execution/store.d.ts +34 -3
- package/dist/chat/task-execution/worker.d.ts +0 -1
- package/dist/chat/tool-support/normalize-result.d.ts +2 -2
- package/dist/chat/tool-support/pi-tool-adapter.d.ts +2 -2
- package/dist/chat/tool-support/structured-result.d.ts +1 -2
- package/dist/chat/tools/resource-events.d.ts +3 -129
- package/dist/chat/tools/sandbox/file-uploads.d.ts +1 -1
- package/dist/chat/{runtime → tools/sandbox}/generated-artifacts.d.ts +3 -3
- package/dist/chat/tools/types.d.ts +1 -1
- package/dist/chat/tools/web/fetch-content.d.ts +5 -0
- package/dist/chat/tools/web/image-generate.d.ts +2 -1
- package/dist/chat/tools/web/search.d.ts +1 -1
- package/dist/{chunk-3S7YYHBI.js → chunk-2FJ6WEYV.js} +1 -1
- package/dist/{chunk-Y5FK3CNG.js → chunk-4EJO4HIC.js} +1 -1
- package/dist/{chunk-W6RJZG7F.js → chunk-66IP6WED.js} +306 -31
- package/dist/{chunk-W75ZPAGG.js → chunk-AU2JVUDF.js} +1 -1
- package/dist/{chunk-3UBQI73J.js → chunk-AWNDKI5K.js} +7 -8
- package/dist/{chunk-IYKPU7H6.js → chunk-CSS7JHEM.js} +1 -1
- package/dist/{chunk-SBOBTS27.js → chunk-GJG67YFS.js} +2 -2
- package/dist/{chunk-RHHRKSPI.js → chunk-GR4IB6OQ.js} +8729 -9024
- package/dist/{chunk-ZKIOWEFL.js → chunk-IV2O4HQJ.js} +1 -1
- package/dist/{chunk-FPK7XY3F.js → chunk-JE23YR3X.js} +1 -0
- package/dist/{chunk-L5XQPJ7T.js → chunk-NDQL4ESR.js} +2 -2
- package/dist/{chunk-WNOVRQ67.js → chunk-PK4ETCUQ.js} +46 -18
- package/dist/{chunk-4QU44P7Q.js → chunk-QIALGHRN.js} +2 -2
- package/dist/{chunk-C5XAFTHY.js → chunk-SKEMI4IF.js} +16 -13
- package/dist/{chunk-Y3H2DN6F.js → chunk-TZU3R5OC.js} +1 -1
- package/dist/{chunk-2T7TIEXI.js → chunk-VBSVNOLA.js} +11 -15
- package/dist/{chunk-GK47NBDE.js → chunk-X3SP5RDW.js} +1 -1
- package/dist/{chunk-3TV7OEHL.js → chunk-ZHP4KNF7.js} +1 -1
- package/dist/cli/chat.js +19 -19
- package/dist/cli/check.js +6 -6
- package/dist/cli/plugins.js +11 -11
- package/dist/cli/snapshot-warmup.js +8 -8
- package/dist/cli/upgrade.js +5 -5
- package/dist/{db-Y6W6CWWW.js → db-P5H5RVQV.js} +5 -5
- package/dist/instrumentation.js +2 -2
- package/dist/nitro.js +14 -8
- package/dist/{runner-BBFV5GLR.js → runner-B4ZDUO3R.js} +19 -28
- package/dist/{skills-AR4AF32L.js → skills-GWTOZ3XV.js} +6 -6
- package/dist/{validation-FBIEPTC2.js → validation-QFIC6XH6.js} +6 -6
- package/dist/version.js +1 -1
- package/package.json +5 -5
|
@@ -10,7 +10,8 @@ export declare class AuthorizationPauseError extends Error {
|
|
|
10
10
|
readonly kind: AuthorizationPauseKind;
|
|
11
11
|
readonly provider: string;
|
|
12
12
|
readonly providerDisplayName: string;
|
|
13
|
-
|
|
13
|
+
readonly requestText?: string;
|
|
14
|
+
constructor(kind: AuthorizationPauseKind, provider: string, providerDisplayName: string, disposition: AuthorizationPauseDisposition, requestText?: string);
|
|
14
15
|
}
|
|
15
16
|
/** Error indicating an authorization pause could not be made durable. */
|
|
16
17
|
export declare class AuthPausePersistenceError extends Error {
|
|
@@ -13,7 +13,7 @@ import type { ThreadArtifactsState } from "@/chat/state/artifacts";
|
|
|
13
13
|
import type { ConversationPendingAuthState } from "@/chat/state/conversation";
|
|
14
14
|
import type { PluginDefinition } from "@/chat/plugins/types";
|
|
15
15
|
export declare class McpAuthorizationPauseError extends AuthorizationPauseError {
|
|
16
|
-
constructor(provider: string, providerDisplayName: string, disposition: "link_already_sent" | "link_sent");
|
|
16
|
+
constructor(provider: string, providerDisplayName: string, disposition: "link_already_sent" | "link_sent", requestText?: string);
|
|
17
17
|
}
|
|
18
18
|
export interface McpAuthOrchestrationInput {
|
|
19
19
|
abortAgent: () => void;
|
|
@@ -15,7 +15,7 @@ import type { UserTokenStore } from "@/chat/credentials/user-token-store";
|
|
|
15
15
|
import { AuthorizationPauseError, type AuthorizationFlowMode } from "@/chat/services/auth-pause";
|
|
16
16
|
import type { ConversationPendingAuthState } from "@/chat/state/conversation";
|
|
17
17
|
export declare class PluginAuthorizationPauseError extends AuthorizationPauseError {
|
|
18
|
-
constructor(provider: string, providerDisplayName: string, disposition: "link_already_sent" | "link_sent");
|
|
18
|
+
constructor(provider: string, providerDisplayName: string, disposition: "link_already_sent" | "link_sent", requestText?: string);
|
|
19
19
|
}
|
|
20
20
|
export declare class PluginCredentialFailureError extends Error {
|
|
21
21
|
readonly provider: string;
|
|
@@ -30,6 +30,7 @@ export interface PluginAuthOrchestrationInput {
|
|
|
30
30
|
destination?: Destination;
|
|
31
31
|
source?: Source;
|
|
32
32
|
threadTs?: string;
|
|
33
|
+
userMessage?: string;
|
|
33
34
|
pendingAuth?: ConversationPendingAuthState;
|
|
34
35
|
recordPendingAuth?: (pendingAuth: ConversationPendingAuthState) => void | Promise<void>;
|
|
35
36
|
authorizationFlowMode?: AuthorizationFlowMode;
|
|
@@ -3,6 +3,7 @@ import type { PiMessage } from "@/chat/pi/messages";
|
|
|
3
3
|
import type { TurnRoute } from "@/chat/services/turn-router";
|
|
4
4
|
import type { AgentTurnUsage } from "@/chat/usage";
|
|
5
5
|
import type { ThreadArtifactsState } from "@/chat/state/artifacts";
|
|
6
|
+
import type { SandboxRef } from "@/chat/sandbox/ref";
|
|
6
7
|
import { extractAssistantText } from "@/chat/pi/transcript";
|
|
7
8
|
export interface AgentTurnDiagnostics {
|
|
8
9
|
assistantMessageCount: number;
|
|
@@ -23,8 +24,7 @@ export interface AgentRunResult {
|
|
|
23
24
|
/** Sanitized terminal text for diagnostics and failure fallback, not success delivery. */
|
|
24
25
|
text: string;
|
|
25
26
|
artifactStatePatch?: Partial<ThreadArtifactsState>;
|
|
26
|
-
|
|
27
|
-
sandboxDependencyProfileHash?: string;
|
|
27
|
+
sandboxRef?: SandboxRef;
|
|
28
28
|
piMessages?: PiMessage[];
|
|
29
29
|
diagnostics: AgentTurnDiagnostics;
|
|
30
30
|
}
|
|
@@ -33,8 +33,7 @@ export interface TurnResultInput {
|
|
|
33
33
|
userInput: string;
|
|
34
34
|
artifactStatePatch: Partial<ThreadArtifactsState>;
|
|
35
35
|
toolCalls: string[];
|
|
36
|
-
|
|
37
|
-
sandboxDependencyProfileHash?: string;
|
|
36
|
+
sandboxRef?: SandboxRef;
|
|
38
37
|
piMessages?: PiMessage[];
|
|
39
38
|
durationMs?: number;
|
|
40
39
|
generatedFileCount: number;
|
|
@@ -272,7 +272,9 @@ interface SlackResourceEventInboundInput {
|
|
|
272
272
|
export interface CreateSlackConversationWorkerOptions {
|
|
273
273
|
getSlackAdapter: () => SlackAdapter;
|
|
274
274
|
lookupSlackUser?: (teamId: string, userId: string) => Promise<SlackActorProfile | null | undefined>;
|
|
275
|
-
resumeAwaitingContinuation: (conversationId: string
|
|
275
|
+
resumeAwaitingContinuation: (conversationId: string, options: {
|
|
276
|
+
shouldYield: () => boolean;
|
|
277
|
+
}) => Promise<boolean>;
|
|
276
278
|
conversationStore?: ConversationStore;
|
|
277
279
|
runtime: SlackInboxTurnRuntime;
|
|
278
280
|
state?: StateAdapter;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { StateAdapter } from "chat";
|
|
2
|
-
import type
|
|
2
|
+
import { type Destination } from "@sentry/junior-plugin-api";
|
|
3
|
+
import { z } from "zod";
|
|
3
4
|
import { type StoredSlackActor } from "@/chat/actor";
|
|
4
5
|
declare class InvalidConversationRecordError extends Error {
|
|
5
6
|
constructor(conversationId: string);
|
|
@@ -12,25 +13,67 @@ export declare const CONVERSATION_WORK_LEASE_TTL_MS = 90000;
|
|
|
12
13
|
export declare const CONVERSATION_WORK_CHECK_IN_INTERVAL_MS = 15000;
|
|
13
14
|
export declare const CONVERSATION_WORK_STALE_ENQUEUE_MS = 60000;
|
|
14
15
|
export declare const CONVERSATION_WORK_MAX_DELIVERY_ATTEMPTS = 5;
|
|
15
|
-
|
|
16
|
+
declare const inboundMessageSourceSchema: z.ZodEnum<{
|
|
17
|
+
slack: "slack";
|
|
18
|
+
plugin: "plugin";
|
|
19
|
+
api: "api";
|
|
20
|
+
local: "local";
|
|
21
|
+
internal: "internal";
|
|
22
|
+
resource_event: "resource_event";
|
|
23
|
+
scheduler: "scheduler";
|
|
24
|
+
}>;
|
|
25
|
+
export type Source = z.output<typeof inboundMessageSourceSchema>;
|
|
16
26
|
export type ExecutionStatus = "awaiting_resume" | "failed" | "idle" | "pending" | "running";
|
|
17
|
-
|
|
18
|
-
attachments
|
|
19
|
-
authorId
|
|
20
|
-
metadata
|
|
21
|
-
text:
|
|
22
|
-
}
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
declare const agentInputSchema: z.ZodObject<{
|
|
28
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
29
|
+
authorId: z.ZodOptional<z.ZodString>;
|
|
30
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
31
|
+
text: z.ZodString;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
export type AgentInput = z.output<typeof agentInputSchema>;
|
|
34
|
+
/** Durable delivery modes for pending inbound mailbox work. */
|
|
35
|
+
export declare const inboundMessageDeliverySchema: z.ZodEnum<{
|
|
36
|
+
defer: "defer";
|
|
37
|
+
interrupt: "interrupt";
|
|
38
|
+
}>;
|
|
39
|
+
export type InboundMessageDelivery = z.output<typeof inboundMessageDeliverySchema>;
|
|
40
|
+
/** Canonical durable mailbox entry owned by task execution. */
|
|
41
|
+
export declare const inboundMessageSchema: z.ZodObject<{
|
|
42
|
+
attemptCount: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
conversationId: z.ZodString;
|
|
44
|
+
createdAtMs: z.ZodNumber;
|
|
45
|
+
delivery: z.ZodEnum<{
|
|
46
|
+
defer: "defer";
|
|
47
|
+
interrupt: "interrupt";
|
|
48
|
+
}>;
|
|
49
|
+
destination: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
50
|
+
platform: z.ZodLiteral<"slack">;
|
|
51
|
+
teamId: z.ZodString;
|
|
52
|
+
channelId: z.ZodString;
|
|
53
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
54
|
+
platform: z.ZodLiteral<"local">;
|
|
55
|
+
conversationId: z.ZodString;
|
|
56
|
+
}, z.core.$strict>], "platform">;
|
|
57
|
+
inboundMessageId: z.ZodString;
|
|
58
|
+
injectedAtMs: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
input: z.ZodObject<{
|
|
60
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
61
|
+
authorId: z.ZodOptional<z.ZodString>;
|
|
62
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
63
|
+
text: z.ZodString;
|
|
64
|
+
}, z.core.$strict>;
|
|
65
|
+
receivedAtMs: z.ZodNumber;
|
|
66
|
+
source: z.ZodEnum<{
|
|
67
|
+
slack: "slack";
|
|
68
|
+
plugin: "plugin";
|
|
69
|
+
api: "api";
|
|
70
|
+
local: "local";
|
|
71
|
+
internal: "internal";
|
|
72
|
+
resource_event: "resource_event";
|
|
73
|
+
scheduler: "scheduler";
|
|
74
|
+
}>;
|
|
75
|
+
}, z.core.$strict>;
|
|
76
|
+
export type InboundMessage = z.output<typeof inboundMessageSchema>;
|
|
34
77
|
export interface Lease {
|
|
35
78
|
acquiredAtMs: number;
|
|
36
79
|
expiresAtMs: number;
|
|
@@ -56,7 +99,7 @@ export interface Conversation {
|
|
|
56
99
|
execution: ConversationExecution;
|
|
57
100
|
lastActivityAtMs: number;
|
|
58
101
|
actor?: StoredSlackActor;
|
|
59
|
-
schemaVersion:
|
|
102
|
+
schemaVersion: 2;
|
|
60
103
|
source?: Source;
|
|
61
104
|
title?: string;
|
|
62
105
|
updatedAtMs: number;
|
|
@@ -182,7 +225,7 @@ export declare function checkInConversationWork(args: {
|
|
|
182
225
|
state?: StateAdapter;
|
|
183
226
|
}): Promise<boolean>;
|
|
184
227
|
/**
|
|
185
|
-
*
|
|
228
|
+
* Resolve pending mailbox entries after the caller accepts responsibility.
|
|
186
229
|
*
|
|
187
230
|
* Returning ids acknowledges only that subset; returning nothing acknowledges
|
|
188
231
|
* every pending entry passed to the handler.
|
|
@@ -193,7 +236,10 @@ export declare function drainConversationMailbox(args: {
|
|
|
193
236
|
leaseToken: string;
|
|
194
237
|
nowMs?: number;
|
|
195
238
|
state?: StateAdapter;
|
|
196
|
-
}): Promise<
|
|
239
|
+
}): Promise<{
|
|
240
|
+
changed: boolean;
|
|
241
|
+
messages: InboundMessage[];
|
|
242
|
+
}>;
|
|
197
243
|
/** Acknowledge leased mailbox entries after the handler accepts responsibility. */
|
|
198
244
|
export declare function ackMessages(args: {
|
|
199
245
|
conversationId: string;
|
|
@@ -210,6 +256,13 @@ export declare function requestConversationContinuation(args: {
|
|
|
210
256
|
nowMs?: number;
|
|
211
257
|
state?: StateAdapter;
|
|
212
258
|
}): Promise<boolean>;
|
|
259
|
+
/** Begin a requested turn resume under the worker's existing lease. */
|
|
260
|
+
export declare function beginConversationResume(args: {
|
|
261
|
+
conversationId: string;
|
|
262
|
+
leaseToken: string;
|
|
263
|
+
nowMs?: number;
|
|
264
|
+
state?: StateAdapter;
|
|
265
|
+
}): Promise<boolean>;
|
|
213
266
|
/** Release the durable execution lease without changing completion state. */
|
|
214
267
|
export declare function releaseConversationWork(args: {
|
|
215
268
|
conversationId: string;
|
|
@@ -2,13 +2,13 @@ import type { StateAdapter } from "chat";
|
|
|
2
2
|
import type { ConversationStore } from "@/chat/conversations/store";
|
|
3
3
|
import type { ConversationWorkQueue } from "./queue";
|
|
4
4
|
import * as workState from "./state";
|
|
5
|
-
export { CONVERSATION_ACTIVE_INDEX_KEY, CONVERSATION_BY_ACTIVITY_INDEX_KEY, CONVERSATION_WORK_CHECK_IN_INTERVAL_MS, CONVERSATION_WORK_LEASE_TTL_MS, CONVERSATION_WORK_MAX_DELIVERY_ATTEMPTS, CONVERSATION_WORK_STALE_ENQUEUE_MS, isFinalAttempt, isInvalidConversationRecordError, type AgentInput, type AttemptFailure, type AppendAndEnqueueInboundMessageResult, type AppendInboundMessageResult, type Conversation, type ConversationExecution, type ConversationWorkLease, type ConversationWorkState, type ExecutionStatus, type InboundMessage, type Lease, type RequestConversationWorkResult, type Source, type StartConversationWorkAcquired, type StartConversationWorkActive, type StartConversationWorkNoWork, type StartConversationWorkResult, } from "@/chat/task-execution/state";
|
|
5
|
+
export { CONVERSATION_ACTIVE_INDEX_KEY, CONVERSATION_BY_ACTIVITY_INDEX_KEY, CONVERSATION_WORK_CHECK_IN_INTERVAL_MS, CONVERSATION_WORK_LEASE_TTL_MS, CONVERSATION_WORK_MAX_DELIVERY_ATTEMPTS, CONVERSATION_WORK_STALE_ENQUEUE_MS, isFinalAttempt, isInvalidConversationRecordError, type AgentInput, type AttemptFailure, type AppendAndEnqueueInboundMessageResult, type AppendInboundMessageResult, type Conversation, type ConversationExecution, type ConversationWorkLease, type ConversationWorkState, type ExecutionStatus, type InboundMessage, type InboundMessageDelivery, type Lease, type RequestConversationWorkResult, type Source, type StartConversationWorkAcquired, type StartConversationWorkActive, type StartConversationWorkNoWork, type StartConversationWorkResult, } from "@/chat/task-execution/state";
|
|
6
6
|
import type { AppendAndEnqueueInboundMessageResult, Conversation, InboundMessage } from "@/chat/task-execution/state";
|
|
7
7
|
export type EnsureConversationWakeResult = {
|
|
8
8
|
queueMessageId?: string;
|
|
9
9
|
status: "enqueued";
|
|
10
10
|
} | {
|
|
11
|
-
status: "already_enqueued" | "no_work";
|
|
11
|
+
status: "already_enqueued" | "lease_active" | "no_work";
|
|
12
12
|
};
|
|
13
13
|
/** Return a persisted conversation record, if one exists. */
|
|
14
14
|
export declare function getConversation(args: {
|
|
@@ -94,7 +94,30 @@ export declare function checkInConversationWork(args: {
|
|
|
94
94
|
export declare function drainConversationMailbox(args: Parameters<typeof workState.drainConversationMailbox>[0] & {
|
|
95
95
|
conversationStore?: ConversationStore;
|
|
96
96
|
state?: StateAdapter;
|
|
97
|
-
}): Promise<
|
|
97
|
+
}): Promise<{
|
|
98
|
+
conversationId: string;
|
|
99
|
+
createdAtMs: number;
|
|
100
|
+
delivery: "defer" | "interrupt";
|
|
101
|
+
destination: {
|
|
102
|
+
platform: "slack";
|
|
103
|
+
teamId: string;
|
|
104
|
+
channelId: string;
|
|
105
|
+
} | {
|
|
106
|
+
platform: "local";
|
|
107
|
+
conversationId: string;
|
|
108
|
+
};
|
|
109
|
+
inboundMessageId: string;
|
|
110
|
+
input: {
|
|
111
|
+
text: string;
|
|
112
|
+
attachments?: unknown[] | undefined;
|
|
113
|
+
authorId?: string | undefined;
|
|
114
|
+
metadata?: Record<string, unknown> | undefined;
|
|
115
|
+
};
|
|
116
|
+
receivedAtMs: number;
|
|
117
|
+
source: "slack" | "plugin" | "api" | "local" | "internal" | "resource_event" | "scheduler";
|
|
118
|
+
attemptCount?: number | undefined;
|
|
119
|
+
injectedAtMs?: number | undefined;
|
|
120
|
+
}[]>;
|
|
98
121
|
/** Acknowledge leased mailbox entries after the handler accepts responsibility. */
|
|
99
122
|
export declare function ackMessages(args: {
|
|
100
123
|
conversationId: string;
|
|
@@ -113,6 +136,14 @@ export declare function requestConversationContinuation(args: {
|
|
|
113
136
|
nowMs?: number;
|
|
114
137
|
state?: StateAdapter;
|
|
115
138
|
}): Promise<boolean>;
|
|
139
|
+
/** Begin a requested turn resume without releasing the current lease. */
|
|
140
|
+
export declare function beginConversationResume(args: {
|
|
141
|
+
conversationId: string;
|
|
142
|
+
leaseToken: string;
|
|
143
|
+
conversationStore?: ConversationStore;
|
|
144
|
+
nowMs?: number;
|
|
145
|
+
state?: StateAdapter;
|
|
146
|
+
}): Promise<boolean>;
|
|
116
147
|
/** Release the durable execution lease without changing completion state. */
|
|
117
148
|
export declare function releaseConversationWork(args: {
|
|
118
149
|
conversationId: string;
|
|
@@ -4,7 +4,6 @@ import type { ConversationStore } from "@/chat/conversations/store";
|
|
|
4
4
|
import { type ConversationQueueMessage, type ConversationWorkQueue } from "./queue";
|
|
5
5
|
import { type InboundMessage } from "./store";
|
|
6
6
|
export declare const CONVERSATION_WORK_DEFER_DELAY_MS = 15000;
|
|
7
|
-
export declare const CONVERSATION_WORK_SOFT_YIELD_AFTER_MS = 240000;
|
|
8
7
|
export interface ConversationWorkerContext {
|
|
9
8
|
attempt: InboxAttempt;
|
|
10
9
|
checkIn(): Promise<boolean>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ImageContent, TextContent } from "@earendil-works/pi-ai";
|
|
2
|
-
/**
|
|
3
|
-
export declare function normalizeToolResult(result: unknown,
|
|
2
|
+
/** Normalize raw tool output into Pi content and structured details. */
|
|
3
|
+
export declare function normalizeToolResult(result: unknown, options?: {
|
|
4
4
|
requireStructuredResult?: boolean;
|
|
5
5
|
toolName?: string;
|
|
6
6
|
}): {
|
|
@@ -3,10 +3,10 @@ import { type ConversationPrivacy } from "@/chat/conversation-privacy";
|
|
|
3
3
|
import { type LogContext } from "@/chat/logging";
|
|
4
4
|
import type { PluginAuthOrchestration } from "@/chat/services/plugin-auth-orchestration";
|
|
5
5
|
import type { AssistantStatusSpec } from "@/chat/slack/assistant-thread/status";
|
|
6
|
-
import type {
|
|
6
|
+
import type { SandboxTools } from "@/chat/sandbox/sandbox";
|
|
7
7
|
import type { SkillSandbox } from "@/chat/sandbox/skill-sandbox";
|
|
8
8
|
import type { AnyToolDefinition } from "@/chat/tools/definition";
|
|
9
9
|
import type { ToolExecutionReport } from "@/chat/tool-support/tool-execution-report";
|
|
10
10
|
import type { PluginHookRunner } from "@/chat/plugins/agent-hooks";
|
|
11
11
|
/** Wrap tool definitions into Pi Agent tool objects with logging, validation, and sandbox execution. */
|
|
12
|
-
export declare function createPiAgentTools(tools: Record<string, AnyToolDefinition>, sandbox: SkillSandbox, spanContext: LogContext, onStatus?: (status: AssistantStatusSpec) => void | Promise<void>,
|
|
12
|
+
export declare function createPiAgentTools(tools: Record<string, AnyToolDefinition>, sandbox: SkillSandbox, spanContext: LogContext, onStatus?: (status: AssistantStatusSpec) => void | Promise<void>, sandboxTools?: SandboxTools, pluginAuthOrchestration?: PluginAuthOrchestration, onToolCall?: (toolCallId: string, toolName: string, params: Record<string, unknown>) => void | Promise<void>, agentHooks?: PluginHookRunner, conversationPrivacy?: ConversationPrivacy, onToolResult?: (report: ToolExecutionReport) => void | Promise<void>): AgentTool[];
|
|
@@ -61,7 +61,7 @@ export interface JuniorToolResultEnvelope<TDetails extends JuniorToolResult = Ju
|
|
|
61
61
|
}
|
|
62
62
|
/** Bind continuation metadata to the exposed runtime tool name. */
|
|
63
63
|
export declare function injectContinuationToolName(details: JuniorToolResult, toolName: string): JuniorToolResult | JuniorToolResultWithBoundContinuation;
|
|
64
|
-
interface JuniorTextToolResultEnvelope<TDetails extends JuniorToolResult = JuniorToolResult> {
|
|
64
|
+
export interface JuniorTextToolResultEnvelope<TDetails extends JuniorToolResult = JuniorToolResult> {
|
|
65
65
|
content: [TextContent];
|
|
66
66
|
details: TDetails;
|
|
67
67
|
}
|
|
@@ -70,4 +70,3 @@ export declare function makeStructuredToolResult<TDetails extends JuniorToolResu
|
|
|
70
70
|
export declare function makeStructuredToolResult<TDetails extends JuniorToolResult>(details: TDetails, options: {
|
|
71
71
|
content: Array<TextContent | ImageContent>;
|
|
72
72
|
}): JuniorToolResultEnvelope<TDetails>;
|
|
73
|
-
export {};
|
|
@@ -1,130 +1,4 @@
|
|
|
1
|
+
import type { ToolRegistry } from "@/chat/tools/definition";
|
|
1
2
|
import type { ToolRuntimeContext } from "@/chat/tools/types";
|
|
2
|
-
/**
|
|
3
|
-
export declare function
|
|
4
|
-
/** Create the tool that subscribes the current conversation to resource events. */
|
|
5
|
-
export declare function createSubscribeToResourceEventsTool(context: ToolRuntimeContext): Omit<import("./definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
6
|
-
inputSchema: import("./definition").JsonSchemaObject;
|
|
7
|
-
outputSchema: import("./definition").JsonSchemaObject;
|
|
8
|
-
prepareArguments(args: unknown): {
|
|
9
|
-
resourceRef: string;
|
|
10
|
-
provider: string;
|
|
11
|
-
resourceType: string;
|
|
12
|
-
label: string;
|
|
13
|
-
events: string[];
|
|
14
|
-
intent: string;
|
|
15
|
-
ttlMs?: number | undefined;
|
|
16
|
-
};
|
|
17
|
-
execute?: ((input: unknown, options: import("./definition").ToolExecuteOptions) => {
|
|
18
|
-
[x: string]: unknown;
|
|
19
|
-
ok: boolean;
|
|
20
|
-
status: "error" | "success";
|
|
21
|
-
target?: string | undefined;
|
|
22
|
-
data?: unknown;
|
|
23
|
-
truncated?: boolean | undefined;
|
|
24
|
-
continuation?: {
|
|
25
|
-
arguments: Record<string, unknown>;
|
|
26
|
-
reason?: string | undefined;
|
|
27
|
-
} | undefined;
|
|
28
|
-
error?: string | {
|
|
29
|
-
kind: string;
|
|
30
|
-
message: string;
|
|
31
|
-
retryable?: boolean | undefined;
|
|
32
|
-
} | undefined;
|
|
33
|
-
} | Promise<{
|
|
34
|
-
[x: string]: unknown;
|
|
35
|
-
ok: boolean;
|
|
36
|
-
status: "error" | "success";
|
|
37
|
-
target?: string | undefined;
|
|
38
|
-
data?: unknown;
|
|
39
|
-
truncated?: boolean | undefined;
|
|
40
|
-
continuation?: {
|
|
41
|
-
arguments: Record<string, unknown>;
|
|
42
|
-
reason?: string | undefined;
|
|
43
|
-
} | undefined;
|
|
44
|
-
error?: string | {
|
|
45
|
-
kind: string;
|
|
46
|
-
message: string;
|
|
47
|
-
retryable?: boolean | undefined;
|
|
48
|
-
} | undefined;
|
|
49
|
-
}>) | undefined;
|
|
50
|
-
};
|
|
51
|
-
/** Create the tool that lists active resource subscriptions for this conversation. */
|
|
52
|
-
export declare function createListResourceEventSubscriptionsTool(context: ToolRuntimeContext): Omit<import("./definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
53
|
-
inputSchema: import("./definition").JsonSchemaObject;
|
|
54
|
-
outputSchema: import("./definition").JsonSchemaObject;
|
|
55
|
-
prepareArguments(args: unknown): Record<string, never>;
|
|
56
|
-
execute?: ((input: unknown, options: import("./definition").ToolExecuteOptions) => {
|
|
57
|
-
[x: string]: unknown;
|
|
58
|
-
ok: boolean;
|
|
59
|
-
status: "error" | "success";
|
|
60
|
-
target?: string | undefined;
|
|
61
|
-
data?: unknown;
|
|
62
|
-
truncated?: boolean | undefined;
|
|
63
|
-
continuation?: {
|
|
64
|
-
arguments: Record<string, unknown>;
|
|
65
|
-
reason?: string | undefined;
|
|
66
|
-
} | undefined;
|
|
67
|
-
error?: string | {
|
|
68
|
-
kind: string;
|
|
69
|
-
message: string;
|
|
70
|
-
retryable?: boolean | undefined;
|
|
71
|
-
} | undefined;
|
|
72
|
-
} | Promise<{
|
|
73
|
-
[x: string]: unknown;
|
|
74
|
-
ok: boolean;
|
|
75
|
-
status: "error" | "success";
|
|
76
|
-
target?: string | undefined;
|
|
77
|
-
data?: unknown;
|
|
78
|
-
truncated?: boolean | undefined;
|
|
79
|
-
continuation?: {
|
|
80
|
-
arguments: Record<string, unknown>;
|
|
81
|
-
reason?: string | undefined;
|
|
82
|
-
} | undefined;
|
|
83
|
-
error?: string | {
|
|
84
|
-
kind: string;
|
|
85
|
-
message: string;
|
|
86
|
-
retryable?: boolean | undefined;
|
|
87
|
-
} | undefined;
|
|
88
|
-
}>) | undefined;
|
|
89
|
-
};
|
|
90
|
-
/** Create the tool that cancels a current-conversation resource subscription. */
|
|
91
|
-
export declare function createCancelResourceEventSubscriptionTool(context: ToolRuntimeContext): Omit<import("./definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
92
|
-
inputSchema: import("./definition").JsonSchemaObject;
|
|
93
|
-
outputSchema: import("./definition").JsonSchemaObject;
|
|
94
|
-
prepareArguments(args: unknown): {
|
|
95
|
-
subscriptionId: string;
|
|
96
|
-
};
|
|
97
|
-
execute?: ((input: unknown, options: import("./definition").ToolExecuteOptions) => {
|
|
98
|
-
[x: string]: unknown;
|
|
99
|
-
ok: boolean;
|
|
100
|
-
status: "error" | "success";
|
|
101
|
-
target?: string | undefined;
|
|
102
|
-
data?: unknown;
|
|
103
|
-
truncated?: boolean | undefined;
|
|
104
|
-
continuation?: {
|
|
105
|
-
arguments: Record<string, unknown>;
|
|
106
|
-
reason?: string | undefined;
|
|
107
|
-
} | undefined;
|
|
108
|
-
error?: string | {
|
|
109
|
-
kind: string;
|
|
110
|
-
message: string;
|
|
111
|
-
retryable?: boolean | undefined;
|
|
112
|
-
} | undefined;
|
|
113
|
-
} | Promise<{
|
|
114
|
-
[x: string]: unknown;
|
|
115
|
-
ok: boolean;
|
|
116
|
-
status: "error" | "success";
|
|
117
|
-
target?: string | undefined;
|
|
118
|
-
data?: unknown;
|
|
119
|
-
truncated?: boolean | undefined;
|
|
120
|
-
continuation?: {
|
|
121
|
-
arguments: Record<string, unknown>;
|
|
122
|
-
reason?: string | undefined;
|
|
123
|
-
} | undefined;
|
|
124
|
-
error?: string | {
|
|
125
|
-
kind: string;
|
|
126
|
-
message: string;
|
|
127
|
-
retryable?: boolean | undefined;
|
|
128
|
-
} | undefined;
|
|
129
|
-
}>) | undefined;
|
|
130
|
-
};
|
|
3
|
+
/** Build the complete resource-watch tool set allowed by this runtime context. */
|
|
4
|
+
export declare function createResourceEventTools(context: ToolRuntimeContext): ToolRegistry;
|
|
@@ -48,5 +48,5 @@ export declare function sandboxArtifactPath(filename: string): string;
|
|
|
48
48
|
/** Infer upload MIME type from an explicit value or filename extension. */
|
|
49
49
|
export declare function inferMimeType(filename: string, explicitMimeType?: string): string;
|
|
50
50
|
/** Read and validate one sandbox file for Slack/file reply upload. */
|
|
51
|
-
export declare function readSandboxFileUpload(
|
|
51
|
+
export declare function readSandboxFileUpload(workspace: SandboxWorkspace, input: SandboxFileMaterializationInput): Promise<SandboxFileUpload>;
|
|
52
52
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { FileUpload } from "chat";
|
|
2
2
|
import { type GeneratedArtifactFileRef } from "@/chat/tools/sandbox/file-uploads";
|
|
3
3
|
import type { SandboxCommandResult } from "@/chat/sandbox/workspace";
|
|
4
|
-
/**
|
|
5
|
-
export interface
|
|
4
|
+
/** Workspace operations needed to make generated artifacts visible to later tools. */
|
|
5
|
+
export interface GeneratedArtifactWorkspace {
|
|
6
6
|
runCommand(input: {
|
|
7
7
|
args?: string[];
|
|
8
8
|
cmd: string;
|
|
@@ -13,4 +13,4 @@ export interface GeneratedArtifactSandbox {
|
|
|
13
13
|
}>): Promise<void>;
|
|
14
14
|
}
|
|
15
15
|
/** Persist generated artifacts into the sandbox before returning model-visible handles. */
|
|
16
|
-
export declare function writeSandboxGeneratedArtifacts(
|
|
16
|
+
export declare function writeSandboxGeneratedArtifacts(workspace: GeneratedArtifactWorkspace, files: FileUpload[]): Promise<GeneratedArtifactFileRef[]>;
|
|
@@ -69,7 +69,7 @@ interface BaseToolRuntimeContext {
|
|
|
69
69
|
configuration?: Record<string, unknown>;
|
|
70
70
|
egress: PluginEgress;
|
|
71
71
|
mcpToolManager?: McpToolManager;
|
|
72
|
-
|
|
72
|
+
workspace: SandboxWorkspace;
|
|
73
73
|
}
|
|
74
74
|
interface SlackToolRuntimeContext extends BaseToolRuntimeContext {
|
|
75
75
|
destination: SlackDestination;
|
|
@@ -17,6 +17,11 @@ export type WebFetchResponse = {
|
|
|
17
17
|
extracted_chars: number;
|
|
18
18
|
truncated: boolean;
|
|
19
19
|
} & Record<string, unknown>;
|
|
20
|
+
/** Apply the web-fetch character limit to already extracted text content. */
|
|
21
|
+
export declare function truncateWebFetchContent(content: string, maxChars: number): {
|
|
22
|
+
content: string;
|
|
23
|
+
truncated: boolean;
|
|
24
|
+
};
|
|
20
25
|
/** Extract readable content and metadata from a fetched response body. */
|
|
21
26
|
export declare function extractContentDetails(body: string, contentType: string, maxChars: number): WebFetchResponseContent;
|
|
22
27
|
/** Extract readable content from a fetched response body, converting HTML to markdown. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ImageGenerateToolDeps, ToolHooks } from "@/chat/tools/types";
|
|
2
2
|
/** Create the image tool with sandbox artifact guidance matched to file-send capability. */
|
|
3
|
-
export declare function createImageGenerateTool(hooks: Required<Pick<ToolHooks, "writeGeneratedArtifacts">>, options
|
|
3
|
+
export declare function createImageGenerateTool(hooks: Required<Pick<ToolHooks, "writeGeneratedArtifacts">>, options: {
|
|
4
|
+
modelId: string;
|
|
4
5
|
canSendFilesToActiveConversation?: boolean;
|
|
5
6
|
}, deps?: ImageGenerateToolDeps): Omit<import("../definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
6
7
|
inputSchema: import("../definition").JsonSchemaObject;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { WebSearchToolDeps } from "@/chat/tools/types";
|
|
2
|
-
export declare function createWebSearchTool(override?: WebSearchToolDeps): Omit<import("../definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
2
|
+
export declare function createWebSearchTool(modelId: string, override?: WebSearchToolDeps): Omit<import("../definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
3
3
|
inputSchema: import("../definition").JsonSchemaObject;
|
|
4
4
|
outputSchema: import("../definition").JsonSchemaObject;
|
|
5
5
|
prepareArguments(args: unknown): {
|