@assertrx/dino 1.0.1 → 1.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/README.md CHANGED
@@ -321,8 +321,9 @@ npm install -g @earendil-works/pi-coding-agent
321
321
  # 2. Install Dino via pi
322
322
  pi install npm:@assertrx/dino --approve
323
323
 
324
- # 3. Set API key
324
+ # 3. Set an API key (any supported provider works)
325
325
  export ANTHROPIC_API_KEY=sk-ant-...
326
+ # e.g. for OpenAI instead: export OPENAI_API_KEY=sk-...
326
327
 
327
328
  # 4. Start the server
328
329
  node ~/.pi/agent/npm/node_modules/@assertrx/dino/scripts/api-server.mjs
@@ -333,13 +334,35 @@ node ~/.pi/agent/npm/node_modules/@assertrx/dino/scripts/api-server.mjs
333
334
  | Method | Path | Description |
334
335
  |--------|------|-------------|
335
336
  | `GET` | `/api/health` | Health check |
337
+ | `GET` | `/api/providers` | List all providers with auth status and model counts |
338
+ | `GET` | `/api/models` | List models available with current credentials (`?provider=<id>` to filter) |
339
+ | `POST` | `/api/models` | List models for given credentials — body accepts `provider`+`apiKey` or `apiKeys` (validates the key and unlocks that provider's catalog) |
336
340
  | `GET` | `/api/prompts` | List all available prompts with parameters |
337
341
  | `GET` | `/api/prompts/:name` | Get raw markdown content of a prompt |
338
342
  | `POST` | `/api/prompts/:name` | **Execute** a prompt via the pi agent |
339
343
 
344
+ ### Providers, models & API keys
345
+
346
+ The server supports every pi provider (Anthropic, OpenAI, Google, DeepSeek, Groq, Mistral, xAI, OpenRouter, and many more). Credentials can come from three places, in this order of precedence:
347
+
348
+ 1. **Per-request keys** — pass `apiKeys` (a map of provider → key) or `apiKey` (+ optional `provider`) in the POST body. These keys are scoped to that single request's session.
349
+ 2. **Environment variables** — any provider's standard env var (e.g. `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`).
350
+ 3. **Stored credentials** — logins created via `pi /login` in `~/.pi/agent/auth.json`.
351
+
352
+ Use `GET /api/providers` to discover which providers are configured and `GET /api/models` to list models available to the server right now.
353
+
354
+ **Selecting a model:** pass `model` in the POST body as either `"provider/model-id"` (e.g. `"openai/gpt-5.2"`) or `{ "provider": "openai", "id": "gpt-5.2" }`. Without `model`, the session uses the default model resolution (configured provider defaults). Requesting a model whose provider has no credentials returns a clear error.
355
+
340
356
  ### Prompt execution endpoints
341
357
 
342
- All POST bodies accept `apiKey` (optional, falls back to `ANTHROPIC_API_KEY` env var), `cwd` (workspace directory, defaults to current), and `stream` (default: `true` for SSE).
358
+ All POST bodies accept auth/model options, `cwd` (workspace directory, defaults to current), and `stream` (default: `true` for SSE):
359
+
360
+ | Body param | Description |
361
+ |------------|-------------|
362
+ | `apiKeys` | Map of provider → API key, e.g. `{"anthropic": "sk-...", "openai": "sk-..."}` |
363
+ | `apiKey` | Single API key. Pair with `provider` to target one explicitly; otherwise applied to the first available provider (anthropic fallback) |
364
+ | `provider` | Provider id (e.g. `"openai"`) to pair with a single `apiKey` |
365
+ | `model` | Model selection: `"provider/model-id"`, `"model-id"`, or `{"provider": ..., "id": ...}` |
343
366
 
344
367
  | Prompt name | Required params |
345
368
  |-------------|---------------|
@@ -357,14 +380,33 @@ All POST bodies accept `apiKey` (optional, falls back to `ANTHROPIC_API_KEY` env
357
380
  # List all prompts
358
381
  curl http://localhost:3000/api/prompts
359
382
 
360
- # Get prompt details
361
- curl http://localhost:3000/api/prompts/setup-playwright
383
+ # Discover providers and their auth status
384
+ curl http://localhost:3000/api/providers
385
+
386
+ # List models available to the server (optionally per provider)
387
+ curl http://localhost:3000/api/models
388
+ curl "http://localhost:3000/api/models?provider=anthropic"
362
389
 
363
- # Execute a prompt (SSE streaming)
390
+ # Execute a prompt (SSE streaming, auth from env vars)
364
391
  curl -X POST http://localhost:3000/api/prompts/setup-playwright \
365
392
  -H "Content-Type: application/json" \
366
393
  -d '{"cwd": "/path/to/workspace"}'
367
394
 
395
+ # Execute with a single provider key + model selection
396
+ # (env: export OPENAI_API_KEY=sk-... then:)
397
+ curl -X POST http://localhost:3000/api/prompts/setup-playwright \
398
+ -H "Content-Type: application/json" \
399
+ -d '{"cwd": "/path/to/workspace", "model": "openai/gpt-5.2"}'
400
+
401
+ # Execute with multiple per-request API keys and an explicit model
402
+ curl -X POST http://localhost:3000/api/prompts/setup-playwright \
403
+ -H "Content-Type: application/json" \
404
+ -d '{
405
+ "cwd": "/path/to/workspace",
406
+ "apiKeys": {"anthropic": "sk-ant-...", "openai": "sk-ov-..."},
407
+ "model": "anthropic/claude-sonnet-4-5"
408
+ }'
409
+
368
410
  # Execute with URL parameter (non-streaming JSON response)
369
411
  curl -X POST http://localhost:3000/api/prompts/generate-pom-from-url-cli \
370
412
  -H "Content-Type: application/json" \
@@ -399,5 +441,5 @@ event: error → {"message": "..."} # error
399
441
  |----------|---------|-------------|
400
442
  | `PORT` | `3000` | Server port |
401
443
  | `HOST` | `0.0.0.0` | Server host |
402
- | `ANTHROPIC_API_KEY` | — | API key (or pass `apiKey` in request body) |
444
+ | Provider env vars | — | Any provider's standard env var (e.g. `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`); per-request `apiKeys`/`apiKey` override these |
403
445
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assertrx/dino",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "A friendly purple dinosaur pi package with a custom TUI header, theme, and Playwright skills.",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -1,23 +1,22 @@
1
1
  ---
2
- description: Generate Playwright Page Object Models from a live URL using playwright-cli
2
+ description: Generate a Playwright Page Object Model for a single live URL using playwright-cli
3
3
  argument-hint: "<URL> [output-dir] [auth-env-file]"
4
4
  ---
5
5
 
6
- Use the `playwright-pom` skill and `playwright-cli` commands to generate Page Object Models from the website at $1.
6
+ Use the `playwright-pom` skill and `playwright-cli` commands to generate a Page Object Model for the single page at $1.
7
7
 
8
8
  Scope and rules:
9
- - Start at $1 and explore only pages on the same origin.
9
+ - Only generate a POM for the exact page at $1 — do not navigate to or explore any other pages.
10
10
  - Use `playwright-cli open <url>` to launch the browser. If `playwright-cli` is not on PATH, use `npx -p @playwright/cli playwright-cli open <url>` instead.
11
- - Use `playwright-cli snapshot` to capture the accessibility tree and element refs for each page.
12
- - Use `playwright-cli goto <url>` or `playwright-cli click <ref>` to navigate to additional pages.
13
- - Generate one focused page object per unique page or reusable component.
11
+ - Use `playwright-cli snapshot` to capture the accessibility tree and element refs for the page. Do not use `goto` or `click` to navigate to additional pages.
12
+ - Generate one page object for this page (plus small reusable component objects only if the page clearly contains distinct, reusable UI components).
14
13
  - Use resilient locators: `getByRole`, `getByLabel`, `getByTestId`, `getByPlaceholder`, `getByText` (in that order). Use CSS/XPath only as a last resort.
15
14
  - Each page object should expose high-level business methods (e.g., `loginAs(user)`, `searchFor(term)`) built from the low-level locators.
16
15
  - Keep selectors and URLs inside the page object; tests should read like user workflows.
17
16
  - Save generated files under `${2:-tests/pom/}` with clear, kebab-case names (e.g., `login-page.ts`).
18
17
  - Only target applications you own or have explicit authorization to test.
19
18
  - Do not interact with destructive actions (delete, remove, sign out) unless explicitly requested.
20
- - Stop after covering the main interactive pages; report which pages were generated and which were skipped.
19
+ - Report what was covered once the page object is complete.
21
20
 
22
21
  ## Authentication
23
22
 
@@ -42,7 +41,7 @@ If the site requires login, handle credentials securely:
42
41
  3. **Never** ask the user to paste credentials into the chat, and **never** hardcode credentials into generated files.
43
42
 
44
43
  After generating, summarize:
45
- - The pages and components covered
46
- - The output file paths
47
- - Any pages that could not be inspected and why
44
+ - The page (and any components) covered
45
+ - The output file path(s)
46
+ - Any parts of the page that could not be inspected and why
48
47
  - How authentication was handled (env file or manual)
@@ -1,21 +1,21 @@
1
1
  ---
2
- description: Generate Playwright Page Object Models from a live URL using the Playwright MCP bridge
2
+ description: Generate a Playwright Page Object Model for a single live URL using the Playwright MCP bridge
3
3
  argument-hint: "<URL> [output-dir] [auth-env-file]"
4
4
  ---
5
5
 
6
- Use the `playwright-pom` skill and the Playwright MCP `browser_*` tools to generate Page Object Models from the website at $1.
6
+ Use the `playwright-pom` skill and the Playwright MCP `browser_*` tools to generate a Page Object Model for the single page at $1.
7
7
 
8
8
  Scope and rules:
9
- - Start at $1 and explore only pages on the same origin.
10
- - Use `browser_navigate` to open each page and `browser_snapshot` to inspect the accessibility tree.
11
- - Generate one focused page object per unique page or reusable component.
9
+ - Only generate a POM for the exact page at $1 — do not navigate to or explore any other pages.
10
+ - Use `browser_navigate` to open the page and `browser_snapshot` to inspect the accessibility tree.
11
+ - Generate one page object for this page (plus small reusable component objects only if the page clearly contains distinct, reusable UI components).
12
12
  - Use resilient locators: `getByRole`, `getByLabel`, `getByTestId`, `getByPlaceholder`, `getByText` (in that order). Use CSS/XPath only as a last resort.
13
13
  - Each page object should expose high-level business methods (e.g., `loginAs(user)`, `searchFor(term)`) built from the low-level locators.
14
14
  - Keep implementation details (selectors, URLs) inside the page object; tests should read like user workflows.
15
15
  - Save the generated files under `${2:-tests/pom/}` using clear, kebab-case names (e.g., `login-page.ts`).
16
16
  - Only target applications you own or have explicit authorization to test.
17
17
  - Do not interact with destructive actions (delete, remove, sign out) unless explicitly requested.
18
- - Stop after covering the main interactive pages; report which pages were generated and which were skipped.
18
+ - Report what was covered once the page object is complete.
19
19
 
20
20
  ## Authentication
21
21
 
@@ -39,7 +39,7 @@ If the site requires login, handle credentials securely:
39
39
  3. **Never** ask the user to paste credentials into the chat, and **never** hardcode credentials into generated files.
40
40
 
41
41
  After generating, summarize:
42
- - The pages and components covered
43
- - The output file paths
44
- - Any pages that could not be inspected and why
42
+ - The page (and any components) covered
43
+ - The output file path(s)
44
+ - Any parts of the page that could not be inspected and why
45
45
  - How authentication was handled (env file or manual)
@@ -0,0 +1,2 @@
1
+ [ 14570ms] [WARNING] The powerPreference option is currently ignored when calling requestAdapter() on Windows. See https://crbug.com/369219127 @ :0
2
+ [ 18833ms] [WARNING] A speculation rule set was inserted into the document but will be ignored. This might happen, for example, if it was previously inserted into another document, or if it was created using the innerHTML setter. @ https://www.google.com/search?q=playwright+test+automation&sca_esv=b3cb815f54d8ec19&source=hp&ei=RICQav7gBoDm5NoPtYioaA&iflsig=ABILxe8AAAAAapCOVCQUd3OYJje-4_I4lPG-zQWogDP_&ved=0ahUKEwj-kr3JtsGWAxUAM1kFHTUECg0Q4dUDCDM&uact=5&oq=playwright+test+automation&gs_lp=Egdnd3Mtd2l6IhpwbGF5d3JpZ2h0IHRlc3QgYXV0b21hdGlvbkgNUABYAHAAeACQAQCYAQCgAQCqAQC4AQPIAQD4AQGYAgCgAgCYAwCSBwCgBwCyBwC4BwDCBwDIBwCACAE&sclient=gws-wiz&sei=UICQauzJI6it5NoPu7KviQ0:34
@@ -0,0 +1,52 @@
1
+ - generic [ref=e2]:
2
+ - navigation [ref=e3]:
3
+ - link "About" [ref=e4] [cursor=pointer]:
4
+ - /url: https://about.google/?fg=1&utm_source=google-US&utm_medium=referral&utm_campaign=hp-header
5
+ - link "Store" [ref=e5] [cursor=pointer]:
6
+ - /url: https://store.google.com/US?utm_source=hp_header&utm_medium=google_ooo&utm_campaign=GS100042&hl=en-US
7
+ - generic [ref=e7]:
8
+ - generic [ref=e8]:
9
+ - link "Gmail" [ref=e10] [cursor=pointer]:
10
+ - /url: https://mail.google.com/mail/&ogbl
11
+ - link "Search for Images" [ref=e12] [cursor=pointer]:
12
+ - /url: https://www.google.com/imghp?hl=en&ogbl
13
+ - text: Images
14
+ - button "Google apps" [ref=e15] [cursor=pointer]
15
+ - link "Sign in" [ref=e20] [cursor=pointer]:
16
+ - /url: https://accounts.google.com/ServiceLogin?hl=en&passive=true&continue=https://www.google.com/&ec=futura_exp_og_so_72776762_e
17
+ - generic [ref=e22]:
18
+ - link [ref=e24] [cursor=pointer]:
19
+ - /url: /search?sca_esv=b3cb815f54d8ec19&q=Which+National+Parks+have+some+of+the+most+scenic+overlooks%3F&udm=50&oi=ddle&noiga=1&ct=460148972&peek_pws=0&aep=84&sa=X&ved=0ahUKEwj-kr3JtsGWAxUAM1kFHTUECg0QPQgH
20
+ - img "Celebrating National Park Week at Yosemite" [ref=e26]
21
+ - button "Share" [ref=e28]
22
+ - search [ref=e36]:
23
+ - generic [ref=e38]:
24
+ - generic [ref=e40]:
25
+ - button "Add files and tools" [ref=e45] [cursor=pointer]
26
+ - combobox "Search" [active] [ref=e50]
27
+ - generic [ref=e51]:
28
+ - generic [ref=e52]:
29
+ - button "Search by voice" [ref=e55] [cursor=pointer]
30
+ - button "Search by image" [ref=e60] [cursor=pointer]
31
+ - link "AI Mode" [ref=e63] [cursor=pointer]
32
+ - generic [ref=e76]:
33
+ - button "Google Search" [ref=e77] [cursor=pointer]
34
+ - button "I'm Feeling Lucky" [ref=e78] [cursor=pointer]
35
+ - 'link "Celebrate National Park Week: Explore Yosemite with Google 🌲" [ref=e88] [cursor=pointer]'
36
+ - contentinfo [ref=e90]:
37
+ - generic [ref=e91]:
38
+ - generic [ref=e92]:
39
+ - link "Advertising" [ref=e93] [cursor=pointer]:
40
+ - /url: https://www.google.com/intl/en_us/ads/?subid=ww-ww-et-g-awa-a-g_hpafoot1_1!o2&utm_source=google.com&utm_medium=referral&utm_campaign=google_hpafooter&fg=1
41
+ - link "Business" [ref=e94] [cursor=pointer]:
42
+ - /url: https://www.google.com/services/?subid=ww-ww-et-g-awa-a-g_hpbfoot1_1!o2&utm_source=google.com&utm_medium=referral&utm_campaign=google_hpbfooter&fg=1
43
+ - link "How Search works" [ref=e95] [cursor=pointer]:
44
+ - /url: https://google.com/search/howsearchworks/?fg=1
45
+ - link "Build, create, and do more with AI tools from Google" [ref=e97] [cursor=pointer]:
46
+ - /url: https://ai.google/helpful-tools/?utm_source=googlehpfooter&utm_medium=housepromos&utm_campaign=bottom-footer
47
+ - generic [ref=e98]:
48
+ - link "Privacy" [ref=e99] [cursor=pointer]:
49
+ - /url: https://policies.google.com/privacy?hl=en&fg=1
50
+ - link "Terms" [ref=e100] [cursor=pointer]:
51
+ - /url: https://policies.google.com/terms?hl=en&fg=1
52
+ - button "Settings" [ref=e104] [cursor=pointer]