tamash-playwright 0.7.0-beta.7 → 0.8.0-beta.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.

Potentially problematic release.


This version of tamash-playwright might be problematic. Click here for more details.

package/.env.example CHANGED
@@ -1,9 +1,12 @@
1
1
  # Master on/off switch for self-healing. Unset or anything other than false/0 leaves it on.
2
2
  HEALER_ENABLED=true
3
3
 
4
- # Which AI provider backs self-healing: ollama | openai | anthropic | gemini
4
+ # Which AI provider backs self-healing: ollama | openai | anthropic | gemini | claude-subscription | copilot-subscription
5
5
  # Unset, unknown, or a provider whose key/model below is missing disables self-healing —
6
6
  # a failed action just fails normally, since there's no AI model configured to recover it.
7
+ # claude-subscription/copilot-subscription don't need an API key at all — they use an existing
8
+ # Claude/GitHub Copilot subscription login instead. See the sections near the bottom of this file
9
+ # for setup.
7
10
  HEALER_PROVIDER=ollama
8
11
 
9
12
  # Optional, off by default. If a locator gets healed but the action on it still fails (e.g. the
@@ -29,3 +32,18 @@ OLLAMA_API_KEY=
29
32
  # GEMINI_MODEL= # check https://ai.google.dev/gemini-api/docs/models for the current model id
30
33
  # GEMINI_API_KEY=
31
34
  # GEMINI_BASE_URL=https://generativelanguage.googleapis.com/v1beta/openai
35
+
36
+ # --- Claude subscription (no API key — uses your existing Claude Pro/Max/Team/Enterprise subscription) ---
37
+ # Requires: npm install @anthropic-ai/claude-agent-sdk
38
+ # Locally: run `claude login` once — no other setup needed.
39
+ # In CI: run `claude setup-token` once to mint a 12-month token, then set it as a CI secret below.
40
+ # CLAUDE_SUBSCRIPTION_MODEL=haiku
41
+ # CLAUDE_CODE_OAUTH_TOKEN=
42
+
43
+ # --- GitHub Copilot subscription (no API key — uses your existing Copilot subscription or free tier) ---
44
+ # Requires: npm install @github/copilot-sdk, and the `copilot` CLI installed and authenticated.
45
+ # Locally: sign in with the `copilot` CLI once — no other setup needed.
46
+ # In GitHub Actions CI: no secret needed — add `permissions: { copilot-requests: write }` to the
47
+ # workflow job and the ambient GITHUB_TOKEN is used automatically.
48
+ # In other CI systems: set GITHUB_TOKEN to a PAT with the "Copilot Requests" scope.
49
+ # COPILOT_SUBSCRIPTION_MODEL=mai-code-1-flash-picker
package/README.md CHANGED
@@ -30,7 +30,7 @@ npm install -D @playwright/test
30
30
 
31
31
  ## Step 2: Connect an AI model
32
32
 
33
- `tamash-playwright` needs an AI model to decide where a broken element actually went. Pick one of Ollama, OpenAI, Anthropic (Claude), or Google Gemini, and give it an API key.
33
+ `tamash-playwright` needs an AI model to decide where a broken element actually went. Pick one of Ollama, OpenAI, Anthropic (Claude), or Google Gemini, and give it an API key — or, if you don't have an API key but do have a Claude or GitHub Copilot subscription, use that instead (see below).
34
34
 
35
35
  Create a file named `.env` in your project folder:
36
36
 
@@ -38,7 +38,7 @@ Create a file named `.env` in your project folder:
38
38
  # Master on/off switch. Leave this as true, or remove the line entirely.
39
39
  HEALER_ENABLED=true
40
40
 
41
- # Pick one: ollama | openai | anthropic | gemini
41
+ # Pick one: ollama | openai | anthropic | gemini | claude-subscription | copilot-subscription
42
42
  HEALER_PROVIDER=ollama
43
43
 
44
44
  # Optional, off by default — see "Action recovery" below.
@@ -59,6 +59,13 @@ OLLAMA_API_KEY=
59
59
  # --- Google Gemini ---
60
60
  # GEMINI_MODEL=
61
61
  # GEMINI_API_KEY=
62
+
63
+ # --- Claude subscription (no API key — uses your Claude subscription) ---
64
+ # CLAUDE_SUBSCRIPTION_MODEL=haiku
65
+ # CLAUDE_CODE_OAUTH_TOKEN=
66
+
67
+ # --- GitHub Copilot subscription (no API key — uses your Copilot subscription/free tier) ---
68
+ # COPILOT_SUBSCRIPTION_MODEL=mai-code-1-flash-picker
62
69
  ```
63
70
 
64
71
  Just fill in the API key and model for whichever one you want to use, and leave the rest as-is (or delete them).
@@ -81,6 +88,51 @@ OLLAMA_API_KEY=paste_your_key_here
81
88
 
82
89
  That's all you need — no other variables required.
83
90
 
91
+ ### Using your Claude or GitHub Copilot subscription instead of an API key
92
+
93
+ If you don't have an API key issued to you but do have a personal Claude (Pro/Max/Team/Enterprise) or GitHub Copilot subscription (including the free tier), you can use that instead — no billing setup, no key to paste anywhere.
94
+
95
+ **Claude subscription** — works both locally and unattended in CI:
96
+
97
+ ```sh
98
+ npm install @anthropic-ai/claude-agent-sdk
99
+ claude login # one-time, locally
100
+ ```
101
+
102
+ ```sh
103
+ HEALER_PROVIDER=claude-subscription
104
+ CLAUDE_SUBSCRIPTION_MODEL=haiku
105
+ ```
106
+
107
+ For CI, generate a long-lived token once (`claude setup-token`) and set it as a secret instead of logging in interactively:
108
+
109
+ ```sh
110
+ CLAUDE_CODE_OAUTH_TOKEN=the-token-you-copied
111
+ ```
112
+
113
+ **GitHub Copilot subscription** — works locally, and unattended in GitHub Actions specifically:
114
+
115
+ ```sh
116
+ npm install @github/copilot-sdk
117
+ copilot # sign in once, locally
118
+ ```
119
+
120
+ ```sh
121
+ HEALER_PROVIDER=copilot-subscription
122
+ COPILOT_SUBSCRIPTION_MODEL=mai-code-1-flash-picker
123
+ ```
124
+
125
+ In a GitHub Actions workflow, no secret is needed at all — just grant the job permission to use it:
126
+
127
+ ```yaml
128
+ permissions:
129
+ copilot-requests: write
130
+ ```
131
+
132
+ Outside GitHub Actions, set `GITHUB_TOKEN` to a personal access token with the "Copilot Requests" scope instead.
133
+
134
+ **One thing worth knowing**: only Claude and Copilot support this "subscription, no API key, works in CI too" combination — a ChatGPT or Google AI subscription can back local runs the same way (via those vendors' own CLIs), but neither vendor currently offers a way to use that subscription unattended in CI, so CI there still needs a plain API key (the existing `openai`/`gemini` providers above).
135
+
84
136
  ### Important: set `actionTimeout` in your `playwright.config.ts`
85
137
 
86
138
  By default, Playwright lets a broken locator retry silently for your *entire* test timeout before it ever throws an error — which means self-healing never gets a turn at all, since it only kicks in once an action actually fails. Set `actionTimeout` to something well below your test timeout so a broken locator fails fast, leaving real time for healing to run:
@@ -179,6 +231,7 @@ Everything below applies identically in both places — same package, same behav
179
231
  | **Healing** | Runs automatically on every `npx playwright test`, using the `.env` file from Step 2. | Runs automatically the same way — set the same variables as CI secrets/environment variables on your test job instead of a `.env` file (there's a real example in [Running `apply-heals` in CI](#running-apply-heals-in-ci-sharded-or-not)). |
180
232
  | **Caching** ([below](#not-paying-for-the-same-heal-twice)) | Persists on disk across every run — a real, ongoing saving the longer you keep working. | Only helps *within* one run — most runners start from a fresh checkout each time, so it doesn't carry over between separate CI runs. `apply-heals` landing the real fix is what actually stops repeat AI calls in CI, not the cache. |
181
233
  | **`apply-heals`** ([below](#making-a-heal-permanent-apply-heals)) | Run manually whenever you want, preview with `--dry-run`, review the diff yourself, commit when ready. | Runs automatically after your test job and opens a PR for review — nothing ever auto-commits to your branch. |
234
+ | **Provider choice** | Any provider works, including `claude-subscription`/`copilot-subscription` off a personal subscription with no API key. | Only `ollama`/`openai`/`anthropic`/`gemini` (a real API key), `claude-subscription` (a `CLAUDE_CODE_OAUTH_TOKEN`), or `copilot-subscription` on GitHub Actions actually run unattended — a `claude-subscription`/`copilot-subscription` config that relies on a local interactive login won't authenticate in CI. See [above](#using-your-claude-or-github-copilot-subscription-instead-of-an-api-key). |
182
235
 
183
236
  ## What else it heals — no extra setup needed
184
237
 
@@ -208,7 +261,7 @@ Not every healed selector is equally durable. One with a real id, test id, or ac
208
261
 
209
262
  ## When text alone isn't enough: vision fallback
210
263
 
211
- Sometimes an element has nothing useful to match on by text — an icon-only button with no label, or several visually distinct elements that all look identical in the accessibility tree. If your configured model supports image input (e.g. `gpt-4o`, `claude-haiku-4-5`, `gemini-2.0-flash`), `tamash-playwright` automatically falls back to a screenshot-based search after the normal text-based attempt fails — no separate setup, it just uses the same provider and API key from Step 2. Run `npx tamash-playwright doctor` to check whether your configured model is expected to support this.
264
+ Sometimes an element has nothing useful to match on by text — an icon-only button with no label, or several visually distinct elements that all look identical in the accessibility tree. If your configured model supports image input (e.g. `gpt-4o`, `claude-haiku-4-5`, `gemini-3.6-flash`), `tamash-playwright` automatically falls back to a screenshot-based search after the normal text-based attempt fails — no separate setup, it just uses the same provider and API key from Step 2. Run `npx tamash-playwright doctor` to check whether your configured model is expected to support this.
212
265
 
213
266
  ## Action recovery (optional)
214
267
 
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AAqJA,wBAAsB,SAAS,CAAC,IAAI,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBlE"}
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AAuJA,wBAAsB,SAAS,CAAC,IAAI,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBlE"}
@@ -32,7 +32,9 @@ async function checkProviderConnectivity() {
32
32
  if (!providerName) {
33
33
  console.log('[WARN] HEALER_PROVIDER is not set. No AI provider is configured, so self-healing will never');
34
34
  console.log(' recover a failed action — it will just fail normally.');
35
- console.log(' Set HEALER_PROVIDER (ollama | openai | anthropic | gemini) plus its API key/model in .env.');
35
+ console.log(' Set HEALER_PROVIDER (ollama | openai | anthropic | gemini | claude-subscription |');
36
+ console.log(' copilot-subscription) plus its API key/model (or, for claude-subscription/');
37
+ console.log(' copilot-subscription, a subscription login) in .env.');
36
38
  return;
37
39
  }
38
40
  const provider = (0, providers_1.getHealProvider)();
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,oDAA4B;AAC5B,mDAAsD;AACtD,sCAAsE;AACtE,iDAA2E;AAC3E,2DAAyD;AAEzD,gBAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;AAE7D,MAAM,uBAAuB,GAAG,KAAK,CAAC;AACtC,MAAM,qBAA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AC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,IAAI,OAAO,CAAC;IACrE,OAAO,CAAC,GAAG,CAAC,YAAY,WAAW,kBAAkB,CAAC,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,8EAA8E,CAAC,CAAC;IAE5F,MAAM,WAAW,GAAG,IAAA,gCAAiB,EAAC,OAAO,CAAC,CAAC;IAC/C,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAChC,oBAAoB,CAAC,WAAW,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { HealProvider } from './types';
2
+ export declare function createClaudeCliProvider(): HealProvider;
3
+ //# sourceMappingURL=claude-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-cli.d.ts","sourceRoot":"","sources":["../../../src/healer/providers/claude-cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,YAAY,EAAsH,MAAM,SAAS,CAAC;AAqFpL,wBAAgB,uBAAuB,IAAI,YAAY,CAmDtD"}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createClaudeCliProvider = createClaudeCliProvider;
4
+ const prompt_1 = require("./prompt");
5
+ // Fallback only — normally overridden by SuggestSelectorInput.timeoutMs, same as the other providers.
6
+ const REQUEST_TIMEOUT_MS = 15000;
7
+ // @anthropic-ai/claude-agent-sdk is a peer dependency (optional — see package.json), not installed
8
+ // by default, so it's only ever loaded lazily inside a try/catch. It's also ESM-only ("type":
9
+ // "module", no "require" export condition) — but this project compiles to CommonJS (tsconfig
10
+ // "module": "commonjs"), and under that setting tsc silently downlevels a plain `await
11
+ // import(...)` into a deferred `require(...)`, which throws ERR_REQUIRE_ESM against an ESM-only
12
+ // package at runtime (confirmed by inspecting the compiled dist/ output). Loading it through
13
+ // `new Function(...)` hides the import() call from tsc's static rewrite — it stays a real,
14
+ // unmodified dynamic import at runtime, which is the only way to load an ESM-only package from a
15
+ // CommonJS module in Node.
16
+ const importClaudeAgentSdk = new Function('specifier', 'return import(specifier)');
17
+ function warnUnavailable(reason, error) {
18
+ const err = error;
19
+ const notInstalled = err?.code === 'ERR_MODULE_NOT_FOUND' || err?.code === 'MODULE_NOT_FOUND';
20
+ if (notInstalled) {
21
+ console.warn(`[self-healer] claude-cli: @anthropic-ai/claude-agent-sdk is not installed — run \`npm install @anthropic-ai/claude-agent-sdk\` to use it, or use HEALER_PROVIDER=anthropic + ANTHROPIC_API_KEY instead.`);
22
+ return;
23
+ }
24
+ console.warn(`[self-healer] claude-cli: ${reason} — not authenticated? Run \`claude login\`, or for CI set CLAUDE_CODE_OAUTH_TOKEN (see \`claude setup-token\`), or use HEALER_PROVIDER=anthropic + ANTHROPIC_API_KEY instead.`);
25
+ }
26
+ // A fresh query() call per invocation (own AbortController, no shared session) — the provider is a
27
+ // module-level singleton (see providers/index.ts) that can be called concurrently, so nothing here
28
+ // may hold state across calls.
29
+ async function runQuery(model, systemPrompt, prompt, timeoutMs) {
30
+ const { query } = await importClaudeAgentSdk('@anthropic-ai/claude-agent-sdk');
31
+ const controller = new AbortController();
32
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
33
+ try {
34
+ for await (const message of query({
35
+ prompt,
36
+ options: {
37
+ model,
38
+ maxTurns: 1,
39
+ tools: [],
40
+ permissionMode: 'bypassPermissions',
41
+ systemPrompt,
42
+ abortController: controller,
43
+ },
44
+ })) {
45
+ if (message.type === 'result') {
46
+ if (message.subtype !== 'success') {
47
+ return null;
48
+ }
49
+ return {
50
+ text: message.result,
51
+ inputTokens: message.usage?.input_tokens,
52
+ outputTokens: message.usage?.output_tokens,
53
+ };
54
+ }
55
+ }
56
+ return null;
57
+ }
58
+ finally {
59
+ clearTimeout(timer);
60
+ }
61
+ }
62
+ function toUsage(result) {
63
+ const { inputTokens, outputTokens } = result;
64
+ if (inputTokens === undefined || outputTokens === undefined) {
65
+ return undefined;
66
+ }
67
+ return { inputTokens, outputTokens, totalTokens: inputTokens + outputTokens };
68
+ }
69
+ // Unlike the API-key providers (anthropic.ts, etc.), this one always returns a provider object —
70
+ // there's no env var to check synchronously, since auth is either an existing `claude login`
71
+ // session or CLAUDE_CODE_OAUTH_TOKEN, both of which can only be verified by actually trying a call.
72
+ // Failure is deferred to each method call below, matching the existing swallow-and-return-null
73
+ // contract every other provider already follows.
74
+ function createClaudeCliProvider() {
75
+ const model = process.env.CLAUDE_CLI_MODEL ?? 'haiku';
76
+ return {
77
+ name: `claude-cli:${model}`,
78
+ // Neither SDK's one-shot `prompt: string` path has a confirmed image-input shape suited to
79
+ // this package's "return pixel coordinates" vision task — safer not to attempt it than guess.
80
+ supportsVision: false,
81
+ async suggestSelector(input) {
82
+ try {
83
+ const result = await runQuery(model, prompt_1.SYSTEM_PROMPT, (0, prompt_1.buildUserPrompt)(input), input.timeoutMs ?? REQUEST_TIMEOUT_MS);
84
+ if (!result) {
85
+ return null;
86
+ }
87
+ const suggestion = (0, prompt_1.parseSuggestion)(result.text);
88
+ if (!suggestion) {
89
+ return null;
90
+ }
91
+ return { suggestion, usage: toUsage(result) };
92
+ }
93
+ catch (error) {
94
+ const reason = error instanceof Error ? error.message : String(error);
95
+ warnUnavailable(reason, error);
96
+ return null;
97
+ }
98
+ },
99
+ async suggestSelectorFromImage(_input) {
100
+ return null;
101
+ },
102
+ async suggestActionTactic(input) {
103
+ try {
104
+ const result = await runQuery(model, prompt_1.ACTION_RECOVERY_SYSTEM_PROMPT, (0, prompt_1.buildActionRecoveryUserPrompt)(input), input.timeoutMs ?? REQUEST_TIMEOUT_MS);
105
+ if (!result) {
106
+ return null;
107
+ }
108
+ const tactic = (0, prompt_1.parseActionTacticSuggestion)(result.text);
109
+ if (!tactic) {
110
+ return null;
111
+ }
112
+ return { tactic, usage: toUsage(result) };
113
+ }
114
+ catch (error) {
115
+ const reason = error instanceof Error ? error.message : String(error);
116
+ warnUnavailable(reason, error);
117
+ return null;
118
+ }
119
+ },
120
+ };
121
+ }
122
+ //# sourceMappingURL=claude-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-cli.js","sourceRoot":"","sources":["../../../src/healer/providers/claude-cli.ts"],"names":[],"mappings":";;;AACA,qCAAsK;AAEtK,sGAAsG;AACtG,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAEjC,mGAAmG;AACnG,8FAA8F;AAC9F,6FAA6F;AAC7F,uFAAuF;AACvF,gGAAgG;AAChG,6FAA6F;AAC7F,2FAA2F;AAC3F,iGAAiG;AACjG,2BAA2B;AAC3B,MAAM,oBAAoB,GAAG,IAAI,QAAQ,CAAC,WAAW,EAAE,0BAA0B,CAEpB,CAAC;AAE9D,SAAS,eAAe,CAAC,MAAc,EAAE,KAAc;IACrD,MAAM,GAAG,GAAG,KAA8B,CAAC;IAC3C,MAAM,YAAY,GAAG,GAAG,EAAE,IAAI,KAAK,sBAAsB,IAAI,GAAG,EAAE,IAAI,KAAK,kBAAkB,CAAC;IAC9F,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,CACV,yMAAyM,CAC1M,CAAC;QACF,OAAO;IACT,CAAC;IACD,OAAO,CAAC,IAAI,CACV,6BAA6B,MAAM,+KAA+K,CACnN,CAAC;AACJ,CAAC;AAID,mGAAmG;AACnG,mGAAmG;AACnG,+BAA+B;AAC/B,KAAK,UAAU,QAAQ,CAAC,KAAa,EAAE,YAAoB,EAAE,MAAc,EAAE,SAAiB;IAC5F,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,oBAAoB,CAAC,gCAAgC,CAAC,CAAC;IAC/E,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,SAAS,CAAC,CAAC;IAE9D,IAAI,CAAC;QACH,IAAI,KAAK,EAAE,MAAM,OAAO,IAAI,KAAK,CAAC;YAChC,MAAM;YACN,OAAO,EAAE;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AO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC5C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACtE,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;gBAC/B,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { HealProvider } from './types';
2
+ export declare function createClaudeSubscriptionProvider(): HealProvider;
3
+ //# sourceMappingURL=claude-subscription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-subscription.d.ts","sourceRoot":"","sources":["../../../src/healer/providers/claude-subscription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,YAAY,EAAsH,MAAM,SAAS,CAAC;AAqFpL,wBAAgB,gCAAgC,IAAI,YAAY,CAmD/D"}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createClaudeSubscriptionProvider = createClaudeSubscriptionProvider;
4
+ const prompt_1 = require("./prompt");
5
+ // Fallback only — normally overridden by SuggestSelectorInput.timeoutMs, same as the other providers.
6
+ const REQUEST_TIMEOUT_MS = 15000;
7
+ // @anthropic-ai/claude-agent-sdk is a peer dependency (optional — see package.json), not installed
8
+ // by default, so it's only ever loaded lazily inside a try/catch. It's also ESM-only ("type":
9
+ // "module", no "require" export condition) — but this project compiles to CommonJS (tsconfig
10
+ // "module": "commonjs"), and under that setting tsc silently downlevels a plain `await
11
+ // import(...)` into a deferred `require(...)`, which throws ERR_REQUIRE_ESM against an ESM-only
12
+ // package at runtime (confirmed by inspecting the compiled dist/ output). Loading it through
13
+ // `new Function(...)` hides the import() call from tsc's static rewrite — it stays a real,
14
+ // unmodified dynamic import at runtime, which is the only way to load an ESM-only package from a
15
+ // CommonJS module in Node.
16
+ const importClaudeAgentSdk = new Function('specifier', 'return import(specifier)');
17
+ function warnUnavailable(reason, error) {
18
+ const err = error;
19
+ const notInstalled = err?.code === 'ERR_MODULE_NOT_FOUND' || err?.code === 'MODULE_NOT_FOUND';
20
+ if (notInstalled) {
21
+ console.warn(`[self-healer] claude-subscription: @anthropic-ai/claude-agent-sdk is not installed — run \`npm install @anthropic-ai/claude-agent-sdk\` to use it, or use HEALER_PROVIDER=anthropic + ANTHROPIC_API_KEY instead.`);
22
+ return;
23
+ }
24
+ console.warn(`[self-healer] claude-subscription: ${reason} — not authenticated? Run \`claude login\`, or for CI set CLAUDE_CODE_OAUTH_TOKEN (see \`claude setup-token\`), or use HEALER_PROVIDER=anthropic + ANTHROPIC_API_KEY instead.`);
25
+ }
26
+ // A fresh query() call per invocation (own AbortController, no shared session) — the provider is a
27
+ // module-level singleton (see providers/index.ts) that can be called concurrently, so nothing here
28
+ // may hold state across calls.
29
+ async function runQuery(model, systemPrompt, prompt, timeoutMs) {
30
+ const { query } = await importClaudeAgentSdk('@anthropic-ai/claude-agent-sdk');
31
+ const controller = new AbortController();
32
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
33
+ try {
34
+ for await (const message of query({
35
+ prompt,
36
+ options: {
37
+ model,
38
+ maxTurns: 1,
39
+ tools: [],
40
+ permissionMode: 'bypassPermissions',
41
+ systemPrompt,
42
+ abortController: controller,
43
+ },
44
+ })) {
45
+ if (message.type === 'result') {
46
+ if (message.subtype !== 'success') {
47
+ return null;
48
+ }
49
+ return {
50
+ text: message.result,
51
+ inputTokens: message.usage?.input_tokens,
52
+ outputTokens: message.usage?.output_tokens,
53
+ };
54
+ }
55
+ }
56
+ return null;
57
+ }
58
+ finally {
59
+ clearTimeout(timer);
60
+ }
61
+ }
62
+ function toUsage(result) {
63
+ const { inputTokens, outputTokens } = result;
64
+ if (inputTokens === undefined || outputTokens === undefined) {
65
+ return undefined;
66
+ }
67
+ return { inputTokens, outputTokens, totalTokens: inputTokens + outputTokens };
68
+ }
69
+ // Unlike the API-key providers (anthropic.ts, etc.), this one always returns a provider object —
70
+ // there's no env var to check synchronously, since auth is either an existing `claude login`
71
+ // session or CLAUDE_CODE_OAUTH_TOKEN, both of which can only be verified by actually trying a call.
72
+ // Failure is deferred to each method call below, matching the existing swallow-and-return-null
73
+ // contract every other provider already follows.
74
+ function createClaudeSubscriptionProvider() {
75
+ const model = process.env.CLAUDE_SUBSCRIPTION_MODEL ?? 'haiku';
76
+ return {
77
+ name: `claude-subscription:${model}`,
78
+ // Neither SDK's one-shot `prompt: string` path has a confirmed image-input shape suited to
79
+ // this package's "return pixel coordinates" vision task — safer not to attempt it than guess.
80
+ supportsVision: false,
81
+ async suggestSelector(input) {
82
+ try {
83
+ const result = await runQuery(model, prompt_1.SYSTEM_PROMPT, (0, prompt_1.buildUserPrompt)(input), input.timeoutMs ?? REQUEST_TIMEOUT_MS);
84
+ if (!result) {
85
+ return null;
86
+ }
87
+ const suggestion = (0, prompt_1.parseSuggestion)(result.text);
88
+ if (!suggestion) {
89
+ return null;
90
+ }
91
+ return { suggestion, usage: toUsage(result) };
92
+ }
93
+ catch (error) {
94
+ const reason = error instanceof Error ? error.message : String(error);
95
+ warnUnavailable(reason, error);
96
+ return null;
97
+ }
98
+ },
99
+ async suggestSelectorFromImage(_input) {
100
+ return null;
101
+ },
102
+ async suggestActionTactic(input) {
103
+ try {
104
+ const result = await runQuery(model, prompt_1.ACTION_RECOVERY_SYSTEM_PROMPT, (0, prompt_1.buildActionRecoveryUserPrompt)(input), input.timeoutMs ?? REQUEST_TIMEOUT_MS);
105
+ if (!result) {
106
+ return null;
107
+ }
108
+ const tactic = (0, prompt_1.parseActionTacticSuggestion)(result.text);
109
+ if (!tactic) {
110
+ return null;
111
+ }
112
+ return { tactic, usage: toUsage(result) };
113
+ }
114
+ catch (error) {
115
+ const reason = error instanceof Error ? error.message : String(error);
116
+ warnUnavailable(reason, error);
117
+ return null;
118
+ }
119
+ },
120
+ };
121
+ }
122
+ //# sourceMappingURL=claude-subscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-subscription.js","sourceRoot":"","sources":["../../../src/healer/providers/claude-subscription.ts"],"names":[],"mappings":";;;AACA,qCAAsK;AAEtK,sGAAsG;AACtG,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAEjC,mGAAmG;AACnG,8FAA8F;AAC9F,6FAA6F;AAC7F,uFAAuF;AACvF,gGAAgG;AAChG,6FAA6F;AAC7F,2FAA2F;AAC3F,iGAAiG;AACjG,2BAA2B;AAC3B,MAAM,oBAAoB,GAAG,IAAI,QAAQ,CAAC,WAAW,EAAE,0BAA0B,CAEpB,CAAC;AAE9D,SAAS,eAAe,CAAC,MAAc,EAAE,KAAc;IACrD,MAAM,GAAG,GAAG,KAA8B,CAAC;IAC3C,MAAM,YAAY,GAAG,GAAG,EAAE,IAAI,KAAK,sBAAsB,IAAI,GAAG,EAAE,IAAI,KAAK,kBAAkB,CAAC;IAC9F,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,CACV,kNAAkN,CACnN,CAAC;QACF,OAAO;IACT,CAAC;IACD,OAAO,CAAC,IAAI,CACV,sCAAsC,MAAM,+KAA+K,CAC5N,CAAC;AACJ,CAAC;AAID,mGAAmG;AACnG,mGAAmG;AACnG,+BAA+B;AAC/B,KAAK,UAAU,QAAQ,CAAC,KAAa,EAAE,YAAoB,EAAE,MAAc,EAAE,SAAiB;IAC5F,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,oBAAoB,CAAC,gCAAgC,CAAC,CAAC;IAC/E,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,SAAS,CAAC,CAAC;IAE9D,IAAI,CAAC;QACH,IAAI,KAAK,EAAE,MAAM,OAAO,IAAI,KAAK,CAAC;YAChC,MAAM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AAE,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC5C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACtE,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;gBAC/B,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { HealProvider } from './types';
2
+ export declare function createCopilotCliProvider(): HealProvider;
3
+ //# sourceMappingURL=copilot-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-cli.d.ts","sourceRoot":"","sources":["../../../src/healer/providers/copilot-cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,YAAY,EAAsH,MAAM,SAAS,CAAC;AAsEpL,wBAAgB,wBAAwB,IAAI,YAAY,CAuDvD"}
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCopilotCliProvider = createCopilotCliProvider;
4
+ const prompt_1 = require("./prompt");
5
+ // Fallback only — normally overridden by SuggestSelectorInput.timeoutMs, same as the other providers.
6
+ const REQUEST_TIMEOUT_MS = 15000;
7
+ // @github/copilot-sdk is a peer dependency (optional — see package.json), not installed by default,
8
+ // so it's only ever loaded lazily inside a try/catch. Unlike the Claude Agent SDK, this package
9
+ // ships both CJS and ESM builds, so a plain require() resolves correctly from this CJS package.
10
+ function warnUnavailable(reason, error) {
11
+ const err = error;
12
+ const notInstalled = err?.code === 'MODULE_NOT_FOUND';
13
+ if (notInstalled) {
14
+ console.warn(`[self-healer] copilot-cli: @github/copilot-sdk is not installed — run \`npm install @github/copilot-sdk\` to use it, or use HEALER_PROVIDER=openai/anthropic/gemini + an API key instead.`);
15
+ return;
16
+ }
17
+ console.warn(`[self-healer] copilot-cli: ${reason} — not authenticated? Install and sign in with the \`copilot\` CLI locally, or for CI set GITHUB_TOKEN (with a "copilot-requests: write" workflow permission on GitHub Actions, or a PAT with "Copilot Requests" scope elsewhere), or use HEALER_PROVIDER=openai/anthropic/gemini + an API key instead.`);
18
+ }
19
+ // A fresh CopilotClient (and its underlying `copilot` CLI subprocess) is started and stopped per
20
+ // call, matching the "no shared state across concurrent calls" requirement — the provider is a
21
+ // module-level singleton (see providers/index.ts) that can be invoked concurrently. A shared,
22
+ // lazily-started client reusing sessions per call would avoid the repeated subprocess-spawn cost
23
+ // and is architecturally supported by the SDK, but isn't implemented here to avoid taking on
24
+ // subprocess-lifecycle management (leftover child processes, retry-after-failure semantics)
25
+ // without a concrete need yet.
26
+ async function sendMessage(model, systemPrompt, prompt, timeoutMs) {
27
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
28
+ const { CopilotClient } = require('@github/copilot-sdk');
29
+ const client = new CopilotClient();
30
+ try {
31
+ await client.start();
32
+ // availableTools: [] keeps this a pure text completion — no tool/file access during a heal
33
+ // call. Deliberately not wiring up onPermissionRequest (e.g. approveAll): with no tools
34
+ // available, none should ever fire, and auto-approving tool calls would be a real security
35
+ // regression for something that can run unattended in CI.
36
+ const session = await client.createSession({ model, availableTools: [] });
37
+ const response = await session.sendAndWait({ prompt: `${systemPrompt}\n\n${prompt}` }, timeoutMs);
38
+ const content = response?.data.content;
39
+ if (!content) {
40
+ return null;
41
+ }
42
+ return { content, outputTokens: response?.data.outputTokens };
43
+ }
44
+ finally {
45
+ try {
46
+ await client.stop();
47
+ }
48
+ catch {
49
+ // Best-effort cleanup — nothing useful to do if the client can't be stopped cleanly.
50
+ }
51
+ }
52
+ }
53
+ function toUsage(result) {
54
+ // The Copilot SDK's assistant.message event only exposes an output-token count, no input/prompt
55
+ // tokens — inputTokens/totalTokens stay undefined, which TokenUsage already allows.
56
+ return result.outputTokens === undefined ? undefined : { outputTokens: result.outputTokens };
57
+ }
58
+ // Unlike the API-key providers (openai.ts, etc.), this one always returns a provider object —
59
+ // there's no env var to check synchronously, since auth is either an existing `copilot` CLI login
60
+ // or an ambient GITHUB_TOKEN, both of which can only be verified by actually trying a call. Failure
61
+ // is deferred to each method call below, matching the existing swallow-and-return-null contract
62
+ // every other provider already follows.
63
+ function createCopilotCliProvider() {
64
+ // MAI-Code-1-Flash (Microsoft's own coding model, available on every Copilot tier including
65
+ // free) by default — cheap and fast, which fits this package's narrow selector-suggestion task
66
+ // well, and matches defaulting claude-cli to Haiku for the same reason. Override with
67
+ // COPILOT_CLI_MODEL for a different model (e.g. the newer MAI-Code-1.1-Flash).
68
+ const model = process.env.COPILOT_CLI_MODEL ?? 'MAI-Code-1-Flash';
69
+ return {
70
+ name: `copilot-cli:${model}`,
71
+ // Neither SDK's one-shot completion path has a confirmed image-input shape suited to this
72
+ // package's "return pixel coordinates" vision task — safer not to attempt it than guess.
73
+ supportsVision: false,
74
+ async suggestSelector(input) {
75
+ try {
76
+ const result = await sendMessage(model, prompt_1.SYSTEM_PROMPT, (0, prompt_1.buildUserPrompt)(input), input.timeoutMs ?? REQUEST_TIMEOUT_MS);
77
+ if (!result) {
78
+ return null;
79
+ }
80
+ const suggestion = (0, prompt_1.parseSuggestion)(result.content);
81
+ if (!suggestion) {
82
+ return null;
83
+ }
84
+ return { suggestion, usage: toUsage(result) };
85
+ }
86
+ catch (error) {
87
+ const reason = error instanceof Error ? error.message : String(error);
88
+ warnUnavailable(reason, error);
89
+ return null;
90
+ }
91
+ },
92
+ async suggestSelectorFromImage(_input) {
93
+ return null;
94
+ },
95
+ async suggestActionTactic(input) {
96
+ try {
97
+ const result = await sendMessage(model, prompt_1.ACTION_RECOVERY_SYSTEM_PROMPT, (0, prompt_1.buildActionRecoveryUserPrompt)(input), input.timeoutMs ?? REQUEST_TIMEOUT_MS);
98
+ if (!result) {
99
+ return null;
100
+ }
101
+ const tactic = (0, prompt_1.parseActionTacticSuggestion)(result.content);
102
+ if (!tactic) {
103
+ return null;
104
+ }
105
+ return { tactic, usage: toUsage(result) };
106
+ }
107
+ catch (error) {
108
+ const reason = error instanceof Error ? error.message : String(error);
109
+ warnUnavailable(reason, error);
110
+ return null;
111
+ }
112
+ },
113
+ };
114
+ }
115
+ //# sourceMappingURL=copilot-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-cli.js","sourceRoot":"","sources":["../../../src/healer/providers/copilot-cli.ts"],"names":[],"mappings":";;;AACA,qCAAsK;AAEtK,sGAAsG;AACtG,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAEjC,oGAAoG;AACpG,gGAAgG;AAChG,gGAAgG;AAChG,SAAS,eAAe,CAAC,MAAc,EAAE,KAAc;IACrD,MAAM,GAAG,GAAG,KAA8B,CAAC;IAC3C,MAAM,YAAY,GAAG,GAAG,EAAE,IAAI,KAAK,kBAAkB,CAAC;IACtD,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,CACV,2LAA2L,CAC5L,CAAC;QACF,OAAO;IACT,CAAC;IACD,OAAO,CAAC,IAAI,CACV,8BAA8B,MAAM,ySAAyS,CAC9U,CAAC;AACJ,CAAC;AAID,iGAAiG;AACjG,+FAA+F;AAC/F,8FAA8F;AAC9F,iGAAiG;AACjG,6FAA6F;AAC7F,4FAA4F;AAC5F,+BAA+B;AAC/B,KAAK,UAAU,WAAW,CAAC,KAAa,EAAE,YAAoB,EAAE,MAAc,EAAE,SAAiB;IAC/F,8DAA8D;IAC9D,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAyC,CAAC;IACjG,MAAM,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;IAEnC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,2FAA2F;QAC3F,wFAAwF;QACxF,2FAA2F;QAC3F,0DAA0D;QAC1D,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,EAAE,KAAK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AAE,CAAC;gBACf,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACtE,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;gBAC/B,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { HealProvider } from './types';
2
+ export declare function createCopilotSubscriptionProvider(): HealProvider;
3
+ //# sourceMappingURL=copilot-subscription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-subscription.d.ts","sourceRoot":"","sources":["../../../src/healer/providers/copilot-subscription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,YAAY,EAAsH,MAAM,SAAS,CAAC;AAsEpL,wBAAgB,iCAAiC,IAAI,YAAY,CA0DhE"}