@notrico/pi-fold 0.0.0-stage → 3.0.0

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/LICENSE +21 -0
  3. package/README.md +71 -2
  4. package/docs/implementation.md +47 -0
  5. package/docs/performance.md +118 -0
  6. package/docs/renderer-reference.md +110 -0
  7. package/index.ts +53 -0
  8. package/package.json +55 -4
  9. package/scripts/performance-review.mjs +273 -0
  10. package/scripts/preview-work-strip.mjs +84 -0
  11. package/scripts/preview.mjs +232 -0
  12. package/scripts/retained-memory-review.mjs +46 -0
  13. package/scripts/test.mjs +21 -0
  14. package/src/action-intent.ts +93 -0
  15. package/src/display-card.ts +64 -0
  16. package/src/display-line-cache.ts +26 -0
  17. package/src/display-mode.ts +33 -0
  18. package/src/fold-command.ts +61 -0
  19. package/src/inspection.ts +87 -0
  20. package/src/modern-code-content.ts +131 -0
  21. package/src/modern-code-pane.ts +101 -0
  22. package/src/modern-native-tools.ts +79 -0
  23. package/src/modern-prompts-adapter.ts +41 -0
  24. package/src/modern-prompts.ts +185 -0
  25. package/src/modern-recorded-pane.ts +68 -0
  26. package/src/modern-rich-text.ts +48 -0
  27. package/src/modern-skill-prompts.ts +152 -0
  28. package/src/modern-subagent-groups.ts +158 -0
  29. package/src/modern-subagent-messages.ts +176 -0
  30. package/src/modern-subagent-spacing.ts +35 -0
  31. package/src/modern-subagents.ts +52 -0
  32. package/src/modern-thinking-adapter.ts +85 -0
  33. package/src/modern-thinking.ts +236 -0
  34. package/src/modern-tool-content.ts +28 -0
  35. package/src/modern-tool-images.ts +63 -0
  36. package/src/modern-tool-pane.ts +208 -0
  37. package/src/modern-tools.ts +509 -0
  38. package/src/modern-workflows.ts +209 -0
  39. package/src/native-method-chain.ts +31 -0
  40. package/src/permission-presentation.ts +280 -0
  41. package/src/recorded-summary.ts +13 -0
  42. package/src/work-strip-subagents.ts +221 -0
  43. package/src/work-strip-view.ts +104 -0
  44. package/src/work-strip.ts +443 -0
  45. package/tests/action-intent.test.mjs +44 -0
  46. package/tests/codemode.test.mjs +365 -0
  47. package/tests/display-cache-lifecycle.test.mjs +55 -0
  48. package/tests/display-line-cache.test.mjs +48 -0
  49. package/tests/display-mode.test.mjs +25 -0
  50. package/tests/fixtures/preview-fixture.ts +81 -0
  51. package/tests/fold-command.test.mjs +150 -0
  52. package/tests/fold-shortcut.test.mjs +143 -0
  53. package/tests/input-focus.test.mjs +95 -0
  54. package/tests/inspection.test.mjs +50 -0
  55. package/tests/mixed-thinking.test.mjs +319 -0
  56. package/tests/modern-prompts.test.mjs +84 -0
  57. package/tests/modern-skill-prompts.test.mjs +174 -0
  58. package/tests/modern-subagent-groups.test.mjs +132 -0
  59. package/tests/modern-subagent-messages.test.mjs +137 -0
  60. package/tests/modern-thinking.test.mjs +202 -0
  61. package/tests/modern-tools.test.mjs +908 -0
  62. package/tests/modern-workflows.test.mjs +147 -0
  63. package/tests/ordinary-prompts.test.mjs +167 -0
  64. package/tests/permission-presentation.test.mjs +257 -0
  65. package/tests/preview-example.test.mjs +171 -0
  66. package/tests/reload-lifecycle.test.mjs +161 -0
  67. package/tests/subagent-spacing.test.mjs +34 -0
  68. package/tests/test-runtime.mjs +58 -0
  69. package/tests/work-strip-final-surface.test.mjs +271 -0
  70. package/tests/work-strip-hierarchy.test.mjs +258 -0
  71. package/tests/work-strip-preview.test.mjs +120 -0
  72. package/tests/work-strip-spacing.test.mjs +208 -0
  73. package/tests/work-strip-subagents.test.mjs +236 -0
  74. package/tests/work-strip.test.mjs +148 -0
@@ -0,0 +1,221 @@
1
+ import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
2
+
3
+ type Status = 'idle' | 'active' | 'unknown';
4
+ const requestEvent = 'subagents:rpc:v1:request';
5
+ const replyPrefix = 'subagents:rpc:v1:reply:';
6
+ const terminalStates = new Set(['complete', 'completed', 'failed', 'partial', 'stopped', 'rejected']);
7
+ let nextRequest = 0;
8
+ const unfinished = (node: any): boolean => !node || !terminalStates.has(node.state)
9
+ || node.children !== undefined && (!Array.isArray(node.children) || node.children.some(unfinished));
10
+ const runId = (event: any): string | undefined => {
11
+ const id = typeof event?.id === 'string' && event.id.trim() ? event.id : undefined;
12
+ const run = typeof event?.runId === 'string' && event.runId.trim() ? event.runId : undefined;
13
+ return event?.childId !== undefined || id && run && id !== run ? undefined : id || run;
14
+ };
15
+ const completionState = (event: any): string | undefined => {
16
+ if (event?.stopped === true) return 'stopped';
17
+ const state = event?.state ?? event?.status;
18
+ if (state === 'paused' || state === 'blocked' || event?.interrupted === true || event?.success === false && event?.exitCode === 0) return 'paused';
19
+ return state ?? (typeof event?.success === 'boolean' ? event.success ? 'complete' : 'failed' : undefined);
20
+ };
21
+
22
+ function replyStatus(data: any): Status {
23
+ const active = data?.fleet?.totalActive;
24
+ if (!Number.isSafeInteger(active) || active < 0) return 'unknown';
25
+ if (active > 0) return 'active';
26
+ const snapshot = data?.asyncSnapshot;
27
+ if (snapshot === undefined) return 'idle';
28
+ if (!snapshot || !Array.isArray(snapshot.runs)) return 'unknown';
29
+ if (snapshot.runs.some(unfinished)) return 'active';
30
+ if (snapshot.omitted?.runs > 0 || snapshot.omitted?.children > 0 || snapshot.omitted?.byteLimitExceeded === true) return 'unknown';
31
+ return 'idle';
32
+ }
33
+
34
+ /** Observe child status through the provider's read-only RPC bus. Missing evidence
35
+ * keeps a work strip open; this monitor never starts or controls a child. */
36
+ export function monitorWorkStripSubagents(pi: ExtensionAPI, onChange: () => void): {
37
+ hasProvider(): boolean;
38
+ current(): Status;
39
+ statusFor(ids: readonly string[]): Status;
40
+ refresh(): void;
41
+ reset(): void;
42
+ dispose(): void;
43
+ } {
44
+ let provider = false, seenProvider = false, disposed = false, generation = 0;
45
+ let status: Status = 'idle';
46
+ type Child = { runId?: string; key?: string; status: Status };
47
+ const runs = new Map<string, Status>(), descendants = new Map<string, Map<string, Child>>();
48
+ let timeout: ReturnType<typeof setTimeout> | undefined;
49
+ let deferred: ReturnType<typeof setTimeout> | undefined;
50
+ let unsubscribeReply: (() => void) | undefined;
51
+ const set = (value: Status, available = provider, recordsChanged = false) => {
52
+ const changed = recordsChanged || value !== status || available !== provider;
53
+ status = value; provider = available;
54
+ if (changed && !disposed) onChange();
55
+ };
56
+ const record = (id: string, value: Status): boolean => {
57
+ const changed = runs.get(id) !== value;
58
+ runs.set(id, value); return changed;
59
+ };
60
+ const childMap = (parent: string) => {
61
+ let children = descendants.get(parent);
62
+ if (!children) { children = new Map(); descendants.set(parent, children); }
63
+ return children;
64
+ };
65
+ const recordChild = (parent: string, id: string, child: Child): boolean => {
66
+ const children = childMap(parent), previous = children.get(id);
67
+ if (child.key) for (const [key, known] of children) if (key !== id && (known.key === child.key || known.runId === child.key)) children.delete(key);
68
+ const next = { ...previous, ...child };
69
+ const changed = previous?.runId !== next.runId || previous?.key !== next.key || previous?.status !== next.status;
70
+ children.set(id, next); return changed;
71
+ };
72
+ const stateStatus = (state: any): Status => typeof state !== 'string' ? 'unknown' : terminalStates.has(state) ? 'idle' : 'active';
73
+ const resultStatus = (child: any): Status => {
74
+ const values = [stateStatus(completionState(child))];
75
+ if (Array.isArray(child?.children)) values.push(...child.children.map(resultStatus));
76
+ else if (child?.children !== undefined) values.push('unknown');
77
+ return values.includes('active') ? 'active' : values.includes('unknown') ? 'unknown' : 'idle';
78
+ };
79
+ const recordResults = (parent: string, results: any): boolean => {
80
+ if (results === undefined) return false;
81
+ if (!Array.isArray(results)) return recordChild(parent, 'invalid-results', { status: 'unknown' });
82
+ let changed = false;
83
+ results.forEach((child: any, index: number) => {
84
+ const id = typeof child?.runId === 'string' && child.runId.trim() ? child.runId : undefined;
85
+ const key = typeof child?.workflowKey === 'string' && child.workflowKey.trim() ? child.workflowKey : undefined;
86
+ const value = stateStatus(completionState(child));
87
+ if (id && !runs.has(id)) changed = record(id, value) || changed;
88
+ changed = recordChild(parent, id ? `run:${id}` : key ? `key:${key}` : `anonymous:${index}`, { runId: id, key, status: id ? value : resultStatus(child) }) || changed;
89
+ if (id && child?.children !== undefined) changed = recordResults(id, child.children) || changed;
90
+ });
91
+ return changed;
92
+ };
93
+ const recordSnapshot = (data: any): boolean => {
94
+ let changed = false;
95
+ if (!Number.isSafeInteger(data?.fleet?.totalActive) || data.fleet.totalActive < 0 || !Array.isArray(data?.asyncSnapshot?.runs)) return false;
96
+ // Step IDs do not create root records. They can update a child already linked
97
+ // by its launch or workflow result. Dispatch completion does not settle children.
98
+ for (const root of data.asyncSnapshot.runs) {
99
+ if (typeof root?.id !== 'string' || !root.id.trim()) continue;
100
+ changed = record(root.id, stateStatus(root.state)) || changed;
101
+ if (root.children !== undefined && !Array.isArray(root.children)) {
102
+ changed = recordChild(root.id, 'invalid-children', { status: 'unknown' }) || changed;
103
+ continue;
104
+ }
105
+ const visit = (node: any, path: string) => {
106
+ const nodeId = typeof node?.id === 'string' && node.id.trim() ? node.id : undefined;
107
+ const linkedEntry = [...childMap(root.id)].find(([, child]) => child.runId === nodeId || child.key === nodeId);
108
+ const linked = linkedEntry?.[1];
109
+ const id = linked?.runId || nodeId;
110
+ const value = stateStatus(node?.state);
111
+ if (id && runs.has(id)) changed = record(id, value) || changed;
112
+ changed = recordChild(root.id, linkedEntry?.[0] || (id ? `run:${id}` : `snapshot:${path}`), { runId: id === root.id ? undefined : id, key: linked?.key, status: value }) || changed;
113
+ if (Array.isArray(node?.children)) node.children.forEach((child: any, index: number) => visit(child, `${path}:${index}`));
114
+ else if (node?.children !== undefined) changed = recordChild(root.id, `invalid:${path}`, { status: 'unknown' }) || changed;
115
+ };
116
+ root.children?.forEach((child: any, index: number) => visit(child, String(index)));
117
+ const omitted = data.asyncSnapshot.omitted;
118
+ if (root.children?.length && !unfinished(root) && !(omitted?.runs > 0 || omitted?.children > 0 || omitted?.byteLimitExceeded)) {
119
+ // A full terminal descendant tree can resolve an anonymous dispatch result.
120
+ for (const [key, child] of childMap(root.id)) if (key.startsWith('anonymous:') || key === 'invalid-results' || key === 'invalid-children') changed = recordChild(root.id, key, { ...child, status: 'idle' }) || changed;
121
+ }
122
+ }
123
+ return changed;
124
+ };
125
+ const runStatus = (id: string, visited = new Set<string>()): Status => {
126
+ if (visited.has(id)) return 'unknown';
127
+ const next = new Set(visited); next.add(id);
128
+ const values: Status[] = [runs.get(id) || 'unknown'];
129
+ for (const child of descendants.get(id)?.values() || []) values.push(child.runId && runs.has(child.runId) ? runStatus(child.runId, next) : child.status);
130
+ return values.includes('active') ? 'active' : values.includes('unknown') ? 'unknown' : 'idle';
131
+ };
132
+ const statusFor = (ids: readonly string[]): Status => {
133
+ if (!ids.length) return 'idle';
134
+ const values = ids.map(id => runStatus(id));
135
+ return values.includes('active') ? 'active' : values.includes('unknown') ? 'unknown' : 'idle';
136
+ };
137
+ const detect = () => {
138
+ try { return seenProvider || pi.getAllTools().some(tool => /^(subagent|subagents)$/.test(tool.name)); }
139
+ catch { return seenProvider || provider; }
140
+ };
141
+ const cancelRequest = () => {
142
+ generation++;
143
+ if (timeout) clearTimeout(timeout);
144
+ timeout = undefined;
145
+ unsubscribeReply?.(); unsubscribeReply = undefined;
146
+ };
147
+ const cancelDeferred = () => {
148
+ if (deferred) clearTimeout(deferred);
149
+ deferred = undefined;
150
+ };
151
+ const refresh = () => {
152
+ if (disposed) return;
153
+ cancelDeferred(); cancelRequest();
154
+ if (!detect()) { set('idle', false); return; }
155
+ set('unknown', true);
156
+ const ownGeneration = generation, requestId = `compact-work-strip-${Date.now()}-${++nextRequest}`;
157
+ const finish = (value: Status, recordsChanged = false) => {
158
+ if (disposed || generation !== ownGeneration) return;
159
+ cancelRequest(); set(value, provider, recordsChanged);
160
+ };
161
+ const off = pi.events.on(`${replyPrefix}${requestId}`, (reply: any) => {
162
+ if (reply?.requestId !== requestId || disposed || generation !== ownGeneration) return;
163
+ const valid = reply.version === 1 && reply.method === 'status' && reply.success === true;
164
+ finish(valid ? replyStatus(reply.data) : 'unknown', valid && recordSnapshot(reply.data));
165
+ });
166
+ unsubscribeReply = typeof off === 'function' ? off : undefined;
167
+ timeout = setTimeout(() => finish('unknown'), 1000);
168
+ timeout.unref?.();
169
+ try {
170
+ pi.events.emit(requestEvent, { version: 1, requestId, method: 'status', params: {}, source: { extension: 'pi-fold' } });
171
+ } catch { finish('unknown'); }
172
+ };
173
+ const scheduleRefresh = (recordsChanged = false) => {
174
+ if (disposed) return;
175
+ seenProvider = true;
176
+ cancelRequest();
177
+ set(status === 'active' ? 'active' : 'unknown', true, recordsChanged);
178
+ if (deferred) return;
179
+ deferred = setTimeout(() => { deferred = undefined; refresh(); }, 0);
180
+ deferred.unref?.();
181
+ };
182
+ const subscriptions = [
183
+ pi.events.on('subagent:async-started', (event: any) => {
184
+ if (disposed) return;
185
+ seenProvider = true;
186
+ const id = runId(event);
187
+ let changed = id ? record(id, 'active') : false;
188
+ if (id) descendants.delete(id);
189
+ if (id && typeof event?.parentWorkflowRunId === 'string' && event.parentWorkflowRunId.trim()) changed = recordChild(event.parentWorkflowRunId, `run:${id}`, { runId: id, key: event.workflowKey, status: 'active' }) || changed;
190
+ cancelDeferred(); cancelRequest(); set('active', true, changed);
191
+ }),
192
+ pi.events.on('subagent:async-complete', (event: any) => {
193
+ if (disposed) return;
194
+ const id = runId(event);
195
+ const state = completionState(event);
196
+ let changed = false;
197
+ if (id && typeof state === 'string') {
198
+ changed = record(id, stateStatus(state));
199
+ changed = recordResults(id, event.results) || changed;
200
+ }
201
+ scheduleRefresh(changed);
202
+ }),
203
+ ...['subagent:child-status', 'subagent:process-terminal', 'subagents:rpc:v1:ready'].map(event => pi.events.on(event, () => scheduleRefresh())),
204
+ ];
205
+ const reset = () => {
206
+ if (disposed) return;
207
+ cancelDeferred(); cancelRequest();
208
+ const recordsChanged = runs.size > 0 || descendants.size > 0;
209
+ runs.clear(); descendants.clear();
210
+ refresh();
211
+ if (recordsChanged && !disposed) onChange();
212
+ };
213
+ const dispose = () => {
214
+ if (disposed) return;
215
+ disposed = true;
216
+ cancelDeferred(); cancelRequest();
217
+ subscriptions.forEach(off => { if (typeof off === 'function') off(); });
218
+ };
219
+ reset();
220
+ return { hasProvider: () => provider, current: () => status, statusFor, refresh, reset, dispose };
221
+ }
@@ -0,0 +1,104 @@
1
+ import { Box, Markdown, truncateToWidth, visibleWidth } from '@earendil-works/pi-tui';
2
+ import { activityRow, cardContentWidth, fillBackground } from './display-card.ts';
3
+
4
+ /** Shared with inspection. Canonical native children stay untouched. */
5
+ export const projectedChildren = Symbol.for('compact-renderer:projected-children:v1');
6
+ export const workEvidenceType = 'compact-renderer:work-settled:v1';
7
+ /** Paint native reply Markdown with one filled row above and below the reply.
8
+ * Native containers own the added rows and mouse layout. The outer message gap,
9
+ * thinking, text gutters, image payloads and OSC zones retain native rendering. */
10
+ export function renderFinalReply(row: any, width: number, theme: any): string[] {
11
+ const restore: (() => void)[] = [];
12
+ const container = row.contentContainer, children = container?.children;
13
+ const first = children?.findIndex((child: any) => child instanceof Markdown) ?? -1;
14
+ if (first < 0) return row.render(width);
15
+ const last = children.findLastIndex((child: any) => child instanceof Markdown);
16
+ const padding = { invalidate() {}, render: (contentWidth: number) => [fillBackground('', contentWidth, theme, 'toolPendingBg')] };
17
+ for (const child of children) {
18
+ if (!(child instanceof Markdown)) continue;
19
+ const native = child.render, own = Object.getOwnPropertyDescriptor(child, 'render');
20
+ child.render = function(contentWidth: number) {
21
+ return native.call(this, contentWidth).map((line: string) => line.includes('\x1b_G') || line.includes('\x1b]1337;File=') ? line : fillBackground(line, Math.max(contentWidth, visibleWidth(line)), theme, 'toolPendingBg'));
22
+ };
23
+ restore.push(() => { if (own) Object.defineProperty(child, 'render', own); else delete (child as any).render; });
24
+ }
25
+ container.children = [...children.slice(0, first), padding, ...children.slice(first, last + 1), padding, ...children.slice(last + 1)];
26
+ try { return row.render(width); } finally { container.children = children; restore.forEach(fn => fn()); }
27
+ }
28
+ /** Native Box owns both rendering and mouse-coordinate translation. */
29
+ export class WorkChild extends Box {
30
+ private inset = 2;
31
+ constructor(row: any) { super(2, 0); this.addChild(row); }
32
+ render(width: number) {
33
+ const padding = width >= 8 ? 2 : 0;
34
+ if (this.inset !== padding) { this.inset = padding; this.setPaddingX(padding); }
35
+ return super.render(width);
36
+ }
37
+ }
38
+ export type WorkEvidence = { version: 1; userId: string; finalId: string; endId: string; startedAt: number; endedAt: number; outcome: 'completed' | 'interrupted' | 'error' };
39
+
40
+ export function workSummary(value: unknown): string {
41
+ if (typeof value !== 'string') return '';
42
+ const text = value.slice(0, 1024).replace(/^[\s#>*`_-]+/, '').replace(/[\p{Cc}\p{Cf}]/gu, ' ').replace(/\s+/g, ' ').trim();
43
+ return truncateToWidth(text.match(/^.*?[.!?。!?](?:\s|$)/u)?.[0]?.trim() || text, 100, '…');
44
+ }
45
+
46
+ export function workDuration(ms: number): string {
47
+ const seconds = Math.max(0, Math.floor(ms / 1000));
48
+ return seconds >= 3600 ? `${Math.floor(seconds / 3600)}h ${Math.floor(seconds % 3600 / 60)}m` : seconds >= 60 ? `${Math.floor(seconds / 60)}m ${seconds % 60}s` : `${seconds}s`;
49
+ }
50
+
51
+ /** Completion evidence refers only to entries on this branch. No prose inference. */
52
+ export function recordedWorkEvidence(entries: readonly any[]): Map<string, WorkEvidence> {
53
+ const result = new Map<string, WorkEvidence>(), positions = new Map(entries.map((entry, index) => [entry.id, index]));
54
+ for (const [index, entry] of entries.entries()) {
55
+ const d = entry?.data;
56
+ if (entry?.type !== 'custom' || entry.customType !== workEvidenceType || d?.version !== 1 || !['completed', 'interrupted', 'error'].includes(d.outcome)) continue;
57
+ const start = positions.get(d.userId), final = positions.get(d.finalId), end = positions.get(d.endId);
58
+ if (start === undefined || final === undefined || end === undefined || start >= final || final > end || end >= index) continue;
59
+ if (entries[start].message?.role !== 'user' || entries[final].message?.role !== 'assistant') continue;
60
+ const message = entries[final].message;
61
+ if (!Array.isArray(message.content) || !message.content.some((b: any) => b?.type === 'text' && typeof b.text === 'string' && /\S/.test(b.text))) continue;
62
+ if (d.outcome === 'completed' && message.stopReason !== 'stop') continue;
63
+ if (entries.slice(final + 1, end + 1).some(e => e.message?.role === 'assistant')) continue;
64
+ if (entries.slice(start + 1, end + 1).some(e => e.message?.role === 'user')) continue;
65
+ if (!Number.isFinite(d.startedAt) || !Number.isFinite(d.endedAt) || d.startedAt < 0 || d.endedAt < d.startedAt) continue;
66
+ result.set(d.userId, d);
67
+ }
68
+ return result;
69
+ }
70
+
71
+ export class WorkStripHeader {
72
+ open = true;
73
+ manual = false;
74
+ focused = false;
75
+ state: 'history' | 'working' | 'waiting' | 'completed' | 'interrupted' | 'error' | 'stopped' = 'history';
76
+ summary = '';
77
+ elapsedMs = 0;
78
+ theme: any;
79
+ private width = 0;
80
+ constructor(private changed: (mouse?: boolean) => void = () => {}) {}
81
+ invalidate() {}
82
+ toggle() { this.manual = true; this.open = !this.open; this.changed(true); }
83
+ expand() { this.manual = true; this.open = true; this.changed(); }
84
+ finish(following: boolean) { if (following && !this.manual && this.state === 'completed') this.open = false; }
85
+ get title() {
86
+ if (this.state === 'completed') return `Worked for ${workDuration(this.elapsedMs)}`;
87
+ if (this.state === 'history') return 'Work details';
88
+ const label = this.state === 'working' ? 'Working' : this.state === 'waiting' ? 'Waiting' : this.state === 'interrupted' ? 'Interrupted' : 'Stopped';
89
+ return `${label} · ${workDuration(this.elapsedMs)}${this.summary ? ` · ${this.summary}` : ''}`;
90
+ }
91
+ render(width: number) {
92
+ this.width = width;
93
+ const label = `${this.open ? '▾' : '▸'} ${this.title}`;
94
+ const remaining = cardContentWidth(width) - visibleWidth(label) - 2;
95
+ const divider = remaining >= 4 ? ` ${'─'.repeat(remaining)}` : '';
96
+ const heading = this.theme ? this.theme.fg(this.state === 'error' ? 'error' : 'muted', label) : label;
97
+ return ['', activityRow(heading + (this.theme ? this.theme.fg('dim', divider) : divider), width, this.theme, this.focused)];
98
+ }
99
+ handleMouse(event: any) {
100
+ if (event.type === 'click' && event.button === 'left' && event.y === 1 && event.x >= 0 && event.x < this.width && !event.ctrl && !event.alt && !event.shift) {
101
+ this.toggle(); return { handled: true, render: true };
102
+ }
103
+ }
104
+ }