@nyte-ai/schema 0.0.0-stage → 0.0.18

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 (148) hide show
  1. package/LICENSE +21 -0
  2. package/THIRD-PARTY-NOTICES.md +800 -0
  3. package/dist/chunks/browser-0byq2fja.js +50 -0
  4. package/dist/chunks/browser-0ebnhqs2.js +36 -0
  5. package/dist/chunks/browser-0g0z3617.js +47 -0
  6. package/dist/chunks/browser-0khex2b1.js +33 -0
  7. package/dist/chunks/browser-1sfp0bcx.js +73 -0
  8. package/dist/chunks/browser-40enyw9r.js +75 -0
  9. package/dist/chunks/browser-48g24pes.js +106 -0
  10. package/dist/chunks/browser-4et7qtz3.js +7 -0
  11. package/dist/chunks/browser-5n1dh580.js +66 -0
  12. package/dist/chunks/browser-5pvw8svn.js +243 -0
  13. package/dist/chunks/browser-6e1madxa.js +83 -0
  14. package/dist/chunks/browser-6yby604e.js +96 -0
  15. package/dist/chunks/browser-7195qf3t.js +14 -0
  16. package/dist/chunks/browser-7gjnxy9m.js +172 -0
  17. package/dist/chunks/browser-8t9anqfc.js +113 -0
  18. package/dist/chunks/browser-9ystjh78.js +0 -0
  19. package/dist/chunks/browser-ad9yebg7.js +101 -0
  20. package/dist/chunks/browser-b519jtez.js +102 -0
  21. package/dist/chunks/browser-bg1esaw0.js +82 -0
  22. package/dist/chunks/browser-bxz3z1v6.js +181 -0
  23. package/dist/chunks/browser-e5xgzd28.js +82 -0
  24. package/dist/chunks/browser-ebr6k189.js +120 -0
  25. package/dist/chunks/browser-ekbecx9r.js +73 -0
  26. package/dist/chunks/browser-fd3accdr.js +159 -0
  27. package/dist/chunks/browser-fth801bw.js +50 -0
  28. package/dist/chunks/browser-g5khdcap.js +170 -0
  29. package/dist/chunks/browser-gchr2880.js +135 -0
  30. package/dist/chunks/browser-h86zs54a.js +65 -0
  31. package/dist/chunks/browser-hq5q56sf.js +79 -0
  32. package/dist/chunks/browser-j629a6wa.js +17 -0
  33. package/dist/chunks/browser-k20f6cvv.js +0 -0
  34. package/dist/chunks/browser-m0wzr0g8.js +5 -0
  35. package/dist/chunks/browser-mnejgne0.js +125 -0
  36. package/dist/chunks/browser-mzfc0v5j.js +58 -0
  37. package/dist/chunks/browser-pdv675va.js +135 -0
  38. package/dist/chunks/browser-pdx38ng3.js +301 -0
  39. package/dist/chunks/browser-qkxe0fwp.js +6 -0
  40. package/dist/chunks/browser-r00v3vwv.js +238 -0
  41. package/dist/chunks/browser-r87w64mz.js +32 -0
  42. package/dist/chunks/browser-s7907azt.js +118 -0
  43. package/dist/chunks/browser-sgwxbek9.js +37 -0
  44. package/dist/chunks/browser-v70eq512.js +215 -0
  45. package/dist/chunks/browser-vapnjwp3.js +35 -0
  46. package/dist/chunks/browser-vkh2tpmf.js +283 -0
  47. package/dist/chunks/browser-vzc3r2r3.js +64 -0
  48. package/dist/chunks/browser-ypez6s7v.js +52 -0
  49. package/dist/src/browser.d.ts +64 -0
  50. package/dist/src/browser.js +26 -0
  51. package/dist/src/configuration.d.ts +26 -0
  52. package/dist/src/configuration.js +17 -0
  53. package/dist/src/connection.d.ts +189 -0
  54. package/dist/src/connection.js +35 -0
  55. package/dist/src/declaration.d.ts +12 -0
  56. package/dist/src/declaration.js +1 -0
  57. package/dist/src/errors.d.ts +56 -0
  58. package/dist/src/errors.js +23 -0
  59. package/dist/src/events.d.ts +1750 -0
  60. package/dist/src/events.js +36 -0
  61. package/dist/src/files.d.ts +130 -0
  62. package/dist/src/files.js +49 -0
  63. package/dist/src/git.d.ts +271 -0
  64. package/dist/src/git.js +64 -0
  65. package/dist/src/github.d.ts +174 -0
  66. package/dist/src/github.js +31 -0
  67. package/dist/src/heads.d.ts +255 -0
  68. package/dist/src/heads.js +48 -0
  69. package/dist/src/hooks.d.ts +201 -0
  70. package/dist/src/hooks.js +28 -0
  71. package/dist/src/host.d.ts +137 -0
  72. package/dist/src/host.js +49 -0
  73. package/dist/src/ids.d.ts +66 -0
  74. package/dist/src/ids.js +67 -0
  75. package/dist/src/index.d.ts +30 -0
  76. package/dist/src/index.js +779 -0
  77. package/dist/src/jobs.d.ts +152 -0
  78. package/dist/src/jobs.js +34 -0
  79. package/dist/src/json.d.ts +24 -0
  80. package/dist/src/json.js +21 -0
  81. package/dist/src/mcp.d.ts +212 -0
  82. package/dist/src/mcp.js +34 -0
  83. package/dist/src/messages.d.ts +114 -0
  84. package/dist/src/messages.js +28 -0
  85. package/dist/src/model/index.d.ts +6 -0
  86. package/dist/src/model/index.js +61 -0
  87. package/dist/src/model/message.d.ts +178 -0
  88. package/dist/src/model/message.js +7 -0
  89. package/dist/src/model/model.d.ts +154 -0
  90. package/dist/src/model/model.js +11 -0
  91. package/dist/src/model/text.d.ts +6 -0
  92. package/dist/src/model/text.js +10 -0
  93. package/dist/src/model/tool.d.ts +36 -0
  94. package/dist/src/model/tool.js +1 -0
  95. package/dist/src/model/transcript.d.ts +34 -0
  96. package/dist/src/model/transcript.js +37 -0
  97. package/dist/src/model/typed.d.ts +6 -0
  98. package/dist/src/model/typed.js +8 -0
  99. package/dist/src/models.d.ts +195 -0
  100. package/dist/src/models.js +45 -0
  101. package/dist/src/parts.d.ts +364 -0
  102. package/dist/src/parts.js +35 -0
  103. package/dist/src/patch.d.ts +21 -0
  104. package/dist/src/patch.js +11 -0
  105. package/dist/src/plugins.d.ts +36 -0
  106. package/dist/src/plugins.js +9 -0
  107. package/dist/src/primitives.d.ts +83 -0
  108. package/dist/src/primitives.js +26 -0
  109. package/dist/src/runs.d.ts +433 -0
  110. package/dist/src/runs.js +39 -0
  111. package/dist/src/schema.d.ts +14 -0
  112. package/dist/src/schema.js +8 -0
  113. package/dist/src/serial.d.ts +18 -0
  114. package/dist/src/serial.js +39 -0
  115. package/dist/src/sessions.d.ts +578 -0
  116. package/dist/src/sessions.js +74 -0
  117. package/dist/src/store.d.ts +831 -0
  118. package/dist/src/store.js +33 -0
  119. package/dist/src/tools.d.ts +76 -0
  120. package/dist/src/tools.js +24 -0
  121. package/dist/src/views.d.ts +2737 -0
  122. package/dist/src/views.js +50 -0
  123. package/dist/src/wire/base64.d.ts +2 -0
  124. package/dist/src/wire/base64.js +6 -0
  125. package/dist/src/wire/nullable.d.ts +2 -0
  126. package/dist/src/wire/nullable.js +6 -0
  127. package/dist/src/wire/operations/browser.d.ts +535 -0
  128. package/dist/src/wire/operations/browser.js +12 -0
  129. package/dist/src/wire/operations/fields.d.ts +54 -0
  130. package/dist/src/wire/operations/fields.js +30 -0
  131. package/dist/src/wire/operations/files.d.ts +244 -0
  132. package/dist/src/wire/operations/files.js +13 -0
  133. package/dist/src/wire/operations/git.d.ts +513 -0
  134. package/dist/src/wire/operations/git.js +15 -0
  135. package/dist/src/wire/operations/github.d.ts +172 -0
  136. package/dist/src/wire/operations/github.js +12 -0
  137. package/dist/src/wire/operations/host.d.ts +1011 -0
  138. package/dist/src/wire/operations/host.js +27 -0
  139. package/dist/src/wire/operations/index.d.ts +6703 -0
  140. package/dist/src/wire/operations/index.js +40 -0
  141. package/dist/src/wire/operations/session.d.ts +3411 -0
  142. package/dist/src/wire/operations/session.js +25 -0
  143. package/dist/src/wire/operations/workspace.d.ts +830 -0
  144. package/dist/src/wire/operations/workspace.js +24 -0
  145. package/dist/src/workspaces.d.ts +119 -0
  146. package/dist/src/workspaces.js +38 -0
  147. package/package.json +51 -3
  148. package/README.md +0 -3
@@ -0,0 +1,243 @@
1
+ import {
2
+ idSchema2
3
+ } from "./browser-ypez6s7v.js";
4
+ import {
5
+ nullable2
6
+ } from "./browser-4et7qtz3.js";
7
+ import {
8
+ DiffOptionsType2,
9
+ ChangeSetSchema2,
10
+ PatchSetWireSchema2
11
+ } from "./browser-gchr2880.js";
12
+ import {
13
+ JobEndType2,
14
+ JobViewType2,
15
+ JobsChangeType2,
16
+ JobEndSchema2,
17
+ OutputFrameSchema2
18
+ } from "./browser-40enyw9r.js";
19
+ import {
20
+ McpServerConfigType2,
21
+ McpViewSchema2,
22
+ McpChangeSchema2
23
+ } from "./browser-b519jtez.js";
24
+ import {
25
+ CapabilityWireSchema2
26
+ } from "./browser-0byq2fja.js";
27
+ import {
28
+ stopOutcomeSchema2
29
+ } from "./browser-s7907azt.js";
30
+ import {
31
+ WorkspaceInfoSchema2
32
+ } from "./browser-bg1esaw0.js";
33
+ import {
34
+ WorkspaceCatalogViewType2,
35
+ CommandCompletionsSchema2,
36
+ WorkspaceCommandOutcomeSchema2
37
+ } from "./browser-7gjnxy9m.js";
38
+ import {
39
+ wireSchema2,
40
+ wireObject2,
41
+ WORKSPACE2,
42
+ NOTHING2,
43
+ ON_WORKSPACE2
44
+ } from "./browser-r87w64mz.js";
45
+
46
+ // src/wire/operations/workspace.ts
47
+ import { Type } from "typebox";
48
+ var PARTICIPANT = { authority: "participant", scope: "workspace" };
49
+ var OWNER = { authority: "owner", scope: "workspace" };
50
+ var JOB = { ...WORKSPACE2, job: idSchema2() };
51
+ var JOB_HANDLE = Type.Object({ ...JobViewType2.properties, key: nullable2(idSchema2()) });
52
+ var ON_JOB = wireObject2(JOB);
53
+ var WORKSPACE_CHANGE = wireSchema2(Type.Union([
54
+ Type.Object({ kind: Type.Literal("updated") }),
55
+ Type.Object({ kind: Type.Literal("missing") })
56
+ ]));
57
+ var JOBS = wireSchema2(Type.Array(JobViewType2));
58
+ var ON_SERVER = wireObject2({ ...WORKSPACE2, server: Type.String() });
59
+ var WORKSPACE_OPERATIONS2 = {
60
+ "workspace.info": {
61
+ ...PARTICIPANT,
62
+ kind: "query",
63
+ input: ON_WORKSPACE2,
64
+ output: WorkspaceInfoSchema2
65
+ },
66
+ "workspace.watch": {
67
+ ...PARTICIPANT,
68
+ kind: "watch",
69
+ input: ON_WORKSPACE2,
70
+ output: WorkspaceInfoSchema2
71
+ },
72
+ "workspace.catalog": {
73
+ ...PARTICIPANT,
74
+ kind: "query",
75
+ input: ON_WORKSPACE2,
76
+ output: wireSchema2(WorkspaceCatalogViewType2)
77
+ },
78
+ "workspace.command": {
79
+ ...PARTICIPANT,
80
+ kind: "command",
81
+ input: wireObject2({ ...WORKSPACE2, name: Type.String(), text: Type.String() }),
82
+ output: WorkspaceCommandOutcomeSchema2
83
+ },
84
+ "workspace.completeCommand": {
85
+ ...PARTICIPANT,
86
+ kind: "query",
87
+ input: wireObject2({ ...WORKSPACE2, name: Type.String(), prefix: Type.String() }),
88
+ output: CommandCompletionsSchema2
89
+ },
90
+ "mcp.watch": { ...OWNER, kind: "watch", input: ON_WORKSPACE2, output: McpViewSchema2 },
91
+ "mcp.reconnect": { ...OWNER, kind: "command", input: ON_SERVER, output: McpChangeSchema2 },
92
+ "mcp.setEnabled": {
93
+ ...OWNER,
94
+ kind: "command",
95
+ input: wireObject2({
96
+ ...WORKSPACE2,
97
+ server: Type.String(),
98
+ enabled: Type.Boolean()
99
+ }),
100
+ output: McpChangeSchema2
101
+ },
102
+ "mcp.login": {
103
+ ...OWNER,
104
+ kind: "command",
105
+ input: ON_SERVER,
106
+ output: wireObject2({ login: Type.String() })
107
+ },
108
+ "mcp.logout": { ...OWNER, kind: "command", input: ON_SERVER, output: McpChangeSchema2 },
109
+ "mcp.add": {
110
+ ...OWNER,
111
+ kind: "command",
112
+ input: wireObject2({
113
+ ...WORKSPACE2,
114
+ server: Type.String(),
115
+ config: McpServerConfigType2,
116
+ scope: Type.Enum(["user", "project"])
117
+ }),
118
+ output: McpChangeSchema2
119
+ },
120
+ "mcp.remove": {
121
+ ...OWNER,
122
+ kind: "command",
123
+ input: wireObject2({
124
+ ...WORKSPACE2,
125
+ server: Type.String(),
126
+ scope: Type.Enum(["user", "project"])
127
+ }),
128
+ output: McpChangeSchema2
129
+ },
130
+ "workspace.update": {
131
+ ...OWNER,
132
+ kind: "command",
133
+ input: wireObject2({
134
+ ...WORKSPACE2,
135
+ patch: Type.Object({ projectResources: Type.Optional(nullable2(Type.Boolean())) })
136
+ }),
137
+ output: WORKSPACE_CHANGE
138
+ },
139
+ "workspace.reload": { ...OWNER, kind: "command", input: ON_WORKSPACE2, output: WORKSPACE_CHANGE },
140
+ "workspace.changes": {
141
+ ...PARTICIPANT,
142
+ kind: "query",
143
+ input: wireObject2({ ...WORKSPACE2, run: idSchema2() }),
144
+ output: ChangeSetSchema2
145
+ },
146
+ "workspace.patches": {
147
+ ...PARTICIPANT,
148
+ kind: "stream",
149
+ input: wireObject2({
150
+ ...WORKSPACE2,
151
+ run: idSchema2(),
152
+ paths: Type.Array(Type.String()),
153
+ options: Type.Optional(DiffOptionsType2)
154
+ }),
155
+ output: PatchSetWireSchema2
156
+ },
157
+ "workspace.files": {
158
+ ...PARTICIPANT,
159
+ kind: "query",
160
+ input: ON_WORKSPACE2,
161
+ output: CapabilityWireSchema2
162
+ },
163
+ "workspace.git": {
164
+ ...PARTICIPANT,
165
+ kind: "query",
166
+ input: ON_WORKSPACE2,
167
+ output: CapabilityWireSchema2
168
+ },
169
+ "workspace.github": {
170
+ ...PARTICIPANT,
171
+ kind: "query",
172
+ input: ON_WORKSPACE2,
173
+ output: CapabilityWireSchema2
174
+ },
175
+ "workspace.browser": {
176
+ ...PARTICIPANT,
177
+ kind: "query",
178
+ input: ON_WORKSPACE2,
179
+ output: CapabilityWireSchema2
180
+ },
181
+ "jobs.start": {
182
+ ...PARTICIPANT,
183
+ kind: "command",
184
+ recovery: "replay",
185
+ input: wireObject2({
186
+ ...WORKSPACE2,
187
+ command: Type.Optional(Type.String()),
188
+ session: Type.Optional(idSchema2()),
189
+ title: Type.Optional(Type.String()),
190
+ pty: Type.Optional(Type.Object({ columns: Type.Number(), rows: Type.Number() })),
191
+ id: Type.Optional(idSchema2())
192
+ }),
193
+ output: wireSchema2(JOB_HANDLE)
194
+ },
195
+ "jobs.recover": {
196
+ ...PARTICIPANT,
197
+ kind: "command",
198
+ input: wireObject2({ ...WORKSPACE2, key: idSchema2() }),
199
+ output: wireSchema2(Type.Union([
200
+ JOB_HANDLE,
201
+ Type.Object({ kind: Type.Literal("ended"), end: JobEndType2 }),
202
+ Type.Object({ kind: Type.Literal("missing") })
203
+ ]))
204
+ },
205
+ "jobs.list": { ...PARTICIPANT, kind: "query", input: ON_WORKSPACE2, output: JOBS },
206
+ "jobs.watch": {
207
+ ...PARTICIPANT,
208
+ kind: "watch",
209
+ input: ON_WORKSPACE2,
210
+ output: wireSchema2(JobsChangeType2)
211
+ },
212
+ "job.write": {
213
+ ...PARTICIPANT,
214
+ kind: "command",
215
+ recovery: "never",
216
+ input: ON_JOB,
217
+ output: NOTHING2
218
+ },
219
+ "job.output": { ...PARTICIPANT, kind: "stream", input: ON_JOB, output: OutputFrameSchema2 },
220
+ "job.resize": {
221
+ ...PARTICIPANT,
222
+ kind: "command",
223
+ input: wireObject2({
224
+ ...JOB,
225
+ size: Type.Object({ columns: Type.Number(), rows: Type.Number() })
226
+ }),
227
+ output: wireSchema2(Type.Union([
228
+ Type.Object({ kind: Type.Literal("resized") }),
229
+ Type.Object({ kind: Type.Literal("not-pty") }),
230
+ Type.Object({ kind: Type.Literal("missing") })
231
+ ]))
232
+ },
233
+ "job.idle": { ...PARTICIPANT, kind: "query", input: ON_JOB, output: wireSchema2(Type.Boolean()) },
234
+ "job.stop": {
235
+ ...PARTICIPANT,
236
+ kind: "command",
237
+ input: ON_JOB,
238
+ output: stopOutcomeSchema2(JobEndType2)
239
+ },
240
+ "job.settled": { ...PARTICIPANT, kind: "query", wait: true, input: ON_JOB, output: JobEndSchema2 }
241
+ };
242
+
243
+ export { WORKSPACE_OPERATIONS2 };
@@ -0,0 +1,83 @@
1
+ import {
2
+ standard2
3
+ } from "./browser-vzc3r2r3.js";
4
+ import {
5
+ idSchema2
6
+ } from "./browser-ypez6s7v.js";
7
+ import {
8
+ nullable2
9
+ } from "./browser-4et7qtz3.js";
10
+ import {
11
+ ValidationIssueType2
12
+ } from "./browser-1sfp0bcx.js";
13
+ import {
14
+ JsonType2,
15
+ withJson2
16
+ } from "./browser-sgwxbek9.js";
17
+
18
+ // src/host.ts
19
+ import { Type } from "typebox";
20
+ var AuthorityType2 = Type.Enum(["participant", "owner", "maintenance"]);
21
+ var ExecutionCoverageType2 = Type.Union([
22
+ Type.Object({ kind: Type.Literal("all") }),
23
+ Type.Object({ kind: Type.Literal("workspace"), workspace: idSchema2() }),
24
+ Type.Object({ kind: Type.Literal("sessions"), sessions: Type.Array(idSchema2()) })
25
+ ]);
26
+ var AdvanceReportType2 = Type.Union([
27
+ Type.Object({ kind: Type.Literal("continue") }),
28
+ Type.Object({ kind: Type.Literal("idle") }),
29
+ Type.Object({ kind: Type.Literal("waiting"), until: nullable2(Type.Number()) }),
30
+ Type.Object({ kind: Type.Literal("retry"), until: Type.Number() }),
31
+ Type.Object({ kind: Type.Literal("busy"), until: Type.Number() }),
32
+ Type.Object({ kind: Type.Literal("fenced") })
33
+ ]);
34
+ var RepairPageType2 = Type.Object({
35
+ runnable: Type.Array(Type.Object({ session: idSchema2(), head: idSchema2() })),
36
+ next: nullable2(idSchema2())
37
+ });
38
+ var PrincipalViewWireType2 = Type.Object({
39
+ id: idSchema2(),
40
+ label: Type.String(),
41
+ authority: Type.Array(AuthorityType2),
42
+ pairedAt: Type.Number()
43
+ });
44
+ var PluginLoadOutcomeType2 = Type.Object({
45
+ kind: Type.Enum(["activated", "rejected", "kept-previous"]),
46
+ id: Type.String(),
47
+ issues: Type.Array(ValidationIssueType2)
48
+ });
49
+ var PluginCheckReportType2 = Type.Object({
50
+ plugins: Type.Array(PluginLoadOutcomeType2),
51
+ collisions: Type.Array(ValidationIssueType2)
52
+ });
53
+ var PluginReplacementReportType2 = Type.Object({
54
+ generation: idSchema2(),
55
+ plugins: Type.Array(PluginLoadOutcomeType2)
56
+ });
57
+ var DecodedObjectViewType2 = Type.Object({
58
+ id: idSchema2(),
59
+ kind: Type.String(),
60
+ parent: nullable2(idSchema2()),
61
+ body: JsonType2,
62
+ at: Type.Number()
63
+ });
64
+ var IntegrityReportType2 = Type.Object({
65
+ ok: Type.Boolean(),
66
+ issues: Type.Array(Type.Object({
67
+ ref: nullable2(Type.String()),
68
+ object: nullable2(idSchema2()),
69
+ message: Type.String()
70
+ }))
71
+ });
72
+ var AuthoritySchema2 = standard2(AuthorityType2);
73
+ var ExecutionCoverageSchema2 = standard2(ExecutionCoverageType2);
74
+ var AdvanceReportSchema2 = standard2(AdvanceReportType2);
75
+ var RepairPageSchema2 = standard2(RepairPageType2);
76
+ var PrincipalViewWireSchema2 = standard2(PrincipalViewWireType2);
77
+ var PluginLoadOutcomeSchema2 = standard2(PluginLoadOutcomeType2);
78
+ var PluginCheckReportSchema2 = standard2(PluginCheckReportType2);
79
+ var PluginReplacementReportSchema2 = standard2(PluginReplacementReportType2);
80
+ var DecodedObjectViewSchema2 = standard2(withJson2(DecodedObjectViewType2));
81
+ var IntegrityReportSchema2 = standard2(IntegrityReportType2);
82
+
83
+ export { AuthorityType2, ExecutionCoverageType2, AdvanceReportType2, RepairPageType2, PrincipalViewWireType2, PluginLoadOutcomeType2, PluginCheckReportType2, PluginReplacementReportType2, DecodedObjectViewType2, IntegrityReportType2, AuthoritySchema2, ExecutionCoverageSchema2, AdvanceReportSchema2, RepairPageSchema2, PrincipalViewWireSchema2, PluginLoadOutcomeSchema2, PluginCheckReportSchema2, PluginReplacementReportSchema2, DecodedObjectViewSchema2, IntegrityReportSchema2 };
@@ -0,0 +1,96 @@
1
+ import {
2
+ nullable2
3
+ } from "./browser-4et7qtz3.js";
4
+
5
+ // src/patch.ts
6
+ import { Type } from "typebox";
7
+ var HunkType2 = Type.Object({
8
+ oldStart: Type.Number(),
9
+ oldLines: Type.Number(),
10
+ newStart: Type.Number(),
11
+ newLines: Type.Number(),
12
+ header: nullable2(Type.String()),
13
+ lines: Type.Array(Type.Object({
14
+ kind: Type.Enum(["context", "add", "remove"]),
15
+ text: Type.String(),
16
+ noNewline: Type.Optional(Type.Literal(true))
17
+ }))
18
+ });
19
+ var HUNK_HEADER = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@ ?(.*)$/;
20
+ var MARKS = { add: "+", remove: "-", context: " " };
21
+ function writePatch2(path, status, hunks) {
22
+ const before = status === "added" || status === "untracked" ? "/dev/null" : `a/${path}`;
23
+ const after = status === "deleted" ? "/dev/null" : `b/${path}`;
24
+ const lines = [`diff --git a/${path} b/${path}`, `--- ${before}`, `+++ ${after}`];
25
+ for (const hunk of hunks) {
26
+ const header = hunk.header === null ? "" : ` ${hunk.header}`;
27
+ lines.push(`@@ -${String(hunk.oldStart)},${String(hunk.oldLines)} +${String(hunk.newStart)},${String(hunk.newLines)} @@${header}`);
28
+ for (const line of hunk.lines) {
29
+ lines.push(`${MARKS[line.kind]}${line.text}`);
30
+ if (line.noNewline === true)
31
+ lines.push("\");
32
+ }
33
+ }
34
+ return `${lines.join(`
35
+ `)}
36
+ `;
37
+ }
38
+ function readHunks2(patch) {
39
+ const lines = patch.split(`
40
+ `);
41
+ if (lines.at(-1) === "")
42
+ lines.pop();
43
+ const hunks = [];
44
+ let index = 0;
45
+ while (index < lines.length) {
46
+ const header = HUNK_HEADER.exec(lines[index] ?? "");
47
+ if (header === null) {
48
+ index += 1;
49
+ continue;
50
+ }
51
+ const oldLines = header[2] === undefined ? 1 : Number(header[2]);
52
+ const newLines = header[4] === undefined ? 1 : Number(header[4]);
53
+ const body = [];
54
+ let oldSeen = 0;
55
+ let newSeen = 0;
56
+ index += 1;
57
+ while (index < lines.length) {
58
+ const line = lines[index] ?? "";
59
+ if (line.startsWith("\\")) {
60
+ const last = body.pop();
61
+ if (last !== undefined)
62
+ body.push({ ...last, noNewline: true });
63
+ index += 1;
64
+ continue;
65
+ }
66
+ if (oldSeen >= oldLines && newSeen >= newLines)
67
+ break;
68
+ const mark = line[0];
69
+ if (mark === "+") {
70
+ body.push({ kind: "add", text: line.slice(1) });
71
+ newSeen += 1;
72
+ } else if (mark === "-") {
73
+ body.push({ kind: "remove", text: line.slice(1) });
74
+ oldSeen += 1;
75
+ } else if (mark === " " || line === "") {
76
+ body.push({ kind: "context", text: line.slice(1) });
77
+ oldSeen += 1;
78
+ newSeen += 1;
79
+ } else
80
+ break;
81
+ index += 1;
82
+ }
83
+ const text = header[5] ?? "";
84
+ hunks.push({
85
+ oldStart: Number(header[1]),
86
+ oldLines,
87
+ newStart: Number(header[3]),
88
+ newLines,
89
+ header: text === "" ? null : text,
90
+ lines: body
91
+ });
92
+ }
93
+ return hunks;
94
+ }
95
+
96
+ export { HunkType2, writePatch2, readHunks2 };
@@ -0,0 +1,14 @@
1
+ import {
2
+ typed2,
3
+ object2
4
+ } from "./browser-qkxe0fwp.js";
5
+
6
+ // src/model/message.ts
7
+ import { Type } from "typebox";
8
+ var TextSignatureV1Schema2 = typed2()(object2({
9
+ v: Type.Literal(1),
10
+ id: Type.String(),
11
+ phase: Type.Optional(Type.Union([Type.Literal("commentary"), Type.Literal("final_answer")]))
12
+ }));
13
+
14
+ export { TextSignatureV1Schema2 };
@@ -0,0 +1,172 @@
1
+ import {
2
+ standard2
3
+ } from "./browser-vzc3r2r3.js";
4
+ import {
5
+ idSchema2
6
+ } from "./browser-ypez6s7v.js";
7
+ import {
8
+ JsonType2,
9
+ JsonObjectType2,
10
+ withJson2
11
+ } from "./browser-sgwxbek9.js";
12
+ import {
13
+ UserContentType2,
14
+ PositionType2
15
+ } from "./browser-hq5q56sf.js";
16
+ import {
17
+ nullable2
18
+ } from "./browser-4et7qtz3.js";
19
+ import {
20
+ ModelRefType2
21
+ } from "./browser-8t9anqfc.js";
22
+ import {
23
+ ExecutionType2
24
+ } from "./browser-s7907azt.js";
25
+ import {
26
+ ActivationType2
27
+ } from "./browser-bg1esaw0.js";
28
+
29
+ // src/sessions.ts
30
+ import { Type } from "typebox";
31
+ var HeadInfoType2 = Type.Object({
32
+ name: idSchema2(),
33
+ tip: PositionType2,
34
+ stack: nullable2(Type.Object({ parent: idSchema2(), base: PositionType2, stale: Type.Boolean() })),
35
+ execution: ExecutionType2,
36
+ unread: Type.Boolean()
37
+ });
38
+ var SessionInfoType2 = Type.Object({
39
+ id: idSchema2(),
40
+ name: nullable2(Type.String()),
41
+ parent: nullable2(idSchema2()),
42
+ call: nullable2(idSchema2()),
43
+ workspace: idSchema2(),
44
+ pinned: Type.Boolean(),
45
+ archived: Type.Boolean(),
46
+ activation: ActivationType2,
47
+ heads: Type.Array(HeadInfoType2),
48
+ createdAt: Type.Number(),
49
+ lastActivityAt: Type.Number()
50
+ });
51
+ var CLIENT_COMMAND_NAMES2 = [
52
+ "accounts",
53
+ "cd",
54
+ "compact",
55
+ "continue",
56
+ "edit",
57
+ "help",
58
+ "login",
59
+ "logout",
60
+ "mcp",
61
+ "new",
62
+ "plugins",
63
+ "pr",
64
+ "quit",
65
+ "reload",
66
+ "resume",
67
+ "sessions",
68
+ "settings",
69
+ "skills",
70
+ "tasks",
71
+ "tree",
72
+ "trust",
73
+ "update",
74
+ "usage"
75
+ ];
76
+ var COMMAND_NAME2 = /^[a-z0-9][a-z0-9-]*$/u;
77
+ var CommandInfoType2 = Type.Object({
78
+ name: Type.String(),
79
+ owner: Type.String(),
80
+ side: Type.Enum(["core", "client"]),
81
+ title: Type.String(),
82
+ description: Type.String(),
83
+ takesText: Type.Boolean(),
84
+ completes: Type.Boolean(),
85
+ category: Type.Optional(Type.String()),
86
+ keywords: Type.Optional(Type.Array(Type.String()))
87
+ });
88
+ var CommandCompletionType2 = Type.Object({
89
+ value: Type.String(),
90
+ label: Type.String(),
91
+ description: Type.Optional(Type.String())
92
+ });
93
+ var SettingInfoType2 = Type.Object({
94
+ id: Type.String(),
95
+ owner: Type.String(),
96
+ scope: Type.Enum(["host", "session"]),
97
+ label: Type.String(),
98
+ schema: JsonObjectType2,
99
+ choices: nullable2(Type.Array(Type.Object({ value: JsonType2, label: Type.String(), badge: Type.Optional(Type.String()) }))),
100
+ value: JsonType2,
101
+ from: Type.Enum(["default", "host", "session"])
102
+ });
103
+ var SkillInfoType2 = Type.Object({
104
+ name: Type.String(),
105
+ owner: Type.String(),
106
+ description: Type.String(),
107
+ location: Type.String()
108
+ });
109
+ var AgentInfoType2 = Type.Object({
110
+ id: Type.String(),
111
+ owner: Type.String(),
112
+ description: nullable2(Type.String()),
113
+ model: nullable2(ModelRefType2),
114
+ mode: Type.Enum(["primary", "subagent", "all"])
115
+ });
116
+ var ToolInfoType2 = Type.Object({
117
+ name: Type.String(),
118
+ owner: Type.String(),
119
+ namespace: nullable2(Type.String()),
120
+ description: Type.String(),
121
+ parameters: JsonObjectType2,
122
+ output: nullable2(JsonObjectType2),
123
+ exposure: Type.Enum(["model", "deferred", "code", "hidden"])
124
+ });
125
+ var SessionCatalogViewType2 = Type.Object({
126
+ commands: Type.Array(CommandInfoType2),
127
+ settings: Type.Array(SettingInfoType2),
128
+ skills: Type.Array(SkillInfoType2),
129
+ agents: Type.Array(AgentInfoType2),
130
+ tools: Type.Array(ToolInfoType2)
131
+ });
132
+ var WorkspaceCatalogViewType2 = Type.Object({
133
+ commands: Type.Array(CommandInfoType2),
134
+ skills: Type.Array(SkillInfoType2)
135
+ });
136
+ var CommandOutcomeType2 = Type.Union([
137
+ Type.Object({ kind: Type.Literal("ran"), output: nullable2(Type.String()) }),
138
+ Type.Object({ kind: Type.Literal("sent"), receipt: idSchema2() }),
139
+ Type.Object({ kind: Type.Literal("unknown") }),
140
+ Type.Object({ kind: Type.Literal("failed"), message: Type.String() })
141
+ ]);
142
+ var WorkspaceCommandOutcomeType2 = Type.Union([
143
+ Type.Object({ kind: Type.Literal("ran"), output: nullable2(Type.String()) }),
144
+ Type.Object({ kind: Type.Literal("prompt"), content: UserContentType2 }),
145
+ Type.Object({ kind: Type.Literal("unknown") }),
146
+ Type.Object({ kind: Type.Literal("failed"), message: Type.String() })
147
+ ]);
148
+ var UpdateOutcomeType2 = Type.Union([
149
+ Type.Object({ kind: Type.Literal("updated") }),
150
+ Type.Object({ kind: Type.Literal("busy"), runs: Type.Array(idSchema2()) }),
151
+ Type.Object({ kind: Type.Literal("unknown-workspace") })
152
+ ]);
153
+ var RemoveSessionOutcomeType2 = Type.Union([
154
+ Type.Object({ kind: Type.Literal("removed") }),
155
+ Type.Object({ kind: Type.Literal("busy"), runs: Type.Array(idSchema2()) }),
156
+ Type.Object({ kind: Type.Literal("has-children"), children: Type.Array(idSchema2()) })
157
+ ]);
158
+ var HeadInfoSchema2 = standard2(withJson2(HeadInfoType2));
159
+ var SessionInfoSchema2 = standard2(withJson2(SessionInfoType2));
160
+ var CommandInfoSchema2 = standard2(withJson2(CommandInfoType2));
161
+ var SettingInfoSchema2 = standard2(withJson2(SettingInfoType2));
162
+ var SkillInfoSchema2 = standard2(SkillInfoType2);
163
+ var AgentInfoSchema2 = standard2(AgentInfoType2);
164
+ var ToolInfoSchema2 = standard2(withJson2(ToolInfoType2));
165
+ var SessionCatalogViewSchema2 = standard2(withJson2(SessionCatalogViewType2));
166
+ var CommandOutcomeSchema2 = standard2(CommandOutcomeType2);
167
+ var CommandCompletionsSchema2 = standard2(Type.Array(CommandCompletionType2));
168
+ var WorkspaceCommandOutcomeSchema2 = standard2(WorkspaceCommandOutcomeType2);
169
+ var UpdateOutcomeSchema2 = standard2(UpdateOutcomeType2);
170
+ var RemoveSessionOutcomeSchema2 = standard2(RemoveSessionOutcomeType2);
171
+
172
+ export { HeadInfoType2, SessionInfoType2, CLIENT_COMMAND_NAMES2, COMMAND_NAME2, CommandInfoType2, CommandCompletionType2, SettingInfoType2, SkillInfoType2, AgentInfoType2, ToolInfoType2, SessionCatalogViewType2, WorkspaceCatalogViewType2, CommandOutcomeType2, WorkspaceCommandOutcomeType2, UpdateOutcomeType2, RemoveSessionOutcomeType2, HeadInfoSchema2, SessionInfoSchema2, CommandInfoSchema2, SettingInfoSchema2, SkillInfoSchema2, AgentInfoSchema2, ToolInfoSchema2, SessionCatalogViewSchema2, CommandOutcomeSchema2, CommandCompletionsSchema2, WorkspaceCommandOutcomeSchema2, UpdateOutcomeSchema2, RemoveSessionOutcomeSchema2 };