@meistrari/agent-sdk 0.1.2 → 0.2.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.
package/dist/index.mjs CHANGED
@@ -53,14 +53,445 @@ ${text}`,
53
53
  }
54
54
  }
55
55
 
56
- const sessionStatusSchema = z.enum([
57
- "pending",
58
- "running",
59
- "completed",
60
- "failed",
61
- "waiting_messages",
62
- "cancelled"
56
+ function getDefaultExportFromCjs (x) {
57
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
58
+ }
59
+
60
+ var openrouterModels = [
61
+ {
62
+ id: "openai/gpt-5.5",
63
+ name: "OpenAI: GPT-5.5",
64
+ context_length: 1050000,
65
+ max_completion_tokens: 128000,
66
+ pricing: {
67
+ prompt_per_million: 5,
68
+ completion_per_million: 30,
69
+ input_cache_read_per_million: 0.5
70
+ },
71
+ supported_parameters: [
72
+ "include_reasoning",
73
+ "max_completion_tokens",
74
+ "max_tokens",
75
+ "reasoning",
76
+ "response_format",
77
+ "seed",
78
+ "structured_outputs",
79
+ "tool_choice",
80
+ "tools"
81
+ ],
82
+ modality: "text+image+file->text",
83
+ description: "GPT-5.5 is OpenAI’s frontier model designed for complex professional workloads, building on GPT-5.4 with stronger reasoning, higher reliability, and improved token efficiency on hard tasks. It features a 1M+ token..."
84
+ },
85
+ {
86
+ id: "openai/gpt-5.4",
87
+ name: "OpenAI: GPT-5.4",
88
+ context_length: 1050000,
89
+ max_completion_tokens: 128000,
90
+ pricing: {
91
+ prompt_per_million: 2.5,
92
+ completion_per_million: 15,
93
+ input_cache_read_per_million: 0.25
94
+ },
95
+ supported_parameters: [
96
+ "include_reasoning",
97
+ "max_completion_tokens",
98
+ "max_tokens",
99
+ "reasoning",
100
+ "response_format",
101
+ "seed",
102
+ "structured_outputs",
103
+ "tool_choice",
104
+ "tools"
105
+ ],
106
+ modality: "text+image+file->text",
107
+ description: "GPT-5.4 is OpenAI’s latest frontier model, unifying the Codex and GPT lines into a single system. It features a 1M+ token context window (922K input, 128K output) with support for..."
108
+ },
109
+ {
110
+ id: "openai/gpt-5.3-codex",
111
+ name: "OpenAI: GPT-5.3-Codex",
112
+ context_length: 400000,
113
+ max_completion_tokens: 128000,
114
+ pricing: {
115
+ prompt_per_million: 1.75,
116
+ completion_per_million: 14,
117
+ input_cache_read_per_million: 0.17
118
+ },
119
+ supported_parameters: [
120
+ "include_reasoning",
121
+ "max_completion_tokens",
122
+ "max_tokens",
123
+ "reasoning",
124
+ "response_format",
125
+ "seed",
126
+ "structured_outputs",
127
+ "tool_choice",
128
+ "tools"
129
+ ],
130
+ modality: "text+image+file->text",
131
+ description: "GPT-5.3-Codex is OpenAI’s most advanced agentic coding model, combining the frontier software engineering performance of GPT-5.2-Codex with the broader reasoning and professional knowledge capabilities of GPT-5.2. It achieves state-of-the-art results"
132
+ },
133
+ {
134
+ id: "google/gemini-3.5-flash",
135
+ name: "Google: Gemini 3.5 Flash",
136
+ context_length: 1048576,
137
+ max_completion_tokens: 65536,
138
+ pricing: {
139
+ prompt_per_million: 1.5,
140
+ completion_per_million: 9,
141
+ input_cache_read_per_million: 0.15
142
+ },
143
+ supported_parameters: [
144
+ "include_reasoning",
145
+ "max_tokens",
146
+ "reasoning",
147
+ "response_format",
148
+ "seed",
149
+ "stop",
150
+ "structured_outputs",
151
+ "temperature",
152
+ "tool_choice",
153
+ "tools",
154
+ "top_p"
155
+ ],
156
+ modality: "text+image+file+audio+video->text",
157
+ description: "Gemini 3.5 Flash is a fast multimodal Google model aimed at coding, reasoning, and parallel agent workflows with a Flash-tier cost profile."
158
+ },
159
+ {
160
+ id: "google/gemini-3-flash-preview",
161
+ name: "Google: Gemini 3 Flash Preview",
162
+ context_length: 1048576,
163
+ max_completion_tokens: 65536,
164
+ pricing: {
165
+ prompt_per_million: 0.5,
166
+ completion_per_million: 3,
167
+ input_cache_read_per_million: 0.05
168
+ },
169
+ supported_parameters: [
170
+ "include_reasoning",
171
+ "max_tokens",
172
+ "reasoning",
173
+ "response_format",
174
+ "seed",
175
+ "stop",
176
+ "structured_outputs",
177
+ "temperature",
178
+ "tool_choice",
179
+ "tools",
180
+ "top_p"
181
+ ],
182
+ modality: "text+image+file+audio+video->text",
183
+ description: "Gemini 3 Flash Preview is a high speed, high value thinking model designed for agentic workflows, multi turn chat, and coding assistance. It delivers near Pro level reasoning and tool..."
184
+ },
185
+ {
186
+ id: "google/gemini-3.1-pro-preview",
187
+ name: "Google: Gemini 3.1 Pro Preview",
188
+ context_length: 1048576,
189
+ max_completion_tokens: 65536,
190
+ pricing: {
191
+ prompt_per_million: 2,
192
+ completion_per_million: 12,
193
+ input_cache_read_per_million: 0.2
194
+ },
195
+ supported_parameters: [
196
+ "include_reasoning",
197
+ "max_tokens",
198
+ "reasoning",
199
+ "response_format",
200
+ "seed",
201
+ "stop",
202
+ "structured_outputs",
203
+ "temperature",
204
+ "tool_choice",
205
+ "tools",
206
+ "top_p"
207
+ ],
208
+ modality: "text+image+file+audio+video->text",
209
+ description: "Gemini 3.1 Pro Preview is Google’s frontier reasoning model, delivering enhanced software engineering performance, improved agentic reliability, and more efficient token usage across complex workflows. Building on the multimodal foundation..."
210
+ },
211
+ {
212
+ id: "xiaomi/mimo-v2-pro",
213
+ name: "Xiaomi: MiMo-V2-Pro",
214
+ context_length: 1048576,
215
+ max_completion_tokens: 131072,
216
+ pricing: {
217
+ prompt_per_million: 1,
218
+ completion_per_million: 3,
219
+ input_cache_read_per_million: 0.2
220
+ },
221
+ supported_parameters: [
222
+ "frequency_penalty",
223
+ "include_reasoning",
224
+ "max_tokens",
225
+ "presence_penalty",
226
+ "reasoning",
227
+ "response_format",
228
+ "stop",
229
+ "temperature",
230
+ "tool_choice",
231
+ "tools",
232
+ "top_p"
233
+ ],
234
+ modality: "text->text",
235
+ description: "MiMo-V2-Pro is Xiaomi's flagship foundation model, featuring over 1T total parameters and a 1M context length, deeply optimized for agentic scenarios. It is highly adaptable to general agent frameworks like..."
236
+ },
237
+ {
238
+ id: "xiaomi/mimo-v2-omni",
239
+ name: "Xiaomi: MiMo-V2-Omni",
240
+ context_length: 262144,
241
+ max_completion_tokens: 65536,
242
+ pricing: {
243
+ prompt_per_million: 0.4,
244
+ completion_per_million: 2,
245
+ input_cache_read_per_million: 0.08
246
+ },
247
+ supported_parameters: [
248
+ "frequency_penalty",
249
+ "include_reasoning",
250
+ "max_tokens",
251
+ "presence_penalty",
252
+ "reasoning",
253
+ "response_format",
254
+ "stop",
255
+ "temperature",
256
+ "tool_choice",
257
+ "tools",
258
+ "top_p"
259
+ ],
260
+ modality: "text+image+audio+video->text",
261
+ description: "MiMo-V2-Omni is a frontier omni-modal model that natively processes image, video, and audio inputs within a unified architecture. It combines strong multimodal perception with agentic capability - visual grounding, multi-step..."
262
+ },
263
+ {
264
+ id: "moonshotai/kimi-k2.5",
265
+ name: "MoonshotAI: Kimi K2.5",
266
+ context_length: 262144,
267
+ max_completion_tokens: 65535,
268
+ pricing: {
269
+ prompt_per_million: 0.38,
270
+ completion_per_million: 1.72,
271
+ input_cache_read_per_million: 0.19
272
+ },
273
+ supported_parameters: [
274
+ "frequency_penalty",
275
+ "include_reasoning",
276
+ "logit_bias",
277
+ "logprobs",
278
+ "max_tokens",
279
+ "min_p",
280
+ "parallel_tool_calls",
281
+ "presence_penalty",
282
+ "reasoning",
283
+ "repetition_penalty",
284
+ "response_format",
285
+ "seed",
286
+ "stop",
287
+ "structured_outputs",
288
+ "temperature",
289
+ "tool_choice",
290
+ "tools",
291
+ "top_k",
292
+ "top_logprobs",
293
+ "top_p"
294
+ ],
295
+ modality: "text+image->text",
296
+ description: "Kimi K2.5 is Moonshot AI's native multimodal model, delivering state-of-the-art visual coding capability and a self-directed agent swarm paradigm. Built on Kimi K2 with continued pretraining over approximately 15T mixed..."
297
+ },
298
+ {
299
+ id: "moonshotai/kimi-k2-thinking",
300
+ name: "MoonshotAI: Kimi K2 Thinking",
301
+ context_length: 262144,
302
+ max_completion_tokens: null,
303
+ pricing: {
304
+ prompt_per_million: 0.6,
305
+ completion_per_million: 2.5
306
+ },
307
+ supported_parameters: [
308
+ "frequency_penalty",
309
+ "include_reasoning",
310
+ "logit_bias",
311
+ "max_tokens",
312
+ "min_p",
313
+ "presence_penalty",
314
+ "reasoning",
315
+ "repetition_penalty",
316
+ "response_format",
317
+ "seed",
318
+ "stop",
319
+ "structured_outputs",
320
+ "temperature",
321
+ "tool_choice",
322
+ "tools",
323
+ "top_k",
324
+ "top_p"
325
+ ],
326
+ modality: "text->text",
327
+ description: "Kimi K2 Thinking is Moonshot AI’s most advanced open reasoning model to date, extending the K2 series into agentic, long-horizon reasoning. Built on the trillion-parameter Mixture-of-Experts (MoE) architecture introduced in..."
328
+ },
329
+ {
330
+ id: "moonshotai/kimi-k2-0905",
331
+ name: "MoonshotAI: Kimi K2 0905",
332
+ context_length: 262144,
333
+ max_completion_tokens: 262144,
334
+ pricing: {
335
+ prompt_per_million: 0.4,
336
+ completion_per_million: 2
337
+ },
338
+ supported_parameters: [
339
+ "frequency_penalty",
340
+ "logit_bias",
341
+ "logprobs",
342
+ "max_tokens",
343
+ "min_p",
344
+ "presence_penalty",
345
+ "repetition_penalty",
346
+ "response_format",
347
+ "seed",
348
+ "stop",
349
+ "structured_outputs",
350
+ "temperature",
351
+ "tool_choice",
352
+ "tools",
353
+ "top_k",
354
+ "top_logprobs",
355
+ "top_p"
356
+ ],
357
+ modality: "text->text",
358
+ description: "Kimi K2 0905 is the September update of [Kimi K2 0711](moonshotai/kimi-k2). It is a large-scale Mixture-of-Experts (MoE) language model developed by Moonshot AI, featuring 1 trillion total parameters with 32..."
359
+ },
360
+ {
361
+ id: "z-ai/glm-5.1",
362
+ name: "Z.ai: GLM 5.1",
363
+ context_length: 202752,
364
+ max_completion_tokens: 131072,
365
+ pricing: {
366
+ prompt_per_million: 1.4,
367
+ completion_per_million: 4.4,
368
+ input_cache_read_per_million: 0.26
369
+ },
370
+ supported_parameters: [
371
+ "frequency_penalty",
372
+ "include_reasoning",
373
+ "logit_bias",
374
+ "logprobs",
375
+ "max_tokens",
376
+ "min_p",
377
+ "presence_penalty",
378
+ "reasoning",
379
+ "repetition_penalty",
380
+ "response_format",
381
+ "seed",
382
+ "stop",
383
+ "structured_outputs",
384
+ "temperature",
385
+ "tool_choice",
386
+ "tools",
387
+ "top_k",
388
+ "top_logprobs",
389
+ "top_p"
390
+ ],
391
+ modality: "text->text",
392
+ description: "GLM-5.1 delivers a major leap in coding capability, with particularly significant gains in handling long-horizon tasks. Unlike previous models built around minute-level interactions, GLM-5.1 can work independently and continuously on..."
393
+ },
394
+ {
395
+ id: "z-ai/glm-5v-turbo",
396
+ name: "Z.ai: GLM 5V Turbo",
397
+ context_length: 202752,
398
+ max_completion_tokens: 131072,
399
+ pricing: {
400
+ prompt_per_million: 1.2,
401
+ completion_per_million: 4,
402
+ input_cache_read_per_million: 0.24
403
+ },
404
+ supported_parameters: [
405
+ "include_reasoning",
406
+ "max_tokens",
407
+ "reasoning",
408
+ "response_format",
409
+ "temperature",
410
+ "tool_choice",
411
+ "tools",
412
+ "top_p"
413
+ ],
414
+ modality: "text+image+video->text",
415
+ description: "GLM-5V-Turbo is Z.ai’s first native multimodal agent foundation model, built for vision-based coding and agent-driven tasks. It natively handles image, video, and text inputs, excels at long-horizon planning, complex coding,..."
416
+ },
417
+ {
418
+ id: "minimax/minimax-m2.7",
419
+ name: "MiniMax: MiniMax M2.7",
420
+ context_length: 204800,
421
+ max_completion_tokens: 131072,
422
+ pricing: {
423
+ prompt_per_million: 0.3,
424
+ completion_per_million: 1.2,
425
+ input_cache_read_per_million: 0.06
426
+ },
427
+ supported_parameters: [
428
+ "include_reasoning",
429
+ "max_tokens",
430
+ "reasoning",
431
+ "response_format",
432
+ "temperature",
433
+ "tool_choice",
434
+ "tools",
435
+ "top_p"
436
+ ],
437
+ modality: "text->text",
438
+ description: "MiniMax-M2.7 is a next-generation large language model designed for autonomous, real-world productivity and continuous improvement. Built to actively participate in its own evolution, M2.7 integrates advanced agentic capabilities through multi-agent."
439
+ },
440
+ {
441
+ id: "minimax/minimax-m2.5",
442
+ name: "MiniMax: MiniMax M2.5",
443
+ context_length: 196608,
444
+ max_completion_tokens: 65536,
445
+ pricing: {
446
+ prompt_per_million: 0.12,
447
+ completion_per_million: 0.99,
448
+ input_cache_read_per_million: 0.06
449
+ },
450
+ supported_parameters: [
451
+ "frequency_penalty",
452
+ "include_reasoning",
453
+ "logit_bias",
454
+ "logprobs",
455
+ "max_tokens",
456
+ "min_p",
457
+ "parallel_tool_calls",
458
+ "presence_penalty",
459
+ "reasoning",
460
+ "reasoning_effort",
461
+ "repetition_penalty",
462
+ "response_format",
463
+ "seed",
464
+ "stop",
465
+ "structured_outputs",
466
+ "temperature",
467
+ "tool_choice",
468
+ "tools",
469
+ "top_k",
470
+ "top_logprobs",
471
+ "top_p"
472
+ ],
473
+ modality: "text->text",
474
+ description: "MiniMax-M2.5 is a SOTA large language model designed for real-world productivity. Trained in a diverse range of complex real-world digital working environments, M2.5 builds upon the coding expertise of M2.1..."
475
+ }
476
+ ];
477
+
478
+ const openrouterCatalog = /*@__PURE__*/getDefaultExportFromCjs(openrouterModels);
479
+
480
+ const nativeAnthropicModelIds = [
481
+ "claude-sonnet-4-5",
482
+ "claude-sonnet-4-6",
483
+ "claude-haiku-4-5",
484
+ "claude-opus-4-6",
485
+ "claude-opus-4-7",
486
+ "claude-opus-4-8"
487
+ ];
488
+ z.enum(nativeAnthropicModelIds);
489
+ const openrouterModelIds = openrouterCatalog.map((entry) => entry.id);
490
+ const modelSchema = z.enum([
491
+ ...nativeAnthropicModelIds,
492
+ ...openrouterModelIds
63
493
  ]);
494
+
64
495
  const vaultReferenceSchema = z.string().regex(/^vault:\/\/\S+$/, "vaultRef must start with vault:// and cannot contain whitespace");
65
496
  const agentInputSchema = z.object({
66
497
  vaultRef: vaultReferenceSchema,
@@ -99,6 +530,42 @@ const executeAgentResponseSchema = z.object({
99
530
  sessionId: z.string().optional(),
100
531
  error: z.string().optional()
101
532
  });
533
+ const repositoryNameSchema = z.string().min(1, "Repository is required").max(200, "Repository must be 200 characters or less").regex(/^[\w.-]+$/, "Repository contains unsupported characters");
534
+ const updateAgentModelRequestSchema = z.object({
535
+ repository: repositoryNameSchema,
536
+ model: modelSchema,
537
+ commitMessage: z.string().max(4096, "Commit message must be 4096 characters or less").optional()
538
+ }).strict();
539
+ const updateAgentModelResponseSchema = z.object({
540
+ success: z.boolean(),
541
+ organizationName: z.string().optional(),
542
+ repository: z.string().optional(),
543
+ branch: z.string().optional(),
544
+ commitHash: z.string().optional(),
545
+ model: modelSchema.optional(),
546
+ providerTemplate: z.string().optional(),
547
+ templateSynced: z.boolean().optional(),
548
+ files: z.array(z.string()).optional(),
549
+ deletedFiles: z.array(z.string()).optional(),
550
+ error: z.string().optional()
551
+ });
552
+
553
+ const sessionStatusSchema = z.enum([
554
+ "pending",
555
+ "running",
556
+ "completed",
557
+ "failed",
558
+ "waiting_messages",
559
+ "cancelled"
560
+ ]);
561
+ const sessionTimelineIdSchema = z.string().min(1, "Session ID is required");
562
+ const sessionTimelineResponseSchema = z.object({
563
+ sessionId: z.string(),
564
+ status: z.string(),
565
+ metrics: z.record(z.string(), z.unknown()),
566
+ prompt: z.record(z.string(), z.unknown()),
567
+ spans: z.array(z.record(z.string(), z.unknown()))
568
+ });
102
569
  const sessionStatusEventSchema = z.object({
103
570
  kind: z.literal("status"),
104
571
  sessionId: z.string(),
@@ -278,6 +745,24 @@ function agentClient(config) {
278
745
  });
279
746
  return executeAgentResponseSchema.parse(await response.json());
280
747
  }
748
+ async function updateAgentModel(input) {
749
+ const { repository, ...body } = updateAgentModelRequestSchema.parse(input);
750
+ const response = await request({
751
+ method: "PUT",
752
+ path: `/v4/agents/${encodeURIComponent(repository)}/model`,
753
+ body
754
+ });
755
+ return updateAgentModelResponseSchema.parse(await response.json());
756
+ }
757
+ async function fetchTimeline(sessionId, options) {
758
+ const parsedSessionId = sessionTimelineIdSchema.parse(sessionId);
759
+ const response = await request({
760
+ method: "GET",
761
+ path: `/v4/sessions/${encodeURIComponent(parsedSessionId)}/timeline`,
762
+ signal: options?.signal
763
+ });
764
+ return sessionTimelineResponseSchema.parse(await response.json());
765
+ }
281
766
  async function streamSession(sessionId, options) {
282
767
  const response = await request({
283
768
  method: "GET",
@@ -314,7 +799,7 @@ function agentClient(config) {
314
799
  return JSON.parse(await vaultFile.content.text());
315
800
  return vaultFile.content.arrayBuffer();
316
801
  }
317
- return { executeAgent, streamSession, resolveReference };
802
+ return { executeAgent, updateAgentModel, fetchTimeline, streamSession, resolveReference };
318
803
  }
319
804
 
320
- export { APIKeyAuthStrategy, DataTokenAuthStrategy, FetchError, agentClient, agentInputSchema, executeAgentRequestSchema, executeAgentResponseSchema, parseSessionStream, sessionStatusSchema, sessionStreamEventSchema };
805
+ export { APIKeyAuthStrategy, DataTokenAuthStrategy, FetchError, agentClient, agentInputSchema, executeAgentRequestSchema, executeAgentResponseSchema, parseSessionStream, sessionStatusSchema, sessionStreamEventSchema, sessionTimelineIdSchema, sessionTimelineResponseSchema, updateAgentModelRequestSchema, updateAgentModelResponseSchema };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meistrari/agent-sdk",
3
3
  "type": "module",
4
- "version": "0.1.2",
4
+ "version": "0.2.0",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
7
7
  "type": "git",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "exports": {
12
12
  ".": {
13
- "bun": "./src/index.ts",
13
+ "bun": "./dist/index.mjs",
14
14
  "types": "./dist/index.d.ts",
15
15
  "import": "./dist/index.mjs",
16
16
  "require": "./dist/index.cjs"
@@ -35,6 +35,7 @@
35
35
  "zod": "4.1.12"
36
36
  },
37
37
  "devDependencies": {
38
+ "@agent-api/schemas": "workspace:*",
38
39
  "@types/bun": "latest",
39
40
  "unbuild": "2.0.0"
40
41
  },