@whyshu/argent-engine 0.13.28 → 0.13.29

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 CHANGED
@@ -2,7 +2,7 @@
2
2
  "schema": 1,
3
3
  "package": "@whyshu/argent-engine",
4
4
  "files": {
5
- "VERSION": "86eefba9eb2c4500c24f9ea1bed58218e047a65b2d9718cc449ad14e47e3f7be",
5
+ "VERSION": "34dc0bd74802a6ef030986290da79cb546a75d005c95a4bec1c23c02d9bdf29e",
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": "d80753cf565ab142e764326fc6f1eda432fcb2e9f860d65fd32328fe407a3057",
17
+ "core/contracts/argent.contracts.json": "983deb0371aa44307ec360412c6a3f622d73c997a719ff99f7a34c8b957ff069",
18
18
  "core/contracts/verbs.schema.json": "54d726181c11536eb30bd25090584a7af103e4c0462f8ef078053c8177e19dcb",
19
19
  "core/lib/account-token.mjs": "35faad2c34e67755c1867f74a74885f0f268d5daabe01d339cf30dc747f86501",
20
20
  "core/lib/argent-datadir.mjs": "1fdd799c933382c4f9e36bd4af33d51b8ac4a466a9d67a8f2296bb267b5251ac",
@@ -161,7 +161,7 @@
161
161
  "scripts/final-check.mjs": "45e2004e778c83fe08b35921a555b2ca57ddb375672cc965544ef1bb6ff10aa8",
162
162
  "scripts/fix-skill-frontmatter.py": "c77cb8d389bd96bc40655bbdd712435bfb06f74453a2f54dad58013f615ea748",
163
163
  "scripts/flow-auto-retry.py": "2474e649e2e7c2803c3140b5c0780648059d3aadae299ea77a706a552b1fab63",
164
- "scripts/flow-requirements.json": "fa4686acca04f2e6b705e0f3446126b721fbc727c16d03a2706d9bac4b7a0c19",
164
+ "scripts/flow-requirements.json": "bc48886dd33ec10cd4daa8a35487bd3febb26db6ee73c0c9f89ed23cf4ab4d58",
165
165
  "scripts/flow-scaffold.py": "d886e4e5d5cf0e80991d1d1a40e54a7281d87fec7c781c89101277795e401ae1",
166
166
  "scripts/flow-session-retention.mjs": "a9a2d261dce959bcd0eb26361413b9fc10fd1cbd562f86c614face66861c9793",
167
167
  "scripts/flow-timers-plist.sh": "a7b1007526fe21923566a002ef4e50fade5cbcdef38799f1a52e50c7b9c21131",
@@ -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": "2fa09cfbb6a69dc0a45ccc40b8196616062d3cb813cdb12389a15676f12dfb4c",
196
+ "scripts/full-exec-worker.mjs": "99dfe3f84e53f0958b172f0bb28431150384fb141035539adf82310dd698e287",
197
197
  "scripts/gen-agent-bundles.mjs": "3ab452fb7b1026a1bfab02977c85229985b390db4bc8458ce974b94bc207ed17",
198
198
  "scripts/gen-preset-rows.mjs": "1c074432be25148e9babce7ea1cb68d8fcef257abc2329f66b4ce488bc504578",
199
199
  "scripts/handover-sheet.mjs": "4e27095ccdd79586391abf7a7d5eb7aabbc3f0d7d9a1dd5161e9af8e8a9338de",
@@ -231,6 +231,7 @@
231
231
  "scripts/lib/dsh-snapshot-path.mjs": "b2d47a75f493e991aae73dfbb7874717997ea916a6267fb47d9024d4f9a37388",
232
232
  "scripts/lib/dsh-versions.mjs": "eb5a607396f46d139a4d75ffdae2e9136cad4e65ac7c662412e42efd214bf361",
233
233
  "scripts/lib/dsh-web-probe.mjs": "0af132c5fcc6afc61f10837b7c909ef24cb1d6c9d96b191d3162c39a059fec07",
234
+ "scripts/lib/fulfillment-upload.mjs": "d6eabd3fdeaf2b0a4e170d9c96689d90255273f6af905a22bffc1beec8f77c8d",
234
235
  "scripts/lib/intel-card.mjs": "9502e9e61f2e102ebf3a9f9879e09fb414d4f1951cebe35a7af8f98a2fed0880",
235
236
  "scripts/lib/invoice_names.py": "b7d89fe034b28803b9ff74afaf20722831090570a6c1218695b5b2215ac6573f",
236
237
  "scripts/lib/is-direct-run.mjs": "de33d824fe69c0f627c3b516c4e6d533559d24dcfdcf459b35d2f89da8b401cb",
package/engine/VERSION CHANGED
@@ -1 +1 @@
1
- 0.13.28
1
+ 0.13.29
@@ -1,6 +1,6 @@
1
1
  {
2
- "argentVersion": "0.13.28",
3
- "_syncNote": "argentVersion 必须与仓库根 VERSION 同批更新:发布前置校验 scripts/check-version-consistency.mjs;2026-11-24 按 VERSION=0.13.28 校正。",
2
+ "argentVersion": "0.13.29",
3
+ "_syncNote": "argentVersion 必须与仓库根 VERSION 同批更新:发布前置校验 scripts/check-version-consistency.mjs;2026-11-24 按 VERSION=0.13.29 校正。",
4
4
  "principle": "宿主无关:宿主只依赖 `argent <verb>`;确定性逻辑在 CLI/MCP,不在提示词里。",
5
5
  "verbs": {
6
6
  "version": {
@@ -647,6 +647,7 @@
647
647
  "scripts/invoice_ready_audit.py",
648
648
  "scripts/lease.py",
649
649
  "scripts/lib/argent-datadir.mjs",
650
+ "scripts/lib/fulfillment-upload.mjs",
650
651
  "scripts/lib/argent_datadir.py",
651
652
  "scripts/lib/argent_filelock.py",
652
653
  "scripts/lib/cdp_ports.py",
@@ -24,7 +24,7 @@ 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
26
  import { basename, join } from 'node:path'
27
- import { uploadFulfillmentFiles } from '../plugins/argent/src/fulfillment-result.mjs'
27
+ import { uploadFulfillmentFiles } from './lib/fulfillment-upload.mjs'
28
28
 
29
29
  const BASE = String(process.env.ARGENT_ERP_BASE || 'https://whyshu.com').replace(/\/+$/, '')
30
30
  const APP = String(process.env.ARGENT_TENANT_APP_ID || '').trim()
@@ -0,0 +1,45 @@
1
+ /**
2
+ * 引擎侧 SkuFlow 产物上传(FULL worker 用)。
3
+ * 与插件 `plugins/argent/src/fulfillment-result.mjs` 的 uploadFulfillmentFiles 同契约:
4
+ * 只接受绝对路径、pdf/png/jpg/xlsx、单文件 ≤2MB、最多 10 个;apiCall 由调用方注入。
5
+ * 单独放在 scripts/lib 是因为该文件必须随 @whyshu/argent-engine 包交付给客户机。
6
+ */
7
+ import { readFile, stat } from 'node:fs/promises'
8
+ import { basename, extname, isAbsolute, resolve } from 'node:path'
9
+
10
+ export const MAX_FILES = 10
11
+ export const MAX_BYTES = 2 * 1024 * 1024
12
+ export const KIND_WHITELIST = new Set(['product_label', 'carton', 'bulk_label', 'invoice'])
13
+ const MIME = {
14
+ '.pdf': 'application/pdf', '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg',
15
+ '.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
16
+ }
17
+
18
+ export async function uploadFulfillmentFiles({ files = [], cmdBase = '', apiCall, maxBytes = MAX_BYTES } = {}) {
19
+ if (typeof apiCall !== 'function') throw new TypeError('apiCall 必须是函数')
20
+ const out = []
21
+ const errors = []
22
+ for (const f of files.slice(0, MAX_FILES)) {
23
+ try {
24
+ if (!f.path || !isAbsolute(f.path)) { errors.push(`跳过非绝对路径: ${f.filename || f.path || ''}`); continue }
25
+ if (!KIND_WHITELIST.has(f.kind)) { errors.push(`跳过非法 kind: ${f.kind || '(空)'}`); continue }
26
+ const real = resolve(f.path)
27
+ const ext = extname(real).toLowerCase()
28
+ if (!MIME[ext]) { errors.push(`跳过非 PDF/图片: ${basename(real)}`); continue }
29
+ const st = await stat(real)
30
+ if (!st.isFile()) { errors.push(`不是文件: ${basename(real)}`); continue }
31
+ if (st.size > maxBytes) { errors.push(`文件超过 ${maxBytes} 字节: ${basename(real)}`); continue }
32
+ const buf = await readFile(real)
33
+ const filename = (f.filename || basename(real)).slice(0, 200)
34
+ const res = await apiCall('POST', `${cmdBase}/attachments`, {
35
+ filename, mime: MIME[ext], dataBase64: buf.toString('base64'), kind: 'task-artifact',
36
+ }, 30_000)
37
+ const ref = res?.data?.attachment?._id || res?.attachment?._id || ''
38
+ if (!ref) { errors.push(`附件接口未返回 attachmentId: ${filename}`); continue }
39
+ out.push({ filename, kind: f.kind, ref })
40
+ } catch (e) {
41
+ errors.push(`${f.filename || f.path || '文件'} 上传失败: ${String(e?.message || e).slice(0, 160)}`)
42
+ }
43
+ }
44
+ return { files: out, errors }
45
+ }
@@ -1 +1 @@
1
- export const VERSION = "0.13.28"
1
+ export const VERSION = "0.13.29"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whyshu/argent-engine",
3
- "version": "0.13.28",
3
+ "version": "0.13.29",
4
4
  "description": "Argent 引擎(L1):流程/台账/重试/守卫/审计/浏览器自动化 —— 逐字节来自 argent-dsh 仓库",
5
5
  "type": "module",
6
6
  "engines": {