@aiwuk/autocomplete 0.0.0-stage → 1.0.2
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/LICENSE +21 -0
- package/README.md +88 -2
- package/client.js +1132 -0
- package/cordis.patch.yml +6 -0
- package/fleet-defaults.js +95 -0
- package/i18n/schema.en.json +13 -0
- package/i18n/schema.zh.json +13 -0
- package/icon.svg +1 -0
- package/index.js +105 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/managed-route.js +55 -0
- package/package.json +33 -4
- package/predictor.js +110 -0
- package/schema.js +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 walke2019
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,89 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AIWUK Autocomplete for DSH
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Part of [AIWUK Team for DSH](https://github.com/walke2019/dsh-capability-team) ([main README](../../README.md)); usable on its own in any session.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
dsh plugin add @aiwuk/autocomplete
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Requires DSH >= 0.2.2-rc.1 (below 0.3.0) and Node.js >= 22.
|
|
10
|
+
|
|
11
|
+
Composer autocomplete for DSH Web (`@aiwuk/autocomplete`, patch id `autocomplete`). The plugin name, description, settings and on-screen text follow the DSH language (Chinese / English).
|
|
12
|
+
|
|
13
|
+
- **Inline continuation**: pause while typing and a continuation is suggested.
|
|
14
|
+
- **Next message**: after the assistant replies, an empty composer suggests what you might ask next.
|
|
15
|
+
- A suggestion only fills the composer; it is **never sent automatically**.
|
|
16
|
+
- Suggestions stay out of the way of slash commands (`/…`) and references (`@…`), IME composition, and a running turn.
|
|
17
|
+
|
|
18
|
+
## Desktop vs. phone and tablet
|
|
19
|
+
|
|
20
|
+
The mode is picked from the device's input, not the screen width, and switches by itself when you attach or detach a keyboard or mouse.
|
|
21
|
+
|
|
22
|
+
| | Desktop (mouse/keyboard) | Phone / tablet (touch) |
|
|
23
|
+
|---|---|---|
|
|
24
|
+
| Where | Grey ghost text after the caret | A strip of buttons just above the composer, shown only when there are suggestions |
|
|
25
|
+
| Next message | Appears in the empty composer | Appears as buttons in the strip after a reply |
|
|
26
|
+
| Continue a draft | Appears after you pause typing | Tap **✦** in the composer's tool row (on screens narrower than 360 px, at the start of the strip) |
|
|
27
|
+
| Accept | **Tab** | Tap a suggestion button |
|
|
28
|
+
| Other candidates | **Alt+↑/↓** | All candidates are shown; scroll the bar sideways |
|
|
29
|
+
| Dismiss | **Esc** | Tap **×** |
|
|
30
|
+
|
|
31
|
+
Buttons are at least 36 px tall and do not take focus, so the soft keyboard stays open. The strip is laid out in the page above the composer, so it pushes content up instead of covering the workspace, mode or other composer controls, and it takes no space while empty. Turn it off with `mobileBar: false` to get ghost text on touch devices too.
|
|
32
|
+
|
|
33
|
+
### Multi-agent sessions
|
|
34
|
+
|
|
35
|
+
Suggestions stand down while the composer is busy: during a running turn, while a confirmation card is docked above the composer (such as a team dispatch plan waiting for approval), and in a read-only teammate view. A request already in flight is cancelled at that moment. Teammate sessions that can be steered (continuable) keep suggestions.
|
|
36
|
+
|
|
37
|
+
## Across terminals
|
|
38
|
+
|
|
39
|
+
The same package works on every DSH Web client connected to the instance: the local browser, another computer on the network, and phones opened through the Mothership hub link. The page calls the endpoint relative to itself, so tunnels and path prefixes need no configuration, and settings are stored in the instance (not the browser), so every device shares them.
|
|
40
|
+
|
|
41
|
+
## Model routing
|
|
42
|
+
|
|
43
|
+
| `routeMode` | Behavior |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `session` (default) | Use the provider and model of the session you are typing in. |
|
|
46
|
+
| `fixed` | Use the configured `provider` and `model` (both required), e.g. a cheap low-latency model. |
|
|
47
|
+
|
|
48
|
+
`provider` is the ID of a provider you already configured in DSH, never an API key. No credentials are stored by this plugin.
|
|
49
|
+
|
|
50
|
+
### Fleet defaults (optional)
|
|
51
|
+
|
|
52
|
+
A fleet manager can set a default route for many instances by writing these plain values to the DSH credential store (for example as Mothership hub integration settings):
|
|
53
|
+
|
|
54
|
+
| Credential | Value |
|
|
55
|
+
|---|---|
|
|
56
|
+
| `AUTOCOMPLETE_PROVIDER` | provider ID, e.g. `my-gateway` |
|
|
57
|
+
| `AUTOCOMPLETE_MODEL` | model ID, e.g. `fast-model` |
|
|
58
|
+
| `AUTOCOMPLETE_ROUTE_MODE` | optional; `fixed` is implied when provider and model are set, `session` forces session routing |
|
|
59
|
+
|
|
60
|
+
They are only a default under your own settings: as soon as you pick a route mode or enter a provider or model yourself, your choice wins entirely and the fleet route is ignored. Without these credentials the plugin behaves exactly as described above.
|
|
61
|
+
|
|
62
|
+
## Settings
|
|
63
|
+
|
|
64
|
+
Installed through an AIWUK Mothership? Everything is already configured and the page says so; see [standalone setup](../../docs/standalone-setup.md) for standalone installs and the AI-agent checklist.
|
|
65
|
+
|
|
66
|
+
Change them from **Settings → General** or the plugin's page under **Plugins**. Every field is volatile, so changes apply without a restart. When an AIWUK Mothership manages a setting (for example the fleet route), its row shows a badge: "Managed by AIWUK Mothership" (locked, read-only here) or "Default from Mothership" (editable; your value wins). The page has no secret fields; secrets are write-only on the Memory and Search pages.
|
|
67
|
+
|
|
68
|
+
| Field | Default | Range |
|
|
69
|
+
|---|---|---|
|
|
70
|
+
| `enabled` | `true` | |
|
|
71
|
+
| `routeMode` | `session` | `session` / `fixed` |
|
|
72
|
+
| `provider`, `model` | empty | used in `fixed` mode |
|
|
73
|
+
| `maxSuggestions` | 3 | 1–5 |
|
|
74
|
+
| `typePauseMs` | 700 | 200–5000 |
|
|
75
|
+
| `mobileBar` | `true` | tap bar on touch devices |
|
|
76
|
+
| `maxOutputTokens` | 220 | 16–2048 |
|
|
77
|
+
| `timeoutMs` | 20000 | 1000–120000 |
|
|
78
|
+
| `maxMessages` | 10 | 1–50 |
|
|
79
|
+
| `maxChars` | 8000 | 500–32000 |
|
|
80
|
+
|
|
81
|
+
## Privacy and safety
|
|
82
|
+
|
|
83
|
+
- The endpoint `POST autocomplete/predict` accepts only the authenticated **owner** and same-origin JSON requests (the forwarded host of a hub tunnel or reverse proxy counts as the origin); cross-site requests are refused.
|
|
84
|
+
- Only the text of recent user and assistant messages is sent as context, never tool calls or tool output, and it is quoted as untrusted data.
|
|
85
|
+
- Predictions never write to the session transcript. At most four predictions run at once; each is bounded by `timeoutMs`.
|
|
86
|
+
|
|
87
|
+
## Development
|
|
88
|
+
|
|
89
|
+
`client.js` is generated from `client/*.js`; edit the fragments and run `npm run build:autocomplete` from the repository root. Tests live in `tests/autocomplete/`.
|