@jayyuen66/dsh-dir-prep-organize 0.1.5 → 0.1.7
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/CHANGELOG.md +146 -0
- package/LICENSE +1 -1
- package/README.md +25 -21
- package/README.zh-CN.md +25 -21
- package/THIRD_PARTY_NOTICES.md +3 -1
- package/agents/academic/academic-statistician.md +143 -0
- package/agents/design/design-inclusive-visuals-specialist.md +4 -3
- package/agents/design/design-ui-designer.md +6 -3
- package/agents/design/design-ux-architect.md +20 -7
- package/agents/design/design-whimsy-injector.md +23 -1
- package/agents/engineering/engineering-autonomous-optimization-architect.md +31 -22
- package/agents/engineering/engineering-backend-architect.md +43 -54
- package/agents/engineering/engineering-data-engineer.md +21 -6
- package/agents/engineering/engineering-database-optimizer.md +22 -10
- package/agents/engineering/engineering-devops-automator.md +12 -3
- package/agents/engineering/engineering-email-intelligence-engineer.md +41 -4
- package/agents/engineering/engineering-embedded-firmware-engineer.md +27 -5
- package/agents/engineering/engineering-feishu-integration-developer.md +10 -2
- package/agents/engineering/engineering-frontend-developer.md +24 -18
- package/agents/engineering/engineering-git-workflow-master.md +16 -4
- package/agents/engineering/engineering-incident-response-commander.md +3 -3
- package/agents/engineering/engineering-prompt-engineer.md +7 -2
- package/agents/engineering/engineering-rapid-prototyper.md +7 -3
- package/agents/engineering/engineering-security-engineer.md +2 -0
- package/agents/engineering/engineering-solidity-smart-contract-engineer.md +1 -1
- package/agents/engineering/engineering-technical-writer.md +4 -4
- package/agents/engineering/engineering-threat-detection-engineer.md +2 -0
- package/agents/engineering/engineering-voice-ai-integration-engineer.md +39 -16
- package/agents/engineering/engineering-wechat-mini-program-developer.md +7 -2
- package/agents/game-development/blender/blender-addon-engineer.md +12 -3
- package/agents/game-development/economy-designer.md +155 -0
- package/agents/game-development/godot/godot-gameplay-scripter.md +4 -0
- package/agents/game-development/godot/godot-multiplayer-engineer.md +6 -2
- package/agents/game-development/godot/godot-shader-developer.md +4 -3
- package/agents/game-development/roblox-studio/roblox-experience-designer.md +7 -6
- package/agents/game-development/roblox-studio/roblox-systems-scripter.md +7 -0
- package/agents/game-development/technical-artist.md +4 -0
- package/agents/game-development/unity/unity-multiplayer-engineer.md +67 -0
- package/agents/game-development/unreal-engine/unreal-multiplayer-architect.md +82 -31
- package/agents/game-development/unreal-engine/unreal-systems-engineer.md +13 -1
- package/agents/marketing/marketing-agentic-search-optimizer.md +50 -87
- package/agents/marketing/marketing-carousel-growth-engine.md +49 -35
- package/agents/marketing/marketing-private-domain-operator.md +2 -2
- package/agents/marketing/marketing-seo-specialist.md +22 -0
- package/agents/product/product-behavioral-nudge-engine.md +3 -0
- package/agents/project-management/project-management-jira-workflow-steward.md +5 -2
- package/agents/security/security-appsec-engineer.md +75 -43
- package/agents/security/security-threat-detection-engineer.md +6 -0
- package/agents/security/security-threat-intelligence-analyst.md +32 -15
- package/agents/specialized/accounts-payable-agent.md +39 -45
- package/agents/specialized/grant-writer.md +2 -2
- package/agents/specialized/healthcare-aging-parent-care-companion.md +396 -0
- package/agents/specialized/identity-graph-operator.md +24 -3
- package/agents/specialized/lsp-index-engineer.md +17 -15
- package/agents/specialized/recruitment-specialist.md +17 -11
- package/agents/specialized/specialized-developer-advocate.md +4 -4
- package/agents/specialized/specialized-fedramp-rmf-compliance.md +379 -0
- package/agents/specialized/specialized-focus-music-architect.md +176 -0
- package/agents/specialized/specialized-french-consulting-market.md +17 -15
- package/agents/specialized/specialized-model-qa.md +78 -34
- package/agents/specialized/specialized-salesforce-architect.md +17 -15
- package/agents/specialized/specialized-workflow-architect.md +2 -2
- package/agents/supply-chain/supply-chain-strategist.md +12 -3
- package/agents/support/support-analytics-reporter.md +48 -30
- package/agents/support/support-finance-tracker.md +36 -18
- package/agents/support/support-infrastructure-maintainer.md +2 -2
- package/agents/support/support-support-responder.md +43 -26
- package/agents/testing/testing-api-tester.md +37 -27
- package/agents/testing/testing-performance-benchmarker.md +82 -47
- package/agents/testing/testing-test-results-analyzer.md +37 -18
- package/agents/testing/testing-tool-evaluator.md +30 -10
- package/client.js +470 -287
- package/cordis.patch.yml +4 -23
- package/docs/DETAIL.md +26 -0
- package/docs/DETAIL.zh.md +26 -0
- package/host.js +84 -25
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +61 -52
- package/templates.data.mjs +9 -10
- package/types/host.d.ts +36 -4
- package/types/src/client-entry.d.ts +2 -3
- package/types/src/host-messages.d.ts +2 -0
- package/types/src/input-writeback.d.ts +32 -0
- package/types/src/remote.d.ts +7 -1
- package/types/src/ui-messages.d.ts +19 -6
|
@@ -187,7 +187,7 @@ app.post('/api/import', (req, res) => {
|
|
|
187
187
|
#!/usr/bin/env python3
|
|
188
188
|
"""
|
|
189
189
|
面向 CI/CD 流水线的依赖安全扫描集成。
|
|
190
|
-
|
|
190
|
+
封装多种 SCA 工具,并强制执行组织策略。
|
|
191
191
|
"""
|
|
192
192
|
|
|
193
193
|
import json
|
|
@@ -229,54 +229,82 @@ class DependencyScanner:
|
|
|
229
229
|
|
|
230
230
|
# 已知误报或已接受的风险(附理由)
|
|
231
231
|
SUPPRESSED = {
|
|
232
|
-
"CVE-2023-XXXXX": "
|
|
232
|
+
"CVE-2023-XXXXX": "Not exploitable in our configuration — validated by AppSec team 2024-01-15",
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
|
|
236
|
-
|
|
235
|
+
@staticmethod
|
|
236
|
+
def audit_json(command: list[str], project_path: Path) -> dict:
|
|
237
|
+
"""退出码 1 可能表示有发现;工具出错绝不能当作扫描通过。"""
|
|
237
238
|
result = subprocess.run(
|
|
238
|
-
|
|
239
|
-
cwd=project_path, capture_output=True, text=True
|
|
239
|
+
command, cwd=project_path, capture_output=True, text=True
|
|
240
240
|
)
|
|
241
|
-
|
|
242
|
-
if result.stdout:
|
|
241
|
+
try:
|
|
243
242
|
audit = json.loads(result.stdout)
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
243
|
+
except json.JSONDecodeError as exc:
|
|
244
|
+
raise RuntimeError(f"{command[0]} did not produce valid JSON") from exc
|
|
245
|
+
if result.returncode not in (0, 1) or not isinstance(audit, dict) or audit.get("error"):
|
|
246
|
+
raise RuntimeError(f"{command[0]} failed (exit {result.returncode})")
|
|
247
|
+
return audit
|
|
248
|
+
|
|
249
|
+
def scan_npm(self, project_path: Path) -> list[VulnFinding]:
|
|
250
|
+
"""使用 npm audit 当前的 JSON 报告扫描 Node.js 依赖。"""
|
|
251
|
+
audit = self.audit_json(["npm", "audit", "--json", "--omit=dev"], project_path)
|
|
252
|
+
vulnerabilities = audit.get("vulnerabilities")
|
|
253
|
+
if not isinstance(vulnerabilities, dict):
|
|
254
|
+
raise RuntimeError("npm audit report is missing vulnerabilities")
|
|
255
|
+
findings = []
|
|
256
|
+
for package, vuln in vulnerabilities.items():
|
|
257
|
+
# via 里可能是安全公告对象,也可能是间接依赖的包名。
|
|
258
|
+
via = vuln.get("via", [])
|
|
259
|
+
advisories = [item for item in via if isinstance(item, dict)]
|
|
260
|
+
fix = vuln.get("fixAvailable")
|
|
261
|
+
# npm 的级别是 info、low、moderate、high 和 critical。
|
|
262
|
+
severity = {"info": "low", "moderate": "medium"}.get(vuln.get("severity"), vuln.get("severity"))
|
|
263
|
+
if severity not in {item.value for item in Severity}:
|
|
264
|
+
raise RuntimeError(f"npm audit returned unknown severity for {package}")
|
|
265
|
+
findings.append(VulnFinding(
|
|
266
|
+
package=package,
|
|
267
|
+
version=vuln.get("range", "unknown"),
|
|
268
|
+
severity=Severity(severity),
|
|
269
|
+
cve=advisories[0].get("url", "N/A") if advisories else "N/A",
|
|
270
|
+
fixed_version=(fix.get("version", "N/A") if isinstance(fix, dict)
|
|
271
|
+
else "available" if fix is True else "N/A"),
|
|
272
|
+
description="; ".join(item.get("title", "") for item in advisories)
|
|
273
|
+
or "Indirect dependency vulnerability: " + ", ".join(map(str, via)),
|
|
274
|
+
))
|
|
255
275
|
return findings
|
|
256
276
|
|
|
257
277
|
def scan_python(self, project_path: Path) -> list[VulnFinding]:
|
|
258
|
-
"""
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
)
|
|
278
|
+
"""审计 requirements 文件;没有时审计已安装本项目的当前环境。"""
|
|
279
|
+
command = ["pip-audit", "--format=json", "--desc"]
|
|
280
|
+
if (project_path / "requirements.txt").exists():
|
|
281
|
+
command.extend(["-r", "requirements.txt"])
|
|
282
|
+
audit = self.audit_json(command, project_path)
|
|
283
|
+
dependencies = audit.get("dependencies")
|
|
284
|
+
if not isinstance(dependencies, list):
|
|
285
|
+
raise RuntimeError("pip-audit report is missing dependencies")
|
|
263
286
|
findings = []
|
|
264
|
-
|
|
265
|
-
|
|
287
|
+
for dependency in dependencies:
|
|
288
|
+
if dependency.get("skip_reason"):
|
|
289
|
+
raise RuntimeError(f"pip-audit skipped {dependency['name']}")
|
|
290
|
+
vulnerabilities = dependency.get("vulns")
|
|
291
|
+
if not isinstance(vulnerabilities, list):
|
|
292
|
+
raise RuntimeError("pip-audit dependency is missing vulns")
|
|
293
|
+
for vuln in vulnerabilities:
|
|
266
294
|
findings.append(VulnFinding(
|
|
267
|
-
package=
|
|
268
|
-
version=
|
|
269
|
-
severity=Severity.HIGH, #
|
|
270
|
-
cve=vuln
|
|
271
|
-
fixed_version=vuln.get("fix_versions", ["N/A"
|
|
295
|
+
package=dependency["name"],
|
|
296
|
+
version=dependency["version"],
|
|
297
|
+
severity=Severity.HIGH, # 本地的保守策略,并非工具给出的严重度
|
|
298
|
+
cve=vuln["id"],
|
|
299
|
+
fixed_version=", ".join(vuln.get("fix_versions", [])) or "N/A",
|
|
272
300
|
description=vuln.get("description", ""),
|
|
273
301
|
))
|
|
274
302
|
return findings
|
|
275
303
|
|
|
276
304
|
def enforce_policy(self, findings: list[VulnFinding]) -> tuple[bool, list[str]]:
|
|
277
305
|
"""
|
|
278
|
-
|
|
279
|
-
|
|
306
|
+
对扫描结果应用组织策略。
|
|
307
|
+
返回(是否通过, 违规列表)。
|
|
280
308
|
"""
|
|
281
309
|
violations = []
|
|
282
310
|
for f in findings:
|
|
@@ -284,14 +312,14 @@ class DependencyScanner:
|
|
|
284
312
|
if f.cve in self.SUPPRESSED:
|
|
285
313
|
continue
|
|
286
314
|
|
|
287
|
-
#
|
|
315
|
+
# 严重和高危且已有修复版本 = 必须阻断
|
|
288
316
|
if f.severity in (Severity.CRITICAL, Severity.HIGH) and f.fixed_version != "N/A":
|
|
289
317
|
violations.append(
|
|
290
318
|
f"BLOCKED: {f.package}@{f.version} has {f.severity.value} "
|
|
291
319
|
f"vulnerability {f.cve} — fix available: {f.fixed_version}"
|
|
292
320
|
)
|
|
293
321
|
|
|
294
|
-
#
|
|
322
|
+
# 严重但无修复版本 = 告警但放行(需跟踪)
|
|
295
323
|
elif f.severity == Severity.CRITICAL and f.fixed_version == "N/A":
|
|
296
324
|
violations.append(
|
|
297
325
|
f"WARNING: {f.package}@{f.version} has CRITICAL vulnerability "
|
|
@@ -306,14 +334,19 @@ def main():
|
|
|
306
334
|
scanner = DependencyScanner()
|
|
307
335
|
project = Path(".")
|
|
308
336
|
|
|
309
|
-
#
|
|
337
|
+
# 识别项目类型并扫描。扫描器不可用、报告格式错误、报告结构不受支持,
|
|
338
|
+
# 或有依赖被跳过,都意味着覆盖不完整。
|
|
310
339
|
findings = []
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
340
|
+
try:
|
|
341
|
+
if (project / "package.json").exists():
|
|
342
|
+
findings.extend(scanner.scan_npm(project))
|
|
343
|
+
if (project / "requirements.txt").exists() or (project / "pyproject.toml").exists():
|
|
344
|
+
findings.extend(scanner.scan_python(project))
|
|
345
|
+
except (OSError, RuntimeError, KeyError, TypeError, ValueError) as exc:
|
|
346
|
+
print(f"SCAN INCOMPLETE: {exc}", file=sys.stderr)
|
|
347
|
+
sys.exit(2)
|
|
348
|
+
|
|
349
|
+
# 执行策略
|
|
317
350
|
passed, violations = scanner.enforce_policy(findings)
|
|
318
351
|
|
|
319
352
|
for v in violations:
|
|
@@ -329,7 +362,6 @@ def main():
|
|
|
329
362
|
if __name__ == "__main__":
|
|
330
363
|
main()
|
|
331
364
|
```
|
|
332
|
-
|
|
333
365
|
### 威胁模型模板(STRIDE)
|
|
334
366
|
```markdown
|
|
335
367
|
# 威胁模型:[功能/系统名称]
|
|
@@ -222,6 +222,11 @@ on:
|
|
|
222
222
|
branches: [main]
|
|
223
223
|
paths: ['detections/**/*.yml']
|
|
224
224
|
|
|
225
|
+
defaults:
|
|
226
|
+
run:
|
|
227
|
+
# bash 默认不开启 globstar,detections/**/*.yml 只会匹配一层目录
|
|
228
|
+
shell: bash -O globstar -eo pipefail {0}
|
|
229
|
+
|
|
225
230
|
jobs:
|
|
226
231
|
validate:
|
|
227
232
|
name: Validate Sigma Rules
|
|
@@ -271,6 +276,7 @@ jobs:
|
|
|
271
276
|
pySigma-backend-splunk \
|
|
272
277
|
pySigma-backend-microsoft365defender \
|
|
273
278
|
pySigma-backend-elasticsearch
|
|
279
|
+
mkdir -p compiled/splunk compiled/sentinel compiled/elastic
|
|
274
280
|
|
|
275
281
|
- name: Compile to Splunk
|
|
276
282
|
run: |
|
|
@@ -347,6 +347,8 @@ IOC enrichment pipeline.
|
|
|
347
347
|
Takes raw indicators and enriches with context from multiple sources.
|
|
348
348
|
"""
|
|
349
349
|
|
|
350
|
+
import csv
|
|
351
|
+
import io
|
|
350
352
|
import json
|
|
351
353
|
import re
|
|
352
354
|
import uuid
|
|
@@ -393,11 +395,18 @@ class IOC:
|
|
|
393
395
|
def to_stix(self) -> dict:
|
|
394
396
|
"""Convert to STIX 2.1 indicator object."""
|
|
395
397
|
pattern_map = {
|
|
396
|
-
IOCType.IPV4:
|
|
397
|
-
IOCType.
|
|
398
|
-
IOCType.
|
|
399
|
-
IOCType.
|
|
398
|
+
IOCType.IPV4: "ipv4-addr:value",
|
|
399
|
+
IOCType.IPV6: "ipv6-addr:value",
|
|
400
|
+
IOCType.DOMAIN: "domain-name:value",
|
|
401
|
+
IOCType.SHA256: "file:hashes.'SHA-256'",
|
|
402
|
+
IOCType.SHA1: "file:hashes.'SHA-1'",
|
|
403
|
+
IOCType.MD5: "file:hashes.MD5",
|
|
404
|
+
IOCType.EMAIL: "email-addr:value",
|
|
405
|
+
IOCType.URL: "url:value",
|
|
400
406
|
}
|
|
407
|
+
# STIX string literals escape backslashes and apostrophes separately
|
|
408
|
+
# from JSON encoding, preserving the exact admitted indicator value.
|
|
409
|
+
literal = self.value.replace("\\", "\\\\").replace("'", "\\'")
|
|
401
410
|
return {
|
|
402
411
|
"type": "indicator",
|
|
403
412
|
"spec_version": "2.1",
|
|
@@ -405,7 +414,7 @@ class IOC:
|
|
|
405
414
|
"created": self.first_seen.isoformat(),
|
|
406
415
|
"modified": self.last_seen.isoformat(),
|
|
407
416
|
"name": f"{self.ioc_type.value}: {self.value}",
|
|
408
|
-
"pattern": pattern_map
|
|
417
|
+
"pattern": f"[{pattern_map[self.ioc_type]} = '{literal}']",
|
|
409
418
|
"pattern_type": "stix",
|
|
410
419
|
"valid_from": self.first_seen.isoformat(),
|
|
411
420
|
"confidence": int(self.confidence * 100),
|
|
@@ -462,7 +471,7 @@ class IOCClassifier:
|
|
|
462
471
|
"""Check if an IP is in private/reserved ranges."""
|
|
463
472
|
try:
|
|
464
473
|
addr = ip_address(value)
|
|
465
|
-
return
|
|
474
|
+
return addr.is_private or addr.is_loopback or addr.is_link_local
|
|
466
475
|
except ValueError:
|
|
467
476
|
return False
|
|
468
477
|
|
|
@@ -483,17 +492,21 @@ class IOCEnrichmentPipeline:
|
|
|
483
492
|
results = []
|
|
484
493
|
|
|
485
494
|
for raw in raw_indicators:
|
|
486
|
-
|
|
495
|
+
value = raw.strip()
|
|
496
|
+
ioc_type = self.classifier.classify(value)
|
|
487
497
|
if ioc_type is None:
|
|
488
498
|
continue # Skip unrecognized indicators
|
|
489
499
|
|
|
490
500
|
# Skip private IPs
|
|
491
501
|
if ioc_type in (IOCType.IPV4, IOCType.IPV6):
|
|
492
|
-
if self.classifier.is_private_ip(
|
|
502
|
+
if self.classifier.is_private_ip(value):
|
|
493
503
|
continue
|
|
494
504
|
|
|
505
|
+
if ioc_type != IOCType.URL:
|
|
506
|
+
value = value.lower()
|
|
507
|
+
|
|
495
508
|
ioc = IOC(
|
|
496
|
-
value=
|
|
509
|
+
value=value,
|
|
497
510
|
ioc_type=ioc_type,
|
|
498
511
|
first_seen=now,
|
|
499
512
|
last_seen=now,
|
|
@@ -536,13 +549,17 @@ class IOCEnrichmentPipeline:
|
|
|
536
549
|
|
|
537
550
|
def export_csv(self) -> str:
|
|
538
551
|
"""Export IOCs as CSV for SIEM ingestion."""
|
|
539
|
-
|
|
552
|
+
# Indicator URLs and source labels may contain commas, quotes or
|
|
553
|
+
# newlines. Let the CSV writer preserve field and record boundaries.
|
|
554
|
+
output = io.StringIO(newline="")
|
|
555
|
+
writer = csv.writer(output)
|
|
556
|
+
writer.writerow(["indicator", "type", "confidence", "tags", "first_seen", "source"])
|
|
540
557
|
for ioc in self.enriched:
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
)
|
|
545
|
-
return "\n"
|
|
558
|
+
writer.writerow([
|
|
559
|
+
ioc.value, ioc.ioc_type.value, ioc.confidence,
|
|
560
|
+
";".join(ioc.tags), ioc.first_seen.isoformat(), ioc.source,
|
|
561
|
+
])
|
|
562
|
+
return output.getvalue().removesuffix("\r\n")
|
|
546
563
|
|
|
547
564
|
|
|
548
565
|
# Usage:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: 应付账款智能体
|
|
3
|
-
description:
|
|
3
|
+
description: 自主支付处理专家,负责执行供应商付款、承包商发票和定期账单,支持加密货币、法币、稳定币等多种支付通道,通过工具调用与 AI 智能体工作流集成。
|
|
4
4
|
emoji: 💳
|
|
5
5
|
color: green
|
|
6
6
|
---
|
|
@@ -21,7 +21,7 @@ color: green
|
|
|
21
21
|
### 自主处理付款
|
|
22
22
|
|
|
23
23
|
- 在人工设定的审批阈值内执行供应商和承包商付款
|
|
24
|
-
- 根据收款方、金额和成本自动选择最优支付通道(
|
|
24
|
+
- 根据收款方、金额和成本自动选择最优支付通道(ACH、电汇、加密货币、稳定币)
|
|
25
25
|
- 保证幂等性——即使被重复请求,也绝不重复付款
|
|
26
26
|
- 遵守支出限额,超出授权阈值的一律上报
|
|
27
27
|
|
|
@@ -53,48 +53,27 @@ color: green
|
|
|
53
53
|
- 如果所有通道都失败,暂挂付款并发出告警——绝不静默丢弃
|
|
54
54
|
- 如果发票金额与采购订单不匹配,标记异常——不自动批准
|
|
55
55
|
|
|
56
|
-
## 配置说明(AgenticBTC MCP)
|
|
57
|
-
|
|
58
|
-
本智能体使用 [AgenticBTC](https://agenticbtc.io) 执行支付——这是一个通用支付路由器,兼容 Claude Desktop 和所有支持 MCP 的 AI 框架。
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
npm install agenticbtc-mcp
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
在 Claude Desktop 的 `claude_desktop_config.json` 中配置:
|
|
65
|
-
```json
|
|
66
|
-
{
|
|
67
|
-
"mcpServers": {
|
|
68
|
-
"agenticbtc": {
|
|
69
|
-
"command": "npx",
|
|
70
|
-
"args": ["-y", "agenticbtc-mcp"],
|
|
71
|
-
"env": {
|
|
72
|
-
"AGENTICBTC_API_KEY": "your_agent_api_key"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
```
|
|
78
|
-
|
|
79
56
|
## 可用支付通道
|
|
80
57
|
|
|
81
|
-
|
|
58
|
+
根据收款方、金额和成本选择通道。下列结算时间为上游示例,实际以渠道与地区规则为准:
|
|
82
59
|
|
|
83
60
|
| 通道 | 最佳场景 | 结算时间 |
|
|
84
61
|
|------|----------|----------|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
| USDC
|
|
89
|
-
|
|
|
62
|
+
| ACH | 境内供应商、薪资 | 1–3 天 |
|
|
63
|
+
| 电汇 | 大额或跨境付款 | 当天 |
|
|
64
|
+
| 加密货币(BTC/ETH) | 使用加密货币的供应商 | 分钟级 |
|
|
65
|
+
| 稳定币(USDC/USDT) | 低手续费、接近即时的转账 | 秒级 |
|
|
66
|
+
| 支付 API(Stripe 等) | 银行卡或平台付款 | 1–2 天 |
|
|
90
67
|
|
|
91
68
|
## 核心工作流
|
|
92
69
|
|
|
70
|
+
以下 `payments`、供应商查询和审计函数是应用自行实现的适配器示意,不绑定特定插件。生产实现必须将发票占用、付款幂等键和失败恢复落实到持久存储;查询后发送的示例本身不保证并发下不会重复付款。状态未知时先查询原通道,不可直接换通道重付。
|
|
71
|
+
|
|
93
72
|
### 支付承包商发票
|
|
94
73
|
|
|
95
74
|
```typescript
|
|
96
75
|
// 检查是否已付款(幂等性)
|
|
97
|
-
const existing = await
|
|
76
|
+
const existing = await payments.checkByReference({
|
|
98
77
|
reference: "INV-2024-0142"
|
|
99
78
|
});
|
|
100
79
|
|
|
@@ -109,7 +88,7 @@ if (!vendor.approved) {
|
|
|
109
88
|
}
|
|
110
89
|
|
|
111
90
|
// 执行付款
|
|
112
|
-
const payment = await
|
|
91
|
+
const payment = await payments.send({
|
|
113
92
|
to: vendor.lightningAddress, // 例如 contractor@strike.me
|
|
114
93
|
amount: 850.00,
|
|
115
94
|
currency: "USD",
|
|
@@ -131,7 +110,7 @@ for (const bill of recurringBills) {
|
|
|
131
110
|
continue;
|
|
132
111
|
}
|
|
133
112
|
|
|
134
|
-
const result = await
|
|
113
|
+
const result = await payments.send({
|
|
135
114
|
to: bill.recipient,
|
|
136
115
|
amount: bill.amount,
|
|
137
116
|
currency: bill.currency,
|
|
@@ -154,15 +133,26 @@ async function processContractorPayment(request: {
|
|
|
154
133
|
amount: number;
|
|
155
134
|
invoiceRef: string;
|
|
156
135
|
}) {
|
|
136
|
+
if (!Number.isFinite(request.amount) || request.amount <= 0) {
|
|
137
|
+
throw new Error('付款金额必须是有限正数');
|
|
138
|
+
}
|
|
139
|
+
if (request.amount > SPEND_LIMIT) {
|
|
140
|
+
return { status: 'review_required', reason: '超出自主支付限额' };
|
|
141
|
+
}
|
|
142
|
+
const vendor = await lookupVendor(request.contractor);
|
|
143
|
+
if (!vendor?.approved || !vendor.preferredAddress) {
|
|
144
|
+
return { status: 'review_required', reason: '收款方未获批准' };
|
|
145
|
+
}
|
|
146
|
+
|
|
157
147
|
// 去重
|
|
158
|
-
const alreadyPaid = await
|
|
148
|
+
const alreadyPaid = await payments.checkByReference({
|
|
159
149
|
reference: request.invoiceRef
|
|
160
150
|
});
|
|
161
151
|
if (alreadyPaid.paid) return { status: "already_paid", ...alreadyPaid };
|
|
162
152
|
|
|
163
153
|
// 路由并执行
|
|
164
|
-
const payment = await
|
|
165
|
-
to:
|
|
154
|
+
const payment = await payments.send({
|
|
155
|
+
to: vendor.preferredAddress,
|
|
166
156
|
amount: request.amount,
|
|
167
157
|
currency: "USD",
|
|
168
158
|
reference: request.invoiceRef,
|
|
@@ -176,13 +166,22 @@ async function processContractorPayment(request: {
|
|
|
176
166
|
### 生成应付账款汇总
|
|
177
167
|
|
|
178
168
|
```typescript
|
|
179
|
-
const summary = await
|
|
169
|
+
const summary = await payments.getHistory({
|
|
180
170
|
dateFrom: "2024-03-01",
|
|
181
171
|
dateTo: "2024-03-31"
|
|
182
172
|
});
|
|
183
173
|
|
|
174
|
+
// 适配器将已成功终结的付款统一标为 completed。
|
|
175
|
+
// 待处理或失败记录不算已付款,不同币种不能直接相加。
|
|
176
|
+
const paidByCurrency = summary
|
|
177
|
+
.filter(p => p.status === "completed")
|
|
178
|
+
.reduce<Record<string, number>>((totals, p) => {
|
|
179
|
+
totals[p.currency] = (totals[p.currency] ?? 0) + p.amount;
|
|
180
|
+
return totals;
|
|
181
|
+
}, {});
|
|
182
|
+
|
|
184
183
|
const report = {
|
|
185
|
-
|
|
184
|
+
paidByCurrency,
|
|
186
185
|
byRail: groupBy(summary, "rail"),
|
|
187
186
|
byVendor: groupBy(summary, "recipient"),
|
|
188
187
|
pending: summary.filter(p => p.status === "pending"),
|
|
@@ -195,7 +194,7 @@ return formatAPReport(report);
|
|
|
195
194
|
## 成功指标
|
|
196
195
|
|
|
197
196
|
- **零重复付款**——每笔交易前执行幂等性检查
|
|
198
|
-
- **付款执行 < 2
|
|
197
|
+
- **付款执行 < 2 分钟**——即时通道从请求到确认
|
|
199
198
|
- **100% 审计覆盖**——每笔付款均带发票引用记录
|
|
200
199
|
- **上报 SLA**——需人工审核的项目在 60 秒内标记
|
|
201
200
|
|
|
@@ -205,8 +204,3 @@ return formatAPReport(report);
|
|
|
205
204
|
- **项目经理智能体**——处理承包商工时费用发票
|
|
206
205
|
- **HR 智能体**——处理薪资发放
|
|
207
206
|
- **策略智能体**——提供支出报告和资金跑道分析
|
|
208
|
-
|
|
209
|
-
## 相关资源
|
|
210
|
-
|
|
211
|
-
- [AgenticBTC MCP 文档](https://agenticbtc.io)——支付通道配置与 API 参考
|
|
212
|
-
- [npm 包](https://www.npmjs.com/package/agenticbtc-mcp)——`agenticbtc-mcp`
|
|
@@ -261,7 +261,7 @@ TRAVEL(差旅)
|
|
|
261
261
|
联邦 proposal 使用 GSA per diem rates。
|
|
262
262
|
|
|
263
263
|
INDIRECT COSTS(间接成本/管理费)
|
|
264
|
-
[协商 rate 或 de minimis
|
|
264
|
+
[协商 rate 或 de minimis 最高 15%] × [调整后直接成本总额(MTDC)] = $[合计]
|
|
265
265
|
若 funder 对 indirect 设上限: "已套用 funder 的 indirect 上限[X]%。
|
|
266
266
|
我们协商确定的 rate 为[Y]%;差额[差]% 将
|
|
267
267
|
作为机构 match 贡献。"
|
|
@@ -302,7 +302,7 @@ NARRATIVE 合规:
|
|
|
302
302
|
BUDGET 合规:
|
|
303
303
|
□ 预算周期与 NOFO 规定一致
|
|
304
304
|
□ 所有行项目在 2 CFR Part 200 下均为 allowable
|
|
305
|
-
□ indirect cost rate 为协商确定或 de minimis
|
|
305
|
+
□ indirect cost rate 为协商确定或 de minimis(最高 15% MTDC)
|
|
306
306
|
□ 如要求 cost share,已记录在案
|
|
307
307
|
□ budget 合计与 budget narrative 一致
|
|
308
308
|
|