@sentry/junior 0.57.0 → 0.59.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/app.js +1311 -1284
- package/dist/chat/agent-dispatch/store.d.ts +4 -2
- package/dist/chat/agent-dispatch/types.d.ts +0 -1
- package/dist/chat/conversation-privacy.d.ts +23 -0
- package/dist/chat/logging.d.ts +2 -0
- package/dist/chat/mcp/tool-manager.d.ts +18 -5
- package/dist/chat/mcp/tool-name.d.ts +2 -0
- package/dist/chat/pi/client.d.ts +2 -0
- package/dist/chat/pi/derived-state.d.ts +5 -0
- package/dist/chat/pi/traced-stream.d.ts +5 -1
- package/dist/chat/prompt.d.ts +3 -9
- package/dist/chat/respond-helpers.d.ts +5 -3
- package/dist/chat/respond.d.ts +1 -0
- package/dist/chat/runtime/conversation-message.d.ts +10 -0
- package/dist/chat/runtime/processing-reaction.d.ts +2 -4
- package/dist/chat/runtime/reply-executor.d.ts +13 -16
- package/dist/chat/runtime/slack-runtime.d.ts +19 -32
- package/dist/chat/runtime/thread-state.d.ts +1 -1
- package/dist/chat/runtime/turn-input.d.ts +29 -0
- package/dist/chat/runtime/turn-preparation.d.ts +4 -24
- package/dist/chat/runtime/turn.d.ts +2 -3
- package/dist/chat/sentry-links.d.ts +4 -0
- package/dist/chat/services/context-compaction.d.ts +3 -4
- package/dist/chat/services/pending-auth.d.ts +1 -1
- package/dist/chat/services/subscribed-reply-policy.d.ts +2 -13
- package/dist/chat/services/timeout-resume.d.ts +1 -2
- package/dist/chat/services/turn-session-record.d.ts +82 -0
- package/dist/chat/slack/assistant-thread/title.d.ts +4 -1
- package/dist/chat/state/artifacts.d.ts +1 -0
- package/dist/chat/state/conversation.d.ts +0 -1
- package/dist/chat/state/session-log.d.ts +117 -0
- package/dist/chat/state/ttl.d.ts +2 -0
- package/dist/chat/state/turn-session.d.ts +89 -0
- package/dist/chat/tools/advisor/tool.d.ts +2 -0
- package/dist/chat/tools/agent-tools.d.ts +2 -1
- package/dist/chat/tools/skill/call-mcp-tool.d.ts +7 -3
- package/dist/chat/tools/skill/search-mcp-tools.d.ts +15 -3
- package/dist/chat/tools/types.d.ts +0 -1
- package/dist/{chunk-AA5TIFN5.js → chunk-FKEKRBUB.js} +267 -735
- package/dist/{chunk-TTUY467K.js → chunk-H652GMDH.js} +30 -14
- package/dist/chunk-I4FDGMFI.js +950 -0
- package/dist/{chunk-D3G3YOU4.js → chunk-ITOW4DED.js} +1 -1
- package/dist/chunk-QDGD5WVN.js +708 -0
- package/dist/cli/check.js +2 -2
- package/dist/cli/init.js +0 -1
- package/dist/cli/snapshot-warmup.js +5 -3
- package/dist/instrumentation.js +3 -0
- package/dist/reporting.d.ts +113 -0
- package/dist/reporting.js +390 -0
- package/package.json +25 -11
- package/dist/chat/services/turn-checkpoint.d.ts +0 -74
- package/dist/chat/state/pi-session-message-store.d.ts +0 -15
- package/dist/chat/state/turn-session-store.d.ts +0 -49
- package/dist/handlers/diagnostics-dashboard.d.ts +0 -2
- package/dist/handlers/diagnostics.d.ts +0 -2
|
@@ -38,7 +38,6 @@ export interface ConversationBackfillState {
|
|
|
38
38
|
export interface ConversationProcessingState {
|
|
39
39
|
activeTurnId?: string;
|
|
40
40
|
lastCompletedAtMs?: number;
|
|
41
|
-
lastSessionId?: string;
|
|
42
41
|
pendingAuth?: ConversationPendingAuthState;
|
|
43
42
|
}
|
|
44
43
|
export interface ConversationPendingAuthState {
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { PiMessage } from "@/chat/pi/messages";
|
|
3
|
+
declare const authorizationKindSchema: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
|
|
4
|
+
declare const sessionLogEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
6
|
+
type: z.ZodLiteral<"pi_message">;
|
|
7
|
+
sessionId: z.ZodDefault<z.ZodString>;
|
|
8
|
+
message: z.ZodPipe<z.ZodObject<{
|
|
9
|
+
role: z.ZodString;
|
|
10
|
+
}, z.core.$loose>, z.ZodTransform<import("@earendil-works/pi-ai").UserMessage | import("@earendil-works/pi-ai").AssistantMessage | import("@earendil-works/pi-ai").ToolResultMessage<any> | import("@earendil-works/pi-agent-core").CustomMessage<unknown> | import("@earendil-works/pi-agent-core").BashExecutionMessage | import("@earendil-works/pi-agent-core").BranchSummaryMessage | import("@earendil-works/pi-agent-core").CompactionSummaryMessage, {
|
|
11
|
+
[x: string]: unknown;
|
|
12
|
+
role: string;
|
|
13
|
+
}>>;
|
|
14
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
15
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
16
|
+
type: z.ZodLiteral<"projection_reset">;
|
|
17
|
+
sessionId: z.ZodDefault<z.ZodString>;
|
|
18
|
+
messages: z.ZodArray<z.ZodPipe<z.ZodObject<{
|
|
19
|
+
role: z.ZodString;
|
|
20
|
+
}, z.core.$loose>, z.ZodTransform<import("@earendil-works/pi-ai").UserMessage | import("@earendil-works/pi-ai").AssistantMessage | import("@earendil-works/pi-ai").ToolResultMessage<any> | import("@earendil-works/pi-agent-core").CustomMessage<unknown> | import("@earendil-works/pi-agent-core").BashExecutionMessage | import("@earendil-works/pi-agent-core").BranchSummaryMessage | import("@earendil-works/pi-agent-core").CompactionSummaryMessage, {
|
|
21
|
+
[x: string]: unknown;
|
|
22
|
+
role: string;
|
|
23
|
+
}>>>;
|
|
24
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
25
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
26
|
+
type: z.ZodLiteral<"mcp_provider_connected">;
|
|
27
|
+
sessionId: z.ZodDefault<z.ZodString>;
|
|
28
|
+
provider: z.ZodString;
|
|
29
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
30
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
31
|
+
type: z.ZodLiteral<"authorization_requested">;
|
|
32
|
+
sessionId: z.ZodDefault<z.ZodString>;
|
|
33
|
+
createdAtMs: z.ZodNumber;
|
|
34
|
+
kind: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
|
|
35
|
+
provider: z.ZodString;
|
|
36
|
+
requesterId: z.ZodString;
|
|
37
|
+
authorizationId: z.ZodString;
|
|
38
|
+
delivery: z.ZodUnion<readonly [z.ZodLiteral<"private_link_sent">, z.ZodLiteral<"private_link_reused">]>;
|
|
39
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
40
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
41
|
+
type: z.ZodLiteral<"authorization_completed">;
|
|
42
|
+
sessionId: z.ZodDefault<z.ZodString>;
|
|
43
|
+
createdAtMs: z.ZodNumber;
|
|
44
|
+
kind: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
|
|
45
|
+
provider: z.ZodString;
|
|
46
|
+
requesterId: z.ZodString;
|
|
47
|
+
authorizationId: z.ZodString;
|
|
48
|
+
}, z.core.$strip>], "type">;
|
|
49
|
+
export type SessionLogEntry = z.infer<typeof sessionLogEntrySchema>;
|
|
50
|
+
export type AuthorizationKind = z.infer<typeof authorizationKindSchema>;
|
|
51
|
+
interface Scope {
|
|
52
|
+
conversationId: string;
|
|
53
|
+
}
|
|
54
|
+
interface AppendArgs {
|
|
55
|
+
entries: SessionLogEntry[];
|
|
56
|
+
scope: Scope;
|
|
57
|
+
ttlMs: number;
|
|
58
|
+
}
|
|
59
|
+
export interface SessionLogStore {
|
|
60
|
+
append(args: AppendArgs): Promise<void>;
|
|
61
|
+
read(scope: Scope): Promise<SessionLogEntry[]>;
|
|
62
|
+
}
|
|
63
|
+
/** Load the committed Pi-message projection for a conversation. */
|
|
64
|
+
export declare function loadMessages(args: Scope & {
|
|
65
|
+
store?: SessionLogStore;
|
|
66
|
+
messageCount: number;
|
|
67
|
+
sessionId?: string;
|
|
68
|
+
}): Promise<PiMessage[] | undefined>;
|
|
69
|
+
/** Load the full current Pi-message projection for a conversation. */
|
|
70
|
+
export declare function loadProjection(args: Scope & {
|
|
71
|
+
store?: SessionLogStore;
|
|
72
|
+
sessionId?: string;
|
|
73
|
+
}): Promise<PiMessage[]>;
|
|
74
|
+
/** Load MCP providers that were durably connected in this conversation. */
|
|
75
|
+
export declare function loadConnectedMcpProviders(args: Scope & {
|
|
76
|
+
store?: SessionLogStore;
|
|
77
|
+
}): Promise<string[]>;
|
|
78
|
+
/** Record a successful MCP provider connection without duplicating the fact. */
|
|
79
|
+
export declare function recordMcpProviderConnected(args: Scope & {
|
|
80
|
+
store?: SessionLogStore;
|
|
81
|
+
provider: string;
|
|
82
|
+
ttlMs: number;
|
|
83
|
+
}): Promise<void>;
|
|
84
|
+
/** Record that an OAuth/MCP authorization link was delivered or reused. */
|
|
85
|
+
export declare function recordAuthorizationRequested(args: Scope & {
|
|
86
|
+
store?: SessionLogStore;
|
|
87
|
+
kind: AuthorizationKind;
|
|
88
|
+
provider: string;
|
|
89
|
+
requesterId: string;
|
|
90
|
+
authorizationId: string;
|
|
91
|
+
delivery: "private_link_sent" | "private_link_reused";
|
|
92
|
+
ttlMs: number;
|
|
93
|
+
}): Promise<void>;
|
|
94
|
+
/** Record completed authorization as a chronological host observation for Pi. */
|
|
95
|
+
export declare function recordAuthorizationCompleted(args: Scope & {
|
|
96
|
+
store?: SessionLogStore;
|
|
97
|
+
kind: AuthorizationKind;
|
|
98
|
+
provider: string;
|
|
99
|
+
requesterId: string;
|
|
100
|
+
authorizationId: string;
|
|
101
|
+
ttlMs: number;
|
|
102
|
+
}): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* Append conversation-log entries and advance the current Pi projection.
|
|
105
|
+
*
|
|
106
|
+
* Normal commits append new Pi messages. If the runtime rolls back to an
|
|
107
|
+
* earlier safe boundary, the log records that projection reset as an explicit
|
|
108
|
+
* event instead of rewriting prior history.
|
|
109
|
+
*/
|
|
110
|
+
export declare function commitMessages(args: Scope & {
|
|
111
|
+
store?: SessionLogStore;
|
|
112
|
+
messages: PiMessage[];
|
|
113
|
+
ttlMs: number;
|
|
114
|
+
}): Promise<{
|
|
115
|
+
sessionId: string;
|
|
116
|
+
}>;
|
|
117
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { PiMessage } from "@/chat/pi/messages";
|
|
2
|
+
import type { AgentTurnUsage } from "@/chat/usage";
|
|
3
|
+
export type AgentTurnSessionStatus = "running" | "awaiting_resume" | "completed" | "failed" | "abandoned";
|
|
4
|
+
export type AgentTurnResumeReason = "timeout" | "auth";
|
|
5
|
+
export interface AgentTurnRequester {
|
|
6
|
+
email?: string;
|
|
7
|
+
fullName?: string;
|
|
8
|
+
slackUserId?: string;
|
|
9
|
+
slackUserName?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface AgentTurnSessionRecord {
|
|
12
|
+
channelName?: string;
|
|
13
|
+
conversationTitle?: string;
|
|
14
|
+
version: number;
|
|
15
|
+
conversationId: string;
|
|
16
|
+
cumulativeDurationMs?: number;
|
|
17
|
+
cumulativeUsage?: AgentTurnUsage;
|
|
18
|
+
errorMessage?: string;
|
|
19
|
+
lastProgressAtMs: number;
|
|
20
|
+
loadedSkillNames?: string[];
|
|
21
|
+
piMessages: PiMessage[];
|
|
22
|
+
requester?: AgentTurnRequester;
|
|
23
|
+
resumeReason?: AgentTurnResumeReason;
|
|
24
|
+
resumedFromSliceId?: number;
|
|
25
|
+
sessionId: string;
|
|
26
|
+
sliceId: number;
|
|
27
|
+
startedAtMs: number;
|
|
28
|
+
state: AgentTurnSessionStatus;
|
|
29
|
+
traceId?: string;
|
|
30
|
+
updatedAtMs: number;
|
|
31
|
+
}
|
|
32
|
+
export type AgentTurnSessionSummary = Omit<AgentTurnSessionRecord, "errorMessage" | "piMessages">;
|
|
33
|
+
/** Read a materialized turn session record for resume and history loading. */
|
|
34
|
+
export declare function getAgentTurnSessionRecord(conversationId: string, sessionId: string): Promise<AgentTurnSessionRecord | undefined>;
|
|
35
|
+
/** Commit stable Pi session state and advance the turn session record. */
|
|
36
|
+
export declare function upsertAgentTurnSessionRecord(args: {
|
|
37
|
+
channelName?: string;
|
|
38
|
+
conversationTitle?: string;
|
|
39
|
+
conversationId: string;
|
|
40
|
+
cumulativeDurationMs?: number;
|
|
41
|
+
cumulativeUsage?: AgentTurnUsage;
|
|
42
|
+
lastProgressAtMs?: number;
|
|
43
|
+
loadedSkillNames?: string[];
|
|
44
|
+
sessionId: string;
|
|
45
|
+
sliceId: number;
|
|
46
|
+
state: AgentTurnSessionStatus;
|
|
47
|
+
piMessages: PiMessage[];
|
|
48
|
+
requester?: AgentTurnRequester;
|
|
49
|
+
resumeReason?: AgentTurnResumeReason;
|
|
50
|
+
errorMessage?: string;
|
|
51
|
+
resumedFromSliceId?: number;
|
|
52
|
+
traceId?: string;
|
|
53
|
+
ttlMs?: number;
|
|
54
|
+
}): Promise<AgentTurnSessionRecord>;
|
|
55
|
+
/** Record turn-session metadata without storing conversation messages. */
|
|
56
|
+
export declare function recordAgentTurnSessionSummary(args: {
|
|
57
|
+
channelName?: string;
|
|
58
|
+
conversationTitle?: string;
|
|
59
|
+
conversationId: string;
|
|
60
|
+
cumulativeDurationMs?: number;
|
|
61
|
+
cumulativeUsage?: AgentTurnUsage;
|
|
62
|
+
lastProgressAtMs?: number;
|
|
63
|
+
loadedSkillNames?: string[];
|
|
64
|
+
requester?: AgentTurnRequester;
|
|
65
|
+
resumeReason?: AgentTurnResumeReason;
|
|
66
|
+
sessionId: string;
|
|
67
|
+
sliceId: number;
|
|
68
|
+
startedAtMs?: number;
|
|
69
|
+
state: AgentTurnSessionStatus;
|
|
70
|
+
traceId?: string;
|
|
71
|
+
ttlMs?: number;
|
|
72
|
+
}): Promise<void>;
|
|
73
|
+
/** List recent turn-session summaries for authenticated operational dashboards. */
|
|
74
|
+
export declare function listAgentTurnSessionSummaries(limit?: number): Promise<AgentTurnSessionSummary[]>;
|
|
75
|
+
/** List turn-session summaries for one conversation without the global feed cap. */
|
|
76
|
+
export declare function listAgentTurnSessionSummariesForConversation(conversationId: string): Promise<AgentTurnSessionSummary[]>;
|
|
77
|
+
/** Mark an unfinished turn session record as abandoned when a newer turn wins. */
|
|
78
|
+
export declare function abandonAgentTurnSessionRecord(args: {
|
|
79
|
+
conversationId: string;
|
|
80
|
+
sessionId: string;
|
|
81
|
+
errorMessage?: string;
|
|
82
|
+
}): Promise<AgentTurnSessionRecord | undefined>;
|
|
83
|
+
/** Mark an unfinished turn session record as failed so it cannot resume. */
|
|
84
|
+
export declare function failAgentTurnSessionRecord(args: {
|
|
85
|
+
conversationId: string;
|
|
86
|
+
expectedVersion: number;
|
|
87
|
+
sessionId: string;
|
|
88
|
+
errorMessage?: string;
|
|
89
|
+
}): Promise<AgentTurnSessionRecord | undefined>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type AgentTool, type StreamFn } from "@earendil-works/pi-agent-core";
|
|
2
2
|
import type { AdvisorConfig } from "@/chat/config";
|
|
3
|
+
import { type ConversationPrivacy } from "@/chat/conversation-privacy";
|
|
3
4
|
import { type LogContext } from "@/chat/logging";
|
|
4
5
|
import { type AdvisorSessionStore } from "@/chat/tools/advisor/session-store";
|
|
5
6
|
import { type ToolDefinition } from "@/chat/tools/definition";
|
|
@@ -19,6 +20,7 @@ export interface AdvisorToolResult {
|
|
|
19
20
|
export interface AdvisorToolRuntimeContext {
|
|
20
21
|
config: AdvisorConfig;
|
|
21
22
|
conversationId?: string;
|
|
23
|
+
conversationPrivacy?: ConversationPrivacy;
|
|
22
24
|
getTools: () => AgentTool[];
|
|
23
25
|
logContext?: LogContext;
|
|
24
26
|
store?: AdvisorSessionStore;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import { type ConversationPrivacy } from "@/chat/conversation-privacy";
|
|
2
3
|
import { type LogContext } from "@/chat/logging";
|
|
3
4
|
import type { PluginAuthOrchestration } from "@/chat/services/plugin-auth-orchestration";
|
|
4
5
|
import type { AssistantStatusSpec } from "@/chat/slack/assistant-thread/status";
|
|
@@ -7,4 +8,4 @@ import type { SkillSandbox } from "@/chat/sandbox/skill-sandbox";
|
|
|
7
8
|
import type { ToolDefinition } from "@/chat/tools/definition";
|
|
8
9
|
import type { AgentPluginHookRunner } from "@/chat/plugins/agent-hooks";
|
|
9
10
|
/** Wrap tool definitions into Pi Agent tool objects with logging, validation, and sandbox execution. */
|
|
10
|
-
export declare function createAgentTools(tools: Record<string, ToolDefinition<any>>, sandbox: SkillSandbox, spanContext: LogContext, onStatus?: (status: AssistantStatusSpec) => void | Promise<void>, sandboxExecutor?: SandboxExecutor, pluginAuthOrchestration?: PluginAuthOrchestration, onToolCall?: (toolName: string, params: Record<string, unknown>) => void, agentHooks?: AgentPluginHookRunner): AgentTool[];
|
|
11
|
+
export declare function createAgentTools(tools: Record<string, ToolDefinition<any>>, sandbox: SkillSandbox, spanContext: LogContext, onStatus?: (status: AssistantStatusSpec) => void | Promise<void>, sandboxExecutor?: SandboxExecutor, pluginAuthOrchestration?: PluginAuthOrchestration, onToolCall?: (toolName: string, params: Record<string, unknown>) => void, agentHooks?: AgentPluginHookRunner, conversationPrivacy?: ConversationPrivacy): AgentTool[];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { ManagedMcpTool } from "@/chat/mcp/tool-manager";
|
|
2
|
+
interface CallMcpToolManager {
|
|
3
|
+
activateProvider(provider: string): Promise<boolean>;
|
|
4
|
+
getResolvedActiveTools(): ManagedMcpTool[];
|
|
5
|
+
}
|
|
3
6
|
/** Create the stable dispatcher for active MCP provider tools. */
|
|
4
|
-
export declare function createCallMcpToolTool(mcpToolManager:
|
|
7
|
+
export declare function createCallMcpToolTool(mcpToolManager: CallMcpToolManager): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
5
8
|
tool_name: import("@sinclair/typebox").TString;
|
|
6
9
|
arguments: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
7
10
|
}>>;
|
|
11
|
+
export {};
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { ManagedMcpToolDescriptor } from "@/chat/mcp/tool-manager";
|
|
2
|
+
interface ProviderSummary {
|
|
3
|
+
provider: string;
|
|
4
|
+
description: string;
|
|
5
|
+
active: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface SearchMcpToolManager {
|
|
8
|
+
activateProvider(provider: string): Promise<boolean>;
|
|
9
|
+
getActiveToolCatalog(options?: {
|
|
10
|
+
provider?: string;
|
|
11
|
+
}): ManagedMcpToolDescriptor[];
|
|
12
|
+
getAvailableProviderCatalog(): ProviderSummary[];
|
|
13
|
+
}
|
|
3
14
|
/** Create the progressive MCP catalog search tool used before callMcpTool. */
|
|
4
|
-
export declare function createSearchMcpToolsTool(mcpToolManager:
|
|
15
|
+
export declare function createSearchMcpToolsTool(mcpToolManager: SearchMcpToolManager): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
5
16
|
query: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
6
17
|
provider: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
7
18
|
max_results: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
8
19
|
}>>;
|
|
20
|
+
export {};
|