@camerontaylor/paseo-plugin 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/dist/attachments.d.ts +26 -0
- package/dist/attachments.js +17 -0
- package/dist/client/buttons.d.ts +64 -0
- package/dist/client/buttons.js +2 -0
- package/dist/client/client-state.d.ts +15 -0
- package/dist/client/client-state.js +32 -0
- package/dist/client/contracts.d.ts +201 -0
- package/dist/client/contracts.js +2 -0
- package/dist/client/host.d.ts +19 -0
- package/dist/client/host.js +12 -0
- package/dist/client/index.d.ts +10 -0
- package/dist/client/index.js +4 -0
- package/dist/client/paseo-context.d.ts +9 -0
- package/dist/client/paseo-context.js +16 -0
- package/dist/client/react-native.d.ts +46 -0
- package/dist/client/react-native.js +2 -0
- package/dist/client/rpc-context.d.ts +13 -0
- package/dist/client/rpc-context.js +18 -0
- package/dist/client/runtime-context-bridge.d.ts +5 -0
- package/dist/client/runtime-context-bridge.js +19 -0
- package/dist/client/shallow.d.ts +2 -0
- package/dist/client/shallow.js +45 -0
- package/dist/client/ui.d.ts +60 -0
- package/dist/client/ui.js +2 -0
- package/dist/contracts.d.ts +90 -0
- package/dist/contracts.js +2 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/rpc.d.ts +17 -0
- package/dist/rpc.js +13 -0
- package/dist/server/acp-internal/connection.d.ts +4 -0
- package/dist/server/acp-internal/connection.js +1187 -0
- package/dist/server/acp.d.ts +112 -0
- package/dist/server/acp.js +21 -0
- package/dist/server/contracts.d.ts +16 -0
- package/dist/server/contracts.js +2 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +2 -0
- package/dist/server/lifecycle.d.ts +92 -0
- package/dist/server/lifecycle.js +2 -0
- package/dist/server/provider.d.ts +610 -0
- package/dist/server/provider.js +811 -0
- package/dist/settings.d.ts +70 -0
- package/dist/settings.js +40 -0
- package/package.json +90 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { JsonValue } from "@camerontaylor/paseo-protocol/agent-types";
|
|
2
|
+
import type { ProviderCatalog, ProviderCommand, ProviderConfigState, ProviderNotice, ProviderRegistration, ProviderTimelineItem } from "./provider.js";
|
|
3
|
+
interface RunAcpProviderBaseOptions {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
acpOptions?: AcpOptions;
|
|
9
|
+
transformers?: readonly AcpTransformer[];
|
|
10
|
+
}
|
|
11
|
+
export type RunAcpProviderOptions = RunAcpProviderBaseOptions & ({
|
|
12
|
+
command: readonly [string, ...string[]];
|
|
13
|
+
connector?: never;
|
|
14
|
+
} | {
|
|
15
|
+
connector: AcpConnector;
|
|
16
|
+
command?: never;
|
|
17
|
+
});
|
|
18
|
+
export type AcpStreamMessage = {
|
|
19
|
+
jsonrpc: "2.0";
|
|
20
|
+
id: string | number | null;
|
|
21
|
+
method: string;
|
|
22
|
+
params?: unknown;
|
|
23
|
+
} | {
|
|
24
|
+
jsonrpc: "2.0";
|
|
25
|
+
method: string;
|
|
26
|
+
params?: unknown;
|
|
27
|
+
} | {
|
|
28
|
+
jsonrpc: "2.0";
|
|
29
|
+
id: string | number | null;
|
|
30
|
+
result: unknown;
|
|
31
|
+
} | {
|
|
32
|
+
jsonrpc: "2.0";
|
|
33
|
+
id: string | number | null;
|
|
34
|
+
error: {
|
|
35
|
+
code: number;
|
|
36
|
+
message: string;
|
|
37
|
+
data?: unknown;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export interface AcpStream {
|
|
41
|
+
writable: WritableStream<AcpStreamMessage>;
|
|
42
|
+
readable: ReadableStream<AcpStreamMessage>;
|
|
43
|
+
}
|
|
44
|
+
export type AcpConnector = () => AcpStream | Promise<AcpStream>;
|
|
45
|
+
export interface AcpOptions {
|
|
46
|
+
protocol?: "auto" | "v1";
|
|
47
|
+
startupTimeoutMs?: number;
|
|
48
|
+
waitForInitialCommands?: boolean;
|
|
49
|
+
initialCommandsTimeoutMs?: number;
|
|
50
|
+
}
|
|
51
|
+
export interface AcpContext {
|
|
52
|
+
sessionId: string;
|
|
53
|
+
}
|
|
54
|
+
export interface AcpConfigAccess {
|
|
55
|
+
read(): Promise<Readonly<Record<string, JsonValue>>>;
|
|
56
|
+
set(id: string, value: JsonValue): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
export interface AcpDiscoveryContext extends AcpContext {
|
|
59
|
+
config: AcpConfigAccess;
|
|
60
|
+
}
|
|
61
|
+
export interface AcpConfigureContext extends AcpContext {
|
|
62
|
+
config: AcpConfigAccess;
|
|
63
|
+
}
|
|
64
|
+
export type AcpConfigChange = {
|
|
65
|
+
target: "model";
|
|
66
|
+
value: string | null;
|
|
67
|
+
} | {
|
|
68
|
+
target: "mode";
|
|
69
|
+
value: string | null;
|
|
70
|
+
} | {
|
|
71
|
+
target: "thinking";
|
|
72
|
+
value: string | null;
|
|
73
|
+
} | {
|
|
74
|
+
target: "setting";
|
|
75
|
+
id: string;
|
|
76
|
+
value: JsonValue;
|
|
77
|
+
};
|
|
78
|
+
export interface AcpToolCallSnapshot {
|
|
79
|
+
id: string;
|
|
80
|
+
name?: string;
|
|
81
|
+
title: string;
|
|
82
|
+
kind?: string;
|
|
83
|
+
status: "pending" | "in_progress" | "completed" | "failed";
|
|
84
|
+
input: JsonValue;
|
|
85
|
+
output: JsonValue;
|
|
86
|
+
locations: readonly string[];
|
|
87
|
+
}
|
|
88
|
+
export type AcpVendorUpdate = {
|
|
89
|
+
type: "commands";
|
|
90
|
+
commands: readonly ProviderCommand[];
|
|
91
|
+
} | {
|
|
92
|
+
type: "config";
|
|
93
|
+
config: ProviderConfigState;
|
|
94
|
+
} | {
|
|
95
|
+
type: "timeline";
|
|
96
|
+
item: ProviderTimelineItem;
|
|
97
|
+
} | {
|
|
98
|
+
type: "notice";
|
|
99
|
+
notice: ProviderNotice;
|
|
100
|
+
};
|
|
101
|
+
export interface AcpTransformer {
|
|
102
|
+
discover?(catalog: ProviderCatalog, context: AcpDiscoveryContext): Promise<ProviderCatalog> | ProviderCatalog;
|
|
103
|
+
configure?(change: AcpConfigChange, context: AcpConfigureContext): Promise<"handled" | "pass">;
|
|
104
|
+
notification?(notification: {
|
|
105
|
+
method: string;
|
|
106
|
+
params: JsonValue;
|
|
107
|
+
}, context: AcpContext): AcpVendorUpdate | readonly AcpVendorUpdate[] | null;
|
|
108
|
+
toolCall?(toolCall: AcpToolCallSnapshot, context: AcpContext): AcpToolCallSnapshot;
|
|
109
|
+
}
|
|
110
|
+
export declare function runAcpProvider(options: RunAcpProviderOptions): ProviderRegistration;
|
|
111
|
+
export {};
|
|
112
|
+
//# sourceMappingURL=acp.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createAcpProviderConnection } from "./acp-internal/connection.js";
|
|
2
|
+
export function runAcpProvider(options) {
|
|
3
|
+
const hasCommand = options.command !== undefined;
|
|
4
|
+
const hasConnector = options.connector !== undefined;
|
|
5
|
+
if (hasCommand === hasConnector) {
|
|
6
|
+
throw new Error("ACP provider requires exactly one command or SDK connector");
|
|
7
|
+
}
|
|
8
|
+
if (options.command && (options.command.length === 0 || options.command[0].trim().length === 0)) {
|
|
9
|
+
throw new Error("ACP provider command must contain an executable");
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
id: options.id,
|
|
13
|
+
label: options.label,
|
|
14
|
+
description: options.description,
|
|
15
|
+
icon: options.icon,
|
|
16
|
+
connect(request) {
|
|
17
|
+
return createAcpProviderConnection(options, request);
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=acp.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PaseoApi } from "@camerontaylor/paseo-client";
|
|
2
|
+
import type { ZodType, input as ZodInput, output as ZodOutput } from "zod";
|
|
3
|
+
import type { PluginRpcContract } from "../rpc.js";
|
|
4
|
+
import type { PluginCleanup } from "../contracts.js";
|
|
5
|
+
import type { ProviderRegistration } from "./provider.js";
|
|
6
|
+
import type { PluginLifecycleRegistration } from "./lifecycle.js";
|
|
7
|
+
export interface PluginHandlerContext {
|
|
8
|
+
paseo: PaseoApi;
|
|
9
|
+
}
|
|
10
|
+
export interface PluginServerContext extends PluginLifecycleRegistration {
|
|
11
|
+
registerSettings<Schema extends ZodType>(definition: import("../settings.js").SettingsDefinition<Schema>): void;
|
|
12
|
+
handle<InputSchema extends ZodType, OutputSchema extends ZodType>(contract: PluginRpcContract<InputSchema, OutputSchema>, handler: (input: ZodOutput<InputSchema>, context: PluginHandlerContext) => ZodInput<OutputSchema> | Promise<ZodInput<OutputSchema>>): void;
|
|
13
|
+
registerProvider(provider: ProviderRegistration): void;
|
|
14
|
+
}
|
|
15
|
+
export type PluginServerContribution = (server: PluginServerContext) => PluginCleanup;
|
|
16
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { PluginHandlerContext, PluginServerContext, PluginServerContribution, } from "./contracts.js";
|
|
2
|
+
export type { PluginHookContext, PluginHookWorkspace, PluginHookAgent, PluginSessionOpenRequest, PluginTurnOutcome, PluginLifecycleEvents, PluginBeforeRequests, PluginLifecycleRegistration, } from "./lifecycle.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { AgentPermissionRequest, AgentPermissionResponse, AgentTimelineItem, AgentSessionConfig } from "@camerontaylor/paseo-protocol/agent-types";
|
|
2
|
+
import type { PaseoApi } from "@camerontaylor/paseo-client";
|
|
3
|
+
import type { WorkspaceCreateRequest } from "@camerontaylor/paseo-protocol/messages";
|
|
4
|
+
export interface PluginHookContext {
|
|
5
|
+
paseo: PaseoApi;
|
|
6
|
+
signal: AbortSignal;
|
|
7
|
+
}
|
|
8
|
+
export interface PluginHookWorkspace {
|
|
9
|
+
id: string;
|
|
10
|
+
projectId: string;
|
|
11
|
+
cwd: string;
|
|
12
|
+
name: string | null;
|
|
13
|
+
archivedAt: string | null;
|
|
14
|
+
}
|
|
15
|
+
export interface PluginHookAgent {
|
|
16
|
+
id: string;
|
|
17
|
+
workspaceId: string | null;
|
|
18
|
+
parentAgentId: string | null;
|
|
19
|
+
provider: string;
|
|
20
|
+
cwd: string;
|
|
21
|
+
title: string | null;
|
|
22
|
+
}
|
|
23
|
+
export interface PluginSessionOpenRequest {
|
|
24
|
+
agentId: string;
|
|
25
|
+
workspaceId: string | null;
|
|
26
|
+
provider: string;
|
|
27
|
+
cwd: string;
|
|
28
|
+
reason: "create" | "resume" | "refresh" | "import";
|
|
29
|
+
purpose: "interactive" | "history";
|
|
30
|
+
env: Record<string, string>;
|
|
31
|
+
}
|
|
32
|
+
export type PluginTurnOutcome = {
|
|
33
|
+
kind: "completed";
|
|
34
|
+
} | {
|
|
35
|
+
kind: "failed";
|
|
36
|
+
error: {
|
|
37
|
+
message: string;
|
|
38
|
+
code?: string;
|
|
39
|
+
};
|
|
40
|
+
} | {
|
|
41
|
+
kind: "canceled";
|
|
42
|
+
reason: string;
|
|
43
|
+
};
|
|
44
|
+
export interface PluginLifecycleEvents {
|
|
45
|
+
"agent.turn_started": {
|
|
46
|
+
agent: PluginHookAgent;
|
|
47
|
+
turnId: string | null;
|
|
48
|
+
};
|
|
49
|
+
"agent.turn_ended": {
|
|
50
|
+
agent: PluginHookAgent;
|
|
51
|
+
turnId: string | null;
|
|
52
|
+
outcome: PluginTurnOutcome;
|
|
53
|
+
timeline: readonly AgentTimelineItem[];
|
|
54
|
+
};
|
|
55
|
+
"agent.permission_requested": {
|
|
56
|
+
agent: PluginHookAgent;
|
|
57
|
+
request: AgentPermissionRequest;
|
|
58
|
+
};
|
|
59
|
+
"agent.permission_resolved": {
|
|
60
|
+
agent: PluginHookAgent;
|
|
61
|
+
requestId: string;
|
|
62
|
+
resolution: AgentPermissionResponse;
|
|
63
|
+
};
|
|
64
|
+
"agent.archived": {
|
|
65
|
+
agent: PluginHookAgent;
|
|
66
|
+
archivedAt: string;
|
|
67
|
+
};
|
|
68
|
+
"agent.created": {
|
|
69
|
+
agent: PluginHookAgent;
|
|
70
|
+
};
|
|
71
|
+
"workspace.created": {
|
|
72
|
+
workspace: PluginHookWorkspace;
|
|
73
|
+
};
|
|
74
|
+
"workspace.archived": {
|
|
75
|
+
workspace: PluginHookWorkspace;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export interface PluginBeforeRequests {
|
|
79
|
+
"agent.create": {
|
|
80
|
+
config: AgentSessionConfig;
|
|
81
|
+
env?: Record<string, string>;
|
|
82
|
+
};
|
|
83
|
+
"agent.session_open": PluginSessionOpenRequest;
|
|
84
|
+
"workspace.create": Omit<WorkspaceCreateRequest, "type" | "requestId">;
|
|
85
|
+
}
|
|
86
|
+
export interface PluginLifecycleRegistration {
|
|
87
|
+
on<Name extends keyof PluginLifecycleEvents>(name: Name, handler: (event: PluginLifecycleEvents[Name], context: PluginHookContext) => void | Promise<void>): () => void;
|
|
88
|
+
before<Name extends keyof PluginBeforeRequests>(name: Name, handler: (input: {
|
|
89
|
+
request: PluginBeforeRequests[Name];
|
|
90
|
+
}, context: PluginHookContext) => PluginBeforeRequests[Name] | void | Promise<PluginBeforeRequests[Name] | void>): () => void;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|