sage-mem 2.25.0 → 2.26.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.
@@ -308,6 +308,8 @@ export const settingsUiSchema = z.object({ 'entry': z.enum(['both', 'sidebar', '
308
308
  // `resolveExternal`),这里只声明传输形状;`settingsPatchSchema` 里还有一份可选字段版。
309
309
  export const settingsExternalSchema = z.object({
310
310
  'enabled': z.number().readonly(),
311
+ // 2.26.0:收不收外来提交(与 enabled 是两件事)。
312
+ 'acceptSubmissions': z.number().readonly(),
311
313
  'prefixes': z.array(z.string()).readonly(),
312
314
  'tags': z.array(z.string()).readonly(),
313
315
  'include': z.array(z.string()).readonly(),
@@ -351,6 +353,7 @@ export const settingsPatchSchema = z.object({
351
353
  // 没碰过的字段不该被旧值覆盖(与 limits / ui / experimental 同一套语义)。
352
354
  'external': z.object({
353
355
  'enabled': z.number().optional(),
356
+ 'acceptSubmissions': z.number().optional(),
354
357
  'prefixes': z.array(z.string()).optional(),
355
358
  'tags': z.array(z.string()).optional(),
356
359
  'include': z.array(z.string()).optional(),
@@ -399,6 +402,50 @@ export const externalStatusSchema = z.object({
399
402
  }).readonly(),
400
403
  }).readonly()
401
404
 
405
+ // ── 2.26.0 外部来件(写侧)────────────────────────────────────────────────
406
+ /** 提交 id(形如 20261201-183000-1abc)。不是文件名,所以不走 fileNameSchema 的正则。 */
407
+ export const subIdSchema = z.string().max(80)
408
+ /** 拒绝理由(人读的一行)。 */
409
+ export const subReasonSchema = z.string().max(1000)
410
+ // 一条待处理提交 + 它的提案。`action` 是**现算**的(主库随时会变),所以每次读都是一份新判断。
411
+ export const intakeProposalItemSchema = z.object({
412
+ 'id': z.string().readonly(),
413
+ 'source': z.string().readonly(),
414
+ 'kind': z.string().readonly(),
415
+ 'name': z.string().readonly(),
416
+ 'description': z.string().readonly(),
417
+ 'type': z.string().readonly(),
418
+ 'submittedAt': z.string().readonly(),
419
+ 'action': z.enum(['create', 'conflict', 'manual', 'reject']).readonly(),
420
+ 'targetFile': z.string().readonly(),
421
+ 'reason': z.string().readonly(),
422
+ 'excerpt': z.string().readonly(),
423
+ // patch 才有内容:面板「复制建议」复制的就是这一段(空串 = 没有)。
424
+ 'suggestion': z.string().readonly(),
425
+ }).readonly()
426
+
427
+ export const intakeOverviewSchema = z.object({
428
+ 'pending': z.number().readonly(),
429
+ 'items': z.array(intakeProposalItemSchema).readonly(),
430
+ // 主库读不出来时这里非空 —— 面板据此禁用「批准」,而不是假装没有冲突。
431
+ 'scanError': z.string().readonly(),
432
+ 'reports': z.array(z.object({ 'name': z.string().readonly(), 'text': z.string().readonly() })).readonly(),
433
+ }).readonly()
434
+
435
+ export const intakeApproveResultSchema = z.object({
436
+ 'ok': z.boolean().readonly(),
437
+ 'action': z.string().readonly().optional(),
438
+ 'targetFile': z.string().readonly().optional(),
439
+ 'error': z.string().readonly().optional(),
440
+ 'report': z.string().readonly().optional(),
441
+ }).readonly()
442
+
443
+ export const intakeRejectResultSchema = z.object({
444
+ 'ok': z.boolean().readonly(),
445
+ 'id': z.string().readonly().optional(),
446
+ 'error': z.string().readonly().optional(),
447
+ }).readonly()
448
+
402
449
  // 保留名原样读写。读的两条分支(成功 {name,content} / 拒绝 {ok:false,error})用可选字段
403
450
  // 的并集接住;写的失败分支可能没有 file,所以 file 也是 optional。
404
451
  export const rawReadResultSchema = z.object({
@@ -19,7 +19,7 @@ import {
19
19
  archiveResultSchema, archivedReadResultSchema, archivedWriteResultSchema, updateCheckSchema, auditItemSchema, auditLinkSchema,
20
20
  auditTypeMismatchSchema, auditHazardSchema, auditOrphanSchema, auditIndexProposalSchema, auditReportSchema, openFolderResultSchema,
21
21
  archiveCandidateSchema, archiveCandidatesResultSchema, lockResultSchema, settingsLimitsSchema, settingsUiSchema, settingsSchema,
22
- settingsPatchSchema, settingsResultSchema, externalStatusSchema, rawReadResultSchema, rawWriteResultSchema, rawFileContentSchema, autodreamConfigSchema,
22
+ settingsPatchSchema, settingsResultSchema, externalStatusSchema, intakeOverviewSchema, intakeApproveResultSchema, intakeRejectResultSchema, subIdSchema, subReasonSchema, rawReadResultSchema, rawWriteResultSchema, rawFileContentSchema, autodreamConfigSchema,
23
23
  autodreamPathsSchema, autodreamRouteSchema, autodreamLastResultSchema, autodreamConfigResultSchema, autodreamStepSchema, autodreamStatusSchema,
24
24
  autodreamRunResultSchema, autodreamPatchSchema, reportListSchema, snapshotListSchema, runListSchema, declarationSchema,
25
25
  rollbackResultSchema, modelListSchema, autodreamOptsSchema, conflictIdSchema, conflictOptsSchema, conflictItemBase,
@@ -249,6 +249,44 @@ export const TYPERT = {
249
249
  result: { mode: 'strict', typeSymbol: 'sage-mem/types#MemorySettingsResult', schema: settingsResultSchema, create: () => settingsResultSchema },
250
250
  sourceLocation: { "file": "lib/index.js", "line": 1, "column": 1 },
251
251
  },
252
+ {
253
+ // 2.26.0:外部来件(写侧)—— 待处理提交 + 每条现算的提案。只读。
254
+ id: 'sage-mem#memory/externalSubmissions',
255
+ service: 'memory',
256
+ namespace: 'memory',
257
+ method: 'externalSubmissions',
258
+ invocation: { kind: 'direct' },
259
+ parameters: [],
260
+ result: { mode: 'strict', typeSymbol: 'sage-mem/types#IntakeOverview', schema: intakeOverviewSchema, create: () => intakeOverviewSchema },
261
+ sourceLocation: { "file": "lib/index.js", "line": 1, "column": 1 },
262
+ },
263
+ {
264
+ // 批准:只对 `create` 生效;其余动作会回 {ok:false, action} 说明原因。
265
+ id: 'sage-mem#memory/intakeApprove',
266
+ service: 'memory',
267
+ namespace: 'memory',
268
+ method: 'intakeApprove',
269
+ invocation: { kind: 'direct' },
270
+ parameters: [
271
+ { name: 'id', wire: 'id', source: 'json', codec: { mode: 'strict', typeSymbol: 'sage-mem/types#SubId', schema: subIdSchema, create: () => subIdSchema } },
272
+ ],
273
+ result: { mode: 'strict', typeSymbol: 'sage-mem/types#IntakeApproveResult', schema: intakeApproveResultSchema, create: () => intakeApproveResultSchema },
274
+ sourceLocation: { "file": "lib/index.js", "line": 1, "column": 1 },
275
+ },
276
+ {
277
+ // 拒绝:原件挪进 rejected/(不删),理由进报告与审计。
278
+ id: 'sage-mem#memory/intakeReject',
279
+ service: 'memory',
280
+ namespace: 'memory',
281
+ method: 'intakeReject',
282
+ invocation: { kind: 'direct' },
283
+ parameters: [
284
+ { name: 'id', wire: 'id', source: 'json', codec: { mode: 'strict', typeSymbol: 'sage-mem/types#SubId', schema: subIdSchema, create: () => subIdSchema } },
285
+ { name: 'reason', wire: 'reason', source: 'json', acceptsUndefined: true, codec: { mode: 'strict', typeSymbol: 'sage-mem/types#SubReason', schema: subIdSchema, create: () => subIdSchema } },
286
+ ],
287
+ result: { mode: 'strict', typeSymbol: 'sage-mem/types#IntakeRejectResult', schema: intakeRejectResultSchema, create: () => intakeRejectResultSchema },
288
+ sourceLocation: { "file": "lib/index.js", "line": 1, "column": 1 },
289
+ },
252
290
  {
253
291
  // 2.25.0:外部访问读侧的运行状态(只读、无入参)。设置走 setSettings({ external }),
254
292
  // 这里只回答「现在跑成什么样」—— 暴露条目数、最近一轮的时间与错误、端点是否在听。
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sage-mem",
3
3
  "description": "Cross-session memory for DeepSeek Harness — plain markdown files, no database, no worker.",
4
- "version": "2.25.0",
4
+ "version": "2.26.0",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "icon": "./icon.png",