@anynotate/protocol 0.4.0 → 0.5.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/PROTOCOL.md +4 -3
- package/dist/fixtures.d.ts +1 -0
- package/dist/fixtures.js +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
- package/src/fixtures.ts +2 -2
- package/src/index.ts +2 -0
package/PROTOCOL.md
CHANGED
|
@@ -4,7 +4,7 @@ The bridge is an HTTP server on `127.0.0.1`, port `47291` by default (`ANYNOTATE
|
|
|
4
4
|
|
|
5
5
|
## Handshake
|
|
6
6
|
|
|
7
|
-
`POST /health` (or `GET`) → `{ "ok": true, "bridgeVersion": "0.
|
|
7
|
+
`POST /health` (or `GET`) → `{ "ok": true, "bridgeVersion": "0.6.1", "protocol": { "version": 2, "min": 1 } }`.
|
|
8
8
|
|
|
9
9
|
A client supports a range of protocol versions (the extension: `min 2, max 2`) and calls `compatibility(clientRange, response.protocol)`:
|
|
10
10
|
|
|
@@ -40,7 +40,7 @@ The allow-list is the valid `chrome-extension://` entries from `$ANYNOTATE_HOME/
|
|
|
40
40
|
| Method and path | Body | Response |
|
|
41
41
|
|---|---|---|
|
|
42
42
|
| `GET` / `POST /health` | — | `HealthResponse` |
|
|
43
|
-
| `GET` / `POST /sessions` | — | `Session[]`: live push sessions, herdr panes (`method: "herdr"`), then sessions seen by the prompt hook outside herdr (`method: "next-prompt"
|
|
43
|
+
| `GET` / `POST /sessions` | — | `Session[]`: live push sessions, herdr panes (`method: "herdr"`), then sessions seen by the prompt hook outside herdr (`method: "next-prompt"`, with the agent's own conversation title when the bridge can read it) |
|
|
44
44
|
| `POST /bundles` | `multipart/form-data`: field `bundle` = JSON `BundleInput`; files `page.md`, `screenshot.png`, optional `snapshot.html`, `crops/A<n>.png` | `201 SendResponse` (`{ id, status }`); `400 ErrorResponse` for an invalid bundle or file name |
|
|
45
45
|
| `POST /bundles/<id>/status`, `GET /bundles/<id>` | — | `BundleStatusResponse` (`{ bundle, status }`; `status` is `null` if the status file is missing or unreadable); `404` if unknown |
|
|
46
46
|
| `POST /bundles/<id>/ack` | `AckRequest` (`{ "summary"?: string }`) | `OkResponse`; `404` if unknown or busy |
|
|
@@ -111,8 +111,9 @@ Each entry is a CSS selector for an `<iframe>`, outermost first, resolved in the
|
|
|
111
111
|
- **v1** — handshake, token-only access, native-host token delivery.
|
|
112
112
|
- **v2** — intents `explain`, `change`, `approve` (legacy `question`, `bug`, `note` still accepted). `PROTOCOL_MIN` stays `1`: a v2 bridge accepts v1 clients.
|
|
113
113
|
- Optional `region` on element annotations (additive, `@anynotate/protocol` 0.4.0, bridge 0.5.1).
|
|
114
|
-
- Optional `offscreen: true` on any annotation whose target was not on
|
|
114
|
+
- Optional `offscreen: true` on any annotation whose target was not on the page at send time (`box` and crop are from when the note was made); `README.md` puts "Not on the page when sent — crop is from when the note was made." under its heading (without the crop clause when no crop was sent; additive, same releases; wording since bridge 0.6.1).
|
|
115
115
|
- Optional `anchor.frames` on notes made inside same-origin iframes; `README.md` names the frames after the selector (additive, same releases).
|
|
116
|
+
- Optional `workspace` on `Session`: the display name of the herdr workspace holding a herdr pane (additive, `@anynotate/protocol` 0.5.0, bridge 0.6.1).
|
|
116
117
|
|
|
117
118
|
## Threat model
|
|
118
119
|
|
package/dist/fixtures.d.ts
CHANGED
package/dist/fixtures.js
CHANGED
|
@@ -33,13 +33,13 @@ export const examplePage = "# Tomato soup\n\nstir in ⟦A1⟧200 ml cream before
|
|
|
33
33
|
export const responseSchemas = {
|
|
34
34
|
HealthResponse, SessionsResponse, SendResponse, BundleStatusResponse, OkResponse, ErrorResponse,
|
|
35
35
|
};
|
|
36
|
-
const health = { ok: true, bridgeVersion: "0.
|
|
36
|
+
const health = { ok: true, bridgeVersion: "0.6.1", protocol: { version: 2, min: 1 } };
|
|
37
37
|
const queued = { state: "queued", at: "2026-09-24T15:32:01.000Z" };
|
|
38
38
|
const exampleBundle = { ...exampleBundleInput, id: EXAMPLE_BUNDLE_ID, files: { page: "page.md", screenshot: "screenshot.png" } };
|
|
39
39
|
export const conformance = [
|
|
40
40
|
{ name: "health-extension", request: { method: "POST", path: "/health", auth: "extension" }, status: 200, response: { schema: "HealthResponse", example: health } },
|
|
41
41
|
{ name: "health-probe", request: { method: "GET", path: "/health", auth: "none" }, status: 200, response: { schema: "HealthResponse", example: health } },
|
|
42
|
-
{ name: "sessions-extension", request: { method: "POST", path: "/sessions", auth: "extension" }, status: 200, response: { schema: "SessionsResponse", example: [{ id: "w1:p2", agent: "claude", cwd: "/home/me/project", title: "shell", method: "herdr", pane: "w1:p2" }] } },
|
|
42
|
+
{ name: "sessions-extension", request: { method: "POST", path: "/sessions", auth: "extension" }, status: 200, response: { schema: "SessionsResponse", example: [{ id: "w1:p2", agent: "claude", cwd: "/home/me/project", title: "shell", method: "herdr", pane: "w1:p2", workspace: "project" }] } },
|
|
43
43
|
{ name: "sessions-token", request: { method: "GET", path: "/sessions", auth: "token" }, status: 200, response: { schema: "SessionsResponse", example: [] } },
|
|
44
44
|
{ name: "sessions-extension-no-token", request: { method: "POST", path: "/sessions", auth: "extension-no-token" }, status: 401, response: { schema: "ErrorResponse", example: { error: "bad token" } } },
|
|
45
45
|
{ name: "sessions-unauthenticated", request: { method: "POST", path: "/sessions", auth: "none" }, status: 401, response: { schema: "ErrorResponse", example: { error: "bad token" } } },
|
package/dist/index.d.ts
CHANGED
|
@@ -275,6 +275,7 @@ export declare const Session: z.ZodObject<{
|
|
|
275
275
|
}>;
|
|
276
276
|
pane: z.ZodOptional<z.ZodString>;
|
|
277
277
|
sessionIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
278
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
278
279
|
}, z.core.$strip>;
|
|
279
280
|
export type Session = z.infer<typeof Session>;
|
|
280
281
|
export declare const PROTOCOL_VERSION = 2;
|
|
@@ -300,6 +301,7 @@ export declare const SessionsResponse: z.ZodArray<z.ZodObject<{
|
|
|
300
301
|
}>;
|
|
301
302
|
pane: z.ZodOptional<z.ZodString>;
|
|
302
303
|
sessionIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
304
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
303
305
|
}, z.core.$strip>>;
|
|
304
306
|
export type SessionsResponse = z.infer<typeof SessionsResponse>;
|
|
305
307
|
export declare const SendResponse: z.ZodObject<{
|
package/dist/index.js
CHANGED
|
@@ -77,6 +77,8 @@ export const Session = z.object({
|
|
|
77
77
|
method: z.enum(["push", "herdr", "next-prompt"]),
|
|
78
78
|
pane: z.string().optional(),
|
|
79
79
|
sessionIds: z.array(z.string()).optional(),
|
|
80
|
+
/** Display name of the herdr workspace a herdr pane is in. */
|
|
81
|
+
workspace: z.string().optional(),
|
|
80
82
|
});
|
|
81
83
|
// Protocol v2. Additive changes (optional fields, new endpoints) keep the version; removals, renames and
|
|
82
84
|
// semantic changes bump PROTOCOL_VERSION, and the bridge keeps accepting the previous version for a release.
|
package/package.json
CHANGED
package/src/fixtures.ts
CHANGED
|
@@ -57,14 +57,14 @@ export type Exchange = {
|
|
|
57
57
|
response: { schema: SchemaName; example: unknown };
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
const health = { ok: true, bridgeVersion: "0.
|
|
60
|
+
const health = { ok: true, bridgeVersion: "0.6.1", protocol: { version: 2, min: 1 } };
|
|
61
61
|
const queued = { state: "queued", at: "2026-09-24T15:32:01.000Z" };
|
|
62
62
|
const exampleBundle = { ...exampleBundleInput, id: EXAMPLE_BUNDLE_ID, files: { page: "page.md", screenshot: "screenshot.png" } };
|
|
63
63
|
|
|
64
64
|
export const conformance: Exchange[] = [
|
|
65
65
|
{ name: "health-extension", request: { method: "POST", path: "/health", auth: "extension" }, status: 200, response: { schema: "HealthResponse", example: health } },
|
|
66
66
|
{ name: "health-probe", request: { method: "GET", path: "/health", auth: "none" }, status: 200, response: { schema: "HealthResponse", example: health } },
|
|
67
|
-
{ name: "sessions-extension", request: { method: "POST", path: "/sessions", auth: "extension" }, status: 200, response: { schema: "SessionsResponse", example: [{ id: "w1:p2", agent: "claude", cwd: "/home/me/project", title: "shell", method: "herdr", pane: "w1:p2" }] } },
|
|
67
|
+
{ name: "sessions-extension", request: { method: "POST", path: "/sessions", auth: "extension" }, status: 200, response: { schema: "SessionsResponse", example: [{ id: "w1:p2", agent: "claude", cwd: "/home/me/project", title: "shell", method: "herdr", pane: "w1:p2", workspace: "project" }] } },
|
|
68
68
|
{ name: "sessions-token", request: { method: "GET", path: "/sessions", auth: "token" }, status: 200, response: { schema: "SessionsResponse", example: [] } },
|
|
69
69
|
{ name: "sessions-extension-no-token", request: { method: "POST", path: "/sessions", auth: "extension-no-token" }, status: 401, response: { schema: "ErrorResponse", example: { error: "bad token" } } },
|
|
70
70
|
{ name: "sessions-unauthenticated", request: { method: "POST", path: "/sessions", auth: "none" }, status: 401, response: { schema: "ErrorResponse", example: { error: "bad token" } } },
|
package/src/index.ts
CHANGED
|
@@ -99,6 +99,8 @@ export const Session = z.object({
|
|
|
99
99
|
method: z.enum(["push", "herdr", "next-prompt"]),
|
|
100
100
|
pane: z.string().optional(),
|
|
101
101
|
sessionIds: z.array(z.string()).optional(),
|
|
102
|
+
/** Display name of the herdr workspace a herdr pane is in. */
|
|
103
|
+
workspace: z.string().optional(),
|
|
102
104
|
});
|
|
103
105
|
export type Session = z.infer<typeof Session>;
|
|
104
106
|
|