@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.
Files changed (210) hide show
  1. package/dist/agent.d.ts +179 -0
  2. package/dist/agent.js +45 -0
  3. package/dist/command.d.ts +76 -0
  4. package/dist/command.js +13 -0
  5. package/dist/config/agent.d.ts +42 -0
  6. package/dist/config/agent.js +21 -0
  7. package/dist/config/command.d.ts +28 -0
  8. package/dist/config/command.js +13 -0
  9. package/dist/config/compaction.d.ts +14 -0
  10. package/dist/config/compaction.js +13 -0
  11. package/dist/config/experimental.d.ts +20 -0
  12. package/dist/config/experimental.js +27 -0
  13. package/dist/config/formatter.d.ts +11 -0
  14. package/dist/config/formatter.js +11 -0
  15. package/dist/config/lsp.d.ts +20 -0
  16. package/dist/config/lsp.js +16 -0
  17. package/dist/config/mcp.d.ts +20 -0
  18. package/dist/config/mcp.js +15 -0
  19. package/dist/config/media.d.ts +15 -0
  20. package/dist/config/media.js +14 -0
  21. package/dist/config/model.d.ts +18 -0
  22. package/dist/config/model.js +28 -0
  23. package/dist/config/plugin.d.ts +11 -0
  24. package/dist/config/plugin.js +10 -0
  25. package/dist/config/policy.d.ts +10 -0
  26. package/dist/config/policy.js +8 -0
  27. package/dist/config/provider.d.ts +392 -0
  28. package/dist/config/provider.js +109 -0
  29. package/dist/config/reference.d.ts +21 -0
  30. package/dist/config/reference.js +18 -0
  31. package/dist/config/shell.d.ts +9 -0
  32. package/dist/config/shell.js +7 -0
  33. package/dist/config/tool-output.d.ts +8 -0
  34. package/dist/config/tool-output.js +8 -0
  35. package/dist/config/warming.d.ts +10 -0
  36. package/dist/config/warming.js +16 -0
  37. package/dist/config/watcher.d.ts +7 -0
  38. package/dist/config/watcher.js +7 -0
  39. package/dist/config/websearch.d.ts +9 -0
  40. package/dist/config/websearch.js +13 -0
  41. package/dist/config/worktree.d.ts +7 -0
  42. package/dist/config/worktree.js +7 -0
  43. package/dist/config.d.ts +182 -0
  44. package/dist/config.js +135 -0
  45. package/dist/connection.d.ts +79 -0
  46. package/dist/connection.js +25 -0
  47. package/dist/credential-legacy.d.ts +54 -0
  48. package/dist/credential-legacy.js +19 -0
  49. package/dist/credential.d.ts +255 -0
  50. package/dist/credential.js +56 -0
  51. package/dist/durable-event-manifest.d.ts +3 -0
  52. package/dist/durable-event-manifest.js +5 -0
  53. package/dist/event-log.d.ts +14 -0
  54. package/dist/event-log.js +17 -0
  55. package/dist/event-manifest.d.ts +12865 -0
  56. package/dist/event-manifest.js +48 -0
  57. package/dist/event.d.ts +142 -0
  58. package/dist/event.js +110 -0
  59. package/dist/file-diff.d.ts +21 -0
  60. package/dist/file-diff.js +18 -0
  61. package/dist/filesystem-v1.d.ts +1 -0
  62. package/dist/filesystem-v1.js +1 -0
  63. package/dist/filesystem.d.ts +123 -0
  64. package/dist/filesystem.js +38 -0
  65. package/dist/form.d.ts +1438 -0
  66. package/dist/form.js +128 -0
  67. package/dist/identifier.d.ts +4 -0
  68. package/dist/identifier.js +25 -0
  69. package/dist/index.d.ts +41 -0
  70. package/dist/index.js +41 -0
  71. package/dist/installation-event.d.ts +149 -0
  72. package/dist/installation-event.js +16 -0
  73. package/dist/instruction-entry.d.ts +29 -0
  74. package/dist/instruction-entry.js +26 -0
  75. package/dist/instruction.d.ts +13 -0
  76. package/dist/instruction.js +8 -0
  77. package/dist/integration-id.d.ts +5 -0
  78. package/dist/integration-id.js +3 -0
  79. package/dist/integration.d.ts +2410 -0
  80. package/dist/integration.js +91 -0
  81. package/dist/kilocode/gateway.d.ts +975 -0
  82. package/dist/kilocode/gateway.js +328 -0
  83. package/dist/kilocode/handshake.d.ts +36 -0
  84. package/dist/kilocode/handshake.js +29 -0
  85. package/dist/kilocode/marketplace.d.ts +593 -0
  86. package/dist/kilocode/marketplace.js +122 -0
  87. package/dist/kilocode/provider-usage.d.ts +371 -0
  88. package/dist/kilocode/provider-usage.js +60 -0
  89. package/dist/legacy-event.d.ts +1 -0
  90. package/dist/legacy-event.js +1 -0
  91. package/dist/llm.d.ts +4 -0
  92. package/dist/llm.js +3 -0
  93. package/dist/location-event.d.ts +68 -0
  94. package/dist/location-event.js +5 -0
  95. package/dist/location.d.ts +56 -0
  96. package/dist/location.js +28 -0
  97. package/dist/lsp-event.d.ts +67 -0
  98. package/dist/lsp-event.js +4 -0
  99. package/dist/mcp-event.d.ts +222 -0
  100. package/dist/mcp-event.js +24 -0
  101. package/dist/mcp.d.ts +145 -0
  102. package/dist/mcp.js +120 -0
  103. package/dist/model-compatibility.d.ts +38 -0
  104. package/dist/model-compatibility.js +28 -0
  105. package/dist/model.d.ts +406 -0
  106. package/dist/model.js +115 -0
  107. package/dist/models-dev.d.ts +69 -0
  108. package/dist/models-dev.js +7 -0
  109. package/dist/money.d.ts +10 -0
  110. package/dist/money.js +5 -0
  111. package/dist/permission-saved.d.ts +22 -0
  112. package/dist/permission-saved.js +16 -0
  113. package/dist/permission-v1.d.ts +1 -0
  114. package/dist/permission-v1.js +1 -0
  115. package/dist/permission.d.ts +302 -0
  116. package/dist/permission.js +46 -0
  117. package/dist/persistent-pty.d.ts +539 -0
  118. package/dist/persistent-pty.js +55 -0
  119. package/dist/plugin.d.ts +132 -0
  120. package/dist/plugin.js +37 -0
  121. package/dist/project-id.d.ts +5 -0
  122. package/dist/project-id.js +3 -0
  123. package/dist/project.d.ts +270 -0
  124. package/dist/project.js +47 -0
  125. package/dist/prompt-input.d.ts +110 -0
  126. package/dist/prompt-input.js +21 -0
  127. package/dist/prompt.d.ts +297 -0
  128. package/dist/prompt.js +61 -0
  129. package/dist/provider.d.ts +275 -0
  130. package/dist/provider.js +66 -0
  131. package/dist/pty-ticket.d.ts +8 -0
  132. package/dist/pty-ticket.js +7 -0
  133. package/dist/pty.d.ts +462 -0
  134. package/dist/pty.js +43 -0
  135. package/dist/question.d.ts +15 -0
  136. package/dist/question.js +15 -0
  137. package/dist/reference.d.ts +120 -0
  138. package/dist/reference.js +30 -0
  139. package/dist/rpc.d.ts +111 -0
  140. package/dist/rpc.js +9 -0
  141. package/dist/schema.d.ts +11 -0
  142. package/dist/schema.js +17 -0
  143. package/dist/server-event.d.ts +132 -0
  144. package/dist/server-event.js +5 -0
  145. package/dist/session-error.d.ts +16 -0
  146. package/dist/session-error.js +11 -0
  147. package/dist/session-event.d.ts +21417 -0
  148. package/dist/session-event.js +565 -0
  149. package/dist/session-fork.d.ts +16 -0
  150. package/dist/session-fork.js +7 -0
  151. package/dist/session-id.d.ts +5 -0
  152. package/dist/session-id.js +6 -0
  153. package/dist/session-inbox.d.ts +756 -0
  154. package/dist/session-inbox.js +47 -0
  155. package/dist/session-legacy.d.ts +7 -0
  156. package/dist/session-legacy.js +118 -0
  157. package/dist/session-message.d.ts +2049 -0
  158. package/dist/session-message.js +234 -0
  159. package/dist/session-metadata.d.ts +8 -0
  160. package/dist/session-metadata.js +9 -0
  161. package/dist/session-revert.d.ts +896 -0
  162. package/dist/session-revert.js +63 -0
  163. package/dist/session-stats.d.ts +186 -0
  164. package/dist/session-stats.js +53 -0
  165. package/dist/session-status-event.d.ts +291 -0
  166. package/dist/session-status-event.js +45 -0
  167. package/dist/session-transfer.d.ts +910 -0
  168. package/dist/session-transfer.js +8 -0
  169. package/dist/session-v1.d.ts +1 -0
  170. package/dist/session-v1.js +1 -0
  171. package/dist/session.d.ts +320 -0
  172. package/dist/session.js +116 -0
  173. package/dist/shell.d.ts +386 -0
  174. package/dist/shell.js +61 -0
  175. package/dist/skill.d.ts +130 -0
  176. package/dist/skill.js +47 -0
  177. package/dist/snapshot.d.ts +4 -0
  178. package/dist/snapshot.js +3 -0
  179. package/dist/token-usage.d.ts +14 -0
  180. package/dist/token-usage.js +14 -0
  181. package/dist/tool.d.ts +78 -0
  182. package/dist/tool.js +22 -0
  183. package/dist/tui-event.d.ts +307 -0
  184. package/dist/tui-event.js +52 -0
  185. package/dist/v1/filesystem.d.ts +78 -0
  186. package/dist/v1/filesystem.js +8 -0
  187. package/dist/v1/legacy-event.d.ts +104 -0
  188. package/dist/v1/legacy-event.js +15 -0
  189. package/dist/v1/permission.d.ts +306 -0
  190. package/dist/v1/permission.js +41 -0
  191. package/dist/v1/session.d.ts +6977 -0
  192. package/dist/v1/session.js +531 -0
  193. package/dist/vcs-event.d.ts +76 -0
  194. package/dist/vcs-event.js +11 -0
  195. package/dist/vcs.d.ts +36 -0
  196. package/dist/vcs.js +24 -0
  197. package/dist/websearch.d.ts +108 -0
  198. package/dist/websearch.js +33 -0
  199. package/dist/workspace-event.d.ts +247 -0
  200. package/dist/workspace-event.js +25 -0
  201. package/dist/workspace-id.d.ts +6 -0
  202. package/dist/workspace-id.js +14 -0
  203. package/dist/workspace.d.ts +15 -0
  204. package/dist/workspace.js +14 -0
  205. package/dist/worktree-event.d.ts +153 -0
  206. package/dist/worktree-event.js +18 -0
  207. package/dist/worktree.d.ts +282 -0
  208. package/dist/worktree.js +83 -0
  209. package/package.json +42 -4
  210. package/README.md +0 -3
@@ -0,0 +1,47 @@
1
+ export * as SessionInbox from "./session-inbox.js";
2
+ import { Schema } from "effect";
3
+ import { Location } from "./location.js";
4
+ import { Project } from "./project.js";
5
+ import { Prompt } from "./prompt.js";
6
+ import { DateTimeUtcFromMillis, optional, RelativePath } from "./schema.js";
7
+ import { SessionID } from "./session-id.js";
8
+ import { SessionMessage } from "./session-message.js";
9
+ export const Delivery = Schema.Literals(["steer", "queue"]).annotate({ identifier: "Session.Inbox.Delivery" });
10
+ export const UserPayload = Schema.Struct({
11
+ ...Prompt.fields,
12
+ metadata: Schema.Record(Schema.String, Schema.Unknown).pipe(optional),
13
+ }).annotate({ identifier: "Session.Inbox.UserPayload" });
14
+ export const SyntheticPayload = Schema.Struct({
15
+ text: Schema.String,
16
+ description: Schema.String.pipe(optional),
17
+ metadata: Schema.Record(Schema.String, Schema.Unknown).pipe(optional),
18
+ }).annotate({ identifier: "Session.Inbox.SyntheticPayload" });
19
+ export const CompactionPayload = Schema.Struct({}).annotate({ identifier: "Session.Inbox.CompactionPayload" });
20
+ export const MovePayload = Schema.Struct({
21
+ location: Location.Ref,
22
+ projectID: Project.ID,
23
+ subpath: RelativePath.pipe(optional),
24
+ }).annotate({ identifier: "Session.Inbox.MovePayload" });
25
+ const UserItem = Schema.Struct({ type: Schema.tag("user"), payload: UserPayload, delivery: Delivery });
26
+ const SyntheticItem = Schema.Struct({ type: Schema.tag("synthetic"), payload: SyntheticPayload, delivery: Delivery });
27
+ const CompactionItem = Schema.Struct({
28
+ type: Schema.tag("compaction"),
29
+ payload: CompactionPayload,
30
+ delivery: Delivery,
31
+ });
32
+ const MoveItem = Schema.Struct({ type: Schema.tag("move"), payload: MovePayload, delivery: Delivery });
33
+ export const Item = Schema.Union([UserItem, SyntheticItem, CompactionItem, MoveItem]).pipe(Schema.toTaggedUnion("type"), Schema.annotate({ identifier: "Session.Inbox.Item" }));
34
+ const Enqueued = {
35
+ id: SessionMessage.ID,
36
+ sessionID: SessionID,
37
+ time: Schema.Struct({ created: DateTimeUtcFromMillis }),
38
+ };
39
+ export const User = Schema.Struct({ ...Enqueued, ...UserItem.fields }).annotate({ identifier: "Session.Inbox.User" });
40
+ export const Synthetic = Schema.Struct({ ...Enqueued, ...SyntheticItem.fields }).annotate({
41
+ identifier: "Session.Inbox.Synthetic",
42
+ });
43
+ export const Compaction = Schema.Struct({ ...Enqueued, ...CompactionItem.fields }).annotate({
44
+ identifier: "Session.Inbox.Compaction",
45
+ });
46
+ export const Move = Schema.Struct({ ...Enqueued, ...MoveItem.fields }).annotate({ identifier: "Session.Inbox.Move" });
47
+ export const Info = Schema.Union([User, Synthetic, Compaction, Move]).pipe(Schema.toTaggedUnion("type"), Schema.annotate({ identifier: "Session.Inbox.Info" }));
@@ -0,0 +1,7 @@
1
+ export * as SessionLegacy from "./session-legacy.js";
2
+ /** Upgrades a durable event payload by event type. */
3
+ export declare function event(type: string, data: unknown): unknown;
4
+ /** Upgrades a projected message's data by message type. */
5
+ export declare function message(type: unknown, data: Record<string, unknown>): Record<string, unknown>;
6
+ /** Upgrades complete messages, such as those in an exported session, before decoding. */
7
+ export declare function messages(values: ReadonlyArray<unknown>): unknown[];
@@ -0,0 +1,118 @@
1
+ export * as SessionLegacy from "./session-legacy.js";
2
+ /**
3
+ * Storage and wire compatibility for current-architecture data written before v2.1 (not V1 contracts). Native data
4
+ * was then named `state` or `providerState`, a tool's result native data `resultState` or `providerResultState`,
5
+ * summary compactions stored the text of the messages they kept in `recent`, and provider compactions stored their
6
+ * replacement window in `providerContext`. Stored events, projected messages, and exported transcripts keep whichever
7
+ * shape they were written with, so these upgrade them before decoding.
8
+ */
9
+ const renames = {
10
+ "session.text.ended": ["state", "native"],
11
+ "session.reasoning.started": ["state", "native"],
12
+ "session.reasoning.ended": ["state", "native"],
13
+ "session.tool.called": ["state", "native"],
14
+ "session.step.ended": ["providerState", "native"],
15
+ "session.step.failed": ["providerState", "native"],
16
+ "session.tool.success": ["resultState", "native"],
17
+ "session.tool.failed": ["resultState", "native"],
18
+ };
19
+ /** Upgrades a durable event payload by event type. */
20
+ export function event(type, data) {
21
+ if (!isRecord(data))
22
+ return data;
23
+ if (type === "session.message.content.updated")
24
+ return content(data);
25
+ // Messages carry a legacy compaction's kept text; its events have no reader for it.
26
+ if (type === "session.compaction.started")
27
+ return omit(data, "recent");
28
+ if (type === "session.compaction.ended")
29
+ return providerContext(omit(rename(data, "providerState", "native"), "recent"));
30
+ const entry = renames[type];
31
+ return entry ? rename(data, entry[0], entry[1]) : data;
32
+ }
33
+ /** Upgrades a projected message's data by message type. */
34
+ export function message(type, data) {
35
+ if (type === "assistant")
36
+ return content(rename(data, "providerState", "native"));
37
+ if (type === "compaction")
38
+ return providerContext(recent(rename(data, "providerState", "native")));
39
+ return data;
40
+ }
41
+ /** Upgrades complete messages, such as those in an exported session, before decoding. */
42
+ export function messages(values) {
43
+ return values.map((value) => (isRecord(value) ? message(value.type, value) : value));
44
+ }
45
+ function content(data) {
46
+ if (!Array.isArray(data.content))
47
+ return data;
48
+ return { ...data, content: data.content.map(part) };
49
+ }
50
+ function part(value) {
51
+ if (!isRecord(value))
52
+ return value;
53
+ if (value.type === "text" || value.type === "reasoning")
54
+ return rename(value, "state", "native");
55
+ // A tool part's own `state` is its lifecycle status, not native data.
56
+ if (value.type === "tool")
57
+ return toolResult(rename(value, "providerState", "native"));
58
+ return value;
59
+ }
60
+ /** Kept text a summary compaction stored before it referenced `metadata.keepID`; replay still reads it. */
61
+ function recent(data) {
62
+ const text = data.recent;
63
+ const rest = omit(data, "recent");
64
+ if (typeof text !== "string" || !text)
65
+ return rest;
66
+ const metadata = isRecord(rest.metadata) ? rest.metadata : {};
67
+ return { ...rest, metadata: { recent: text, ...metadata } };
68
+ }
69
+ /** The window moves to `native.messages`; the `native` stored beside it was never replayed. */
70
+ function providerContext(data) {
71
+ const context = data.providerContext;
72
+ const rest = omit(data, "providerContext");
73
+ if (!isRecord(context))
74
+ return rest;
75
+ return {
76
+ ...rest,
77
+ native: { messages: Array.isArray(context.messages) ? context.messages.map(media) : context.messages },
78
+ };
79
+ }
80
+ /** Before 2.0.15, window media parts stored `mediaType` and base64 `data` directly. */
81
+ function media(message) {
82
+ if (!isRecord(message) || !Array.isArray(message.content))
83
+ return message;
84
+ return {
85
+ ...message,
86
+ content: message.content.map((part) => {
87
+ if (!isRecord(part) || part.type !== "media" || part.media !== undefined || typeof part.data !== "string")
88
+ return part;
89
+ const { mediaType, data, ...rest } = part;
90
+ return { ...rest, media: { source: { type: "base64", data, mediaType } } };
91
+ }),
92
+ };
93
+ }
94
+ function omit(value, key) {
95
+ if (!(key in value))
96
+ return value;
97
+ const { [key]: _, ...rest } = value;
98
+ return rest;
99
+ }
100
+ // Result data now merges into the tool's single `native`, as projection does for current result events.
101
+ function toolResult(value) {
102
+ if (!("providerResultState" in value))
103
+ return value;
104
+ const { providerResultState, ...rest } = value;
105
+ if (!isRecord(providerResultState))
106
+ return rest;
107
+ return { ...rest, native: { ...(isRecord(rest.native) ? rest.native : {}), ...providerResultState } };
108
+ }
109
+ // The current name wins when a payload carries both.
110
+ function rename(value, from, to) {
111
+ if (!(from in value))
112
+ return value;
113
+ const { [from]: moved, ...rest } = value;
114
+ return to in rest ? rest : { ...rest, [to]: moved };
115
+ }
116
+ function isRecord(value) {
117
+ return typeof value === "object" && value !== null && !Array.isArray(value);
118
+ }