@whyshu/argent-engine 0.13.29 → 0.14.0
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/MANIFEST.json +5 -5
- package/engine/VERSION +1 -1
- package/engine/core/contracts/argent.contracts.json +2 -2
- package/engine/scripts/full-exec-worker.mjs +174 -69
- package/engine/scripts/orchestrator.py +17 -0
- package/engine/version.mjs +1 -1
- package/engine/verticals/mercadolibre/manifest.json +1 -1
- package/package.json +1 -1
package/MANIFEST.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schema": 1,
|
|
3
3
|
"package": "@whyshu/argent-engine",
|
|
4
4
|
"files": {
|
|
5
|
-
"VERSION": "
|
|
5
|
+
"VERSION": "065582655aacd6fc83ff742a5715c04bb4a57395bf3ee4559798fa42c2ce4589",
|
|
6
6
|
"agents/catalog.json": "5356a812f2554dfd3115370363d4c3f787a82c9e5928a85d05b2a07c9e4b324d",
|
|
7
7
|
"configs/_aliases.proposed.json": "3a59edf80563bcc20d410d488decad6fd787bd3de9489321367b0783904cd3e5",
|
|
8
8
|
"configs/_migration-plan.proposed.json": "dd9f90b0b9b2f217dd23367a618402e57997d44f7fddcfa88a7cadf52e056c0d",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"configs/mcp-tools.snapshot.json": "cfa94a6ba64a7ae9d133a4a878ce3d5e0e85e554ccd3e3ebaf0d51ad750acf6a",
|
|
15
15
|
"configs/notify.json": "cb9ef11c1c498fcf99af99ec50271b8a2598061b77ed73a6099032e837474ef0",
|
|
16
16
|
"core/cli/argent.mjs": "9a8977324c238ca4e20435f9817eb7ec76157da32b1d510977dc03e0feb416a9",
|
|
17
|
-
"core/contracts/argent.contracts.json": "
|
|
17
|
+
"core/contracts/argent.contracts.json": "0a91f5e7e915c0cbce9bf3ba0b032250a1c662d6b1f33bb9e02b70ffb279cf9c",
|
|
18
18
|
"core/contracts/verbs.schema.json": "54d726181c11536eb30bd25090584a7af103e4c0462f8ef078053c8177e19dcb",
|
|
19
19
|
"core/lib/account-token.mjs": "35faad2c34e67755c1867f74a74885f0f268d5daabe01d339cf30dc747f86501",
|
|
20
20
|
"core/lib/argent-datadir.mjs": "1fdd799c933382c4f9e36bd4af33d51b8ac4a466a9d67a8f2296bb267b5251ac",
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
"scripts/flow_write_verify.py": "a9123838b00cb60b43fbc761f6dae740dfa3692906c2985e9b98a7c4538c2491",
|
|
194
194
|
"scripts/fulfillment.js": "8de1ea386ebfe628caf4eaf2df5f1941938c07d4b8b2dcf79a78d45ac231669f",
|
|
195
195
|
"scripts/fulfillment_sites.py": "7120ddcd891b1de588b4c80420af9b7291bfd2e582a7bb41cf9fcd91a0699fe7",
|
|
196
|
-
"scripts/full-exec-worker.mjs": "
|
|
196
|
+
"scripts/full-exec-worker.mjs": "ff62a3bacd91834a4fa51054e3979b9ef0e8cc6bf68dafbe5fdbcb1d6fc5a2b3",
|
|
197
197
|
"scripts/gen-agent-bundles.mjs": "3ab452fb7b1026a1bfab02977c85229985b390db4bc8458ce974b94bc207ed17",
|
|
198
198
|
"scripts/gen-preset-rows.mjs": "1c074432be25148e9babce7ea1cb68d8fcef257abc2329f66b4ce488bc504578",
|
|
199
199
|
"scripts/handover-sheet.mjs": "4e27095ccdd79586391abf7a7d5eb7aabbc3f0d7d9a1dd5161e9af8e8a9338de",
|
|
@@ -297,7 +297,7 @@
|
|
|
297
297
|
"scripts/ops-codefix-queue.mjs": "bf377ee88f0b5c0493067fe38fd7355bc081285dfd3b06f8a48c2efaa297f705",
|
|
298
298
|
"scripts/ops-digest.mjs": "7fcb827d2ad258a9014c677d35be3222e7985894d483e6d18b8b089ac7f80e0d",
|
|
299
299
|
"scripts/ops-verify.mjs": "cfe80ad4693c0ebc8c1782f7f09934529b98cd8edbdd9c980028754e370370f1",
|
|
300
|
-
"scripts/orchestrator.py": "
|
|
300
|
+
"scripts/orchestrator.py": "6faa9ff8b22645b003a1ebbb9a9ab29efec3f8deed84965f6ee582308a834b0d",
|
|
301
301
|
"scripts/orchestrator_br.py": "103544e887add1f8d2bc7bfd0168fc8a0f2cd8a0547874e064a2465fd5626459",
|
|
302
302
|
"scripts/p2-report-run.mjs": "86bd6b3005f1a5fca3f808f4ea77dcce43a11a4a9be7ee814a029daaae201fb5",
|
|
303
303
|
"scripts/pack-plugins.mjs": "b1b42fb30ebd27f320af72bc28b5b8e2b76e54031b4ac1ba5c3909374990b38b",
|
|
@@ -427,7 +427,7 @@
|
|
|
427
427
|
"verticals/mercadolibre/brazil-full-sop.json": "722630b859d7a1c42ab3a243cae75598bf92a562663d9ebe376afd093f02bbfb",
|
|
428
428
|
"verticals/mercadolibre/config.json": "85e592d700383b9b191ed6a809dc47fffba8e6850842c3699058a679ef6546a7",
|
|
429
429
|
"verticals/mercadolibre/flows.json": "69c11df91a53f15149b168989be14cba1ec66f1bc30fb71cf5fda16c914a0886",
|
|
430
|
-
"verticals/mercadolibre/manifest.json": "
|
|
430
|
+
"verticals/mercadolibre/manifest.json": "09d7f0503ebd33e9d8e866b5998951ac472342b49dd45d30762ae691e901fad4",
|
|
431
431
|
"verticals/mercadolibre/migrate-machine-state.mjs": "a5a55f3c6b5057365621b4d976f5f16792532bd392d9379bf06b596a3e178f77",
|
|
432
432
|
"verticals/mercadolibre/preflight.py": "24a490c19bad174f3eddb86d651ff767e55979270b780b6e43b8f0f8cb01acc2",
|
|
433
433
|
"verticals/mercadolibre/prompts/daily-report.failure.md": "528b322931ed459516e6909c5eeff1dbbc89f3a38bd5ec68628ada85160cf0a8",
|
package/engine/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.14.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"argentVersion": "0.
|
|
3
|
-
"_syncNote": "argentVersion 必须与仓库根 VERSION 同批更新:发布前置校验 scripts/check-version-consistency.mjs;2026-11-24 按 VERSION=0.
|
|
2
|
+
"argentVersion": "0.14.0",
|
|
3
|
+
"_syncNote": "argentVersion 必须与仓库根 VERSION 同批更新:发布前置校验 scripts/check-version-consistency.mjs;2026-11-24 按 VERSION=0.14.0 校正。",
|
|
4
4
|
"principle": "宿主无关:宿主只依赖 `argent <verb>`;确定性逻辑在 CLI/MCP,不在提示词里。",
|
|
5
5
|
"verbs": {
|
|
6
6
|
"version": {
|
|
@@ -23,7 +23,7 @@ import { spawn } from 'node:child_process'
|
|
|
23
23
|
import { mkdtemp, readdir, rm, stat, writeFile } from 'node:fs/promises'
|
|
24
24
|
import { existsSync } from 'node:fs'
|
|
25
25
|
import { tmpdir } from 'node:os'
|
|
26
|
-
import { basename, join } from 'node:path'
|
|
26
|
+
import { basename, dirname, join } from 'node:path'
|
|
27
27
|
import { uploadFulfillmentFiles } from './lib/fulfillment-upload.mjs'
|
|
28
28
|
|
|
29
29
|
const BASE = String(process.env.ARGENT_ERP_BASE || 'https://whyshu.com').replace(/\/+$/, '')
|
|
@@ -36,6 +36,11 @@ const TABS = Math.max(1, Math.min(5, Number(process.env.FULL_EXEC_TABS || 2) ||
|
|
|
36
36
|
const POLL_MS = Math.max(1000, Number(process.env.FULL_EXEC_POLL_MS || 5000) || 5000)
|
|
37
37
|
const DOWNLOAD_ROOT = String(process.env.ZINIAO_DOWNLOAD_ROOT || '')
|
|
38
38
|
|| join(process.env.HOME || '', 'Library', 'Application Support', 'ziniaobrowserdatas', 'ziniao browser')
|
|
39
|
+
// 客户机引擎必须用带 playwright/yaml/selenium 的 venv,不能默认系统 python3。
|
|
40
|
+
const PYTHON = String(process.env.ARGENT_PY || '').trim()
|
|
41
|
+
|| (existsSync(join(process.env.HOME || '', '.dsh', 'argent', 'venv', 'bin', 'python3'))
|
|
42
|
+
? join(process.env.HOME || '', '.dsh', 'argent', 'venv', 'bin', 'python3')
|
|
43
|
+
: 'python3')
|
|
39
44
|
|
|
40
45
|
if (!APP || !TOKEN || !ENGINE || !STORES.length) {
|
|
41
46
|
console.error('缺少 ARGENT_TENANT_APP_ID / ARGENT_MACHINE_TOKEN / ARGENT_ENGINE_DIR / FULL_EXEC_STORES')
|
|
@@ -141,88 +146,188 @@ async function shutdown(signal = 'SIGTERM') {
|
|
|
141
146
|
process.on('SIGTERM', () => { void shutdown('SIGTERM') })
|
|
142
147
|
process.on('SIGINT', () => { void shutdown('SIGINT') })
|
|
143
148
|
|
|
149
|
+
async function runAppointmentPhase(ctx) {
|
|
150
|
+
const task = ctx.task
|
|
151
|
+
const record = ctx.record
|
|
152
|
+
const ruleSnapshot = task.appointmentRuleSnapshot || null
|
|
153
|
+
const today = new Date()
|
|
154
|
+
const day = (n) => {
|
|
155
|
+
const d = new Date(today.getTime() + n * 86400000)
|
|
156
|
+
return d.toISOString().slice(0, 10)
|
|
157
|
+
}
|
|
158
|
+
const body = {
|
|
159
|
+
store: task.store,
|
|
160
|
+
sku: record.sku || '',
|
|
161
|
+
quantity: Number(record.qty) || undefined,
|
|
162
|
+
boxCount: Number(record.box) || undefined,
|
|
163
|
+
shipmentNo: record.shipmentNo || task.shipmentNo || '',
|
|
164
|
+
dateMode: ruleSnapshot ? 'rule' : 'range',
|
|
165
|
+
ruleSnapshot,
|
|
166
|
+
dateFrom: ruleSnapshot ? undefined : day(1),
|
|
167
|
+
dateTo: ruleSnapshot ? undefined : day(7),
|
|
168
|
+
weekdays: ruleSnapshot ? undefined : [1, 2, 3, 4, 5, 6, 7],
|
|
169
|
+
timeFrom: ruleSnapshot ? undefined : '07:00',
|
|
170
|
+
timeTo: ruleSnapshot ? undefined : '21:00',
|
|
171
|
+
windowText: ruleSnapshot ? `FULL 时间规则:${ruleSnapshot.name || ''}` : 'FULL 自动预约',
|
|
172
|
+
}
|
|
173
|
+
const out = await new Promise((resolve) => {
|
|
174
|
+
const child = spawn(PYTHON, [join(ENGINE, 'scripts', 'appointment_grab.py'), '--task-json', JSON.stringify(body)], {
|
|
175
|
+
cwd: ENGINE,
|
|
176
|
+
env: { ...process.env, PYTHONPATH: 'scripts', PATH: `${dirname(process.execPath)}:${process.env.PATH || ''}` },
|
|
177
|
+
})
|
|
178
|
+
activeChild = child
|
|
179
|
+
let stdout = ''; let stderr = ''
|
|
180
|
+
child.stdout.on('data', (b) => { stdout += String(b) })
|
|
181
|
+
child.stderr.on('data', (b) => { stderr += String(b) })
|
|
182
|
+
child.on('close', () => { activeChild = null; resolve(`${stdout}\n${stderr}`.trim()) })
|
|
183
|
+
child.on('error', (e) => { activeChild = null; resolve(`WORKER_ERROR: ${e.message}`) })
|
|
184
|
+
})
|
|
185
|
+
let result = null
|
|
186
|
+
for (const line of String(out).split('\n').reverse()) {
|
|
187
|
+
try { const j = JSON.parse(line); if (j && j.status) { result = j; break } } catch { /* next */ }
|
|
188
|
+
}
|
|
189
|
+
if (!result) {
|
|
190
|
+
await api('POST', `/api/argent/v1/tenants/${encodeURIComponent(APP)}/full-executions/${encodeURIComponent(task.id)}/result`, {
|
|
191
|
+
workerId, status: 'failed', error: '抢预约未返回结果',
|
|
192
|
+
}).catch(() => {})
|
|
193
|
+
return false
|
|
194
|
+
}
|
|
195
|
+
const ok = ['booked', 'succeeded', 'success'].includes(String(result.status || ''))
|
|
196
|
+
if (!ok) {
|
|
197
|
+
await api('POST', `/api/argent/v1/tenants/${encodeURIComponent(APP)}/full-executions/${encodeURIComponent(task.id)}/result`, {
|
|
198
|
+
workerId, status: 'failed', error: String(result.summary || result.status || '抢预约失败').slice(0, 400),
|
|
199
|
+
}).catch(() => {})
|
|
200
|
+
return false
|
|
201
|
+
}
|
|
202
|
+
const r = await api('POST', `/api/argent/v1/tenants/${encodeURIComponent(APP)}/full-executions/${encodeURIComponent(task.id)}/appointment-result`, {
|
|
203
|
+
workerId,
|
|
204
|
+
result: {
|
|
205
|
+
date: result.date || '',
|
|
206
|
+
slot: result.slot || '',
|
|
207
|
+
summary: result.summary || `预约成功:${result.date || ''} ${result.slot || ''}`.trim(),
|
|
208
|
+
windowText: body.windowText,
|
|
209
|
+
},
|
|
210
|
+
})
|
|
211
|
+
if (!r || r.ok === false) {
|
|
212
|
+
console.warn('[worker] 预约结果回写失败', task.id, r?.message || r?.error?.message || '')
|
|
213
|
+
return false
|
|
214
|
+
}
|
|
215
|
+
ctx.task.phase = 'label_ready'
|
|
216
|
+
return true
|
|
217
|
+
}
|
|
218
|
+
|
|
144
219
|
async function executeBatch(tasks) {
|
|
145
|
-
const records = []
|
|
146
220
|
const contexts = []
|
|
147
221
|
for (const t of tasks) {
|
|
148
222
|
activeTasks.set(String(t.id), t)
|
|
149
223
|
const c = await api('GET', `/api/argent/v1/tenants/${encodeURIComponent(APP)}/full-executions/${encodeURIComponent(t.id)}/context`)
|
|
150
|
-
|
|
151
|
-
contexts.push({ task: t, record: c.record })
|
|
224
|
+
contexts.push({ task: c.task || t, record: c.record })
|
|
152
225
|
}
|
|
153
|
-
|
|
154
|
-
const file = join(dir, 'records.json')
|
|
155
|
-
await writeFile(file, JSON.stringify(records), 'utf8')
|
|
226
|
+
let cancelSeen = false
|
|
156
227
|
const hb = setInterval(() => {
|
|
157
|
-
for (const t of tasks)
|
|
228
|
+
for (const t of tasks) {
|
|
229
|
+
api('POST', `/api/argent/v1/tenants/${encodeURIComponent(APP)}/full-executions/${encodeURIComponent(t.id)}/heartbeat`, { workerId })
|
|
230
|
+
.then((r) => {
|
|
231
|
+
if (String(r?.task?.status || '') === 'cancelled') {
|
|
232
|
+
cancelSeen = true
|
|
233
|
+
console.log('[worker] 任务已人工接管取消,终止子进程', t.id)
|
|
234
|
+
try { activeChild?.kill('SIGTERM') } catch { /* noop */ }
|
|
235
|
+
}
|
|
236
|
+
})
|
|
237
|
+
.catch(() => {})
|
|
238
|
+
}
|
|
158
239
|
}, 30_000)
|
|
159
|
-
let out = ''
|
|
160
240
|
try {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
child.on('error', (e) => { activeChild = null; resolve(`WORKER_ERROR: ${e.message}`) })
|
|
173
|
-
})
|
|
174
|
-
} finally {
|
|
175
|
-
clearInterval(hb)
|
|
176
|
-
await rm(dir, { recursive: true, force: true }).catch(() => {})
|
|
177
|
-
}
|
|
178
|
-
let batch = null
|
|
179
|
-
for (const line of String(out).split('\n').reverse()) {
|
|
180
|
-
try { const j = JSON.parse(line); if (j && j.status) { batch = j; break } } catch { /* next */ }
|
|
181
|
-
}
|
|
182
|
-
if (!batch) {
|
|
183
|
-
for (const t of tasks) await api('POST', `/api/argent/v1/tenants/${encodeURIComponent(APP)}/full-executions/${encodeURIComponent(t.id)}/result`, { workerId, status: 'failed', error: 'worker 未解析到引擎结果' }).catch(() => {})
|
|
184
|
-
return
|
|
185
|
-
}
|
|
186
|
-
const results = Array.isArray(batch.results) ? batch.results : []
|
|
187
|
-
for (const ctx of contexts) {
|
|
188
|
-
const rid = String(ctx.record.record_id || '')
|
|
189
|
-
const result = results.find((x) => String(x.record_id || '') === rid)
|
|
190
|
-
|| (results.length === contexts.length ? results[contexts.indexOf(ctx)] : null)
|
|
191
|
-
|| { status: 'failed', error: { message: batch.error || '引擎未返回该记录结果' } }
|
|
192
|
-
if (String(result.status || '') !== 'success') {
|
|
193
|
-
await api('POST', `/api/argent/v1/tenants/${encodeURIComponent(APP)}/full-executions/${encodeURIComponent(ctx.task.id)}/result`, {
|
|
194
|
-
workerId, status: 'failed', error: String(result?.error?.message || result?.message || result?.status || 'FULL 失败'),
|
|
195
|
-
}).catch(() => {})
|
|
196
|
-
continue
|
|
241
|
+
// 一个槽位先处理抢预约阶段;抢到后同一批继续进入标签执行。
|
|
242
|
+
const waiting = contexts.filter((x) => String(x.task.phase || '') === 'appointment_wait')
|
|
243
|
+
if (waiting.length) {
|
|
244
|
+
await Promise.all(waiting.map(async (x) => {
|
|
245
|
+
try { await runAppointmentPhase(x) } catch (e) {
|
|
246
|
+
console.warn('[worker] 抢预约阶段异常', x.task.id, e.message)
|
|
247
|
+
await api('POST', `/api/argent/v1/tenants/${encodeURIComponent(APP)}/full-executions/${encodeURIComponent(x.task.id)}/result`, {
|
|
248
|
+
workerId, status: 'failed', error: String(e.message || e).slice(0, 400),
|
|
249
|
+
}).catch(() => {})
|
|
250
|
+
}
|
|
251
|
+
}))
|
|
197
252
|
}
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
253
|
+
const labels = contexts.filter((x) => !String(x.task.phase || '') || ['label_ready', 'executing'].includes(String(x.task.phase || '')))
|
|
254
|
+
if (!labels.length) return
|
|
255
|
+
const dir = await mkdtemp(join(tmpdir(), 'argent-full-exec-'))
|
|
256
|
+
const file = join(dir, 'records.json')
|
|
257
|
+
await writeFile(file, JSON.stringify(labels.map((x) => x.record)), 'utf8')
|
|
258
|
+
let out = ''
|
|
259
|
+
try {
|
|
260
|
+
out = await new Promise((resolve) => {
|
|
261
|
+
const skipSteps = labels.some((x) => String(x.task.resumeFrom || '') === 'afterProductLabel') ? ['6'] : []
|
|
262
|
+
const args = [
|
|
263
|
+
join(ENGINE, 'scripts', 'orchestrator.py'), '--mode', 'full',
|
|
264
|
+
'--record-jsons-file', file, '--parallel-records', String(Math.min(labels.length, TABS)),
|
|
265
|
+
'--allow-write', '--no-lip',
|
|
266
|
+
]
|
|
267
|
+
if (skipSteps.length) args.push('--skip-steps', skipSteps.join(','))
|
|
268
|
+
const child = spawn(PYTHON, args, { cwd: ENGINE, env: { ...process.env, PYTHONPATH: 'scripts', PATH: `${dirname(process.execPath)}:${process.env.PATH || ''}` } })
|
|
269
|
+
activeChild = child
|
|
270
|
+
let stdout = ''; let stderr = ''
|
|
271
|
+
child.stdout.on('data', (b) => { stdout += String(b) })
|
|
272
|
+
child.stderr.on('data', (b) => { stderr += String(b) })
|
|
273
|
+
child.on('close', () => { activeChild = null; resolve(`${stdout}\n${stderr}`.trim()) })
|
|
274
|
+
child.on('error', (e) => { activeChild = null; resolve(`WORKER_ERROR: ${e.message}`) })
|
|
275
|
+
})
|
|
276
|
+
} finally {
|
|
277
|
+
await rm(dir, { recursive: true, force: true }).catch(() => {})
|
|
278
|
+
}
|
|
279
|
+
let batch = null
|
|
280
|
+
for (const line of String(out).split('\n').reverse()) {
|
|
281
|
+
try { const j = JSON.parse(line); if (j && j.status) { batch = j; break } } catch { /* next */ }
|
|
205
282
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
|
|
283
|
+
if (!batch) {
|
|
284
|
+
console.error('[worker] 引擎未返回 JSON,输出尾部:', String(out).slice(-4000))
|
|
285
|
+
for (const t of labels) await api('POST', `/api/argent/v1/tenants/${encodeURIComponent(APP)}/full-executions/${encodeURIComponent(t.task.id)}/result`, { workerId, status: 'failed', error: 'worker 未解析到引擎结果' }).catch(() => {})
|
|
286
|
+
return
|
|
287
|
+
}
|
|
288
|
+
const results = Array.isArray(batch.results) ? batch.results : []
|
|
289
|
+
for (const ctx of labels) {
|
|
290
|
+
const rid = String(ctx.record.record_id || '')
|
|
291
|
+
const result = results.find((x) => String(x.record_id || '') === rid)
|
|
292
|
+
|| (results.length === labels.length ? results[labels.indexOf(ctx)] : null)
|
|
293
|
+
|| { status: 'failed', error: { message: batch.error || '引擎未返回该记录结果' } }
|
|
294
|
+
if (String(result.status || '') !== 'success') {
|
|
295
|
+
await api('POST', `/api/argent/v1/tenants/${encodeURIComponent(APP)}/full-executions/${encodeURIComponent(ctx.task.id)}/result`, {
|
|
296
|
+
workerId, status: 'failed', error: String(result?.error?.message || result?.message || result?.status || 'FULL 失败'),
|
|
297
|
+
}).catch(() => {})
|
|
298
|
+
continue
|
|
299
|
+
}
|
|
300
|
+
const taskStarted = ctx.task.createdAt ? new Date(ctx.task.createdAt).getTime() : Date.now() - 2 * 3600_000
|
|
301
|
+
const files = await findArtifacts(result.files_uploaded || {}, taskStarted)
|
|
302
|
+
if (!files.length) {
|
|
303
|
+
await api('POST', `/api/argent/v1/tenants/${encodeURIComponent(APP)}/full-executions/${encodeURIComponent(ctx.task.id)}/result`, {
|
|
304
|
+
workerId, status: 'failed', error: 'FULL 成功但未找到可上传的产物文件',
|
|
305
|
+
}).catch(() => {})
|
|
306
|
+
continue
|
|
307
|
+
}
|
|
308
|
+
const uploaded = await uploadFulfillmentFiles({
|
|
309
|
+
files,
|
|
310
|
+
cmdBase: `/api/argent/v1/tenants/${encodeURIComponent(APP)}/machines/${encodeURIComponent(MACHINE || workerId)}`,
|
|
311
|
+
apiCall: (method, path, body, timeoutMs) => api(method, path, body, timeoutMs),
|
|
312
|
+
}).catch((e) => ({ files: [], errors: [String(e?.message || e)] }))
|
|
313
|
+
if (!uploaded.files.length) {
|
|
314
|
+
await api('POST', `/api/argent/v1/tenants/${encodeURIComponent(APP)}/full-executions/${encodeURIComponent(ctx.task.id)}/result`, {
|
|
315
|
+
workerId, status: 'failed', error: `产物上传失败: ${uploaded.errors.join('; ').slice(0, 300)}`,
|
|
316
|
+
}).catch(() => {})
|
|
317
|
+
continue
|
|
318
|
+
}
|
|
212
319
|
await api('POST', `/api/argent/v1/tenants/${encodeURIComponent(APP)}/full-executions/${encodeURIComponent(ctx.task.id)}/result`, {
|
|
213
|
-
workerId, status: '
|
|
214
|
-
|
|
215
|
-
|
|
320
|
+
workerId, status: 'succeeded',
|
|
321
|
+
files: uploaded.files,
|
|
322
|
+
resultSummary: { summary: result.summary || `FULL 完成:${result.shipment_id || ctx.task.shipmentNo || ''}`, shipmentNo: result.shipment_id || ctx.task.shipmentNo || '' },
|
|
323
|
+
ticketComplete: Boolean(result.ticket_complete),
|
|
324
|
+
completedSteps: Array.isArray(result.completed_steps) ? result.completed_steps : [],
|
|
325
|
+
}).catch((e) => console.warn('[worker] 回写失败', ctx.task.id, e.message))
|
|
216
326
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
resultSummary: { summary: result.summary || `FULL 完成:${result.shipment_id || ctx.task.shipmentNo || ''}`, shipmentNo: result.shipment_id || ctx.task.shipmentNo || '' },
|
|
221
|
-
ticketComplete: Boolean(result.ticket_complete),
|
|
222
|
-
completedSteps: Array.isArray(result.completed_steps) ? result.completed_steps : [],
|
|
223
|
-
}).catch((e) => console.warn('[worker] 回写失败', ctx.task.id, e.message))
|
|
327
|
+
} finally {
|
|
328
|
+
clearInterval(hb)
|
|
329
|
+
for (const t of tasks) activeTasks.delete(String(t.id))
|
|
224
330
|
}
|
|
225
|
-
for (const t of tasks) activeTasks.delete(String(t.id))
|
|
226
331
|
}
|
|
227
332
|
|
|
228
333
|
async function tick() {
|
|
@@ -13387,6 +13387,9 @@ class Orchestrator:
|
|
|
13387
13387
|
force=True)
|
|
13388
13388
|
step_summaries: dict[int, Any] = {}
|
|
13389
13389
|
steps = [step_filter] if step_filter else list(range(1, 9))
|
|
13390
|
+
_skip = _parse_skip_steps(getattr(self.args, "skip_steps", ""))
|
|
13391
|
+
if _skip:
|
|
13392
|
+
steps = [x for x in steps if x not in _skip]
|
|
13390
13393
|
result = await self._execute_steps(steps, allow_write, dry_run, step_summaries)
|
|
13391
13394
|
if result is None:
|
|
13392
13395
|
# 步骤序列走完:收尾决策走**唯一入口**(`run()` 与批处理同一个)
|
|
@@ -13657,6 +13660,9 @@ class Orchestrator:
|
|
|
13657
13660
|
steps = [4, 5, 6, 7, 8]
|
|
13658
13661
|
else:
|
|
13659
13662
|
steps = [step_filter] if step_filter else list(range(1, 9))
|
|
13663
|
+
_skip = _parse_skip_steps(getattr(self.args, "skip_steps", ""))
|
|
13664
|
+
if _skip:
|
|
13665
|
+
steps = [x for x in steps if x not in _skip]
|
|
13660
13666
|
step_summaries: dict[int, Any] = {}
|
|
13661
13667
|
|
|
13662
13668
|
result = await self._execute_steps(steps, allow_write, dry_run, step_summaries)
|
|
@@ -14249,6 +14255,8 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
14249
14255
|
help="step 模式下的步骤号")
|
|
14250
14256
|
p.add_argument("--allow-write", action="store_true",
|
|
14251
14257
|
help="批准写步骤(3/4/5/7/8)执行(默认拒绝)")
|
|
14258
|
+
p.add_argument("--skip-steps", default="",
|
|
14259
|
+
help="逗号分隔强制跳过的步骤号(人工接管续传用;如 6=产品标已人工上传,只跑预约/箱唛/取消)")
|
|
14252
14260
|
p.add_argument("--skip-appointment", action="store_true",
|
|
14253
14261
|
help="FULL 流程跳过步骤4 预约(预约交给 ERP 的 FULL 预约队列;2026-11-18)")
|
|
14254
14262
|
p.add_argument("--record-id", help="指定飞书记录 ID 定向处理(店铺从记录字段读取,忽略 --store-name 取第一条逻辑;供并发调度/定向重跑)")
|
|
@@ -14406,6 +14414,15 @@ async def _run_batch_parallel(orch: "Orchestrator", args: argparse.Namespace) ->
|
|
|
14406
14414
|
"parallel": parallel, "store": store, "results": list(results)}
|
|
14407
14415
|
|
|
14408
14416
|
|
|
14417
|
+
def _parse_skip_steps(raw: str) -> set[int]:
|
|
14418
|
+
out = set()
|
|
14419
|
+
for part in str(raw or "").split(","):
|
|
14420
|
+
part = part.strip()
|
|
14421
|
+
if part.isdigit() and 1 <= int(part) <= 8:
|
|
14422
|
+
out.add(int(part))
|
|
14423
|
+
return out
|
|
14424
|
+
|
|
14425
|
+
|
|
14409
14426
|
async def _run_and_close(orch: "Orchestrator", args: argparse.Namespace) -> dict[str, Any]:
|
|
14410
14427
|
"""统一运行入口:无论成功/失败/needs_approval/异常,finally 必关自建标签页(防泄漏)。
|
|
14411
14428
|
|
package/engine/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.
|
|
1
|
+
export const VERSION = "0.14.0"
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"_note": "P2a 落位:flows/prompts/暂停开关/日志/会话文件已命名空间化;角色/preset/技能仍是旧名(legacyNaming,P2b/P5 在有重启窗口时改名);能力与计费单位仍在 base(随重装窗口改 SKU id);适配器仍在 scripts/integrations(P4 端口化时搬)。",
|
|
6
6
|
"_versionNote": "0.1.1(2026-10-06):`requires.argent` 由 `>=0.2 <0.3` 抬到 `>=0.3 <0.4`(平台现役 VERSION=0.3.0)—— 修前「Argent 能力 → 概览」把这唯一的业务线标成 `⚠️ 版本不满足`,而它实际能跑(口径与事实相反)。同批 `version` +1(P0-5,见 docs/Argent-工作台口径审计-2026-10-06.md)。|0.1.2(2026-10-09):**平台抬到 0.4.0** ⇒ `requires.argent` 同步抬到 `>=0.4 <0.5`(不改则会重演 P0-5:兼容区间把现役平台挡在门外)。判据已固化为门禁 `node scripts/check-version-consistency.mjs`(**平台版本必须落在每条业务线声明的兼容区间内**),不再靠人记得复核。⚠️ `verifiedOn.argent` **刻意维持 `0.3.0`**:该字段记的是\"**真装真跑过**\",本批只抬版本号、内核无行为改动,未在 0.4.0 上跑过生产 ⇒ 落地后补登,⛔ 不预填。|0.1.3(2026-10-21):平台版本线已到 0.7.6 ⇒ `requires.argent` 由 `>=0.4 <0.5` 抬到 `>=0.7 <0.8`(原区间把现役平台挡在门外;`check-version-consistency` R1-LOCKSTEP 实测报红)。|0.1.4(2026-11-20):平台版本线到 0.12.25 ⇒ `requires.argent` 抬到 `>=0.11 <0.13`(容纳 0.11/0.12;原文 `>=0.11 <0.12` 把 0.12 挡在门外,R1-LOCKSTEP 报红);`requires.dsh` 同步到 `>=0.2 <0.3`;`verifiedOn.argent` 补 0.12.25(六禾园客户机实装)。",
|
|
7
7
|
"requires": {
|
|
8
|
-
"argent": ">=0.11 <0.
|
|
8
|
+
"argent": ">=0.11 <0.15",
|
|
9
9
|
"dsh": ">=0.2 <0.3"
|
|
10
10
|
},
|
|
11
11
|
"verifiedOn": {
|