1688-cli 0.1.41 → 0.1.43
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/AGENTS.md +112 -318
- package/ARCHITECTURE.md +107 -0
- package/CHANGELOG.md +79 -0
- package/README.md +186 -18
- package/dist/cli.js +131 -25
- package/dist/cli.js.map +1 -1
- package/dist/commands/cart-list.js +2 -1
- package/dist/commands/cart-list.js.map +1 -1
- package/dist/commands/checkout-confirm.js +8 -8
- package/dist/commands/checkout-confirm.js.map +1 -1
- package/dist/commands/compare.js +107 -0
- package/dist/commands/compare.js.map +1 -0
- package/dist/commands/doctor.js +64 -47
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/inbox.js +1 -1
- package/dist/commands/inbox.js.map +1 -1
- package/dist/commands/login.js +14 -14
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.js +6 -4
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/offer.js +7 -5
- package/dist/commands/offer.js.map +1 -1
- package/dist/commands/order-list.js +4 -2
- package/dist/commands/order-list.js.map +1 -1
- package/dist/commands/order-logistics.js +4 -2
- package/dist/commands/order-logistics.js.map +1 -1
- package/dist/commands/profile.js +25 -9
- package/dist/commands/profile.js.map +1 -1
- package/dist/commands/research.js +142 -0
- package/dist/commands/research.js.map +1 -0
- package/dist/commands/search.js +59 -18
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/seller-chat.js +1 -1
- package/dist/commands/seller-chat.js.map +1 -1
- package/dist/commands/seller-inquire.js +1 -1
- package/dist/commands/seller-inquire.js.map +1 -1
- package/dist/commands/seller-messages.js +8 -5
- package/dist/commands/seller-messages.js.map +1 -1
- package/dist/commands/sourcing-utils.js +438 -0
- package/dist/commands/sourcing-utils.js.map +1 -0
- package/dist/commands/supplier-inspect.js +559 -0
- package/dist/commands/supplier-inspect.js.map +1 -0
- package/dist/commands/supplier-search.js +522 -0
- package/dist/commands/supplier-search.js.map +1 -0
- package/dist/commands/whoami.js +6 -3
- package/dist/commands/whoami.js.map +1 -1
- package/dist/daemon/client.js +10 -6
- package/dist/daemon/client.js.map +1 -1
- package/dist/daemon/manager.js +53 -37
- package/dist/daemon/manager.js.map +1 -1
- package/dist/daemon/protocol.js +2 -1
- package/dist/daemon/protocol.js.map +1 -1
- package/dist/daemon/server.js +26 -22
- package/dist/daemon/server.js.map +1 -1
- package/dist/session/context.js +1 -1
- package/dist/session/context.js.map +1 -1
- package/dist/session/dispatch.js +25 -22
- package/dist/session/dispatch.js.map +1 -1
- package/dist/session/im-ws.js +8 -5
- package/dist/session/im-ws.js.map +1 -1
- package/dist/session/lock.js +14 -14
- package/dist/session/lock.js.map +1 -1
- package/dist/session/paths.js +50 -16
- package/dist/session/paths.js.map +1 -1
- package/dist/session/search-mtop.js +53 -0
- package/dist/session/search-mtop.js.map +1 -1
- package/dist/session/shared.js +17 -7
- package/dist/session/shared.js.map +1 -1
- package/dist/session/state.js +7 -7
- package/dist/session/state.js.map +1 -1
- package/dist/session/supplier-search.js +403 -0
- package/dist/session/supplier-search.js.map +1 -0
- package/dist/util/encoding.js +8 -0
- package/dist/util/encoding.js.map +1 -0
- package/dist/util/temp.js +6 -0
- package/dist/util/temp.js.map +1 -0
- package/docs/AGENT_MAPS_PLAN.md +171 -0
- package/docs/AGENT_WORKING_PRINCIPLES.md +143 -0
- package/docs/COMMANDS.md +205 -0
- package/docs/FEATURES.md +45 -0
- package/docs/JSON_CONTRACTS.md +476 -0
- package/docs/QUALITY_SCORE.md +61 -0
- package/docs/README.md +36 -0
- package/docs/RELIABILITY.md +69 -0
- package/docs/SAFETY.md +99 -0
- package/docs/WORKFLOW.md +82 -0
- package/docs/exec-plans/README.md +9 -0
- package/docs/exec-plans/active/README.md +4 -0
- package/docs/exec-plans/completed/2026-05-28-sourcing-research-v1.md +125 -0
- package/docs/exec-plans/completed/2026-05-31-supplier-inspect-v1.md +113 -0
- package/docs/exec-plans/completed/2026-06-04-supplier-search-v1.md +81 -0
- package/docs/exec-plans/completed/2026-06-07-windows-cli-compatibility.md +138 -0
- package/docs/exec-plans/completed/2026-06-16-profile-daemon.md +146 -0
- package/docs/exec-plans/completed/README.md +4 -0
- package/docs/exec-plans/tech-debt-tracker.md +5 -0
- package/docs/generated/command-index.md +54 -0
- package/docs/generated/json-shapes.md +111 -0
- package/docs/generated/module-map.md +13 -0
- package/docs/generated/test-index.md +34 -0
- package/docs/playbooks/add-command.md +15 -0
- package/docs/playbooks/add-mtop-capture.md +13 -0
- package/docs/playbooks/change-json-output.md +11 -0
- package/docs/playbooks/debug-risk-control.md +12 -0
- package/docs/playbooks/update-cli-release.md +61 -0
- package/docs/records/release-omissions.md +34 -0
- package/docs/specs/checkout-and-orders.md +30 -0
- package/docs/specs/index.md +9 -0
- package/docs/specs/profile-daemon.md +114 -0
- package/docs/specs/seller-im.md +28 -0
- package/docs/specs/sourcing-research.md +186 -0
- package/docs/specs/supplier-inspect.md +144 -0
- package/docs/specs/supplier-search.md +179 -0
- package/docs/specs/windows-cli-compatibility.md +123 -0
- package/package.json +21 -4
- package/scripts/check_agent_map.mjs +87 -0
- package/scripts/check_release.mjs +40 -0
- package/scripts/fix_bin_mode.mjs +18 -0
- package/scripts/generate_agent_context.mjs +253 -0
- package/scripts/postinstall.mjs +12 -4
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Plan: Profile Daemon
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
Deliver profile-scoped daemon mode for `1688-cli`: one daemon, persistent
|
|
6
|
+
browser context, lock, and runtime artifact set per profile, with default
|
|
7
|
+
profile compatibility and deterministic verification.
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
- Source spec: `docs/specs/profile-daemon.md`.
|
|
12
|
+
- Read first:
|
|
13
|
+
- `AGENTS.md`
|
|
14
|
+
- `ARCHITECTURE.md`
|
|
15
|
+
- `docs/WORKFLOW.md`
|
|
16
|
+
- `docs/COMMANDS.md`
|
|
17
|
+
- `docs/JSON_CONTRACTS.md`
|
|
18
|
+
- `docs/SAFETY.md`
|
|
19
|
+
- `docs/RELIABILITY.md`
|
|
20
|
+
- `docs/playbooks/add-command.md`
|
|
21
|
+
- `src/session/paths.ts`
|
|
22
|
+
- `src/session/lock.ts`
|
|
23
|
+
- `src/session/context.ts`
|
|
24
|
+
- `src/session/shared.ts`
|
|
25
|
+
- `src/session/dispatch.ts`
|
|
26
|
+
- `src/daemon/client.ts`
|
|
27
|
+
- `src/daemon/manager.ts`
|
|
28
|
+
- `src/daemon/server.ts`
|
|
29
|
+
- `src/commands/login.ts`
|
|
30
|
+
- `src/commands/doctor.ts`
|
|
31
|
+
- `src/commands/profile.ts`
|
|
32
|
+
- `src/cli.ts`
|
|
33
|
+
- `tests/paths.test.ts`
|
|
34
|
+
- `tests/profile.test.ts`
|
|
35
|
+
- `tests/doctor.test.ts`
|
|
36
|
+
|
|
37
|
+
## Non-goals
|
|
38
|
+
|
|
39
|
+
- Do not implement a multi-profile daemon process.
|
|
40
|
+
- Do not change checkout confirmation safety.
|
|
41
|
+
- Do not run external live login/search/browser flows during verification.
|
|
42
|
+
- Do not introduce new dependencies.
|
|
43
|
+
- Do not refactor unrelated command behavior.
|
|
44
|
+
|
|
45
|
+
## Design
|
|
46
|
+
|
|
47
|
+
Use one profile-bound daemon process per profile. The profile is resolved to
|
|
48
|
+
`default` at the edge and then passed through path helpers, locks, daemon
|
|
49
|
+
client/manager/server, shared context, dispatch, login, doctor, and profile
|
|
50
|
+
status.
|
|
51
|
+
|
|
52
|
+
Runtime artifacts become profile-scoped via centralized helpers. Non-Windows
|
|
53
|
+
sockets live under a profile runtime directory; Windows named pipes include the
|
|
54
|
+
root hash plus a profile-derived hash/slug so profiles do not collide.
|
|
55
|
+
|
|
56
|
+
`dispatch` no longer treats `opts.profile` as a daemon skip condition. It
|
|
57
|
+
connects to the selected profile daemon, auto-starts or refreshes only that
|
|
58
|
+
daemon, and falls back inline only for that profile. Headed mode, `noDaemon`,
|
|
59
|
+
and `BB1688_NO_DAEMON=1` still skip daemon dispatch.
|
|
60
|
+
|
|
61
|
+
Inline fallback pauses only the selected profile daemon before opening an
|
|
62
|
+
inline context on that profile. Other profile daemons continue running.
|
|
63
|
+
|
|
64
|
+
`login --profile` writes profile-scoped state and attempts to start that
|
|
65
|
+
profile daemon unless `--no-daemon` is set. `doctor --profile` and
|
|
66
|
+
`profile status <name>` read profile-scoped state, lock, and daemon status.
|
|
67
|
+
|
|
68
|
+
Docs and generated indexes are updated because command flags, daemon behavior,
|
|
69
|
+
and source/test layout behavior changed.
|
|
70
|
+
|
|
71
|
+
## Checklist
|
|
72
|
+
|
|
73
|
+
- [x] Create spec/index and active ExecPlan for profile-scoped daemon work.
|
|
74
|
+
- [x] Implement profile-scoped path helpers and lock acquisition.
|
|
75
|
+
- [x] Thread profile through session context, shared daemon context, daemon
|
|
76
|
+
client, daemon manager, and daemon server.
|
|
77
|
+
- [x] Update dispatch so explicit `--profile` uses the corresponding daemon and
|
|
78
|
+
inline fallback pauses only that profile daemon.
|
|
79
|
+
- [x] Update CLI daemon/serve commands, login auto-start, doctor checks, and
|
|
80
|
+
profile status to use selected profile state and diagnostics.
|
|
81
|
+
- [x] Update deterministic tests for paths, profile status, doctor, and daemon
|
|
82
|
+
profile plumbing.
|
|
83
|
+
- [x] Update durable docs and regenerate generated context.
|
|
84
|
+
- [x] Run focused and final verification, review diff, and record results.
|
|
85
|
+
|
|
86
|
+
## Verification
|
|
87
|
+
|
|
88
|
+
- `pnpm typecheck`
|
|
89
|
+
- `pnpm test:unit`
|
|
90
|
+
- `pnpm agent-context`
|
|
91
|
+
- `pnpm docs-check`
|
|
92
|
+
- `pnpm agent-map-check`
|
|
93
|
+
- `pnpm agent-verify`
|
|
94
|
+
|
|
95
|
+
## Decisions
|
|
96
|
+
|
|
97
|
+
- 2026-06-16: Use one daemon process per profile instead of one daemon managing
|
|
98
|
+
many browser contexts, matching the request and current daemon architecture.
|
|
99
|
+
- 2026-06-16: Keep `checkout-confirm` daemon-blocked; profile daemon support
|
|
100
|
+
does not weaken checkout safety.
|
|
101
|
+
- 2026-06-16: Use deterministic local verification only; live 1688 browser
|
|
102
|
+
checks require user/session state and are out of scope for automated tests.
|
|
103
|
+
|
|
104
|
+
## Progress Log
|
|
105
|
+
|
|
106
|
+
- 2026-06-16: `/to-done` readiness path selected: clear complex request with no
|
|
107
|
+
existing matching durable spec or active plan, so create full spec and full
|
|
108
|
+
active ExecPlan before implementation.
|
|
109
|
+
- 2026-06-16: `/run` execution strategy selected. Goal tracking preference:
|
|
110
|
+
prefer Codex /goal. Goal tracking result: Codex /goal. Delegation: none.
|
|
111
|
+
Reason: the active plan has one objective, scoped non-goals, deterministic
|
|
112
|
+
verification, and an adaptive validation loop. Subagents skipped because the
|
|
113
|
+
core daemon/session files are tightly coupled and should be edited/reviewed
|
|
114
|
+
by the primary agent. Completed checklist item: durable spec/index and active
|
|
115
|
+
ExecPlan created.
|
|
116
|
+
- 2026-06-16: Implemented profile-scoped runtime helpers for socket, pid,
|
|
117
|
+
version, log, state, and lock artifacts. Default artifacts remain compatible
|
|
118
|
+
at the historical root paths; non-default profiles use their profile runtime
|
|
119
|
+
directory. Windows daemon pipes now include a profile hash.
|
|
120
|
+
- 2026-06-16: Threaded profile through locks, inline sessions, shared daemon
|
|
121
|
+
browser context, daemon client/manager/server, dispatch, login auto-start,
|
|
122
|
+
doctor, profile status, whoami state writes, seller/inbox state reads, and
|
|
123
|
+
checkout-confirm daemon pause/resume.
|
|
124
|
+
- 2026-06-16: Updated durable docs (`ARCHITECTURE.md`, `docs/COMMANDS.md`,
|
|
125
|
+
`docs/JSON_CONTRACTS.md`, `docs/RELIABILITY.md`, `docs/SAFETY.md`,
|
|
126
|
+
`docs/QUALITY_SCORE.md`) and refreshed generated context with
|
|
127
|
+
`pnpm agent-context`.
|
|
128
|
+
- 2026-06-16: Review result: diff stayed within the profile daemon spec and
|
|
129
|
+
plan; checkout confirmation remains daemon-blocked and approval behavior is
|
|
130
|
+
unchanged. A small doctor indentation/readability issue found during diff
|
|
131
|
+
review was fixed before final verification.
|
|
132
|
+
- 2026-06-16: Verification passed:
|
|
133
|
+
`pnpm typecheck`;
|
|
134
|
+
`pnpm vitest run tests/paths.test.ts tests/state.test.ts tests/profile.test.ts tests/doctor.test.ts --exclude tests/doctor-live.test.ts`;
|
|
135
|
+
`pnpm test:unit`;
|
|
136
|
+
`pnpm agent-context`;
|
|
137
|
+
`pnpm agent-verify`.
|
|
138
|
+
Final `pnpm agent-verify` passed with 27 test files and 174 deterministic
|
|
139
|
+
tests, fresh generated context, passing agent-map check, and passing release
|
|
140
|
+
check. No blockers or new open questions remain.
|
|
141
|
+
|
|
142
|
+
## Rollback
|
|
143
|
+
|
|
144
|
+
Revert the profile daemon changes in `src/session`, `src/daemon`,
|
|
145
|
+
`src/commands`, `src/cli.ts`, tests, and docs. Existing profile browser data
|
|
146
|
+
under `~/.1688/profiles/<name>` is not modified by rollback.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Command Index
|
|
2
|
+
|
|
3
|
+
_Generated by `scripts/generate_agent_context.mjs`._
|
|
4
|
+
|
|
5
|
+
| Command | Source | Arguments | Options | Description |
|
|
6
|
+
|---|---|---|---|---|
|
|
7
|
+
| `login` | `src/commands/login.ts` | - | `--force`<br>`--timeout <seconds>`<br>`--profile <name>`<br>`--headed`<br>`--no-daemon` | Log in to 1688 by scanning a QR code (auto-starts daemon afterwards) |
|
|
8
|
+
| `search` | `src/commands/search.ts` | `<keyword>` | `--max <n>`<br>`--sort <sort>`<br>`--price-min <n>`<br>`--price-max <n>`<br>`--province <name>`<br>`--city <name>`<br>`--verified <kind>`<br>`--min-turnover <n>`<br>`--exclude-ads`<br>`--profile <name>`<br>`--headed` | Search 1688 by keyword |
|
|
9
|
+
| `research` | `src/commands/research.ts` | `<keywords...>` | `--max-per-query <n>`<br>`--sort <sort>`<br>`--price-min <n>`<br>`--price-max <n>`<br>`--province <name>`<br>`--city <name>`<br>`--verified <kind>`<br>`--min-turnover <n>`<br>`--exclude-ads`<br>`--enrich <spec>`<br>`--jsonl`<br>`--csv`<br>`--output <file>`<br>`--profile <name>`<br>`--headed` | Run multi-keyword sourcing research with scoring and optional enrichment |
|
|
10
|
+
| `compare` | `src/commands/compare.ts` | `<offerIds...>` | `--csv`<br>`--output <file>`<br>`--profile <name>`<br>`--headed` | Compare multiple offer detail pages for sourcing decisions |
|
|
11
|
+
| `supplier` | - | - | - | - |
|
|
12
|
+
| `supplier inspect` | `src/commands/supplier-inspect.ts` | `<target>` | `--profile <name>`<br>`--headed` | Inspect supplier signals from an offerId or b2b-* memberId |
|
|
13
|
+
| `supplier search` | `src/commands/supplier-search.ts` | `<keywords...>` | `--max <n>`<br>`--factory-only`<br>`--province <name>`<br>`--city <name>`<br>`--min-years <n>`<br>`--min-repeat-rate <n>`<br>`--min-response-rate <n>`<br>`--enrich <spec>`<br>`--jsonl`<br>`--csv`<br>`--output <file>`<br>`--profile <name>`<br>`--headed` | Search suppliers from 1688 company search |
|
|
14
|
+
| `supplier research` | `src/commands/supplier-search.ts` | `<keywords...>` | `--max <n>`<br>`--factory-only`<br>`--province <name>`<br>`--city <name>`<br>`--min-years <n>`<br>`--min-repeat-rate <n>`<br>`--min-response-rate <n>`<br>`--enrich <spec>`<br>`--jsonl`<br>`--csv`<br>`--output <file>`<br>`--profile <name>`<br>`--headed` | Run supplier research from 1688 company search with scoring and inspect enrichment |
|
|
15
|
+
| `image-search` | `src/commands/image-search.ts` | `<imagePathOrUrl>` | `--max <n>`<br>`--profile <name>`<br>`--headed` | Search 1688 by image (local file or http(s) URL) |
|
|
16
|
+
| `offer` | `src/commands/offer.ts` | `<offerId>` | `--profile <name>`<br>`--headed` | Show details of a single 1688 offer |
|
|
17
|
+
| `similar` | `src/commands/similar.ts` | `<offerId>` | `--max <n>`<br>`--profile <name>`<br>`--headed` | Find similar / 找同款 offers for a given offerId (compare suppliers, sorted by price), |
|
|
18
|
+
| `inbox` | `src/commands/inbox.ts` | - | `--limit <n>`<br>`--unread`<br>`--profile <name>`<br>`--headed` | List recent 旺旺 IM conversations (newest first) |
|
|
19
|
+
| `seller` | - | - | - | Seller communication (旺旺 IM |
|
|
20
|
+
| `seller inquire` | `src/commands/seller-inquire.ts` | `<offerId>`<br>`<message>` | `--to <sellerLoginId>`<br>`--profile <name>`<br>`--headed` | Pre-sale inquiry: send a product link question to seller (requires prior chat or --to), |
|
|
21
|
+
| `seller messages` | `src/commands/seller-messages.ts` | `[target]` | `--offer <offerId>`<br>`--limit <n>`<br>`--since <iso>`<br>`--watch`<br>`--interval <seconds>`<br>`--profile <name>`<br>`--headed` | Read recent messages from a seller conversation |
|
|
22
|
+
| `seller chat` | `src/commands/seller-chat.ts` | `<target>`<br>`<message>` | `--no-card`<br>`--prefix`<br>`--profile <name>`<br>`--headed` | Send to seller. With orderId: sends order card link message (use --no-card for follow-ups |
|
|
23
|
+
| `checkout` | - | - | - | - |
|
|
24
|
+
| `checkout confirm` | `src/commands/checkout-confirm.ts` | `<cartIds...>` | `-y, --yes`<br>`--agent`<br>`--profile <name>` | Place an order for selected cart items. Default: TTY prompt. --agent: no prompt after external approval., |
|
|
25
|
+
| `checkout prepare` | `src/commands/checkout-prepare.ts` | `<cartIds...>` | `--profile <name>`<br>`--headed` | Preview total/address/items for a checkout (does NOT place order) |
|
|
26
|
+
| `cart` | - | - | - | - |
|
|
27
|
+
| `cart add` | `src/commands/cart-add.ts` | `<offerId>` | `--sku <skuId>`<br>`--qty <n>`<br>`--profile <name>`<br>`--headed` | Add one item to cart (UI replay, ~15s) |
|
|
28
|
+
| `cart remove` | `src/commands/cart-remove.ts` | `<cartId>` | `--profile <name>`<br>`--headed` | Remove one item from cart by cartId (UI replay, ~10s) |
|
|
29
|
+
| `cart list` | `src/commands/cart-list.ts` | - | `--profile <name>`<br>`--headed` | List items in your cart |
|
|
30
|
+
| `shipped` | `src/commands/workflows.ts` | `<orderId>` | `--profile <name>`<br>`--headed` | Combined order detail logistics for one orderId |
|
|
31
|
+
| `stuck` | `src/commands/workflows.ts` | - | `--days <n>`<br>`--limit <n>`<br>`--profile <name>`<br>`--headed` | Orders paid but not shipped after N days (default 3) |
|
|
32
|
+
| `fake-shipped` | `src/commands/workflows.ts` | - | `--days <n>`<br>`--max-pages <n>`<br>`--max-check <n>`<br>`--limit <n>`<br>`--debug`<br>`--profile <name>`<br>`--headed` | Orders marked shipped but logistics frozen at 等待揽收 (likely 虚假发货) |
|
|
33
|
+
| `seller-history` | `src/commands/workflows.ts` | `<seller>` | `--max-pages <n>`<br>`--profile <name>`<br>`--headed` | All orders from a seller avg shipping days on-time rate |
|
|
34
|
+
| `order` | - | - | - | - |
|
|
35
|
+
| `order logistics` | `src/commands/order-logistics.ts` | `<orderId>` | `--max-scan-pages <n>`<br>`--status <s>`<br>`--profile <name>`<br>`--headed` | Show shipping status tracking number for an order |
|
|
36
|
+
| `order get` | `src/commands/order-get.ts` | `<orderId>` | `--max-scan-pages <n>`<br>`--status <s>`<br>`--profile <name>`<br>`--headed` | Show one order by orderId (scans recent pages) |
|
|
37
|
+
| `order list` | `src/commands/order-list.ts` | - | `--status <s>`<br>`--page <n>`<br>`--page-size <n>`<br>`--profile <name>`<br>`--headed` | List buyer orders |
|
|
38
|
+
| `whoami` | `src/commands/whoami.ts` | - | `--verify`<br>`--profile <name>` | Show the current logged-in account |
|
|
39
|
+
| `logout` | `src/commands/logout.ts` | - | `-y, --yes`<br>`--profile <name>` | Log out and clear local session |
|
|
40
|
+
| `doctor` | `src/commands/doctor.ts` | - | `--no-launch`<br>`--live`<br>`--profile <name>` | Check environment, profile, Chromium, and session |
|
|
41
|
+
| `serve` | - | - | `--profile <name>`<br>`--idle-timeout <minutes>`<br>`--no-prewarm` | Run the 1688 daemon in the foreground |
|
|
42
|
+
| `daemon` | - | - | - | - |
|
|
43
|
+
| `daemon start` | - | - | `--profile <name>` | Start the daemon as a background process |
|
|
44
|
+
| `daemon stop` | - | - | `--profile <name>` | Stop the running daemon |
|
|
45
|
+
| `daemon reload` | - | - | `--profile <name>` | Restart the daemon (stop start) to pick up new code |
|
|
46
|
+
| `daemon status` | - | - | `--profile <name>` | Show daemon status |
|
|
47
|
+
| `profile` | - | - | - | - |
|
|
48
|
+
| `profile list` | `src/commands/profile.ts` | - | - | List local profiles |
|
|
49
|
+
| `profile status` | `src/commands/profile.ts` | `[name]` | - | Show profile status |
|
|
50
|
+
| `debug` | - | - | - | - |
|
|
51
|
+
| `debug list` | `src/commands/debug.ts` | - | `--limit <n>`<br>`--failed` | List recent command events |
|
|
52
|
+
| `debug last` | `src/commands/debug.ts` | - | `--failed` | Show the most recent command event |
|
|
53
|
+
| `debug show` | `src/commands/debug.ts` | `<requestId>` | - | Show events and artifact location for a request |
|
|
54
|
+
| `feedback` | `src/commands/feedback.ts` | `<message...>` | `--bug`<br>`--submit`<br>`--no-open`<br>`--json`<br>`--json-v2`<br>`--pretty`<br>`--get <path>`<br>`--pick <paths>` | Submit feedback or a bug report. Default: opens a pre-filled GitHub issue. With --submit: posts directly via the gh CLI., |
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# JSON Shapes
|
|
2
|
+
|
|
3
|
+
_Generated by `scripts/generate_agent_context.mjs`._
|
|
4
|
+
|
|
5
|
+
This is a heuristic index of exported TypeScript interfaces that are likely to matter for agent-facing JSON.
|
|
6
|
+
|
|
7
|
+
| Interface | File | Notable Fields |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `CartAddArgs` | `src/commands/cart-add.ts` | `offerId: string;`<br>`skuId: string;`<br>`quantity: number;`<br>`headed?: boolean;` |
|
|
10
|
+
| `CartAddOpts` | `src/commands/cart-add.ts` | `offerId: string;`<br>`sku?: string;`<br>`qty?: string;`<br>`profile?: string;`<br>`headed?: boolean;` |
|
|
11
|
+
| `CartAddResult` | `src/commands/cart-add.ts` | `ok: boolean;`<br>`confirmationStatus: 'confirmed';`<br>`added: CartItem;`<br>`/** True when a brand-new cart row was created. False when the SKU was`<br>`isNewRow: boolean;`<br>`/** Actual quantity added by this call. For a new row it equals`<br>`addedQuantity: number;` |
|
|
12
|
+
| `CartItem` | `src/commands/cart-list.ts` | `cartId: string;`<br>`offerId: string;`<br>`skuId: string \| null;`<br>`productTitle: string;`<br>`skuTitle: string \| null;`<br>`unit: string \| null;`<br>`quantity: number;`<br>`unitPrice: number;`<br>`amount: number;`<br>`minQuantity: number \| null;`<br>`maxQuantity: number \| null;`<br>`image: string \| null;`<br>`checked: boolean;`<br>`effective: boolean;` |
|
|
13
|
+
| `CartListArgs` | `src/commands/cart-list.ts` | `headed?: boolean;` |
|
|
14
|
+
| `CartListOpts` | `src/commands/cart-list.ts` | `profile?: string;`<br>`headed?: boolean;` |
|
|
15
|
+
| `CartListResult` | `src/commands/cart-list.ts` | `total: number;`<br>`selectedCount: number;`<br>`items: CartItem[];` |
|
|
16
|
+
| `CartRemoveArgs` | `src/commands/cart-remove.ts` | `cartId: string;`<br>`headed?: boolean;` |
|
|
17
|
+
| `CartRemoveOpts` | `src/commands/cart-remove.ts` | `cartId: string;`<br>`profile?: string;`<br>`headed?: boolean;` |
|
|
18
|
+
| `CartRemoveResult` | `src/commands/cart-remove.ts` | `ok: boolean;`<br>`removed: CartItem;` |
|
|
19
|
+
| `CheckoutConfirmArgs` | `src/commands/checkout-confirm.ts` | `cartIds: string[];`<br>`headed?: boolean;` |
|
|
20
|
+
| `CheckoutConfirmOpts` | `src/commands/checkout-confirm.ts` | `cartIds: string[];`<br>`yes?: boolean;`<br>`agent?: boolean;`<br>`profile?: string;` |
|
|
21
|
+
| `CheckoutConfirmResult` | `src/commands/checkout-confirm.ts` | `ok: boolean;`<br>`placed: boolean;`<br>`finalUrl: string;`<br>`orderId: string \| null;`<br>`message: string;`<br>`preview: CheckoutPrepareResult;` |
|
|
22
|
+
| `CheckoutPrepareArgs` | `src/commands/checkout-prepare.ts` | `cartIds: string[];`<br>`headed?: boolean;` |
|
|
23
|
+
| `CheckoutPrepareOpts` | `src/commands/checkout-prepare.ts` | `cartIds: string[];`<br>`profile?: string;`<br>`headed?: boolean;` |
|
|
24
|
+
| `CheckoutPrepareResult` | `src/commands/checkout-prepare.ts` | `ok: boolean;`<br>`url: string;`<br>`totalAmount: number;`<br>`productAmount: number;`<br>`shippingAmount: number;`<br>`taxAmount: number;`<br>`receiveAddress: {`<br>`fullName: string \| null;`<br>`mobile: string \| null;`<br>`address: string \| null;`<br>`region: string \| null;`<br>`orders: PrepareOrder[];` |
|
|
25
|
+
| `PrepareOrder` | `src/commands/checkout-prepare.ts` | `seller: {`<br>`memberId: string \| null;`<br>`loginId: string \| null;`<br>`companyName: string \| null;`<br>`totalAmount: number;`<br>`productAmount: number;`<br>`shippingAmount: number;`<br>`items: PrepareItem[];` |
|
|
26
|
+
| `CompareOpts` | `src/commands/compare.ts` | `offerIds: string[];`<br>`csv?: boolean;`<br>`output?: string;`<br>`profile?: string;`<br>`headed?: boolean;` |
|
|
27
|
+
| `CompareResult` | `src/commands/compare.ts` | `total: number;`<br>`ok: number;`<br>`failed: number;`<br>`items: CompareItem[];` |
|
|
28
|
+
| `DebugLastOpts` | `src/commands/debug.ts` | `failed?: boolean;` |
|
|
29
|
+
| `DebugListOpts` | `src/commands/debug.ts` | `limit?: string;`<br>`failed?: boolean;` |
|
|
30
|
+
| `DebugShowOpts` | `src/commands/debug.ts` | `requestId: string;` |
|
|
31
|
+
| `DoctorOpts` | `src/commands/doctor.ts` | `launch?: boolean;`<br>`live?: boolean;`<br>`profile?: string;` |
|
|
32
|
+
| `FeedbackOpts` | `src/commands/feedback.ts` | `message?: string;`<br>`bug?: boolean;`<br>`open?: boolean;`<br>`submit?: boolean;` |
|
|
33
|
+
| `FeedbackResult` | `src/commands/feedback.ts` | `url: string;`<br>`title: string;`<br>`bodyPreview: string;`<br>`submitted: boolean;` |
|
|
34
|
+
| `ImageSearchArgs` | `src/commands/image-search.ts` | `imagePath: string;`<br>`max: number;`<br>`headed?: boolean;` |
|
|
35
|
+
| `ImageSearchOpts` | `src/commands/image-search.ts` | `imagePath: string;`<br>`max?: string;`<br>`profile?: string;`<br>`headed?: boolean;` |
|
|
36
|
+
| `ImageSearchResult` | `src/commands/image-search.ts` | `imageId: string;`<br>`total: number;`<br>`offers: Offer[];` |
|
|
37
|
+
| `InboxArgs` | `src/commands/inbox.ts` | `limit: number;`<br>`unreadOnly: boolean;`<br>`myLoginId: string;`<br>`myMemberId: string;`<br>`headed?: boolean;` |
|
|
38
|
+
| `InboxOpts` | `src/commands/inbox.ts` | `limit?: string;`<br>`unread?: boolean;`<br>`profile?: string;`<br>`headed?: boolean;` |
|
|
39
|
+
| `InboxResult` | `src/commands/inbox.ts` | `myLoginId: string;`<br>`myMemberId: string;`<br>`conversations: Conversation[];`<br>`nextCursor: number \| null;`<br>`truncated: boolean;` |
|
|
40
|
+
| `LoginOpts` | `src/commands/login.ts` | `force?: boolean;`<br>`timeout?: string;`<br>`profile?: string;`<br>`headed?: boolean;`<br>`noDaemon?: boolean;` |
|
|
41
|
+
| `LogoutOpts` | `src/commands/logout.ts` | `yes?: boolean;`<br>`profile?: string;` |
|
|
42
|
+
| `OfferArgs` | `src/commands/offer.ts` | `offerId: string;`<br>`headed?: boolean;` |
|
|
43
|
+
| `OfferOpts` | `src/commands/offer.ts` | `offerId: string;`<br>`profile?: string;`<br>`headed?: boolean;` |
|
|
44
|
+
| `OfferResult` | `src/commands/offer.ts` | `offerId: string;`<br>`title: string;`<br>`url: string;`<br>`priceRange: string \| null;`<br>`priceMin: number \| null;`<br>`priceMax: number \| null;`<br>`/** Display unit ("件" / "个" / "米" ...) */`<br>`unitName: string \| null;`<br>`/** 起订量 — minimum order quantity for a single SKU buy. */`<br>`minOrderQty: number \| null;`<br>`/** 混批起订量 — minimum quantity when mixing SKUs in one order. */`<br>`mixOrderQty: number \| null;`<br>`/** Bulk-discount tiers, e.g. [{minQty: 1, price: 4.16}, {minQty: 100, price: 3.50}]. */`<br>`priceTiers: PriceTier[];` |
|
|
45
|
+
| `PriceTier` | `src/commands/offer.ts` | `minQty: number;`<br>`price: number;` |
|
|
46
|
+
| `ProductAttribute` | `src/commands/offer.ts` | `name: string;`<br>`value: string;` |
|
|
47
|
+
| `SkuOption` | `src/commands/offer.ts` | `prop: string;`<br>`values: { name: string; imageUrl: string \| null }[];` |
|
|
48
|
+
| `SkuPackage` | `src/commands/offer.ts` | `skuId: string;`<br>`spec: string;`<br>`/** cm */`<br>`length: number \| null;`<br>`width: number \| null;`<br>`height: number \| null;`<br>`/** Stated weight (raw value — 1688 sometimes uses grams or kg per offer). */`<br>`weight: number \| null;`<br>`/** Volume (cm³). */`<br>`volume: number \| null;` |
|
|
49
|
+
| `SkuVariant` | `src/commands/offer.ts` | `skuId: string;`<br>`specs: string;`<br>`price: number \| null;`<br>`/** Bulk-tier price when 1688 surfaces a separate multi-piece price. */`<br>`multiPrice: number \| null;`<br>`stock: number \| null;`<br>`saleCount: number;`<br>`/** Best-effort image URL derived from the first option (颜色/款式) match. */`<br>`image: string \| null;` |
|
|
50
|
+
| `OrderGetArgs` | `src/commands/order-get.ts` | `orderId: string;`<br>`maxScanPages: number;`<br>`/** Narrow scan to a specific tradeStatus when known — much faster for`<br>`statusHint?: string;`<br>`headed?: boolean;` |
|
|
51
|
+
| `OrderGetOpts` | `src/commands/order-get.ts` | `orderId: string;`<br>`maxScanPages?: string;`<br>`status?: string;`<br>`profile?: string;`<br>`headed?: boolean;` |
|
|
52
|
+
| `Order` | `src/commands/order-list.ts` | `orderId: string;`<br>`status: string;`<br>`statusLabel: string;`<br>`bizType: string \| null; // "cb" / "pc" / ...`<br>`createdAt: string;`<br>`paidAt: string \| null;`<br>`shippedAt: string \| null;`<br>`confirmGoodsTime: string \| null;`<br>`totalAmount: number;`<br>`productAmount: number;`<br>`shipping: number;`<br>`originalAmount: number; // before any promotions`<br>`discountAmount: number; // sum of all promotions applied`<br>`adjustment: number; // seller manual price adjustment (改价)` |
|
|
53
|
+
| `OrderAction` | `src/commands/order-list.ts` | `key: string; // permissionKey, e.g. "canBuyerRefund"`<br>`name: string; // display name, e.g. "申请退款"`<br>`url: string \| null;`<br>`highlight: boolean;` |
|
|
54
|
+
| `OrderItem` | `src/commands/order-list.ts` | `entryId: string;`<br>`productName: string;`<br>`spec: string;`<br>`quantity: number;`<br>`unitPrice: number;`<br>`amount: number;`<br>`image: string \| null;`<br>`productNumber: string \| null;` |
|
|
55
|
+
| `OrderListArgs` | `src/commands/order-list.ts` | `status: string;`<br>`page: number;`<br>`pageSize: number;`<br>`headed?: boolean;` |
|
|
56
|
+
| `OrderListOpts` | `src/commands/order-list.ts` | `status?: string;`<br>`page?: string;`<br>`pageSize?: string;`<br>`profile?: string;`<br>`headed?: boolean;` |
|
|
57
|
+
| `OrderListResult` | `src/commands/order-list.ts` | `status: string;`<br>`page: number;`<br>`pageSize: number;`<br>`totalPages: number;`<br>`totalOrders: number;`<br>`orders: Order[];` |
|
|
58
|
+
| `OrderService` | `src/commands/order-list.ts` | `productName: string;`<br>`category: string; // "insurance" / "refund" / ...`<br>`payer: string; // "seller" / "buyer"`<br>`detailLink: string \| null;` |
|
|
59
|
+
| `OrderStep` | `src/commands/order-list.ts` | `status: string;`<br>`name: string;`<br>`paid: number;`<br>`goods: number;`<br>`postage: number;` |
|
|
60
|
+
| `OrderLogisticsArgs` | `src/commands/order-logistics.ts` | `orderId: string;`<br>`maxScanPages: number;`<br>`/** Narrow the scan to one tradeStatus (e.g. "waitbuyerreceive") when known —`<br>`statusHint?: string;`<br>`headed?: boolean;` |
|
|
61
|
+
| `OrderLogisticsOpts` | `src/commands/order-logistics.ts` | `orderId: string;`<br>`maxScanPages?: string;`<br>`status?: string;`<br>`profile?: string;`<br>`headed?: boolean;` |
|
|
62
|
+
| `OrderLogisticsResult` | `src/commands/order-logistics.ts` | `orderId: string;`<br>`found: boolean;`<br>`trace: LogisticsTrace[];` |
|
|
63
|
+
| `ResearchOpts` | `src/commands/research.ts` | `keywords: string[];`<br>`maxPerQuery?: string;`<br>`sort?: string;`<br>`priceMin?: string;`<br>`priceMax?: string;`<br>`province?: string;`<br>`city?: string;`<br>`verified?: string;`<br>`minTurnover?: string;`<br>`excludeAds?: boolean;`<br>`enrich?: string;`<br>`jsonl?: boolean;`<br>`csv?: boolean;`<br>`output?: string;` |
|
|
64
|
+
| `ResearchResult` | `src/commands/research.ts` | `queries: string[];`<br>`sort: SearchSort;`<br>`filters: SearchFilterSummary;`<br>`maxPerQuery: number;`<br>`enrichTop: number;`<br>`total: number;`<br>`enrichedCount: number;`<br>`items: ResearchItem[];` |
|
|
65
|
+
| `SearchArgs` | `src/commands/search.ts` | `keyword: string;`<br>`max: number;`<br>`sort?: SearchSort;`<br>`filters?: SearchFilterSummary;`<br>`headed?: boolean;` |
|
|
66
|
+
| `SearchOpts` | `src/commands/search.ts` | `max?: string;`<br>`sort?: string;`<br>`priceMin?: string;`<br>`priceMax?: string;`<br>`province?: string;`<br>`city?: string;`<br>`verified?: string;`<br>`minTurnover?: string;`<br>`excludeAds?: boolean;`<br>`profile?: string;`<br>`headed?: boolean;` |
|
|
67
|
+
| `SearchResult` | `src/commands/search.ts` | `keyword: string;`<br>`sort: SearchSort;`<br>`filters: SearchFilterSummary;`<br>`totalBeforeFilter: number;`<br>`total: number;`<br>`offers: Offer[];` |
|
|
68
|
+
| `SellerChatArgs` | `src/commands/seller-chat.ts` | `/** Display name(s) to find seller in 旺旺 sidebar — try in order */`<br>`searchNames: string[];`<br>`/** Seller loginId (raw, no cnalichn prefix) for order/offer-context URL */`<br>`sellerLoginId?: string;`<br>`/** Order ID — passed in URL to trigger order-scoped conversation */`<br>`orderId?: string;`<br>`/** Offer ID — passed in URL to trigger pre-sale (offer-scoped) conversation */`<br>`offerId?: string;`<br>`myLoginId: string;`<br>`message: string;`<br>`headed?: boolean;` |
|
|
69
|
+
| `SellerChatOpts` | `src/commands/seller-chat.ts` | `target?: string;`<br>`message: string;`<br>`prefix?: boolean;`<br>`/** Skip sending order card link before message (use for follow-up replies) */`<br>`noCard?: boolean;`<br>`profile?: string;`<br>`headed?: boolean;` |
|
|
70
|
+
| `SellerChatResult` | `src/commands/seller-chat.ts` | `ok: boolean;`<br>`sentTo: string;`<br>`message: string;`<br>`sentAt: string;` |
|
|
71
|
+
| `SellerInquireOpts` | `src/commands/seller-inquire.ts` | `offerId: string;`<br>`message: string;`<br>`to?: string; // explicit seller loginId`<br>`profile?: string;`<br>`headed?: boolean;` |
|
|
72
|
+
| `Message` | `src/commands/seller-messages.ts` | `sender: string;`<br>`time: string \| null;`<br>`isMine: boolean;`<br>`content: string;`<br>`read: boolean;`<br>`/** Type of message — auto-detected from DOM. */`<br>`kind: MessageKind;`<br>`/** Populated when kind === 'offerCard' or 'orderCard'. */`<br>`card?: {`<br>`title: string \| null;`<br>`price: string \| null;`<br>`image: string \| null;`<br>`url: string \| null;`<br>`/** Server-side message ID (only present when sourced from WS). Used for` |
|
|
73
|
+
| `SellerMessagesArgs` | `src/commands/seller-messages.ts` | `searchNames: string[];`<br>`sellerLoginId?: string;`<br>`orderId?: string;`<br>`offerId?: string;`<br>`myLoginId: string;`<br>`limit: number;`<br>`headed?: boolean;` |
|
|
74
|
+
| `SellerMessagesOpts` | `src/commands/seller-messages.ts` | `target?: string;`<br>`offer?: string;`<br>`limit?: string;`<br>`since?: string;`<br>`watch?: boolean;`<br>`interval?: string;`<br>`profile?: string;`<br>`headed?: boolean;` |
|
|
75
|
+
| `SellerMessagesResult` | `src/commands/seller-messages.ts` | `conversation: string;`<br>`total: number;`<br>`messages: Message[];` |
|
|
76
|
+
| `SimilarArgs` | `src/commands/similar.ts` | `offerId: string;`<br>`max: number;`<br>`headed?: boolean;` |
|
|
77
|
+
| `SimilarOpts` | `src/commands/similar.ts` | `offerId: string;`<br>`max?: string;`<br>`profile?: string;`<br>`headed?: boolean;` |
|
|
78
|
+
| `SimilarResult` | `src/commands/similar.ts` | `offerId: string;`<br>`total: number;`<br>`offers: Offer[];` |
|
|
79
|
+
| `OfferDetailSummary` | `src/commands/sourcing-utils.ts` | `offerId: string;`<br>`title: string;`<br>`url: string;`<br>`priceMin: number \| null;`<br>`priceMax: number \| null;`<br>`unitName: string \| null;`<br>`minOrderQty: number \| null;`<br>`mixOrderQty: number \| null;`<br>`priceTiers: PriceTier[];`<br>`saledCount: number \| null;`<br>`categoryId: string \| null;`<br>`supplier: OfferResult['supplier'];`<br>`skuCount: number;`<br>`totalStock: number \| null;` |
|
|
80
|
+
| `SupplierInspectArgs` | `src/commands/supplier-inspect.ts` | `target: string;`<br>`headed?: boolean;` |
|
|
81
|
+
| `SupplierInspectOpts` | `src/commands/supplier-inspect.ts` | `target: string;`<br>`profile?: string;`<br>`headed?: boolean;` |
|
|
82
|
+
| `SupplierInspectResult` | `src/commands/supplier-inspect.ts` | `target: SupplierTarget;`<br>`supplier: {`<br>`name: string \| null;`<br>`loginId: string \| null;`<br>`memberId: string \| null;`<br>`userId: string \| null;`<br>`companyId: string \| null;`<br>`shopUrl: string \| null;`<br>`shopUrls: Record<string, string>;`<br>`identity: string \| null;`<br>`signs: Record<string, boolean>;`<br>`factory: {`<br>`isFactory: boolean;`<br>`superFactory: boolean;` |
|
|
83
|
+
| `SupplierResearchOpts` | `src/commands/supplier-search.ts` | - |
|
|
84
|
+
| `SupplierSearchArgs` | `src/commands/supplier-search.ts` | `keywords: string[];`<br>`maxPerQuery: number;`<br>`enrichTop?: number;`<br>`filters?: SupplierFilters;`<br>`headed?: boolean;` |
|
|
85
|
+
| `SupplierSearchOpts` | `src/commands/supplier-search.ts` | `keywords: string[];`<br>`max?: string;`<br>`enrich?: string;`<br>`factoryOnly?: boolean;`<br>`province?: string;`<br>`city?: string;`<br>`minYears?: string;`<br>`minRepeatRate?: string;`<br>`minResponseRate?: string;`<br>`jsonl?: boolean;`<br>`csv?: boolean;`<br>`output?: string;`<br>`profile?: string;`<br>`headed?: boolean;` |
|
|
86
|
+
| `SupplierSearchResult` | `src/commands/supplier-search.ts` | `queries: string[];`<br>`source: {`<br>`kind: 'company-search';`<br>`endpoint: 'companySearchBusinessService';`<br>`offerAggregation: false;`<br>`filters: SupplierFilters;`<br>`maxPerQuery: number;`<br>`enrichTop: number;`<br>`totalBeforeFilter: number;`<br>`total: number;`<br>`enrichedCount: number;`<br>`items: SupplierSearchItem[];` |
|
|
87
|
+
| `WhoamiArgs` | `src/commands/whoami.ts` | `verify?: boolean;`<br>`profile?: string;` |
|
|
88
|
+
| `WhoamiOpts` | `src/commands/whoami.ts` | `verify?: boolean;`<br>`profile?: string;` |
|
|
89
|
+
| `WhoamiResult` | `src/commands/whoami.ts` | `loggedIn: boolean;`<br>`memberId?: string;`<br>`nick?: string \| null;`<br>`lastVerifiedAt?: string \| null;` |
|
|
90
|
+
| `FakeShippedOpts` | `src/commands/workflows.ts` | `days?: string;`<br>`limit?: string;`<br>`maxPages?: string;`<br>`maxCheck?: string;`<br>`debug?: boolean;` |
|
|
91
|
+
| `SellerHistoryOpts` | `src/commands/workflows.ts` | `seller: string;`<br>`maxPages?: string;` |
|
|
92
|
+
| `ShippedOpts` | `src/commands/workflows.ts` | `orderId: string;` |
|
|
93
|
+
| `StuckOpts` | `src/commands/workflows.ts` | `days?: string;`<br>`limit?: string;` |
|
|
94
|
+
| `SessionOpts` | `src/session/context.ts` | `headless: boolean;`<br>`profile?: string;` |
|
|
95
|
+
| `DispatchOpts` | `src/session/dispatch.ts` | `headed?: boolean;`<br>`profile?: string;`<br>`noDaemon?: boolean;` |
|
|
96
|
+
| `DecodedMessage` | `src/session/im-cards.ts` | `kind: MessageKind;`<br>`preview: string;`<br>`/** Set when `kind === 'card'`. Semantic name when known, `'unknown'` otherwise. */`<br>`cardTemplate?: CardTemplate;`<br>`/** Raw 6-digit template code (`170002`, `467001`, …). Always present for cards. */`<br>`cardCode?: string;`<br>`/** Populated only when at least one field resolved — keep JSON output compact. */`<br>`extras?: MessageExtras;` |
|
|
97
|
+
| `MessageExtras` | `src/session/im-cards.ts` | `/** Trade order id parsed from card link, if any. */`<br>`orderId?: string;`<br>`/** Offer (product) id parsed from card link, if any. */`<br>`offerId?: string;`<br>`/** Refund / 退货 id, if any. */`<br>`refundId?: string;`<br>`/** Product / order thumbnail URL. */`<br>`imgUrl?: string;`<br>`/** Clickthrough URL embedded in the card. */`<br>`linkUrl?: string;`<br>`/** Display string such as "订单金额:¥4.90" or "¥0.04". */`<br>`amount?: string;` |
|
|
98
|
+
| `RawImMessage` | `src/session/im-cards.ts` | `content?: {`<br>`contentType?: number;`<br>`text?: { content?: string };`<br>`custom?: {`<br>`summary?: string;`<br>`data?: string;`<br>`title?: string;`<br>`extension?: {`<br>`biMsgType?: string;`<br>`dynamic_msg_content?: string;` |
|
|
99
|
+
| `StableLocatorResult` | `src/session/locator.ts` | `strategy: string;`<br>`description: string;` |
|
|
100
|
+
| `ResponseCaptureActionResult` | `src/session/response-capture.ts` | `actionResult: TResult;`<br>`response: T \| null;`<br>`diagnostics: ResponseCaptureDiagnostics;` |
|
|
101
|
+
| `ResponseCaptureEmptyResult` | `src/session/response-capture.ts` | `at: string;`<br>`url: string;` |
|
|
102
|
+
| `SearchOfferCaptureDiagnostics` | `src/session/search-capture.ts` | `startedAt: string;`<br>`endedAt?: string;`<br>`disposed: boolean;`<br>`finalStatus?: SearchOfferCaptureWaitStatus;`<br>`timedOut: boolean;`<br>`seenCount: number;`<br>`matchedCount: number;`<br>`parsedCount: number;`<br>`failureCount: number;`<br>`lastSeenUrl?: string;`<br>`lastMatchedUrl?: string;`<br>`lastParsedUrl?: string;`<br>`lastError?: { name?: string; message: string };`<br>`failures: SearchOfferCaptureFailure[];` |
|
|
103
|
+
| `SearchOfferCaptureFailure` | `src/session/search-capture.ts` | `at: string;`<br>`url: string;`<br>`name?: string;`<br>`message: string;` |
|
|
104
|
+
| `SearchOfferCaptureOptions` | `src/session/search-capture.ts` | `page: Page;`<br>`requireMethod?: string;`<br>`targetPage?: () => number;`<br>`keep?: 'first' \| 'largest';` |
|
|
105
|
+
| `SearchOfferCaptureResult` | `src/session/search-capture.ts` | `actionResult: TResult;`<br>`status: SearchOfferCaptureWaitStatus;`<br>`offers: Offer[];`<br>`diagnostics: SearchOfferCaptureDiagnostics;` |
|
|
106
|
+
| `SearchOfferCaptureWaitOptions` | `src/session/search-capture.ts` | `timeoutMs: number;`<br>`intervalMs?: number;`<br>`isBlocked?: () => boolean \| Promise<boolean>;`<br>`isClosed?: () => boolean;` |
|
|
107
|
+
| `SearchOfferCaptureWaitResult` | `src/session/search-capture.ts` | `status: SearchOfferCaptureWaitStatus;`<br>`offers: Offer[];`<br>`diagnostics: SearchOfferCaptureDiagnostics;` |
|
|
108
|
+
| `Offer` | `src/session/search-mtop.ts` | `offerId: string;`<br>`title: string;`<br>`price: { text: string; min: number \| null; max: number \| null };`<br>`supplier: {`<br>`name: string \| null;`<br>`shopUrl: string \| null;`<br>`years: number \| null;`<br>`location: { province: string \| null; city: string \| null };`<br>`bizType: string \| null;`<br>`verified: { factory: boolean; business: boolean; superFactory: boolean };`<br>`tags: string[];`<br>`serviceTags?: string[];`<br>`productBadges?: string[];`<br>`demand?: {` |
|
|
109
|
+
| `RawOfferItem` | `src/session/search-mtop.ts` | `cellType?: string;`<br>`data?: {`<br>`offerId?: string;`<br>`title?: string;`<br>`priceInfo?: { price?: string };`<br>`offerPicUrl?: string;`<br>`loginId?: string;`<br>`memberId?: string;`<br>`province?: string;`<br>`city?: string;`<br>`bookedCount?: string;`<br>`repurchaseRate?: string;`<br>`repurchaseRateText?: string;`<br>`orderCount?: string \| number;` |
|
|
110
|
+
| `SupplierOfferPreview` | `src/session/supplier-search.ts` | `offerId: string \| null;`<br>`title: string;`<br>`url: string \| null;`<br>`price: { text: string \| null; value: number \| null };`<br>`unit: string \| null;`<br>`image: string \| null;`<br>`bookedCount: number \| null;`<br>`saleQuantity: number \| null;`<br>`quantitySumMonth: number \| null;`<br>`brief: string \| null;` |
|
|
111
|
+
| `SupplierSearchCaptureWaitResult` | `src/session/supplier-search.ts` | `status: SupplierSearchCaptureWaitStatus;`<br>`data: SupplierSearchServiceData \| null;`<br>`diagnostics: SupplierSearchCaptureDiagnostics;` |
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Module Map
|
|
2
|
+
|
|
3
|
+
_Generated by `scripts/generate_agent_context.mjs`._
|
|
4
|
+
|
|
5
|
+
| Directory | Source Files | Related Tests | Notes |
|
|
6
|
+
|---|---:|---:|---|
|
|
7
|
+
| `src` | 1 | 0 | - |
|
|
8
|
+
| `src/auth` | 2 | 1 | login/session/cookie helpers |
|
|
9
|
+
| `src/commands` | 29 | 5 | command executors and renderers |
|
|
10
|
+
| `src/daemon` | 5 | 0 | background daemon client/server/protocol |
|
|
11
|
+
| `src/io` | 3 | 10 | output, prompts, and errors |
|
|
12
|
+
| `src/session` | 27 | 11 | browser/session automation helpers |
|
|
13
|
+
| `src/util` | 3 | 0 | shared utilities |
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Test Index
|
|
2
|
+
|
|
3
|
+
_Generated by `scripts/generate_agent_context.mjs`._
|
|
4
|
+
|
|
5
|
+
| Test File | Focus | Risk Notes |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| `tests/artifacts.test.ts` | artifacts | live/session-sensitive, browser/page-state, fixture/parser |
|
|
8
|
+
| `tests/config.test.ts` | config | live/session-sensitive, fixture/parser |
|
|
9
|
+
| `tests/cookies.test.ts` | cookies | live/session-sensitive, browser/page-state |
|
|
10
|
+
| `tests/debug.test.ts` | debug | live/session-sensitive |
|
|
11
|
+
| `tests/doctor-live.test.ts` | doctor-live | live/session-sensitive |
|
|
12
|
+
| `tests/doctor.test.ts` | doctor | live/session-sensitive |
|
|
13
|
+
| `tests/events.test.ts` | events | live/session-sensitive, browser/page-state |
|
|
14
|
+
| `tests/fix-bin-mode.test.ts` | fix-bin-mode | - |
|
|
15
|
+
| `tests/im-cards.test.ts` | im-cards | live/session-sensitive, fixture/parser |
|
|
16
|
+
| `tests/inbox.test.ts` | inbox | live/session-sensitive |
|
|
17
|
+
| `tests/locator.test.ts` | locator | browser/page-state |
|
|
18
|
+
| `tests/mtop.test.ts` | mtop | fixture/parser |
|
|
19
|
+
| `tests/navigation-guard.test.ts` | navigation-guard | live/session-sensitive |
|
|
20
|
+
| `tests/output.test.ts` | output | - |
|
|
21
|
+
| `tests/page-state.test.ts` | page-state | live/session-sensitive, browser/page-state |
|
|
22
|
+
| `tests/paths.test.ts` | paths | live/session-sensitive |
|
|
23
|
+
| `tests/profile.test.ts` | profile | live/session-sensitive |
|
|
24
|
+
| `tests/recovery.test.ts` | recovery | browser/page-state |
|
|
25
|
+
| `tests/replay-fixtures.test.ts` | replay-fixtures | browser/page-state, fixture/parser |
|
|
26
|
+
| `tests/response-capture.test.ts` | response-capture | browser/page-state, fixture/parser |
|
|
27
|
+
| `tests/search-capture.test.ts` | search-capture | browser/page-state, fixture/parser |
|
|
28
|
+
| `tests/search-mtop.test.ts` | search-mtop | browser/page-state, fixture/parser |
|
|
29
|
+
| `tests/search-options.test.ts` | search-options | - |
|
|
30
|
+
| `tests/sourcing-utils.test.ts` | sourcing-utils | fixture/parser |
|
|
31
|
+
| `tests/state.test.ts` | state | live/session-sensitive |
|
|
32
|
+
| `tests/supplier-inspect.test.ts` | supplier-inspect | browser/page-state, fixture/parser |
|
|
33
|
+
| `tests/supplier-search.test.ts` | supplier-search | browser/page-state, fixture/parser |
|
|
34
|
+
| `tests/wait.test.ts` | wait | - |
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Playbook: Add A Command
|
|
2
|
+
|
|
3
|
+
1. Add the Commander surface in `src/cli.ts`.
|
|
4
|
+
2. Create or update the owning module in `src/commands`.
|
|
5
|
+
3. Keep CLI parsing in `run(opts)` and browser/session work in
|
|
6
|
+
`execute(ctx, args)` when daemon dispatch is needed.
|
|
7
|
+
4. Wire daemon dispatch in `src/session/dispatch.ts` if the command should run
|
|
8
|
+
through the daemon.
|
|
9
|
+
5. Use `emit({ human, data })` so JSON/text dual mode stays consistent.
|
|
10
|
+
6. Add deterministic tests for parsing, output, mtop payload parsing, or helper
|
|
11
|
+
behavior.
|
|
12
|
+
7. Update `docs/COMMANDS.md` and `docs/JSON_CONTRACTS.md` when behavior or
|
|
13
|
+
output shape changes.
|
|
14
|
+
8. Run `pnpm agent-context` and the focused verification command.
|
|
15
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Playbook: Add Mtop Capture
|
|
2
|
+
|
|
3
|
+
1. Probe the browser flow manually only when needed and safe.
|
|
4
|
+
2. Capture the smallest stable endpoint/method/appId signal.
|
|
5
|
+
3. Add parsing logic under `src/session` when it is shared, or in the command
|
|
6
|
+
module when it is command-specific.
|
|
7
|
+
4. Save representative payloads as tests fixtures when they do not contain
|
|
8
|
+
sensitive account data.
|
|
9
|
+
5. Return structured `CliError` failures for timeout, login redirect,
|
|
10
|
+
risk-control, and parse failure.
|
|
11
|
+
6. Update `docs/JSON_CONTRACTS.md` if the capture changes agent-facing output.
|
|
12
|
+
7. Run focused parser/capture tests, then `pnpm agent-context`.
|
|
13
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Playbook: Change JSON Output
|
|
2
|
+
|
|
3
|
+
1. Identify the stable result interface in `src/commands/*`.
|
|
4
|
+
2. Prefer additive fields. Do not rename or remove fields unless the user
|
|
5
|
+
approved a breaking change.
|
|
6
|
+
3. Update human rendering only after preserving machine output.
|
|
7
|
+
4. Add or update tests for the JSON shape or parser feeding it.
|
|
8
|
+
5. Update `docs/JSON_CONTRACTS.md`.
|
|
9
|
+
6. Run `pnpm agent-context`.
|
|
10
|
+
7. Run `pnpm test` or a focused test plus `pnpm docs-check`.
|
|
11
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Playbook: Debug Risk Control
|
|
2
|
+
|
|
3
|
+
1. Confirm whether the failure is login redirect, risk-control URL, empty mtop
|
|
4
|
+
capture, network error, or browser closure.
|
|
5
|
+
2. Check structured exit code behavior. Exit `3` should point to `1688 login`;
|
|
6
|
+
exit `4` should point to rerunning once with `--headed`.
|
|
7
|
+
3. Use `--headed` only when manual slider solving is expected.
|
|
8
|
+
4. Inspect `src/session/page-state.ts`, `src/session/recovery.ts`, and the
|
|
9
|
+
relevant command's capture logic.
|
|
10
|
+
5. Add fixture-backed tests for page-state or parser changes.
|
|
11
|
+
6. Do not add silent retry loops around risk-control failures.
|
|
12
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Playbook: Update CLI Release Behavior
|
|
2
|
+
|
|
3
|
+
Use this playbook for version bumps, npm publishes, GitHub release/tag work,
|
|
4
|
+
postinstall changes, and update-notifier behavior.
|
|
5
|
+
|
|
6
|
+
## Release Checklist
|
|
7
|
+
|
|
8
|
+
1. Update `CHANGELOG.md` first.
|
|
9
|
+
- Keep current in-progress docs/features under `## [Unreleased]`.
|
|
10
|
+
- Before publishing, move released items into
|
|
11
|
+
`## [x.y.z] - YYYY-MM-DD`.
|
|
12
|
+
- Do not describe post-tag work as part of an already-published npm version.
|
|
13
|
+
2. Check `package.json`, `README.md`, npm metadata, and update-notifier behavior
|
|
14
|
+
in `src/cli.ts`.
|
|
15
|
+
3. Preserve the update protocol in `docs/SAFETY.md`: never run a global install
|
|
16
|
+
command without explicit current-turn user approval.
|
|
17
|
+
4. If daemon behavior changes after upgrade, document whether
|
|
18
|
+
`1688 daemon reload` is required.
|
|
19
|
+
5. Run:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm agent-context
|
|
23
|
+
pnpm agent-verify
|
|
24
|
+
npm pack --dry-run
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
6. Verify the release gate explicitly:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm release-check
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
7. Publish only after npm auth is valid:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm whoami
|
|
37
|
+
npm publish
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
8. Push both branch and tag. Lightweight tags are not pushed by
|
|
41
|
+
`git push --follow-tags`, so push the release tag explicitly:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
git push origin main
|
|
45
|
+
git push origin vX.Y.Z
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
9. After publish, verify:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm view 1688-cli version dist-tags --json
|
|
52
|
+
npm view 1688-cli@X.Y.Z readmeFilename version --json
|
|
53
|
+
git ls-remote --tags origin refs/tags/vX.Y.Z
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Omission Tracking
|
|
57
|
+
|
|
58
|
+
If a release step is missed, record it in
|
|
59
|
+
`docs/records/release-omissions.md` with symptom, cause, fix, and prevention.
|
|
60
|
+
Then update this playbook or a script so the same omission becomes harder to
|
|
61
|
+
repeat.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Release Omissions
|
|
2
|
+
|
|
3
|
+
Record release misses here so the process improves instead of relying on memory.
|
|
4
|
+
|
|
5
|
+
## 2026-06-08 - 0.1.42 CHANGELOG Omitted
|
|
6
|
+
|
|
7
|
+
### Symptom
|
|
8
|
+
|
|
9
|
+
After `1688-cli@0.1.42` was published and pushed, the GitHub file list still
|
|
10
|
+
showed `CHANGELOG.md` last changed by `chore(release): 0.1.41`. The npm
|
|
11
|
+
package included the old changelog because the 0.1.42 release commit only
|
|
12
|
+
bumped `package.json`.
|
|
13
|
+
|
|
14
|
+
### Cause
|
|
15
|
+
|
|
16
|
+
The release playbook said to check `CHANGELOG.md`, but there was no executable
|
|
17
|
+
gate in `agent-verify` or `prepublishOnly` to fail when the package version was
|
|
18
|
+
missing from `CHANGELOG.md`.
|
|
19
|
+
|
|
20
|
+
### Fix
|
|
21
|
+
|
|
22
|
+
- Backfilled `CHANGELOG.md` with a `0.1.42` section for released work.
|
|
23
|
+
- Added an `Unreleased` section for post-tag README/npm-metadata documentation
|
|
24
|
+
changes that should ship in the next npm version.
|
|
25
|
+
- Added `pnpm release-check`, backed by `scripts/check_release.mjs`.
|
|
26
|
+
- Added `release-check` to `pnpm agent-verify` and `prepublishOnly`.
|
|
27
|
+
- Expanded `docs/playbooks/update-cli-release.md` with changelog, npm, tag, and
|
|
28
|
+
post-publish verification steps.
|
|
29
|
+
|
|
30
|
+
### Prevention
|
|
31
|
+
|
|
32
|
+
Before the next publish, move `Unreleased` items into the new version section,
|
|
33
|
+
run `pnpm agent-verify`, run `npm pack --dry-run`, and push the release tag
|
|
34
|
+
explicitly with `git push origin vX.Y.Z`.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Checkout And Orders
|
|
2
|
+
|
|
3
|
+
Checkout and order tracking commands operate real buyer state.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
1688 checkout prepare <cartIds...>
|
|
9
|
+
1688 checkout confirm <cartIds...>
|
|
10
|
+
1688 order list [--status <status>]
|
|
11
|
+
1688 order get <orderId>
|
|
12
|
+
1688 order logistics <orderId>
|
|
13
|
+
1688 shipped <orderId>
|
|
14
|
+
1688 stuck [--days N]
|
|
15
|
+
1688 fake-shipped [--days N]
|
|
16
|
+
1688 seller-history <sellerName>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Checkout Boundary
|
|
20
|
+
|
|
21
|
+
`checkout prepare` is read-only. `checkout confirm` places a real order and
|
|
22
|
+
must follow the protocol in `docs/SAFETY.md`.
|
|
23
|
+
|
|
24
|
+
## Agent Requirements
|
|
25
|
+
|
|
26
|
+
- Preserve order IDs, seller identity, totals, line items, services, badges,
|
|
27
|
+
actions, and logistics trace fields.
|
|
28
|
+
- Keep overdue/fake-shipped workflows explainable: include thresholds and the
|
|
29
|
+
evidence used to flag each order.
|
|
30
|
+
- Never hide partial scans; report scan limits and blockers.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Specs Index
|
|
2
|
+
|
|
3
|
+
- [Checkout And Orders](checkout-and-orders.md)
|
|
4
|
+
- [Profile Daemon](profile-daemon.md)
|
|
5
|
+
- [Seller IM](seller-im.md)
|
|
6
|
+
- [Sourcing Research](sourcing-research.md)
|
|
7
|
+
- [Supplier Inspect](supplier-inspect.md)
|
|
8
|
+
- [Supplier Search](supplier-search.md)
|
|
9
|
+
- [Windows CLI Compatibility](windows-cli-compatibility.md)
|