@equinor/fusion-framework-cli-plugin-copilot 1.0.0
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 +24 -0
- package/LICENSE +21 -0
- package/README.md +228 -0
- package/dist/esm/commands/app/command.js +176 -0
- package/dist/esm/commands/app/command.js.map +1 -0
- package/dist/esm/commands/app/eval.js +92 -0
- package/dist/esm/commands/app/eval.js.map +1 -0
- package/dist/esm/commands/app/format.js +93 -0
- package/dist/esm/commands/app/format.js.map +1 -0
- package/dist/esm/commands/app/login.js +71 -0
- package/dist/esm/commands/app/login.js.map +1 -0
- package/dist/esm/commands/app/prompts/execute-step.prompt.js +44 -0
- package/dist/esm/commands/app/prompts/execute-step.prompt.js.map +1 -0
- package/dist/esm/commands/app/prompts/judge.prompt.js +116 -0
- package/dist/esm/commands/app/prompts/judge.prompt.js.map +1 -0
- package/dist/esm/commands/app/prompts/plan.prompt.js +47 -0
- package/dist/esm/commands/app/prompts/plan.prompt.js.map +1 -0
- package/dist/esm/commands/app/prompts/step.prompt.js +42 -0
- package/dist/esm/commands/app/prompts/step.prompt.js.map +1 -0
- package/dist/esm/commands/app/prompts/system.dev-server.prompt.js +21 -0
- package/dist/esm/commands/app/prompts/system.dev-server.prompt.js.map +1 -0
- package/dist/esm/commands/app/prompts/system.prompt.js +77 -0
- package/dist/esm/commands/app/prompts/system.prompt.js.map +1 -0
- package/dist/esm/commands/app/server.js +83 -0
- package/dist/esm/commands/app/server.js.map +1 -0
- package/dist/esm/commands/app/session-logger.js +171 -0
- package/dist/esm/commands/app/session-logger.js.map +1 -0
- package/dist/esm/commands/app/tools/click.js +27 -0
- package/dist/esm/commands/app/tools/click.js.map +1 -0
- package/dist/esm/commands/app/tools/errors.js +24 -0
- package/dist/esm/commands/app/tools/errors.js.map +1 -0
- package/dist/esm/commands/app/tools/eval-js.js +36 -0
- package/dist/esm/commands/app/tools/eval-js.js.map +1 -0
- package/dist/esm/commands/app/tools/fill.js +28 -0
- package/dist/esm/commands/app/tools/fill.js.map +1 -0
- package/dist/esm/commands/app/tools/find.js +44 -0
- package/dist/esm/commands/app/tools/find.js.map +1 -0
- package/dist/esm/commands/app/tools/get-styles.js +36 -0
- package/dist/esm/commands/app/tools/get-styles.js.map +1 -0
- package/dist/esm/commands/app/tools/get-url.js +24 -0
- package/dist/esm/commands/app/tools/get-url.js.map +1 -0
- package/dist/esm/commands/app/tools/go-back.js +15 -0
- package/dist/esm/commands/app/tools/go-back.js.map +1 -0
- package/dist/esm/commands/app/tools/hover.js +24 -0
- package/dist/esm/commands/app/tools/hover.js.map +1 -0
- package/dist/esm/commands/app/tools/index.js +32 -0
- package/dist/esm/commands/app/tools/index.js.map +1 -0
- package/dist/esm/commands/app/tools/navigate.js +31 -0
- package/dist/esm/commands/app/tools/navigate.js.map +1 -0
- package/dist/esm/commands/app/tools/press-key.js +24 -0
- package/dist/esm/commands/app/tools/press-key.js.map +1 -0
- package/dist/esm/commands/app/tools/read-file.js +98 -0
- package/dist/esm/commands/app/tools/read-file.js.map +1 -0
- package/dist/esm/commands/app/tools/registry.js +34 -0
- package/dist/esm/commands/app/tools/registry.js.map +1 -0
- package/dist/esm/commands/app/tools/reload.js +15 -0
- package/dist/esm/commands/app/tools/reload.js.map +1 -0
- package/dist/esm/commands/app/tools/screenshot.js +133 -0
- package/dist/esm/commands/app/tools/screenshot.js.map +1 -0
- package/dist/esm/commands/app/tools/scroll.js +41 -0
- package/dist/esm/commands/app/tools/scroll.js.map +1 -0
- package/dist/esm/commands/app/tools/select.js +25 -0
- package/dist/esm/commands/app/tools/select.js.map +1 -0
- package/dist/esm/commands/app/tools/snapshot.js +24 -0
- package/dist/esm/commands/app/tools/snapshot.js.map +1 -0
- package/dist/esm/commands/app/tools/type-text.js +29 -0
- package/dist/esm/commands/app/tools/type-text.js.map +1 -0
- package/dist/esm/commands/app/tools/types.js +2 -0
- package/dist/esm/commands/app/tools/types.js.map +1 -0
- package/dist/esm/commands/app/tools/wait.js +39 -0
- package/dist/esm/commands/app/tools/wait.js.map +1 -0
- package/dist/esm/commands/app/tools/write-file.js +98 -0
- package/dist/esm/commands/app/tools/write-file.js.map +1 -0
- package/dist/esm/commands/app/types.js +2 -0
- package/dist/esm/commands/app/types.js.map +1 -0
- package/dist/esm/eval-resolve.js +83 -0
- package/dist/esm/eval-resolve.js.map +1 -0
- package/dist/esm/index.js +18 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/utils/agent-browser.js +67 -0
- package/dist/esm/utils/agent-browser.js.map +1 -0
- package/dist/esm/utils/browser-poll.js +26 -0
- package/dist/esm/utils/browser-poll.js.map +1 -0
- package/dist/esm/utils/daemon.js +83 -0
- package/dist/esm/utils/daemon.js.map +1 -0
- package/dist/esm/utils/index.js +6 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/process.js +30 -0
- package/dist/esm/utils/process.js.map +1 -0
- package/dist/esm/utils/server.js +65 -0
- package/dist/esm/utils/server.js.map +1 -0
- package/dist/esm/version.js +3 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/commands/app/command.d.ts +7 -0
- package/dist/types/commands/app/eval.d.ts +9 -0
- package/dist/types/commands/app/format.d.ts +14 -0
- package/dist/types/commands/app/login.d.ts +14 -0
- package/dist/types/commands/app/prompts/execute-step.prompt.d.ts +13 -0
- package/dist/types/commands/app/prompts/judge.prompt.d.ts +15 -0
- package/dist/types/commands/app/prompts/plan.prompt.d.ts +13 -0
- package/dist/types/commands/app/prompts/step.prompt.d.ts +12 -0
- package/dist/types/commands/app/prompts/system.dev-server.prompt.d.ts +12 -0
- package/dist/types/commands/app/prompts/system.prompt.d.ts +12 -0
- package/dist/types/commands/app/server.d.ts +26 -0
- package/dist/types/commands/app/session-logger.d.ts +14 -0
- package/dist/types/commands/app/tools/click.d.ts +9 -0
- package/dist/types/commands/app/tools/errors.d.ts +9 -0
- package/dist/types/commands/app/tools/eval-js.d.ts +13 -0
- package/dist/types/commands/app/tools/fill.d.ts +9 -0
- package/dist/types/commands/app/tools/find.d.ts +9 -0
- package/dist/types/commands/app/tools/get-styles.d.ts +13 -0
- package/dist/types/commands/app/tools/get-url.d.ts +9 -0
- package/dist/types/commands/app/tools/go-back.d.ts +9 -0
- package/dist/types/commands/app/tools/hover.d.ts +9 -0
- package/dist/types/commands/app/tools/index.d.ts +9 -0
- package/dist/types/commands/app/tools/navigate.d.ts +9 -0
- package/dist/types/commands/app/tools/press-key.d.ts +9 -0
- package/dist/types/commands/app/tools/read-file.d.ts +13 -0
- package/dist/types/commands/app/tools/registry.d.ts +28 -0
- package/dist/types/commands/app/tools/reload.d.ts +9 -0
- package/dist/types/commands/app/tools/screenshot.d.ts +9 -0
- package/dist/types/commands/app/tools/scroll.d.ts +9 -0
- package/dist/types/commands/app/tools/select.d.ts +9 -0
- package/dist/types/commands/app/tools/snapshot.d.ts +9 -0
- package/dist/types/commands/app/tools/type-text.d.ts +9 -0
- package/dist/types/commands/app/tools/types.d.ts +12 -0
- package/dist/types/commands/app/tools/wait.d.ts +9 -0
- package/dist/types/commands/app/tools/write-file.d.ts +19 -0
- package/dist/types/commands/app/types.d.ts +68 -0
- package/dist/types/eval-resolve.d.ts +31 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/utils/agent-browser.d.ts +26 -0
- package/dist/types/utils/browser-poll.d.ts +9 -0
- package/dist/types/utils/daemon.d.ts +16 -0
- package/dist/types/utils/index.d.ts +5 -0
- package/dist/types/utils/process.d.ts +21 -0
- package/dist/types/utils/server.d.ts +26 -0
- package/dist/types/version.d.ts +1 -0
- package/package.json +57 -0
- package/src/commands/app/command.ts +204 -0
- package/src/commands/app/eval.ts +114 -0
- package/src/commands/app/format.ts +110 -0
- package/src/commands/app/login.ts +92 -0
- package/src/commands/app/prompts/execute-step.prompt.ts +48 -0
- package/src/commands/app/prompts/judge.prompt.ts +121 -0
- package/src/commands/app/prompts/plan.prompt.ts +48 -0
- package/src/commands/app/prompts/step.prompt.ts +45 -0
- package/src/commands/app/prompts/system.dev-server.prompt.ts +22 -0
- package/src/commands/app/prompts/system.prompt.ts +78 -0
- package/src/commands/app/server.ts +105 -0
- package/src/commands/app/session-logger.ts +187 -0
- package/src/commands/app/tools/click.ts +28 -0
- package/src/commands/app/tools/errors.ts +26 -0
- package/src/commands/app/tools/eval-js.ts +40 -0
- package/src/commands/app/tools/fill.ts +29 -0
- package/src/commands/app/tools/find.ts +49 -0
- package/src/commands/app/tools/get-styles.ts +40 -0
- package/src/commands/app/tools/get-url.ts +26 -0
- package/src/commands/app/tools/go-back.ts +16 -0
- package/src/commands/app/tools/hover.ts +25 -0
- package/src/commands/app/tools/index.ts +57 -0
- package/src/commands/app/tools/navigate.ts +32 -0
- package/src/commands/app/tools/press-key.ts +25 -0
- package/src/commands/app/tools/read-file.ts +113 -0
- package/src/commands/app/tools/registry.ts +38 -0
- package/src/commands/app/tools/reload.ts +16 -0
- package/src/commands/app/tools/screenshot.ts +168 -0
- package/src/commands/app/tools/scroll.ts +45 -0
- package/src/commands/app/tools/select.ts +26 -0
- package/src/commands/app/tools/snapshot.ts +27 -0
- package/src/commands/app/tools/type-text.ts +30 -0
- package/src/commands/app/tools/types.ts +15 -0
- package/src/commands/app/tools/wait.ts +43 -0
- package/src/commands/app/tools/write-file.ts +104 -0
- package/src/commands/app/types.ts +76 -0
- package/src/eval-resolve.ts +113 -0
- package/src/index.ts +20 -0
- package/src/utils/agent-browser.ts +66 -0
- package/src/utils/browser-poll.ts +27 -0
- package/src/utils/daemon.ts +84 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/process.ts +33 -0
- package/src/utils/server.ts +66 -0
- package/src/version.ts +2 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the back navigation tool.
|
|
4
|
+
*
|
|
5
|
+
* @param context - Shared browser tool execution context
|
|
6
|
+
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
|
+
* @returns Copilot tool definition for going back in browser history
|
|
8
|
+
*/
|
|
9
|
+
export declare function createGoBackTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("@github/copilot-sdk").Tool<unknown>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the hover interaction tool.
|
|
4
|
+
*
|
|
5
|
+
* @param context - Shared browser tool execution context
|
|
6
|
+
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
|
+
* @returns Copilot tool definition for hovering a page element
|
|
8
|
+
*/
|
|
9
|
+
export declare function createHoverTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("@github/copilot-sdk").Tool<unknown>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentBrowserToolContext, AgentBrowserToolList, DefineTool } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the full set of Copilot browser tools for an eval session.
|
|
4
|
+
*
|
|
5
|
+
* @param context - Shared execution context for all browser tool wrappers
|
|
6
|
+
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
|
+
* @returns Registered browser tools in the order they should be exposed to the model
|
|
8
|
+
*/
|
|
9
|
+
export declare function createAgentBrowserTools(context: AgentBrowserToolContext, defineTool: DefineTool): AgentBrowserToolList;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the browser navigation tool.
|
|
4
|
+
*
|
|
5
|
+
* @param context - Shared browser tool execution context
|
|
6
|
+
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
|
+
* @returns Copilot tool definition for opening a URL
|
|
8
|
+
*/
|
|
9
|
+
export declare function createNavigateTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("@github/copilot-sdk").Tool<unknown>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the keyboard press tool.
|
|
4
|
+
*
|
|
5
|
+
* @param context - Shared browser tool execution context
|
|
6
|
+
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
|
+
* @returns Copilot tool definition for pressing a single key
|
|
8
|
+
*/
|
|
9
|
+
export declare function createPressKeyTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("@github/copilot-sdk").Tool<unknown>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DefineTool } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the read-file tool so the judge agent can inspect evidence artifacts.
|
|
4
|
+
*
|
|
5
|
+
* For image files the tool returns a `ToolBinaryResult` with base64-encoded
|
|
6
|
+
* data that multimodal models can view directly. Text files are returned
|
|
7
|
+
* as plain text. Directories return a listing of their contents.
|
|
8
|
+
*
|
|
9
|
+
* @param baseDir - The run output directory that scopes all reads
|
|
10
|
+
* @param defineTool - Copilot SDK helper used to declare tools
|
|
11
|
+
* @returns Copilot tool definition for reading evidence files
|
|
12
|
+
*/
|
|
13
|
+
export declare function createReadFileTool(baseDir: string, defineTool: DefineTool): import("@github/copilot-sdk").Tool<unknown>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AgentBrowserToolList } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Ordered collection of agent-browser tool registrations for a Copilot session.
|
|
4
|
+
*
|
|
5
|
+
* Tools are exposed to the model in insertion order. Use {@link addTools} to
|
|
6
|
+
* register multiple tools at once during session setup.
|
|
7
|
+
*/
|
|
8
|
+
export declare class AgentBrowserToolRegistry {
|
|
9
|
+
private readonly tools;
|
|
10
|
+
/**
|
|
11
|
+
* Adds a tool to the registry.
|
|
12
|
+
*
|
|
13
|
+
* @param tool - Tool definition created with the Copilot SDK `defineTool` helper
|
|
14
|
+
*/
|
|
15
|
+
addTool(tool: AgentBrowserToolList[number]): void;
|
|
16
|
+
/**
|
|
17
|
+
* Adds multiple tools to the registry in order.
|
|
18
|
+
*
|
|
19
|
+
* @param tools - Tool definitions created with the Copilot SDK `defineTool` helper
|
|
20
|
+
*/
|
|
21
|
+
addTools(...tools: AgentBrowserToolList): void;
|
|
22
|
+
/**
|
|
23
|
+
* Returns a shallow copy of the registered tools in insertion order.
|
|
24
|
+
*
|
|
25
|
+
* @returns The registered Copilot SDK tool list
|
|
26
|
+
*/
|
|
27
|
+
getTools(): AgentBrowserToolList;
|
|
28
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the page reload tool.
|
|
4
|
+
*
|
|
5
|
+
* @param context - Shared browser tool execution context
|
|
6
|
+
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
|
+
* @returns Copilot tool definition for reloading the current page
|
|
8
|
+
*/
|
|
9
|
+
export declare function createReloadTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("@github/copilot-sdk").Tool<unknown>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the screenshot capture tool.
|
|
4
|
+
*
|
|
5
|
+
* @param context - Shared browser tool execution context
|
|
6
|
+
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
|
+
* @returns Copilot tool definition for saving an image screenshot and returning it to the model
|
|
8
|
+
*/
|
|
9
|
+
export declare function createScreenshotTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("@github/copilot-sdk").Tool<unknown>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the scroll tool.
|
|
4
|
+
*
|
|
5
|
+
* @param context - Shared browser tool execution context
|
|
6
|
+
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
|
+
* @returns Copilot tool definition for page scrolling or scrolling an element into view
|
|
8
|
+
*/
|
|
9
|
+
export declare function createScrollTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("@github/copilot-sdk").Tool<unknown>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the select interaction tool.
|
|
4
|
+
*
|
|
5
|
+
* @param context - Shared browser tool execution context
|
|
6
|
+
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
|
+
* @returns Copilot tool definition for choosing an option in a select element
|
|
8
|
+
*/
|
|
9
|
+
export declare function createSelectTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("@github/copilot-sdk").Tool<unknown>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the accessibility snapshot tool.
|
|
4
|
+
*
|
|
5
|
+
* @param context - Shared browser tool execution context
|
|
6
|
+
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
|
+
* @returns Copilot tool definition for capturing the current page snapshot
|
|
8
|
+
*/
|
|
9
|
+
export declare function createSnapshotTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("@github/copilot-sdk").Tool<unknown>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the text typing tool.
|
|
4
|
+
*
|
|
5
|
+
* @param context - Shared browser tool execution context
|
|
6
|
+
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
|
+
* @returns Copilot tool definition for typing text into the focused element or a target
|
|
8
|
+
*/
|
|
9
|
+
export declare function createTypeTextTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("@github/copilot-sdk").Tool<unknown>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SessionConfig, defineTool } from '@github/copilot-sdk';
|
|
2
|
+
/** Shared runtime context passed to every agent-browser tool factory. */
|
|
3
|
+
export interface AgentBrowserToolContext {
|
|
4
|
+
/** Directory where evidence artifacts for the current eval run are stored. */
|
|
5
|
+
outDir: string;
|
|
6
|
+
/** Executes an `agent-browser` command and returns its stdout. */
|
|
7
|
+
invoke: (args: string[], timeoutMs?: number) => string;
|
|
8
|
+
}
|
|
9
|
+
/** Type-only alias for the Copilot SDK `defineTool` helper. */
|
|
10
|
+
export type DefineTool = typeof defineTool;
|
|
11
|
+
/** Copilot SDK tool list type used by the registry. */
|
|
12
|
+
export type AgentBrowserToolList = NonNullable<SessionConfig['tools']>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the wait tool.
|
|
4
|
+
*
|
|
5
|
+
* @param context - Shared browser tool execution context
|
|
6
|
+
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
|
+
* @returns Copilot tool definition for waiting on load state, text, elements, or time
|
|
8
|
+
*/
|
|
9
|
+
export declare function createWaitTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("@github/copilot-sdk").Tool<unknown>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DefineTool } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the write-file tool so the agent can save artifacts
|
|
4
|
+
* (plan.json, verdict.json, etc.) to the run output directory.
|
|
5
|
+
*
|
|
6
|
+
* @param baseDir - The run output directory that scopes all writes
|
|
7
|
+
* @param defineTool - Copilot SDK helper used to declare tools
|
|
8
|
+
* @returns Copilot tool definition for writing a file
|
|
9
|
+
*/
|
|
10
|
+
export declare function createWriteFileTool(baseDir: string, defineTool: DefineTool): import("@github/copilot-sdk").Tool<unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* Creates the append-file tool so the agent can append lines
|
|
13
|
+
* to artifacts like executions.jsonl.
|
|
14
|
+
*
|
|
15
|
+
* @param baseDir - The run output directory that scopes all writes
|
|
16
|
+
* @param defineTool - Copilot SDK helper used to declare tools
|
|
17
|
+
* @returns Copilot tool definition for appending to a file
|
|
18
|
+
*/
|
|
19
|
+
export declare function createAppendFileTool(baseDir: string, defineTool: DefineTool): import("@github/copilot-sdk").Tool<unknown>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
export interface RuntimeExecutionContext {
|
|
3
|
+
outDir: string;
|
|
4
|
+
url: string;
|
|
5
|
+
}
|
|
6
|
+
/** CLI option set for the `copilot app eval` command. */
|
|
7
|
+
export interface CopilotEvalOptions {
|
|
8
|
+
/** Port for the local app dev server. */
|
|
9
|
+
port: string;
|
|
10
|
+
/** Host address for the local app dev server. */
|
|
11
|
+
host: string;
|
|
12
|
+
/** Skip server start and use an already-running URL. */
|
|
13
|
+
url?: string;
|
|
14
|
+
/** Show detailed output from the dev server and agent-browser. */
|
|
15
|
+
verbose: boolean;
|
|
16
|
+
/** LLM model override (e.g. "claude-sonnet-4"). */
|
|
17
|
+
model?: string;
|
|
18
|
+
/** Reasoning effort: low, medium, high, xhigh. */
|
|
19
|
+
reasoning?: 'low' | 'medium' | 'high' | 'xhigh';
|
|
20
|
+
/** Output directory override for run artifacts. */
|
|
21
|
+
output?: string;
|
|
22
|
+
/** Open a headed browser for interactive MSAL login. */
|
|
23
|
+
login: boolean;
|
|
24
|
+
/** Specific eval to run (name or file path). */
|
|
25
|
+
eval?: string;
|
|
26
|
+
/** Observable that emits on SIGINT for graceful shutdown. */
|
|
27
|
+
shutdown$?: Observable<string>;
|
|
28
|
+
}
|
|
29
|
+
/** A logical test step that groups related criteria under one scenario. */
|
|
30
|
+
export interface PlanStep {
|
|
31
|
+
/** Short scenario description (e.g. "Open the landing page"). */
|
|
32
|
+
scenario: string;
|
|
33
|
+
/** Acceptance criteria to verify (e.g. ["Header shows Hello Fusion", ...]). */
|
|
34
|
+
criteria: string[];
|
|
35
|
+
/** What constitutes a pass for each criterion (same order as criteria). */
|
|
36
|
+
pass: string[];
|
|
37
|
+
/** What constitutes a fail for each criterion (same order as criteria). */
|
|
38
|
+
fail: string[];
|
|
39
|
+
}
|
|
40
|
+
/** Structured plan produced by Phase 1. */
|
|
41
|
+
export interface Plan {
|
|
42
|
+
/** Brief summary of the feature under test. */
|
|
43
|
+
summary: string;
|
|
44
|
+
/** Ordered acceptance criteria to execute. */
|
|
45
|
+
steps: PlanStep[];
|
|
46
|
+
}
|
|
47
|
+
/** Result of executing a single {@link PlanStep}. */
|
|
48
|
+
export interface StepResult {
|
|
49
|
+
/** The criterion that was tested. */
|
|
50
|
+
criterion: string;
|
|
51
|
+
/** Whether the criterion passed. */
|
|
52
|
+
ok: boolean;
|
|
53
|
+
/** Agent's observation or explanation. */
|
|
54
|
+
note: string;
|
|
55
|
+
/** Evidence artifact filenames collected during this step. */
|
|
56
|
+
evidence: string[];
|
|
57
|
+
}
|
|
58
|
+
/** Structured verdict produced by the Copilot agent at the end of an eval session. */
|
|
59
|
+
export interface Verdict {
|
|
60
|
+
/** Whether all acceptance criteria passed. */
|
|
61
|
+
pass: boolean;
|
|
62
|
+
/** Overall summary explaining the pass/fail outcome. */
|
|
63
|
+
reasoning: string;
|
|
64
|
+
/** Per-criterion results with evidence references. */
|
|
65
|
+
steps: StepResult[];
|
|
66
|
+
/** Optional UX observations and improvement suggestions based on what was seen. */
|
|
67
|
+
ux?: string[];
|
|
68
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalized positional input for the `copilot app eval` command.
|
|
3
|
+
*
|
|
4
|
+
* When the user passes an application directory, `evalFile` is undefined.
|
|
5
|
+
* When the user passes a direct `eval/*.md` file path, `appPath` is derived
|
|
6
|
+
* from the file location and `evalFile` points to the selected markdown file.
|
|
7
|
+
*/
|
|
8
|
+
export interface EvalCommandInput {
|
|
9
|
+
/** Absolute path to the Fusion application directory. */
|
|
10
|
+
appPath: string;
|
|
11
|
+
/** Optional absolute path to the directly selected eval markdown file. */
|
|
12
|
+
evalFile?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Resolves the positional `copilot app eval` argument.
|
|
16
|
+
*
|
|
17
|
+
* Supports both application directory paths and direct paths to markdown files
|
|
18
|
+
* inside an application's `eval/` directory.
|
|
19
|
+
*
|
|
20
|
+
* @param inputPath - Positional CLI argument passed to the eval command.
|
|
21
|
+
* @returns Normalized application path and optional direct eval file path.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveEvalCommandInput(inputPath: string): EvalCommandInput;
|
|
24
|
+
/**
|
|
25
|
+
* Resolves eval markdown files for a Fusion application.
|
|
26
|
+
*
|
|
27
|
+
* @param appPath - Path to the Fusion application directory
|
|
28
|
+
* @param evalOpt - Value of the `--eval` CLI option (name, path, or `undefined`)
|
|
29
|
+
* @returns Array of absolute paths to eval markdown files
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveEvalFiles(appPath: string, evalOpt?: string): string[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* Registers the `copilot` CLI plugin with the Fusion Framework CLI.
|
|
4
|
+
*
|
|
5
|
+
* Attaches the top-level `copilot` command group, providing Copilot SDK
|
|
6
|
+
* powered evaluation tools with agent-browser.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* ffc copilot app eval ./cookbooks/app-react
|
|
10
|
+
* ffc copilot app eval . --eval smoke --model claude-sonnet-4
|
|
11
|
+
*
|
|
12
|
+
* @param program - The root Commander program instance
|
|
13
|
+
*/
|
|
14
|
+
export declare function registerCopilotPlugin(program: Command): void;
|
|
15
|
+
export default registerCopilotPlugin;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Persistent Chrome profile directory used across agent-browser sessions. */
|
|
2
|
+
export declare const PROFILE_DIR: string;
|
|
3
|
+
/**
|
|
4
|
+
* Runs an agent-browser command with the persistent Chrome profile.
|
|
5
|
+
*
|
|
6
|
+
* Calls the `agent-browser` binary resolved from `PATH` (homebrew or npm global).
|
|
7
|
+
* Every invocation automatically injects `--profile <PROFILE_DIR>` so browser
|
|
8
|
+
* state (cookies, session storage, MSAL tokens) persists across calls.
|
|
9
|
+
*
|
|
10
|
+
* @param args - Subcommand and arguments passed directly to `agent-browser`
|
|
11
|
+
* @param timeoutMs - Maximum execution time in milliseconds (default: 30 000)
|
|
12
|
+
* @returns Trimmed stdout from the command
|
|
13
|
+
* @throws {Error} When `agent-browser` exits with a non-zero code or times out
|
|
14
|
+
*/
|
|
15
|
+
export declare function ab(args: string[], timeoutMs?: number): string;
|
|
16
|
+
/**
|
|
17
|
+
* Extracts the user-facing error message from an agent-browser failure.
|
|
18
|
+
*
|
|
19
|
+
* Strips ANSI escape codes from stderr and returns only the diagnostic
|
|
20
|
+
* lines prefixed with `✗` or `⚠`. Falls back to the first 200 characters
|
|
21
|
+
* of the error message when no diagnostic lines are found.
|
|
22
|
+
*
|
|
23
|
+
* @param err - The caught error (typically from {@link ab})
|
|
24
|
+
* @returns A single-line summary suitable for console output
|
|
25
|
+
*/
|
|
26
|
+
export declare function abErrorMessage(err: unknown): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Polls the browser's console log output until a predicate returns `true`
|
|
3
|
+
* or the timeout expires.
|
|
4
|
+
*
|
|
5
|
+
* @param predicate - Callback receiving the raw console log text; return `true` to stop
|
|
6
|
+
* @param timeoutMs - Maximum polling duration in milliseconds
|
|
7
|
+
* @returns `true` if the predicate matched before timeout, `false` otherwise
|
|
8
|
+
*/
|
|
9
|
+
export declare function pollConsole(predicate: (logs: string) => boolean, timeoutMs: number): Promise<boolean>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kills any running agent-browser daemon and its Chrome children,
|
|
3
|
+
* then removes stale state files so the next run starts clean.
|
|
4
|
+
*
|
|
5
|
+
* Cleanup sequence:
|
|
6
|
+
* 1. Graceful `agent-browser close` (5 s timeout)
|
|
7
|
+
* 2. Force-kill the daemon PID read from {@link DAEMON_PID_FILE}
|
|
8
|
+
* 3. `pkill` leftover headless Chrome processes
|
|
9
|
+
* 4. Delete Session Storage to clear stuck MSAL `interaction.status` flags
|
|
10
|
+
*/
|
|
11
|
+
export declare function resetDaemon(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Clears the MSAL `interaction.status` flag from `sessionStorage` in the
|
|
14
|
+
* running browser via `agent-browser eval`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function clearMsalInteraction(): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ab, abErrorMessage, PROFILE_DIR } from './agent-browser.js';
|
|
2
|
+
export { resetDaemon, clearMsalInteraction } from './daemon.js';
|
|
3
|
+
export { cleanup, sleep, stripAnsi } from './process.js';
|
|
4
|
+
export { createRunDir, resolveAppKey, waitForServer } from './server.js';
|
|
5
|
+
export { pollConsole } from './browser-poll.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ChildProcess } from 'node:child_process';
|
|
2
|
+
/**
|
|
3
|
+
* Sends `SIGTERM` to a child process if it is still running.
|
|
4
|
+
*
|
|
5
|
+
* @param proc - The child process to terminate (no-op when `undefined` or already killed)
|
|
6
|
+
*/
|
|
7
|
+
export declare function cleanup(proc?: ChildProcess): void;
|
|
8
|
+
/**
|
|
9
|
+
* Returns a promise that resolves after the given delay.
|
|
10
|
+
*
|
|
11
|
+
* @param ms - Delay in milliseconds
|
|
12
|
+
* @returns A promise that resolves after `ms` milliseconds
|
|
13
|
+
*/
|
|
14
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Strips ANSI escape codes (color / formatting) from a string.
|
|
17
|
+
*
|
|
18
|
+
* @param s - The string potentially containing ANSI sequences
|
|
19
|
+
* @returns The input string with all ANSI escape sequences removed
|
|
20
|
+
*/
|
|
21
|
+
export declare function stripAnsi(s: string): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a timestamped, run-specific output directory for eval artifacts.
|
|
3
|
+
*
|
|
4
|
+
* @param title - Human label used as the directory name prefix (slugified)
|
|
5
|
+
* @param baseDir - Optional parent directory override
|
|
6
|
+
* @returns Absolute path to the newly created directory
|
|
7
|
+
*/
|
|
8
|
+
export declare function createRunDir(title: string, baseDir?: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Resolves the Fusion `appKey` by running `ffc app manifest --silent`
|
|
11
|
+
* in the given application directory and parsing the JSON output.
|
|
12
|
+
*
|
|
13
|
+
* @param appDir - Absolute path to the Fusion application
|
|
14
|
+
* @returns The `appKey` string from the manifest
|
|
15
|
+
* @throws {Error} When `ffc app manifest` fails or returns invalid JSON
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveAppKey(appDir: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Polls a server URL until it responds with a non-5xx status or the
|
|
20
|
+
* timeout is reached.
|
|
21
|
+
*
|
|
22
|
+
* @param url - The URL to poll (e.g. `http://localhost:3000`)
|
|
23
|
+
* @param timeoutSeconds - Maximum number of seconds to wait
|
|
24
|
+
* @returns `true` if the server responded before timeout, `false` otherwise
|
|
25
|
+
*/
|
|
26
|
+
export declare function waitForServer(url: string, timeoutSeconds: number): Promise<boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const version = "1.0.0";
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@equinor/fusion-framework-cli-plugin-copilot",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Copilot SDK powered evaluation plugin for Fusion Framework CLI",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/esm/index.js",
|
|
11
|
+
"types": "./dist/types/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"typesVersions": {
|
|
15
|
+
"*": {
|
|
16
|
+
".": [
|
|
17
|
+
"dist/types/index.d.ts"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"fusion-framework",
|
|
23
|
+
"cli",
|
|
24
|
+
"plugin",
|
|
25
|
+
"copilot",
|
|
26
|
+
"copilot-sdk",
|
|
27
|
+
"agent-browser"
|
|
28
|
+
],
|
|
29
|
+
"author": "",
|
|
30
|
+
"license": "ISC",
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/equinor/fusion-framework.git",
|
|
37
|
+
"directory": "packages/cli-plugins/copilot"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@github/copilot-sdk": "^0.1.32",
|
|
41
|
+
"chalk": "^5.6.2",
|
|
42
|
+
"commander": "^14.0.1",
|
|
43
|
+
"ora": "^9.3.0",
|
|
44
|
+
"rxjs": "^7.8.2"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@equinor/fusion-framework-cli": "^14.0.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"typescript": "^5.9.3",
|
|
51
|
+
"@equinor/fusion-framework-cli": "^14.0.0"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsc -b",
|
|
55
|
+
"build:types": "tsc -b"
|
|
56
|
+
}
|
|
57
|
+
}
|