@nyte-ai/schema 0.0.0-stage → 0.0.19

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 +866 -0
  3. package/dist/chunks/browser-0byq2fja.js +50 -0
  4. package/dist/chunks/browser-0chm3654.js +125 -0
  5. package/dist/chunks/browser-0g0z3617.js +47 -0
  6. package/dist/chunks/browser-0khex2b1.js +33 -0
  7. package/dist/chunks/browser-0sbkxgkx.js +115 -0
  8. package/dist/chunks/browser-0xr6c36r.js +106 -0
  9. package/dist/chunks/browser-1nqahr9q.js +239 -0
  10. package/dist/chunks/browser-1sfp0bcx.js +73 -0
  11. package/dist/chunks/browser-3exd93gm.js +50 -0
  12. package/dist/chunks/browser-40enyw9r.js +75 -0
  13. package/dist/chunks/browser-4et7qtz3.js +7 -0
  14. package/dist/chunks/browser-6e1madxa.js +83 -0
  15. package/dist/chunks/browser-6yby604e.js +96 -0
  16. package/dist/chunks/browser-7195qf3t.js +14 -0
  17. package/dist/chunks/browser-8ancsy4m.js +118 -0
  18. package/dist/chunks/browser-9ystjh78.js +0 -0
  19. package/dist/chunks/browser-b519jtez.js +102 -0
  20. package/dist/chunks/browser-bg1esaw0.js +82 -0
  21. package/dist/chunks/browser-ebr6k189.js +120 -0
  22. package/dist/chunks/browser-ekbecx9r.js +73 -0
  23. package/dist/chunks/browser-fd3accdr.js +159 -0
  24. package/dist/chunks/browser-g5khdcap.js +170 -0
  25. package/dist/chunks/browser-h5k4hqfq.js +244 -0
  26. package/dist/chunks/browser-h86zs54a.js +65 -0
  27. package/dist/chunks/browser-hp9ze9ga.js +185 -0
  28. package/dist/chunks/browser-hq5q56sf.js +79 -0
  29. package/dist/chunks/browser-j150etqf.js +101 -0
  30. package/dist/chunks/browser-j629a6wa.js +17 -0
  31. package/dist/chunks/browser-jgxe05s4.js +301 -0
  32. package/dist/chunks/browser-k20f6cvv.js +0 -0
  33. package/dist/chunks/browser-m0wzr0g8.js +5 -0
  34. package/dist/chunks/browser-mzfc0v5j.js +58 -0
  35. package/dist/chunks/browser-p691tcac.js +139 -0
  36. package/dist/chunks/browser-pdv675va.js +135 -0
  37. package/dist/chunks/browser-pvfshqyk.js +36 -0
  38. package/dist/chunks/browser-qkxe0fwp.js +6 -0
  39. package/dist/chunks/browser-qncc807c.js +66 -0
  40. package/dist/chunks/browser-r87w64mz.js +32 -0
  41. package/dist/chunks/browser-s2xe7c21.js +82 -0
  42. package/dist/chunks/browser-sgst60b0.js +293 -0
  43. package/dist/chunks/browser-sgwxbek9.js +37 -0
  44. package/dist/chunks/browser-v70eq512.js +215 -0
  45. package/dist/chunks/browser-vzc3r2r3.js +64 -0
  46. package/dist/chunks/browser-xensz05x.js +172 -0
  47. package/dist/chunks/browser-ynj8v9ad.js +35 -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 +1752 -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 +280 -0
  64. package/dist/src/git.js +66 -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 +783 -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 +198 -0
  100. package/dist/src/models.js +47 -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 +830 -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 +3105 -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 +1031 -0
  138. package/dist/src/wire/operations/host.js +27 -0
  139. package/dist/src/wire/operations/index.d.ts +7103 -0
  140. package/dist/src/wire/operations/index.js +40 -0
  141. package/dist/src/wire/operations/session.d.ts +3779 -0
  142. package/dist/src/wire/operations/session.js +25 -0
  143. package/dist/src/wire/operations/workspace.d.ts +842 -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,170 @@
1
+ import {
2
+ contentText2,
3
+ getSystemMessageText2
4
+ } from "./browser-0khex2b1.js";
5
+
6
+ // src/model/transcript.ts
7
+ var transcriptContextBrand = Symbol("TranscriptContext");
8
+ function transcriptContext(messages, checkpoint) {
9
+ return {
10
+ messages,
11
+ ...checkpoint === undefined ? {} : { checkpoint },
12
+ [transcriptContextBrand]: true
13
+ };
14
+ }
15
+ function createInitialSystemMessage2(systemPrompt, tools) {
16
+ const hasSystemPrompt = systemPrompt !== undefined && systemPrompt.length > 0;
17
+ const hasTools = tools !== undefined && tools.length > 0;
18
+ if (!hasSystemPrompt && !hasTools)
19
+ return;
20
+ return {
21
+ role: "system",
22
+ content: systemPrompt ?? "",
23
+ ...hasTools ? { toolsAdded: tools } : {},
24
+ timestamp: 0
25
+ };
26
+ }
27
+ function normalizeContext2(context) {
28
+ const initialMessage = createInitialSystemMessage2(context.systemPrompt, context.tools);
29
+ const messages = initialMessage ? [initialMessage, ...context.messages] : context.messages;
30
+ return transcriptContext(messages, context.checkpoint);
31
+ }
32
+ function getInitialSystemMessage2(messages) {
33
+ const first = messages[0];
34
+ return first && first.role === "system" ? first : undefined;
35
+ }
36
+ function withoutInitialSystemMessage2(messages) {
37
+ return getInitialSystemMessage2(messages) ? messages.slice(1) : messages;
38
+ }
39
+ function getCurrentTools2(messages) {
40
+ const tools = new Map;
41
+ for (const message of messages) {
42
+ if (message.role !== "system")
43
+ continue;
44
+ for (const tool of message.toolsRemoved ?? [])
45
+ tools.delete(tool.name);
46
+ for (const tool of message.toolsAdded ?? [])
47
+ tools.set(tool.name, tool);
48
+ }
49
+ return [...tools.values()];
50
+ }
51
+ function getCurrentSystemMessage2(messages) {
52
+ const content = [];
53
+ const sections = new Map;
54
+ let timestamp;
55
+ for (const message of messages) {
56
+ if (message.role !== "system")
57
+ continue;
58
+ timestamp ??= message.timestamp;
59
+ const text = contentText2(message.content);
60
+ if (text.length > 0)
61
+ content.push(text);
62
+ for (const [name, value] of Object.entries(message.sections ?? {})) {
63
+ if (value === null)
64
+ sections.delete(name);
65
+ else
66
+ sections.set(name, value);
67
+ }
68
+ }
69
+ const tools = getCurrentTools2(messages);
70
+ if (timestamp === undefined && tools.length === 0)
71
+ return;
72
+ return {
73
+ role: "system",
74
+ content: content.join(`
75
+
76
+ `),
77
+ ...sections.size > 0 ? { sections: Object.fromEntries(sections) } : {},
78
+ ...tools.length > 0 ? { toolsAdded: tools } : {},
79
+ timestamp: timestamp ?? 0
80
+ };
81
+ }
82
+ function getCurrentSystemPrompt2(messages) {
83
+ const message = getCurrentSystemMessage2(messages);
84
+ return message ? getSystemMessageText2(message) : "";
85
+ }
86
+ function collapseSystemMessages2(context) {
87
+ const head = getCurrentSystemMessage2(context.messages);
88
+ const messages = context.messages.filter((message) => message.role !== "system");
89
+ return transcriptContext(head ? [head, ...messages] : messages, context.checkpoint);
90
+ }
91
+ function resolveTranscript2(context, supportsMidConvoSystemMessages) {
92
+ return supportsMidConvoSystemMessages ? context : collapseSystemMessages2(context);
93
+ }
94
+ function toToolDeclaration2(tool) {
95
+ const parameters = JSON.parse(JSON.stringify(tool.parameters));
96
+ if (typeof parameters !== "object" || parameters === null) {
97
+ throw new Error(`Tool ${tool.name} parameters did not survive a JSON round trip`);
98
+ }
99
+ return {
100
+ name: tool.name,
101
+ description: tool.description,
102
+ parameters,
103
+ ...tool.constrainedSampling === undefined ? {} : { constrainedSampling: tool.constrainedSampling }
104
+ };
105
+ }
106
+ function declarationsEqual2(left, right) {
107
+ return JSON.stringify(toToolDeclaration2(left)) === JSON.stringify(toToolDeclaration2(right));
108
+ }
109
+ function getToolStateChanges2(previous, current) {
110
+ const previousTools = new Map(previous.map((tool) => [tool.name, tool]));
111
+ const currentTools = new Map(current.map((tool) => [tool.name, tool]));
112
+ return {
113
+ toolsAdded: current.filter((tool) => {
114
+ const previousTool = previousTools.get(tool.name);
115
+ return previousTool === undefined || !declarationsEqual2(previousTool, tool);
116
+ }).map(toToolDeclaration2),
117
+ toolsRemoved: previous.filter((tool) => {
118
+ const currentTool = currentTools.get(tool.name);
119
+ return currentTool === undefined || !declarationsEqual2(tool, currentTool);
120
+ }).map((tool) => ({ name: tool.name }))
121
+ };
122
+ }
123
+ function getDeclaredTools2(messages) {
124
+ const definitions = new Map;
125
+ for (const message of messages) {
126
+ if (message.role !== "system")
127
+ continue;
128
+ for (const tool of message.toolsAdded ?? [])
129
+ definitions.set(tool.name, tool);
130
+ }
131
+ return [...definitions.values()];
132
+ }
133
+ function hasToolRedefinitions2(messages) {
134
+ const declared = new Map;
135
+ for (const message of messages) {
136
+ if (message.role !== "system")
137
+ continue;
138
+ for (const tool of message.toolsAdded ?? []) {
139
+ const previous = declared.get(tool.name);
140
+ if (previous !== undefined && !declarationsEqual2(previous, tool))
141
+ return true;
142
+ declared.set(tool.name, tool);
143
+ }
144
+ }
145
+ return false;
146
+ }
147
+ function hasNonAdditiveToolChanges2(messages) {
148
+ const declared = new Set;
149
+ for (const message of messages) {
150
+ if (message.role !== "system")
151
+ continue;
152
+ if ((message.toolsRemoved?.length ?? 0) > 0)
153
+ return true;
154
+ for (const tool of message.toolsAdded ?? []) {
155
+ if (declared.has(tool.name))
156
+ return true;
157
+ declared.add(tool.name);
158
+ }
159
+ }
160
+ return false;
161
+ }
162
+ function resolveTranscriptTools2(messages, supportsToolAdditions) {
163
+ const anchorsAdditions = supportsToolAdditions && !hasNonAdditiveToolChanges2(messages);
164
+ return {
165
+ requestTools: anchorsAdditions ? getInitialSystemMessage2(messages)?.toolsAdded ?? [] : getCurrentTools2(messages),
166
+ anchorsAdditions
167
+ };
168
+ }
169
+
170
+ export { createInitialSystemMessage2, normalizeContext2, getInitialSystemMessage2, withoutInitialSystemMessage2, getCurrentTools2, getCurrentSystemMessage2, getCurrentSystemPrompt2, collapseSystemMessages2, resolveTranscript2, toToolDeclaration2, declarationsEqual2, getToolStateChanges2, getDeclaredTools2, hasToolRedefinitions2, hasNonAdditiveToolChanges2, resolveTranscriptTools2 };
@@ -0,0 +1,244 @@
1
+ import {
2
+ idSchema2
3
+ } from "./browser-ypez6s7v.js";
4
+ import {
5
+ nullable2
6
+ } from "./browser-4et7qtz3.js";
7
+ import {
8
+ ChangeSourceType2,
9
+ DiffOptionsType2,
10
+ ChangeSetSchema2,
11
+ PatchSetWireSchema2
12
+ } from "./browser-p691tcac.js";
13
+ import {
14
+ JobEndType2,
15
+ JobViewType2,
16
+ JobsChangeType2,
17
+ JobEndSchema2,
18
+ OutputFrameSchema2
19
+ } from "./browser-40enyw9r.js";
20
+ import {
21
+ McpServerConfigType2,
22
+ McpViewSchema2,
23
+ McpChangeSchema2
24
+ } from "./browser-b519jtez.js";
25
+ import {
26
+ CapabilityWireSchema2
27
+ } from "./browser-0byq2fja.js";
28
+ import {
29
+ stopOutcomeSchema2
30
+ } from "./browser-8ancsy4m.js";
31
+ import {
32
+ WorkspaceInfoSchema2
33
+ } from "./browser-bg1esaw0.js";
34
+ import {
35
+ WorkspaceCatalogViewType2,
36
+ CommandCompletionsSchema2,
37
+ WorkspaceCommandOutcomeSchema2
38
+ } from "./browser-xensz05x.js";
39
+ import {
40
+ wireSchema2,
41
+ wireObject2,
42
+ WORKSPACE2,
43
+ NOTHING2,
44
+ ON_WORKSPACE2
45
+ } from "./browser-r87w64mz.js";
46
+
47
+ // src/wire/operations/workspace.ts
48
+ import { Type } from "typebox";
49
+ var PARTICIPANT = { authority: "participant", scope: "workspace" };
50
+ var OWNER = { authority: "owner", scope: "workspace" };
51
+ var JOB = { ...WORKSPACE2, job: idSchema2() };
52
+ var JOB_HANDLE = Type.Object({ ...JobViewType2.properties, key: nullable2(idSchema2()) });
53
+ var ON_JOB = wireObject2(JOB);
54
+ var WORKSPACE_CHANGE = wireSchema2(Type.Union([
55
+ Type.Object({ kind: Type.Literal("updated") }),
56
+ Type.Object({ kind: Type.Literal("missing") })
57
+ ]));
58
+ var JOBS = wireSchema2(Type.Array(JobViewType2));
59
+ var ON_SERVER = wireObject2({ ...WORKSPACE2, server: Type.String() });
60
+ var WORKSPACE_OPERATIONS2 = {
61
+ "workspace.info": {
62
+ ...PARTICIPANT,
63
+ kind: "query",
64
+ input: ON_WORKSPACE2,
65
+ output: WorkspaceInfoSchema2
66
+ },
67
+ "workspace.watch": {
68
+ ...PARTICIPANT,
69
+ kind: "watch",
70
+ input: ON_WORKSPACE2,
71
+ output: WorkspaceInfoSchema2
72
+ },
73
+ "workspace.catalog": {
74
+ ...PARTICIPANT,
75
+ kind: "query",
76
+ input: ON_WORKSPACE2,
77
+ output: wireSchema2(WorkspaceCatalogViewType2)
78
+ },
79
+ "workspace.command": {
80
+ ...PARTICIPANT,
81
+ kind: "command",
82
+ input: wireObject2({ ...WORKSPACE2, name: Type.String(), text: Type.String() }),
83
+ output: WorkspaceCommandOutcomeSchema2
84
+ },
85
+ "workspace.completeCommand": {
86
+ ...PARTICIPANT,
87
+ kind: "query",
88
+ input: wireObject2({ ...WORKSPACE2, name: Type.String(), prefix: Type.String() }),
89
+ output: CommandCompletionsSchema2
90
+ },
91
+ "mcp.watch": { ...OWNER, kind: "watch", input: ON_WORKSPACE2, output: McpViewSchema2 },
92
+ "mcp.reconnect": { ...OWNER, kind: "command", input: ON_SERVER, output: McpChangeSchema2 },
93
+ "mcp.setEnabled": {
94
+ ...OWNER,
95
+ kind: "command",
96
+ input: wireObject2({
97
+ ...WORKSPACE2,
98
+ server: Type.String(),
99
+ enabled: Type.Boolean()
100
+ }),
101
+ output: McpChangeSchema2
102
+ },
103
+ "mcp.login": {
104
+ ...OWNER,
105
+ kind: "command",
106
+ input: ON_SERVER,
107
+ output: wireObject2({ login: Type.String() })
108
+ },
109
+ "mcp.logout": { ...OWNER, kind: "command", input: ON_SERVER, output: McpChangeSchema2 },
110
+ "mcp.add": {
111
+ ...OWNER,
112
+ kind: "command",
113
+ input: wireObject2({
114
+ ...WORKSPACE2,
115
+ server: Type.String(),
116
+ config: McpServerConfigType2,
117
+ scope: Type.Enum(["user", "project"])
118
+ }),
119
+ output: McpChangeSchema2
120
+ },
121
+ "mcp.remove": {
122
+ ...OWNER,
123
+ kind: "command",
124
+ input: wireObject2({
125
+ ...WORKSPACE2,
126
+ server: Type.String(),
127
+ scope: Type.Enum(["user", "project"])
128
+ }),
129
+ output: McpChangeSchema2
130
+ },
131
+ "workspace.update": {
132
+ ...OWNER,
133
+ kind: "command",
134
+ input: wireObject2({
135
+ ...WORKSPACE2,
136
+ patch: Type.Object({ projectResources: Type.Optional(nullable2(Type.Boolean())) })
137
+ }),
138
+ output: WORKSPACE_CHANGE
139
+ },
140
+ "workspace.reload": { ...OWNER, kind: "command", input: ON_WORKSPACE2, output: WORKSPACE_CHANGE },
141
+ "workspace.changes": {
142
+ ...PARTICIPANT,
143
+ kind: "query",
144
+ input: wireObject2({ ...WORKSPACE2, source: ChangeSourceType2 }),
145
+ output: ChangeSetSchema2
146
+ },
147
+ "workspace.patches": {
148
+ ...PARTICIPANT,
149
+ kind: "stream",
150
+ input: wireObject2({
151
+ ...WORKSPACE2,
152
+ source: ChangeSourceType2,
153
+ paths: Type.Array(Type.String()),
154
+ options: Type.Optional(DiffOptionsType2)
155
+ }),
156
+ output: PatchSetWireSchema2
157
+ },
158
+ "workspace.files": {
159
+ ...PARTICIPANT,
160
+ kind: "query",
161
+ input: ON_WORKSPACE2,
162
+ output: CapabilityWireSchema2
163
+ },
164
+ "workspace.git": {
165
+ ...PARTICIPANT,
166
+ kind: "query",
167
+ input: ON_WORKSPACE2,
168
+ output: CapabilityWireSchema2
169
+ },
170
+ "workspace.github": {
171
+ ...PARTICIPANT,
172
+ kind: "query",
173
+ input: ON_WORKSPACE2,
174
+ output: CapabilityWireSchema2
175
+ },
176
+ "workspace.browser": {
177
+ ...PARTICIPANT,
178
+ kind: "query",
179
+ input: ON_WORKSPACE2,
180
+ output: CapabilityWireSchema2
181
+ },
182
+ "jobs.start": {
183
+ ...PARTICIPANT,
184
+ kind: "command",
185
+ recovery: "replay",
186
+ input: wireObject2({
187
+ ...WORKSPACE2,
188
+ command: Type.Optional(Type.String()),
189
+ session: Type.Optional(idSchema2()),
190
+ title: Type.Optional(Type.String()),
191
+ pty: Type.Optional(Type.Object({ columns: Type.Number(), rows: Type.Number() })),
192
+ id: Type.Optional(idSchema2())
193
+ }),
194
+ output: wireSchema2(JOB_HANDLE)
195
+ },
196
+ "jobs.recover": {
197
+ ...PARTICIPANT,
198
+ kind: "command",
199
+ input: wireObject2({ ...WORKSPACE2, key: idSchema2() }),
200
+ output: wireSchema2(Type.Union([
201
+ JOB_HANDLE,
202
+ Type.Object({ kind: Type.Literal("ended"), end: JobEndType2 }),
203
+ Type.Object({ kind: Type.Literal("missing") })
204
+ ]))
205
+ },
206
+ "jobs.list": { ...PARTICIPANT, kind: "query", input: ON_WORKSPACE2, output: JOBS },
207
+ "jobs.watch": {
208
+ ...PARTICIPANT,
209
+ kind: "watch",
210
+ input: ON_WORKSPACE2,
211
+ output: wireSchema2(JobsChangeType2)
212
+ },
213
+ "job.write": {
214
+ ...PARTICIPANT,
215
+ kind: "command",
216
+ recovery: "never",
217
+ input: ON_JOB,
218
+ output: NOTHING2
219
+ },
220
+ "job.output": { ...PARTICIPANT, kind: "stream", input: ON_JOB, output: OutputFrameSchema2 },
221
+ "job.resize": {
222
+ ...PARTICIPANT,
223
+ kind: "command",
224
+ input: wireObject2({
225
+ ...JOB,
226
+ size: Type.Object({ columns: Type.Number(), rows: Type.Number() })
227
+ }),
228
+ output: wireSchema2(Type.Union([
229
+ Type.Object({ kind: Type.Literal("resized") }),
230
+ Type.Object({ kind: Type.Literal("not-pty") }),
231
+ Type.Object({ kind: Type.Literal("missing") })
232
+ ]))
233
+ },
234
+ "job.idle": { ...PARTICIPANT, kind: "query", input: ON_JOB, output: wireSchema2(Type.Boolean()) },
235
+ "job.stop": {
236
+ ...PARTICIPANT,
237
+ kind: "command",
238
+ input: ON_JOB,
239
+ output: stopOutcomeSchema2(JobEndType2)
240
+ },
241
+ "job.settled": { ...PARTICIPANT, kind: "query", wait: true, input: ON_JOB, output: JobEndSchema2 }
242
+ };
243
+
244
+ export { WORKSPACE_OPERATIONS2 };
@@ -0,0 +1,65 @@
1
+ import {
2
+ standard2
3
+ } from "./browser-vzc3r2r3.js";
4
+ import {
5
+ idSchema2
6
+ } from "./browser-ypez6s7v.js";
7
+ import {
8
+ JsonType2,
9
+ withJson2
10
+ } from "./browser-sgwxbek9.js";
11
+ import {
12
+ nullable2
13
+ } from "./browser-4et7qtz3.js";
14
+
15
+ // src/tools.ts
16
+ import { Type } from "typebox";
17
+ var ToolClassType2 = Type.Union([
18
+ Type.Object({ kind: Type.Literal("read"), path: Type.String() }),
19
+ Type.Object({ kind: Type.Literal("list"), path: Type.String() }),
20
+ Type.Object({ kind: Type.Literal("edit"), path: Type.String() }),
21
+ Type.Object({
22
+ kind: Type.Literal("shell"),
23
+ command: Type.String(),
24
+ description: Type.Optional(Type.String())
25
+ }),
26
+ Type.Object({
27
+ kind: Type.Literal("delegate"),
28
+ child: nullable2(idSchema2()),
29
+ role: Type.Enum(["task", "create", "send", "await", "read", "stop"]),
30
+ title: nullable2(Type.String())
31
+ }),
32
+ Type.Object({ kind: Type.Literal("custom"), label: Type.String() })
33
+ ]);
34
+ var ToolContentType2 = Type.Union([
35
+ Type.Object({ kind: Type.Literal("text"), text: Type.String() }),
36
+ Type.Object({
37
+ kind: Type.Literal("file"),
38
+ blob: idSchema2(),
39
+ mime: Type.String(),
40
+ name: Type.Optional(Type.String())
41
+ })
42
+ ]);
43
+ var ToolOutcomeType2 = Type.Union([
44
+ Type.Object({
45
+ kind: Type.Literal("ok"),
46
+ content: Type.Array(ToolContentType2),
47
+ output: JsonType2,
48
+ parts: Type.Array(idSchema2())
49
+ }),
50
+ Type.Object({ kind: Type.Literal("failed"), message: Type.String() }),
51
+ Type.Object({ kind: Type.Literal("interrupted") }),
52
+ Type.Object({ kind: Type.Literal("rejected"), reason: Type.String() }),
53
+ Type.Object({ kind: Type.Literal("stopped") })
54
+ ]);
55
+ var ToolProgressType2 = Type.Object({
56
+ text: Type.Optional(Type.String()),
57
+ fraction: Type.Optional(Type.Number()),
58
+ detail: Type.Optional(JsonType2)
59
+ });
60
+ var ToolClassSchema2 = standard2(ToolClassType2);
61
+ var ToolContentSchema2 = standard2(ToolContentType2);
62
+ var ToolOutcomeSchema2 = standard2(withJson2(ToolOutcomeType2));
63
+ var ToolProgressSchema2 = standard2(withJson2(ToolProgressType2));
64
+
65
+ export { ToolClassType2, ToolContentType2, ToolOutcomeType2, ToolProgressType2, ToolClassSchema2, ToolContentSchema2, ToolOutcomeSchema2, ToolProgressSchema2 };
@@ -0,0 +1,185 @@
1
+ import {
2
+ standard2
3
+ } from "./browser-vzc3r2r3.js";
4
+ import {
5
+ withJson2
6
+ } from "./browser-sgwxbek9.js";
7
+ import {
8
+ idSchema2,
9
+ SeqType2
10
+ } from "./browser-ypez6s7v.js";
11
+ import {
12
+ nullable2
13
+ } from "./browser-4et7qtz3.js";
14
+ import {
15
+ UsageType2,
16
+ ContextViewType2
17
+ } from "./browser-0sbkxgkx.js";
18
+ import {
19
+ ConfigurationType2
20
+ } from "./browser-ynj8v9ad.js";
21
+ import {
22
+ FileChangeType2
23
+ } from "./browser-ebr6k189.js";
24
+ import {
25
+ DeliveryType2,
26
+ UserContentType2,
27
+ MessageSourceType2,
28
+ ScheduleType2
29
+ } from "./browser-hq5q56sf.js";
30
+ import {
31
+ RunEndType2,
32
+ WaitTargetType2,
33
+ ExecutionType2,
34
+ BackgroundItemType2
35
+ } from "./browser-8ancsy4m.js";
36
+ import {
37
+ PartStatusType2,
38
+ PartViewType2
39
+ } from "./browser-j150etqf.js";
40
+ import {
41
+ ActivationType2
42
+ } from "./browser-bg1esaw0.js";
43
+ import {
44
+ HeadInfoType2,
45
+ SessionCatalogViewType2
46
+ } from "./browser-xensz05x.js";
47
+
48
+ // src/views.ts
49
+ import { Type } from "typebox";
50
+ var CLASS_SUMMARY = Type.Object({ count: Type.Number(), paths: Type.Array(Type.String()) });
51
+ var MESSAGE = { id: idSchema2(), turn: idSchema2(), at: Type.Number() };
52
+ var ViewOptionsType2 = Type.Object({ tail: Type.Optional(Type.Number()) });
53
+ var UserStatusType2 = Type.Union([
54
+ Type.Object({
55
+ kind: Type.Literal("unsent"),
56
+ attempts: Type.Number(),
57
+ retrying: nullable2(Type.Object({ at: Type.Number(), reason: Type.String() }))
58
+ }),
59
+ Type.Object({ kind: Type.Literal("pending"), schedule: ScheduleType2, covered: Type.Boolean() }),
60
+ Type.Object({
61
+ kind: Type.Literal("landed"),
62
+ commit: idSchema2(),
63
+ run: nullable2(idSchema2()),
64
+ replaced: nullable2(Type.Object({ previous: idSchema2(), stopped: nullable2(idSchema2()) }))
65
+ })
66
+ ]);
67
+ var UserMessageType = Type.Object({
68
+ ...MESSAGE,
69
+ kind: Type.Literal("user"),
70
+ content: UserContentType2,
71
+ source: MessageSourceType2,
72
+ delivery: DeliveryType2,
73
+ status: UserStatusType2,
74
+ siblings: Type.Object({
75
+ index: Type.Number(),
76
+ count: Type.Number(),
77
+ ids: Type.Array(idSchema2())
78
+ })
79
+ });
80
+ var MessageType2 = Type.Union([
81
+ UserMessageType,
82
+ Type.Object({
83
+ ...MESSAGE,
84
+ kind: Type.Literal("part"),
85
+ part: idSchema2(),
86
+ partKind: Type.String(),
87
+ role: Type.Enum(["step", "answer", "note"]),
88
+ state: Type.Unknown(),
89
+ version: Type.Number(),
90
+ status: PartStatusType2
91
+ })
92
+ ]);
93
+ var TurnInfoType2 = Type.Object({
94
+ id: idSchema2(),
95
+ run: nullable2(idSchema2()),
96
+ prompt: nullable2(idSchema2()),
97
+ state: Type.Union([
98
+ Type.Object({ kind: Type.Literal("working"), activity: nullable2(Type.String()) }),
99
+ Type.Object({ kind: Type.Literal("waiting"), on: WaitTargetType2 }),
100
+ Type.Object({ kind: Type.Literal("ended"), end: RunEndType2 })
101
+ ]),
102
+ startedAt: Type.Number(),
103
+ endedAt: nullable2(Type.Number()),
104
+ steps: Type.Number(),
105
+ thinkingOnly: Type.Boolean(),
106
+ summary: Type.Object({
107
+ byClass: Type.Object({
108
+ read: CLASS_SUMMARY,
109
+ list: CLASS_SUMMARY,
110
+ edit: CLASS_SUMMARY,
111
+ shell: CLASS_SUMMARY,
112
+ delegate: CLASS_SUMMARY,
113
+ custom: CLASS_SUMMARY
114
+ }),
115
+ failed: Type.Number(),
116
+ stopped: Type.Number(),
117
+ added: Type.Number(),
118
+ removed: Type.Number()
119
+ })
120
+ });
121
+ var SessionViewType2 = Type.Object({
122
+ revision: nullable2(idSchema2()),
123
+ seq: SeqType2,
124
+ activation: ActivationType2,
125
+ messages: Type.Array(MessageType2),
126
+ leadingPrompt: nullable2(UserMessageType),
127
+ parts: Type.Array(PartViewType2),
128
+ turns: Type.Array(TurnInfoType2),
129
+ usage: UsageType2,
130
+ execution: ExecutionType2,
131
+ background: Type.Array(BackgroundItemType2),
132
+ configuration: Type.Object({
133
+ selected: nullable2(ConfigurationType2),
134
+ effective: nullable2(ConfigurationType2)
135
+ }),
136
+ context: ContextViewType2,
137
+ heads: Type.Array(HeadInfoType2),
138
+ changes: Type.Array(FileChangeType2),
139
+ catalog: SessionCatalogViewType2
140
+ });
141
+ var HistoryPageType2 = Type.Object({
142
+ messages: Type.Array(MessageType2),
143
+ leadingPrompt: nullable2(UserMessageType),
144
+ turns: Type.Array(TurnInfoType2)
145
+ });
146
+ var VIEW = SessionViewType2.properties;
147
+ function viewSplice(item) {
148
+ return Type.Object({ runs: Type.Array(Type.Number()), items: Type.Array(item) });
149
+ }
150
+ var ViewAppendType2 = Type.Object({
151
+ at: Type.Number(),
152
+ append: Type.String(),
153
+ version: Type.Number()
154
+ });
155
+ var ViewFrameType2 = Type.Union([
156
+ Type.Object({ kind: Type.Literal("view"), view: SessionViewType2 }),
157
+ Type.Object({
158
+ kind: Type.Literal("delta"),
159
+ seq: SeqType2,
160
+ revision: Type.Optional(VIEW.revision),
161
+ activation: Type.Optional(VIEW.activation),
162
+ messages: Type.Optional(viewSplice(MessageType2)),
163
+ appends: Type.Optional(Type.Array(ViewAppendType2)),
164
+ leadingPrompt: Type.Optional(VIEW.leadingPrompt),
165
+ parts: Type.Optional(viewSplice(PartViewType2)),
166
+ turns: Type.Optional(viewSplice(TurnInfoType2)),
167
+ usage: Type.Optional(VIEW.usage),
168
+ execution: Type.Optional(VIEW.execution),
169
+ background: Type.Optional(viewSplice(BackgroundItemType2)),
170
+ configuration: Type.Optional(VIEW.configuration),
171
+ context: Type.Optional(VIEW.context),
172
+ heads: Type.Optional(viewSplice(HeadInfoType2)),
173
+ changes: Type.Optional(viewSplice(FileChangeType2)),
174
+ catalog: Type.Optional(VIEW.catalog)
175
+ })
176
+ ]);
177
+ var ViewOptionsSchema2 = standard2(ViewOptionsType2);
178
+ var UserStatusSchema2 = standard2(UserStatusType2);
179
+ var MessageSchema2 = standard2(MessageType2);
180
+ var TurnInfoSchema2 = standard2(TurnInfoType2);
181
+ var SessionViewSchema2 = standard2(withJson2(SessionViewType2));
182
+ var HistoryPageSchema2 = standard2(withJson2(HistoryPageType2));
183
+ var ViewFrameSchema2 = standard2(withJson2(ViewFrameType2));
184
+
185
+ export { ViewOptionsType2, UserStatusType2, MessageType2, TurnInfoType2, SessionViewType2, HistoryPageType2, ViewAppendType2, ViewFrameType2, ViewOptionsSchema2, UserStatusSchema2, MessageSchema2, TurnInfoSchema2, SessionViewSchema2, HistoryPageSchema2, ViewFrameSchema2 };