opencode-copilot-delegate 0.9.0 → 0.10.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/CHANGELOG.md +12 -0
- package/README.md +14 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14141 -215
- package/dist/runtime/cancel-helper.d.ts +10 -0
- package/dist/runtime/envelope.d.ts +1 -1
- package/dist/runtime/notify.d.ts +2 -1
- package/dist/runtime/rpc-contract.d.ts +39 -0
- package/dist/runtime/rpc-server.d.ts +32 -0
- package/dist/tui/__tests__/confirm-card.test.d.ts +2 -0
- package/dist/tui/__tests__/index.test.d.ts +1 -0
- package/dist/tui/__tests__/modal-list.test.d.ts +1 -0
- package/dist/tui/__tests__/rpc-client.test.d.ts +1 -0
- package/dist/tui/components/confirm-card.d.ts +12 -0
- package/dist/tui/components/modal-list.d.ts +16 -0
- package/dist/tui/components/row.d.ts +6 -0
- package/dist/tui/index.d.ts +7 -0
- package/dist/tui/index.js +14107 -0
- package/dist/tui/rpc-client.d.ts +43 -0
- package/package.json +32 -9
- package/src/tui/.gitkeep +1 -0
- package/src/tui/__tests__/confirm-card.test.tsx +516 -0
- package/src/tui/__tests__/index.test.ts +438 -0
- package/src/tui/__tests__/modal-list.test.tsx +518 -0
- package/src/tui/__tests__/rpc-client.test.ts +507 -0
- package/src/tui/components/confirm-card.tsx +252 -0
- package/src/tui/components/modal-list.tsx +232 -0
- package/src/tui/components/row.tsx +41 -0
- package/src/tui/index.tsx +67 -0
- package/src/tui/rpc-client.ts +379 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type CancelTaskResult = {
|
|
2
|
+
cancelled: boolean;
|
|
3
|
+
error?: string;
|
|
4
|
+
};
|
|
5
|
+
export type CancelTaskRegistry = {
|
|
6
|
+
getTask: (taskId: string) => {
|
|
7
|
+
abortController: AbortController;
|
|
8
|
+
} | undefined;
|
|
9
|
+
};
|
|
10
|
+
export declare function cancelTaskById(taskRegistry: CancelTaskRegistry, taskId: string): CancelTaskResult;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { ParsedEvent } from './jsonl-parser';
|
|
9
9
|
/** Status of a delegated Copilot task. */
|
|
10
|
-
export type TaskStatus = 'running' | 'complete' | 'failed' | 'cancelled';
|
|
10
|
+
export type TaskStatus = 'running' | 'cancelling' | 'complete' | 'failed' | 'cancelled';
|
|
11
11
|
/** Summary of a single tool call made during the Copilot session. */
|
|
12
12
|
export type ToolCallSummary = {
|
|
13
13
|
name: string;
|
package/dist/runtime/notify.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export type NotifyClient = {
|
|
|
27
27
|
};
|
|
28
28
|
}) => Promise<unknown>;
|
|
29
29
|
};
|
|
30
|
-
tui
|
|
30
|
+
tui?: {
|
|
31
31
|
showToast: (opts: {
|
|
32
32
|
body: {
|
|
33
33
|
message: string;
|
|
@@ -60,6 +60,7 @@ export type NotifyTaskInfo = {
|
|
|
60
60
|
export declare function incrementInFlight(parentSessionID: string): void;
|
|
61
61
|
/** Reset all counters (for testing only). */
|
|
62
62
|
export declare function resetInFlightCounters(): void;
|
|
63
|
+
export declare function notifySpawn(client: NotifyClient, taskId: string): Promise<void>;
|
|
63
64
|
/**
|
|
64
65
|
* Notify the parent session that a Copilot delegation has completed.
|
|
65
66
|
*
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const HealthResponseSchema: z.ZodObject<{
|
|
3
|
+
ok: z.ZodLiteral<true>;
|
|
4
|
+
version: z.ZodString;
|
|
5
|
+
}, z.core.$strict>;
|
|
6
|
+
export declare const TasksListResponseSchema: z.ZodObject<{
|
|
7
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
8
|
+
taskId: z.ZodString;
|
|
9
|
+
status: z.ZodEnum<{
|
|
10
|
+
running: "running";
|
|
11
|
+
cancelling: "cancelling";
|
|
12
|
+
complete: "complete";
|
|
13
|
+
failed: "failed";
|
|
14
|
+
cancelled: "cancelled";
|
|
15
|
+
}>;
|
|
16
|
+
agent: z.ZodString;
|
|
17
|
+
model: z.ZodString;
|
|
18
|
+
elapsedMs: z.ZodNumber;
|
|
19
|
+
toolCallCount: z.ZodNumber;
|
|
20
|
+
startedAt: z.ZodNumber;
|
|
21
|
+
}, z.core.$strict>>;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
export declare const TasksCancelRequestSchema: z.ZodObject<{
|
|
24
|
+
taskId: z.ZodString;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
export declare const TasksCancelResponseSchema: z.ZodObject<{
|
|
27
|
+
cancelled: z.ZodBoolean;
|
|
28
|
+
error: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
export declare const PortFileSchema: z.ZodObject<{
|
|
31
|
+
port: z.ZodNumber;
|
|
32
|
+
pid: z.ZodNumber;
|
|
33
|
+
token: z.ZodString;
|
|
34
|
+
}, z.core.$strict>;
|
|
35
|
+
export type HealthResponse = z.infer<typeof HealthResponseSchema>;
|
|
36
|
+
export type TasksListResponse = z.infer<typeof TasksListResponseSchema>;
|
|
37
|
+
export type TasksCancelRequest = z.infer<typeof TasksCancelRequestSchema>;
|
|
38
|
+
export type TasksCancelResponse = z.infer<typeof TasksCancelResponseSchema>;
|
|
39
|
+
export type PortFile = z.infer<typeof PortFileSchema>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AddressInfo } from 'node:net';
|
|
2
|
+
import type { CancelTaskResult } from './cancel-helper';
|
|
3
|
+
import type { TaskStatus } from './envelope';
|
|
4
|
+
import type { ParsedEvent } from './jsonl-parser';
|
|
5
|
+
type RpcTaskRecord = {
|
|
6
|
+
taskId: string;
|
|
7
|
+
status: TaskStatus;
|
|
8
|
+
agentName?: string;
|
|
9
|
+
modelName?: string;
|
|
10
|
+
startedAt: number;
|
|
11
|
+
endedAt?: number;
|
|
12
|
+
events?: ParsedEvent[];
|
|
13
|
+
};
|
|
14
|
+
type TaskRegistryLike = {
|
|
15
|
+
getAllTasks(): RpcTaskRecord[];
|
|
16
|
+
};
|
|
17
|
+
export type StartRpcServerOptions = {
|
|
18
|
+
taskRegistry: TaskRegistryLike;
|
|
19
|
+
cancelTaskById: (taskId: string) => CancelTaskResult | Promise<CancelTaskResult>;
|
|
20
|
+
portFileBaseDir?: string;
|
|
21
|
+
sessionDiscriminator?: string;
|
|
22
|
+
now?: () => number;
|
|
23
|
+
};
|
|
24
|
+
export type StartedRpcServer = {
|
|
25
|
+
port: number;
|
|
26
|
+
token: string;
|
|
27
|
+
close(): Promise<void>;
|
|
28
|
+
};
|
|
29
|
+
export declare function isMissingPathError(error: unknown): boolean;
|
|
30
|
+
export declare function getTcpServerPort(address: AddressInfo | string | null): number;
|
|
31
|
+
export declare function startRpcServer(options: StartRpcServerOptions): Promise<StartedRpcServer>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** @jsxImportSource @opentui/solid */
|
|
2
|
+
import type { RpcClient } from '../rpc-client';
|
|
3
|
+
import type { ModalListTask } from './row';
|
|
4
|
+
type ConfirmCardProps = {
|
|
5
|
+
task: ModalListTask;
|
|
6
|
+
rpc: Pick<RpcClient, 'tasksCancel'>;
|
|
7
|
+
onConfirm: () => void;
|
|
8
|
+
onCancel: () => void;
|
|
9
|
+
onDismissAfterError: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function ConfirmCard(props: ConfirmCardProps): any;
|
|
12
|
+
export default ConfirmCard;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** @jsxImportSource @opentui/solid */
|
|
2
|
+
import type { RpcClient } from '../rpc-client';
|
|
3
|
+
export type ModalListClock = {
|
|
4
|
+
now(): number;
|
|
5
|
+
setInterval(fn: () => void, delayMs: number): unknown;
|
|
6
|
+
clearInterval(handle: unknown): void;
|
|
7
|
+
};
|
|
8
|
+
type ModalListProps = {
|
|
9
|
+
rpc: Pick<RpcClient, 'tasksList'>;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
onLoadError?: (error: unknown) => void;
|
|
12
|
+
initialTaskId?: string;
|
|
13
|
+
clock?: ModalListClock;
|
|
14
|
+
};
|
|
15
|
+
export declare function ModalList(props: ModalListProps): any;
|
|
16
|
+
export default ModalList;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TasksListResponse } from '../../runtime/rpc-contract';
|
|
2
|
+
export type ModalListTask = TasksListResponse['tasks'][number];
|
|
3
|
+
export declare function displayValue(value: string): string;
|
|
4
|
+
export declare function formatElapsed(elapsedMs: number): string;
|
|
5
|
+
export declare function formatToolCalls(toolCallCount: number): string;
|
|
6
|
+
export declare function formatRowText(task: ModalListTask, nowMs: number): string;
|