march-ai-sdk 0.3.0 → 0.4.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/README.md +115 -10
- package/dist/{app-C_umwZXh.d.ts → app-Cf_umb8u.d.ts} +49 -51
- package/dist/extensions/langgraph.d.ts +1 -1
- package/dist/extensions/vercel-ai.d.ts +1 -1
- package/dist/index.d.ts +284 -4
- package/dist/index.js +357 -49
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +18 -4
- package/src/streamer.ts +22 -27
- package/src/structural/artifact.ts +97 -0
- package/src/structural/base.ts +83 -0
- package/src/structural/index.ts +12 -0
- package/src/structural/stepper.ts +131 -0
- package/src/structural/surface.ts +93 -0
- package/src/structural/text-block.ts +102 -0
- package/src/artifact.ts +0 -59
package/src/artifact.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* March Agent SDK - Artifact Types
|
|
3
|
-
* Port of Python march_agent/artifact.py
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { z } from 'zod'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Valid artifact types for message attachments
|
|
10
|
-
*/
|
|
11
|
-
export const ArtifactTypeSchema = z.enum([
|
|
12
|
-
'document',
|
|
13
|
-
'image',
|
|
14
|
-
'iframe',
|
|
15
|
-
'video',
|
|
16
|
-
'audio',
|
|
17
|
-
'code',
|
|
18
|
-
'link',
|
|
19
|
-
'file',
|
|
20
|
-
])
|
|
21
|
-
|
|
22
|
-
export type ArtifactType = z.infer<typeof ArtifactTypeSchema>
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Schema for artifact validation
|
|
26
|
-
*/
|
|
27
|
-
export const ArtifactSchema = z.object({
|
|
28
|
-
url: z.string(),
|
|
29
|
-
type: ArtifactTypeSchema,
|
|
30
|
-
title: z.string().optional(),
|
|
31
|
-
description: z.string().optional(),
|
|
32
|
-
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
export type Artifact = z.infer<typeof ArtifactSchema>
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Input type for adding artifacts (without strict validation)
|
|
39
|
-
*/
|
|
40
|
-
export interface ArtifactInput {
|
|
41
|
-
url: string
|
|
42
|
-
type: ArtifactType | string
|
|
43
|
-
title?: string
|
|
44
|
-
description?: string
|
|
45
|
-
metadata?: Record<string, unknown>
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Convert artifact input to validated artifact
|
|
50
|
-
*/
|
|
51
|
-
export function toArtifact(input: ArtifactInput): Artifact {
|
|
52
|
-
return ArtifactSchema.parse({
|
|
53
|
-
url: input.url,
|
|
54
|
-
type: input.type,
|
|
55
|
-
title: input.title,
|
|
56
|
-
description: input.description,
|
|
57
|
-
metadata: input.metadata,
|
|
58
|
-
})
|
|
59
|
-
}
|