@nextclaw/ui 0.12.19 → 0.12.20-beta.1

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 (185) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/assets/api-BcqDx0tm.js +15 -0
  3. package/dist/assets/app-manager-provider-DVYBjif-.js +1 -0
  4. package/dist/assets/app-navigation.config-CMoWvFEI.js +1 -0
  5. package/dist/assets/{book-open-CVEuA0y5.js → book-open-DgLqYpNY.js} +1 -1
  6. package/dist/assets/{channels-list-page-BqhqaBf1.js → channels-list-page-CsoI4OJm.js} +2 -2
  7. package/dist/assets/{chat-D4KecKjB.js → chat-CA3aRmhx.js} +13 -12
  8. package/dist/assets/chat-page-gdSN6Pr6.js +1 -0
  9. package/dist/assets/chunk-JZWAC4HX-u4uYphxM.js +3 -0
  10. package/dist/assets/{config-split-page-BGjVACdO.js → config-split-page-BMRGuCJQ.js} +1 -1
  11. package/dist/assets/{createLucideIcon-PPrXCGK8.js → createLucideIcon-BZkY6emz.js} +1 -1
  12. package/dist/assets/desktop-update-config-CD6-2PfI.js +1 -0
  13. package/dist/assets/{dialog-CTCX7oLf.js → dialog-csshWetU.js} +1 -1
  14. package/dist/assets/{dist-FL5e8mMi.js → dist-Bl94Ahwx.js} +1 -1
  15. package/dist/assets/{doc-browser-C02neCIE.js → doc-browser-BUlCkZo2.js} +1 -1
  16. package/dist/assets/doc-browser-CzCV73NJ.js +1 -0
  17. package/dist/assets/doc-browser-Doh2541x.js +1 -0
  18. package/dist/assets/{doc-browser-context-C-WPOji4.js → doc-browser-context-DfLHAWbG.js} +1 -1
  19. package/dist/assets/{es2015-BNy4R8AC.js → es2015-JCM5-KtW.js} +1 -1
  20. package/dist/assets/{external-link-BNtqJE01.js → external-link-Sw3ah_JD.js} +1 -1
  21. package/dist/assets/{folder-QyJHVUNz.js → folder-D7-VTnkz.js} +1 -1
  22. package/dist/assets/{hash-BGYUE-zr.js → hash-zajSTDXZ.js} +1 -1
  23. package/dist/assets/i18n-C5Mibli1.js +1 -0
  24. package/dist/assets/index-BTDFuKka.js +2 -0
  25. package/dist/assets/index-CUmk8xFK.css +1 -0
  26. package/dist/assets/{key-round-DenCfA2w.js → key-round-CnI1mc9F.js} +1 -1
  27. package/dist/assets/loader-circle-B5i8oMMY.js +1 -0
  28. package/dist/assets/{logo-badge-CKAxvQFc.js → logo-badge-BQgKnVtz.js} +1 -1
  29. package/dist/assets/{logos-CqXnaJIm.js → logos-CqVm0q0W.js} +1 -1
  30. package/dist/assets/marketplace-page-DJGDpTAo.js +1 -0
  31. package/dist/assets/{marketplace-page-XnDa2ulT.js → marketplace-page-DxlxHCFm.js} +2 -2
  32. package/dist/assets/mcp-marketplace-page-5UjYRWOR.js +40 -0
  33. package/dist/assets/mcp-marketplace-page-C1XaHZZO.js +1 -0
  34. package/dist/assets/message-square-D6Z4NwpG.js +1 -0
  35. package/dist/assets/{model-config-ByeL6Toe.js → model-config-PccJ9XyH.js} +1 -1
  36. package/dist/assets/{notice-card-D00-02yg.js → notice-card-CCgk6FvF.js} +1 -1
  37. package/dist/assets/play-D8WJLnJe.js +1 -0
  38. package/dist/assets/plus-Di0KAkiO.js +1 -0
  39. package/dist/assets/{popover-AmJkxio3.js → popover-YAsxDBhY.js} +1 -1
  40. package/dist/assets/{provider-scoped-model-input-CfFJsJp-.js → provider-scoped-model-input-CzpF7cug.js} +1 -1
  41. package/dist/assets/{providers-list-HMQzW2WV.js → providers-list-8qDMER8o.js} +1 -1
  42. package/dist/assets/{refresh-ccw-B-dhb3yS.js → refresh-ccw-Bii4w8aB.js} +1 -1
  43. package/dist/assets/refresh-cw-BxojR62w.js +1 -0
  44. package/dist/assets/remote-D4TtLPAp.js +1 -0
  45. package/dist/assets/{rotate-cw-BWqAG3Fv.js → rotate-cw-1Xqa7LZ8.js} +1 -1
  46. package/dist/assets/runtime-config-page-D-4c5H5z.js +1 -0
  47. package/dist/assets/{save-DpdkGieJ.js → save--BVI5wZX.js} +1 -1
  48. package/dist/assets/search-config-D3a65l3r.js +1 -0
  49. package/dist/assets/{search-CQUdr7j_.js → search-vChioOoe.js} +1 -1
  50. package/dist/assets/{secrets-config-YCsGd1am.js → secrets-config-CoMlR_7i.js} +2 -2
  51. package/dist/assets/{select-DVUtSFHZ.js → select-DIZrwsKU.js} +1 -1
  52. package/dist/assets/{sessions-config-page-BKN-XdKr.js → sessions-config-page-Cc0TJStn.js} +2 -2
  53. package/dist/assets/{setting-row-Cb5-lFs-.js → setting-row-DiQyrE81.js} +1 -1
  54. package/dist/assets/{settings-DgtZZlnF.js → settings-CiRChctQ.js} +1 -1
  55. package/dist/assets/skeleton-CFQRIUzt.js +1 -0
  56. package/dist/assets/{sparkles-DNSCyDhL.js → sparkles-D1ZKWdm4.js} +1 -1
  57. package/dist/assets/{status-dot-X_j51OfA.js → status-dot-Dv_hiUVa.js} +1 -1
  58. package/dist/assets/{tabs-custom-CcWmekaF.js → tabs-custom-CsACkVji.js} +1 -1
  59. package/dist/assets/{tag-chip-fdbK2wE6.js → tag-chip-C3wDBe_-.js} +1 -1
  60. package/dist/assets/theme-provider-aOmrJ9J6.js +1 -0
  61. package/dist/assets/{tooltip-BkZCQcKw.js → tooltip-Dq5Xehpk.js} +1 -1
  62. package/dist/assets/{trash-2-CqciSCsg.js → trash-2-rY9ZteZX.js} +1 -1
  63. package/dist/assets/use-config-BQJjq1mP.js +1 -0
  64. package/dist/assets/{use-confirm-dialog-DSrb9205.js → use-confirm-dialog-DBoV5n5P.js} +1 -1
  65. package/dist/assets/{use-infinite-scroll-loader-DmowtyTI.js → use-infinite-scroll-loader-JAicqVC5.js} +1 -1
  66. package/dist/assets/{use-viewport-layout-CaALCA51.js → use-viewport-layout-BX3XqzJ4.js} +1 -1
  67. package/dist/assets/x-DpTzXQcX.js +1 -0
  68. package/dist/index.html +40 -39
  69. package/package.json +9 -6
  70. package/src/app/hooks/use-realtime-query-bridge.ts +5 -5
  71. package/src/app/index.tsx +7 -1
  72. package/src/features/channels/components/config/channel-form.tsx +3 -3
  73. package/src/features/channels/components/config/weixin-channel-auth-section.tsx +1 -1
  74. package/src/features/chat/components/conversation/chat-conversation-panel.tsx +1 -0
  75. package/src/features/chat/components/conversation/chat-input-bar.container.tsx +9 -4
  76. package/src/features/chat/components/conversation/chat-message-list.container.test.tsx +64 -6
  77. package/src/features/chat/components/conversation/chat-message-list.container.tsx +185 -17
  78. package/src/features/chat/components/session/session-context-icon.tsx +1 -4
  79. package/src/features/chat/hooks/use-ncp-chat-derived-state.ts +3 -1
  80. package/src/features/chat/hooks/use-ncp-chat-page-data.ts +7 -6
  81. package/src/features/chat/hooks/use-ncp-session-conversation.test.tsx +74 -2
  82. package/src/features/chat/hooks/use-ncp-session-conversation.ts +32 -10
  83. package/src/features/chat/hooks/use-selected-session-context-window-indicator.ts +20 -0
  84. package/src/features/chat/managers/ncp-chat-input.manager.test.ts +25 -0
  85. package/src/features/chat/managers/ncp-chat-input.manager.ts +5 -1
  86. package/src/features/chat/pages/ncp-chat-page.test.ts +22 -8
  87. package/src/features/chat/pages/ncp-chat-page.tsx +15 -11
  88. package/src/features/chat/stores/chat-thread.store.ts +8 -2
  89. package/src/features/chat/utils/chat-context-window-indicator.utils.ts +50 -0
  90. package/src/features/chat/utils/chat-runtime.utils.ts +1 -1
  91. package/src/features/chat/utils/chat-session-preference-governance.utils.test.tsx +114 -0
  92. package/src/features/chat/utils/chat-session-preference-governance.utils.ts +30 -36
  93. package/src/features/chat/utils/ncp-chat-runtime-availability.utils.test.ts +165 -0
  94. package/src/features/chat/utils/ncp-chat-runtime-availability.utils.ts +50 -0
  95. package/src/features/chat/utils/ncp-session-adapter.utils.test.ts +27 -0
  96. package/src/features/chat/utils/ncp-session-adapter.utils.ts +6 -4
  97. package/src/features/chat/utils/ncp-session-context-metadata.utils.ts +121 -0
  98. package/src/features/chat/utils/session-context.utils.ts +1 -2
  99. package/src/features/system-status/components/config/runtime-config-editor.tsx +6 -0
  100. package/src/features/system-status/components/config/runtime-settings-card.tsx +12 -0
  101. package/src/features/system-status/components/desktop-update-config.test.tsx +17 -7
  102. package/src/features/system-status/components/desktop-update-config.tsx +75 -30
  103. package/src/features/system-status/hooks/use-system-status.ts +0 -11
  104. package/src/features/system-status/index.ts +4 -1
  105. package/src/features/system-status/managers/runtime-update.manager.ts +330 -0
  106. package/src/features/system-status/managers/system-status.manager.test.ts +0 -25
  107. package/src/features/system-status/managers/system-status.manager.ts +1 -30
  108. package/src/features/system-status/stores/runtime-update.store.ts +24 -0
  109. package/src/features/system-status/types/system-status.types.ts +0 -2
  110. package/src/features/system-status/utils/runtime-config-agent.utils.ts +6 -1
  111. package/src/features/system-status/utils/system-status.utils.test.ts +1 -85
  112. package/src/features/system-status/utils/system-status.utils.ts +1 -23
  113. package/src/platforms/desktop/managers/desktop-update.manager.ts +6 -0
  114. package/src/platforms/desktop/types/desktop-update.types.ts +21 -19
  115. package/src/shared/components/common/brand-header.test.tsx +142 -0
  116. package/src/shared/components/common/brand-header.tsx +93 -0
  117. package/src/shared/components/cron-config.tsx +1 -1
  118. package/src/shared/components/doc-browser/doc-browser-context.test.tsx +1 -1
  119. package/src/shared/components/doc-browser/doc-browser.tsx +1 -1
  120. package/src/shared/components/search-config.tsx +3 -3
  121. package/src/shared/lib/api/README.md +3 -0
  122. package/src/shared/lib/api/index.ts +13 -11
  123. package/src/shared/lib/api/ncp-session.test.ts +17 -18
  124. package/src/shared/lib/api/ncp-session.types.ts +92 -0
  125. package/src/shared/lib/api/raw-client.utils.ts +3 -126
  126. package/src/shared/lib/api/services/agents.service.ts +18 -0
  127. package/src/shared/lib/api/services/channel-auth.service.ts +21 -0
  128. package/src/shared/lib/api/{client.ts → services/client.service.ts} +45 -1
  129. package/src/shared/lib/api/services/config.service.ts +171 -0
  130. package/src/shared/lib/api/services/marketplace.service.ts +66 -0
  131. package/src/shared/lib/api/services/mcp-marketplace.service.ts +70 -0
  132. package/src/shared/lib/api/services/ncp-attachments.service.ts +14 -0
  133. package/src/shared/lib/api/services/ncp-session.service.ts +39 -0
  134. package/src/shared/lib/api/services/remote.service.ts +50 -0
  135. package/src/shared/lib/api/services/runtime-control.service.ts +18 -0
  136. package/src/shared/lib/api/services/runtime-update.service.ts +26 -0
  137. package/src/shared/lib/api/services/server-path.service.ts +16 -0
  138. package/src/shared/lib/api/types.ts +9 -74
  139. package/src/shared/lib/i18n/{chat.ts → chat-labels.utils.ts} +13 -1
  140. package/src/shared/lib/i18n/desktop-update-labels.utils.ts +65 -0
  141. package/src/shared/lib/i18n/index.ts +4 -5
  142. package/src/shared/lib/i18n/runtime/i18n-language-owner.ts +5 -5
  143. package/src/shared/lib/transport/index.ts +1 -0
  144. package/src/shared/lib/transport/local-transport.service.ts +24 -4
  145. package/src/shared/lib/transport/remote-transport.service.ts +2 -2
  146. package/src/shared/lib/transport/request-raw-api-response.utils.ts +133 -0
  147. package/src/shared/lib/transport/transport.types.ts +8 -2
  148. package/src/shared/lib/ui-document-title/index.ts +1 -1
  149. package/tsconfig.json +1 -0
  150. package/dist/assets/api-BurjmW4A.js +0 -15
  151. package/dist/assets/app-manager-provider-DhxUmyTv.js +0 -1
  152. package/dist/assets/app-navigation.config-Bpd16Pem.js +0 -1
  153. package/dist/assets/chat-page-Cc7n80lW.js +0 -1
  154. package/dist/assets/chunk-JZWAC4HX-24FLdHl7.js +0 -3
  155. package/dist/assets/desktop-update-config-fMLlSStv.js +0 -1
  156. package/dist/assets/doc-browser-COj7x090.js +0 -1
  157. package/dist/assets/doc-browser-fyn7eDTp.js +0 -1
  158. package/dist/assets/i18n-CM4y8Mw9.js +0 -1
  159. package/dist/assets/index-CtVSzMPM.js +0 -2
  160. package/dist/assets/index-N3hjuljD.css +0 -1
  161. package/dist/assets/loader-circle-R23uEPkM.js +0 -1
  162. package/dist/assets/marketplace-page-mF-M5mku.js +0 -1
  163. package/dist/assets/mcp-marketplace-page-BArKWcRZ.js +0 -40
  164. package/dist/assets/mcp-marketplace-page-DBUcIIHJ.js +0 -1
  165. package/dist/assets/message-square-Dm34zD6k.js +0 -1
  166. package/dist/assets/play-ul4L6MWm.js +0 -1
  167. package/dist/assets/plus-D14303DH.js +0 -1
  168. package/dist/assets/remote-B4ELSd3u.js +0 -1
  169. package/dist/assets/runtime-config-page-N4FP6H0M.js +0 -1
  170. package/dist/assets/search-config-B62TY-z2.js +0 -1
  171. package/dist/assets/skeleton-BCPi52jT.js +0 -1
  172. package/dist/assets/theme-provider-WTWq_jYq.js +0 -1
  173. package/dist/assets/use-config-CyvhbRhf.js +0 -1
  174. package/dist/assets/x-tYcSDsrY.js +0 -1
  175. package/src/shared/lib/api/agents.ts +0 -34
  176. package/src/shared/lib/api/channel-auth.ts +0 -35
  177. package/src/shared/lib/api/config.ts +0 -362
  178. package/src/shared/lib/api/marketplace.ts +0 -156
  179. package/src/shared/lib/api/mcp-marketplace.ts +0 -138
  180. package/src/shared/lib/api/ncp-attachments.ts +0 -41
  181. package/src/shared/lib/api/ncp-session.ts +0 -78
  182. package/src/shared/lib/api/remote.ts +0 -86
  183. package/src/shared/lib/api/runtime-control.ts +0 -34
  184. package/src/shared/lib/api/server-path.ts +0 -46
  185. /package/dist/assets/{config-hints-CPNzbMEp.js → config-hints-MogHYQ8G.js} +0 -0
@@ -0,0 +1,18 @@
1
+ import { nextclawClient } from "./client.service";
2
+ import type { AgentCreateRequest, AgentDeleteResult, AgentProfileView, AgentUpdateRequest } from "@/shared/lib/api/types";
3
+
4
+ export async function fetchAgents(): Promise<{ agents: AgentProfileView[] }> {
5
+ return { agents: await nextclawClient.agents.list() };
6
+ }
7
+
8
+ export async function createAgent(data: AgentCreateRequest): Promise<AgentProfileView> {
9
+ return await nextclawClient.agents.create(data);
10
+ }
11
+
12
+ export async function updateAgent(agentId: string, data: AgentUpdateRequest): Promise<AgentProfileView> {
13
+ return await nextclawClient.agents.update(agentId, data);
14
+ }
15
+
16
+ export async function deleteAgent(agentId: string): Promise<AgentDeleteResult> {
17
+ return await nextclawClient.agents.delete(agentId);
18
+ }
@@ -0,0 +1,21 @@
1
+ import { nextclawClient } from './client.service';
2
+ import type {
3
+ ChannelAuthPollRequest,
4
+ ChannelAuthPollResult,
5
+ ChannelAuthStartRequest,
6
+ ChannelAuthStartResult
7
+ } from '@/shared/lib/api/channel-auth.types';
8
+
9
+ export async function startChannelAuth(
10
+ channel: string,
11
+ data: ChannelAuthStartRequest = {}
12
+ ): Promise<ChannelAuthStartResult> {
13
+ return await nextclawClient.channelAuth.start(channel, data);
14
+ }
15
+
16
+ export async function pollChannelAuth(
17
+ channel: string,
18
+ data: ChannelAuthPollRequest
19
+ ): Promise<ChannelAuthPollResult> {
20
+ return await nextclawClient.channelAuth.poll(channel, data);
21
+ }
@@ -1,5 +1,45 @@
1
+ import {
2
+ createNextClawClient,
3
+ type NextClawRealtimeEvent,
4
+ type NextClawTransport,
5
+ type NextClawTransportRequestInput,
6
+ type NextClawTransportUploadInput
7
+ } from '@nextclaw/client-sdk';
8
+ import { API_BASE } from '@/shared/lib/api/api-base';
1
9
  import { appClient } from '@/shared/lib/transport';
2
- import type { ApiResponse } from './types';
10
+ import type { ApiResponse } from '@/shared/lib/api/types';
11
+
12
+ const nextclawUiTransport: NextClawTransport = {
13
+ request: async <T>({ body, method, path, signal, timeoutMs }: NextClawTransportRequestInput): Promise<T> => {
14
+ return await appClient.request({
15
+ method,
16
+ path,
17
+ ...(body !== undefined ? { body } : {}),
18
+ ...(signal ? { signal } : {}),
19
+ ...(timeoutMs !== undefined ? { timeoutMs } : {})
20
+ });
21
+ },
22
+ upload: async <T>({ formData, headers, path, signal }: NextClawTransportUploadInput): Promise<T> => {
23
+ const response = await fetch(`${API_BASE}${path}`, {
24
+ method: 'POST',
25
+ body: formData,
26
+ credentials: 'include',
27
+ ...(headers ? { headers } : {}),
28
+ ...(signal ? { signal } : {})
29
+ });
30
+ const payload = (await response.json()) as ApiResponse<unknown>;
31
+ if (!response.ok || !payload.ok) {
32
+ throw new Error(readApiErrorMessage(payload, `Upload failed for ${path}`));
33
+ }
34
+ return payload.data as T;
35
+ },
36
+ subscribe: (handler: (event: NextClawRealtimeEvent) => void) => appClient.subscribe(handler)
37
+ };
38
+
39
+ export const nextclawClient = createNextClawClient({
40
+ baseUrl: API_BASE,
41
+ transport: nextclawUiTransport
42
+ });
3
43
 
4
44
  export async function requestApiResponse<T>(
5
45
  endpoint: string,
@@ -64,3 +104,7 @@ function parseRequestBody(body: BodyInit | null | undefined): unknown {
64
104
  }
65
105
  return body;
66
106
  }
107
+
108
+ function readApiErrorMessage(payload: ApiResponse<unknown>, fallback: string): string {
109
+ return !payload.ok ? payload.error.message : fallback;
110
+ }
@@ -0,0 +1,171 @@
1
+ import { nextclawClient } from './client.service';
2
+ import type {
3
+ AuthEnabledUpdateRequest,
4
+ AuthLoginRequest,
5
+ AuthPasswordUpdateRequest,
6
+ AuthSetupRequest,
7
+ AuthStatusView,
8
+ AppMetaView,
9
+ BootstrapStatusView,
10
+ ConfigView,
11
+ ConfigMetaView,
12
+ ConfigSchemaResponse,
13
+ ProviderConfigView,
14
+ ChannelConfigUpdate,
15
+ ProviderConfigUpdate,
16
+ ProviderConnectionTestRequest,
17
+ ProviderConnectionTestResult,
18
+ ProviderAuthStartRequest,
19
+ ProviderAuthStartResult,
20
+ ProviderAuthPollRequest,
21
+ ProviderAuthPollResult,
22
+ ProviderAuthImportResult,
23
+ SearchConfigUpdate,
24
+ SearchConfigView,
25
+ ProviderCreateRequest,
26
+ ProviderCreateResult,
27
+ ProviderDeleteResult,
28
+ RuntimeConfigUpdate,
29
+ SecretsConfigUpdate,
30
+ SecretsView,
31
+ ConfigActionExecuteRequest,
32
+ ConfigActionExecuteResult,
33
+ ChatSessionTypesView,
34
+ CronListView,
35
+ CronEnableRequest,
36
+ CronRunRequest,
37
+ CronActionResult
38
+ } from '@/shared/lib/api/types';
39
+
40
+ export async function fetchAuthStatus(options: { timeoutMs?: number } = {}): Promise<AuthStatusView> {
41
+ return await nextclawClient.auth.fetchStatus({ timeoutMs: options.timeoutMs ?? 5_000 });
42
+ }
43
+
44
+ export async function setupAuth(data: AuthSetupRequest): Promise<AuthStatusView> {
45
+ return await nextclawClient.auth.setup(data);
46
+ }
47
+
48
+ export async function loginAuth(data: AuthLoginRequest): Promise<AuthStatusView> {
49
+ return await nextclawClient.auth.login(data);
50
+ }
51
+
52
+ export async function logoutAuth(): Promise<{ success: boolean }> {
53
+ return await nextclawClient.auth.logout();
54
+ }
55
+
56
+ export async function updateAuthPassword(data: AuthPasswordUpdateRequest): Promise<AuthStatusView> {
57
+ return await nextclawClient.auth.updatePassword(data);
58
+ }
59
+
60
+ export async function updateAuthEnabled(data: AuthEnabledUpdateRequest): Promise<AuthStatusView> {
61
+ return await nextclawClient.auth.updateEnabled(data);
62
+ }
63
+
64
+ export async function fetchAppMeta(): Promise<AppMetaView> {
65
+ return await nextclawClient.app.fetchMeta();
66
+ }
67
+
68
+ export async function fetchBootstrapStatus(): Promise<BootstrapStatusView> {
69
+ return await nextclawClient.app.fetchBootstrapStatus();
70
+ }
71
+
72
+ export async function fetchConfig(): Promise<ConfigView> {
73
+ return await nextclawClient.config.fetch();
74
+ }
75
+
76
+ export async function fetchConfigMeta(): Promise<ConfigMetaView> {
77
+ return await nextclawClient.config.fetchMeta();
78
+ }
79
+
80
+ export async function fetchConfigSchema(): Promise<ConfigSchemaResponse> {
81
+ return await nextclawClient.config.fetchSchema();
82
+ }
83
+
84
+ export async function updateModel(data: { model: string; workspace?: string }): Promise<{ model: string; workspace?: string }> {
85
+ return await nextclawClient.config.updateModel(data);
86
+ }
87
+
88
+ export async function updateSearch(data: SearchConfigUpdate): Promise<SearchConfigView> {
89
+ return await nextclawClient.config.updateSearch(data);
90
+ }
91
+
92
+ export async function updateProvider(provider: string, data: ProviderConfigUpdate): Promise<ProviderConfigView> {
93
+ return await nextclawClient.config.updateProvider(provider, data);
94
+ }
95
+
96
+ export async function createProvider(data: ProviderCreateRequest = {}): Promise<ProviderCreateResult> {
97
+ return await nextclawClient.config.createProvider(data);
98
+ }
99
+
100
+ export async function deleteProvider(provider: string): Promise<ProviderDeleteResult> {
101
+ return await nextclawClient.config.deleteProvider(provider);
102
+ }
103
+
104
+ export async function testProviderConnection(
105
+ provider: string,
106
+ data: ProviderConnectionTestRequest
107
+ ): Promise<ProviderConnectionTestResult> {
108
+ return await nextclawClient.config.testProviderConnection(provider, data);
109
+ }
110
+
111
+ export async function startProviderAuth(
112
+ provider: string,
113
+ data: ProviderAuthStartRequest = {}
114
+ ): Promise<ProviderAuthStartResult> {
115
+ return await nextclawClient.config.startProviderAuth(provider, data);
116
+ }
117
+
118
+ export async function pollProviderAuth(
119
+ provider: string,
120
+ data: ProviderAuthPollRequest
121
+ ): Promise<ProviderAuthPollResult> {
122
+ return await nextclawClient.config.pollProviderAuth(provider, data);
123
+ }
124
+
125
+ export async function importProviderAuthFromCli(provider: string): Promise<ProviderAuthImportResult> {
126
+ return await nextclawClient.config.importProviderAuthFromCli(provider);
127
+ }
128
+
129
+ export async function updateChannel(
130
+ channel: string,
131
+ data: ChannelConfigUpdate
132
+ ): Promise<Record<string, unknown>> {
133
+ return await nextclawClient.config.updateChannel(channel, data);
134
+ }
135
+
136
+ export async function updateRuntime(
137
+ data: RuntimeConfigUpdate
138
+ ): Promise<Pick<ConfigView, 'agents' | 'bindings' | 'session'>> {
139
+ return await nextclawClient.config.updateRuntime(data) as Pick<ConfigView, 'agents' | 'bindings' | 'session'>;
140
+ }
141
+
142
+ export async function updateSecrets(data: SecretsConfigUpdate): Promise<SecretsView> {
143
+ return await nextclawClient.config.updateSecrets(data);
144
+ }
145
+
146
+ export async function executeConfigAction(
147
+ actionId: string,
148
+ data: ConfigActionExecuteRequest
149
+ ): Promise<ConfigActionExecuteResult> {
150
+ return await nextclawClient.config.executeAction(actionId, data);
151
+ }
152
+
153
+ export async function fetchNcpChatSessionTypes(): Promise<ChatSessionTypesView> {
154
+ return await nextclawClient.config.fetchChatSessionTypes();
155
+ }
156
+
157
+ export async function fetchCronJobs(params?: { all?: boolean }): Promise<CronListView> {
158
+ return await nextclawClient.config.fetchCronJobs(params);
159
+ }
160
+
161
+ export async function deleteCronJob(id: string): Promise<{ deleted: boolean }> {
162
+ return await nextclawClient.config.deleteCronJob(id);
163
+ }
164
+
165
+ export async function setCronJobEnabled(id: string, data: CronEnableRequest): Promise<CronActionResult> {
166
+ return await nextclawClient.config.setCronJobEnabled(id, data);
167
+ }
168
+
169
+ export async function runCronJob(id: string, data: CronRunRequest): Promise<CronActionResult> {
170
+ return await nextclawClient.config.runCronJob(id, data);
171
+ }
@@ -0,0 +1,66 @@
1
+ import { nextclawClient } from './client.service';
2
+ import type {
3
+ MarketplaceInstallRequest,
4
+ MarketplaceInstallResult,
5
+ MarketplaceManageRequest,
6
+ MarketplaceManageResult,
7
+ MarketplaceInstalledView,
8
+ MarketplacePluginContentView,
9
+ MarketplaceItemType,
10
+ MarketplaceSkillContentView,
11
+ MarketplaceItemView,
12
+ MarketplaceListView,
13
+ MarketplaceRecommendationView,
14
+ MarketplaceSort
15
+ } from '@/shared/lib/api/types';
16
+
17
+ export type MarketplaceListParams = {
18
+ type: MarketplaceItemType;
19
+ q?: string;
20
+ tag?: string;
21
+ sort?: MarketplaceSort;
22
+ page?: number;
23
+ pageSize?: number;
24
+ };
25
+
26
+ export async function fetchMarketplaceItems(params: MarketplaceListParams): Promise<MarketplaceListView> {
27
+ return await nextclawClient.marketplace.fetchItems(params);
28
+ }
29
+
30
+ export async function fetchMarketplaceItem(slug: string, type: MarketplaceItemType): Promise<MarketplaceItemView> {
31
+ return await nextclawClient.marketplace.fetchItem(slug, type);
32
+ }
33
+
34
+ export async function fetchMarketplaceSkillContent(slug: string): Promise<MarketplaceSkillContentView> {
35
+ return await nextclawClient.marketplace.fetchSkillContent(slug);
36
+ }
37
+
38
+ export async function fetchMarketplacePluginContent(slug: string): Promise<MarketplacePluginContentView> {
39
+ return await nextclawClient.marketplace.fetchPluginContent(slug);
40
+ }
41
+
42
+ export async function fetchMarketplaceRecommendations(
43
+ type: MarketplaceItemType,
44
+ params: {
45
+ scene?: string;
46
+ limit?: number;
47
+ } = {}
48
+ ): Promise<MarketplaceRecommendationView> {
49
+ return await nextclawClient.marketplace.fetchRecommendations(type, params);
50
+ }
51
+
52
+ export async function installMarketplaceItem(request: MarketplaceInstallRequest): Promise<MarketplaceInstallResult> {
53
+ return await nextclawClient.marketplace.install(
54
+ request as Parameters<typeof nextclawClient.marketplace.install>[0]
55
+ ) as MarketplaceInstallResult;
56
+ }
57
+
58
+ export async function fetchMarketplaceInstalled(type: MarketplaceItemType): Promise<MarketplaceInstalledView> {
59
+ return await nextclawClient.marketplace.fetchInstalled(type);
60
+ }
61
+
62
+ export async function manageMarketplaceItem(request: MarketplaceManageRequest): Promise<MarketplaceManageResult> {
63
+ return await nextclawClient.marketplace.manage(
64
+ request as Parameters<typeof nextclawClient.marketplace.manage>[0]
65
+ ) as MarketplaceManageResult;
66
+ }
@@ -0,0 +1,70 @@
1
+ import { nextclawClient } from './client.service';
2
+ import type {
3
+ MarketplaceInstalledView,
4
+ MarketplaceItemView,
5
+ MarketplaceListView,
6
+ MarketplaceMcpContentView,
7
+ MarketplaceMcpDoctorResult,
8
+ MarketplaceRecommendationView,
9
+ MarketplaceSort
10
+ } from '@/shared/lib/api/types';
11
+
12
+ export type McpMarketplaceListParams = {
13
+ q?: string;
14
+ tag?: string;
15
+ sort?: MarketplaceSort;
16
+ page?: number;
17
+ pageSize?: number;
18
+ };
19
+
20
+ export async function fetchMcpMarketplaceItems(params: McpMarketplaceListParams): Promise<MarketplaceListView> {
21
+ return await nextclawClient.mcpMarketplace.fetchItems(params);
22
+ }
23
+
24
+ export async function fetchMcpMarketplaceInstalled(): Promise<MarketplaceInstalledView> {
25
+ return await nextclawClient.mcpMarketplace.fetchInstalled();
26
+ }
27
+
28
+ export async function fetchMcpMarketplaceItem(slug: string): Promise<MarketplaceItemView> {
29
+ return await nextclawClient.mcpMarketplace.fetchItem(slug);
30
+ }
31
+
32
+ export async function fetchMcpMarketplaceContent(slug: string): Promise<MarketplaceMcpContentView> {
33
+ return await nextclawClient.mcpMarketplace.fetchContent(slug);
34
+ }
35
+
36
+ export async function fetchMcpMarketplaceRecommendations(params: {
37
+ scene?: string;
38
+ limit?: number;
39
+ } = {}): Promise<MarketplaceRecommendationView> {
40
+ return await nextclawClient.mcpMarketplace.fetchRecommendations(params);
41
+ }
42
+
43
+ export async function installMcpMarketplaceItem(request: {
44
+ spec: string;
45
+ name?: string;
46
+ enabled?: boolean;
47
+ allAgents?: boolean;
48
+ agents?: string[];
49
+ inputs?: Record<string, string>;
50
+ }): Promise<{ type: 'mcp'; spec: string; name?: string; message: string; output?: string }> {
51
+ return await nextclawClient.mcpMarketplace.install({
52
+ type: 'mcp',
53
+ ...request
54
+ });
55
+ }
56
+
57
+ export async function manageMcpMarketplaceItem(request: {
58
+ action: 'enable' | 'disable' | 'remove';
59
+ id?: string;
60
+ spec?: string;
61
+ }): Promise<{ type: 'mcp'; action: 'enable' | 'disable' | 'remove'; id: string; message: string; output?: string }> {
62
+ return await nextclawClient.mcpMarketplace.manage({
63
+ type: 'mcp',
64
+ ...request
65
+ });
66
+ }
67
+
68
+ export async function doctorMcpMarketplaceItem(name: string): Promise<MarketplaceMcpDoctorResult> {
69
+ return await nextclawClient.mcpMarketplace.doctor(name);
70
+ }
@@ -0,0 +1,14 @@
1
+ import type { NcpDraftAttachment } from "@nextclaw/ncp-react";
2
+ import { nextclawClient } from "./client.service";
3
+
4
+ export async function uploadNcpAssets(files: File[]): Promise<NcpDraftAttachment[]> {
5
+ const payload = await nextclawClient.sessions.uploadAssets(files);
6
+ return payload.assets.map((asset) => ({
7
+ id: asset.id,
8
+ name: asset.name,
9
+ mimeType: asset.mimeType,
10
+ sizeBytes: asset.sizeBytes,
11
+ assetUri: asset.assetUri,
12
+ url: asset.url,
13
+ }));
14
+ }
@@ -0,0 +1,39 @@
1
+ import { nextclawClient } from './client.service';
2
+ import type {
3
+ NcpSessionMessagesView,
4
+ NcpSessionSkillsView,
5
+ NcpSessionsListView,
6
+ NcpSessionSummaryView,
7
+ SessionPatchUpdate
8
+ } from '@/shared/lib/api/types';
9
+
10
+ // GET /api/ncp/sessions
11
+ export async function fetchNcpSessions(params?: { limit?: number }): Promise<NcpSessionsListView> {
12
+ return await nextclawClient.sessions.list(params) as NcpSessionsListView;
13
+ }
14
+
15
+ // GET /api/ncp/sessions/:sessionId/messages
16
+ export async function fetchNcpSessionMessages(sessionId: string, limit = 200): Promise<NcpSessionMessagesView> {
17
+ return await nextclawClient.sessions.listMessages(sessionId, limit) as NcpSessionMessagesView;
18
+ }
19
+
20
+ // GET /api/ncp/sessions/:sessionId/skills
21
+ export async function fetchNcpSessionSkills(
22
+ sessionId: string,
23
+ params?: { projectRoot?: string | null }
24
+ ): Promise<NcpSessionSkillsView> {
25
+ return await nextclawClient.sessions.listSkills(sessionId, params);
26
+ }
27
+
28
+ // PUT /api/ncp/sessions/:sessionId
29
+ export async function updateNcpSession(
30
+ sessionId: string,
31
+ data: SessionPatchUpdate
32
+ ): Promise<NcpSessionSummaryView> {
33
+ return await nextclawClient.sessions.update(sessionId, data) as NcpSessionSummaryView;
34
+ }
35
+
36
+ // DELETE /api/ncp/sessions/:sessionId
37
+ export async function deleteNcpSession(sessionId: string): Promise<{ deleted: boolean; sessionId: string }> {
38
+ return await nextclawClient.sessions.delete(sessionId);
39
+ }
@@ -0,0 +1,50 @@
1
+ import { nextclawClient } from './client.service';
2
+ import type {
3
+ RemoteAccessView,
4
+ RemoteAccountProfileUpdateRequest,
5
+ RemoteBrowserAuthPollRequest,
6
+ RemoteBrowserAuthPollResult,
7
+ RemoteBrowserAuthStartRequest,
8
+ RemoteBrowserAuthStartResult,
9
+ RemoteDoctorView,
10
+ RemoteLoginRequest,
11
+ RemoteServiceAction,
12
+ RemoteServiceActionResult,
13
+ RemoteSettingsUpdateRequest
14
+ } from '@/shared/lib/api/remote.types';
15
+
16
+ export async function fetchRemoteStatus(): Promise<RemoteAccessView> {
17
+ return await nextclawClient.remote.fetchStatus();
18
+ }
19
+
20
+ export async function fetchRemoteDoctor(): Promise<RemoteDoctorView> {
21
+ return await nextclawClient.remote.fetchDoctor();
22
+ }
23
+
24
+ export async function loginRemote(data: RemoteLoginRequest): Promise<RemoteAccessView> {
25
+ return await nextclawClient.remote.login(data);
26
+ }
27
+
28
+ export async function startRemoteBrowserAuth(data: RemoteBrowserAuthStartRequest): Promise<RemoteBrowserAuthStartResult> {
29
+ return await nextclawClient.remote.startBrowserAuth(data);
30
+ }
31
+
32
+ export async function pollRemoteBrowserAuth(data: RemoteBrowserAuthPollRequest): Promise<RemoteBrowserAuthPollResult> {
33
+ return await nextclawClient.remote.pollBrowserAuth(data);
34
+ }
35
+
36
+ export async function logoutRemote(): Promise<RemoteAccessView> {
37
+ return await nextclawClient.remote.logout();
38
+ }
39
+
40
+ export async function updateRemoteAccountProfile(data: RemoteAccountProfileUpdateRequest): Promise<RemoteAccessView> {
41
+ return await nextclawClient.remote.updateAccountProfile(data);
42
+ }
43
+
44
+ export async function updateRemoteSettings(data: RemoteSettingsUpdateRequest): Promise<RemoteAccessView> {
45
+ return await nextclawClient.remote.updateSettings(data);
46
+ }
47
+
48
+ export async function controlRemoteService(action: RemoteServiceAction): Promise<RemoteServiceActionResult> {
49
+ return await nextclawClient.remote.controlService(action);
50
+ }
@@ -0,0 +1,18 @@
1
+ import { nextclawClient } from './client.service';
2
+ import type { RuntimeControlActionResult, RuntimeControlView } from '@/shared/lib/api/runtime-control.types';
3
+
4
+ export async function fetchRuntimeControl(): Promise<RuntimeControlView> {
5
+ return await nextclawClient.runtimeControl.fetch();
6
+ }
7
+
8
+ export async function startRuntimeService(): Promise<RuntimeControlActionResult> {
9
+ return await nextclawClient.runtimeControl.startService();
10
+ }
11
+
12
+ export async function restartRuntimeService(): Promise<RuntimeControlActionResult> {
13
+ return await nextclawClient.runtimeControl.restartService();
14
+ }
15
+
16
+ export async function stopRuntimeService(): Promise<RuntimeControlActionResult> {
17
+ return await nextclawClient.runtimeControl.stopService();
18
+ }
@@ -0,0 +1,26 @@
1
+ import type { UpdatePreferences, UpdateSnapshot } from '@nextclaw/kernel';
2
+ import { nextclawClient } from './client.service';
3
+
4
+ export async function fetchRuntimeUpdate(): Promise<UpdateSnapshot> {
5
+ return await nextclawClient.runtimeUpdate.fetch();
6
+ }
7
+
8
+ export async function checkRuntimeUpdate(): Promise<UpdateSnapshot> {
9
+ return await nextclawClient.runtimeUpdate.check();
10
+ }
11
+
12
+ export async function downloadRuntimeUpdate(): Promise<UpdateSnapshot> {
13
+ return await nextclawClient.runtimeUpdate.download();
14
+ }
15
+
16
+ export async function applyRuntimeUpdate(): Promise<UpdateSnapshot> {
17
+ return await nextclawClient.runtimeUpdate.apply();
18
+ }
19
+
20
+ export async function updateRuntimeUpdatePreferences(preferences: Partial<UpdatePreferences>): Promise<UpdateSnapshot> {
21
+ return await nextclawClient.runtimeUpdate.updatePreferences(preferences);
22
+ }
23
+
24
+ export async function updateRuntimeUpdateChannel(channel: UpdateSnapshot['channel']): Promise<UpdateSnapshot> {
25
+ return await nextclawClient.runtimeUpdate.updateChannel(channel);
26
+ }
@@ -0,0 +1,16 @@
1
+ import { nextclawClient } from './client.service';
2
+ import type { ServerPathBrowseView, ServerPathReadView } from '@/shared/lib/api/types';
3
+
4
+ export async function fetchServerPathBrowse(params?: {
5
+ path?: string | null;
6
+ includeFiles?: boolean;
7
+ }): Promise<ServerPathBrowseView> {
8
+ return await nextclawClient.serverPaths.browse(params);
9
+ }
10
+
11
+ export async function fetchServerPathRead(params: {
12
+ path: string;
13
+ basePath?: string | null;
14
+ }): Promise<ServerPathReadView> {
15
+ return await nextclawClient.serverPaths.read(params);
16
+ }
@@ -1,4 +1,6 @@
1
- import type { NcpMessage, NcpSessionStatus, NcpSessionSummary } from '@nextclaw/ncp';
1
+ import type { NcpSessionStatus } from '@nextclaw/ncp';
2
+ import type { SessionEntryView, RuntimeEntryView, SessionTypeIconView, SessionMessageView, SessionEventView, NcpSessionSummaryView } from './ncp-session.types';
3
+ export type { SessionEntryView, RuntimeEntryView, SessionTypeIconView, SessionMessageView, SessionEventView, NcpSessionSummaryView, NcpSessionsListView, NcpMessageView, NcpSessionMessagesView, SessionContextWindowView } from './ncp-session.types';
2
4
 
3
5
  // API Types - matching backend response format
4
6
  export type ApiError = {
@@ -286,78 +288,6 @@ export type SessionConfigView = {
286
288
  dmScope?: "main" | "per-peer" | "per-channel-peer" | "per-account-channel-peer";
287
289
  };
288
290
 
289
- export type SessionTypeIconView = {
290
- kind: "image";
291
- src: string;
292
- alt?: string | null;
293
- };
294
-
295
- export type RuntimeEntryView = {
296
- enabled?: boolean;
297
- label?: string;
298
- icon?: SessionTypeIconView | null;
299
- type: string;
300
- config?: Record<string, unknown>;
301
- };
302
-
303
- export type SessionEntryView = {
304
- key: string;
305
- createdAt: string;
306
- updatedAt: string;
307
- lastMessageAt?: string;
308
- readAt?: string;
309
- agentId?: string;
310
- label?: string;
311
- channel?: string;
312
- type?: string;
313
- preferredModel?: string;
314
- preferredThinking?: ThinkingLevel | null;
315
- projectRoot?: string | null;
316
- projectName?: string | null;
317
- sessionType: string;
318
- sessionTypeMutable: boolean;
319
- isChildSession?: boolean;
320
- isPromotedChildSession?: boolean;
321
- parentSessionId?: string | null;
322
- spawnedByRequestId?: string | null;
323
- messageCount: number;
324
- lastRole?: string;
325
- lastTimestamp?: string;
326
- };
327
-
328
- export type SessionMessageView = {
329
- role: string;
330
- content: unknown;
331
- timestamp: string;
332
- name?: string;
333
- tool_call_id?: string;
334
- tool_calls?: Array<Record<string, unknown>>;
335
- reasoning_content?: string;
336
- };
337
-
338
- export type SessionEventView = {
339
- seq: number;
340
- type: string;
341
- timestamp: string;
342
- message?: SessionMessageView;
343
- };
344
-
345
- export type NcpSessionSummaryView = NcpSessionSummary;
346
-
347
- export type NcpSessionsListView = {
348
- sessions: NcpSessionSummaryView[];
349
- total: number;
350
- };
351
-
352
- export type NcpMessageView = NcpMessage;
353
-
354
- export type NcpSessionMessagesView = {
355
- sessionId: string;
356
- status: NcpSessionStatus;
357
- messages: NcpMessageView[];
358
- total: number;
359
- };
360
-
361
291
  export type SessionSkillEntryView = {
362
292
  ref: string;
363
293
  name: string;
@@ -468,6 +398,9 @@ export type CronActionResult = {
468
398
  };
469
399
 
470
400
  export type RuntimeConfigUpdate = {
401
+ companion?: {
402
+ enabled?: boolean;
403
+ };
471
404
  agents?: {
472
405
  defaults?: {
473
406
  contextTokens?: number;
@@ -537,6 +470,9 @@ export type SecretsConfigUpdate = {
537
470
  export type ChannelConfigUpdate = Record<string, unknown>;
538
471
 
539
472
  export type ConfigView = {
473
+ companion?: {
474
+ enabled?: boolean;
475
+ };
540
476
  agents: {
541
477
  defaults: {
542
478
  model: string;
@@ -554,7 +490,6 @@ export type ConfigView = {
554
490
  bootstrap?: {
555
491
  files?: string[];
556
492
  minimalFiles?: string[];
557
- heartbeatFiles?: string[];
558
493
  perFileChars?: number;
559
494
  totalChars?: number;
560
495
  };