Skip to content

Commit 9917f0a

Browse files
author
Carl
committed
Merge main and address workflow attribution review
Load workflow-owner profiles on direct thread and media opens. Cover non-relay Search spoofing and preserve main's effective-author permissions while disclosing the actual relay signer. Signed-off-by: Carl <32a2e2c9d428ee08902cab75d956da2c1d235a22d4766b0dd4138bf6e2e5db1d@buzz.block.builderlab.xyz>
2 parents 43cff26 + fc594b2 commit 9917f0a

104 files changed

Lines changed: 3717 additions & 533 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎AGENTS.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ callers, and relevant design docs; preserve documented product decisions and
4141
ownership boundaries. Resolve answerable questions from evidence; ask before
4242
deviating from agreed scope or product behavior.
4343

44+
For cross-host changes, follow [shared logic and host boundaries](docs/contributing.md#shared-logic-and-host-boundaries).
45+
Name the existing feature owner/current callers, preserved behavior or approved
46+
host differences, and which host the validation actually exercises. Keep shared
47+
contracts executable in the existing tests; frontend checks do not replace host
48+
signing or IPC enforcement.
49+
4450
Agent selection must consume `session.agentChoices`, not independently reconstruct
4551
native/legacy inventories. Keep usable partial choices distinct from complete
4652
inference evidence; preserve each action's membership/archive policy. See

‎Cargo.lock‎

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎NOTICE.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,15 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
6969
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
7070
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
7171
SOFTWARE.
72+
73+
Claude Code: the bundled `icons/claude.png` is reused unchanged from Block Buzz's
74+
`desktop/src/features/onboarding/assets/harness-logos/claude.png` to identify
75+
Anthropic's Claude Code harness. Claude is a trademark of Anthropic.
76+
77+
Hermes Agent: the bundled `icons/hermes.png` is reused unchanged from Block Buzz's
78+
`desktop/public/harness-logos/hermes.png`. Its upstream is
79+
[NousResearch/hermes-agent](https://github.com/NousResearch/hermes-agent), revision
80+
`6ad632b`, `website/static/img/logo.png`, MIT © 2025 Nous Research. Old Buzz
81+
cropped the border, padded it to square, resized to 64×64 and quantised it to
82+
16 colours. The MIT license terms above also apply to this artwork, with the
83+
Nous Research copyright notice.

‎README.md‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ just desktop --port 1431
4040

4141
Ports do not isolate account credentials or native plugin data. For separate
4242
plugin profiles, use the existing `BUZZODZ_PROFILE` setting described below.
43-
Without live opt-in they run the shell without relay identity access.
43+
Without a public viewer pin, browser development runs the shell/fixtures;
44+
supported desktop development can use [native identity and relay access](docs/identity.md).
45+
See the [host-mode matrix](docs/contributing.md#shared-logic-and-host-boundaries).
4446
`just iterate` applies formatting and runs fast checks plus the frontend build.
4547
`just scan` adds tests and native checks. [PR CI](.github/workflows/ci.yml) runs
4648
those checks in cached, parallel jobs with sharded browser journeys.
@@ -70,13 +72,15 @@ per-platform steps and limits.
7072

7173
## Relay channels
7274

73-
Live development currently requires **an existing Buzz account in the OS credential
74-
store**: the `buzz-desktop` / `secrets` Keychain entry on macOS, or the same entry in
75+
Live **browser/broker development** requires an existing Buzz account in the OS credential
76+
store: the `buzz-desktop` / `secrets` Keychain entry on macOS, or the same entry in
7577
the freedesktop secret service on Linux (read with libsecret's `secret-tool`, so
7678
install `libsecret-tools` and run inside an unlocked desktop session). This development broker is not native
7779
sign-in and is not included in packaged builds. `just web` and `just desktop` run
78-
it automatically once `BUZZ_DEV_VIEWER` is configured; without that pin they start
79-
in the non-live shell/fixture state.
80+
it automatically once `BUZZ_DEV_VIEWER` is configured, including inside the native
81+
window. Without that pin, web stays in shell/fixture mode and supported desktop
82+
uses its separate [native identity path](docs/identity.md). Removing the pin can
83+
change the active identity; it does not migrate the legacy key.
8084

8185
1. Copy your existing Buzz account's **public key** (npub or 64-character hex).
8286
2. Add it to the git-ignored `.env.local` at this repository's root. The optional

‎crates/agent-controller/src/lib.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ pub use import::{
3535
CloneSettings, CredentialedImport, ImportPreview, Imports, LegacySource, PreparedImport,
3636
};
3737
pub use restart::{RestartChange, RestartDiffEntry};
38-
pub use runtime::{installed, managed_tool, Action, Controller, GooseModelContext, ModelContext};
38+
pub use runtime::{
39+
installed, installed_npm_tool, managed_tool, Action, Controller, GooseModelContext,
40+
ModelContext,
41+
};
3942
pub use secret::{Credentials, Secret};
4043
pub use store::{ParkedIdentity, Store};
4144
type Result<T> = std::result::Result<T, String>;

‎crates/agent-controller/src/runtime.rs‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ fn tools_path() -> Result<std::ffi::OsString> {
323323
pub fn managed_tool(app_data: &Path, name: &str) -> Option<PathBuf> {
324324
let path = match name {
325325
"pi" | "buzz-pi-acp" => app_data.join("node-tools/bin").join(name),
326+
"claude" | "claude-agent-acp" => app_data.join("claude-tools/bin").join(name),
326327
"node" => app_data.join("runtimes/node/v24.18.0").join(
327328
match (std::env::consts::OS, std::env::consts::ARCH) {
328329
("macos", "aarch64") => "darwin-arm64/bin/node",
@@ -339,6 +340,28 @@ pub fn managed_tool(app_data: &Path, name: &str) -> Option<PathBuf> {
339340
}
340341

341342
pub fn installed(name: &str) -> Option<PathBuf> {
343+
installed_names(&[name.to_owned()])
344+
}
345+
346+
/// Claude's setup supports Windows npm launchers; other harnesses retain their
347+
/// existing discovery until their launch contracts support those paths too.
348+
pub fn installed_npm_tool(name: &str) -> Option<PathBuf> {
349+
// npm also writes an extensionless POSIX shim on Windows. Prefer launchers
350+
// that Rust and the displayed PowerShell sign-in command can actually run.
351+
#[cfg(windows)]
352+
let names = if Path::new(name).extension().is_some() {
353+
vec![name.to_owned()]
354+
} else {
355+
["exe", "cmd", "bat"]
356+
.map(|extension| format!("{name}.{extension}"))
357+
.to_vec()
358+
};
359+
#[cfg(not(windows))]
360+
let names = [name.to_owned()];
361+
installed_names(&names)
362+
}
363+
364+
fn installed_names(names: &[String]) -> Option<PathBuf> {
342365
let mut dirs = Vec::new();
343366
if let Some(home) = std::env::var_os("HOME") {
344367
dirs.push(PathBuf::from(home).join(".local/bin"));
@@ -352,7 +375,7 @@ pub fn installed(name: &str) -> Option<PathBuf> {
352375
]);
353376
dirs.into_iter()
354377
.filter(|p| p.is_absolute())
355-
.map(|p| p.join(name))
378+
.flat_map(|p| names.iter().map(move |name| p.join(name)))
356379
.find(|p| executable(p).is_ok())
357380
}
358381

‎crates/plugin-manager/src/lib.rs‎

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ pub mod imports;
1212

1313
pub type Result<T> = std::result::Result<T, String>;
1414
const LIMIT: u64 = 8 * 1024 * 1024;
15+
pub const DEFAULT_HOST_COMMAND_OUTPUT_BYTES: u64 = 4096;
16+
pub const MAX_HOST_COMMAND_OUTPUT_BYTES: u64 = 1024 * 1024;
1517

1618
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
1719
#[serde(rename_all = "camelCase", deny_unknown_fields)]
@@ -36,6 +38,12 @@ pub struct HostCommand {
3638
pub id: String,
3739
pub program: String,
3840
pub args: Vec<String>,
41+
#[serde(
42+
default,
43+
rename = "maxOutputBytes",
44+
skip_serializing_if = "Option::is_none"
45+
)]
46+
pub max_output_bytes: Option<u64>,
3947
}
4048
impl Manifest {
4149
pub fn validate(&self) -> Result<()> {
@@ -60,6 +68,9 @@ impl Manifest {
6068
byte.is_ascii_alphanumeric() || matches!(byte, b'-' | b'_' | b'.')
6169
})
6270
|| command.args.len() > 16
71+
|| command
72+
.max_output_bytes
73+
.is_some_and(|limit| !(1..=MAX_HOST_COMMAND_OUTPUT_BYTES).contains(&limit))
6374
|| command
6475
.args
6576
.iter()
@@ -553,7 +564,20 @@ impl Manager {
553564
if manifest.id != snapshot.2 {
554565
return Err("Reloaded plugin manifest ID changed; import it as a new plugin".into());
555566
}
556-
if manifest.host.clone().unwrap_or_default() != snapshot.3 {
567+
// Compare effective access without changing the stored manifest representation.
568+
let effective_grants = |mut grants: HostGrants| {
569+
for command in &mut grants.commands {
570+
command.max_output_bytes = Some(
571+
command
572+
.max_output_bytes
573+
.unwrap_or(DEFAULT_HOST_COMMAND_OUTPUT_BYTES),
574+
);
575+
}
576+
grants
577+
};
578+
if effective_grants(manifest.host.clone().unwrap_or_default())
579+
!= effective_grants(snapshot.3)
580+
{
557581
return Err("Host access changed; use Load from folder to review it".into());
558582
}
559583
let revision = hash(&bytes);
@@ -761,7 +785,7 @@ fn atomic_write(path: &Path, bytes: &[u8]) -> Result<()> {
761785

762786
#[cfg(test)]
763787
mod tests {
764-
use super::{artifact_from_text, Manager, Manifest};
788+
use super::{artifact_from_text, Manager, Manifest, MAX_HOST_COMMAND_OUTPUT_BYTES};
765789
use std::fs;
766790

767791
#[test]
@@ -780,6 +804,27 @@ mod tests {
780804
}
781805
});
782806
assert!(artifact_from_text(&manifest.to_string(), "export const x = 1".into()).is_ok());
807+
let old: Manifest = serde_json::from_value(manifest.clone()).unwrap();
808+
assert_eq!(
809+
old.host.as_ref().unwrap().commands[0].max_output_bytes,
810+
None
811+
);
812+
assert_eq!(serde_json::to_value(&old).unwrap(), manifest);
813+
for limit in [1, 4096, MAX_HOST_COMMAND_OUTPUT_BYTES] {
814+
let mut valid = manifest.clone();
815+
valid["host"]["commands"][0]["maxOutputBytes"] = serde_json::json!(limit);
816+
assert!(artifact_from_text(&valid.to_string(), "export const x = 1".into()).is_ok());
817+
}
818+
for limit in [
819+
serde_json::json!(0),
820+
serde_json::json!(-1),
821+
serde_json::json!(1.5),
822+
serde_json::json!(MAX_HOST_COMMAND_OUTPUT_BYTES + 1),
823+
] {
824+
let mut invalid = manifest.clone();
825+
invalid["host"]["commands"][0]["maxOutputBytes"] = limit;
826+
assert!(artifact_from_text(&invalid.to_string(), "export const x = 1".into()).is_err());
827+
}
783828
for invalid_origin in [
784829
"http://api.example.com",
785830
"https://api.example.com/path",
@@ -837,7 +882,7 @@ mod tests {
837882

838883
fs::write(
839884
source.join("manifest.json"),
840-
r#"{"id":"example.page","name":"Example","apiVersion":1,"host":{"commands":[{"id":"second","program":"example-cli","args":["status","--json"]}],"networkOrigins":["https://two.example"]}}"#,
885+
r#"{"id":"example.page","name":"Example","apiVersion":1,"host":{"commands":[{"id":"second","program":"example-cli","args":["status","--json"],"maxOutputBytes":65536}],"networkOrigins":["https://two.example"]}}"#,
841886
)
842887
.unwrap();
843888
let second = manager
@@ -851,6 +896,12 @@ mod tests {
851896
assert!(manager.host_grants("example.page", &first).is_err());
852897
let grants = manager.host_grants("example.page", &second).unwrap();
853898
assert_eq!(grants.commands[0].id, "second");
899+
assert_eq!(grants.commands[0].max_output_bytes, Some(65536));
900+
let reopened = Manager::open(Some(temp.path().into()), "test", false).unwrap();
901+
assert_eq!(
902+
reopened.host_grants("example.page", &second).unwrap(),
903+
grants
904+
);
854905
assert_eq!(grants.network_origins, ["https://two.example"]);
855906
manager.change("disable", "example.page").unwrap();
856907
assert!(manager.host_grants("example.page", &second).is_err());

‎crates/plugin-manager/tests/management.rs‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,70 @@ fn folder_reload_updates_current_revision_and_preserves_disabled_state() {
109109
.unwrap()
110110
.contains("reloaded"));
111111
}
112+
#[test]
113+
fn folder_reload_compares_effective_output_limits() {
114+
for (before, after, allowed) in [
115+
(None, Some(4096), true),
116+
(Some(4096), None, true),
117+
(None, Some(65536), false),
118+
(Some(4096), Some(65536), false),
119+
(Some(65536), None, false),
120+
(Some(65536), Some(4096), false),
121+
] {
122+
let (temp, manager, source) = fixture();
123+
let write_manifest = |limit: Option<u64>| {
124+
let mut manifest = serde_json::json!({
125+
"id": "example.page", "name": "Example", "apiVersion": 1,
126+
"host": {"commands": [{"id": "tools", "program": "agent-tools", "args": ["list", "--json"]}]}
127+
});
128+
if let Some(limit) = limit {
129+
manifest["host"]["commands"][0]["maxOutputBytes"] = serde_json::json!(limit);
130+
}
131+
fs::write(source.join("manifest.json"), manifest.to_string()).unwrap();
132+
};
133+
write_manifest(before);
134+
let first = manager
135+
.install(&source)
136+
.unwrap()
137+
.plugins
138+
.into_iter()
139+
.find(|plugin| plugin.manifest.id == "example.page")
140+
.unwrap();
141+
write_manifest(after);
142+
let result = manager.reload("example.page");
143+
if allowed {
144+
assert!(
145+
result.is_ok(),
146+
"{before:?} -> {after:?}: {}",
147+
result.err().unwrap()
148+
);
149+
} else {
150+
assert!(result.err().unwrap().contains("Host access changed"));
151+
}
152+
let reopened = Manager::open(Some(temp.path().into()), "test", false).unwrap();
153+
let plugin = reopened
154+
.catalog()
155+
.unwrap()
156+
.plugins
157+
.into_iter()
158+
.find(|plugin| plugin.manifest.id == "example.page")
159+
.unwrap();
160+
assert!(!plugin.enabled);
161+
assert!(plugin.reloadable);
162+
assert_eq!(
163+
plugin.manifest.host.as_ref().unwrap().commands[0].max_output_bytes,
164+
if allowed { after } else { before }
165+
);
166+
if allowed {
167+
assert_ne!(plugin.revision, first.revision);
168+
assert_eq!(plugin.previous.as_deref(), Some(first.revision.as_str()));
169+
} else {
170+
assert_eq!(plugin.revision, first.revision);
171+
assert_eq!(plugin.previous, first.previous);
172+
}
173+
}
174+
}
175+
112176
#[test]
113177
fn reload_rejects_invalid_sources_without_changing_revision() {
114178
let (temp, manager, source) = fixture();

‎dev/README.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Browser development host
2+
3+
This directory contains the Node host used by live browser development and
4+
broker-backed tests, plus development tooling. It is checked-in source, not a
5+
cache or another relay server. Packaged desktop uses the native Rust host.
6+
7+
See [shared logic and host boundaries](../docs/contributing.md#shared-logic-and-host-boundaries)
8+
for the runtime/identity matrix, ownership rules and cross-host test expectations.
9+
Keep platform-neutral feature policy under its existing `src/features/*` owner;
10+
retain host custody and boundary enforcement here. Existing tests are discovered
11+
by Vitest. [Broker setup](../README.md#relay-channels) requires an explicit public
12+
identity pin; never put a private key in environment configuration.

‎dev/channel-kit.test.mjs‎

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { expect, it } from "vitest";
2+
import canvasCases from "../src/features/channel-templates/canvas-signing-contract.json";
23
import { keypair, signed } from "../src/features/relay/testing.ts";
34
import {
45
coordinate,
@@ -141,37 +142,18 @@ it("expands multiple teams and individual agents by exact key without namesake c
141142
);
142143
});
143144

144-
it("admits only bounded Canvas writes with one exact channel and no notification or privilege tags", () => {
145+
// Shape only: the broker additionally checks freshness; Rust also deserializes
146+
// EventTemplate and bounds the signed serialization. See contributing.md.
147+
it.each(canvasCases)("Canvas signing shape: $name", ({ accepted, tags }) => {
148+
expect(validCanvas({ kind: 40100, content: "# Plan", tags })).toBe(accepted);
149+
});
150+
151+
it("bounds Canvas content in UTF-8 bytes, not JavaScript characters", () => {
145152
const canvas = {
146153
kind: 40100,
147-
content: "# Plan",
148154
tags: [["h", "11111111-1111-4111-8111-111111111111"]],
149155
};
150-
expect(validCanvas(canvas)).toBe(true);
151-
for (const revision of ["none", "a".repeat(64)])
152-
expect(
153-
validCanvas({
154-
...canvas,
155-
tags: [...canvas.tags, ["expected-revision", revision]],
156-
}),
157-
).toBe(true);
158-
for (const tags of [
159-
[...canvas.tags, ["expected-revision", "bad"]],
160-
[...canvas.tags, ["expected-revision", "A".repeat(64)]],
161-
[...canvas.tags, ["expected-revision", "none", "extra"]],
162-
[
163-
...canvas.tags,
164-
["expected-revision", "none"],
165-
["expected-revision", "none"],
166-
],
167-
[...canvas.tags, null],
168-
[],
169-
[...canvas.tags, ...canvas.tags],
170-
[...canvas.tags, ["p", owner.pubkey]],
171-
[["h", "invalid"]],
172-
])
173-
expect(validCanvas({ ...canvas, tags })).toBe(false);
174-
expect(validCanvas({ ...canvas, content: "é".repeat(13 * 1024) })).toBe(
175-
false,
176-
);
156+
const content = "é".repeat(12 * 1024);
157+
expect(validCanvas({ ...canvas, content })).toBe(true);
158+
expect(validCanvas({ ...canvas, content: `${content}x` })).toBe(false);
177159
});

0 commit comments

Comments
 (0)