@aalis/plugin-checkpoint 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/config.d.ts CHANGED
@@ -2,45 +2,47 @@ import { type ConfigOf } from '@aalis/schema-config';
2
2
  export declare const configSchema: {
3
3
  readonly rootDir: {
4
4
  readonly type: "string";
5
- readonly label: "存储目录";
5
+ readonly label: import("@aalis/schema-i18n").TextRef;
6
6
  readonly onInvalid: "error";
7
- readonly description: "存储 URI(默认 data:/checkpoints)。所有 checkpoint blob 和 manifest 写入此位置。";
7
+ readonly description: import("@aalis/schema-i18n").TextRef;
8
8
  readonly default: "data:/checkpoints";
9
9
  };
10
10
  readonly maxFileSize: {
11
11
  readonly type: "number";
12
- readonly label: "单文件大小上限(字节)";
13
- readonly description: "超过此大小的文件不做内容快照,只在 manifest 里记录为 skipped。";
12
+ readonly label: import("@aalis/schema-i18n").TextRef;
13
+ readonly description: import("@aalis/schema-i18n").TextRef;
14
14
  readonly default: number;
15
15
  };
16
16
  readonly keepSessions: {
17
17
  readonly type: "number";
18
- readonly label: "保留的会话数";
19
- readonly description: "GC 阈值。每次提交回合后,若 session 目录数超过此值,删除最早的几个。设为 0 关闭 GC。";
18
+ readonly label: import("@aalis/schema-i18n").TextRef;
19
+ readonly description: import("@aalis/schema-i18n").TextRef;
20
20
  readonly default: 20;
21
21
  };
22
- readonly scopes: {
23
- readonly type: "multiselect";
24
- readonly label: "启用作用域";
25
- readonly description: "仅在匹配下列 platform:sessionType 的会话中参与 turn 生命周期(建 checkpoint)。格式举例:`webui:*` / `onebot:group` / `*` 表示全部。默认仅 `webui:*`:onebot 等聊天平台不会为每条消息创建 checkpoint。留空数组 = 禁用 checkpoint(仅允许手动 rollback)。";
26
- readonly allowCustom: true;
22
+ readonly keepTurns: {
23
+ readonly type: "number";
24
+ readonly label: import("@aalis/schema-i18n").TextRef;
25
+ readonly description: import("@aalis/schema-i18n").TextRef;
26
+ readonly default: 200;
27
+ };
28
+ readonly coverage: {
29
+ readonly type: "select";
30
+ readonly label: import("@aalis/schema-i18n").TextRef;
31
+ readonly description: import("@aalis/schema-i18n").TextRef;
32
+ readonly default: "ownerOnly";
27
33
  readonly options: [{
28
- readonly label: "所有会话";
29
- readonly value: "*";
30
- }, {
31
- readonly label: "WebUI 会话(推荐)";
32
- readonly value: "webui:*";
33
- }, {
34
- readonly label: "OneBot 群聊";
35
- readonly value: "onebot:group";
34
+ readonly label: import("@aalis/schema-i18n").TextRef;
35
+ readonly value: "off";
36
36
  }, {
37
- readonly label: "OneBot 私聊";
38
- readonly value: "onebot:private";
37
+ readonly label: import("@aalis/schema-i18n").TextRef;
38
+ readonly value: "ownerOnly";
39
39
  }, {
40
- readonly label: "CLI";
41
- readonly value: "cli:*";
40
+ readonly label: import("@aalis/schema-i18n").TextRef;
41
+ readonly value: "all";
42
42
  }];
43
- readonly default: readonly ["webui:*"];
43
+ readonly session: {
44
+ readonly prominence: "advanced";
45
+ };
44
46
  };
45
47
  };
46
48
  export type CheckpointConfig = ConfigOf<typeof configSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAgB,MAAM,sBAAsB,CAAC;AAEnE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCvB,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAgB,MAAM,sBAAsB,CAAC;AAGnE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCvB,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAC"}
package/dist/config.js CHANGED
@@ -1,38 +1,43 @@
1
1
  import { defineConfig } from '@aalis/schema-config';
2
+ import { t } from './texts.js';
2
3
  export const configSchema = defineConfig({
3
4
  rootDir: {
4
5
  type: 'string',
5
- label: '存储目录',
6
+ label: t('rootDirLabel'),
6
7
  onInvalid: 'error',
7
- description: '存储 URI(默认 data:/checkpoints)。所有 checkpoint blob 和 manifest 写入此位置。',
8
+ description: t('rootDirDescription'),
8
9
  default: 'data:/checkpoints',
9
10
  },
10
11
  maxFileSize: {
11
12
  type: 'number',
12
- label: '单文件大小上限(字节)',
13
- description: '超过此大小的文件不做内容快照,只在 manifest 里记录为 skipped。',
13
+ label: t('maxFileSizeLabel'),
14
+ description: t('maxFileSizeDescription'),
14
15
  default: 10 * 1024 * 1024,
15
16
  },
16
17
  keepSessions: {
17
18
  type: 'number',
18
- label: '保留的会话数',
19
- description: 'GC 阈值。每次提交回合后,若 session 目录数超过此值,删除最早的几个。设为 0 关闭 GC。',
19
+ label: t('keepSessionsLabel'),
20
+ description: t('keepSessionsDescription'),
20
21
  default: 20,
21
22
  },
22
- scopes: {
23
- type: 'multiselect',
24
- label: '启用作用域',
25
- description: '仅在匹配下列 platform:sessionType 的会话中参与 turn 生命周期(建 checkpoint)。格式举例:`webui:*` / `onebot:group` / `*` 表示全部。默认仅 `webui:*`:onebot 等聊天平台不会为每条消息创建 checkpoint。留空数组 = 禁用 checkpoint(仅允许手动 rollback)。',
26
- // 常用选项之外的作用域也合法
27
- allowCustom: true,
23
+ keepTurns: {
24
+ type: 'number',
25
+ label: t('keepTurnsLabel'),
26
+ description: t('keepTurnsDescription'),
27
+ default: 200,
28
+ },
29
+ // 按会话字段:在哪一层读都是字面意思,在某个群的场所层选「记」就是这个群记
30
+ coverage: {
31
+ type: 'select',
32
+ label: t('coverageLabel'),
33
+ description: t('coverageDescription'),
34
+ default: 'ownerOnly',
28
35
  options: [
29
- { label: '所有会话', value: '*' },
30
- { label: 'WebUI 会话(推荐)', value: 'webui:*' },
31
- { label: 'OneBot 群聊', value: 'onebot:group' },
32
- { label: 'OneBot 私聊', value: 'onebot:private' },
33
- { label: 'CLI', value: 'cli:*' },
36
+ { label: t('coverageOff'), value: 'off' },
37
+ { label: t('coverageOwnerOnly'), value: 'ownerOnly' },
38
+ { label: t('coverageAll'), value: 'all' },
34
39
  ],
35
- default: ['webui:*'],
40
+ session: { prominence: 'advanced' },
36
41
  },
37
42
  });
38
43
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEnE,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC;IACvC,OAAO,EAAE;QACP,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,OAAO;QAClB,WAAW,EAAE,mEAAmE;QAChF,OAAO,EAAE,mBAAmB;KAC7B;IACD,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,0CAA0C;QACvD,OAAO,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;KAC1B;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,QAAQ;QACf,WAAW,EAAE,qDAAqD;QAClE,OAAO,EAAE,EAAE;KACZ;IACD,MAAM,EAAE;QACN,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,OAAO;QACd,WAAW,EACT,4LAA4L;QAC9L,gBAAgB;QAChB,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE;YACP,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE;YAC7B,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,EAAE;YAC3C,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EA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AC,qBAAqB,CAAC;QACrC,OAAO,EAAE,WAAW;QACpB,OAAO,EAAE;YACP,EAAE,KAAK,EAAE,CAAC,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE;YACzC,EAAE,KAAK,EAAE,CAAC,CAAC,mBAAmB,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE;YACrD,EAAE,KAAK,EAAE,CAAC,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE;SAC1C;QACD,OAAO,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE;KACpC;CACF,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { type CheckpointService } from './service.js';
2
- export declare const checkpoint: import("@aalis/core").ServiceDescriptor<CheckpointService, import("@aalis/core").ServiceRef<CheckpointService>>;
3
1
  declare const _default: import("@aalis/core").PluginDefinition<{
4
2
  /**
5
3
  * storage 是硬依赖:本插件的快照/manifest 全部经 storage 落盘。
@@ -8,11 +6,19 @@ declare const _default: import("@aalis/core").PluginDefinition<{
8
6
  * 该保证只在 app.stop() 的整体拓扑逆序成立;单独禁用/热重载 storage 时 flushAll 会落空
9
7
  * (回合 blob 在写点已落盘,丢的只是在飞回合的 manifest)。
10
8
  */
11
- storage: import("@aalis/core").ServiceDescriptor<import("@aalis/api-storage").StorageService, import("@aalis/core").ServiceRef<import("@aalis/api-storage").StorageService>>;
9
+ storage: import("@aalis/core").ServiceDescriptor<import("@aalis/api-storage").StorageService, import("@aalis/api-storage").BoundStorage>;
12
10
  /** 只有「回滚整轮对话」用得到(抓消息时间戳、删消息);没有 memory 也能做纯文件回滚 */
13
- memory: import("@aalis/core").OptionalUse<import("@aalis/api-memory").MemoryService, import("@aalis/core").ServiceRef<import("@aalis/api-memory").MemoryService>>;
14
- /** 页面动作的登记口;无 WebUI 时本插件照常在后台记账 */
15
- webui: import("@aalis/core").OptionalUse<import("@aalis/api-webui").WebUIService, import("@aalis/api-webui").BoundWebui>;
11
+ memory: import("@aalis/core").OptionalUse<import("@aalis/api-memory").MemoryService, import("@aalis/api-memory").MemoryService>;
12
+ /** 登记 /clear 的 checkpoint 类型 */
13
+ contributions: import("@aalis/core").OptionalUse<import("@aalis/api-contributions").ContributionRegistry, import("@aalis/api-contributions").Contributions>;
14
+ /** 判会话的受众(房间类别,子会话取根会话的):coverage 为按受众时用;会话管理缺席时判不出,不记 */
15
+ sessionManager: import("@aalis/core").OptionalUse<import("@aalis/api-session-manager").SessionManagerService, import("@aalis/api-session-manager").SessionManagerService>;
16
+ /** 房间类别里谁是 owner;缺席时没有人是 owner */
17
+ authority: import("@aalis/core").OptionalUse<import("@aalis/api-authority").AuthorityService, import("@aalis/api-authority").AuthorityService>;
18
+ /** 按会话读 coverage;缺席时取插件配置里的值 */
19
+ sessionFields: import("@aalis/core").OptionalUse<import("@aalis/api-session-settings").SessionSettingsService, import("@aalis/api-session-settings").SessionFields>;
20
+ /** 按会话字段的全局层:宿主配置文档里本实例的那一段 */
21
+ document: import("@aalis/core").OptionalUse<import("@aalis/api-host-config").HostConfig, import("@aalis/api-host-config").OwnHostConfig>;
16
22
  events: import("@aalis/core").ServiceDescriptor<(identity: symbol) => import("@aalis/core").Events, import("@aalis/core").Events>;
17
23
  hooks: import("@aalis/core").ServiceDescriptor<import("@aalis/api-hooks").HookRegistry, import("@aalis/api-hooks").Hooks>;
18
24
  lifecycle: import("@aalis/core").ServiceDescriptor<(identity: symbol) => import("@aalis/core").LifecycleCap, import("@aalis/core").LifecycleCap>;
@@ -21,5 +27,4 @@ declare const _default: import("@aalis/core").PluginDefinition<{
21
27
  provide: import("@aalis/core").ServiceDescriptor<(identity: symbol) => import("@aalis/core").Provide, import("@aalis/core").Provide>;
22
28
  }>;
23
29
  export default _default;
24
- export type { CheckpointFileRecord, CheckpointService, RollbackResult, RollbackWithChatResult, TurnManifest, TurnSummary, } from './service.js';
25
30
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,iBAAiB,EAA0C,MAAM,cAAc,CAAC;AAO9F,eAAO,MAAM,UAAU,iHAAiD,CAAC;;IAGvE;;;;;;OAMG;;IAEH,mDAAmD;;IAEnD,mCAAmC;;;;;;;;;AAWrC,wBAQG;AAiJH,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,YAAY,EACZ,WAAW,GACZ,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";IAsBE;;;;;;OAMG;;IAEH,mDAAmD;;IAEnD,gCAAgC;;IAEhC,0DAA0D;;IAE1D,kCAAkC;;IAElC,gCAAgC;;IAEhC,+BAA+B;;;;;;;;;AAWjC,wBAQG"}
package/dist/index.js CHANGED
@@ -1,16 +1,21 @@
1
+ import { authority } from '@aalis/api-authority';
2
+ import { checkpoint } from '@aalis/api-checkpoint';
3
+ import { contributions } from '@aalis/api-contributions';
1
4
  import { hooks } from '@aalis/api-hooks';
5
+ import { ownHostConfig } from '@aalis/api-host-config';
2
6
  import { memory } from '@aalis/api-memory';
3
- import { createStorageGateway, storage } from '@aalis/api-storage';
4
- import { webuiServer } from '@aalis/api-webui';
5
- import { config, definePlugin, defineService, events, lifecycle, logger, optional, provide, } from '@aalis/core';
7
+ import { roomClass, sessionManager } from '@aalis/api-session-manager';
8
+ import { sessionFields } from '@aalis/api-session-settings';
9
+ import { storage } from '@aalis/api-storage';
10
+ import { config, definePlugin, events, lifecycle, logger, optional, provide } from '@aalis/core';
6
11
  import { parseConfig } from '@aalis/schema-config';
12
+ import { textOf } from '@aalis/schema-i18n';
7
13
  import { configSchema } from './config.js';
8
14
  import { CheckpointServiceImpl, normalizeConfig } from './service.js';
15
+ import { t } from './texts.js';
9
16
  // ════════════════════════════════════════════════════════════
10
- // plugin-checkpoint — 文件操作快照与回滚
17
+ // plugin-checkpoint — 文件操作快照与回滚(契约见 @aalis/api-checkpoint)
11
18
  // ════════════════════════════════════════════════════════════
12
- // ----- 服务描述符(按激活绑定;调用型:绑定接口是 ServiceRef)-----
13
- export const checkpoint = defineService('checkpoint');
14
19
  const uses = {
15
20
  /**
16
21
  * storage 是硬依赖:本插件的快照/manifest 全部经 storage 落盘。
@@ -22,8 +27,16 @@ const uses = {
22
27
  storage,
23
28
  /** 只有「回滚整轮对话」用得到(抓消息时间戳、删消息);没有 memory 也能做纯文件回滚 */
24
29
  memory: optional(memory),
25
- /** 页面动作的登记口;无 WebUI 时本插件照常在后台记账 */
26
- webui: optional(webuiServer),
30
+ /** 登记 /clear 的 checkpoint 类型 */
31
+ contributions: optional(contributions),
32
+ /** 判会话的受众(房间类别,子会话取根会话的):coverage 为按受众时用;会话管理缺席时判不出,不记 */
33
+ sessionManager: optional(sessionManager),
34
+ /** 房间类别里谁是 owner;缺席时没有人是 owner */
35
+ authority: optional(authority),
36
+ /** 按会话读 coverage;缺席时取插件配置里的值 */
37
+ sessionFields: optional(sessionFields),
38
+ /** 按会话字段的全局层:宿主配置文档里本实例的那一段 */
39
+ document: optional(ownHostConfig),
27
40
  events,
28
41
  hooks,
29
42
  lifecycle,
@@ -33,7 +46,7 @@ const uses = {
33
46
  };
34
47
  export default definePlugin({
35
48
  name: '@aalis/plugin-checkpoint',
36
- displayName: '回滚检查点',
49
+ displayName: t('displayName'),
37
50
  subsystem: 'scheduler',
38
51
  configSchema,
39
52
  provides: [checkpoint],
@@ -41,96 +54,51 @@ export default definePlugin({
41
54
  apply: run,
42
55
  });
43
56
  function run(caps) {
44
- const { storage, memory, webui, events, hooks, lifecycle, provide } = caps;
57
+ const { storage, memory, events, hooks, lifecycle, provide, contributions, sessionManager, authority } = caps;
45
58
  /** 服务内部的 commitTurn / gc / flush 都写这个 source,日志页按 `…:checkpoint` 归组 */
46
- const logger = caps.logger.child('checkpoint');
47
- const cfg = normalizeConfig(parseConfig(configSchema, caps.config, logger));
48
- const gateway = createStorageGateway(storage);
59
+ const logger = caps.logger.use.child('checkpoint');
60
+ const cfg = normalizeConfig(parseConfig(configSchema, caps.config.use, logger));
61
+ const gateway = storage.use;
49
62
  const service = new CheckpointServiceImpl(cfg, logger, gateway);
50
- provide(checkpoint, service);
63
+ provide.use(checkpoint, service);
51
64
  // 注入 chat 回滚所需依赖:memory 引用(每次调用解析当前提供者)+ 事件发出器
52
65
  service.setChatRollbackDeps({
53
66
  memory,
54
67
  emitMessagesDeleted: (sessionId, timestamps) => {
55
- events
68
+ events.use
56
69
  .emit('memory:messages-deleted', { sessionId, timestamps })
57
70
  .catch(err => logger.debug(`emit memory:messages-deleted 失败: ${err.message}`));
58
71
  },
59
72
  emitHistoryChanged: sessionId => {
60
- events
73
+ events.use
61
74
  .emit('history:changed', { sessionId })
62
75
  .catch(err => logger.debug(`emit history:changed 失败: ${err.message}`));
63
76
  },
64
77
  });
65
- // ──────────── 页面动作(供 WebUI 调用)────────────
66
- webui.registerAction('listTurns', async (args) => {
67
- const sessionId = args.sessionId ?? '';
68
- if (!sessionId)
69
- return { error: '缺少 sessionId' };
70
- return service.listTurns(sessionId);
71
- });
72
- webui.registerAction('getManifest', async (args) => service.getManifest(args.sessionId, args.turnId));
73
- webui.registerAction('rollback', async (args) => {
74
- const sessionId = args.sessionId;
75
- const turnId = args.turnId;
76
- if (!sessionId || !turnId)
77
- return { ok: false, errors: [{ uri: '', reason: '缺少 sessionId 或 turnId' }] };
78
- return service.rollback(sessionId, turnId);
79
- });
80
- webui.registerAction('rollbackWithChat', async (args) => {
81
- const sessionId = args.sessionId;
82
- const turnId = args.turnId;
83
- if (!sessionId || !turnId) {
84
- return {
85
- ok: false,
86
- errors: [{ uri: '', reason: '缺少 sessionId 或 turnId' }],
87
- deletedMessages: 0,
88
- chatDeleted: false,
89
- };
90
- }
91
- return service.rollbackWithChat(sessionId, turnId);
92
- });
93
78
  // ──────────── 回合生命周期 ────────────
94
- // agent:input:before:一次 LLM 回合开始(一个用户消息进来)
95
- // 仅对配置 scopes 匹配的会话参与回合生命周期,避免 onebot 等聊天平台为每条消息都创建空 checkpoint。
96
- const isScopeEnabled = (platform, sessionType) => {
97
- if (cfg.scopes.length === 0)
98
- return false;
99
- const p = platform ?? '';
100
- const t = sessionType ?? '';
101
- for (const raw of cfg.scopes) {
102
- const [sp = '*', st = '*'] = raw.includes(':') ? raw.split(':', 2) : [raw, '*'];
103
- const platOk = sp === '*' || sp === '' || sp === p;
104
- const typeOk = st === '*' || st === '' || st === t;
105
- if (platOk && typeOk)
106
- return true;
107
- }
108
- return false;
79
+ // agent:turn:before 的 next 就是这一轮的全部(后续中间件、输入的归档、模型调用、工具、回合结束钩子),
80
+ // 用 agent 给的 turnId 把它包进 runTurn:期间的存储改动记进这一轮,next 返回(含被下游拦下、出错)即提交。
81
+ // 只包 coverage 覆盖的会话:按受众时看根会话的房间类别,不看这一轮从哪个入口进来(入口平台取开轮那条输入的)。
82
+ const fields = caps.sessionFields.use.fields(configSchema, caps);
83
+ const lookup = (id) => (sessionManager.present ? sessionManager.use.getSession(id) : undefined);
84
+ const isOwner = (platform, userId) => authority.present && authority.use.isOwner(platform, userId);
85
+ const covered = (sessionId, platform) => {
86
+ const coverage = fields.get(sessionId, { platform }).coverage;
87
+ return (coverage === 'all' || (coverage === 'ownerOnly' && roomClass(lookup(sessionId), lookup, isOwner) === 'owner-only'));
109
88
  };
110
- hooks.middleware('agent:input:before', async (data, next) => {
111
- if (isScopeEnabled(data.message.platform, data.message.sessionType)) {
112
- service.beginTurn(data.message.sessionId);
89
+ hooks.use.middleware('agent:turn:before', async (data, next) => {
90
+ if (covered(data.sessionId, data.inputs[0].message.platform)) {
91
+ await service.runTurn(data.turnId, data.sessionId, next);
113
92
  }
114
- await next();
115
- });
116
- // agent:turn:after:回合结束(按 sessionId 提交该会话回合;无对应回合则直接 return)
117
- hooks.middleware('agent:turn:after', async (data, next) => {
118
- await next();
119
- await service.endTurn(data.sessionId);
120
- });
121
- // 监听命令类工具调用,给该会话当前 turn 打 execUsed 标记(UI 显示 "部分未保护"):
122
- // 这些工具的副作用(子进程改磁盘、装包、起服务)不经 storage,快照覆盖不到。
123
- hooks.middleware('agent:tool:before', async (data, next) => {
124
- const name = data.name;
125
- if (name === 'exec' || name === 'exec_background' || name.startsWith('run_')) {
126
- service.markExecUsed(data.toolCallContext.sessionId);
93
+ else {
94
+ await next();
127
95
  }
128
- await next();
129
96
  });
130
97
  // ──────────── 参与统一的 memory:clear ────────────
131
98
  // /clear 与 session-manager.deleteSession 都通过 memory:clear hook 编排,
132
- // 不监听的话 checkpoint 目录无人清理,长期泄漏。
133
- hooks.middleware('memory:clear', async (data, next) => {
99
+ // 不监听的话 checkpoint 目录无人清理,长期泄漏。登记 checkpoint 类型,/clear -t 才选得中。
100
+ contributions.use.contribute('memory:clear-type', { id: 'checkpoint', label: t('clearType') });
101
+ hooks.use.middleware('memory:clear', async (data, next) => {
134
102
  if (data.types && !data.types.includes('checkpoint')) {
135
103
  await next();
136
104
  return;
@@ -142,7 +110,7 @@ function run(caps) {
142
110
  source: 'checkpoint',
143
111
  type: 'checkpoint',
144
112
  success: true,
145
- message: `所有 checkpoint 已清空(${n} 个 session)`,
113
+ message: t('clearedAll', { count: n }),
146
114
  });
147
115
  }
148
116
  else if (data.sessionId) {
@@ -151,23 +119,22 @@ function run(caps) {
151
119
  source: 'checkpoint',
152
120
  type: 'checkpoint',
153
121
  success: true,
154
- message: n > 0 ? `当前会话 checkpoint 已清空(${n} 个 turn)` : '当前会话无 checkpoint',
122
+ message: n > 0 ? t('clearedSession', { count: n }) : t('noneInSession'),
155
123
  });
156
124
  }
157
125
  }
158
126
  catch (err) {
159
- const msg = err instanceof Error ? err.message : String(err);
160
127
  data.results.push({
161
128
  source: 'checkpoint',
162
129
  type: 'checkpoint',
163
130
  success: false,
164
- message: `checkpoint 清空失败: ${msg}`,
131
+ message: t('clearFailed', { error: textOf(err) }),
165
132
  });
166
133
  }
167
134
  await next();
168
135
  });
169
- // 进程退出前提交所有未结束的活跃回合,避免崩溃/重载时丢失(per-session 化后不再有"任意新回合 flush 旧回合"的兜底)
170
- lifecycle.onDispose(() => service.flushAll());
171
- logger.info(`checkpoint 服务就绪 rootUri=${cfg.rootUri} maxFileSize=${cfg.maxFileSize} scopes=${cfg.scopes.join('|') || '<空>'}`);
136
+ // 拆卸时提交所有还在跑的回合,避免崩溃/重载时丢失
137
+ lifecycle.use.onDispose(() => service.flushAll());
138
+ logger.info(`checkpoint 服务就绪 rootUri=${cfg.rootUri} maxFileSize=${cfg.maxFileSize}`);
172
139
  }
173
140
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAEL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EACN,SAAS,EACT,MAAM,EACN,QAAQ,EACR,OAAO,GACR,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAA0B,qBAAqB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE9F,+DAA+D;AAC/D,gCAAgC;AAChC,+DAA+D;AAE/D,+CAA+C;AAC/C,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAoB,YAAY,CAAC,CAAC;AAEzE,MAAM,IAAI,GAAG;IACX;;;;;;OAMG;IACH,OAAO;IACP,mDAAmD;IACnD,MAAM,EAAE,QAAQ,CAAC,MAAM,CA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AAG,CAAC,WAAW,EAAE,CAAC,CAAC;AACvF,CAAC"}
@@ -0,0 +1,30 @@
1
+ declare const _default: {
2
+ readonly displayName: "Rewind checkpoints";
3
+ readonly rootDirLabel: "Storage directory";
4
+ readonly rootDirDescription: "Storage URI (data:/checkpoints by default). All checkpoint blobs and manifests are written here.";
5
+ readonly maxFileSizeLabel: "Per-file size limit (bytes)";
6
+ readonly maxFileSizeDescription: "Files larger than this get no content snapshot and are only recorded as skipped in the manifest.";
7
+ readonly keepSessionsLabel: "Sessions to keep";
8
+ readonly keepSessionsDescription: "GC threshold. After each turn is committed, if there are more session directories than this, the oldest ones are deleted. 0 turns GC off.";
9
+ readonly keepTurnsLabel: "Turns to keep per session";
10
+ readonly keepTurnsDescription: "After each turn is committed, once this session has more turns than this, the oldest ones are deleted (with their backups), so only the most recent turns can be rewound; a turn that changed no files and only talked still counts. 0 means no limit.";
11
+ readonly coverageLabel: "Sessions with checkpoints";
12
+ readonly coverageDescription: "Which sessions get checkpoints for their turns (rewind relies on them). “By audience” only records in sessions whose audience is just you: WebUI, the terminal and your own IM private chats; group chats and other people's private chats are not recorded, nor is a turn you send into a group from WebUI.";
13
+ readonly coverageOff: "Off";
14
+ readonly coverageOwnerOnly: "By audience (when it is just you)";
15
+ readonly coverageAll: "On";
16
+ readonly rootDirNotUri: "plugin-checkpoint config error: rootDir is not a storage URI; write it as <root>:/<path>";
17
+ readonly clearType: "Checkpoints (conversation rewind saves)";
18
+ readonly clearedAll: "Cleared all checkpoints ({count, plural, one {# session} other {# sessions}})";
19
+ readonly clearedSession: "Cleared the checkpoints of this session ({count, plural, one {# turn} other {# turns}})";
20
+ readonly noneInSession: "This session has no checkpoints";
21
+ readonly clearFailed: "Clearing checkpoints failed: {error}";
22
+ readonly notSnapshotUnreadable: "Not snapshotted (the original file could not be read; cannot be rewound)";
23
+ readonly notSnapshotDirectory: "Not snapshotted (a directory, or reading failed)";
24
+ readonly tooLarge: "File too large ({size} > {max})";
25
+ readonly noCheckpoint: "The checkpoint does not exist";
26
+ readonly noDeleteByTimestamps: "The current memory backend does not support deleteMessagesByTimestamps";
27
+ readonly deleteMessagesFailed: "Deleting messages failed: {error}";
28
+ };
29
+ export default _default;
30
+ //# sourceMappingURL=en.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/locales/en.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAgCG"}
@@ -0,0 +1,30 @@
1
+ import { defineLocale } from '@aalis/schema-i18n';
2
+ export default defineLocale()({
3
+ displayName: 'Rewind checkpoints',
4
+ rootDirLabel: 'Storage directory',
5
+ rootDirDescription: 'Storage URI (data:/checkpoints by default). All checkpoint blobs and manifests are written here.',
6
+ maxFileSizeLabel: 'Per-file size limit (bytes)',
7
+ maxFileSizeDescription: 'Files larger than this get no content snapshot and are only recorded as skipped in the manifest.',
8
+ keepSessionsLabel: 'Sessions to keep',
9
+ keepSessionsDescription: 'GC threshold. After each turn is committed, if there are more session directories than this, the oldest ones are deleted. 0 turns GC off.',
10
+ keepTurnsLabel: 'Turns to keep per session',
11
+ keepTurnsDescription: 'After each turn is committed, once this session has more turns than this, the oldest ones are deleted (with their backups), so only the most recent turns can be rewound; a turn that changed no files and only talked still counts. 0 means no limit.',
12
+ coverageLabel: 'Sessions with checkpoints',
13
+ coverageDescription: "Which sessions get checkpoints for their turns (rewind relies on them). “By audience” only records in sessions whose audience is just you: WebUI, the terminal and your own IM private chats; group chats and other people's private chats are not recorded, nor is a turn you send into a group from WebUI.",
14
+ coverageOff: 'Off',
15
+ coverageOwnerOnly: 'By audience (when it is just you)',
16
+ coverageAll: 'On',
17
+ rootDirNotUri: 'plugin-checkpoint config error: rootDir is not a storage URI; write it as <root>:/<path>',
18
+ clearType: 'Checkpoints (conversation rewind saves)',
19
+ clearedAll: 'Cleared all checkpoints ({count, plural, one {# session} other {# sessions}})',
20
+ clearedSession: 'Cleared the checkpoints of this session ({count, plural, one {# turn} other {# turns}})',
21
+ noneInSession: 'This session has no checkpoints',
22
+ clearFailed: 'Clearing checkpoints failed: {error}',
23
+ notSnapshotUnreadable: 'Not snapshotted (the original file could not be read; cannot be rewound)',
24
+ notSnapshotDirectory: 'Not snapshotted (a directory, or reading failed)',
25
+ tooLarge: 'File too large ({size} > {max})',
26
+ noCheckpoint: 'The checkpoint does not exist',
27
+ noDeleteByTimestamps: 'The current memory backend does not support deleteMessagesByTimestamps',
28
+ deleteMessagesFailed: 'Deleting messages failed: {error}',
29
+ });
30
+ //# sourceMappingURL=en.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en.js","sourceRoot":"","sources":["../../src/locales/en.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,eAAe,YAAY,EAAU,CAAC;IACpC,WAAW,EAAE,oBAAoB;IACjC,YAAY,EAAE,mBAAmB;IACjC,kBAAkB,EAChB,kGAAkG;IACpG,gBAAgB,EAAE,6BAA6B;IAC/C,sBAAsB,EACpB,kGAAkG;IACpG,iBAAiB,EAAE,kBAAkB;IACrC,uBAAuB,EACrB,2IAA2I;IAC7I,cAAc,EAAE,2BAA2B;IAC3C,oBAAoB,EAClB,wPAAwP;IAC1P,aAAa,EAAE,2BAA2B;IAC1C,mBAAmB,EACjB,8SAA8S;IAChT,WAAW,EAAE,KAAK;IAClB,iBAAiB,EAAE,mCAAmC;IACtD,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,0FAA0F;IACzG,SAAS,EAAE,yCAAyC;IACpD,UAAU,EAAE,+EAA+E;IAC3F,cAAc,EAAE,yFAAyF;IACzG,aAAa,EAAE,iCAAiC;IAChD,WAAW,EAAE,sCAAsC;IACnD,qBAAqB,EAAE,0EAA0E;IACjG,oBAAoB,EAAE,kDAAkD;IACxE,QAAQ,EAAE,iCAAiC;IAC3C,YAAY,EAAE,+BAA+B;IAC7C,oBAAoB,EAAE,wEAAwE;IAC9F,oBAAoB,EAAE,mCAAmC;CAC1D,CAAC,CAAC"}