@inferencesh/sdk 0.20.1 → 0.22.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 (61) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/dist/agent/actions.js +1 -4
  3. package/dist/agent/api.d.ts +37 -6
  4. package/dist/agent/api.js +37 -3
  5. package/dist/agent/reducer.js +23 -7
  6. package/dist/agent/types.d.ts +30 -5
  7. package/dist/api/agents.d.ts +9 -3
  8. package/dist/api/agents.js +87 -65
  9. package/dist/api/api-keys.d.ts +2 -5
  10. package/dist/api/apps.d.ts +9 -2
  11. package/dist/api/apps.js +9 -1
  12. package/dist/api/chats.d.ts +13 -3
  13. package/dist/api/chats.js +13 -2
  14. package/dist/api/engines.d.ts +4 -2
  15. package/dist/api/engines.js +3 -2
  16. package/dist/api/flow-runs.d.ts +7 -2
  17. package/dist/api/flow-runs.js +7 -2
  18. package/dist/api/flows.d.ts +13 -2
  19. package/dist/api/flows.js +15 -1
  20. package/dist/api/knowledge.d.ts +7 -4
  21. package/dist/api/knowledge.js +6 -4
  22. package/dist/api/mcp-servers.d.ts +2 -1
  23. package/dist/api/projects.d.ts +5 -3
  24. package/dist/api/projects.js +3 -2
  25. package/dist/api/secrets.d.ts +2 -2
  26. package/dist/api/tasks.js +39 -60
  27. package/dist/api/teams.d.ts +4 -2
  28. package/dist/api/teams.js +3 -2
  29. package/dist/api/write-bodies.d.ts +110 -0
  30. package/dist/api/write-bodies.js +1 -0
  31. package/dist/http/client.d.ts +68 -7
  32. package/dist/http/client.js +138 -97
  33. package/dist/http/index.d.ts +2 -2
  34. package/dist/http/loopback.d.ts +8 -0
  35. package/dist/http/loopback.js +18 -0
  36. package/dist/http/stream-until-terminal.d.ts +55 -0
  37. package/dist/http/stream-until-terminal.js +88 -0
  38. package/dist/http/stream.d.ts +1 -0
  39. package/dist/http/stream.js +7 -3
  40. package/dist/http/streamable.d.ts +25 -5
  41. package/dist/http/streamable.js +28 -40
  42. package/dist/index.d.ts +4 -2
  43. package/dist/index.js +1 -0
  44. package/dist/proxy/endpoints.json +156 -0
  45. package/dist/proxy/express.d.ts +5 -6
  46. package/dist/proxy/express.js +18 -2
  47. package/dist/proxy/hono.d.ts +5 -3
  48. package/dist/proxy/hono.js +4 -3
  49. package/dist/proxy/index.d.ts +165 -6
  50. package/dist/proxy/index.js +409 -25
  51. package/dist/proxy/nextjs.d.ts +29 -17
  52. package/dist/proxy/nextjs.js +72 -62
  53. package/dist/proxy/remix.d.ts +5 -3
  54. package/dist/proxy/remix.js +4 -3
  55. package/dist/proxy/svelte.d.ts +5 -4
  56. package/dist/proxy/svelte.js +4 -4
  57. package/dist/types.d.ts +591 -271
  58. package/dist/types.js +117 -252
  59. package/dist/version.d.ts +1 -0
  60. package/dist/version.js +7 -0
  61. package/package.json +2 -1
@@ -1,4 +1,4 @@
1
- import { StreamableManager } from '../http/streamable';
1
+ import { streamUntilTerminal } from '../http/stream-until-terminal';
2
2
  import { PollManager } from '../http/poll';
3
3
  import { createLLMDeltaAccumulator } from '../delta';
4
4
  import { ToolTypeClient, ToolInvocationStatusAwaitingInput, ToolInvocationStatusInProgress, } from '../types';
@@ -108,6 +108,10 @@ export class Agent {
108
108
  let waitPromise = null;
109
109
  if (this.chatId && shouldWait) {
110
110
  waitPromise = waitFn(options);
111
+ // The stream can fail while the POST is in flight, before anything
112
+ // awaits waitPromise; mark the rejection handled so Node does not treat
113
+ // it as unhandled. The await below still sees it.
114
+ waitPromise.catch(() => { });
111
115
  }
112
116
  // Make the POST request
113
117
  let response;
@@ -145,8 +149,11 @@ export class Agent {
145
149
  this.disconnect();
146
150
  reject(signal.reason);
147
151
  };
148
- if (signal.aborted)
149
- return onAbort();
152
+ if (signal.aborted) {
153
+ onAbort();
154
+ wait.catch(() => { });
155
+ return;
156
+ }
150
157
  signal.addEventListener('abort', onAbort, { once: true });
151
158
  wait.then(resolve, reject).finally(() => signal.removeEventListener('abort', onAbort));
152
159
  });
@@ -203,91 +210,101 @@ export class Agent {
203
210
  startStreaming(options = {}) {
204
211
  if (!this.chatId)
205
212
  return;
206
- this.streamUntilIdle(options, new TurnGate(false));
213
+ // Fire-and-forget: a stream failure must not become an unhandled rejection.
214
+ this.streamUntilIdle(options, new TurnGate(false)).catch((error) => {
215
+ console.warn('[Agent] Stream error:', error);
216
+ });
207
217
  }
208
218
  /** Stream events until chat becomes idle */
209
219
  streamUntilIdle(options, gate) {
210
220
  if (!this.chatId)
211
221
  return Promise.resolve();
212
- const { url, headers, credentials } = this.http.getStreamableConfig(`/chats/${this.chatId}/stream`);
213
- return new Promise((resolve) => {
214
- this.stream?.stop();
215
- this.stream = new StreamableManager({
216
- url,
217
- headers,
218
- credentials,
219
- });
222
+ const chatId = this.chatId;
223
+ this.stream?.stop();
224
+ const handle = streamUntilTerminal((settle) => {
220
225
  // Last chat/run observation was idle but the gate wasn't settled yet;
221
226
  // a terminal message for this turn can settle it.
222
227
  let idlePending = false;
223
228
  const onIdle = () => {
224
229
  if (gate.settled)
225
- resolve();
230
+ settle.resolve();
226
231
  else
227
232
  idlePending = true;
228
233
  };
229
- this.stream.addEventListener('chats', (chat) => {
234
+ const observeChat = (chat) => {
230
235
  options.onChat?.(chat);
231
236
  gate.observeChat(chat);
232
237
  if (!isChatBusy(chat))
233
238
  onIdle();
234
239
  else
235
240
  idlePending = false;
236
- });
237
- this.stream.addEventListener('agent_runs', (run) => {
238
- const asChat = { active_run: run };
239
- options.onChat?.(asChat);
240
- gate.observeChat(asChat);
241
- if (!isChatBusy(asChat))
242
- onIdle();
243
- else
244
- idlePending = false;
245
- });
241
+ };
246
242
  // One accumulator per message being streamed, keyed by the message id
247
243
  // the delta names, so a tool-call-only turn never shows the previous
248
244
  // message's text. Same attribution rule as the React hooks.
249
245
  const deltaAccums = new Map();
250
- this.stream.addEventListener('delta', (evt) => {
251
- if (!options.onDelta || !evt?.delta || !evt.resource_id)
252
- return;
253
- let accum = deltaAccums.get(evt.resource_id);
254
- if (!accum) {
255
- accum = createLLMDeltaAccumulator();
256
- deltaAccums.set(evt.resource_id, accum);
257
- }
258
- accum.apply(evt.delta);
259
- options.onDelta({
260
- messageId: evt.resource_id,
261
- delta: evt.delta,
262
- output: accum.toOutput(),
263
- seq: evt.seq,
264
- });
265
- });
266
- this.stream.addEventListener('chat_messages', (message) => {
267
- // A terminal message receives no further deltas.
268
- if (isMessageTerminal(message.status))
269
- deltaAccums.delete(message.id);
270
- gate.observeMessage(message);
271
- options.onMessage?.(message);
272
- if (idlePending && gate.settled)
273
- resolve();
274
- if (message.tool_invocations && options.onToolCall) {
275
- for (const inv of message.tool_invocations) {
276
- if (this.dispatchedToolCalls.has(inv.id))
277
- continue;
278
- if (inv.type === ToolTypeClient && (inv.status === ToolInvocationStatusInProgress || inv.status === ToolInvocationStatusAwaitingInput)) {
279
- this.dispatchedToolCalls.add(inv.id);
280
- options.onToolCall({
281
- id: inv.id,
282
- name: inv.function?.name || '',
283
- args: inv.function?.arguments || {},
284
- });
246
+ return {
247
+ request: (init) => this.http.fetch(`/chats/${chatId}/stream`, init),
248
+ events: {
249
+ chats: (chat) => observeChat(chat),
250
+ agent_runs: (run) => observeChat({ active_run: run }),
251
+ delta: (evt) => {
252
+ if (!options.onDelta || !evt?.delta || !evt.resource_id)
253
+ return;
254
+ let accum = deltaAccums.get(evt.resource_id);
255
+ if (!accum) {
256
+ accum = createLLMDeltaAccumulator();
257
+ deltaAccums.set(evt.resource_id, accum);
285
258
  }
286
- }
287
- }
288
- });
289
- this.stream.start();
259
+ accum.apply(evt.delta);
260
+ options.onDelta({
261
+ messageId: evt.resource_id,
262
+ delta: evt.delta,
263
+ output: accum.toOutput(),
264
+ seq: evt.seq,
265
+ });
266
+ },
267
+ chat_messages: (message) => {
268
+ // A terminal message receives no further deltas.
269
+ if (isMessageTerminal(message.status))
270
+ deltaAccums.delete(message.id);
271
+ gate.observeMessage(message);
272
+ options.onMessage?.(message);
273
+ if (idlePending && gate.settled)
274
+ settle.resolve();
275
+ if (message.tool_invocations && options.onToolCall) {
276
+ for (const inv of message.tool_invocations) {
277
+ if (this.dispatchedToolCalls.has(inv.id))
278
+ continue;
279
+ if (inv.type === ToolTypeClient && (inv.status === ToolInvocationStatusInProgress || inv.status === ToolInvocationStatusAwaitingInput)) {
280
+ this.dispatchedToolCalls.add(inv.id);
281
+ options.onToolCall({
282
+ id: inv.id,
283
+ name: inv.function?.name || '',
284
+ args: inv.function?.arguments || {},
285
+ });
286
+ }
287
+ }
288
+ }
289
+ },
290
+ },
291
+ // The stream closed before the chat was seen idle: the chat itself
292
+ // says whether the turn is over.
293
+ reconcile: async () => {
294
+ const { data: chat } = await this.http.request('get', `/chats/${chatId}`);
295
+ observeChat(chat);
296
+ },
297
+ closedMessage: 'Chat stream closed before the chat became idle',
298
+ // Stopped by disconnect()/abort or replaced by a newer stream: the
299
+ // caller stopped waiting on purpose.
300
+ onStopped: () => settle.resolve(),
301
+ // Once the turn is over the stream stays attached, so onChat/onMessage
302
+ // keep reporting until the next turn or disconnect() replaces it.
303
+ keepOpen: true,
304
+ };
290
305
  });
306
+ this.stream = handle;
307
+ return handle.done;
291
308
  }
292
309
  /** Poll until chat becomes idle, dispatching callbacks on changes */
293
310
  pollUntilIdle(options, gate) {
@@ -396,7 +413,8 @@ export class AgentsAPI {
396
413
  return this.http.request('post', '/agents', { data });
397
414
  }
398
415
  /**
399
- * Update an agent template
416
+ * Update an agent template: its visibility and images, and a new version
417
+ * when `version` is set (see AgentUpdateBody).
400
418
  */
401
419
  async update(agentId, data) {
402
420
  return this.http.request('post', `/agents/${agentId}`, { data });
@@ -474,7 +492,11 @@ export class AgentsAPI {
474
492
  await this.http.request('post', `/tools/${toolInvocationId}`, { data: { result } });
475
493
  }
476
494
  /**
477
- * Resolve an interrupt gate on an agent run
495
+ * Resolve an interrupt gate on an agent run.
496
+ *
497
+ * Needs approvals:write, which only the account holder's own sign-in holds:
498
+ * with an API key, an app's OAuth token or the server proxy it rejects with
499
+ * 403 `requires_sign_in` (ErrorCodeRequiresSignIn).
478
500
  */
479
501
  async resolveInterrupt(interruptId, decision) {
480
502
  return this.http.request('post', `/interrupts/${interruptId}/resolve`, {
@@ -1,6 +1,6 @@
1
1
  import { HttpClient } from '../http/client';
2
2
  import type { Response } from '../http/response';
3
- import { ApiKeyDTO, CursorListRequest, CursorListResponse } from '../types';
3
+ import { ApiKeyDTO, CreateApiKeyRequest, CursorListRequest, CursorListResponse } from '../types';
4
4
  /**
5
5
  * API Keys API
6
6
  */
@@ -14,10 +14,7 @@ export declare class ApiKeysAPI {
14
14
  /**
15
15
  * Create an API key
16
16
  */
17
- create(data: {
18
- name: string;
19
- scopes?: string[];
20
- }): Promise<Response<ApiKeyDTO>>;
17
+ create(data: CreateApiKeyRequest): Promise<Response<ApiKeyDTO>>;
21
18
  /**
22
19
  * Delete an API key
23
20
  */
@@ -1,5 +1,6 @@
1
1
  import { HttpClient } from '../http/client';
2
2
  import type { Response } from '../http/response';
3
+ import type { AppPatchBody, AppUpdateBody } from './write-bodies';
3
4
  import { AppDTO as App, AppVersionDTO, CursorListRequest, CursorListResponse, LicenseRecordDTO } from '../types';
4
5
  /**
5
6
  * Apps API
@@ -24,9 +25,15 @@ export declare class AppsAPI {
24
25
  */
25
26
  create(data: Partial<App>): Promise<Response<App>>;
26
27
  /**
27
- * Update an app
28
+ * Update an app's copy and edit its current version in place (see
29
+ * AppUpdateBody). Status and visibility have their own methods.
28
30
  */
29
- update(appId: string, data: Partial<App>): Promise<Response<App>>;
31
+ update(appId: string, data: AppUpdateBody): Promise<Response<App>>;
32
+ /**
33
+ * Change some of an app's copy (PATCH): only the fields sent are written,
34
+ * the others keep their value. Editing the version in place: update.
35
+ */
36
+ patch(appId: string, data: AppPatchBody): Promise<Response<App>>;
30
37
  /**
31
38
  * Delete an app
32
39
  */
package/dist/api/apps.js CHANGED
@@ -30,11 +30,19 @@ export class AppsAPI {
30
30
  return this.http.request('post', '/apps', { data });
31
31
  }
32
32
  /**
33
- * Update an app
33
+ * Update an app's copy and edit its current version in place (see
34
+ * AppUpdateBody). Status and visibility have their own methods.
34
35
  */
35
36
  async update(appId, data) {
36
37
  return this.http.request('post', `/apps/${appId}`, { data });
37
38
  }
39
+ /**
40
+ * Change some of an app's copy (PATCH): only the fields sent are written,
41
+ * the others keep their value. Editing the version in place: update.
42
+ */
43
+ async patch(appId, data) {
44
+ return this.http.request('patch', `/apps/${appId}`, { data });
45
+ }
38
46
  /**
39
47
  * Delete an app
40
48
  */
@@ -1,6 +1,7 @@
1
1
  import { HttpClient } from '../http/client';
2
2
  import type { Response } from '../http/response';
3
- import { ChatDTO as Chat, ChatMessageDTO, ChatTraceDTO, CursorListRequest, CursorListResponse } from '../types';
3
+ import type { ChatUpdateBody } from './write-bodies';
4
+ import { ChatDTO as Chat, ChatMessageDTO, ChatSettingsDTO, ChatSettingsRequest, ChatTraceDTO, CursorListRequest, CursorListResponse } from '../types';
4
5
  /**
5
6
  * Chats API
6
7
  */
@@ -16,9 +17,18 @@ export declare class ChatsAPI {
16
17
  */
17
18
  get(chatId: string): Promise<Response<Chat>>;
18
19
  /**
19
- * Update a chat
20
+ * Update a chat's name and description (PATCH): only the fields sent are
21
+ * written. Visibility and the other chat settings: updateSettings.
20
22
  */
21
- update(chatId: string, data: Partial<Chat>): Promise<Response<Chat>>;
23
+ update(chatId: string, data: ChatUpdateBody): Promise<Response<Chat>>;
24
+ /**
25
+ * Change a chat's settings (name, visibility, tool approval, hooks,
26
+ * memory). Answers with the settings as they now are. Widening what runs
27
+ * without approval needs approvals:write, held only by the account
28
+ * holder's own sign-in: other credentials get 403 `requires_sign_in`
29
+ * (ErrorCodeRequiresSignIn).
30
+ */
31
+ updateSettings(chatId: string, settings: ChatSettingsRequest): Promise<Response<ChatSettingsDTO>>;
22
32
  /**
23
33
  * Delete a chat
24
34
  */
package/dist/api/chats.js CHANGED
@@ -18,10 +18,21 @@ export class ChatsAPI {
18
18
  return this.http.request('get', `/chats/${chatId}`);
19
19
  }
20
20
  /**
21
- * Update a chat
21
+ * Update a chat's name and description (PATCH): only the fields sent are
22
+ * written. Visibility and the other chat settings: updateSettings.
22
23
  */
23
24
  async update(chatId, data) {
24
- return this.http.request('post', `/chats/${chatId}`, { data });
25
+ return this.http.request('patch', `/chats/${chatId}`, { data });
26
+ }
27
+ /**
28
+ * Change a chat's settings (name, visibility, tool approval, hooks,
29
+ * memory). Answers with the settings as they now are. Widening what runs
30
+ * without approval needs approvals:write, held only by the account
31
+ * holder's own sign-in: other credentials get 403 `requires_sign_in`
32
+ * (ErrorCodeRequiresSignIn).
33
+ */
34
+ async updateSettings(chatId, settings) {
35
+ return this.http.request('post', `/chats/${chatId}/settings`, { data: settings });
25
36
  }
26
37
  /**
27
38
  * Delete a chat
@@ -1,5 +1,6 @@
1
1
  import { HttpClient } from '../http/client';
2
2
  import type { Response } from '../http/response';
3
+ import type { EngineUpdateBody } from './write-bodies';
3
4
  import { EngineDTO as Engine, CursorListRequest, CursorListResponse } from '../types';
4
5
  /**
5
6
  * Engines API
@@ -27,9 +28,10 @@ export declare class EnginesAPI {
27
28
  */
28
29
  create(data: Partial<Engine>): Promise<Response<Engine>>;
29
30
  /**
30
- * Update an engine
31
+ * Rename an engine (see EngineUpdateBody). PATCH: only the fields sent are
32
+ * written.
31
33
  */
32
- update(engineId: string, data: Partial<Engine>): Promise<Response<Engine>>;
34
+ update(engineId: string, data: EngineUpdateBody): Promise<Response<Engine>>;
33
35
  /**
34
36
  * Delete an engine
35
37
  */
@@ -30,10 +30,11 @@ export class EnginesAPI {
30
30
  return this.http.request('post', '/engines', { data });
31
31
  }
32
32
  /**
33
- * Update an engine
33
+ * Rename an engine (see EngineUpdateBody). PATCH: only the fields sent are
34
+ * written.
34
35
  */
35
36
  async update(engineId, data) {
36
- return this.http.request('post', `/engines/${engineId}`, { data });
37
+ return this.http.request('patch', `/engines/${engineId}`, { data });
37
38
  }
38
39
  /**
39
40
  * Delete an engine
@@ -24,7 +24,11 @@ export declare class FlowRunsAPI {
24
24
  */
25
25
  clone(flowRunId: string): Promise<Response<FlowRun>>;
26
26
  /**
27
- * Update a flow run
27
+ * Update a flow run.
28
+ *
29
+ * @deprecated A flow run has no caller-writable fields: the API refuses this
30
+ * request. To change who can see a run, use {@link FlowRunsAPI.updateVisibility}.
31
+ * Kept so existing code still compiles; it will be removed in a future major version.
28
32
  */
29
33
  update(flowRunId: string, data: Partial<FlowRun>): Promise<Response<FlowRun>>;
30
34
  /**
@@ -40,7 +44,8 @@ export declare class FlowRunsAPI {
40
44
  */
41
45
  streamTasks(flowRunId: string): Promise<import("eventsource").EventSource | null>;
42
46
  /**
43
- * Update flow run visibility
47
+ * Set who can see a flow run: `private`, `team`, `unlisted` or `public`.
48
+ * This is the one change a caller can make to a run.
44
49
  */
45
50
  updateVisibility(flowRunId: string, visibility: string): Promise<Response<FlowRun>>;
46
51
  }
@@ -30,7 +30,11 @@ export class FlowRunsAPI {
30
30
  return this.http.request('post', `/flowruns/${flowRunId}/clone`);
31
31
  }
32
32
  /**
33
- * Update a flow run
33
+ * Update a flow run.
34
+ *
35
+ * @deprecated A flow run has no caller-writable fields: the API refuses this
36
+ * request. To change who can see a run, use {@link FlowRunsAPI.updateVisibility}.
37
+ * Kept so existing code still compiles; it will be removed in a future major version.
34
38
  */
35
39
  async update(flowRunId, data) {
36
40
  return this.http.request('post', `/flowruns/${flowRunId}`, { data });
@@ -54,7 +58,8 @@ export class FlowRunsAPI {
54
58
  return this.http.createEventSource(`/flowruns/${flowRunId}/tasks/stream`);
55
59
  }
56
60
  /**
57
- * Update flow run visibility
61
+ * Set who can see a flow run: `private`, `team`, `unlisted` or `public`.
62
+ * This is the one change a caller can make to a run.
58
63
  */
59
64
  async updateVisibility(flowRunId, visibility) {
60
65
  return this.http.request('post', `/flowruns/${flowRunId}/visibility`, { data: { visibility } });
@@ -1,5 +1,6 @@
1
1
  import { HttpClient } from '../http/client';
2
2
  import type { Response } from '../http/response';
3
+ import type { FlowPatchBody, FlowUpdateBody, FlowViewportBody } from './write-bodies';
3
4
  import { FlowDTO as Flow, FlowVersionDTO, AppDTO as App, CursorListRequest, CursorListResponse } from '../types';
4
5
  /**
5
6
  * Flows API
@@ -20,9 +21,19 @@ export declare class FlowsAPI {
20
21
  */
21
22
  create(name: string): Promise<Response<Flow>>;
22
23
  /**
23
- * Update a flow
24
+ * Update a flow's copy and images, and save its draft graph when the body
25
+ * names the draft (see FlowUpdateBody). A field left out is written
26
+ * empty: to change some fields only, use patch.
24
27
  */
25
- update(flowId: string, data: Partial<Flow>): Promise<Response<Flow>>;
28
+ update(flowId: string, data: FlowUpdateBody): Promise<Response<Flow>>;
29
+ /**
30
+ * Change some of a flow's fields: only the fields sent are written.
31
+ */
32
+ patch(flowId: string, data: FlowPatchBody): Promise<Response<Flow>>;
33
+ /**
34
+ * Save where the editor's canvas looks on the flow's draft.
35
+ */
36
+ saveViewport(flowId: string, viewport: FlowViewportBody): Promise<Response<void>>;
26
37
  /**
27
38
  * Update flow visibility
28
39
  */
package/dist/api/flows.js CHANGED
@@ -24,11 +24,25 @@ export class FlowsAPI {
24
24
  return this.http.request('post', '/flows', { data: { name } });
25
25
  }
26
26
  /**
27
- * Update a flow
27
+ * Update a flow's copy and images, and save its draft graph when the body
28
+ * names the draft (see FlowUpdateBody). A field left out is written
29
+ * empty: to change some fields only, use patch.
28
30
  */
29
31
  async update(flowId, data) {
30
32
  return this.http.request('post', `/flows/${flowId}`, { data });
31
33
  }
34
+ /**
35
+ * Change some of a flow's fields: only the fields sent are written.
36
+ */
37
+ async patch(flowId, data) {
38
+ return this.http.request('patch', `/flows/${flowId}`, { data });
39
+ }
40
+ /**
41
+ * Save where the editor's canvas looks on the flow's draft.
42
+ */
43
+ async saveViewport(flowId, viewport) {
44
+ return this.http.request('post', `/flows/${flowId}/viewport`, { data: viewport });
45
+ }
32
46
  /**
33
47
  * Update flow visibility
34
48
  */
@@ -1,5 +1,6 @@
1
1
  import { HttpClient } from '../http/client';
2
2
  import type { Response } from '../http/response';
3
+ import type { KnowledgeUpdateBody } from './write-bodies';
3
4
  import { KnowledgeDTO, KnowledgeVersionDTO, KnowledgeCreateRequest, SkillDTO, SkillVersionDTO, CursorListRequest, CursorListResponse, PublicSkillStoreDTO } from '../types';
4
5
  /**
5
6
  * Knowledge API
@@ -24,9 +25,10 @@ export declare class KnowledgeAPI {
24
25
  */
25
26
  create(data: KnowledgeCreateRequest): Promise<Response<KnowledgeDTO>>;
26
27
  /**
27
- * Update a knowledge entry
28
+ * Update a knowledge entry (PATCH): only the fields sent are written, the
29
+ * others keep their value.
28
30
  */
29
- update(id: string, data: Partial<KnowledgeDTO>): Promise<Response<KnowledgeDTO>>;
31
+ update(id: string, data: KnowledgeUpdateBody): Promise<Response<KnowledgeDTO>>;
30
32
  /**
31
33
  * Delete a knowledge entry
32
34
  */
@@ -75,9 +77,10 @@ export declare class SkillsAPI {
75
77
  */
76
78
  create(data: Partial<SkillDTO>): Promise<Response<SkillDTO>>;
77
79
  /**
78
- * Update a skill
80
+ * Update a skill (PATCH): only the fields sent are written, the others
81
+ * keep their value.
79
82
  */
80
- update(id: string, data: Partial<SkillDTO>): Promise<Response<SkillDTO>>;
83
+ update(id: string, data: KnowledgeUpdateBody): Promise<Response<SkillDTO>>;
81
84
  /**
82
85
  * Delete a skill
83
86
  */
@@ -30,10 +30,11 @@ export class KnowledgeAPI {
30
30
  return this.http.request('post', '/knowledge', { data });
31
31
  }
32
32
  /**
33
- * Update a knowledge entry
33
+ * Update a knowledge entry (PATCH): only the fields sent are written, the
34
+ * others keep their value.
34
35
  */
35
36
  async update(id, data) {
36
- return this.http.request('post', `/knowledge/${id}`, { data });
37
+ return this.http.request('patch', `/knowledge/${id}`, { data });
37
38
  }
38
39
  /**
39
40
  * Delete a knowledge entry
@@ -107,10 +108,11 @@ export class SkillsAPI {
107
108
  return this.http.request('post', '/skills', { data });
108
109
  }
109
110
  /**
110
- * Update a skill
111
+ * Update a skill (PATCH): only the fields sent are written, the others
112
+ * keep their value.
111
113
  */
112
114
  async update(id, data) {
113
- return this.http.request('post', `/skills/${id}`, { data });
115
+ return this.http.request('patch', `/skills/${id}`, { data });
114
116
  }
115
117
  /**
116
118
  * Delete a skill
@@ -1,5 +1,6 @@
1
1
  import { HttpClient } from '../http/client';
2
2
  import type { Response } from '../http/response';
3
+ import type { MCPServerUpdateBody } from './write-bodies';
3
4
  import { MCPServerDTO, CursorListRequest, CursorListResponse } from '../types';
4
5
  /**
5
6
  * MCP Servers API
@@ -38,7 +39,7 @@ export declare class MCPServersAPI {
38
39
  /**
39
40
  * Update an MCP server
40
41
  */
41
- update(id: string, data: Partial<MCPServerDTO>): Promise<Response<MCPServerDTO>>;
42
+ update(id: string, data: MCPServerUpdateBody): Promise<Response<MCPServerDTO>>;
42
43
  /**
43
44
  * Delete an MCP server
44
45
  */
@@ -1,5 +1,6 @@
1
1
  import { HttpClient } from '../http/client';
2
2
  import type { Response } from '../http/response';
3
+ import type { ProjectWriteBody } from './write-bodies';
3
4
  import { ProjectDTO, CursorListRequest, CursorListResponse } from '../types';
4
5
  /**
5
6
  * Projects API
@@ -18,11 +19,12 @@ export declare class ProjectsAPI {
18
19
  /**
19
20
  * Create a project
20
21
  */
21
- create(data: Partial<ProjectDTO>): Promise<Response<ProjectDTO>>;
22
+ create(data: ProjectWriteBody): Promise<Response<ProjectDTO>>;
22
23
  /**
23
- * Update a project
24
+ * Update a project (PATCH): only the fields sent are written, the others
25
+ * keep their value.
24
26
  */
25
- update(id: string, data: Partial<ProjectDTO>): Promise<Response<ProjectDTO>>;
27
+ update(id: string, data: ProjectWriteBody): Promise<Response<ProjectDTO>>;
26
28
  /**
27
29
  * Delete a project
28
30
  */
@@ -24,10 +24,11 @@ export class ProjectsAPI {
24
24
  return this.http.request('post', '/projects', { data });
25
25
  }
26
26
  /**
27
- * Update a project
27
+ * Update a project (PATCH): only the fields sent are written, the others
28
+ * keep their value.
28
29
  */
29
30
  async update(id, data) {
30
- return this.http.request('post', `/projects/${id}`, { data });
31
+ return this.http.request('patch', `/projects/${id}`, { data });
31
32
  }
32
33
  /**
33
34
  * Delete a project
@@ -1,6 +1,6 @@
1
1
  import { HttpClient } from '../http/client';
2
2
  import type { Response } from '../http/response';
3
- import { SecretDTO, SecretCreateRequest, CursorListRequest, CursorListResponse } from '../types';
3
+ import { SecretDTO, SecretCreateRequest, SecretUpdateRequest, CursorListRequest, CursorListResponse } from '../types';
4
4
  /**
5
5
  * Secrets API
6
6
  */
@@ -18,7 +18,7 @@ export declare class SecretsAPI {
18
18
  /**
19
19
  * Update a secret
20
20
  */
21
- update(key: string, data: Partial<SecretCreateRequest>): Promise<Response<SecretDTO>>;
21
+ update(key: string, data: SecretUpdateRequest): Promise<Response<SecretDTO>>;
22
22
  /**
23
23
  * Delete a secret
24
24
  */