@opencode-ai/schema 0.0.0-dev-17471
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/agent.d.ts +164 -0
- package/dist/agent.js +46 -0
- package/dist/ai.d.ts +4 -0
- package/dist/ai.js +5 -0
- package/dist/catalog.d.ts +69 -0
- package/dist/catalog.js +4 -0
- package/dist/command.d.ts +124 -0
- package/dist/command.js +19 -0
- package/dist/config/agent.d.ts +42 -0
- package/dist/config/agent.js +20 -0
- package/dist/config/command.d.ts +27 -0
- package/dist/config/command.js +12 -0
- package/dist/config/compaction.d.ts +14 -0
- package/dist/config/compaction.js +13 -0
- package/dist/config/experimental.d.ts +17 -0
- package/dist/config/experimental.js +16 -0
- package/dist/config/formatter.d.ts +11 -0
- package/dist/config/formatter.js +11 -0
- package/dist/config/lsp.d.ts +20 -0
- package/dist/config/lsp.js +16 -0
- package/dist/config/mcp.d.ts +18 -0
- package/dist/config/mcp.js +14 -0
- package/dist/config/media.d.ts +15 -0
- package/dist/config/media.js +14 -0
- package/dist/config/model.d.ts +18 -0
- package/dist/config/model.js +28 -0
- package/dist/config/plugin.d.ts +11 -0
- package/dist/config/plugin.js +10 -0
- package/dist/config/policy.d.ts +10 -0
- package/dist/config/policy.js +8 -0
- package/dist/config/provider.d.ts +106 -0
- package/dist/config/provider.js +62 -0
- package/dist/config/reference.d.ts +21 -0
- package/dist/config/reference.js +18 -0
- package/dist/config/tool-output.d.ts +8 -0
- package/dist/config/tool-output.js +8 -0
- package/dist/config/warming.d.ts +10 -0
- package/dist/config/warming.js +16 -0
- package/dist/config/watcher.d.ts +7 -0
- package/dist/config/watcher.js +7 -0
- package/dist/config/websearch.d.ts +9 -0
- package/dist/config/websearch.js +8 -0
- package/dist/config.d.ts +175 -0
- package/dist/config.js +136 -0
- package/dist/connection.d.ts +28 -0
- package/dist/connection.js +15 -0
- package/dist/credential.d.ts +38 -0
- package/dist/credential.js +25 -0
- package/dist/durable-event-manifest.d.ts +3 -0
- package/dist/durable-event-manifest.js +5 -0
- package/dist/event-log.d.ts +14 -0
- package/dist/event-log.js +17 -0
- package/dist/event-manifest.d.ts +11372 -0
- package/dist/event-manifest.js +45 -0
- package/dist/event.d.ts +142 -0
- package/dist/event.js +110 -0
- package/dist/file-diff.d.ts +21 -0
- package/dist/file-diff.js +18 -0
- package/dist/filesystem-v1.d.ts +1 -0
- package/dist/filesystem-v1.js +1 -0
- package/dist/filesystem.d.ts +118 -0
- package/dist/filesystem.js +35 -0
- package/dist/form.d.ts +1259 -0
- package/dist/form.js +120 -0
- package/dist/ide-event.d.ts +76 -0
- package/dist/ide-event.js +10 -0
- package/dist/identifier.d.ts +3 -0
- package/dist/identifier.js +24 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +39 -0
- package/dist/installation-event.d.ts +149 -0
- package/dist/installation-event.js +16 -0
- package/dist/instruction-entry.d.ts +23 -0
- package/dist/instruction-entry.js +22 -0
- package/dist/instruction.d.ts +13 -0
- package/dist/instruction.js +8 -0
- package/dist/integration-id.d.ts +5 -0
- package/dist/integration-id.js +3 -0
- package/dist/integration.d.ts +1675 -0
- package/dist/integration.js +87 -0
- package/dist/legacy-event.d.ts +1 -0
- package/dist/legacy-event.js +1 -0
- package/dist/llm.d.ts +4 -0
- package/dist/llm.js +3 -0
- package/dist/location.d.ts +37 -0
- package/dist/location.js +22 -0
- package/dist/lsp-event.d.ts +67 -0
- package/dist/lsp-event.js +4 -0
- package/dist/mcp-event.d.ts +222 -0
- package/dist/mcp-event.js +24 -0
- package/dist/mcp.d.ts +138 -0
- package/dist/mcp.js +111 -0
- package/dist/model.d.ts +186 -0
- package/dist/model.js +104 -0
- package/dist/models-dev.d.ts +69 -0
- package/dist/models-dev.js +7 -0
- package/dist/money.d.ts +10 -0
- package/dist/money.js +5 -0
- package/dist/permission-saved.d.ts +18 -0
- package/dist/permission-saved.js +12 -0
- package/dist/permission-v1.d.ts +1 -0
- package/dist/permission-v1.js +1 -0
- package/dist/permission.d.ts +306 -0
- package/dist/permission.js +45 -0
- package/dist/plugin.d.ts +150 -0
- package/dist/plugin.js +16 -0
- package/dist/project-id.d.ts +5 -0
- package/dist/project-id.js +3 -0
- package/dist/project.d.ts +241 -0
- package/dist/project.js +37 -0
- package/dist/prompt-input.d.ts +143 -0
- package/dist/prompt-input.js +25 -0
- package/dist/prompt.d.ts +297 -0
- package/dist/prompt.js +61 -0
- package/dist/provider.d.ts +60 -0
- package/dist/provider.js +42 -0
- package/dist/pty-ticket.d.ts +8 -0
- package/dist/pty-ticket.js +7 -0
- package/dist/pty.d.ts +462 -0
- package/dist/pty.js +43 -0
- package/dist/question-v1.d.ts +1 -0
- package/dist/question-v1.js +1 -0
- package/dist/question.d.ts +15 -0
- package/dist/question.js +15 -0
- package/dist/reference.d.ts +120 -0
- package/dist/reference.js +30 -0
- package/dist/schema.d.ts +10 -0
- package/dist/schema.js +14 -0
- package/dist/server-event.d.ts +132 -0
- package/dist/server-event.js +5 -0
- package/dist/session-compaction-event.d.ts +87 -0
- package/dist/session-compaction-event.js +10 -0
- package/dist/session-error.d.ts +9 -0
- package/dist/session-error.js +8 -0
- package/dist/session-event.d.ts +17994 -0
- package/dist/session-event.js +499 -0
- package/dist/session-fork.d.ts +26 -0
- package/dist/session-fork.js +11 -0
- package/dist/session-id.d.ts +6 -0
- package/dist/session-id.js +10 -0
- package/dist/session-inbox.d.ts +748 -0
- package/dist/session-inbox.js +47 -0
- package/dist/session-message.d.ts +1512 -0
- package/dist/session-message.js +209 -0
- package/dist/session-revert.d.ts +480 -0
- package/dist/session-revert.js +63 -0
- package/dist/session-status-event.d.ts +299 -0
- package/dist/session-status-event.js +43 -0
- package/dist/session-transfer.d.ts +744 -0
- package/dist/session-transfer.js +8 -0
- package/dist/session-v1.d.ts +1 -0
- package/dist/session-v1.js +1 -0
- package/dist/session.d.ts +218 -0
- package/dist/session.js +45 -0
- package/dist/shell.d.ts +381 -0
- package/dist/shell.js +58 -0
- package/dist/skill.d.ts +133 -0
- package/dist/skill.js +48 -0
- package/dist/snapshot.d.ts +4 -0
- package/dist/snapshot.js +3 -0
- package/dist/token-usage.d.ts +13 -0
- package/dist/token-usage.js +11 -0
- package/dist/tool.d.ts +74 -0
- package/dist/tool.js +22 -0
- package/dist/tui-event.d.ts +307 -0
- package/dist/tui-event.js +53 -0
- package/dist/v1/filesystem.d.ts +78 -0
- package/dist/v1/filesystem.js +8 -0
- package/dist/v1/legacy-event.d.ts +108 -0
- package/dist/v1/legacy-event.js +15 -0
- package/dist/v1/permission.d.ts +316 -0
- package/dist/v1/permission.js +41 -0
- package/dist/v1/question.d.ts +444 -0
- package/dist/v1/question.js +57 -0
- package/dist/v1/session.d.ts +7657 -0
- package/dist/v1/session.js +535 -0
- package/dist/vcs-event.d.ts +76 -0
- package/dist/vcs-event.js +11 -0
- package/dist/vcs.d.ts +26 -0
- package/dist/vcs.js +17 -0
- package/dist/websearch.d.ts +108 -0
- package/dist/websearch.js +31 -0
- package/dist/workspace-event.d.ts +247 -0
- package/dist/workspace-event.js +25 -0
- package/dist/workspace-id.d.ts +6 -0
- package/dist/workspace-id.js +16 -0
- package/dist/workspace.d.ts +9 -0
- package/dist/workspace.js +5 -0
- package/dist/worktree-event.d.ts +153 -0
- package/dist/worktree-event.js +18 -0
- package/dist/worktree.d.ts +255 -0
- package/dist/worktree.js +61 -0
- package/package.json +42 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
export * as SessionMessage from "./session-message.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { optional } from "./schema.js";
|
|
4
|
+
import { Content } from "./tool.js";
|
|
5
|
+
import { Location } from "./location.js";
|
|
6
|
+
import { Model } from "./model.js";
|
|
7
|
+
import { Project } from "./project.js";
|
|
8
|
+
import { Prompt } from "./prompt.js";
|
|
9
|
+
import { DateTimeUtcFromMillis, PositiveInt, RelativePath, statics } from "./schema.js";
|
|
10
|
+
import { ascending } from "./identifier.js";
|
|
11
|
+
import { Event } from "./event.js";
|
|
12
|
+
import { Shell as ShellSchema } from "./shell.js";
|
|
13
|
+
import { FinishReason } from "./llm.js";
|
|
14
|
+
import { SessionError } from "./session-error.js";
|
|
15
|
+
import { Agent } from "./agent.js";
|
|
16
|
+
import { Skill as SkillSchema } from "./skill.js";
|
|
17
|
+
import { Money } from "./money.js";
|
|
18
|
+
import { Snapshot } from "./snapshot.js";
|
|
19
|
+
import { TokenUsage } from "./token-usage.js";
|
|
20
|
+
export const ID = Schema.String.check(Schema.isStartsWith("msg_")).pipe(Schema.brand("Session.Message.ID"), statics((schema) => ({
|
|
21
|
+
create: () => schema.make("msg_" + ascending()),
|
|
22
|
+
fromEvent: (eventID) => schema.make(eventID.replace(/^evt_/, "msg_")),
|
|
23
|
+
})));
|
|
24
|
+
const Base = {
|
|
25
|
+
id: ID,
|
|
26
|
+
metadata: Schema.Record(Schema.String, Schema.Unknown).pipe(optional),
|
|
27
|
+
time: Schema.Struct({ created: DateTimeUtcFromMillis }),
|
|
28
|
+
};
|
|
29
|
+
export const ProviderState = Schema.Record(Schema.String, Schema.Unknown).annotate({
|
|
30
|
+
identifier: "Session.Message.ProviderState",
|
|
31
|
+
});
|
|
32
|
+
export const AgentSelected = Schema.Struct({
|
|
33
|
+
...Base,
|
|
34
|
+
type: Schema.tag("agent-switched"),
|
|
35
|
+
agent: Agent.ID,
|
|
36
|
+
previous: Agent.ID.pipe(optional),
|
|
37
|
+
}).annotate({ identifier: "Session.Message.AgentSelected" });
|
|
38
|
+
export const ModelSelected = Schema.Struct({
|
|
39
|
+
...Base,
|
|
40
|
+
type: Schema.tag("model-switched"),
|
|
41
|
+
model: Model.Ref,
|
|
42
|
+
previous: Model.Ref.pipe(optional),
|
|
43
|
+
}).annotate({ identifier: "Session.Message.ModelSelected" });
|
|
44
|
+
export const LocationSwitched = Schema.Struct({
|
|
45
|
+
...Base,
|
|
46
|
+
type: Schema.tag("location-switched"),
|
|
47
|
+
location: Location.Ref,
|
|
48
|
+
projectID: Project.ID.pipe(optional),
|
|
49
|
+
subpath: RelativePath.pipe(optional),
|
|
50
|
+
previous: Schema.Struct({
|
|
51
|
+
location: Location.Ref,
|
|
52
|
+
projectID: Project.ID.pipe(optional),
|
|
53
|
+
subpath: RelativePath.pipe(optional),
|
|
54
|
+
}).pipe(optional),
|
|
55
|
+
}).annotate({ identifier: "Session.Message.LocationSwitched" });
|
|
56
|
+
export const User = Schema.Struct({
|
|
57
|
+
...Base,
|
|
58
|
+
text: Prompt.fields.text,
|
|
59
|
+
files: Prompt.fields.files,
|
|
60
|
+
agents: Prompt.fields.agents,
|
|
61
|
+
skills: Prompt.fields.skills,
|
|
62
|
+
type: Schema.tag("user"),
|
|
63
|
+
}).annotate({ identifier: "Session.Message.User" });
|
|
64
|
+
export const Synthetic = Schema.Struct({
|
|
65
|
+
...Base,
|
|
66
|
+
text: Schema.String,
|
|
67
|
+
description: Schema.String.pipe(optional),
|
|
68
|
+
type: Schema.tag("synthetic"),
|
|
69
|
+
}).annotate({ identifier: "Session.Message.Synthetic" });
|
|
70
|
+
export const System = Schema.Struct({
|
|
71
|
+
...Base,
|
|
72
|
+
type: Schema.tag("system"),
|
|
73
|
+
/** The model-facing update text, frozen at emit time. */
|
|
74
|
+
text: Schema.String,
|
|
75
|
+
/** A short human-readable summary for transcript display. */
|
|
76
|
+
description: Schema.String.pipe(optional),
|
|
77
|
+
}).annotate({ identifier: "Session.Message.System" });
|
|
78
|
+
export const Skill = Schema.Struct({
|
|
79
|
+
...Base,
|
|
80
|
+
type: Schema.tag("skill"),
|
|
81
|
+
skill: SkillSchema.ID,
|
|
82
|
+
name: SkillSchema.Name,
|
|
83
|
+
text: Schema.String,
|
|
84
|
+
}).annotate({ identifier: "Session.Message.Skill" });
|
|
85
|
+
export const Shell = Schema.Struct({
|
|
86
|
+
...Base,
|
|
87
|
+
type: Schema.tag("shell"),
|
|
88
|
+
shellID: ShellSchema.ID,
|
|
89
|
+
command: Schema.String,
|
|
90
|
+
status: ShellSchema.Status,
|
|
91
|
+
exit: Schema.Number.pipe(optional),
|
|
92
|
+
output: ShellSchema.Output.pipe(optional),
|
|
93
|
+
time: Schema.Struct({
|
|
94
|
+
created: DateTimeUtcFromMillis,
|
|
95
|
+
completed: DateTimeUtcFromMillis.pipe(optional),
|
|
96
|
+
}),
|
|
97
|
+
}).annotate({ identifier: "Session.Message.Shell" });
|
|
98
|
+
export const ToolStateStreaming = Schema.Struct({
|
|
99
|
+
status: Schema.tag("streaming"),
|
|
100
|
+
input: Schema.String,
|
|
101
|
+
}).annotate({ identifier: "Session.Message.ToolState.Streaming" });
|
|
102
|
+
export const ToolStateRunning = Schema.Struct({
|
|
103
|
+
status: Schema.tag("running"),
|
|
104
|
+
input: Schema.Record(Schema.String, Schema.Unknown),
|
|
105
|
+
metadata: Schema.Record(Schema.String, Schema.Json),
|
|
106
|
+
}).annotate({ identifier: "Session.Message.ToolState.Running" });
|
|
107
|
+
export const ToolStateCompleted = Schema.Struct({
|
|
108
|
+
status: Schema.tag("completed"),
|
|
109
|
+
input: Schema.Record(Schema.String, Schema.Unknown),
|
|
110
|
+
content: Schema.NonEmptyArray(Content),
|
|
111
|
+
metadata: Schema.Record(Schema.String, Schema.Json).pipe(optional),
|
|
112
|
+
}).annotate({ identifier: "Session.Message.ToolState.Completed" });
|
|
113
|
+
export const ToolStateError = Schema.Struct({
|
|
114
|
+
status: Schema.tag("error"),
|
|
115
|
+
input: Schema.Record(Schema.String, Schema.Unknown),
|
|
116
|
+
error: SessionError.Error,
|
|
117
|
+
content: Schema.NonEmptyArray(Content).pipe(optional),
|
|
118
|
+
metadata: Schema.Record(Schema.String, Schema.Json).pipe(optional),
|
|
119
|
+
}).annotate({ identifier: "Session.Message.ToolState.Error" });
|
|
120
|
+
export const ToolState = Schema.Union([ToolStateStreaming, ToolStateRunning, ToolStateCompleted, ToolStateError]).pipe(Schema.toTaggedUnion("status"));
|
|
121
|
+
export const AssistantTool = Schema.Struct({
|
|
122
|
+
type: Schema.tag("tool"),
|
|
123
|
+
id: Schema.String,
|
|
124
|
+
name: Schema.String,
|
|
125
|
+
executed: Schema.Boolean.pipe(optional),
|
|
126
|
+
providerState: ProviderState.pipe(optional),
|
|
127
|
+
providerResultState: ProviderState.pipe(optional),
|
|
128
|
+
state: ToolState,
|
|
129
|
+
time: Schema.Struct({
|
|
130
|
+
created: DateTimeUtcFromMillis,
|
|
131
|
+
ran: DateTimeUtcFromMillis.pipe(optional),
|
|
132
|
+
completed: DateTimeUtcFromMillis.pipe(optional),
|
|
133
|
+
}),
|
|
134
|
+
}).annotate({ identifier: "Session.Message.Assistant.Tool" });
|
|
135
|
+
export const AssistantText = Schema.Struct({
|
|
136
|
+
type: Schema.tag("text"),
|
|
137
|
+
text: Schema.String,
|
|
138
|
+
state: ProviderState.pipe(optional),
|
|
139
|
+
}).annotate({ identifier: "Session.Message.Assistant.Text" });
|
|
140
|
+
export const AssistantReasoning = Schema.Struct({
|
|
141
|
+
type: Schema.tag("reasoning"),
|
|
142
|
+
text: Schema.String,
|
|
143
|
+
state: ProviderState.pipe(optional),
|
|
144
|
+
time: Schema.Struct({
|
|
145
|
+
created: DateTimeUtcFromMillis,
|
|
146
|
+
completed: DateTimeUtcFromMillis.pipe(optional),
|
|
147
|
+
}).pipe(optional),
|
|
148
|
+
}).annotate({ identifier: "Session.Message.Assistant.Reasoning" });
|
|
149
|
+
export const AssistantContent = Schema.Union([AssistantText, AssistantReasoning, AssistantTool]).pipe(Schema.toTaggedUnion("type"));
|
|
150
|
+
export const AssistantRetry = Schema.Struct({
|
|
151
|
+
attempt: PositiveInt,
|
|
152
|
+
at: DateTimeUtcFromMillis,
|
|
153
|
+
error: SessionError.Error,
|
|
154
|
+
}).annotate({ identifier: "Session.Message.Assistant.Retry" });
|
|
155
|
+
export const Assistant = Schema.Struct({
|
|
156
|
+
...Base,
|
|
157
|
+
type: Schema.tag("assistant"),
|
|
158
|
+
agent: Agent.ID,
|
|
159
|
+
model: Model.Ref,
|
|
160
|
+
content: AssistantContent.pipe(Schema.Array),
|
|
161
|
+
snapshot: Schema.Struct({
|
|
162
|
+
start: Snapshot.ID.pipe(optional),
|
|
163
|
+
end: Snapshot.ID.pipe(optional),
|
|
164
|
+
files: Schema.Array(RelativePath).pipe(optional),
|
|
165
|
+
}).pipe(optional),
|
|
166
|
+
finish: FinishReason.pipe(optional),
|
|
167
|
+
cost: Money.USD.pipe(optional),
|
|
168
|
+
tokens: TokenUsage.Info.pipe(optional),
|
|
169
|
+
error: SessionError.Error.pipe(optional),
|
|
170
|
+
retry: AssistantRetry.pipe(optional),
|
|
171
|
+
time: Schema.Struct({
|
|
172
|
+
created: DateTimeUtcFromMillis,
|
|
173
|
+
completed: DateTimeUtcFromMillis.pipe(optional),
|
|
174
|
+
}),
|
|
175
|
+
}).annotate({ identifier: "Session.Message.Assistant" });
|
|
176
|
+
const CompactionBase = { type: Schema.tag("compaction"), ...Base };
|
|
177
|
+
export const CompactionRunning = Schema.Struct({
|
|
178
|
+
...CompactionBase,
|
|
179
|
+
status: Schema.tag("running"),
|
|
180
|
+
reason: Schema.Literals(["auto", "manual"]),
|
|
181
|
+
summary: Schema.String,
|
|
182
|
+
recent: Schema.String,
|
|
183
|
+
}).annotate({ identifier: "Session.Message.Compaction.Running" });
|
|
184
|
+
export const CompactionCompleted = Schema.Struct({
|
|
185
|
+
...CompactionBase,
|
|
186
|
+
status: Schema.tag("completed"),
|
|
187
|
+
reason: Schema.Literals(["auto", "manual"]),
|
|
188
|
+
summary: Schema.String,
|
|
189
|
+
recent: Schema.String,
|
|
190
|
+
}).annotate({ identifier: "Session.Message.Compaction.Completed" });
|
|
191
|
+
export const CompactionFailed = Schema.Struct({
|
|
192
|
+
...CompactionBase,
|
|
193
|
+
status: Schema.tag("failed"),
|
|
194
|
+
reason: Schema.Literals(["auto", "manual"]),
|
|
195
|
+
error: SessionError.Error,
|
|
196
|
+
}).annotate({ identifier: "Session.Message.Compaction.Failed" });
|
|
197
|
+
export const Compaction = Schema.Union([CompactionRunning, CompactionCompleted, CompactionFailed]).pipe(Schema.toTaggedUnion("status"), Schema.annotate({ identifier: "Session.Message.Compaction" }));
|
|
198
|
+
export const Info = Schema.Union([
|
|
199
|
+
AgentSelected,
|
|
200
|
+
ModelSelected,
|
|
201
|
+
LocationSwitched,
|
|
202
|
+
User,
|
|
203
|
+
Synthetic,
|
|
204
|
+
System,
|
|
205
|
+
Skill,
|
|
206
|
+
Shell,
|
|
207
|
+
Assistant,
|
|
208
|
+
Compaction,
|
|
209
|
+
]).annotate({ identifier: "Session.Message.Info" });
|