shadok-ai 0.20.10 → 0.20.12
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/README.md +50 -1
- package/context/whatsapp-lib/load.mjs +13 -0
- package/context/whatsapp-lib/npm-shrinkwrap.json +1023 -0
- package/context/whatsapp-lib/package.json +10 -0
- package/dist/capability.d.ts +9 -0
- package/dist/capability.js +11 -0
- package/dist/capability.js.map +1 -1
- package/dist/server.js +149 -2
- package/dist/server.js.map +1 -1
- package/dist/wa-baileys.d.ts +95 -0
- package/dist/wa-baileys.js +266 -0
- package/dist/wa-baileys.js.map +1 -0
- package/dist/wa-fake.d.ts +58 -0
- package/dist/wa-fake.js +149 -0
- package/dist/wa-fake.js.map +1 -0
- package/dist/wa-library.d.ts +58 -0
- package/dist/wa-library.js +232 -0
- package/dist/wa-library.js.map +1 -0
- package/dist/wa-link.d.ts +128 -0
- package/dist/wa-link.js +167 -0
- package/dist/wa-link.js.map +1 -0
- package/dist/wa-transport.d.ts +61 -0
- package/dist/wa-transport.js +85 -0
- package/dist/wa-transport.js.map +1 -0
- package/dist/wa-worker-host.d.ts +32 -0
- package/dist/wa-worker-host.js +133 -0
- package/dist/wa-worker-host.js.map +1 -0
- package/dist/wa-worker.d.ts +1 -0
- package/dist/wa-worker.js +17 -0
- package/dist/wa-worker.js.map +1 -0
- package/dist/whatsapp.d.ts +88 -0
- package/dist/whatsapp.js +509 -0
- package/dist/whatsapp.js.map +1 -0
- package/package.json +1 -1
- package/public/index.html +150 -1
- package/public/tour-steps.js +2 -1
- package/public/wa-panel.js +177 -0
package/README.md
CHANGED
|
@@ -923,6 +923,52 @@ from the board group's creator, so an instance that already has an owner never
|
|
|
923
923
|
hands itself to whoever messages next — a bot username is public, and a DM is a
|
|
924
924
|
shell.
|
|
925
925
|
|
|
926
|
+
### WhatsApp (optional, linking only for now)
|
|
927
|
+
|
|
928
|
+
The **WhatsApp** panel (in the ⋯ menu, beside Telegram, admin only) links ONE
|
|
929
|
+
WhatsApp number to the instance. Linking makes the instance a **linked device**
|
|
930
|
+
of that account, the way WhatsApp Web is: click **Link a number**, then on the
|
|
931
|
+
phone open *Settings → Linked devices → Link a device* and scan the code the
|
|
932
|
+
panel shows (it refreshes by itself; nobody scanning for three minutes ends the
|
|
933
|
+
attempt). The panel then shows who the instance is linked as and since when;
|
|
934
|
+
**Unlink** logs the device out on WhatsApp's side and deletes the stored session
|
|
935
|
+
— even when that logout cannot reach WhatsApp, in which case remove the device
|
|
936
|
+
from the phone's *Linked devices* list too.
|
|
937
|
+
|
|
938
|
+
- **Use a number you can afford to lose.** This is not WhatsApp's official API:
|
|
939
|
+
linking a device this way is outside WhatsApp's terms of use, and the number
|
|
940
|
+
can be restricted or banned. The panel says so before you link.
|
|
941
|
+
- **One number, one instance.** Nothing stops the same account from being linked
|
|
942
|
+
to two instances, and both would answer — don't.
|
|
943
|
+
- **Only linking exists so far.** Messages are not handled yet; anyone-who-writes-
|
|
944
|
+
gets-their-own-agent (the WhatsApp twin of Telegram's open DMs) comes next.
|
|
945
|
+
- The panel always shows the link's true state, one at a time: *Not linked*,
|
|
946
|
+
*Linking*, *Connected*, *Reconnecting* (a link that stops answering leaves
|
|
947
|
+
*Connected* within about two minutes, even with no disconnect event),
|
|
948
|
+
*Unlinked remotely* (removed from the phone), *Stopped* with the reason (WhatsApp
|
|
949
|
+
refused the number, the same number was connected elsewhere, a local failure, or
|
|
950
|
+
a previous start that went down while resuming — nothing is retried on its own;
|
|
951
|
+
**Retry** or **Link again** is your call), *Installing the WhatsApp library*,
|
|
952
|
+
*WhatsApp library needed* with the reason, or *Unavailable* with the reason.
|
|
953
|
+
**Unlink** is offered whenever a session is stored, in every state.
|
|
954
|
+
- **Multi-tenant, migrated instances only.** The stored session IS the account,
|
|
955
|
+
so it must be out of every agent's reach: it lives in
|
|
956
|
+
`~/.shadok-ai/whatsapp/<instance>/` (mode 0700, on the data volume, so a
|
|
957
|
+
recreate does not unlink the number), and the feature is refused on a
|
|
958
|
+
mono-tenant instance and until the groups migration has completed.
|
|
959
|
+
- **The WhatsApp library is installed on demand, not with shadok-ai.** Neither
|
|
960
|
+
`npx shadok-ai` nor the auto-update fetches any WhatsApp package: an instance
|
|
961
|
+
that never links a number installs nothing. The first **Link** by an admin runs
|
|
962
|
+
`npm ci` (about 35 MB on disk, a few seconds on a good connection) into
|
|
963
|
+
`~/.shadok-ai/whatsapp-lib/` on the data volume, so it survives updates and
|
|
964
|
+
recreates. The versions and the whole package tree are pinned by the release
|
|
965
|
+
(by checksum), install scripts are off, and the machine needs `npm` and access
|
|
966
|
+
to the npm registry. A failed install says why (no network, no npm, a full
|
|
967
|
+
disk) and offers **Install** again. When a release pins a new version, the old
|
|
968
|
+
copy is never used: the panel asks you to **Install** before the link
|
|
969
|
+
reconnects. The same happens when a stored session finds no library at boot,
|
|
970
|
+
because nothing is ever installed without an admin's click.
|
|
971
|
+
|
|
926
972
|
### Running in Docker
|
|
927
973
|
|
|
928
974
|
> Putting one instance online for someone else, on its own machine, behind a
|
|
@@ -1530,6 +1576,7 @@ machine, which silently shifts every daily prompt on a server running in UTC.
|
|
|
1530
1576
|
| `SHADOK_AUTOUPDATE=0` | don't apply a newer release by itself (**ON by default** under the supervisor, i.e. `npx shadok-ai`; a server run directly never self-updates, since nothing would respawn it). `0`/`false` turns it off, `1`/`true` forces it on; the GUI setting wins over either once used |
|
|
1531
1577
|
| `SHADOK_PILOT_PROMPT=0` | don't inject the cockpit system prompt |
|
|
1532
1578
|
| `SHADOK_GREETING=0` | the lead agent starts silent — no first-message greeting |
|
|
1579
|
+
| `SHADOK_WA_FAKE=1` | **verification only**: the WhatsApp panel drives a scripted fake transport instead of the library (no phone, no real account), and `POST /whatsapp/fake/:action` scripts it — for checking the panel on a side instance |
|
|
1533
1580
|
| `SHADOK_LEDGER=0` | turn OFF the shared-ledger reflex — a per-instance state table siblings read/write so they stop re-surfacing resolved work, plus a `⟦ledger⟧` delta pushed ahead of each message (**ON by default**; `SHADOK_LEDGER=0` or the GUI/config setting turns it off) |
|
|
1534
1581
|
| `SHADOK_SEED_SKILLS=0` | don't rewrite the machine-wide skill scripts at boot — for a build run side by side with another instance, so it doesn't hand that instance's agents scripts newer than the server they call |
|
|
1535
1582
|
| `SHADOK_RESUME_SUMMARY=1` | don't auto-answer the resume-from-summary prompt |
|
|
@@ -1754,7 +1801,9 @@ to — from the profile's editor or from a tick on the secret's *Injected into*
|
|
|
1754
1801
|
chips, both directions of the same link — and which agent **received** it at spawn or in a cron guard, with the person
|
|
1755
1802
|
or door that caused it; names only, never a value; filters `secret`, `action`,
|
|
1756
1803
|
`actor`, `agent`, `since`, `limit`. Also in the vault panel → *Audit log*, and
|
|
1757
|
-
🕘 on each secret), `/telegram`, `/
|
|
1804
|
+
🕘 on each secret), `/telegram`, `/whatsapp` (GET — the link's state, the QR drawn
|
|
1805
|
+
as SVG only for a signed-in admin's browser; POST/DELETE `/whatsapp/link` — link,
|
|
1806
|
+
cancel or unlink, admin and browser-only), `/defaults`, `/first-agent` (GET —
|
|
1758
1807
|
`{pending, reason}`: whether this instance's lead agent is being started
|
|
1759
1808
|
right now), `/version`, `/autoupdate`,
|
|
1760
1809
|
`/connect/status` (GET — `{available, providers: {linkedin, google, github},
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The entry of the on-demand WhatsApp library directory (src/wa-library.ts).
|
|
2
|
+
//
|
|
3
|
+
// Copied beside package.json and npm-shrinkwrap.json into
|
|
4
|
+
// ~/.shadok-ai/whatsapp-lib/<fingerprint>/, where `npm ci` installs the tree.
|
|
5
|
+
// A dynamic import() resolves from the module that makes it, so importing the
|
|
6
|
+
// packages HERE resolves them from that directory's node_modules — never from
|
|
7
|
+
// the app's own, which the auto-update rewrites and which no longer carries them.
|
|
8
|
+
const ALLOWED = new Set(["baileys", "qrcode"]);
|
|
9
|
+
|
|
10
|
+
export function load(name) {
|
|
11
|
+
if (!ALLOWED.has(name)) return Promise.reject(new Error(`not a package of this directory: ${name}`));
|
|
12
|
+
return import(name);
|
|
13
|
+
}
|