@superblocksteam/library-shared 1.99.99-next.2 → 2.0.0-SNAPSHOT.04704c19f32b3902

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 (179) hide show
  1. package/dist/computed.d.ts +4 -2
  2. package/dist/computed.d.ts.map +1 -1
  3. package/dist/computed.js +1 -1
  4. package/dist/computed.js.map +1 -1
  5. package/dist/default-structure.d.ts +12 -0
  6. package/dist/default-structure.d.ts.map +1 -0
  7. package/dist/default-structure.js +36 -0
  8. package/dist/default-structure.js.map +1 -0
  9. package/dist/event-trigger-constants.d.ts +2 -0
  10. package/dist/event-trigger-constants.d.ts.map +1 -0
  11. package/dist/event-trigger-constants.js +2 -0
  12. package/dist/event-trigger-constants.js.map +1 -0
  13. package/dist/index.d.ts +18 -8
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +17 -8
  16. package/dist/index.js.map +1 -1
  17. package/dist/layout.d.ts +12 -1
  18. package/dist/layout.d.ts.map +1 -1
  19. package/dist/layout.js +11 -4
  20. package/dist/layout.js.map +1 -1
  21. package/dist/mobx-sync/apply-patch.d.ts.map +1 -1
  22. package/dist/mobx-sync/apply-patch.js +23 -4
  23. package/dist/mobx-sync/apply-patch.js.map +1 -1
  24. package/dist/mobx-sync/to-patch.d.ts.map +1 -1
  25. package/dist/mobx-sync/to-patch.js.map +1 -1
  26. package/dist/pages.d.ts +76 -6
  27. package/dist/pages.d.ts.map +1 -1
  28. package/dist/pages.js +54 -2
  29. package/dist/pages.js.map +1 -1
  30. package/dist/pegs/find-string-interpolation.d.ts +12 -0
  31. package/dist/pegs/find-string-interpolation.d.ts.map +1 -0
  32. package/dist/pegs/find-string-interpolation.js +1265 -0
  33. package/dist/pegs/find-string-interpolation.js.map +1 -0
  34. package/dist/props/helpers.d.ts +1 -1
  35. package/dist/props/helpers.d.ts.map +1 -1
  36. package/dist/props/helpers.js +13 -5
  37. package/dist/props/helpers.js.map +1 -1
  38. package/dist/props/prop-types.d.ts +24 -13
  39. package/dist/props/prop-types.d.ts.map +1 -1
  40. package/dist/props/prop-types.js.map +1 -1
  41. package/dist/props/properties-panel.d.ts +61 -26
  42. package/dist/props/properties-panel.d.ts.map +1 -1
  43. package/dist/props/properties-panel.js +2 -5
  44. package/dist/props/properties-panel.js.map +1 -1
  45. package/dist/props/tailwind-property-keys.d.ts +5 -0
  46. package/dist/props/tailwind-property-keys.d.ts.map +1 -0
  47. package/dist/props/tailwind-property-keys.js +234 -0
  48. package/dist/props/tailwind-property-keys.js.map +1 -0
  49. package/dist/restart-contract.d.ts +35 -0
  50. package/dist/restart-contract.d.ts.map +1 -0
  51. package/dist/restart-contract.js +49 -0
  52. package/dist/restart-contract.js.map +1 -0
  53. package/dist/scope.d.ts +2 -0
  54. package/dist/scope.d.ts.map +1 -1
  55. package/dist/scope.js +3 -0
  56. package/dist/scope.js.map +1 -1
  57. package/dist/types/ai.d.ts +1721 -0
  58. package/dist/types/ai.d.ts.map +1 -0
  59. package/dist/types/ai.js +432 -0
  60. package/dist/types/ai.js.map +1 -0
  61. package/dist/types/apis.d.ts +44 -1
  62. package/dist/types/apis.d.ts.map +1 -1
  63. package/dist/types/base-entity-manager.d.ts +15 -0
  64. package/dist/types/base-entity-manager.d.ts.map +1 -0
  65. package/dist/types/base-entity-manager.js +2 -0
  66. package/dist/types/base-entity-manager.js.map +1 -0
  67. package/dist/types/binding-identifiers.d.ts +13 -0
  68. package/dist/types/binding-identifiers.d.ts.map +1 -0
  69. package/dist/types/binding-identifiers.js +6 -0
  70. package/dist/types/binding-identifiers.js.map +1 -0
  71. package/dist/types/common.d.ts +2 -1
  72. package/dist/types/common.d.ts.map +1 -1
  73. package/dist/types/edit-operations.d.ts +26 -23
  74. package/dist/types/edit-operations.d.ts.map +1 -1
  75. package/dist/types/edit-operations.js +2 -0
  76. package/dist/types/edit-operations.js.map +1 -1
  77. package/dist/types/entities.d.ts +10 -29
  78. package/dist/types/entities.d.ts.map +1 -1
  79. package/dist/types/entities.js +0 -5
  80. package/dist/types/entities.js.map +1 -1
  81. package/dist/types/errors.d.ts +82 -1
  82. package/dist/types/errors.d.ts.map +1 -1
  83. package/dist/types/errors.js +15 -1
  84. package/dist/types/errors.js.map +1 -1
  85. package/dist/types/events.d.ts +219 -26
  86. package/dist/types/events.d.ts.map +1 -1
  87. package/dist/types/events.js +33 -5
  88. package/dist/types/events.js.map +1 -1
  89. package/dist/types/index.d.ts +19 -6
  90. package/dist/types/index.d.ts.map +1 -1
  91. package/dist/types/index.js +19 -6
  92. package/dist/types/index.js.map +1 -1
  93. package/dist/types/migration.d.ts +240 -0
  94. package/dist/types/migration.d.ts.map +1 -0
  95. package/dist/types/migration.js +50 -0
  96. package/dist/types/migration.js.map +1 -0
  97. package/dist/types/mobx-shared-state.d.ts +27 -1
  98. package/dist/types/mobx-shared-state.d.ts.map +1 -1
  99. package/dist/types/parent-messages.d.ts +16 -7
  100. package/dist/types/parent-messages.d.ts.map +1 -1
  101. package/dist/types/persisted-chat-message.d.ts +55 -0
  102. package/dist/types/persisted-chat-message.d.ts.map +1 -0
  103. package/dist/types/persisted-chat-message.js +752 -0
  104. package/dist/types/persisted-chat-message.js.map +1 -0
  105. package/dist/types/protected-packages.d.ts +54 -0
  106. package/dist/types/protected-packages.d.ts.map +1 -0
  107. package/dist/types/protected-packages.js +91 -0
  108. package/dist/types/protected-packages.js.map +1 -0
  109. package/dist/types/register-component.d.ts +128 -0
  110. package/dist/types/register-component.d.ts.map +1 -0
  111. package/dist/types/register-component.js +45 -0
  112. package/dist/types/register-component.js.map +1 -0
  113. package/dist/types/routing.d.ts +68 -0
  114. package/dist/types/routing.d.ts.map +1 -0
  115. package/dist/types/routing.js +2 -0
  116. package/dist/types/routing.js.map +1 -0
  117. package/dist/types/runtime-sync.d.ts +32 -0
  118. package/dist/types/runtime-sync.d.ts.map +1 -0
  119. package/dist/types/runtime-sync.js +2 -0
  120. package/dist/types/runtime-sync.js.map +1 -0
  121. package/dist/types/scope.d.ts +8 -6
  122. package/dist/types/scope.d.ts.map +1 -1
  123. package/dist/types/snapshot.d.ts +53 -0
  124. package/dist/types/snapshot.d.ts.map +1 -0
  125. package/dist/types/snapshot.js +2 -0
  126. package/dist/types/snapshot.js.map +1 -0
  127. package/dist/types/socket.d.ts +668 -48
  128. package/dist/types/socket.d.ts.map +1 -1
  129. package/dist/types/theme.d.ts +8 -7
  130. package/dist/types/theme.d.ts.map +1 -1
  131. package/dist/types/theme.js +5 -6
  132. package/dist/types/theme.js.map +1 -1
  133. package/dist/types/tool-permission-response.d.ts +5 -0
  134. package/dist/types/tool-permission-response.d.ts.map +1 -0
  135. package/dist/types/tool-permission-response.js +26 -0
  136. package/dist/types/tool-permission-response.js.map +1 -0
  137. package/dist/types/vite.d.ts +29 -0
  138. package/dist/types/vite.d.ts.map +1 -0
  139. package/dist/types/vite.js +6 -0
  140. package/dist/types/vite.js.map +1 -0
  141. package/dist/urls.d.ts +7 -0
  142. package/dist/urls.d.ts.map +1 -0
  143. package/dist/urls.js +6 -0
  144. package/dist/urls.js.map +1 -0
  145. package/dist/utils/binding-identifier.d.ts +5 -0
  146. package/dist/utils/binding-identifier.d.ts.map +1 -0
  147. package/dist/utils/binding-identifier.js +14 -0
  148. package/dist/utils/binding-identifier.js.map +1 -0
  149. package/dist/utils/blocks.d.ts +3 -0
  150. package/dist/utils/blocks.d.ts.map +1 -0
  151. package/dist/utils/blocks.js +70 -0
  152. package/dist/utils/blocks.js.map +1 -0
  153. package/dist/utils/computed-args.d.ts +11 -0
  154. package/dist/utils/computed-args.d.ts.map +1 -0
  155. package/dist/utils/computed-args.js +13 -0
  156. package/dist/utils/computed-args.js.map +1 -0
  157. package/dist/utils/dev-server-authorization.d.ts +4 -0
  158. package/dist/utils/dev-server-authorization.d.ts.map +1 -0
  159. package/dist/utils/dev-server-authorization.js +56 -0
  160. package/dist/utils/dev-server-authorization.js.map +1 -0
  161. package/dist/utils/dotted-paths.js +1 -1
  162. package/dist/utils/dotted-paths.js.map +1 -1
  163. package/dist/utils/properties.d.ts +12 -9
  164. package/dist/utils/properties.d.ts.map +1 -1
  165. package/dist/utils/properties.js +14 -6
  166. package/dist/utils/properties.js.map +1 -1
  167. package/dist/utils/routing.d.ts +5 -0
  168. package/dist/utils/routing.d.ts.map +1 -0
  169. package/dist/utils/routing.js +16 -0
  170. package/dist/utils/routing.js.map +1 -0
  171. package/dist/utils/strings.d.ts +12 -0
  172. package/dist/utils/strings.d.ts.map +1 -1
  173. package/dist/utils/strings.js +40 -1
  174. package/dist/utils/strings.js.map +1 -1
  175. package/package.json +41 -25
  176. package/dist/apis.d.ts +0 -2
  177. package/dist/apis.d.ts.map +0 -1
  178. package/dist/apis.js +0 -4
  179. package/dist/apis.js.map +0 -1
@@ -1,34 +1,447 @@
1
+ import type { DefaultStructureState } from "../default-structure.js";
2
+ import type { AiAppFact, AiChangeInfoPush, AiChatGetMessagesResponse, AiChatMessage, AiGenerateRequest, AiGenerationStateSnapshot, AiInterpretPromptRequest, AiLabelAttachmentRequest, AiLabelAttachmentResponse, AiMoveAppKnowledgeRequest, AiMoveAppKnowledgeResult, AiPromptInterpretationPush, AiToolPermission, AiToolPermissionDetails, LLMProviderConfig, PromptContextIntegration, TokenRequestData } from "./ai.js";
3
+ import type { ApiRunRecord, IApiV3Dto } from "./apis.js";
1
4
  import type { SbElement } from "./common.js";
2
- import type { AddEntityRequest, ApiUpdateRequest, BatchUpdateRequest, CreateRequest, DeleteEntityRequest, ReparentRequest, SetPropertiesRequest, SetPropertyRequest, UpdateEntityRequest, UpdateThemeRequest, DeleteRequest, ApiUpdateResponse, ApiDeleteRequest, ApiDeleteResponse, DeletePropertiesRequest, RenameElementRequest, RenameApiRequest, SyncronizationStatus, AiGenerateRequest } from "./edit-operations.js";
3
- import type { ServerError } from "./errors.js";
5
+ /**
6
+ * A single live execution step emitted by a policy gate agent while it runs.
7
+ * Mirrors what Clark surfaces (a tool invocation or a reasoning/thinking
8
+ * block) so the editor can render the agent's latest activity inline under the
9
+ * running policy row. Only the latest step per policy is retained; these are
10
+ * best-effort, ephemeral, and not persisted.
11
+ *
12
+ * A step always represents the agent's *current* activity (an in-flight tool
13
+ * call or an ongoing thought), so the editor renders it in the present tense
14
+ * ("Reading `file`", "Thinking..."). Completed tool results are not surfaced.
15
+ */
16
+ export type AiPolicyAgentStep = {
17
+ kind: "tool";
18
+ toolCallId: string;
19
+ tool: string;
20
+ args?: Record<string, unknown>;
21
+ } | {
22
+ kind: "reasoning";
23
+ content: string;
24
+ };
25
+ export interface AiPolicyAgentStepPush {
26
+ applicationId: string;
27
+ policyId: string;
28
+ step: AiPolicyAgentStep;
29
+ }
30
+ /**
31
+ * Response type for SDK API execution via aiExecuteSdkApi.
32
+ * Used by both the library iframe (sender) and socket handler (receiver)
33
+ * to ensure type consistency.
34
+ */
35
+ /**
36
+ * Per-integration-call diagnostic record captured during SDK API execution.
37
+ */
38
+ export interface IntegrationCallDiagnostic {
39
+ integrationId: string;
40
+ pluginId: string;
41
+ inputTruncated?: string;
42
+ outputTruncated?: string;
43
+ startMs: number;
44
+ endMs: number;
45
+ durationMs: number;
46
+ error?: string;
47
+ /** Error code from the orchestrator (e.g. INTEGRATION_QUERY_TIMEOUT, INTEGRATION_NETWORK). */
48
+ errorCode?: string;
49
+ sequence: number;
50
+ metadata?: {
51
+ label?: string;
52
+ description?: string;
53
+ };
54
+ /** True when the input field was truncated to fit within the byte limit. */
55
+ inputWasTruncated?: boolean;
56
+ /** True when the output field was truncated to fit within the byte limit. */
57
+ outputWasTruncated?: boolean;
58
+ }
59
+ /**
60
+ * Breakdown of time spent in each phase of an SDK API execution.
61
+ * All values are milliseconds. Phases are sequential:
62
+ * bootstrap → discovery → fileSync → authCheck → network (fetch round-trip).
63
+ */
64
+ export interface ExecutionTimingBreakdown {
65
+ /** Time spent waiting for the bootstrap response (app context, tokens). */
66
+ bootstrapMs?: number;
67
+ /** Time spent waiting for SDK API discovery to register the entry point. */
68
+ discoveryMs?: number;
69
+ /** Time spent flushing pending file writes to the server (ensureFilesSynced). */
70
+ fileSyncMs?: number;
71
+ /** Time spent on frontend auth checks before the orchestrator call. */
72
+ authCheckMs?: number;
73
+ /** Network round-trip time for the fetch to the orchestrator (fetch end − fetch start). */
74
+ networkMs?: number;
75
+ }
76
+ export interface SdkApiExecutionResult {
77
+ /** Whether execution succeeded */
78
+ success: boolean;
79
+ /** Output data if successful */
80
+ output?: unknown;
81
+ /** Error details if failed */
82
+ error?: {
83
+ code: string;
84
+ message: string;
85
+ details?: unknown;
86
+ };
87
+ /** Per-integration-call diagnostics when includeDiagnostics was requested */
88
+ diagnostics?: IntegrationCallDiagnostic[];
89
+ /** Unix epoch ms when the orchestrator started execution (from response performance.start). */
90
+ executionStartMs?: number;
91
+ /** Total execution duration in ms as measured by the orchestrator (from response performance.total). */
92
+ executionDurationMs?: number;
93
+ /** Unix epoch ms captured right before the HTTP request to the orchestrator. Used as fallback start time when orchestrator timing is unavailable. */
94
+ fetchStartMs?: number;
95
+ /** Per-phase timing breakdown for the execution. */
96
+ timingBreakdown?: ExecutionTimingBreakdown;
97
+ }
98
+ export interface AiSummarizeApiUsageRequest {
99
+ apiName: string;
100
+ jwt: string;
101
+ llmConfig?: LLMProviderConfig;
102
+ pages?: Array<{
103
+ name: string;
104
+ scopeId: string;
105
+ }>;
106
+ }
107
+ export interface AiPushApiUsageSummary {
108
+ apiName: string;
109
+ delta?: string;
110
+ isComplete?: boolean;
111
+ error?: string;
112
+ }
113
+ export interface AiSummarizeErrorRequest {
114
+ errorMessage: string;
115
+ pluginId: string;
116
+ integrationName: string;
117
+ input?: string;
118
+ summaryKey: string;
119
+ jwt: string;
120
+ llmConfig?: LLMProviderConfig;
121
+ apiName?: string;
122
+ stepLabel?: string;
123
+ errorCode?: string;
124
+ }
125
+ export interface AiPushErrorSummary {
126
+ summaryKey: string;
127
+ delta?: string;
128
+ isComplete?: boolean;
129
+ error?: string;
130
+ }
131
+ /**
132
+ * Lifecycle state of a background task — mirrors the discriminated union
133
+ * the agent's TaskStore tracks (`TaskStatus`'s `state` field). Defined
134
+ * here (not in the agent's `tasks/types.ts`) so the UI can consume it
135
+ * without crossing the package boundary into agent-only code.
136
+ */
137
+ export type BackgroundTaskState = "running" | "completed" | "failed" | "cancelled";
138
+ /**
139
+ * Snapshot the agent pushes to the UI on every state/message change of a
140
+ * background task.
141
+ *
142
+ * Wire shape of `EditorClientMethods.aiPushTaskStatus`. Intentionally
143
+ * never includes the task's `result` — terminal results are only
144
+ * conveyed to the LLM via the generic checkTask/waitForTask flow, which
145
+ * already runs through the secret-scanning middleware. The UI surfaces
146
+ * `state` + `message` for live progress and `error` for failures only.
147
+ */
148
+ export interface BackgroundTaskSummary {
149
+ taskId: string;
150
+ taskType: string;
151
+ label?: string;
152
+ state: BackgroundTaskState;
153
+ message?: string;
154
+ /** ms since `startedAt`. */
155
+ ageMs: number;
156
+ /** ISO timestamp for terminal states, otherwise undefined. */
157
+ completedAt?: string;
158
+ /**
159
+ * Short, plain-language failure reason when `state === "failed"`.
160
+ * Rendered directly in the chat checklist row (clamped) — keep it
161
+ * action-first and free of internal tool/infra jargon.
162
+ */
163
+ error?: string;
164
+ /**
165
+ * Optional fuller failure detail (classified code/message, request id,
166
+ * agent guidance). Surfaced to Clark via checkTask/waitForTask and as
167
+ * the checklist row tooltip — never as the clamped visible row text.
168
+ */
169
+ detail?: string;
170
+ }
171
+ import type { ApplicationEnvironmentSettings, ApplicationHashChangeSource, DegradedMode, MethodSchema, OpenApiSpec } from "@superblocksteam/shared";
172
+ import type { ApiUpdateRequest, ApiUpdateResponse, ApiDeleteRequest, ApiDeleteResponse, RenameElementRequest, RenameApiRequest, SyncronizationStatus } from "./edit-operations.js";
173
+ import type { RouterParseError, RuntimeErrorData, ServerError, ConsoleLogEntry } from "./errors.js";
4
174
  import type { DeleteMeLibraryApi } from "./parent-messages.js";
5
175
  import type { AppScope, SbScope } from "./scope.js";
6
- import type { MethodSchema } from "@superblocksteam/shared";
176
+ export type EditorHasDefaultStructure = DefaultStructureState;
177
+ export type EditorStructureReport = {
178
+ hasDefaultStructure: EditorHasDefaultStructure;
179
+ };
7
180
  /**
8
181
  * Clients -> Server
9
182
  */
10
183
  export interface ServerMethods {
11
184
  editor: {
12
- setProperties: MethodSchema<SetPropertiesRequest, any>;
13
- deleteProperties: MethodSchema<DeletePropertiesRequest, void>;
14
- moveComponent: MethodSchema<ReparentRequest, void>;
15
- createComponent: MethodSchema<CreateRequest, SbElement | undefined>;
16
- deleteComponents: MethodSchema<DeleteRequest, void>;
17
- setProperty: MethodSchema<SetPropertyRequest, void>;
18
- batchUpdate: MethodSchema<BatchUpdateRequest, unknown[]>;
19
185
  renameElement: MethodSchema<RenameElementRequest, void>;
20
186
  renameApi: MethodSchema<RenameApiRequest, void>;
21
187
  apiUpdate: MethodSchema<ApiUpdateRequest, ApiUpdateResponse>;
22
188
  apiDelete: MethodSchema<ApiDeleteRequest, ApiDeleteResponse | undefined>;
23
- addEntity: MethodSchema<AddEntityRequest, void>;
24
- updateEntity: MethodSchema<UpdateEntityRequest, void>;
25
- deleteEntity: MethodSchema<DeleteEntityRequest, void>;
26
- updateTheme: MethodSchema<UpdateThemeRequest, void>;
27
189
  ensureFilesSynced: MethodSchema<void, string | undefined>;
28
- aiRejectDraft: MethodSchema<void, void>;
29
- aiAcceptDraft: MethodSchema<void, void>;
190
+ aiRejectDraft: MethodSchema<{
191
+ silently?: boolean;
192
+ }, void>;
193
+ aiAcceptDraft: MethodSchema<{
194
+ silently?: boolean;
195
+ }, {
196
+ commitId: string;
197
+ warning?: {
198
+ code: "draft_state_cleanup_failed";
199
+ message: string;
200
+ };
201
+ }>;
202
+ aiUploadCheckpointScreenshot: MethodSchema<{
203
+ commitId: string;
204
+ screenshotDataUrl: string;
205
+ }, void>;
206
+ aiClearDraftState: MethodSchema<void, void>;
30
207
  aiGenerate: MethodSchema<AiGenerateRequest, void>;
208
+ aiGenerateWithQueue: MethodSchema<AiGenerateRequest & {
209
+ queueMode: "queue" | "interrupt";
210
+ }, {
211
+ /**
212
+ * The generation this prompt started, named the same way every
213
+ * `aiSetGenerationState` push for it is. A caller keeps it so it can
214
+ * tell its own turn ending from a generation the ai-service started
215
+ * on its own. Absent from dev servers that predate the field.
216
+ * (APPS-5161)
217
+ */
218
+ generationId?: string;
219
+ status: "started" | "interrupted";
220
+ }>;
221
+ releaseTurnLock: MethodSchema<{
222
+ headlessTurnId?: string;
223
+ }, void>;
224
+ /**
225
+ * Fires the invisible post-flip v2→v3 API migration turn on the
226
+ * ai-service. The server-side handler is idempotent (one-shot per
227
+ * ai-service process) and bails if no `seed_api` checklist items are
228
+ * pending, so the UI can call this unconditionally as soon as it
229
+ * observes the `translating` phase.
230
+ */
231
+ aiTriggerMigrationTurn: MethodSchema<{
232
+ jwt: string;
233
+ llmConfig: LLMProviderConfig;
234
+ /**
235
+ * When set, the turn is dispatched in debug-retry mode: the
236
+ * server bypasses its one-shot guard and the translation
237
+ * prompt is reframed around prior failures. Used after the
238
+ * UI's "Fix with Clark" button hits
239
+ * `/sb-migration-retry-unresolved`.
240
+ */
241
+ retryMode?: "focused-debug";
242
+ }, {
243
+ dispatched: boolean;
244
+ reason?: string;
245
+ }>;
31
246
  aiCancel: MethodSchema<void, void>;
247
+ aiNotifyIntegrationSetupClosed: MethodSchema<void | {
248
+ outcome: "abandoned" | "saved";
249
+ }, void>;
250
+ aiChatGetMessages: MethodSchema<{
251
+ force?: boolean;
252
+ }, AiChatGetMessagesResponse>;
253
+ aiNewChat: MethodSchema<void, void>;
254
+ aiRestoreToCommit: MethodSchema<{
255
+ sinceTimestamp: number;
256
+ commitId: string;
257
+ applicationId: string;
258
+ branchName: string;
259
+ }, void>;
260
+ aiInterpretPrompt: MethodSchema<AiInterpretPromptRequest, void>;
261
+ aiSummarizeApiUsage: MethodSchema<AiSummarizeApiUsageRequest, void>;
262
+ aiSummarizeError: MethodSchema<AiSummarizeErrorRequest, void>;
263
+ aiSkipTestCase: MethodSchema<{
264
+ testRunId: string;
265
+ testCaseId: string;
266
+ }, void>;
267
+ aiRespondToToolPermission: MethodSchema<{
268
+ messageId: string;
269
+ approved: boolean;
270
+ alwaysAllowPermissions?: AiToolPermission[];
271
+ denyMessage?: string;
272
+ requestId?: string;
273
+ }, void>;
274
+ /**
275
+ * UI-initiated cancellation of a background task. The agent aborts
276
+ * the local poll loop and best-effort invokes the task type's
277
+ * `cancel` hook on the external system. Returns `{ cancelled: true }`
278
+ * when the task transitioned from `running` to `cancelled`, or
279
+ * `{ cancelled: false }` when the task was already terminal (or
280
+ * unknown — both surface as a no-op so the UI can dispatch this
281
+ * thunk optimistically).
282
+ */
283
+ aiCancelBackgroundTask: MethodSchema<{
284
+ taskId: string;
285
+ }, {
286
+ cancelled: boolean;
287
+ }>;
288
+ aiLabelAttachment: MethodSchema<AiLabelAttachmentRequest, AiLabelAttachmentResponse>;
289
+ handleRuntimeError: MethodSchema<RuntimeErrorData, void>;
290
+ handleClearRuntimeError: MethodSchema<{
291
+ id: string;
292
+ }, void>;
293
+ handleClearRuntimeErrors: MethodSchema<{
294
+ before?: number;
295
+ }, void>;
296
+ handleConsoleLog: MethodSchema<ConsoleLogEntry, void>;
297
+ handleApiRunRecord: MethodSchema<{
298
+ apiId: string;
299
+ run: ApiRunRecord;
300
+ }, void>;
301
+ handleJudgeEvaluation: MethodSchema<{
302
+ promptId: string;
303
+ prompt: string;
304
+ appId: string;
305
+ appUrl: string;
306
+ jwt: string;
307
+ llmConfig?: LLMProviderConfig;
308
+ options?: {
309
+ complexity?: "low" | "medium" | "high";
310
+ storageStatePath?: string;
311
+ playwrightServerUrl?: string;
312
+ connectWsEndpoint?: string;
313
+ storageStateData?: any;
314
+ sessionStorageData?: {
315
+ origin: string;
316
+ items: Array<{
317
+ name: string;
318
+ value: string;
319
+ }>;
320
+ };
321
+ extraOrigins?: Array<{
322
+ origin: string;
323
+ localStorage: Array<{
324
+ name: string;
325
+ value: string;
326
+ }>;
327
+ sessionStorage?: Array<{
328
+ name: string;
329
+ value: string;
330
+ }>;
331
+ }>;
332
+ };
333
+ }, {
334
+ promptId: string;
335
+ appId: string;
336
+ overallScore: number;
337
+ passed: boolean;
338
+ criteriaEvaluations: Array<{
339
+ criterion: string;
340
+ passed: boolean;
341
+ score: number;
342
+ reasoning: string;
343
+ evidence?: string;
344
+ suggestions?: string[];
345
+ }>;
346
+ summary: string;
347
+ suggestions: string[];
348
+ strengths?: string[];
349
+ weaknesses?: string[];
350
+ tokensUsed: {
351
+ input: number;
352
+ output: number;
353
+ cached?: number;
354
+ total: number;
355
+ };
356
+ evaluationDurationMs?: number;
357
+ confidence?: number;
358
+ error?: string;
359
+ }>;
360
+ ping: MethodSchema<void | {
361
+ isUserActive: boolean;
362
+ }, void>;
363
+ /** Enable/disable forwarding Clark (Vite plugin) logs to browser console. Use `?clark_logs=true` query param. */
364
+ setClarkLogsEnabled: MethodSchema<{
365
+ enabled: boolean;
366
+ }, void>;
367
+ /** Prime Clark with the user's inference JWT when auth hot-reload is unavailable (EE). */
368
+ primeClarkInferenceJwt: MethodSchema<{
369
+ jwt: string;
370
+ }, void>;
371
+ /** Get all saved app skill facts for the current application */
372
+ aiGetAppFacts: MethodSchema<void, {
373
+ facts: AiAppFact[];
374
+ }>;
375
+ /** Delete an app skill fact by its virtual path */
376
+ aiDeleteAppFact: MethodSchema<{
377
+ path: string;
378
+ }, void>;
379
+ /** Toggle the isEnabled field of an app skill fact */
380
+ aiToggleAppFact: MethodSchema<{
381
+ path: string;
382
+ isEnabled: boolean;
383
+ }, {
384
+ fact: AiAppFact;
385
+ }>;
386
+ /** Move app skill knowledge to org/user/integration scope */
387
+ aiMoveAppKnowledge: MethodSchema<AiMoveAppKnowledgeRequest, AiMoveAppKnowledgeResult>;
388
+ gitCommitLocal: MethodSchema<{
389
+ message: string;
390
+ }, {
391
+ sha: string;
392
+ }>;
393
+ gitPushLiveBranch: MethodSchema<void, void>;
394
+ gitRollbackLastCommit: MethodSchema<{
395
+ expectedSha: string;
396
+ }, {
397
+ rolledBack: boolean;
398
+ }>;
399
+ gitPull: MethodSchema<{
400
+ jwt?: string;
401
+ } | void, {
402
+ merged: boolean;
403
+ conflictedFiles?: string[];
404
+ }>;
405
+ gitSyncStatus: MethodSchema<void, {
406
+ ahead: number;
407
+ behind: number;
408
+ hasUncommittedChanges: boolean;
409
+ aheadOfDefaultBranch: boolean;
410
+ isLiveBranchMissing: boolean;
411
+ remoteAuthFailed?: boolean;
412
+ } | {
413
+ authFailed?: boolean;
414
+ bootstrapFailed: true;
415
+ } | null>;
416
+ gitChangedFiles: MethodSchema<void, Array<{
417
+ path: string;
418
+ status: "added" | "modified" | "deleted";
419
+ }>>;
420
+ gitDisconnect: MethodSchema<void, void>;
421
+ gitDefaultBranch: MethodSchema<void, string | null>;
422
+ gitBranchLog: MethodSchema<{
423
+ branch?: string;
424
+ limit?: number;
425
+ remote?: boolean;
426
+ } | void, Array<{
427
+ sha: string;
428
+ parents?: string[];
429
+ message: string;
430
+ author: string;
431
+ date: string;
432
+ }>>;
433
+ gitPrepareMainCommit: MethodSchema<{
434
+ sha: string;
435
+ }, {
436
+ directoryHash: string;
437
+ sha: string;
438
+ }>;
439
+ gitActivate: MethodSchema<void, {
440
+ activated: boolean;
441
+ }>;
442
+ gitRefreshCredentials: MethodSchema<void, {
443
+ refreshed: boolean;
444
+ }>;
32
445
  };
33
446
  }
34
447
  /**
@@ -46,58 +459,257 @@ export interface EditorClientMethods {
46
459
  id: string;
47
460
  }, void>;
48
461
  manualUpdateApi: MethodSchema<{
49
- api: DeleteMeLibraryApi;
462
+ api: DeleteMeLibraryApi & {
463
+ scopeId: string;
464
+ };
465
+ }, void>;
466
+ updateApiInputs: MethodSchema<{
467
+ apiId: string;
468
+ inputs: string[];
50
469
  }, void>;
51
470
  error: MethodSchema<ServerError, void>;
471
+ routerParseError: MethodSchema<RouterParseError | null, void>;
52
472
  releasingLock: MethodSchema<void, void>;
473
+ closedByServer: MethodSchema<{
474
+ initiatedByEmail?: string;
475
+ switchingTo?: "local" | "cloud" | "none";
476
+ }, void>;
53
477
  syncStatus: MethodSchema<{
54
478
  status: SyncronizationStatus;
55
479
  generationNumber: number | undefined;
480
+ /** What caused the change, when it was an upload the dev server ran. */
481
+ source?: ApplicationHashChangeSource;
56
482
  }, void>;
57
- aiSetLoading: MethodSchema<{
58
- isLoading: boolean;
59
- }, void>;
60
- aiPushMessage: MethodSchema<{
61
- text: string;
62
- type?: "reasoning" | "text";
63
- }, void>;
64
- aiSetCompleted: MethodSchema<{
65
- hasError?: boolean;
66
- hasSuggestions?: boolean;
483
+ setDegradedMode: MethodSchema<{
484
+ degradedMode: DegradedMode | undefined;
67
485
  }, void>;
486
+ aiApplyApplicationEnvironmentSettings: MethodSchema<ApplicationEnvironmentSettings, void>;
487
+ aiPushChangeInfo: MethodSchema<AiChangeInfoPush, void>;
488
+ aiPushMessage: MethodSchema<AiChatMessage, void>;
489
+ aiPushPromptInterpretation: MethodSchema<AiPromptInterpretationPush, void>;
68
490
  aiSetDraftState: MethodSchema<{
69
491
  hasDraft: boolean;
70
492
  }, void>;
493
+ aiGetOpenApiSpec: MethodSchema<{
494
+ ref: string;
495
+ integrationId: string;
496
+ }, OpenApiSpec | undefined>;
497
+ aiGetIntegration: MethodSchema<{
498
+ integrationId: string;
499
+ }, PromptContextIntegration>;
500
+ aiGetIntegrations: MethodSchema<void, Omit<PromptContextIntegration, "metadata">[]>;
501
+ aiSetGenerationState: MethodSchema<AiGenerationStateSnapshot, void>;
502
+ aiExecuteRequestToIntegration: MethodSchema<{
503
+ request: Record<string, unknown>;
504
+ integrationId: string;
505
+ integrationHint?: {
506
+ name: string;
507
+ type: string;
508
+ displayName?: string;
509
+ };
510
+ }, {
511
+ response?: string;
512
+ error?: string;
513
+ }>;
514
+ aiRequestToolPermission: MethodSchema<{
515
+ messageId: string;
516
+ toolName: string;
517
+ actionName: {
518
+ future: string;
519
+ present: string;
520
+ past: string;
521
+ } | undefined;
522
+ formattedInput: AiToolPermissionDetails | undefined;
523
+ rawInput: any;
524
+ permissions: AiToolPermission[];
525
+ signature?: string;
526
+ }, void>;
527
+ aiClearToolPermission: MethodSchema<void, void>;
528
+ aiPushTokenUsage: MethodSchema<TokenRequestData, void>;
529
+ aiPushContextUsed: MethodSchema<{
530
+ contextUsed: number;
531
+ }, void>;
532
+ aiPushApiUsageSummary: MethodSchema<AiPushApiUsageSummary, void>;
533
+ aiPushErrorSummary: MethodSchema<AiPushErrorSummary, void>;
534
+ aiPushPolicyAgentStep: MethodSchema<AiPolicyAgentStepPush, void>;
535
+ /**
536
+ * Agent -> UI push fired on every background-task status transition
537
+ * (including the initial in-store snapshot after `start`) and
538
+ * re-emitted for every non-terminal task on socket reconnect so a
539
+ * fresh tab can rebuild its indicator state. Terminal summaries
540
+ * (`completed | failed | cancelled`) are pushed once; the UI is
541
+ * responsible for evicting entries on chat-clear or app-switch.
542
+ */
543
+ aiPushTaskStatus: MethodSchema<BackgroundTaskSummary, void>;
71
544
  setApiDependencies: MethodSchema<{
72
545
  apiDependencies: Record<string, string[]>;
73
546
  }, void>;
547
+ aiExecuteV2Api: MethodSchema<{
548
+ api: {
549
+ type: "inline";
550
+ definition: IApiV3Dto["apiPb"];
551
+ } | {
552
+ type: "fetch";
553
+ apiName: string;
554
+ };
555
+ inputs: Record<string, any>;
556
+ includeStepOutputs?: boolean;
557
+ timeout?: number;
558
+ }, {
559
+ outputs?: Record<string, any>;
560
+ stepOutputs?: Record<string, {
561
+ error?: any;
562
+ output?: any;
563
+ }>;
564
+ errors?: Array<{
565
+ message: string;
566
+ handled?: boolean;
567
+ }>;
568
+ systemError?: string;
569
+ }>;
570
+ aiExecuteSdkApi: MethodSchema<{
571
+ /** Name of the registered SDK API to execute */
572
+ apiName: string;
573
+ /** Input data for the API */
574
+ input: Record<string, unknown>;
575
+ /** Entry point resolved by the caller (used when browser discovery hasn't run yet) */
576
+ entryPoint?: string;
577
+ /** Export name for named-export APIs sharing a file */
578
+ exportName?: string;
579
+ /** Integration IDs extracted from the API source by the caller.
580
+ * Used for auth preflight when the browser-side SDK discovery
581
+ * hasn't registered the API in the Redux store yet. */
582
+ integrationIds?: string[];
583
+ }, SdkApiExecutionResult>;
584
+ aiCaptureScreenshot: MethodSchema<{
585
+ selector?: string;
586
+ } | void, {
587
+ dataUrl?: string;
588
+ error?: string;
589
+ /**
590
+ * True when no screenshot was taken because the app preview had not
591
+ * rendered yet (e.g. still building/migrating). The agent must treat this
592
+ * as "not ready / wait and retry", NOT as a visual verification result.
593
+ */
594
+ notReady?: boolean;
595
+ }>;
596
+ aiNavigatePreviewRoute: MethodSchema<{
597
+ hash?: string;
598
+ path: string;
599
+ queryParams?: Record<string, string>;
600
+ routeParams?: Record<string, string>;
601
+ }, {
602
+ error?: string;
603
+ path?: string;
604
+ success: boolean;
605
+ }>;
606
+ reloadIframe: MethodSchema<void, void>;
607
+ clarkLog: MethodSchema<{
608
+ level: "info" | "warn" | "error";
609
+ state: string;
610
+ messages: unknown[];
611
+ timestamp: number;
612
+ meta?: {
613
+ error: {
614
+ kind: string;
615
+ message: string;
616
+ stack?: string;
617
+ };
618
+ };
619
+ }, void>;
620
+ appFactsChanged: MethodSchema<void, void>;
621
+ requestGitRefresh: MethodSchema<void, void>;
622
+ notifyDeploySuccess: MethodSchema<{
623
+ commitId: string;
624
+ gitSha?: string;
625
+ }, void>;
626
+ aiGetIntegrationFormSchema: MethodSchema<{
627
+ pluginId: string;
628
+ }, {
629
+ success: boolean;
630
+ pluginId?: string;
631
+ pluginName?: string;
632
+ isTestable?: boolean;
633
+ fields?: Record<string, unknown>;
634
+ error?: string;
635
+ }>;
636
+ aiOpenIntegrationSetup: MethodSchema<{
637
+ pluginId: string;
638
+ label?: string;
639
+ fields?: Record<string, unknown>;
640
+ }, {
641
+ success: boolean;
642
+ formState?: unknown;
643
+ error?: string;
644
+ }>;
645
+ aiOpenExistingIntegration: MethodSchema<{
646
+ integrationId: string;
647
+ fields?: Record<string, unknown>;
648
+ }, {
649
+ success: boolean;
650
+ pluginId?: string;
651
+ integrationName?: string;
652
+ formState?: unknown;
653
+ error?: string;
654
+ }>;
655
+ aiUpdateIntegrationFields: MethodSchema<{
656
+ fields: Record<string, unknown>;
657
+ configId?: string;
658
+ }, {
659
+ success: boolean;
660
+ formState?: unknown;
661
+ error?: string;
662
+ }>;
663
+ aiTestIntegrationConnection: MethodSchema<{
664
+ configId?: string;
665
+ }, {
666
+ success: boolean;
667
+ configId?: string;
668
+ error?: {
669
+ message: string;
670
+ details: string;
671
+ };
672
+ formState?: unknown;
673
+ }>;
674
+ aiSaveIntegration: MethodSchema<{
675
+ force?: boolean;
676
+ }, {
677
+ success: boolean;
678
+ integrationId?: string;
679
+ integrationName?: string;
680
+ pluginId?: string;
681
+ testFailed?: boolean;
682
+ failedConfigIds?: string[];
683
+ error?: string;
684
+ }>;
685
+ aiCloseIntegrationSetup: MethodSchema<void, {
686
+ success: boolean;
687
+ }>;
688
+ aiDeleteIntegration: MethodSchema<{
689
+ integrationId: string;
690
+ }, {
691
+ success: boolean;
692
+ integrationId?: string;
693
+ integrationName?: string;
694
+ error?: string;
695
+ }>;
696
+ aiGetIntegrationDependents: MethodSchema<{
697
+ integrationId: string;
698
+ }, {
699
+ success: boolean;
700
+ appCount?: number;
701
+ appNames?: string[];
702
+ error?: string;
703
+ }>;
704
+ }
705
+ export interface GatewayClientMethods extends EditorClientMethods {
706
+ aiSetEditorHasDefaultStructure: MethodSchema<EditorStructureReport, void>;
74
707
  }
75
708
  /**
76
709
  * Server -> Library
77
710
  */
78
711
  export interface LibraryClientMethods {
79
712
  nonVisualEdit: MethodSchema<void, void>;
80
- updateApiParams: MethodSchema<{
81
- apiName: string;
82
- params: string[];
83
- apiDependencies: string[];
84
- }, void>;
85
- setApiDefinitions: MethodSchema<Record<string, {
86
- api: DeleteMeLibraryApi;
87
- scopeId: string;
88
- }>, void>;
89
- updateApi: MethodSchema<{
90
- api: DeleteMeLibraryApi;
91
- oldName?: string;
92
- scopeId: string;
93
- }, void>;
94
- deleteApis: MethodSchema<{
95
- apiName: string;
96
- scopeId?: string;
97
- }[], void>;
98
- updateLocalBindingEntities: MethodSchema<{
99
- entities: string[];
100
- }, void>;
101
713
  renameRegisteredComponent: MethodSchema<{
102
714
  name: string;
103
715
  oldName?: string;
@@ -111,5 +723,13 @@ export interface LibraryClientMethods {
111
723
  entityId?: string;
112
724
  entityName?: string;
113
725
  }[], void>;
726
+ clientImport: MethodSchema<{
727
+ importPath: string;
728
+ }, Error | undefined>;
729
+ /** Notify library that an SDK API's source code has changed */
730
+ sdkApiSourceUpdated: MethodSchema<{
731
+ apiName: string;
732
+ sourceCode: string;
733
+ }, void>;
114
734
  }
115
735
  //# sourceMappingURL=socket.d.ts.map