@yinaoxiong/paseo-plugin 0.18.2-personal.2 → 0.19.2-personal.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/build-info.json +9 -9
- package/dist/client/contracts.d.ts +28 -0
- package/dist/client/host.d.ts +1 -0
- package/dist/client/host.js +1 -0
- package/dist/client/index.d.ts +3 -1
- package/dist/client/index.js +1 -0
- package/dist/client/runtime-context-bridge.js +5 -2
- package/dist/client/ui.d.ts +4 -1
- package/dist/client/workspace-layout.d.ts +161 -0
- package/dist/client/workspace-layout.js +32 -0
- package/dist/server/acp-internal/connection.js +126 -57
- package/dist/server/acp.d.ts +26 -1
- package/dist/server/lifecycle.d.ts +4 -0
- package/dist/server/provider.d.ts +7 -1
- package/dist/server/usage.d.ts +12 -0
- package/package.json +8 -8
package/build-info.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"upstreamVersion": "0.
|
|
4
|
-
"revision":
|
|
5
|
-
"version": "0.
|
|
6
|
-
"appVersion": "0.
|
|
7
|
-
"androidVersionCode":
|
|
8
|
-
"iosBuildNumber": "
|
|
9
|
-
"sourceSha": "
|
|
10
|
-
"lockSha256": "
|
|
3
|
+
"upstreamVersion": "0.19.2",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"version": "0.19.2-personal.1",
|
|
6
|
+
"appVersion": "0.19.2",
|
|
7
|
+
"androidVersionCode": 19002001,
|
|
8
|
+
"iosBuildNumber": "19002001",
|
|
9
|
+
"sourceSha": "9cbe5ba2dd85ec96b031653dfa0bc75cb4c535d7",
|
|
10
|
+
"lockSha256": "09ab224c826745f06f8444ff5c7a842720c26b75bcd609f7112da1b7365f5cd2",
|
|
11
11
|
"nodeVersion": "v24.21.0",
|
|
12
12
|
"npmVersion": "11.19.0",
|
|
13
13
|
"platform": "linux",
|
|
14
14
|
"arch": "x64",
|
|
15
15
|
"signature": "unsigned",
|
|
16
16
|
"packageName": "@yinaoxiong/paseo-plugin",
|
|
17
|
-
"desktopVersion": "0.
|
|
17
|
+
"desktopVersion": "0.19.2+personal.1"
|
|
18
18
|
}
|
|
@@ -5,6 +5,7 @@ import type { PluginPaseoApi } from "./reference-api.js";
|
|
|
5
5
|
import type { AgentTimelineItem, JsonValue } from "@getpaseo/protocol/agent-types";
|
|
6
6
|
import type { ZodType, input as ZodInput, output as ZodOutput } from "zod";
|
|
7
7
|
import type { PluginFile } from "./file.js";
|
|
8
|
+
import type { PluginWorkspaceLayout } from "./workspace-layout.js";
|
|
8
9
|
import type { PluginComposer, PluginComposerItemContribution, PluginComposerSelector } from "./composer.js";
|
|
9
10
|
import type { PluginNewWorkspaceItemContribution } from "./new-workspace.js";
|
|
10
11
|
import type { PluginRpcContract, PluginSubscribeOptions, PluginSubscriptionContract, PluginSubscriptionHandle, PluginWireInput } from "../rpc.js";
|
|
@@ -123,6 +124,13 @@ export interface PluginWorkspaceRowBadgeItemContribution<Text extends PluginText
|
|
|
123
124
|
* and color; buttons widen the props with their host and target context.
|
|
124
125
|
*/
|
|
125
126
|
export type PluginIcon<Props extends PluginIconProps = PluginIconProps> = PluginSerializableIcon | ComponentType<Props>;
|
|
127
|
+
export interface PluginProviderIconProps {
|
|
128
|
+
provider: string;
|
|
129
|
+
/** Target host ID. Defaults to the current plugin installation's host. */
|
|
130
|
+
hostId?: string;
|
|
131
|
+
size?: number;
|
|
132
|
+
color?: string;
|
|
133
|
+
}
|
|
126
134
|
export type PluginPanelLocation = "workspace" | "explorer";
|
|
127
135
|
export interface PluginOpenPanelOptions {
|
|
128
136
|
location?: PluginPanelLocation;
|
|
@@ -136,6 +144,8 @@ interface PluginWorkspacePanelBase<Text extends PluginText = string> {
|
|
|
136
144
|
locations?: readonly PluginPanelLocation[];
|
|
137
145
|
}
|
|
138
146
|
export interface PluginTab {
|
|
147
|
+
/** This tab in its workspace's layout, as `useWorkspaceLayout` reads and arranges it. */
|
|
148
|
+
readonly id: string;
|
|
139
149
|
/** Shows the tab's unsaved dot and asks before closing. */
|
|
140
150
|
setModified(modified: boolean): void;
|
|
141
151
|
/** Opaque persisted JSON. Undefined until written; the panel validates it. */
|
|
@@ -221,6 +231,15 @@ export interface PluginClientContext extends PluginCommandCapabilities, PluginCl
|
|
|
221
231
|
addTimelineTransformer<ItemType extends AgentTimelineItem["type"]>(contribution: PluginTimelineTransformerContribution<ItemType>): PluginCleanup;
|
|
222
232
|
addTimelineRenderer<Schema extends ZodType>(contribution: PluginTimelineRendererContribution<Schema>): PluginCleanup;
|
|
223
233
|
onNotificationOpen(handler: PluginNotificationOpenHandler): PluginCleanup;
|
|
234
|
+
/**
|
|
235
|
+
* A handle on a workspace's panes and tabs on this client, for any workspace of the plugin's
|
|
236
|
+
* host. Components use `useWorkspaceLayout`, which returns the same handle.
|
|
237
|
+
*/
|
|
238
|
+
workspaceLayout(workspaceId: string): PluginWorkspaceLayout;
|
|
239
|
+
/**
|
|
240
|
+
* @deprecated Use `workspaceLayout(workspaceId).open({ panelId }, { placement })`, then
|
|
241
|
+
* `navigation.openWorkspace` when the user is somewhere else.
|
|
242
|
+
*/
|
|
224
243
|
openPanel(id: string, options: PluginClientOpenPanelOptions): void;
|
|
225
244
|
/**
|
|
226
245
|
* Subscribes to a plugin subscription on this client's host. Paseo re-subscribes after a
|
|
@@ -312,12 +331,21 @@ export interface PluginGlobalCommandContext extends PluginCommandCapabilities {
|
|
|
312
331
|
export interface PluginWorkspaceCommandContext extends PluginCommandCapabilities {
|
|
313
332
|
context: "workspace";
|
|
314
333
|
workspace: PluginWorkspaceSnapshot;
|
|
334
|
+
/** The panes and tabs of `workspace`. */
|
|
335
|
+
workspaceLayout: PluginWorkspaceLayout;
|
|
336
|
+
/** @deprecated Use `workspaceLayout.open({ panelId }, { placement })`. */
|
|
315
337
|
openPanel(id: string, options?: PluginOpenPanelOptions): void;
|
|
316
338
|
}
|
|
317
339
|
export interface PluginAgentCommandContext extends PluginCommandCapabilities {
|
|
318
340
|
context: "agent";
|
|
319
341
|
workspace: PluginWorkspaceSnapshot;
|
|
320
342
|
agent: PluginAgentSnapshot;
|
|
343
|
+
/** The panes and tabs of `workspace`. */
|
|
344
|
+
workspaceLayout: PluginWorkspaceLayout;
|
|
345
|
+
/**
|
|
346
|
+
* @deprecated Use `workspaceLayout.open({ panelId }, { placement })`. An agent panel takes
|
|
347
|
+
* `params: { agentId: agent.id }`.
|
|
348
|
+
*/
|
|
321
349
|
openPanel(id: string, options?: PluginOpenPanelOptions): void;
|
|
322
350
|
}
|
|
323
351
|
interface PluginCommandCenterItemBase<Text extends PluginText = string> {
|
package/dist/client/host.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { PluginText } from "../text.js";
|
|
|
2
2
|
export { PluginClientStateProvider, usePaseoSelector, type PluginClientStateSource, type PluginClientSnapshot, } from "./client-state.js";
|
|
3
3
|
export { PluginComposerProvider, PluginComposersProvider, type PluginComposersSource, } from "./composer.js";
|
|
4
4
|
export { PluginNewWorkspaceProvider } from "./new-workspace.js";
|
|
5
|
+
export { PluginWorkspaceLayoutProvider, type PluginWorkspaceLayoutSource, } from "./workspace-layout.js";
|
|
5
6
|
export { usePluginRuntimeContextBridge, type PluginRuntimeContextBridge, } from "./runtime-context-bridge.js";
|
|
6
7
|
import type { PluginAttachmentSourceContribution } from "../contracts.js";
|
|
7
8
|
import { PluginRpcProvider } from "./rpc-context.js";
|
package/dist/client/host.js
CHANGED
|
@@ -2,6 +2,7 @@ import { PluginAttachmentSearchPayloadSchema } from "../attachments.js";
|
|
|
2
2
|
export { PluginClientStateProvider, usePaseoSelector, } from "./client-state.js";
|
|
3
3
|
export { PluginComposerProvider, PluginComposersProvider, } from "./composer.js";
|
|
4
4
|
export { PluginNewWorkspaceProvider } from "./new-workspace.js";
|
|
5
|
+
export { PluginWorkspaceLayoutProvider, } from "./workspace-layout.js";
|
|
5
6
|
export { usePluginRuntimeContextBridge, } from "./runtime-context-bridge.js";
|
|
6
7
|
import { PluginRpcProvider } from "./rpc-context.js";
|
|
7
8
|
import { PaseoApiProvider } from "./paseo-context.js";
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { PaseoSideChatActions } from "@getpaseo/client";
|
|
2
|
-
export type { PluginHostProps, PluginHostNavigationActions, PluginTab, PluginPanelProps, PluginWorkspacePanelParams, PluginAgentPanelParams, PluginFilePanelParams, PluginAgentPanelContribution, PluginFilePanelContribution, PluginFilePanelProps, PluginSurfaceProps, PluginScreenProps, PluginPopoverProps, PluginScreenParams, PluginOpenScreenInput, PluginScreenLocation, PluginSidebarItemProps, PluginSidebarViewProps, PluginSidebarViewContribution, PluginSidebarItemContribution, PluginWorkspaceRowBadgeItemProps, PluginWorkspaceRowBadgeItemContribution, PluginIcon, PluginPanelLocation, PluginOpenPanelOptions, PluginWorkspacePanelProps, PluginAgentPanelProps, PluginClientOpenPanelOptions, PluginClientContext, PluginClientContribution, PluginWorkspacePanelContribution, PluginSettingsScreenContribution, PluginSurfaceContribution, PluginScreenContribution, PluginScreenTitle, PluginSidebarContribution, PluginTimelineTransformerContribution, PluginTimelineItemProps, PluginTimelineRendererContribution, PluginCommandCapabilities, PluginGlobalCommandContext, PluginWorkspaceCommandContext, PluginAgentCommandContext, PluginCommandCenterItemContribution, PluginClientSlashCommandContribution, SettingsState, } from "./contracts.js";
|
|
2
|
+
export type { PluginHostProps, PluginHostNavigationActions, PluginTab, PluginPanelProps, PluginWorkspacePanelParams, PluginAgentPanelParams, PluginFilePanelParams, PluginAgentPanelContribution, PluginFilePanelContribution, PluginFilePanelProps, PluginSurfaceProps, PluginScreenProps, PluginPopoverProps, PluginScreenParams, PluginOpenScreenInput, PluginScreenLocation, PluginSidebarItemProps, PluginSidebarViewProps, PluginSidebarViewContribution, PluginSidebarItemContribution, PluginWorkspaceRowBadgeItemProps, PluginWorkspaceRowBadgeItemContribution, PluginIcon, PluginProviderIconProps, PluginPanelLocation, PluginOpenPanelOptions, PluginWorkspacePanelProps, PluginAgentPanelProps, PluginClientOpenPanelOptions, PluginClientContext, PluginClientContribution, PluginWorkspacePanelContribution, PluginSettingsScreenContribution, PluginSurfaceContribution, PluginScreenContribution, PluginScreenTitle, PluginSidebarContribution, PluginTimelineTransformerContribution, PluginTimelineItemProps, PluginTimelineRendererContribution, PluginCommandCapabilities, PluginGlobalCommandContext, PluginWorkspaceCommandContext, PluginAgentCommandContext, PluginCommandCenterItemContribution, PluginClientSlashCommandContribution, SettingsState, } from "./contracts.js";
|
|
3
3
|
export type { PluginNotificationOpenEvent, PluginNotificationOpenContext, PluginNotificationOpenHandler, } from "./notifications.js";
|
|
4
4
|
export type { PluginButton, PluginButtonBehavior, PluginButtonContentProps, PluginButtonContext, PluginButtonIcon, PluginButtonIconProps, PluginButtonMenuEntry, PluginButtonRegistration, PluginComposerPillContribution, PluginHeaderButtonContribution, } from "./buttons.js";
|
|
5
5
|
export type { PluginIconProps, PluginSerializableIcon, PluginSvgIcon } from "../icons.js";
|
|
@@ -33,6 +33,8 @@ export { defineTranslations, useTranslation } from "./translations.js";
|
|
|
33
33
|
export type { PluginI18n } from "./translations.js";
|
|
34
34
|
export type { PluginText, PluginMessage, PluginTranslations } from "../text.js";
|
|
35
35
|
export { useTabState } from "./tab.js";
|
|
36
|
+
export { PluginWorkspaceUnavailableError, useWorkspaceLayout } from "./workspace-layout.js";
|
|
37
|
+
export type { PluginWorkspaceLayout, PluginWorkspaceLayoutEvent, PluginWorkspaceLayoutState, PluginPane, PluginLayoutTab, PluginTabLocation, PluginPanelTarget, PluginPanelTargetParams, PluginTabPlacement, PluginOpenTabOptions, } from "./workspace-layout.js";
|
|
36
38
|
export type { WorkspaceRef, AgentRef, ProjectRef, TerminalRef } from "../refs.js";
|
|
37
39
|
export type { Query, Group, GroupKey } from "./query.js";
|
|
38
40
|
export type { PluginPaseoApi, PluginProjectHandle, PluginTerminalHandle } from "./reference-api.js";
|
package/dist/client/index.js
CHANGED
|
@@ -6,4 +6,5 @@ export { useNewWorkspace } from "./new-workspace.js";
|
|
|
6
6
|
export { useRpc, useSubscription } from "./rpc-context.js";
|
|
7
7
|
export { defineTranslations, useTranslation } from "./translations.js";
|
|
8
8
|
export { useTabState } from "./tab.js";
|
|
9
|
+
export { PluginWorkspaceUnavailableError, useWorkspaceLayout } from "./workspace-layout.js";
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -6,6 +6,7 @@ import { PluginClientStateProvider, usePluginClientStateSource } from "./client-
|
|
|
6
6
|
import { PluginNewWorkspaceProvider, usePluginNewWorkspaceValue } from "./new-workspace.js";
|
|
7
7
|
import { PaseoApiProvider, usePaseoContextValue } from "./paseo-context.js";
|
|
8
8
|
import { PluginRpcProvider, usePluginRpcContextValue } from "./rpc-context.js";
|
|
9
|
+
import { PluginWorkspaceLayoutProvider, usePluginWorkspaceLayoutSource, } from "./workspace-layout.js";
|
|
9
10
|
/** Rebuilds plugin runtime contexts inside React Native portal hosts. */
|
|
10
11
|
export function usePluginRuntimeContextBridge() {
|
|
11
12
|
const translations = usePluginTranslationRuntime();
|
|
@@ -15,6 +16,7 @@ export function usePluginRuntimeContextBridge() {
|
|
|
15
16
|
const composer = usePluginComposerValue();
|
|
16
17
|
const composers = usePluginComposersSource();
|
|
17
18
|
const newWorkspace = usePluginNewWorkspaceValue();
|
|
19
|
+
const workspaceLayouts = usePluginWorkspaceLayoutSource();
|
|
18
20
|
if (!paseo || !rpc) {
|
|
19
21
|
throw new Error("Plugin UI must run inside a contributed plugin surface");
|
|
20
22
|
}
|
|
@@ -22,8 +24,9 @@ export function usePluginRuntimeContextBridge() {
|
|
|
22
24
|
const withState = state ? (_jsx(PluginClientStateProvider, { source: state, children: children })) : (children);
|
|
23
25
|
const withComposers = composers ? (_jsx(PluginComposersProvider, { source: composers, children: withState })) : (withState);
|
|
24
26
|
const withNewWorkspace = newWorkspace ? (_jsx(PluginNewWorkspaceProvider, { newWorkspace: newWorkspace, children: withComposers })) : (withComposers);
|
|
25
|
-
const
|
|
27
|
+
const withWorkspaceLayouts = workspaceLayouts ? (_jsx(PluginWorkspaceLayoutProvider, { source: workspaceLayouts, children: withNewWorkspace })) : (withNewWorkspace);
|
|
28
|
+
const content = composer ? (_jsx(PluginComposerProvider, { composer: composer, children: withWorkspaceLayouts })) : (withWorkspaceLayouts);
|
|
26
29
|
return (_jsx(PaseoApiProvider, { paseo: paseo, children: _jsx(PluginRpcProvider, { invoke: rpc.invoke, subscribe: rpc.subscribe, children: _jsx(PluginTranslationProvider, { runtime: translations, children: content }) }) }));
|
|
27
|
-
}, [composer, composers, newWorkspace, paseo, rpc, state, translations]);
|
|
30
|
+
}, [composer, composers, newWorkspace, paseo, rpc, state, translations, workspaceLayouts]);
|
|
28
31
|
}
|
|
29
32
|
//# sourceMappingURL=runtime-context-bridge.js.map
|
package/dist/client/ui.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComponentType, FunctionComponent, ReactNode, ForwardRefExoticComponent, RefAttributes, ReactElement, Ref } from "react";
|
|
2
2
|
import type { StyleProp, ViewStyle, ScrollView as NativeScrollView, ScrollViewProps, FlatList as NativeFlatList, FlatListProps, TextInput as NativeTextInput, TextInputProps, TextProps } from "react-native";
|
|
3
3
|
import type { PluginIconProps } from "../icons.js";
|
|
4
|
-
import type { PluginIcon } from "./contracts.js";
|
|
4
|
+
import type { PluginIcon, PluginProviderIconProps } from "./contracts.js";
|
|
5
5
|
export interface ModalProps {
|
|
6
6
|
title: string;
|
|
7
7
|
icon?: ReactNode;
|
|
@@ -39,6 +39,8 @@ export type IconProps = Partial<PluginIconProps> & ({
|
|
|
39
39
|
name?: never;
|
|
40
40
|
});
|
|
41
41
|
export declare const Icon: ComponentType<IconProps>;
|
|
42
|
+
/** Renders Paseo's icon for a built-in, catalog, or plugin-provided agent provider. */
|
|
43
|
+
export declare const ProviderIcon: ComponentType<PluginProviderIconProps>;
|
|
42
44
|
export declare const Modal: ModalComponent;
|
|
43
45
|
export declare function useToast(): ToastApi;
|
|
44
46
|
export interface StreamedTextProps extends Omit<TextProps, "children"> {
|
|
@@ -48,6 +50,7 @@ export interface StreamedTextProps extends Omit<TextProps, "children"> {
|
|
|
48
50
|
/** Plain assistant text with host-owned streaming pacing and typography. */
|
|
49
51
|
export declare const StreamedText: ComponentType<StreamedTextProps>;
|
|
50
52
|
export type { PluginIconProps } from "../icons.js";
|
|
53
|
+
export type { PluginProviderIconProps } from "./contracts.js";
|
|
51
54
|
/** React Native scrolling with the host's sheet gestures when rendered inside a sheet. */
|
|
52
55
|
export declare const ScrollView: ForwardRefExoticComponent<ScrollViewProps & RefAttributes<NativeScrollView>>;
|
|
53
56
|
export declare function FlatList<Item>(props: FlatListProps<Item> & {
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { PluginPanelLocation } from "./contracts.js";
|
|
3
|
+
/**
|
|
4
|
+
* A workspace's panes and tabs on this client. One per workspace, stable for the installation.
|
|
5
|
+
* Commands arrange the workspace and never change the screen the user is on. For a workspace that
|
|
6
|
+
* is not on screen, they do not open or close what is.
|
|
7
|
+
*
|
|
8
|
+
* Every command throws `PluginWorkspaceUnavailableError` when the client does not know the
|
|
9
|
+
* workspace on the plugin's host. `get` returns an empty state then.
|
|
10
|
+
*/
|
|
11
|
+
export interface PluginWorkspaceLayout {
|
|
12
|
+
readonly workspaceId: string;
|
|
13
|
+
/**
|
|
14
|
+
* Opens a registered panel. With the default intent, `reveal`, an open tab of the same panel and
|
|
15
|
+
* identity is focused where it is and gets the params again with a new `revision`; `placement`
|
|
16
|
+
* decides where a tab that is not open yet goes.
|
|
17
|
+
*
|
|
18
|
+
* Throws for a panel that is not registered, params the panel rejects, a placement the panel does
|
|
19
|
+
* not allow, or a pane that does not exist.
|
|
20
|
+
*/
|
|
21
|
+
open(target: PluginPanelTarget, options?: PluginOpenTabOptions): PluginTabLocation;
|
|
22
|
+
/** Does nothing when no tab has this id. */
|
|
23
|
+
focus(tabId: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Asks the user first when the tab reports unsaved work, as the close button does. Does nothing
|
|
26
|
+
* when no tab has this id.
|
|
27
|
+
*/
|
|
28
|
+
close(tabId: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* Moves an open tab. Throws for a tab that is not open, a placement the tab's panel does not
|
|
31
|
+
* allow, or a pane that does not exist. Moving a tab into a hidden Explorer leaves it hidden.
|
|
32
|
+
*/
|
|
33
|
+
move(tabId: string, placement: PluginTabPlacement): PluginTabLocation;
|
|
34
|
+
/**
|
|
35
|
+
* Removes an ordinary pane and its tabs, asking what the UI asks first; hides the Explorer. Does
|
|
36
|
+
* nothing when no pane has this id, or when it is the only pane left.
|
|
37
|
+
*/
|
|
38
|
+
closePane(paneId: string): void;
|
|
39
|
+
readonly explorer: {
|
|
40
|
+
show(): void;
|
|
41
|
+
hide(): void;
|
|
42
|
+
toggle(): void;
|
|
43
|
+
};
|
|
44
|
+
/** Returns the same object until the layout changes. */
|
|
45
|
+
get(): PluginWorkspaceLayoutState;
|
|
46
|
+
/**
|
|
47
|
+
* Calls `listener` after the state `get` returns changes. Returns the unsubscribe function.
|
|
48
|
+
* Paseo releases what is left when the plugin stops.
|
|
49
|
+
*/
|
|
50
|
+
subscribe(listener: (event: PluginWorkspaceLayoutEvent) => void): () => void;
|
|
51
|
+
}
|
|
52
|
+
/** What happened to the layout. Switch on `type`; later versions may add fields. */
|
|
53
|
+
export interface PluginWorkspaceLayoutEvent {
|
|
54
|
+
type: "changed";
|
|
55
|
+
}
|
|
56
|
+
export interface PluginWorkspaceLayoutState {
|
|
57
|
+
/** Visible panes in reading order. The Explorer is a pane of kind `explorer` while shown. */
|
|
58
|
+
readonly panes: readonly PluginPane[];
|
|
59
|
+
/** Every open tab, including tabs of a hidden Explorer. */
|
|
60
|
+
readonly tabs: readonly PluginLayoutTab[];
|
|
61
|
+
/** A main pane. The Explorer never takes focus; read its `activeTabId` for what it shows. */
|
|
62
|
+
readonly focusedPaneId: string | null;
|
|
63
|
+
/** The focused pane's active tab, or the tab shown over the workspace on a phone. */
|
|
64
|
+
readonly focusedTabId: string | null;
|
|
65
|
+
/** On a phone, the app's one Explorer overlay, whichever workspace is on screen. */
|
|
66
|
+
readonly explorer: {
|
|
67
|
+
readonly visible: boolean;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export interface PluginPane {
|
|
71
|
+
readonly id: string;
|
|
72
|
+
readonly kind: "main" | "explorer";
|
|
73
|
+
readonly tabIds: readonly string[];
|
|
74
|
+
readonly activeTabId: string | null;
|
|
75
|
+
}
|
|
76
|
+
export interface PluginLayoutTab {
|
|
77
|
+
readonly id: string;
|
|
78
|
+
/** Null for a tab shown over the workspace on a phone. */
|
|
79
|
+
readonly paneId: string | null;
|
|
80
|
+
/** Always qualified: `paseo/file`, `my-plugin/review`. */
|
|
81
|
+
readonly panelId: string;
|
|
82
|
+
/** The params that identify what the tab shows. */
|
|
83
|
+
readonly params: PluginPanelTargetParams;
|
|
84
|
+
/** Where this tab's panel may live, from its registration. */
|
|
85
|
+
readonly locations: readonly PluginPanelLocation[];
|
|
86
|
+
readonly title: string;
|
|
87
|
+
/** The tab reports unsaved work. */
|
|
88
|
+
readonly modified: boolean;
|
|
89
|
+
}
|
|
90
|
+
export interface PluginTabLocation {
|
|
91
|
+
readonly tabId: string;
|
|
92
|
+
/** Null for a tab shown over the workspace on a phone. */
|
|
93
|
+
readonly paneId: string | null;
|
|
94
|
+
}
|
|
95
|
+
/** A registered panel and the params that identify one instance of it. */
|
|
96
|
+
export interface PluginPanelTarget {
|
|
97
|
+
/**
|
|
98
|
+
* `<pluginId>/<panelId>`. `paseo/...` names one of Paseo's own panels. A bare id is the calling
|
|
99
|
+
* plugin's own panel.
|
|
100
|
+
*/
|
|
101
|
+
panelId: string;
|
|
102
|
+
params?: PluginPanelTargetParams;
|
|
103
|
+
}
|
|
104
|
+
export type PluginPanelTargetParams = Readonly<Record<string, string | number>>;
|
|
105
|
+
/**
|
|
106
|
+
* Where a tab goes. On phones and touch tablets, which have no splits, `pane`, `beside` and `split`
|
|
107
|
+
* mean the main pane.
|
|
108
|
+
*/
|
|
109
|
+
export type PluginTabPlacement =
|
|
110
|
+
/** The default. A panel that cannot live in the focused pane goes to its first location. */
|
|
111
|
+
{
|
|
112
|
+
type: "focused";
|
|
113
|
+
} | {
|
|
114
|
+
type: "pane";
|
|
115
|
+
paneId: string;
|
|
116
|
+
}
|
|
117
|
+
/** The side pane, created on first use. */
|
|
118
|
+
| {
|
|
119
|
+
type: "beside";
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* A new pane next to `paneId`. `size` is its share of that pane's space, 0.1 to 0.9. Without it,
|
|
123
|
+
* the split is sized as one made in the UI.
|
|
124
|
+
*/
|
|
125
|
+
| {
|
|
126
|
+
type: "split";
|
|
127
|
+
paneId: string;
|
|
128
|
+
side: "left" | "right" | "top" | "bottom";
|
|
129
|
+
size?: number;
|
|
130
|
+
} | {
|
|
131
|
+
type: "explorer";
|
|
132
|
+
};
|
|
133
|
+
export interface PluginOpenTabOptions {
|
|
134
|
+
placement?: PluginTabPlacement;
|
|
135
|
+
/**
|
|
136
|
+
* `reveal` (default) reuses an open tab and focuses it. `background` does the same without taking
|
|
137
|
+
* focus. `new` always adds a tab; for panels that allow one tab per identity, such as an agent's
|
|
138
|
+
* chat, it behaves as `reveal`.
|
|
139
|
+
*/
|
|
140
|
+
intent?: "reveal" | "background" | "new";
|
|
141
|
+
}
|
|
142
|
+
/** The client does not know this workspace on the plugin's host. */
|
|
143
|
+
export declare class PluginWorkspaceUnavailableError extends Error {
|
|
144
|
+
constructor(message?: string);
|
|
145
|
+
}
|
|
146
|
+
export interface PluginWorkspaceLayoutSource {
|
|
147
|
+
/** The same handle for the same workspace id. */
|
|
148
|
+
layout(workspaceId: string): PluginWorkspaceLayout;
|
|
149
|
+
}
|
|
150
|
+
export declare function usePluginWorkspaceLayoutSource(): PluginWorkspaceLayoutSource | null;
|
|
151
|
+
export declare function PluginWorkspaceLayoutProvider({ children, source, }: {
|
|
152
|
+
children: ReactNode;
|
|
153
|
+
source: PluginWorkspaceLayoutSource;
|
|
154
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
155
|
+
/**
|
|
156
|
+
* The layout of a workspace on the plugin's host. Without a selector, the handle. With one, what it
|
|
157
|
+
* selects from the state, re-rendering when that changes (compared shallowly).
|
|
158
|
+
*/
|
|
159
|
+
export declare function useWorkspaceLayout(workspaceId: string): PluginWorkspaceLayout;
|
|
160
|
+
export declare function useWorkspaceLayout<Selection>(workspaceId: string, selector: (state: PluginWorkspaceLayoutState) => Selection): Selection;
|
|
161
|
+
//# sourceMappingURL=workspace-layout.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector";
|
|
4
|
+
import { shallowEqual } from "./shallow.js";
|
|
5
|
+
/** The client does not know this workspace on the plugin's host. */
|
|
6
|
+
export class PluginWorkspaceUnavailableError extends Error {
|
|
7
|
+
constructor(message = "The workspace is not available on this client.") {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = "PluginWorkspaceUnavailableError";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const PluginWorkspaceLayoutContext = createContext(null);
|
|
13
|
+
export function usePluginWorkspaceLayoutSource() {
|
|
14
|
+
return useContext(PluginWorkspaceLayoutContext);
|
|
15
|
+
}
|
|
16
|
+
export function PluginWorkspaceLayoutProvider({ children, source, }) {
|
|
17
|
+
return (_jsx(PluginWorkspaceLayoutContext.Provider, { value: source, children: children }));
|
|
18
|
+
}
|
|
19
|
+
function subscribeNever() {
|
|
20
|
+
return () => { };
|
|
21
|
+
}
|
|
22
|
+
export function useWorkspaceLayout(workspaceId, selector) {
|
|
23
|
+
const source = usePluginWorkspaceLayoutSource();
|
|
24
|
+
if (!source)
|
|
25
|
+
throw new Error("useWorkspaceLayout must run inside a plugin host");
|
|
26
|
+
const layout = source.layout(workspaceId);
|
|
27
|
+
const read = selector
|
|
28
|
+
? layout.get
|
|
29
|
+
: () => layout;
|
|
30
|
+
return useSyncExternalStoreWithSelector(selector ? layout.subscribe : subscribeNever, read, read, (value) => (selector ? selector(value) : layout), shallowEqual);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=workspace-layout.js.map
|
|
@@ -331,10 +331,11 @@ async function discover(input, state, signal) {
|
|
|
331
331
|
});
|
|
332
332
|
}
|
|
333
333
|
async function listSessions(input, state, signal) {
|
|
334
|
+
const extraScanDeadline = performance.now() + EXTRA_SESSION_SCAN_BUDGET_MS;
|
|
334
335
|
await withRequestRuntime(state, {
|
|
335
336
|
boundarySessionId: "sessions",
|
|
336
337
|
signal,
|
|
337
|
-
run: (runtime) => runtime.listSessions({ cwd: input.cwd, limit: input.limit }),
|
|
338
|
+
run: (runtime) => runtime.listSessions({ cwd: input.cwd, limit: input.limit, extraScanDeadline }),
|
|
338
339
|
publish(selected) {
|
|
339
340
|
state.emit({
|
|
340
341
|
type: "sessions",
|
|
@@ -349,6 +350,9 @@ async function listSessions(input, state, signal) {
|
|
|
349
350
|
},
|
|
350
351
|
});
|
|
351
352
|
}
|
|
353
|
+
function sessionUpdatedAt(session) {
|
|
354
|
+
return Date.parse(session.updatedAt ?? "") || 0;
|
|
355
|
+
}
|
|
352
356
|
function retireSession(state, sessionId, error) {
|
|
353
357
|
if (state.sessions.delete(sessionId)) {
|
|
354
358
|
state.emit({ type: "session.closed", sessionId, ...(error ? { error } : {}) });
|
|
@@ -402,6 +406,7 @@ const DEFAULT_DEFERRED_SETTLE_DELAY_MS = 500;
|
|
|
402
406
|
const DEFAULT_INTERRUPT_GRACE_MS = 10000;
|
|
403
407
|
const DEFAULT_INTERRUPT_KILL_GRACE_MS = 2000;
|
|
404
408
|
const SESSION_SCAN_LIMIT = 500;
|
|
409
|
+
const EXTRA_SESSION_SCAN_BUDGET_MS = 2000;
|
|
405
410
|
// COMPAT(acpAutoAccept): added in v0.17.4, remove after 2027-05-23. The generic ACP adapter saves
|
|
406
411
|
// its Auto Accept toggle as this setting on agents that later moved to a bundled ACP provider.
|
|
407
412
|
const LEGACY_AUTO_ACCEPT_SETTING = "auto_accept";
|
|
@@ -770,21 +775,16 @@ class AcpRuntime {
|
|
|
770
775
|
activePrompt.wirePromptsInFlight -= 1;
|
|
771
776
|
if (activePrompt.retired)
|
|
772
777
|
return undefined;
|
|
773
|
-
if (response.usage)
|
|
774
|
-
this.
|
|
775
|
-
...this.lastUsage,
|
|
776
|
-
inputTokens: response.usage.inputTokens,
|
|
777
|
-
outputTokens: response.usage.outputTokens,
|
|
778
|
-
cachedInputTokens: response.usage.cachedReadTokens ?? undefined,
|
|
779
|
-
};
|
|
780
|
-
this.emit({
|
|
781
|
-
type: "session.usage",
|
|
782
|
-
sessionId: this.options.boundarySessionId,
|
|
783
|
-
turnId,
|
|
784
|
-
usage: this.lastUsage,
|
|
785
|
-
});
|
|
786
|
-
}
|
|
778
|
+
if (response.usage)
|
|
779
|
+
this.recordTurnUsage(turnId, response.usage);
|
|
787
780
|
const state = response.stopReason === "cancelled" ? "canceled" : "completed";
|
|
781
|
+
if (state === "completed") {
|
|
782
|
+
const turnFailure = this.evaluateTurnEnd(activePrompt, response.stopReason);
|
|
783
|
+
if (turnFailure) {
|
|
784
|
+
this.finishPromptTurn(turnId, "failed", turnFailure.error);
|
|
785
|
+
return undefined;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
788
|
if (response.stopReason === "end_turn" && this.shouldDeferTurn(activePrompt)) {
|
|
789
789
|
await this.settleDeferredPrompt(activePrompt);
|
|
790
790
|
return undefined;
|
|
@@ -925,17 +925,29 @@ class AcpRuntime {
|
|
|
925
925
|
this.finalizeRetiredTurn(deferredTurnId, false);
|
|
926
926
|
return { retired: true };
|
|
927
927
|
}
|
|
928
|
-
/**
|
|
929
|
-
async listSessions({ cwd, limit }) {
|
|
928
|
+
/** Selects the most recent sessions from a bounded scan of the provider's pages. */
|
|
929
|
+
async listSessions({ cwd, limit, extraScanDeadline, }) {
|
|
930
930
|
const wanted = Math.min(limit ?? SESSION_SCAN_LIMIT, SESSION_SCAN_LIMIT);
|
|
931
931
|
const sessions = [];
|
|
932
932
|
let cursor;
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
933
|
+
// ACP does not guarantee that sessions arrive in recency order.
|
|
934
|
+
for (let pages = 0; pages < SESSION_SCAN_LIMIT; pages += 1) {
|
|
935
|
+
// Once we have enough rows, pages can improve the order only within the original budget.
|
|
936
|
+
const remainingMs = cursor && sessions.length >= wanted ? extraScanDeadline - performance.now() : undefined;
|
|
937
|
+
if (remainingMs !== undefined && remainingMs <= 0)
|
|
938
|
+
break;
|
|
939
|
+
const request = this.call(this.connection.listSessions({ cwd, cursor }));
|
|
940
|
+
const page = remainingMs === undefined
|
|
941
|
+
? await request
|
|
942
|
+
: await withTimeout(request, remainingMs, "ACP listing scan budget expired").catch(() => undefined);
|
|
943
|
+
if (!page)
|
|
944
|
+
break;
|
|
945
|
+
sessions.push(...page.sessions.slice(0, SESSION_SCAN_LIMIT - sessions.length));
|
|
936
946
|
cursor = page.nextCursor ?? undefined;
|
|
937
|
-
|
|
938
|
-
|
|
947
|
+
if (!cursor || sessions.length === SESSION_SCAN_LIMIT)
|
|
948
|
+
break;
|
|
949
|
+
}
|
|
950
|
+
return sessions.sort((a, b) => sessionUpdatedAt(b) - sessionUpdatedAt(a)).slice(0, wanted);
|
|
939
951
|
}
|
|
940
952
|
async drainNotifications() {
|
|
941
953
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
@@ -1428,6 +1440,7 @@ class AcpRuntime {
|
|
|
1428
1440
|
const id = this.resolveChunkId(update.sessionUpdate, update.messageId);
|
|
1429
1441
|
const text = `${this.messages.get(id) ?? ""}${update.content.text}`;
|
|
1430
1442
|
this.messages.set(id, text);
|
|
1443
|
+
this.recordLastAssistantMessage(update.sessionUpdate === "agent_message_chunk" ? text : undefined);
|
|
1431
1444
|
this.emit({
|
|
1432
1445
|
type: "timeline.item",
|
|
1433
1446
|
sessionId: this.options.boundarySessionId,
|
|
@@ -1444,13 +1457,13 @@ class AcpRuntime {
|
|
|
1444
1457
|
return;
|
|
1445
1458
|
}
|
|
1446
1459
|
if (update.sessionUpdate === "tool_call" || update.sessionUpdate === "tool_call_update") {
|
|
1447
|
-
if (update.sessionUpdate === "tool_call")
|
|
1448
|
-
this.fallbackChunkIds.clear();
|
|
1449
1460
|
this.reduceToolCall(update, wireSeq);
|
|
1450
1461
|
return;
|
|
1451
1462
|
}
|
|
1452
|
-
if (update.sessionUpdate === "plan")
|
|
1463
|
+
if (update.sessionUpdate === "plan") {
|
|
1453
1464
|
this.fallbackChunkIds.clear();
|
|
1465
|
+
this.recordLastAssistantMessage(undefined);
|
|
1466
|
+
}
|
|
1454
1467
|
this.reduceStateUpdate(update, wireSeq);
|
|
1455
1468
|
}
|
|
1456
1469
|
// Historical user messages arrive only as replayed chunks; a live prompt
|
|
@@ -1576,6 +1589,8 @@ class AcpRuntime {
|
|
|
1576
1589
|
const preserve = options?.preserveQualifyingOpenTools === true;
|
|
1577
1590
|
for (const [id, tool] of this.toolCalls) {
|
|
1578
1591
|
const snapshot = tool.presentation;
|
|
1592
|
+
if (!tool.included)
|
|
1593
|
+
continue;
|
|
1579
1594
|
if (snapshot.status !== "pending" && snapshot.status !== "in_progress")
|
|
1580
1595
|
continue;
|
|
1581
1596
|
if (preserve && this.liveOpenToolIds.has(id) && this.toolKeepsTurnOpen(snapshot))
|
|
@@ -1590,6 +1605,7 @@ class AcpRuntime {
|
|
|
1590
1605
|
this.toolCalls.set(id, {
|
|
1591
1606
|
source: { ...tool.source, status: completed.status },
|
|
1592
1607
|
presentation: completed,
|
|
1608
|
+
included: true,
|
|
1593
1609
|
});
|
|
1594
1610
|
this.emit({
|
|
1595
1611
|
type: "timeline.item",
|
|
@@ -1642,7 +1658,13 @@ class AcpRuntime {
|
|
|
1642
1658
|
this.liveOpenToolIds.has(current.id) &&
|
|
1643
1659
|
this.toolKeepsTurnOpen(current);
|
|
1644
1660
|
const { source, presentation: snapshot } = this.presentToolCall(update);
|
|
1645
|
-
|
|
1661
|
+
const included = tool?.included ?? this.includesToolCall(snapshot);
|
|
1662
|
+
this.toolCalls.set(snapshot.id, { source, presentation: snapshot, included });
|
|
1663
|
+
if (!included)
|
|
1664
|
+
return;
|
|
1665
|
+
if (update.sessionUpdate === "tool_call")
|
|
1666
|
+
this.fallbackChunkIds.clear();
|
|
1667
|
+
this.recordLastAssistantMessage(undefined);
|
|
1646
1668
|
const isOpen = snapshot.status === "pending" || snapshot.status === "in_progress";
|
|
1647
1669
|
if (this.replayWindow === null) {
|
|
1648
1670
|
if (isOpen)
|
|
@@ -1658,6 +1680,9 @@ class AcpRuntime {
|
|
|
1658
1680
|
const isOpenQualifying = this.liveOpenToolIds.has(snapshot.id) && this.toolKeepsTurnOpen(snapshot);
|
|
1659
1681
|
this.noteDeferredToolTransition(wasOpenQualifying, isOpenQualifying, isOpen, snapshot, wireSeq);
|
|
1660
1682
|
}
|
|
1683
|
+
includesToolCall(snapshot) {
|
|
1684
|
+
return this.options.options.acpOptions?.includeToolCall?.(snapshot) ?? true;
|
|
1685
|
+
}
|
|
1661
1686
|
vendorNotification(method, params) {
|
|
1662
1687
|
const notification = { method, params: jsonValue(params) };
|
|
1663
1688
|
const context = { sessionId: this.options.boundarySessionId };
|
|
@@ -1833,33 +1858,16 @@ class AcpRuntime {
|
|
|
1833
1858
|
}
|
|
1834
1859
|
this.fallbackChunkIds.clear();
|
|
1835
1860
|
active.lastPromptResponseWireSeq = null;
|
|
1861
|
+
active.lastAssistantMessage = undefined;
|
|
1836
1862
|
if (active.replyState === "settled_with_open_tools")
|
|
1837
1863
|
active.replyState = "idle";
|
|
1838
1864
|
const response = await this.call(this.connection.prompt({ sessionId: this.nativeSessionId, prompt }));
|
|
1839
1865
|
await this.drainNotifications();
|
|
1840
1866
|
if (this.closing || this.activeRetirement || active.deferred !== deferred)
|
|
1841
1867
|
return;
|
|
1842
|
-
if (response.usage)
|
|
1843
|
-
this.
|
|
1844
|
-
|
|
1845
|
-
inputTokens: response.usage.inputTokens,
|
|
1846
|
-
outputTokens: response.usage.outputTokens,
|
|
1847
|
-
cachedInputTokens: response.usage.cachedReadTokens ?? undefined,
|
|
1848
|
-
};
|
|
1849
|
-
this.emit({
|
|
1850
|
-
type: "session.usage",
|
|
1851
|
-
sessionId: this.options.boundarySessionId,
|
|
1852
|
-
turnId: active.turnId,
|
|
1853
|
-
usage: this.lastUsage,
|
|
1854
|
-
});
|
|
1855
|
-
}
|
|
1856
|
-
if (response.stopReason === "cancelled") {
|
|
1857
|
-
this.finishDeferredTurn(active, { type: "cancel" });
|
|
1858
|
-
return;
|
|
1859
|
-
}
|
|
1860
|
-
if (response.stopReason !== "end_turn" && active.wirePromptsInFlight === 1) {
|
|
1861
|
-
this.finishDeferredTurn(active, { type: "complete", terminalizeTools: true });
|
|
1862
|
-
}
|
|
1868
|
+
if (response.usage)
|
|
1869
|
+
this.recordTurnUsage(active.turnId, response.usage);
|
|
1870
|
+
this.settleSteerResponse(active, input.prompt.clientMessageId, response.stopReason);
|
|
1863
1871
|
}
|
|
1864
1872
|
catch (error) {
|
|
1865
1873
|
await this.drainNotifications();
|
|
@@ -1872,16 +1880,7 @@ class AcpRuntime {
|
|
|
1872
1880
|
});
|
|
1873
1881
|
}
|
|
1874
1882
|
else {
|
|
1875
|
-
this.
|
|
1876
|
-
type: "session.notice",
|
|
1877
|
-
sessionId: this.options.boundarySessionId,
|
|
1878
|
-
notice: {
|
|
1879
|
-
id: `acp:steer-error:${input.prompt.clientMessageId}`,
|
|
1880
|
-
severity: "error",
|
|
1881
|
-
title: "Follow-up prompt failed",
|
|
1882
|
-
description: describeError(error),
|
|
1883
|
-
},
|
|
1884
|
-
});
|
|
1883
|
+
this.emitSteerFailure(input.prompt.clientMessageId, describeError(error));
|
|
1885
1884
|
}
|
|
1886
1885
|
}
|
|
1887
1886
|
finally {
|
|
@@ -2015,8 +2014,78 @@ class AcpRuntime {
|
|
|
2015
2014
|
this.hasDeferredBlockers()) {
|
|
2016
2015
|
return;
|
|
2017
2016
|
}
|
|
2017
|
+
const turnFailure = this.evaluateTurnEnd(active, "end_turn");
|
|
2018
|
+
if (turnFailure) {
|
|
2019
|
+
this.finishDeferredTurn(active, { type: "fail", error: turnFailure.error });
|
|
2020
|
+
return;
|
|
2021
|
+
}
|
|
2018
2022
|
this.finishDeferredTurn(active, { type: "complete", terminalizeTools: true });
|
|
2019
2023
|
}
|
|
2024
|
+
recordTurnUsage(turnId, usage) {
|
|
2025
|
+
this.lastUsage = {
|
|
2026
|
+
...this.lastUsage,
|
|
2027
|
+
inputTokens: usage.inputTokens,
|
|
2028
|
+
outputTokens: usage.outputTokens,
|
|
2029
|
+
cachedInputTokens: usage.cachedReadTokens ?? undefined,
|
|
2030
|
+
};
|
|
2031
|
+
this.emit({
|
|
2032
|
+
type: "session.usage",
|
|
2033
|
+
sessionId: this.options.boundarySessionId,
|
|
2034
|
+
turnId,
|
|
2035
|
+
usage: this.lastUsage,
|
|
2036
|
+
});
|
|
2037
|
+
}
|
|
2038
|
+
recordLastAssistantMessage(message) {
|
|
2039
|
+
if (this.replayWindow !== null || !this.activePrompt)
|
|
2040
|
+
return;
|
|
2041
|
+
this.activePrompt.lastAssistantMessage = message;
|
|
2042
|
+
}
|
|
2043
|
+
emitSteerFailure(clientMessageId, description) {
|
|
2044
|
+
this.emit({
|
|
2045
|
+
type: "session.notice",
|
|
2046
|
+
sessionId: this.options.boundarySessionId,
|
|
2047
|
+
notice: {
|
|
2048
|
+
id: `acp:steer-error:${clientMessageId}`,
|
|
2049
|
+
severity: "error",
|
|
2050
|
+
title: "Follow-up prompt failed",
|
|
2051
|
+
description,
|
|
2052
|
+
},
|
|
2053
|
+
});
|
|
2054
|
+
}
|
|
2055
|
+
settleSteerResponse(active, clientMessageId, stopReason) {
|
|
2056
|
+
if (stopReason === "cancelled") {
|
|
2057
|
+
this.finishDeferredTurn(active, { type: "cancel" });
|
|
2058
|
+
return;
|
|
2059
|
+
}
|
|
2060
|
+
const turnFailure = this.evaluateTurnEnd(active, stopReason);
|
|
2061
|
+
if (turnFailure) {
|
|
2062
|
+
// Steers Paseo already accepted are still queued behind this one. Report this reply and
|
|
2063
|
+
// let the last one settle the turn.
|
|
2064
|
+
if (active.wirePromptsInFlight > 1) {
|
|
2065
|
+
this.emitSteerFailure(clientMessageId, turnFailure.error.message);
|
|
2066
|
+
}
|
|
2067
|
+
else {
|
|
2068
|
+
this.finishDeferredTurn(active, { type: "fail", error: turnFailure.error });
|
|
2069
|
+
}
|
|
2070
|
+
return;
|
|
2071
|
+
}
|
|
2072
|
+
if (stopReason !== "end_turn" && active.wirePromptsInFlight === 1) {
|
|
2073
|
+
this.finishDeferredTurn(active, { type: "complete", terminalizeTools: true });
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
evaluateTurnEnd(active, stopReason) {
|
|
2077
|
+
const context = {
|
|
2078
|
+
sessionId: this.options.boundarySessionId,
|
|
2079
|
+
stopReason,
|
|
2080
|
+
lastAssistantMessage: active.lastAssistantMessage,
|
|
2081
|
+
};
|
|
2082
|
+
for (const transformer of this.transformers) {
|
|
2083
|
+
const outcome = transformer.turnEnd?.(context);
|
|
2084
|
+
if (outcome?.state === "failed")
|
|
2085
|
+
return outcome;
|
|
2086
|
+
}
|
|
2087
|
+
return null;
|
|
2088
|
+
}
|
|
2020
2089
|
waitForInitialCommands() {
|
|
2021
2090
|
if (this.receivedInitialCommands)
|
|
2022
2091
|
return Promise.resolve();
|
package/dist/server/acp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JsonValue } from "@getpaseo/protocol/agent-types";
|
|
2
|
-
import type { ProviderCatalog, ProviderCatalogRefreshMode, ProviderCommand, ProviderConfigState, ProviderMode, ProviderNotice, ProviderPersistence, ProviderRegistration, ProviderTimelineItem, ProviderToolCallDetail } from "./provider.js";
|
|
2
|
+
import type { ProviderCatalog, ProviderCatalogRefreshMode, ProviderCommand, ProviderConfigState, ProviderError, ProviderMode, ProviderNotice, ProviderPersistence, ProviderRegistration, ProviderTimelineItem, ProviderToolCallDetail } from "./provider.js";
|
|
3
3
|
interface RunAcpProviderBaseOptions {
|
|
4
4
|
id: string;
|
|
5
5
|
label: string;
|
|
@@ -64,6 +64,13 @@ export interface AcpOptions {
|
|
|
64
64
|
* as ready once this long passes without a history update.
|
|
65
65
|
*/
|
|
66
66
|
loadReplayQuietPeriodMs?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Predicate deciding whether a tool call belongs in the session's timeline, asked once per call
|
|
69
|
+
* on its first update. An excluded call still backs permission requests, but adds no timeline
|
|
70
|
+
* row, does not end the streamed message, does not clear `lastAssistantMessage`, and does not
|
|
71
|
+
* keep the turn open. Defaults to all tool calls.
|
|
72
|
+
*/
|
|
73
|
+
includeToolCall?: (toolCall: AcpToolCallSnapshot) => boolean;
|
|
67
74
|
/**
|
|
68
75
|
* Keep a turn open after `end_turn` while qualifying tool calls are still running,
|
|
69
76
|
* settling once those tools finish and the agent finishes its follow-up reply.
|
|
@@ -86,6 +93,15 @@ export interface AcpOptions {
|
|
|
86
93
|
export interface AcpContext {
|
|
87
94
|
sessionId: string;
|
|
88
95
|
}
|
|
96
|
+
export interface AcpTurnEndContext extends AcpContext {
|
|
97
|
+
/** The ACP `stopReason` of the reply. */
|
|
98
|
+
stopReason: string;
|
|
99
|
+
/**
|
|
100
|
+
* Text of the assistant message that ended the reply. Absent when a tool call, tool call update,
|
|
101
|
+
* thought or plan came after the last message, or when the reply had no message.
|
|
102
|
+
*/
|
|
103
|
+
lastAssistantMessage?: string;
|
|
104
|
+
}
|
|
89
105
|
export interface AcpConfigAccess {
|
|
90
106
|
read(): Promise<Readonly<Record<string, JsonValue>>>;
|
|
91
107
|
set(id: string, value: JsonValue): Promise<void>;
|
|
@@ -171,6 +187,15 @@ export interface AcpTransformer {
|
|
|
171
187
|
/** The call as Paseo last presented it, after every transformer. Absent on its first update. */
|
|
172
188
|
previous?: AcpToolCallSnapshot;
|
|
173
189
|
}): AcpToolCallSnapshot;
|
|
190
|
+
/**
|
|
191
|
+
* Inspects an agent reply that resolved without being canceled, before Paseo accepts it.
|
|
192
|
+
* Return `{ state: "failed", error }` to report it as a failure. It can run more than once
|
|
193
|
+
* in a turn, so keep it free of side effects.
|
|
194
|
+
*/
|
|
195
|
+
turnEnd?(context: AcpTurnEndContext): {
|
|
196
|
+
state: "failed";
|
|
197
|
+
error: ProviderError;
|
|
198
|
+
} | null | undefined;
|
|
174
199
|
}
|
|
175
200
|
export declare function runAcpProvider(options: RunAcpProviderOptions): ProviderRegistration;
|
|
176
201
|
export {};
|
|
@@ -12,6 +12,8 @@ export interface PluginHookWorkspace {
|
|
|
12
12
|
cwd: string;
|
|
13
13
|
name: string | null;
|
|
14
14
|
archivedAt: string | null;
|
|
15
|
+
/** True when the workspace comes from an untrusted source such as a fork change request. */
|
|
16
|
+
readonly untrusted: boolean;
|
|
15
17
|
/** Data plugins stored on the workspace. Paseo never reads a key. */
|
|
16
18
|
metadata: Record<string, JsonValue>;
|
|
17
19
|
}
|
|
@@ -19,6 +21,8 @@ export interface PluginHookWorktree {
|
|
|
19
21
|
path: string;
|
|
20
22
|
branch: string;
|
|
21
23
|
sourceCheckout: string;
|
|
24
|
+
/** True when the worktree comes from an untrusted source such as a fork change request. */
|
|
25
|
+
readonly untrusted: boolean;
|
|
22
26
|
}
|
|
23
27
|
/** Resolved creation options before Git fetches refs or chooses a unique branch name. */
|
|
24
28
|
export type PluginWorktreeCreateRequest = {
|
|
@@ -361,7 +361,13 @@ export type ProviderInput = {
|
|
|
361
361
|
requestId: string;
|
|
362
362
|
sessionId: string;
|
|
363
363
|
changes: ProviderConfigChanges;
|
|
364
|
-
}
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Rewind to the supplied `token`. Completing the request (`request.completed`) guarantees the
|
|
367
|
+
* plugin rewound to that exact point (removing that prompt and everything after it for
|
|
368
|
+
* `"conversation"` and `"both"`).
|
|
369
|
+
*/
|
|
370
|
+
| {
|
|
365
371
|
type: "session.revert";
|
|
366
372
|
requestId: string;
|
|
367
373
|
sessionId: string;
|
package/dist/server/usage.d.ts
CHANGED
|
@@ -61,6 +61,11 @@ export type UsageReport = {
|
|
|
61
61
|
} | {
|
|
62
62
|
status: "error";
|
|
63
63
|
error: string;
|
|
64
|
+
/**
|
|
65
|
+
* ISO time when fetching again can succeed, such as when a vendor's rate limit ends. Paseo
|
|
66
|
+
* does not call `fetch` for this account before then, except when the user selects Refresh.
|
|
67
|
+
*/
|
|
68
|
+
retryAt?: string;
|
|
64
69
|
};
|
|
65
70
|
export interface UsageAccount {
|
|
66
71
|
/** Stable across token rotation; [A-Za-z0-9._-]{1,128}. Never a credential or raw email. */
|
|
@@ -101,6 +106,13 @@ export interface UsageSourceRegistration {
|
|
|
101
106
|
/** Provider IDs associated with this source, used as a hint for default visibility. */
|
|
102
107
|
providers?: readonly string[];
|
|
103
108
|
input: ZodType;
|
|
109
|
+
/**
|
|
110
|
+
* When Paseo calls `fetch`. "automatic" (the default) fetches when a client lists usage and
|
|
111
|
+
* refreshes the result every few minutes. "manual" fetches only when the user selects Refresh:
|
|
112
|
+
* lists show the last result, or a prompt to refresh before the first one, and a failure is
|
|
113
|
+
* not retried. Use it when each fetch costs the user something, such as a vendor's quota check.
|
|
114
|
+
*/
|
|
115
|
+
refresh?: "automatic" | "manual";
|
|
104
116
|
/** Accounts for this scope only. The same key in any scope identifies the same account. */
|
|
105
117
|
discover(scope: UsageScope): Promise<UsageAccount[]>;
|
|
106
118
|
/** Re-reads the login store; never writes it. */
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yinaoxiong/paseo-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.2-personal.1",
|
|
4
4
|
"description": "Paseo plugin SDK package",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/yinaoxiong/paseo-private.git",
|
|
9
|
+
"directory": "packages/plugin"
|
|
10
|
+
},
|
|
6
11
|
"files": [
|
|
7
12
|
"dist",
|
|
8
13
|
"!dist/**/*.map",
|
|
@@ -75,8 +80,8 @@
|
|
|
75
80
|
"@agentclientprotocol/sdk": "1.4.0",
|
|
76
81
|
"i18next": "26.3.0",
|
|
77
82
|
"use-sync-external-store": "1.6.0",
|
|
78
|
-
"@getpaseo/client": "npm:@yinaoxiong/paseo-client@0.
|
|
79
|
-
"@getpaseo/protocol": "npm:@yinaoxiong/paseo-protocol@0.
|
|
83
|
+
"@getpaseo/client": "npm:@yinaoxiong/paseo-client@0.19.2-personal.1",
|
|
84
|
+
"@getpaseo/protocol": "npm:@yinaoxiong/paseo-protocol@0.19.2-personal.1"
|
|
80
85
|
},
|
|
81
86
|
"peerDependencies": {
|
|
82
87
|
"react": ">=19.1.0 <20",
|
|
@@ -88,11 +93,6 @@
|
|
|
88
93
|
"optional": true
|
|
89
94
|
}
|
|
90
95
|
},
|
|
91
|
-
"repository": {
|
|
92
|
-
"type": "git",
|
|
93
|
-
"url": "git+https://github.com/yinaoxiong/paseo-private.git",
|
|
94
|
-
"directory": "packages/plugin"
|
|
95
|
-
},
|
|
96
96
|
"engines": {
|
|
97
97
|
"node": ">=24 <25"
|
|
98
98
|
}
|