Retire Convex paths and standardize local-first Pi runtime
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
-- 002-ai-runtime-store.sql
|
||||
-- MNote ACP/Hermes runtime session store.
|
||||
-- MNote AI runtime session store.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ai_runtime_runs (
|
||||
id TEXT PRIMARY KEY,
|
||||
|
||||
@@ -591,7 +591,7 @@ fn list_ai_agent_profile_access_rows(
|
||||
g.can_manage_config, g.created_at, g.updated_at, g.revision
|
||||
FROM ai_agent_profiles p
|
||||
JOIN ai_agent_profile_grants g ON g.profile_id = p.id
|
||||
WHERE p.agent_id = 'hermes'
|
||||
WHERE p.agent_id = 'pi'
|
||||
AND p.status = 'active'
|
||||
AND g.can_run = 1
|
||||
AND (
|
||||
@@ -2002,12 +2002,24 @@ impl ControlPlaneStore for SqliteControlPlaneStore {
|
||||
}
|
||||
let conn = self.lock_conn()?;
|
||||
let now = now_text();
|
||||
// 退役 brand:历史 hermes agent_id 就地迁到 pi,避免 UNIQUE 下再插一套孤儿行。
|
||||
conn.execute(
|
||||
"UPDATE ai_agent_profiles
|
||||
SET agent_id = 'pi',
|
||||
display_name = CASE
|
||||
WHEN display_name = '我的 Hermes' THEN '我的 Pi'
|
||||
ELSE display_name
|
||||
END,
|
||||
updated_at = ?1
|
||||
WHERE agent_id = 'hermes'",
|
||||
params![now],
|
||||
)?;
|
||||
conn.execute(
|
||||
"INSERT INTO ai_agent_profiles (
|
||||
id, agent_id, profile_kind, owner_user_id, base_profile_name,
|
||||
isolated_profile_name, display_name, status, created_at, updated_at, revision
|
||||
)
|
||||
VALUES ('shared_lite', 'hermes', 'shared', '', 'lite', 'lite', 'Lite', 'active', ?1, ?2, 1)
|
||||
VALUES ('shared_lite', 'pi', 'shared', '', 'lite', 'lite', 'Lite', 'active', ?1, ?2, 1)
|
||||
ON CONFLICT(agent_id, profile_kind, owner_user_id, base_profile_name)
|
||||
DO UPDATE SET status = 'active', updated_at = excluded.updated_at",
|
||||
params![now, now],
|
||||
@@ -2093,7 +2105,7 @@ impl ControlPlaneStore for SqliteControlPlaneStore {
|
||||
id, agent_id, profile_kind, owner_user_id, base_profile_name,
|
||||
isolated_profile_name, display_name, status, created_at, updated_at, revision
|
||||
)
|
||||
VALUES (?1, 'hermes', 'shared', '', ?2, ?3, ?4, 'active', ?5, ?6, 1)
|
||||
VALUES (?1, 'pi', 'shared', '', ?2, ?3, ?4, 'active', ?5, ?6, 1)
|
||||
ON CONFLICT(agent_id, profile_kind, owner_user_id, base_profile_name)
|
||||
DO UPDATE SET status = 'active', display_name = excluded.display_name,
|
||||
isolated_profile_name = excluded.isolated_profile_name, updated_at = excluded.updated_at",
|
||||
@@ -2121,9 +2133,10 @@ impl ControlPlaneStore for SqliteControlPlaneStore {
|
||||
id, agent_id, profile_kind, owner_user_id, base_profile_name,
|
||||
isolated_profile_name, display_name, status, created_at, updated_at, revision
|
||||
)
|
||||
VALUES (?1, 'hermes', 'personal', ?2, 'default', ?3, '我的 Hermes', 'active', ?4, ?5, 1)
|
||||
VALUES (?1, 'pi', 'personal', ?2, 'default', ?3, '我的 Pi', 'active', ?4, ?5, 1)
|
||||
ON CONFLICT(agent_id, profile_kind, owner_user_id, base_profile_name)
|
||||
DO UPDATE SET status = 'active', updated_at = excluded.updated_at",
|
||||
DO UPDATE SET status = 'active', display_name = excluded.display_name,
|
||||
isolated_profile_name = excluded.isolated_profile_name, updated_at = excluded.updated_at",
|
||||
params![personal_profile_id, user_id, personal_profile_name, now, now],
|
||||
)?;
|
||||
let personal_grant_id = format!("grant_{personal_profile_id}_owner");
|
||||
@@ -4461,8 +4474,8 @@ mod tests {
|
||||
session_id: "sess_1".to_string(),
|
||||
run_id: "run_1".to_string(),
|
||||
title: Some("初始标题".to_string()),
|
||||
profile: "reasonix".to_string(),
|
||||
acp_runtime: "reasonix".to_string(),
|
||||
profile: "pi".to_string(),
|
||||
acp_runtime: "pi".to_string(),
|
||||
trace_id: Some("trace_1".to_string()),
|
||||
status: "running".to_string(),
|
||||
runtime_json: "{\"status\":\"running\"}".to_string(),
|
||||
@@ -4480,8 +4493,8 @@ mod tests {
|
||||
session_id: "sess_1".to_string(),
|
||||
run_id: "run_1".to_string(),
|
||||
title: Some("更新标题".to_string()),
|
||||
profile: "reasonix".to_string(),
|
||||
acp_runtime: "reasonix".to_string(),
|
||||
profile: "pi".to_string(),
|
||||
acp_runtime: "pi".to_string(),
|
||||
trace_id: Some("trace_2".to_string()),
|
||||
status: "completed".to_string(),
|
||||
runtime_json: "{\"status\":\"completed\"}".to_string(),
|
||||
@@ -4511,8 +4524,8 @@ mod tests {
|
||||
document_id: Some("doc_1".to_string()),
|
||||
session_id: "sess_1".to_string(),
|
||||
run_id: "run_1".to_string(),
|
||||
profile: "reasonix".to_string(),
|
||||
acp_runtime: "reasonix".to_string(),
|
||||
profile: "pi".to_string(),
|
||||
acp_runtime: "pi".to_string(),
|
||||
event_type: "message.delta".to_string(),
|
||||
payload_json: "{\"text\":\"hello\"}".to_string(),
|
||||
})
|
||||
@@ -4526,8 +4539,8 @@ mod tests {
|
||||
document_id: Some("doc_1".to_string()),
|
||||
session_id: "sess_1".to_string(),
|
||||
run_id: "run_1".to_string(),
|
||||
profile: "reasonix".to_string(),
|
||||
acp_runtime: "reasonix".to_string(),
|
||||
profile: "pi".to_string(),
|
||||
acp_runtime: "pi".to_string(),
|
||||
event_type: "run.completed".to_string(),
|
||||
payload_json: "{\"status\":\"completed\"}".to_string(),
|
||||
})
|
||||
@@ -4639,8 +4652,8 @@ mod tests {
|
||||
session_id: "sess_1".to_string(),
|
||||
run_id: "run_1".to_string(),
|
||||
title: None,
|
||||
profile: "reasonix".to_string(),
|
||||
acp_runtime: "reasonix".to_string(),
|
||||
profile: "pi".to_string(),
|
||||
acp_runtime: "pi".to_string(),
|
||||
trace_id: None,
|
||||
status: "completed".to_string(),
|
||||
runtime_json: "{\"status\":\"completed\"}".to_string(),
|
||||
@@ -4963,7 +4976,7 @@ mod tests {
|
||||
workspace_id: Some("ws_1".to_string()),
|
||||
session_id: "sess_1".to_string(),
|
||||
run_id: Some("run_2".to_string()),
|
||||
provider: "reasonix".to_string(),
|
||||
provider: "pi".to_string(),
|
||||
provider_session_id: None,
|
||||
tool_name: "fs.write".to_string(),
|
||||
allowed: false,
|
||||
|
||||
@@ -1125,7 +1125,7 @@ fn list_ai_agent_profile_access_rows(
|
||||
g.can_manage_config, g.created_at, g.updated_at, g.revision
|
||||
FROM ai_agent_profiles p
|
||||
JOIN ai_agent_profile_grants g ON g.profile_id = p.id
|
||||
WHERE p.agent_id = 'hermes'
|
||||
WHERE p.agent_id = 'pi'
|
||||
AND p.status = 'active'
|
||||
AND g.can_run = 1
|
||||
AND (
|
||||
@@ -2530,12 +2530,24 @@ impl ControlPlaneStore for TursoControlPlaneStore {
|
||||
}
|
||||
let conn = self.lock_conn()?;
|
||||
let now = now_text();
|
||||
// 退役 brand:历史 hermes agent_id 就地迁到 pi,避免 UNIQUE 下再插一套孤儿行。
|
||||
conn.execute(
|
||||
"UPDATE ai_agent_profiles
|
||||
SET agent_id = 'pi',
|
||||
display_name = CASE
|
||||
WHEN display_name = '我的 Hermes' THEN '我的 Pi'
|
||||
ELSE display_name
|
||||
END,
|
||||
updated_at = ?1
|
||||
WHERE agent_id = 'hermes'",
|
||||
params![now],
|
||||
)?;
|
||||
conn.execute(
|
||||
"INSERT INTO ai_agent_profiles (
|
||||
id, agent_id, profile_kind, owner_user_id, base_profile_name,
|
||||
isolated_profile_name, display_name, status, created_at, updated_at, revision
|
||||
)
|
||||
VALUES ('shared_lite', 'hermes', 'shared', '', 'lite', 'lite', 'Lite', 'active', ?1, ?2, 1)
|
||||
VALUES ('shared_lite', 'pi', 'shared', '', 'lite', 'lite', 'Lite', 'active', ?1, ?2, 1)
|
||||
ON CONFLICT(agent_id, profile_kind, owner_user_id, base_profile_name)
|
||||
DO UPDATE SET status = 'active', updated_at = excluded.updated_at",
|
||||
params![now, now],
|
||||
@@ -2621,7 +2633,7 @@ impl ControlPlaneStore for TursoControlPlaneStore {
|
||||
id, agent_id, profile_kind, owner_user_id, base_profile_name,
|
||||
isolated_profile_name, display_name, status, created_at, updated_at, revision
|
||||
)
|
||||
VALUES (?1, 'hermes', 'shared', '', ?2, ?3, ?4, 'active', ?5, ?6, 1)
|
||||
VALUES (?1, 'pi', 'shared', '', ?2, ?3, ?4, 'active', ?5, ?6, 1)
|
||||
ON CONFLICT(agent_id, profile_kind, owner_user_id, base_profile_name)
|
||||
DO UPDATE SET status = 'active', display_name = excluded.display_name,
|
||||
isolated_profile_name = excluded.isolated_profile_name, updated_at = excluded.updated_at",
|
||||
@@ -2649,9 +2661,10 @@ impl ControlPlaneStore for TursoControlPlaneStore {
|
||||
id, agent_id, profile_kind, owner_user_id, base_profile_name,
|
||||
isolated_profile_name, display_name, status, created_at, updated_at, revision
|
||||
)
|
||||
VALUES (?1, 'hermes', 'personal', ?2, 'default', ?3, '我的 Hermes', 'active', ?4, ?5, 1)
|
||||
VALUES (?1, 'pi', 'personal', ?2, 'default', ?3, '我的 Pi', 'active', ?4, ?5, 1)
|
||||
ON CONFLICT(agent_id, profile_kind, owner_user_id, base_profile_name)
|
||||
DO UPDATE SET status = 'active', updated_at = excluded.updated_at",
|
||||
DO UPDATE SET status = 'active', display_name = excluded.display_name,
|
||||
isolated_profile_name = excluded.isolated_profile_name, updated_at = excluded.updated_at",
|
||||
params![personal_profile_id, user_id, personal_profile_name, now, now],
|
||||
)?;
|
||||
let personal_grant_id = format!("grant_{personal_profile_id}_owner");
|
||||
@@ -4891,8 +4904,8 @@ mod tests {
|
||||
session_id: "sess_1".to_string(),
|
||||
run_id: "run_1".to_string(),
|
||||
title: Some("初始标题".to_string()),
|
||||
profile: "reasonix".to_string(),
|
||||
acp_runtime: "reasonix".to_string(),
|
||||
profile: "pi".to_string(),
|
||||
acp_runtime: "pi".to_string(),
|
||||
trace_id: Some("trace_1".to_string()),
|
||||
status: "running".to_string(),
|
||||
runtime_json: "{\"status\":\"running\"}".to_string(),
|
||||
@@ -4910,8 +4923,8 @@ mod tests {
|
||||
session_id: "sess_1".to_string(),
|
||||
run_id: "run_1".to_string(),
|
||||
title: Some("更新标题".to_string()),
|
||||
profile: "reasonix".to_string(),
|
||||
acp_runtime: "reasonix".to_string(),
|
||||
profile: "pi".to_string(),
|
||||
acp_runtime: "pi".to_string(),
|
||||
trace_id: Some("trace_2".to_string()),
|
||||
status: "completed".to_string(),
|
||||
runtime_json: "{\"status\":\"completed\"}".to_string(),
|
||||
@@ -4941,8 +4954,8 @@ mod tests {
|
||||
document_id: Some("doc_1".to_string()),
|
||||
session_id: "sess_1".to_string(),
|
||||
run_id: "run_1".to_string(),
|
||||
profile: "reasonix".to_string(),
|
||||
acp_runtime: "reasonix".to_string(),
|
||||
profile: "pi".to_string(),
|
||||
acp_runtime: "pi".to_string(),
|
||||
event_type: "message.delta".to_string(),
|
||||
payload_json: "{\"text\":\"hello\"}".to_string(),
|
||||
})
|
||||
@@ -4956,8 +4969,8 @@ mod tests {
|
||||
document_id: Some("doc_1".to_string()),
|
||||
session_id: "sess_1".to_string(),
|
||||
run_id: "run_1".to_string(),
|
||||
profile: "reasonix".to_string(),
|
||||
acp_runtime: "reasonix".to_string(),
|
||||
profile: "pi".to_string(),
|
||||
acp_runtime: "pi".to_string(),
|
||||
event_type: "run.completed".to_string(),
|
||||
payload_json: "{\"status\":\"completed\"}".to_string(),
|
||||
})
|
||||
@@ -5005,8 +5018,8 @@ mod tests {
|
||||
session_id: "sess_1".to_string(),
|
||||
run_id: "run_1".to_string(),
|
||||
title: None,
|
||||
profile: "reasonix".to_string(),
|
||||
acp_runtime: "reasonix".to_string(),
|
||||
profile: "pi".to_string(),
|
||||
acp_runtime: "pi".to_string(),
|
||||
trace_id: None,
|
||||
status: "completed".to_string(),
|
||||
runtime_json: "{\"status\":\"completed\"}".to_string(),
|
||||
@@ -5471,7 +5484,7 @@ mod tests {
|
||||
workspace_id: Some("ws_1".to_string()),
|
||||
session_id: "sess_1".to_string(),
|
||||
run_id: Some("run_2".to_string()),
|
||||
provider: "reasonix".to_string(),
|
||||
provider: "pi".to_string(),
|
||||
provider_session_id: None,
|
||||
tool_name: "fs.write".to_string(),
|
||||
allowed: false,
|
||||
|
||||
@@ -79,8 +79,8 @@ fn libsql_local_store_covers_control_plane_core_flows() {
|
||||
session_id: "sess_1".to_string(),
|
||||
run_id: "run_1".to_string(),
|
||||
title: Some("libSQL run".to_string()),
|
||||
profile: "reasonix".to_string(),
|
||||
acp_runtime: "reasonix".to_string(),
|
||||
profile: "pi".to_string(),
|
||||
acp_runtime: "pi".to_string(),
|
||||
trace_id: Some("trace_1".to_string()),
|
||||
status: "running".to_string(),
|
||||
runtime_json: "{\"status\":\"running\"}".to_string(),
|
||||
@@ -97,8 +97,8 @@ fn libsql_local_store_covers_control_plane_core_flows() {
|
||||
document_id: Some("doc_1".to_string()),
|
||||
session_id: "sess_1".to_string(),
|
||||
run_id: "run_1".to_string(),
|
||||
profile: "reasonix".to_string(),
|
||||
acp_runtime: "reasonix".to_string(),
|
||||
profile: "pi".to_string(),
|
||||
acp_runtime: "pi".to_string(),
|
||||
event_type: "message.delta".to_string(),
|
||||
payload_json: "{\"text\":\"hello\"}".to_string(),
|
||||
})
|
||||
@@ -181,8 +181,8 @@ fn libsql_local_store_handles_parallel_control_plane_writes() {
|
||||
session_id: "parallel_session".to_string(),
|
||||
run_id: "parallel_run".to_string(),
|
||||
title: Some("Parallel run".to_string()),
|
||||
profile: "reasonix".to_string(),
|
||||
acp_runtime: "reasonix".to_string(),
|
||||
profile: "pi".to_string(),
|
||||
acp_runtime: "pi".to_string(),
|
||||
trace_id: None,
|
||||
status: "running".to_string(),
|
||||
runtime_json: "{}".to_string(),
|
||||
@@ -231,8 +231,8 @@ fn libsql_local_store_handles_parallel_control_plane_writes() {
|
||||
document_id: Some("parallel_doc".to_string()),
|
||||
session_id: "parallel_session".to_string(),
|
||||
run_id: "parallel_run".to_string(),
|
||||
profile: "reasonix".to_string(),
|
||||
acp_runtime: "reasonix".to_string(),
|
||||
profile: "pi".to_string(),
|
||||
acp_runtime: "pi".to_string(),
|
||||
event_type: "message.delta".to_string(),
|
||||
payload_json: format!("{{\"index\":{index}}}"),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user