@ottocode/sdk 0.1.291 → 0.1.293

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ottocode/sdk",
3
- "version": "0.1.291",
3
+ "version": "0.1.293",
4
4
  "description": "AI agent SDK for building intelligent assistants - tree-shakable and comprehensive",
5
5
  "author": "nitishxyz",
6
6
  "license": "MIT",
@@ -67,10 +67,6 @@ export function buildLoadMCPToolsTool(briefs: MCPToolBrief[]): {
67
67
  ok: true,
68
68
  loaded,
69
69
  ...(notFound.length > 0 ? { notFound } : {}),
70
- message:
71
- loaded.length > 0
72
- ? `Loaded ${loaded.length} tool(s). They are now available for use.`
73
- : 'No valid tools to load.',
74
70
  };
75
71
  },
76
72
  }),
@@ -30,26 +30,8 @@ export const progressUpdateTool = tool({
30
30
  .describe('Optional overall progress percent 0-100.'),
31
31
  stage: StageEnum.optional().default('planning'),
32
32
  }),
33
- async execute({
34
- message,
35
- pct,
36
- stage,
37
- }: {
38
- message: string;
39
- pct?: number;
40
- stage?: z.infer<typeof StageEnum>;
41
- }) {
33
+ async execute() {
42
34
  // Keep the tool lightweight; no side effects beyond the event itself.
43
- // Returning the normalized payload allows generic renderers to inspect it if needed.
44
- const normalizedPct =
45
- typeof pct === 'number'
46
- ? Math.min(100, Math.max(0, Math.round(pct)))
47
- : undefined;
48
- return {
49
- ok: true,
50
- message,
51
- pct: normalizedPct,
52
- stage: stage ?? 'planning',
53
- } as const;
35
+ return { ok: true } as const;
54
36
  },
55
37
  });
@@ -182,7 +182,6 @@ export function buildTerminalTool(
182
182
  args: params.args || [],
183
183
  shell: runInShell,
184
184
  title: term.title,
185
- message: `Started: ${params.command ?? command}${params.args ? ` ${params.args.join(' ')}` : ''}`,
186
185
  };
187
186
  }
188
187
 
@@ -249,7 +248,7 @@ export function buildTerminalTool(
249
248
  return {
250
249
  ok: true,
251
250
  terminalId: term.id,
252
- message: `Wrote ${params.input.length} characters to terminal`,
251
+ charactersWritten: params.input.length,
253
252
  };
254
253
  }
255
254
 
@@ -270,7 +269,6 @@ export function buildTerminalTool(
270
269
  return {
271
270
  ok: true,
272
271
  terminalId: term.id,
273
- message: 'Sent SIGINT (Ctrl+C) to terminal',
274
272
  };
275
273
  }
276
274
 
@@ -296,7 +294,6 @@ export function buildTerminalTool(
296
294
  return {
297
295
  ok: true,
298
296
  terminalId: params.terminalId,
299
- message: `Killed terminal ${params.terminalId}`,
300
297
  };
301
298
  }
302
299
 
@@ -60,7 +60,8 @@ export const updateTodosTool: Tool = tool({
60
60
  .optional()
61
61
  .describe('Optional note or context for the update'),
62
62
  }),
63
- async execute({ todos, note }: { todos: TodoItemInput[]; note?: string }) {
64
- return { items: normalizeItems(todos), note };
63
+ async execute({ todos }: { todos: TodoItemInput[]; note?: string }) {
64
+ normalizeItems(todos);
65
+ return { ok: true };
65
66
  },
66
67
  });
@@ -45,10 +45,6 @@ export function buildLoadToolsTool(briefs: LazyToolBrief[]): {
45
45
  ok: true,
46
46
  loaded,
47
47
  ...(notFound.length > 0 ? { notFound } : {}),
48
- message:
49
- loaded.length > 0
50
- ? `Loaded ${loaded.length} tool(s). They are now available for use.`
51
- : 'No valid tools to load.',
52
48
  };
53
49
  },
54
50
  }),
@@ -66,6 +66,22 @@ function normalizeOptionalText(value: string | undefined): string | undefined {
66
66
  return trimmed;
67
67
  }
68
68
 
69
+ function normalizeConfiguredModels(
70
+ models: ProviderSettingsEntry['models'] | undefined,
71
+ ): ModelInfo[] {
72
+ if (!models) return [];
73
+ return models
74
+ .map((model): ModelInfo | null => {
75
+ if (typeof model === 'string') {
76
+ const id = model.trim();
77
+ return id ? { id, label: id } : null;
78
+ }
79
+ const id = normalizeOptionalText(model.id);
80
+ return id ? { ...model, id, label: model.label ?? id } : null;
81
+ })
82
+ .filter((model): model is ModelInfo => model !== null);
83
+ }
84
+
69
85
  function resolveCustomCompatibility(
70
86
  settings: ProviderSettingsEntry,
71
87
  ): ProviderCompatibility {
@@ -121,7 +137,8 @@ export function getProviderDefinition(
121
137
 
122
138
  if (!settings?.custom) return undefined;
123
139
  const cachedEntry = getCachedProviderCatalogEntry(provider);
124
- const models = cachedEntry?.models ?? [];
140
+ const configuredModels = normalizeConfiguredModels(settings.models);
141
+ const models = cachedEntry?.models ?? configuredModels;
125
142
  return {
126
143
  id: provider,
127
144
  label: settings.label ?? cachedEntry?.label ?? provider,