@opencode-ai/schema 0.0.0-next-15090 → 0.0.0-next-15092
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 +13 -9
- package/dist/agent.js +5 -2
- package/dist/command.d.ts +5 -5
- package/dist/command.js +3 -2
- package/dist/durable-event-manifest.d.ts +146 -96
- package/dist/event-manifest.d.ts +390 -282
- package/dist/event.d.ts +2 -1
- package/dist/event.js +12 -4
- package/dist/file-diff.d.ts +11 -1
- package/dist/file-diff.js +13 -5
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/model.d.ts +46 -30
- package/dist/model.js +10 -9
- package/dist/money.d.ts +10 -0
- package/dist/money.js +5 -0
- package/dist/session-event.d.ts +748 -486
- package/dist/session-event.js +30 -27
- package/dist/session-input.d.ts +6 -6
- package/dist/session-input.js +3 -3
- package/dist/session-message.d.ts +238 -619
- package/dist/session-message.js +57 -44
- package/dist/session-revert.d.ts +479 -0
- package/dist/session-revert.js +63 -0
- package/dist/session.d.ts +26 -22
- package/dist/session.js +9 -13
- package/dist/shell.d.ts +42 -42
- package/dist/shell.js +1 -1
- package/dist/skill.d.ts +16 -9
- package/dist/skill.js +14 -11
- 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/v1/session.d.ts +62 -62
- package/dist/v1/session.js +5 -5
- package/package.json +1 -1
- package/dist/revert.d.ts +0 -35
- package/dist/revert.js +0 -19
package/dist/session-event.js
CHANGED
|
@@ -11,29 +11,25 @@ import { FileAttachment, Prompt } from "./prompt.js";
|
|
|
11
11
|
import { SessionID } from "./session-id.js";
|
|
12
12
|
import { Location } from "./location.js";
|
|
13
13
|
import { SessionMessage } from "./session-message.js";
|
|
14
|
-
import { Revert } from "./revert.js";
|
|
14
|
+
import { Revert } from "./session-revert.js";
|
|
15
15
|
import { Shell as ShellSchema } from "./shell.js";
|
|
16
16
|
import { SessionError } from "./session-error.js";
|
|
17
|
+
import { Agent } from "./agent.js";
|
|
18
|
+
import { Skill as SkillSchema } from "./skill.js";
|
|
19
|
+
import { Money } from "./money.js";
|
|
20
|
+
import { Snapshot } from "./snapshot.js";
|
|
21
|
+
import { TokenUsage } from "./token-usage.js";
|
|
17
22
|
export { FileAttachment };
|
|
18
23
|
export const Source = Schema.Struct({
|
|
19
24
|
start: NonNegativeInt,
|
|
20
25
|
end: NonNegativeInt,
|
|
21
26
|
text: Schema.String,
|
|
22
27
|
}).annotate({
|
|
23
|
-
identifier: "
|
|
28
|
+
identifier: "Session.Event.Source",
|
|
24
29
|
});
|
|
25
30
|
const Base = {
|
|
26
31
|
sessionID: SessionID,
|
|
27
32
|
};
|
|
28
|
-
const Tokens = Schema.Struct({
|
|
29
|
-
input: Schema.Finite,
|
|
30
|
-
output: Schema.Finite,
|
|
31
|
-
reasoning: Schema.Finite,
|
|
32
|
-
cache: Schema.Struct({
|
|
33
|
-
read: Schema.Finite,
|
|
34
|
-
write: Schema.Finite,
|
|
35
|
-
}),
|
|
36
|
-
});
|
|
37
33
|
const PromptFields = {
|
|
38
34
|
...Base,
|
|
39
35
|
inputID: SessionMessage.ID,
|
|
@@ -51,7 +47,7 @@ export const AgentSelected = Event.durable({
|
|
|
51
47
|
...options,
|
|
52
48
|
schema: {
|
|
53
49
|
...Base,
|
|
54
|
-
agent:
|
|
50
|
+
agent: Agent.ID,
|
|
55
51
|
},
|
|
56
52
|
});
|
|
57
53
|
export const ModelSelected = Event.durable({
|
|
@@ -83,8 +79,8 @@ export const UsageUpdated = Event.ephemeral({
|
|
|
83
79
|
type: "session.usage.updated",
|
|
84
80
|
schema: {
|
|
85
81
|
...Base,
|
|
86
|
-
cost:
|
|
87
|
-
tokens:
|
|
82
|
+
cost: Money.USD,
|
|
83
|
+
tokens: TokenUsage.Info,
|
|
88
84
|
},
|
|
89
85
|
});
|
|
90
86
|
export const Deleted = Event.durable({
|
|
@@ -157,7 +153,8 @@ export var Skill;
|
|
|
157
153
|
...options,
|
|
158
154
|
schema: {
|
|
159
155
|
...Base,
|
|
160
|
-
|
|
156
|
+
id: SkillSchema.ID,
|
|
157
|
+
name: SkillSchema.Name,
|
|
161
158
|
text: Schema.String,
|
|
162
159
|
},
|
|
163
160
|
});
|
|
@@ -190,9 +187,9 @@ export var Step;
|
|
|
190
187
|
schema: {
|
|
191
188
|
...Base,
|
|
192
189
|
assistantMessageID: SessionMessage.ID,
|
|
193
|
-
agent:
|
|
190
|
+
agent: Agent.ID,
|
|
194
191
|
model: Model.Ref,
|
|
195
|
-
snapshot:
|
|
192
|
+
snapshot: Snapshot.ID.pipe(optional),
|
|
196
193
|
},
|
|
197
194
|
});
|
|
198
195
|
Step.Ended = Event.durable({
|
|
@@ -202,9 +199,9 @@ export var Step;
|
|
|
202
199
|
...Base,
|
|
203
200
|
assistantMessageID: SessionMessage.ID,
|
|
204
201
|
finish: FinishReason,
|
|
205
|
-
cost:
|
|
206
|
-
tokens:
|
|
207
|
-
snapshot:
|
|
202
|
+
cost: Money.USD,
|
|
203
|
+
tokens: TokenUsage.Info,
|
|
204
|
+
snapshot: Snapshot.ID.pipe(optional),
|
|
208
205
|
files: Schema.Array(RelativePath).pipe(optional),
|
|
209
206
|
},
|
|
210
207
|
});
|
|
@@ -215,8 +212,8 @@ export var Step;
|
|
|
215
212
|
...Base,
|
|
216
213
|
assistantMessageID: SessionMessage.ID,
|
|
217
214
|
error: SessionError.Error,
|
|
218
|
-
cost:
|
|
219
|
-
tokens:
|
|
215
|
+
cost: Money.USD.pipe(optional),
|
|
216
|
+
tokens: TokenUsage.Info.pipe(optional),
|
|
220
217
|
},
|
|
221
218
|
});
|
|
222
219
|
})(Step || (Step = {}));
|
|
@@ -350,7 +347,6 @@ export var Tool;
|
|
|
350
347
|
...ToolBase,
|
|
351
348
|
structured: Schema.Record(Schema.String, Schema.Unknown),
|
|
352
349
|
content: Schema.Array(ToolContent),
|
|
353
|
-
outputPaths: Schema.Array(Schema.String).pipe(optional),
|
|
354
350
|
result: Schema.Unknown.pipe(optional),
|
|
355
351
|
executed: Schema.Boolean,
|
|
356
352
|
resultState: SessionMessage.ProviderState.pipe(optional),
|
|
@@ -394,7 +390,9 @@ export var Compaction;
|
|
|
394
390
|
...options,
|
|
395
391
|
schema: {
|
|
396
392
|
...Base,
|
|
397
|
-
reason: Schema.
|
|
393
|
+
reason: Schema.Literals(["auto", "manual"]),
|
|
394
|
+
recent: Schema.String,
|
|
395
|
+
inputID: SessionMessage.ID.pipe(optional),
|
|
398
396
|
},
|
|
399
397
|
});
|
|
400
398
|
Compaction.Delta = Event.ephemeral({
|
|
@@ -417,7 +415,12 @@ export var Compaction;
|
|
|
417
415
|
Compaction.Failed = Event.durable({
|
|
418
416
|
type: "session.compaction.failed",
|
|
419
417
|
...options,
|
|
420
|
-
schema:
|
|
418
|
+
schema: {
|
|
419
|
+
...Base,
|
|
420
|
+
reason: Compaction.Started.data.fields.reason,
|
|
421
|
+
error: SessionError.Error,
|
|
422
|
+
inputID: SessionMessage.ID.pipe(optional),
|
|
423
|
+
},
|
|
421
424
|
});
|
|
422
425
|
})(Compaction || (Compaction = {}));
|
|
423
426
|
export var RevertEvent;
|
|
@@ -425,7 +428,7 @@ export var RevertEvent;
|
|
|
425
428
|
RevertEvent.Staged = Event.durable({
|
|
426
429
|
type: "session.revert.staged",
|
|
427
430
|
...options,
|
|
428
|
-
schema: { ...Base, revert: Revert
|
|
431
|
+
schema: { ...Base, revert: Revert },
|
|
429
432
|
});
|
|
430
433
|
RevertEvent.Cleared = Event.durable({ type: "session.revert.cleared", ...options, schema: Base });
|
|
431
434
|
RevertEvent.Committed = Event.durable({
|
|
@@ -438,5 +441,5 @@ export const Definitions = Event.inventory(AgentSelected, ModelSelected, Moved,
|
|
|
438
441
|
export const DurableDefinitions = Event.inventory(...Definitions.filter((definition) => definition.durability === "durable"));
|
|
439
442
|
export const Durable = Schema.Union(DurableDefinitions, { mode: "oneOf" })
|
|
440
443
|
.pipe(Schema.toTaggedUnion("type"))
|
|
441
|
-
.annotate({ identifier: "
|
|
444
|
+
.annotate({ identifier: "Session.Event.Durable" });
|
|
442
445
|
export const All = Schema.Union(Definitions, { mode: "oneOf" }).pipe(Schema.toTaggedUnion("type"));
|
package/dist/session-input.d.ts
CHANGED
|
@@ -355,12 +355,12 @@ export declare const PromptEntry: Schema.Struct<{
|
|
|
355
355
|
readonly delivery: Schema.Literals<readonly ["steer", "queue"]>;
|
|
356
356
|
readonly timeCreated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
357
357
|
readonly promotedSeq: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
358
|
-
readonly type: Schema.
|
|
358
|
+
readonly type: Schema.tag<"prompt">;
|
|
359
359
|
}>;
|
|
360
360
|
export interface Compaction extends Schema.Schema.Type<typeof Compaction> {
|
|
361
361
|
}
|
|
362
362
|
export declare const Compaction: Schema.Struct<{
|
|
363
|
-
readonly type: Schema.
|
|
363
|
+
readonly type: Schema.tag<"compaction">;
|
|
364
364
|
readonly admittedSeq: Schema.Int;
|
|
365
365
|
readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
366
366
|
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
@@ -373,7 +373,7 @@ export declare const Compaction: Schema.Struct<{
|
|
|
373
373
|
readonly timeCreated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
374
374
|
readonly handledSeq: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
375
375
|
}>;
|
|
376
|
-
export declare const
|
|
376
|
+
export declare const Info: Schema.Union<readonly [Schema.Struct<{
|
|
377
377
|
readonly admittedSeq: Schema.Int;
|
|
378
378
|
readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
379
379
|
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
@@ -546,9 +546,9 @@ export declare const Entry: Schema.toTaggedUnion<"type", readonly [Schema.Struct
|
|
|
546
546
|
readonly delivery: Schema.Literals<readonly ["steer", "queue"]>;
|
|
547
547
|
readonly timeCreated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
548
548
|
readonly promotedSeq: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
549
|
-
readonly type: Schema.
|
|
549
|
+
readonly type: Schema.tag<"prompt">;
|
|
550
550
|
}>, Schema.Struct<{
|
|
551
|
-
readonly type: Schema.
|
|
551
|
+
readonly type: Schema.tag<"compaction">;
|
|
552
552
|
readonly admittedSeq: Schema.Int;
|
|
553
553
|
readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
554
554
|
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
@@ -561,4 +561,4 @@ export declare const Entry: Schema.toTaggedUnion<"type", readonly [Schema.Struct
|
|
|
561
561
|
readonly timeCreated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
562
562
|
readonly handledSeq: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
563
563
|
}>]>;
|
|
564
|
-
export type
|
|
564
|
+
export type Info = typeof Info.Type;
|
package/dist/session-input.js
CHANGED
|
@@ -17,15 +17,15 @@ export const Admitted = Schema.Struct({
|
|
|
17
17
|
promotedSeq: NonNegativeInt.pipe(optional),
|
|
18
18
|
}).annotate({ identifier: "SessionInput.Admitted" });
|
|
19
19
|
export const PromptEntry = Schema.Struct({
|
|
20
|
-
type: Schema.
|
|
20
|
+
type: Schema.tag("prompt"),
|
|
21
21
|
...Admitted.fields,
|
|
22
22
|
}).annotate({ identifier: "SessionInput.PromptEntry" });
|
|
23
23
|
export const Compaction = Schema.Struct({
|
|
24
|
-
type: Schema.
|
|
24
|
+
type: Schema.tag("compaction"),
|
|
25
25
|
admittedSeq: NonNegativeInt,
|
|
26
26
|
id: SessionMessage.ID,
|
|
27
27
|
sessionID: SessionID,
|
|
28
28
|
timeCreated: DateTimeUtcFromMillis,
|
|
29
29
|
handledSeq: NonNegativeInt.pipe(optional),
|
|
30
30
|
}).annotate({ identifier: "SessionInput.Compaction" });
|
|
31
|
-
export const
|
|
31
|
+
export const Info = Schema.Union([PromptEntry, Compaction]).pipe(Schema.toTaggedUnion("type"), Schema.annotate({ identifier: "SessionInput.Info" }));
|