Skip to main content

Agent Workspace

桌面上的 Agent 工作区:用户攒程序(番茄钟、心情日记、记账…),每个程序都有自己的助手; 智能全在远端 aaas-service,本进程只做四件事 —— 落盘、执行被点名的那一个、广播、传话。

内核不含一克智能。 它不选工具、不决定下一步、不重试、不兜底。 判据:本仓库里出现的每个分支,都只回答「参数/状态是否合法」,不回答「接下来做什么」。

谱系

道      = Agent(aaas-service,唯一的智能,不在本进程)
一      = 内核(本仓库 agentworkspace/:一个目录约定、一条 dispatch、一条事件流、一份能力面)
二      = 双入口(人走本地 HTTP,agent 走 invokeFunction,落到同一个 dispatch)
三      = 程序三要素(backend.py 能力 / ui 页面 / data 状态)
万物    = 工作区(用户攒出来的程序)

七个模块,各管一件事:

文件 它是谁
kernel.py 一:目录约定 / 唯一 dispatch() / 事件总线 / 能力面(按 pid 隔离)
link.py 道:aaas 接线(connect / declare / send / 转发被点名的那一个),每个程序一条会话
server.py 二之一:人的门(本地 HTTP + SSE)
shell.py 窗口壳:pywebview(--browser 是它的退化形态)
native.py 原生程序宿主:不是第二条执行路径,是「人的门」的第三种壳
main.py 入口:装配,没有第四样东西
web/index.html 工作区视图 + 对话 + 能力面板(单文件,无构建步骤)

配套:settings.py(唯一一项设置:aaas-service 地址)、devtools.py(开发者模式那双手)、 assistant.py(内核唯一内置的程序:小助理)、toolbox.py(小助理的手)、 selftest.py / qa.py / uiprobe.py(三层的自检:逻辑 / 真窗口 / 真浏览器)。

装

pip install open-agent-workspace

一条命令就够:pywebview 是默认依赖,装完就有桌面窗口,不需要再补一个 [gui]。 需要 Python 3.10+,以及一个能连上的 aaas-service(地址在设置里改,默认 ws://localhost:8888)。

这个内核曾以 agent-workspace-desktop 0.1.0 发布过一版,是同一份东西。现在叫 open-agent-workspace。两个包提供同一个顶层模块 agentworkspace,装新的之前先 pip uninstall agent-workspace-desktop,否则会互相覆盖(先装的赢,后装的留下空壳)。

跑

open-agent-workspace                # 桌面窗口
open-agent-workspace --browser      # 换成浏览器(pywebview 起不来时的形态)
open-agent-workspace --cli          # 命令行:跟小助理说一句
open-agent-workspace --cli -m "做个番茄钟"        # 同上
open-agent-workspace --cli --as pomodoro -m "开始 25 分钟"   # 跟某个程序自己的助手说

工作区默认就是你敲命令时所在的目录(没有会自动新建),所以它落在「你正在做的事」那里:

cd D:\我的项目
open-agent-workspace                          # 工作区 = D:\我的项目
open-agent-workspace --workspace D:\别处      # 也可以显式指定(不存在同样自动建)

--cli 是验收形态:connect → declare → sendInput → invokeFunction → 本地执行 → functionResult → 模型续写 → turn.completed。这条不通,界面做得再漂亮也是空壳。

工作区长什么样

工作区(默认 = 启动时的当前目录,--workspace 可换)是运行时,不在本仓库里:

workspace/
  plugins/<pid>/         程序:plugin.json + backend.py + ui/index.html + data/store.json
  logs/events.jsonl      谁做了什么、谁点的(事件流)
  prompts/               每个程序的指令
  config.json            设置(只有一项:aaas-service 地址)
  dev.json               开发者模式开关(**只属于人**:程序写它一律被拒)

内核没有任何内置的领域能力:番茄钟、日记、记账都是工作区里长出来的程序, 所以它们不在这个仓库里 —— 这里只有内核。

契约(写程序的人关心这几条)

  1. 公开函数 = 能力;_ 前缀 = 私有;wire name = <pid>_<fn>
  2. 约束只写一处:Annotated[int, {"minimum": 1}] → schema / 表单 / 校验同源
  3. 双面返回:dict 含 "text" → 文本给模型,其余进 data 给界面
  4. 状态走 ctx.get/set → data/store.json(代码目录与数据目录分离)
  5. 事件总线:call.ok / call.error / call.rejected / state.changed

隔离只写一处:Runtime.capabilities_of(pid)。别的程序在结构上就拿不到 plugin_write。

开发者模式

一个开关(设置面板里拨),打开后当前程序多拿到一把只够改自己的手:

有 没有
dev_tree / dev_read / dev_search plugin_list(「有哪些程序」本身就是权限地图)
dev_write(普通文件) plugin_call(能绕开别人的隔离)
dev_plugin_write(没有 pid 参数) plugin_delete / shell

想改别人,在签名上就无从下手;dev.json 由人掌握,程序写它一律被拒。 细节见 docs/dev-mode.md。

自检

python -m agentworkspace.selftest     # 逻辑层(内存里跑完整链路)
python -m agentworkspace.qa all       # 真窗口
python -m agentworkspace.uiprobe      # 真浏览器(拖动 / 折叠 / 设置 / 图标)

三层缺一不可:selftest 只能断言「文件里有这行字」,CSS 优先级、事件绑定、 重绘时机任何一处错了都拦不住 —— 那要靠后两层。

文档

License

MIT

Metadata

Release files for open-agent-workspace 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for open-agent-workspace 0.1.1
File Size Uploaded Provenance Actions
open_agent_workspace-0.1.1.tar.gz 158.2 kB Without provenance Details for open_agent_workspace-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for open-agent-workspace 0.1.1
File Interpreter ABI Platform Actions
open_agent_workspace-0.1.1-py3-none-any.whl Python 3 none any Details for open_agent_workspace-0.1.1-py3-none-any.whl

Total release size: 281.9 kB

Release files / open_agent_workspace-0.1.1.tar.gz

Download URL open_agent_workspace-0.1.1.tar.gz
Size 158.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e752374412f88dd8a5b8140eff573a0c670f853033b0a3d11ee10dee2388b618
BLAKE2b-256 checksum
How to use checksums
5575c661b3a72675d21e9c7cab7f4f35c7995e0321d4ea805dd21e20c9d22a2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

Release files / open_agent_workspace-0.1.1-py3-none-any.whl

Download URL open_agent_workspace-0.1.1-py3-none-any.whl
Size 123.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5e90b3737597baee256c9a79703f202bfae06b9182e27f2478f1b1ae141ffef
BLAKE2b-256 checksum
How to use checksums
75b4ee15b3035bcb4fa375de5b2e6dcb031f5dcd5d1f26634d0289559fd1a222
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

Security for open-agent-workspace 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page