mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
Merge branch 'worktree-tasks-service-seam' into worktree-process-service-seam
This commit is contained in:
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write
|
||||
tasks.md: d1f5a6d7b369e6113132f60e493cf87757e20599
|
||||
tasks.zh.md: 1562d9401f0f55ac6d6260902b8b1c71d9664d48
|
||||
tasks.md: a38055d3ef7aa18e62678f92eb5ac5ae2a09c205
|
||||
tasks.zh.md: b5dd7f75c7df3e359bc995fce57f1ca2dc7fd017
|
||||
|
||||
@@ -151,4 +151,4 @@ interface TaskRead {
|
||||
|
||||
## 服务行为
|
||||
|
||||
[`TaskService`](../../packages/tasks/tasks/src/index.ts) 提供原子 `start`、限定调用方作用域的 `get` 和 `list`、`read`、`kill`、有界 `wait`、故障隔离的 `onTaskDone` 监听器,以及 `attachSurface` 可用性防线。授权会比较拥有者会话;拥有者清理会选择确切的已注册 `Agent` 实例。包(package)契约见 [`dsh-tasks`](../../packages/tasks/tasks/README.md),面向模型的接口见 [`dsh-tool-tasks`](../../packages/tasks/tool-tasks/README.md)。
|
||||
抽象的 [`TaskService`](../../packages/tasks/tasks/src/index.ts) seam 定义原子 `start`、限定调用方作用域的 `get` 和 `list`、`read`、`kill`、有界 `wait`、故障隔离的 `onTaskDone` 监听器,以及 `attachSurface` 可用性防线;[`LocalTaskService`](../../packages/tasks/tasks-local/src/index.ts) 是其进程局部实现。授权会比较拥有者会话;拥有者清理会选择确切的已注册 `Agent` 实例。seam 契约见 [`dsh-tasks`](../../packages/tasks/tasks/README.md),注册表生命周期见 [`dsh-tasks-local`](../../packages/tasks/tasks-local/README.md),面向模型的接口见 [`dsh-tool-tasks`](../../packages/tasks/tool-tasks/README.md)。
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write
|
||||
README.md: 736de2ea01e1524854c57f91d128b82a9fe0c9e8
|
||||
README.zh.md: 4ffe47ba82539d12c9b74b1690392d58d21a24b1
|
||||
README.md: 32874bf2839c194572ddde8c4ed007297f763ccc
|
||||
README.zh.md: 57a06a00203b8e67f2f33c87d7450d1a0789d7e6
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
@deepseek-ai/dsh-tool-goal optional model-facing goal controls
|
||||
@deepseek-ai/dsh-goal-session optional same-session goal-round driver
|
||||
@deepseek-ai/dsh-llm-retry bounded transient request retry policy
|
||||
@deepseek-ai/dsh-tasks generic background-task registry
|
||||
@deepseek-ai/dsh-tasks-local generic background-task registry
|
||||
@deepseek-ai/dsh-invariants configurable invariant registry service
|
||||
@deepseek-ai/dsh-session/invariant
|
||||
@deepseek-ai/dsh-agent/invariant
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write
|
||||
README.md: f1c224345c94a833c44cbafb635be7617e8c42bf
|
||||
README.zh.md: 610a84a1506b4bb780297322f7827e6f04533bc1
|
||||
README.md: 9bafe5633bb7e57a5404ffb41fad04b621832b6d
|
||||
README.zh.md: 73c87a2c95ccebf70558a2051149eca4ba41f60e
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
[English](README.md) | 中文
|
||||
|
||||
后台 task id、拥有者隔离、读取、取消、等待和完成通知的共用归属位置。Bash、subagent 及未来的长时间运行工具共用一套面向模型的协议。参见[后台任务运行时 Agent Note(agent 决策记录)](../../.agents/notes/implemented/architecture/2026-06-20-generic-long-running-tool-runtime.md)。
|
||||
后台 task id、拥有者隔离、读取、取消、等待和完成通知的共用归属位置。Bash、subagent 及未来的长时间运行工具共用一套面向模型的协议。参见[后台任务运行时 Agent Note(agent 决策记录)](../../.agents/notes/implemented/architecture/2026-06-20-generic-long-running-tool-runtime.md)和[任务注册表 seam Agent Note](../../.agents/notes/implemented/architecture/2026-07-26-task-registry-seam.md)。
|
||||
|
||||
| 包(package) | ctx 键 | 角色 |
|
||||
|---|---|---|
|
||||
| [`tasks`](tasks/README.md)(`@deepseek-ai/dsh-tasks`) | `ctx.tasks` | 注册表服务:品牌化 `<kind>-N` id、按拥有者设防的 read/kill/wait/list、结算记账、等待完成的拥有者清理路径,以及防止 `attachSurface` 配置错误的防线 |
|
||||
| [`tasks`](tasks/README.md)(`@deepseek-ai/dsh-tasks`) | `ctx.tasks` | 注册表 seam:品牌化 `<kind>-N` id、按拥有者设防的 read/kill/wait/list 契约、快照词汇、防止 `attachSurface` 配置错误的防线,以及快照不变式配套插件 |
|
||||
| [`tasks-local`](tasks-local/README.md)(`@deepseek-ai/dsh-tasks-local`) | 无 | 进程局部的注册表实现:内存记录、首次结果优先的结算簿记,以及等待完成的拥有者清理与拆卸路径 |
|
||||
| [`tool-tasks`](tool-tasks/README.md)(`@deepseek-ai/dsh-tool-tasks`) | 无 | 面向模型的控制接口:`task_output`、`task_list`、`task_kill`、完成通知注入和后台工作习惯提示词段落 |
|
||||
|
||||
注册表拥有跨生产方或接口重载的状态;工具包拥有呈现。生产方通过 `ctx.tasks.start` 注册执行钩子,并自行决定其配置是否公开 `run_in_background`。
|
||||
|
||||
6
packages/tasks/tasks-local/README.i18n.yaml
Normal file
6
packages/tasks/tasks-local/README.i18n.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write
|
||||
README.md: 23ca6fca61ccb59c855e5d6da6b0a2e23e7cb632
|
||||
README.zh.md: c5553a76690278f5b6d5ec40a55d213ef7e1e2d9
|
||||
@@ -1,5 +1,7 @@
|
||||
# @deepseek-ai/dsh-tasks-local
|
||||
|
||||
English | [中文](README.zh.md)
|
||||
|
||||
Process-local implementation of the [`@deepseek-ai/dsh-tasks`](../tasks/README.md) registry seam: `LocalTaskService` keeps every record in memory, issues per-kind `<kind>-N` ids, and hands out fresh snapshots, never live state. It has no config; load it as a plugin and it registers as `ctx.tasks`.
|
||||
|
||||
## Lifecycle
|
||||
|
||||
26
packages/tasks/tasks-local/README.zh.md
Normal file
26
packages/tasks/tasks-local/README.zh.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# @deepseek-ai/dsh-tasks-local
|
||||
|
||||
[English](README.md) | 中文
|
||||
|
||||
[`@deepseek-ai/dsh-tasks`](../tasks/README.md) 注册表 seam 的进程局部实现:`LocalTaskService` 把每条记录保存在内存中,按 kind 签发 `<kind>-N` id,并且只交出全新快照,从不交出实时状态。它没有配置;作为插件加载后即注册为 `ctx.tasks`。
|
||||
|
||||
## 生命周期
|
||||
|
||||
任务属于其 owner 和后端,而不是生产方工具 fiber,因此重载生产方或表层不会停止任务。某个 owner 的第一个任务会把一个受等待的 effect 附加到精确的 `Agent` scope。owner 释放会取消该对象的任务,等待生产方完全停稳,并移除其快照;复用 agent 或 Session id 无法重定向旧清理。
|
||||
|
||||
服务释放会关闭监听器、取消所有存活任务、等待其记录,并从仍存活的 owner scope 分离 effect。如果拆卸取消抛出异常,服务会强制把记录标为失败,并警告工作可能遗留,而不会死锁。取消已返回但始终不终止 `done` 时,系统无法将其与缓慢停止区分开,拆卸可能因此停滞。
|
||||
|
||||
结算遵循首次结果优先:最早出现的终止结果(生产方结算、被隔离为 `failed` 的 `done` 拒绝,或拆卸强制失败)只记录一次,只通知监听器一次并对每个监听器单独隔离故障,然后释放等待方。挂起的等待会在监听器运行前把任务标记为已报告,因此呈现完成情况的表层不会重复发出通知。
|
||||
|
||||
## 模型体验
|
||||
|
||||
通过生产方插件和 [`dsh-tool-tasks`](../tool-tasks/README.md) 间接影响;它们会渲染 task id、输出、状态、取消和完成通知。
|
||||
|
||||
#### KV Cache 影响
|
||||
|
||||
不会直接失效;请求前缀变更由命名消费方负责。
|
||||
|
||||
## 已知限制与暂缓事项
|
||||
|
||||
- **任务只存在于进程本地**:记录随 harness 进程一起消亡;持久或跨重启执行需要一个单独实现该 seam 的后端。
|
||||
- **静默无效的取消可能使拆卸停滞**:只有显式抛出异常才能安全地强制标为失败。
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write
|
||||
README.md: 1a073add0fde8f2e519cc83b087af6a531a6cbb8
|
||||
README.zh.md: 795602701f072068f05bbf16ee98bdeea57548af
|
||||
README.md: 2f822bad139020f0ebae0165aa4e8893853f635d
|
||||
README.zh.md: 4adb249f31241d5c61c3f8cbee638e8243e4a92e
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
[English](README.md) | 中文
|
||||
|
||||
进程局部的后台任务注册表(`ctx.tasks`)。它为长时间运行的生产方提供共享 id、owner 隔离、读取、取消、等待、通知和清理。生产方插件使用其不透明 id namespace 扩展 `TaskKindMap`。
|
||||
后台任务注册表 seam(`ctx.tasks`)。抽象的 `TaskService` 及其词汇类型在同一份契约下为长时间运行的生产方提供共享 id、owner 隔离、读取、取消、等待、通知和清理;进程局部注册表位于 [`dsh-tasks-local`](../tasks-local/README.md)。生产方插件使用其不透明 id namespace 扩展 `TaskKindMap`。
|
||||
|
||||
## 服务 API
|
||||
## 服务契约
|
||||
|
||||
- `start(spec): TaskId` 验证控制表层、spec、精确的存活 owner,以及可选的正 `outputLimitBytes`,然后只调用生产方的 `run()` 一次。启动方抛出异常时不注册任何内容;成功返回会直接提交,不再执行其他可能失败的步骤。
|
||||
- `get(id, caller?)` 和 `list(caller?)` 返回非消费式快照。列表只包含调用方拥有及无 owner 的任务。
|
||||
@@ -18,13 +18,9 @@
|
||||
|
||||
`outputLimitBytes` 是生产方拥有的模型呈现策略,会原样携带到快照中。控制表层在添加状态或通知元数据后应用它;注册表不会重写生产方输出,也不会为省略此字段的生产方虚构默认值。
|
||||
|
||||
## 生命周期
|
||||
实现还必须兑现契约的生命周期语义:注册的存续期长于生产方与控制表层的 fiber,owner 释放和服务释放会取消存活工作并等待守约的生产方,结算遵循首次结果优先(一条终止记录、一轮故障隔离的监听器通知,然后释放等待方)。
|
||||
|
||||
任务属于其 owner 和后端,而不是生产方工具 fiber,因此重载生产方或表层不会停止任务。某个 owner 的第一个任务会把一个受等待的 effect 附加到精确的 `Agent` scope。owner 释放会取消该对象的任务,等待生产方完全停稳,并移除其快照;复用 agent 或 Session id 无法重定向旧清理。
|
||||
|
||||
服务释放会关闭监听器、取消所有存活任务、等待其记录,并从仍存活的 owner scope 分离 effect。如果拆卸取消抛出异常,服务会强制把记录标为失败,并警告工作可能遗留,而不会死锁。取消已返回但始终不终止 `done` 时,系统无法将其与缓慢停止区分开,拆卸可能因此停滞。
|
||||
|
||||
参见[任务类型目录](../../../docs/core-data-structures/tasks.md)和[运行时 Agent Note](../../../.agents/notes/implemented/architecture/2026-06-20-generic-long-running-tool-runtime.md)。
|
||||
参见[任务类型目录](../../../docs/core-data-structures/tasks.md)、[运行时 Agent Note](../../../.agents/notes/implemented/architecture/2026-06-20-generic-long-running-tool-runtime.md)和 [seam Agent Note](../../../.agents/notes/implemented/architecture/2026-07-26-task-registry-seam.md)。
|
||||
|
||||
## 模型体验
|
||||
|
||||
@@ -36,8 +32,6 @@
|
||||
|
||||
## 已知限制与暂缓事项
|
||||
|
||||
- **任务只存在于进程本地**:持久或跨重启执行需要独立生命周期。
|
||||
- **服务与实现没有拆分**:第二个后端必须先定义塑造该边界的生命周期。
|
||||
- **流输出只有一个消费游标**:独立观察者需要游标或快照 API。
|
||||
- **前台工作无法提升**:生产方在启动前选择前台或后台。
|
||||
- **静默无效的取消可能使拆卸停滞**:只有显式抛出异常才能安全地强制标为失败。
|
||||
- **契约是进程内的**:`TaskStart.run()` 传入回调和确切的 `Agent` 对象;持久或跨进程后端必须先重塑身份、重启、所有权与观察语义,才能实现此 seam。
|
||||
|
||||
Reference in New Issue
Block a user