cli-swarm 7.0.30 → 7.0.32

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/broker.mjs CHANGED
@@ -24,6 +24,7 @@ const VALIDATION_STATES = new Set(['passed', 'failed', 'incomplete'])
24
24
  const EVALUATION_SCHEMA = 'skill-automatic-evaluation/1.0'
25
25
  const IDENTIFIER_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/
26
26
  const REQUEST_SCHEMA_PATTERN = /^([A-Za-z0-9.-]+\.skill)\.request\/([0-9]+\.[0-9]+)$/
27
+ const TRANSPORT_ERROR_CODE_PATTERN = /^[A-Z][A-Z0-9_]{1,63}$/
27
28
 
28
29
  function asObject(value, label) {
29
30
  if (!value || typeof value !== 'object' || Array.isArray(value)) {
@@ -222,6 +223,20 @@ function invocationRequest(context, operation, input) {
222
223
  }
223
224
  }
224
225
 
226
+ export function transportFailureCode(error) {
227
+ const inspected = new Set()
228
+ let candidate = error
229
+ while (candidate && typeof candidate === 'object' && !inspected.has(candidate)) {
230
+ inspected.add(candidate)
231
+ const code = typeof candidate.code === 'string' ? candidate.code.trim() : ''
232
+ if (TRANSPORT_ERROR_CODE_PATTERN.test(code)) return code
233
+ const name = typeof candidate.name === 'string' ? candidate.name.trim() : ''
234
+ if (name === 'AbortError' || name === 'TimeoutError') return name
235
+ candidate = candidate.cause
236
+ }
237
+ return 'UNKNOWN_TRANSPORT_ERROR'
238
+ }
239
+
225
240
  export async function invokeOfficialSkill(context, operation, input, dependencies) {
226
241
  const environment = asObject(dependencies.environment, 'broker environment')
227
242
  if (typeof dependencies.request !== 'function') {
@@ -237,8 +252,10 @@ export async function invokeOfficialSkill(context, operation, input, dependencie
237
252
  body: JSON.stringify({ input: requestEnvelope }),
238
253
  signal: AbortSignal.timeout(CALL_TIMEOUT_MS),
239
254
  })
240
- } catch {
241
- throw new Error(`${context.displayName} ${operation} invocation failed`)
255
+ } catch (error) {
256
+ throw new Error(
257
+ `${context.displayName} ${operation} invocation failed: network transport ${transportFailureCode(error)}`,
258
+ )
242
259
  }
243
260
  const payload = await responsePayload(response, `${context.displayName} ${operation} response`)
244
261
  if (!response.ok || payload.ok !== true) {
package/package.json CHANGED
@@ -33,5 +33,5 @@
33
33
  "url": "https://github.com/88208555/swarm-clitax.git"
34
34
  },
35
35
  "type": "module",
36
- "version": "7.0.30"
36
+ "version": "7.0.32"
37
37
  }
package/skill/SKILL.md CHANGED
@@ -5,7 +5,7 @@ description: '通过智能体大脑调度创建 N 个子智能体,用企业级
5
5
 
6
6
  # swarm
7
7
 
8
- Package version: v7.0.30
8
+ Package version: v7.0.32
9
9
 
10
10
  把「项目需求」编排为一支可观测、可自治、可安全运转的智能体蜂群。
11
11
 
@@ -26,7 +26,7 @@
26
26
 
27
27
  - 事件到达:5 秒目标窗口内路由唤醒包,内容含事件与重取清单。
28
28
  - 对方失败或被回收:立即以 `dependency-terminated` 唤醒,不等超时。
29
- - 超时:按声明处置;`escalate-need-human` 和连续第二次超时生成高风险 Confirm Protocol 请求。
29
+ - 超时:按声明处置;`escalate-need-human` 和连续第二次超时返回 `status=blocked`、高风险 Confirm Protocol 请求与 `nextStep=confirm-protocol`。宿主必须先调用该请求并等待人类答案,不能把请求对象当作已确认。
30
30
  - 成环:登记时或 `tick` 检出后立即打断全部相关等待,并生成真人裁决请求。
31
31
  - 未登记等待:`task-status=waiting` 返回 `undeclaredWait=true` 和补登提示。
32
32
 
package/skill/skill.json CHANGED
@@ -6,5 +6,5 @@
6
6
  "name": "swarm",
7
7
  "schemaVersion": "swarm.skill.request/1.0",
8
8
  "type": "Skill",
9
- "version": "v7.0.30"
9
+ "version": "v7.0.32"
10
10
  }
@@ -139,7 +139,7 @@ function createDecision(state, kind, agents, waitIds, question, riskDescription,
139
139
  }
140
140
  state.decisions.push(decision)
141
141
  addMessage(state, 'need-human', 'coordinator', 'human', { decisionId: decision.decisionId, kind, agents, waitIds }, now)
142
- return { decision, confirmProtocolRequest: confirmationRequest(decision) }
142
+ return { decision, status: 'blocked', confirmationRequired: true, confirmProtocolRequest: confirmationRequest(decision), nextStep: { operation: 'confirm-protocol', instruction: 'Invoke Confirm Protocol and wait for the human answer.' } }
143
143
  }
144
144
 
145
145
  async function registerTask(repositoryRoot, input) {
package/swarm-runtime.mjs CHANGED
@@ -7,7 +7,7 @@ const ORG_SCHEMA = "swarm.org-chart/1.0";
7
7
  const TASK_SCHEMA = "swarm.tasks/1.0";
8
8
  const TEST_EVIDENCE_SCHEMA = "cli.tax.test-evidence/1.0";
9
9
  const COMPILER_NAME = "swarm";
10
- const COMPILER_VERSION = "v7.0.30";
10
+ const COMPILER_VERSION = "v7.0.32";
11
11
  const SHA256_PATTERN = /^[0-9a-f]{64}$/;
12
12
  const PURE_OPERATIONS = new Set([
13
13
  "capabilities", "help", "intake", "org-chart", "blueprint-bridge", "dispatch", "claim",