@getpaseo/protocol 0.1.84
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 +12 -0
- package/dist/agent-attention-notification.d.ts +41 -0
- package/dist/agent-attention-notification.js +140 -0
- package/dist/agent-labels.d.ts +2 -0
- package/dist/agent-labels.js +2 -0
- package/dist/agent-lifecycle.d.ts +3 -0
- package/dist/agent-lifecycle.js +8 -0
- package/dist/agent-state-bucket.d.ts +13 -0
- package/dist/agent-state-bucket.js +41 -0
- package/dist/agent-title-limits.d.ts +3 -0
- package/dist/agent-title-limits.js +3 -0
- package/dist/agent-types.d.ts +421 -0
- package/dist/agent-types.js +22 -0
- package/dist/binary-frames/file-transfer.d.ts +56 -0
- package/dist/binary-frames/file-transfer.js +108 -0
- package/dist/binary-frames/index.d.ts +3 -0
- package/dist/binary-frames/index.js +3 -0
- package/dist/binary-frames/terminal.d.ts +37 -0
- package/dist/binary-frames/terminal.js +101 -0
- package/dist/chat/rpc-schemas.d.ts +728 -0
- package/dist/chat/rpc-schemas.js +103 -0
- package/dist/chat/types.d.ts +75 -0
- package/dist/chat/types.js +22 -0
- package/dist/client-capabilities.d.ts +6 -0
- package/dist/client-capabilities.js +9 -0
- package/dist/connection-offer.d.ts +80 -0
- package/dist/connection-offer.js +53 -0
- package/dist/daemon-endpoints.d.ts +47 -0
- package/dist/daemon-endpoints.js +201 -0
- package/dist/error-utils.d.ts +11 -0
- package/dist/error-utils.js +27 -0
- package/dist/git-remote.d.ts +16 -0
- package/dist/git-remote.js +72 -0
- package/dist/host-connection-schema.d.ts +23 -0
- package/dist/host-connection-schema.js +9 -0
- package/dist/importable-providers.d.ts +7 -0
- package/dist/importable-providers.js +7 -0
- package/dist/literal-union.d.ts +2 -0
- package/dist/literal-union.js +2 -0
- package/dist/loop/rpc-schemas.d.ts +3005 -0
- package/dist/loop/rpc-schemas.js +163 -0
- package/dist/messages.d.ts +144995 -0
- package/dist/messages.js +3338 -0
- package/dist/paseo-config-schema.d.ts +915 -0
- package/dist/paseo-config-schema.js +77 -0
- package/dist/path-utils.d.ts +2 -0
- package/dist/path-utils.js +16 -0
- package/dist/provider-config.d.ts +602 -0
- package/dist/provider-config.js +123 -0
- package/dist/provider-manifest.d.ts +33 -0
- package/dist/provider-manifest.js +219 -0
- package/dist/schedule/rpc-schemas.d.ts +3993 -0
- package/dist/schedule/rpc-schemas.js +151 -0
- package/dist/schedule/types.d.ts +745 -0
- package/dist/schedule/types.js +74 -0
- package/dist/terminal-input-mode.d.ts +26 -0
- package/dist/terminal-input-mode.js +151 -0
- package/dist/terminal-key-input.d.ts +13 -0
- package/dist/terminal-key-input.js +201 -0
- package/dist/terminal-snapshot.d.ts +3 -0
- package/dist/terminal-snapshot.js +165 -0
- package/dist/terminal-stream-protocol.d.ts +2 -0
- package/dist/terminal-stream-protocol.js +2 -0
- package/dist/tool-call-display.d.ts +11 -0
- package/dist/tool-call-display.js +135 -0
- package/dist/tool-name-normalization.d.ts +9 -0
- package/dist/tool-name-normalization.js +82 -0
- package/package.json +34 -0
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# @getpaseo/protocol
|
|
2
|
+
|
|
3
|
+
Shared Paseo protocol schemas, codecs, and wire types.
|
|
4
|
+
|
|
5
|
+
## Stability
|
|
6
|
+
|
|
7
|
+
This package is public so Paseo's published packages can depend on it cleanly.
|
|
8
|
+
It is not a stable public API yet.
|
|
9
|
+
|
|
10
|
+
Schemas, exports, wire helpers, and types may change or disappear in any release
|
|
11
|
+
without advance notice. Use it outside Paseo at your own risk until the package
|
|
12
|
+
is explicitly documented as stable.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type AgentAttentionReason = "finished" | "error" | "permission";
|
|
2
|
+
export interface AgentAttentionNotificationData {
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
serverId: string;
|
|
5
|
+
agentId: string;
|
|
6
|
+
reason: AgentAttentionReason;
|
|
7
|
+
}
|
|
8
|
+
export interface AgentAttentionNotificationPayload {
|
|
9
|
+
title: string;
|
|
10
|
+
body: string;
|
|
11
|
+
data: AgentAttentionNotificationData;
|
|
12
|
+
}
|
|
13
|
+
interface BuildAgentAttentionNotificationPayloadInput {
|
|
14
|
+
reason: AgentAttentionReason;
|
|
15
|
+
serverId: string;
|
|
16
|
+
agentId: string;
|
|
17
|
+
assistantMessage?: string | null;
|
|
18
|
+
permissionRequest?: NotificationPermissionRequest | null;
|
|
19
|
+
}
|
|
20
|
+
export interface NotificationPermissionRequest {
|
|
21
|
+
id: string;
|
|
22
|
+
provider: string;
|
|
23
|
+
name: string;
|
|
24
|
+
kind: "tool" | "plan" | "question" | "mode" | "other";
|
|
25
|
+
title?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
input?: Record<string, unknown>;
|
|
28
|
+
metadata?: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
export type AssistantTimelineItem = {
|
|
31
|
+
type: "assistant_message";
|
|
32
|
+
text: string;
|
|
33
|
+
} | {
|
|
34
|
+
type: string;
|
|
35
|
+
text?: string;
|
|
36
|
+
};
|
|
37
|
+
export declare function findLatestAssistantMessageFromTimeline(timeline: readonly AssistantTimelineItem[]): string | null;
|
|
38
|
+
export declare function findLatestPermissionRequest(pendingPermissions: ReadonlyMap<string, NotificationPermissionRequest>): NotificationPermissionRequest | null;
|
|
39
|
+
export declare function buildAgentAttentionNotificationPayload(input: BuildAgentAttentionNotificationPayloadInput): AgentAttentionNotificationPayload;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=agent-attention-notification.d.ts.map
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
const NOTIFICATION_PREVIEW_LIMIT = 220;
|
|
2
|
+
const normalizeNotificationText = (text) => text.replace(/\s+/g, " ").trim();
|
|
3
|
+
const truncateNotificationText = (text, limit) => {
|
|
4
|
+
if (text.length <= limit) {
|
|
5
|
+
return text;
|
|
6
|
+
}
|
|
7
|
+
const trimmed = text.slice(0, Math.max(0, limit - 3)).trimEnd();
|
|
8
|
+
return trimmed.length > 0 ? `${trimmed}...` : text.slice(0, limit);
|
|
9
|
+
};
|
|
10
|
+
const stripMarkdownToText = (markdown) => {
|
|
11
|
+
let text = markdown.replace(/\r\n/g, "\n");
|
|
12
|
+
// Strip fenced code markers but keep the code content itself.
|
|
13
|
+
text = text.replace(/^\s*```[^\n]*$/gm, "");
|
|
14
|
+
text = text.replace(/^\s*~~~[^\n]*$/gm, "");
|
|
15
|
+
// Markdown links/images.
|
|
16
|
+
text = text.replace(/!\[([^\]]*)\]\((?:[^()\\]|\\.)*\)/g, "$1");
|
|
17
|
+
text = text.replace(/\[([^\]]+)\]\((?:[^()\\]|\\.)*\)/g, "$1");
|
|
18
|
+
// Structural prefixes.
|
|
19
|
+
text = text.replace(/^\s{0,3}#{1,6}\s+/gm, "");
|
|
20
|
+
text = text.replace(/^\s{0,3}>+\s?/gm, "");
|
|
21
|
+
text = text.replace(/^\s{0,3}(?:[*+-]|\d+\.)\s+/gm, "");
|
|
22
|
+
text = text.replace(/^\s{0,3}(?:[-*_]\s*){3,}$/gm, "");
|
|
23
|
+
// Inline markdown markers.
|
|
24
|
+
text = text.replace(/`([^`]+)`/g, "$1");
|
|
25
|
+
text = text.replace(/\*\*([^*]+)\*\*/g, "$1");
|
|
26
|
+
text = text.replace(/__([^_]+)__/g, "$1");
|
|
27
|
+
text = text.replace(/\*([^*\n]+)\*/g, "$1");
|
|
28
|
+
text = text.replace(/_([^_\n]+)_/g, "$1");
|
|
29
|
+
text = text.replace(/~~([^~]+)~~/g, "$1");
|
|
30
|
+
// Angle-bracketed URL autolinks.
|
|
31
|
+
text = text.replace(/<([^>\n]+)>/g, "$1");
|
|
32
|
+
return text;
|
|
33
|
+
};
|
|
34
|
+
const buildNotificationPreview = (text) => {
|
|
35
|
+
if (!text) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const normalized = normalizeNotificationText(stripMarkdownToText(text));
|
|
39
|
+
if (!normalized) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return truncateNotificationText(normalized, NOTIFICATION_PREVIEW_LIMIT);
|
|
43
|
+
};
|
|
44
|
+
const safeStringify = (value) => {
|
|
45
|
+
try {
|
|
46
|
+
return JSON.stringify(value);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const buildPermissionDetails = (request) => {
|
|
53
|
+
if (!request) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const title = request.title?.trim();
|
|
57
|
+
const description = request.description?.trim();
|
|
58
|
+
const details = [];
|
|
59
|
+
if (title) {
|
|
60
|
+
details.push(title);
|
|
61
|
+
}
|
|
62
|
+
if (description && description !== title) {
|
|
63
|
+
details.push(description);
|
|
64
|
+
}
|
|
65
|
+
if (details.length > 0) {
|
|
66
|
+
return details.join(" - ");
|
|
67
|
+
}
|
|
68
|
+
const inputPreview = request.input ? safeStringify(request.input) : null;
|
|
69
|
+
if (inputPreview) {
|
|
70
|
+
return inputPreview;
|
|
71
|
+
}
|
|
72
|
+
const metadataPreview = request.metadata ? safeStringify(request.metadata) : null;
|
|
73
|
+
if (metadataPreview) {
|
|
74
|
+
return metadataPreview;
|
|
75
|
+
}
|
|
76
|
+
return request.name?.trim() || request.kind;
|
|
77
|
+
};
|
|
78
|
+
export function findLatestAssistantMessageFromTimeline(timeline) {
|
|
79
|
+
// Providers may stream assistant content in consecutive chunks.
|
|
80
|
+
const chunks = [];
|
|
81
|
+
for (let i = timeline.length - 1; i >= 0; i -= 1) {
|
|
82
|
+
const item = timeline[i];
|
|
83
|
+
if (item.type !== "assistant_message" || typeof item.text !== "string") {
|
|
84
|
+
if (chunks.length > 0) {
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
chunks.push(item.text);
|
|
90
|
+
}
|
|
91
|
+
if (chunks.length === 0) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
return chunks.toReversed().join("");
|
|
95
|
+
}
|
|
96
|
+
export function findLatestPermissionRequest(pendingPermissions) {
|
|
97
|
+
let latest = null;
|
|
98
|
+
for (const request of pendingPermissions.values()) {
|
|
99
|
+
latest = request;
|
|
100
|
+
}
|
|
101
|
+
return latest;
|
|
102
|
+
}
|
|
103
|
+
function resolveAgentAttentionTitle(reason) {
|
|
104
|
+
if (reason === "permission")
|
|
105
|
+
return "Agent needs permission";
|
|
106
|
+
if (reason === "error")
|
|
107
|
+
return "Agent needs attention";
|
|
108
|
+
return "Agent finished";
|
|
109
|
+
}
|
|
110
|
+
function resolveAgentAttentionPreview(input) {
|
|
111
|
+
if (input.reason === "finished") {
|
|
112
|
+
return buildNotificationPreview(input.assistantMessage);
|
|
113
|
+
}
|
|
114
|
+
if (input.reason === "permission") {
|
|
115
|
+
return buildNotificationPreview(buildPermissionDetails(input.permissionRequest));
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
function resolveAgentAttentionFallbackBody(reason) {
|
|
120
|
+
if (reason === "permission")
|
|
121
|
+
return "Permission requested.";
|
|
122
|
+
if (reason === "error")
|
|
123
|
+
return "Encountered an error.";
|
|
124
|
+
return "Finished working.";
|
|
125
|
+
}
|
|
126
|
+
export function buildAgentAttentionNotificationPayload(input) {
|
|
127
|
+
const title = resolveAgentAttentionTitle(input.reason);
|
|
128
|
+
const preview = resolveAgentAttentionPreview(input);
|
|
129
|
+
const body = preview ?? resolveAgentAttentionFallbackBody(input.reason);
|
|
130
|
+
return {
|
|
131
|
+
title,
|
|
132
|
+
body,
|
|
133
|
+
data: {
|
|
134
|
+
serverId: input.serverId,
|
|
135
|
+
agentId: input.agentId,
|
|
136
|
+
reason: input.reason,
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=agent-attention-notification.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AgentLifecycleStatus } from "./agent-lifecycle.js";
|
|
2
|
+
import type { WorkspaceStateBucket } from "./messages.js";
|
|
3
|
+
export type AgentAttentionReason = "finished" | "error" | "permission" | null | undefined;
|
|
4
|
+
export interface AgentStateBucketInput {
|
|
5
|
+
status: AgentLifecycleStatus;
|
|
6
|
+
pendingPermissionCount?: number;
|
|
7
|
+
requiresAttention?: boolean;
|
|
8
|
+
attentionReason?: AgentAttentionReason;
|
|
9
|
+
}
|
|
10
|
+
export declare function deriveAgentStateBucket(input: AgentStateBucketInput): WorkspaceStateBucket;
|
|
11
|
+
export declare function getWorkspaceStateBucketPriority(bucket: WorkspaceStateBucket): number;
|
|
12
|
+
export declare function getAgentStatusPriority(input: AgentStateBucketInput): number;
|
|
13
|
+
//# sourceMappingURL=agent-state-bucket.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const WORKSPACE_STATE_BUCKET_PRIORITY = {
|
|
2
|
+
needs_input: 0,
|
|
3
|
+
failed: 1,
|
|
4
|
+
running: 2,
|
|
5
|
+
attention: 3,
|
|
6
|
+
done: 4,
|
|
7
|
+
};
|
|
8
|
+
export function deriveAgentStateBucket(input) {
|
|
9
|
+
if ((input.pendingPermissionCount ?? 0) > 0 || input.attentionReason === "permission") {
|
|
10
|
+
return "needs_input";
|
|
11
|
+
}
|
|
12
|
+
if (input.status === "error" || input.attentionReason === "error") {
|
|
13
|
+
return "failed";
|
|
14
|
+
}
|
|
15
|
+
if (input.status === "running") {
|
|
16
|
+
return "running";
|
|
17
|
+
}
|
|
18
|
+
if (input.requiresAttention) {
|
|
19
|
+
return "attention";
|
|
20
|
+
}
|
|
21
|
+
return "done";
|
|
22
|
+
}
|
|
23
|
+
export function getWorkspaceStateBucketPriority(bucket) {
|
|
24
|
+
return WORKSPACE_STATE_BUCKET_PRIORITY[bucket];
|
|
25
|
+
}
|
|
26
|
+
export function getAgentStatusPriority(input) {
|
|
27
|
+
if ((input.pendingPermissionCount ?? 0) > 0 || input.attentionReason === "permission") {
|
|
28
|
+
return 0;
|
|
29
|
+
}
|
|
30
|
+
if (input.status === "error" || input.attentionReason === "error") {
|
|
31
|
+
return 1;
|
|
32
|
+
}
|
|
33
|
+
if (input.status === "running") {
|
|
34
|
+
return 2;
|
|
35
|
+
}
|
|
36
|
+
if (input.status === "initializing") {
|
|
37
|
+
return 3;
|
|
38
|
+
}
|
|
39
|
+
return 4;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=agent-state-bucket.js.map
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import type { AgentAttachment } from "./messages.js";
|
|
2
|
+
export type AgentProvider = string;
|
|
3
|
+
export interface AgentMetadata {
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Stdio-based MCP server (spawns a subprocess).
|
|
8
|
+
*/
|
|
9
|
+
export interface McpStdioServerConfig {
|
|
10
|
+
type: "stdio";
|
|
11
|
+
command: string;
|
|
12
|
+
args?: string[];
|
|
13
|
+
env?: Record<string, string>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* HTTP-based MCP server.
|
|
17
|
+
*/
|
|
18
|
+
export interface McpHttpServerConfig {
|
|
19
|
+
type: "http";
|
|
20
|
+
url: string;
|
|
21
|
+
headers?: Record<string, string>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* SSE-based MCP server (Server-Sent Events over HTTP).
|
|
25
|
+
*/
|
|
26
|
+
export interface McpSseServerConfig {
|
|
27
|
+
type: "sse";
|
|
28
|
+
url: string;
|
|
29
|
+
headers?: Record<string, string>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Canonical MCP server configuration.
|
|
33
|
+
* Discriminated union by `type` field.
|
|
34
|
+
* Each provider normalizes this to their expected format.
|
|
35
|
+
*/
|
|
36
|
+
export type McpServerConfig = McpStdioServerConfig | McpHttpServerConfig | McpSseServerConfig;
|
|
37
|
+
export interface AgentMode {
|
|
38
|
+
id: string;
|
|
39
|
+
label: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
icon?: string;
|
|
42
|
+
colorTier?: string;
|
|
43
|
+
}
|
|
44
|
+
export type ProviderStatus = "ready" | "loading" | "error" | "unavailable";
|
|
45
|
+
export interface AgentModelDefinition {
|
|
46
|
+
provider: AgentProvider;
|
|
47
|
+
id: string;
|
|
48
|
+
label: string;
|
|
49
|
+
description?: string;
|
|
50
|
+
isDefault?: boolean;
|
|
51
|
+
metadata?: AgentMetadata;
|
|
52
|
+
thinkingOptions?: AgentSelectOption[];
|
|
53
|
+
defaultThinkingOptionId?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface AgentSelectOption {
|
|
56
|
+
id: string;
|
|
57
|
+
label: string;
|
|
58
|
+
description?: string;
|
|
59
|
+
isDefault?: boolean;
|
|
60
|
+
metadata?: AgentMetadata;
|
|
61
|
+
}
|
|
62
|
+
export declare function normalizeAgentModelDefinition(model: AgentModelDefinition): AgentModelDefinition;
|
|
63
|
+
export interface ProviderSnapshotEntry {
|
|
64
|
+
provider: AgentProvider;
|
|
65
|
+
status: ProviderStatus;
|
|
66
|
+
enabled: boolean;
|
|
67
|
+
error?: string;
|
|
68
|
+
models?: AgentModelDefinition[];
|
|
69
|
+
modes?: AgentMode[];
|
|
70
|
+
fetchedAt?: string;
|
|
71
|
+
label?: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
defaultModeId?: string | null;
|
|
74
|
+
}
|
|
75
|
+
export interface AgentFeatureToggle {
|
|
76
|
+
type: "toggle";
|
|
77
|
+
id: string;
|
|
78
|
+
label: string;
|
|
79
|
+
description?: string;
|
|
80
|
+
tooltip?: string;
|
|
81
|
+
icon?: string;
|
|
82
|
+
value: boolean;
|
|
83
|
+
}
|
|
84
|
+
export interface AgentFeatureSelect {
|
|
85
|
+
type: "select";
|
|
86
|
+
id: string;
|
|
87
|
+
label: string;
|
|
88
|
+
description?: string;
|
|
89
|
+
tooltip?: string;
|
|
90
|
+
icon?: string;
|
|
91
|
+
value: string | null;
|
|
92
|
+
options: AgentSelectOption[];
|
|
93
|
+
}
|
|
94
|
+
export type AgentFeature = AgentFeatureToggle | AgentFeatureSelect;
|
|
95
|
+
export interface AgentCapabilityFlags {
|
|
96
|
+
supportsStreaming: boolean;
|
|
97
|
+
supportsSessionPersistence: boolean;
|
|
98
|
+
supportsDynamicModes: boolean;
|
|
99
|
+
supportsMcpServers: boolean;
|
|
100
|
+
supportsReasoningStream: boolean;
|
|
101
|
+
supportsToolInvocations: boolean;
|
|
102
|
+
supportsRewindConversation?: boolean;
|
|
103
|
+
supportsRewindFiles?: boolean;
|
|
104
|
+
supportsRewindBoth?: boolean;
|
|
105
|
+
}
|
|
106
|
+
export interface AgentPersistenceHandle {
|
|
107
|
+
provider: AgentProvider;
|
|
108
|
+
sessionId: string;
|
|
109
|
+
/** Provider specific handle (Codex thread id, Claude resume token, etc). */
|
|
110
|
+
nativeHandle?: string;
|
|
111
|
+
metadata?: AgentMetadata;
|
|
112
|
+
}
|
|
113
|
+
export type AgentPromptContentBlock = {
|
|
114
|
+
type: "text";
|
|
115
|
+
text: string;
|
|
116
|
+
} | {
|
|
117
|
+
type: "image";
|
|
118
|
+
data: string;
|
|
119
|
+
mimeType: string;
|
|
120
|
+
} | AgentAttachment;
|
|
121
|
+
export type AgentPromptInput = string | AgentPromptContentBlock[];
|
|
122
|
+
export interface AgentRunOptions {
|
|
123
|
+
outputSchema?: unknown;
|
|
124
|
+
resumeFrom?: AgentPersistenceHandle;
|
|
125
|
+
maxThinkingTokens?: number;
|
|
126
|
+
}
|
|
127
|
+
export interface AgentUsage {
|
|
128
|
+
inputTokens?: number;
|
|
129
|
+
cachedInputTokens?: number;
|
|
130
|
+
outputTokens?: number;
|
|
131
|
+
totalCostUsd?: number;
|
|
132
|
+
contextWindowMaxTokens?: number;
|
|
133
|
+
contextWindowUsedTokens?: number;
|
|
134
|
+
}
|
|
135
|
+
export declare const TOOL_CALL_ICON_NAMES: readonly ["wrench", "square_terminal", "eye", "pencil", "search", "bot", "sparkles", "brain", "mic_vocal"];
|
|
136
|
+
export type ToolCallIconName = (typeof TOOL_CALL_ICON_NAMES)[number];
|
|
137
|
+
export type ToolCallDetail = {
|
|
138
|
+
type: "shell";
|
|
139
|
+
command: string;
|
|
140
|
+
cwd?: string;
|
|
141
|
+
output?: string;
|
|
142
|
+
exitCode?: number | null;
|
|
143
|
+
} | {
|
|
144
|
+
type: "read";
|
|
145
|
+
filePath: string;
|
|
146
|
+
content?: string;
|
|
147
|
+
offset?: number;
|
|
148
|
+
limit?: number;
|
|
149
|
+
} | {
|
|
150
|
+
type: "edit";
|
|
151
|
+
filePath: string;
|
|
152
|
+
oldString?: string;
|
|
153
|
+
newString?: string;
|
|
154
|
+
unifiedDiff?: string;
|
|
155
|
+
} | {
|
|
156
|
+
type: "write";
|
|
157
|
+
filePath: string;
|
|
158
|
+
content?: string;
|
|
159
|
+
} | {
|
|
160
|
+
type: "search";
|
|
161
|
+
query: string;
|
|
162
|
+
toolName?: "search" | "grep" | "glob" | "web_search";
|
|
163
|
+
content?: string;
|
|
164
|
+
filePaths?: string[];
|
|
165
|
+
webResults?: Array<{
|
|
166
|
+
title: string;
|
|
167
|
+
url: string;
|
|
168
|
+
}>;
|
|
169
|
+
annotations?: string[];
|
|
170
|
+
numFiles?: number;
|
|
171
|
+
numMatches?: number;
|
|
172
|
+
durationMs?: number;
|
|
173
|
+
durationSeconds?: number;
|
|
174
|
+
truncated?: boolean;
|
|
175
|
+
mode?: "content" | "files_with_matches" | "count";
|
|
176
|
+
} | {
|
|
177
|
+
type: "fetch";
|
|
178
|
+
url: string;
|
|
179
|
+
prompt?: string;
|
|
180
|
+
result?: string;
|
|
181
|
+
code?: number;
|
|
182
|
+
codeText?: string;
|
|
183
|
+
bytes?: number;
|
|
184
|
+
durationMs?: number;
|
|
185
|
+
} | {
|
|
186
|
+
type: "worktree_setup";
|
|
187
|
+
worktreePath: string;
|
|
188
|
+
branchName: string;
|
|
189
|
+
log: string;
|
|
190
|
+
commands: Array<{
|
|
191
|
+
index: number;
|
|
192
|
+
command: string;
|
|
193
|
+
cwd: string;
|
|
194
|
+
log: string;
|
|
195
|
+
status: "running" | "completed" | "failed";
|
|
196
|
+
exitCode: number | null;
|
|
197
|
+
durationMs?: number;
|
|
198
|
+
}>;
|
|
199
|
+
truncated?: boolean;
|
|
200
|
+
} | {
|
|
201
|
+
type: "sub_agent";
|
|
202
|
+
subAgentType?: string;
|
|
203
|
+
description?: string;
|
|
204
|
+
childSessionId?: string;
|
|
205
|
+
log: string;
|
|
206
|
+
actions?: Array<{
|
|
207
|
+
index: number;
|
|
208
|
+
toolName: string;
|
|
209
|
+
summary?: string;
|
|
210
|
+
}>;
|
|
211
|
+
} | {
|
|
212
|
+
type: "plain_text";
|
|
213
|
+
label?: string;
|
|
214
|
+
text?: string;
|
|
215
|
+
icon?: ToolCallIconName;
|
|
216
|
+
} | {
|
|
217
|
+
type: "plan";
|
|
218
|
+
text: string;
|
|
219
|
+
} | {
|
|
220
|
+
type: "unknown";
|
|
221
|
+
input: unknown;
|
|
222
|
+
output: unknown;
|
|
223
|
+
};
|
|
224
|
+
interface ToolCallBase {
|
|
225
|
+
[key: string]: unknown;
|
|
226
|
+
type: "tool_call";
|
|
227
|
+
callId: string;
|
|
228
|
+
name: string;
|
|
229
|
+
detail: ToolCallDetail;
|
|
230
|
+
metadata?: Record<string, unknown>;
|
|
231
|
+
}
|
|
232
|
+
type ToolCallRunningTimelineItem = ToolCallBase & {
|
|
233
|
+
status: "running";
|
|
234
|
+
error: null;
|
|
235
|
+
};
|
|
236
|
+
type ToolCallCompletedTimelineItem = ToolCallBase & {
|
|
237
|
+
status: "completed";
|
|
238
|
+
error: null;
|
|
239
|
+
};
|
|
240
|
+
type ToolCallFailedTimelineItem = ToolCallBase & {
|
|
241
|
+
status: "failed";
|
|
242
|
+
error: unknown;
|
|
243
|
+
};
|
|
244
|
+
type ToolCallCanceledTimelineItem = ToolCallBase & {
|
|
245
|
+
status: "canceled";
|
|
246
|
+
error: null;
|
|
247
|
+
};
|
|
248
|
+
export type ToolCallTimelineItem = ToolCallRunningTimelineItem | ToolCallCompletedTimelineItem | ToolCallFailedTimelineItem | ToolCallCanceledTimelineItem;
|
|
249
|
+
export interface CompactionTimelineItem {
|
|
250
|
+
[key: string]: unknown;
|
|
251
|
+
type: "compaction";
|
|
252
|
+
status: "loading" | "completed";
|
|
253
|
+
trigger?: "auto" | "manual";
|
|
254
|
+
preTokens?: number;
|
|
255
|
+
}
|
|
256
|
+
export type AgentTimelineItem = {
|
|
257
|
+
type: "user_message";
|
|
258
|
+
text: string;
|
|
259
|
+
messageId?: string;
|
|
260
|
+
} | {
|
|
261
|
+
type: "assistant_message";
|
|
262
|
+
text: string;
|
|
263
|
+
messageId?: string;
|
|
264
|
+
} | {
|
|
265
|
+
type: "reasoning";
|
|
266
|
+
text: string;
|
|
267
|
+
} | ToolCallTimelineItem | {
|
|
268
|
+
type: "todo";
|
|
269
|
+
items: {
|
|
270
|
+
text: string;
|
|
271
|
+
completed: boolean;
|
|
272
|
+
}[];
|
|
273
|
+
} | {
|
|
274
|
+
type: "error";
|
|
275
|
+
message: string;
|
|
276
|
+
} | CompactionTimelineItem;
|
|
277
|
+
export type AgentStreamEvent = {
|
|
278
|
+
type: "thread_started";
|
|
279
|
+
sessionId: string;
|
|
280
|
+
provider: AgentProvider;
|
|
281
|
+
} | {
|
|
282
|
+
type: "turn_started";
|
|
283
|
+
provider: AgentProvider;
|
|
284
|
+
turnId?: string;
|
|
285
|
+
} | {
|
|
286
|
+
type: "turn_completed";
|
|
287
|
+
provider: AgentProvider;
|
|
288
|
+
usage?: AgentUsage;
|
|
289
|
+
turnId?: string;
|
|
290
|
+
} | {
|
|
291
|
+
type: "usage_updated";
|
|
292
|
+
provider: AgentProvider;
|
|
293
|
+
usage: AgentUsage;
|
|
294
|
+
turnId?: string;
|
|
295
|
+
} | {
|
|
296
|
+
type: "mode_changed";
|
|
297
|
+
provider: AgentProvider;
|
|
298
|
+
currentModeId: string | null;
|
|
299
|
+
availableModes: AgentMode[];
|
|
300
|
+
} | {
|
|
301
|
+
type: "model_changed";
|
|
302
|
+
provider: AgentProvider;
|
|
303
|
+
runtimeInfo: AgentRuntimeInfo;
|
|
304
|
+
} | {
|
|
305
|
+
type: "thinking_option_changed";
|
|
306
|
+
provider: AgentProvider;
|
|
307
|
+
thinkingOptionId: string | null;
|
|
308
|
+
} | {
|
|
309
|
+
type: "turn_failed";
|
|
310
|
+
provider: AgentProvider;
|
|
311
|
+
error: string;
|
|
312
|
+
code?: string;
|
|
313
|
+
diagnostic?: string;
|
|
314
|
+
turnId?: string;
|
|
315
|
+
} | {
|
|
316
|
+
type: "turn_canceled";
|
|
317
|
+
provider: AgentProvider;
|
|
318
|
+
reason: string;
|
|
319
|
+
turnId?: string;
|
|
320
|
+
} | {
|
|
321
|
+
type: "timeline";
|
|
322
|
+
item: AgentTimelineItem;
|
|
323
|
+
provider: AgentProvider;
|
|
324
|
+
turnId?: string;
|
|
325
|
+
timestamp?: string;
|
|
326
|
+
} | {
|
|
327
|
+
type: "permission_requested";
|
|
328
|
+
provider: AgentProvider;
|
|
329
|
+
request: AgentPermissionRequest;
|
|
330
|
+
turnId?: string;
|
|
331
|
+
} | {
|
|
332
|
+
type: "permission_resolved";
|
|
333
|
+
provider: AgentProvider;
|
|
334
|
+
requestId: string;
|
|
335
|
+
resolution: AgentPermissionResponse;
|
|
336
|
+
turnId?: string;
|
|
337
|
+
} | {
|
|
338
|
+
type: "attention_required";
|
|
339
|
+
provider: AgentProvider;
|
|
340
|
+
reason: "finished" | "error" | "permission";
|
|
341
|
+
timestamp: string;
|
|
342
|
+
};
|
|
343
|
+
export declare function getAgentStreamEventTurnId(event: AgentStreamEvent): string | undefined;
|
|
344
|
+
export type AgentPermissionRequestKind = "tool" | "plan" | "question" | "mode" | "other";
|
|
345
|
+
export type AgentPermissionUpdate = AgentMetadata;
|
|
346
|
+
export interface AgentPermissionAction {
|
|
347
|
+
id: string;
|
|
348
|
+
label: string;
|
|
349
|
+
behavior: "allow" | "deny";
|
|
350
|
+
variant?: "primary" | "secondary" | "danger";
|
|
351
|
+
intent?: "implement" | "implement_resume" | "dismiss";
|
|
352
|
+
}
|
|
353
|
+
export interface AgentPermissionRequest {
|
|
354
|
+
id: string;
|
|
355
|
+
provider: AgentProvider;
|
|
356
|
+
name: string;
|
|
357
|
+
kind: AgentPermissionRequestKind;
|
|
358
|
+
title?: string;
|
|
359
|
+
description?: string;
|
|
360
|
+
input?: AgentMetadata;
|
|
361
|
+
detail?: ToolCallDetail;
|
|
362
|
+
suggestions?: AgentPermissionUpdate[];
|
|
363
|
+
actions?: AgentPermissionAction[];
|
|
364
|
+
metadata?: AgentMetadata;
|
|
365
|
+
}
|
|
366
|
+
export type AgentPermissionResponse = {
|
|
367
|
+
behavior: "allow";
|
|
368
|
+
selectedActionId?: string;
|
|
369
|
+
updatedInput?: AgentMetadata;
|
|
370
|
+
updatedPermissions?: AgentPermissionUpdate[];
|
|
371
|
+
} | {
|
|
372
|
+
behavior: "deny";
|
|
373
|
+
selectedActionId?: string;
|
|
374
|
+
message?: string;
|
|
375
|
+
interrupt?: boolean;
|
|
376
|
+
};
|
|
377
|
+
export interface AgentRunResult {
|
|
378
|
+
sessionId: string;
|
|
379
|
+
finalText: string;
|
|
380
|
+
usage?: AgentUsage;
|
|
381
|
+
timeline: AgentTimelineItem[];
|
|
382
|
+
canceled?: boolean;
|
|
383
|
+
}
|
|
384
|
+
export interface AgentSessionConfig {
|
|
385
|
+
provider: AgentProvider;
|
|
386
|
+
cwd: string;
|
|
387
|
+
/**
|
|
388
|
+
* Provider-agnostic system/developer instruction string.
|
|
389
|
+
* Mapped by each provider to its native instruction field.
|
|
390
|
+
*/
|
|
391
|
+
systemPrompt?: string;
|
|
392
|
+
modeId?: string;
|
|
393
|
+
model?: string;
|
|
394
|
+
thinkingOptionId?: string;
|
|
395
|
+
featureValues?: Record<string, unknown>;
|
|
396
|
+
title?: string | null;
|
|
397
|
+
approvalPolicy?: string;
|
|
398
|
+
sandboxMode?: string;
|
|
399
|
+
networkAccess?: boolean;
|
|
400
|
+
webSearch?: boolean;
|
|
401
|
+
extra?: {
|
|
402
|
+
codex?: AgentMetadata;
|
|
403
|
+
claude?: AgentMetadata;
|
|
404
|
+
};
|
|
405
|
+
mcpServers?: Record<string, McpServerConfig>;
|
|
406
|
+
/**
|
|
407
|
+
* Internal agents are hidden from listings and don't trigger notifications.
|
|
408
|
+
* They are used for ephemeral system tasks like commit/PR generation.
|
|
409
|
+
*/
|
|
410
|
+
internal?: boolean;
|
|
411
|
+
}
|
|
412
|
+
export interface AgentRuntimeInfo {
|
|
413
|
+
provider: AgentProvider;
|
|
414
|
+
sessionId: string | null;
|
|
415
|
+
model?: string | null;
|
|
416
|
+
thinkingOptionId?: string | null;
|
|
417
|
+
modeId?: string | null;
|
|
418
|
+
extra?: AgentMetadata;
|
|
419
|
+
}
|
|
420
|
+
export {};
|
|
421
|
+
//# sourceMappingURL=agent-types.d.ts.map
|