martty 0.2.11
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 +118 -0
- package/bin/dsh-tui.js +68 -0
- package/cordis.patch.yml +30 -0
- package/creator/cordis.patch.yml +6 -0
- package/creator/package.json +10 -0
- package/lib/acp-client-events.js +65 -0
- package/lib/acp-client.js +114 -0
- package/lib/acp-host.js +24 -0
- package/lib/acp-session-config.js +376 -0
- package/lib/acp-session-plan.js +196 -0
- package/lib/acp-session-stats.js +239 -0
- package/lib/agent.js +64 -0
- package/lib/boot.js +119 -0
- package/lib/client-process.js +11 -0
- package/lib/client-run.js +379 -0
- package/lib/cordis-protocol.js +51 -0
- package/lib/creator-overlay.js +77 -0
- package/lib/demo-skin.js +79 -0
- package/lib/ember.js +20 -0
- package/lib/index.js +226 -0
- package/lib/inspect.js +971 -0
- package/lib/jsonrpc-line-transport.js +155 -0
- package/lib/mux.js +281 -0
- package/lib/palettes/default.json +44 -0
- package/lib/palettes/ember.json +44 -0
- package/lib/plan-view.js +92 -0
- package/lib/profile-acp-client.js +11 -0
- package/lib/right-demo.js +55 -0
- package/lib/runner.js +94 -0
- package/lib/spawn-tui.js +179 -0
- package/lib/stats-view.js +90 -0
- package/lib/tui-commands.js +144 -0
- package/lib/tui-overlay.js +252 -0
- package/lib/tui-slots.js +351 -0
- package/lib/tui-theme.js +463 -0
- package/package.json +83 -0
- package/skills/tui-plugin-development/SKILL.md +172 -0
- package/vendor/darwin-arm64/dsh-tui +0 -0
- package/vendor/darwin-x64/dsh-tui +0 -0
- package/vendor/linux-arm64/dsh-tui +0 -0
- package/vendor/linux-x64/dsh-tui +0 -0
- package/vendor/win32-x64/dsh-tui.exe +0 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tui-plugin-development
|
|
3
|
+
description: Companion guidance for dynamic Cordis Plugins that touch the TUI: terminal themes, slots, local slash commands, native overlays, and current ACP Session config or Plan state. Load `cordis-plugin-development` first for the common Plugin model, then load this skill for the TUI half.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Develop TUI Client Plugins
|
|
7
|
+
|
|
8
|
+
Load `cordis-plugin-development` first for the common dynamic-Plugin lifecycle,
|
|
9
|
+
Host/Client split, Package versions, approval, and repair flow. Load this skill
|
|
10
|
+
as its TUI companion whenever any requested behavior belongs to the terminal.
|
|
11
|
+
For that TUI half, the live TUI Providers and rules below replace generic Web
|
|
12
|
+
Slots, React, CSS, settings, and browser-theme assumptions. Keep the generic
|
|
13
|
+
skill for shared Cordis behavior and for any genuine Host or Web half.
|
|
14
|
+
|
|
15
|
+
## Fast path
|
|
16
|
+
|
|
17
|
+
1. Call `cordis_inspect_list` once. Do this before examining optional visual
|
|
18
|
+
assets: asset contents do not determine which TUI Providers own the UI.
|
|
19
|
+
2. Query only the smallest Client Providers that own the requested behavior,
|
|
20
|
+
using the exact methods shown by the list.
|
|
21
|
+
3. For an existing `@pluginId`, call `cordis_inspect_self` once; skip it for a
|
|
22
|
+
new Plugin.
|
|
23
|
+
4. Write plain JavaScript in `code.client`. Add `code.host` only when the task
|
|
24
|
+
genuinely owns Host data or operations.
|
|
25
|
+
5. Call `cordis_define` once, then `cordis_run` once with the returned exact
|
|
26
|
+
ids. Use `run` for a new Plugin and `update` for a new Package replacing a
|
|
27
|
+
current one.
|
|
28
|
+
6. If run reports `awaiting-approval` or `starting`, stop the Tool flow and let
|
|
29
|
+
later state updates finish activation. Reply with one short status sentence;
|
|
30
|
+
do not summarize the implementation while approval is pending.
|
|
31
|
+
7. After the later state update confirms activation, report success and stop.
|
|
32
|
+
Do not re-query Providers merely to verify effects that activation already
|
|
33
|
+
confirmed; query again only for a concrete runtime diagnostic.
|
|
34
|
+
|
|
35
|
+
The normal new-plugin trajectory is therefore one list, one query per needed
|
|
36
|
+
Provider, one define, and one run. Once inspect returns a sufficient live
|
|
37
|
+
contract, author immediately; do not re-prove it from generic Cordis concepts.
|
|
38
|
+
|
|
39
|
+
`define` stores an immutable Package; `run` activates it. Stop/update/unload
|
|
40
|
+
dispose the owning Client Plugin effects. Never depend on a value returned by
|
|
41
|
+
`apply()` as the disposer; register effects through the inspected Cordis APIs.
|
|
42
|
+
|
|
43
|
+
## Inspect is the authority
|
|
44
|
+
|
|
45
|
+
Treat the current list and query results as the complete Client API. If a
|
|
46
|
+
required capability is absent, report that exact gap before define. Do not:
|
|
47
|
+
|
|
48
|
+
- search source, installed packages, npm, or the web;
|
|
49
|
+
- reflect on runtime objects or function source;
|
|
50
|
+
- guess shapes and retry calls;
|
|
51
|
+
- define/run a probe Package;
|
|
52
|
+
- use a visible Slot such as `chrome.right` for diagnostics.
|
|
53
|
+
|
|
54
|
+
Use the narrowest capability:
|
|
55
|
+
|
|
56
|
+
| Need | Inspect family | Runtime service |
|
|
57
|
+
| --- | --- | --- |
|
|
58
|
+
| Palette registration/activation | `Theme` | `tuiTheme` |
|
|
59
|
+
| Persistent terminal content | `Slots` | `tuiSlots` |
|
|
60
|
+
| Local slash command | `Commands` | `tuiCommands` |
|
|
61
|
+
| Transient slider or node view | `Overlay` | `tuiOverlay` |
|
|
62
|
+
| Current ACP Session option | advertised config-option Provider | `acpSessionConfig` |
|
|
63
|
+
| Current structured ACP Plan | `Plans` | `acpSessionPlan` |
|
|
64
|
+
| Current ACP Session statistics | `Stats` | `acpSessionStats` |
|
|
65
|
+
|
|
66
|
+
A transient control is not a side panel. When the user did not request
|
|
67
|
+
persistent content, do not query Slots or mount `chrome.right`.
|
|
68
|
+
|
|
69
|
+
## Compose independent capabilities
|
|
70
|
+
|
|
71
|
+
Follow the Web dynamic-Plugin model: a returned Client Plugin declares the
|
|
72
|
+
services it needs, and one `apply()` may contribute any combination of
|
|
73
|
+
features. Every registration belongs to that Plugin's Cordis fiber, so
|
|
74
|
+
stop/update/unload retracts all of its contributions together. Do not invent
|
|
75
|
+
cross-service option fields or a new bundle abstraction to couple two features.
|
|
76
|
+
|
|
77
|
+
Select Providers from the user-visible behavior, query each live contract, and
|
|
78
|
+
compose only in the Plugin code. The services do not imply one another:
|
|
79
|
+
|
|
80
|
+
- **Themes:** use the inspected theme-Plugin registration contract. `/theme`
|
|
81
|
+
is a special single-select Plugin switch: selecting another entry starts its
|
|
82
|
+
Plugin and stops the current Theme Plugin, so every contribution shares one
|
|
83
|
+
unload. Register palette, commands, overlays, slots, and RPC unconditionally
|
|
84
|
+
in that one Plugin. Never read/subscribe to active theme or implement a
|
|
85
|
+
theme condition yourself. Immediate preview uses the inspected registration
|
|
86
|
+
option and enters the same Plugin seat.
|
|
87
|
+
- **Commands:** register a local slash command. Registration publishes slash
|
|
88
|
+
completion and keeps invocation out of the ACP prompt. Its availability is
|
|
89
|
+
the registration's lifetime; Commands does not know about themes, overlays,
|
|
90
|
+
config categories, or Slots.
|
|
91
|
+
- **Slots:** register persistent native `TuiNode` content only when the user
|
|
92
|
+
asked for persistent shell UI. Use stable node ids and update the existing
|
|
93
|
+
contribution instead of creating parallel panels. Select the live seat from
|
|
94
|
+
`Slots.list`: all current seats aggregate contributors. Use
|
|
95
|
+
`conversation.input.dock` for content needing its own line and keep
|
|
96
|
+
`conversation.composer.dock` contributions compact.
|
|
97
|
+
- **Overlays:** open a transient native control only in response to the
|
|
98
|
+
interaction that needs it. A command is one possible trigger, not part of
|
|
99
|
+
the Overlay contract. Do not use a persistent Slot as a transient control.
|
|
100
|
+
- **ACP Session config:** resolve the live option through the inspected
|
|
101
|
+
semantic category, or by id only when the Package is intentionally
|
|
102
|
+
agent-specific. Use the inspected transaction when an interaction needs
|
|
103
|
+
preview/commit/rollback; it owns write ordering, deduplication, first-winner
|
|
104
|
+
finalization, and rollback of unfinished previews with the Plugin run.
|
|
105
|
+
- **ACP Session Plan:** consume `current()` / `subscribe()` when the requested UI
|
|
106
|
+
reflects agent Plan state. This is already folded from standard ACP updates;
|
|
107
|
+
do not parse raw messages or add a Host RPC. A persistent summary and a
|
|
108
|
+
command-opened full view remain independent Slot, Command, and Overlay contributions.
|
|
109
|
+
- **ACP Session statistics:** consume `current()` / `subscribe()` for token,
|
|
110
|
+
cache, turn, step, latency, or throughput UI. The builtin stats line is an
|
|
111
|
+
ordinary Client Plugin in `conversation.composer.dock`; do not scrape the
|
|
112
|
+
transcript or recreate raw ACP event folding in another plugin.
|
|
113
|
+
- **Host-backed behavior:** add a Host half only for Host-owned data. Use the
|
|
114
|
+
Package-private JSON call surface exactly as inspected. ACP Session config is
|
|
115
|
+
already Client-owned and needs no Host RPC.
|
|
116
|
+
|
|
117
|
+
When one Plugin registers several features, register each through its owning
|
|
118
|
+
service and rely on the shared Plugin lifetime for joint unload. If a feature
|
|
119
|
+
must appear or disappear while the Plugin remains loaded, use an inspected
|
|
120
|
+
state/event API and hold that feature's ordinary disposer in the Plugin; do not
|
|
121
|
+
add the condition to an unrelated service's registration schema.
|
|
122
|
+
|
|
123
|
+
Some interactions map a visual range onto a finite ordered choice set. Only
|
|
124
|
+
when the task asks for that mapping, keep the domains separate: for `P` visual
|
|
125
|
+
positions and `N` live choices, position `p` selects
|
|
126
|
+
`min(N - 1, floor(p * N / P))`. Derive the initial visual position from the
|
|
127
|
+
current live choice. This is a local mapping technique, not a prescribed
|
|
128
|
+
Command, Overlay, Theme, or ACP workflow.
|
|
129
|
+
|
|
130
|
+
## Treat supplied media as opaque assets
|
|
131
|
+
|
|
132
|
+
A file-backed theme usually needs stable resource identity, not visual
|
|
133
|
+
understanding. First decide whether knowing the pixels can materially change
|
|
134
|
+
the requested result. When the user supplies valid media plus an ordering
|
|
135
|
+
convention and asks only to use it, treat it as opaque: list the directory once
|
|
136
|
+
if exact names are unknown, sort deterministically, and do not inspect every
|
|
137
|
+
image merely to choose presentation options.
|
|
138
|
+
|
|
139
|
+
Make that one inventory sufficient for authoring: collect candidate names,
|
|
140
|
+
ordering keys, absolute paths, and only metadata the queried API actually
|
|
141
|
+
requires in the same operation. After it succeeds, use the result verbatim;
|
|
142
|
+
do not re-list the directory for validation or path conversion, and do not
|
|
143
|
+
probe sibling or `references` directories the user did not supply.
|
|
144
|
+
|
|
145
|
+
When content-aware judgment really matters — for example crop QA, palette
|
|
146
|
+
extraction, subject detection, or visual comparison — inspect the smallest
|
|
147
|
+
representative subset. If an image call reports that the model or tool lacks
|
|
148
|
+
visual capability, remember that result for the rest of the task and do not
|
|
149
|
+
retry sibling files. Continue with deterministic metadata and runtime defaults
|
|
150
|
+
when visual understanding is optional. If it is essential to the user's
|
|
151
|
+
requested outcome, report that exact missing capability while preserving any
|
|
152
|
+
independent work that remains possible.
|
|
153
|
+
|
|
154
|
+
For a static directory, resolve the ordered absolute paths while authoring and
|
|
155
|
+
embed that immutable list in `code.client`. Client code has no filesystem API.
|
|
156
|
+
Do not add `code.host` or Host RPC just to rediscover a static list at runtime;
|
|
157
|
+
use a Host half only when the user requests live-changing Host-owned assets.
|
|
158
|
+
Omit optional background presentation fields when the inspected Theme contract
|
|
159
|
+
provides safe defaults. This lets the renderer own generic fit, anchor, and
|
|
160
|
+
opacity behavior instead of guessing from image content.
|
|
161
|
+
|
|
162
|
+
When a slider selects both a frame and an ACP option, the frame index remains a
|
|
163
|
+
visual domain and the live ACP choices remain a business domain. Update the
|
|
164
|
+
background through the Theme Plugin's owned registration and map the index to
|
|
165
|
+
the inspected choices separately. Keep that registration, command, overlay,
|
|
166
|
+
and transaction in the same Theme Plugin fiber: no active-theme subscription,
|
|
167
|
+
theme predicate, or side panel is needed.
|
|
168
|
+
|
|
169
|
+
Client code is plain JavaScript: no imports, require, TypeScript, JSX, browser
|
|
170
|
+
globals, Node globals, native timers, raw ACP methods, guessed services, or
|
|
171
|
+
arbitrary compositor events. Every visible effect must disappear with its
|
|
172
|
+
owning Plugin run.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|