@whyshu/argent-engine 0.8.0-rc.3 → 0.8.0-rc.4
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 +20 -12
- package/engine/VERSION +1 -1
- package/engine/scripts/build-engine-package.mjs +1 -1
- package/engine/scripts/capability-packs.lock.json +12 -12
- package/engine/scripts/check-argent-desktop.mjs +91 -0
- package/engine/scripts/erp_invoice_shadow.py +62 -0
- package/engine/scripts/erp_invoice_writeback.py +93 -0
- package/engine/scripts/flow-requirements.json +3 -3
- package/engine/scripts/flow_source.py +10 -1
- package/engine/scripts/flow_sources/__init__.py +1 -0
- package/engine/scripts/flow_sources/erp.py +54 -0
- package/engine/scripts/invoice_lip_runner.py +43 -0
- package/engine/scripts/lib/plugin-packages.mjs +3 -0
- package/engine/scripts/orchestrator.py +173 -5
- package/engine/scripts/orchestrator_br.py +89 -1
- package/engine/scripts/query_runner.py +2 -3
- package/engine/scripts/release-gate-0.8.mjs +1 -0
- package/engine/scripts/skuflow_invoice_runner.py +145 -0
- package/engine/tools/agentic/README.md +95 -0
- package/engine/tools/agentic/mcp_server.py +212 -0
- package/engine/tools/agentic/ml_agent_tools.py +602 -0
- package/engine/version.mjs +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": "1601e2a6af4034c7fcf569fd20db5362aff318466ed1155572b9d3647780c6d6",
|
|
6
6
|
"agents/catalog.json": "5356a812f2554dfd3115370363d4c3f787a82c9e5928a85d05b2a07c9e4b324d",
|
|
7
7
|
"configs/_aliases.proposed.json": "3a59edf80563bcc20d410d488decad6fd787bd3de9489321367b0783904cd3e5",
|
|
8
8
|
"configs/_migration-plan.proposed.json": "dd9f90b0b9b2f217dd23367a618402e57997d44f7fddcfa88a7cadf52e056c0d",
|
|
@@ -63,11 +63,12 @@
|
|
|
63
63
|
"scripts/audit-all.mjs": "54c21512dc7c192fba21e45aab19502e070fecc4d0686fabb1fbdba0d7140794",
|
|
64
64
|
"scripts/base-bootstrap.sh": "d44361618f808533fc11e8acdbccf5dfa53822a745e7c7a84bbd09885f6d6c2e",
|
|
65
65
|
"scripts/billing-mode-daily.sh": "830e2dca9f362d1098239111479794a68d4a34071242daaeb04c36cf858cd175",
|
|
66
|
-
"scripts/build-engine-package.mjs": "
|
|
67
|
-
"scripts/capability-packs.lock.json": "
|
|
66
|
+
"scripts/build-engine-package.mjs": "44ec5ee79c5087fe30c705e805ca713154c17759cf51705af1ebc05c29fbb593",
|
|
67
|
+
"scripts/capability-packs.lock.json": "e441fdd041986f1918371b36240e5686b6b506326c0616f1cf3773789ed23338",
|
|
68
68
|
"scripts/capability_pack.py": "d21bca70deadab6bb818a3f2e12721c7eeb1c690bb382daae752620db8db5cb3",
|
|
69
69
|
"scripts/check-1.0-criteria.mjs": "8fe145a83c4060c51a678eb2586b87a78b66d1456cebc95c52f7789aeb181c66",
|
|
70
70
|
"scripts/check-agent-catalog.mjs": "340be84cfad2f3cd7049545e6c953c9ce54523bdf6ad60dff1ad7925293821bc",
|
|
71
|
+
"scripts/check-argent-desktop.mjs": "00cc07d5ac1fd6b8406e7d97b06fd95cae5674151e4ab0cb57851b46807191c6",
|
|
71
72
|
"scripts/check-billing-mode.sh": "223bdec2370adbd0ee626e645a240bda7a806343c5bc19139b09df01f71ff918",
|
|
72
73
|
"scripts/check-child-sessions.mjs": "eed280e629c87a581d1520fdab4eb5fec544e17a064ea38f174be450678e8eee",
|
|
73
74
|
"scripts/check-config-catalog.mjs": "0032fd3fcddf7b9e429df990036b536ee361f6b7a6d05982028a177d670ee70a",
|
|
@@ -126,11 +127,13 @@
|
|
|
126
127
|
"scripts/ensure-store-windows.py": "8080b5afb7cf95a2203cfe46e34773ea4bcb945718f26cb837248860701c08f4",
|
|
127
128
|
"scripts/entitlements.py": "827bc3dd842faef7b4e7711f517633158cc5fbc2c9738faa41f80095c10b84c6",
|
|
128
129
|
"scripts/env_probe.py": "976171519efe2a699844940687f179cb07b277f979ca5465d409a4e6cee4b3a7",
|
|
130
|
+
"scripts/erp_invoice_shadow.py": "cde33ae1250eaa14c901f13a2cbac9acbc30cd646187ebb55374d07ad4de6a69",
|
|
131
|
+
"scripts/erp_invoice_writeback.py": "6ab4abb58b2c6b944636722bc0bf15769d53d57a898da59d335af51dfb129418",
|
|
129
132
|
"scripts/feishu-card.mjs": "1041cc0d32ad49a5d2ef5c5dc5f954f4e6b5d628395768847e9d5ed246706e8f",
|
|
130
133
|
"scripts/final-check.mjs": "45e2004e778c83fe08b35921a555b2ca57ddb375672cc965544ef1bb6ff10aa8",
|
|
131
134
|
"scripts/fix-skill-frontmatter.py": "c77cb8d389bd96bc40655bbdd712435bfb06f74453a2f54dad58013f615ea748",
|
|
132
135
|
"scripts/flow-auto-retry.py": "2474e649e2e7c2803c3140b5c0780648059d3aadae299ea77a706a552b1fab63",
|
|
133
|
-
"scripts/flow-requirements.json": "
|
|
136
|
+
"scripts/flow-requirements.json": "e0a9f13a9b642dde656dbe136e35e8c609e9e38da62543345cd1028ce7ad5b31",
|
|
134
137
|
"scripts/flow-scaffold.py": "d886e4e5d5cf0e80991d1d1a40e54a7281d87fec7c781c89101277795e401ae1",
|
|
135
138
|
"scripts/flow-session-retention.mjs": "a9a2d261dce959bcd0eb26361413b9fc10fd1cbd562f86c614face66861c9793",
|
|
136
139
|
"scripts/flow-timers-plist.sh": "a7b1007526fe21923566a002ef4e50fade5cbcdef38799f1a52e50c7b9c21131",
|
|
@@ -150,10 +153,11 @@
|
|
|
150
153
|
"scripts/flow_registry.py": "53928b3fb76351561bfbb4cbe2e86de94b0a9f31d3f28ee0673e9f43c2b12d21",
|
|
151
154
|
"scripts/flow_retry.py": "6516a65a04da7db3b1a55f03afb61129cb4a55c09cbf6806cbd945864fc0e1bc",
|
|
152
155
|
"scripts/flow_return_to_ops.py": "1eb105447aee62066271d715155e99a9d4e5c71123bca57fcd0da2464ea2c895",
|
|
153
|
-
"scripts/flow_source.py": "
|
|
154
|
-
"scripts/flow_sources/__init__.py": "
|
|
156
|
+
"scripts/flow_source.py": "a77269061d8effa290f4278b69ea363b99d4969f9a1049d59396957d58f5a4d0",
|
|
157
|
+
"scripts/flow_sources/__init__.py": "2b064441170290e5969a495c0c0debf288910eb9d8d7a550ccc7d12343f4214f",
|
|
155
158
|
"scripts/flow_sources/cases_json.py": "c9b328c2a2890d05f15e1d017e38d2cbbd1dafb93b1cff3c9caa80fe7419f4c6",
|
|
156
159
|
"scripts/flow_sources/common.py": "0f1efb103e0542209fd3924ee393da2c6daf57017d0206fc1bb28bd177bfe1ea",
|
|
160
|
+
"scripts/flow_sources/erp.py": "7d9344179c33e33d85b5bf0c8ac01c993322a13aea13f77ce95a3b2263f6d936",
|
|
157
161
|
"scripts/flow_sources/feishu_base.py": "6d9a8883adcc0b869794921e64806b4a788649975f4c1f718191a5cbd3419c73",
|
|
158
162
|
"scripts/flow_stale.py": "a2877cd8faa7a54cec7fb91bb886e56cc714d87c21e4e477f98507031c97e0d3",
|
|
159
163
|
"scripts/flow_status_reconcile.py": "f17fea943deffb5c691531f73d025f69d8d4b75aea15292ab867ce254b8e0edc",
|
|
@@ -173,7 +177,7 @@
|
|
|
173
177
|
"scripts/invoice-table.sh": "a5963137ce711c974b8b6ac17c14ac5d34a8a5e0a6b21b8f85dba8c8df615bad",
|
|
174
178
|
"scripts/invoice_carrier_notice.py": "8b24766ac67934895a214244ad7495388ad508bf5020cd8784cbd68b0cf2fa65",
|
|
175
179
|
"scripts/invoice_fail_closeout.py": "6dbed32a633b9e3ea676792e11e8e1f12d9e51a654d2aeda1e9d4de263ad5a91",
|
|
176
|
-
"scripts/invoice_lip_runner.py": "
|
|
180
|
+
"scripts/invoice_lip_runner.py": "0ce53eb1f6a6de584dc19bc5646ad41965efa201113abb4516486f023b62654d",
|
|
177
181
|
"scripts/invoice_lip_runner.py.bak-20260922-1710-freready": "95d95e7d3aa9f46cca93e1a70d86f6ffe8f6bca07a9c1ebba1bbf993abdd09e6",
|
|
178
182
|
"scripts/invoice_ready_audit.py": "f598801d1603d8ea5ca7d433bb4e3eee230eeceb1b99448be6ef75397cb6e8a0",
|
|
179
183
|
"scripts/invoice_runner.py": "6b8744ad50173be9d4c8a8875400399594c7ba43e485cfbccd1c911191d8fdd1",
|
|
@@ -202,7 +206,7 @@
|
|
|
202
206
|
"scripts/lib/patch-compose.mjs": "1e2064062799c214c8fea1bf3403c7dea7854d0c29e7bbe2ab82ad994dfc636e",
|
|
203
207
|
"scripts/lib/patch-target.mjs": "9c2970180b25c757f959ff9aa34d9cafdee8747351893ab59826b407940a272e",
|
|
204
208
|
"scripts/lib/plugin-lifecycle.mjs": "a69bbc1f60400128b4999ac4d81b466bd7e68d8fd4076d2ac963908635901c08",
|
|
205
|
-
"scripts/lib/plugin-packages.mjs": "
|
|
209
|
+
"scripts/lib/plugin-packages.mjs": "73bf719bad02739b9b5c3c15d1e2c7a2e2a3d82343df6bce520895c7a11dac64",
|
|
206
210
|
"scripts/lib/preset-compat.mjs": "c31d803922894231f24ce7baba1468ef590a4dae011fcb33de6e4083750c1918",
|
|
207
211
|
"scripts/lib/preset-install.mjs": "cf939e22ae82be40c9823e102d5c453fd4a5d5c5b4e0ae1acd0ca36eb2414c45",
|
|
208
212
|
"scripts/lib/preset-mechanism.mjs": "b5ad412bacd8db85c334fddda858069336100395632b6c076735e800a9b1f358",
|
|
@@ -236,8 +240,8 @@
|
|
|
236
240
|
"scripts/ml_store_ids.py": "133e520e0019fae03a3daa5766352a390cf104ddbaaf228a51264a6a5fdd2493",
|
|
237
241
|
"scripts/npm-publish-argent.mjs": "f3068945bcd6e659414bcd396d08940ed4b80f7ed296dd0cebf9138325526d26",
|
|
238
242
|
"scripts/npm-publish-argent.sh": "9e54b17b011bbaaffdc9dfdded18196d83fc00363c405179e5ec45beb712c555",
|
|
239
|
-
"scripts/orchestrator.py": "
|
|
240
|
-
"scripts/orchestrator_br.py": "
|
|
243
|
+
"scripts/orchestrator.py": "7ce2ac1789ab6eba5f788759a86ee129252e9678918474572663d3c2c8573c41",
|
|
244
|
+
"scripts/orchestrator_br.py": "137c7faf46cc09d749db4e5749194606ca10f07af50acd94ca876aaa778df3e6",
|
|
241
245
|
"scripts/p2-report-run.mjs": "86bd6b3005f1a5fca3f808f4ea77dcce43a11a4a9be7ee814a029daaae201fb5",
|
|
242
246
|
"scripts/pack-plugins.mjs": "b1b42fb30ebd27f320af72bc28b5b8e2b76e54031b4ac1ba5c3909374990b38b",
|
|
243
247
|
"scripts/patches/dsh-session--append-message-shape.patch": "e4cd6447d4fdd03ff5fa94fd5ff62234168740b901804f687d91006fdedf66a1",
|
|
@@ -261,9 +265,9 @@
|
|
|
261
265
|
"scripts/provider-switch.sh": "42b369100d8a190741efab34c68e4d8488ce70f142251d994b4a8db560905a0a",
|
|
262
266
|
"scripts/provider-sync-target.check.mjs": "f4a1fcb2724724f895053d2401b6f3701a76594f8dbec3f3045db66901f3f135",
|
|
263
267
|
"scripts/python-runtime.sh": "7831db3ec43e8f9a5cdf519aa50960918c2f7126992494626b7886e219db4967",
|
|
264
|
-
"scripts/query_runner.py": "
|
|
268
|
+
"scripts/query_runner.py": "9bc16e2c3b030cde901a7f680e68499d15f412ef3317e7936fbaeab021412a16",
|
|
265
269
|
"scripts/release-argent.sh": "f6cec78ce4c5c4ecd18dc66771148a3780c90ac427c9fac3742e84cabf3a2b3c",
|
|
266
|
-
"scripts/release-gate-0.8.mjs": "
|
|
270
|
+
"scripts/release-gate-0.8.mjs": "8182a27de192b7afacb296cbb2bcb544ed91b49df395077bb50905e9c8c1764c",
|
|
267
271
|
"scripts/repair-unresolved-tools.mjs": "bcdeb4a1fe9544a304248880804e29a0dccf251d93eeea1a7608e2aa4e03f10a",
|
|
268
272
|
"scripts/retire-inventory.mjs": "c9dda33d9ac741a45459bbf8088e3a50f8eb2bed83cc819ef850e780d7bf8c09",
|
|
269
273
|
"scripts/run-tests.sh": "4297f8d5309a6c2ee15e9db1a894c43051c1a5bbe0e1a9fcfef36f2773ff2bcd",
|
|
@@ -276,6 +280,7 @@
|
|
|
276
280
|
"scripts/setup.sh": "3d8e2386a9a443bf2ee08a81115adb3f673e009c6baf3aba69559e85e0d1a528",
|
|
277
281
|
"scripts/skill-install.mjs": "8fe429f44b50e96ed48cd100297fb882693907361643d5ef24714245fc82bfdd",
|
|
278
282
|
"scripts/sku_translate.py": "c6d0b94e84e703cc5a5a671c9960c5e1060e8bf5d3f0115c1e0ba38bbd2eb289",
|
|
283
|
+
"scripts/skuflow_invoice_runner.py": "3dab68668802f004f245cbcf836cc8748fff4061df6cc034a586ed60148f8f09",
|
|
279
284
|
"scripts/sync-plugins.sh": "85b1756513d2209385229556aa495af5937a050518889f016a998bd7a12ddc55",
|
|
280
285
|
"scripts/sync-presets.sh": "b82e9960db0cb2bbb12e468563e798cac9ab8fd9f7ab218a4767d3ae7d024f38",
|
|
281
286
|
"scripts/sync-scripts.sh": "ee67231daa9252a69fea68313540dcfc8fb21b2b56972aeb0c01f950871142f1",
|
|
@@ -340,6 +345,9 @@
|
|
|
340
345
|
"skills/pet-dev/SKILL.md": "0699f0aeb3598f39f28438285419b303e44f9cff155f56fcfa1ac6270978a975",
|
|
341
346
|
"skills/whyshu-pm/SKILL.md": "04294e57508e32bd5f8dcad8b4c0da3052c1ad567434273c5d975d882096c50b",
|
|
342
347
|
"skills/whyshu-web-dev/SKILL.md": "f07d4365be9c723ccf08373860c5d66b2e30acdcffbe725ae569e9a208e9bb1e",
|
|
348
|
+
"tools/agentic/README.md": "6fa0af915442bfe97d730ce41eb66bf8dec9d1165b393d687a5e35072e69270c",
|
|
349
|
+
"tools/agentic/mcp_server.py": "4c3e66e6a8f8a4571339045dc4ccc255288557115a06ff42bd60a4c79b696feb",
|
|
350
|
+
"tools/agentic/ml_agent_tools.py": "b080d439ababf0ea375ae498a534f6c9761f8fce799b79d44991e830e6ca8dbc",
|
|
343
351
|
"verticals/README.md": "5618cb80cd8db5cda216ebbed913e03bf640b8460650fb2f99e86c58c773604e",
|
|
344
352
|
"verticals/_engine-words.baseline.txt": "9260be008c01c444f600c0b4ec4a5bfeb5ad8176626bfce559d17a6ae689f574",
|
|
345
353
|
"verticals/_engine-words.json": "656f2b306a83d65da58f0fe28cd4032e55fffc1cf93398aa36c126aa5686f06b",
|
package/engine/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.8.0-rc.
|
|
1
|
+
0.8.0-rc.4
|
|
@@ -19,7 +19,7 @@ const HERE = dirname(fileURLToPath(import.meta.url))
|
|
|
19
19
|
const REPO = join(HERE, '..')
|
|
20
20
|
|
|
21
21
|
/** 白名单:目录 + 排除(唯一真源) */
|
|
22
|
-
export const INCLUDE_DIRS = ['scripts', 'core', 'verticals', 'configs', 'agents', 'skills']
|
|
22
|
+
export const INCLUDE_DIRS = ['scripts', 'core', 'verticals', 'configs', 'agents', 'skills', 'tools/agentic']
|
|
23
23
|
export const EXCLUDE_RE = [
|
|
24
24
|
/(^|\/)tests?\//, /(^|\/)__pycache__\//, /\.pyc$/, /(^|\/)node_modules\//,
|
|
25
25
|
/(^|\/)attic\//, /\.test\.(mjs|py)$/, /(^|\/)fixtures\//,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"_doc": "能力包版本锁(迭代3-⑨):由 scripts/capability_pack.py --stamp 生成。内容变了(sha 或 digest 变)而版本没变 ⇒ --stamp 直接拒绝(stamp_check)且 --validate 报错;版本**降**了同样拒绝(--allow-downgrade 才放行,且显著告警);提了版本再盖章。digest = 整包内容摘要,与 --emit-server-manifest#sha256 / --digest-tgz 同口径;批次收口前用只读的 --check-stamp 自检。",
|
|
3
3
|
"capabilities": {
|
|
4
4
|
"daily-report": {
|
|
5
|
-
"version": "1.1.
|
|
5
|
+
"version": "1.1.185",
|
|
6
6
|
"flows": [
|
|
7
7
|
"mercadolibre.daily-report"
|
|
8
8
|
],
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
"scripts/flow_preflight.py": "4afc572456febcd7",
|
|
63
63
|
"scripts/flow_retry.py": "6516a65a04da7db3",
|
|
64
64
|
"scripts/flow_return_to_ops.py": "1eb105447aee6206",
|
|
65
|
-
"scripts/flow_sources/__init__.py": "
|
|
65
|
+
"scripts/flow_sources/__init__.py": "2b064441170290e5",
|
|
66
66
|
"scripts/flow_sources/common.py": "0f1efb103e054220",
|
|
67
67
|
"scripts/flow_sources/feishu_base.py": "6d9a8883adcc0b86",
|
|
68
68
|
"scripts/flow_sources/cases_json.py": "c9b328c2a2890d05",
|
|
69
|
-
"scripts/flow_source.py": "
|
|
69
|
+
"scripts/flow_source.py": "bde31295a2759c60",
|
|
70
70
|
"scripts/flow_stale.py": "a2877cd8faa7a54c",
|
|
71
71
|
"scripts/flow_triage.py": "12e57412e03f2cfd",
|
|
72
72
|
"scripts/integration_contract.py": "d44690ef41769999",
|
|
@@ -145,10 +145,10 @@
|
|
|
145
145
|
"verticals/mercadolibre/flows.json": "1b0f3b5d87af164a",
|
|
146
146
|
"verticals/mercadolibre/config.json": "85e592d700383b9b"
|
|
147
147
|
},
|
|
148
|
-
"digest": "
|
|
148
|
+
"digest": "2bd959eb1c6a864dac6b8470c263e0921154e100bf4da56c4d79265d4229657d"
|
|
149
149
|
},
|
|
150
150
|
"full": {
|
|
151
|
-
"version": "1.3.
|
|
151
|
+
"version": "1.3.194",
|
|
152
152
|
"flows": [
|
|
153
153
|
"mercadolibre.full"
|
|
154
154
|
],
|
|
@@ -208,11 +208,11 @@
|
|
|
208
208
|
"scripts/flow_preflight.py": "4afc572456febcd7",
|
|
209
209
|
"scripts/flow_retry.py": "6516a65a04da7db3",
|
|
210
210
|
"scripts/flow_return_to_ops.py": "1eb105447aee6206",
|
|
211
|
-
"scripts/flow_sources/__init__.py": "
|
|
211
|
+
"scripts/flow_sources/__init__.py": "2b064441170290e5",
|
|
212
212
|
"scripts/flow_sources/common.py": "0f1efb103e054220",
|
|
213
213
|
"scripts/flow_sources/feishu_base.py": "6d9a8883adcc0b86",
|
|
214
214
|
"scripts/flow_sources/cases_json.py": "c9b328c2a2890d05",
|
|
215
|
-
"scripts/flow_source.py": "
|
|
215
|
+
"scripts/flow_source.py": "bde31295a2759c60",
|
|
216
216
|
"scripts/flow_stale.py": "a2877cd8faa7a54c",
|
|
217
217
|
"scripts/flow_triage.py": "12e57412e03f2cfd",
|
|
218
218
|
"scripts/integration_contract.py": "d44690ef41769999",
|
|
@@ -301,7 +301,7 @@
|
|
|
301
301
|
"verticals/mercadolibre/flows.json": "1b0f3b5d87af164a",
|
|
302
302
|
"verticals/mercadolibre/config.json": "85e592d700383b9b"
|
|
303
303
|
},
|
|
304
|
-
"digest": "
|
|
304
|
+
"digest": "a3da42978005c29e5082349bc301de4da88d25e227d9bfee1419404f5dafdd9a"
|
|
305
305
|
},
|
|
306
306
|
"hr": {
|
|
307
307
|
"version": "0.1.86",
|
|
@@ -317,7 +317,7 @@
|
|
|
317
317
|
"digest": "179527a2905f358cdff15f9a8c0f9945f23770e4c504f58a27843c7bf365e76a"
|
|
318
318
|
},
|
|
319
319
|
"invoice": {
|
|
320
|
-
"version": "1.2.
|
|
320
|
+
"version": "1.2.188",
|
|
321
321
|
"flows": [
|
|
322
322
|
"mercadolibre.wenyao-invoice",
|
|
323
323
|
"mercadolibre.xzh-invoice"
|
|
@@ -378,11 +378,11 @@
|
|
|
378
378
|
"scripts/flow_preflight.py": "4afc572456febcd7",
|
|
379
379
|
"scripts/flow_retry.py": "6516a65a04da7db3",
|
|
380
380
|
"scripts/flow_return_to_ops.py": "1eb105447aee6206",
|
|
381
|
-
"scripts/flow_sources/__init__.py": "
|
|
381
|
+
"scripts/flow_sources/__init__.py": "2b064441170290e5",
|
|
382
382
|
"scripts/flow_sources/common.py": "0f1efb103e054220",
|
|
383
383
|
"scripts/flow_sources/feishu_base.py": "6d9a8883adcc0b86",
|
|
384
384
|
"scripts/flow_sources/cases_json.py": "c9b328c2a2890d05",
|
|
385
|
-
"scripts/flow_source.py": "
|
|
385
|
+
"scripts/flow_source.py": "bde31295a2759c60",
|
|
386
386
|
"scripts/flow_stale.py": "a2877cd8faa7a54c",
|
|
387
387
|
"scripts/flow_triage.py": "12e57412e03f2cfd",
|
|
388
388
|
"scripts/integration_contract.py": "d44690ef41769999",
|
|
@@ -476,7 +476,7 @@
|
|
|
476
476
|
"verticals/mercadolibre/flows.json": "1b0f3b5d87af164a",
|
|
477
477
|
"verticals/mercadolibre/config.json": "85e592d700383b9b"
|
|
478
478
|
},
|
|
479
|
-
"digest": "
|
|
479
|
+
"digest": "840b2aedb233c0b1b9ab30a5c69b85015a1cac9e950d24958993732526768058"
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* 验收:DSH Desktop 上的 @whyshu/argent-desktop 是否真的接上 ERP(2026-10-29)。
|
|
4
|
+
*
|
|
5
|
+
* 为什么需要它:桌面端的 dsh launch token 只在 Electron 壳内部,外部 curl 拿不到
|
|
6
|
+
* `/api/argent-office/status`;插件每次上报/轮询后会把只读状态落到数据目录,
|
|
7
|
+
* 本脚本就是这份状态的**机器判据**(不联网、不打印 token)。
|
|
8
|
+
*
|
|
9
|
+
* 用法:
|
|
10
|
+
* node scripts/check-argent-desktop.mjs
|
|
11
|
+
* node scripts/check-argent-desktop.mjs --machine mac-chester
|
|
12
|
+
* node scripts/check-argent-desktop.mjs --max-age 120 # lastOkAt 允许的最大秒数
|
|
13
|
+
* node scripts/check-argent-desktop.mjs --file <path> # 指定状态文件(测试/排障)
|
|
14
|
+
*
|
|
15
|
+
* 退出码:0 = 全部通过;1 = 有失败项;2 = 状态文件不存在(通常 = Desktop 未重启/插件未加载)。
|
|
16
|
+
*/
|
|
17
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
18
|
+
import { dirname, join } from 'node:path'
|
|
19
|
+
import { resolveDataDir } from '../core/lib/argent-datadir.mjs'
|
|
20
|
+
|
|
21
|
+
const args = process.argv.slice(2)
|
|
22
|
+
const flag = (name, dflt) => {
|
|
23
|
+
const i = args.indexOf(name)
|
|
24
|
+
return i > -1 ? args[i + 1] ?? dflt : dflt
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const dataDir = resolveDataDir({ env: process.env }).dir
|
|
28
|
+
// v0.2.0 起状态文件移出 ~/.dsh/argent(避免 agent-bundle-generation 门禁误报);
|
|
29
|
+
// 旧路径保留为回退,便于未重启的 0.1.x 插件继续被检查。
|
|
30
|
+
const newFile = join(dirname(dataDir), 'argent-desktop', 'argent-desktop-status.json')
|
|
31
|
+
const oldFile = join(dataDir, 'argent-desktop-status.json')
|
|
32
|
+
const defaultFile = [newFile, oldFile].find((p) => { try { return existsSync(p) } catch { return false } }) || newFile
|
|
33
|
+
const file = flag('--file', defaultFile)
|
|
34
|
+
const maxAgeMs = Math.max(Number(flag('--max-age', '90')) || 90, 10) * 1000
|
|
35
|
+
const expectMachine = String(flag('--machine', '') || '')
|
|
36
|
+
|
|
37
|
+
let pass = 0
|
|
38
|
+
let fail = 0
|
|
39
|
+
const ok = (cond, label, detail = '') => {
|
|
40
|
+
if (cond) { pass += 1; console.log(` ✅ ${label}${detail ? `:${detail}` : ''}`) }
|
|
41
|
+
else { fail += 1; console.log(` ❌ ${label}${detail ? `:${detail}` : ''}`) }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
console.log('── Argent Desktop ERP 连接验收 ─────────────────────────────')
|
|
45
|
+
console.log(` 状态文件:${file}`)
|
|
46
|
+
console.log(` 数据目录:${dataDir}`)
|
|
47
|
+
|
|
48
|
+
let raw
|
|
49
|
+
try {
|
|
50
|
+
raw = readFileSync(file, 'utf8')
|
|
51
|
+
} catch (e) {
|
|
52
|
+
console.error(`\n❌ 读不到状态文件(${e?.code || e?.message})。`)
|
|
53
|
+
console.error(' 最常见的两个原因:')
|
|
54
|
+
console.error(' 1) Desktop 还没**完整退出重开**(关窗口不算;要 Cmd+Q 后重开);')
|
|
55
|
+
console.error(' 2) 插件没装进 profile:dsh plugin --profile desktop add file:.../plugins/argent-desktop')
|
|
56
|
+
process.exit(2)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let s
|
|
60
|
+
try { s = JSON.parse(raw) } catch {
|
|
61
|
+
console.error('\n❌ 状态文件不是合法 JSON(可能写了一半)。等 5 秒再跑一次。')
|
|
62
|
+
process.exit(1)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
console.log(` 插件 pid:${s.pid ?? '?'} at:${s.at ?? '?'}`)
|
|
66
|
+
console.log('')
|
|
67
|
+
|
|
68
|
+
ok(s.enabled === true, '上报已启用', s.reason ? `reason=${s.reason}` : '')
|
|
69
|
+
ok(Boolean(s.machineId), 'machineId 非空', String(s.machineId || ''))
|
|
70
|
+
if (expectMachine) ok(s.machineId === expectMachine, 'machineId 符合预期', `${s.machineId} == ${expectMachine}`)
|
|
71
|
+
ok(Boolean(s.lastOkAt), '最近一次上报成功', String(s.lastOkAt || ''))
|
|
72
|
+
const age = s.lastOkAt ? Date.now() - Date.parse(s.lastOkAt) : Infinity
|
|
73
|
+
ok(Number.isFinite(age) && age <= maxAgeMs, '上报足够新', `${Math.round(age / 1000)}s ≤ ${Math.round(maxAgeMs / 1000)}s`)
|
|
74
|
+
ok(!s.lastError, '上报无错误', String(s.lastError || ''))
|
|
75
|
+
|
|
76
|
+
const chat = s.chat || {}
|
|
77
|
+
ok(chat.enabled === true, '机器对话已启用', '')
|
|
78
|
+
ok(chat.started === true, '机器对话轮询已启动', '')
|
|
79
|
+
ok(Boolean(chat.lastOkAt), '最近一次轮询成功', String(chat.lastOkAt || ''))
|
|
80
|
+
ok(!chat.lastError, '轮询无错误', String(chat.lastError || ''))
|
|
81
|
+
|
|
82
|
+
console.log('')
|
|
83
|
+
if (fail === 0) {
|
|
84
|
+
console.log(`✅ 通过(${pass} 项):Desktop 正在以 ${s.machineId} 接通 ERP。`)
|
|
85
|
+
console.log(' 下一步:在 ERP「机器管理」确认在线,并在办公室页对会话发一条消息。')
|
|
86
|
+
} else {
|
|
87
|
+
console.log(`❌ 有 ${fail} 项失败 / ${pass} 项通过。`)
|
|
88
|
+
console.log(' 若只是首次启动:等 10–15 秒再跑一次(首个 tick 在上报)。')
|
|
89
|
+
console.log(' 若 lastError 有值:先看网络/机器 token;状态文件里不含 token,不会泄露凭据。')
|
|
90
|
+
process.exitCode = 1
|
|
91
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""发票写回 shadow:把「准备写到 lip 的字段/附件」映射成 ERP 契约并落 JSONL。
|
|
2
|
+
|
|
3
|
+
⛔ 本模块**不调用 ERP 写接口**、**不改客户状态**;只供 invoice_lip_runner 在
|
|
4
|
+
ARGENT_WRITEBACK=shadow 时记录“如果切 ERP 会写什么”,用于和 lip 结果比对。
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import os
|
|
10
|
+
import time
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
FIELD_MAP = {
|
|
14
|
+
'发票状态': 'invoiceStatus',
|
|
15
|
+
'发票错误信息': 'invoiceError',
|
|
16
|
+
'发票就绪': 'invoiceReady',
|
|
17
|
+
}
|
|
18
|
+
ATTACHMENT_MAP = {
|
|
19
|
+
'发票文件': 'invoiceFile',
|
|
20
|
+
'大货标签': 'bulkLabel',
|
|
21
|
+
'产品图': 'productImage',
|
|
22
|
+
'FULL标签文件': 'fullLabelFile',
|
|
23
|
+
'FULL箱唛文件': 'fullCartonFile',
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def to_erp_fields(patch: dict) -> tuple[dict, list]:
|
|
28
|
+
"""lip 中文 patch → ERP 字段;返回 (erp_fields, skipped)。"""
|
|
29
|
+
fields: dict = {}
|
|
30
|
+
skipped: list = []
|
|
31
|
+
for key, value in (patch or {}).items():
|
|
32
|
+
target = FIELD_MAP.get(key)
|
|
33
|
+
if target:
|
|
34
|
+
fields[target] = value
|
|
35
|
+
else:
|
|
36
|
+
skipped.append(key)
|
|
37
|
+
return fields, skipped
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def shadow_record(rids, patch=None, source: str = 'lip_update', attachments=None) -> dict:
|
|
41
|
+
fields, skipped = to_erp_fields(patch or {})
|
|
42
|
+
return {
|
|
43
|
+
'ts': time.strftime('%Y-%m-%dT%H:%M:%S'),
|
|
44
|
+
'mode': 'shadow',
|
|
45
|
+
'source': source,
|
|
46
|
+
'records': [str(x) for x in (rids or [])],
|
|
47
|
+
'erpFields': fields,
|
|
48
|
+
'skippedFields': skipped,
|
|
49
|
+
'attachments': [
|
|
50
|
+
{'field': ATTACHMENT_MAP.get(a.get('field'), a.get('field')), 'filename': a.get('filename', '')}
|
|
51
|
+
for a in (attachments or [])
|
|
52
|
+
],
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def append_shadow(record: dict, data_dir=None) -> Path:
|
|
57
|
+
base = Path(data_dir) if data_dir else Path(os.environ.get('ARGENT_DATA_DIR') or (Path.home() / '.dsh' / 'argent'))
|
|
58
|
+
path = base / 'invoice-lip-writes' / 'erp-shadow.jsonl'
|
|
59
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
60
|
+
with path.open('a', encoding='utf-8') as fh:
|
|
61
|
+
fh.write(json.dumps(record, ensure_ascii=False) + '\n')
|
|
62
|
+
return path
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""发票写回 ERP(ARGENT_WRITEBACK=erp):字段 + 附件引用。
|
|
2
|
+
|
|
3
|
+
⛔ 不打印 token;附件走 machine 上传端点(≤2MB),再把 attachment `_id` 同时作为
|
|
4
|
+
fileToken/attachmentId 传给 /agent-tasks/invoice-finalize(attachInvoiceFile 幂等)。
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import base64
|
|
9
|
+
import json
|
|
10
|
+
import mimetypes
|
|
11
|
+
import os
|
|
12
|
+
import urllib.error
|
|
13
|
+
import urllib.request
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
from erp_invoice_shadow import ATTACHMENT_MAP, to_erp_fields
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _config() -> dict:
|
|
20
|
+
env = os.environ
|
|
21
|
+
candidates = []
|
|
22
|
+
if env.get('ARGENT_AGENT_REPORT'):
|
|
23
|
+
candidates.append(Path(env['ARGENT_AGENT_REPORT']))
|
|
24
|
+
data_dir = Path(env.get('ARGENT_DATA_DIR') or (Path.home() / '.dsh' / 'argent'))
|
|
25
|
+
candidates += [data_dir / 'agent-report.json', Path.home() / '.dsh-argent' / 'argent' / 'agent-report.json']
|
|
26
|
+
for f in candidates:
|
|
27
|
+
try:
|
|
28
|
+
d = json.loads(f.read_text())
|
|
29
|
+
if d.get('serverUrl') and d.get('tenantAppId') and d.get('machineId') and d.get('machineToken'):
|
|
30
|
+
return d
|
|
31
|
+
except Exception:
|
|
32
|
+
continue
|
|
33
|
+
raise RuntimeError('ERP 写回:找不到 agent-report.json(serverUrl/tenantAppId/machineId/machineToken)')
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _post(path: str, body: dict) -> tuple[int, dict]:
|
|
37
|
+
cfg = _config()
|
|
38
|
+
url = f"{str(cfg['serverUrl']).rstrip('/')}{path}"
|
|
39
|
+
req = urllib.request.Request(url, data=json.dumps(body, ensure_ascii=False).encode('utf-8'), method='POST',
|
|
40
|
+
headers={'content-type': 'application/json', 'authorization': f"Bearer {cfg['machineToken']}"})
|
|
41
|
+
try:
|
|
42
|
+
with urllib.request.urlopen(req, timeout=60) as resp:
|
|
43
|
+
raw = resp.read().decode('utf-8', errors='replace')
|
|
44
|
+
return resp.status, (json.loads(raw) if raw else {})
|
|
45
|
+
except urllib.error.HTTPError as e:
|
|
46
|
+
raw = e.read().decode('utf-8', errors='replace')
|
|
47
|
+
try:
|
|
48
|
+
return e.code, json.loads(raw)
|
|
49
|
+
except Exception:
|
|
50
|
+
return e.code, {'ok': False, 'error': {'code': 'http_error', 'message': raw[:500]}}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def upload_attachment(path) -> dict:
|
|
54
|
+
p = Path(path)
|
|
55
|
+
data = base64.b64encode(p.read_bytes()).decode('ascii')
|
|
56
|
+
mime = mimetypes.guess_type(p.name)[0] or 'application/octet-stream'
|
|
57
|
+
cfg = _config()
|
|
58
|
+
status, doc = _post(f"/api/argent/v1/tenants/{cfg['tenantAppId']}/machines/{cfg['machineId']}/attachments", {
|
|
59
|
+
'filename': p.name, 'mime': mime, 'dataBase64': data, 'kind': 'invoice-file',
|
|
60
|
+
})
|
|
61
|
+
att = (doc.get('data') or {}).get('attachment') or {}
|
|
62
|
+
if not doc.get('ok') or not att.get('_id'):
|
|
63
|
+
raise RuntimeError(f"ERP 附件上传失败(HTTP {status}):{(doc.get('error') or {}).get('message') or doc}")
|
|
64
|
+
return {
|
|
65
|
+
'attachmentId': str(att['_id']), 'fileToken': str(att['_id']),
|
|
66
|
+
'filename': att.get('filename') or p.name, 'mime': att.get('mime') or mime,
|
|
67
|
+
'size': att.get('size') if isinstance(att.get('size'), int) else p.stat().st_size,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def finalize(record_id: str, fields: dict, attachments: list) -> bool:
|
|
72
|
+
cfg = _config()
|
|
73
|
+
body = {'sourceRecordId': str(record_id), 'fields': fields or {}, 'attachments': attachments or []}
|
|
74
|
+
status, doc = _post(f"/api/argent/v1/tenants/{cfg['tenantAppId']}/machines/{cfg['machineId']}/agent-tasks/invoice-finalize", body)
|
|
75
|
+
return bool(doc.get('ok')), status, doc
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def write_fields(rids, patch) -> bool:
|
|
79
|
+
fields, _skipped = to_erp_fields(patch or {})
|
|
80
|
+
if not fields:
|
|
81
|
+
return True
|
|
82
|
+
for rid in rids or []:
|
|
83
|
+
ok, _status, _doc = finalize(rid, fields, [])
|
|
84
|
+
if not ok:
|
|
85
|
+
return False
|
|
86
|
+
return True
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def upload_and_finalize(rid, field, path) -> bool:
|
|
90
|
+
att = upload_attachment(path)
|
|
91
|
+
erp_field = ATTACHMENT_MAP.get(field, field)
|
|
92
|
+
ok, _status, _doc = finalize(rid, {}, [{**att, 'field': erp_field}])
|
|
93
|
+
return ok
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
},
|
|
158
158
|
"minPlan": "enterprise",
|
|
159
159
|
"pack": {
|
|
160
|
-
"version": "1.2.
|
|
160
|
+
"version": "1.2.188",
|
|
161
161
|
"scripts": [
|
|
162
162
|
"scripts/wenyao-invoice-writeback.mjs",
|
|
163
163
|
"scripts/invoice_lip_runner.py",
|
|
@@ -260,7 +260,7 @@
|
|
|
260
260
|
],
|
|
261
261
|
"minPlan": "enterprise",
|
|
262
262
|
"pack": {
|
|
263
|
-
"version": "1.3.
|
|
263
|
+
"version": "1.3.194",
|
|
264
264
|
"scripts": [
|
|
265
265
|
"scripts/poll-fulfillment.sh",
|
|
266
266
|
"scripts/orchestrator.py",
|
|
@@ -340,7 +340,7 @@
|
|
|
340
340
|
"minPlan": "pro",
|
|
341
341
|
"_minPlanNote": "**2026-10-09(变现分层落地)**:`enterprise` → **`pro`**。判据 = 用户已确认的产品模型「分界线 = **价值更高 / 风险更高 ⇒ 企业版**」:日报是**只读**能力(官方 API 只读查询 + 生成推送,⛔ 不写客户任何系统、⛔ 不动浏览器),与 `full`(箱唛/写操作)、`invoice`(发票/门户写操作)不同档 ⇒ 归 **Pro**。⛔ 只改**档位下限**,⛔ 不改流程行为、⛔ 不改价格口径;`daily-report` 的能力包版本随引擎前进(见 pack.version)。已装机器**不因本改动被卸载/停用**(缩权只影响后续下发,见 entitlements.plans._why 与 docs 策划案 §4.4)。",
|
|
342
342
|
"pack": {
|
|
343
|
-
"version": "1.1.
|
|
343
|
+
"version": "1.1.185",
|
|
344
344
|
"scripts": [
|
|
345
345
|
"scripts/daily-report.mjs",
|
|
346
346
|
"scripts/daily-report.sh",
|
|
@@ -62,6 +62,8 @@ SOURCES: dict = {
|
|
|
62
62
|
'cases-json': {'needs_args': ('--from-json 或 source.file',), 'registry_driven': True,
|
|
63
63
|
'module': 'flow_sources.cases_json',
|
|
64
64
|
'note': '批量清单文件(生成器产出的待处理单元;日报走这条)'},
|
|
65
|
+
'erp': {'needs_args': (), 'registry_driven': True, 'module': 'flow_sources.erp',
|
|
66
|
+
'note': 'ERP Shipment/Invoice 只读数据面(0.8 去 lip Phase 2;machine token 只读)'},
|
|
65
67
|
'cli-json': {'needs_args': ('--ticket', '--fields-from-json'), 'registry_driven': False, 'inline': True,
|
|
66
68
|
'note': '手工/外部喂字段(会话与排障用)'},
|
|
67
69
|
'conversation': {'needs_args': ('--ticket', '--fields-from-json'), 'registry_driven': False, 'inline': True,
|
|
@@ -100,7 +102,14 @@ def _assert_kinds_aligned() -> None:
|
|
|
100
102
|
|
|
101
103
|
|
|
102
104
|
def declared_kind(spec: dict) -> str:
|
|
103
|
-
"""该流程在注册表里声明的数据面(`source.kind`),缺省 feishu-base(历史行为)。
|
|
105
|
+
"""该流程在注册表里声明的数据面(`source.kind`),缺省 feishu-base(历史行为)。
|
|
106
|
+
|
|
107
|
+
0.8 去 lip 过渡开关:ARGENT_FLOW_SOURCE=erp 时,所有流程统一改走 ERP source
|
|
108
|
+
(字段名由适配器保持 lip 兼容),用于先灰度、再删除 lip 源。
|
|
109
|
+
"""
|
|
110
|
+
override = os.environ.get('ARGENT_FLOW_SOURCE', '').strip()
|
|
111
|
+
if override:
|
|
112
|
+
return override
|
|
104
113
|
return str((spec.get('source') or {}).get('kind') or 'feishu-base')
|
|
105
114
|
|
|
106
115
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""ERP 数据面(0.8 去 lip,Phase 2)。
|
|
2
|
+
|
|
3
|
+
从 ERP 机器只读接口拉取 Shipment/Invoice 并映射成旧流程认识的字段;
|
|
4
|
+
不再读 lip 表。身份 = 本机 agent-report.json 的 machine token。
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import os
|
|
10
|
+
import urllib.request
|
|
11
|
+
import urllib.error
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
14
|
+
KIND = 'erp'
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _config() -> dict:
|
|
18
|
+
env = os.environ
|
|
19
|
+
candidates = []
|
|
20
|
+
if env.get('ARGENT_AGENT_REPORT'):
|
|
21
|
+
candidates.append(Path(env['ARGENT_AGENT_REPORT']))
|
|
22
|
+
data_dir = Path(env.get('ARGENT_DATA_DIR') or (Path.home() / '.dsh' / 'argent'))
|
|
23
|
+
candidates += [data_dir / 'agent-report.json', Path.home() / '.dsh-argent' / 'argent' / 'agent-report.json']
|
|
24
|
+
for f in candidates:
|
|
25
|
+
try:
|
|
26
|
+
d = json.loads(f.read_text())
|
|
27
|
+
if d.get('serverUrl') and d.get('tenantAppId') and d.get('machineId') and d.get('machineToken'):
|
|
28
|
+
return d
|
|
29
|
+
except Exception:
|
|
30
|
+
continue
|
|
31
|
+
return {}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def pull(spec, args):
|
|
35
|
+
cfg = _config()
|
|
36
|
+
if not cfg:
|
|
37
|
+
raise SystemExit('ERP source:找不到 agent-report.json(serverUrl/tenantAppId/machineId/machineToken)')
|
|
38
|
+
base = str(cfg['serverUrl']).rstrip('/')
|
|
39
|
+
url = f"{base}/api/argent/v1/tenants/{cfg['tenantAppId']}/machines/{cfg['machineId']}/erp-source?limit=5000"
|
|
40
|
+
req = urllib.request.Request(url, headers={'authorization': f"Bearer {cfg['machineToken']}"})
|
|
41
|
+
try:
|
|
42
|
+
with urllib.request.urlopen(req, timeout=60) as resp:
|
|
43
|
+
doc = json.loads(resp.read().decode('utf-8', errors='replace') or '{}')
|
|
44
|
+
except urllib.error.HTTPError as e:
|
|
45
|
+
raise SystemExit(f'ERP source HTTP {e.code}: {e.read().decode("utf-8", errors="replace")[:500]}')
|
|
46
|
+
except Exception as e:
|
|
47
|
+
raise SystemExit(f'ERP source 不可达:{e}')
|
|
48
|
+
items = (doc.get('data') or {}).get('items') or []
|
|
49
|
+
out = []
|
|
50
|
+
for it in items:
|
|
51
|
+
rid = str(it.get('recordId') or (it.get('fields') or {}).get('recordId') or '')
|
|
52
|
+
if rid:
|
|
53
|
+
out.append((rid, it.get('fields') or {}))
|
|
54
|
+
return out
|