@kilocode/schema 0.0.0-stage → 0.0.0-v2-9
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 +179 -0
- package/dist/agent.js +45 -0
- package/dist/command.d.ts +76 -0
- package/dist/command.js +13 -0
- package/dist/config/agent.d.ts +42 -0
- package/dist/config/agent.js +21 -0
- package/dist/config/command.d.ts +28 -0
- package/dist/config/command.js +13 -0
- package/dist/config/compaction.d.ts +14 -0
- package/dist/config/compaction.js +13 -0
- package/dist/config/experimental.d.ts +20 -0
- package/dist/config/experimental.js +27 -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 +20 -0
- package/dist/config/mcp.js +15 -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 +392 -0
- package/dist/config/provider.js +109 -0
- package/dist/config/reference.d.ts +21 -0
- package/dist/config/reference.js +18 -0
- package/dist/config/shell.d.ts +9 -0
- package/dist/config/shell.js +7 -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 +13 -0
- package/dist/config/worktree.d.ts +7 -0
- package/dist/config/worktree.js +7 -0
- package/dist/config.d.ts +182 -0
- package/dist/config.js +135 -0
- package/dist/connection.d.ts +79 -0
- package/dist/connection.js +25 -0
- package/dist/credential-legacy.d.ts +54 -0
- package/dist/credential-legacy.js +19 -0
- package/dist/credential.d.ts +255 -0
- package/dist/credential.js +56 -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 +12865 -0
- package/dist/event-manifest.js +48 -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 +123 -0
- package/dist/filesystem.js +38 -0
- package/dist/form.d.ts +1438 -0
- package/dist/form.js +128 -0
- package/dist/identifier.d.ts +4 -0
- package/dist/identifier.js +25 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +41 -0
- package/dist/installation-event.d.ts +149 -0
- package/dist/installation-event.js +16 -0
- package/dist/instruction-entry.d.ts +29 -0
- package/dist/instruction-entry.js +26 -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 +2410 -0
- package/dist/integration.js +91 -0
- package/dist/kilocode/gateway.d.ts +975 -0
- package/dist/kilocode/gateway.js +328 -0
- package/dist/kilocode/handshake.d.ts +36 -0
- package/dist/kilocode/handshake.js +29 -0
- package/dist/kilocode/marketplace.d.ts +593 -0
- package/dist/kilocode/marketplace.js +122 -0
- package/dist/kilocode/provider-usage.d.ts +371 -0
- package/dist/kilocode/provider-usage.js +60 -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-event.d.ts +68 -0
- package/dist/location-event.js +5 -0
- package/dist/location.d.ts +56 -0
- package/dist/location.js +28 -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 +145 -0
- package/dist/mcp.js +120 -0
- package/dist/model-compatibility.d.ts +38 -0
- package/dist/model-compatibility.js +28 -0
- package/dist/model.d.ts +406 -0
- package/dist/model.js +115 -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 +22 -0
- package/dist/permission-saved.js +16 -0
- package/dist/permission-v1.d.ts +1 -0
- package/dist/permission-v1.js +1 -0
- package/dist/permission.d.ts +302 -0
- package/dist/permission.js +46 -0
- package/dist/persistent-pty.d.ts +539 -0
- package/dist/persistent-pty.js +55 -0
- package/dist/plugin.d.ts +132 -0
- package/dist/plugin.js +37 -0
- package/dist/project-id.d.ts +5 -0
- package/dist/project-id.js +3 -0
- package/dist/project.d.ts +270 -0
- package/dist/project.js +47 -0
- package/dist/prompt-input.d.ts +110 -0
- package/dist/prompt-input.js +21 -0
- package/dist/prompt.d.ts +297 -0
- package/dist/prompt.js +61 -0
- package/dist/provider.d.ts +275 -0
- package/dist/provider.js +66 -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.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/rpc.d.ts +111 -0
- package/dist/rpc.js +9 -0
- package/dist/schema.d.ts +11 -0
- package/dist/schema.js +17 -0
- package/dist/server-event.d.ts +132 -0
- package/dist/server-event.js +5 -0
- package/dist/session-error.d.ts +16 -0
- package/dist/session-error.js +11 -0
- package/dist/session-event.d.ts +21417 -0
- package/dist/session-event.js +565 -0
- package/dist/session-fork.d.ts +16 -0
- package/dist/session-fork.js +7 -0
- package/dist/session-id.d.ts +5 -0
- package/dist/session-id.js +6 -0
- package/dist/session-inbox.d.ts +756 -0
- package/dist/session-inbox.js +47 -0
- package/dist/session-legacy.d.ts +7 -0
- package/dist/session-legacy.js +118 -0
- package/dist/session-message.d.ts +2049 -0
- package/dist/session-message.js +234 -0
- package/dist/session-metadata.d.ts +8 -0
- package/dist/session-metadata.js +9 -0
- package/dist/session-revert.d.ts +896 -0
- package/dist/session-revert.js +63 -0
- package/dist/session-stats.d.ts +186 -0
- package/dist/session-stats.js +53 -0
- package/dist/session-status-event.d.ts +291 -0
- package/dist/session-status-event.js +45 -0
- package/dist/session-transfer.d.ts +910 -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 +320 -0
- package/dist/session.js +116 -0
- package/dist/shell.d.ts +386 -0
- package/dist/shell.js +61 -0
- package/dist/skill.d.ts +130 -0
- package/dist/skill.js +47 -0
- package/dist/snapshot.d.ts +4 -0
- package/dist/snapshot.js +3 -0
- package/dist/token-usage.d.ts +14 -0
- package/dist/token-usage.js +14 -0
- package/dist/tool.d.ts +78 -0
- package/dist/tool.js +22 -0
- package/dist/tui-event.d.ts +307 -0
- package/dist/tui-event.js +52 -0
- package/dist/v1/filesystem.d.ts +78 -0
- package/dist/v1/filesystem.js +8 -0
- package/dist/v1/legacy-event.d.ts +104 -0
- package/dist/v1/legacy-event.js +15 -0
- package/dist/v1/permission.d.ts +306 -0
- package/dist/v1/permission.js +41 -0
- package/dist/v1/session.d.ts +6977 -0
- package/dist/v1/session.js +531 -0
- package/dist/vcs-event.d.ts +76 -0
- package/dist/vcs-event.js +11 -0
- package/dist/vcs.d.ts +36 -0
- package/dist/vcs.js +24 -0
- package/dist/websearch.d.ts +108 -0
- package/dist/websearch.js +33 -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 +14 -0
- package/dist/workspace.d.ts +15 -0
- package/dist/workspace.js +14 -0
- package/dist/worktree-event.d.ts +153 -0
- package/dist/worktree-event.js +18 -0
- package/dist/worktree.d.ts +282 -0
- package/dist/worktree.js +83 -0
- package/package.json +42 -4
- package/README.md +0 -3
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * as SessionTransfer from "./session-transfer.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { Session } from "./session.js";
|
|
4
|
+
import { SessionMessage } from "./session-message.js";
|
|
5
|
+
export const Data = Schema.Struct({
|
|
6
|
+
info: Session.Info,
|
|
7
|
+
messages: Schema.Array(SessionMessage.Info),
|
|
8
|
+
}).annotate({ identifier: "SessionTransfer.Data" });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./v1/session.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./v1/session.js";
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
export * as Session from "./session.js";
|
|
2
|
+
import { Effect, Schema } from "effect";
|
|
3
|
+
import { SessionEvent } from "./session-event.js";
|
|
4
|
+
import { SessionID } from "./session-id.js";
|
|
5
|
+
import { SessionMetadata } from "./session-metadata.js";
|
|
6
|
+
import { Revert } from "./session-revert.js";
|
|
7
|
+
import { SessionFork } from "./session-fork.js";
|
|
8
|
+
export declare const ID: Schema.brand<Schema.String, "SessionID"> & {
|
|
9
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
10
|
+
};
|
|
11
|
+
export type ID = SessionID;
|
|
12
|
+
export declare const Metadata: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
13
|
+
export type Metadata = SessionMetadata;
|
|
14
|
+
export declare const Event: typeof SessionEvent;
|
|
15
|
+
export { Revert };
|
|
16
|
+
export declare const ForkBoundary: Schema.Union<readonly [Schema.Struct<{
|
|
17
|
+
readonly type: Schema.Literal<"before">;
|
|
18
|
+
readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
19
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
20
|
+
fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
21
|
+
};
|
|
22
|
+
}>, Schema.Struct<{
|
|
23
|
+
readonly type: Schema.Literal<"through">;
|
|
24
|
+
readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
25
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
26
|
+
fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
27
|
+
};
|
|
28
|
+
}>]>;
|
|
29
|
+
export type ForkBoundary = SessionFork.Boundary;
|
|
30
|
+
export interface Info extends Schema.Schema.Type<typeof Info> {
|
|
31
|
+
}
|
|
32
|
+
export declare const Info: Schema.Struct<{
|
|
33
|
+
readonly id: Schema.brand<Schema.String, "SessionID"> & {
|
|
34
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
35
|
+
};
|
|
36
|
+
readonly parentID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "SessionID"> & {
|
|
37
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
38
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "SessionID"> & {
|
|
39
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
40
|
+
}>, never, never>;
|
|
41
|
+
readonly fork: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
42
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
43
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
44
|
+
};
|
|
45
|
+
readonly boundary: Schema.Union<readonly [Schema.Struct<{
|
|
46
|
+
readonly type: Schema.Literal<"before">;
|
|
47
|
+
readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
48
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
49
|
+
fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
50
|
+
};
|
|
51
|
+
}>, Schema.Struct<{
|
|
52
|
+
readonly type: Schema.Literal<"through">;
|
|
53
|
+
readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
54
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
55
|
+
fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
56
|
+
};
|
|
57
|
+
}>]>;
|
|
58
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
59
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
60
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
61
|
+
};
|
|
62
|
+
readonly boundary: Schema.Union<readonly [Schema.Struct<{
|
|
63
|
+
readonly type: Schema.Literal<"before">;
|
|
64
|
+
readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
65
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
66
|
+
fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
67
|
+
};
|
|
68
|
+
}>, Schema.Struct<{
|
|
69
|
+
readonly type: Schema.Literal<"through">;
|
|
70
|
+
readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
71
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
72
|
+
fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
73
|
+
};
|
|
74
|
+
}>]>;
|
|
75
|
+
}>>, never, never>;
|
|
76
|
+
readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
|
|
77
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
78
|
+
};
|
|
79
|
+
readonly agent: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Agent.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Agent.ID">>, never, never>;
|
|
80
|
+
readonly model: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
81
|
+
readonly id: Schema.brand<Schema.String, "Model.ID">;
|
|
82
|
+
readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
|
|
83
|
+
opencode: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
84
|
+
anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
85
|
+
openai: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
86
|
+
google: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
87
|
+
googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
88
|
+
githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
89
|
+
amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
90
|
+
azure: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
91
|
+
openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
92
|
+
mistral: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
93
|
+
gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
94
|
+
};
|
|
95
|
+
readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
|
|
96
|
+
}> & {
|
|
97
|
+
parse: (input: string) => {
|
|
98
|
+
readonly id: string & import("effect/Brand").Brand<"Model.ID">;
|
|
99
|
+
readonly providerID: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
100
|
+
readonly variant?: (string & import("effect/Brand").Brand<"Model.VariantID">) | undefined;
|
|
101
|
+
};
|
|
102
|
+
}>>, Schema.optionalKey<Schema.Struct<{
|
|
103
|
+
readonly id: Schema.brand<Schema.String, "Model.ID">;
|
|
104
|
+
readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
|
|
105
|
+
opencode: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
106
|
+
anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
107
|
+
openai: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
108
|
+
google: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
109
|
+
googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
110
|
+
githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
111
|
+
amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
112
|
+
azure: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
113
|
+
openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
114
|
+
mistral: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
115
|
+
gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
116
|
+
};
|
|
117
|
+
readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
|
|
118
|
+
}> & {
|
|
119
|
+
parse: (input: string) => {
|
|
120
|
+
readonly id: string & import("effect/Brand").Brand<"Model.ID">;
|
|
121
|
+
readonly providerID: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
122
|
+
readonly variant?: (string & import("effect/Brand").Brand<"Model.VariantID">) | undefined;
|
|
123
|
+
};
|
|
124
|
+
}>, never, never>;
|
|
125
|
+
readonly cost: Schema.brand<Schema.Finite, "Money.USD"> & {
|
|
126
|
+
zero: number & import("effect/Brand").Brand<"Money.USD">;
|
|
127
|
+
};
|
|
128
|
+
readonly tokens: Schema.Struct<{
|
|
129
|
+
readonly input: Schema.Finite;
|
|
130
|
+
readonly output: Schema.Finite;
|
|
131
|
+
readonly reasoning: Schema.Finite;
|
|
132
|
+
readonly cache: Schema.Struct<{
|
|
133
|
+
readonly read: Schema.Finite;
|
|
134
|
+
readonly write: Schema.Finite;
|
|
135
|
+
}>;
|
|
136
|
+
}>;
|
|
137
|
+
/** Outcome of the last completed execution, recorded at `time.idle`. Absent until a run reaches a terminal transition. */
|
|
138
|
+
readonly outcome: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>>>, Schema.optionalKey<Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>>, never, never>;
|
|
139
|
+
readonly time: Schema.Struct<{
|
|
140
|
+
readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
141
|
+
readonly updated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
142
|
+
readonly idle: Schema.decodeTo<Schema.optional<Schema.toType<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>>, Schema.optionalKey<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>, never, never>;
|
|
143
|
+
readonly viewed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>>, Schema.optionalKey<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>, never, never>;
|
|
144
|
+
readonly archived: Schema.decodeTo<Schema.optional<Schema.toType<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>>, Schema.optionalKey<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>, never, never>;
|
|
145
|
+
}>;
|
|
146
|
+
readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
147
|
+
readonly location: Schema.Struct<{
|
|
148
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
149
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
150
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
151
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
152
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
153
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
154
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
155
|
+
}>, never, never>;
|
|
156
|
+
}>;
|
|
157
|
+
readonly subpath: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "RelativePath">>>, Schema.optionalKey<Schema.brand<Schema.String, "RelativePath">>, never, never>;
|
|
158
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>, never, never>;
|
|
159
|
+
/** Evaluated after the agent's rules; the last matching rule wins. */
|
|
160
|
+
readonly permissions: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
|
|
161
|
+
readonly action: Schema.String;
|
|
162
|
+
readonly resource: Schema.String;
|
|
163
|
+
readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
|
|
164
|
+
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
165
|
+
readonly action: Schema.String;
|
|
166
|
+
readonly resource: Schema.String;
|
|
167
|
+
readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
|
|
168
|
+
}>>>, never, never>;
|
|
169
|
+
readonly revert: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
170
|
+
readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
171
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
172
|
+
fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
173
|
+
};
|
|
174
|
+
readonly partID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
175
|
+
readonly snapshot: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Snapshot.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Snapshot.ID">>, never, never>;
|
|
176
|
+
readonly files: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
|
|
177
|
+
readonly file: Schema.String;
|
|
178
|
+
readonly patch: Schema.String;
|
|
179
|
+
readonly additions: Schema.Int;
|
|
180
|
+
readonly deletions: Schema.Int;
|
|
181
|
+
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
182
|
+
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
183
|
+
readonly file: Schema.String;
|
|
184
|
+
readonly patch: Schema.String;
|
|
185
|
+
readonly additions: Schema.Int;
|
|
186
|
+
readonly deletions: Schema.Int;
|
|
187
|
+
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
188
|
+
}>>>, never, never>;
|
|
189
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
190
|
+
readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
191
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
192
|
+
fromEvent: (eventID: string) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
193
|
+
};
|
|
194
|
+
readonly partID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
195
|
+
readonly snapshot: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Snapshot.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Snapshot.ID">>, never, never>;
|
|
196
|
+
readonly files: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
|
|
197
|
+
readonly file: Schema.String;
|
|
198
|
+
readonly patch: Schema.String;
|
|
199
|
+
readonly additions: Schema.Int;
|
|
200
|
+
readonly deletions: Schema.Int;
|
|
201
|
+
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
202
|
+
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
203
|
+
readonly file: Schema.String;
|
|
204
|
+
readonly patch: Schema.String;
|
|
205
|
+
readonly additions: Schema.Int;
|
|
206
|
+
readonly deletions: Schema.Int;
|
|
207
|
+
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
208
|
+
}>>>, never, never>;
|
|
209
|
+
}>>, never, never>;
|
|
210
|
+
}>;
|
|
211
|
+
export declare const ListAnchor: Schema.Struct<{
|
|
212
|
+
readonly id: Schema.brand<Schema.String, "SessionID"> & {
|
|
213
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
214
|
+
};
|
|
215
|
+
readonly time: Schema.Finite;
|
|
216
|
+
readonly direction: Schema.Literals<readonly ["previous", "next"]>;
|
|
217
|
+
}>;
|
|
218
|
+
export interface ListAnchor extends Schema.Schema.Type<typeof ListAnchor> {
|
|
219
|
+
}
|
|
220
|
+
export declare const ListFilter: Schema.Struct<{
|
|
221
|
+
readonly order: Schema.optional<Schema.Literals<readonly ["asc", "desc"]>>;
|
|
222
|
+
readonly search: Schema.optional<Schema.String>;
|
|
223
|
+
readonly parentID: Schema.optional<Schema.Union<readonly [Schema.brand<Schema.String, "SessionID"> & {
|
|
224
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
225
|
+
}, Schema.decodeTo<Schema.Null, Schema.Literal<"null">, never, never>]>>;
|
|
226
|
+
readonly archived: Schema.optional<Schema.decodeTo<Schema.Boolean, Schema.Literals<readonly ["true", "false"]>, never, never>>;
|
|
227
|
+
readonly directory: Schema.optional<Schema.brand<Schema.String, "AbsolutePath">>;
|
|
228
|
+
readonly project: Schema.optional<Schema.brand<Schema.String, "Project.ID"> & {
|
|
229
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
230
|
+
}>;
|
|
231
|
+
readonly subpath: Schema.optional<Schema.brand<Schema.String, "RelativePath">>;
|
|
232
|
+
}>;
|
|
233
|
+
export interface ListFilter extends Schema.Schema.Type<typeof ListFilter> {
|
|
234
|
+
}
|
|
235
|
+
declare const ListCursorInput: Schema.Union<readonly [Schema.Struct<{
|
|
236
|
+
readonly order: Schema.optional<Schema.Literals<readonly ["asc", "desc"]>>;
|
|
237
|
+
readonly search: Schema.optional<Schema.String>;
|
|
238
|
+
readonly parentID: Schema.optional<Schema.Union<readonly [Schema.brand<Schema.String, "SessionID"> & {
|
|
239
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
240
|
+
}, Schema.decodeTo<Schema.Null, Schema.Literal<"null">, never, never>]>>;
|
|
241
|
+
readonly archived: Schema.optional<Schema.decodeTo<Schema.Boolean, Schema.Literals<readonly ["true", "false"]>, never, never>>;
|
|
242
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
243
|
+
readonly anchor: Schema.Struct<{
|
|
244
|
+
readonly id: Schema.brand<Schema.String, "SessionID"> & {
|
|
245
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
246
|
+
};
|
|
247
|
+
readonly time: Schema.Finite;
|
|
248
|
+
readonly direction: Schema.Literals<readonly ["previous", "next"]>;
|
|
249
|
+
}>;
|
|
250
|
+
}>, Schema.Struct<{
|
|
251
|
+
readonly order: Schema.optional<Schema.Literals<readonly ["asc", "desc"]>>;
|
|
252
|
+
readonly search: Schema.optional<Schema.String>;
|
|
253
|
+
readonly parentID: Schema.optional<Schema.Union<readonly [Schema.brand<Schema.String, "SessionID"> & {
|
|
254
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
255
|
+
}, Schema.decodeTo<Schema.Null, Schema.Literal<"null">, never, never>]>>;
|
|
256
|
+
readonly archived: Schema.optional<Schema.decodeTo<Schema.Boolean, Schema.Literals<readonly ["true", "false"]>, never, never>>;
|
|
257
|
+
readonly project: Schema.brand<Schema.String, "Project.ID"> & {
|
|
258
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
259
|
+
};
|
|
260
|
+
readonly subpath: Schema.optional<Schema.brand<Schema.String, "RelativePath">>;
|
|
261
|
+
readonly anchor: Schema.Struct<{
|
|
262
|
+
readonly id: Schema.brand<Schema.String, "SessionID"> & {
|
|
263
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
264
|
+
};
|
|
265
|
+
readonly time: Schema.Finite;
|
|
266
|
+
readonly direction: Schema.Literals<readonly ["previous", "next"]>;
|
|
267
|
+
}>;
|
|
268
|
+
}>, Schema.Struct<{
|
|
269
|
+
readonly order: Schema.optional<Schema.Literals<readonly ["asc", "desc"]>>;
|
|
270
|
+
readonly search: Schema.optional<Schema.String>;
|
|
271
|
+
readonly parentID: Schema.optional<Schema.Union<readonly [Schema.brand<Schema.String, "SessionID"> & {
|
|
272
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
273
|
+
}, Schema.decodeTo<Schema.Null, Schema.Literal<"null">, never, never>]>>;
|
|
274
|
+
readonly archived: Schema.optional<Schema.decodeTo<Schema.Boolean, Schema.Literals<readonly ["true", "false"]>, never, never>>;
|
|
275
|
+
readonly anchor: Schema.Struct<{
|
|
276
|
+
readonly id: Schema.brand<Schema.String, "SessionID"> & {
|
|
277
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
278
|
+
};
|
|
279
|
+
readonly time: Schema.Finite;
|
|
280
|
+
readonly direction: Schema.Literals<readonly ["previous", "next"]>;
|
|
281
|
+
}>;
|
|
282
|
+
}>]>;
|
|
283
|
+
export declare const ListCursor: Schema.brand<Schema.String, "SessionsCursor"> & {
|
|
284
|
+
make: (input: typeof ListCursorInput.Type) => string & import("effect/Brand").Brand<"SessionsCursor">;
|
|
285
|
+
parse: (input: string) => Effect.Effect<{
|
|
286
|
+
readonly order?: "asc" | "desc" | undefined;
|
|
287
|
+
readonly search?: string | undefined;
|
|
288
|
+
readonly parentID?: (string & import("effect/Brand").Brand<"SessionID">) | null | undefined;
|
|
289
|
+
readonly archived?: boolean | undefined;
|
|
290
|
+
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
291
|
+
readonly anchor: {
|
|
292
|
+
readonly id: string & import("effect/Brand").Brand<"SessionID">;
|
|
293
|
+
readonly time: number;
|
|
294
|
+
readonly direction: "next" | "previous";
|
|
295
|
+
};
|
|
296
|
+
} | {
|
|
297
|
+
readonly order?: "asc" | "desc" | undefined;
|
|
298
|
+
readonly search?: string | undefined;
|
|
299
|
+
readonly parentID?: (string & import("effect/Brand").Brand<"SessionID">) | null | undefined;
|
|
300
|
+
readonly archived?: boolean | undefined;
|
|
301
|
+
readonly project: string & import("effect/Brand").Brand<"Project.ID">;
|
|
302
|
+
readonly subpath?: (string & import("effect/Brand").Brand<"RelativePath">) | undefined;
|
|
303
|
+
readonly anchor: {
|
|
304
|
+
readonly id: string & import("effect/Brand").Brand<"SessionID">;
|
|
305
|
+
readonly time: number;
|
|
306
|
+
readonly direction: "next" | "previous";
|
|
307
|
+
};
|
|
308
|
+
} | {
|
|
309
|
+
readonly order?: "asc" | "desc" | undefined;
|
|
310
|
+
readonly search?: string | undefined;
|
|
311
|
+
readonly parentID?: (string & import("effect/Brand").Brand<"SessionID">) | null | undefined;
|
|
312
|
+
readonly archived?: boolean | undefined;
|
|
313
|
+
readonly anchor: {
|
|
314
|
+
readonly id: string & import("effect/Brand").Brand<"SessionID">;
|
|
315
|
+
readonly time: number;
|
|
316
|
+
readonly direction: "next" | "previous";
|
|
317
|
+
};
|
|
318
|
+
}, "Invalid cursor", never>;
|
|
319
|
+
};
|
|
320
|
+
export type ListCursor = typeof ListCursor.Type;
|
package/dist/session.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export * as Session from "./session.js";
|
|
2
|
+
import { Effect, Result, Schema, SchemaGetter, SchemaParser } from "effect";
|
|
3
|
+
import { Base64Url } from "effect/encoding";
|
|
4
|
+
import { Agent } from "./agent.js";
|
|
5
|
+
import { Location } from "./location.js";
|
|
6
|
+
import { Model } from "./model.js";
|
|
7
|
+
import { Project } from "./project.js";
|
|
8
|
+
import { AbsolutePath, DateTimeUtcFromMillis, optional, RelativePath, statics } from "./schema.js";
|
|
9
|
+
import { SessionEvent } from "./session-event.js";
|
|
10
|
+
import { SessionID } from "./session-id.js";
|
|
11
|
+
import { SessionMetadata } from "./session-metadata.js";
|
|
12
|
+
import { Money } from "./money.js";
|
|
13
|
+
import { Permission } from "./permission.js";
|
|
14
|
+
import { TokenUsage } from "./token-usage.js";
|
|
15
|
+
import { Revert } from "./session-revert.js";
|
|
16
|
+
import { SessionFork } from "./session-fork.js";
|
|
17
|
+
export const ID = SessionID;
|
|
18
|
+
export const Metadata = SessionMetadata;
|
|
19
|
+
export const Event = SessionEvent;
|
|
20
|
+
export { Revert };
|
|
21
|
+
export const ForkBoundary = SessionFork.Boundary;
|
|
22
|
+
export const Info = Schema.Struct({
|
|
23
|
+
id: ID,
|
|
24
|
+
parentID: ID.pipe(optional),
|
|
25
|
+
fork: Schema.Struct({
|
|
26
|
+
sessionID: ID,
|
|
27
|
+
boundary: ForkBoundary,
|
|
28
|
+
}).pipe(optional),
|
|
29
|
+
projectID: Project.ID,
|
|
30
|
+
agent: Agent.ID.pipe(optional),
|
|
31
|
+
model: Model.Ref.pipe(optional),
|
|
32
|
+
cost: Money.USD,
|
|
33
|
+
tokens: TokenUsage.Info,
|
|
34
|
+
/** Outcome of the last completed execution, recorded at `time.idle`. Absent until a run reaches a terminal transition. */
|
|
35
|
+
outcome: Schema.Literals(["succeeded", "failed", "interrupted"]).pipe(optional),
|
|
36
|
+
time: Schema.Struct({
|
|
37
|
+
created: DateTimeUtcFromMillis,
|
|
38
|
+
updated: DateTimeUtcFromMillis,
|
|
39
|
+
idle: DateTimeUtcFromMillis.pipe(optional),
|
|
40
|
+
viewed: DateTimeUtcFromMillis.pipe(optional),
|
|
41
|
+
archived: DateTimeUtcFromMillis.pipe(optional),
|
|
42
|
+
}),
|
|
43
|
+
title: Schema.String.pipe(optional),
|
|
44
|
+
location: Location.Ref,
|
|
45
|
+
subpath: RelativePath.pipe(optional),
|
|
46
|
+
metadata: Metadata.pipe(optional),
|
|
47
|
+
/** Evaluated after the agent's rules; the last matching rule wins. */
|
|
48
|
+
permissions: Permission.Ruleset.pipe(optional),
|
|
49
|
+
revert: Revert.pipe(optional),
|
|
50
|
+
}).annotate({ identifier: "Session.Info" });
|
|
51
|
+
export const ListAnchor = Schema.Struct({
|
|
52
|
+
id: ID,
|
|
53
|
+
time: Schema.Finite,
|
|
54
|
+
direction: Schema.Literals(["previous", "next"]),
|
|
55
|
+
}).annotate({ identifier: "Session.ListAnchor" });
|
|
56
|
+
// These fields are also the session.list HTTP query parameters. Raw Schema.optional keeps that
|
|
57
|
+
// endpoint's OpenAPI parameters unchanged.
|
|
58
|
+
const ListFilterFields = {
|
|
59
|
+
order: Schema.Literals(["asc", "desc"]).pipe(Schema.optional).annotate({
|
|
60
|
+
description: "Session order for the first page. Use desc for newest first or asc for oldest first.",
|
|
61
|
+
}),
|
|
62
|
+
search: Schema.String.pipe(Schema.optional),
|
|
63
|
+
parentID: Schema.Union([
|
|
64
|
+
ID,
|
|
65
|
+
Schema.Null.pipe(Schema.encodeTo(Schema.Literal("null"), {
|
|
66
|
+
decode: SchemaGetter.transform(() => null),
|
|
67
|
+
encode: SchemaGetter.transform(() => "null"),
|
|
68
|
+
})),
|
|
69
|
+
])
|
|
70
|
+
.annotate({ description: "Filter by parent session. Use null to return only root sessions." })
|
|
71
|
+
.pipe(Schema.optional),
|
|
72
|
+
archived: Schema.Literals(["true", "false"])
|
|
73
|
+
.pipe(Schema.decodeTo(Schema.Boolean, {
|
|
74
|
+
decode: SchemaGetter.transform((value) => value === "true"),
|
|
75
|
+
encode: SchemaGetter.transform((value) => (value ? "true" : "false")),
|
|
76
|
+
}))
|
|
77
|
+
.annotate({
|
|
78
|
+
description: "Filter by archive state. Use true to return only archived sessions or false to exclude them. Omit to include both.",
|
|
79
|
+
})
|
|
80
|
+
.pipe(Schema.optional),
|
|
81
|
+
};
|
|
82
|
+
export const ListFilter = Schema.Struct({
|
|
83
|
+
...ListFilterFields,
|
|
84
|
+
directory: AbsolutePath.pipe(Schema.optional),
|
|
85
|
+
project: Project.ID.pipe(Schema.optional),
|
|
86
|
+
subpath: RelativePath.pipe(Schema.optional),
|
|
87
|
+
}).annotate({ identifier: "Session.ListFilter" });
|
|
88
|
+
const ListCursorInput = Schema.Union([
|
|
89
|
+
Schema.Struct({ ...ListFilterFields, directory: AbsolutePath, anchor: ListAnchor }),
|
|
90
|
+
Schema.Struct({
|
|
91
|
+
...ListFilterFields,
|
|
92
|
+
project: Project.ID,
|
|
93
|
+
subpath: RelativePath.pipe(Schema.optional),
|
|
94
|
+
anchor: ListAnchor,
|
|
95
|
+
}),
|
|
96
|
+
Schema.Struct({ ...ListFilterFields, anchor: ListAnchor }),
|
|
97
|
+
]);
|
|
98
|
+
const ListCursorJson = Schema.fromJsonString(ListCursorInput);
|
|
99
|
+
const encodeListCursor = Schema.encodeSync(ListCursorJson);
|
|
100
|
+
const decodeListCursor = Schema.decodeUnknownEffect(ListCursorJson);
|
|
101
|
+
export const ListCursor = Schema.String.pipe(Schema.brand("SessionsCursor"), Schema.annotate({
|
|
102
|
+
identifier: "SessionsCursor",
|
|
103
|
+
description: "Opaque pagination cursor returned as cursor.previous or cursor.next in the previous response.",
|
|
104
|
+
}), statics((schema) => {
|
|
105
|
+
// Read the default constructor without caching it on the schema, so `make` can be replaced.
|
|
106
|
+
const make = SchemaParser.make(schema);
|
|
107
|
+
return {
|
|
108
|
+
make: (input) => make(Base64Url.encode(encodeListCursor(input))),
|
|
109
|
+
parse: (input) => Effect.suspend(() => {
|
|
110
|
+
const result = Base64Url.decodeString(input);
|
|
111
|
+
return Result.isFailure(result)
|
|
112
|
+
? Effect.fail("Invalid cursor")
|
|
113
|
+
: decodeListCursor(result.success).pipe(Effect.mapError(() => "Invalid cursor"));
|
|
114
|
+
}),
|
|
115
|
+
};
|
|
116
|
+
}));
|