@book.dev/sdk 3.3.1 → 3.3.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.
@@ -41,6 +41,16 @@ export interface TrustedIssuerConfig {
41
41
  /** The instance's multi-user policy, persisted in the `settings` table. */
42
42
  export interface InstanceConfig {
43
43
  guestAccess: GuestAccess;
44
+ /**
45
+ * A stable, opaque per-library identifier (STAB-5). Minted once at first
46
+ * startup and persisted; it authorizes NOTHING (like {@link ownerSubject}, it's
47
+ * a non-secret coordinate) and only exists so an out-of-process connector can
48
+ * confirm it reached THIS library's server rather than a foreign responder that
49
+ * happens to answer on the same loopback port (e.g. a stale `pnpm dev`). Surfaced
50
+ * on `GET /api/instance` as {@link InstanceInfo.instanceId}. Absent on a
51
+ * pre-STAB-5 config until the next boot's {@link ensureInstanceId} mints it.
52
+ */
53
+ instanceId?: string;
44
54
  /** The principal subject that administers this instance, once claimed. */
45
55
  ownerSubject?: string;
46
56
  trustedIssuers: TrustedIssuerConfig[];
@@ -130,6 +140,14 @@ export declare const DEFAULT_INSTANCE_CONFIG: InstanceConfig;
130
140
  */
131
141
  export interface InstanceInfo {
132
142
  guestAccess: GuestAccess;
143
+ /**
144
+ * The stable, opaque per-library identifier (STAB-5) — see
145
+ * {@link InstanceConfig.instanceId}. An out-of-process MCP connector compares
146
+ * this against its configured `OPENBOOK_INSTANCE_ID` to refuse a foreign
147
+ * responder on the same port. Not a secret (authorizes nothing). Optional:
148
+ * absent on a pre-STAB-5 server / a test fixture — a connector then can't verify
149
+ * identity and falls back to a reachability-only probe. */
150
+ instanceId?: string | null;
133
151
  ownerSubject: string | null;
134
152
  trustedIssuers: string[];
135
153
  /** This server's audience identifier, so a client can request an `aud`-scoped
@@ -1 +1 @@
1
- {"version":3,"file":"provenance.js","sourceRoot":"","sources":["../src/provenance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,CAAC;AA6H9C,MAAM,CAAC,MAAM,uBAAuB,GAAmB;IACrD,WAAW,EAAE,OAAO;IACpB,+EAA+E;IAC/E,+EAA+E;IAC/E,gFAAgF;IAChF,4EAA4E;IAC5E,cAAc,EAAE;QACd;YACE,MAAM,EAAE,mBAAmB;YAC3B,OAAO,EAAE,GAAG,mBAAmB,oBAAoB;YACnD,2EAA2E;YAC3E,uDAAuD;YACvD,cAAc,EAAE,GAAG,mBAAmB,2BAA2B;SAClE;KACF;IACD,iFAAiF;IACjF,+EAA+E;IAC/E,iBAAiB,EAAE,SAAS;IAC5B,iFAAiF;IACjF,+EAA+E;IAC/E,cAAc,EAAE,mBAAmB;CACpC,CAAC"}
1
+ {"version":3,"file":"provenance.js","sourceRoot":"","sources":["../src/provenance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAuI9C,MAAM,CAAC,MAAM,uBAAuB,GAAmB;IACrD,WAAW,EAAE,OAAO;IACpB,+EAA+E;IAC/E,+EAA+E;IAC/E,gFAAgF;IAChF,4EAA4E;IAC5E,cAAc,EAAE;QACd;YACE,MAAM,EAAE,mBAAmB;YAC3B,OAAO,EAAE,GAAG,mBAAmB,oBAAoB;YACnD,2EAA2E;YAC3E,uDAAuD;YACvD,cAAc,EAAE,GAAG,mBAAmB,2BAA2B;SAClE;KACF;IACD,iFAAiF;IACjF,+EAA+E;IAC/E,iBAAiB,EAAE,SAAS;IAC5B,iFAAiF;IACjF,+EAA+E;IAC/E,cAAc,EAAE,mBAAmB;CACpC,CAAC"}
package/dist/types.d.ts CHANGED
@@ -261,6 +261,17 @@ export interface ServerInfo {
261
261
  accessToken?: string | null;
262
262
  /** Folder the on-disk book mirror writes to (durable mode). */
263
263
  bookDir?: string | null;
264
+ /**
265
+ * Whether the host also binds a loopback TCP listener (`127.0.0.1:4319`) on the
266
+ * same sidecar so an out-of-process local MCP/agent connector can reach this
267
+ * exact library (STAB-5). Gated on the local-MCP/agent toggle — OFF by default,
268
+ * and independent of {@link published} (which binds `0.0.0.0` for the LAN).
269
+ * Unlike the FS-permissioned IPC socket, this loopback listener is reachable by
270
+ * any local process AND by any web origin the user's browser will POST to (the
271
+ * sidecar serves wildcard CORS and guestAccess defaults to 'write') — a real
272
+ * added surface, hence the explicit opt-in toggle; browser-reachability
273
+ * hardening is tracked separately. */
274
+ agentLocalTcp?: boolean;
264
275
  }
265
276
  /**
266
277
  * Controls for the host-managed local server, provided by the platform layer
@@ -281,4 +292,11 @@ export interface ServerControls {
281
292
  chooseBookDir?(): Promise<ServerInfo>;
282
293
  /** Reveal the current book-mirror directory in the OS file manager. */
283
294
  revealBookDir?(): Promise<void>;
295
+ /**
296
+ * Bind (or unbind) the loopback TCP listener (`127.0.0.1:4319`) used by an
297
+ * out-of-process local MCP/agent connector (STAB-5). Flipped together with the
298
+ * agent-API toggle so the connector's default endpoint actually points at THIS
299
+ * library's server. Resolves the new status (with {@link ServerInfo.agentLocalTcp}).
300
+ * Absent on the web / an old host that predates the capability. */
301
+ setAgentLocalTcp?(enabled: boolean): Promise<ServerInfo>;
284
302
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@book.dev/sdk",
3
- "version": "3.3.1",
3
+ "version": "3.3.3",
4
4
  "description": "Shared OpenBook types and HTTP client used by the server, desktop, and web.",
5
5
  "repository": {
6
6
  "type": "git",