@blazingagents/sdk 0.1.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 (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +366 -0
  3. package/dist/chat-transport.d.ts +17 -0
  4. package/dist/chat-transport.js +58 -0
  5. package/dist/client.d.ts +38 -0
  6. package/dist/client.js +86 -0
  7. package/dist/contracts/api.d.ts +256 -0
  8. package/dist/contracts/api.js +189 -0
  9. package/dist/contracts/entities/agent-tools.d.ts +26 -0
  10. package/dist/contracts/entities/agent-tools.js +52 -0
  11. package/dist/contracts/entities/agents.d.ts +183 -0
  12. package/dist/contracts/entities/agents.js +153 -0
  13. package/dist/contracts/entities/artifacts.d.ts +71 -0
  14. package/dist/contracts/entities/artifacts.js +71 -0
  15. package/dist/contracts/entities/attribution.d.ts +27 -0
  16. package/dist/contracts/entities/attribution.js +27 -0
  17. package/dist/contracts/entities/chat.d.ts +269 -0
  18. package/dist/contracts/entities/chat.js +198 -0
  19. package/dist/contracts/entities/mcp-connections.d.ts +421 -0
  20. package/dist/contracts/entities/mcp-connections.js +473 -0
  21. package/dist/contracts/entities/memories.d.ts +56 -0
  22. package/dist/contracts/entities/memories.js +62 -0
  23. package/dist/contracts/entities/prompts.d.ts +61 -0
  24. package/dist/contracts/entities/prompts.js +96 -0
  25. package/dist/contracts/entities/providers.d.ts +123 -0
  26. package/dist/contracts/entities/providers.js +111 -0
  27. package/dist/contracts/entities/sessions.d.ts +156 -0
  28. package/dist/contracts/entities/sessions.js +120 -0
  29. package/dist/contracts/entities/skills.d.ts +167 -0
  30. package/dist/contracts/entities/skills.js +153 -0
  31. package/dist/contracts/entities/tasks.d.ts +457 -0
  32. package/dist/contracts/entities/tasks.js +252 -0
  33. package/dist/contracts/entities/tenants.d.ts +69 -0
  34. package/dist/contracts/entities/tenants.js +54 -0
  35. package/dist/contracts/entities/usage.d.ts +95 -0
  36. package/dist/contracts/entities/usage.js +117 -0
  37. package/dist/contracts/entities/workspaces.d.ts +89 -0
  38. package/dist/contracts/entities/workspaces.js +71 -0
  39. package/dist/contracts/ids.d.ts +57 -0
  40. package/dist/contracts/ids.js +79 -0
  41. package/dist/contracts/index.d.ts +15 -0
  42. package/dist/contracts/index.js +16 -0
  43. package/dist/contracts/limitations.d.ts +138 -0
  44. package/dist/contracts/limitations.js +140 -0
  45. package/dist/contracts/utils.d.ts +3 -0
  46. package/dist/contracts/utils.js +7 -0
  47. package/dist/errors.d.ts +33 -0
  48. package/dist/errors.js +48 -0
  49. package/dist/generation.d.ts +5 -0
  50. package/dist/generation.js +422 -0
  51. package/dist/http.d.ts +21 -0
  52. package/dist/http.js +307 -0
  53. package/dist/index.d.ts +20 -0
  54. package/dist/index.js +13 -0
  55. package/dist/relay.d.ts +20 -0
  56. package/dist/relay.js +113 -0
  57. package/dist/resources/agents.d.ts +8 -0
  58. package/dist/resources/agents.js +82 -0
  59. package/dist/resources/artifacts.d.ts +5 -0
  60. package/dist/resources/artifacts.js +29 -0
  61. package/dist/resources/mcp-connections.d.ts +2 -0
  62. package/dist/resources/mcp-connections.js +40 -0
  63. package/dist/resources/memories.d.ts +7 -0
  64. package/dist/resources/memories.js +33 -0
  65. package/dist/resources/prompts.d.ts +6 -0
  66. package/dist/resources/prompts.js +36 -0
  67. package/dist/resources/providers.d.ts +5 -0
  68. package/dist/resources/providers.js +38 -0
  69. package/dist/resources/sessions.d.ts +8 -0
  70. package/dist/resources/sessions.js +49 -0
  71. package/dist/resources/skills.d.ts +2 -0
  72. package/dist/resources/skills.js +49 -0
  73. package/dist/resources/tasks.d.ts +7 -0
  74. package/dist/resources/tasks.js +63 -0
  75. package/dist/resources/tenant.d.ts +6 -0
  76. package/dist/resources/tenant.js +19 -0
  77. package/dist/resources/usage.d.ts +7 -0
  78. package/dist/resources/usage.js +19 -0
  79. package/dist/resources/workspaces.d.ts +2 -0
  80. package/dist/resources/workspaces.js +31 -0
  81. package/dist/types.d.ts +381 -0
  82. package/dist/types.js +1 -0
  83. package/package.json +65 -0
@@ -0,0 +1,167 @@
1
+ import { z } from "zod";
2
+ export declare const skillNameSchema: z.ZodString;
3
+ export declare const skillDescriptionSchema: z.ZodString;
4
+ export declare const skillMetadataSchema: z.ZodRecord<z.ZodString, z.ZodString>;
5
+ export declare const skillFrontmatterSchema: z.ZodObject<{
6
+ name: z.ZodString;
7
+ description: z.ZodString;
8
+ license: z.ZodOptional<z.ZodString>;
9
+ compatibility: z.ZodOptional<z.ZodString>;
10
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
11
+ "allowed-tools": z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strict>;
13
+ export declare const skillSchema: z.ZodObject<{
14
+ id: z.ZodString;
15
+ tenantId: z.ZodString;
16
+ agentId: z.ZodString;
17
+ name: z.ZodString;
18
+ description: z.ZodString;
19
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
20
+ createdAt: z.ZodISODateTime;
21
+ updatedAt: z.ZodISODateTime;
22
+ }, z.core.$strict>;
23
+ export declare const skillFilePathSchema: z.ZodString;
24
+ export declare const skillFileSchema: z.ZodObject<{
25
+ path: z.ZodString;
26
+ sizeBytes: z.ZodNumber;
27
+ }, z.core.$strict>;
28
+ export declare const skillDetailSchema: z.ZodObject<{
29
+ id: z.ZodString;
30
+ tenantId: z.ZodString;
31
+ agentId: z.ZodString;
32
+ name: z.ZodString;
33
+ description: z.ZodString;
34
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
35
+ createdAt: z.ZodISODateTime;
36
+ updatedAt: z.ZodISODateTime;
37
+ files: z.ZodArray<z.ZodObject<{
38
+ path: z.ZodString;
39
+ sizeBytes: z.ZodNumber;
40
+ }, z.core.$strict>>;
41
+ }, z.core.$strict>;
42
+ export declare const skillResponseSchema: z.ZodObject<{
43
+ id: z.ZodString;
44
+ tenantId: z.ZodString;
45
+ agentId: z.ZodString;
46
+ name: z.ZodString;
47
+ description: z.ZodString;
48
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
49
+ createdAt: z.ZodISODateTime;
50
+ updatedAt: z.ZodISODateTime;
51
+ files: z.ZodArray<z.ZodObject<{
52
+ path: z.ZodString;
53
+ sizeBytes: z.ZodNumber;
54
+ }, z.core.$strict>>;
55
+ }, z.core.$strict>;
56
+ export declare const skillsListQuerySchema: z.ZodObject<{
57
+ cursor: z.ZodOptional<z.ZodString>;
58
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
59
+ }, z.core.$strict>;
60
+ export declare const skillsListResponseSchema: z.ZodObject<{
61
+ data: z.ZodArray<z.ZodObject<{
62
+ id: z.ZodString;
63
+ tenantId: z.ZodString;
64
+ agentId: z.ZodString;
65
+ name: z.ZodString;
66
+ description: z.ZodString;
67
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
68
+ createdAt: z.ZodISODateTime;
69
+ updatedAt: z.ZodISODateTime;
70
+ }, z.core.$strict>>;
71
+ nextCursor: z.ZodNullable<z.ZodString>;
72
+ }, z.core.$strict>;
73
+ export declare const createSkillBodySchema: z.ZodObject<{
74
+ path: z.ZodLiteral<"SKILL.md">;
75
+ content: z.ZodString;
76
+ }, z.core.$strict>;
77
+ export declare const skillArchiveTypeSchema: z.ZodEnum<{
78
+ tar: "tar";
79
+ "tar.gz": "tar.gz";
80
+ zip: "zip";
81
+ }>;
82
+ export declare const skillUploadBodySchema: z.ZodObject<{
83
+ type: z.ZodEnum<{
84
+ tar: "tar";
85
+ "tar.gz": "tar.gz";
86
+ zip: "zip";
87
+ }>;
88
+ file: z.ZodFile;
89
+ }, z.core.$strict>;
90
+ export declare const copySkillBodySchema: z.ZodObject<{
91
+ agentIds: z.ZodArray<z.ZodString>;
92
+ }, z.core.$strict>;
93
+ export declare const skillCopyResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
94
+ agentId: z.ZodString;
95
+ status: z.ZodLiteral<"created">;
96
+ skill: z.ZodObject<{
97
+ id: z.ZodString;
98
+ tenantId: z.ZodString;
99
+ agentId: z.ZodString;
100
+ name: z.ZodString;
101
+ description: z.ZodString;
102
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
103
+ createdAt: z.ZodISODateTime;
104
+ updatedAt: z.ZodISODateTime;
105
+ files: z.ZodArray<z.ZodObject<{
106
+ path: z.ZodString;
107
+ sizeBytes: z.ZodNumber;
108
+ }, z.core.$strict>>;
109
+ }, z.core.$strict>;
110
+ }, z.core.$strict>, z.ZodObject<{
111
+ agentId: z.ZodString;
112
+ status: z.ZodLiteral<"failed">;
113
+ error: z.ZodObject<{
114
+ code: z.ZodString;
115
+ message: z.ZodString;
116
+ details: z.ZodOptional<z.ZodUnknown>;
117
+ }, z.core.$strict>;
118
+ }, z.core.$strict>], "status">;
119
+ export declare const skillCopyResultsSchema: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
120
+ agentId: z.ZodString;
121
+ status: z.ZodLiteral<"created">;
122
+ skill: z.ZodObject<{
123
+ id: z.ZodString;
124
+ tenantId: z.ZodString;
125
+ agentId: z.ZodString;
126
+ name: z.ZodString;
127
+ description: z.ZodString;
128
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
129
+ createdAt: z.ZodISODateTime;
130
+ updatedAt: z.ZodISODateTime;
131
+ files: z.ZodArray<z.ZodObject<{
132
+ path: z.ZodString;
133
+ sizeBytes: z.ZodNumber;
134
+ }, z.core.$strict>>;
135
+ }, z.core.$strict>;
136
+ }, z.core.$strict>, z.ZodObject<{
137
+ agentId: z.ZodString;
138
+ status: z.ZodLiteral<"failed">;
139
+ error: z.ZodObject<{
140
+ code: z.ZodString;
141
+ message: z.ZodString;
142
+ details: z.ZodOptional<z.ZodUnknown>;
143
+ }, z.core.$strict>;
144
+ }, z.core.$strict>], "status">>;
145
+ export interface SkillMarkdownFrontmatterParseSuccess {
146
+ frontmatter: SkillFrontmatter;
147
+ success: true;
148
+ }
149
+ export interface SkillMarkdownFrontmatterParseFailure {
150
+ message: string;
151
+ success: false;
152
+ }
153
+ export type SkillMarkdownFrontmatterParseResult = SkillMarkdownFrontmatterParseSuccess | SkillMarkdownFrontmatterParseFailure;
154
+ export declare function parseSkillMarkdownFrontmatter(content: string): SkillMarkdownFrontmatterParseResult;
155
+ export type Skill = z.infer<typeof skillSchema>;
156
+ export type SkillDetail = z.infer<typeof skillDetailSchema>;
157
+ export type SkillResponse = z.infer<typeof skillResponseSchema>;
158
+ export type SkillFile = z.infer<typeof skillFileSchema>;
159
+ export type SkillFrontmatter = z.infer<typeof skillFrontmatterSchema>;
160
+ export type SkillsListQuery = z.infer<typeof skillsListQuerySchema>;
161
+ export type SkillsListResponse = z.infer<typeof skillsListResponseSchema>;
162
+ export type CreateSkillBody = z.infer<typeof createSkillBodySchema>;
163
+ export type SkillArchiveType = z.infer<typeof skillArchiveTypeSchema>;
164
+ export type SkillUploadBody = z.infer<typeof skillUploadBodySchema>;
165
+ export type CopySkillBody = z.infer<typeof copySkillBodySchema>;
166
+ export type SkillCopyResult = z.infer<typeof skillCopyResultSchema>;
167
+ export type SkillCopyResults = z.infer<typeof skillCopyResultsSchema>;
@@ -0,0 +1,153 @@
1
+ import { parseDocument } from "yaml";
2
+ import { z } from "zod";
3
+ import { cursorSchema, paginatedResponseSchema } from "../api.js";
4
+ import { agentIdSchema, skillIdSchema, tenantIdSchema } from "../ids.js";
5
+ import { DEFAULT_SKILLS_LIST_LIMIT, MAX_SKILL_COMPATIBILITY_LENGTH, MAX_SKILL_COPY_DESTINATIONS, MAX_SKILL_DESCRIPTION_LENGTH, MAX_SKILL_NAME_LENGTH, MAX_SKILLS_LIST_LIMIT, } from "../limitations.js";
6
+ import { hasUniqueValues } from "../utils.js";
7
+ export const skillNameSchema = z
8
+ .string()
9
+ .min(1, { message: "Name is required." })
10
+ .max(MAX_SKILL_NAME_LENGTH)
11
+ .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, {
12
+ message: "Name must use lowercase letters, numbers, and single internal hyphens.",
13
+ })
14
+ .refine((name) => name !== "anthropic" && name !== "claude", {
15
+ message: "Name is reserved.",
16
+ });
17
+ export const skillDescriptionSchema = z
18
+ .string()
19
+ .trim()
20
+ .min(1, { message: "Description is required." })
21
+ .max(MAX_SKILL_DESCRIPTION_LENGTH);
22
+ export const skillMetadataSchema = z.record(z.string(), z.string());
23
+ export const skillFrontmatterSchema = z
24
+ .object({
25
+ name: skillNameSchema,
26
+ description: skillDescriptionSchema,
27
+ license: z.string().optional(),
28
+ compatibility: z.string().max(MAX_SKILL_COMPATIBILITY_LENGTH).optional(),
29
+ metadata: skillMetadataSchema.optional(),
30
+ "allowed-tools": z.string().optional(),
31
+ })
32
+ .strict();
33
+ export const skillSchema = z
34
+ .object({
35
+ id: skillIdSchema,
36
+ tenantId: tenantIdSchema,
37
+ agentId: agentIdSchema,
38
+ name: skillNameSchema,
39
+ description: skillDescriptionSchema,
40
+ metadata: skillMetadataSchema.optional(),
41
+ createdAt: z.iso.datetime({ offset: true }),
42
+ updatedAt: z.iso.datetime({ offset: true }),
43
+ })
44
+ .strict();
45
+ export const skillFilePathSchema = z
46
+ .string()
47
+ .min(1)
48
+ .refine((path) => {
49
+ if (path.startsWith("/") || path.includes("\0")) {
50
+ return false;
51
+ }
52
+ const segments = path.split("/");
53
+ return segments.every((segment) => segment.length > 0 && segment !== "." && segment !== "..");
54
+ }, { message: "Path must be a safe relative file path." });
55
+ export const skillFileSchema = z
56
+ .object({
57
+ path: skillFilePathSchema,
58
+ sizeBytes: z.number().int().nonnegative(),
59
+ })
60
+ .strict();
61
+ export const skillDetailSchema = skillSchema
62
+ .extend({
63
+ files: z.array(skillFileSchema),
64
+ })
65
+ .strict();
66
+ export const skillResponseSchema = skillDetailSchema;
67
+ export const skillsListQuerySchema = z
68
+ .object({
69
+ cursor: cursorSchema.optional(),
70
+ limit: z.coerce
71
+ .number()
72
+ .int()
73
+ .min(1)
74
+ .max(MAX_SKILLS_LIST_LIMIT)
75
+ .default(DEFAULT_SKILLS_LIST_LIMIT),
76
+ })
77
+ .strict();
78
+ export const skillsListResponseSchema = paginatedResponseSchema(skillSchema);
79
+ export const createSkillBodySchema = z
80
+ .object({
81
+ path: z.literal("SKILL.md"),
82
+ content: z.string(),
83
+ })
84
+ .strict();
85
+ export const skillArchiveTypeSchema = z.enum(["zip", "tar", "tar.gz"]);
86
+ export const skillUploadBodySchema = z
87
+ .object({
88
+ type: skillArchiveTypeSchema,
89
+ file: z.file(),
90
+ })
91
+ .strict();
92
+ export const copySkillBodySchema = z
93
+ .object({
94
+ agentIds: z
95
+ .array(agentIdSchema)
96
+ .min(1)
97
+ .max(MAX_SKILL_COPY_DESTINATIONS)
98
+ .refine(hasUniqueValues, {
99
+ message: "Destination Agent ids must be unique.",
100
+ }),
101
+ })
102
+ .strict();
103
+ const skillCopyCreatedResultSchema = z
104
+ .object({
105
+ agentId: agentIdSchema,
106
+ status: z.literal("created"),
107
+ skill: skillDetailSchema,
108
+ })
109
+ .strict();
110
+ const skillCopyFailedResultSchema = z
111
+ .object({
112
+ agentId: agentIdSchema,
113
+ status: z.literal("failed"),
114
+ error: z
115
+ .object({
116
+ code: z.string().min(1),
117
+ message: z.string().min(1),
118
+ details: z.unknown().optional(),
119
+ })
120
+ .strict(),
121
+ })
122
+ .strict();
123
+ export const skillCopyResultSchema = z.discriminatedUnion("status", [
124
+ skillCopyCreatedResultSchema,
125
+ skillCopyFailedResultSchema,
126
+ ]);
127
+ export const skillCopyResultsSchema = z.array(skillCopyResultSchema);
128
+ const frontmatterPattern = /^---\n([\s\S]*?)\n---(?:\n|$)/;
129
+ export function parseSkillMarkdownFrontmatter(content) {
130
+ const normalized = content.replaceAll("\r\n", "\n");
131
+ const match = frontmatterPattern.exec(normalized);
132
+ if (!match) {
133
+ return {
134
+ message: "SKILL.md must start with frontmatter.",
135
+ success: false,
136
+ };
137
+ }
138
+ const document = parseDocument(match[1]);
139
+ if (document.errors.length > 0) {
140
+ return {
141
+ message: `SKILL.md frontmatter is not valid YAML: ${document.errors[0].message}`,
142
+ success: false,
143
+ };
144
+ }
145
+ const result = skillFrontmatterSchema.safeParse(document.toJS());
146
+ if (!result.success) {
147
+ return {
148
+ message: "SKILL.md frontmatter does not match the accepted contract.",
149
+ success: false,
150
+ };
151
+ }
152
+ return { frontmatter: result.data, success: true };
153
+ }