saeeol 1.2.0 → 1.2.2
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 +14 -14
- package/src/cli/cmd/tui/component/dialog/dialog-agent.tsx +32 -0
- package/src/cli/cmd/tui/component/dialog/dialog-command.tsx +190 -0
- package/src/cli/cmd/tui/component/dialog/dialog-console-org.tsx +103 -0
- package/src/cli/cmd/tui/component/dialog/dialog-go-upsell.tsx +159 -0
- package/src/cli/cmd/tui/component/dialog/dialog-mcp.tsx +86 -0
- package/src/cli/cmd/tui/component/dialog/dialog-model.tsx +238 -0
- package/src/cli/cmd/tui/component/dialog/dialog-provider.tsx +343 -0
- package/src/cli/cmd/tui/component/dialog/dialog-session-delete-failed.tsx +103 -0
- package/src/cli/cmd/tui/component/dialog/dialog-session-list.tsx +301 -0
- package/src/cli/cmd/tui/component/dialog/dialog-session-rename.tsx +35 -0
- package/src/cli/cmd/tui/component/dialog/dialog-skill.tsx +37 -0
- package/src/cli/cmd/tui/component/dialog/dialog-stash.tsx +87 -0
- package/src/cli/cmd/tui/component/dialog/dialog-status.tsx +190 -0
- package/src/cli/cmd/tui/component/dialog/dialog-tag.tsx +44 -0
- package/src/cli/cmd/tui/component/dialog/dialog-theme-list.tsx +50 -0
- package/src/cli/cmd/tui/component/dialog/dialog-variant.tsx +39 -0
- package/src/cli/cmd/tui/component/dialog/dialog-workspace-create.tsx +200 -0
- package/src/cli/cmd/tui/component/dialog/dialog-workspace-unavailable.tsx +81 -0
- package/src/cli/cmd/tui/component/dialog-agent.tsx +1 -32
- package/src/cli/cmd/tui/component/dialog-command.tsx +1 -190
- package/src/cli/cmd/tui/component/dialog-console-org.tsx +1 -103
- package/src/cli/cmd/tui/component/dialog-go-upsell.tsx +1 -159
- package/src/cli/cmd/tui/component/dialog-mcp.tsx +1 -86
- package/src/cli/cmd/tui/component/dialog-model.tsx +1 -238
- package/src/cli/cmd/tui/component/dialog-provider.tsx +1 -343
- package/src/cli/cmd/tui/component/dialog-session-delete-failed.tsx +1 -103
- package/src/cli/cmd/tui/component/dialog-session-list.tsx +1 -301
- package/src/cli/cmd/tui/component/dialog-session-rename.tsx +1 -35
- package/src/cli/cmd/tui/component/dialog-skill.tsx +1 -37
- package/src/cli/cmd/tui/component/dialog-stash.tsx +1 -87
- package/src/cli/cmd/tui/component/dialog-status.tsx +1 -190
- package/src/cli/cmd/tui/component/dialog-tag.tsx +1 -44
- package/src/cli/cmd/tui/component/dialog-theme-list.tsx +1 -50
- package/src/cli/cmd/tui/component/dialog-variant.tsx +1 -39
- package/src/cli/cmd/tui/component/dialog-workspace-create.tsx +1 -200
- package/src/cli/cmd/tui/component/dialog-workspace-unavailable.tsx +1 -81
- package/src/session/compaction-helpers.ts +1 -169
- package/src/session/compaction.ts +1 -712
- package/src/session/core/compaction/compaction-helpers.ts +169 -0
- package/src/session/core/compaction/compaction.ts +712 -0
- package/src/session/core/compaction/overflow.ts +28 -0
- package/src/session/core/instruction.ts +234 -0
- package/src/session/core/llm.ts +504 -0
- package/src/session/core/network.ts +392 -0
- package/src/session/core/processor.ts +731 -0
- package/src/session/core/projectors.ts +139 -0
- package/src/session/core/resolve-tools.ts +241 -0
- package/src/session/core/retry.ts +149 -0
- package/src/session/core/revert.ts +173 -0
- package/src/session/core/run-state.ts +110 -0
- package/src/session/core/schema.ts +35 -0
- package/src/session/core/session-types.ts +160 -0
- package/src/session/core/session.sql.ts +124 -0
- package/src/session/core/session.ts +948 -0
- package/src/session/core/shell-exec.ts +205 -0
- package/src/session/core/status.ts +100 -0
- package/src/session/core/subtask.ts +268 -0
- package/src/session/core/summary.ts +173 -0
- package/src/session/core/system.ts +114 -0
- package/src/session/core/todo.ts +86 -0
- package/src/session/core/user-part.ts +293 -0
- package/src/session/instruction.ts +1 -234
- package/src/session/llm.ts +1 -504
- package/src/session/message/message-errors.ts +83 -0
- package/src/session/message/message-parts.ts +89 -0
- package/src/session/message/message-query.ts +107 -0
- package/src/session/message/message-transform.ts +156 -0
- package/src/session/message/message-types.ts +68 -0
- package/src/session/message/message-v2.ts +73 -0
- package/src/session/message/message.ts +192 -0
- package/src/session/message-errors.ts +1 -83
- package/src/session/message-parts.ts +1 -89
- package/src/session/message-query.ts +1 -107
- package/src/session/message-transform.ts +1 -156
- package/src/session/message-types.ts +1 -68
- package/src/session/message-v2.ts +1 -73
- package/src/session/message.ts +1 -192
- package/src/session/network.ts +1 -392
- package/src/session/overflow.ts +1 -28
- package/src/session/processor.ts +1 -731
- package/src/session/projectors.ts +2 -139
- package/src/session/prompt/prompt-command.ts +93 -0
- package/src/session/prompt/prompt-loop.ts +299 -0
- package/src/session/prompt/prompt-model.ts +44 -0
- package/src/session/prompt/prompt-reminders.ts +120 -0
- package/src/session/prompt/prompt-resolve.ts +42 -0
- package/src/session/prompt/prompt-schemas.ts +128 -0
- package/src/session/prompt/prompt-title.ts +55 -0
- package/src/session/prompt/prompt-types.ts +47 -0
- package/src/session/prompt/prompt-user-msg.ts +80 -0
- package/src/session/prompt/prompt.ts +211 -0
- package/src/session/prompt-command.ts +1 -93
- package/src/session/prompt-loop.ts +1 -299
- package/src/session/prompt-model.ts +1 -44
- package/src/session/prompt-reminders.ts +1 -120
- package/src/session/prompt-resolve.ts +1 -42
- package/src/session/prompt-schemas.ts +1 -128
- package/src/session/prompt-title.ts +1 -55
- package/src/session/prompt-types.ts +1 -47
- package/src/session/prompt-user-msg.ts +1 -80
- package/src/session/prompt.ts +1 -211
- package/src/session/resolve-tools.ts +1 -241
- package/src/session/retry.ts +1 -149
- package/src/session/revert.ts +1 -173
- package/src/session/run-state.ts +1 -110
- package/src/session/schema.ts +1 -35
- package/src/session/session-types.ts +1 -160
- package/src/session/session.sql.ts +1 -124
- package/src/session/session.ts +1 -948
- package/src/session/shell-exec.ts +1 -205
- package/src/session/status.ts +1 -100
- package/src/session/subtask.ts +1 -268
- package/src/session/summary.ts +1 -173
- package/src/session/system.ts +1 -114
- package/src/session/todo.ts +1 -86
- package/src/session/user-part.ts +1 -293
- package/src/tool/apply_patch.ts +1 -334
- package/src/tool/bash.ts +1 -656
- package/src/tool/core/external-directory.ts +55 -0
- package/src/tool/core/invalid.ts +21 -0
- package/src/tool/core/recall.ts +164 -0
- package/src/tool/core/recall.txt +12 -0
- package/src/tool/core/schema.ts +16 -0
- package/src/tool/core/tool.ts +162 -0
- package/src/tool/core/truncate.ts +160 -0
- package/src/tool/core/truncation-dir.ts +4 -0
- package/src/tool/diagnostics.ts +1 -20
- package/src/tool/edit-replacers.ts +1 -288
- package/src/tool/edit-utils.ts +1 -86
- package/src/tool/edit.ts +1 -262
- package/src/tool/external-directory.ts +1 -55
- package/src/tool/file/apply_patch.ts +334 -0
- package/src/tool/file/apply_patch.txt +33 -0
- package/src/tool/file/bash.ts +656 -0
- package/src/tool/file/bash.txt +119 -0
- package/src/tool/file/edit-replacers.ts +288 -0
- package/src/tool/file/edit-utils.ts +86 -0
- package/src/tool/file/edit.ts +262 -0
- package/src/tool/file/edit.txt +10 -0
- package/src/tool/file/read.ts +389 -0
- package/src/tool/file/read.txt +14 -0
- package/src/tool/file/write.ts +114 -0
- package/src/tool/file/write.txt +8 -0
- package/src/tool/glob.ts +1 -115
- package/src/tool/grep.ts +1 -151
- package/src/tool/integration/diagnostics.ts +20 -0
- package/src/tool/integration/lsp.ts +113 -0
- package/src/tool/integration/lsp.txt +24 -0
- package/src/tool/integration/mcp-exa.ts +73 -0
- package/src/tool/integration/package.ts +168 -0
- package/src/tool/integration/registry.ts +375 -0
- package/src/tool/invalid.ts +1 -21
- package/src/tool/lsp.ts +1 -113
- package/src/tool/mcp-exa.ts +1 -73
- package/src/tool/package.ts +1 -168
- package/src/tool/plan.ts +1 -30
- package/src/tool/question.ts +1 -52
- package/src/tool/read.ts +1 -389
- package/src/tool/recall.ts +1 -164
- package/src/tool/registry.ts +1 -375
- package/src/tool/schema.ts +1 -16
- package/src/tool/search/glob.ts +115 -0
- package/src/tool/search/glob.txt +6 -0
- package/src/tool/search/grep.ts +151 -0
- package/src/tool/search/grep.txt +8 -0
- package/src/tool/search/warpgrep.ts +107 -0
- package/src/tool/search/warpgrep.txt +10 -0
- package/src/tool/search/webfetch.ts +202 -0
- package/src/tool/search/webfetch.txt +13 -0
- package/src/tool/search/websearch.ts +71 -0
- package/src/tool/search/websearch.txt +14 -0
- package/src/tool/skill.ts +1 -91
- package/src/tool/task.ts +1 -197
- package/src/tool/todo.ts +1 -62
- package/src/tool/tool.ts +1 -162
- package/src/tool/truncate.ts +1 -160
- package/src/tool/truncation-dir.ts +1 -4
- package/src/tool/warpgrep.ts +1 -107
- package/src/tool/webfetch.ts +1 -202
- package/src/tool/websearch.ts +1 -71
- package/src/tool/workflow/plan-enter.txt +14 -0
- package/src/tool/workflow/plan-exit.txt +13 -0
- package/src/tool/workflow/plan.ts +30 -0
- package/src/tool/workflow/question.ts +52 -0
- package/src/tool/workflow/question.txt +11 -0
- package/src/tool/workflow/skill.ts +91 -0
- package/src/tool/workflow/skill.txt +5 -0
- package/src/tool/workflow/task.ts +197 -0
- package/src/tool/workflow/task.txt +57 -0
- package/src/tool/workflow/todo.ts +62 -0
- package/src/tool/workflow/todowrite.txt +167 -0
- package/src/tool/write.ts +1 -114
|
@@ -1,68 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { SessionID, MessageID, PartID } from "./schema"
|
|
4
|
-
import { Snapshot } from "@/snapshot"
|
|
5
|
-
import { SyncEvent } from "../sync"
|
|
6
|
-
import { BusEvent } from "@/bus/bus-event"
|
|
7
|
-
import { Effect, Schema, Types } from "effect"
|
|
8
|
-
import { zod } from "@/util/effect-zod"
|
|
9
|
-
import { NonNegativeInt, withStatics } from "@/util/schema"
|
|
10
|
-
import { ModelID, ProviderID } from "@/provider/schema"
|
|
11
|
-
import { _Part } from "./message-parts"
|
|
12
|
-
import { AssistantErrorSchema, AssistantErrorZod, _Format } from "./message-errors"
|
|
13
|
-
export { AssistantErrorSchema, AssistantErrorZod, _Format, _Part as Part }
|
|
14
|
-
export type { AssistantError } from "./message-errors"
|
|
15
|
-
import z from "zod"
|
|
16
|
-
|
|
17
|
-
const messageBase = { id: MessageID, sessionID: SessionID }
|
|
18
|
-
|
|
19
|
-
export const EditorContext = Schema.Struct({
|
|
20
|
-
visibleFiles: Schema.optional(Schema.Array(Schema.String)), openTabs: Schema.optional(Schema.Array(Schema.String)),
|
|
21
|
-
activeFile: Schema.optional(Schema.String), shell: Schema.optional(Schema.String),
|
|
22
|
-
})
|
|
23
|
-
export type EditorContext = Types.DeepMutable<Schema.Schema.Type<typeof EditorContext>>
|
|
24
|
-
|
|
25
|
-
export const User = Schema.Struct({
|
|
26
|
-
...messageBase, role: Schema.Literal("user"), time: Schema.Struct({ created: NonNegativeInt }), format: Schema.optional(_Format),
|
|
27
|
-
summary: Schema.optional(Schema.Struct({ title: Schema.optional(Schema.String), body: Schema.optional(Schema.String), diffs: Schema.Array(Snapshot.FileDiff) })),
|
|
28
|
-
agent: Schema.String, model: Schema.Struct({ providerID: ProviderID, modelID: ModelID, variant: Schema.optional(Schema.String) }),
|
|
29
|
-
system: Schema.optional(Schema.String), tools: Schema.optional(Schema.Record(Schema.String, Schema.Boolean)), editorContext: Schema.optional(EditorContext),
|
|
30
|
-
}).annotate({ identifier: "UserMessage" }).pipe(withStatics((s) => ({ zod: zod(s) })))
|
|
31
|
-
export type User = Types.DeepMutable<Schema.Schema.Type<typeof User>>
|
|
32
|
-
|
|
33
|
-
export const Assistant = Schema.Struct({
|
|
34
|
-
...messageBase, role: Schema.Literal("assistant"), time: Schema.Struct({ created: NonNegativeInt, completed: Schema.optional(NonNegativeInt) }),
|
|
35
|
-
error: Schema.optional(AssistantErrorSchema), parentID: MessageID, modelID: ModelID, providerID: ProviderID, mode: Schema.String, agent: Schema.String,
|
|
36
|
-
path: Schema.Struct({ cwd: Schema.String, root: Schema.String }), summary: Schema.optional(Schema.Boolean), cost: Schema.Finite,
|
|
37
|
-
tokens: Schema.Struct({ total: Schema.optional(NonNegativeInt), input: NonNegativeInt, output: NonNegativeInt, reasoning: NonNegativeInt, cache: Schema.Struct({ read: NonNegativeInt, write: NonNegativeInt }) }),
|
|
38
|
-
structured: Schema.optional(Schema.Any), variant: Schema.optional(Schema.String), finish: Schema.optional(Schema.String),
|
|
39
|
-
}).annotate({ identifier: "AssistantMessage" }).pipe(withStatics((s) => ({ zod: zod(s) })))
|
|
40
|
-
export type Assistant = Omit<Types.DeepMutable<Schema.Schema.Type<typeof Assistant>>, "error"> & { error?: import("./message-errors").AssistantError }
|
|
41
|
-
|
|
42
|
-
const _Info = Schema.Union([User, Assistant]).annotate({ discriminator: "role", identifier: "Message" })
|
|
43
|
-
export const Info = Object.assign(_Info, { zod: zod(_Info) as unknown as z.ZodType<User | Assistant> })
|
|
44
|
-
export type Info = User | Assistant
|
|
45
|
-
|
|
46
|
-
export const WithParts = Schema.Struct({ info: _Info, parts: Schema.Array(_Part) }).pipe(withStatics((s) => ({ zod: zod(s) })))
|
|
47
|
-
export type WithParts = { info: Info; parts: import("./message-parts").Part[] }
|
|
48
|
-
|
|
49
|
-
const UpdatedEventSchema = Schema.Struct({ sessionID: SessionID, info: _Info })
|
|
50
|
-
const RemovedEventSchema = Schema.Struct({ sessionID: SessionID, messageID: MessageID })
|
|
51
|
-
const PartUpdatedEventSchema = Schema.Struct({ sessionID: SessionID, part: _Part, time: NonNegativeInt })
|
|
52
|
-
const PartRemovedEventSchema = Schema.Struct({ sessionID: SessionID, messageID: MessageID, partID: PartID })
|
|
53
|
-
|
|
54
|
-
export const Event = {
|
|
55
|
-
Updated: SyncEvent.define({ type: "message.updated", version: 1, aggregate: "sessionID", schema: UpdatedEventSchema }),
|
|
56
|
-
Removed: SyncEvent.define({ type: "message.removed", version: 1, aggregate: "sessionID", schema: RemovedEventSchema }),
|
|
57
|
-
PartUpdated: SyncEvent.define({ type: "message.part.updated", version: 1, aggregate: "sessionID", schema: PartUpdatedEventSchema }),
|
|
58
|
-
PartDelta: BusEvent.define("message.part.delta", Schema.Struct({ sessionID: SessionID, messageID: MessageID, partID: PartID, field: Schema.String, delta: Schema.String })),
|
|
59
|
-
PartRemoved: SyncEvent.define({ type: "message.part.removed", version: 1, aggregate: "sessionID", schema: PartRemovedEventSchema }),
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const Cursor = Schema.Struct({ id: MessageID, time: Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0)) })
|
|
63
|
-
type Cursor = typeof Cursor.Type
|
|
64
|
-
const decodeCursor = Schema.decodeUnknownSync(Cursor)
|
|
65
|
-
export const cursor = {
|
|
66
|
-
encode(input: Cursor) { return Buffer.from(JSON.stringify(input)).toString("base64url") },
|
|
67
|
-
decode(input: string) { return decodeCursor(JSON.parse(Buffer.from(input, "base64url").toString("utf8"))) },
|
|
68
|
-
}
|
|
1
|
+
export * from "./message/message-types"
|
|
@@ -1,73 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
OutputLengthError,
|
|
3
|
-
AbortedError,
|
|
4
|
-
StructuredOutputError,
|
|
5
|
-
AuthError,
|
|
6
|
-
APIError,
|
|
7
|
-
ContextOverflowError,
|
|
8
|
-
OutputFormatText,
|
|
9
|
-
OutputFormatJsonSchema,
|
|
10
|
-
Format,
|
|
11
|
-
fromError,
|
|
12
|
-
} from "./message-errors"
|
|
13
|
-
export type { OutputFormat } from "./message-errors"
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
SnapshotPart,
|
|
17
|
-
PatchPart,
|
|
18
|
-
TextPart,
|
|
19
|
-
ReasoningPart,
|
|
20
|
-
FileSource,
|
|
21
|
-
SymbolSource,
|
|
22
|
-
ResourceSource,
|
|
23
|
-
FilePartSource,
|
|
24
|
-
FilePart,
|
|
25
|
-
AgentPart,
|
|
26
|
-
CompactionPart,
|
|
27
|
-
SubtaskPart,
|
|
28
|
-
RetryPart,
|
|
29
|
-
StepStartPart,
|
|
30
|
-
StepFinishPart,
|
|
31
|
-
ToolStatePending,
|
|
32
|
-
ToolStateRunning,
|
|
33
|
-
ToolStateCompleted,
|
|
34
|
-
ToolStateError,
|
|
35
|
-
ToolState,
|
|
36
|
-
ToolPart,
|
|
37
|
-
truncateToolOutput,
|
|
38
|
-
TextPartInput,
|
|
39
|
-
FilePartInput,
|
|
40
|
-
AgentPartInput,
|
|
41
|
-
SubtaskPartInput,
|
|
42
|
-
Part,
|
|
43
|
-
} from "./message-parts"
|
|
44
|
-
|
|
45
|
-
export {
|
|
46
|
-
EditorContext,
|
|
47
|
-
User,
|
|
48
|
-
Assistant,
|
|
49
|
-
Info,
|
|
50
|
-
WithParts,
|
|
51
|
-
Event,
|
|
52
|
-
cursor,
|
|
53
|
-
} from "./message-types"
|
|
54
|
-
|
|
55
|
-
export {
|
|
56
|
-
SYNTHETIC_ATTACHMENT_PROMPT,
|
|
57
|
-
isMedia,
|
|
58
|
-
stripPartMetadata,
|
|
59
|
-
stripMessageMetadata,
|
|
60
|
-
toModelMessagesEffect,
|
|
61
|
-
toModelMessages,
|
|
62
|
-
} from "./message-transform"
|
|
63
|
-
|
|
64
|
-
export {
|
|
65
|
-
page,
|
|
66
|
-
stream,
|
|
67
|
-
parts,
|
|
68
|
-
get,
|
|
69
|
-
filterCompacted,
|
|
70
|
-
filterCompactedEffect,
|
|
71
|
-
} from "./message-query"
|
|
72
|
-
|
|
73
|
-
export * as MessageV2 from "./message-v2"
|
|
1
|
+
export * from "./message/message-v2"
|
package/src/session/message.ts
CHANGED
|
@@ -1,192 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { SessionID } from "./schema"
|
|
3
|
-
import { ModelID, ProviderID } from "../provider/schema"
|
|
4
|
-
import { zod } from "@/util/effect-zod"
|
|
5
|
-
import { NonNegativeInt, withStatics } from "@/util/schema"
|
|
6
|
-
import { namedSchemaError } from "@/util/named-schema-error"
|
|
7
|
-
|
|
8
|
-
export const OutputLengthError = namedSchemaError("MessageOutputLengthError", {})
|
|
9
|
-
export const AuthError = namedSchemaError("ProviderAuthError", {
|
|
10
|
-
providerID: Schema.String,
|
|
11
|
-
message: Schema.String,
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
const AuthErrorEffect = Schema.Struct({
|
|
15
|
-
name: Schema.Literal("ProviderAuthError"),
|
|
16
|
-
data: Schema.Struct({
|
|
17
|
-
providerID: Schema.String,
|
|
18
|
-
message: Schema.String,
|
|
19
|
-
}),
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
const OutputLengthErrorEffect = Schema.Struct({
|
|
23
|
-
name: Schema.Literal("MessageOutputLengthError"),
|
|
24
|
-
data: Schema.Struct({}),
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
const UnknownErrorEffect = Schema.Struct({
|
|
28
|
-
name: Schema.Literal("UnknownError"),
|
|
29
|
-
data: Schema.Struct({
|
|
30
|
-
message: Schema.String,
|
|
31
|
-
}),
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
export const ToolCall = Schema.Struct({
|
|
35
|
-
state: Schema.Literal("call"),
|
|
36
|
-
step: Schema.optional(NonNegativeInt),
|
|
37
|
-
toolCallId: Schema.String,
|
|
38
|
-
toolName: Schema.String,
|
|
39
|
-
args: Schema.Unknown,
|
|
40
|
-
})
|
|
41
|
-
.annotate({ identifier: "ToolCall" })
|
|
42
|
-
.pipe(withStatics((s) => ({ zod: zod(s) })))
|
|
43
|
-
export type ToolCall = Schema.Schema.Type<typeof ToolCall>
|
|
44
|
-
|
|
45
|
-
export const ToolPartialCall = Schema.Struct({
|
|
46
|
-
state: Schema.Literal("partial-call"),
|
|
47
|
-
step: Schema.optional(NonNegativeInt),
|
|
48
|
-
toolCallId: Schema.String,
|
|
49
|
-
toolName: Schema.String,
|
|
50
|
-
args: Schema.Unknown,
|
|
51
|
-
})
|
|
52
|
-
.annotate({ identifier: "ToolPartialCall" })
|
|
53
|
-
.pipe(withStatics((s) => ({ zod: zod(s) })))
|
|
54
|
-
export type ToolPartialCall = Schema.Schema.Type<typeof ToolPartialCall>
|
|
55
|
-
|
|
56
|
-
export const ToolResult = Schema.Struct({
|
|
57
|
-
state: Schema.Literal("result"),
|
|
58
|
-
step: Schema.optional(NonNegativeInt),
|
|
59
|
-
toolCallId: Schema.String,
|
|
60
|
-
toolName: Schema.String,
|
|
61
|
-
args: Schema.Unknown,
|
|
62
|
-
result: Schema.String,
|
|
63
|
-
})
|
|
64
|
-
.annotate({ identifier: "ToolResult" })
|
|
65
|
-
.pipe(withStatics((s) => ({ zod: zod(s) })))
|
|
66
|
-
export type ToolResult = Schema.Schema.Type<typeof ToolResult>
|
|
67
|
-
|
|
68
|
-
export const ToolInvocation = Schema.Union([ToolCall, ToolPartialCall, ToolResult])
|
|
69
|
-
.annotate({ identifier: "ToolInvocation", discriminator: "state" })
|
|
70
|
-
.pipe(withStatics((s) => ({ zod: zod(s) })))
|
|
71
|
-
export type ToolInvocation = Schema.Schema.Type<typeof ToolInvocation>
|
|
72
|
-
|
|
73
|
-
export const TextPart = Schema.Struct({
|
|
74
|
-
type: Schema.Literal("text"),
|
|
75
|
-
text: Schema.String,
|
|
76
|
-
})
|
|
77
|
-
.annotate({ identifier: "TextPart" })
|
|
78
|
-
.pipe(withStatics((s) => ({ zod: zod(s) })))
|
|
79
|
-
export type TextPart = Schema.Schema.Type<typeof TextPart>
|
|
80
|
-
|
|
81
|
-
export const ReasoningPart = Schema.Struct({
|
|
82
|
-
type: Schema.Literal("reasoning"),
|
|
83
|
-
text: Schema.String,
|
|
84
|
-
providerMetadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
|
|
85
|
-
})
|
|
86
|
-
.annotate({ identifier: "ReasoningPart" })
|
|
87
|
-
.pipe(withStatics((s) => ({ zod: zod(s) })))
|
|
88
|
-
export type ReasoningPart = Schema.Schema.Type<typeof ReasoningPart>
|
|
89
|
-
|
|
90
|
-
export const ToolInvocationPart = Schema.Struct({
|
|
91
|
-
type: Schema.Literal("tool-invocation"),
|
|
92
|
-
toolInvocation: ToolInvocation,
|
|
93
|
-
})
|
|
94
|
-
.annotate({ identifier: "ToolInvocationPart" })
|
|
95
|
-
.pipe(withStatics((s) => ({ zod: zod(s) })))
|
|
96
|
-
export type ToolInvocationPart = Schema.Schema.Type<typeof ToolInvocationPart>
|
|
97
|
-
|
|
98
|
-
export const SourceUrlPart = Schema.Struct({
|
|
99
|
-
type: Schema.Literal("source-url"),
|
|
100
|
-
sourceId: Schema.String,
|
|
101
|
-
url: Schema.String,
|
|
102
|
-
title: Schema.optional(Schema.String),
|
|
103
|
-
providerMetadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
|
|
104
|
-
})
|
|
105
|
-
.annotate({ identifier: "SourceUrlPart" })
|
|
106
|
-
.pipe(withStatics((s) => ({ zod: zod(s) })))
|
|
107
|
-
export type SourceUrlPart = Schema.Schema.Type<typeof SourceUrlPart>
|
|
108
|
-
|
|
109
|
-
export const FilePart = Schema.Struct({
|
|
110
|
-
type: Schema.Literal("file"),
|
|
111
|
-
mediaType: Schema.String,
|
|
112
|
-
filename: Schema.optional(Schema.String),
|
|
113
|
-
url: Schema.String,
|
|
114
|
-
})
|
|
115
|
-
.annotate({ identifier: "FilePart" })
|
|
116
|
-
.pipe(withStatics((s) => ({ zod: zod(s) })))
|
|
117
|
-
export type FilePart = Schema.Schema.Type<typeof FilePart>
|
|
118
|
-
|
|
119
|
-
export const StepStartPart = Schema.Struct({
|
|
120
|
-
type: Schema.Literal("step-start"),
|
|
121
|
-
})
|
|
122
|
-
.annotate({ identifier: "StepStartPart" })
|
|
123
|
-
.pipe(withStatics((s) => ({ zod: zod(s) })))
|
|
124
|
-
export type StepStartPart = Schema.Schema.Type<typeof StepStartPart>
|
|
125
|
-
|
|
126
|
-
export const MessagePart = Schema.Union([
|
|
127
|
-
TextPart,
|
|
128
|
-
ReasoningPart,
|
|
129
|
-
ToolInvocationPart,
|
|
130
|
-
SourceUrlPart,
|
|
131
|
-
FilePart,
|
|
132
|
-
StepStartPart,
|
|
133
|
-
])
|
|
134
|
-
.annotate({ identifier: "MessagePart", discriminator: "type" })
|
|
135
|
-
.pipe(withStatics((s) => ({ zod: zod(s) })))
|
|
136
|
-
export type MessagePart = Schema.Schema.Type<typeof MessagePart>
|
|
137
|
-
|
|
138
|
-
export const Info = Schema.Struct({
|
|
139
|
-
id: Schema.String,
|
|
140
|
-
role: Schema.Literals(["user", "assistant"]),
|
|
141
|
-
parts: Schema.Array(MessagePart),
|
|
142
|
-
metadata: Schema.Struct({
|
|
143
|
-
time: Schema.Struct({
|
|
144
|
-
created: NonNegativeInt,
|
|
145
|
-
completed: Schema.optional(NonNegativeInt),
|
|
146
|
-
}),
|
|
147
|
-
error: Schema.optional(Schema.Union([AuthErrorEffect, UnknownErrorEffect, OutputLengthErrorEffect])),
|
|
148
|
-
sessionID: SessionID,
|
|
149
|
-
tool: Schema.Record(
|
|
150
|
-
Schema.String,
|
|
151
|
-
Schema.StructWithRest(
|
|
152
|
-
Schema.Struct({
|
|
153
|
-
title: Schema.String,
|
|
154
|
-
snapshot: Schema.optional(Schema.String),
|
|
155
|
-
time: Schema.Struct({
|
|
156
|
-
start: NonNegativeInt,
|
|
157
|
-
end: NonNegativeInt,
|
|
158
|
-
}),
|
|
159
|
-
}),
|
|
160
|
-
[Schema.Record(Schema.String, Schema.Unknown)],
|
|
161
|
-
),
|
|
162
|
-
),
|
|
163
|
-
assistant: Schema.optional(
|
|
164
|
-
Schema.Struct({
|
|
165
|
-
system: Schema.Array(Schema.String),
|
|
166
|
-
modelID: ModelID,
|
|
167
|
-
providerID: ProviderID,
|
|
168
|
-
path: Schema.Struct({
|
|
169
|
-
cwd: Schema.String,
|
|
170
|
-
root: Schema.String,
|
|
171
|
-
}),
|
|
172
|
-
cost: Schema.Finite,
|
|
173
|
-
summary: Schema.optional(Schema.Boolean),
|
|
174
|
-
tokens: Schema.Struct({
|
|
175
|
-
input: NonNegativeInt,
|
|
176
|
-
output: NonNegativeInt,
|
|
177
|
-
reasoning: NonNegativeInt,
|
|
178
|
-
cache: Schema.Struct({
|
|
179
|
-
read: NonNegativeInt,
|
|
180
|
-
write: NonNegativeInt,
|
|
181
|
-
}),
|
|
182
|
-
}),
|
|
183
|
-
}),
|
|
184
|
-
),
|
|
185
|
-
snapshot: Schema.optional(Schema.String),
|
|
186
|
-
}).annotate({ identifier: "MessageMetadata" }),
|
|
187
|
-
})
|
|
188
|
-
.annotate({ identifier: "Message" })
|
|
189
|
-
.pipe(withStatics((s) => ({ zod: zod(s) })))
|
|
190
|
-
export type Info = Schema.Schema.Type<typeof Info>
|
|
191
|
-
|
|
192
|
-
export * as Message from "./message"
|
|
1
|
+
export * from "./message/message"
|