@zyro-sec/schema 1.0.2 → 1.0.3
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/AGENTS.md +95 -95
- package/package.json +1 -1
- package/script/build.ts +9 -9
- package/script/config-schema.ts +86 -86
- package/script/config-v1.json +1311 -1311
- package/script/pack.ts +5 -5
- package/src/agent.ts +68 -68
- package/src/artifact.ts +81 -81
- package/src/automation.ts +224 -224
- package/src/blob-store.ts +25 -25
- package/src/command.ts +18 -18
- package/src/config/agent.ts +26 -26
- package/src/config/command.ts +14 -14
- package/src/config/compaction.ts +27 -27
- package/src/config/experimental.ts +72 -72
- package/src/config/flag.ts +39 -39
- package/src/config/formatter.ts +13 -13
- package/src/config/lsp.ts +19 -19
- package/src/config/mcp.ts +22 -22
- package/src/config/media.ts +15 -15
- package/src/config/model.ts +37 -37
- package/src/config/plugin.ts +14 -14
- package/src/config/policy.ts +57 -57
- package/src/config/provider.ts +122 -122
- package/src/config/reference.ts +23 -23
- package/src/config/shell.ts +10 -10
- package/src/config/tool-output.ts +9 -9
- package/src/config/warming.ts +21 -21
- package/src/config/watcher.ts +8 -8
- package/src/config/websearch.ts +17 -17
- package/src/config/worktree.ts +10 -10
- package/src/config.ts +149 -149
- package/src/connection.ts +38 -38
- package/src/credential-legacy.ts +29 -29
- package/src/credential.ts +78 -78
- package/src/durable-event-manifest.ts +7 -7
- package/src/event-log.ts +21 -21
- package/src/event-manifest.ts +108 -108
- package/src/event.ts +205 -205
- package/src/file-diff.ts +25 -25
- package/src/filesystem-v1.ts +1 -1
- package/src/filesystem.ts +48 -48
- package/src/form.ts +177 -177
- package/src/generate.ts +292 -292
- package/src/goal.ts +46 -46
- package/src/identifier.ts +32 -32
- package/src/index.ts +51 -51
- package/src/installation-event.ts +20 -20
- package/src/instruction-entry.ts +40 -40
- package/src/instruction.ts +25 -25
- package/src/integration-id.ts +13 -13
- package/src/integration.ts +129 -129
- package/src/job.ts +79 -79
- package/src/legacy-event.ts +1 -1
- package/src/llm.ts +6 -6
- package/src/location-event.ts +8 -8
- package/src/location.ts +36 -36
- package/src/lsp-event.ts +7 -7
- package/src/mcp-event.ts +63 -63
- package/src/mcp.ts +171 -171
- package/src/model-compatibility.ts +55 -55
- package/src/model.ts +176 -176
- package/src/models-dev.ts +9 -9
- package/src/money.ts +18 -18
- package/src/permission-saved.ts +25 -25
- package/src/permission-v1.ts +1 -1
- package/src/permission.ts +67 -67
- package/src/persistent-pty.ts +73 -73
- package/src/plugin.ts +62 -62
- package/src/project-id.ts +9 -9
- package/src/project.ts +62 -62
- package/src/prompt-input.ts +33 -33
- package/src/prompt.ts +117 -117
- package/src/provider.ts +136 -136
- package/src/pty-ticket.ts +10 -10
- package/src/pty.ts +61 -61
- package/src/push.ts +86 -86
- package/src/question.ts +22 -22
- package/src/reference.ts +40 -40
- package/src/rpc.ts +167 -167
- package/src/schema.ts +41 -41
- package/src/server-event.ts +8 -8
- package/src/session-error.ts +14 -14
- package/src/session-event.ts +739 -739
- package/src/session-fork.ts +10 -10
- package/src/session-id.ts +12 -12
- package/src/session-inbox.ts +102 -102
- package/src/session-legacy.ts +117 -117
- package/src/session-message.ts +352 -352
- package/src/session-metadata.ts +11 -11
- package/src/session-revert.ts +86 -86
- package/src/session-stats.ts +68 -68
- package/src/session-status-event.ts +53 -53
- package/src/session-transfer.ts +11 -11
- package/src/session-v1.ts +1 -1
- package/src/session.ts +147 -147
- package/src/shell.ts +90 -90
- package/src/skill.ts +68 -68
- package/src/snapshot.ts +6 -6
- package/src/token-usage.ts +18 -18
- package/src/tool.ts +143 -143
- package/src/tui-event.ts +59 -59
- package/src/usage-limits.ts +76 -76
- package/src/v1/filesystem.ts +11 -11
- package/src/v1/legacy-event.ts +18 -18
- package/src/v1/permission.ts +66 -66
- package/src/v1/session.ts +667 -667
- package/src/vcs-event.ts +14 -14
- package/src/vcs.ts +41 -41
- package/src/websearch.ts +44 -44
- package/src/workspace-event.ts +32 -32
- package/src/workspace-id.ts +19 -19
- package/src/workspace.ts +20 -20
- package/src/worktree-event.ts +22 -22
- package/src/worktree.ts +109 -109
- package/tsconfig.build.json +11 -11
- package/tsconfig.json +14 -14
- package/test/agent.test.ts +0 -10
- package/test/automation.test.ts +0 -48
- package/test/compatibility.test.ts +0 -10
- package/test/config.test.ts +0 -194
- package/test/contract-hygiene.test.ts +0 -352
- package/test/credential-legacy.test.ts +0 -55
- package/test/event-manifest.test.ts +0 -228
- package/test/event.test.ts +0 -52
- package/test/legacy-event.test.ts +0 -46
- package/test/mcp.test.ts +0 -37
- package/test/model.test.ts +0 -104
- package/test/session-cursor.test.ts +0 -16
- package/test/session-error.test.ts +0 -51
- package/test/session-legacy.test.ts +0 -178
- package/test/session-terminal.test.ts +0 -50
- package/test/token-usage.test.ts +0 -18
- package/test/v1-isolation.test.ts +0 -26
- package/test/vcs.test.ts +0 -23
- package/test/worktree.test.ts +0 -45
package/src/session-metadata.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Schema } from "effect"
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Host-supplied session annotations, durable and opaque to core. Keys are
|
|
5
|
-
* arbitrary; values must be JSON-serializable. Children and forks inherit
|
|
6
|
-
* the parent's current metadata unless the creator supplies its own.
|
|
7
|
-
*/
|
|
8
|
-
export const SessionMetadata = Schema.Record(Schema.String, Schema.Json).annotate({
|
|
9
|
-
identifier: "Session.Metadata",
|
|
10
|
-
})
|
|
11
|
-
export type SessionMetadata = typeof SessionMetadata.Type
|
|
1
|
+
import { Schema } from "effect"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Host-supplied session annotations, durable and opaque to core. Keys are
|
|
5
|
+
* arbitrary; values must be JSON-serializable. Children and forks inherit
|
|
6
|
+
* the parent's current metadata unless the creator supplies its own.
|
|
7
|
+
*/
|
|
8
|
+
export const SessionMetadata = Schema.Record(Schema.String, Schema.Json).annotate({
|
|
9
|
+
identifier: "Session.Metadata",
|
|
10
|
+
})
|
|
11
|
+
export type SessionMetadata = typeof SessionMetadata.Type
|
package/src/session-revert.ts
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
import { Schema, SchemaTransformation } from "effect"
|
|
2
|
-
import { FileDiff } from "./file-diff.js"
|
|
3
|
-
import { optional } from "./schema.js"
|
|
4
|
-
import { SessionMessage } from "./session-message.js"
|
|
5
|
-
import { Snapshot } from "./snapshot.js"
|
|
6
|
-
|
|
7
|
-
export interface Revert extends Schema.Schema.Type<typeof Revert> {}
|
|
8
|
-
export const Revert = Schema.Struct({
|
|
9
|
-
messageID: SessionMessage.ID,
|
|
10
|
-
/** Legacy V1 compatibility state. */
|
|
11
|
-
partID: Schema.String.pipe(optional),
|
|
12
|
-
snapshot: Snapshot.ID.pipe(optional),
|
|
13
|
-
files: Schema.Array(FileDiff.Info).pipe(optional),
|
|
14
|
-
}).annotate({ identifier: "Session.Revert" })
|
|
15
|
-
|
|
16
|
-
const FileDiffV1 = Schema.Struct({
|
|
17
|
-
path: Schema.String,
|
|
18
|
-
status: Schema.Literals(["added", "modified", "deleted"]),
|
|
19
|
-
additions: Schema.Finite,
|
|
20
|
-
deletions: Schema.Finite,
|
|
21
|
-
patch: Schema.String,
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
export interface RevertV1 extends Schema.Schema.Type<typeof RevertV1> {}
|
|
25
|
-
export const RevertV1 = Schema.Struct({
|
|
26
|
-
messageID: SessionMessage.ID,
|
|
27
|
-
partID: Schema.String.pipe(optional),
|
|
28
|
-
snapshot: Schema.String.pipe(optional),
|
|
29
|
-
diff: Schema.String.pipe(optional),
|
|
30
|
-
files: Schema.Array(FileDiffV1).pipe(optional),
|
|
31
|
-
}).annotate({ identifier: "Session.RevertV1" })
|
|
32
|
-
|
|
33
|
-
const PersistedCurrent = Revert.pipe(
|
|
34
|
-
Schema.decodeTo(
|
|
35
|
-
Schema.Struct({ source: Schema.tag("current"), revert: Schema.toType(Revert) }),
|
|
36
|
-
SchemaTransformation.transform({
|
|
37
|
-
decode: (revert): { readonly source: "current"; readonly revert: Revert } => ({
|
|
38
|
-
source: "current",
|
|
39
|
-
revert,
|
|
40
|
-
}),
|
|
41
|
-
encode: (value) => value.revert,
|
|
42
|
-
}),
|
|
43
|
-
),
|
|
44
|
-
)
|
|
45
|
-
const PersistedLegacy = RevertV1.pipe(
|
|
46
|
-
Schema.decodeTo(
|
|
47
|
-
Schema.Struct({ source: Schema.tag("legacy"), revert: Schema.toType(RevertV1) }),
|
|
48
|
-
SchemaTransformation.transform({
|
|
49
|
-
decode: (revert): { readonly source: "legacy"; readonly revert: RevertV1 } => ({
|
|
50
|
-
source: "legacy",
|
|
51
|
-
revert,
|
|
52
|
-
}),
|
|
53
|
-
encode: (value) => value.revert,
|
|
54
|
-
}),
|
|
55
|
-
),
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
/** Storage decoder for revert state written before FileDiff became canonical. */
|
|
59
|
-
export const PersistedRevert = Schema.Union([PersistedCurrent, PersistedLegacy]).pipe(
|
|
60
|
-
Schema.toTaggedUnion("source"),
|
|
61
|
-
Schema.decodeTo(
|
|
62
|
-
Schema.toType(Revert),
|
|
63
|
-
SchemaTransformation.transform({
|
|
64
|
-
decode: (persisted): Revert => {
|
|
65
|
-
if (persisted.source === "current") return persisted.revert
|
|
66
|
-
return Revert.make({
|
|
67
|
-
messageID: persisted.revert.messageID,
|
|
68
|
-
partID: persisted.revert.partID,
|
|
69
|
-
snapshot: persisted.revert.snapshot ? Snapshot.ID.make(persisted.revert.snapshot) : undefined,
|
|
70
|
-
files: persisted.revert.files?.map((file) => ({
|
|
71
|
-
file: file.path,
|
|
72
|
-
status: file.status,
|
|
73
|
-
additions: file.additions,
|
|
74
|
-
deletions: file.deletions,
|
|
75
|
-
patch: file.patch,
|
|
76
|
-
})),
|
|
77
|
-
})
|
|
78
|
-
},
|
|
79
|
-
encode: (revert): { readonly source: "current"; readonly revert: Revert } => ({
|
|
80
|
-
source: "current",
|
|
81
|
-
revert,
|
|
82
|
-
}),
|
|
83
|
-
}),
|
|
84
|
-
),
|
|
85
|
-
Schema.annotate({ identifier: "Session.Revert.Persisted" }),
|
|
86
|
-
)
|
|
1
|
+
import { Schema, SchemaTransformation } from "effect"
|
|
2
|
+
import { FileDiff } from "./file-diff.js"
|
|
3
|
+
import { optional } from "./schema.js"
|
|
4
|
+
import { SessionMessage } from "./session-message.js"
|
|
5
|
+
import { Snapshot } from "./snapshot.js"
|
|
6
|
+
|
|
7
|
+
export interface Revert extends Schema.Schema.Type<typeof Revert> {}
|
|
8
|
+
export const Revert = Schema.Struct({
|
|
9
|
+
messageID: SessionMessage.ID,
|
|
10
|
+
/** Legacy V1 compatibility state. */
|
|
11
|
+
partID: Schema.String.pipe(optional),
|
|
12
|
+
snapshot: Snapshot.ID.pipe(optional),
|
|
13
|
+
files: Schema.Array(FileDiff.Info).pipe(optional),
|
|
14
|
+
}).annotate({ identifier: "Session.Revert" })
|
|
15
|
+
|
|
16
|
+
const FileDiffV1 = Schema.Struct({
|
|
17
|
+
path: Schema.String,
|
|
18
|
+
status: Schema.Literals(["added", "modified", "deleted"]),
|
|
19
|
+
additions: Schema.Finite,
|
|
20
|
+
deletions: Schema.Finite,
|
|
21
|
+
patch: Schema.String,
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
export interface RevertV1 extends Schema.Schema.Type<typeof RevertV1> {}
|
|
25
|
+
export const RevertV1 = Schema.Struct({
|
|
26
|
+
messageID: SessionMessage.ID,
|
|
27
|
+
partID: Schema.String.pipe(optional),
|
|
28
|
+
snapshot: Schema.String.pipe(optional),
|
|
29
|
+
diff: Schema.String.pipe(optional),
|
|
30
|
+
files: Schema.Array(FileDiffV1).pipe(optional),
|
|
31
|
+
}).annotate({ identifier: "Session.RevertV1" })
|
|
32
|
+
|
|
33
|
+
const PersistedCurrent = Revert.pipe(
|
|
34
|
+
Schema.decodeTo(
|
|
35
|
+
Schema.Struct({ source: Schema.tag("current"), revert: Schema.toType(Revert) }),
|
|
36
|
+
SchemaTransformation.transform({
|
|
37
|
+
decode: (revert): { readonly source: "current"; readonly revert: Revert } => ({
|
|
38
|
+
source: "current",
|
|
39
|
+
revert,
|
|
40
|
+
}),
|
|
41
|
+
encode: (value) => value.revert,
|
|
42
|
+
}),
|
|
43
|
+
),
|
|
44
|
+
)
|
|
45
|
+
const PersistedLegacy = RevertV1.pipe(
|
|
46
|
+
Schema.decodeTo(
|
|
47
|
+
Schema.Struct({ source: Schema.tag("legacy"), revert: Schema.toType(RevertV1) }),
|
|
48
|
+
SchemaTransformation.transform({
|
|
49
|
+
decode: (revert): { readonly source: "legacy"; readonly revert: RevertV1 } => ({
|
|
50
|
+
source: "legacy",
|
|
51
|
+
revert,
|
|
52
|
+
}),
|
|
53
|
+
encode: (value) => value.revert,
|
|
54
|
+
}),
|
|
55
|
+
),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
/** Storage decoder for revert state written before FileDiff became canonical. */
|
|
59
|
+
export const PersistedRevert = Schema.Union([PersistedCurrent, PersistedLegacy]).pipe(
|
|
60
|
+
Schema.toTaggedUnion("source"),
|
|
61
|
+
Schema.decodeTo(
|
|
62
|
+
Schema.toType(Revert),
|
|
63
|
+
SchemaTransformation.transform({
|
|
64
|
+
decode: (persisted): Revert => {
|
|
65
|
+
if (persisted.source === "current") return persisted.revert
|
|
66
|
+
return Revert.make({
|
|
67
|
+
messageID: persisted.revert.messageID,
|
|
68
|
+
partID: persisted.revert.partID,
|
|
69
|
+
snapshot: persisted.revert.snapshot ? Snapshot.ID.make(persisted.revert.snapshot) : undefined,
|
|
70
|
+
files: persisted.revert.files?.map((file) => ({
|
|
71
|
+
file: file.path,
|
|
72
|
+
status: file.status,
|
|
73
|
+
additions: file.additions,
|
|
74
|
+
deletions: file.deletions,
|
|
75
|
+
patch: file.patch,
|
|
76
|
+
})),
|
|
77
|
+
})
|
|
78
|
+
},
|
|
79
|
+
encode: (revert): { readonly source: "current"; readonly revert: Revert } => ({
|
|
80
|
+
source: "current",
|
|
81
|
+
revert,
|
|
82
|
+
}),
|
|
83
|
+
}),
|
|
84
|
+
),
|
|
85
|
+
Schema.annotate({ identifier: "Session.Revert.Persisted" }),
|
|
86
|
+
)
|
package/src/session-stats.ts
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
export * as SessionStats from "./session-stats.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
import { Model } from "./model.js"
|
|
5
|
-
import { Money } from "./money.js"
|
|
6
|
-
import { DateTimeUtcFromMillis, NonNegativeInt, optional } from "./schema.js"
|
|
7
|
-
import { TokenUsage } from "./token-usage.js"
|
|
8
|
-
|
|
9
|
-
export const Activity = Schema.Struct({
|
|
10
|
-
date: Schema.String,
|
|
11
|
-
steps: NonNegativeInt,
|
|
12
|
-
}).annotate({ identifier: "SessionStats.Activity" })
|
|
13
|
-
export type Activity = typeof Activity.Type
|
|
14
|
-
|
|
15
|
-
export const ModelUsage = Schema.Struct({
|
|
16
|
-
model: Model.Ref,
|
|
17
|
-
steps: NonNegativeInt,
|
|
18
|
-
tokens: TokenUsage.Info,
|
|
19
|
-
cost: Money.USD,
|
|
20
|
-
}).annotate({ identifier: "SessionStats.ModelUsage" })
|
|
21
|
-
export type ModelUsage = typeof ModelUsage.Type
|
|
22
|
-
|
|
23
|
-
export const ToolUsage = Schema.Struct({
|
|
24
|
-
name: Schema.String,
|
|
25
|
-
calls: NonNegativeInt,
|
|
26
|
-
succeeded: NonNegativeInt,
|
|
27
|
-
failed: NonNegativeInt,
|
|
28
|
-
unfinished: NonNegativeInt,
|
|
29
|
-
durationP50: Schema.Finite.pipe(optional),
|
|
30
|
-
}).annotate({ identifier: "SessionStats.ToolUsage" })
|
|
31
|
-
export type ToolUsage = typeof ToolUsage.Type
|
|
32
|
-
|
|
33
|
-
export const ToolMode = Schema.Literals(["none", "summary", "detail"])
|
|
34
|
-
export type ToolMode = typeof ToolMode.Type
|
|
35
|
-
|
|
36
|
-
export const ToolTotals = Schema.Struct({
|
|
37
|
-
calls: NonNegativeInt,
|
|
38
|
-
succeeded: NonNegativeInt,
|
|
39
|
-
failed: NonNegativeInt,
|
|
40
|
-
unfinished: NonNegativeInt,
|
|
41
|
-
}).annotate({ identifier: "SessionStats.ToolTotals" })
|
|
42
|
-
export type ToolTotals = typeof ToolTotals.Type
|
|
43
|
-
|
|
44
|
-
export const Tools = Schema.Union([
|
|
45
|
-
Schema.Struct({ mode: Schema.Literal("none") }),
|
|
46
|
-
Schema.Struct({ mode: Schema.Literal("summary"), totals: ToolTotals }),
|
|
47
|
-
Schema.Struct({ mode: Schema.Literal("detail"), totals: ToolTotals, usage: Schema.Array(ToolUsage) }),
|
|
48
|
-
]).annotate({ identifier: "SessionStats.Tools" })
|
|
49
|
-
export type Tools = typeof Tools.Type
|
|
50
|
-
|
|
51
|
-
export const Info = Schema.Struct({
|
|
52
|
-
range: Schema.Struct({
|
|
53
|
-
from: DateTimeUtcFromMillis,
|
|
54
|
-
to: DateTimeUtcFromMillis,
|
|
55
|
-
}),
|
|
56
|
-
sessions: NonNegativeInt,
|
|
57
|
-
subagents: NonNegativeInt,
|
|
58
|
-
prompts: NonNegativeInt,
|
|
59
|
-
steps: NonNegativeInt,
|
|
60
|
-
tokens: TokenUsage.Info,
|
|
61
|
-
cost: Money.USD,
|
|
62
|
-
tools: Tools,
|
|
63
|
-
activeDays: NonNegativeInt,
|
|
64
|
-
streak: NonNegativeInt,
|
|
65
|
-
activity: Schema.Array(Activity),
|
|
66
|
-
models: Schema.Array(ModelUsage),
|
|
67
|
-
}).annotate({ identifier: "SessionStats.Info" })
|
|
68
|
-
export type Info = typeof Info.Type
|
|
1
|
+
export * as SessionStats from "./session-stats.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
import { Model } from "./model.js"
|
|
5
|
+
import { Money } from "./money.js"
|
|
6
|
+
import { DateTimeUtcFromMillis, NonNegativeInt, optional } from "./schema.js"
|
|
7
|
+
import { TokenUsage } from "./token-usage.js"
|
|
8
|
+
|
|
9
|
+
export const Activity = Schema.Struct({
|
|
10
|
+
date: Schema.String,
|
|
11
|
+
steps: NonNegativeInt,
|
|
12
|
+
}).annotate({ identifier: "SessionStats.Activity" })
|
|
13
|
+
export type Activity = typeof Activity.Type
|
|
14
|
+
|
|
15
|
+
export const ModelUsage = Schema.Struct({
|
|
16
|
+
model: Model.Ref,
|
|
17
|
+
steps: NonNegativeInt,
|
|
18
|
+
tokens: TokenUsage.Info,
|
|
19
|
+
cost: Money.USD,
|
|
20
|
+
}).annotate({ identifier: "SessionStats.ModelUsage" })
|
|
21
|
+
export type ModelUsage = typeof ModelUsage.Type
|
|
22
|
+
|
|
23
|
+
export const ToolUsage = Schema.Struct({
|
|
24
|
+
name: Schema.String,
|
|
25
|
+
calls: NonNegativeInt,
|
|
26
|
+
succeeded: NonNegativeInt,
|
|
27
|
+
failed: NonNegativeInt,
|
|
28
|
+
unfinished: NonNegativeInt,
|
|
29
|
+
durationP50: Schema.Finite.pipe(optional),
|
|
30
|
+
}).annotate({ identifier: "SessionStats.ToolUsage" })
|
|
31
|
+
export type ToolUsage = typeof ToolUsage.Type
|
|
32
|
+
|
|
33
|
+
export const ToolMode = Schema.Literals(["none", "summary", "detail"])
|
|
34
|
+
export type ToolMode = typeof ToolMode.Type
|
|
35
|
+
|
|
36
|
+
export const ToolTotals = Schema.Struct({
|
|
37
|
+
calls: NonNegativeInt,
|
|
38
|
+
succeeded: NonNegativeInt,
|
|
39
|
+
failed: NonNegativeInt,
|
|
40
|
+
unfinished: NonNegativeInt,
|
|
41
|
+
}).annotate({ identifier: "SessionStats.ToolTotals" })
|
|
42
|
+
export type ToolTotals = typeof ToolTotals.Type
|
|
43
|
+
|
|
44
|
+
export const Tools = Schema.Union([
|
|
45
|
+
Schema.Struct({ mode: Schema.Literal("none") }),
|
|
46
|
+
Schema.Struct({ mode: Schema.Literal("summary"), totals: ToolTotals }),
|
|
47
|
+
Schema.Struct({ mode: Schema.Literal("detail"), totals: ToolTotals, usage: Schema.Array(ToolUsage) }),
|
|
48
|
+
]).annotate({ identifier: "SessionStats.Tools" })
|
|
49
|
+
export type Tools = typeof Tools.Type
|
|
50
|
+
|
|
51
|
+
export const Info = Schema.Struct({
|
|
52
|
+
range: Schema.Struct({
|
|
53
|
+
from: DateTimeUtcFromMillis,
|
|
54
|
+
to: DateTimeUtcFromMillis,
|
|
55
|
+
}),
|
|
56
|
+
sessions: NonNegativeInt,
|
|
57
|
+
subagents: NonNegativeInt,
|
|
58
|
+
prompts: NonNegativeInt,
|
|
59
|
+
steps: NonNegativeInt,
|
|
60
|
+
tokens: TokenUsage.Info,
|
|
61
|
+
cost: Money.USD,
|
|
62
|
+
tools: Tools,
|
|
63
|
+
activeDays: NonNegativeInt,
|
|
64
|
+
streak: NonNegativeInt,
|
|
65
|
+
activity: Schema.Array(Activity),
|
|
66
|
+
models: Schema.Array(ModelUsage),
|
|
67
|
+
}).annotate({ identifier: "SessionStats.Info" })
|
|
68
|
+
export type Info = typeof Info.Type
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
export * as SessionStatusEvent from "./session-status-event.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
import { optional } from "./schema.js"
|
|
5
|
-
import { Event } from "./event.js"
|
|
6
|
-
import { NonNegativeInt } from "./schema.js"
|
|
7
|
-
import { SessionID } from "./session-id.js"
|
|
8
|
-
|
|
9
|
-
export const Info = Schema.Union([
|
|
10
|
-
Schema.Struct({
|
|
11
|
-
type: Schema.Literal("idle"),
|
|
12
|
-
}),
|
|
13
|
-
Schema.Struct({
|
|
14
|
-
type: Schema.Literal("retry"),
|
|
15
|
-
attempt: NonNegativeInt,
|
|
16
|
-
message: Schema.String,
|
|
17
|
-
action: optional(
|
|
18
|
-
Schema.Struct({
|
|
19
|
-
reason: Schema.String,
|
|
20
|
-
provider: Schema.String,
|
|
21
|
-
title: Schema.String,
|
|
22
|
-
message: Schema.String,
|
|
23
|
-
label: Schema.String,
|
|
24
|
-
link: optional(Schema.String),
|
|
25
|
-
}),
|
|
26
|
-
),
|
|
27
|
-
next: NonNegativeInt,
|
|
28
|
-
}),
|
|
29
|
-
Schema.Struct({
|
|
30
|
-
type: Schema.Literal("busy"),
|
|
31
|
-
}),
|
|
32
|
-
]).annotate({ identifier: "SessionStatus" })
|
|
33
|
-
export type Info = Schema.Schema.Type<typeof Info>
|
|
34
|
-
|
|
35
|
-
export const Status = Event.ephemeral({
|
|
36
|
-
type: "session.status",
|
|
37
|
-
// The bare SessionStatus identifier belongs to the status union above.
|
|
38
|
-
identifier: "SessionStatusUpdated",
|
|
39
|
-
schema: {
|
|
40
|
-
sessionID: SessionID,
|
|
41
|
-
status: Info,
|
|
42
|
-
},
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
// deprecated
|
|
46
|
-
export const Idle = Event.ephemeral({
|
|
47
|
-
type: "session.idle",
|
|
48
|
-
schema: {
|
|
49
|
-
sessionID: SessionID,
|
|
50
|
-
},
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
export const Definitions = Event.inventory(Status, Idle)
|
|
1
|
+
export * as SessionStatusEvent from "./session-status-event.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
import { optional } from "./schema.js"
|
|
5
|
+
import { Event } from "./event.js"
|
|
6
|
+
import { NonNegativeInt } from "./schema.js"
|
|
7
|
+
import { SessionID } from "./session-id.js"
|
|
8
|
+
|
|
9
|
+
export const Info = Schema.Union([
|
|
10
|
+
Schema.Struct({
|
|
11
|
+
type: Schema.Literal("idle"),
|
|
12
|
+
}),
|
|
13
|
+
Schema.Struct({
|
|
14
|
+
type: Schema.Literal("retry"),
|
|
15
|
+
attempt: NonNegativeInt,
|
|
16
|
+
message: Schema.String,
|
|
17
|
+
action: optional(
|
|
18
|
+
Schema.Struct({
|
|
19
|
+
reason: Schema.String,
|
|
20
|
+
provider: Schema.String,
|
|
21
|
+
title: Schema.String,
|
|
22
|
+
message: Schema.String,
|
|
23
|
+
label: Schema.String,
|
|
24
|
+
link: optional(Schema.String),
|
|
25
|
+
}),
|
|
26
|
+
),
|
|
27
|
+
next: NonNegativeInt,
|
|
28
|
+
}),
|
|
29
|
+
Schema.Struct({
|
|
30
|
+
type: Schema.Literal("busy"),
|
|
31
|
+
}),
|
|
32
|
+
]).annotate({ identifier: "SessionStatus" })
|
|
33
|
+
export type Info = Schema.Schema.Type<typeof Info>
|
|
34
|
+
|
|
35
|
+
export const Status = Event.ephemeral({
|
|
36
|
+
type: "session.status",
|
|
37
|
+
// The bare SessionStatus identifier belongs to the status union above.
|
|
38
|
+
identifier: "SessionStatusUpdated",
|
|
39
|
+
schema: {
|
|
40
|
+
sessionID: SessionID,
|
|
41
|
+
status: Info,
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
// deprecated
|
|
46
|
+
export const Idle = Event.ephemeral({
|
|
47
|
+
type: "session.idle",
|
|
48
|
+
schema: {
|
|
49
|
+
sessionID: SessionID,
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
export const Definitions = Event.inventory(Status, Idle)
|
package/src/session-transfer.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * as SessionTransfer from "./session-transfer.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
import { Session } from "./session.js"
|
|
5
|
-
import { SessionMessage } from "./session-message.js"
|
|
6
|
-
|
|
7
|
-
export interface Data extends Schema.Schema.Type<typeof Data> {}
|
|
8
|
-
export const Data = Schema.Struct({
|
|
9
|
-
info: Session.Info,
|
|
10
|
-
messages: Schema.Array(SessionMessage.Info),
|
|
11
|
-
}).annotate({ identifier: "SessionTransfer.Data" })
|
|
1
|
+
export * as SessionTransfer from "./session-transfer.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
import { Session } from "./session.js"
|
|
5
|
+
import { SessionMessage } from "./session-message.js"
|
|
6
|
+
|
|
7
|
+
export interface Data extends Schema.Schema.Type<typeof Data> {}
|
|
8
|
+
export const Data = Schema.Struct({
|
|
9
|
+
info: Session.Info,
|
|
10
|
+
messages: Schema.Array(SessionMessage.Info),
|
|
11
|
+
}).annotate({ identifier: "SessionTransfer.Data" })
|
package/src/session-v1.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./v1/session.js"
|
|
1
|
+
export * from "./v1/session.js"
|