ompchamber 0.7.0 → 0.8.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 (107) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/static/css/index.5c0447cefe.css +2 -0
  3. package/dist/client/static/js/async/{3y.4c2596f64c.js → 3y.71f2ccf3b6.js} +2 -2
  4. package/dist/client/static/js/async/{xw.ae67ba06fd.js → 5b.0d6ae50fe8.js} +10 -10
  5. package/dist/client/static/js/async/5bh.8b2363424f.js +1 -0
  6. package/dist/client/static/js/async/{vy.bbe114c4e0.js → bi.09688ba75c.js} +1 -2
  7. package/dist/client/static/js/async/c.797d933882.js +1 -0
  8. package/dist/client/static/js/async/{dc.6dc4b0a04b.js → dc.856fda6560.js} +2 -2
  9. package/dist/client/static/js/async/{g.86e2256a70.js → g.d1c2fe09aa.js} +2 -2
  10. package/dist/client/static/js/async/g.d1c2fe09aa.js.LICENSE.txt +11 -0
  11. package/dist/client/static/js/async/{m.4b29d34f93.js → m.0896dab823.js} +2 -2
  12. package/dist/client/static/js/async/ma.2c261b04dd.js +2 -0
  13. package/dist/client/static/js/async/nam.b5663e919f.js +10 -0
  14. package/dist/client/static/js/async/nam.b5663e919f.js.LICENSE.txt +11 -0
  15. package/dist/client/static/js/async/{q.542c184fec.js → q.23af2a358f.js} +3 -3
  16. package/dist/client/static/js/async/{s.413c2a4683.js → s.222ee974f6.js} +2 -2
  17. package/dist/client/static/js/async/t.4dca0e2ba8.js +1 -0
  18. package/dist/client/static/js/async/uf.46ad6209fa.js +2 -0
  19. package/dist/client/static/js/async/x4.69ec69c61b.js +6 -0
  20. package/dist/client/static/js/async/xn.6360379f71.js +2 -0
  21. package/dist/client/static/js/async/xnl.feb0021e50.js +2 -0
  22. package/dist/client/static/js/index.dc5f5fabe8.js +33 -0
  23. package/dist/client/static/js/{uy.2e8929ed0c.js → jp.50817896f3.js} +6 -6
  24. package/package.json +1 -1
  25. package/src/client/components/common/MarkdownRenderer.tsx +69 -27
  26. package/src/client/components/common/code-editor/history.test.ts +118 -0
  27. package/src/client/components/common/code-editor/history.ts +101 -0
  28. package/src/client/components/common/code-editor/index.tsx +56 -66
  29. package/src/client/components/common/code-surface/index.tsx +84 -11
  30. package/src/client/components/common/code-surface/measure.ts +66 -17
  31. package/src/client/components/common/diagram-viewer/index.tsx +258 -0
  32. package/src/client/components/common/diagram-viewer/read-block.ts +53 -0
  33. package/src/client/components/layout/session-sidebar/CategoryItem.tsx +1 -0
  34. package/src/client/components/layout/session-sidebar/SessionItem.tsx +10 -3
  35. package/src/client/components/settings/LazyModal.tsx +1 -1
  36. package/src/client/components/settings/Modal.tsx +2 -1
  37. package/src/client/components/workspace/chat-timeline/ToolCallCard.tsx +8 -1
  38. package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +11 -52
  39. package/src/client/components/workspace/chat-timeline/chat-input/selection.ts +57 -0
  40. package/src/client/components/workspace/chat-timeline/index.tsx +121 -107
  41. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FrameControl.tsx +172 -0
  42. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionBlock.tsx +155 -0
  43. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/drafts.ts +113 -0
  44. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +92 -0
  45. package/src/client/components/workspace/chat-timeline/tool-renderers/{ask-dialog → extension-dialog}/Footer.tsx +3 -3
  46. package/src/client/components/workspace/chat-timeline/tool-renderers/{ask-dialog → extension-dialog}/Header.tsx +3 -3
  47. package/src/client/components/workspace/chat-timeline/tool-renderers/{ask-dialog → extension-dialog}/Lazy.tsx +8 -8
  48. package/src/client/components/workspace/chat-timeline/tool-renderers/{ask-dialog → extension-dialog}/SelectBody.tsx +3 -3
  49. package/src/client/components/workspace/chat-timeline/tool-renderers/{ask-dialog → extension-dialog}/index.tsx +16 -10
  50. package/src/client/components/workspace/chat-timeline/tool-renderers/index.tsx +2 -2
  51. package/src/client/components/workspace/file-explorer/index.tsx +18 -5
  52. package/src/client/hooks/chat/omp/session-list.tsx +4 -0
  53. package/src/client/hooks/chat/timeline/actions.ts +0 -9
  54. package/src/client/hooks/chat/timeline/ask-frames.ts +102 -0
  55. package/src/client/hooks/chat/timeline/extension-dialog.ts +12 -9
  56. package/src/client/hooks/chat/timeline/index.ts +6 -8
  57. package/src/client/hooks/chat/timeline/prompt-text.ts +35 -0
  58. package/src/client/hooks/chat/timeline/send.ts +13 -27
  59. package/src/client/hooks/chat/timeline/session-load.ts +48 -106
  60. package/src/client/hooks/chat/timeline/session-pagination.ts +144 -0
  61. package/src/client/hooks/editor/use-code-window.ts +118 -0
  62. package/src/client/hooks/ui/input-required-alert.ts +43 -0
  63. package/src/client/hooks/ui/notification-sound.ts +65 -0
  64. package/src/client/hooks/ui/theme.ts +22 -6
  65. package/src/client/tailwind.css +38 -12
  66. package/src/server/lib/omp/rpc/manager.ts +14 -3
  67. package/src/server/lib/omp/rpc/session-registry.ts +18 -0
  68. package/src/server/lib/omp/session/sidebar-data.server.ts +7 -1
  69. package/src/shared/lib/chat/ask-questions.test.ts +169 -0
  70. package/src/shared/lib/chat/ask-questions.ts +264 -0
  71. package/src/shared/lib/code/lazy-window.test.ts +161 -0
  72. package/src/shared/lib/code/lazy-window.ts +156 -0
  73. package/src/shared/lib/code/syntax-highlight.test.ts +50 -1
  74. package/src/shared/lib/code/syntax-highlight.ts +14 -1
  75. package/src/shared/lib/code/windowed-highlight.ts +63 -0
  76. package/src/shared/lib/markdown/mermaid.ts +8 -6
  77. package/src/shared/types/omp/agent.ts +2 -2
  78. package/src/shared/types/workspace.ts +4 -0
  79. package/dist/client/static/css/index.51f68210a5.css +0 -2
  80. package/dist/client/static/js/async/5b.d88304bc13.js +0 -1
  81. package/dist/client/static/js/async/c.cd45b0ac45.js +0 -1
  82. package/dist/client/static/js/async/fw.6a51998a8e.js +0 -6
  83. package/dist/client/static/js/async/kc.bbdb35b771.js +0 -1
  84. package/dist/client/static/js/async/mw.ca1512563c.js +0 -10
  85. package/dist/client/static/js/async/rf.d626afc367.js +0 -2
  86. package/dist/client/static/js/async/t.cda4891526.js +0 -1
  87. package/dist/client/static/js/async/uf.24ca3d49c3.js +0 -2
  88. package/dist/client/static/js/async/v0.394ed37c6b.js +0 -2
  89. package/dist/client/static/js/async/v0.394ed37c6b.js.LICENSE.txt +0 -6
  90. package/dist/client/static/js/async/vy.bbe114c4e0.js.LICENSE.txt +0 -6
  91. package/dist/client/static/js/async/xn.afecebbbd9.js +0 -2
  92. package/dist/client/static/js/index.eccad0b70a.js +0 -33
  93. package/dist/client/static/js/index.eccad0b70a.js.LICENSE.txt +0 -4
  94. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Ask.tsx +0 -205
  95. /package/dist/client/static/js/async/{3y.4c2596f64c.js.LICENSE.txt → 3y.71f2ccf3b6.js.LICENSE.txt} +0 -0
  96. /package/dist/client/static/js/async/{g.86e2256a70.js.LICENSE.txt → 5b.0d6ae50fe8.js.LICENSE.txt} +0 -0
  97. /package/dist/client/static/js/async/{dc.6dc4b0a04b.js.LICENSE.txt → dc.856fda6560.js.LICENSE.txt} +0 -0
  98. /package/dist/client/static/js/async/{fw.6a51998a8e.js.LICENSE.txt → m.0896dab823.js.LICENSE.txt} +0 -0
  99. /package/dist/client/static/js/async/{m.4b29d34f93.js.LICENSE.txt → ma.2c261b04dd.js.LICENSE.txt} +0 -0
  100. /package/dist/client/static/js/async/{mw.ca1512563c.js.LICENSE.txt → q.23af2a358f.js.LICENSE.txt} +0 -0
  101. /package/dist/client/static/js/async/{q.542c184fec.js.LICENSE.txt → s.222ee974f6.js.LICENSE.txt} +0 -0
  102. /package/dist/client/static/js/async/{rf.d626afc367.js.LICENSE.txt → uf.46ad6209fa.js.LICENSE.txt} +0 -0
  103. /package/dist/client/static/js/async/{s.413c2a4683.js.LICENSE.txt → x4.69ec69c61b.js.LICENSE.txt} +0 -0
  104. /package/dist/client/static/js/async/{uf.24ca3d49c3.js.LICENSE.txt → xn.6360379f71.js.LICENSE.txt} +0 -0
  105. /package/dist/client/static/js/async/{xn.afecebbbd9.js.LICENSE.txt → xnl.feb0021e50.js.LICENSE.txt} +0 -0
  106. /package/dist/client/static/js/{async/xw.ae67ba06fd.js.LICENSE.txt → index.dc5f5fabe8.js.LICENSE.txt} +0 -0
  107. /package/dist/client/static/js/{uy.2e8929ed0c.js.LICENSE.txt → jp.50817896f3.js.LICENSE.txt} +0 -0
@@ -1,4 +0,0 @@
1
- /**
2
- * @license
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
@@ -1,205 +0,0 @@
1
- import { useMemo } from 'preact/hooks';
2
- import { CheckCircle2, HelpCircle, XCircle } from 'lucide-preact';
3
- import type { ToolCallData } from '@/shared/types';
4
- import { MarkdownRenderer } from '@/client/components/common/MarkdownRenderer';
5
- import { highlightCode, isCodeLike, tryParseJson } from '@/shared/lib/code/syntax-highlight';
6
- import { useSyntaxReady } from '@/client/hooks/ui/syntax-ready';
7
- import { JsonCodeBlock } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/JsonCodeBlock';
8
- import { CopyButton } from '@/client/components/common/CopyButton';
9
-
10
- interface OptionItem {
11
- label: string;
12
- description?: string;
13
- }
14
-
15
- /** Panel khusus untuk tool `ask` — dialog pertanyaan agent ke user atau konfirmasi. */
16
- export function Ask({ tool }: { tool: ToolCallData }) {
17
- const input = tool.input;
18
- const inputObj = typeof input === 'object' && input !== null ? (input as Record<string, any>) : undefined;
19
-
20
- // 1. Support omp questions array: input.questions[0]
21
- const questionEntry = Array.isArray(inputObj?.questions) && inputObj.questions.length > 0
22
- ? inputObj.questions[0]
23
- : undefined;
24
-
25
- const header = questionEntry?.header;
26
-
27
- const question =
28
- questionEntry?.question ||
29
- (typeof inputObj?.question === 'string'
30
- ? inputObj.question
31
- : typeof inputObj?.prompt === 'string'
32
- ? inputObj.prompt
33
- : typeof inputObj?.message === 'string'
34
- ? inputObj.message
35
- : typeof input === 'string'
36
- ? input
37
- : tool.detail || 'Question from agent');
38
-
39
- // Parse options: can be array of { label, description } or strings
40
- const rawOptions = questionEntry?.options || inputObj?.options || inputObj?.choices || [];
41
- const options: OptionItem[] = Array.isArray(rawOptions)
42
- ? rawOptions.map((opt: unknown) => {
43
- if (typeof opt === 'string') return { label: opt };
44
- if (typeof opt === 'object' && opt !== null) {
45
- const o = opt as Record<string, any>;
46
- return {
47
- label: typeof o.label === 'string' ? o.label : typeof o.text === 'string' ? o.text : String(opt),
48
- description: typeof o.description === 'string' ? o.description : undefined,
49
- };
50
- }
51
- return { label: String(opt) };
52
- })
53
- : [];
54
-
55
- const rawOutput = useMemo(() => {
56
- if (typeof tool.output === 'string') return tool.output;
57
- if (tool.output && typeof tool.output === 'object') return JSON.stringify(tool.output, null, 2);
58
- if (typeof inputObj?.answer === 'string') return inputObj.answer;
59
- if (inputObj?.answer && typeof inputObj?.answer === 'object') return JSON.stringify(inputObj.answer, null, 2);
60
- return '';
61
- }, [tool.output, inputObj?.answer]);
62
-
63
- const isCancelled =
64
- (typeof rawOutput === 'string' && /cancelled|aborted|interrupted|disconnected/i.test(rawOutput)) ||
65
- tool.status === 'aborted' ||
66
- (tool.status === 'error' && typeof rawOutput === 'string' && /disconnect|error/i.test(rawOutput));
67
-
68
- // Extract selected answer if e.g. "User selected: Blue"
69
- const selectedMatch = typeof rawOutput === 'string' ? rawOutput.match(/selected:\s*(.+)$/i) : null;
70
- const selectedAnswer = selectedMatch ? selectedMatch[1].trim() : rawOutput;
71
-
72
- const jsonResult = useMemo(
73
- () => (!isCancelled && rawOutput ? tryParseJson(rawOutput) : { isValid: false }),
74
- [rawOutput, isCancelled]
75
- );
76
-
77
- const isMultilineText = typeof rawOutput === 'string' && rawOutput.includes('\n') && !selectedMatch;
78
-
79
- const syntaxReady = useSyntaxReady();
80
- const highlightedResponse = useMemo(
81
- () => (typeof rawOutput === 'string' && isCodeLike(rawOutput) ? highlightCode(rawOutput, 'javascript') : ''),
82
- [rawOutput, syntaxReady]
83
- );
84
-
85
- return (
86
- <div className="space-y-2">
87
- <div className="rounded-lg border border-ink/10 bg-paper p-3 shadow-xs">
88
- <div className="flex items-start gap-2 min-w-0">
89
- <HelpCircle size={14} className="mt-0.5 shrink-0 text-ink/60" />
90
- <div className="min-w-0 flex-1">
91
- <span className="text-[10px] font-semibold uppercase tracking-wider text-ink/40">
92
- {header ? `Agent Question · ${header}` : 'Agent Question'}
93
- </span>
94
- <div className="mt-1 text-[12.5px] leading-relaxed text-ink/90 select-text">
95
- <MarkdownRenderer content={question} />
96
- </div>
97
- </div>
98
- </div>
99
-
100
- {options.length > 0 && (
101
- <div className="mt-3 space-y-1.5 border-t border-ink/6 pt-2.5">
102
- <span className="text-[9.5px] font-semibold uppercase tracking-wider text-ink/40">
103
- Options
104
- </span>
105
- <div className="grid gap-1.5">
106
- {options.map((opt, idx) => {
107
- const isSelected =
108
- !isCancelled &&
109
- Boolean(selectedAnswer) &&
110
- selectedAnswer.toLowerCase().includes(opt.label.toLowerCase());
111
-
112
- return (
113
- <div
114
- key={idx}
115
- className={`flex flex-col gap-0.5 rounded-md px-2.5 py-1.5 text-[11px] transition-colors ${
116
- isSelected
117
- ? 'border border-ink/30 bg-ink/5 font-medium text-ink'
118
- : 'border border-ink/6 bg-canvas/30 text-ink/75'
119
- }`}
120
- >
121
- <div className="flex items-center gap-2">
122
- <span className="flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded bg-ink/5 font-mono text-[9px] text-ink/60 font-semibold">
123
- {idx + 1}
124
- </span>
125
- <span className="min-w-0 flex-1 truncate font-medium text-ink/90">
126
- {opt.label}
127
- </span>
128
- {isSelected && <CheckCircle2 size={12} className="shrink-0 text-success" />}
129
- </div>
130
- {opt.description && (
131
- <div className="pl-5.5 text-[10px] leading-relaxed text-ink/50">
132
- {opt.description}
133
- </div>
134
- )}
135
- </div>
136
- );
137
- })}
138
- </div>
139
- </div>
140
- )}
141
- </div>
142
-
143
- {/* User Response Section — compact, proportional styling */}
144
- {isCancelled && rawOutput && (
145
- <div className="flex items-center gap-2 rounded-md border border-ink/8 bg-ink/[0.02] px-2.5 py-1 text-[10.5px] text-ink/60">
146
- <XCircle size={11} className="shrink-0 text-ink/40" />
147
- <span className="text-[9px] font-semibold uppercase tracking-wider text-ink/40 shrink-0">
148
- Status:
149
- </span>
150
- <span className="font-mono text-ink/60 truncate select-text">{rawOutput}</span>
151
- </div>
152
- )}
153
-
154
- {!isCancelled && jsonResult.isValid && jsonResult.pretty && (
155
- <JsonCodeBlock
156
- jsonString={jsonResult.pretty}
157
- title="User Response"
158
- maxHeightClass="max-h-40"
159
- compact={true}
160
- icon={<CheckCircle2 size={10.5} className="text-success shrink-0" />}
161
- showHeader={true}
162
- />
163
- )}
164
-
165
- {!isCancelled && !jsonResult.isValid && rawOutput && (
166
- isMultilineText ? (
167
- <div className="overflow-hidden rounded-md border border-ink/8 bg-paper">
168
- <div className="flex items-center justify-between border-b border-ink/6 bg-canvas/40 px-2.5 py-1">
169
- <div className="flex items-center gap-1.5">
170
- <CheckCircle2 size={10.5} className="shrink-0 text-success" />
171
- <span className="text-[9px] font-semibold uppercase tracking-wider text-ink/50">
172
- User Response
173
- </span>
174
- </div>
175
- <CopyButton
176
- text={rawOutput}
177
- className="flex cursor-pointer items-center gap-1 rounded px-1.5 py-0.5 text-[9px] text-ink/45 transition-colors hover:bg-ink/5 hover:text-ink shrink-0"
178
- title="Copy response"
179
- label="Copy"
180
- />
181
- </div>
182
- <pre className="max-h-32 overflow-y-auto p-2 font-mono text-[10.5px] leading-snug whitespace-pre-wrap break-words text-ink/85 select-text">
183
- {highlightedResponse ? (
184
- <span dangerouslySetInnerHTML={{ __html: highlightedResponse }} />
185
- ) : (
186
- rawOutput
187
- )}
188
- </pre>
189
- </div>
190
- ) : (
191
- <div className="flex items-center gap-2 rounded-md border border-ink/8 bg-canvas/30 px-2.5 py-1 text-[10.5px]">
192
- <CheckCircle2 size={11} className="shrink-0 text-success" />
193
- <span className="text-[9px] font-semibold uppercase tracking-wider text-ink/40 shrink-0">
194
- User Response:
195
- </span>
196
- <span className="font-mono text-ink/90 font-medium truncate select-text">
197
- {selectedMatch ? selectedMatch[1].trim().replace(/^["']|["']$/g, '') : rawOutput}
198
- </span>
199
- </div>
200
- )
201
- )}
202
- </div>
203
- );
204
- }
205
-