@11agents/cli 0.1.35 → 0.1.37

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.
@@ -142,6 +142,7 @@ class TikTokAdbPublisher:
142
142
  status="published",
143
143
  )
144
144
  append_publish_record(self.records_path, record)
145
+ self._close_tiktok_best_effort(device, run_dir)
145
146
  return TikTokAdbPublishResult(
146
147
  device_id=device.device_id,
147
148
  status=status,
@@ -242,6 +243,17 @@ class TikTokAdbPublisher:
242
243
  self._ok(self.adb.launch_package(device.adb_serial, TIKTOK_PACKAGE), "launch TikTok")
243
244
  time.sleep(5)
244
245
 
246
+ def _close_tiktok(self, device: Device) -> None:
247
+ self._ok(self.adb.force_stop(device.adb_serial, TIKTOK_PACKAGE), "close TikTok")
248
+
249
+ def _close_tiktok_best_effort(self, device: Device, run_dir: Path) -> None:
250
+ try:
251
+ self._close_tiktok(device)
252
+ time.sleep(1)
253
+ self.adb.screenshot(device.adb_serial, run_dir / "after-app-close.png")
254
+ except Exception:
255
+ pass
256
+
245
257
  def _open_create(self, device: Device, run_dir: Path) -> None:
246
258
  root = self._dump_and_check(device, run_dir, "before-create")
247
259
  create_node = ui.find_node(
@@ -136,6 +136,7 @@ class TikTokAppiumPublisher:
136
136
  status="published",
137
137
  ),
138
138
  )
139
+ self.media_helper._close_tiktok_best_effort(device, run_dir)
139
140
  return TikTokAppiumPublishResult(
140
141
  device_id=device.device_id,
141
142
  status=status,
@@ -357,6 +357,7 @@ class XiaohongshuAdbPublisher:
357
357
  status="published",
358
358
  ),
359
359
  )
360
+ self._close_xiaohongshu_best_effort(device, run_dir)
360
361
  return XiaohongshuAdbPublishResult(
361
362
  device_id=device.device_id,
362
363
  status=status,
@@ -531,9 +532,12 @@ class XiaohongshuAdbPublisher:
531
532
  def _close_xiaohongshu(self, device: Device) -> None:
532
533
  self._ok(self.adb.force_stop(device.adb_serial, self.package), "close Xiaohongshu")
533
534
 
534
- def _close_xiaohongshu_best_effort(self, device: Device) -> None:
535
+ def _close_xiaohongshu_best_effort(self, device: Device, run_dir: Path | None = None) -> None:
535
536
  try:
536
537
  self._close_xiaohongshu(device)
538
+ if run_dir is not None:
539
+ time.sleep(self._wait("after_prompt_dismiss"))
540
+ self.adb.screenshot(device.adb_serial, run_dir / "after-app-close.png")
537
541
  except Exception:
538
542
  pass
539
543
 
@@ -34,6 +34,10 @@ ADB fallback when explicitly requested:
34
34
 
35
35
  Use `--range`, `--parallel`, and `--max-concurrency N` only when the approved plan targets multiple devices. Keep concurrency at or below 5.
36
36
 
37
+ Successful live publish is only confirmed after the CLI taps the publish button and verifies TikTok publish completion. After writing the publish record, the CLI force-stops TikTok and captures `after-app-close.png` in the run artifacts.
38
+
39
+ When the agent environment contains `ELEVENAGENTS_PUBLISH_DINGTALK_WEBHOOK`, the CLI sends a DingTalk notification after status `published`; `ELEVENAGENTS_PUBLISH_DINGTALK_SECRET` is optional. TikTok notification content does not show a link.
40
+
37
41
  ## Output
38
42
 
39
43
  Return publish status, record id, account/device, screenshot path, permalink or platform post id when available, duration, error action, and the data-collection handoff:
@@ -33,7 +33,9 @@ Structured package:
33
33
  11agents mobile publish-xiaohongshu --device D03 --publish-package "/path/publish_package.json" --json --task-id TASK_123
34
34
  ```
35
35
 
36
- Successful live publish is only confirmed after the CLI taps the final publish button, waits without tapping while Xiaohongshu shows upload/progress state, closes and relaunches Xiaohongshu, then opens the "我" page, opens the note whose title matches the expected title or the first visible profile note as a verified fallback, and verifies the detail page against the expected title/body. The CLI recovers the note link by default for live publish; use `--no-copy-link-after-publish` only when link recovery is explicitly not wanted. If that evidence does not match, treat the result as `failed`; do not claim publish success from the publish button tap alone.
36
+ Successful live publish is only confirmed after the CLI taps the final publish button, waits without tapping while Xiaohongshu shows upload/progress state, closes and relaunches Xiaohongshu, then opens the "我" page, opens the note whose title matches the expected title or the first visible profile note as a verified fallback, and verifies the detail page against the expected title/body. The CLI recovers the note link by default for live publish; use `--no-copy-link-after-publish` only when link recovery is explicitly not wanted. After writing the publish record, the CLI force-stops Xiaohongshu and captures `after-app-close.png` in the run artifacts. If that evidence does not match, treat the result as `failed`; do not claim publish success from the publish button tap alone.
37
+
38
+ When the agent environment contains `ELEVENAGENTS_PUBLISH_DINGTALK_WEBHOOK`, the CLI sends a DingTalk notification after status `published`; `ELEVENAGENTS_PUBLISH_DINGTALK_SECRET` is optional. The Xiaohongshu notification includes the recovered link when available and still sends if the link was not recovered.
37
39
 
38
40
  Link copy after publish or during the recovery skill:
39
41
 
@@ -8,7 +8,7 @@ description: Use when a mobile publish agent needs to prepare or dry-run `11agen
8
8
  ## Required Inputs
9
9
  - Approved execution plan or dry-run request.
10
10
  - Installed `@11agents/cli` and completed `11agents mobile setup`.
11
- - Optional placeholders: `ELEVENAGENTS_MOBILE_HOME`, `ELEVENAGENTS_MOBILE_DEFAULT_DEVICE`, `ELEVENAGENTS_MOBILE_DEFAULT_RANGE`, and `ELEVENAGENTS_MOBILE_DEFAULT_MAX_CONCURRENCY`.
11
+ - Optional placeholders: `ELEVENAGENTS_MOBILE_HOME`, `ELEVENAGENTS_MOBILE_DEFAULT_DEVICE`, `ELEVENAGENTS_MOBILE_DEFAULT_RANGE`, `ELEVENAGENTS_MOBILE_DEFAULT_MAX_CONCURRENCY`, `ELEVENAGENTS_PUBLISH_DINGTALK_WEBHOOK`, and `ELEVENAGENTS_PUBLISH_DINGTALK_SECRET`.
12
12
  - Media files, captions/titles/body/link fields, target device or range, optional account id/account prefix, and dry-run/live mode.
13
13
 
14
14
  If mobile setup, device online status, media path, app login readiness, or approval status is missing, ask the user before running commands. Missing account CSV alone is not a blocker when the target app is already logged in on the device.
@@ -51,7 +51,8 @@ If mobile setup, device online status, media path, app login readiness, or appro
51
51
  11. Use `11agents mobile publish-tiktok`, `publish-instagram`, `publish-facebook`, `publish-reddit`, `publish-x`, and `publish-xiaohongshu`.
52
52
  12. Prefer `--json` and parse status, duration, record id, screenshot path, permalink, platform post id, and error.
53
53
  13. Pass `--task-id <task_id>` so logs land at `~/.11agents/mobile/runs/<task_id>/log`.
54
- 14. Stop on `failed`; surface screenshot and error instead of repeated retries.
54
+ 14. Do not run custom DingTalk webhook scripts after Xiaohongshu or TikTok publish. When the agent environment contains `ELEVENAGENTS_PUBLISH_DINGTALK_WEBHOOK`, the CLI sends the publish-success notification automatically; `ELEVENAGENTS_PUBLISH_DINGTALK_SECRET` is optional for signed robots.
55
+ 15. Stop on `failed`; surface screenshot and error instead of repeated retries.
55
56
 
56
57
  ## Output
57
58
  Return readiness status, dry-run result or execution preparation summary, device/app health notes, optional account-registry notes, command family selected, exact safe `11agents mobile` command shape, log path, and missing env placeholders.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@11agents/cli",
3
- "version": "0.1.35",
3
+ "version": "0.1.37",
4
4
  "description": "11agents local runtime and telemetry CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -99,8 +99,9 @@ Runtime:
99
99
  Python/device-control code is bundled with @11agents/cli.
100
100
  Mutable runtime state lives in ~/.11agents/mobile by default.
101
101
  Every command writes logs under ~/.11agents/mobile/runs/<task_id>/log.
102
- Publish-success DingTalk notification is enabled by ELEVENAGENTS_PUBLISH_DINGTALK_WEBHOOK
103
- and optional ELEVENAGENTS_PUBLISH_DINGTALK_SECRET.`)
102
+ Xiaohongshu/TikTok publish-success DingTalk notification is enabled by
103
+ ELEVENAGENTS_PUBLISH_DINGTALK_WEBHOOK and optional
104
+ ELEVENAGENTS_PUBLISH_DINGTALK_SECRET.`)
104
105
  }
105
106
 
106
107
  function mobileHome(flags = {}, env = process.env) {
@@ -597,11 +598,10 @@ async function notifyMobilePublishSuccess({ command, context, parsed, env = proc
597
598
  const config = dingTalkConfig(env)
598
599
  if (!config.webhook || !Array.isArray(parsed)) return
599
600
  const platform = platformFromMobileCommand(command)
600
- if (!platform) return
601
+ if (!shouldNotifyPublishPlatform(platform)) return
601
602
  for (const row of parsed) {
602
603
  if (!isPublishedResult(row)) continue
603
604
  const link = publishResultLink(row)
604
- if (!link) continue
605
605
  const content = buildPublishNotificationContent({
606
606
  platform,
607
607
  task: context.taskTitle || context.taskId,
@@ -623,8 +623,20 @@ async function notifyMobilePublishSuccess({ command, context, parsed, env = proc
623
623
 
624
624
  function dingTalkConfig(env = process.env) {
625
625
  return {
626
- webhook: env.ELEVENAGENTS_PUBLISH_DINGTALK_WEBHOOK || env.ELEVENAGENTS_DINGTALK_WEBHOOK || '',
627
- secret: env.ELEVENAGENTS_PUBLISH_DINGTALK_SECRET || env.ELEVENAGENTS_DINGTALK_SECRET || '',
626
+ webhook: env.ELEVENAGENTS_PUBLISH_DINGTALK_WEBHOOK
627
+ || env.ELEVENAGENTS_DINGTALK_WEBHOOK
628
+ || env.GTM_DINGTALK_WEBHOOK
629
+ || env.DINGTALK_WEBHOOK
630
+ || '',
631
+ secret: env.ELEVENAGENTS_PUBLISH_DINGTALK_SECRET
632
+ || env.ELEVENAGENTS_PUBLISH_DINGTALK_KEY
633
+ || env.ELEVENAGENTS_DINGTALK_SECRET
634
+ || env.ELEVENAGENTS_DINGTALK_KEY
635
+ || env.GTM_DINGTALK_SECRET
636
+ || env.GTM_DINGTALK_KEY
637
+ || env.DINGTALK_SECRET
638
+ || env.DINGTALK_KEY
639
+ || '',
628
640
  }
629
641
  }
630
642
 
@@ -644,6 +656,10 @@ function isPublishedResult(row) {
644
656
  return row && typeof row === 'object' && row.status === 'published'
645
657
  }
646
658
 
659
+ function shouldNotifyPublishPlatform(platform) {
660
+ return platform === 'xiaohongshu' || platform === 'tiktok'
661
+ }
662
+
647
663
  function publishResultLink(row) {
648
664
  return String(
649
665
  row.platform_permalink
@@ -658,7 +674,9 @@ function buildPublishNotificationContent({ platform, task, deviceId = '', link }
658
674
  const label = platformLabel(platform)
659
675
  const taskText = String(task || 'task').trim()
660
676
  const deviceText = deviceId ? `(设备 ${deviceId})` : ''
661
- return `${label} ${taskText}${deviceText}已发布,链接:${link}`
677
+ if (platform === 'tiktok') return `${label} ${taskText}${deviceText}已发布`
678
+ const linkText = String(link || '').trim() || '未回收'
679
+ return `${label} ${taskText}${deviceText}已发布,链接:${linkText}`
662
680
  }
663
681
 
664
682
  function platformLabel(platform) {
@@ -831,6 +849,7 @@ export const mobileInternals = {
831
849
  parseRawArgs,
832
850
  platformFromMobileCommand,
833
851
  publishResultLink,
852
+ shouldNotifyPublishPlatform,
834
853
  signedDingTalkUrl,
835
854
  stripWrapperFlags,
836
855
  taskIdFrom,