@sightmap/sightkick 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @sightmap/sightkick
2
2
 
3
- The **sightkick** CLI: compile a `webmcp.tools.yaml` + a sightmap `.sightmap/`
4
- corpus into WebMCP tool IR, and install the sightkick agent skills.
3
+ The **sightkick** CLI: compile a `.sightkick/` tool layer + a sightmap
4
+ `.sightmap/` corpus into WebMCP tool IR, and install the sightkick agent skills.
5
5
 
6
6
  Ships as a native binary (no Go toolchain required). `npm install` pulls in only
7
7
  the `@sightmap/sightkick-<os>-<arch>` package matching your platform; the
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sightmap/sightkick",
3
- "version": "0.3.0",
4
- "description": "sightkick — compile a webmcp.tools.yaml + sightmap corpus into WebMCP tool IR, and install the sightkick agent skills (native binary, no Go toolchain required)",
3
+ "version": "0.4.0",
4
+ "description": "sightkick — compile a .sightkick/ tool layer + sightmap corpus into WebMCP tool IR, and install the sightkick agent skills (native binary, no Go toolchain required)",
5
5
  "license": "MIT",
6
6
  "homepage": "https://sightmap.org",
7
7
  "repository": {
@@ -34,11 +34,11 @@
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@sightmap/sightkick-darwin-arm64": "0.3.0",
38
- "@sightmap/sightkick-darwin-x64": "0.3.0",
39
- "@sightmap/sightkick-linux-arm64": "0.3.0",
40
- "@sightmap/sightkick-linux-x64": "0.3.0",
41
- "@sightmap/sightkick-win32-arm64": "0.3.0",
42
- "@sightmap/sightkick-win32-x64": "0.3.0"
37
+ "@sightmap/sightkick-darwin-arm64": "0.4.0",
38
+ "@sightmap/sightkick-darwin-x64": "0.4.0",
39
+ "@sightmap/sightkick-linux-arm64": "0.4.0",
40
+ "@sightmap/sightkick-linux-x64": "0.4.0",
41
+ "@sightmap/sightkick-win32-arm64": "0.4.0",
42
+ "@sightmap/sightkick-win32-x64": "0.4.0"
43
43
  }
44
44
  }
@@ -1,20 +1,35 @@
1
1
  ---
2
2
  name: sightkick-authoring
3
- description: Author a webmcp.tools.yaml — the sightkick manifest that turns a sightmap corpus into named WebMCP tools (atomic view-scoped actions + guidance journeys), then compile it to IR with `sightkick build`. Use when you have (or are building) a `.sightmap/` corpus and want to define the tools an agent can call on that app. Pairs with sightmap-authoring (writes the corpus this reads) and sightkick-debug (runs the compiled tools on a live page).
3
+ description: Author a .sightkick/ tool layer — the sightkick manifest that turns a sightmap corpus into named WebMCP tools (atomic view-scoped actions + guidance journeys), then compile it to IR with `sightkick build`. Use when you have (or are building) a `.sightmap/` corpus and want to define the tools an agent can call on that app. Pairs with sightmap-authoring (writes the corpus this reads) and sightkick-debug (runs the compiled tools on a live page).
4
4
  activation:
5
5
  - a `.sightmap/` corpus exists (or is being authored) and you want to define WebMCP tools over it
6
- - writing or editing a `webmcp.tools.yaml`
6
+ - writing or editing a `.sightkick/` tool layer
7
7
  - a `sightkick build` reports unresolved component/property/view references
8
8
  ---
9
9
 
10
- # sightkick-authoring: write a webmcp.tools.yaml
10
+ # sightkick-authoring: write a .sightkick/ tool layer
11
11
 
12
12
  sightkick compiles two inputs into a self-contained **IR**: a `.sightmap/` corpus
13
13
  (the app's component map — authored with the **`sightmap-authoring`** skill) and a
14
- **`webmcp.tools.yaml`** manifest (the *tool layer*, authored here). `sightkick
15
- build` resolves every reference in the manifest against the corpus and reports
16
- unresolved ones with candidate lists. Once it compiles, drive the tools on a live
17
- page with the **`sightkick-debug`** skill.
14
+ **`.sightkick/`** tool layer (authored here). `sightkick build` resolves every
15
+ reference against the corpus and reports unresolved ones with candidate lists.
16
+ Once it compiles, drive the tools on a live page with the **`sightkick-debug`**
17
+ skill.
18
+
19
+ The two sit side by side in the app directory:
20
+
21
+ ```
22
+ <app>/
23
+ .sightmap/ # the corpus (components + views), read by sightkick
24
+ .sightkick/ # the tool layer, authored here
25
+ *.yaml # any number of files — all merged into one manifest
26
+ ```
27
+
28
+ `.sightkick/` mirrors `.sightmap/`: every `*.yaml` file inside is **merged** into
29
+ one manifest (tools and journeys concatenated), with **no dependencies** between
30
+ files — the whole directory is the manifest. Split a large tool layer however
31
+ helps (e.g. one file per view, plus a `journeys.yaml`); keep a tiny one in a
32
+ single `tools.yaml`.
18
33
 
19
34
  **Prerequisite:** the corpus must exist first — tools reference corpus
20
35
  **component names** and **declared properties**, so if a name/property isn't in
@@ -34,14 +49,22 @@ the corpus, author it there (sightmap-authoring) before referencing it here.
34
49
 
35
50
  ## File shape
36
51
 
52
+ Each `.sightkick/*.yaml` file may set any of these top-level keys; they're merged
53
+ across the directory:
54
+
37
55
  ```yaml
38
- version: 1 # required (must be 1)
39
- name: myapp # the IR name
40
- corpus: ./.sightmap # required — path to the corpus dir, relative to this file
41
- tools: [ ... ] # required, non-empty
56
+ version: 1 # optional (defaults to 1); set it once
57
+ name: myapp # optional — the IR name; defaults to the app dir's name
58
+ corpus: ../.sightmap # optional — path to the corpus, relative to .sightkick/;
59
+ # defaults to the sibling ../.sightmap
60
+ tools: [ ... ] # the tools (at least one across the whole directory)
42
61
  journeys: [ ... ] # optional
43
62
  ```
44
63
 
64
+ The singular fields (`version`/`name`/`corpus`) are taken from whichever file
65
+ sets them (a conflict warns); `tools` and `journeys` accumulate. Most apps set
66
+ `version`/`name` in the first file and never touch `corpus`.
67
+
45
68
  ## Tools
46
69
 
47
70
  ```yaml
@@ -136,10 +159,12 @@ anything — they only shape the breadcrumbs in results.
136
159
 
137
160
  ## Worked example (a task-list app)
138
161
 
162
+ One file, `.sightkick/tools.yaml` (no `corpus:` — it defaults to the sibling
163
+ `../.sightmap`). Split it across several `.sightkick/*.yaml` files once it grows.
164
+
139
165
  ```yaml
140
166
  version: 1
141
167
  name: tasks
142
- corpus: ./.sightmap
143
168
  tools:
144
169
  - name: list_tasks
145
170
  description: List the current tasks and whether each is done.
@@ -194,9 +219,9 @@ journeys:
194
219
  ## Build & fix
195
220
 
196
221
  ```sh
197
- sightkick build <DIR> -o /tmp/x.ir.json # <DIR> holds webmcp.tools.yaml + the corpus
198
- sightkick build <DIR> --verify # also checks returns extractors against captured
199
- # view snapshots; warns on fields empty on every row
222
+ sightkick build <APP_DIR> -o /tmp/x.ir.json # <APP_DIR> holds .sightkick/ + .sightmap/
223
+ sightkick build <APP_DIR> --verify # also checks returns extractors against captured
224
+ # view snapshots; warns on fields empty on every row
200
225
  ```
201
226
 
202
227
  The compiler is your validator. Common diagnostics and fixes:
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  name: sightkick-debug
3
- description: Drive and debug a generated sightkick WebMCP tool script on a live page via `sightmap browser`, with no bespoke sightkick extension. Use when you have a sightkick corpus + `webmcp.tools.yaml` (in the sightkick repo's `examples/` or a `sites/<name>/` dir) and want to inject its compiled tools into a running site and exercise them — either agent-driven (getTools/executeTool over `sightmap browser eval`) or Gemini-driven via the vendored WebMCP inspector.
3
+ description: Drive and debug a generated sightkick WebMCP tool script on a live page via `sightmap browser`, with no bespoke sightkick extension. Use when you have a sightkick `.sightkick/` tool layer + `.sightmap/` corpus (in the sightkick repo's `examples/` or a `sites/<name>/` dir) and want to inject its compiled tools into a running site and exercise them — either agent-driven (getTools/executeTool over `sightmap browser eval`) or Gemini-driven via the vendored WebMCP inspector.
4
4
  activation:
5
- - a sightkick `webmcp.tools.yaml` + `.sightmap/` corpus is present and you want to run its tools on a live page
5
+ - a sightkick `.sightkick/` tool layer + `.sightmap/` corpus is present and you want to run its tools on a live page
6
6
  - debugging why a generated WebMCP tool does/doesn't register or fire on a real site
7
7
  ---
8
8
 
9
9
  # sightkick-debug: run generated WebMCP tools on a live page
10
10
 
11
- sightkick compiles a `.sightmap/` corpus + a `webmcp.tools.yaml` into an **IR**,
11
+ sightkick compiles a `.sightmap/` corpus + a `.sightkick/` tool layer into an **IR**,
12
12
  and a ~19 KB runtime bundle turns that IR into WebMCP tools on
13
13
  `document.modelContext`. You do **not** need a bespoke extension to get them onto
14
14
  a page: `sightmap browser eval` injects the runtime bundle, then
@@ -29,14 +29,39 @@ sightmap browser install # Chrome-for-Testing; needs >=152 for n
29
29
 
30
30
  That installs the **`sightmap-browser`** skill (driving a live session) and
31
31
  **`sightmap-authoring`** skill (building the `.sightmap/` corpus) alongside this
32
- one — everything needed to build and test a `webmcp.tools.yaml`. No repo checkout
33
- is required; `<CORPUS_DIR>` below is any directory holding a `webmcp.tools.yaml`
32
+ one — everything needed to build and test a `.sightkick/` tool layer. No repo checkout
33
+ is required; `<CORPUS_DIR>` below is any directory holding a `.sightkick/` tool layer
34
34
  + `.sightmap/` corpus.
35
35
 
36
- To **write** the `webmcp.tools.yaml` (its tool/step/`returns`/`journeys` grammar),
36
+ To **write** the `.sightkick/` tool layer (its tool/step/`returns`/`journeys` grammar),
37
37
  see the **`sightkick-authoring`** skill — this skill assumes it already exists and
38
38
  compiles.
39
39
 
40
+ ## Quick start: `sightkick browser`
41
+
42
+ For the common case, one command does the whole setup — build the IR, start a
43
+ sightmap session, and persist-inject the runtime + tools:
44
+
45
+ ```sh
46
+ sightkick browser <CORPUS_DIR>
47
+ # auto-opens the corpus's home-view URL (or pass --url URL)
48
+ # --webmcp expose the native document.modelContext (adds the blink flags)
49
+ # --extensions P load an unpacked extension (e.g. a WebMCP inspector)
50
+ # --profile/--cdp-port/--chrome-flag passed through to sightmap
51
+ # --no-start inject into an already-running session (e.g. after editing the corpus)
52
+ ```
53
+
54
+ It runs sightmap from `<CORPUS_DIR>`, so the session lives in that dir's
55
+ `.sightmap/` — **drive it from there** (`cd <CORPUS_DIR> && sightmap browser
56
+ eval …`, see §4). The inject is **persisted**, so on SPA route changes (and, once
57
+ sightmap's persist re-injection lands, full navigations too) the tools
58
+ re-register automatically. Re-run `sightkick browser <CORPUS_DIR> --no-start`
59
+ after editing the corpus to refresh the injected IR.
60
+
61
+ The manual steps below (§1–§3) are the same thing unbundled — reach for them for
62
+ finer control, to understand what's happening, or when driving a site the wrapper
63
+ didn't start.
64
+
40
65
  ## 1. Build the two artifacts
41
66
 
42
67
  Both come straight from the installed `sightkick` CLI:
@@ -45,7 +70,7 @@ Both come straight from the installed `sightkick` CLI:
45
70
  # The payload: the runtime bundle (exposes window.__sightkick.load).
46
71
  sightkick runtime -o /tmp/sightkick-runtime.js
47
72
 
48
- # The IR for the corpus you're testing (any dir with webmcp.tools.yaml + .sightmap/).
73
+ # The IR for the corpus you're testing (any dir with .sightkick/ + .sightmap/).
49
74
  sightkick build <CORPUS_DIR> -o /tmp/x.ir.json
50
75
  ```
51
76
 
@@ -113,27 +138,45 @@ sleep 1; sightmap browser eval "window.__t" # -> ["tool_a","t
113
138
 
114
139
  ## 4. Drive the tools
115
140
 
116
- ### Mode A (agent/scripted): drive via `window.__sightkick.call`
117
- The **reliable** scripted entry point is `window.__sightkick.call(name, args)` it
118
- invokes a tool by name and resolves to the raw `ToolResult` directly, regardless
119
- of whether the page's `document.modelContext` is our polyfill or a native surface:
141
+ ### Mode A (agent/scripted): drive via `sightkick call`
142
+ The scripted entry point is `sightkick call <app-dir> <tool> --param k=v ...`. It
143
+ prints the resolved `ToolResult` as JSON and exits non-zero on `ok:false`.
144
+ `--via` picks how the tool runs:
120
145
 
121
146
  ```sh
122
- sightmap browser eval "window.__r='RUN';window.__sightkick.call('add_task',{title:'Water the plants'}).then(function(r){window.__r=JSON.stringify(r)}).catch(function(e){window.__r='ERR '+e});'go'"
123
- sleep 2; sightmap browser eval "window.__r" # the ToolResult JSON (ok/value/items/skipped/guidance)
147
+ sightkick call . add_task --param title="Water the plants" # --via webmcp (default)
148
+ sightkick call . add_task --param title="Water the plants" --via cli # translate steps to CLI commands
124
149
  ```
125
150
 
151
+ **`--via webmcp`** asks the page's own registered tool to run itself, so it
152
+ exercises the contract a real WebMCP client uses. It requires the runtime on the
153
+ page — that's what step 3 above sets up — and a tool is only registered on its
154
+ own view, so an out-of-view tool simply isn't there to call.
155
+
156
+ **`--via cli`** translates the tool's steps into `sightmap browser <verb>`
157
+ commands and needs no runtime at all: a plain `sightmap browser start` is
158
+ enough. Two reasons to reach for it:
159
+
160
+ - **Portal-rendered targets.** The runtime clicks by dispatching synthetic
161
+ events, which do not reach elements rendered outside the app's own DOM
162
+ subtree — dropdown menu items and modal buttons. The same element takes a
163
+ real click fine, so a tool that silently no-ops under `--via webmcp` often
164
+ works under `--via cli`.
165
+ - **Any page you don't control.** A third-party app has no sightkick runtime on
166
+ it, so `--via webmcp` has nothing to call.
167
+
126
168
  The `ToolResult` carries `ok`, `value`/`items`, `skipped` (idempotency guard
127
169
  hit), and `guidance` (next-step breadcrumbs). The sightkick repo's
128
- `packages/runtime/eval/run.mjs` is a full scripted example of this loop.
170
+ `packages/runtime/eval/run.mjs` is a full scripted example driving the WebMCP
171
+ surface directly.
129
172
 
130
- > **Don't script `document.modelContext.executeTool` directly.** Its call shape
173
+ > **Don't script `document.modelContext.executeTool` yourself.** Its call shape
131
174
  > differs by surface: the polyfill takes a bare `{name}`, but a **native**
132
175
  > `document.modelContext` (present on Chrome ≥150 even with no blink flags) is
133
176
  > stricter and rejects it with `Failed to parse input arguments`, and wraps the
134
177
  > result in an envelope (`{content:[{type:'text',text:<ToolResult JSON>}]}`).
135
- > `window.__sightkick.call` sidesteps both differences prefer it for Mode A, and
136
- > leave `executeTool` to the inspector in Mode B.
178
+ > `sightkick call` handles both — use it for Mode A, and leave `executeTool` to
179
+ > the inspector in Mode B.
137
180
 
138
181
  ### Mode B (native): drive via the inspector
139
182
  Open the inspector's sidebar and prompt Gemini — it enumerates