openfeel 1.5.11 → 1.5.12
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 +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +10 -0
- package/dist/commands/setup.js.map +1 -1
- package/dist/core/dsh-profile.d.ts +5 -0
- package/dist/core/dsh-profile.d.ts.map +1 -1
- package/dist/core/dsh-profile.js +5 -2
- package/dist/core/dsh-profile.js.map +1 -1
- package/dist/core/i18n-data/en.d.ts.map +1 -1
- package/dist/core/i18n-data/en.js +1 -0
- package/dist/core/i18n-data/en.js.map +1 -1
- package/dist/core/i18n-data/zh-CN.d.ts.map +1 -1
- package/dist/core/i18n-data/zh-CN.js +1 -0
- package/dist/core/i18n-data/zh-CN.js.map +1 -1
- package/dist/core/setup.d.ts +10 -0
- package/dist/core/setup.d.ts.map +1 -1
- package/dist/core/setup.js +11 -1
- package/dist/core/setup.js.map +1 -1
- package/dist/core/template-loader.d.ts.map +1 -1
- package/dist/core/template-loader.js +12 -2
- package/dist/core/template-loader.js.map +1 -1
- package/dist/core/update.d.ts.map +1 -1
- package/dist/core/update.js +12 -2
- package/dist/core/update.js.map +1 -1
- package/dsh/ADAPTER.md +45 -11
- package/dsh/lib/adapters/guard-state.js +436 -40
- package/dsh/lib/adapters/workflow-gate.js +49 -0
- package/dsh/lib/guard.js +426 -11
- package/dsh/lib/index.js +9 -1
- package/dsh/lib/tools/index.js +78 -14
- package/dsh/package.json +2 -2
- package/package.json +1 -1
package/dsh/lib/tools/index.js
CHANGED
|
@@ -18,8 +18,8 @@ import { buildDispatchTemplate } from '../adapters/dispatch.js';
|
|
|
18
18
|
import { readRecovery } from '../adapters/recovery.js';
|
|
19
19
|
import { readPreflightInfo } from '../adapters/preflight.js';
|
|
20
20
|
import { buildObservability } from '../adapters/observability.js';
|
|
21
|
-
import { computeWorkflowGate } from '../adapters/workflow-gate.js';
|
|
22
|
-
import { buildGuardSection } from '../adapters/guard-state.js';
|
|
21
|
+
import { computeWorkflowGate, headlineWarning } from '../adapters/workflow-gate.js';
|
|
22
|
+
import { buildGuardSection, maybeSelfHealGuardState, repairGuardState } from '../adapters/guard-state.js';
|
|
23
23
|
import { readHostMarker } from '../adapters/host-state.js';
|
|
24
24
|
import { resolveGuardCwd } from '../guard.js';
|
|
25
25
|
import { touchSession as touchSessionCwd } from '../adapters/session-cwd-registry.js';
|
|
@@ -213,15 +213,25 @@ export function compactStatusSnapshot(snapshot) {
|
|
|
213
213
|
/**
|
|
214
214
|
* 门禁自检段的摘要告警(v1.5.11 D-126-04):让「门禁没生效 / 判定不可信 /
|
|
215
215
|
* cwd 降级」在 summary 里一眼可见,而不是藏在 JSON 深处。
|
|
216
|
+
*
|
|
217
|
+
* v1.5.12 / stage-127 §3-E:
|
|
218
|
+
* - `skipGateCovered:true`(由调用方按 `workflowGate.reason` 以 `guard-` 开头传入)跳过
|
|
219
|
+
* `registered === false` 与 `stale` 两条 —— 它们已由门禁标题(`headlineWarning`)
|
|
220
|
+
* 逐字覆盖,避免同一原因在 summary 里堆两遍;`degraded` 仍保留。
|
|
221
|
+
* - `hmacWarn`(验签失败但 pid/loaded_hash 都对)只在这里渲染一行提示:不进
|
|
222
|
+
* `workflowGate`、不置 stale,见 guard-state 的 P1-6 设计。
|
|
223
|
+
*
|
|
216
224
|
* @param {Record<string, any> | null | undefined} guard
|
|
225
|
+
* @param {{ skipGateCovered?: boolean }} [options]
|
|
217
226
|
* @returns {string}
|
|
218
227
|
*/
|
|
219
|
-
function guardWarnings(guard) {
|
|
228
|
+
export function guardWarnings(guard, options = {}) {
|
|
220
229
|
if (guard === null || guard === undefined) return '';
|
|
221
|
-
|
|
230
|
+
const skipGateCovered = options.skipGateCovered === true;
|
|
231
|
+
if (guard.registered === false && !skipGateCovered) {
|
|
222
232
|
return '⚠ 写入门禁未生效(guard-state 缺失或 guard 未注册),源码写入当前无门禁保护。';
|
|
223
233
|
}
|
|
224
|
-
if (guard.stale === true) {
|
|
234
|
+
if (guard.stale === true && !skipGateCovered) {
|
|
225
235
|
// op-005 / P1-6:stale 也可能是「guard-state 被整体重写」(HMAC 校验失败),
|
|
226
236
|
// 文案要把「篡改」说清楚,不能只怪旧进程。
|
|
227
237
|
if (guard.staleReason === 'hmac') {
|
|
@@ -229,12 +239,26 @@ function guardWarnings(guard) {
|
|
|
229
239
|
}
|
|
230
240
|
return '⚠ 门禁来自旧进程/旧适配器,判定不可信,请重启宿主后再写入。';
|
|
231
241
|
}
|
|
242
|
+
if (guard.hmacWarn === true) {
|
|
243
|
+
// v1.5.12 / P1-6:签名失配但 pid/loaded_hash 都通过 → 仅提示,不影响判定
|
|
244
|
+
return '⚠ 门禁状态签名失配(仅提示,不影响判定);如显示异常可完全重启宿主。';
|
|
245
|
+
}
|
|
232
246
|
if (guard.degraded === true && typeof guard.cwdSource === 'string' && guard.cwdSource !== 'agent-session') {
|
|
233
247
|
return `⚠ 门禁 cwd 为降级来源(cwdSource=${guard.cwdSource}),请核对 guard 段。`;
|
|
234
248
|
}
|
|
235
249
|
return '';
|
|
236
250
|
}
|
|
237
251
|
|
|
252
|
+
/**
|
|
253
|
+
* 门禁标题已覆盖的原因(`guard-*`)——此时 `guardWarnings` 跳过重复项。
|
|
254
|
+
*
|
|
255
|
+
* @param {Record<string, any> | null | undefined} gate
|
|
256
|
+
* @returns {boolean}
|
|
257
|
+
*/
|
|
258
|
+
function gateCoversGuardWarning(gate) {
|
|
259
|
+
return typeof gate?.reason === 'string' && gate.reason.startsWith('guard-');
|
|
260
|
+
}
|
|
261
|
+
|
|
238
262
|
/**
|
|
239
263
|
* 构造全部工具定义。
|
|
240
264
|
*
|
|
@@ -246,15 +270,28 @@ export function createTools(context) {
|
|
|
246
270
|
|
|
247
271
|
/**
|
|
248
272
|
* 在目标项目上执行(把 cwd 锚定到解析出的项目根)。
|
|
273
|
+
*
|
|
274
|
+
* v1.5.12 / stage-127 §3-F:所有 `feel_*` 公共入口都先尝试**自动自愈** guard-state
|
|
275
|
+
* (重启后首次 `feel_*` 即修,不要求删除任何文件)。`OPENFEEL_GUARD_SELF_HEAL=off`
|
|
276
|
+
* 可关;活着的异 pid 不自动修(见 `maybeSelfHealGuardState`)。best-effort,绝不阻断。
|
|
277
|
+
*
|
|
249
278
|
* @param {object} exec
|
|
250
279
|
* @param {Record<string, any>} args
|
|
251
|
-
* @
|
|
280
|
+
* @param {{ selfHeal?: boolean }} [options] `selfHeal:false` 供显式修复入口接管(避免自动修抢在显式修之前)
|
|
281
|
+
* @returns {{ cwd: string, sessionCwd: string, initialized: boolean }}
|
|
252
282
|
*/
|
|
253
|
-
const target = (exec, args) => {
|
|
283
|
+
const target = (exec, args, options = {}) => {
|
|
254
284
|
const workspace = resolveWorkspace(exec, {
|
|
255
285
|
projectPath: typeof args.project === 'string' ? args.project : undefined,
|
|
256
286
|
fallback: cli.cwd,
|
|
257
287
|
});
|
|
288
|
+
if (options.selfHeal !== false && workspace.initialized === true) {
|
|
289
|
+
try {
|
|
290
|
+
maybeSelfHealGuardState(workspace.projectRoot);
|
|
291
|
+
} catch {
|
|
292
|
+
/* 自愈是 best-effort:任何异常都不得阻断 feel_* */
|
|
293
|
+
}
|
|
294
|
+
}
|
|
258
295
|
return { cwd: workspace.projectRoot, sessionCwd: workspace.sessionCwd, initialized: workspace.initialized };
|
|
259
296
|
};
|
|
260
297
|
|
|
@@ -321,9 +358,12 @@ export function createTools(context) {
|
|
|
321
358
|
touchSessionFile(resolved.cwd, snapshot.focus?.stage ?? '');
|
|
322
359
|
snapshot.sessions = readSessionEntries(resolved.cwd);
|
|
323
360
|
const focus = snapshot.focus;
|
|
324
|
-
|
|
361
|
+
// v1.5.12 / stage-127 §3-E:标题按 workflowGate.reason 选择,与 feel_next 同源(headlineWarning)
|
|
362
|
+
const gateWarning = headlineWarning(snapshot);
|
|
325
363
|
const staleWarning = snapshot.stale ? '⚠ 快照为降级(flow next 缺失),以 flow status 为准。' : '';
|
|
326
|
-
const guardWarning = guardWarnings(snapshot.guard
|
|
364
|
+
const guardWarning = guardWarnings(snapshot.guard, {
|
|
365
|
+
skipGateCovered: gateCoversGuardWarning(snapshot.workflowGate),
|
|
366
|
+
});
|
|
327
367
|
const data = args.detail === 'full' ? snapshot : compactStatusSnapshot(snapshot);
|
|
328
368
|
return {
|
|
329
369
|
data,
|
|
@@ -378,9 +418,13 @@ export function createTools(context) {
|
|
|
378
418
|
plan.dispatch = buildDispatchTemplate(snapshot);
|
|
379
419
|
plan.observability = snapshot.observability;
|
|
380
420
|
if (plan.workflowGate.required) {
|
|
381
|
-
|
|
421
|
+
// v1.5.12 / stage-127 §3-E:与 feel_status 同一 helper(标题文案只在 workflow-gate.js)
|
|
422
|
+
const gateWarning = headlineWarning({ workflowGate: plan.workflowGate });
|
|
423
|
+
if (gateWarning !== '') plan.summary = `${gateWarning} ${plan.summary}`;
|
|
382
424
|
}
|
|
383
|
-
const guardWarning = guardWarnings(snapshot.guard
|
|
425
|
+
const guardWarning = guardWarnings(snapshot.guard, {
|
|
426
|
+
skipGateCovered: gateCoversGuardWarning(snapshot.workflowGate),
|
|
427
|
+
});
|
|
384
428
|
if (guardWarning !== '') plan.summary = `${guardWarning} ${plan.summary}`;
|
|
385
429
|
if (snapshot.stale) {
|
|
386
430
|
plan.summary = `⚠ 快照为降级(flow next 缺失),以 flow status 为准。 ${plan.summary}`;
|
|
@@ -1271,8 +1315,11 @@ export function createTools(context) {
|
|
|
1271
1315
|
},
|
|
1272
1316
|
output: { schema: envelopeSchema(), render: renderEnvelope },
|
|
1273
1317
|
async execute(args, exec) {
|
|
1274
|
-
const { cwd } = target(exec, args);
|
|
1275
1318
|
const action = args.action;
|
|
1319
|
+
// v1.5.12 / stage-127 §3-F:显式修复入口(`health fix=true`)由本工具接管自愈,
|
|
1320
|
+
// 避免 `target()` 的自动自愈抢在显式修复之前把「旧→新」证据修掉。
|
|
1321
|
+
const repairing = action === 'health' && args.fix === true && args.dry_run !== true;
|
|
1322
|
+
const { cwd } = target(exec, args, { selfHeal: !repairing });
|
|
1276
1323
|
const opts = { cwd, signal: exec.signal };
|
|
1277
1324
|
|
|
1278
1325
|
switch (action) {
|
|
@@ -1282,8 +1329,25 @@ export function createTools(context) {
|
|
|
1282
1329
|
pushFlag(argv, '--fix', args.fix);
|
|
1283
1330
|
pushFlag(argv, '--dry-run', args.dry_run);
|
|
1284
1331
|
return envelope(action, async () => {
|
|
1285
|
-
|
|
1286
|
-
|
|
1332
|
+
// 显式修复:身份只来自 marker + 当前宿主 pid(不接受工具参数)。
|
|
1333
|
+
const guardRepair = repairing
|
|
1334
|
+
? repairGuardState(cwd, { hostMarker: readHostMarker(), tool: 'feel_verify' })
|
|
1335
|
+
: null;
|
|
1336
|
+
let data = await cli.json(argv, opts);
|
|
1337
|
+
let repairNote = '';
|
|
1338
|
+
if (guardRepair !== null) {
|
|
1339
|
+
if (guardRepair.ok === true) {
|
|
1340
|
+
const health = typeof data?.health === 'object' && data.health !== null ? data.health : {};
|
|
1341
|
+
data = { ...data, health: { ...health, guardRepair } };
|
|
1342
|
+
repairNote = guardRepair.changed === true
|
|
1343
|
+
? `门禁自证已修复(pid ${guardRepair.old?.pid ?? '(无)'}→${guardRepair.next?.pid ?? process.pid},hash ${String(guardRepair.old?.loaded_hash ?? '(无)').slice(0, 8)}→${String(guardRepair.next?.loaded_hash ?? '').slice(0, 8)})。`
|
|
1344
|
+
: '门禁自证已可信(无需修复)。';
|
|
1345
|
+
} else {
|
|
1346
|
+
data = { ...data, health: { ...(typeof data?.health === 'object' && data.health !== null ? data.health : {}), guardRepair } };
|
|
1347
|
+
repairNote = `⚠ 门禁自愈失败:${guardRepair.reason ?? 'unknown'}(marker 缺失请重启宿主)。`;
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
return { data, summary: `已执行流水线健康检查。${repairNote}` };
|
|
1287
1351
|
});
|
|
1288
1352
|
}
|
|
1289
1353
|
case 'lint': {
|
package/dsh/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openfeel-dsh",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.12",
|
|
4
4
|
"description": "OpenFeel × DSH — Feel 模式适配器:把 OpenFeel 的流水线、需求分发、版本归档与知识库接入 DeepSeek Harness",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": true,
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"openfeel": {
|
|
35
35
|
"adapter": "dsh",
|
|
36
|
-
"requiresCli": ">=1.5.
|
|
36
|
+
"requiresCli": ">=1.5.12"
|
|
37
37
|
},
|
|
38
38
|
"keywords": [
|
|
39
39
|
"openfeel",
|