Skip to content
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Processes, agents, protocols, tools, approvals, storage and trust boundaries, wi
| [`crates/ai-host/`](crates/ai-host/README.md) | The shell's AI services behind one entry point, package `octosense-ai-host`: the octos kernel service, the `llm` host service with the platform's QR import, and apps' assistant access. |
| [`crates/kernel/`](crates/kernel/README.md) | The octos kernel service, package `octosense-kernel`: the [octos](https://github.com/octos-org/octos) agent kernel as a shell service, one per process, configured by AI providers and shared by its consumers. |
| [`crates/app-peers/`](crates/app-peers/README.md) | The app-agent broker: apps' access to the assistant ([Rinx ADR 0007](https://github.com/hagency-org/Rinx/blob/main/docs/adr/0007-host-owned-octos-app-peers.md)). |
| [`apps/`](apps/README.md) | The system apps (News, Photos, Maps, Camera, Mail, AI providers, YouTube) as contained script apps, their host services (`mail`, `llm`), the native comparison modules (`apps/*/native`), `apps/reference`, and the opt-in AppCard assistant (`apps/appcard`). |
| [`apps/`](apps/README.md) | The system apps (News, Photos, Maps, Camera, Mail, AI providers, YouTube) as contained script apps, their host services (`mail`, `llm`), `apps/reference`, and the opt-in AppCard assistant (`apps/appcard`). |
| `tools/` | `setup.py` (the pinned framework sources), the reviewed Makepad runtime patch (`runtime-patches/`), `kernel-artifact.py` (the octos kernel an Android APK bundles as `liboctos.so`), `check-shell-graph.sh` (the dependency-graph guards every shell build passes). |
| [`docs/adr/`](docs/adr/README.md) | Architecture decisions: this repository's, and the Home decisions 0001–0006 kept as history. |
| `Cargo.toml`, `Cargo.lock` | One workspace. Every external dependency is pinned once in `[workspace.dependencies]`. |
Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
| [`crates/ai-host/`](crates/ai-host/README.md) | Shell 的 AI 服务,统一入口,package `octosense-ai-host`:octos 内核服务、带平台二维码导入的 `llm` 宿主服务,以及应用访问助手的通道。 |
| [`crates/kernel/`](crates/kernel/README.md) | octos 内核服务,package `octosense-kernel`:把 [octos](https://github.com/octos-org/octos) Agent 内核作为 Shell 服务,每个进程一个,由 AI 服务商配置,供所有使用方共享。 |
| [`crates/app-peers/`](crates/app-peers/README.md) | 应用与 Agent 之间的代理:应用访问助手的通道([Rinx ADR 0007(英文)](https://github.com/hagency-org/Rinx/blob/main/docs/adr/0007-host-owned-octos-app-peers.md))。 |
| [`apps/`](apps/README.zh-CN.md) | 系统应用(新闻、相册、地图、相机、邮件、AI 服务商、YouTube),均为受隔离约束的脚本应用;它们的宿主服务(`mail`、`llm`);用于对比的原生模块(`apps/*/native`);`apps/reference`;以及需显式启用的 AppCard 助手(`apps/appcard`)。 |
| [`apps/`](apps/README.zh-CN.md) | 系统应用(新闻、相册、地图、相机、邮件、AI 服务商、YouTube),均为受隔离约束的脚本应用;它们的宿主服务(`mail`、`llm`);`apps/reference`;以及需显式启用的 AppCard 助手(`apps/appcard`)。 |
| `tools/` | `setup.py`(锁定版本的框架源码)、经审查的 Makepad 运行时补丁(`runtime-patches/`)、`kernel-artifact.py`(Android APK 以 `liboctos.so` 形式打包的 octos 内核)、`check-shell-graph.sh`(每个 Shell 构建都要通过的依赖图检查)。 |
| [`docs/adr/`](docs/adr/README.zh-CN.md) | 架构决策记录:本仓库的决策,以及作为历史保留的 Home 决策 0001–0006。 |
| `Cargo.toml`、`Cargo.lock` | 一个工作区。所有外部依赖都只在 `[workspace.dependencies]` 中锁定一次。 |
Expand Down
4 changes: 2 additions & 2 deletions apps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ them. They live in `apps/` of the [OctoSense repository](../README.md); until
`app-reference` (always on phones). Every native app the shells link is
declared in [`../native-apps.json`](../native-apps.json). News, Photos and
Maps are script apps only: their earlier native modules were deleted
(native-apps ADR 0004 §1, [#110](https://github.com/OctoSense-org/OctoSense/pull/110)). Photos' sample library, which Home mounts, is in
(native-apps ADR 0004 §1, [#113](https://github.com/OctoSense-org/OctoSense/pull/113)). Photos' sample library, which Home mounts, is in
`photos/resources/`.

The shell services these apps rely on are next door:
Expand Down Expand Up @@ -156,7 +156,7 @@ request.

```
<name>/bundle/ a contained script app: manifest.json, main.splash, artwork
<name>/native/ native comparison module (news, photos, maps); Photos' full-size library
photos/resources/ Photos' sample library, which Home mounts
mail/host-service/ octosense-mail-service, the `mail` host service (Rust)
ai-providers/ the `llm` host service (host-service/) and octosense-llm-config (config/:
octos's model catalog and provider registry, the profile merge, OCTOS1/OCTOS1E QR)
Expand Down
4 changes: 2 additions & 2 deletions apps/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ OctoSense-System-Apps 仓库(已归档)。
- **Reference**(`reference`):Shell 通过 `app-reference` 链接的 Rust
模块(手机上始终链接)。Shell 链接的所有原生应用都在
[`../native-apps.json`](../native-apps.json) 中声明。News、Photos 和 Maps
只有脚本应用版本:早期的原生模块已删除(原生应用 ADR 0004 §1,[#110](https://github.com/OctoSense-org/OctoSense/pull/110))。Home 挂载的
只有脚本应用版本:早期的原生模块已删除(原生应用 ADR 0004 §1,[#113](https://github.com/OctoSense-org/OctoSense/pull/113))。Home 挂载的
Photos 示例图库位于 `photos/resources/`。

这些应用依赖的 Shell 服务就在旁边:
Expand Down Expand Up @@ -131,7 +131,7 @@ OctoScript-App-Design-Flow 的 `AGENTS.md`,再读 `docs/QUICKSTART.md`),

```
<name>/bundle/ 隔离运行的脚本应用:manifest.json、main.splash、图片资源
<name>/native/ 原生对比模块(news、photos、maps);Photos 的原图库
photos/resources/ Home 挂载的 Photos 示例图库
mail/host-service/ octosense-mail-service,`mail` 宿主服务(Rust)
ai-providers/ `llm` 宿主服务(host-service/)和 octosense-llm-config(config/:
octos 模型目录与服务商注册表、profile 合并、OCTOS1/OCTOS1E 二维码)
Expand Down
9 changes: 6 additions & 3 deletions crates/kernel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,12 @@ system agent's tool set is its grants. Its default octos tools are
file tools (octos fences them to the session's working directory), memory,
`ask_user_question`, media viewing, octos's `web_search` / `web_fetch` (until
toolbox grants replace them, #108) and `tool_search`. Granted toolbox and
cross-app tools, and command execution when the person turns it on in
Settings (off by default), join it as host tools through `SystemAgentTools`;
command execution is a host tool with a live approval (`terminal.run`).
cross-app tools join it as host tools through `SystemAgentTools`. Command
execution is **planned, not available**: it is to be a host tool with a live
approval (`terminal.run`), off by default and turned on by a Settings
switch. `SystemAgentTools::grant_command_execution` is the seam, but no
Settings switch sets it yet, and the host tool cannot be registered on the
system session until octos can register tools per session (octos#2567).

**What the kernel enforces today.** octos has no tool list the host can set
for one session, so every start writes the `_main` profile's `tool_policy`
Expand Down
5 changes: 3 additions & 2 deletions crates/kernel/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ adb -s SERIAL forward tcp:PORT tcp:PORT
[ADR 0004](../../docs/adr/0004-native-apps-hosting-and-peers.md) §12:系统智能体的工具集就是它获得的授权。它默认的 octos
工具是 `system_tools::SYSTEM_AGENT_TOOLS`:监督(`peer_send_input`、`peer_gather`、`peer_list`、`peer_respond`、
`peer_close`)、其工作区内的文件工具(octos 将其限制在会话工作目录内)、记忆、`ask_user_question`、查看媒体、octos 的
`web_search` / `web_fetch`(在工具箱授权取代它们之前,#108)以及 `tool_search`。授予的工具箱工具和跨应用工具,以及用户在设置中开启
(默认关闭)的命令执行,通过 `SystemAgentTools` 作为宿主工具加入;命令执行是需要实时批准的宿主工具(`terminal.run`)。
`web_search` / `web_fetch`(在工具箱授权取代它们之前,#108)以及 `tool_search`。授予的工具箱工具和跨应用工具通过 `SystemAgentTools` 作为宿主工具加入。命令执行**尚在计划中,目前不可用**:
它将是需要实时批准的宿主工具(`terminal.run`),默认关闭,由设置中的开关开启。`SystemAgentTools::grant_command_execution`
是预留接口,但目前还没有设置开关调用它,而且在 octos 支持按会话注册工具(octos#2567)之前,无法在系统会话上注册该宿主工具。

**内核今天执行的内容。** octos 没有宿主可为单个会话设置的工具名单,因此每次启动都写入 `_main` profile 的 `tool_policy`
(`system_tools::tool_policy`):任何授权可给予的一切,唯独去掉 octos 自己的 shell(`group:runtime`:`shell`、`bash`、
Expand Down
13 changes: 8 additions & 5 deletions crates/kernel/src/system_tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
//! - [`SYSTEM_AGENT_TOOLS`]: the octos tools the system agent
//! (`_main:api:octosense#system`) gets by default. With what the person
//! grants it ([`SystemAgentTools`]: toolbox tools, other apps' shareable
//! tools, and command execution when turned on in Settings) that is its
//! whole set: ADR 0004 §12's "exactly its grants".
//! tools, and, planned, command execution behind a Settings switch that
//! does not exist yet; see [`SystemAgentTools::grant_command_execution`])
//! that is its whole set: ADR 0004 §12's "exactly its grants".
//! - [`tool_policy`]: the `_main` profile's policy, the ceiling for every
//! `_main` session. It is every tool any grant can give: OctoSense
//! hard-codes no exclusions (§12) except ONE, octos's own shell
Expand Down Expand Up @@ -66,7 +67,8 @@ use serde_json::{json, Value};
/// agent `toolbox.search` / `toolbox.web_read`.
///
/// Anything else it may have is by grant ([`SystemAgentTools`]); command
/// execution only as a host tool the person turns on in Settings.
/// execution only as a host tool the person turns on (planned: no Settings
/// switch yet, and it needs octos#2567's per-session tool registration).
pub const SYSTEM_AGENT_TOOLS: &[&str] = &[
// Supervision.
"peer_send_input",
Expand Down Expand Up @@ -172,8 +174,9 @@ impl SystemAgentTools {
self
}

/// The person's Settings switch for the system agent's command
/// execution (ADR 0004 §12; off by default). On, the system agent gets
/// The seam for the person's planned Settings switch for the system
/// agent's command execution (ADR 0004 §12; off by default). Nothing
/// calls it outside tests yet. On, the system agent gets
/// the host tool [`COMMAND_EXECUTION_TOOL`], each command approved live
/// (section 8); never octos's shell.
///
Expand Down
17 changes: 10 additions & 7 deletions crates/shell/src/approvals/consent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
//! app) and the Rinx/native offer path ask before handing an app its peer.

use super::rules::ApprovalGesture;
use crate::app_storage::{AgentWorkspace, AppKind, StorageSpec};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::BTreeMap;
Expand Down Expand Up @@ -36,13 +37,15 @@ impl AgentSummary {
/// with the grants the person gave at install and the model's place.
pub fn from_manifest(app: &str, name: &str, manifest: &Value, granted: &[String], model: &str) -> AgentSummary {
let mut reads = Vec::new();
let storage = manifest.get("storage");
let workspace = storage.and_then(|s| s.get("agent_workspace")).and_then(|v| v.as_str()).unwrap_or("account");
if workspace == "none" {
reads.push("No files: only what its tools return".to_string());
} else {
let per_account = storage.and_then(|s| s.get("accounts")).and_then(|v| v.as_bool()).unwrap_or(true);
reads.push(if per_account { format!("{name}'s files for the signed-in account") } else { format!("{name}'s files on this device") });
// The storage block as app storage reads it, so the sheet and the
// folders agree (a block the store refuses is shown as no block;
// the install check reports it). `external` is native-only and is
// never an agent's workspace, so parse as native.
let storage = StorageSpec::from_manifest(manifest, AppKind::Native).unwrap_or_default();
match storage.agent_workspace {
AgentWorkspace::None => reads.push("No files: only what its tools return".to_string()),
AgentWorkspace::Account if storage.accounts => reads.push(format!("{name}'s files for the signed-in account")),
AgentWorkspace::Account => reads.push(format!("{name}'s files on this device")),
}
reads.push("Its own memory".to_string());
let mut declared: Vec<String> = Vec::new();
Expand Down
22 changes: 22 additions & 0 deletions crates/shell/src/approvals/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,28 @@ fn news() -> AgentSummary {
)
}

/// The consent sheet and app storage read one `storage` block the same
/// way: `accounts` defaults to false (one `device` folder) in both.
#[test]
fn consent_and_app_storage_agree_on_accounts() {
use crate::app_storage::{AppKind, StorageSpec};
for manifest in [
json!({}),
json!({"storage": {}}),
json!({"storage": {"agent_workspace": "account"}}),
json!({"storage": {"accounts": false}}),
json!({"storage": {"accounts": true}}),
json!({"storage": {"accounts": true, "agent_workspace": "account"}}),
] {
let per_account = StorageSpec::from_manifest(&manifest, AppKind::Script).unwrap().accounts;
let summary = AgentSummary::from_manifest("os.x", "X", &manifest, &[], "m");
let says_account = summary.reads.iter().any(|r| r.contains("signed-in account"));
let says_device = summary.reads.iter().any(|r| r.contains("on this device"));
assert_eq!((says_account, says_device), (per_account, !per_account), "{manifest}");
}
assert!(!StorageSpec::from_manifest(&json!({}), AppKind::Script).unwrap().accounts, "an app declares accounts");
}

#[test]
fn consent_at_first_use_is_asked_once_and_remembered() {
let mut c = ConsentStore::memory();
Expand Down
7 changes: 3 additions & 4 deletions crates/shell/src/apps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,8 @@ mod tests {
assert_eq!(manifest_default(Declared::Process, || false, true), Hosting::Module, "no binary: in-process");
assert_eq!(manifest_default(Declared::ProcessIfVulkan, || true, false), Hosting::Module, "OpenGL or X11");
assert_eq!(manifest_default(Declared::ProcessIfVulkan, || true, true), Hosting::Process);
// App Hub and Rinx stay in-process everywhere (ADR 0004 §2).
for id in ["apphub", "rinx"] {
// Every app but the Terminal stays in-process everywhere (ADR 0004 §2).
for id in ["apphub", "rinx", "sheets", "reference", "appcard"] {
let app = crate::native_apps::find(id).unwrap();
assert_eq!(manifest_default(app.on_this_target(), || true, true), Hosting::Module, "{id}");
}
Expand All @@ -650,8 +650,7 @@ mod tests {
assert_eq!(registry.hosting("sheets"), Hosting::Module);
assert!(registry.linked_ids().contains(&"sheets"));
let plain = AppRegistry::default();
let expected = if process_form("sheets") { Hosting::Process } else { Hosting::Module };
assert_eq!(plain.hosting("sheets"), expected, "desktop default is a process where it can start");
assert_eq!(plain.hosting("sheets"), Hosting::Module, "Terminal is the only process app for now (ADR 0004 §2)");
}
}

Expand Down
12 changes: 6 additions & 6 deletions crates/shell/src/native_apps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ pub const APPS: &[NativeApp] = &[
id: "reference",
feature: "app-reference",
bin: Some("octosense-reference"),
macos: Hosting::Process,
windows: Hosting::Process,
linux: Hosting::Process,
macos: Hosting::Module,
windows: Hosting::Module,
linux: Hosting::Module,
android: Hosting::Module,
ios: Hosting::Module,
ohos: Hosting::Module,
Expand All @@ -92,9 +92,9 @@ pub const APPS: &[NativeApp] = &[
id: "sheets",
feature: "app-sheets",
bin: Some("sheets"),
macos: Hosting::Process,
windows: Hosting::Process,
linux: Hosting::Process,
macos: Hosting::Module,
windows: Hosting::Module,
linux: Hosting::Module,
android: Hosting::Module,
ios: Hosting::Module,
ohos: Hosting::Module,
Expand Down
3 changes: 1 addition & 2 deletions desktop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ The native apps' features (`app-hub`, `app-rinx`, `app-reference`, `app-sheets`,
| `app-aichat` | off | Links Makepad's AI chat as a module, without its model engine. |
| `mobile-apps` | off | `app-rinx` + `app-reference` + `app-sheets` + `app-hub` + `octos-core`: the set phone builds link, for testing on desktop. Not AppCard. |

A linked native app is hosted as its `hosting` in `native-apps.json` says for the platform: App Hub, Rinx and AppCard in-process everywhere, the Terminal as a process on macOS and Windows, Reference and Sheets as processes on the desktop. `--module <id>` (or a `<id>: Module` line in `wm/apps.splash` under the state directory) opens one in-process instead:
A linked native app is hosted as its `hosting` in `native-apps.json` says for the platform: App Hub, Rinx, AppCard, Reference and Sheets in-process everywhere, the Terminal as a process on macOS and Windows (and on Linux with a Vulkan build in a Wayland session). `--module <id>` (or a `<id>: Module` line in `wm/apps.splash` under the state directory) opens one in-process instead:

```sh
cargo run --release -p octosense --features mobile-apps -- --module reference --module sheets
cargo run --release -p octosense -- --module terminal
```

Expand Down
3 changes: 1 addition & 2 deletions desktop/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ cargo run --release -p octosense
| `app-aichat` | 关 | 以模块形式链接 Makepad 的 AI chat,不含其模型引擎。 |
| `mobile-apps` | 关 | `app-rinx` + `app-reference` + `app-sheets` + `app-hub` + `octos-core`:手机构建所链接的集合,用于在桌面上测试。不含 AppCard。 |

已链接的原生应用按照 `native-apps.json` 中该平台的 `hosting` 托管:App Hub、Rinx 和 AppCard 在所有平台上都在进程内运行,Terminal 在 macOS 和 Windows 上作为独立进程运行,Reference 和 Sheets 在桌面端作为独立进程运行。用 `--module <id>`(或在状态目录下的 `wm/apps.splash` 中写一行 `<id>: Module`)可改为在进程内打开:
已链接的原生应用按照 `native-apps.json` 中该平台的 `hosting` 托管:App Hub、Rinx、AppCard、Reference 和 Sheets 在所有平台上都在进程内运行,Terminal 在 macOS 和 Windows 上(以及 Vulkan 构建且处于 Wayland 会话的 Linux 上)作为独立进程运行。用 `--module <id>`(或在状态目录下的 `wm/apps.splash` 中写一行 `<id>: Module`)可改为在进程内打开:

```sh
cargo run --release -p octosense --features mobile-apps -- --module reference --module sheets
cargo run --release -p octosense -- --module terminal
```

Expand Down
Loading