bs-engineering-suite 2.9.0-rc.13 → 2.9.0-rc.15
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/NOTICE.md +1 -1
- package/README.md +35 -25
- package/cordis.patch.yml +87 -1
- package/docs/content-packs/ONLINE_LIBRARY.md +1 -1
- package/docs/windows-install.md +5 -5
- package/docs/windows-usage.md +2 -2
- package/node_modules/@buildseek/diagnostics/lib/client.js +4 -4
- package/node_modules/@buildseek/diagnostics/lib/version.js +1 -1
- package/node_modules/@buildseek/harness-engineering-document-plugin/dist/client.js +2 -2
- package/node_modules/@buildseek/harness-engineering-document-plugin/lib/content-packs.js +15 -1
- package/node_modules/@buildseek/harness-engineering-document-plugin/lib/project-content-flow.js +1 -0
- package/node_modules/@buildseek/harness-engineering-document-plugin/lib/project-data/application.js +1 -1
- package/node_modules/@buildseek/harness-engineering-document-plugin/lib/project-data/project-setup.js +5 -1
- package/node_modules/@buildseek/harness-engineering-document-plugin/lib/service.js +13 -1
- package/node_modules/@buildseek/harness-engineering-document-plugin/lib/types/content-packs.d.ts +1 -1
- package/node_modules/@buildseek/harness-engineering-document-plugin/lib/types/host-adapter/optional-host.d.ts +9 -0
- package/node_modules/@buildseek/harness-engineering-document-plugin/lib/types/project-data/application.d.ts +1 -0
- package/node_modules/@buildseek/harness-engineering-document-plugin/lib/types/service.d.ts +2 -0
- package/node_modules/@buildseek/harness-engineering-document-plugin/lib/types/workbench/application.d.ts +2 -0
- package/node_modules/@buildseek/harness-engineering-document-plugin/lib/workbench/application.js +9 -1
- package/node_modules/@buildseek/harness-engineering-document-plugin/lib/workbench/native.js +30 -6
- package/node_modules/@buildseek/harness-engineering-document-plugin/presets/buildseek-engineering-documents/preset.yml +1 -1
- package/node_modules/@buildseek/harness-engineering-document-plugin/presets/buildseek-engineering-documents.patch.yml +1 -1
- package/node_modules/@buildseek/platform/project-setup.d.ts +1 -1
- package/node_modules/@buildseek/platform/project-setup.js +41 -1
- package/node_modules/@dsh-engineering/workbench/client/bundle.js +105 -39
- package/node_modules/bs-engineering-docs/lib/agent.js +64 -14
- package/node_modules/bs-engineering-docs/lib/project-tools.js +133 -1
- package/package.json +1 -1
package/node_modules/@buildseek/harness-engineering-document-plugin/lib/workbench/application.js
CHANGED
|
@@ -58,7 +58,15 @@ const SnapshotSchema = z.object({ schema: z.literal('buildseek/engineering-workb
|
|
|
58
58
|
const StoredSnapshotSchema = SnapshotSchema.extend({ artifacts: z.array(z.union([ArtifactSchema, LegacyArtifactSchema])).max(2000), mutations: z.array(MutationRecordSchema).max(1000).optional() }).strict();
|
|
59
59
|
const StoredRecordSchema = z.object({ sequence: z.number().int().positive(), previous: sha.nullable(), state: StoredSnapshotSchema, digest: sha }).strict();
|
|
60
60
|
const NativeMessageSchema = z.object({ id, text: z.string().max(1048576), timestamp: z.number().finite().nonnegative().optional(), attachments: z.array(z.object({ id, name: z.string().min(1).max(255), mime: z.string().max(128) }).strict()).max(20).optional() }).strict();
|
|
61
|
-
|
|
61
|
+
/** Accept a direct imperative; questions, conditional or negative wording need clarification. */
|
|
62
|
+
export const nativeIntent = (text) => {
|
|
63
|
+
const value = text.trim();
|
|
64
|
+
if (!value || value.length > 160 || /[??]/u.test(value) ||
|
|
65
|
+
/(?:不要|不用|不必|不需|不想|不能|不可|不应|不允许|不生成|先不|暂不|并不|没有|没必要|尚未|无需|无须|别生成|先别|暂别|别再|避免|取消|停止|禁止|暂缓|推迟|稍后|待会|之后|能否|是否|可否|如何|怎么|为什么|如果|假如|除非)/u.test(value) ||
|
|
66
|
+
/(?:吗|么|嘛|呢)[。!!]*$/u.test(value))
|
|
67
|
+
return false;
|
|
68
|
+
return /^(?:(?:请帮我|麻烦你|请你|帮我|麻烦|请|现在|立即|立刻)\s*)?生成(?!(?:的|了|过|完|流程|过程|方法|原理|规则|说明|状态))[\s\S]*$/u.test(value);
|
|
69
|
+
};
|
|
62
70
|
const hash = (value) => canonicalSha256(asJson(value));
|
|
63
71
|
const same = (left, right) => canonicalJson(asJson(left)) === canonicalJson(asJson(right));
|
|
64
72
|
const requestHash = (revision, draft, materials) => hash({ revision, draft, materials });
|
|
@@ -19,7 +19,7 @@ export const WORKBENCH_SCOPES = ['engineering-document:workspace', 'engineering-
|
|
|
19
19
|
const packageRoot = fileURLToPath(new URL('../../', import.meta.url)).replace(/\/$/, '');
|
|
20
20
|
const presetFiles = [
|
|
21
21
|
{ path: 'agent.cordis.yml', bytes: 97, sha256: '5249821a32ce89aa848300068159c5a652f7658725c032ba3dda525762d53594', mode: '0600' },
|
|
22
|
-
{ path: 'preset.yml', bytes:
|
|
22
|
+
{ path: 'preset.yml', bytes: 153, sha256: '66a5f8a501168348992e4a157d9eb9d9a402c3ba6a5bc273fa7cbfc675b6d2e7', mode: '0600' },
|
|
23
23
|
];
|
|
24
24
|
/**
|
|
25
25
|
* 当前生效的 agent preset。
|
|
@@ -319,19 +319,43 @@ export class NativeWorkbench {
|
|
|
319
319
|
}
|
|
320
320
|
/** Current model-visible real user event, pinned to the official live surface and durable bytes. */
|
|
321
321
|
async currentDialogueEvent(id) {
|
|
322
|
-
|
|
322
|
+
const host = optionalHost(this.ctx);
|
|
323
|
+
if (!hasDialogueHost(host))
|
|
323
324
|
workbenchError('EDP_DIALOGUE_HOST_UNAVAILABLE');
|
|
324
|
-
|
|
325
|
+
let session = await this.session(id);
|
|
325
326
|
if (session.header.id !== id || session.header.parentSession || currentSessionPreset(session) !== ENGINEERING_PRESET)
|
|
326
327
|
workbenchError('EDP_ENGINEERING_SESSION_REQUIRED');
|
|
327
328
|
// NEXT-01D-CONNECT-INJECT-FIX-01:顶层 EDP fiber 只 inject `tools`;此处必须走 optional seam
|
|
328
329
|
//(`ctx.get(name,false)`),否则 Cordis 先抛 `without inject`,屏蔽下面稳定的 EDP 码。
|
|
329
|
-
const live =
|
|
330
|
-
|
|
330
|
+
const live = host.sessions.get(SessionId(id));
|
|
331
|
+
let nodes = live?.surface?.nodes ?? [];
|
|
332
|
+
// A live event may precede persistence. Flush the exact live session before
|
|
333
|
+
// reopening the log; false means no durability listener participated.
|
|
334
|
+
if (nodes.some(seq => seq > (session.events.at(-1)?.seq ?? -1))) {
|
|
335
|
+
try {
|
|
336
|
+
if (!live || !host.sessions.flush || await host.sessions.flush(live) !== true)
|
|
337
|
+
workbenchError('EDP_DIALOGUE_EVENT_UNAVAILABLE');
|
|
338
|
+
session = await this.session(id);
|
|
339
|
+
}
|
|
340
|
+
catch {
|
|
341
|
+
workbenchError('EDP_DIALOGUE_EVENT_UNAVAILABLE');
|
|
342
|
+
}
|
|
343
|
+
if (host.sessions.get(SessionId(id)) !== live)
|
|
344
|
+
workbenchError('EDP_DIALOGUE_EVENT_UNAVAILABLE');
|
|
345
|
+
nodes = live.surface?.nodes ?? [];
|
|
346
|
+
// Events can arrive during the barrier or the subsequent read. Never
|
|
347
|
+
// fall back to an older user event when the new surface is ahead.
|
|
348
|
+
if (nodes.some(seq => seq > (session.events.at(-1)?.seq ?? -1)))
|
|
349
|
+
workbenchError('EDP_DIALOGUE_EVENT_UNAVAILABLE');
|
|
350
|
+
}
|
|
351
|
+
if (session.header.id !== id || session.header.parentSession || currentSessionPreset(session) !== ENGINEERING_PRESET)
|
|
352
|
+
workbenchError('EDP_ENGINEERING_SESSION_REQUIRED');
|
|
331
353
|
const users = session.events.filter(e => e.type === 'user/message' && e.data.source.kind === 'user');
|
|
332
354
|
if (!live && users.length)
|
|
333
355
|
workbenchError('EDP_DIALOGUE_EVENT_UNAVAILABLE');
|
|
334
|
-
const
|
|
356
|
+
const usersBySeq = new Map(users.map(event => [event.seq, event]));
|
|
357
|
+
const seq = nodes.slice().reverse().find(node => usersBySeq.has(node));
|
|
358
|
+
const event = seq === undefined ? undefined : usersBySeq.get(seq);
|
|
335
359
|
if (users.length && !event)
|
|
336
360
|
workbenchError('EDP_DIALOGUE_EVENT_UNAVAILABLE');
|
|
337
361
|
return event ? { seq: event.seq, data: event.data } : null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: 工程资料
|
|
2
2
|
description: 原生对话整理材料与事实,明确生成指令后生成可编辑候选资料;不自动批准或正式放行。
|
|
@@ -13,7 +13,7 @@ export function commitProjectPackages(referenceRoot:string,projectRoot:string,pr
|
|
|
13
13
|
export function packageReferences(root:string):Promise<Record<string,ProjectResources & {history?:ProjectResources[]}>>
|
|
14
14
|
export function projectPackageReferenced(root:string,kind:string,ref:any):Promise<boolean>
|
|
15
15
|
export const BASIC_CATEGORIES:[string,string[]][]
|
|
16
|
-
export class ProjectBasicFiles{constructor(root:string,projectId:string,check?:()=>Promise<unknown>);state():Promise<any>;reapExpired(state:any):Promise<any>;status(state:any):Promise<any>;start(input:any):Promise<any>;append(input:any):Promise<any>;complete(id:string):Promise<any>;cancel(id:string):Promise<void>;category(id:string,category:string):Promise<void>;open(id:string):Promise<{row:any;handle:import('node:fs/promises').FileHandle}>}
|
|
16
|
+
export class ProjectBasicFiles{constructor(root:string,projectId:string,check?:()=>Promise<unknown>);state():Promise<any>;reapExpired(state:any):Promise<any>;status(state:any):Promise<any>;start(input:any):Promise<any>;append(input:any):Promise<any>;complete(id:string):Promise<any>;cancel(id:string):Promise<void>;category(id:string,category:string):Promise<void>;unbind(id:string):Promise<void>;open(id:string):Promise<{row:any;handle:import('node:fs/promises').FileHandle}>}
|
|
17
17
|
export function registerProjectArtifactSource(provider:(root:string)=>Promise<any[]>):()=>void
|
|
18
18
|
export function projectArtifactSources(root:string,onFailure?:()=>void):Promise<any[]>
|
|
19
19
|
export function projectArtifactPreview(root:string,row:any,signal:AbortSignal,scope?:{sessionId:string;bindingRevision:number}):Promise<{relativePath:string;leaseId:string}>
|
|
@@ -6,7 +6,36 @@ import {join,basename,isAbsolute,resolve} from 'node:path'
|
|
|
6
6
|
import {createHash,randomUUID} from 'node:crypto'
|
|
7
7
|
const code=c=>{throw Error('BS_PROJECT_'+c)}
|
|
8
8
|
const locks=new Map()
|
|
9
|
-
export async function projectLock(key,fn
|
|
9
|
+
export async function projectLock(key, fn, signal) {
|
|
10
|
+
signal?.throwIfAborted()
|
|
11
|
+
const before = locks.get(key) ?? Promise.resolve()
|
|
12
|
+
let release
|
|
13
|
+
const held = new Promise(resolve => { release = resolve })
|
|
14
|
+
// A canceled waiter may settle its own slot early. Its successors still
|
|
15
|
+
// depend on the preceding holder, and only a settled tail clears the key.
|
|
16
|
+
const tail = before.then(() => held)
|
|
17
|
+
locks.set(key, tail)
|
|
18
|
+
void tail.then(() => {
|
|
19
|
+
if (locks.get(key) === tail) locks.delete(key)
|
|
20
|
+
})
|
|
21
|
+
try {
|
|
22
|
+
if (signal) {
|
|
23
|
+
let abort
|
|
24
|
+
const canceled = new Promise((_, reject) => {
|
|
25
|
+
abort = () => reject(signal.reason)
|
|
26
|
+
signal.addEventListener('abort', abort, { once: true })
|
|
27
|
+
})
|
|
28
|
+
try { await Promise.race([before, canceled]) }
|
|
29
|
+
finally { signal.removeEventListener('abort', abort) }
|
|
30
|
+
signal.throwIfAborted()
|
|
31
|
+
} else {
|
|
32
|
+
await before
|
|
33
|
+
}
|
|
34
|
+
return await fn()
|
|
35
|
+
} finally {
|
|
36
|
+
release()
|
|
37
|
+
}
|
|
38
|
+
}
|
|
10
39
|
export async function safeProjectDir(root,parts){
|
|
11
40
|
let p=root;const privateMetadata=parts[0]==='.dsh-engineering'
|
|
12
41
|
for(const part of parts){
|
|
@@ -680,6 +709,17 @@ export class ProjectBasicFiles {
|
|
|
680
709
|
await saveProjectSetup(this.root, state)
|
|
681
710
|
}
|
|
682
711
|
|
|
712
|
+
async unbind(id) {
|
|
713
|
+
if (typeof id !== 'string' || !id) code('INPUT_INVALID')
|
|
714
|
+
const state = await this.state()
|
|
715
|
+
if (!state.files.some(file => file.id === id)) return
|
|
716
|
+
state.files = state.files.filter(file => file.id !== id)
|
|
717
|
+
for (const [uploadId, fileId] of Object.entries(state.receipts ?? {})) {
|
|
718
|
+
if (fileId === id) delete state.receipts[uploadId]
|
|
719
|
+
}
|
|
720
|
+
await saveProjectSetup(this.root, state, this.check)
|
|
721
|
+
}
|
|
722
|
+
|
|
683
723
|
async open(id) {
|
|
684
724
|
const state = await this.state(), row = state.files.find(file => file.id === id)
|
|
685
725
|
if (!row || !validBasicName(row.name) || row.relativePath !== '项目基础资料/' + row.name) code('FILE_NOT_FOUND')
|