@comty.io/core 0.0.0-stage → 0.1.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,3 +1,111 @@
1
- # Temporary Holding Version
1
+ # @comty.io/core
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Comty's browser SDK and development companion have no npm package dependencies. The Node companion runs the locally installed Codex, Claude or Cursor CLI and stores technical requests in your project's `.comty/tasks.json`.
4
+
5
+ Requires Node.js 22.12 or newer for the development tools.
6
+
7
+ ## Browser SDK
8
+
9
+ ```sh
10
+ npm install @comty.io/core
11
+ ```
12
+
13
+ ```js
14
+ import { initComty } from '@comty.io/core';
15
+
16
+ await initComty({
17
+ projectKey: 'YOUR_PROJECT_KEY',
18
+ apiUrl: 'https://YOUR_COMTY_API',
19
+ });
20
+ ```
21
+
22
+ Call once from your application entry. Server rendering is safe: it does nothing until called in a browser. Repeated calls with the same options reuse the document's instance. Reload the page to change its project or API URL. Register the site's domain in Comty to use shared comments.
23
+
24
+ The standalone script remains available at your existing CDN URL:
25
+
26
+ ```html
27
+ <script src="https://YOUR_COMTY_CDN/v1/comty-sdk.js"
28
+ data-project-key="YOUR_PROJECT_KEY"
29
+ data-api-url="https://YOUR_COMTY_API"></script>
30
+ ```
31
+
32
+ Choose one browser entry per page (npm, development injection, or CDN). Both distributions are generated from `src/browser.js`.
33
+
34
+ ## Color tokens
35
+
36
+ Element inspection shows a copyable CSS custom-property name above foreground/background colors when the winning declaration can be identified. It handles ordinary selectors, `:where()`, inline styles, inheritance, `!important`, active media/supports rules and named top-level cascade layers. Semantic aliases retain their declared name. No extra line is rendered for literal colors or uncertain provenance (including inaccessible stylesheets, shadow/scoped or nested cascades, and unsupported functional selectors).
37
+
38
+ The screen pipette receives a pixel color and copies its HEX value. When an inspected element has an identifiable background token whose rendered color matches the sample, the toast shows that token as **Element token · --name**. The native pipette does not report which element produced the pixel, so the label describes the inspected element rather than attributing the sampled pixel. Matching variable values alone do not produce a label. No additional dependency is required.
39
+
40
+ ## Live motion
41
+
42
+ Open inspection with **Shift I**, then select the stopwatch or press **M**. Drag the speed gauge directly: **0.1×–1×**, in 0.1 steps. Its fill and handle track the value; arrow keys and Home/End work too. The whole page remains interactive. Hover, click and open panels normally; new native animations are detected as they appear. At 0.2×, a 100 ms transition has a nominal playback duration of 500 ms. Detection can occur after its first frame.
43
+
44
+ **Pause** holds controlled animations, including new ones. **Escape** closes Motion. Closing Motion or switching tools restores the original playback rates and releases pauses introduced by Comty, while preserving animations that were already paused by the application.
45
+
46
+ Supported: CSS transitions, CSS animations and Web Animations on document timelines, including newly mounted sidebars and open shadow roots (new shadow roots can take up to 500 ms to be discovered). Comty's own interface is excluded. No screen capture, permission prompt, recording buffer, upload or package dependency is involved.
47
+
48
+ JavaScript animation loops, canvas, closed shadow roots, embedded frames and scroll-driven timelines are not controlled. Application timers and state changes keep their normal timing: a panel removed by a fixed timer can disappear before its slowed animation ends. Comty does not patch global clocks or delay application actions.
49
+
50
+ ## Agent mode with Vite
51
+
52
+ ```js
53
+ // vite.config.js
54
+ import { defineConfig } from 'vite';
55
+ import { comty } from '@comty.io/core/vite';
56
+
57
+ export default defineConfig({
58
+ plugins: [comty({ agent: 'codex', model: 'gpt-6-luna' })],
59
+ });
60
+ ```
61
+
62
+ Keep your existing plugins. Run your normal dev command and open `http://localhost:<vite-port>`. The plugin injects the SDK and starts the companion automatically. It is disabled for production builds. The `model` option selects any model supported by your installed Codex CLI; omit it to use your Codex default. Use `agent: 'claude'` or `agent: 'cursor'` to select another provider. A project key is optional in local Agent mode; set `projectKey` and `apiUrl` in the plugin options if you also want shared Comty comments.
63
+
64
+ ## Other development servers
65
+
66
+ ```sh
67
+ npx comty dev --agent codex -- vite --strictPort
68
+ # Next.js:
69
+ npx comty dev --agent claude --target http://127.0.0.1:3000 -- next dev
70
+ ```
71
+
72
+ Open the **Comty URL printed in the terminal** (by default `http://127.0.0.1:4387`). The application continues to run on its own port. HTTP and WebSockets are forwarded to it. `--target` must match that port; use a fixed port so a busy port cannot silently select a different application. The wrapper currently expects uncompressed HTML and buffers HTML responses up to 8 MiB. Prefer the direct Vite plugin when using Vite. Do not use the wrapper and plugin together.
73
+
74
+ Optional flags: `--port`, `--model` (Codex only), `--project-key`, `--api-url`. Without a command after `--`, the wrapper connects to an already-running local server.
75
+
76
+ ## Using the agent
77
+
78
+ Install and sign in to your selected coding agent first. Codex and Claude use the project's local CLI when present, otherwise `codex` or `claude` on PATH. Cursor uses `agent` on PATH. Claude's permission requests are relayed to the same Comty sidebar through a local MCP tool. Comty does not provision an AI subscription or credentials.
79
+
80
+ 1. Open the toolbar with Shift S or Shift I.
81
+ 2. Select the `</>` Agent tool and click an element.
82
+ 3. Describe your change and submit. No Comty account is needed.
83
+ 4. Use History in the Code toolbar to show or hide the Local agent sidebar. Review any requested tool permissions there; allow once or deny.
84
+ 5. Completed tasks disappear from the page. Their result and verification remain in History. Errors remain visible and can be retried after reviewing partial edits.
85
+
86
+ Each request starts its own agent session, so tasks can run at the same time in the same project directory. Concurrent agents can touch the same files; review overlapping changes. Cancel stops that task's agent; it does **not** revert changes already made. Requests time out after 30 minutes and remain available for review. Neither normal operation nor shutdown deletes task history.
87
+
88
+ Comty starts a separate agent session. It does not send instructions into an already-open Codex, Claude or Cursor conversation. Cursor requires a recent Cursor CLI with `agent acp` support; run `agent login` before using it. Legacy `cursor-agent` releases without ACP are unsupported.
89
+
90
+ Technical requests are never sent to the Comty API or its database. Their prompt and page context are sent to the selected AI provider by its coding agent. Standard shared comments retain their existing Comty authentication and storage.
91
+
92
+ Add `.comty/` to your application's `.gitignore`. Keep the companion on loopback; LAN binding, tunnels and production hosting are unsupported. Requests require the random token of the running development session and its exact origin.
93
+
94
+ ## Development
95
+
96
+ ```sh
97
+ cd sdk
98
+ npm ci
99
+ npm run build
100
+ npm test
101
+ npm run check:build
102
+ npm run test:vite
103
+ ```
104
+
105
+ Vite is a development dependency used by the integration test; it is not included in the published package.
106
+
107
+ For browser checks, run `bun sdk/tests/serve.mjs` from the repository root. Open `http://127.0.0.1:4178/` for the comment/inspector regression suite, or `http://127.0.0.1:4178/motion` for the interactive live-motion lab and slowdown checks. The test bridge is injected by that local server only and is not included in the published SDK.
108
+
109
+ From the repository root, run `bun sdk/tests/serve.mjs`, open the printed URL and select **Run regression checks**. Edit `src/browser.js`, never the generated `comty-sdk.js`.
110
+
111
+ See the repository's `doc.md` for publication, CDN deployment, verification and rollback steps.