@sentry/junior 0.53.0 → 0.55.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/README.md +4 -3
- package/dist/api-reference.d.ts +7 -0
- package/dist/app.d.ts +14 -12
- package/dist/app.js +12977 -10333
- package/dist/build/copy-build-content.d.ts +4 -0
- package/dist/build/glob-to-regex.d.ts +2 -0
- package/dist/build/rolldown-workarounds.d.ts +14 -0
- package/dist/build/virtual-config.d.ts +4 -0
- package/dist/chat/agent-dispatch/context.d.ts +6 -0
- package/dist/chat/agent-dispatch/heartbeat.d.ts +14 -0
- package/dist/chat/agent-dispatch/runner.d.ts +9 -0
- package/dist/chat/agent-dispatch/signing.d.ts +5 -0
- package/dist/chat/agent-dispatch/store.d.ts +29 -0
- package/dist/chat/agent-dispatch/types.d.ts +57 -0
- package/dist/chat/agent-dispatch/validation.d.ts +3 -0
- package/dist/chat/app/factory.d.ts +10 -0
- package/dist/chat/app/production.d.ts +6 -0
- package/dist/chat/app/services.d.ts +17 -0
- package/dist/chat/capabilities/catalog.d.ts +16 -0
- package/dist/chat/capabilities/factory.d.ts +10 -0
- package/dist/chat/capabilities/jr-rpc-command.d.ts +26 -0
- package/dist/chat/capabilities/router.d.ts +19 -0
- package/dist/chat/coerce.d.ts +6 -0
- package/dist/chat/config.d.ts +47 -0
- package/dist/chat/configuration/defaults.d.ts +4 -0
- package/dist/chat/configuration/service.d.ts +2 -0
- package/dist/chat/configuration/types.d.ts +37 -0
- package/dist/chat/configuration/validation.d.ts +2 -0
- package/dist/chat/credentials/broker.d.ts +22 -0
- package/dist/chat/credentials/header-transforms.d.ts +3 -0
- package/dist/chat/credentials/oauth-scope.d.ts +4 -0
- package/dist/chat/credentials/state-adapter-token-store.d.ts +9 -0
- package/dist/chat/credentials/unlink-provider.d.ts +2 -0
- package/dist/chat/credentials/user-token-store.d.ts +11 -0
- package/dist/chat/discovery.d.ts +47 -0
- package/dist/chat/ingress/junior-chat.d.ts +26 -0
- package/dist/chat/ingress/message-changed.d.ts +50 -0
- package/dist/chat/ingress/message-router.d.ts +9 -0
- package/dist/chat/ingress/slash-command.d.ts +3 -0
- package/dist/chat/ingress/workspace-membership.d.ts +9 -0
- package/dist/chat/interruption-marker.d.ts +2 -0
- package/dist/chat/logging.d.ts +90 -0
- package/dist/chat/mcp/auth-store.d.ts +41 -0
- package/dist/chat/mcp/client.d.ts +34 -0
- package/dist/chat/mcp/errors.d.ts +8 -0
- package/dist/chat/mcp/oauth-provider.d.ts +27 -0
- package/dist/chat/mcp/oauth.d.ts +17 -0
- package/dist/chat/mcp/tool-manager.d.ts +60 -0
- package/dist/chat/oauth-flow.d.ts +45 -0
- package/dist/chat/optional-string.d.ts +5 -0
- package/dist/chat/pi/client.d.ts +49 -0
- package/dist/chat/pi/messages.d.ts +3 -0
- package/dist/chat/pi/traced-stream.d.ts +9 -0
- package/dist/chat/plugins/agent-hooks.d.ts +32 -0
- package/dist/chat/plugins/auth/api-headers-broker.d.ts +6 -0
- package/dist/chat/plugins/auth/auth-token-placeholder.d.ts +3 -0
- package/dist/chat/plugins/auth/github-app-broker.d.ts +4 -0
- package/dist/chat/plugins/auth/oauth-bearer-broker.d.ts +6 -0
- package/dist/chat/plugins/auth/oauth-request.d.ts +18 -0
- package/dist/chat/plugins/command-env.d.ts +3 -0
- package/dist/chat/plugins/logging.d.ts +3 -0
- package/dist/chat/plugins/manifest.d.ts +3 -0
- package/dist/chat/plugins/package-discovery.d.ts +14 -0
- package/dist/chat/plugins/registry.d.ts +23 -0
- package/dist/chat/plugins/state.d.ts +3 -0
- package/dist/chat/plugins/types.d.ts +146 -0
- package/dist/chat/prompt.d.ts +39 -0
- package/dist/chat/queue/thread-message-dispatcher.d.ts +33 -0
- package/dist/chat/respond-helpers.d.ts +77 -0
- package/dist/chat/respond.d.ts +75 -0
- package/dist/chat/runtime/auth-pause-state.d.ts +11 -0
- package/dist/chat/runtime/delivered-turn-state.d.ts +15 -0
- package/dist/chat/runtime/dev-agent-trace.d.ts +1 -0
- package/dist/chat/runtime/processing-reaction.d.ts +25 -0
- package/dist/chat/runtime/reply-executor.d.ts +56 -0
- package/dist/chat/runtime/report-progress.d.ts +3 -0
- package/dist/chat/runtime/slack-resume.d.ts +50 -0
- package/dist/chat/runtime/slack-runtime.d.ts +100 -0
- package/dist/chat/runtime/thread-context.d.ts +24 -0
- package/dist/chat/runtime/thread-state.d.ts +28 -0
- package/dist/chat/runtime/turn-preparation.d.ts +43 -0
- package/dist/chat/runtime/turn-user-message.d.ts +12 -0
- package/dist/chat/runtime/turn.d.ts +69 -0
- package/dist/chat/sandbox/credentials.d.ts +11 -0
- package/dist/chat/sandbox/egress-oidc.d.ts +3 -0
- package/dist/chat/sandbox/egress-policy.d.ts +11 -0
- package/dist/chat/sandbox/egress-proxy.d.ts +17 -0
- package/dist/chat/sandbox/egress-session.d.ts +27 -0
- package/dist/chat/sandbox/errors.d.ts +12 -0
- package/dist/chat/sandbox/http-error-details.d.ts +18 -0
- package/dist/chat/sandbox/noninteractive-command.d.ts +17 -0
- package/dist/chat/sandbox/paths.d.ts +5 -0
- package/dist/chat/sandbox/runtime-dependency-snapshots.d.ts +20 -0
- package/dist/chat/sandbox/sandbox.d.ts +54 -0
- package/dist/chat/sandbox/session.d.ts +54 -0
- package/dist/chat/sandbox/skill-sandbox.d.ts +42 -0
- package/dist/chat/sandbox/skill-sync.d.ts +16 -0
- package/dist/chat/sandbox/workspace.d.ts +55 -0
- package/dist/chat/scheduler/cadence.d.ts +24 -0
- package/dist/chat/scheduler/plugin.d.ts +2 -0
- package/dist/chat/scheduler/prompt.d.ts +7 -0
- package/dist/chat/scheduler/store.d.ts +49 -0
- package/dist/chat/scheduler/types.d.ts +86 -0
- package/dist/chat/sentry.d.ts +2 -0
- package/dist/chat/services/attachment-claims.d.ts +2 -0
- package/dist/chat/services/auth-pause-response.d.ts +2 -0
- package/dist/chat/services/auth-pause.d.ts +19 -0
- package/dist/chat/services/channel-intent.d.ts +2 -0
- package/dist/chat/services/conversation-memory.d.ts +33 -0
- package/dist/chat/services/mcp-auth-orchestration.d.ts +30 -0
- package/dist/chat/services/pending-auth.d.ts +27 -0
- package/dist/chat/services/plugin-auth-orchestration.d.ts +37 -0
- package/dist/chat/services/provider-default-config.d.ts +9 -0
- package/dist/chat/services/provider-retry.d.ts +6 -0
- package/dist/chat/services/reply-delivery-plan.d.ts +17 -0
- package/dist/chat/services/subscribed-decision.d.ts +63 -0
- package/dist/chat/services/subscribed-reply-policy.d.ts +23 -0
- package/dist/chat/services/timeout-resume.d.ts +17 -0
- package/dist/chat/services/turn-checkpoint.d.ts +74 -0
- package/dist/chat/services/turn-continuation-response.d.ts +2 -0
- package/dist/chat/services/turn-failure-response.d.ts +15 -0
- package/dist/chat/services/turn-result.d.ts +55 -0
- package/dist/chat/services/turn-thinking-level.d.ts +49 -0
- package/dist/chat/services/vision-context.d.ts +61 -0
- package/dist/chat/skills.d.ts +48 -0
- package/dist/chat/slack/adapter.d.ts +9 -0
- package/dist/chat/slack/app-home.d.ts +11 -0
- package/dist/chat/slack/assistant-thread/lifecycle.d.ts +13 -0
- package/dist/chat/slack/assistant-thread/status-render.d.ts +28 -0
- package/dist/chat/slack/assistant-thread/status-scheduler.d.ts +23 -0
- package/dist/chat/slack/assistant-thread/status-send.d.ts +31 -0
- package/dist/chat/slack/assistant-thread/status.d.ts +36 -0
- package/dist/chat/slack/assistant-thread/title.d.ts +28 -0
- package/dist/chat/slack/canvas-references.d.ts +2 -0
- package/dist/chat/slack/channel.d.ts +48 -0
- package/dist/chat/slack/client.d.ts +52 -0
- package/dist/chat/slack/context.d.ts +9 -0
- package/dist/chat/slack/emoji.d.ts +1 -0
- package/dist/chat/slack/errors.d.ts +6 -0
- package/dist/chat/slack/footer.d.ts +42 -0
- package/dist/chat/slack/ids.d.ts +4 -0
- package/dist/chat/slack/legacy-attachments.d.ts +4 -0
- package/dist/chat/slack/message.d.ts +6 -0
- package/dist/chat/slack/mrkdwn.d.ts +12 -0
- package/dist/chat/slack/outbound.d.ts +57 -0
- package/dist/chat/slack/output.d.ts +54 -0
- package/dist/chat/slack/reply.d.ts +33 -0
- package/dist/chat/slack/status-format.d.ts +2 -0
- package/dist/chat/slack/turn-continuation-notice.d.ts +8 -0
- package/dist/chat/slack/user.d.ts +8 -0
- package/dist/chat/slack/users.d.ts +39 -0
- package/dist/chat/slack/workspace-context.d.ts +4 -0
- package/dist/chat/state/adapter.d.ts +9 -0
- package/dist/chat/state/artifacts.d.ts +29 -0
- package/dist/chat/state/conversation.d.ts +81 -0
- package/dist/chat/state/pi-session-message-store.d.ts +15 -0
- package/dist/chat/state/turn-id.d.ts +2 -0
- package/dist/chat/state/turn-session-store.d.ts +49 -0
- package/dist/chat/tools/advisor/session-store.d.ts +9 -0
- package/dist/chat/tools/advisor/tool.d.ts +33 -0
- package/dist/chat/tools/agent-tools.d.ts +10 -0
- package/dist/chat/tools/channel-capabilities.d.ts +11 -0
- package/dist/chat/tools/definition.d.ts +17 -0
- package/dist/chat/tools/execution/build-sandbox-input.d.ts +2 -0
- package/dist/chat/tools/execution/normalize-result.d.ts +6 -0
- package/dist/chat/tools/execution/tool-error-handler.d.ts +3 -0
- package/dist/chat/tools/execution/tool-input-error.d.ts +6 -0
- package/dist/chat/tools/idempotency.d.ts +1 -0
- package/dist/chat/tools/index.d.ts +5 -0
- package/dist/chat/tools/runtime/report-progress.d.ts +4 -0
- package/dist/chat/tools/sandbox/attach-file.d.ts +7 -0
- package/dist/chat/tools/sandbox/bash.d.ts +5 -0
- package/dist/chat/tools/sandbox/edit-file.d.ts +37 -0
- package/dist/chat/tools/sandbox/file-utils.d.ts +52 -0
- package/dist/chat/tools/sandbox/find-files.d.ts +24 -0
- package/dist/chat/tools/sandbox/grep.d.ts +33 -0
- package/dist/chat/tools/sandbox/list-dir.d.ts +22 -0
- package/dist/chat/tools/sandbox/read-file.d.ts +32 -0
- package/dist/chat/tools/sandbox/text-edits.d.ts +28 -0
- package/dist/chat/tools/sandbox/write-file.d.ts +5 -0
- package/dist/chat/tools/skill/call-mcp-tool.d.ts +7 -0
- package/dist/chat/tools/skill/load-skill.d.ts +22 -0
- package/dist/chat/tools/skill/mcp-tool-summary.d.ts +31 -0
- package/dist/chat/tools/skill/search-mcp-tools.d.ts +8 -0
- package/dist/chat/tools/slack/canvas-tools.d.ts +29 -0
- package/dist/chat/tools/slack/canvases.d.ts +45 -0
- package/dist/chat/tools/slack/channel-list-messages.d.ts +9 -0
- package/dist/chat/tools/slack/channel-post-message.d.ts +4 -0
- package/dist/chat/tools/slack/list-tools.d.ts +21 -0
- package/dist/chat/tools/slack/lists.d.ts +42 -0
- package/dist/chat/tools/slack/message-add-reaction.d.ts +4 -0
- package/dist/chat/tools/slack/schedule-tools.d.ts +29 -0
- package/dist/chat/tools/slack/slack-message-url.d.ts +18 -0
- package/dist/chat/tools/slack/thread-read.d.ts +9 -0
- package/dist/chat/tools/slack/user-lookup.d.ts +8 -0
- package/dist/chat/tools/system-time.d.ts +1 -0
- package/dist/chat/tools/types.d.ts +61 -0
- package/dist/chat/tools/web/constants.d.ts +6 -0
- package/dist/chat/tools/web/fetch-content.d.ts +23 -0
- package/dist/chat/tools/web/fetch-tool.d.ts +5 -0
- package/dist/chat/tools/web/image-generate.d.ts +4 -0
- package/dist/chat/tools/web/network.d.ts +6 -0
- package/dist/chat/tools/web/search.d.ts +5 -0
- package/dist/chat/turn-context-tag.d.ts +6 -0
- package/dist/chat/usage.d.ts +24 -0
- package/dist/chat/xml.d.ts +1 -0
- package/dist/{chunk-XPXD3FCE.js → chunk-5LUISFEY.js} +189 -35
- package/dist/{chunk-ZNFNY53B.js → chunk-D3G3YOU4.js} +2 -2
- package/dist/chunk-SCQPBJAU.js +21 -0
- package/dist/{chunk-Q3FDONU7.js → chunk-TTUY467K.js} +47 -37
- package/dist/{chunk-KCOKQLBF.js → chunk-XI3CFWTA.js} +168 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +6 -1
- package/dist/cli/snapshot-warmup.js +3 -3
- package/dist/handlers/agent-dispatch.d.ts +3 -0
- package/dist/handlers/diagnostics-dashboard.d.ts +2 -0
- package/dist/handlers/diagnostics.d.ts +2 -0
- package/dist/handlers/health.d.ts +4 -0
- package/dist/handlers/heartbeat.d.ts +3 -0
- package/dist/handlers/mcp-oauth-callback.d.ts +2 -0
- package/dist/handlers/oauth-callback.d.ts +2 -0
- package/dist/handlers/oauth-html.d.ts +2 -0
- package/dist/handlers/sandbox-egress-proxy.d.ts +9 -0
- package/dist/handlers/turn-resume.d.ts +3 -0
- package/dist/handlers/types.d.ts +2 -0
- package/dist/handlers/webhooks.d.ts +15 -0
- package/dist/instrumentation.d.ts +1 -3
- package/dist/nitro.d.ts +4 -7
- package/dist/nitro.js +112 -54
- package/dist/package-resolution.d.ts +13 -0
- package/dist/vercel.d.ts +2 -4
- package/dist/vercel.js +3 -12
- package/package.json +32 -26
- package/dist/cli/check.d.ts +0 -8
- package/dist/cli/env.d.ts +0 -7
- package/dist/cli/init.d.ts +0 -3
- package/dist/cli/run.d.ts +0 -12
- package/dist/cli/snapshot-warmup.d.ts +0 -3
- package/dist/types-X_iCClPb.d.ts +0 -75
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RedisStateAdapter } from "@chat-adapter/state-redis";
|
|
2
|
+
import type { StateAdapter } from "chat";
|
|
3
|
+
export declare const ACTIVE_LOCK_TTL_MS = 90000;
|
|
4
|
+
export declare function getConnectedStateContext(): Promise<{
|
|
5
|
+
redisStateAdapter?: RedisStateAdapter;
|
|
6
|
+
stateAdapter: StateAdapter;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function getStateAdapter(): StateAdapter;
|
|
9
|
+
export declare function disconnectStateAdapter(): Promise<void>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface ListColumnMap {
|
|
2
|
+
titleColumnId?: string;
|
|
3
|
+
completedColumnId?: string;
|
|
4
|
+
assigneeColumnId?: string;
|
|
5
|
+
dueDateColumnId?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CanvasArtifactSummary {
|
|
8
|
+
id: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
url?: string;
|
|
11
|
+
createdAt?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ThreadArtifactsState {
|
|
14
|
+
assistantContextChannelId?: string;
|
|
15
|
+
assistantTitleSourceMessageId?: string;
|
|
16
|
+
lastCanvasId?: string;
|
|
17
|
+
lastCanvasUrl?: string;
|
|
18
|
+
recentCanvases?: CanvasArtifactSummary[];
|
|
19
|
+
lastListId?: string;
|
|
20
|
+
lastListUrl?: string;
|
|
21
|
+
listColumnMap?: ListColumnMap;
|
|
22
|
+
updatedAt?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Safely coerce an unknown value into a ThreadArtifactsState, discarding invalid fields. */
|
|
25
|
+
export declare function coerceThreadArtifactsState(value: unknown): ThreadArtifactsState;
|
|
26
|
+
/** Wrap a partial artifact update into the storage envelope with an updatedAt timestamp. */
|
|
27
|
+
export declare function buildArtifactStatePatch(patch: Partial<ThreadArtifactsState>): {
|
|
28
|
+
artifacts: ThreadArtifactsState;
|
|
29
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { PiMessage } from "@/chat/pi/messages";
|
|
2
|
+
import type { AuthorizationPauseKind } from "@/chat/services/auth-pause";
|
|
3
|
+
type ConversationRole = "assistant" | "system" | "user";
|
|
4
|
+
export interface ConversationAuthor {
|
|
5
|
+
fullName?: string;
|
|
6
|
+
isBot?: boolean;
|
|
7
|
+
userId?: string;
|
|
8
|
+
userName?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ConversationMessageMeta {
|
|
11
|
+
attachmentCount?: number;
|
|
12
|
+
explicitMention?: boolean;
|
|
13
|
+
imageAttachmentCount?: number;
|
|
14
|
+
imageFileIds?: string[];
|
|
15
|
+
imagesHydrated?: boolean;
|
|
16
|
+
replied?: boolean;
|
|
17
|
+
slackTs?: string;
|
|
18
|
+
skippedReason?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ConversationMessage {
|
|
21
|
+
author?: ConversationAuthor;
|
|
22
|
+
createdAtMs: number;
|
|
23
|
+
id: string;
|
|
24
|
+
meta?: ConversationMessageMeta;
|
|
25
|
+
role: ConversationRole;
|
|
26
|
+
text: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ConversationCompaction {
|
|
29
|
+
coveredMessageIds: string[];
|
|
30
|
+
createdAtMs: number;
|
|
31
|
+
id: string;
|
|
32
|
+
summary: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ConversationBackfillState {
|
|
35
|
+
completedAtMs?: number;
|
|
36
|
+
source?: "recent_messages" | "thread_fetch";
|
|
37
|
+
}
|
|
38
|
+
export interface ConversationProcessingState {
|
|
39
|
+
activeTurnId?: string;
|
|
40
|
+
lastCompletedAtMs?: number;
|
|
41
|
+
lastSessionId?: string;
|
|
42
|
+
pendingAuth?: ConversationPendingAuthState;
|
|
43
|
+
}
|
|
44
|
+
export interface ConversationPendingAuthState {
|
|
45
|
+
kind: AuthorizationPauseKind;
|
|
46
|
+
linkSentAtMs: number;
|
|
47
|
+
provider: string;
|
|
48
|
+
requesterId: string;
|
|
49
|
+
sessionId: string;
|
|
50
|
+
}
|
|
51
|
+
export interface ConversationStats {
|
|
52
|
+
compactedMessageCount: number;
|
|
53
|
+
estimatedContextTokens: number;
|
|
54
|
+
totalMessageCount: number;
|
|
55
|
+
updatedAtMs: number;
|
|
56
|
+
}
|
|
57
|
+
export interface ConversationVisionSummary {
|
|
58
|
+
analyzedAtMs: number;
|
|
59
|
+
summary: string;
|
|
60
|
+
}
|
|
61
|
+
export interface ConversationVisionState {
|
|
62
|
+
backfillCompletedAtMs?: number;
|
|
63
|
+
byFileId: Record<string, ConversationVisionSummary>;
|
|
64
|
+
}
|
|
65
|
+
export interface ThreadConversationState {
|
|
66
|
+
backfill: ConversationBackfillState;
|
|
67
|
+
compactions: ConversationCompaction[];
|
|
68
|
+
messages: ConversationMessage[];
|
|
69
|
+
piMessages: PiMessage[];
|
|
70
|
+
processing: ConversationProcessingState;
|
|
71
|
+
schemaVersion: 1;
|
|
72
|
+
stats: ConversationStats;
|
|
73
|
+
vision: ConversationVisionState;
|
|
74
|
+
}
|
|
75
|
+
/** Safely coerce an unknown persisted value into a ThreadConversationState. */
|
|
76
|
+
export declare function coerceThreadConversationState(value: unknown): ThreadConversationState;
|
|
77
|
+
/** Wrap a conversation state into the storage envelope for persistence. */
|
|
78
|
+
export declare function buildConversationStatePatch(conversation: ThreadConversationState): {
|
|
79
|
+
conversation: ThreadConversationState;
|
|
80
|
+
};
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PiMessage } from "@/chat/pi/messages";
|
|
2
|
+
interface PiSessionScope {
|
|
3
|
+
conversationId: string;
|
|
4
|
+
sessionId: string;
|
|
5
|
+
}
|
|
6
|
+
/** Load the exact stable Pi message prefix for a session. */
|
|
7
|
+
export declare function loadPiSessionMessages(args: PiSessionScope & {
|
|
8
|
+
messageCount: number;
|
|
9
|
+
}): Promise<PiMessage[] | undefined>;
|
|
10
|
+
/** Commit new stable Pi messages before the caller advances its cursor. */
|
|
11
|
+
export declare function commitPiSessionMessages(args: PiSessionScope & {
|
|
12
|
+
messages: PiMessage[];
|
|
13
|
+
ttlMs: number;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { PiMessage } from "@/chat/pi/messages";
|
|
2
|
+
import type { AgentTurnUsage } from "@/chat/usage";
|
|
3
|
+
export type AgentTurnSessionStatus = "running" | "awaiting_resume" | "completed" | "failed" | "superseded";
|
|
4
|
+
export type AgentTurnResumeReason = "timeout" | "auth";
|
|
5
|
+
export interface AgentTurnSessionCheckpoint {
|
|
6
|
+
checkpointVersion: number;
|
|
7
|
+
conversationId: string;
|
|
8
|
+
cumulativeDurationMs?: number;
|
|
9
|
+
cumulativeUsage?: AgentTurnUsage;
|
|
10
|
+
errorMessage?: string;
|
|
11
|
+
loadedSkillNames?: string[];
|
|
12
|
+
piMessages: PiMessage[];
|
|
13
|
+
resumeReason?: AgentTurnResumeReason;
|
|
14
|
+
resumedFromSliceId?: number;
|
|
15
|
+
sessionId: string;
|
|
16
|
+
sliceId: number;
|
|
17
|
+
state: AgentTurnSessionStatus;
|
|
18
|
+
updatedAtMs: number;
|
|
19
|
+
}
|
|
20
|
+
/** Read a materialized turn-session checkpoint for resume and history loading. */
|
|
21
|
+
export declare function getAgentTurnSessionCheckpoint(conversationId: string, sessionId: string): Promise<AgentTurnSessionCheckpoint | undefined>;
|
|
22
|
+
/** Commit stable Pi session state and advance the turn-session checkpoint cursor. */
|
|
23
|
+
export declare function upsertAgentTurnSessionCheckpoint(args: {
|
|
24
|
+
conversationId: string;
|
|
25
|
+
cumulativeDurationMs?: number;
|
|
26
|
+
cumulativeUsage?: AgentTurnUsage;
|
|
27
|
+
sessionId: string;
|
|
28
|
+
sliceId: number;
|
|
29
|
+
state: AgentTurnSessionStatus;
|
|
30
|
+
piMessages: PiMessage[];
|
|
31
|
+
loadedSkillNames?: string[];
|
|
32
|
+
resumeReason?: AgentTurnResumeReason;
|
|
33
|
+
errorMessage?: string;
|
|
34
|
+
resumedFromSliceId?: number;
|
|
35
|
+
ttlMs?: number;
|
|
36
|
+
}): Promise<AgentTurnSessionCheckpoint>;
|
|
37
|
+
/** Mark an unfinished turn-session checkpoint as superseded when a newer turn wins. */
|
|
38
|
+
export declare function supersedeAgentTurnSessionCheckpoint(args: {
|
|
39
|
+
conversationId: string;
|
|
40
|
+
sessionId: string;
|
|
41
|
+
errorMessage?: string;
|
|
42
|
+
}): Promise<AgentTurnSessionCheckpoint | undefined>;
|
|
43
|
+
/** Mark an unfinished turn-session checkpoint as failed so it cannot resume. */
|
|
44
|
+
export declare function failAgentTurnSessionCheckpoint(args: {
|
|
45
|
+
conversationId: string;
|
|
46
|
+
expectedCheckpointVersion?: number;
|
|
47
|
+
sessionId: string;
|
|
48
|
+
errorMessage?: string;
|
|
49
|
+
}): Promise<AgentTurnSessionCheckpoint | undefined>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PiMessage } from "@/chat/pi/messages";
|
|
2
|
+
export interface AdvisorSessionStore {
|
|
3
|
+
load: (conversationId: string) => Promise<PiMessage[]>;
|
|
4
|
+
save: (conversationId: string, messages: PiMessage[]) => Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
/** Return the durable advisor session key for an opaque parent conversation id. */
|
|
7
|
+
export declare function getAdvisorSessionKey(conversationId: string): string;
|
|
8
|
+
/** Create the production advisor message store backed by the chat state adapter. */
|
|
9
|
+
export declare function createStateAdvisorSessionStore(): AdvisorSessionStore;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type AgentTool, type StreamFn } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import type { AdvisorConfig } from "@/chat/config";
|
|
3
|
+
import { type LogContext } from "@/chat/logging";
|
|
4
|
+
import { type AdvisorSessionStore } from "@/chat/tools/advisor/session-store";
|
|
5
|
+
import { type ToolDefinition } from "@/chat/tools/definition";
|
|
6
|
+
export type AdvisorErrorCode = "invalid_context" | "invalid_question" | "missing_conversation_id" | "session_unavailable" | "unavailable";
|
|
7
|
+
export interface AdvisorToolResult {
|
|
8
|
+
content: [{
|
|
9
|
+
type: "text";
|
|
10
|
+
text: string;
|
|
11
|
+
}];
|
|
12
|
+
details: {
|
|
13
|
+
ok: true;
|
|
14
|
+
} | {
|
|
15
|
+
error_code: AdvisorErrorCode;
|
|
16
|
+
ok: false;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface AdvisorToolRuntimeContext {
|
|
20
|
+
config: AdvisorConfig;
|
|
21
|
+
conversationId?: string;
|
|
22
|
+
getTools: () => AgentTool[];
|
|
23
|
+
logContext?: LogContext;
|
|
24
|
+
store?: AdvisorSessionStore;
|
|
25
|
+
streamFn?: StreamFn;
|
|
26
|
+
}
|
|
27
|
+
/** Build the advisor's read-only tool definition subset. */
|
|
28
|
+
export declare function createAdvisorToolDefinitions(definitions: Record<string, ToolDefinition<any>>): Record<string, ToolDefinition<any>>;
|
|
29
|
+
/** Create the advisor tool backed by conversation-scoped message history. */
|
|
30
|
+
export declare function createAdvisorTool(context: AdvisorToolRuntimeContext): ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
31
|
+
question: import("@sinclair/typebox").TString;
|
|
32
|
+
context: import("@sinclair/typebox").TString;
|
|
33
|
+
}>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import { type LogContext } from "@/chat/logging";
|
|
3
|
+
import type { PluginAuthOrchestration } from "@/chat/services/plugin-auth-orchestration";
|
|
4
|
+
import type { AssistantStatusSpec } from "@/chat/slack/assistant-thread/status";
|
|
5
|
+
import type { SandboxExecutor } from "@/chat/sandbox/sandbox";
|
|
6
|
+
import type { SkillSandbox } from "@/chat/sandbox/skill-sandbox";
|
|
7
|
+
import type { ToolDefinition } from "@/chat/tools/definition";
|
|
8
|
+
import type { AgentPluginHookRunner } from "@/chat/plugins/agent-hooks";
|
|
9
|
+
/** 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[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Declared capabilities of the current channel context. */
|
|
2
|
+
export interface ChannelCapabilities {
|
|
3
|
+
/** Can create canvases in this channel (C/G/D channels). */
|
|
4
|
+
canCreateCanvas: boolean;
|
|
5
|
+
/** Can post standalone messages to this channel (C/G channels only). */
|
|
6
|
+
canPostToChannel: boolean;
|
|
7
|
+
/** Can add reactions to messages (C/G/D channels). */
|
|
8
|
+
canAddReactions: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Resolve channel capabilities from a Slack channel ID. */
|
|
11
|
+
export declare function resolveChannelCapabilities(channelId: string | undefined): ChannelCapabilities;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ToolAnnotations } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import type { Static, TSchema } from "@sinclair/typebox";
|
|
3
|
+
import type { ToolExecutionMode } from "@earendil-works/pi-agent-core";
|
|
4
|
+
export interface ToolDefinition<TInputSchema extends TSchema = TSchema> {
|
|
5
|
+
description: string;
|
|
6
|
+
inputSchema: TInputSchema;
|
|
7
|
+
annotations?: ToolAnnotations;
|
|
8
|
+
promptSnippet?: string;
|
|
9
|
+
promptGuidelines?: string[];
|
|
10
|
+
prepareArguments?: (args: unknown) => Static<TInputSchema>;
|
|
11
|
+
executionMode?: ToolExecutionMode;
|
|
12
|
+
execute?: (input: Static<TInputSchema>, options: {
|
|
13
|
+
experimental_context?: unknown;
|
|
14
|
+
}) => Promise<unknown> | unknown;
|
|
15
|
+
}
|
|
16
|
+
/** Infer execute parameter types from the inputSchema via generic binding. */
|
|
17
|
+
export declare function tool<TInputSchema extends TSchema>(definition: ToolDefinition<TInputSchema>): ToolDefinition<TInputSchema>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ImageContent, TextContent } from "@earendil-works/pi-ai";
|
|
2
|
+
/** Unwrap sandbox envelope and detect structured results. */
|
|
3
|
+
export declare function normalizeToolResult(result: unknown, isSandboxResult: boolean): {
|
|
4
|
+
content: Array<TextContent | ImageContent>;
|
|
5
|
+
details: unknown;
|
|
6
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type LogContext } from "@/chat/logging";
|
|
2
|
+
/** Handle tool execution errors: set span attributes, log, and rethrow. */
|
|
3
|
+
export declare function handleToolExecutionError(error: unknown, toolName: string, toolCallId: string | undefined, shouldTrace: boolean, traceContext: LogContext): never;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createOperationKey(toolName: string, input: Record<string, unknown>): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SkillMetadata } from "@/chat/skills";
|
|
2
|
+
import type { ToolDefinition } from "@/chat/tools/definition";
|
|
3
|
+
import type { ToolHooks, ToolRuntimeContext } from "@/chat/tools/types";
|
|
4
|
+
export type { ToolHooks, ToolRuntimeContext };
|
|
5
|
+
export declare function createTools(availableSkills: SkillMetadata[], hooks: ToolHooks | undefined, context: ToolRuntimeContext): Record<string, ToolDefinition<any>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SandboxWorkspace } from "@/chat/sandbox/workspace";
|
|
2
|
+
import type { ToolHooks } from "@/chat/tools/types";
|
|
3
|
+
export declare function createAttachFileTool(sandbox: SandboxWorkspace, hooks?: ToolHooks): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
4
|
+
path: import("@sinclair/typebox").TString;
|
|
5
|
+
filename: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
6
|
+
mimeType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
7
|
+
}>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Create the sandbox shell tool definition exposed to the agent. */
|
|
2
|
+
export declare function createBashTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
3
|
+
command: import("@sinclair/typebox").TString;
|
|
4
|
+
timeoutMs: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
5
|
+
}>>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type SandboxFileSystem } from "@/chat/tools/sandbox/file-utils";
|
|
2
|
+
import { type TextReplacement } from "@/chat/tools/sandbox/text-edits";
|
|
3
|
+
type EditReplacement = TextReplacement;
|
|
4
|
+
interface EditFileResult {
|
|
5
|
+
content: [{
|
|
6
|
+
type: "text";
|
|
7
|
+
text: string;
|
|
8
|
+
}];
|
|
9
|
+
details: {
|
|
10
|
+
diff: string;
|
|
11
|
+
first_changed_line?: number;
|
|
12
|
+
ok: true;
|
|
13
|
+
path: string;
|
|
14
|
+
replacements: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
interface EditFileInput {
|
|
18
|
+
path: string;
|
|
19
|
+
edits: EditReplacement[];
|
|
20
|
+
}
|
|
21
|
+
/** Accept common edit argument variants before Pi validates the canonical schema. */
|
|
22
|
+
export declare function prepareEditFileArguments(input: unknown): EditFileInput;
|
|
23
|
+
/** Apply exact, ordered file replacements through the sandbox filesystem API. */
|
|
24
|
+
export declare function editFile(params: {
|
|
25
|
+
edits: EditReplacement[];
|
|
26
|
+
fs: SandboxFileSystem;
|
|
27
|
+
path: string;
|
|
28
|
+
}): Promise<EditFileResult>;
|
|
29
|
+
/** Create the sandbox edit tool definition exposed to the agent. */
|
|
30
|
+
export declare function createEditFileTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
31
|
+
path: import("@sinclair/typebox").TString;
|
|
32
|
+
edits: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
33
|
+
oldText: import("@sinclair/typebox").TString;
|
|
34
|
+
newText: import("@sinclair/typebox").TString;
|
|
35
|
+
}>>;
|
|
36
|
+
}>>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { SandboxFileSystem } from "@/chat/sandbox/workspace";
|
|
2
|
+
export type { SandboxFileSystem };
|
|
3
|
+
export declare const MAX_TEXT_CHARS = 60000;
|
|
4
|
+
export type TextSearchResultDetails = {
|
|
5
|
+
ok: true;
|
|
6
|
+
path: string;
|
|
7
|
+
truncated: boolean;
|
|
8
|
+
} | {
|
|
9
|
+
ok: false;
|
|
10
|
+
error: "not_found";
|
|
11
|
+
path: string;
|
|
12
|
+
missing_path?: string;
|
|
13
|
+
truncated: false;
|
|
14
|
+
};
|
|
15
|
+
export interface TextSearchToolResult {
|
|
16
|
+
content: [{
|
|
17
|
+
type: "text";
|
|
18
|
+
text: string;
|
|
19
|
+
}];
|
|
20
|
+
details: TextSearchResultDetails;
|
|
21
|
+
}
|
|
22
|
+
/** Normalize model-supplied numeric knobs before they reach filesystem tools. */
|
|
23
|
+
export declare function positiveInteger(value: unknown): number | undefined;
|
|
24
|
+
/** Compare and slice text in one line-ending space while preserving callers' output rules. */
|
|
25
|
+
export declare function normalizeToLf(value: string): string;
|
|
26
|
+
/** Keep tool output inside the model-facing budget with an explicit notice. */
|
|
27
|
+
export declare function truncateText(value: string, maxChars?: number): {
|
|
28
|
+
content: string;
|
|
29
|
+
truncated: boolean;
|
|
30
|
+
};
|
|
31
|
+
/** Detect model-facing missing paths without swallowing sandbox lifecycle/API failures. */
|
|
32
|
+
export declare function isMissingPathError(error: unknown): boolean;
|
|
33
|
+
/** Build the shared model-visible result for expected missing search/list paths. */
|
|
34
|
+
export declare function missingPathSearchResult(params: {
|
|
35
|
+
path: string;
|
|
36
|
+
displayPath?: string;
|
|
37
|
+
missingPath?: string;
|
|
38
|
+
}): TextSearchToolResult;
|
|
39
|
+
/** Keep sandbox filesystem tools scoped to the mounted workspace root. */
|
|
40
|
+
export declare function resolveWorkspacePath(input: string | undefined, fallback?: string): string;
|
|
41
|
+
/** Share bounded workspace traversal across search tools so their skip rules stay aligned. */
|
|
42
|
+
export declare function collectFiles(params: {
|
|
43
|
+
fs: SandboxFileSystem;
|
|
44
|
+
root: string;
|
|
45
|
+
limit?: number;
|
|
46
|
+
pattern?: string;
|
|
47
|
+
}): Promise<{
|
|
48
|
+
files: string[];
|
|
49
|
+
limitReached: boolean;
|
|
50
|
+
missingPath?: string;
|
|
51
|
+
missingRoot: boolean;
|
|
52
|
+
}>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type SandboxFileSystem, type TextSearchResultDetails } from "@/chat/tools/sandbox/file-utils";
|
|
2
|
+
interface FindFilesResult {
|
|
3
|
+
content: [{
|
|
4
|
+
type: "text";
|
|
5
|
+
text: string;
|
|
6
|
+
}];
|
|
7
|
+
details: TextSearchResultDetails & {
|
|
8
|
+
result_limit_reached?: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/** Find workspace files with structured limits instead of ad hoc shell output. */
|
|
12
|
+
export declare function findFiles(params: {
|
|
13
|
+
fs: SandboxFileSystem;
|
|
14
|
+
limit?: unknown;
|
|
15
|
+
path?: string;
|
|
16
|
+
pattern: string;
|
|
17
|
+
}): Promise<FindFilesResult>;
|
|
18
|
+
/** Create the sandbox file discovery tool definition exposed to the agent. */
|
|
19
|
+
export declare function createFindFilesTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
20
|
+
pattern: import("@sinclair/typebox").TString;
|
|
21
|
+
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
22
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
23
|
+
}>>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type SandboxFileSystem, type TextSearchResultDetails } from "@/chat/tools/sandbox/file-utils";
|
|
2
|
+
interface GrepResult {
|
|
3
|
+
content: [{
|
|
4
|
+
type: "text";
|
|
5
|
+
text: string;
|
|
6
|
+
}];
|
|
7
|
+
details: TextSearchResultDetails & {
|
|
8
|
+
line_truncated?: boolean;
|
|
9
|
+
match_limit_reached?: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/** Search workspace file contents with bounded, line-numbered output. */
|
|
13
|
+
export declare function grepFiles(params: {
|
|
14
|
+
context?: unknown;
|
|
15
|
+
fs: SandboxFileSystem;
|
|
16
|
+
glob?: string;
|
|
17
|
+
ignoreCase?: boolean;
|
|
18
|
+
limit?: unknown;
|
|
19
|
+
literal?: boolean;
|
|
20
|
+
path?: string;
|
|
21
|
+
pattern: string;
|
|
22
|
+
}): Promise<GrepResult>;
|
|
23
|
+
/** Create the sandbox grep tool definition exposed to the agent. */
|
|
24
|
+
export declare function createGrepTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
25
|
+
pattern: import("@sinclair/typebox").TString;
|
|
26
|
+
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
27
|
+
glob: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
28
|
+
ignoreCase: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
29
|
+
literal: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
30
|
+
context: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
31
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
32
|
+
}>>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type SandboxFileSystem, type TextSearchResultDetails } from "@/chat/tools/sandbox/file-utils";
|
|
2
|
+
interface ListDirResult {
|
|
3
|
+
content: [{
|
|
4
|
+
type: "text";
|
|
5
|
+
text: string;
|
|
6
|
+
}];
|
|
7
|
+
details: TextSearchResultDetails & {
|
|
8
|
+
entry_limit_reached?: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/** List workspace directories without forcing the model through shell output. */
|
|
12
|
+
export declare function listDir(params: {
|
|
13
|
+
fs: SandboxFileSystem;
|
|
14
|
+
limit?: unknown;
|
|
15
|
+
path?: string;
|
|
16
|
+
}): Promise<ListDirResult>;
|
|
17
|
+
/** Create the sandbox directory listing tool definition exposed to the agent. */
|
|
18
|
+
export declare function createListDirTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
19
|
+
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
20
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
21
|
+
}>>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
interface TextRangeResult {
|
|
2
|
+
content: string;
|
|
3
|
+
end_line?: number;
|
|
4
|
+
path: string;
|
|
5
|
+
start_line: number;
|
|
6
|
+
success: true;
|
|
7
|
+
total_lines: number;
|
|
8
|
+
truncated: boolean;
|
|
9
|
+
continuation?: string;
|
|
10
|
+
}
|
|
11
|
+
interface TextRangeMissingPathResult {
|
|
12
|
+
content: "";
|
|
13
|
+
error: "not_found";
|
|
14
|
+
path: string;
|
|
15
|
+
success: false;
|
|
16
|
+
}
|
|
17
|
+
/** Return a bounded line window so large files can be read incrementally. */
|
|
18
|
+
export declare function sliceFileContent(params: {
|
|
19
|
+
content: string;
|
|
20
|
+
limit?: unknown;
|
|
21
|
+
offset?: unknown;
|
|
22
|
+
path: string;
|
|
23
|
+
}): TextRangeResult;
|
|
24
|
+
/** Return a model-visible result for expected missing read targets. */
|
|
25
|
+
export declare function missingFileResult(path: string): TextRangeMissingPathResult;
|
|
26
|
+
/** Create the sandbox read tool definition exposed to the agent. */
|
|
27
|
+
export declare function createReadFileTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
28
|
+
path: import("@sinclair/typebox").TString;
|
|
29
|
+
offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
30
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
31
|
+
}>>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface TextReplacement {
|
|
2
|
+
oldText: string;
|
|
3
|
+
newText: string;
|
|
4
|
+
}
|
|
5
|
+
export interface TextReplacementInput {
|
|
6
|
+
edits: TextReplacement[];
|
|
7
|
+
}
|
|
8
|
+
/** Preserve a text artifact's dominant line-ending style across rewrites. */
|
|
9
|
+
export declare function detectLineEnding(value: string): "\r\n" | "\n";
|
|
10
|
+
/** Restore normalized LF content to the caller's original line-ending style. */
|
|
11
|
+
export declare function restoreLineEndings(value: string, lineEnding: "\r\n" | "\n"): string;
|
|
12
|
+
/** Keep UTF-8 BOM handling out of exact edit matching. */
|
|
13
|
+
export declare function stripBom(value: string): {
|
|
14
|
+
bom: string;
|
|
15
|
+
text: string;
|
|
16
|
+
};
|
|
17
|
+
/** Accept common exact-edit argument variants before schema validation. */
|
|
18
|
+
export declare function prepareTextReplacementArguments<T extends TextReplacementInput>(input: unknown): T;
|
|
19
|
+
/** Build a small line-oriented diff that gives agents enough context to review edits. */
|
|
20
|
+
export declare function buildCompactDiff(oldContent: string, newContent: string): {
|
|
21
|
+
diff: string;
|
|
22
|
+
firstChangedLine?: number;
|
|
23
|
+
};
|
|
24
|
+
/** Apply exact replacements to normalized text after validating uniqueness and overlap. */
|
|
25
|
+
export declare function validateAndApplyTextEdits(content: string, edits: TextReplacement[], targetName: string): {
|
|
26
|
+
baseContent: string;
|
|
27
|
+
newContent: string;
|
|
28
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Create the sandbox full-file write tool definition exposed to the agent. */
|
|
2
|
+
export declare function createWriteFileTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
3
|
+
path: import("@sinclair/typebox").TString;
|
|
4
|
+
content: import("@sinclair/typebox").TString;
|
|
5
|
+
}>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { McpToolManager } from "@/chat/mcp/tool-manager";
|
|
2
|
+
import type { Skill } from "@/chat/skills";
|
|
3
|
+
/** Create the stable dispatcher for active MCP provider tools. */
|
|
4
|
+
export declare function createCallMcpToolTool(mcpToolManager: McpToolManager, getActiveSkills: () => Skill[]): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
5
|
+
tool_name: import("@sinclair/typebox").TString;
|
|
6
|
+
arguments: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
7
|
+
}>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Skill, type SkillMetadata } from "@/chat/skills";
|
|
2
|
+
export type LoadSkillResult = {
|
|
3
|
+
ok?: boolean;
|
|
4
|
+
error?: string;
|
|
5
|
+
available_skills?: string[];
|
|
6
|
+
skill_name?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
skill_dir?: string;
|
|
9
|
+
working_directory?: string;
|
|
10
|
+
location?: string;
|
|
11
|
+
path_resolution?: string;
|
|
12
|
+
instructions?: string;
|
|
13
|
+
mcp_provider?: string;
|
|
14
|
+
available_tool_count?: number;
|
|
15
|
+
};
|
|
16
|
+
export type LoadSkillMetadata = Pick<LoadSkillResult, "mcp_provider" | "available_tool_count">;
|
|
17
|
+
/** Create the skill-loading tool that injects skill instructions and activates provider catalogs. */
|
|
18
|
+
export declare function createLoadSkillTool(availableSkills: SkillMetadata[], options?: {
|
|
19
|
+
onSkillLoaded?: (skill: Skill) => void | LoadSkillMetadata | Promise<void | LoadSkillMetadata>;
|
|
20
|
+
}): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
21
|
+
skill_name: import("@sinclair/typebox").TString;
|
|
22
|
+
}>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ManagedMcpToolDescriptor } from "@/chat/mcp/tool-manager";
|
|
2
|
+
export interface ExposedToolSummary {
|
|
3
|
+
tool_name: string;
|
|
4
|
+
mcp_tool_name: string;
|
|
5
|
+
provider: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
description: string;
|
|
8
|
+
signature: string;
|
|
9
|
+
call: {
|
|
10
|
+
tool_name: string;
|
|
11
|
+
arguments: Record<string, string>;
|
|
12
|
+
};
|
|
13
|
+
input_schema: Record<string, unknown>;
|
|
14
|
+
input_schema_summary: string;
|
|
15
|
+
output_schema?: Record<string, unknown>;
|
|
16
|
+
annotations?: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
export interface ActiveMcpCatalogSummary {
|
|
19
|
+
provider: string;
|
|
20
|
+
available_tool_count: number;
|
|
21
|
+
}
|
|
22
|
+
/** Build a stable model-readable MCP tool signature. */
|
|
23
|
+
export declare function formatMcpToolSignature(toolName: string, schema: Record<string, unknown>): string;
|
|
24
|
+
/** Build the exact callMcpTool argument shape agents should use. */
|
|
25
|
+
export declare function formatMcpToolCallExample(toolName: string, schema: Record<string, unknown>): ExposedToolSummary["call"];
|
|
26
|
+
/** Summarize an MCP input schema for quick catalog scanning. */
|
|
27
|
+
export declare function summarizeInputSchema(schema: Record<string, unknown>): string;
|
|
28
|
+
/** Convert a managed MCP tool descriptor into agent-visible search output. */
|
|
29
|
+
export declare function toExposedToolSummary(toolDef: ManagedMcpToolDescriptor): ExposedToolSummary;
|
|
30
|
+
/** Group discovered MCP tools into provider catalogs for prompt disclosure. */
|
|
31
|
+
export declare function toActiveMcpCatalogSummaries(toolDefs: ManagedMcpToolDescriptor[]): ActiveMcpCatalogSummary[];
|