agentcue 0.0.0-stage → 0.0.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.
@@ -0,0 +1,20 @@
1
+ import type { IncomingMessage, ServerResponse } from "node:http";
2
+ import type { Dispatcher } from "./dispatcher.ts";
3
+ import { type AgentId, type CuePayload } from "../shared/types.ts";
4
+ export declare const CORS_HEADERS: Record<string, string>;
5
+ export declare function sendJson(res: ServerResponse, status: number, body: unknown): void;
6
+ export declare function validateCuePayload(raw: unknown, allowedAgents: AgentId[]): CuePayload;
7
+ export declare function resolveClientBundlePath(): string;
8
+ export type NextFunction = (err?: unknown) => void;
9
+ export interface BridgeHandlerOptions {
10
+ dispatcher: Dispatcher;
11
+ basePath?: string;
12
+ clientOrigin: string | (() => string);
13
+ clientScript?: string;
14
+ clientBundlePath?: string;
15
+ }
16
+ export interface BridgeHandler {
17
+ middleware: (req: IncomingMessage, res: ServerResponse, next?: NextFunction) => void;
18
+ dispose: () => void;
19
+ }
20
+ export declare function createBridgeHandler(options: BridgeHandlerOptions): BridgeHandler;
@@ -0,0 +1,20 @@
1
+ import { type AgentExecutor, type Dispatcher } from "./dispatcher.ts";
2
+ import type { AgentId } from "../shared/types.ts";
3
+ export interface ServerOptions {
4
+ port?: number;
5
+ host?: string;
6
+ cwd?: string;
7
+ defaultAgent?: AgentId;
8
+ agents?: AgentId[];
9
+ executor?: AgentExecutor;
10
+ clientScript?: string;
11
+ demoHtmlPath?: string;
12
+ }
13
+ export interface RunningServer {
14
+ port: number;
15
+ host: string;
16
+ origin: string;
17
+ dispatcher: Dispatcher;
18
+ close(): Promise<void>;
19
+ }
20
+ export declare function startServer(options?: ServerOptions): Promise<RunningServer>;
@@ -0,0 +1,2 @@
1
+ import type { CuePayload } from "./types.ts";
2
+ export declare function formatCuePrompt(cue: CuePayload): string;
@@ -0,0 +1,69 @@
1
+ export declare const SUPPORTED_AGENTS: readonly ["agy", "claude", "cursor-agent", "codex", "pi"];
2
+ export type AgentId = (typeof SUPPORTED_AGENTS)[number];
3
+ export interface BoundingBox {
4
+ x: number;
5
+ y: number;
6
+ width: number;
7
+ height: number;
8
+ }
9
+ export interface PinContext {
10
+ tagName: string;
11
+ selector: string;
12
+ breadcrumb: string;
13
+ outerHTML: string;
14
+ textExcerpt: string;
15
+ computedStyles: Record<string, string>;
16
+ boundingBox: BoundingBox;
17
+ sourceHint?: string;
18
+ componentStack?: string;
19
+ }
20
+ export interface PinPayload {
21
+ index: number;
22
+ note: string;
23
+ context: PinContext;
24
+ }
25
+ export interface CuePayload {
26
+ agent: AgentId;
27
+ continueSession: boolean;
28
+ pageUrl: string;
29
+ pageTitle: string;
30
+ pins: PinPayload[];
31
+ }
32
+ export type DispatcherStatus = "idle" | "running" | "done" | "error";
33
+ export interface CueSummary {
34
+ cueId: string;
35
+ agent: AgentId;
36
+ pinCount: number;
37
+ startedAt: number;
38
+ }
39
+ export interface LastCueResult {
40
+ cueId: string;
41
+ agent: AgentId;
42
+ ok: boolean;
43
+ durationMs: number;
44
+ error?: string;
45
+ finishedAt: number;
46
+ }
47
+ export interface DispatcherState {
48
+ cwd: string;
49
+ agents: AgentId[];
50
+ defaultAgent: AgentId | null;
51
+ status: DispatcherStatus;
52
+ activeCue: CueSummary | null;
53
+ queuedCount: number;
54
+ lastResult: LastCueResult | null;
55
+ }
56
+ export type ServerEvent = {
57
+ type: "state";
58
+ state: DispatcherState;
59
+ } | {
60
+ type: "cue:done";
61
+ cueId: string;
62
+ agent: AgentId;
63
+ durationMs: number;
64
+ } | {
65
+ type: "cue:error";
66
+ cueId: string;
67
+ agent: AgentId;
68
+ error: string;
69
+ };
package/dist/vite.d.ts ADDED
@@ -0,0 +1,60 @@
1
+ import type { IncomingMessage, ServerResponse } from "node:http";
2
+ import { type AgentExecutor, type Dispatcher } from "./server/dispatcher.ts";
3
+ import { type AgentId } from "./shared/types.ts";
4
+ export type { AgentId, AgentExecutor, Dispatcher };
5
+ export interface AgentcueViteOptions {
6
+ /** Enable or disable the plugin in Vite dev server (default: true). */
7
+ enabled?: boolean;
8
+ /** Default selected Agent Target in the browser capsule. */
9
+ defaultAgent?: AgentId;
10
+ /**
11
+ * Workspace directory where the Agent CLI executes edits.
12
+ * Relative paths resolve from Vite's `root` (default: Vite's `root`).
13
+ */
14
+ cwd?: string;
15
+ /** Mount path prefix on the Vite dev server (default: "/__agentcue"). */
16
+ basePath?: string;
17
+ /** Explicit list of enabled Agent Targets (defaults to auto-detecting PATH). */
18
+ agents?: AgentId[];
19
+ /** Custom Agent CLI executor (useful for testing). */
20
+ executor?: AgentExecutor;
21
+ /** Override bundled client overlay script (useful for testing). */
22
+ clientScript?: string;
23
+ /** Suppress the startup line printed beneath Vite's server URLs. */
24
+ quiet?: boolean;
25
+ }
26
+ export interface AgentcueHtmlTagDescriptor {
27
+ tag: string;
28
+ attrs?: Record<string, string | boolean | undefined>;
29
+ children?: string;
30
+ injectTo?: "head" | "body" | "head-prepend" | "body-prepend";
31
+ }
32
+ export interface ViteResolvedConfigLike {
33
+ readonly root: string;
34
+ readonly base: string;
35
+ }
36
+ export interface ViteDevServerLike {
37
+ readonly config: {
38
+ readonly root: string;
39
+ readonly base: string;
40
+ readonly logger: {
41
+ info(msg: string): void;
42
+ };
43
+ };
44
+ readonly middlewares: {
45
+ use(fn: (req: IncomingMessage, res: ServerResponse, next: () => void) => void): unknown;
46
+ };
47
+ readonly httpServer: {
48
+ once(event: "close", listener: () => void): unknown;
49
+ } | null;
50
+ printUrls?: () => void;
51
+ }
52
+ export interface AgentcueVitePlugin {
53
+ name: string;
54
+ apply: "serve";
55
+ configResolved(config: ViteResolvedConfigLike): void;
56
+ configureServer(server: ViteDevServerLike): void;
57
+ transformIndexHtml(): AgentcueHtmlTagDescriptor[];
58
+ }
59
+ export declare function agentcue(options?: AgentcueViteOptions): AgentcueVitePlugin;
60
+ export default agentcue;