@yankeguo/dsh-devlead 0.2.5 → 0.2.6

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Core Host service of the DevLead suite (`ctx.devLead`): the durable mode switch, damage-recovery
4
4
  `reset()`, Workspace and Session orchestration (including `useWorkspace(agent, request, signal?)`
5
5
  with directory creation opt-in), the watched-session notification hub with cold-lead rehydration, the mid-turn report channel for watched Sessions,
6
- and the `devLead` / `devLeadMode` Session projections.
6
+ and the `devLead` / `devLeadMode` / `devLeadWatch` Session projections.
7
7
 
8
8
  DevLead mode is **globally single-active**: at most one Session (across every Workspace) may be
9
9
  enabled. `setEnabled(agent, true)` throws `DEVLEAD_ALREADY_ACTIVE` naming the occupant when another
@@ -12,8 +12,8 @@ releasable, and a restart/rehydration reconciles historical duplicates and keeps
12
12
  Admission is serialized in-process and scans live projections plus the durable corpus.
13
13
 
14
14
  `reportProgress(agent, { message, kind?, summary? }, signal?)` lets a watched, non-DevLead Session
15
- send a one-way report to its unique active lead. It resolves the supervisor through the hub's
16
- reverse index, validates size/kind, deduplicates identical messages within a turn, enforces four
15
+ send a one-way report to its unique active lead. It resolves the active lead that watches it through
16
+ the hub's reverse index, validates size/kind, deduplicates identical messages within a turn, enforces four
17
17
  distinct reports per turn (`DEVLEAD_REPORT_RATE_LIMITED`), and otherwise refuses with
18
18
  `DEVLEAD_NOT_SUPERVISED`. The receipt is `{ report, durable, queued, warning? }`.
19
19
 
@@ -70,7 +70,7 @@ validated at both the Loader and direct-construction boundaries.
70
70
 
71
71
  `@yankeguo/dsh-devlead` 是套件的 Host 核心服务 `ctx.devLead`:模式开关、损坏状态恢复
72
72
  `reset()`、Workspace/Session 编排(`useWorkspace(agent, request, signal?)`,目录创建 opt-in)、
73
- 带冷 lead 索引重建的 watch 索引与通知投递,以及 `devLead` / `devLeadMode` projection。
73
+ 带冷 lead 索引重建的关注关系索引与通知投递,以及 `devLead` / `devLeadMode` / `devLeadWatch` projection。
74
74
  `agents`、`sessions`、`sessionProjections` 为必需 peer;Workspace registry、Session controller、
75
75
  标题/查询服务、projection cache、`sessionPersistence`(冷重建就绪屏障)与实验性 worktree 能力
76
76
  均为可选探测。完整中文文档见[根 README.zh.md](https://github.com/yankeguo/dsh-devlead/blob/main/README.zh.md)与
package/lib/index.js CHANGED
@@ -15239,6 +15239,7 @@ import {
15239
15239
  DEVLEAD_REPORT_SUMMARY_MAX as DEVLEAD_REPORT_SUMMARY_MAX3,
15240
15240
  DEVLEAD_RESET_RECORD_TYPE as DEVLEAD_RESET_RECORD_TYPE2,
15241
15241
  DEVLEAD_TRANSITIONS,
15242
+ DEVLEAD_WATCH_PROJECTION_KEY,
15242
15243
  DEVLEAD_WATCH_RECORD_TYPE as DEVLEAD_WATCH_RECORD_TYPE2,
15243
15244
  devLeadReportId as devLeadReportId3,
15244
15245
  notificationId as notificationId2
@@ -15413,6 +15414,80 @@ var devLeadProjectionDefinition = {
15413
15414
  // are discarded and refolded from the durable log.
15414
15415
  stateVersion: 2
15415
15416
  };
15417
+ function emptyDevLeadWatchProjectionState() {
15418
+ return { sessions: [], failure: null };
15419
+ }
15420
+ var devLeadWatchProjectionStateSchema = external_exports.object({
15421
+ sessions: external_exports.array(external_exports.string().min(1)).refine(
15422
+ (sessions) => new Set(sessions).size === sessions.length,
15423
+ { message: "watch sessions must be unique" }
15424
+ ),
15425
+ failure: external_exports.string().min(1).nullable()
15426
+ }).strict();
15427
+ var devLeadWatchProjectionSchema = external_exports.object({
15428
+ sessions: external_exports.array(external_exports.string().min(1)).refine(
15429
+ (sessions) => new Set(sessions).size === sessions.length,
15430
+ { message: "watch sessions must be unique" }
15431
+ )
15432
+ }).strict();
15433
+ function devLeadWatchProjectionView(state) {
15434
+ return { sessions: state.sessions };
15435
+ }
15436
+ function applyDevLeadWatchProjection(state, event) {
15437
+ const record2 = pluginRecordOf(event);
15438
+ if (record2 === void 0) return state;
15439
+ if (record2.type === DEVLEAD_RESET_RECORD_TYPE2) {
15440
+ try {
15441
+ decodeResetRecord(record2.data);
15442
+ return emptyDevLeadWatchProjectionState();
15443
+ } catch (error51) {
15444
+ if (state.failure !== null) return state;
15445
+ const message = error51 instanceof Error ? error51.message : String(error51);
15446
+ return {
15447
+ ...state,
15448
+ failure: `devlead watch replay failed at session event ${event.seq} (${record2.type}): ${message}`
15449
+ };
15450
+ }
15451
+ }
15452
+ if (state.failure !== null) return state;
15453
+ try {
15454
+ switch (record2.type) {
15455
+ case DEVLEAD_WATCH_RECORD_TYPE2: {
15456
+ const watch = decodeWatchRecord(record2.data);
15457
+ return sameSessionIds(state.sessions, watch.sessions) ? state : { sessions: watch.sessions, failure: null };
15458
+ }
15459
+ case DEVLEAD_MODE_RECORD_TYPE2:
15460
+ decodeModeRecord(record2.data);
15461
+ return state;
15462
+ case DEVLEAD_NOTIFICATION_RECORD_TYPE2:
15463
+ decodeNotificationRecord(record2.data);
15464
+ return state;
15465
+ case DEVLEAD_REPORT_RECORD_TYPE2:
15466
+ decodeReportRecord(record2.data);
15467
+ return state;
15468
+ default:
15469
+ return state;
15470
+ }
15471
+ } catch (error51) {
15472
+ const message = error51 instanceof Error ? error51.message : String(error51);
15473
+ return {
15474
+ ...state,
15475
+ failure: `devlead watch replay failed at session event ${event.seq} (${record2.type}): ${message}`
15476
+ };
15477
+ }
15478
+ }
15479
+ var devLeadWatchProjectionDefinition = {
15480
+ key: DEVLEAD_WATCH_PROJECTION_KEY,
15481
+ stateSchema: devLeadWatchProjectionStateSchema,
15482
+ init: emptyDevLeadWatchProjectionState,
15483
+ apply: applyDevLeadWatchProjection,
15484
+ wire: {
15485
+ viewSchema: devLeadWatchProjectionSchema,
15486
+ view: devLeadWatchProjectionView
15487
+ },
15488
+ // 1: the initial summary representation of the watch set.
15489
+ stateVersion: 1
15490
+ };
15416
15491
  function emptyDevLeadModeProjectionState() {
15417
15492
  return { enabled: false, failure: null };
15418
15493
  }
@@ -16888,6 +16963,7 @@ var DevLeadService = class extends Service {
16888
16963
  async [Service.init]() {
16889
16964
  this.projectionHandle = await this.ctx.sessionProjections.register(devLeadProjectionDefinition);
16890
16965
  await this.ctx.sessionProjections.register(devLeadModeProjectionDefinition);
16966
+ await this.ctx.sessionProjections.register(devLeadWatchProjectionDefinition);
16891
16967
  this.hub = new DevLeadNotificationHub(
16892
16968
  this.ctx,
16893
16969
  (session) => this.projectionHandle.stateOf(session),
@@ -17979,15 +18055,15 @@ var DevLeadService = class extends Service {
17979
18055
  };
17980
18056
  }
17981
18057
  /**
17982
- * Resolve the unique active DevLead Session supervising one reporter.
18058
+ * Resolve the unique active DevLead Session that watches one reporter.
17983
18059
  *
17984
18060
  * The hub's reverse index already reflects durable watch/mode state (live and
17985
18061
  * cold rehydrated leads). Archived leads are excluded, and when historical
17986
18062
  * state leaves more than one watcher the current global incumbent wins; with
17987
- * no unique answer the reporter is treated as unsupervised instead of
18063
+ * no unique answer the reporter is treated as unwatched instead of
17988
18064
  * broadcasting to an arbitrary lead.
17989
18065
  * @param agent - candidate watched Session Agent.
17990
- * @returns the supervising lead Session id, or undefined.
18066
+ * @returns the watching lead Session id, or undefined.
17991
18067
  */
17992
18068
  supervisorOf(agent) {
17993
18069
  if (this.hub === void 0) return void 0;
@@ -18022,7 +18098,7 @@ var DevLeadService = class extends Service {
18022
18098
  /**
18023
18099
  * Whether one Session may send mid-turn reports to an active DevLead.
18024
18100
  * @param agent - candidate reporter Agent.
18025
- * @returns whether the reporter has exactly one usable supervisor.
18101
+ * @returns whether the reporter has exactly one active lead watching it.
18026
18102
  */
18027
18103
  isSupervised(agent) {
18028
18104
  return this.supervisorOf(agent) !== void 0;
@@ -19075,6 +19151,7 @@ export {
19075
19151
  DevLeadService,
19076
19152
  applyDevLeadModeProjection,
19077
19153
  applyDevLeadProjection,
19154
+ applyDevLeadWatchProjection,
19078
19155
  assistantExcerpt,
19079
19156
  createDevLeadNoticeMessage,
19080
19157
  createDevLeadPromptMessage,
@@ -19096,8 +19173,13 @@ export {
19096
19173
  devLeadProjectionStateSchema,
19097
19174
  devLeadProjectionView,
19098
19175
  devLeadReport,
19176
+ devLeadWatchProjectionDefinition,
19177
+ devLeadWatchProjectionSchema,
19178
+ devLeadWatchProjectionStateSchema,
19179
+ devLeadWatchProjectionView,
19099
19180
  emptyDevLeadModeProjectionState,
19100
19181
  emptyDevLeadProjectionState,
19182
+ emptyDevLeadWatchProjectionState,
19101
19183
  failureExcerpt,
19102
19184
  isDevLeadError,
19103
19185
  modeRecord,
package/locale/zh.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "DevLead",
4
- "description": "DevLead 模式的 Host 核心:每个会话的模式开关、lead 的 Workspace 与会话编排、被监督会话的通知,以及 devLead 会话投影。"
4
+ "description": "DevLead 模式的 Host 核心:每个会话的模式开关、lead 的 Workspace 与会话编排、已关注会话的通知,以及 devLead 会话投影。"
5
5
  }
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yankeguo/dsh-devlead",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "DevLead mode core service for the DeepSeek Harness: durable per-session mode, Workspace and Session orchestration, watched-session notifications, and the `devLead` Session projection.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -43,7 +43,7 @@
43
43
  }
44
44
  },
45
45
  "dependencies": {
46
- "@yankeguo/dsh-devlead-protocol": "0.2.5"
46
+ "@yankeguo/dsh-devlead-protocol": "0.2.6"
47
47
  },
48
48
  "engines": {
49
49
  "dsh": ">=0.2.2-rc.1 <0.3.0"