@suifei/dsh-ai-team 0.4.146 → 0.4.148

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.
@@ -192,6 +192,7 @@ function makeProject(payload, event) {
192
192
  status: textOr(source.status, 'active'),
193
193
  createdAt: intOr(source.createdAt, event.at),
194
194
  archivedAt: null,
195
+ ...(isPlainObject(source.blueprint) ? { blueprint: source.blueprint } : {}),
195
196
  };
196
197
  }
197
198
 
@@ -279,6 +280,7 @@ function makeTask(payload, event) {
279
280
  sourceMessageId: stringOrNull(source.sourceMessageId),
280
281
  resultRef: stringOrNull(source.resultRef),
281
282
  originRefs: stringArray(source.originRefs),
283
+ ...(isPlainObject(source.blueprintRun) ? { blueprintRun: source.blueprintRun } : {}),
282
284
  createdBy: textOr(source.createdBy, actorMemberId(event)),
283
285
  createdAt: intOr(source.createdAt, event.at),
284
286
  updatedAt: intOr(source.updatedAt, event.at),
@@ -778,6 +780,27 @@ function applyEventCore(state, event) {
778
780
  // 计数在 applyEvent 外层;这里只推进 seq,使事件「已应用」。
779
781
  return advance(state, event);
780
782
 
783
+ case 'project/blueprint-evidence': {
784
+ const project = state.projects?.[event.projectId];
785
+ const field = { prepared: 'blueprintPrepared', time: 'blueprintTime', confirmation: 'blueprintConfirmation' }[payload.kind];
786
+ if (!project?.blueprint || typeof field !== 'string' || !isPlainObject(payload.evidence)) return advance(state, event);
787
+ return advance(state, event, { projects: { ...state.projects, [event.projectId]: { ...project, [field]: payload.evidence } } });
788
+ }
789
+
790
+ case 'project/blueprint-measured': {
791
+ const project = state.projects?.[event.projectId];
792
+ const measurement = payload.measurement;
793
+ if (!project?.blueprint || !isPlainObject(measurement)) return advance(state, event);
794
+ return advance(state, event, { projects: {
795
+ ...state.projects,
796
+ [event.projectId]: {
797
+ ...project,
798
+ blueprintMeasurement: measurement,
799
+ ...(measurement.qa === false ? { blueprintV1Measurement: measurement } : {}),
800
+ },
801
+ } });
802
+ }
803
+
781
804
  case 'project/pmo-updated': {
782
805
  const projectId = textOr(payload.projectId, event.projectId);
783
806
  const project = state.projects?.[projectId];
@@ -31,6 +31,20 @@ export function stoppedTeamDenial(execution, projectOf) {
31
31
  };
32
32
  }
33
33
 
34
+ /** 首发只在账本交付草稿。父会话识别覆盖成员绑定 sessionId 以前的首次调用。 */
35
+ export function blueprintToolDenial(execution, projectOf) {
36
+ if (execution?.name === 'team') return null;
37
+ const sessionId = execution?.agent?.id;
38
+ if (typeof sessionId !== 'string' || sessionId === '') return null;
39
+ const parent = execution.agent?.session?.header?.parentSession;
40
+ const project = projectOf(sessionId) ?? (typeof parent === 'string' && parent !== '' ? projectOf(parent) : null);
41
+ if (project?.blueprint !== true) return null;
42
+ return {
43
+ projectId: project.projectId,
44
+ reason: '首发试跑只用 team 工具交付草稿。发布、发送、删除、付费或永久变更由负责人提请用户明确决定并由用户操作。',
45
+ };
46
+ }
47
+
34
48
  /**
35
49
  * SkillOpt 一次性子代理(handoff 作答、判官、生成)只凭题面文字作答,不得调用任何工具。
36
50
  *
@@ -81,9 +95,10 @@ export function registerStopGuard({ tools, projectOf, diag }) {
81
95
  if (tools === undefined || tools === null || typeof tools.guard !== 'function') return () => {};
82
96
  return tools.guard((execution) => {
83
97
  try {
84
- const denial = stoppedTeamDenial(execution, projectOf);
98
+ const blueprint = blueprintToolDenial(execution, projectOf);
99
+ const denial = blueprint ?? stoppedTeamDenial(execution, projectOf);
85
100
  if (denial === null) return undefined;
86
- diag?.append?.({ ev: 'team.stopped.blocked', projectId: denial.projectId, sessionId: execution?.agent?.id ?? null, tool: String(execution?.name ?? '') });
101
+ diag?.append?.({ ev: blueprint ? 'blueprint.tool.blocked' : 'team.stopped.blocked', projectId: denial.projectId, sessionId: execution?.agent?.id ?? null, tool: String(execution?.name ?? '') });
87
102
  return denial.reason;
88
103
  } catch {
89
104
  // 守卫自身出错绝不能阻断工具调用。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suifei/dsh-ai-team",
3
- "version": "0.4.146",
3
+ "version": "0.4.148",
4
4
  "type": "module",
5
5
  "description": "文渊阁 (Wenyuan Pavilion) — AI Team mode for DeepSeek Harness: concurrent projects, owned tasks, threads, inbox and an append-only team ledger",
6
6
  "license": "MIT",