@fugood/buttress-server 2.26.0-beta.12 → 2.26.0-beta.13

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
@@ -69,14 +69,14 @@ The `bricks` CLI is the tool that performs the binding and writes the local stat
69
69
  ### Bind a server to a workspace
70
70
 
71
71
  ```bash
72
- # Pair the local machine's buttress-server with the workspace of the current bricks-cli profile
72
+ # Pair the local server and provision a workspace DevTools token using the current CLI profile
73
73
  bricks buttress bind
74
74
 
75
75
  # Override the auto-detected server id, give it a friendly name, or write to a custom state dir
76
76
  bricks buttress bind --server-id buttress-mac-studio --name "Studio LLM" --state-dir /etc/buttress
77
77
 
78
78
  # For headless/remote setups: emit state.json to stdout instead of writing to disk
79
- bricks buttress bind --print > /etc/buttress/state.json
79
+ (umask 077; bricks buttress bind --print > /etc/buttress/state.json)
80
80
  ```
81
81
 
82
82
  The state file (`~/.bricks-cli/buttress/state.json` by default, or `$BRICKS_BUTTRESS_STATE_DIR`) stores:
@@ -84,6 +84,15 @@ The state file (`~/.bricks-cli/buttress/state.json` by default, or `$BRICKS_BUTT
84
84
  - `workspace.id` / `workspace.name` — which workspace this server belongs to
85
85
  - `workspace.serverId` — the server's stable id (defaults to `buttress-<machineId>`)
86
86
  - `workspace.issuerPublicKey` + `workspace.kid` — Ed25519 SPKI used to verify access tokens
87
+ - `devtools` — workspace-scoped DevTools JWT (`k: "da"`), workspace id and expiry,
88
+ provisioned automatically by `bind` for agent device tools
89
+
90
+ Normal bind/status output reports only token expiry, never the token. The CLI writes
91
+ state with mode `0600`; `--print` includes credentials and must be treated as a secret.
92
+ Rebinding provisions a fresh token (default lifetime: 30 days) and rotates the announce
93
+ key. Issuance failure stops binding before changing the remote announce key. Rebinding
94
+ or unbinding does not revoke previously issued DevTools JWTs; they remain valid until
95
+ expiry or issuer-key rotation.
87
96
 
88
97
  **Restart `bricks-buttress` after binding** for the change to take effect — the state file is read once at startup.
89
98
 
@@ -914,16 +923,23 @@ fail closed unless marked `optional = true`.
914
923
 
915
924
  For example, scan with `{}` then call `devtools` with
916
925
  `{ "action": "tree", "address": "192.168.1.42", "port": 19851 }`.
917
- Supply `passcode` or a workspace DevTools `accessToken` if required; otherwise the
918
- transport uses the device's advertised Chrome Inspect credential. Buttress does **not**
919
- read the host's CLI login or mint tokens. Calls open/close their own connection;
926
+ After `bricks buttress bind` and a restart, the workspace credential is injected
927
+ server-side automatically when the device advertises the same workspace and issuer.
928
+ The token is validated for signature, kind and expiry before use; inbound Buttress
929
+ JWTs (`k: "ba"`) are never forwarded. Older bindings without the credential, or expired
930
+ credentials, require rebinding and a restart. The server does not read the CLI login
931
+ or renew tokens itself. Local previews can still use advertised inspect credentials;
932
+ explicit `passcode` / `accessToken` arguments remain optional overrides. Calls open/close their own connection;
920
933
  avoid parallel calls or other inspectors on the same device (one CDP client at a time).
921
934
 
922
935
  **Security:** enabling this option grants network discovery and device control,
923
936
  including arbitrary JavaScript evaluation on reachable authenticated devices. It is
924
- not read-only or a network sandbox. Tool arguments/results (including credentials,
925
- console output and device data) enter model context and persisted session transcripts;
926
- only grant this to trusted agents/callers. Disable with `local_devices = false` and
937
+ not read-only or a network sandbox. Automatic authentication requires a **trusted LAN**:
938
+ workspace/issuer hints from device info are not cryptographic peer authentication.
939
+ The stored token is never inserted into model arguments and is redacted from text
940
+ results/errors before truncation. Explicit credentials supplied in arguments still
941
+ enter session transcripts, as do console output and device data; prefer automatic
942
+ authentication and only grant this to trusted agents/callers. Disable with `local_devices = false` and
927
943
  restart Buttress. Aborting closes active CDP connections; discovery completes its
928
944
  bounded scan before returning the abort result.
929
945
 
@@ -0,0 +1,3 @@
1
+ import type { WorkspaceState } from '../utils/workspaceState';
2
+ /** Select only the bound workspace's credential; never reuse an inbound Buttress (k=ba) JWT. */
3
+ export declare const resolveDeviceAccessToken: (address: string, port: number, state?: WorkspaceState, signal?: AbortSignal) => Promise<string | undefined>;
@@ -1,4 +1,5 @@
1
1
  import type { AgentFunctionTool } from './tools';
2
2
  import type { AgentDefinition } from './types';
3
+ import type { WorkspaceState } from '../utils/workspaceState';
3
4
  /** Two tools regardless of device count; no remote tool-list expansion or persistent sockets. */
4
- export declare const buildLocalDeviceTools: (agent: Pick<AgentDefinition, 'localDevices'>, configDir: string) => AgentFunctionTool[];
5
+ export declare const buildLocalDeviceTools: (agent: Pick<AgentDefinition, 'localDevices'>, configDir: string, workspaceState?: WorkspaceState) => AgentFunctionTool[];