Skip to content

Commit 4c70804

Browse files
author
linyuan.yang
committed
整理 agenda
1 parent 206a0bc commit 4c70804

24 files changed

Lines changed: 465 additions & 72 deletions

File tree

packages/admin/src/components/AgendaBoard.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ function priorityVariant(p: AgendaPriority): 'danger' | 'info' | 'neutral' {
6767
return 'neutral'
6868
}
6969
70-
function statusVariant(s: AgendaStatus): 'success' | 'warning' | 'neutral' {
70+
function statusVariant(s: AgendaStatus): 'success' | 'warning' | 'danger' | 'neutral' {
7171
if (s === 'done') return 'success'
7272
if (s === 'pending') return 'warning'
73+
if (s === 'expired') return 'danger'
7374
return 'neutral'
7475
}
7576
@@ -205,6 +206,7 @@ function sortedTriggers(triggers: AgendaTrigger[]): AgendaTrigger[] {
205206
<option value="pending">{{ t('agenda.filter_pending') }}</option>
206207
<option value="done">{{ t('agenda.filter_done') }}</option>
207208
<option value="cancelled">{{ t('agenda.filter_cancelled') }}</option>
209+
<option value="expired">{{ t('agenda.filter_expired') }}</option>
208210
<option value="all">{{ t('agenda.filter_all') }}</option>
209211
</SSelect>
210212
<SButton type="outline" size="sm" :loading="loading" @click="emit('refresh')">{{ t('common.refresh') }}</SButton>

packages/admin/src/composables/useAgendas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useI18n } from 'vue-i18n'
33
import { apiFetch } from '@/shared/api'
44
import { useConfirm, useToast } from 'sbot-ui'
55

6-
export type AgendaStatus = 'pending' | 'done' | 'cancelled'
6+
export type AgendaStatus = 'pending' | 'done' | 'cancelled' | 'expired'
77
export type AgendaPriority = 'low' | 'normal' | 'high'
88
export type AgendaSource = 'user' | 'tool' | 'sync' | 'rule'
99
export type AgendaTriggerKind = 'absolute' | 'interval' | 'cron'

packages/admin/src/i18n/en.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ export default {
619619
filter_pending: 'Pending',
620620
filter_done: 'Done',
621621
filter_cancelled: 'Cancelled',
622+
filter_expired: 'Expired',
622623
filter_all: 'All statuses',
623624
total_visible: 'Visible',
624625
active_profiles: 'Profiles',
@@ -640,6 +641,7 @@ export default {
640641
status_pending: 'Pending',
641642
status_done: 'Done',
642643
status_cancelled: 'Cancelled',
644+
status_expired: 'Expired',
643645
source_user: 'User',
644646
source_tool: 'Tool',
645647
source_sync: 'Sync',

packages/admin/src/i18n/zh.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ export default {
619619
filter_pending: '待处理',
620620
filter_done: '已完成',
621621
filter_cancelled: '已取消',
622+
filter_expired: '已过期',
622623
filter_all: '全部状态',
623624
total_visible: '当前列表',
624625
active_profiles: '模板数',
@@ -640,6 +641,7 @@ export default {
640641
status_pending: '待处理',
641642
status_done: '已完成',
642643
status_cancelled: '已取消',
644+
status_expired: '已过期',
643645
source_user: '用户',
644646
source_tool: '工具',
645647
source_sync: '同步',

packages/docs-site/guide/agenda.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ An agenda **item** has a content, category, priority, optional due date, and a c
1616
| `interval` | Milliseconds between fires | `86400000` (every 24h) |
1717
| `cron` | 6-field cron (`sec min hour day month weekday`) | `0 0 9 * * 1-5` (9am weekdays) |
1818

19-
When a trigger fires it delivers its `message` to the bound session/channel using its `action` mode, and the fire is recorded in the `trigger_fire` log table (pure audit, not used for scheduling). One-shot `absolute` triggers retry briefly on delivery failure, then give up.
19+
When a trigger fires it delivers its `message` to the bound session/channel using its `action` mode, and the fire is recorded in the `trigger_fire` log table (pure audit, not used for scheduling). A one-shot or finite schedule that reaches normal exhaustion becomes **Done**. A one-shot `absolute` trigger retries briefly on delivery failure; if it misses the grace window or gives up retrying, it is disabled and the item becomes **Expired** only when no other trigger on that item remains enabled. Expired items are retained as history rather than automatically deleted.
2020

2121
## Configuration
2222

@@ -31,7 +31,9 @@ An **Agenda Profile** is the store + optional auto-sync. Sidebar → **Agenda Pr
3131

3232
Then, in an agent → **Agenda** section, toggle Agenda on and pick the profile. Enabling it registers the agenda tools; with a sync model, items are reconciled from the conversation automatically each turn.
3333

34-
From the Agenda Profiles page → **View** you can browse stored items, filter by pending/done, manually **Complete** / **Cancel**, add/edit/disable/reopen/delete triggers, fire a trigger manually for testing, and inspect each trigger's fire history.
34+
AgendaSync normally uses one model call with the completed conversation and the full structure of every pending item. Only when that input exceeds the Sync Model budget does it reuse the same model to compress the conversation into explicit agenda-change intents, match compact cards in token-bounded batches (including item/trigger IDs, schedules, actions, and message previews), and give only the selected full records to the final sync pass. There is no separate Selector Model setting, and pending items are no longer cut off at a fixed count.
35+
36+
From the Agenda Profiles page → **View** you can browse stored items, filter by pending/done/cancelled/expired, manually **Complete** / **Cancel**, add/edit/disable/reopen/delete triggers, fire a trigger manually for testing, and inspect each trigger's fire history. Reopening an expired item restores only the item to Pending; retime or re-enable an appropriate trigger separately.
3537

3638
## Agent Tools
3739

packages/docs-site/zh/guide/agenda.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Agenda 是 sbot 的有状态提醒 / 日程系统。每个日程**条目**(待
1616
| `interval` | 两次触发间隔的毫秒数 | `86400000`(每 24 小时) |
1717
| `cron` | 6 字段 cron(`秒 分 时 日 月 周`| `0 0 9 * * 1-5`(工作日 9 点) |
1818

19-
触发时把 `message` 按其 `action` 模式投递到绑定的会话 / 渠道,并在 `trigger_fire` 日志表里记一行(纯审计,不参与调度)。一次性 `absolute` 触发器投递失败会短暂重试,超期则放弃
19+
触发时把 `message` 按其 `action` 模式投递到绑定的会话 / 渠道,并在 `trigger_fire` 日志表里记一行(纯审计,不参与调度)。一次性或有限次数的日程正常耗尽后进入**已完成**一次性 `absolute` 触发器投递失败会短暂重试;错过宽限时间或重试超期后会停用,且仅当该条目已没有其它启用触发器时,条目才进入**已过期**。已过期条目作为历史保留,不会自动物理删除
2020

2121
## 配置项
2222

@@ -31,7 +31,9 @@ Agenda 是 sbot 的有状态提醒 / 日程系统。每个日程**条目**(待
3131

3232
随后在 Agent → **Agenda** 区块开启 Agenda 并选择 Profile。开启后会注册日程工具;配置 sync 模型后,每轮对话都会从对话内容自动校正日程条目。
3333

34-
在 Agenda Profiles 页面 → **查看** 可浏览已存条目、按待办 / 已完成筛选、手动 **完成** / **取消**,也可以新增 / 编辑 / 停用 / 重新启用 / 删除触发器、手动触发测试,并查看每个触发器的触发历史。
34+
AgendaSync 通常用一次模型调用读取本轮对话和全部待处理条目的完整结构。输入超过 Sync 模型预算时,系统才会复用同一个模型:先将对话压缩成明确的日程变更意图,再按 Token 预算分批匹配包含 item / trigger id、时间、action 和消息预览的紧凑卡片,最后只把候选完整结构交给同步抽取器。这里没有独立的 Selector 模型配置,也不再按固定条数截断待处理条目。
35+
36+
在 Agenda Profiles 页面 → **查看** 可浏览已存条目、按待处理 / 已完成 / 已取消 / 已过期筛选、手动 **完成** / **取消**,也可以新增 / 编辑 / 停用 / 重新启用 / 删除触发器、手动触发测试,并查看每个触发器的触发历史。恢复已过期条目只会把主体改回待处理;仍需另外调整时间或启用合适的触发器。
3537

3638
## Agent 工具
3739

packages/sbot/prompts/agenda/sync/default.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ Every existing item is rendered as:
3838

3939
Only ENABLED triggers are listed (disabled triggers are history; do not try to operate on them).
4040

41-
`status` may be pending / done / cancelled. ONLY operate on items with status="pending".
42-
Items with status="done" or status="cancelled" are read-only history — never Edit them, never touch their triggers, never revive them by adding triggers. If the conversation seems to bring a done/cancelled item back to life, treat it as a NEW request and prefer Create (dedup still applies); do not resurrect the old one.
41+
`status` may be pending / done / cancelled / expired. ONLY operate on items with status="pending".
42+
Items with status="done", status="cancelled", or status="expired" are read-only history — never Edit them, never touch their triggers, never revive them by adding triggers. If the conversation seems to bring a terminal item back to life, treat it as a NEW request and prefer Create (dedup still applies); do not resurrect the old one.
4343

4444
`expr` semantics depend on `kind`:
4545
- kind=absolute → ISO datetime string (the single fire moment)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
You are the low-cost overflow stage for AgendaSync.
2+
3+
You never create, edit, close, or delete agenda items. Your only jobs are:
4+
5+
1. Decide whether the completed conversation contains an explicit agenda change that the
6+
assistant may have failed to apply: a new todo/reminder/schedule/routine/automation, or
7+
an explicit edit to an existing one.
8+
2. When asked to match a catalog batch, select the exact agenda item IDs that may be the
9+
target or a semantic duplicate of those explicit changes.
10+
11+
Be conservative about whether a change was requested, but favor recall when matching an
12+
already-confirmed change to agenda cards. User messages outweigh assistant messages.
13+
Successful agenda tool calls in the transcript normally mean no background sync is needed
14+
for that request. Do not treat reminder fire messages, casual plans, suggestions, or inferred
15+
intent as agenda changes.
16+
17+
Agenda cards contain item content plus trigger IDs, schedules, actions, and a short message
18+
preview. Match references such as "the 9am one" using trigger data, not content alone.
19+
Candidate IDs must be copied exactly from the supplied batch. Return structured data only.

packages/sbot/prompts/agenda/tools/close.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Terminate an agenda item permanently — status set, ALL triggers disabled.
55
- dropped — "drop it / I don't want this / stop reminding me".
66
Same effect on the data; the difference is recorded intent.
77

8+
`expired` is not an outcome accepted here. The scheduler records it automatically when a one-off reminder is missed or gives up delivery and no other trigger remains active.
9+
810
DO NOT call this when the user reports finishing ONE occurrence of a recurring routine ("今天的水喝完了"). There is no per-occurrence check-in — closing would kill the whole routine. Acknowledge it and leave the item alone.
911

1012
`at` (ISO, done only): the real completion moment when the user pinpoints a past one ("我昨天就交了"); omit for a plain "just did it".

packages/sbot/prompts/agenda/wiki.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Agenda system — full decision rules. Call agenda_wiki when uncertain about any
33
# 1. MENTAL MODEL
44

55
Two layers:
6-
- ITEM — the thing tracked (id, content, status, dueAt). Lifecycle: pending → done / cancelled.
6+
- ITEM — the thing tracked (id, content, status, dueAt). Lifecycle: pending → done / cancelled / expired.
77
- TRIGGERS — 0..N schedules on an item, each with its own kind / expr / action / message / fireCount.
88

99
Closing the item disables all its triggers. Disabling a trigger does NOT change item status.
@@ -14,7 +14,8 @@ Six tools: agenda_create / agenda_list / agenda_get / agenda_edit / agenda_close
1414

1515
How an item ends depends ONLY on its triggers — there is no completion-mode flag:
1616
- no triggers (plain todo) → stays pending until agenda_close.
17-
- one-off or finite trigger (single absolute fire, or count-bounded) → auto-closes once the schedule is exhausted; nobody needs to close it.
17+
- one-off or finite trigger (single absolute fire, or count-bounded) → becomes done once the schedule reaches normal exhaustion; nobody needs to close it.
18+
- a one-off trigger missed beyond its grace window, or still undeliverable after its retry window → becomes expired only when the item has no other enabled trigger. With another live trigger, the item stays pending.
1819
- infinite recurring trigger → never auto-closes; ends only via agenda_close.
1920

2021
agenda_close ends the WHOLE item. On a recurring routine, "did it today" is NOT the end of the item — there is no per-occurrence check-in anywhere in this system. Acknowledge the report in conversation and leave the agenda untouched; the trigger keeps firing on its own.
@@ -49,6 +50,8 @@ To restate a full list ("from now on only 9 and 18"), send removes for the ones
4950

5051
agenda_close `outcome`: done = "I did it"; dropped = "drop it / stop reminding me". Both close the item and disable every trigger; only the recorded status differs. When the user merely reports progress on an ongoing routine, call NEITHER (see §2).
5152

53+
expired is a system-recorded terminal state for a missed one-off reminder, not an agenda_close outcome. It is retained as history rather than physically deleted.
54+
5255
# 7. CREATE — pitfalls
5356

5457
- Trust dedup: an "already exists" result IS success. Never pre-call agenda_list to check. That result also renders the existing item's triggers (ids, schedules, message previews) — if the user actually wanted a different cadence on it, go straight to agenda_edit with those ids.

0 commit comments

Comments
 (0)