dsh-swarm-console 0.2.2 → 0.3.1
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 +19 -11
- package/docs/DETAIL.md +79 -68
- package/index.js +388 -379
- package/lib/adapter.js +2 -1
- package/lib/core/checks.js +89 -64
- package/lib/core/contract.js +59 -10
- package/lib/core/evidence.js +2 -1
- package/lib/core/gate.js +15 -7
- package/lib/core/policy.js +17 -14
- package/lib/core/verify.js +261 -214
- package/package.json +1 -1
- package/policies/code-change.json +2 -14
package/lib/core/verify.js
CHANGED
|
@@ -1,214 +1,261 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* D5/D6 · verify
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*/
|
|
35
|
-
export function
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
return
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
const
|
|
150
|
-
if (!
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* D5/D6 · verify 核心(0.3.0 破坏性变更)。
|
|
3
|
+
*
|
|
4
|
+
* 变更点:
|
|
5
|
+
* - 契约按会话隔离:键 `${sessionId}:${contractId}`(与 runs 一致)
|
|
6
|
+
* - policy 仅当契约显式声明 policyId 且策略检查被契约 checkIds 全覆盖时才启用(P0-1)
|
|
7
|
+
* - 检查以 contract.workspaceRoot 为根、exec 受 contract.testCmd 白名单约束(P0-2/P0-4)
|
|
8
|
+
* - approve 必须携带 evidenceHash 自证;retry 置 stale 并保留上次放行信息(P0-6/P1-1)
|
|
9
|
+
*/
|
|
10
|
+
import { freezeContract } from './contract.js'
|
|
11
|
+
import { makeEvidence, evidenceHash } from './evidence.js'
|
|
12
|
+
import { decide } from './gate.js'
|
|
13
|
+
import { runChecks } from './checks.js'
|
|
14
|
+
import { loadPolicy, policyToChecks, policyCheckIds } from './policy.js'
|
|
15
|
+
|
|
16
|
+
const contracts = new Map()
|
|
17
|
+
const runs = new Map()
|
|
18
|
+
|
|
19
|
+
/** 运行状态键:`${sessionId}:${contractId}` */
|
|
20
|
+
export function runKey(contractId, sessionId = 'default') {
|
|
21
|
+
return `${sessionId}:${contractId}`
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** 契约键:与 runKey 同构,保证契约和状态在同一会话维度 */
|
|
25
|
+
export function contractKey(contractId, sessionId = 'default') {
|
|
26
|
+
return `${sessionId}:${contractId}`
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function splitKey(key) {
|
|
30
|
+
const idx = key.indexOf(':')
|
|
31
|
+
return idx < 0 ? ['default', key] : [key.slice(0, idx), key.slice(idx + 1)]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** verify_contract:冻结契约(按会话存),返回 id。 */
|
|
35
|
+
export function verifyContract(input, sessionId = 'default', store = contracts) {
|
|
36
|
+
const c = freezeContract(input)
|
|
37
|
+
store.set(contractKey(c.id, sessionId), { contract: c, frozenAt: c.frozenAt })
|
|
38
|
+
return { contractId: c.id }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* P1-4 · 前缀解析:最短 4 位,范围限定本会话。
|
|
43
|
+
* @returns {{id?:string, error?:string}}
|
|
44
|
+
*/
|
|
45
|
+
export function resolveContractId(input, sessionId = 'default', store = contracts) {
|
|
46
|
+
const raw = String(input ?? '').trim()
|
|
47
|
+
if (raw === '') return { error: '缺少契约 id' }
|
|
48
|
+
if (raw.length < 4) return { error: '契约 id 前缀至少 4 位' }
|
|
49
|
+
const ids = [...store.keys()]
|
|
50
|
+
.filter((k) => splitKey(k)[0] === sessionId)
|
|
51
|
+
.map((k) => splitKey(k)[1])
|
|
52
|
+
if (ids.includes(raw)) return { id: raw }
|
|
53
|
+
const hits = ids.filter((id) => id.startsWith(raw))
|
|
54
|
+
if (hits.length === 1) return { id: hits[0] }
|
|
55
|
+
if (hits.length === 0) return { error: `未知契约 ${raw}` }
|
|
56
|
+
return { error: `前缀 ${raw} 命中多个契约:${hits.join(', ')}` }
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* verify_run:执行检查请求 → 三态判定。
|
|
61
|
+
* H1:没有检查请求时不判 GREEN(gate 的 R1 保证)。
|
|
62
|
+
*/
|
|
63
|
+
export function verifyRun({ contractId, sessionId = 'default', evidenceInput, runPolicy, checkDeps, usePolicy }, store = contracts, runStore = runs) {
|
|
64
|
+
const rk = runKey(contractId, sessionId)
|
|
65
|
+
const entry = store.get(contractKey(contractId, sessionId))
|
|
66
|
+
if (!entry) return { decision: 'RED', reasons: [`未知 contractId ${contractId}`], evidenceHash: '' }
|
|
67
|
+
const contract = entry.contract
|
|
68
|
+
|
|
69
|
+
// P0-1:只有契约显式声明 policyId,且策略的每个检查 id 都被契约 checkIds 覆盖,才启用策略
|
|
70
|
+
let policyNote
|
|
71
|
+
if (usePolicy === true && !evidenceInput && typeof runPolicy !== 'function' && typeof contract.policyId === 'string') {
|
|
72
|
+
const policy = loadPolicy(contract.policyId)
|
|
73
|
+
const declared = policyCheckIds(policy)
|
|
74
|
+
const covered = new Set(contract.criteria.flatMap((c) => c.checkIds))
|
|
75
|
+
const uncovered = declared.filter((id) => !covered.has(id))
|
|
76
|
+
if (declared.length > 0 && uncovered.length === 0) {
|
|
77
|
+
evidenceInput = { checks: policyToChecks(policy, contract) }
|
|
78
|
+
} else if (declared.length > 0) {
|
|
79
|
+
policyNote = `策略未提供/未被契约覆盖的检查:${uncovered.join(', ')}`
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// H1:没有检查请求 → 不伪造证据
|
|
84
|
+
if (!evidenceInput && typeof runPolicy !== 'function') {
|
|
85
|
+
const d = decide(contract, { checks: [], artifacts: [] })
|
|
86
|
+
const ev = makeEvidence({ contractId })
|
|
87
|
+
const hash = evidenceHash(ev)
|
|
88
|
+
runStore.set(rk, { decision: d.decision, at: new Date().toISOString(), evidenceHash: hash, missing: d.missing, reproCmd: d.reproCmd })
|
|
89
|
+
return {
|
|
90
|
+
decision: d.decision,
|
|
91
|
+
reasons: policyNote ? [...d.reasons, policyNote] : d.reasons,
|
|
92
|
+
evidenceHash: hash,
|
|
93
|
+
missing: d.missing,
|
|
94
|
+
...(d.reproCmd ? { reproCmd: d.reproCmd } : {}),
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const evidence = typeof runPolicy === 'function'
|
|
99
|
+
? runPolicy(contract, evidenceInput)
|
|
100
|
+
: (() => {
|
|
101
|
+
const executed = runChecks(evidenceInput?.checks ?? [], {
|
|
102
|
+
workspaceRoot: contract.workspaceRoot,
|
|
103
|
+
testCmd: contract.testCmd,
|
|
104
|
+
...checkDeps,
|
|
105
|
+
})
|
|
106
|
+
return makeEvidence({
|
|
107
|
+
contractId,
|
|
108
|
+
...evidenceInput,
|
|
109
|
+
checks: executed.checks,
|
|
110
|
+
warnings: [...(evidenceInput?.warnings ?? []), ...executed.warnings],
|
|
111
|
+
})
|
|
112
|
+
})()
|
|
113
|
+
|
|
114
|
+
const d = decide(contract, evidence)
|
|
115
|
+
const hash = evidenceHash(evidence)
|
|
116
|
+
runStore.set(rk, { decision: d.decision, at: new Date().toISOString(), evidenceHash: hash, missing: d.missing, reproCmd: d.reproCmd })
|
|
117
|
+
return {
|
|
118
|
+
decision: d.decision,
|
|
119
|
+
reasons: policyNote ? [...d.reasons, policyNote] : d.reasons,
|
|
120
|
+
evidenceHash: hash,
|
|
121
|
+
missing: d.missing,
|
|
122
|
+
...(Array.isArray(evidence.warnings) && evidence.warnings.length > 0 ? { warnings: evidence.warnings } : {}),
|
|
123
|
+
...(d.reproCmd ? { reproCmd: d.reproCmd } : {}),
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** verify_status:最近决定 + 证据 hash + 放行/失效状态(P0-6 要求输出证据行)。 */
|
|
128
|
+
export function verifyStatus({ contractId, sessionId = 'default' }, runStore = runs) {
|
|
129
|
+
const r = runStore.get(runKey(contractId, sessionId))
|
|
130
|
+
if (!r) return { known: false }
|
|
131
|
+
return {
|
|
132
|
+
known: true,
|
|
133
|
+
decision: r.decision,
|
|
134
|
+
at: r.at,
|
|
135
|
+
evidenceHash: r.evidenceHash,
|
|
136
|
+
...(r.reproCmd ? { reproCmd: r.reproCmd } : {}),
|
|
137
|
+
...(Array.isArray(r.missing) && r.missing.length > 0 ? { missing: r.missing } : {}),
|
|
138
|
+
...(r.approved === true ? { approved: true, approvedAt: r.approvedAt } : {}),
|
|
139
|
+
...(r.stale === true ? { stale: true, lastApprovedAt: r.lastApprovedAt, lastApprovedHash: r.lastApprovedHash } : {}),
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* H3 · 卡片 act 的调用者守卫(卡片为可选增强;v1 默认入口是斜杠命令)。
|
|
145
|
+
*/
|
|
146
|
+
export function guardCaller(agent, record) {
|
|
147
|
+
const origin = agent?.session?.header?.origin
|
|
148
|
+
const fromAgent = origin === 'subagent' || agent?.fromAgent === true || agent?.origin === 'subagent'
|
|
149
|
+
const live = agent && typeof agent === 'object' && !agent.disposed
|
|
150
|
+
if (!live || fromAgent) {
|
|
151
|
+
const reason = !live ? 'not-live-root' : 'agent-initiated-not-user'
|
|
152
|
+
if (typeof record === 'function') {
|
|
153
|
+
record(agent, { callId: agent?.callId ?? 'unknown', action: 'dsh-swarm-console/gate', phase: 'refused', data: { reason } })
|
|
154
|
+
}
|
|
155
|
+
return { status: 'refused', reason }
|
|
156
|
+
}
|
|
157
|
+
return null
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** 供测试隔离用的空 store。 */
|
|
161
|
+
export function newStores() {
|
|
162
|
+
return { contracts: new Map(), runs: new Map() }
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// ── 放行入口:斜杠命令核心(用户触发;模型无对应工具)─────────────────
|
|
166
|
+
|
|
167
|
+
/** /gate-approve:必须带 evidenceHash 自证;非 GREEN 拒绝;hash 不一致拒绝。 */
|
|
168
|
+
export function gateApprove({ contractId, sessionId = 'default', expectedHash }, store = contracts, runStore = runs) {
|
|
169
|
+
const resolved = resolveContractId(contractId, sessionId, store)
|
|
170
|
+
if (resolved.error) return { kind: 'error', text: resolved.error }
|
|
171
|
+
const id = resolved.id
|
|
172
|
+
const rk = runKey(id, sessionId)
|
|
173
|
+
const r = runStore.get(rk)
|
|
174
|
+
if (!r) return { kind: 'error', text: '尚无门禁决定,请先执行 verify_run' }
|
|
175
|
+
if (typeof expectedHash !== 'string' || expectedHash.trim() === '') {
|
|
176
|
+
return { kind: 'error', text: `缺少 evidenceHash:请先用 /gate-status ${id} 查看并复制「证据:<hash>」,再执行 /gate-approve ${id} <hash>` }
|
|
177
|
+
}
|
|
178
|
+
if (r.decision !== 'GREEN') {
|
|
179
|
+
return { kind: 'error', text: `非 GREEN 不可放行,请先 /gate-retry ${id}` }
|
|
180
|
+
}
|
|
181
|
+
if (r.evidenceHash !== expectedHash.trim()) {
|
|
182
|
+
return { kind: 'error', text: '证据已过期,请重新 verify_run' }
|
|
183
|
+
}
|
|
184
|
+
runStore.set(rk, {
|
|
185
|
+
...r,
|
|
186
|
+
approved: true,
|
|
187
|
+
approvedAt: new Date().toISOString(),
|
|
188
|
+
approvedHash: r.evidenceHash,
|
|
189
|
+
by: 'user',
|
|
190
|
+
stale: false,
|
|
191
|
+
})
|
|
192
|
+
return { kind: 'success', text: `契约 ${id} 已由用户放行(approved)` }
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** /gate-retry:重算 → YELLOW;approved=false、stale=true,保留上次放行信息。 */
|
|
196
|
+
export function gateRetry({ contractId, sessionId = 'default' }, store = contracts, runStore = runs) {
|
|
197
|
+
const resolved = resolveContractId(contractId, sessionId, store)
|
|
198
|
+
if (resolved.error) return { kind: 'error', text: resolved.error }
|
|
199
|
+
const id = resolved.id
|
|
200
|
+
const rk = runKey(id, sessionId)
|
|
201
|
+
const before = runStore.get(rk)
|
|
202
|
+
const wasApproved = before?.approved === true
|
|
203
|
+
const lastApprovedAt = wasApproved ? before.approvedAt : before?.lastApprovedAt
|
|
204
|
+
const lastApprovedHash = wasApproved ? before.approvedHash : before?.lastApprovedHash
|
|
205
|
+
|
|
206
|
+
const r = verifyRun({ contractId: id, sessionId, evidenceInput: undefined }, store, runStore)
|
|
207
|
+
|
|
208
|
+
// verifyRun 覆盖整条记录,这里补回 stale 语义
|
|
209
|
+
const after = runStore.get(rk) ?? {}
|
|
210
|
+
runStore.set(rk, {
|
|
211
|
+
...after,
|
|
212
|
+
approved: false,
|
|
213
|
+
stale: true,
|
|
214
|
+
...(lastApprovedAt !== undefined ? { lastApprovedAt } : {}),
|
|
215
|
+
...(lastApprovedHash !== undefined ? { lastApprovedHash } : {}),
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
const now = verifyStatus({ contractId: id, sessionId }, runStore)
|
|
219
|
+
const staleNote = lastApprovedAt ? ` [stale] 上次放行已失效(${lastApprovedAt})` : ' [stale]'
|
|
220
|
+
return {
|
|
221
|
+
kind: 'success',
|
|
222
|
+
text: `契约 ${id} 已重算:${r.decision} @ ${now.at}${staleNote}。需重新执行 verify_run 补证据后才可能转 GREEN。`,
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** /gate-status:无参列出本会话契约;有参(支持 ≥4 位前缀)看单条。 */
|
|
227
|
+
export function gateStatus({ contractId, sessionId = 'default' } = {}, store = contracts, runStore = runs) {
|
|
228
|
+
const raw = String(contractId ?? '').trim()
|
|
229
|
+
|
|
230
|
+
if (raw === '') {
|
|
231
|
+
const ids = [...store.keys()].filter((k) => splitKey(k)[0] === sessionId).map((k) => splitKey(k)[1])
|
|
232
|
+
if (ids.length === 0) return { kind: 'success', text: '当前会话还没有冻结任何契约(先执行 verify_contract)' }
|
|
233
|
+
const rows = ids.map((id) => ({ id, run: runStore.get(runKey(id, sessionId)) }))
|
|
234
|
+
rows.sort((a, b) => String(b.run?.at ?? '').localeCompare(String(a.run?.at ?? '')))
|
|
235
|
+
const lines = rows.map(({ id, run }) => {
|
|
236
|
+
if (!run) return `- ${id} 未跑校验`
|
|
237
|
+
const flags = [run.decision]
|
|
238
|
+
if (run.stale === true) flags.push('[stale]')
|
|
239
|
+
flags.push(run.approved === true ? '已放行' : '尚未放行')
|
|
240
|
+
return `- ${id} ${flags.join(' ')} @ ${run.at ?? '-'}`
|
|
241
|
+
})
|
|
242
|
+
return { kind: 'success', text: [`当前会话契约(${rows.length}):`, ...lines].join('\n') }
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
const resolved = resolveContractId(raw, sessionId, store)
|
|
246
|
+
if (resolved.error) return { kind: 'error', text: resolved.error }
|
|
247
|
+
const id = resolved.id
|
|
248
|
+
const r = runStore.get(runKey(id, sessionId))
|
|
249
|
+
if (!r) return { kind: 'success', text: `契约 ${id} 尚无门禁决定` }
|
|
250
|
+
|
|
251
|
+
const approved = r.approved === true
|
|
252
|
+
const stale = r.stale === true
|
|
253
|
+
const head = `契约 ${id}:最近决定 ${r.decision} @ ${r.at}` +
|
|
254
|
+
(stale ? ` [stale] 上次放行已失效${r.lastApprovedAt ? `(${r.lastApprovedAt})` : ''}` : '') +
|
|
255
|
+
(approved ? `;已由 ${r.by ?? 'user'} 放行 @ ${r.approvedAt}` : (stale ? '' : ';尚未放行'))
|
|
256
|
+
|
|
257
|
+
const extra = [`证据:${r.evidenceHash ?? '-'}`]
|
|
258
|
+
if (r.reproCmd) extra.push(`复现:${r.reproCmd}`)
|
|
259
|
+
if (Array.isArray(r.missing) && r.missing.length > 0) extra.push(`缺失证据:${r.missing.join(';')}`)
|
|
260
|
+
return { kind: 'success', text: [head, ...extra].join('\n') }
|
|
261
|
+
}
|
package/package.json
CHANGED
|
@@ -2,23 +2,11 @@
|
|
|
2
2
|
"id": "code-change",
|
|
3
3
|
"label": "代码改动策略",
|
|
4
4
|
"checks": [
|
|
5
|
-
{
|
|
6
|
-
"id": "exists",
|
|
7
|
-
"type": "file.exists",
|
|
8
|
-
"description": "验收条件指定的文件存在",
|
|
9
|
-
"input": "criteria[].checkIds -> artifacts[].path"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"id": "diff",
|
|
13
|
-
"type": "workspace.diff",
|
|
14
|
-
"description": "取宿主 workspaceChanges.summary|diff,不自建 diff",
|
|
15
|
-
"input": "workspaceChanges.summary || workspaceChanges.diff"
|
|
16
|
-
},
|
|
17
5
|
{
|
|
18
6
|
"id": "tests",
|
|
19
7
|
"type": "exec",
|
|
20
|
-
"description": "
|
|
21
|
-
"input": "
|
|
8
|
+
"description": "执行契约声明的 testCmd,退出码必须为 0",
|
|
9
|
+
"input": "contract.testCmd(无声明则不生成任何检查)",
|
|
22
10
|
"successExitCode": 0
|
|
23
11
|
}
|
|
24
12
|
]
|