@equinor/fusion-framework-cli-plugin-copilot 2.0.1 → 2.0.3
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 +17 -0
- package/dist/esm/commands/app/{session-logger.js → attach-session-logger.js} +16 -2
- package/dist/esm/commands/app/attach-session-logger.js.map +1 -0
- package/dist/esm/commands/app/{command.js → copilot-command.js} +22 -11
- package/dist/esm/commands/app/copilot-command.js.map +1 -0
- package/dist/esm/commands/app/{eval.js → create-session.js} +8 -6
- package/dist/esm/commands/app/create-session.js.map +1 -0
- package/dist/esm/commands/app/format-plan.js +24 -0
- package/dist/esm/commands/app/format-plan.js.map +1 -0
- package/dist/esm/commands/app/format-step-result.js +14 -0
- package/dist/esm/commands/app/format-step-result.js.map +1 -0
- package/dist/esm/commands/app/format-verdict.js +38 -0
- package/dist/esm/commands/app/format-verdict.js.map +1 -0
- package/dist/esm/commands/app/prompts/{system.dev-server.prompt.js → create-dev-server-context.js} +1 -1
- package/dist/esm/commands/app/prompts/create-dev-server-context.js.map +1 -0
- package/dist/esm/commands/app/prompts/{execute-step.prompt.js → create-execute-step-prompt.js} +1 -1
- package/dist/esm/commands/app/prompts/create-execute-step-prompt.js.map +1 -0
- package/dist/esm/commands/app/prompts/{judge.prompt.js → create-judge-prompt.js} +5 -1
- package/dist/esm/commands/app/prompts/create-judge-prompt.js.map +1 -0
- package/dist/esm/commands/app/prompts/{plan.prompt.js → create-plan-prompt.js} +1 -1
- package/dist/esm/commands/app/prompts/create-plan-prompt.js.map +1 -0
- package/dist/esm/commands/app/prompts/{step.prompt.js → create-step-prompt.js} +3 -2
- package/dist/esm/commands/app/prompts/create-step-prompt.js.map +1 -0
- package/dist/esm/commands/app/prompts/{system.prompt.js → create-system-prompt.js} +1 -1
- package/dist/esm/commands/app/prompts/create-system-prompt.js.map +1 -0
- package/dist/esm/commands/app/{login.js → run-login.js} +5 -1
- package/dist/esm/commands/app/run-login.js.map +1 -0
- package/dist/esm/commands/app/{server.js → start-app-server.js} +7 -1
- package/dist/esm/commands/app/start-app-server.js.map +1 -0
- package/dist/esm/commands/app/status-icon.js +18 -0
- package/dist/esm/commands/app/status-icon.js.map +1 -0
- package/dist/esm/commands/app/tools/{registry.js → AgentBrowserToolRegistry.js} +1 -1
- package/dist/esm/commands/app/tools/AgentBrowserToolRegistry.js.map +1 -0
- package/dist/esm/commands/app/tools/{write-file.js → create-append-file-tool.js} +5 -38
- package/dist/esm/commands/app/tools/create-append-file-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{click.js → create-click-tool.js} +1 -1
- package/dist/esm/commands/app/tools/create-click-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{errors.js → create-errors-tool.js} +1 -1
- package/dist/esm/commands/app/tools/create-errors-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{eval-js.js → create-eval-js-tool.js} +1 -1
- package/dist/esm/commands/app/tools/create-eval-js-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{fill.js → create-fill-tool.js} +1 -1
- package/dist/esm/commands/app/tools/create-fill-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{find.js → create-find-tool.js} +4 -1
- package/dist/esm/commands/app/tools/create-find-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{get-styles.js → create-get-styles-tool.js} +1 -1
- package/dist/esm/commands/app/tools/create-get-styles-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{get-url.js → create-get-url-tool.js} +1 -1
- package/dist/esm/commands/app/tools/create-get-url-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{go-back.js → create-go-back-tool.js} +1 -1
- package/dist/esm/commands/app/tools/create-go-back-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{hover.js → create-hover-tool.js} +1 -1
- package/dist/esm/commands/app/tools/create-hover-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{navigate.js → create-navigate-tool.js} +1 -1
- package/dist/esm/commands/app/tools/create-navigate-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{press-key.js → create-press-key-tool.js} +1 -1
- package/dist/esm/commands/app/tools/create-press-key-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{read-file.js → create-read-file-tool.js} +4 -2
- package/dist/esm/commands/app/tools/create-read-file-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{reload.js → create-reload-tool.js} +1 -1
- package/dist/esm/commands/app/tools/create-reload-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{screenshot.js → create-screenshot-tool.js} +7 -1
- package/dist/esm/commands/app/tools/create-screenshot-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{scroll.js → create-scroll-tool.js} +3 -1
- package/dist/esm/commands/app/tools/create-scroll-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{select.js → create-select-tool.js} +1 -1
- package/dist/esm/commands/app/tools/create-select-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{snapshot.js → create-snapshot-tool.js} +1 -1
- package/dist/esm/commands/app/tools/create-snapshot-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{type-text.js → create-type-text-tool.js} +1 -1
- package/dist/esm/commands/app/tools/create-type-text-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/{wait.js → create-wait-tool.js} +5 -1
- package/dist/esm/commands/app/tools/create-wait-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/create-write-file-tool.js +65 -0
- package/dist/esm/commands/app/tools/create-write-file-tool.js.map +1 -0
- package/dist/esm/commands/app/tools/index.js +19 -19
- package/dist/esm/commands/app/tools/index.js.map +1 -1
- package/dist/esm/commands/app/truncate.js +11 -0
- package/dist/esm/commands/app/truncate.js.map +1 -0
- package/dist/esm/commands/app/try-format-message.js +39 -0
- package/dist/esm/commands/app/try-format-message.js.map +1 -0
- package/dist/esm/exit-with-resolution-error.js +16 -0
- package/dist/esm/exit-with-resolution-error.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/resolve-eval-command-input.js +37 -0
- package/dist/esm/resolve-eval-command-input.js.map +1 -0
- package/dist/esm/resolve-eval-files.js +49 -0
- package/dist/esm/resolve-eval-files.js.map +1 -0
- package/dist/esm/utils/ab-error-message.js +34 -0
- package/dist/esm/utils/ab-error-message.js.map +1 -0
- package/dist/esm/utils/{agent-browser.js → ab.js} +3 -32
- package/dist/esm/utils/ab.js.map +1 -0
- package/dist/esm/utils/create-run-dir.js +24 -0
- package/dist/esm/utils/create-run-dir.js.map +1 -0
- package/dist/esm/utils/{process.js → helpers.js} +28 -11
- package/dist/esm/utils/helpers.js.map +1 -0
- package/dist/esm/utils/index.js +8 -5
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/{browser-poll.js → poll-console.js} +5 -3
- package/dist/esm/utils/poll-console.js.map +1 -0
- package/dist/esm/utils/{daemon.js → reset-daemon.js} +5 -14
- package/dist/esm/utils/reset-daemon.js.map +1 -0
- package/dist/esm/utils/resolve-app-key.js +20 -0
- package/dist/esm/utils/resolve-app-key.js.map +1 -0
- package/dist/esm/utils/wait-for-server.js +26 -0
- package/dist/esm/utils/wait-for-server.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/commands/app/{command.d.ts → copilot-command.d.ts} +1 -1
- package/dist/types/commands/app/format-plan.d.ts +8 -0
- package/dist/types/commands/app/format-step-result.d.ts +8 -0
- package/dist/types/commands/app/format-verdict.d.ts +8 -0
- package/dist/types/commands/app/prompts/{step.prompt.d.ts → create-step-prompt.d.ts} +1 -1
- package/dist/types/commands/app/status-icon.d.ts +8 -0
- package/dist/types/commands/app/tools/create-append-file-tool.d.ts +10 -0
- package/dist/types/commands/app/tools/{click.d.ts → create-click-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{errors.d.ts → create-errors-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{eval-js.d.ts → create-eval-js-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{fill.d.ts → create-fill-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{find.d.ts → create-find-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{get-styles.d.ts → create-get-styles-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{get-url.d.ts → create-get-url-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{go-back.d.ts → create-go-back-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{hover.d.ts → create-hover-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{navigate.d.ts → create-navigate-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{press-key.d.ts → create-press-key-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{read-file.d.ts → create-read-file-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{reload.d.ts → create-reload-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{screenshot.d.ts → create-screenshot-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{scroll.d.ts → create-scroll-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{select.d.ts → create-select-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{snapshot.d.ts → create-snapshot-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{type-text.d.ts → create-type-text-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/{wait.d.ts → create-wait-tool.d.ts} +1 -1
- package/dist/types/commands/app/tools/create-write-file-tool.d.ts +10 -0
- package/dist/types/commands/app/truncate.d.ts +8 -0
- package/dist/types/commands/app/try-format-message.d.ts +10 -0
- package/dist/types/exit-with-resolution-error.d.ts +8 -0
- package/dist/types/{eval-resolve.d.ts → resolve-eval-command-input.d.ts} +0 -8
- package/dist/types/resolve-eval-files.d.ts +8 -0
- package/dist/types/utils/ab-error-message.d.ts +11 -0
- package/dist/types/utils/{agent-browser.d.ts → ab.d.ts} +0 -13
- package/dist/types/utils/create-run-dir.d.ts +8 -0
- package/dist/types/utils/{process.d.ts → helpers.d.ts} +13 -6
- package/dist/types/utils/index.d.ts +8 -5
- package/dist/types/utils/{daemon.d.ts → reset-daemon.d.ts} +0 -5
- package/dist/types/utils/resolve-app-key.d.ts +9 -0
- package/dist/types/utils/wait-for-server.d.ts +9 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +6 -6
- package/src/commands/app/{session-logger.ts → attach-session-logger.ts} +15 -1
- package/src/commands/app/{command.ts → copilot-command.ts} +21 -12
- package/src/commands/app/{eval.ts → create-session.ts} +7 -5
- package/src/commands/app/format-plan.ts +26 -0
- package/src/commands/app/format-step-result.ts +16 -0
- package/src/commands/app/format-verdict.ts +43 -0
- package/src/commands/app/prompts/{judge.prompt.ts → create-judge-prompt.ts} +4 -0
- package/src/commands/app/prompts/{step.prompt.ts → create-step-prompt.ts} +2 -1
- package/src/commands/app/{login.ts → run-login.ts} +4 -0
- package/src/commands/app/{server.ts → start-app-server.ts} +6 -0
- package/src/commands/app/status-icon.ts +16 -0
- package/src/commands/app/tools/{write-file.ts → create-append-file-tool.ts} +4 -39
- package/src/commands/app/tools/{find.ts → create-find-tool.ts} +3 -0
- package/src/commands/app/tools/{read-file.ts → create-read-file-tool.ts} +3 -1
- package/src/commands/app/tools/{screenshot.ts → create-screenshot-tool.ts} +6 -0
- package/src/commands/app/tools/{scroll.ts → create-scroll-tool.ts} +2 -0
- package/src/commands/app/tools/{wait.ts → create-wait-tool.ts} +4 -0
- package/src/commands/app/tools/create-write-file-tool.ts +69 -0
- package/src/commands/app/tools/index.ts +19 -19
- package/src/commands/app/truncate.ts +10 -0
- package/src/commands/app/try-format-message.ts +42 -0
- package/src/exit-with-resolution-error.ts +15 -0
- package/src/index.ts +1 -1
- package/src/resolve-eval-command-input.ts +59 -0
- package/src/resolve-eval-files.ts +57 -0
- package/src/utils/ab-error-message.ts +31 -0
- package/src/utils/{agent-browser.ts → ab.ts} +2 -30
- package/src/utils/create-run-dir.ts +24 -0
- package/src/utils/{process.ts → helpers.ts} +28 -10
- package/src/utils/index.ts +8 -5
- package/src/utils/{browser-poll.ts → poll-console.ts} +4 -2
- package/src/utils/{daemon.ts → reset-daemon.ts} +4 -13
- package/src/utils/resolve-app-key.ts +20 -0
- package/src/utils/wait-for-server.ts +24 -0
- package/src/version.ts +1 -1
- package/tsconfig.json +3 -1
- package/dist/esm/commands/app/command.js.map +0 -1
- package/dist/esm/commands/app/eval.js.map +0 -1
- package/dist/esm/commands/app/format.js +0 -93
- package/dist/esm/commands/app/format.js.map +0 -1
- package/dist/esm/commands/app/login.js.map +0 -1
- package/dist/esm/commands/app/prompts/execute-step.prompt.js.map +0 -1
- package/dist/esm/commands/app/prompts/judge.prompt.js.map +0 -1
- package/dist/esm/commands/app/prompts/plan.prompt.js.map +0 -1
- package/dist/esm/commands/app/prompts/step.prompt.js.map +0 -1
- package/dist/esm/commands/app/prompts/system.dev-server.prompt.js.map +0 -1
- package/dist/esm/commands/app/prompts/system.prompt.js.map +0 -1
- package/dist/esm/commands/app/server.js.map +0 -1
- package/dist/esm/commands/app/session-logger.js.map +0 -1
- package/dist/esm/commands/app/tools/click.js.map +0 -1
- package/dist/esm/commands/app/tools/errors.js.map +0 -1
- package/dist/esm/commands/app/tools/eval-js.js.map +0 -1
- package/dist/esm/commands/app/tools/fill.js.map +0 -1
- package/dist/esm/commands/app/tools/find.js.map +0 -1
- package/dist/esm/commands/app/tools/get-styles.js.map +0 -1
- package/dist/esm/commands/app/tools/get-url.js.map +0 -1
- package/dist/esm/commands/app/tools/go-back.js.map +0 -1
- package/dist/esm/commands/app/tools/hover.js.map +0 -1
- package/dist/esm/commands/app/tools/navigate.js.map +0 -1
- package/dist/esm/commands/app/tools/press-key.js.map +0 -1
- package/dist/esm/commands/app/tools/read-file.js.map +0 -1
- package/dist/esm/commands/app/tools/registry.js.map +0 -1
- package/dist/esm/commands/app/tools/reload.js.map +0 -1
- package/dist/esm/commands/app/tools/screenshot.js.map +0 -1
- package/dist/esm/commands/app/tools/scroll.js.map +0 -1
- package/dist/esm/commands/app/tools/select.js.map +0 -1
- package/dist/esm/commands/app/tools/snapshot.js.map +0 -1
- package/dist/esm/commands/app/tools/type-text.js.map +0 -1
- package/dist/esm/commands/app/tools/wait.js.map +0 -1
- package/dist/esm/commands/app/tools/write-file.js.map +0 -1
- package/dist/esm/eval-resolve.js +0 -83
- package/dist/esm/eval-resolve.js.map +0 -1
- package/dist/esm/utils/agent-browser.js.map +0 -1
- package/dist/esm/utils/browser-poll.js.map +0 -1
- package/dist/esm/utils/daemon.js.map +0 -1
- package/dist/esm/utils/process.js.map +0 -1
- package/dist/esm/utils/server.js +0 -65
- package/dist/esm/utils/server.js.map +0 -1
- package/dist/types/commands/app/format.d.ts +0 -14
- package/dist/types/commands/app/tools/write-file.d.ts +0 -19
- package/dist/types/utils/server.d.ts +0 -26
- package/src/commands/app/format.ts +0 -110
- package/src/eval-resolve.ts +0 -113
- package/src/utils/server.ts +0 -66
- /package/dist/types/commands/app/{session-logger.d.ts → attach-session-logger.d.ts} +0 -0
- /package/dist/types/commands/app/{eval.d.ts → create-session.d.ts} +0 -0
- /package/dist/types/commands/app/prompts/{system.dev-server.prompt.d.ts → create-dev-server-context.d.ts} +0 -0
- /package/dist/types/commands/app/prompts/{execute-step.prompt.d.ts → create-execute-step-prompt.d.ts} +0 -0
- /package/dist/types/commands/app/prompts/{judge.prompt.d.ts → create-judge-prompt.d.ts} +0 -0
- /package/dist/types/commands/app/prompts/{plan.prompt.d.ts → create-plan-prompt.d.ts} +0 -0
- /package/dist/types/commands/app/prompts/{system.prompt.d.ts → create-system-prompt.d.ts} +0 -0
- /package/dist/types/commands/app/{login.d.ts → run-login.d.ts} +0 -0
- /package/dist/types/commands/app/{server.d.ts → start-app-server.d.ts} +0 -0
- /package/dist/types/commands/app/tools/{registry.d.ts → AgentBrowserToolRegistry.d.ts} +0 -0
- /package/dist/types/utils/{browser-poll.d.ts → poll-console.d.ts} +0 -0
- /package/src/commands/app/prompts/{system.dev-server.prompt.ts → create-dev-server-context.ts} +0 -0
- /package/src/commands/app/prompts/{execute-step.prompt.ts → create-execute-step-prompt.ts} +0 -0
- /package/src/commands/app/prompts/{plan.prompt.ts → create-plan-prompt.ts} +0 -0
- /package/src/commands/app/prompts/{system.prompt.ts → create-system-prompt.ts} +0 -0
- /package/src/commands/app/tools/{registry.ts → AgentBrowserToolRegistry.ts} +0 -0
- /package/src/commands/app/tools/{click.ts → create-click-tool.ts} +0 -0
- /package/src/commands/app/tools/{errors.ts → create-errors-tool.ts} +0 -0
- /package/src/commands/app/tools/{eval-js.ts → create-eval-js-tool.ts} +0 -0
- /package/src/commands/app/tools/{fill.ts → create-fill-tool.ts} +0 -0
- /package/src/commands/app/tools/{get-styles.ts → create-get-styles-tool.ts} +0 -0
- /package/src/commands/app/tools/{get-url.ts → create-get-url-tool.ts} +0 -0
- /package/src/commands/app/tools/{go-back.ts → create-go-back-tool.ts} +0 -0
- /package/src/commands/app/tools/{hover.ts → create-hover-tool.ts} +0 -0
- /package/src/commands/app/tools/{navigate.ts → create-navigate-tool.ts} +0 -0
- /package/src/commands/app/tools/{press-key.ts → create-press-key-tool.ts} +0 -0
- /package/src/commands/app/tools/{reload.ts → create-reload-tool.ts} +0 -0
- /package/src/commands/app/tools/{select.ts → create-select-tool.ts} +0 -0
- /package/src/commands/app/tools/{snapshot.ts → create-snapshot-tool.ts} +0 -0
- /package/src/commands/app/tools/{type-text.ts → create-type-text-tool.ts} +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Plan } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a structured plan as a human-readable summary.
|
|
4
|
+
*
|
|
5
|
+
* @param plan - The plan to render, containing a summary and ordered steps.
|
|
6
|
+
* @returns A multi-line string suitable for console output.
|
|
7
|
+
*/
|
|
8
|
+
export declare function formatPlan(plan: Plan): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StepResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a single step execution result.
|
|
4
|
+
*
|
|
5
|
+
* @param result - The step result to render, including its outcome, note, and evidence.
|
|
6
|
+
* @returns A formatted two-line string describing the step outcome.
|
|
7
|
+
*/
|
|
8
|
+
export declare function formatStepResult(result: StepResult): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Verdict } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Renders the final verdict as a full-width coloured report.
|
|
4
|
+
*
|
|
5
|
+
* @param verdict - The verdict to render, including per-step results, reasoning, and UX feedback.
|
|
6
|
+
* @returns A multi-line string suitable for console output.
|
|
7
|
+
*/
|
|
8
|
+
export declare function formatVerdict(verdict: Verdict): string;
|
|
@@ -9,4 +9,4 @@ import type { PlanStep, RuntimeExecutionContext } from '../types.js';
|
|
|
9
9
|
* @param ctx - Runtime context with output directory and app URL
|
|
10
10
|
* @returns The fully interpolated prompt string
|
|
11
11
|
*/
|
|
12
|
-
export declare const createStepPrompt: (step: PlanStep,
|
|
12
|
+
export declare const createStepPrompt: (step: PlanStep, _ctx: RuntimeExecutionContext) => string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders a status glyph for a step or verdict outcome.
|
|
3
|
+
*
|
|
4
|
+
* @param ok - Outcome value: `true` (pass), `false` (fail), or a string label
|
|
5
|
+
* such as `'blocked'` or `'flaky'` for anything in between.
|
|
6
|
+
* @returns A single coloured glyph representing the outcome.
|
|
7
|
+
*/
|
|
8
|
+
export declare function statusIcon(ok: boolean | string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DefineTool } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the append-file tool so the agent can append lines
|
|
4
|
+
* to artifacts like executions.jsonl.
|
|
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 appending to a file
|
|
9
|
+
*/
|
|
10
|
+
export declare function createAppendFileTool(baseDir: string, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -6,4 +6,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
6
6
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
7
|
* @returns Copilot tool definition for clicking a page element
|
|
8
8
|
*/
|
|
9
|
-
export declare function createClickTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
9
|
+
export declare function createClickTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -6,4 +6,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
6
6
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
7
|
* @returns Copilot tool definition for retrieving JavaScript errors
|
|
8
8
|
*/
|
|
9
|
-
export declare function createErrorsTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
9
|
+
export declare function createErrorsTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -10,4 +10,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
10
10
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
11
11
|
* @returns Copilot tool definition for evaluating arbitrary JavaScript in the browser
|
|
12
12
|
*/
|
|
13
|
-
export declare function createEvalJsTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
13
|
+
export declare function createEvalJsTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -6,4 +6,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
6
6
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
7
|
* @returns Copilot tool definition for filling input fields
|
|
8
8
|
*/
|
|
9
|
-
export declare function createFillTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
9
|
+
export declare function createFillTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -6,4 +6,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
6
6
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
7
|
* @returns Copilot tool definition for semantic element lookup and optional action execution
|
|
8
8
|
*/
|
|
9
|
-
export declare function createFindTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
9
|
+
export declare function createFindTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -10,4 +10,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
10
10
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
11
11
|
* @returns Copilot tool definition for retrieving computed CSS style properties
|
|
12
12
|
*/
|
|
13
|
-
export declare function createGetStylesTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
13
|
+
export declare function createGetStylesTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -6,4 +6,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
6
6
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
7
|
* @returns Copilot tool definition for retrieving the current page URL
|
|
8
8
|
*/
|
|
9
|
-
export declare function createGetUrlTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
9
|
+
export declare function createGetUrlTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -6,4 +6,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
6
6
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
7
|
* @returns Copilot tool definition for going back in browser history
|
|
8
8
|
*/
|
|
9
|
-
export declare function createGoBackTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
9
|
+
export declare function createGoBackTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -6,4 +6,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
6
6
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
7
|
* @returns Copilot tool definition for hovering a page element
|
|
8
8
|
*/
|
|
9
|
-
export declare function createHoverTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
9
|
+
export declare function createHoverTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -6,4 +6,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
6
6
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
7
|
* @returns Copilot tool definition for opening a URL
|
|
8
8
|
*/
|
|
9
|
-
export declare function createNavigateTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
9
|
+
export declare function createNavigateTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -6,4 +6,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
6
6
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
7
|
* @returns Copilot tool definition for pressing a single key
|
|
8
8
|
*/
|
|
9
|
-
export declare function createPressKeyTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
9
|
+
export declare function createPressKeyTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -10,4 +10,4 @@ import type { DefineTool } from './types.js';
|
|
|
10
10
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
11
11
|
* @returns Copilot tool definition for reading evidence files
|
|
12
12
|
*/
|
|
13
|
-
export declare function createReadFileTool(baseDir: string, defineTool: DefineTool): import("
|
|
13
|
+
export declare function createReadFileTool(baseDir: string, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -6,4 +6,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
6
6
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
7
|
* @returns Copilot tool definition for reloading the current page
|
|
8
8
|
*/
|
|
9
|
-
export declare function createReloadTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
9
|
+
export declare function createReloadTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -6,4 +6,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
6
6
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
7
|
* @returns Copilot tool definition for saving an image screenshot and returning it to the model
|
|
8
8
|
*/
|
|
9
|
-
export declare function createScreenshotTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
9
|
+
export declare function createScreenshotTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -6,4 +6,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
6
6
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
7
|
* @returns Copilot tool definition for page scrolling or scrolling an element into view
|
|
8
8
|
*/
|
|
9
|
-
export declare function createScrollTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
9
|
+
export declare function createScrollTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -6,4 +6,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
6
6
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
7
|
* @returns Copilot tool definition for choosing an option in a select element
|
|
8
8
|
*/
|
|
9
|
-
export declare function createSelectTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
9
|
+
export declare function createSelectTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -6,4 +6,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
6
6
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
7
|
* @returns Copilot tool definition for capturing the current page snapshot
|
|
8
8
|
*/
|
|
9
|
-
export declare function createSnapshotTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
9
|
+
export declare function createSnapshotTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -6,4 +6,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
6
6
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
7
|
* @returns Copilot tool definition for typing text into the focused element or a target
|
|
8
8
|
*/
|
|
9
|
-
export declare function createTypeTextTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
9
|
+
export declare function createTypeTextTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -6,4 +6,4 @@ import type { AgentBrowserToolContext, DefineTool } from './types.js';
|
|
|
6
6
|
* @param defineTool - Copilot SDK helper used to declare tools
|
|
7
7
|
* @returns Copilot tool definition for waiting on load state, text, elements, or time
|
|
8
8
|
*/
|
|
9
|
-
export declare function createWaitTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("
|
|
9
|
+
export declare function createWaitTool(context: AgentBrowserToolContext, defineTool: DefineTool): import("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -0,0 +1,10 @@
|
|
|
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("node_modules/@github/copilot-sdk/dist/types.js").Tool<unknown>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Truncates a string to a maximum length, appending an ellipsis when cut.
|
|
3
|
+
*
|
|
4
|
+
* @param str - The string to truncate.
|
|
5
|
+
* @param max - Maximum length of the returned string, including the ellipsis.
|
|
6
|
+
* @returns The original string, or a shortened version ending in `…`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function truncate(str: string, max: number): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attempts to detect the JSON shape of an assistant message and format it.
|
|
3
|
+
*
|
|
4
|
+
* Returns `null` when the content is not a recognised structure, so the
|
|
5
|
+
* caller can fall back to plain-text rendering.
|
|
6
|
+
*
|
|
7
|
+
* @param content - Raw assistant message content, expected to be a JSON string.
|
|
8
|
+
* @returns A formatted string for a recognised plan, step result, or verdict, or `null` otherwise.
|
|
9
|
+
*/
|
|
10
|
+
export declare function tryFormatMessage(content: string): string | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prints a CLI resolution error and exits the current process.
|
|
3
|
+
*
|
|
4
|
+
* @param message - Primary error message.
|
|
5
|
+
* @param detail - Optional follow-up detail shown on the next line.
|
|
6
|
+
* @returns This function never returns because the process exits.
|
|
7
|
+
*/
|
|
8
|
+
export declare function exitWithResolutionError(message: string, detail?: string): never;
|
|
@@ -21,11 +21,3 @@ export interface EvalCommandInput {
|
|
|
21
21
|
* @returns Normalized application path and optional direct eval file path.
|
|
22
22
|
*/
|
|
23
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,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves eval markdown files for a Fusion application.
|
|
3
|
+
*
|
|
4
|
+
* @param appPath - Path to the Fusion application directory
|
|
5
|
+
* @param evalOpt - Value of the `--eval` CLI option (name, path, or `undefined`)
|
|
6
|
+
* @returns Array of absolute paths to eval markdown files
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveEvalFiles(appPath: string, evalOpt?: string): string[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts the user-facing error message from an agent-browser failure.
|
|
3
|
+
*
|
|
4
|
+
* Strips ANSI escape codes from stderr and returns only the diagnostic
|
|
5
|
+
* lines prefixed with `✗` or `⚠`. Falls back to the first 200 characters
|
|
6
|
+
* of the error message when no diagnostic lines are found.
|
|
7
|
+
*
|
|
8
|
+
* @param err - The caught error (typically from {@link ab})
|
|
9
|
+
* @returns A single-line summary suitable for console output
|
|
10
|
+
*/
|
|
11
|
+
export declare function abErrorMessage(err: unknown): string;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/** Persistent Chrome profile directory used across agent-browser sessions. */
|
|
2
|
-
export declare const PROFILE_DIR: string;
|
|
3
1
|
/**
|
|
4
2
|
* Runs an agent-browser command with the persistent Chrome profile.
|
|
5
3
|
*
|
|
@@ -13,14 +11,3 @@ export declare const PROFILE_DIR: string;
|
|
|
13
11
|
* @throws {Error} When `agent-browser` exits with a non-zero code or times out
|
|
14
12
|
*/
|
|
15
13
|
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,8 @@
|
|
|
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;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { ChildProcess } from 'node:child_process';
|
|
2
|
-
/**
|
|
3
|
-
|
|
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;
|
|
2
|
+
/** Persistent Chrome profile directory used across agent-browser sessions. */
|
|
3
|
+
export declare const PROFILE_DIR: string;
|
|
8
4
|
/**
|
|
9
5
|
* Returns a promise that resolves after the given delay.
|
|
10
6
|
*
|
|
@@ -19,3 +15,14 @@ export declare function sleep(ms: number): Promise<void>;
|
|
|
19
15
|
* @returns The input string with all ANSI escape sequences removed
|
|
20
16
|
*/
|
|
21
17
|
export declare function stripAnsi(s: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Sends `SIGTERM` to a child process if it is still running.
|
|
20
|
+
*
|
|
21
|
+
* @param proc - The child process to terminate (no-op when `undefined` or already killed)
|
|
22
|
+
*/
|
|
23
|
+
export declare function cleanup(proc?: ChildProcess): void;
|
|
24
|
+
/**
|
|
25
|
+
* Clears the MSAL `interaction.status` flag from `sessionStorage` in the
|
|
26
|
+
* running browser via `agent-browser eval`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function clearMsalInteraction(): void;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
export { ab
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
1
|
+
export { ab } from './ab.js';
|
|
2
|
+
export { abErrorMessage } from './ab-error-message.js';
|
|
3
|
+
export { PROFILE_DIR, sleep, stripAnsi, cleanup, clearMsalInteraction } from './helpers.js';
|
|
4
|
+
export { resetDaemon } from './reset-daemon.js';
|
|
5
|
+
export { createRunDir } from './create-run-dir.js';
|
|
6
|
+
export { resolveAppKey } from './resolve-app-key.js';
|
|
7
|
+
export { waitForServer } from './wait-for-server.js';
|
|
8
|
+
export { pollConsole } from './poll-console.js';
|
|
@@ -9,8 +9,3 @@
|
|
|
9
9
|
* 4. Delete Session Storage to clear stuck MSAL `interaction.status` flags
|
|
10
10
|
*/
|
|
11
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,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the Fusion `appKey` by running `ffc app manifest --silent`
|
|
3
|
+
* in the given application directory and parsing the JSON output.
|
|
4
|
+
*
|
|
5
|
+
* @param appDir - Absolute path to the Fusion application
|
|
6
|
+
* @returns The `appKey` string from the manifest
|
|
7
|
+
* @throws {Error} When `ffc app manifest` fails or returns invalid JSON
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveAppKey(appDir: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Polls a server URL until it responds with a non-5xx status or the
|
|
3
|
+
* timeout is reached.
|
|
4
|
+
*
|
|
5
|
+
* @param url - The URL to poll (e.g. `http://localhost:3000`)
|
|
6
|
+
* @param timeoutSeconds - Maximum number of seconds to wait
|
|
7
|
+
* @returns `true` if the server responded before timeout, `false` otherwise
|
|
8
|
+
*/
|
|
9
|
+
export declare function waitForServer(url: string, timeoutSeconds: number): Promise<boolean>;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.0.
|
|
1
|
+
export declare const version = "2.0.3";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-cli-plugin-copilot",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Copilot SDK powered evaluation plugin for Fusion Framework CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
"directory": "packages/cli-plugins/copilot"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@github/copilot-sdk": "^0.
|
|
40
|
+
"@github/copilot-sdk": "^1.0.0",
|
|
41
41
|
"chalk": "^5.6.2",
|
|
42
|
-
"commander": "^
|
|
42
|
+
"commander": "^15.0.0",
|
|
43
43
|
"ora": "^9.3.0",
|
|
44
44
|
"rxjs": "^7.8.2"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@equinor/fusion-framework-cli": "^15.
|
|
47
|
+
"@equinor/fusion-framework-cli": "^15.2.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"typescript": "^
|
|
51
|
-
"@equinor/fusion-framework-cli": "^15.
|
|
50
|
+
"typescript": "^7.0.2",
|
|
51
|
+
"@equinor/fusion-framework-cli": "^15.2.1"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"build": "tsc -b",
|
|
@@ -3,7 +3,7 @@ import ora from 'ora';
|
|
|
3
3
|
|
|
4
4
|
import type { CopilotSession } from '@github/copilot-sdk';
|
|
5
5
|
|
|
6
|
-
import { tryFormatMessage } from './format.js';
|
|
6
|
+
import { tryFormatMessage } from './try-format-message.js';
|
|
7
7
|
|
|
8
8
|
const TOOL_ICONS: Record<string, string> = {
|
|
9
9
|
browser_screenshot: '📷',
|
|
@@ -31,7 +31,9 @@ export function attachSessionLogger(
|
|
|
31
31
|
let spinner: ReturnType<typeof ora> | null = null;
|
|
32
32
|
|
|
33
33
|
function syncSpinner(): void {
|
|
34
|
+
// No pending tools means the spinner has nothing left to show
|
|
34
35
|
if (pendingTools.size === 0) {
|
|
36
|
+
// Stop the spinner only if one was actually running
|
|
35
37
|
if (spinner) {
|
|
36
38
|
spinner.stop();
|
|
37
39
|
spinner = null;
|
|
@@ -39,6 +41,7 @@ export function attachSessionLogger(
|
|
|
39
41
|
return;
|
|
40
42
|
}
|
|
41
43
|
const text = [...pendingTools.values()].join(chalk.dim(' | '));
|
|
44
|
+
// Reuse the existing spinner instance rather than starting a second one
|
|
42
45
|
if (spinner) {
|
|
43
46
|
spinner.text = text;
|
|
44
47
|
} else {
|
|
@@ -47,6 +50,7 @@ export function attachSessionLogger(
|
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
function pauseSpinner(): void {
|
|
53
|
+
// Only stop the spinner if one is actually running
|
|
50
54
|
if (spinner) {
|
|
51
55
|
spinner.stop();
|
|
52
56
|
spinner = null;
|
|
@@ -61,6 +65,7 @@ export function attachSessionLogger(
|
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
session.on((event) => {
|
|
68
|
+
// Dispatch on the Copilot SDK session event type to render the right log line
|
|
64
69
|
switch (event.type) {
|
|
65
70
|
case 'tool.execution_start': {
|
|
66
71
|
const { toolCallId, toolName, arguments: args } = event.data;
|
|
@@ -74,6 +79,7 @@ export function attachSessionLogger(
|
|
|
74
79
|
}
|
|
75
80
|
case 'tool.execution_complete': {
|
|
76
81
|
const label = pendingTools.get(event.data.toolCallId);
|
|
82
|
+
// Only log completion for tools we actually tracked the start of
|
|
77
83
|
if (label) {
|
|
78
84
|
pendingTools.delete(event.data.toolCallId);
|
|
79
85
|
logCompletion(label, event.data.success);
|
|
@@ -82,6 +88,7 @@ export function attachSessionLogger(
|
|
|
82
88
|
}
|
|
83
89
|
case 'external_tool.completed': {
|
|
84
90
|
const label = pendingTools.get(event.data.requestId);
|
|
91
|
+
// Only log completion for tools we actually tracked the start of
|
|
85
92
|
if (label) {
|
|
86
93
|
pendingTools.delete(event.data.requestId);
|
|
87
94
|
logCompletion(label, true);
|
|
@@ -95,9 +102,11 @@ export function attachSessionLogger(
|
|
|
95
102
|
break;
|
|
96
103
|
}
|
|
97
104
|
case 'assistant.message': {
|
|
105
|
+
// Skip empty assistant messages (e.g. tool-only turns)
|
|
98
106
|
if (event.data.content) {
|
|
99
107
|
pauseSpinner();
|
|
100
108
|
const formatted = tryFormatMessage(event.data.content);
|
|
109
|
+
// Prefer the structured plan/verdict/step-result rendering when recognised
|
|
101
110
|
if (formatted) {
|
|
102
111
|
console.log(formatted);
|
|
103
112
|
} else {
|
|
@@ -119,6 +128,7 @@ export function attachSessionLogger(
|
|
|
119
128
|
}
|
|
120
129
|
case 'permission.completed': {
|
|
121
130
|
const label = pendingTools.get(event.data.requestId);
|
|
131
|
+
// Only log completion for permissions we actually tracked the request of
|
|
122
132
|
if (label) {
|
|
123
133
|
const approved = event.data.result?.kind === 'approved';
|
|
124
134
|
pendingTools.delete(event.data.requestId);
|
|
@@ -128,8 +138,10 @@ export function attachSessionLogger(
|
|
|
128
138
|
}
|
|
129
139
|
case 'session.tools_updated': {
|
|
130
140
|
const negotiatedModel = event.data.model as string | undefined;
|
|
141
|
+
// Only log tooling info once the server has actually negotiated a model
|
|
131
142
|
if (negotiatedModel) {
|
|
132
143
|
console.log(chalk.dim(`💾 ${negotiatedModel}`));
|
|
144
|
+
// Warn the user when the server picked a different model than requested
|
|
133
145
|
if (options?.requestedModel && negotiatedModel !== options.requestedModel) {
|
|
134
146
|
console.log(
|
|
135
147
|
chalk.yellow(
|
|
@@ -157,6 +169,7 @@ export function attachSessionLogger(
|
|
|
157
169
|
}
|
|
158
170
|
case 'session.info': {
|
|
159
171
|
const { message } = event.data as { message?: string };
|
|
172
|
+
// Skip empty info events
|
|
160
173
|
if (message) {
|
|
161
174
|
pauseSpinner();
|
|
162
175
|
console.log(chalk.dim(`ℹ️ ${message}`));
|
|
@@ -166,6 +179,7 @@ export function attachSessionLogger(
|
|
|
166
179
|
}
|
|
167
180
|
case 'assistant.intent': {
|
|
168
181
|
const { intent } = event.data as { intent?: string };
|
|
182
|
+
// Skip empty intent events
|
|
169
183
|
if (intent) {
|
|
170
184
|
pauseSpinner();
|
|
171
185
|
console.log(chalk.yellow(`🎯 ${intent}`));
|