@camerontaylor/paseo-protocol 0.8.0-fork.1
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 +43 -0
- package/dist/agent-attention-notification.js +141 -0
- package/dist/agent-deep-link.d.ts +8 -0
- package/dist/agent-deep-link.js +49 -0
- package/dist/agent-labels.d.ts +10 -0
- package/dist/agent-labels.js +21 -0
- package/dist/agent-lifecycle.d.ts +3 -0
- package/dist/agent-lifecycle.js +8 -0
- package/dist/agent-state-bucket.d.ts +14 -0
- package/dist/agent-state-bucket.js +41 -0
- package/dist/agent-title-limits.d.ts +2 -0
- package/dist/agent-title-limits.js +2 -0
- package/dist/agent-types.d.ts +478 -0
- package/dist/agent-types.js +22 -0
- package/dist/binary-frames/demux.d.ts +11 -0
- package/dist/binary-frames/demux.js +23 -0
- package/dist/binary-frames/file-transfer.d.ts +51 -0
- package/dist/binary-frames/file-transfer.js +108 -0
- package/dist/binary-frames/index.d.ts +4 -0
- package/dist/binary-frames/index.js +4 -0
- package/dist/binary-frames/terminal.d.ts +35 -0
- package/dist/binary-frames/terminal.js +100 -0
- package/dist/branch-slug.d.ts +14 -0
- package/dist/branch-slug.js +49 -0
- package/dist/browser-automation/capabilities.d.ts +7 -0
- package/dist/browser-automation/capabilities.js +31 -0
- package/dist/browser-automation/rpc-schemas.d.ts +1112 -0
- package/dist/browser-automation/rpc-schemas.js +462 -0
- package/dist/chat/rpc-schemas.d.ts +158 -0
- package/dist/chat/rpc-schemas.js +104 -0
- package/dist/chat/types.d.ts +30 -0
- package/dist/chat/types.js +23 -0
- package/dist/check-traits.d.ts +11 -0
- package/dist/check-traits.js +10 -0
- package/dist/client-capabilities.d.ts +20 -0
- package/dist/client-capabilities.js +47 -0
- package/dist/connection-offer.d.ts +36 -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/forge-manifest.d.ts +66 -0
- package/dist/forge-manifest.js +92 -0
- package/dist/generated/validation/ws-outbound.aot.d.ts +2 -0
- package/dist/generated/validation/ws-outbound.aot.js +98097 -0
- package/dist/git-remote.d.ts +33 -0
- package/dist/git-remote.js +94 -0
- package/dist/gitea-status.d.ts +10 -0
- package/dist/gitea-status.js +23 -0
- package/dist/gitlab-pipeline.d.ts +10 -0
- package/dist/gitlab-pipeline.js +17 -0
- package/dist/host-connection-schema.d.ts +11 -0
- package/dist/host-connection-schema.js +9 -0
- package/dist/literal-union.d.ts +2 -0
- package/dist/literal-union.js +2 -0
- package/dist/loop/rpc-schemas.d.ts +636 -0
- package/dist/loop/rpc-schemas.js +164 -0
- package/dist/messages.d.ts +60742 -0
- package/dist/messages.js +6152 -0
- package/dist/paseo-config-schema.d.ts +138 -0
- package/dist/paseo-config-schema.js +98 -0
- package/dist/paseo-tool-call-detail.d.ts +15 -0
- package/dist/paseo-tool-call-detail.js +305 -0
- package/dist/path-utils.d.ts +2 -0
- package/dist/path-utils.js +16 -0
- package/dist/plugin-requirements.d.ts +11 -0
- package/dist/plugin-requirements.js +26 -0
- package/dist/plugin-source-reference.d.ts +7 -0
- package/dist/plugin-source-reference.js +41 -0
- package/dist/provider-config.d.ts +139 -0
- package/dist/provider-config.js +115 -0
- package/dist/provider-icon-names.d.ts +5 -0
- package/dist/provider-icon-names.js +54 -0
- package/dist/provider-manifest.d.ts +37 -0
- package/dist/provider-manifest.js +261 -0
- package/dist/provider-snapshot-codec.d.ts +18 -0
- package/dist/provider-snapshot-codec.js +71 -0
- package/dist/schedule/cadence.d.ts +6 -0
- package/dist/schedule/cadence.js +28 -0
- package/dist/schedule/cron-expression.d.ts +13 -0
- package/dist/schedule/cron-expression.js +97 -0
- package/dist/schedule/rpc-schemas.d.ts +568 -0
- package/dist/schedule/rpc-schemas.js +155 -0
- package/dist/schedule/types.d.ts +201 -0
- package/dist/schedule/types.js +68 -0
- package/dist/search/text-match.d.ts +71 -0
- package/dist/search/text-match.js +291 -0
- package/dist/ssh-transport.d.ts +11 -0
- package/dist/ssh-transport.js +72 -0
- package/dist/terminal-activity.d.ts +21 -0
- package/dist/terminal-activity.js +25 -0
- package/dist/terminal-input-mode.d.ts +30 -0
- package/dist/terminal-input-mode.js +180 -0
- package/dist/terminal-key-input.d.ts +13 -0
- package/dist/terminal-key-input.js +210 -0
- package/dist/terminal-profiles.d.ts +41 -0
- package/dist/terminal-profiles.js +270 -0
- package/dist/terminal-snapshot.d.ts +3 -0
- package/dist/terminal-snapshot.js +184 -0
- package/dist/terminal-stream-protocol.d.ts +2 -0
- package/dist/terminal-stream-protocol.js +2 -0
- package/dist/terminal-subscription-key.d.ts +2 -0
- package/dist/terminal-subscription-key.js +9 -0
- package/dist/timeline-identity.d.ts +3 -0
- package/dist/timeline-identity.js +8 -0
- package/dist/tool-call-display.d.ts +11 -0
- package/dist/tool-call-display.js +136 -0
- package/dist/tool-name-normalization.d.ts +9 -0
- package/dist/tool-name-normalization.js +82 -0
- package/dist/validation/ws-outbound-schema-metadata.d.ts +11418 -0
- package/dist/validation/ws-outbound-schema-metadata.js +3 -0
- package/dist/validation/ws-outbound.d.ts +12 -0
- package/dist/validation/ws-outbound.js +8 -0
- package/dist/workspace-labels.d.ts +9 -0
- package/dist/workspace-labels.js +19 -0
- package/package.json +44 -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,43 @@
|
|
|
1
|
+
export type AgentAttentionReason = "finished" | "error" | "permission";
|
|
2
|
+
export interface AgentAttentionNotificationData {
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
serverId: string;
|
|
5
|
+
workspaceId?: string;
|
|
6
|
+
agentId: string;
|
|
7
|
+
reason: AgentAttentionReason;
|
|
8
|
+
}
|
|
9
|
+
export interface AgentAttentionNotificationPayload {
|
|
10
|
+
title: string;
|
|
11
|
+
body: string;
|
|
12
|
+
data: AgentAttentionNotificationData;
|
|
13
|
+
}
|
|
14
|
+
interface BuildAgentAttentionNotificationPayloadInput {
|
|
15
|
+
reason: AgentAttentionReason;
|
|
16
|
+
serverId: string;
|
|
17
|
+
workspaceId: string;
|
|
18
|
+
agentId: string;
|
|
19
|
+
assistantMessage?: string | null;
|
|
20
|
+
permissionRequest?: NotificationPermissionRequest | null;
|
|
21
|
+
}
|
|
22
|
+
export interface NotificationPermissionRequest {
|
|
23
|
+
id: string;
|
|
24
|
+
provider: string;
|
|
25
|
+
name: string;
|
|
26
|
+
kind: "tool" | "plan" | "question" | "mode" | "other";
|
|
27
|
+
title?: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
input?: Record<string, unknown>;
|
|
30
|
+
metadata?: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
export type AssistantTimelineItem = {
|
|
33
|
+
type: "assistant_message";
|
|
34
|
+
text: string;
|
|
35
|
+
} | {
|
|
36
|
+
type: string;
|
|
37
|
+
text?: string;
|
|
38
|
+
};
|
|
39
|
+
export declare function findLatestAssistantMessageFromTimeline(timeline: readonly AssistantTimelineItem[]): string | null;
|
|
40
|
+
export declare function findLatestPermissionRequest(pendingPermissions: ReadonlyMap<string, NotificationPermissionRequest>): NotificationPermissionRequest | null;
|
|
41
|
+
export declare function buildAgentAttentionNotificationPayload(input: BuildAgentAttentionNotificationPayloadInput): AgentAttentionNotificationPayload;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=agent-attention-notification.d.ts.map
|
|
@@ -0,0 +1,141 @@
|
|
|
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
|
+
workspaceId: input.workspaceId,
|
|
136
|
+
agentId: input.agentId,
|
|
137
|
+
reason: input.reason,
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=agent-attention-notification.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface AgentDeepLinkTarget {
|
|
2
|
+
serverId: string;
|
|
3
|
+
agentId: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function buildAgentDeepLinkRoute(target: AgentDeepLinkTarget): `/h/${string}/agent/${string}`;
|
|
6
|
+
export declare function buildAgentDeepLink(target: AgentDeepLinkTarget): string;
|
|
7
|
+
export declare function parseAgentDeepLink(input: string): AgentDeepLinkTarget | null;
|
|
8
|
+
//# sourceMappingURL=agent-deep-link.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
function normalizeSegment(value) {
|
|
2
|
+
return value.trim();
|
|
3
|
+
}
|
|
4
|
+
function normalizeAgentDeepLinkTarget(target) {
|
|
5
|
+
const serverId = normalizeSegment(target.serverId);
|
|
6
|
+
const agentId = normalizeSegment(target.agentId);
|
|
7
|
+
if (!serverId || !agentId) {
|
|
8
|
+
throw new Error("Agent deep links require a server ID and agent ID.");
|
|
9
|
+
}
|
|
10
|
+
return { serverId, agentId };
|
|
11
|
+
}
|
|
12
|
+
export function buildAgentDeepLinkRoute(target) {
|
|
13
|
+
const { serverId, agentId } = normalizeAgentDeepLinkTarget(target);
|
|
14
|
+
return `/h/${encodeURIComponent(serverId)}/agent/${encodeURIComponent(agentId)}`;
|
|
15
|
+
}
|
|
16
|
+
export function buildAgentDeepLink(target) {
|
|
17
|
+
return `paseo:/${buildAgentDeepLinkRoute(target)}`;
|
|
18
|
+
}
|
|
19
|
+
export function parseAgentDeepLink(input) {
|
|
20
|
+
let url;
|
|
21
|
+
try {
|
|
22
|
+
url = new URL(input);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
if (url.protocol !== "paseo:" ||
|
|
28
|
+
url.hostname !== "h" ||
|
|
29
|
+
url.username ||
|
|
30
|
+
url.password ||
|
|
31
|
+
url.port ||
|
|
32
|
+
url.search ||
|
|
33
|
+
url.hash) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const segments = url.pathname.split("/").filter(Boolean);
|
|
37
|
+
if (segments.length !== 3 || segments[1] !== "agent") {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const serverId = normalizeSegment(decodeURIComponent(segments[0] ?? ""));
|
|
42
|
+
const agentId = normalizeSegment(decodeURIComponent(segments[2] ?? ""));
|
|
43
|
+
return serverId && agentId ? { serverId, agentId } : null;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=agent-deep-link.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const PARENT_AGENT_ID_LABEL = "paseo.parent-agent-id";
|
|
2
|
+
export declare function getOpenAgentTabLabel(clientId: string): string;
|
|
3
|
+
export declare function isOpenAgentTabLabel(label: string): boolean;
|
|
4
|
+
export interface AgentLabelSource {
|
|
5
|
+
labels?: Record<string, unknown> | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function getParentAgentIdFromLabels(labels: Record<string, unknown> | null | undefined): string | null;
|
|
8
|
+
export declare function isDelegatedAgent(agent: AgentLabelSource): boolean;
|
|
9
|
+
export declare function hasOpenAgentTab(labels: Record<string, unknown> | null | undefined): boolean;
|
|
10
|
+
//# sourceMappingURL=agent-labels.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const PARENT_AGENT_ID_LABEL = "paseo.parent-agent-id";
|
|
2
|
+
const OPEN_AGENT_TAB_LABEL_PREFIX = "paseo.open-agent-tab.";
|
|
3
|
+
export function getOpenAgentTabLabel(clientId) {
|
|
4
|
+
return `${OPEN_AGENT_TAB_LABEL_PREFIX}${clientId}`;
|
|
5
|
+
}
|
|
6
|
+
export function isOpenAgentTabLabel(label) {
|
|
7
|
+
return label.startsWith(OPEN_AGENT_TAB_LABEL_PREFIX);
|
|
8
|
+
}
|
|
9
|
+
export function getParentAgentIdFromLabels(labels) {
|
|
10
|
+
const parentAgentId = labels?.[PARENT_AGENT_ID_LABEL];
|
|
11
|
+
return typeof parentAgentId === "string" && parentAgentId.trim().length > 0
|
|
12
|
+
? parentAgentId.trim()
|
|
13
|
+
: null;
|
|
14
|
+
}
|
|
15
|
+
export function isDelegatedAgent(agent) {
|
|
16
|
+
return getParentAgentIdFromLabels(agent.labels) !== null;
|
|
17
|
+
}
|
|
18
|
+
export function hasOpenAgentTab(labels) {
|
|
19
|
+
return Object.entries(labels ?? {}).some(([label, value]) => isOpenAgentTabLabel(label) && value === "true");
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=agent-labels.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AgentLifecycleStatus } from "./agent-lifecycle.js";
|
|
2
|
+
import type { WorkspaceStateBucket } from "./messages.js";
|
|
3
|
+
export type { WorkspaceStateBucket };
|
|
4
|
+
export type AgentAttentionReason = "finished" | "error" | "permission" | null | undefined;
|
|
5
|
+
export interface AgentStateBucketInput {
|
|
6
|
+
status: AgentLifecycleStatus;
|
|
7
|
+
pendingPermissionCount?: number;
|
|
8
|
+
requiresAttention?: boolean;
|
|
9
|
+
attentionReason?: AgentAttentionReason;
|
|
10
|
+
}
|
|
11
|
+
export declare function deriveAgentStateBucket(input: AgentStateBucketInput): WorkspaceStateBucket;
|
|
12
|
+
export declare function getWorkspaceStateBucketPriority(bucket: WorkspaceStateBucket): number;
|
|
13
|
+
export declare function getAgentStatusPriority(input: AgentStateBucketInput): number;
|
|
14
|
+
//# 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
|