@qilin-agent/client-ui-input-trigger 0.0.0-stage → 3.1.4

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 kkutysllb
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.
@@ -0,0 +1,40 @@
1
+ # Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
2
+ # section, a hash of its English and Chinese blocks outside code blocks and generated regions.
3
+ # After editing either side, bring the other along and re-record with:
4
+ # pnpm run verify-translation-pairing --write packages/client/ui-input-trigger/README.md
5
+ /:
6
+ en: 99c36d8cf52f1a8a
7
+ zh: 3cc3f1e8c2f42c23
8
+ /qilin-agent-client-ui-input-trigger:
9
+ en: 50ac5df798bc4405
10
+ zh: 06eb3eec0ad71936
11
+ /qilin-agent-client-ui-input-trigger/summary:
12
+ en: 2a968a6e0bc65ac4
13
+ zh: 883f1be84003a5c5
14
+ /qilin-agent-client-ui-input-trigger/table-of-contents:
15
+ en: d152484eb41ac6b4
16
+ zh: 09388d293f9be9cb
17
+ /qilin-agent-client-ui-input-trigger/use-this-package:
18
+ en: 331a1247c318b1e3
19
+ zh: 6689a92ce0c82942
20
+ /qilin-agent-client-ui-input-trigger/use-this-package/keyboard-and-mouse:
21
+ en: b198d6256a961f99
22
+ zh: 292e0bb94c18c9ca
23
+ /qilin-agent-client-ui-input-trigger/understand-the-implementation:
24
+ en: 81ac247b6e84a670
25
+ zh: a81221be009a1f47
26
+ /qilin-agent-client-ui-input-trigger/further-exploration:
27
+ en: fb584dab51c0f0c9
28
+ zh: 34502ebd83de1e54
29
+ /qilin-agent-client-ui-input-trigger/model-experience:
30
+ en: 5d1596f50088f468
31
+ zh: 3c72b4f6b1ba27ee
32
+ /qilin-agent-client-ui-input-trigger/model-experience/kv-cache-effect:
33
+ en: ca75c51c89c2c9b0
34
+ zh: de54f3467ef3b9be
35
+ /qilin-agent-client-ui-input-trigger/known-limitations-and-deferred-work:
36
+ en: 560e5df72c0fb698
37
+ zh: ed6fa149bc90258a
38
+ /qilin-agent-client-ui-input-trigger/known-limitations-and-deferred-work/dev-note:
39
+ en: e67f633dc6fe7773
40
+ zh: 3bb0c20c93f16f98
package/README.md CHANGED
@@ -1,3 +1,89 @@
1
- # Temporary Holding Version
1
+ ---
2
+ description: "Input trigger pipeline for the Web GUI: / and @ detection under the caret, the grouped candidate menu, and pick routing to registered sources; for users and maintainers of slash commands and references."
3
+ kind: "package-reference"
4
+ ---
2
5
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
6
+ # @qilin-agent/client-ui-input-trigger
7
+
8
+ English | [中文](README.zh.md)
9
+
10
+ ## Summary
11
+
12
+ When users type `/` or `@` at the caret in the Web GUI, this package opens a grouped menu for slash commands, file references, and session references. It supports keyboard and pointer selection, including drill-down choices and launchers that open a single candidate group over the current selection. A pick either invokes a command flow or inserts a reference for the consuming input surface to handle. The package affects browser presentation only; it does not assemble or send model requests.
13
+
14
+ ## Table of Contents
15
+
16
+ - [Use this package](#use-this-package)
17
+ - [Understand the implementation](#understand-the-implementation)
18
+ - [Further Exploration](#further-exploration)
19
+ - [Model Experience](#model-experience)
20
+ - [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
21
+ - [Dev Note](#dev-note)
22
+
23
+ -----
24
+
25
+ <a id="use-this-package"></a>
26
+ ## Use this package
27
+
28
+ Mount this plugin alongside `ui-conversation`; the menu then appears in the input overlay when the user types a trigger under the caret. Grouped candidates render under title rows, or under the section headings a source attaches to its own rows; a pick routes to the source, and the consuming surface applies the result — a slash command opens its popup or executes, a reference inserts its inline token. A row shows its icon, its title (the candidate `label`, or the `name` when no label is given), the `name` as a trailing alias when the label is not the name in another letter case, and the description right-aligned; a query matches either the name or the label.
29
+
30
+ ### Keyboard and mouse
31
+
32
+ The composer surface keeps focus while the menu is open: rows pick on mousedown, the highlight rides `aria-activedescendant`, and a pointer press outside both the menu and the composer card dismisses it. Opening it from the launcher button puts the keyboard back in the editor before the menu opens, so the arrows drive it there too. Space and Enter adjudication polls the optional `matchSpace`/`matchEnter` hooks in registration order; the first non-undefined answer wins, and a source can refuse a submission it cannot consume whole. Tab acts on the highlighted completion: a candidate declaring `drill: true` routes through `onPick` with `action: 'drill'`, while an ordinary candidate settles through `action: 'pick'`; without a highlight Tab passes untouched so native focus traversal survives. Escape and Shift+Tab leave the menu instead, never settling: the exit gesture cannot consume or rewrite the draft. A dismissed menu stays dismissed: the same token re-tracked with the same query keeps its menu closed, so restoring the caret after a pointer dismissal — or after a settled command closes the surface it opened — cannot bring the menu back; typing a new query or moving to another token re-arms it. A drillable row's trailing chevron exposes the same second verb to pointer users. A source implementing the optional `header` hook additionally publishes crumbs above its group: the pipeline re-polls it on every hit with the live query and whether a drill, rather than typing, produced it, and a crumb pick routes back through `onPick` with `action: 'drill'`.
33
+
34
+ A source may implement `openReference(session, reference)` to open a draft reference without submitting it. Acceptance may precede asynchronous catalog loading. Chips route by source name; editable tokens route through the current source lexicon. Returning `false`, a missing source, or a disposed controller leaves the editor gesture unchanged.
35
+
36
+ -----
37
+
38
+ <a id="understand-the-implementation"></a>
39
+ ## Understand the implementation
40
+
41
+ <details>
42
+ <summary>Implementation internals — click to expand</summary>
43
+
44
+ `src/core/` is the pure core — trigger detection, menu reduction, and exact match, with zero React/DOM/cordis — while `src/client/service.ts` wires the core to the menu snapshot store, the per-hit candidate fetch (generation-gated, `AbortSignal`-superseded, failed sources dropping silently with a console record), and the pick paths. One `InputTriggerController` resolves per session scope (`sessionOf`); the conversation wiring layer drives `track`/`arbitrate`/`onSpace`/`adjudicate` on the controller. A source is warmed into every session controller it can reach; sources whose `lexicon` rolls change after warm implement `subscribeLexicon` and the controller re-polls on each notification. `MenuView` self-registers into `conversation.input.overlay` (list kind, session scope) and renders null while closed. The `listbox` role sits on its scrolling viewport rather than the bounded shell, because a breadcrumb header is not an option and a listbox may not carry one; crumbs ride their own snapshot store beside the menu store, so the frozen reducer stays unaware of them. The overlay SlotMap merge lives here because the dependency direction (ui-conversation → ui-input-trigger) admits no reverse type import.
45
+
46
+ </details>
47
+
48
+ -----
49
+
50
+ <a id="further-exploration"></a>
51
+ ## Further Exploration
52
+
53
+ Read these pages when the trigger pipeline is not enough. They move from the pipeline to the sources that register into it and the shell that owns the input.
54
+
55
+ - [ui-commands](../ui-commands/README.md) — registers the `/` command source into this pipeline and owns the command popup shell.
56
+ - [ui-reference](../ui-reference/README.md) — registers the `@` file and session reference sources.
57
+ - [ui-conversation](../ui-conversation/README.md) — declares the input overlay slot and owns the composer and input machine.
58
+ - [Web client architecture](../../../.agents/notes/implemented/architecture/2026-07-19-gui-web-client-architecture.md) — how browser plugin rows load and register slots.
59
+
60
+ -----
61
+
62
+ <a id="model-experience"></a>
63
+ ## Model Experience
64
+
65
+ None, as the trigger pipeline is browser presentation only — picks produce command claims and reference inserts whose model-visible consequences are owned by the consuming host and input-machine packages.
66
+
67
+ #### KV Cache effect
68
+
69
+ None; this package neither assembles nor sends a provider request.
70
+
71
+ ## Known Limitations and Deferred Work
72
+
73
+ <a id="known-limitations-and-deferred-work"></a>
74
+
75
+
76
+ These limits define the current trigger pipeline. They are current package constraints, not a general menu comparison or a task backlog.
77
+
78
+ - **Global source layer only** — session-scope source registration (per-session shadowing) is designed but not enabled; the ledger tracks the trigger condition, a real per-session source need.
79
+ - **Overlay SlotMap merge home is split from slot ownership** — the sole `conversation.input.overlay` merge lives here, while ui-conversation owns its anchor, children declaration, and lifecycle because the dependency direction is ui-conversation → ui-input-trigger.
80
+
81
+ <a id="dev-note"></a>
82
+ ### Dev Note
83
+
84
+ <details>
85
+ <summary>Working context for maintainers — click to expand</summary>
86
+
87
+ None.
88
+
89
+ </details>
package/README.zh.md ADDED
@@ -0,0 +1,89 @@
1
+ ---
2
+ description: "Web GUI 的输入触发流水线:光标处的 / 与 @ 检测、分组候选菜单,以及把 pick 路由到已注册 source;供斜杠命令与引用的用户与维护者阅读。"
3
+ kind: "package-reference"
4
+ ---
5
+
6
+ # @qilin-agent/client-ui-input-trigger
7
+
8
+ [English](README.md) | 中文
9
+
10
+ ## 概述
11
+
12
+ 当用户在 Web GUI 的光标处键入 `/` 或 `@` 时,本包会为斜杠命令、文件引用和会话引用打开分组菜单。它支持键盘和指针选择,包括下钻候选项,以及在当前选区上打开单个候选分组的 launcher。pick 会触发命令流程或插入引用,具体结果由消费方输入表面处理。本包只影响浏览器呈现;它既不组装也不发送模型请求。
13
+
14
+ ## 目录
15
+
16
+ - [使用本包](#use-this-package)
17
+ - [理解实现](#understand-the-implementation)
18
+ - [进一步探索](#further-exploration)
19
+ - [模型体验](#model-experience)
20
+ - [已知限制与延期工作](#known-limitations-and-deferred-work)
21
+ - [开发备注](#dev-note)
22
+
23
+ -----
24
+
25
+ <a id="use-this-package"></a>
26
+ ## 使用本包
27
+
28
+ 与 `ui-conversation` 一起挂载本插件;用户在光标处键入触发器时,菜单随即出现在输入浮层中。分组候选项渲染在标题行之下,或渲染在 source 附加在自己各行上的小节标题之下;pick 路由到 source,消费方表面应用其结果——斜杠命令打开其弹窗或执行,引用插入其行内 token。每一行显示图标、标题(候选项的 `label`,没有 label 时显示 `name`)、当标题不是 `name` 的另一种大小写写法时跟在标题后的 `name` 别名,以及右对齐的说明;查询同时匹配 name 与 label。
29
+
30
+ ### 键盘与鼠标
31
+
32
+ 菜单打开期间 composer 表面保持焦点:行在 mousedown 时完成 pick,高亮由 `aria-activedescendant` 承载,指针落在菜单与所在 composer 卡片之外即关闭菜单。从 launcher 按钮打开菜单时会先把键盘还给编辑器再开菜单,因此方向键在那里同样可用。空格与回车裁决按注册序轮询可选的 `matchSpace`/`matchEnter` 钩子;第一个非 undefined 的应答胜出,source 也可以拒绝它无法整体消费的提交。Tab 会作用于高亮补全项:声明 `drill: true` 的候选项以 `action: 'drill'` 进入 `onPick`,普通候选项则以 `action: 'pick'` 完成选定;没有高亮项时 Tab 原样放行,原生焦点遍历不受影响。Escape 与 Shift+Tab 则是离开菜单——它们从不选定,因此退出动作不会消耗或改写草稿。被关闭的菜单保持关闭:同一个 token 以同一查询重新 track 时菜单不会重开——因此指针关闭之后恢复光标、或已选定的命令关闭它自己打开的界面,都不会把菜单召回来;输入新的查询或移到另一个 token 才会重新武装。可下钻行尾的 chevron 向指针用户提供同一个动词。实现可选 `header` 钩子的 source 还会在其分组上方发布面包屑:流水线在每次命中时用实时查询、以及该查询由下钻还是由键入产生这一事实重新询问它,点击面包屑经 `onPick` 以 `action: 'drill'` 回到该 source。
33
+
34
+ 来源可以实现 `openReference(session, reference)`,打开草稿引用而不提交。来源可以先接受预览请求,再异步加载目录。标签按来源名称路由;可编辑文本按来源当前的词表路由。返回 `false`、来源缺失或控制器已释放时,保留编辑器原有的手势处理。
35
+
36
+ -----
37
+
38
+ <a id="understand-the-implementation"></a>
39
+ ## 理解实现
40
+
41
+ <details>
42
+ <summary>实现细节——点击展开</summary>
43
+
44
+ `src/core/` 是纯内核——触发器检测、菜单归约与精确匹配,零 React/DOM/cordis——而 `src/client/service.ts` 把内核接到菜单快照存储、逐 hit 候选拉取(以 generation 把关、被后继请求通过 `AbortSignal` 取代、失败的 source 静默丢弃并留一条 console 记录)与 pick 路径上。每个会话 scope 各解析一个 `InputTriggerController`(`sessionOf`);对话接线层在控制器上驱动 `track`/`arbitrate`/`onSpace`/`adjudicate`。source 会被预热进它能触达的每个会话控制器;`lexicon` 名录在预热后变化的 source 实现 `subscribeLexicon`,控制器每收到通知就重拉。`MenuView` 自注册进 `conversation.input.overlay`(列表类,会话 scope),菜单关闭期间渲染 null。`listbox` 角色落在其滚动视口而非有界外壳上,因为面包屑头部不是选项,listbox 也不得承载它;面包屑走菜单存储之外的独立快照存储,冻结的归约器因此对它一无所知。overlay 的 SlotMap 合并放在本包,因为依赖方向(ui-conversation → ui-input-trigger)不允许反向的类型导入。
45
+
46
+ </details>
47
+
48
+ -----
49
+
50
+ <a id="further-exploration"></a>
51
+ ## 进一步探索
52
+
53
+ 当触发流水线不够用时阅读以下页面。它们从流水线延伸到注册进其中的 source,以及拥有输入的会话外壳。
54
+
55
+ - [ui-commands](../ui-commands/README.zh.md)——把 `/` 命令 source 注册进本流水线并拥有命令弹窗外壳。
56
+ - [ui-reference](../ui-reference/README.zh.md)——注册 `@` 文件与会话引用 source。
57
+ - [ui-conversation](../ui-conversation/README.zh.md)——声明输入浮层 slot 并拥有 composer 与输入状态机。
58
+ - [Web 客户端架构](../../../.agents/notes/implemented/architecture/2026-07-19-gui-web-client-architecture.zh.md)——浏览器插件行如何加载并注册 slot。
59
+
60
+ -----
61
+
62
+ <a id="model-experience"></a>
63
+ ## 模型体验
64
+
65
+ 无。触发流水线只是浏览器呈现——pick 产出命令声明与引用插入,其模型可见后果由消费方宿主与输入状态机包负责。
66
+
67
+ #### KV Cache 影响
68
+
69
+ 无;该包既不组装也不发送提供方请求。
70
+
71
+ ## 已知限制与延期工作
72
+
73
+ <a id="known-limitations-and-deferred-work"></a>
74
+
75
+
76
+ 这些限制界定了当前触发流水线。它们是当前包约束,不是通用菜单对比或任务积压。
77
+
78
+ - **只有全局 source 层**——会话 scope 的 source 注册(逐会话遮蔽)已有设计但未启用;台账记录着触发条件,即真实的逐会话 source 需求。
79
+ - **overlay 的 SlotMap 合并归属与 slot 所有权分离**:唯一的 `conversation.input.overlay` 合并放在本包,而 ui-conversation 拥有其锚点、children 声明与生命周期,因为依赖方向是 ui-conversation → ui-input-trigger。
80
+
81
+ <a id="dev-note"></a>
82
+ ### 开发备注
83
+
84
+ <details>
85
+ <summary>维护者的工作上下文——点击展开</summary>
86
+
87
+ 无。
88
+
89
+ </details>