Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ not (package(cccc-pair-web) & (
| test(=browser_surface::browser_surface_tests::shared_owner::shared_windows_submit_independent_batches_while_viewers_capture)
| test(=browser_surface::browser_surface_tests::shutdown_closes_all_browser_processes)
| test(=browser_surface::browser_surface_tests::special_key_command_applies_native_input_behavior)
| test(=browser_surface::pairing::tests::current_chatgpt_pairing_receipt_keeps_exact_user_and_assistant_boundaries)
| test(=browser_surface::prompt_submission::grok_tests::grok_controls_busy_state_drafts_and_user_receipts)
| test(=browser_surface::prompt_submission::readiness_tests::chatgpt_auth_and_landing_inputs_are_not_conversation_composers)
| test(=browser_surface::prompt_submission::readiness_tests::current_chatgpt_composer_is_not_an_auth_or_search_input)
| test(=browser_surface::prompt_submission::readiness_tests::current_chatgpt_layout_submits_once_and_protects_drafts_and_generation)
| test(=browser_surface::prompt_submission::readiness_tests::current_chatgpt_user_bubble_is_required_for_delivery_receipt)
| test(=browser_surface::prompt_submission::readiness_tests::failed_page_inspection_invalidates_earlier_readiness)
| test(=browser_surface::prompt_submission::readiness_tests::image_compat_submission_waits_for_enabled_button_and_sends_once)
| test(=browser_surface::prompt_submission::readiness_tests::owned_draft_recovery_rechecks_composer_and_page_before_replacement)
| test(=browser_surface::prompt_submission::readiness_tests::send_activation_rechecks_ownership_and_uses_the_button_handler_once)
Expand Down Expand Up @@ -91,8 +96,13 @@ package(cccc-pair-web) & (
| test(=browser_surface::browser_surface_tests::shared_owner::shared_windows_submit_independent_batches_while_viewers_capture)
| test(=browser_surface::browser_surface_tests::shutdown_closes_all_browser_processes)
| test(=browser_surface::browser_surface_tests::special_key_command_applies_native_input_behavior)
| test(=browser_surface::pairing::tests::current_chatgpt_pairing_receipt_keeps_exact_user_and_assistant_boundaries)
| test(=browser_surface::prompt_submission::grok_tests::grok_controls_busy_state_drafts_and_user_receipts)
| test(=browser_surface::prompt_submission::readiness_tests::chatgpt_auth_and_landing_inputs_are_not_conversation_composers)
| test(=browser_surface::prompt_submission::readiness_tests::current_chatgpt_composer_is_not_an_auth_or_search_input)
| test(=browser_surface::prompt_submission::readiness_tests::current_chatgpt_layout_submits_once_and_protects_drafts_and_generation)
| test(=browser_surface::prompt_submission::readiness_tests::current_chatgpt_user_bubble_is_required_for_delivery_receipt)
| test(=browser_surface::prompt_submission::readiness_tests::failed_page_inspection_invalidates_earlier_readiness)
| test(=browser_surface::prompt_submission::readiness_tests::image_compat_submission_waits_for_enabled_button_and_sends_once)
| test(=browser_surface::prompt_submission::readiness_tests::owned_draft_recovery_rechecks_composer_and_page_before_replacement)
| test(=browser_surface::prompt_submission::readiness_tests::send_activation_rechecks_ownership_and_uses_the_button_handler_once)
Expand Down
62 changes: 62 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions crates/cccc-cli/src/args/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ pub enum ActorAction {
runtime: String,
#[arg(long, default_value = "default", value_parser = ["default", "acp"])]
runtime_mode: String,
/// Read-only native turn observation; takes effect on the next start.
#[arg(long, default_value = "off", value_parser = ["off", "auto", "hermes_turn_lease"])]
turn_probe: String,
#[arg(long, default_value = "")]
command: String,
#[arg(long = "env")]
Expand Down Expand Up @@ -47,6 +50,9 @@ pub enum ActorAction {
runtime: Option<String>,
#[arg(long, value_parser = ["default", "acp"])]
runtime_mode: Option<String>,
/// Read-only native turn observation; takes effect on the next start.
#[arg(long, value_parser = ["off", "auto", "hermes_turn_lease"])]
turn_probe: Option<String>,
#[arg(long)]
scope: Option<String>,
#[arg(long)]
Expand Down
5 changes: 4 additions & 1 deletion crates/cccc-cli/src/commands/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub async fn run(client: &DaemonClient, home: &HomeLayout, args: ActorArgs) -> R
title,
runtime,
runtime_mode,
turn_probe,
command,
env: raw_env,
scope,
Expand All @@ -36,7 +37,7 @@ pub async fn run(client: &DaemonClient, home: &HomeLayout, args: ActorArgs) -> R
"actor_add",
json!({
"group_id":group(home,group_id)?,"actor_id":actor_id,"title":title,
"runtime":runtime,"runtime_mode":runtime_mode,"command":command,"env":env(raw_env)?,
"runtime":runtime,"runtime_mode":runtime_mode,"turn_probe":turn_probe,"command":command,"env":env(raw_env)?,
"default_scope_key":scope,"submit":submit,"by":by
}),
)
Expand All @@ -52,6 +53,7 @@ pub async fn run(client: &DaemonClient, home: &HomeLayout, args: ActorArgs) -> R
title,
runtime,
runtime_mode,
turn_probe,
scope,
command,
env: raw_env,
Expand All @@ -63,6 +65,7 @@ pub async fn run(client: &DaemonClient, home: &HomeLayout, args: ActorArgs) -> R
optional(&mut patch, "title", title);
optional(&mut patch, "runtime", runtime);
optional(&mut patch, "runtime_mode", runtime_mode);
optional(&mut patch, "turn_probe", turn_probe);
if let Some(scope) = scope {
patch.insert(
"default_scope_key".into(),
Expand Down
19 changes: 19 additions & 0 deletions crates/cccc-contracts/src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ pub enum RuntimeMode {
Acp,
}

/// Optional authoritative observation for a native terminal, applied on next start.
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default)]
#[serde(rename_all = "snake_case")]
pub enum TurnProbe {
#[default]
Off,
Auto,
HermesTurnLease,
}

impl TurnProbe {
pub const fn is_off(&self) -> bool {
matches!(self, Self::Off)
}
}

impl RuntimeMode {
pub const fn is_default(&self) -> bool {
matches!(self, Self::Default)
Expand Down Expand Up @@ -213,6 +229,8 @@ pub struct Actor {
pub runtime: ActorRuntime,
#[serde(default, skip_serializing_if = "RuntimeMode::is_default")]
pub runtime_mode: RuntimeMode,
#[serde(default, skip_serializing_if = "TurnProbe::is_off")]
pub turn_probe: TurnProbe,
#[serde(default)]
pub runtime_state_source: RuntimeStateSource,
#[serde(default)]
Expand Down Expand Up @@ -255,6 +273,7 @@ impl Actor {
runner: RunnerKind::default(),
runtime: ActorRuntime::default(),
runtime_mode: RuntimeMode::default(),
turn_probe: TurnProbe::Off,
runtime_state_source: RuntimeStateSource::default(),
internal_kind: None,
avatar_asset_path: String::new(),
Expand Down
2 changes: 1 addition & 1 deletion crates/cccc-contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub mod voice_secretary;

pub use actor::{
Actor, ActorRole, ActorRuntime, ActorSubmit, GroupState, RunnerKind, RuntimeMode,
RuntimeStateSource,
RuntimeStateSource, TurnProbe,
};
pub use codex_voice::{AgentRuntimeSettings, CodexVoiceAnalystSettings, CodexVoiceSettings};
pub use deepseek::{
Expand Down
72 changes: 71 additions & 1 deletion crates/cccc-core/src/profiles.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cccc_contracts::{ActorRuntime, ActorSubmit, RunnerKind, RuntimeMode, utc_now};
use cccc_contracts::{ActorRuntime, ActorSubmit, RunnerKind, RuntimeMode, TurnProbe, utc_now};
use serde::{Deserialize, Serialize};
use serde_json::{Map, Value, json};
use sha2::{Digest, Sha256};
Expand Down Expand Up @@ -52,6 +52,7 @@ struct SecretDoc {
pub struct RuntimeProfileConfig {
pub runtime: ActorRuntime,
pub runtime_mode: RuntimeMode,
pub turn_probe: TurnProbe,
pub runner: RunnerKind,
pub command: Vec<String>,
pub submit: ActorSubmit,
Expand Down Expand Up @@ -150,12 +151,14 @@ impl ProfileStore {
let runtime_mode = parse_profile_field(&profile, "runtime_mode", RuntimeMode::default())?;
runtime_mode.validate(runtime).map_err(io::Error::other)?;
let runner = runtime.runner_for(runtime_mode);
let turn_probe = parse_profile_field(&profile, "turn_probe", TurnProbe::Off)?;
let submit = parse_profile_field(&profile, "submit", ActorSubmit::default())?;
let command = parse_profile_command(&profile)?;
let environment = self.secret_values_ref(profile_id, scope, owner_id)?;
Ok(Some(RuntimeProfileConfig {
runtime,
runtime_mode,
turn_probe,
runner,
command,
submit,
Expand Down Expand Up @@ -234,6 +237,19 @@ impl ProfileStore {
"runtime_mode".into(),
serde_json::to_value(runtime_mode).map_err(io::Error::other)?,
);
let turn_probe: TurnProbe = parse_profile_field(
&Value::Object(profile.clone()),
"turn_probe",
TurnProbe::Off,
)?;
if turn_probe.is_off() {
profile.remove("turn_probe");
} else {
profile.insert(
"turn_probe".into(),
serde_json::to_value(turn_probe).map_err(io::Error::other)?,
);
}
profile.insert(
"runner".into(),
serde_json::to_value(runtime.runner_for(runtime_mode)).map_err(io::Error::other)?,
Expand Down Expand Up @@ -262,6 +278,7 @@ impl ProfileStore {
| "owner_id"
| "runtime"
| "runtime_mode"
| "turn_probe"
| "runner"
| "command"
| "submit"
Expand Down Expand Up @@ -778,6 +795,59 @@ fn python_repr(value: &Value) -> String {
mod tests {
use super::*;

#[test]
fn turn_probe_is_opt_in_and_profile_controlled() {
let temp = tempfile::tempdir().expect("tempdir");
let home = HomeLayout::from_path(temp.path()).expect("home");
let store = ProfileStore::new(home).expect("store");
let off = store
.upsert(
json!({"id":"native", "runtime":"hermes"})
.as_object()
.expect("profile")
.clone(),
None,
)
.expect("default profile");
assert!(off.get("turn_probe").is_none());
assert_eq!(
store
.runtime_ref("native", "global", "")
.expect("runtime")
.expect("profile")
.turn_probe,
TurnProbe::Off
);
store
.upsert(
json!({"id":"native", "runtime":"hermes", "turn_probe":"auto"})
.as_object()
.expect("profile")
.clone(),
None,
)
.expect("opt in");
assert_eq!(
store
.runtime_ref("native", "global", "")
.expect("runtime")
.expect("profile")
.turn_probe,
TurnProbe::Auto
);
assert!(
store
.upsert(
json!({"id":"native", "turn_probe":"guess_from_output"})
.as_object()
.expect("profile")
.clone(),
None
)
.is_err()
);
}

#[test]
fn profile_upsert_canonicalizes_shell_command_strings() {
let temp = tempfile::tempdir().expect("tempdir");
Expand Down
3 changes: 2 additions & 1 deletion crates/cccc-daemon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ chrono.workspace = true
fs2.workspace = true
futures-util.workspace = true
mime_guess.workspace = true
nix = { workspace = true, features = ["hostname", "signal", "process"] }
nix = { workspace = true, features = ["hostname", "signal", "process", "time", "feature"] }
percent-encoding.workspace = true
regex.workspace = true
same-file.workspace = true
reqwest.workspace = true
rustls.workspace = true
rusqlite = { version = "0.32.1", features = ["bundled", "hooks", "limits"] }
tokio-rustls.workspace = true
serde.workspace = true
serde_json.workspace = true
Expand Down
1 change: 1 addition & 0 deletions crates/cccc-daemon/src/ops/actor_activity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ impl Publisher {
let mut payloads = Vec::new();
let mut snapshot = BTreeMap::new();
for actor in &group.actors {
super::turn_probe::refresh(&group.group_id, actor);
if let Some(payload) = running_payload(store.home(), group, actor) {
let runner = text(&payload, "runner_effective", "pty");
let state = text(&payload, "effective_working_state", "waiting");
Expand Down
Loading
Loading