@11agents/cli 0.1.24 → 0.1.25

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.
Files changed (71) hide show
  1. package/README.md +52 -0
  2. package/bin/11agents.js +12 -0
  3. package/mobile-runtime/README.md +19 -0
  4. package/mobile-runtime/configs/platforms/xiaohongshu_d01.json +73 -0
  5. package/mobile-runtime/configs/platforms/xiaohongshu_d02.json +70 -0
  6. package/mobile-runtime/configs/platforms/xiaohongshu_d03.json +73 -0
  7. package/mobile-runtime/configs/publish_policy.json +40 -0
  8. package/mobile-runtime/data-templates/README.md +4 -0
  9. package/mobile-runtime/data-templates/accounts.example.csv +6 -0
  10. package/mobile-runtime/data-templates/devices.example.csv +2 -0
  11. package/mobile-runtime/data-templates/publish_records.example.jsonl +2 -0
  12. package/mobile-runtime/data-templates/tasks.example.jsonl +5 -0
  13. package/mobile-runtime/data-templates/video_metrics.example.jsonl +1 -0
  14. package/mobile-runtime/python/pyproject.toml +34 -0
  15. package/mobile-runtime/python/src/device_control/__init__.py +5 -0
  16. package/mobile-runtime/python/src/device_control/adapters/__init__.py +31 -0
  17. package/mobile-runtime/python/src/device_control/adapters/base.py +43 -0
  18. package/mobile-runtime/python/src/device_control/adapters/facebook.py +30 -0
  19. package/mobile-runtime/python/src/device_control/adapters/instagram.py +25 -0
  20. package/mobile-runtime/python/src/device_control/adapters/reddit.py +29 -0
  21. package/mobile-runtime/python/src/device_control/adapters/tiktok.py +25 -0
  22. package/mobile-runtime/python/src/device_control/adapters/x.py +29 -0
  23. package/mobile-runtime/python/src/device_control/adapters/xiaohongshu.py +26 -0
  24. package/mobile-runtime/python/src/device_control/adb.py +161 -0
  25. package/mobile-runtime/python/src/device_control/appium_client.py +131 -0
  26. package/mobile-runtime/python/src/device_control/appium_manager.py +403 -0
  27. package/mobile-runtime/python/src/device_control/cli.py +1608 -0
  28. package/mobile-runtime/python/src/device_control/entrypoints.py +60 -0
  29. package/mobile-runtime/python/src/device_control/locks.py +162 -0
  30. package/mobile-runtime/python/src/device_control/metrics/__init__.py +33 -0
  31. package/mobile-runtime/python/src/device_control/metrics/collectors.py +320 -0
  32. package/mobile-runtime/python/src/device_control/metrics/tiktok_account_adb.py +367 -0
  33. package/mobile-runtime/python/src/device_control/metrics/tiktok_video_adb.py +714 -0
  34. package/mobile-runtime/python/src/device_control/models.py +439 -0
  35. package/mobile-runtime/python/src/device_control/publish_policy.py +173 -0
  36. package/mobile-runtime/python/src/device_control/publishers/__init__.py +24 -0
  37. package/mobile-runtime/python/src/device_control/publishers/facebook_adb.py +494 -0
  38. package/mobile-runtime/python/src/device_control/publishers/instagram_adb.py +663 -0
  39. package/mobile-runtime/python/src/device_control/publishers/reddit_adb.py +595 -0
  40. package/mobile-runtime/python/src/device_control/publishers/tiktok_adb.py +477 -0
  41. package/mobile-runtime/python/src/device_control/publishers/tiktok_appium.py +259 -0
  42. package/mobile-runtime/python/src/device_control/publishers/ui_helpers.py +372 -0
  43. package/mobile-runtime/python/src/device_control/publishers/x_adb.py +636 -0
  44. package/mobile-runtime/python/src/device_control/publishers/xiaohongshu_adb.py +1143 -0
  45. package/mobile-runtime/python/src/device_control/store.py +137 -0
  46. package/mobile-runtime/scripts/appium_smoke.py +71 -0
  47. package/mobile-runtime/skills/android-collect-tiktok-metrics/SKILL.md +60 -0
  48. package/mobile-runtime/skills/android-collect-tiktok-metrics/agents/openai.yaml +4 -0
  49. package/mobile-runtime/skills/android-group-control-cli/SKILL.md +76 -0
  50. package/mobile-runtime/skills/android-group-control-cli/agents/openai.yaml +4 -0
  51. package/mobile-runtime/skills/android-group-control-cli/references/command-reference.md +122 -0
  52. package/mobile-runtime/skills/android-publish-facebook/SKILL.md +41 -0
  53. package/mobile-runtime/skills/android-publish-facebook/agents/openai.yaml +4 -0
  54. package/mobile-runtime/skills/android-publish-instagram/SKILL.md +45 -0
  55. package/mobile-runtime/skills/android-publish-instagram/agents/openai.yaml +4 -0
  56. package/mobile-runtime/skills/android-publish-reddit/SKILL.md +41 -0
  57. package/mobile-runtime/skills/android-publish-reddit/agents/openai.yaml +4 -0
  58. package/mobile-runtime/skills/android-publish-tiktok/SKILL.md +43 -0
  59. package/mobile-runtime/skills/android-publish-tiktok/agents/openai.yaml +4 -0
  60. package/mobile-runtime/skills/android-publish-x/SKILL.md +40 -0
  61. package/mobile-runtime/skills/android-publish-x/agents/openai.yaml +4 -0
  62. package/mobile-runtime/skills/android-publish-xiaohongshu/SKILL.md +50 -0
  63. package/mobile-runtime/skills/android-publish-xiaohongshu/agents/openai.yaml +4 -0
  64. package/mobile-runtime/skills/mobile-publish-data-collection/SKILL.md +49 -0
  65. package/mobile-runtime/skills/mobile-publish-device-health/SKILL.md +47 -0
  66. package/mobile-runtime/skills/mobile-publish-execution/SKILL.md +57 -0
  67. package/mobile-runtime/skills/mobile-publish-records/SKILL.md +29 -0
  68. package/package.json +4 -1
  69. package/scripts/mobile-postinstall.js +26 -0
  70. package/src/commands/mobile.js +695 -0
  71. package/src/commands/runtime.js +6 -5
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Android TikTok Publisher"
3
+ short_description: "Publish TikTok videos through the Android device-pool CLI"
4
+ default_prompt: "Use $android-publish-tiktok to publish a TikTok video from a managed Android device."
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: android-publish-x
3
+ description: Publish X text, link, and image posts through the bundled 11agents mobile Android runtime. Use `11agents mobile publish-x`; do not expose raw ADB, automate engagement, or bypass platform checks.
4
+ ---
5
+
6
+ # Android X Publishing
7
+
8
+ ## Required Inputs
9
+
10
+ - Approved post type: `text`, `link`, or `image`.
11
+ - Body/link/media fields required by the post type.
12
+ - Target device or range, account id/account prefix when records need it, and live approval or dry-run intent.
13
+ - Logged-in authorized X account.
14
+
15
+ If approval, account access, content fields, or device readiness is missing, ask the user before publishing.
16
+
17
+ ## Workflow
18
+
19
+ ```bash
20
+ 11agents mobile doctor --json
21
+ 11agents mobile list-devices --health --json
22
+ ```
23
+
24
+ Examples:
25
+
26
+ ```bash
27
+ 11agents mobile publish-x --device D03 --post-type text --body "post body" --json --task-id TASK_123
28
+ 11agents mobile publish-x --device D03 --post-type link --body "post body" --link-url "https://example.com" --json --task-id TASK_123
29
+ 11agents mobile publish-x --device D03 --post-type image --body "post body" --image "/path/image.jpg" --json --task-id TASK_123
30
+ ```
31
+
32
+ Do not automate replies, follows, likes, reposts, random browsing, or DM actions from this skill.
33
+
34
+ ## Output
35
+
36
+ Return publish status, record id, account/device, screenshot path, permalink or platform post id when available, duration, error or human action, and the data-collection handoff:
37
+
38
+ ```bash
39
+ 11agents mobile data collect --platform x --record-id <record_id> --json --task-id TASK_123
40
+ ```
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Android X Publisher"
3
+ short_description: "Publish X posts through Android devices"
4
+ default_prompt: "Use $android-publish-x to publish X content from a managed Android device."
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: android-publish-xiaohongshu
3
+ description: Publish Xiaohongshu image and video notes through the bundled 11agents mobile Android runtime. Use `11agents mobile publish-xiaohongshu` and `11agents mobile copy-xiaohongshu-link`; do not expose raw ADB or bypass platform checks.
4
+ ---
5
+
6
+ # Android Xiaohongshu Publishing
7
+
8
+ ## Required Inputs
9
+
10
+ - Approved image/video note or structured publish package.
11
+ - Title, caption/body, tags/topics when available, media paths, target device or range, account id/account prefix, and live approval or dry-run intent.
12
+ - Logged-in authorized Xiaohongshu account and account lifecycle approval.
13
+
14
+ If approval, account lifecycle, media/package path, text fields, or device readiness is missing, ask the user before publishing.
15
+
16
+ ## Workflow
17
+
18
+ ```bash
19
+ 11agents mobile doctor --json
20
+ 11agents mobile list-devices --health --json
21
+ ```
22
+
23
+ Image/video note:
24
+
25
+ ```bash
26
+ 11agents mobile publish-xiaohongshu --device D03 --post-type image --image "/path/image.jpg" --title "title" --caption "body" --json --task-id TASK_123
27
+ 11agents mobile publish-xiaohongshu --device D03 --post-type video --video "/path/video.mp4" --title "title" --caption "body" --json --task-id TASK_123
28
+ ```
29
+
30
+ Structured package:
31
+
32
+ ```bash
33
+ 11agents mobile publish-xiaohongshu --device D03 --publish-package "/path/publish_package.json" --json --task-id TASK_123
34
+ ```
35
+
36
+ Link copy after publish, when requested:
37
+
38
+ ```bash
39
+ 11agents mobile copy-xiaohongshu-link --device D03 --record-id <record_id> --json --task-id TASK_123
40
+ ```
41
+
42
+ Use `--confirm-no-disclosure-needed` only when the approved package/policy explicitly allows it. Stop on login, restriction, verification, disclosure ambiguity, or unexpected UI state.
43
+
44
+ ## Output
45
+
46
+ Return publish status, record id, account/device, screenshot path, note link or platform post id when available, duration, error or human action, and the data-collection handoff:
47
+
48
+ ```bash
49
+ 11agents mobile data collect --platform xiaohongshu --record-id <record_id> --copy-link --json --task-id TASK_123
50
+ ```
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Android Xiaohongshu Publisher"
3
+ short_description: "Publish Xiaohongshu notes through the Android device-pool CLI"
4
+ default_prompt: "Use $android-publish-xiaohongshu to publish Xiaohongshu content from a managed Android device."
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: mobile-publish-data-collection
3
+ description: Use when a mobile publish agent needs to recover post-publish data from Android publish records and feed review learning back to channel agents
4
+ ---
5
+
6
+ # Mobile Publish Data Recovery
7
+
8
+ ## Required Inputs
9
+ - Installed `@11agents/cli` with `11agents mobile setup` completed.
10
+ - Optional `ELEVENAGENTS_MOBILE_HOME` and platform API tokens or export paths provided by the user.
11
+ - Record ids, platform post ids, permalinks, account ids, and target metric windows.
12
+
13
+ If records, platform post id/permalink, or analytics access is missing, ask the user before claiming metrics are available. When paths are absent, default to `~/.11agents/mobile/data/publish_records.jsonl` and `~/.11agents/mobile/data/video_metrics.jsonl`.
14
+
15
+ ## Process
16
+ 1. Verify the runtime and publish records:
17
+
18
+ ```bash
19
+ 11agents mobile doctor --json
20
+ 11agents mobile list-publish-records --json --task-id TASK_ID
21
+ ```
22
+
23
+ 2. Read bundled command guidance when exact metrics commands or record update syntax are needed:
24
+
25
+ ```bash
26
+ 11agents mobile skills show android-group-control-cli
27
+ ```
28
+
29
+ 3. Prefer platform API or existing local collector commands over screenshots for metrics.
30
+ 4. Run high-level metrics commands only:
31
+
32
+ ```bash
33
+ 11agents mobile data collect --platform reddit --record-id <record_id> --json --task-id TASK_ID
34
+ 11agents mobile data collect --platform instagram --record-id <record_id> --json --task-id TASK_ID
35
+ 11agents mobile data collect --platform tiktok --scope account --device Dxx --json --task-id TASK_ID
36
+ 11agents mobile data collect --platform tiktok --scope video --device Dxx --record-id <record_id> --json --task-id TASK_ID
37
+ 11agents mobile data collect --platform xiaohongshu --record-id <record_id> --copy-link --json --task-id TASK_ID
38
+ 11agents mobile data collect --platform x --record-id <record_id> --json --task-id TASK_ID
39
+ 11agents mobile data collect --platform facebook --record-id <record_id> --json --task-id TASK_ID
40
+ 11agents mobile list-metrics --json --task-id TASK_ID
41
+ ```
42
+
43
+ 5. Treat X, Facebook, and unsupported platform collectors that return `missing_access` as a valid recovery status. Ask for the relevant API token, analytics export, or manual values, then append with `11agents mobile add-metrics`.
44
+ 6. If platform metrics are unavailable, record the missing access and ask for the relevant token/export instead of inventing numbers.
45
+ 7. Summarize metrics by platform, account, device, content type, creative pattern, and issue/task id.
46
+ 8. Write reusable learning as `agent_memory_delta` for channel agents.
47
+
48
+ ## Output
49
+ Return recovered links/metrics, missing analytics access, record ids covered, data freshness, run log path, notable performance patterns, and follow-up tasks for planning.
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: mobile-publish-device-health
3
+ description: Use when a mobile publish agent needs to inspect Android device pool health, account state, or human handoff needs
4
+ ---
5
+
6
+ # Mobile Publish Device Health
7
+
8
+ ## Required Inputs
9
+ - Installed `@11agents/cli` with `11agents mobile setup` completed.
10
+ - Optional `ELEVENAGENTS_MOBILE_HOME`. Account/device registries live under `~/.11agents/mobile/data` by default.
11
+ - Target device id, range, platform, app package expectations, and health-check intent. Account id is optional unless the user asks to validate a specific account.
12
+
13
+ If mobile setup, device data, or target device information is missing, ask the user before reporting device readiness. Missing `accounts.csv` must not make an ADB-online device unavailable; report it only as missing account registry metadata.
14
+
15
+ ## Process
16
+ 1. Verify the bundled runtime.
17
+ 2. Verify ADB and device registry with high-level commands:
18
+
19
+ ```bash
20
+ 11agents mobile doctor --json
21
+ 11agents mobile list-adb
22
+ 11agents mobile list-devices --health --json
23
+ ```
24
+
25
+ 3. Select target devices only from current health output where the managed device is active and online.
26
+ 4. If account inventory was requested and `~/.11agents/mobile/data/accounts.csv` exists, check account binding through documented local commands or records. If devices are already logged in and no account registry was requested, verify app/login readiness from device state instead of requiring account metadata.
27
+ 5. Capture screenshots through high-level CLI when a device/account needs human attention:
28
+
29
+ ```bash
30
+ 11agents mobile screenshot Dxx --task-id TASK_ID
31
+ ```
32
+
33
+ 6. Use controlled Appium and ADB-state helpers when a device needs deeper inspection:
34
+
35
+ ```bash
36
+ 11agents mobile ensure-appium --device Dxx --json --task-id TASK_ID
37
+ 11agents mobile dump-ui Dxx --task-id TASK_ID
38
+ 11agents mobile launch Dxx <android.package.name> --task-id TASK_ID
39
+ ```
40
+
41
+ 7. `tap`, `keyevent`, and `input-text` are allowed only through `11agents mobile` for explicit diagnostics, documented recovery steps, or human handoff assistance. Do not run raw `adb shell`.
42
+ 8. Do not return `needs_human` only for camera, microphone, gallery/media, or notification permission prompts when the publish CLI can auto-grant or tap allow for publish-required permissions.
43
+ 9. Return `needs_human` for login prompts, captcha, account restrictions, verification challenges, or unexpected app states that are not permission prompts.
44
+ 10. Do not retry blindly after a restricted or unknown state; preserve screenshot evidence and stop.
45
+
46
+ ## Output
47
+ Return device availability, online status, app readiness, optional account-registry notes, screenshot paths, run log path, blocked devices/accounts, and the exact human action needed. Keep ADB/device availability separate from account metadata availability.
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: mobile-publish-execution
3
+ description: Use when a mobile publish agent needs to prepare or dry-run `11agents mobile` publishing commands
4
+ ---
5
+
6
+ # Mobile Publish Execution
7
+
8
+ ## Required Inputs
9
+ - Approved execution plan or dry-run request.
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`.
12
+ - Media files, captions/titles/body/link fields, target device or range, optional account id/account prefix, and dry-run/live mode.
13
+
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.
15
+
16
+ ## Process
17
+ 1. Verify the bundled runtime:
18
+
19
+ ```bash
20
+ 11agents mobile doctor --json
21
+ ```
22
+
23
+ 2. Read bundled command guidance when exact syntax is needed:
24
+
25
+ ```bash
26
+ 11agents mobile skills show android-group-control-cli
27
+ ```
28
+
29
+ 3. Verify prerequisites with controlled CLI commands:
30
+
31
+ ```bash
32
+ 11agents mobile list-adb
33
+ 11agents mobile list-devices --health --json
34
+ ```
35
+
36
+ 4. Use controlled ADB/Appium utility commands when needed for diagnosis, screenshots, UI state capture, app launch, or human handoff support:
37
+
38
+ ```bash
39
+ 11agents mobile ensure-appium --device Dxx --json
40
+ 11agents mobile screenshot Dxx
41
+ 11agents mobile dump-ui Dxx
42
+ 11agents mobile launch Dxx <android.package.name>
43
+ ```
44
+
45
+ 5. Use `tap`, `keyevent`, and `input-text` only as explicit, traceable `11agents mobile` steps for diagnostics or a documented recovery path; do not expose raw `adb shell` or arbitrary Appium scripts.
46
+ 6. Validate every local media path before a publish command. The path must be reachable from the runtime machine that controls the Android devices.
47
+ 7. Validate the selected platform command supports the requested post type and text fields.
48
+ 8. If no explicit `--account-id` is provided, rely on the command's `--account-prefix` fallback account id for publish records when supported.
49
+ 9. Use `--dry-run` only for preview/test requests; do not add it to explicit live-publish requests.
50
+ 10. Do not stop solely for Android camera, microphone, gallery/media, notification, Reels public-sharing, or Xiaohongshu disclosure prompts when the CLI policy handles them for explicit live publish. Let the CLI return `needs_human` when it cannot safely continue.
51
+ 11. Use `11agents mobile publish-tiktok`, `publish-instagram`, `publish-facebook`, `publish-reddit`, `publish-x`, and `publish-xiaohongshu`.
52
+ 12. Prefer `--json` and parse status, duration, record id, screenshot path, permalink, platform post id, and error.
53
+ 13. Pass `--task-id <task_id>` so logs land at `~/.11agents/mobile/runs/<task_id>/log`.
54
+ 14. Stop on `needs_human` or `failed`; surface screenshot and error instead of repeated retries.
55
+
56
+ ## Output
57
+ 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.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: mobile-publish-records
3
+ description: Use when a mobile publish agent needs to inspect, update, or reconcile Android publish records
4
+ ---
5
+
6
+ # Mobile Publish Records
7
+
8
+ ## Required Inputs
9
+ - Installed `@11agents/cli` with `11agents mobile setup` completed.
10
+ - Optional `ELEVENAGENTS_MOBILE_HOME`; records live under `~/.11agents/mobile/data/publish_records.jsonl` by default.
11
+ - Publish result JSON, record id, platform, account id, device id, screenshot path, permalink/platform post id, and status update intent.
12
+
13
+ If record path, record id, publish result, or update intent is missing, ask the user before modifying records. When no custom mobile home is configured, default to `~/.11agents/mobile/data/publish_records.jsonl`.
14
+
15
+ ## Process
16
+ 1. Verify the mobile runtime and resolve the records path.
17
+ 2. List current records before reconciling:
18
+
19
+ ```bash
20
+ 11agents mobile list-publish-records --json --task-id TASK_ID
21
+ ```
22
+
23
+ 3. Update records only through high-level local commands such as `11agents mobile update-publish-record`.
24
+ 4. Preserve screenshot paths, errors, `needs_human` reasons, duration, account/device, media path, platform post id, permalink, and command family.
25
+ 5. For Reddit permalink lookup, avoid marking app-level success as failed only because public lookup lacks a matching username.
26
+ 6. Hand successful records to Mobile Publish Data Recovery.
27
+
28
+ ## Output
29
+ Return record ids touched, status changes, permalink/post id updates, screenshot evidence, unresolved human handoffs, run log path, and data-recovery next step.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@11agents/cli",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "11agents local runtime and telemetry CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,11 +11,14 @@
11
11
  "bin/",
12
12
  "src/",
13
13
  "!src/**/*.test.js",
14
+ "mobile-runtime/",
15
+ "scripts/",
14
16
  "examples/",
15
17
  "specs/",
16
18
  "README.md"
17
19
  ],
18
20
  "scripts": {
21
+ "postinstall": "node scripts/mobile-postinstall.js",
19
22
  "test": "node --test src/*.test.js src/commands/*.test.js"
20
23
  },
21
24
  "engines": {
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from 'node:child_process'
3
+
4
+ const requested = process.env.ELEVENAGENTS_INSTALL_MOBILE === '1'
5
+ const required = process.env.ELEVENAGENTS_REQUIRE_MOBILE === '1'
6
+
7
+ if (!requested && !required) {
8
+ process.stderr.write('11agents mobile runtime: run `11agents mobile setup` on Android publishing machines.\n')
9
+ process.exit(0)
10
+ }
11
+
12
+ const result = spawnSync(process.execPath, [
13
+ new URL('../bin/11agents.js', import.meta.url).pathname,
14
+ 'mobile',
15
+ 'setup',
16
+ '--json',
17
+ '--quiet',
18
+ ], {
19
+ stdio: 'inherit',
20
+ env: process.env,
21
+ })
22
+
23
+ if (result.status && required) process.exit(result.status)
24
+ if (result.status) {
25
+ process.stderr.write('11agents mobile runtime setup failed; rerun `11agents mobile setup` after installing Python, npm, Android SDK, and ADB.\n')
26
+ }