Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
2e092fc
feat(cli): follow the Session's default branch
yyhhyyyyyy Nov 20, 2026
563f70f
feat(web): centre the Session's default branch
yyhhyyyyyy Nov 20, 2026
2884045
feat(acp): target the Session's default branch
yyhhyyyyyy Nov 20, 2026
d549f04
chore(graph): regenerate after the clients' imports
yyhhyyyyyy Nov 20, 2026
f92ec38
Merge branch 'hui/branch-default-routing' into hui/pr4-clients
yyhhyyyyyy Nov 20, 2026
af7bd0c
feat(clients): resume the shown line from the attach cursor
yyhhyyyyyy Nov 20, 2026
fcfd5d5
fix(cli): follow the line the attach reply names, and show its facts
yyhhyyyyyy Nov 20, 2026
4bd2be0
fix(acp): recover the line the attach reply names
yyhhyyyyyy Nov 20, 2026
70561a3
fix(cli): attribute a refused move to the line that raised it
yyhhyyyyyy Nov 20, 2026
17e9138
docs(cli): name the default branch in the permission and lines texts
yyhhyyyyyy Nov 20, 2026
9af71e7
fix(web): mark the root row with both of its roles
yyhhyyyyyy Nov 20, 2026
16579a0
fix(web): report a moved centre whose transcript could not be read
yyhhyyyyyy Nov 20, 2026
833acba
fix(web): fork through the command that reads the root
yyhhyyyyyy Nov 20, 2026
2f80287
test(cli): wait for the moved transcript before reading the bar
yyhhyyyyyy Nov 20, 2026
4b9308c
fix(web): keep the timeline fork's picked cut
yyhhyyyyyy Nov 20, 2026
2ca6953
Merge branch 'hui/branch-default-routing' into hui/pr4-clients
yyhhyyyyyy Nov 20, 2026
471b5c2
fix(cli): pair a resumed line's model and preset with its cursor
yyhhyyyyyy Nov 20, 2026
fd5f9f9
fix(acp): load the line's own configuration and settle a prompt a mov…
yyhhyyyyyy Nov 20, 2026
cac34ee
fix(web): keep a centre's model, permission and timeline with the lin…
yyhhyyyyyy Nov 20, 2026
a33d91a
docs: state the configuration a default line's cursor pairs with
yyhhyyyyyy Nov 20, 2026
b379628
fix(web): keep the centre and the root reachable through a move
yyhhyyyyyy Nov 20, 2026
eb3f877
fix(cli): adopt a resumed launch's model after its permission preset
yyhhyyyyyy Nov 20, 2026
921e24d
test(web): pin the line the chat page hands the timeline
yyhhyyyyyy Nov 20, 2026
deebefd
docs: state the root's configuration and a line's window watermark
yyhhyyyyyy Nov 20, 2026
7a9592e
test(cli): read the attach window before a resumed launch adopts its …
yyhhyyyyyy Nov 20, 2026
4322aa6
Merge branch 'hui/branch-default-routing' into hui/pr4-clients
yyhhyyyyyy Nov 20, 2026
8a66879
fix(clients): read a line's adopted configuration from its own history
yyhhyyyyyy Nov 20, 2026
e7060e1
fix(web): source a line's model and keep its newest move
yyhhyyyyyy Nov 20, 2026
9697975
test(dimcode): expect the attach before the version refusal
yyhhyyyyyy Nov 20, 2026
9ac78a3
fix(web): keep the interrupted draft on the line it started on
yyhhyyyyyy Nov 20, 2026
2e9e344
Merge remote-tracking branch 'origin/hui/session-model-get' into hui/…
yyhhyyyyyy Nov 21, 2026
75ea6f3
fix(clients): read a line's configuration through session.model.get
yyhhyyyyyy Nov 21, 2026
c8bf0e0
fix(cli): ask a line's configuration only where a move asks for it
yyhhyyyyyy Nov 21, 2026
f77225a
fix(cli): carry no model for a line the client cannot read a configur…
yyhhyyyyyy Nov 21, 2026
3252327
test(cli): read the last painted bar with rfind
yyhhyyyyyy Nov 21, 2026
30c6c7b
Merge remote-tracking branch 'origin/hui/session-model-get' into hui/…
yyhhyyyyyy Nov 21, 2026
205862c
fix(clients): keep a move's model and policy through its reads
yyhhyyyyyy Nov 21, 2026
394d390
fix(cli): bind an opening policy reply to its line and move
yyhhyyyyyy Nov 21, 2026
b128313
fix(web): publish a line's policy and model only to that line
yyhhyyyyyy Nov 21, 2026
822b1ad
fix(web): keep a gesture's draft when its hidden composer sees a new …
yyhhyyyyyy Nov 21, 2026
96ffdd3
Merge remote-tracking branch 'origin/hui/session-model-get' into hui/…
yyhhyyyyyy Nov 21, 2026
ddbf0c5
test(web): give the page fixture its policy version
yyhhyyyyyy Nov 21, 2026
15052dd
Merge remote-tracking branch 'origin/hui/session-model-get' into hui/…
yyhhyyyyyy Nov 21, 2026
e530a98
fix(web): keep a line's policy, goal and commands on the line that is…
yyhhyyyyyy Nov 22, 2026
2964d21
fix(cli): show a moved line's policy as unknown until its own read
yyhhyyyyyy Nov 22, 2026
70c9245
test(web): wait for the published row instead of a fixed delay
yyhhyyyyyy Nov 22, 2026
6340cd8
test(web): contain the outgoing goal read's failure in its own case
yyhhyyyyyy Nov 22, 2026
c0a94a5
fix(cli): keep terminal commands and stops on the line their key named
yyhhyyyyyy Nov 22, 2026
d80661a
fix(web): name the line compact, usage and a failed goal read belong to
yyhhyyyyyy Nov 22, 2026
4d9a4ee
fix(cli): mark the policy unknown only when the daemon can read it
yyhhyyyyyy Nov 22, 2026
7dc874b
fix(web): keep the optional chain on the fork command
yyhhyyyyyy Nov 22, 2026
e544958
fix(cli): cancel a compact, usage or earlier read whose line moved
yyhhyyyyyy Nov 22, 2026
b400df1
test(cli): require the first opening read after the directory to be h…
yyhhyyyyyy Nov 22, 2026
604afd9
Merge remote-tracking branch 'origin/hui/session-model-get' into hui/…
yyhhyyyyyy Nov 22, 2026
0129034
Merge remote-tracking branch 'origin/main' into hui/pr4-clients
yyhhyyyyyy Nov 22, 2026
16295c5
fix(cli): keep a queued send and permission change on their Session
yyhhyyyyyy Nov 22, 2026
1963b87
fix(cli): register a resumed leaf once its launch settings apply
yyhhyyyyyy Nov 22, 2026
cd9db07
style(cli): format the queued-command and leaf fixes
yyhhyyyyyy Nov 22, 2026
d605517
test(cli): pass the leaf registration flag to the attach fixtures
yyhhyyyyyy Nov 22, 2026
1ee9fdc
fix(cli): keep stop gestures on their Session
yyhhyyyyyy Nov 22, 2026
db2d2c8
fix(cli): do not claim a kept draft on a refused send now
yyhhyyyyyy Nov 22, 2026
8164298
fix(cli): keep Home commands off the Session that replaces it
yyhhyyyyyy Nov 22, 2026
aea15e6
fix(cli): keep launch keys and the first message apart
yyhhyyyyyy Nov 22, 2026
e366143
Merge remote-tracking branch 'origin/main' into hui/pr4-clients
yyhhyyyyyy Nov 22, 2026
9ed18f2
test(cli): pass the register flag to main's switch tests
yyhhyyyyyy Nov 22, 2026
dba7375
fix(cli): bind a shell command to where it was typed
yyhhyyyyyy Nov 22, 2026
427aa10
test(web): cover retrying the accepted line's reads
yyhhyyyyyy Nov 23, 2026
534f0cd
fix(web): retry the accepted line's reads from the failed page
yyhhyyyyyy Nov 23, 2026
8fc608a
test(web): pin the retry's closed, reconnect and buffered-event paths
yyhhyyyyyy Nov 23, 2026
0c795e3
test(web): pin the retry after a failed pending-question read
yyhhyyyyyy Nov 23, 2026
dba4d0c
test(web): pin a goal read that reports the Session closed
yyhhyyyyyy Nov 23, 2026
ede18cc
fix(web): keep a retry's closed Session, attachment and buffered events
yyhhyyyyyy Nov 23, 2026
44fa34a
test(web): pin the reconnect exits that drop queued notifications
yyhhyyyyyy Nov 23, 2026
183cdff
Merge remote-tracking branch 'origin/main' into hui/pr4-clients
yyhhyyyyyy Nov 23, 2026
aba3a2b
fix(web): keep a reconnect's queued notifications and await its goal …
yyhhyyyyyy Nov 23, 2026
df943ad
test(web): pin a side line receiving events while the centre page is …
yyhhyyyyyy Nov 23, 2026
ad7141d
fix(web): hold a failed page's events for the centre line only
yyhhyyyyyy Nov 23, 2026
d80a4bb
test(web): pin the move and refresh exits that publish a stale page
yyhhyyyyyy Nov 23, 2026
bcf558e
test(web): await the move after the goal read it waits for
yyhhyyyyyy Nov 23, 2026
770232b
Merge remote-tracking branch 'origin/main' into hui/pr4-clients
yyhhyyyyyy Nov 23, 2026
c74f579
test(web): model the goal and the directory each pinned exit reads
yyhhyyyyyy Nov 23, 2026
9171e2e
fix(web): keep a failed page from the reads and moves that cross it
yyhhyyyyyy Nov 23, 2026
4f4b211
Cover a resync's stale answers over a moved page
yyhhyyyyyy Nov 23, 2026
ddf4774
Keep a resync's stale answers off a moved page
yyhhyyyyyy Nov 23, 2026
594f67d
Pin the page a resync's ready write belongs to
yyhhyyyyyy Nov 23, 2026
0e9938e
test(web): pin the retry's late policy read and the no-op move
yyhhyyyyyy Nov 23, 2026
a62e56a
fix(web): guard the retry's policy read and finish a no-op move
yyhhyyyyyy Nov 23, 2026
2c99210
test(web): pin the retry's live resume
yyhhyyyyyy Nov 23, 2026
7f70a60
fix(web): resume the retry's live consumer on success
yyhhyyyyyy Nov 23, 2026
781a89e
Merge remote-tracking branch 'origin/main' into hui/pr4-clients
yyhhyyyyyy Nov 23, 2026
c3162dd
Merge remote-tracking branch 'origin/main' into hui/pr4-clients
yyhhyyyyyy Nov 23, 2026
d464ece
test(acp): pin the default line's load, attach and model write
yyhhyyyyyy Nov 23, 2026
96eff7e
Merge remote-tracking branch 'origin/main' into hui/pr4-clients
yyhhyyyyyy Nov 23, 2026
309f5ec
Merge remote-tracking branch 'origin/main' into hui/pr4-clients
yyhhyyyyyy Nov 23, 2026
f303f09
test(web): pin late retry failures and goal reads to their centre
yyhhyyyyyy Nov 23, 2026
4b88788
fix(web): bind a late retry failure and goal read to their centre
yyhhyyyyyy Nov 23, 2026
01a70a6
test(web): pin a resync failure that a move overtook
yyhhyyyyyy Nov 23, 2026
b0308f1
test(web): expect the moved line own stored row
yyhhyyyyyy Nov 23, 2026
df959de
fix(web): keep a sync failure on the centre it started on
yyhhyyyyyy Nov 23, 2026
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
18 changes: 11 additions & 7 deletions crates/dim-acp/src/commands.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{config::Config, rpc::Rpc};
use agent_client_protocol::{Error, schema::v1 as acp};
use dim_agent_types::{DEFAULT_BRANCH_ID, GoalRead, GoalViewStatus};
use dim_agent_types::{GoalRead, GoalViewStatus};
use serde::Deserialize;
use serde_json::{Value, json};
use tokio_util::sync::CancellationToken;
Expand Down Expand Up @@ -80,6 +80,7 @@ pub(crate) fn available(config: &Config) -> Vec<acp::AvailableCommand> {
pub(crate) async fn run(
rpc: &Rpc,
id: &str,
branch: &str,
config: &Config,
name: &str,
words: &str,
Expand All @@ -98,7 +99,7 @@ pub(crate) async fn run(
let result = rpc
.call(
"session.context.compact",
json!({"sessionId":id,"branchId":DEFAULT_BRANCH_ID}),
json!({"sessionId":id,"branchId":branch}),
)
.await;
match result {
Expand All @@ -114,8 +115,8 @@ pub(crate) async fn run(
usage(rpc, &config.model.as_ref().unwrap().provider_id, cancelled).await?
}
"usage" => "Usage: /usage".into(),
"goal" => goal(rpc, id, words, cancelled).await?,
"loop" => loops(rpc, id, words, cancelled).await?,
"goal" => goal(rpc, id, branch, words, cancelled).await?,
"loop" => loops(rpc, id, branch, words, cancelled).await?,
_ => unreachable!(),
};
Ok(Some(text))
Expand All @@ -124,6 +125,7 @@ pub(crate) async fn run(
async fn goal(
rpc: &Rpc,
id: &str,
branch: &str,
words: &str,
cancelled: &CancellationToken,
) -> Result<String, Error> {
Expand All @@ -132,7 +134,7 @@ async fn goal(
if matches!(verb, "set" | "edit") && rest.is_empty() {
return Ok(GOAL_USAGE.into());
}
let query = json!({"sessionId":id,"branchId":DEFAULT_BRANCH_ID});
let query = json!({"sessionId":id,"branchId":branch});
let mut read: GoalRead = rpc.typed("session.goal.get", query.clone()).await?;
if !words.is_empty() {
let (method, objective) = match verb {
Expand Down Expand Up @@ -236,6 +238,7 @@ fn loop_report(loops: &[Loop]) -> String {
async fn loops(
rpc: &Rpc,
id: &str,
branch: &str,
words: &str,
cancelled: &CancellationToken,
) -> Result<String, Error> {
Expand All @@ -248,7 +251,7 @@ async fn loops(
let listed: LoopList = rpc
.typed(
"session.loop.list",
json!({"sessionId":id,"branchId":DEFAULT_BRANCH_ID}),
json!({"sessionId":id,"branchId":branch}),
)
.await?;
if words.is_empty() {
Expand Down Expand Up @@ -311,7 +314,8 @@ async fn loops(
.checked_mul(scale)
})
.filter(|seconds| *seconds > 0 && !rest.is_empty());
let mut params = json!({"sessionId":id,"branchId":DEFAULT_BRANCH_ID,"prompt":if seconds.is_some() {rest} else {words}});
let mut params =
json!({"sessionId":id,"branchId":branch,"prompt":if seconds.is_some() {rest} else {words}});
if let Some(seconds) = seconds {
params["everySeconds"] = json!(seconds);
}
Expand Down
101 changes: 65 additions & 36 deletions crates/dim-acp/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::rpc::Rpc;
use agent_client_protocol::{Error, schema::v1 as acp};
use dim_agent_types::{DEFAULT_BRANCH_ID, ModelId, PermissionPolicy, PermissionPreset};
use dim_client::wire::{Configuration, Event, EventContent};
use dim_agent_types::{ModelId, PermissionPolicy, PermissionPreset, ROOT_BRANCH_ID};
use dim_client::wire::{AdoptedConfiguration, Configuration, Event, EventContent};
use serde::Deserialize;
use serde_json::json;
use std::collections::{HashMap, HashSet};
Expand Down Expand Up @@ -97,10 +97,34 @@ pub(crate) async fn models(rpc: &Rpc) -> Result<Vec<Model>, Error> {
Ok(choices)
}

/// The configuration `branch` adopted at `through`, or at its head when
/// omitted, with that line's own committed cutoff. Callers ask a server that
/// offers the read: one without it cannot name this line's configuration, and
/// the attach reply's is the root's (design §14).
pub(crate) async fn adopted(
rpc: &Rpc,
session_id: &str,
branch: &str,
through: Option<u64>,
) -> Result<(u64, Option<Configuration>), Error> {
let mut params = json!({"sessionId":session_id,"branchId":branch});
if let Some(through) = through {
params["through"] = json!(through);
}
let reply: AdoptedConfiguration = rpc.typed("session.model.get", params).await?;
if reply.branch_id != branch {
return Err(Error::internal_error().data(json!({"code":"model_get_answered_another_line"})));
}
Ok((reply.through, reply.configuration.map(Configuration::from)))
}

impl Config {
/// Reads the Session's configuration for `branch`, the line its
/// conversation is on: its policy and its model are that line's (design §4).
pub(crate) async fn read(
rpc: &Rpc,
id: &str,
branch: &str,
model: Option<Configuration>,
) -> Result<Self, Error> {
let mut config = Self {
Expand Down Expand Up @@ -134,7 +158,7 @@ impl Config {
config.policy = Some(
rpc.typed(
"session.permission.get",
json!({"sessionId":id,"branchId":DEFAULT_BRANCH_ID}),
json!({"sessionId":id,"branchId":branch}),
)
.await?,
);
Expand Down Expand Up @@ -289,40 +313,44 @@ impl Config {
}

pub(crate) async fn recover_model(rpc: &Rpc, id: &str, value: &str) -> Result<Self, Error> {
let mut config = Self::read(rpc, id, None).await?;
config.set_model(rpc, id, value, true).await?;
#[derive(Deserialize)]
struct Current {
configuration: Option<AdoptedConfiguration>,
}
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
struct AdoptedConfiguration {
model: ModelId,
capability_snapshot: Option<Box<dim_agent_types::ModelCapabilitySnapshot>>,
model_preferences: Option<dim_agent_types::ModelPreferences>,
let branch = if rpc.supports("session.branches") {
let directory: dim_client::wire::BranchDirectory = rpc
.typed("session.branches", json!({"sessionId":id}))
.await?;
directory
.default_branch_id
.unwrap_or_else(|| ROOT_BRANCH_ID.to_owned())
} else {
ROOT_BRANCH_ID.to_owned()
};
let mut config = Self::read(rpc, id, &branch, None).await?;
// `session.attach` checks its route against the root and `session.submit`
// against the line it targets: restore an expired route on both.
let root = config.set_model(rpc, id, ROOT_BRANCH_ID, value, true).await;
if branch == ROOT_BRANCH_ID {
root?;
} else {
let line = config.set_model(rpc, id, &branch, value, true).await;
match (root, line) {
(Ok(()), Ok(())) => {}
(Ok(()), Err(error)) | (Err(error), Ok(()))
if error.data.as_ref().is_some_and(|data| {
data["nativeAppError"] == "provider_route_not_expired"
}) => {}
(Err(error), _) => return Err(error),
(_, Err(error)) => return Err(error),
}
}
let current: Current = rpc
.typed(
"session.model.get",
json!({"sessionId":id,"branchId":DEFAULT_BRANCH_ID}),
)
.await?;
let current = current.configuration.ok_or_else(Error::internal_error)?;
config.model = Some(Configuration {
provider_id: current.model.provider_id,
model_id: current.model.model_id,
catalog_provider_id: None,
capability_snapshot: current.capability_snapshot,
model_preferences: current.model_preferences,
});
let (_, current) = adopted(rpc, id, &branch, None).await?;
config.model = Some(current.ok_or_else(Error::internal_error)?);
Ok(config)
}

async fn set_model(
&mut self,
rpc: &Rpc,
id: &str,
branch: &str,
value: &str,
require_expired_route: bool,
) -> Result<(), Error> {
Expand All @@ -335,7 +363,7 @@ impl Config {
#[serde(rename_all = "camelCase")]
struct Select<'a> {
session_id: &'a str,
branch_id: &'static str,
branch_id: &'a str,
provider_id: &'a str,
model_id: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -348,7 +376,7 @@ impl Config {
.ok_or_else(Error::invalid_params)?;
let params = serde_json::to_value(Select {
session_id: id,
branch_id: DEFAULT_BRANCH_ID,
branch_id: branch,
provider_id: &model.provider,
model_id: &model.id,
require_expired_route: require_expired_route.then_some(true),
Expand All @@ -373,6 +401,7 @@ impl Config {
mut self,
rpc: &Rpc,
id: &str,
branch: &str,
key: &str,
value: &str,
) -> Result<Self, Error> {
Expand All @@ -381,17 +410,17 @@ impl Config {
let current: Policy = rpc
.typed(
"session.permission.get",
json!({"sessionId":id,"branchId":DEFAULT_BRANCH_ID}),
json!({"sessionId":id,"branchId":branch}),
)
.await?;
let mut policy = current.policy;
policy.preset =
serde_json::from_value(json!(value)).map_err(|_| Error::invalid_params())?;
rpc.call("session.permission.update",json!({"sessionId":id,"branchId":DEFAULT_BRANCH_ID,"expectedVersion":current.version,"policy":policy})).await?;
rpc.call("session.permission.update",json!({"sessionId":id,"branchId":branch,"expectedVersion":current.version,"policy":policy})).await?;
self.policy = Some(
rpc.typed(
"session.permission.get",
json!({"sessionId":id,"branchId":DEFAULT_BRANCH_ID}),
json!({"sessionId":id,"branchId":branch}),
)
.await?,
);
Expand All @@ -414,15 +443,15 @@ impl Config {
let result: Adopted = rpc
.typed(
"session.model.update",
json!({"sessionId":id,"branchId":DEFAULT_BRANCH_ID,"modelPreferences":{"reasoningEffort":patch}}),
json!({"sessionId":id,"branchId":branch,"modelPreferences":{"reasoningEffort":patch}}),
)
.await?;
if !matches!(result.outcome.as_str(), "adopted" | "unchanged") {
return Err(Error::internal_error());
}
}
"model" => {
self.set_model(rpc, id, value, false).await?;
self.set_model(rpc, id, branch, value, false).await?;
self.models = models(rpc).await?;
}
_ => return Err(Error::invalid_params()),
Expand Down
Loading