@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.
- package/CHANGELOG.md +10 -0
- package/README.md +33 -24
- package/client.js +435 -34
- package/cordis.patch.yml +30 -31
- package/index.js +98 -24
- package/lib/domain/policy.js +8 -1
- package/lib/domain/task.js +2 -0
- package/lib/domain/team-blueprint.js +240 -0
- package/lib/host/default-roster.js +18 -0
- package/lib/host/member-tools.js +6 -1
- package/lib/host/project-runtime.js +2 -2
- package/lib/host/service.js +195 -16
- package/lib/host/views.js +42 -1
- package/lib/host/waker.js +38 -8
- package/lib/ledger/fold.js +23 -0
- package/lib/runtime/stop-guard.js +17 -2
- package/package.json +1 -1
package/lib/ledger/fold.js
CHANGED
|
@@ -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
|
|
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.
|
|
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",
|