@alwith/module-chat 0.1.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 (171) hide show
  1. package/LICENSE +94 -0
  2. package/README.md +54 -0
  3. package/THIRD_PARTY_NOTICES.md +43 -0
  4. package/dist/activity-host.d.ts +32 -0
  5. package/dist/activity-host.js +1 -0
  6. package/dist/approval/choice-elicitation-form.d.ts +15 -0
  7. package/dist/approval/choice-elicitation-form.js +1 -0
  8. package/dist/approval/choice-schema.d.ts +18 -0
  9. package/dist/approval/choice-schema.js +1 -0
  10. package/dist/approval/permission-options.d.ts +7 -0
  11. package/dist/approval/permission-options.js +1 -0
  12. package/dist/approval/permission-view.d.ts +19 -0
  13. package/dist/approval/permission-view.js +1 -0
  14. package/dist/approval/schema-elicitation-form.d.ts +29 -0
  15. package/dist/approval/schema-elicitation-form.js +1 -0
  16. package/dist/approval/url-elicitation-card.d.ts +8 -0
  17. package/dist/approval/url-elicitation-card.js +1 -0
  18. package/dist/codex/activity-group.d.ts +15 -0
  19. package/dist/codex/activity-group.js +6 -0
  20. package/dist/codex/assistant-message.d.ts +43 -0
  21. package/dist/codex/assistant-message.js +2 -0
  22. package/dist/codex/disclosure-state.d.ts +2 -0
  23. package/dist/codex/disclosure-state.js +1 -0
  24. package/dist/codex/edited-files-card.d.ts +15 -0
  25. package/dist/codex/edited-files-card.js +2 -0
  26. package/dist/codex/markdown-renderer.d.ts +11 -0
  27. package/dist/codex/markdown-renderer.js +6 -0
  28. package/dist/codex/markdown.css +760 -0
  29. package/dist/codex/navigation-audio.d.ts +18 -0
  30. package/dist/codex/navigation-audio.js +1 -0
  31. package/dist/codex/navigation-instruments.d.ts +54 -0
  32. package/dist/codex/navigation-instruments.js +1 -0
  33. package/dist/codex/navigation-preview.d.ts +8 -0
  34. package/dist/codex/navigation-preview.js +1 -0
  35. package/dist/codex/navigation-rail.css +216 -0
  36. package/dist/codex/navigation-rail.d.ts +25 -0
  37. package/dist/codex/navigation-rail.js +1 -0
  38. package/dist/codex/patch-view.d.ts +8 -0
  39. package/dist/codex/patch-view.js +2 -0
  40. package/dist/codex/plan.d.ts +4 -0
  41. package/dist/codex/plan.js +1 -0
  42. package/dist/codex/styles.css +1238 -0
  43. package/dist/codex/terminal-output.d.ts +3 -0
  44. package/dist/codex/terminal-output.js +1 -0
  45. package/dist/codex/thread-virtualizer.d.ts +52 -0
  46. package/dist/codex/thread-virtualizer.js +1 -0
  47. package/dist/codex/user-message.d.ts +30 -0
  48. package/dist/codex/user-message.js +1 -0
  49. package/dist/codex/virtualized-turn-list.d.ts +16 -0
  50. package/dist/codex/virtualized-turn-list.js +1 -0
  51. package/dist/composer/completion-filter.d.ts +12 -0
  52. package/dist/composer/completion-filter.js +1 -0
  53. package/dist/composer/completion-menu.d.ts +21 -0
  54. package/dist/composer/completion-menu.js +3 -0
  55. package/dist/composer/completion-trigger.d.ts +8 -0
  56. package/dist/composer/completion-trigger.js +3 -0
  57. package/dist/composer/effort-slider.d.ts +10 -0
  58. package/dist/composer/effort-slider.js +1 -0
  59. package/dist/composer/menu-radio.d.ts +15 -0
  60. package/dist/composer/menu-radio.js +1 -0
  61. package/dist/composer/model-select.d.ts +56 -0
  62. package/dist/composer/model-select.js +1 -0
  63. package/dist/composer/permission-mode-select.d.ts +13 -0
  64. package/dist/composer/permission-mode-select.js +1 -0
  65. package/dist/composer/prompt-input-attachments.d.ts +16 -0
  66. package/dist/composer/prompt-input-attachments.js +1 -0
  67. package/dist/composer/prompt-input-clipboard.d.ts +10 -0
  68. package/dist/composer/prompt-input-clipboard.js +1 -0
  69. package/dist/composer/prompt-input-context.d.ts +59 -0
  70. package/dist/composer/prompt-input-context.js +1 -0
  71. package/dist/composer/prompt-input-textarea.d.ts +13 -0
  72. package/dist/composer/prompt-input-textarea.js +3 -0
  73. package/dist/composer/prompt-input.d.ts +44 -0
  74. package/dist/composer/prompt-input.js +1 -0
  75. package/dist/image-lightbox.d.ts +5 -0
  76. package/dist/image-lightbox.js +1 -0
  77. package/dist/image-preview-dialog.d.ts +14 -0
  78. package/dist/image-preview-dialog.js +1 -0
  79. package/dist/lib/code-highlighter.d.ts +27 -0
  80. package/dist/lib/code-highlighter.js +1 -0
  81. package/dist/lib/code-highlighter.worker.d.ts +1 -0
  82. package/dist/lib/code-highlighter.worker.js +1 -0
  83. package/dist/lib/fuzzy.d.ts +11 -0
  84. package/dist/lib/fuzzy.js +1 -0
  85. package/dist/lib/group-blocks.d.ts +5 -0
  86. package/dist/lib/group-blocks.js +1 -0
  87. package/dist/lib/image-encode.d.ts +1 -0
  88. package/dist/lib/image-encode.js +1 -0
  89. package/dist/lib/limits.d.ts +5 -0
  90. package/dist/lib/limits.js +1 -0
  91. package/dist/lib/markdown-parser.d.ts +34 -0
  92. package/dist/lib/markdown-parser.js +1 -0
  93. package/dist/lib/markdown-parser.worker.d.ts +1 -0
  94. package/dist/lib/markdown-parser.worker.js +1 -0
  95. package/dist/lib/markdown-rules.d.ts +9 -0
  96. package/dist/lib/markdown-rules.js +1 -0
  97. package/dist/lib/pointer-centered-zoom.d.ts +13 -0
  98. package/dist/lib/pointer-centered-zoom.js +1 -0
  99. package/dist/lib/prepare-prompt-files.d.ts +7 -0
  100. package/dist/lib/prepare-prompt-files.js +1 -0
  101. package/dist/lib/stream-entry.d.ts +28 -0
  102. package/dist/lib/stream-entry.js +0 -0
  103. package/dist/lib/stream-style.d.ts +15 -0
  104. package/dist/lib/stream-style.js +2 -0
  105. package/dist/lib/streaming-markdown.d.ts +4 -0
  106. package/dist/lib/streaming-markdown.js +2 -0
  107. package/dist/locales.d.ts +489 -0
  108. package/dist/locales.js +1 -0
  109. package/dist/search/chat-search.d.ts +19 -0
  110. package/dist/search/chat-search.js +1 -0
  111. package/dist/search/dom-matches.d.ts +1 -0
  112. package/dist/search/dom-matches.js +1 -0
  113. package/dist/search/find-bar.d.ts +14 -0
  114. package/dist/search/find-bar.js +1 -0
  115. package/dist/search/literal-matches.d.ts +12 -0
  116. package/dist/search/literal-matches.js +1 -0
  117. package/dist/types.d.ts +139 -0
  118. package/dist/types.js +0 -0
  119. package/dist/ui/badge.d.ts +7 -0
  120. package/dist/ui/badge.js +1 -0
  121. package/dist/ui/button.d.ts +8 -0
  122. package/dist/ui/button.js +1 -0
  123. package/dist/ui/card.d.ts +11 -0
  124. package/dist/ui/card.js +1 -0
  125. package/dist/ui/checkbox.d.ts +3 -0
  126. package/dist/ui/checkbox.js +1 -0
  127. package/dist/ui/dialog.d.ts +17 -0
  128. package/dist/ui/dialog.js +1 -0
  129. package/dist/ui/dropdown-menu.d.ts +29 -0
  130. package/dist/ui/dropdown-menu.js +1 -0
  131. package/dist/ui/field.d.ts +24 -0
  132. package/dist/ui/field.js +1 -0
  133. package/dist/ui/hover-card.d.ts +5 -0
  134. package/dist/ui/hover-card.js +1 -0
  135. package/dist/ui/input-group-textarea.d.ts +2 -0
  136. package/dist/ui/input-group-textarea.js +1 -0
  137. package/dist/ui/input-group.d.ts +17 -0
  138. package/dist/ui/input-group.js +1 -0
  139. package/dist/ui/input.d.ts +3 -0
  140. package/dist/ui/input.js +1 -0
  141. package/dist/ui/label.d.ts +3 -0
  142. package/dist/ui/label.js +1 -0
  143. package/dist/ui/radio-group.d.ts +5 -0
  144. package/dist/ui/radio-group.js +1 -0
  145. package/dist/ui/separator.d.ts +3 -0
  146. package/dist/ui/separator.js +1 -0
  147. package/dist/ui/switch.d.ts +5 -0
  148. package/dist/ui/switch.js +1 -0
  149. package/dist/ui/textarea.d.ts +3 -0
  150. package/dist/ui/textarea.js +1 -0
  151. package/dist/ui/tooltip.d.ts +6 -0
  152. package/dist/ui/tooltip.js +1 -0
  153. package/licenses/Apache-2.0.txt +191 -0
  154. package/licenses/_agentclientprotocol_sdk-LICENSE +191 -0
  155. package/licenses/_base-ui_react-LICENSE +21 -0
  156. package/licenses/_floating-ui_dom-LICENSE +20 -0
  157. package/licenses/ai-elements-notice.txt +13 -0
  158. package/licenses/ansi_up-LICENSE +22 -0
  159. package/licenses/class-variance-authority-LICENSE +190 -0
  160. package/licenses/cn-LICENSE +21 -0
  161. package/licenses/diff2html-LICENSE.md +14 -0
  162. package/licenses/entities-LICENSE +11 -0
  163. package/licenses/highlight.js-LICENSE +29 -0
  164. package/licenses/katex-LICENSE +21 -0
  165. package/licenses/lucide-react-LICENSE +43 -0
  166. package/licenses/marked-LICENSE +44 -0
  167. package/licenses/marked-linkify-it-LICENSE +21 -0
  168. package/licenses/react-LICENSE +21 -0
  169. package/licenses/react-dom-LICENSE +21 -0
  170. package/licenses/shadcn-ui-MIT.txt +21 -0
  171. package/package.json +314 -0
package/LICENSE ADDED
@@ -0,0 +1,94 @@
1
+ ALwith Developer and Redistribution License, Version 1.0
2
+ Copyright 2026 ALWITHAI PTE. LTD. All rights reserved, except as expressly granted below.
3
+
4
+ 1. Scope
5
+ This license applies only to ALWITHAI PTE. LTD.'s ("ALwith") own material in
6
+ the npm package accompanying this license (the "Software"). It is a proprietary
7
+ license, not an open-source license. Third-party material is governed by its
8
+ respective licenses, as described in THIRD_PARTY_NOTICES.md. No restriction here
9
+ reduces rights granted by those licenses or by mandatory applicable law.
10
+
11
+ 2. Permission to develop and distribute applications
12
+ Subject to this license, ALwith grants you a worldwide, non-exclusive, royalty-free
13
+ copyright license to use, reproduce, integrate and modify the supplied Software
14
+ to develop, test, host and operate your own applications, including WorkBuddy
15
+ applications, for personal, internal business or commercial use. You may brand,
16
+ sell and distribute those applications, including the Software embedded in them,
17
+ to your customers and end users. No per-application registration, approval or
18
+ royalty is required by this software license.
19
+
20
+ You may bundle, minify, transform and otherwise adapt the supplied JavaScript,
21
+ styles and declarations for those applications. You may include the supplied
22
+ Software in an application source distribution when necessary to build or use
23
+ that application, provided it remains separately identified under this license.
24
+ You may combine it with separately licensed application code, including MPL-2.0
25
+ code, while complying with both licenses. Your own independent code remains yours;
26
+ this license does not require disclosure of your application source code.
27
+
28
+ Recipients may use the embedded Software to run the application and exercise the
29
+ permissions above under this same license. You may allow your contractors and
30
+ hosting providers to use it for those purposes. You must supply this license and
31
+ all applicable third-party notices with each redistribution (for example in an
32
+ included licenses directory or an accessible legal-notices page), identify your
33
+ modifications, and not impose terms that purport to change ALwith's license.
34
+
35
+ 3. Rights reserved
36
+ No right to ALwith's unpublished source code, private repositories, trademarks,
37
+ or separately distributed Runtime binaries, modules or services is granted here.
38
+ You may not relicense the Software as your own framework or redistribute it as
39
+ a standalone SDK/package for others, except for private development/build caches
40
+ used for applications permitted by Section 2. No restriction is imposed on
41
+ independently developed competing applications or on third-party licensed code.
42
+ You must not misrepresent authorship or imply ALwith endorses your application.
43
+
44
+ 4. Accounts and services
45
+ This license does not supply platform credentials, paid entitlements, hosting,
46
+ support, updates or a service-availability guarantee. Use of ALwith accounts,
47
+ pets, relay or other hosted services is separately subject to the applicable
48
+ service terms and authorization. Do not bypass service access controls or use
49
+ another person's credentials without authorization. Choosing or replacing an
50
+ authentication provider for your own application is not prohibited by this
51
+ software license. Distributing an Auth client does not authorize its recipients
52
+ to access another user's account, data or entitlements.
53
+
54
+ 5. Lawful use and independent responsibility
55
+ You must not use the Software to commit or knowingly facilitate unlawful acts.
56
+ You are responsible for your application's operation, permissions, business
57
+ practices, data processing, content and compliance with applicable law. You must
58
+ not make warranties or commitments on ALwith's behalf. ALwith does not endorse
59
+ your application merely because it uses the Software or connects to ALwith.
60
+ These allocations do not remove either party's own mandatory legal obligations.
61
+
62
+ 6. Disclaimer and limitation of liability
63
+ TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE SOFTWARE IS PROVIDED
64
+ "AS IS" AND "AS AVAILABLE", WITHOUT EXPRESS OR IMPLIED WARRANTIES, INCLUDING
65
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, ACCURACY,
66
+ SECURITY OR UNINTERRUPTED OPERATION. AI OUTPUTS AND AUTOMATED ACTIONS MAY BE
67
+ INCORRECT OR HARMFUL; YOU MUST DETERMINE APPROPRIATE REVIEW AND SAFEGUARDS.
68
+
69
+ TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, ALWITH AND ITS CONTRIBUTORS
70
+ ARE NOT LIABLE FOR DAMAGES ARISING FROM USE, MODIFICATION OR DISTRIBUTION OF
71
+ THE SOFTWARE, INCLUDING LOST PROFITS, LOST DATA, BUSINESS INTERRUPTION AND
72
+ INDIRECT OR CONSEQUENTIAL LOSS. NOTHING EXCLUDES OR LIMITS LIABILITY THAT
73
+ CANNOT LAWFULLY BE EXCLUDED OR LIMITED, INCLUDING APPLICABLE MANDATORY CONSUMER
74
+ RIGHTS AND LIABILITY FOR FRAUD, WILLFUL MISCONDUCT OR GROSS NEGLIGENCE WHERE
75
+ SUCH EXCLUSION OR LIMITATION IS PROHIBITED. THIS LICENSE DOES NOT EXCLUDE
76
+ CRIMINAL OR REGULATORY RESPONSIBILITY IMPOSED BY LAW.
77
+
78
+ 7. Duration and termination
79
+ The grant for this version continues while you comply with this license. If
80
+ ALwith gives written notice of a material breach, your rights terminate if you
81
+ do not cure it within 30 days; no cure period authorizes continuing unlawful
82
+ conduct. On termination, cease new use and distribution of ALwith's proprietary
83
+ Software except as required by law. Independently compliant recipients retain
84
+ their own grants. Sections concerning reserved rights, notices, disclaimers and
85
+ mandatory-law exceptions survive as applicable. Third-party licenses are not
86
+ terminated by this provision.
87
+
88
+ 8. Versions and severability
89
+ This license governs the accompanying version. A later license or publication
90
+ of source code does not retroactively replace this grant or revoke rights in
91
+ earlier lawfully obtained versions. Any additional open-source license must be
92
+ expressly identified by ALwith. If a provision is unenforceable, the remaining
93
+ provisions continue to the extent permitted by law. A separate written agreement
94
+ signed by you and ALwith may expressly override these terms for its stated scope.
package/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # @alwith/module-chat
2
+
3
+ Desktop-first shared chat implementation. Distributed under the proprietary license included in this package.
4
+
5
+ Desktop and U share turn virtualization, Desktop's Markdown renderer, activity groups, work sections, plans, user messages, assistant turn layout and edited-file cards. Both apps also consume the composer, completion menu, model/effort/permission selectors, attachments, approval components, search interaction and turn navigation with audio. U maps existing API state to presentation blocks; it does not maintain a second session state. Extraction is not yet a complete product acceptance: source-to-rendered search mapping and end-to-end visual/selection/scroll verification remain outstanding.
6
+
7
+ ## Ownership
8
+
9
+ | Package owns | Application supplies |
10
+ | --- | --- |
11
+ | Message layout, Markdown, activity and tool presentation | Message projection, theme, translations, file/artifact opening and business-specific cards |
12
+ | Composer, attachments, completion and selectors | Controlled draft, available commands/files/models/options, submission and error handling |
13
+ | Approval and elicitation interaction | Original request identity, protocol response, replay and product-specific actions |
14
+ | Virtual list, search UI and turn navigation | Session identity, viewport, source matches, reveal callback and navigation preferences |
15
+
16
+ Application navigation, settings, login pages, update UI and general-purpose product controls are not part of this package. Runtime owns execution; `@alwith/api` owns protocol folding. Applications must not reconstruct run state from the chat presentation.
17
+
18
+ Import @alwith/module-chat/markdown.css for Markdown styling and include the package source in Tailwind's @source scan. Local linked development requires React deduplication in the app bundler; React is a peer, never bundled into chat. Bun component tests alias linked React to the real consumer React exports without installing a global DOM.
19
+
20
+ Run bun install at the workspace root, then bun run --cwd packages/chat typecheck and bun run test:chat. Consumer DOM tests live in both apps and cover the shared implementations through their real app adapters.
21
+
22
+ ACP session folding stays in @alwith/api. This package owns chat presentation and interaction, not Agent processes or a second session database.
23
+
24
+ `search` provides Desktop's complete find bar, DOM matching, highlights and navigation. The host supplies its viewport, labels and native-menu subscription; virtualized callers also supply source matches and an async turn-reveal callback. Key the component by session identity to discard the previous search on a session switch. Highlight ownership is per mounted search, and cancelled navigation cannot repaint after close. Source projection stays with the application's message model; the search component never reads a private store.
25
+
26
+ `search-source` shares Unicode-aware literal matching and original UTF-16 offsets with DOM matching. This does **not** make raw tool fields, Markdown source or folded content equivalent to rendered text: the current per-turn occurrence index still requires a complete source-to-rendered mapping. Do not treat the current search counter as proof that every indexed match can be revealed. Automatic expansion of folded matches has not been agreed.
27
+
28
+ `permission-view` supplies Desktop's approval list, sorting, keyboard selection and optional input-anchored portal. Without an anchor it renders inline. Applications supply request identity, details and the response callback; Desktop replay/pet actions and U's ACP pending-request routing remain in their hosts. Inline callers can select `autoFocus="if-idle"` to avoid taking focus from a draft.
29
+
30
+ `choice-elicitation-form` preserves Desktop's choice questions, Other inputs, previews and notes. `schema-elicitation-form` handles standard schema fields, including text, numbers and booleans. Applications answer the original pending request; the package does not send protocol messages. The latter reuses the API's property guards; local unpublished development resolves `@alwith/api` through the workspace root dependency and override.
31
+
32
+ `url-elicitation-card` provides U's inline pending-link presentation. The host opens the supplied URL and handles decline/cancel; opening a browser does not synthesize an acceptance response. Desktop's separate native URL-consent and authorization flow is unchanged, not replaced by this card.
33
+
34
+ Tool results use Desktop defaults; optional Output/Patch/image actions preserve inline terminal, diff and media behavior. The package includes TerminalOutput and PatchView implementations.
35
+
36
+ For i18next, wrap the application resources once with withChatResources(resources) from @alwith/module-chat/locales. This adds the alwithChat namespace without mutating application resources or choosing its active/fallback language. ActivityHost receives the translator for that namespace. Existing Desktop translations are included; unavailable entries follow the application i18n fallback policy.
37
+
38
+ The composer form comes from `@alwith/module-chat/composer`, with the controller/provider in `composer-context` and the textarea in `composer-textarea`. It owns file selection, drag/drop, image limits and preparation, and clears the draft after successful submission. Supply `onSubmit` and `onSubmitError`; application commands and local file identity are optional host policies. Desktop enables its bash border explicitly. Controls remain internal Desktop-derived primitives, not a general UI component kit. Locally linked apps deduplicate `@base-ui/react` as well as React to keep primitive contexts and hooks on the consumer instance.
39
+
40
+ `composer-attachments` provides the attachment list and chips, with Desktop's hover preview, removal and zoomable image dialog. The chip takes a translator for its three input labels. `image-preview-dialog` exposes the same preview for other chat image entry points; zoom, viewport fitting and pointer-centered scrolling remain package-owned.
41
+
42
+ `completion-menu` owns keyboard selection, focus, insertion and the anchored/inline menu; the host supplies completion data and async file search. `model-select`, `effort-slider` and `permission-mode-select` are controlled: callbacks request a change, while the host supplies the authoritative selected value. Provider catalogs, subscriptions, billing and settings navigation remain application policy.
43
+
44
+ `navigation-rail` owns Desktop's turn markers, preview, observation and scrubbing, and imports its CSS. The host projects turns, releases scroll following before reveal, supplies the virtualizer callback and injects navigation audio actions. `navigation-audio` and `navigation-instruments` share Desktop's sample cache, unlock lifecycle, instrument catalog and playback scheduling. Preferences and native diagnostics remain in the application. Linked consumer tests that mock `smplr` must resolve the same module instance as the package; Desktop deduplicates it alongside React and Base UI. Automated tests do not establish audible playback in a packaged application.
45
+
46
+ ## License and redistribution
47
+
48
+ See [LICENSE](LICENSE) and [third-party notices](THIRD_PARTY_NOTICES.md).
49
+ ALwith-owned code is proprietary, not open source. You may build, customize, host,
50
+ charge for and distribute your own WorkBuddy applications under the included
51
+ license, without per-application registration. This does not grant hosted-service
52
+ access or rights to separately distributed Rust libraries or Runtime binaries.
53
+ The npm artifact includes compiled/minified JS, declarations and necessary assets,
54
+ not the private TS/TSX implementation or source maps. Minification is not encryption.
@@ -0,0 +1,43 @@
1
+ # Third-party notices — @alwith/module-chat
2
+
3
+ ALwith's proprietary license applies only to its own material. Third-party
4
+ material retains its original license and rights; the package license does not
5
+ replace or restrict those rights. Preserve applicable notices when redistributing.
6
+
7
+ ## Included/adapted components
8
+
9
+ - UI primitives (`dist/ui/*`) were brought through ALwith Desktop from shadcn/ui. Upstream: https://github.com/shadcn-ui/ui. MIT notice: `licenses/shadcn-ui-MIT.txt`. ALwith adaptations are not upstream releases.
10
+ - Prompt-input family (`dist/composer/prompt-input*`) is conservatively attributed to the Vercel AI Elements lineage pending exact revision verification. Upstream: https://github.com/vercel/ai-elements. Retained copyright: `licenses/ai-elements-notice.txt`; Apache-2.0 terms: `licenses/Apache-2.0.txt`. ALwith modified and split this family for shared context, host callbacks, attachments and Desktop behavior. This attribution does not assert that every file in the family is upstream code.
11
+
12
+ ## External direct dependencies and peers
13
+
14
+ These are external imports, not bundled dependency implementations in this npm
15
+ artifact. Versions below record the local release-preparation inventory; declared
16
+ ranges can resolve to different versions. Keep the notices from the versions
17
+ actually distributed by your application, including transitive dependencies.
18
+
19
+ | Package | Inspected version | License | Included license copy |
20
+ | --- | --- | --- | --- |
21
+ | @agentclientprotocol/sdk | 1.4.0 | Apache-2.0 | `licenses/_agentclientprotocol_sdk-LICENSE` |
22
+ | @base-ui/react | 1.8.0 | MIT | `licenses/_base-ui_react-LICENSE` |
23
+ | @floating-ui/dom | 1.8.0 | MIT | `licenses/_floating-ui_dom-LICENSE` |
24
+ | ansi_up | 6.0.6 | MIT | `licenses/ansi_up-LICENSE` |
25
+ | class-variance-authority | 0.7.1 | Apache-2.0 | `licenses/class-variance-authority-LICENSE` |
26
+ | cn | 0.3.0 | MIT | `licenses/cn-LICENSE` |
27
+ | diff2html | 3.4.56 | MIT | `licenses/diff2html-LICENSE.md` |
28
+ | entities | 8.1.0 | BSD-2-Clause | `licenses/entities-LICENSE` |
29
+ | highlight.js | 11.12.0 | BSD-3-Clause | `licenses/highlight.js-LICENSE` |
30
+ | katex | 0.18.7 | MIT | `licenses/katex-LICENSE` |
31
+ | lucide-react | 1.46.0 | ISC | `licenses/lucide-react-LICENSE` |
32
+ | marked | 18.0.13 | MIT | `licenses/marked-LICENSE` |
33
+ | marked-linkify-it | 4.0.2 | MIT | `licenses/marked-linkify-it-LICENSE` |
34
+ | react | 19.3.0 | MIT | `licenses/react-LICENSE` |
35
+ | react-dom | 19.3.0 | MIT | `licenses/react-dom-LICENSE` |
36
+ | smplr | 1.0.0 | MIT | MIT declared in package.json; full license/copyright notice not found in installed package or upstream repository; release review required |
37
+
38
+ ## Runtime-loaded media
39
+
40
+ `smplr` navigation audio can load instrument samples from external services. Those
41
+ samples are not included in this npm archive. The library license does not license
42
+ all sample collections; verify the selected collection and provider terms before
43
+ redistributing or caching media.
@@ -0,0 +1,32 @@
1
+ import { type ComponentType, type ReactNode } from "react";
2
+ import type { ToolUseBlock } from "./lib/group-blocks.js";
3
+ export type ChatTranslate = (key: string, values?: Record<string, unknown>) => string;
4
+ export interface ActivityHost {
5
+ t: ChatTranslate;
6
+ i18n: {
7
+ language: string;
8
+ };
9
+ openLink: (url: string) => void;
10
+ Output?: ComponentType<{
11
+ text: string;
12
+ }>;
13
+ Patch?: ComponentType<{
14
+ patch: string;
15
+ }>;
16
+ openImage?: (url: string) => void;
17
+ expandToolOutput?: boolean;
18
+ commandStatus?: (block: ToolUseBlock) => string | undefined;
19
+ Markdown: ComponentType<{
20
+ text: string;
21
+ streaming?: boolean;
22
+ }>;
23
+ }
24
+ export declare function ActivityHostProvider({ host, children }: {
25
+ host: ActivityHost;
26
+ children: ReactNode;
27
+ }): import("react").JSX.Element;
28
+ export declare function useActivityHost(): ActivityHost;
29
+ export declare function ActivityMarkdown(props: {
30
+ text: string;
31
+ streaming?: boolean;
32
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{jsx as r}from"react/jsx-runtime";import{createContext as n,useContext as e}from"react";var i=n(null);function v({host:t,children:o}){return r(i.Provider,{value:t,children:o})}function s(){let t=e(i);if(t===null)throw Error("Activity host is missing");return t}function x(t){let{Markdown:o}=s();return r(o,{...t})}export{v as ActivityHostProvider,x as ActivityMarkdown,s as useActivityHost};
@@ -0,0 +1,15 @@
1
+ import { type RefObject } from "react";
2
+ import type { ElicitationFormRequest } from "../types.js";
3
+ export type ChoiceAnnotations = Record<string, {
4
+ preview?: string;
5
+ notes?: string;
6
+ }>;
7
+ export interface ChoiceElicitationFormProps {
8
+ current: ElicitationFormRequest | undefined;
9
+ total: number;
10
+ anchorRef: RefObject<HTMLDivElement | null>;
11
+ t: (key: "askUserQuestion.title" | "askUserQuestion.other" | "askUserQuestion.otherPlaceholder" | "askUserQuestion.notesPlaceholder" | "askUserQuestion.cancel" | "askUserQuestion.submit") => string;
12
+ onAccept: (requestId: string, content: Record<string, string | string[]>, annotations: ChoiceAnnotations) => void | Promise<void>;
13
+ onDecline: (requestId: string) => void | Promise<void>;
14
+ }
15
+ export declare function ChoiceElicitationForm({ current, total, anchorRef, t, onAccept, onDecline, }: ChoiceElicitationFormProps): import("react").ReactPortal | null;
@@ -0,0 +1 @@
1
+ import{jsx as s,jsxs as l}from"react/jsx-runtime";import{autoUpdate as D}from"@floating-ui/dom";import{useCallback as k,useEffect as A,useLayoutEffect as z,useMemo as B,useRef as K,useState as U}from"react";import{createPortal as X}from"react-dom";import{Badge as J}from"../ui/badge.js";import{Button as L}from"../ui/button.js";import{Checkbox as O}from"../ui/checkbox.js";import{Input as q}from"../ui/input.js";import{Label as H}from"../ui/label.js";import{RadioGroup as Y,RadioGroupItem as M}from"../ui/radio-group.js";import{Textarea as Z}from"../ui/textarea.js";import{cn as G}from"cn";import{elicitationFields as ee,elicitationLabels as R,elicitationOptions as I,isMultiSelect as S}from"./choice-schema.js";var d="__other__";function he({current:o,total:P,anchorRef:g,t:u,onAccept:F,onDecline:Q}){let x=B(()=>o?ee(o.requestedSchema):[],[o]),[w,p]=U({}),T=K(null);A(()=>{if(o?.elicitationId===void 0)return;let e={};for(let{key:n,property:r}of x)if(!S(r)){let c=I(r)[0];if(c)e[n]={selected:c.value}}p(e)},[o?.elicitationId,x]),A(()=>{if(o?.elicitationId!==void 0&&T.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")T.current.focus()},[o?.elicitationId]);let[b,_]=U(null),[C,V]=U(null),N=k(()=>{let e=g.current;if(!e)return;let n=e.getBoundingClientRect();if(n.width===0){let r=Math.min(640,window.innerWidth*0.9);_({left:(window.innerWidth-r)/2,width:r,bottom:24});return}_({left:n.left,width:n.width,bottom:window.innerHeight-n.bottom+20})},[g]);z(()=>{if(!o)return;let e=0,n=()=>{if(g.current){N();return}e=requestAnimationFrame(n)};return n(),()=>cancelAnimationFrame(e)},[o,N,g]),z(()=>{let e=g.current;if(!o||!e||!C)return;return D(e,C,N,{animationFrame:!0})},[o,C,g,N]);let y=B(()=>{if(!o)return!1;for(let{key:e,property:n}of x){let r=w[e];if(!r)return!1;if(S(n)){if(!r.selectedSet||r.selectedSet.size===0)return!1;if(r.selectedSet.has(d)&&!r.otherText?.trim())return!1}else{if(!r.selected)return!1;if(r.selected===d&&!r.otherText?.trim())return!1}}return!0},[o,x,w]),W=k(async()=>{if(!o)return;if(!y)return;let e={},n={};for(let{key:r,property:c}of x){let a=w[r];if(!a)continue;let f;if(S(c))e[r]=Array.from(a.selectedSet??[]).map((m)=>m===d?(a.otherText??"").trim():m).filter(Boolean);else{let m=a.selected??"";if(e[r]=m===d?(a.otherText??"").trim():m,m!==d)f=I(c).find((t)=>t.value===m)?.preview}let h=a.notes?.trim();if(f||h)n[r]={...f&&{preview:f},...h&&{notes:h}}}await F(o.elicitationId,e,n)},[o,x,w,y,F]),j=k(async()=>{if(o)await Q(o.elicitationId)},[o,Q]);if(!o||!b)return null;return X(l("div",{"data-overlay":"ask-user-question",tabIndex:0,onKeyDown:(e)=>{if(e.key==="Escape")e.preventDefault(),j()},className:"bg-card border-border fixed z-50 flex flex-col overflow-hidden rounded-lg border shadow-lg outline-none",style:{left:b.left,width:b.width,bottom:b.bottom,maxHeight:"70vh"},ref:(e)=>{T.current=e,V(e)},children:[l("div",{className:"border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",children:[s("div",{className:"text-foreground text-sm font-medium",children:u("askUserQuestion.title")}),P>1&&s("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${P}`})]}),s("div",{className:"min-h-0 flex-1 overflow-y-auto",children:s("div",{className:"space-y-4 px-3 py-3",children:x.map(({key:e,property:n},r)=>{let c=w[e],a=c?.selected,f=c?.selectedSet??new Set,h=I(n),m=S(n);return l("div",{className:"space-y-2",children:[l("div",{className:"flex items-center gap-2",children:[s(J,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:R(n).title??e}),s("div",{className:"text-foreground text-sm font-medium",children:R(n).description})]}),m?l("div",{className:"space-y-1.5 ps-1",children:[h.map((t)=>l("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[s(O,{checked:f.has(t.value),onCheckedChange:(i)=>{p((v)=>{let E=new Set(v[e]?.selectedSet??new Set);if(i)E.add(t.value);else E.delete(t.value);return{...v,[e]:{...v[e],selectedSet:E}}})}}),l("div",{className:"min-w-0 flex-1",children:[s("div",{className:"text-foreground text-sm",children:t.label}),t.description&&s("div",{className:"text-muted-foreground text-xs",children:t.description})]})]},t.value)),l("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[s(O,{checked:f.has(d),onCheckedChange:(t)=>{p((i)=>{let v=new Set(i[e]?.selectedSet??new Set);if(t)v.add(d);else v.delete(d);return{...i,[e]:{...i[e],selectedSet:v}}})}}),s("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:u("askUserQuestion.other")})]}),f.has(d)&&s("div",{className:"ps-7",children:s(q,{placeholder:u("askUserQuestion.otherPlaceholder"),value:c?.otherText??"",onChange:(t)=>p((i)=>({...i,[e]:{...i[e],otherText:t.target.value}}))})})]}):l(Y,{value:a??"",onValueChange:(t)=>p((i)=>({...i,[e]:{...i[e],selected:t}})),className:"space-y-1.5 ps-1",children:[h.map((t)=>{let i=`${r}:${t.value}`;return l("div",{className:G("hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",a===t.value&&"bg-muted/60"),children:[s(M,{value:t.value,id:i}),l(H,{htmlFor:i,className:"min-w-0 flex-1 cursor-pointer",children:[s("div",{className:"text-foreground text-sm font-normal",children:t.label}),t.description&&s("div",{className:"text-muted-foreground text-xs font-normal",children:t.description})]})]},t.value)}),l("div",{className:G("hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",a===d&&"bg-muted/60"),children:[s(M,{value:d,id:`${r}:other`,className:"mt-0.5"}),s(H,{htmlFor:`${r}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:u("askUserQuestion.other")})]}),a===d&&s("div",{className:"ps-7",children:s(q,{placeholder:u("askUserQuestion.otherPlaceholder"),value:c?.otherText??"",onChange:(t)=>p((i)=>({...i,[e]:{...i[e],otherText:t.target.value}}))})})]}),!m&&a&&a!==d&&(()=>{let t=h.find((i)=>i.value===a)?.preview;if(!t)return null;return s("pre",{className:"bg-muted/50 text-muted-foreground ms-1 mt-1 overflow-auto rounded-sm px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap",children:t})})(),h.some((t)=>t.preview)&&s(Z,{placeholder:u("askUserQuestion.notesPlaceholder"),value:c?.notes??"",onChange:(t)=>p((i)=>({...i,[e]:{...i[e],notes:t.target.value}})),rows:1,className:"min-h-0 resize-none text-xs"})]},e)})})}),l("div",{className:"border-border bg-card flex shrink-0 items-center justify-end gap-2 border-t px-3 py-2",children:[s(L,{variant:"ghost",size:"sm",onClick:()=>void j(),children:u("askUserQuestion.cancel")}),s(L,{size:"sm",disabled:!y,onClick:()=>void W(),children:u("askUserQuestion.submit")})]})]}),document.body)}export{he as ChoiceElicitationForm};
@@ -0,0 +1,18 @@
1
+ import type { ElicitationPropertySchema, ElicitationSchema } from "@agentclientprotocol/sdk/experimental/v2";
2
+ export interface ElicitationField {
3
+ key: string;
4
+ property: ElicitationPropertySchema;
5
+ }
6
+ export interface ElicitationOption {
7
+ value: string;
8
+ label: string;
9
+ description?: string;
10
+ preview?: string;
11
+ }
12
+ export declare function elicitationFields(schema: ElicitationSchema): ElicitationField[];
13
+ export declare function elicitationLabels(property: ElicitationPropertySchema): {
14
+ title?: string;
15
+ description?: string;
16
+ };
17
+ export declare function isMultiSelect(property: ElicitationPropertySchema): boolean;
18
+ export declare function elicitationOptions(property: ElicitationPropertySchema): ElicitationOption[];
@@ -0,0 +1 @@
1
+ function c(t){return Object.entries(t.properties??{}).map(([n,i])=>({key:n,property:i}))}function p(t){let{title:n,description:i}=t;return{title:n??void 0,description:i??void 0}}function o(t){return t.type==="array"}function s(t){return(o(t)?t.items?.oneOf??[]:t.oneOf??[]).map((i)=>{let e=i,r=e.const??e.title??"";return{value:r,label:e.title??r,...e.description?{description:e.description}:{},...e._meta?.alwith?.preview?{preview:e._meta.alwith.preview}:{}}})}export{c as elicitationFields,p as elicitationLabels,s as elicitationOptions,o as isMultiSelect};
@@ -0,0 +1,7 @@
1
+ export type PermissionKind = "allow_once" | "allow_always" | "reject_once" | "reject_always";
2
+ export declare const PERMISSION_KIND_GROUP_ORDER: Record<PermissionKind, number>;
3
+ export declare function sortPermissionOptions<T extends {
4
+ kind: string;
5
+ }>(options: readonly T[]): T[];
6
+ export declare function isAllowKind(kind: string): boolean;
7
+ export declare function isAlwaysKind(kind: string): boolean;
@@ -0,0 +1 @@
1
+ var l={allow_once:0,allow_always:1,reject_once:2,reject_always:3};function t(o){return[...o].sort((e,n)=>(l[e.kind]??99)-(l[n.kind]??99))}function a(o){return o==="allow_once"||o==="allow_always"}function r(o){return o==="allow_always"||o==="reject_always"}export{l as PERMISSION_KIND_GROUP_ORDER,a as isAllowKind,r as isAlwaysKind,t as sortPermissionOptions};
@@ -0,0 +1,19 @@
1
+ import { type ReactNode, type RefObject } from "react";
2
+ export interface PermissionViewOption {
3
+ optionId: string;
4
+ name: string;
5
+ kind: string;
6
+ description?: string;
7
+ }
8
+ export interface PermissionViewProps {
9
+ requestId: string;
10
+ options: readonly PermissionViewOption[];
11
+ title: ReactNode;
12
+ children?: ReactNode;
13
+ total?: number;
14
+ alwaysLabel?: string;
15
+ autoFocus?: "always" | "if-idle";
16
+ anchorRef?: RefObject<HTMLDivElement | null>;
17
+ onRespond: (optionId: string | null) => void | Promise<void>;
18
+ }
19
+ export declare function PermissionView({ requestId, options, title, children, total, alwaysLabel, autoFocus, anchorRef, onRespond, }: PermissionViewProps): import("react").JSX.Element | null;
@@ -0,0 +1 @@
1
+ import{jsx as r,jsxs as u}from"react/jsx-runtime";import{autoUpdate as K}from"@floating-ui/dom";import{CheckCheckIcon as S,CheckIcon as I,ShieldXIcon as z,XIcon as M}from"lucide-react";import{useCallback as O,useEffect as h,useLayoutEffect as v,useRef as U,useState as p}from"react";import{createPortal as W}from"react-dom";import{cn as N}from"cn";import{sortPermissionOptions as X}from"./permission-options.js";var B={allow_once:{icon:I},allow_always:{icon:S},reject_once:{icon:M},reject_always:{icon:z}};function Y({requestId:f,options:_,title:j,children:D,total:w=1,alwaysLabel:E="always",autoFocus:y="always",anchorRef:n,onRespond:i}){let[l,x]=p(0),[s,b]=p(null),[c,A]=p(null),g=U(null),a=X(_);h(()=>{x(0)},[f]),h(()=>{let e=document.activeElement;if(y==="always"||e===null||e===document.body)g.current?.focus()},[f,c,y]);let d=O(()=>{let e=n?.current;if(!e)return;let t=e.getBoundingClientRect();if(t.width===0){let o=Math.min(640,window.innerWidth*0.9);b({left:(window.innerWidth-o)/2,width:o,bottom:24});return}b({left:t.left,width:t.width,bottom:window.innerHeight-t.bottom+20})},[n]);if(v(()=>{if(!n)return;let e=0,t=()=>{if(n.current)d();else e=requestAnimationFrame(t)};return t(),()=>cancelAnimationFrame(e)},[f,n,d]),v(()=>{let e=n?.current;if(!e||!c)return;return K(e,c,d,{animationFrame:!0})},[n,c,d]),n&&!s)return null;let k=u("div",{ref:A,"data-overlay":"permission-request",className:N("bg-card border-border overflow-hidden rounded-lg border",n&&"fixed z-50"),style:n&&s?{left:s.left,width:s.width,bottom:s.bottom}:void 0,children:[u("div",{className:"border-border border-b px-3 py-2",children:[u("div",{className:"flex items-center justify-between gap-2",children:[r("div",{className:"text-foreground text-sm font-medium",children:j}),w>1&&r("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${w}`})]}),D]}),r("div",{role:"listbox",tabIndex:0,ref:g,onKeyDown:(e)=>{let t=a.length;if(t===0&&e.key!=="Escape")return;if(e.key==="ArrowDown"||e.key==="ArrowUp")e.preventDefault(),x((o)=>e.key==="ArrowDown"?(o+1)%t:(o-1+t)%t);else if(e.key==="Enter")e.preventDefault(),i(a[l].optionId);else if(e.key==="Escape")e.preventDefault(),i(null);else if(/^[1-9]$/.test(e.key)&&Number(e.key)<=t)e.preventDefault(),i(a[Number(e.key)-1].optionId)},className:"outline-none",children:a.map((e,t)=>{let o=e.kind??"allow_once",C=B[o]?.icon??I,P=o==="allow_always"||o==="reject_always",F=o==="reject_once"||o==="reject_always";return u("div",{role:"option",tabIndex:-1,"aria-selected":t===l,title:e.description,onClick:()=>void i(e.optionId),onKeyDown:(m)=>{if(m.key==="Enter"||m.key===" ")m.preventDefault(),m.stopPropagation(),i(e.optionId)},className:N("flex cursor-pointer items-center gap-2 px-3 py-1.5 text-sm select-none",t===l?"bg-ring text-accent-foreground":"text-foreground",F&&t!==l&&"text-muted-foreground"),children:[r("span",{className:"min-w-3 text-xs opacity-70",children:t+1}),r(C,{className:"size-3.5 shrink-0 opacity-80"}),r("span",{className:"min-w-0 flex-1 truncate",children:e.name}),P&&r("span",{className:"bg-muted text-muted-foreground rounded px-1.5 py-0.5 text-[10px] tracking-wide uppercase",children:E})]},e.optionId)})})]});return n?W(k,document.body):k}export{Y as PermissionView};
@@ -0,0 +1,29 @@
1
+ import type * as acp from "@agentclientprotocol/sdk/experimental/v2";
2
+ type FormValue = acp.ElicitationContentValue | undefined;
3
+ interface Option {
4
+ value: string;
5
+ label: string;
6
+ description?: string;
7
+ }
8
+ interface FormField {
9
+ key: string;
10
+ property: acp.ElicitationPropertySchema;
11
+ title: string;
12
+ description: string | null;
13
+ required: boolean;
14
+ options: Option[] | null;
15
+ multiOptions: Option[] | null;
16
+ }
17
+ export declare function elicitationFields(schema: acp.ElicitationSchema): FormField[];
18
+ export declare function initialValues(fields: FormField[]): Record<string, FormValue>;
19
+ export declare function isAnswered(field: FormField, value: FormValue): boolean;
20
+ export interface SchemaElicitationFormProps {
21
+ requestId: string;
22
+ schema: acp.ElicitationSchema;
23
+ message: string;
24
+ total: number;
25
+ t: (key: "approval.needed" | "actions.decline" | "actions.submit") => string;
26
+ onRespond: (answer: acp.CreateElicitationResponse) => void;
27
+ }
28
+ export declare function SchemaElicitationForm({ requestId, schema, message, total, t, onRespond, }: SchemaElicitationFormProps): import("react").JSX.Element;
29
+ export {};
@@ -0,0 +1 @@
1
+ import{jsx as n,jsxs as c}from"react/jsx-runtime";import{useEffect as A,useMemo as F,useState as N}from"react";import{Button as x}from"../ui/button.js";import{Checkbox as S}from"../ui/checkbox.js";import{Dialog as C,DialogContent as D,DialogDescription as j,DialogFooter as q,DialogHeader as E,DialogTitle as P}from"../ui/dialog.js";import{Field as G,FieldDescription as p,FieldGroup as I,FieldLabel as K,FieldLegend as y,FieldSet as b}from"../ui/field.js";import{Input as L}from"../ui/input.js";import{Label as V}from"../ui/label.js";import{RadioGroup as B,RadioGroupItem as T}from"../ui/radio-group.js";import{Switch as _}from"../ui/switch.js";import{Textarea as H}from"../ui/textarea.js";import{isArrayProperty as O,isBooleanProperty as w,isNumberProperty as M,isStringProperty as R}from"@alwith/api";function z(t){if(!R(t))return null;if(t.oneOf&&t.oneOf.length>0)return t.oneOf.map((e)=>({value:e.const,label:e.title??e.const,...e.description?{description:e.description}:{}}));if(t.enum&&t.enum.length>0)return t.enum.map((e)=>({value:e,label:e}));return null}function J(t){let e=t;if(Array.isArray(e.enum))return e.enum.map((r)=>({value:String(r),label:String(r)}));if(Array.isArray(e.oneOf))return e.oneOf.map((r)=>({value:r.const,label:r.title,...r.description?{description:r.description}:{}}));return null}function Q(t){let e=new Set(t.required??[]);return Object.entries(t.properties??{}).map(([r,i])=>({key:r,property:i,title:i.title??r,description:i.description??null,required:e.has(r),options:z(i),multiOptions:O(i)?J(i.items):null}))}function v(t){let e={};for(let r of t){let i=r.property.default;if(i!==void 0&&i!==null)e[r.key]=i;else if(r.options)e[r.key]=r.options[0].value;else if(w(r.property))e[r.key]=!1;else if(O(r.property))e[r.key]=[]}return e}function U(t,e){if(t.multiOptions)return Array.isArray(e)&&e.length>0;if(!t.required)return!0;return e!==void 0&&e!==""&&!(Array.isArray(e)&&e.length===0)}function k({id:t,label:e,description:r,control:i}){return c("div",{className:"hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",children:[i,c(V,{htmlFor:t,className:"min-w-0 flex-1 cursor-pointer font-normal",children:[n("div",{className:"text-foreground text-sm",children:e}),r&&n("div",{className:"text-muted-foreground text-xs",children:r})]})]})}function W({id:t,field:e,value:r,onChange:i}){if(e.multiOptions){let o=new Set(Array.isArray(r)?r:[]);return c(b,{children:[n(y,{variant:"label",children:e.title}),e.description&&n(p,{children:e.description}),n("div",{className:"flex flex-col gap-1",children:e.multiOptions.map((s)=>{let a=`${t}:${s.value}`;return n(k,{id:a,...s,control:n(S,{id:a,checked:o.has(s.value),onCheckedChange:(d)=>{let u=new Set(o);if(d)u.add(s.value);else u.delete(s.value);i([...u])}})},s.value)})})]})}if(e.options)return c(b,{children:[n(y,{variant:"label",children:e.title}),e.description&&n(p,{children:e.description}),n(B,{value:typeof r==="string"?r:"",onValueChange:(o)=>i(String(o)),className:"flex flex-col gap-1",children:e.options.map((o)=>{let s=`${t}:${o.value}`;return n(k,{id:s,...o,control:n(T,{value:o.value,id:s})},o.value)})})]});return c(G,{children:[n(K,{htmlFor:t,children:e.title}),w(e.property)?n(_,{id:t,checked:r===!0,onCheckedChange:(o)=>i(o)}):M(e.property)?n(L,{id:t,type:"number",required:e.required,value:typeof r==="number"?r:"",onChange:(o)=>i(o.target.value===""?void 0:Number(o.target.value))}):n(H,{id:t,rows:2,required:e.required,value:typeof r==="string"?r:"",onChange:(o)=>i(o.target.value)}),e.description&&n(p,{children:e.description})]})}function ae({requestId:t,schema:e,message:r,total:i,t:o,onRespond:s}){let a=F(()=>Q(e),[e]),[d,u]=N(()=>v(a));A(()=>u(v(a)),[t,a]);let h=a.every((l)=>U(l,d[l.key])),g=()=>{if(!h)return;let l={};for(let[f,m]of Object.entries(d))if(m!==void 0)l[f]=m;s({action:"accept",content:l})};return n(C,{open:!0,onOpenChange:(l)=>!l&&s({action:"cancel"}),children:c(D,{className:"flex max-h-[80vh] flex-col gap-4 sm:max-w-lg",onKeyDown:(l)=>{if(l.key==="Enter"&&(l.metaKey||l.ctrlKey))l.preventDefault(),g()},children:[c(E,{children:[c("div",{className:"flex items-center justify-between gap-2 pe-8",children:[n(P,{children:e.title??o("approval.needed")}),i>1&&n("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${i}`})]}),n(j,{children:r})]}),n("div",{className:"min-h-0 flex-1 overflow-y-auto",children:n(I,{children:a.map((l)=>n(W,{id:`${t}:${l.key}`,field:l,value:d[l.key],onChange:(f)=>u((m)=>({...m,[l.key]:f}))},l.key))})}),c(q,{children:[n(x,{variant:"ghost",onClick:()=>s({action:"decline"}),children:o("actions.decline")}),n(x,{disabled:!h,onClick:g,children:o("actions.submit")})]})]})})}export{ae as SchemaElicitationForm,Q as elicitationFields,v as initialValues,U as isAnswered};
@@ -0,0 +1,8 @@
1
+ export interface UrlElicitationCardProps {
2
+ message: string;
3
+ url: string;
4
+ t: (key: "approval.needed" | "approval.openLink" | "approval.waitingForLink" | "actions.decline" | "actions.cancel") => string;
5
+ onOpen: (url: string) => void | Promise<void>;
6
+ onRespond: (action: "decline" | "cancel") => void;
7
+ }
8
+ export declare function UrlElicitationCard({ message, url, t, onOpen, onRespond }: UrlElicitationCardProps): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{jsx as i,jsxs as r}from"react/jsx-runtime";import{ExternalLinkIcon as t}from"lucide-react";import{Button as a}from"../ui/button.js";import{Card as s,CardContent as d,CardDescription as m,CardFooter as p,CardHeader as h,CardTitle as x}from"../ui/card.js";function k({message:l,url:o,t:e,onOpen:c,onRespond:n}){return r(s,{size:"sm",children:[r(h,{children:[i(m,{children:e("approval.needed")}),i(x,{children:l})]}),i(d,{children:r("div",{className:"flex flex-col gap-3",children:[r(a,{variant:"outline",size:"sm",className:"w-fit",onClick:()=>void c(o),children:[i(t,{"data-icon":"inline-start"}),e("approval.openLink")]}),i("p",{className:"text-muted-foreground text-sm",children:e("approval.waitingForLink")})]})}),r(p,{className:"flex flex-wrap gap-2",children:[i(a,{variant:"outline",size:"sm",onClick:()=>n("decline"),children:e("actions.decline")}),i(a,{variant:"ghost",size:"sm",onClick:()=>n("cancel"),children:e("actions.cancel")})]})]})}export{k as UrlElicitationCard};
@@ -0,0 +1,15 @@
1
+ import type { CodexActivityBlock } from "../lib/group-blocks.js";
2
+ interface Props {
3
+ blocks: CodexActivityBlock[];
4
+ }
5
+ export declare function CodexWorkSection({ stateKey, durationMs, active, startedAt, providerId, providerIcon, children }: {
6
+ stateKey: string;
7
+ durationMs?: number;
8
+ active: boolean;
9
+ startedAt?: number;
10
+ providerId?: string;
11
+ providerIcon?: React.ReactNode;
12
+ children: React.ReactNode;
13
+ }): import("react").JSX.Element;
14
+ export declare function CodexActivityGroup({ blocks }: Props): import("react").JSX.Element;
15
+ export {};
@@ -0,0 +1,6 @@
1
+ import{jsx as t,jsxs as l,Fragment as S}from"react/jsx-runtime";import{useActivityHost as I,ActivityMarkdown as O}from"../activity-host.js";import{CheckIcon as J,CopyIcon as Q,GitBranchIcon as X}from"lucide-react";import{useEffect as w,useRef as N,useState as Z}from"react";import{cn as y}from"cn";import{describeToolUse as F}from"../lib/stream-style.js";import{useCodexDisclosureState as B}from"./disclosure-state.js";import{CodexPlan as Y}from"./plan.js";var W=new WeakMap,H=1;function L(e){if(e.type==="tool_use"||e.type==="subagent")return`${e.type}:${e.id}`;if(e.type==="thinking"&&e.id!==void 0)return`thinking:${e.id}`;let n=W.get(e);if(n!==void 0)return`${e.type}:${n}`;let i=H;return H+=1,W.set(e,i),`${e.type}:${i}`}function _(e){switch(e){case"pending":case"in_progress":return!0;case"completed":case"failed":case"cancelled":case"interrupted":return!1;default:throw Error(`Unknown ACP tool status: ${e}`)}}function V(e,n){let i=Math.max(1,Math.round(e/1000)),a=Math.floor(i/3600),r=Math.floor(i%3600/60),d=i%60;if(d>=60)r+=Math.floor(d/60),d%=60;if(r>=60)a+=Math.floor(r/60),r%=60;let c=Intl.DurationFormat;if(c)try{return new c(n,{style:"narrow"}).format({hours:a,minutes:r,seconds:a>0?0:d})}catch{}if(a>0)return r>0?`${a}h ${r}m`:`${a}h`;if(r>0)return d>0?`${r}m ${d}s`:`${r}m`;return`${d}s`}var ee="M7.52925 3.7793C7.75652 3.55203 8.10803 3.52383 8.36616 3.69434L8.47065 3.7793L14.2207 9.5293C14.4804 9.789 14.4804 10.211 14.2207 10.4707L8.47065 16.2207C8.21095 16.4804 7.78895 16.4804 7.52925 16.2207C7.26955 15.961 7.26955 15.539 7.52925 15.2793L12.8085 10L7.52925 4.7207L7.44429 4.61621C7.27378 4.35808 7.30198 4.00657 7.52925 3.7793Z";function E({expanded:e,className:n}){return t("svg",{className:y("codex-activity-disclosure",e&&"codex-activity-disclosure-expanded",n),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:t("path",{d:ee})})}function te(){return t("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:t("path",{d:"M16.3965 5.01128C16.3963 4.93399 16.3489 4.87691 16.293 4.85406L16.2354 4.84332C13.9306 4.91764 12.5622 5.32101 10.665 6.34722V16.3716C11.3851 15.9994 12.0688 15.7115 12.7861 15.5015C13.8286 15.1965 14.9113 15.0633 16.2402 15.0435L16.2979 15.0308C16.353 15.0063 16.3965 14.9483 16.3965 14.8755V5.01128ZM3.54492 14.8765C3.54492 14.9725 3.62159 15.0422 3.70117 15.0435L4.19629 15.0562C5.94062 15.1247 7.26036 15.4201 8.65918 16.0484C8.05544 15.1706 7.14706 14.436 6.17871 14.1109V14.1099C5.56757 13.9045 5.16816 13.3314 5.16797 12.6988V4.98882C4.86679 4.93786 4.60268 4.8999 4.28223 4.87457L3.72754 4.84429C3.62093 4.84079 3.54505 4.92417 3.54492 5.01226V14.8765ZM17.7266 14.8755C17.7266 15.6314 17.1607 16.2751 16.4121 16.3628L16.2598 16.3736C15.0122 16.3922 14.0555 16.5159 13.1602 16.7779C12.2629 17.0404 11.3966 17.4508 10.3369 18.0738C10.129 18.1959 9.87099 18.1958 9.66309 18.0738C7.71455 16.9283 6.31974 16.4689 4.12988 16.3853L3.68164 16.3736C2.85966 16.3614 2.21484 15.6838 2.21484 14.8765V5.01226C2.21497 4.15391 2.93263 3.4871 3.77246 3.51519L4.39844 3.54937C4.67996 3.57191 4.92258 3.60421 5.16797 3.64214V2.51031C5.16797 1.44939 6.29018 0.645615 7.31055 1.15679L7.31152 1.15582C8.78675 1.89511 10.0656 3.33006 10.5352 4.91461C12.3595 3.98907 13.8688 3.58817 16.1924 3.51324L16.3506 3.51714C17.1285 3.5741 17.7264 4.23496 17.7266 5.01128V14.8755ZM6.49805 12.6988C6.49824 12.7723 6.5442 12.8296 6.60254 12.8492L6.96289 12.9859C7.85245 13.3586 8.68125 13.9846 9.33496 14.7496V5.5816C9.08794 4.37762 8.13648 3.1566 6.95801 2.47613L6.71582 2.34527C6.67779 2.32617 6.6337 2.32502 6.58301 2.35796C6.52946 2.39279 6.49805 2.44863 6.49805 2.51031V12.6988Z"})})}function ne(){return t("svg",{className:"codex-activity-icon",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:t("path",{d:"M7.33057 1.98535C10.2484 1.98535 12.6136 4.3508 12.6138 7.26855C12.6138 8.58031 12.1346 9.77942 11.3433 10.7031L13.9897 13.3496C14.1655 13.5253 14.1655 13.8106 13.9897 13.9863C13.814 14.1621 13.5288 14.1621 13.353 13.9863L10.7017 11.335C9.78678 12.0942 8.61243 12.5518 7.33057 12.5518C4.41281 12.5516 2.04736 10.1864 2.04736 7.26855C2.04754 4.35091 4.41292 1.98553 7.33057 1.98535ZM7.33057 2.88574C4.90998 2.88592 2.94793 4.84796 2.94775 7.26855C2.94775 9.68929 4.90987 11.6522 7.33057 11.6523C9.75141 11.6523 11.7144 9.6894 11.7144 7.26855C11.7142 4.84786 9.75131 2.88574 7.33057 2.88574Z"})})}function ie(){return l("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:[t("path",{d:"M6.19629 7.86231C6.42357 7.63534 6.7752 7.60692 7.0332 7.77734L7.1377 7.86231L8.80371 9.5293C9.06329 9.78889 9.06307 10.21 8.80371 10.4697L7.1377 12.1367C6.878 12.3964 6.45599 12.3964 6.19629 12.1367C5.93686 11.8771 5.93697 11.456 6.19629 11.1963L7.39258 9.99902L6.19629 8.80371L6.11133 8.69922C5.94087 8.4411 5.96904 8.08955 6.19629 7.86231Z"}),t("path",{d:"M13.4668 11.0156C13.7699 11.0776 13.998 11.3456 13.998 11.667C13.9979 11.9883 13.7698 12.2564 13.4668 12.3184L13.333 12.332H10.833C10.466 12.3319 10.1682 12.034 10.168 11.667C10.168 11.2998 10.4659 11.0021 10.833 11.002H13.333L13.4668 11.0156Z"}),t("path",{d:"M12.6602 2.66504C13.3492 2.66504 13.9062 2.66439 14.3564 2.70117C14.8142 2.73859 15.2201 2.81796 15.5967 3.00977C16.1922 3.31321 16.677 3.79805 16.9805 4.39356C17.1722 4.77014 17.2517 5.17604 17.2891 5.63379C17.3258 6.08402 17.3252 6.64102 17.3252 7.33008V12.6602C17.3252 13.3492 17.3258 13.9062 17.2891 14.3564C17.2516 14.8142 17.1723 15.2201 16.9805 15.5967C16.677 16.1922 16.1922 16.677 15.5967 16.9805C15.2201 17.1723 14.8142 17.2516 14.3564 17.2891C13.9062 17.3258 13.3492 17.3252 12.6602 17.3252H7.33008C6.64102 17.3252 6.08402 17.3258 5.63379 17.2891C5.17604 17.2517 4.77014 17.1722 4.39356 16.9805C3.79805 16.677 3.31321 16.1922 3.00977 15.5967C2.81796 15.2201 2.73859 14.8142 2.70117 14.3564C2.66439 13.9062 2.66504 13.3492 2.66504 12.6602V7.33008C2.66504 6.64101 2.66439 6.08402 2.70117 5.63379C2.73858 5.17601 2.81797 4.77016 3.00977 4.39356C3.31321 3.79802 3.79802 3.31321 4.39356 3.00977C4.77016 2.81797 5.17601 2.73858 5.63379 2.70117C6.08402 2.66439 6.64101 2.66504 7.33008 2.66504H12.6602ZM7.33008 3.99512C6.61907 3.99512 6.1257 3.99601 5.74219 4.02734C5.3665 4.05804 5.15508 4.11481 4.99707 4.19531C4.65183 4.37124 4.37124 4.65183 4.19531 4.99707C4.11481 5.15508 4.05805 5.3665 4.02734 5.74219C3.99601 6.1257 3.99512 6.61908 3.99512 7.33008V12.6602C3.99512 13.3711 3.99601 13.8646 4.02734 14.248C4.05805 14.6237 4.11481 14.8352 4.19531 14.9932C4.37124 15.3384 4.65186 15.619 4.99707 15.7949C5.15507 15.8754 5.36654 15.9322 5.74219 15.9629C6.1257 15.9942 6.61908 15.9951 7.33008 15.9951H12.6602C13.3711 15.9951 13.8646 15.9942 14.248 15.9629C14.6237 15.9322 14.8352 15.8754 14.9932 15.7949C15.3384 15.619 15.619 15.3384 15.7949 14.9932C15.8754 14.8352 15.9322 14.6237 15.9629 14.248C15.9942 13.8646 15.9951 13.3711 15.9951 12.6602V7.33008C15.9951 6.61908 15.9942 6.1257 15.9629 5.74219C15.9322 5.36654 15.8754 5.15507 15.7949 4.99707C15.619 4.65186 15.3384 4.37124 14.9932 4.19531C14.8352 4.11481 14.6237 4.05805 14.248 4.02734C13.8646 3.99601 13.3711 3.99512 12.6602 3.99512H7.33008Z"})]})}function ae(){return t("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:t("path",{d:"M11.3312 4.20472C12.7488 2.92391 14.9377 2.96644 16.3039 4.33265L16.4318 4.46742C17.6713 5.8393 17.6713 7.93343 16.4318 9.30531L16.3039 9.44007L10.0119 15.7311C9.68839 16.0546 9.45384 16.2917 9.22185 16.4821L8.98748 16.6588C8.78233 16.799 8.56429 16.9196 8.33709 17.0192L8.10759 17.1119C7.92582 17.1785 7.73843 17.2266 7.52166 17.2711L6.75701 17.4069L4.36345 17.8053C4.22059 17.8291 4.06914 17.8552 3.9406 17.8649C3.84183 17.8723 3.70833 17.875 3.56267 17.8395L3.41423 17.7907C3.19121 17.695 3.00747 17.5271 2.89177 17.316L2.84588 17.2223C2.75958 17.0209 2.76174 16.8276 2.77166 16.6959C2.78136 16.5674 2.80742 16.4159 2.83123 16.2731L3.22966 13.8795L3.36443 13.1149C3.40899 12.898 3.45795 12.7108 3.52459 12.5289L3.61736 12.2985C3.71691 12.0715 3.83772 11.854 3.97771 11.6491L4.15349 11.4147C4.34392 11.1825 4.58171 10.9484 4.90545 10.6246L11.1965 4.33265L11.3312 4.20472ZM5.84588 11.5651C5.49671 11.9142 5.31258 12.0998 5.1867 12.2526L5.07537 12.3991C4.98194 12.5358 4.90157 12.6812 4.83513 12.8327L4.77361 12.9869C4.73328 13.0971 4.70248 13.2125 4.66814 13.3815L4.54119 14.0983L4.14275 16.4918L4.14177 16.4938H4.1447L6.53826 16.0944L7.25505 15.9684C7.42406 15.9341 7.53946 15.9033 7.64959 15.8629L7.80291 15.8014C7.95461 15.7349 8.09953 15.6538 8.2365 15.5602L8.38396 15.4498C8.53674 15.3239 8.72231 15.1398 9.07146 14.7907L14.0588 9.80238L10.8332 6.57679L5.84588 11.5651ZM15.3635 5.27308C14.5281 4.43776 13.2058 4.38573 12.3097 5.11683L12.1369 5.27308L11.7736 5.63636L15.0002 8.86195L15.3635 8.49964L15.5197 8.32581C16.2015 7.48961 16.2015 6.28311 15.5197 5.44691L15.3635 5.27308Z"})})}function re(){return t("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:t("path",{d:"M16.8347 7.91699C16.8347 7.76279 16.8266 7.61021 16.8123 7.45996L15.4705 8.80371C14.2903 9.98388 12.3762 9.98388 11.1961 8.80371C10.016 7.62352 10.0159 5.70942 11.1961 4.5293L12.5378 3.18652C12.3885 3.17238 12.237 3.16505 12.0837 3.16504C9.45947 3.16504 7.33179 5.29272 7.33179 7.91699C7.33184 8.56608 7.46162 9.18329 7.69605 9.74512C7.79981 9.9939 7.74311 10.2811 7.5525 10.4717L3.59547 14.4287C3.0498 14.9744 3.04991 15.8586 3.59547 16.4043L3.70191 16.501C4.25076 16.9483 5.05957 16.9158 5.57105 16.4043L9.52906 12.4473L9.60426 12.3828C9.79018 12.2455 10.0369 12.2131 10.2546 12.3037C10.8166 12.5382 11.4345 12.668 12.0837 12.668C14.7078 12.6678 16.8345 10.541 16.8347 7.91699ZM18.1648 7.91699C18.1646 11.2755 15.4423 13.9979 12.0837 13.998C11.4151 13.998 10.7708 13.8886 10.1677 13.6885L6.51246 17.3457C5.51389 18.3443 3.93332 18.406 2.86207 17.5322L2.65504 17.3457C1.58992 16.2806 1.58992 14.5534 2.65504 13.4883L6.31031 9.83203C6.1104 9.22921 6.00175 8.58526 6.00172 7.91699C6.00172 4.55818 8.72494 1.83496 12.0837 1.83496C12.7838 1.835 13.458 1.95316 14.0857 2.17188L14.1638 2.20508C14.3404 2.29325 14.4697 2.45713 14.5144 2.65234C14.5653 2.87533 14.4984 3.10876 14.3367 3.27051L12.1375 5.4707C11.4767 6.13148 11.4767 7.20251 12.1375 7.86328C12.7983 8.52373 13.8694 8.52395 14.53 7.86328L16.7293 5.66309L16.7937 5.60742C16.9499 5.48687 17.1532 5.44067 17.3484 5.48535C17.5714 5.53648 17.7526 5.69898 17.8279 5.91504C18.0466 6.54272 18.1648 7.21689 18.1648 7.91699Z"})})}function R({block:e}){if(e.type!=="tool_use")return null;let n=F(e).category;if(n==="read")return t(te,{});if(n==="search"||n==="fetch")return t(ne,{});if(n==="execute")return t(ie,{});if(n==="edit")return t(ae,{});return t(re,{})}function T(e,n){let i=e.rawInput[n];return typeof i==="string"&&i.length>0?i:void 0}function oe(e){return F(e).target}function D(e){return e.name.startsWith("mcp__")||e.name.startsWith("mcp_")}function P(e,n){let{category:i}=F(e),a=oe(e),r=_(e.status);if(D(e))return{leading:e.title};if(i==="execute"){let d=T(e,"command")?.split(`
2
+ `)[0]??a;return d?{leading:n(r?"stream.codex.running":"stream.codex.ran"),trailing:d}:{leading:n(r?"stream.codex.runningCommand":"stream.codex.ranCommandGeneric")}}if(i==="search"){let d=T(e,"pattern")??T(e,"query")??a;return d?{leading:n(r?"stream.codex.searching":"stream.codex.searched"),trailing:n("stream.codex.forDetail",{detail:d})}:{leading:n(r?"stream.codex.searchingFiles":"stream.codex.searchedFiles")}}if(i==="fetch"){let d=T(e,"query")??T(e,"url")??a;return d?{leading:n(r?"stream.codex.searchingWeb":"stream.codex.searchedWeb"),trailing:n("stream.codex.forDetail",{detail:d})}:{leading:n(r?"stream.codex.searchingWeb":"stream.codex.searchedWeb")}}if(i==="read")return a?{leading:n("stream.codex.readLabel"),trailing:a}:{leading:n("stream.codex.readFiles")};if(i==="edit")return a?{leading:n(r?"stream.codex.editingLabel":"stream.codex.editedLabel"),trailing:a}:{leading:n(r?"stream.codex.editingFiles":"stream.codex.editedFiles")};if(i==="delete")return a?{leading:n(r?"stream.codex.deletingLabel":"stream.codex.deletedLabel"),trailing:a}:{leading:n(r?"stream.codex.deletingFiles":"stream.codex.deletedFiles")};if(i==="move")return a?{leading:n(r?"stream.codex.movingLabel":"stream.codex.movedLabel"),trailing:a}:{leading:n(r?"stream.codex.movingFiles":"stream.codex.movedFiles")};return{leading:e.title}}function q(e,n){let i=P(e,n);return i.trailing===void 0?i.leading:`${i.leading} ${i.trailing}`}function de(e){return e.map((n)=>{if(n.type!=="content")return"";let i=n.content;return i.type==="text"?i.text:""}).filter(Boolean).join(`
3
+ `).trim()}function ce(e){return e.flatMap((n)=>{if(n.type!=="content")return[];let i=n.content;return i.type==="image"?[{data:i.data,mimeType:i.mimeType}]:[]})}function se(e){return e.flatMap((n)=>{if(n.type!=="content")return[];let i=n.content;return i.type==="audio"?[{data:i.data,mimeType:i.mimeType}]:[]})}function le(e){if(typeof e==="string"&&e.length>0)return e;return}function ue(e){return e.type==="diff"}function me(e){let n=e.content.find(ue);if(n===void 0)return;return n.changes.map((i)=>`${i.operation} ${i.path}`).join(`
4
+ `)}function G(e){let n=le(e.rawOutput);if(n!==void 0)return n;let i=de(e.content);if(i.length>0)return i;return me(e)}function fe({block:e,command:n}){let{t:i,Output:a,commandStatus:r}=I(),[d,c]=Z(!1),[o,u]=Z(!1),m=G(e),f=r===void 0?e.exitCode===void 0?void 0:i("stream.codex.exitCode",{code:e.exitCode}):r(e),s=()=>{navigator.clipboard.writeText([`$ ${n}`,m].filter((x)=>x!==void 0).join(`
5
+ `)),c(!0),setTimeout(()=>c(!1),1500)};return t("div",{className:"codex-command-details",children:l("div",{className:"codex-command-card",children:[l("div",{className:"codex-command-line-row",children:[t("span",{className:"codex-command-prompt","aria-hidden":"true",children:"$"}),t("button",{type:"button",className:y("codex-command-line",!o&&"codex-command-line-clamped"),"data-codex-disclosure":"","aria-expanded":o,onClick:()=>u((x)=>!x),children:n}),t("button",{type:"button",className:"codex-command-copy","aria-label":i("actions.copy"),onClick:s,children:d?t(J,{}):t(Q,{})})]}),m!==void 0&&(a===void 0?t("pre",{className:"codex-command-output",children:m}):t(a,{text:m})),f!==void 0&&t("div",{className:"codex-command-footer",children:t("span",{className:"codex-command-status",children:f})})]})})}function k({block:e}){let{t:n,openLink:i,Patch:a,openImage:r,expandToolOutput:d=!1}=I(),c=G(e),o=a===void 0?void 0:e.content.flatMap((p)=>{if(p.type!=="diff")return[];let M=p;return M.patch?.text?[M.patch.text]:[]}).join(`
6
+ `),u=ce(e.content),m=se(e.content),[f,s]=B(`tool:${e.id}`,!1),x=F(e),h=x.category,C=P(e,n),v=h==="execute"?T(e,"command"):void 0,g=v!==void 0||D(e)||u.length>0||m.length>0||Boolean(o)||d&&c!==void 0,b=!g&&!_(e.status)?x.filePath:void 0;if(h==="read"&&_(e.status))return null;let A=l("span",{className:"codex-activity-label",children:[t(R,{block:e}),t("span",{className:"min-w-0 flex-1 truncate",children:_(e.status)?t("span",{className:"codex-activity-running",children:C.trailing===void 0?C.leading:`${C.leading} ${C.trailing}`}):l(S,{children:[t("span",{className:"codex-activity-leading",children:C.leading}),C.trailing!==void 0&&(b!==void 0?l(S,{children:[" ",t("button",{type:"button",className:"codex-activity-trailing codex-activity-file-link",title:b,onClick:()=>i(b),children:C.trailing})]}):l("span",{className:"codex-activity-trailing",children:[" ",C.trailing]}))]})})]});return l("div",{className:"codex-activity-item",children:[g?l("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-label":q(e,n),"aria-expanded":f,onClick:()=>s((p)=>!p),children:[A,t(E,{expanded:f})]}):t("div",{className:"codex-activity-header codex-activity-header-static",children:A}),t("div",{className:y("codex-activity-details-grid",f&&"codex-activity-details-grid-open"),children:l("div",{className:"min-h-0 overflow-hidden",children:[v!==void 0?t(fe,{block:e,command:v}):a!==void 0&&o?t(a,{patch:o}):c!==void 0&&t("pre",{className:"codex-activity-details",children:c}),u.length>0&&t("div",{className:"codex-activity-media",children:u.map((p)=>{let M=`data:${p.mimeType};base64,${p.data}`,j=t("img",{src:M,className:"max-h-48 max-w-full rounded-lg object-contain",alt:""},`${p.mimeType}:${p.data.slice(0,32)}`);return r===void 0?j:t("button",{type:"button",className:"cursor-pointer",onClick:()=>r(M),children:j},M)})}),m.map((p)=>t("audio",{className:"mt-1 w-full","aria-label":n("stream.codex.audioOutput"),controls:!0,src:`data:${p.mimeType};base64,${p.data}`},`${p.mimeType}:${p.data.slice(0,32)}`))]})})]})}function z({block:e}){if(e.type==="tool_use")return t(k,{block:e});if(e.type==="thinking")return t(U,{block:e});return t(K,{block:e})}function K({block:e}){let{t:n}=I(),i=_(e.status),[a,r]=B(`subagent:${e.id}`,i),d=N(i);w(()=>{if(i)r(!0);if(d.current&&!i)r(!1);d.current=i},[i,r]);let c=e.blocks.length>0;return l("div",{className:"codex-activity-item",children:[l("button",{type:"button",className:y("codex-activity-header",!c&&"codex-activity-header-static"),"data-codex-disclosure":"","aria-expanded":c?a:void 0,disabled:!c,onClick:()=>r((o)=>!o),children:[l("span",{className:"codex-activity-label",children:[t(X,{className:"size-4 shrink-0","aria-hidden":"true"}),t("span",{className:"min-w-0 flex-1 truncate",children:i?t("span",{className:"codex-activity-running",children:n("stream.codex.subagentWorking",{name:e.name})}):n("stream.codex.subagentFinished",{name:e.name})})]}),c&&t(E,{expanded:a})]}),t("div",{className:y("codex-activity-details-grid",a&&"codex-activity-details-grid-open"),children:t("div",{className:"min-h-0 overflow-hidden",children:t("div",{className:"codex-subagent-details",children:e.blocks.map((o)=>{if(o.type==="tool_use")return t(k,{block:o},o.id);if(o.type==="thinking")return t(U,{block:o},L(o));if(o.type==="subagent")return t(K,{block:o},o.id);if(o.type==="text")return t("div",{className:"codex-reasoning-details",children:t(O,{text:o.text,streaming:!1})},L(o));if(o.type==="plan")return t(Y,{entries:o.entries},L(o));if(o.type==="image")return t("img",{src:`data:${o.source.media_type};base64,${o.source.data}`,className:"max-h-48 max-w-full rounded-lg object-contain",alt:""},L(o));return null})})})})]})}function U({block:e}){let{t:n,i18n:i}=I(),a=Boolean(e.isComplete),[r,d]=B(`thinking:${L(e)}`,!a),c=N(a),o=N(null);w(()=>{if(!a)d(!0);if(!c.current&&a)d(!1);c.current=a},[a,d]);let u=e.thinking.trim().length>0;w(()=>{if(a||!u)return;let s=o.current;if(s===null)throw Error("Thinking details are not mounted");let x=new ResizeObserver(()=>{s.scrollTop=s.scrollHeight}),h=null,C=()=>{let g=s.firstElementChild;if(g===h)return;if(h!==null)x.unobserve(h);if(h=g,h!==null)x.observe(h)},v=new MutationObserver(C);return v.observe(s,{childList:!0}),C(),()=>{v.disconnect(),x.disconnect()}},[u,a]);let m=a?e.durationMs!==void 0?n("stream.codex.thoughtFor",{duration:V(e.durationMs,i.language)}):n("stream.codex.thought"):n("message.thinking"),f=e.thinking.trimStart().replace(/^\*\*[^\n]*?\*\*\s*/,"");return l("div",{className:"codex-activity-item",children:[l("button",{type:"button",className:y("codex-activity-header",!u&&"codex-activity-header-static"),"data-codex-disclosure":"","aria-expanded":u?r:void 0,disabled:!u,onClick:()=>d((s)=>!s),children:[t("span",{className:"codex-activity-label",children:t("span",{className:"codex-reasoning-label min-w-0 flex-1 truncate",children:a?m:t("span",{className:"codex-activity-running",children:m})})}),u&&t(E,{expanded:r})]}),t("div",{className:y("codex-activity-details-grid",r&&"codex-activity-details-grid-open"),children:t("div",{className:"min-h-0 overflow-hidden",children:u&&t("div",{ref:o,className:"codex-reasoning-details",children:t(O,{text:f,streaming:!a})})})})]})}function xe(e){if(D(e))return"mcp";let n=F(e).category;return n==="think"||n==="switch_mode"?"other":n}function pe(e,n,i,a){return a(`stream.codex.summary.${e}.${i?"leading":"following"}`,{count:n})}function Ce(e,n,i){let a=new Map;for(let d of e){let c=xe(d);a.set(c,(a.get(c)??0)+1)}let r=Array.from(a,([d,c],o)=>pe(d,c,o===0,n));if(i.startsWith("zh"))return r.join("");return new Intl.ListFormat(i,{style:"long",type:"conjunction"}).format(r)}function be({stateKey:e,durationMs:n,active:i,startedAt:a,providerId:r,providerIcon:d,children:c}){let{t:o,i18n:u}=I(),[m,f]=B(`work:${e}`,i),s=N(i),x=N(null),[h,C]=Z(0);w(()=>{if(i)f(!0);if(s.current&&!i)f(!1);s.current=i},[i,f]),w(()=>{if(!i){x.current=null;return}x.current=a??Date.now();let g=()=>{let A=x.current;if(A===null)throw Error("Codex work section is ticking without a start time");C(Date.now()-A)};g();let b=window.setInterval(g,1000);return()=>window.clearInterval(b)},[i,a]);let v=i?h<1000?o("stream.codex.worked"):o("stream.codex.workedFor",{duration:V(h,u.language)}):n===void 0?o("stream.codex.worked"):o("stream.codex.workedFor",{duration:V(n,u.language)});return l("section",{className:"codex-work-section",children:[l("button",{type:"button",className:"codex-work-trigger","data-codex-disclosure":"","aria-expanded":m,onClick:()=>f((g)=>!g),children:[r!==void 0&&t("span",{className:"codex-work-provider-icon","data-testid":"codex-work-provider-icon","data-provider-id":r,"aria-hidden":"true",children:d}),t("span",{children:v}),t(E,{expanded:m,className:"codex-work-chevron"})]}),t("div",{className:"codex-work-separator","aria-hidden":"true"}),t("div",{className:y("codex-work-grid",m&&"codex-work-grid-open"),children:t("div",{className:"min-h-0 overflow-hidden",children:t("div",{className:"codex-work-body",children:c})})})]})}function he(e,n){if(e.type==="tool_use")return q(e,n);if(e.type==="thinking")return n("message.thinking");return n("stream.codex.subagentWorking",{name:e.name})}function ge(e){if(e.type==="thinking")return!e.isComplete;if(e.type==="tool_use"||e.type==="subagent")return _(e.status);return!1}function ye(e,n=1000){let[i,a]=Z(e),r=N(Date.now());return w(()=>{if(e===i)return;let d=Date.now(),c=Math.max(0,r.current+n-d);if(c===0){r.current=d,a(e);return}let o=window.setTimeout(()=>{r.current=Date.now(),a(e)},c);return()=>window.clearTimeout(o)},[i,n,e]),i}function ve({blocks:e}){let{t:n,i18n:i}=I(),a=e.some(ge),r=e.map(L).join(":"),[d,c]=B(`group:${r}`,a),o=N(a);w(()=>{if(a)c(!0);if(o.current&&!a)c(!1);o.current=a},[a,c]);let u=e.at(-1);if(u===void 0)throw Error("CodexActivityGroup requires at least one activity block");let m=e.filter((s)=>s.type==="tool_use"),f=ye(a?he(u,n):Ce(m,n,i.language));return l("div",{className:"codex-activity-group",children:[l("button",{type:"button",className:"codex-activity-group-trigger","aria-expanded":d,onClick:()=>c((s)=>!s),children:[l("span",{className:"codex-activity-label",children:[t(R,{block:e[0]}),t("span",{className:"truncate",children:a?t("span",{className:"codex-activity-running",children:f}):f})]}),t(E,{expanded:d})]}),t("div",{className:y("codex-activity-group-grid",d&&"codex-activity-group-grid-open"),children:t("div",{className:"min-h-0 overflow-hidden",children:t("div",{className:"codex-activity-group-body",children:e.map((s)=>t(z,{block:s},L(s)))})})})]})}function Ae({blocks:e}){if(e.length===0)throw Error("CodexActivityGroup requires at least one activity block");if(e.length===1)return t(z,{block:e[0]});return t(ve,{blocks:e})}export{Ae as CodexActivityGroup,be as CodexWorkSection};
@@ -0,0 +1,43 @@
1
+ import type { ComponentProps, ReactNode } from "react";
2
+ import { type ToolUseBlock } from "../lib/group-blocks.js";
3
+ import type { ChatMessage, ContentBlock } from "../types.js";
4
+ import { CodexWorkSection } from "./activity-group.js";
5
+ export interface AssistantTextProps {
6
+ block: Extract<ContentBlock, {
7
+ type: "text";
8
+ }>;
9
+ streaming: boolean;
10
+ actions?: React.ReactNode;
11
+ }
12
+ export interface CodexAssistantMessageProps {
13
+ message: ChatMessage;
14
+ isMostRecentTurn?: boolean;
15
+ hiddenTools?: ReadonlySet<string>;
16
+ time?: {
17
+ short: string;
18
+ full: string;
19
+ } | null;
20
+ beforeCopy?: React.ReactNode;
21
+ afterCopy?: React.ReactNode;
22
+ providerIcon?: React.ReactNode;
23
+ renderText?: (props: AssistantTextProps) => React.ReactNode;
24
+ renderEditedFiles?: (blocks: ToolUseBlock[]) => React.ReactNode;
25
+ }
26
+ export declare function CodexAssistantMessage({ message, isMostRecentTurn, hiddenTools, time, beforeCopy, afterCopy, providerIcon, renderText, renderEditedFiles }: CodexAssistantMessageProps): import("react").JSX.Element;
27
+ export declare function CodexMessageActions({ text, isMostRecentTurn, beforeCopy, afterCopy, time }: {
28
+ text: string;
29
+ isMostRecentTurn?: boolean;
30
+ beforeCopy?: ReactNode;
31
+ afterCopy?: ReactNode;
32
+ time?: {
33
+ short: string;
34
+ full: string;
35
+ } | null;
36
+ }): import("react").JSX.Element;
37
+ export type CodexAssistantTurnProps = Omit<ComponentProps<typeof CodexWorkSection>, "children"> & {
38
+ work: ReactNode[];
39
+ answer: ReactNode;
40
+ footer?: ReactNode;
41
+ loading?: boolean;
42
+ };
43
+ export declare function CodexAssistantTurn({ work, answer, footer, loading, ...metadata }: CodexAssistantTurnProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import{jsx as n,jsxs as f}from"react/jsx-runtime";import{Loader2Icon as M}from"lucide-react";import{cn as B}from"cn";import{useActivityHost as j,ActivityMarkdown as C}from"../activity-host.js";import{groupBlocksForStyle as T}from"../lib/group-blocks.js";import{describeToolUse as E}from"../lib/stream-style.js";import{CodexActivityGroup as S,CodexWorkSection as G}from"./activity-group.js";import{CodexPlan as O}from"./plan.js";import{CodexEditedFilesCard as D}from"./edited-files-card.js";import{CopyAction as H}from"./user-message.js";var v=new WeakMap,K=1;function A(t){if(t.type==="tool_use"||t.type==="subagent")return`${t.type}:${t.id}`;let i=v.get(t);if(i!==void 0)return`${t.type}:${i}`;let r=K++;return v.set(t,r),`${t.type}:${r}`}function L({block:t,streaming:i,actions:r}){if(t.isApiError)return n("div",{className:"codex-stream-error",children:t.text});return f("div",{className:"codex-assistant-message",children:[n(C,{text:t.text,streaming:i}),r]})}function P({block:t,streaming:i,actions:r,renderText:o}){switch(t.type){case"text":return o===void 0?n(L,{block:t,streaming:i,actions:r}):o({block:t,streaming:i,actions:r});case"thinking":return t.thinking.length>0?n(C,{text:t.thinking,streaming:!t.isComplete}):null;case"plan":return n(O,{entries:t.entries});case"image":return n("img",{src:`data:${t.source.media_type};base64,${t.source.data}`,className:"max-h-64 rounded",alt:""});case"tool_use":case"subagent":return null}}var R=new Set;function tt({message:t,isMostRecentTurn:i,hiddenTools:r=R,time:o,beforeCopy:s,afterCopy:l,providerIcon:w,renderText:N,renderEditedFiles:m}){if(t.streaming===!0&&t.content.every((e)=>e.type==="text"?e.text.length===0:e.type==="thinking"?e.thinking.length===0:!1))return n(k,{});let h=t.content.filter((e)=>e.type==="text").map((e)=>e.text).join(`
2
+ `),I=!t.streaming&&h.trim().length>0?n(W,{text:h,isMostRecentTurn:i,beforeCopy:s,afterCopy:l,time:o}):null,c=T(t.content,"compact"),u=c.reduce((e,a,d)=>a.kind==="codexActivityGroup"?d:e,-1),y=c.findIndex((e,a)=>a>u&&e.kind==="block"&&e.block.type==="text"),_=[...t.content].reverse().find((e)=>e.type==="text"),p=t.content.filter((e)=>e.type==="tool_use"&&E(e).category==="edit"),g=(e)=>{if(e.kind==="codexActivityGroup"){let a=e.blocks.filter((d)=>d.type!=="tool_use"||!r.has(d.name));return a.length===0?null:n(S,{blocks:a},`activity:${A(a[0])}`)}if(e.kind!=="block")throw Error(`Codex received an incompatible grouped entry: ${e.kind}`);return n(P,{block:e.block,streaming:Boolean(t.streaming),actions:e.block===_?I:void 0,renderText:N},A(e.block))},x=u===-1?0:y===-1?c.length:y;return n(z,{stateKey:t.id,active:Boolean(t.streaming),startedAt:t.startedAt,durationMs:t.durationMs,providerId:t.providerId,providerIcon:w,work:c.slice(0,x).map(g),answer:c.length>x?c.slice(x).map(g):null,footer:u!==-1&&p.length>0&&(m===void 0?n(D,{blocks:p}):m(p))})}function W({text:t,isMostRecentTurn:i=!1,beforeCopy:r,afterCopy:o,time:s}){let{t:l}=j();return f("div",{className:B("mt-1.5 flex h-5 w-fit -translate-x-1 items-center justify-start gap-0.5 [&_*]:transition-none",i?"opacity-100":"opacity-0 group-focus-within/am:opacity-100 group-hover/am:opacity-100"),children:[r,n(H,{text:t,label:l("actions.copy")}),o,s&&n("span",{className:"codex-user-time ms-1",title:s.full,children:s.short})]})}function k(){return n("div",{className:"flex w-full items-center justify-center pt-8",children:n(M,{className:"size-[18px] animate-spin text-(--codex-conversation-body)","aria-hidden":"true"})})}function z({work:t,answer:i,footer:r,loading:o=!1,...s}){if(o)return n(k,{});return f("div",{className:"group/am codex-assistant-turn",children:[t.length>0&&n(G,{...s,children:t}),i!==null&&(t.length===0?i:n("div",{"data-local-conversation-final-assistant":!0,"data-testid":"codex-final-answer",className:"codex-final-answer",children:i})),r]})}export{tt as CodexAssistantMessage,z as CodexAssistantTurn,W as CodexMessageActions};
@@ -0,0 +1,2 @@
1
+ import { type Dispatch, type SetStateAction } from "react";
2
+ export declare function useCodexDisclosureState(stateKey: string, initialExpanded: boolean): [boolean, Dispatch<SetStateAction<boolean>>];
@@ -0,0 +1 @@
1
+ import{useCallback as r,useState as t}from"react";var d=new Map;function g(e,o){let[c,k]=t(()=>({key:e,expanded:d.get(e)??o})),p=c.expanded;if(c.key!==e)p=d.get(e)??o,k({key:e,expanded:p});let f=r((s)=>{k((n)=>{let u=n.key===e?n.expanded:d.get(e)??o,x=typeof s==="function"?s(u):s;return d.set(e,x),n.key===e?{key:e,expanded:x}:n})},[e,o]);return[p,f]}export{g as useCodexDisclosureState};
@@ -0,0 +1,15 @@
1
+ import type { ToolUseBlock } from "../lib/group-blocks.js";
2
+ export interface FileChange {
3
+ path: string;
4
+ additions: number;
5
+ deletions: number;
6
+ }
7
+ export declare function fileChanges(blocks: ToolUseBlock[]): FileChange[];
8
+ export declare function CodexEditedFilesCard({ blocks }: {
9
+ blocks: ToolUseBlock[];
10
+ }): import("react").JSX.Element;
11
+ export declare function EditedFilesCard<T extends FileChange>({ files, onOpen, renderPath }: {
12
+ files: T[];
13
+ onOpen?: (file: T) => void;
14
+ renderPath?: (file: T) => React.ReactNode;
15
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ import{jsx as i,jsxs as d}from"react/jsx-runtime";import{FileDiffIcon as p}from"lucide-react";import{useState as m}from"react";import{useActivityHost as x}from"../activity-host.js";function f(t){if(t===null||t.length===0)return 0;return t.split(`
2
+ `).length}function N(t){let s=new Map;for(let a of t)for(let o of a.content){if(o.type!=="diff")continue;let l=o,c=l._meta?.alwith?.hunks??[],r=c.reduce((n,e)=>n+f(e.newText),0),h=c.reduce((n,e)=>n+f(e.oldText),0);for(let n of l.changes){let e=s.get(n.path);if(e)e.additions+=r,e.deletions+=h;else s.set(n.path,{path:n.path,additions:r,deletions:h})}}return[...s.values()]}function y({blocks:t}){return i(g,{files:N(t)})}function g({files:t,onOpen:s,renderPath:a}){let{t:o,openLink:l}=x(),[c,r]=m(!0);if(t.length===0)return null;let h=t.reduce((e,u)=>e+u.additions,0),n=t.reduce((e,u)=>e+u.deletions,0);return d("section",{className:"codex-edited-files-card",children:[d("div",{className:"codex-edited-files-header",children:[i("div",{className:"codex-edited-files-icon","aria-hidden":"true",children:i(p,{})}),d("div",{className:"codex-edited-files-summary",children:[i("strong",{children:o("stream.codex.editedFilesCount",{count:t.length})}),i("button",{type:"button","data-codex-disclosure":"",onClick:()=>r((e)=>!e),"aria-expanded":c,children:o(c?"stream.codex.hideChanges":"stream.codex.viewChanges")})]}),d("div",{className:"codex-edited-files-total",title:o("stream.codex.changedLines"),children:[d("span",{className:"codex-diff-additions",children:["+",h]}),d("span",{className:"codex-diff-deletions",children:["-",n]})]})]}),c&&i("div",{className:"codex-edited-files-list",children:t.map((e)=>d("div",{className:"codex-edited-file-row",children:[i("button",{type:"button",className:"codex-edited-file-path",title:e.path,onClick:()=>s===void 0?l(e.path):s(e),children:a===void 0?e.path:a(e)}),d("span",{className:"codex-edited-file-counts",children:[d("span",{className:"codex-diff-additions",children:["+",e.additions]}),d("span",{className:"codex-diff-deletions",children:["-",e.deletions]})]})]},e.path))})]})}export{y as CodexEditedFilesCard,g as EditedFilesCard,N as fileChanges};
@@ -0,0 +1,11 @@
1
+ import "katex/dist/katex.min.css";
2
+ export interface MarkdownHost {
3
+ theme: "dark" | "light";
4
+ copyLabel: string;
5
+ openLink: (url: string) => void;
6
+ }
7
+ export declare function CodexMarkdownRenderer({ text, streaming, host }: {
8
+ text: string;
9
+ streaming?: boolean;
10
+ host: MarkdownHost;
11
+ }): React.JSX.Element;