stitchkit 0.130.1 → 0.132.0

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 (159) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/dist/agent-executor/acp/v1-connect.d.ts +40 -26
  3. package/dist/agent-executor/acp/v1-connect.d.ts.map +1 -1
  4. package/dist/agent-executor/acp/v1-driver.d.ts +10 -4
  5. package/dist/agent-executor/acp/v1-driver.d.ts.map +1 -1
  6. package/dist/agent-executor/acp/v1-handlers.d.ts +6 -2
  7. package/dist/agent-executor/acp/v1-handlers.d.ts.map +1 -1
  8. package/dist/agent-executor/acp/v1-probe.d.ts +38 -0
  9. package/dist/agent-executor/acp/v1-probe.d.ts.map +1 -0
  10. package/dist/agent-executor/acp/v1-protocol.d.ts +15 -0
  11. package/dist/agent-executor/acp/v1-protocol.d.ts.map +1 -1
  12. package/dist/agent-executor/acp/v1-session.d.ts +9 -7
  13. package/dist/agent-executor/acp/v1-session.d.ts.map +1 -1
  14. package/dist/agent-executor/claude/cli-driver.d.ts +7 -7
  15. package/dist/agent-executor/claude/cli-driver.d.ts.map +1 -1
  16. package/dist/agent-executor/claude/limits.d.ts +6 -4
  17. package/dist/agent-executor/claude/limits.d.ts.map +1 -1
  18. package/dist/agent-executor/claude/session.d.ts +3 -3
  19. package/dist/agent-executor/claude/session.d.ts.map +1 -1
  20. package/dist/agent-executor/claude/transcript.d.ts +1 -1
  21. package/dist/agent-executor/claude/transcript.d.ts.map +1 -1
  22. package/dist/agent-executor/claude-sdk/controls.d.ts +1 -0
  23. package/dist/agent-executor/claude-sdk/controls.d.ts.map +1 -1
  24. package/dist/agent-executor/claude-sdk/driver.d.ts +51 -50
  25. package/dist/agent-executor/claude-sdk/driver.d.ts.map +1 -1
  26. package/dist/agent-executor/claude-sdk/probe.d.ts +3 -3
  27. package/dist/agent-executor/claude-sdk/probe.d.ts.map +1 -1
  28. package/dist/agent-executor/claude-sdk/query-loop.d.ts +2 -1
  29. package/dist/agent-executor/claude-sdk/query-loop.d.ts.map +1 -1
  30. package/dist/agent-executor/claude-sdk/session.d.ts.map +1 -1
  31. package/dist/agent-executor/codex/classify.d.ts.map +1 -1
  32. package/dist/agent-executor/codex/connect.d.ts +7 -7
  33. package/dist/agent-executor/codex/connect.d.ts.map +1 -1
  34. package/dist/agent-executor/codex/control-client.d.ts +86 -99
  35. package/dist/agent-executor/codex/control-client.d.ts.map +1 -1
  36. package/dist/agent-executor/codex/control-read-methods.d.ts +7 -0
  37. package/dist/agent-executor/codex/control-read-methods.d.ts.map +1 -0
  38. package/dist/agent-executor/codex/driver.d.ts +29 -28
  39. package/dist/agent-executor/codex/driver.d.ts.map +1 -1
  40. package/dist/agent-executor/codex/event-routing.d.ts +14 -0
  41. package/dist/agent-executor/codex/event-routing.d.ts.map +1 -0
  42. package/dist/agent-executor/codex/handlers.d.ts +2 -2
  43. package/dist/agent-executor/codex/handlers.d.ts.map +1 -1
  44. package/dist/agent-executor/codex/limits.d.ts +9 -3
  45. package/dist/agent-executor/codex/limits.d.ts.map +1 -1
  46. package/dist/agent-executor/codex/notifications.d.ts +183 -0
  47. package/dist/agent-executor/codex/notifications.d.ts.map +1 -0
  48. package/dist/agent-executor/codex/pagination.d.ts +54 -0
  49. package/dist/agent-executor/codex/pagination.d.ts.map +1 -0
  50. package/dist/agent-executor/codex/protocol.d.ts +586 -148
  51. package/dist/agent-executor/codex/protocol.d.ts.map +1 -1
  52. package/dist/agent-executor/codex/request-answers.d.ts +4 -2
  53. package/dist/agent-executor/codex/request-answers.d.ts.map +1 -1
  54. package/dist/agent-executor/codex/responses.d.ts +855 -0
  55. package/dist/agent-executor/codex/responses.d.ts.map +1 -0
  56. package/dist/agent-executor/codex/session-bind.d.ts +410 -0
  57. package/dist/agent-executor/codex/session-bind.d.ts.map +1 -0
  58. package/dist/agent-executor/codex/session-controls.d.ts +19 -190
  59. package/dist/agent-executor/codex/session-controls.d.ts.map +1 -1
  60. package/dist/agent-executor/codex/session-types.d.ts +190 -0
  61. package/dist/agent-executor/codex/session-types.d.ts.map +1 -0
  62. package/dist/agent-executor/codex/session.d.ts +1 -1
  63. package/dist/agent-executor/codex/session.d.ts.map +1 -1
  64. package/dist/agent-executor/codex/shared-server.d.ts +4 -4
  65. package/dist/agent-executor/codex/shared-server.d.ts.map +1 -1
  66. package/dist/agent-executor/codex/shared-thread.d.ts +5 -5
  67. package/dist/agent-executor/codex/shared-thread.d.ts.map +1 -1
  68. package/dist/agent-executor/codex/thread-controls.d.ts +45 -36
  69. package/dist/agent-executor/codex/thread-controls.d.ts.map +1 -1
  70. package/dist/agent-executor/codex/thread-list-query.d.ts +5 -0
  71. package/dist/agent-executor/codex/thread-list-query.d.ts.map +1 -0
  72. package/dist/agent-executor/codex/thread-open.d.ts +20 -20
  73. package/dist/agent-executor/codex/thread-open.d.ts.map +1 -1
  74. package/dist/agent-executor/codex/turn-input.d.ts +4 -3
  75. package/dist/agent-executor/codex/turn-input.d.ts.map +1 -1
  76. package/dist/agent-executor/codex/unix-socket-target.d.ts +12 -3
  77. package/dist/agent-executor/codex/unix-socket-target.d.ts.map +1 -1
  78. package/dist/agent-executor/codex/ws-frame.d.ts +4 -1
  79. package/dist/agent-executor/codex/ws-frame.d.ts.map +1 -1
  80. package/dist/agent-executor/contract.d.ts +3 -1
  81. package/dist/agent-executor/contract.d.ts.map +1 -1
  82. package/dist/agent-executor/engine-process.d.ts +4 -4
  83. package/dist/agent-executor/engine-process.d.ts.map +1 -1
  84. package/dist/agent-executor/engine.d.ts +3 -3
  85. package/dist/agent-executor/engine.d.ts.map +1 -1
  86. package/dist/agent-executor/handoff.d.ts.map +1 -1
  87. package/dist/agent-executor/hello.d.ts +7 -0
  88. package/dist/agent-executor/hello.d.ts.map +1 -1
  89. package/dist/agent-executor/json-rpc-peer.d.ts +9 -4
  90. package/dist/agent-executor/json-rpc-peer.d.ts.map +1 -1
  91. package/dist/agent-executor/leases.d.ts +1 -1
  92. package/dist/agent-executor/leases.d.ts.map +1 -1
  93. package/dist/agent-executor/plan-limits.d.ts +12 -1
  94. package/dist/agent-executor/plan-limits.d.ts.map +1 -1
  95. package/dist/agent-executor/profile.d.ts +9 -1
  96. package/dist/agent-executor/profile.d.ts.map +1 -1
  97. package/dist/agent-executor/session-primitives.d.ts +8 -0
  98. package/dist/agent-executor/session-primitives.d.ts.map +1 -1
  99. package/dist/agent-executor/testing/consumer-stubs.d.ts +45 -0
  100. package/dist/agent-executor/testing/consumer-stubs.d.ts.map +1 -0
  101. package/dist/agent-executor/testing/fake-claude-sdk-query.d.ts +88 -0
  102. package/dist/agent-executor/testing/fake-claude-sdk-query.d.ts.map +1 -0
  103. package/dist/agent-executor/testing/fake-codex-app-server.d.ts +56 -0
  104. package/dist/agent-executor/testing/fake-codex-app-server.d.ts.map +1 -0
  105. package/dist/agent-executor/testing/fixtures.d.ts +26 -0
  106. package/dist/agent-executor/testing/fixtures.d.ts.map +1 -0
  107. package/dist/agent-executor/testing/replay-driver.d.ts +8 -8
  108. package/dist/agent-executor/testing/replay-driver.d.ts.map +1 -1
  109. package/dist/agent-executor/testing/replay-runner.d.ts +3 -2
  110. package/dist/agent-executor/testing/replay-runner.d.ts.map +1 -1
  111. package/dist/agent-executor/testing/replay-transcript.d.ts +5 -3
  112. package/dist/agent-executor/testing/replay-transcript.d.ts.map +1 -1
  113. package/dist/agent-runtime/branch-observations.d.ts +19 -19
  114. package/dist/agent-runtime/sql-rows.d.ts +10 -10
  115. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +20 -20
  116. package/dist/agent-runtime/store-conformance-support.d.ts +10 -10
  117. package/dist/agent-runtime/terminal-commit.d.ts +10 -10
  118. package/dist/entrypoints/agent-executor/acp.d.ts +2 -1
  119. package/dist/entrypoints/agent-executor/acp.d.ts.map +1 -1
  120. package/dist/entrypoints/agent-executor/acp.js +284 -82
  121. package/dist/entrypoints/agent-executor/claude-sdk.d.ts +4 -0
  122. package/dist/entrypoints/agent-executor/claude-sdk.d.ts.map +1 -1
  123. package/dist/entrypoints/agent-executor/claude-sdk.js +64 -37
  124. package/dist/entrypoints/agent-executor/claude.d.ts +2 -2
  125. package/dist/entrypoints/agent-executor/claude.d.ts.map +1 -1
  126. package/dist/entrypoints/agent-executor/claude.js +29 -23
  127. package/dist/entrypoints/agent-executor/codex.d.ts +9 -5
  128. package/dist/entrypoints/agent-executor/codex.d.ts.map +1 -1
  129. package/dist/entrypoints/agent-executor/codex.js +1860 -1695
  130. package/dist/entrypoints/agent-executor/testing.d.ts +4 -0
  131. package/dist/entrypoints/agent-executor/testing.d.ts.map +1 -1
  132. package/dist/entrypoints/agent-executor/testing.js +880 -18
  133. package/dist/entrypoints/agent-executor.d.ts +3 -3
  134. package/dist/entrypoints/agent-executor.d.ts.map +1 -1
  135. package/dist/entrypoints/agent-executor.js +42 -8
  136. package/dist/entrypoints/process.js +3 -3
  137. package/dist/entrypoints/sync.js +8 -4
  138. package/dist/{index-jrn3prgm.js → index-athc412x.js} +29 -4
  139. package/dist/{index-dbp6xemn.js → index-f9p62ean.js} +219 -7
  140. package/dist/index-j15dhkda.js +749 -0
  141. package/dist/index-jcrj0b8z.js +56 -0
  142. package/dist/{index-1q0n6zek.js → index-kwsr7j5k.js} +84 -44
  143. package/dist/{index-p1qmpq0p.js → index-z114ax5e.js} +93 -57
  144. package/dist/sync/session-machine.d.ts.map +1 -1
  145. package/dist/sync/session.d.ts +3 -3
  146. package/llms/agent-executor-acp.txt +5 -5
  147. package/llms/agent-executor-claude-sdk.txt +3 -1
  148. package/llms/agent-executor-claude.txt +2 -2
  149. package/llms/agent-executor-codex.txt +11 -8
  150. package/llms/agent-executor-testing.txt +5 -1
  151. package/llms/agent-executor.txt +10 -4
  152. package/llms/stitchkit.txt +75 -74
  153. package/llms/sync.txt +1 -1
  154. package/llms/{upgrading-0.128.0-0.130.0.txt → upgrading-0.128.0-0.132.0.txt} +76 -3
  155. package/llms/upgrading.txt +1 -1
  156. package/llms-full.txt +185 -96
  157. package/llms.txt +8 -8
  158. package/package.json +3 -3
  159. package/dist/index-2s8sy57y.js +0 -229
@@ -0,0 +1,749 @@
1
+ import {
2
+ JsonRpcValueSchema2,
3
+ JsonRpcRecordSchema2
4
+ } from "./index-kwsr7j5k.js";
5
+ import {
6
+ assertUnixSocketPathLength,
7
+ assertExpectedOwnerUid,
8
+ unixSocketDirectoryViolation
9
+ } from "./index-hab790s6.js";
10
+ import {
11
+ errnoOf
12
+ } from "./index-jj9228tt.js";
13
+ import {
14
+ isRecord
15
+ } from "./index-ps3djm8d.js";
16
+
17
+ // src/agent-executor/codex/protocol.ts
18
+ import { z } from "zod";
19
+ class CodexProtocolError2 extends Error {
20
+ method;
21
+ cause;
22
+ constructor(method, cause, message) {
23
+ super(message ?? `[stitchkit] Codex ${method} response did not match schema: ${cause.issues[0]?.message ?? cause.message}`, { cause });
24
+ this.method = method;
25
+ this.name = "CodexProtocolError";
26
+ this.cause = cause;
27
+ }
28
+ }
29
+ function parseCodexResponse(method, schema, raw, kind = "response") {
30
+ const parsed = schema.safeParse(raw);
31
+ if (!parsed.success) {
32
+ throw new CodexProtocolError2(method, parsed.error, `[stitchkit] Codex ${method} ${kind} did not match schema: ${parsed.error.issues[0]?.message ?? parsed.error.message}`);
33
+ }
34
+ return parsed.data;
35
+ }
36
+ var KNOWN_SANDBOX_POLICY_TYPES = new Set([
37
+ "dangerFullAccess",
38
+ "readOnly",
39
+ "externalSandbox",
40
+ "workspaceWrite"
41
+ ]);
42
+ var KNOWN_THREAD_STATUS_TYPES = new Set(["notLoaded", "idle", "systemError", "active"]);
43
+ function unknownTypedRecordSchema(knownTypes) {
44
+ return z.custom((value) => isRecord(value) && typeof value.type === "string" && value.type.length > 0 && !knownTypes.has(value.type), { message: "Expected an object with an unknown non-empty type discriminator" });
45
+ }
46
+ var CodexApprovalPolicySchema2 = z.union([
47
+ z.enum(["untrusted", "on-failure", "on-request", "never"]),
48
+ JsonRpcRecordSchema2
49
+ ]);
50
+ var CodexSandboxModeSchema2 = z.enum([
51
+ "read-only",
52
+ "workspace-write",
53
+ "danger-full-access"
54
+ ]);
55
+ var CodexSandboxPolicySchema2 = z.union([
56
+ z.looseObject({ type: z.literal("dangerFullAccess") }),
57
+ z.looseObject({
58
+ type: z.literal("readOnly"),
59
+ networkAccess: z.boolean().optional()
60
+ }),
61
+ z.looseObject({
62
+ type: z.literal("externalSandbox"),
63
+ networkAccess: z.string().optional()
64
+ }),
65
+ z.looseObject({
66
+ type: z.literal("workspaceWrite"),
67
+ writableRoots: z.array(z.string()).optional(),
68
+ networkAccess: z.boolean().optional(),
69
+ excludeTmpdirEnvVar: z.boolean().optional(),
70
+ excludeSlashTmp: z.boolean().optional()
71
+ }),
72
+ unknownTypedRecordSchema(KNOWN_SANDBOX_POLICY_TYPES)
73
+ ]);
74
+ var CodexThreadStatusSchema2 = z.union([
75
+ z.looseObject({ type: z.literal("notLoaded") }),
76
+ z.looseObject({ type: z.literal("idle") }),
77
+ z.looseObject({ type: z.literal("systemError") }),
78
+ z.looseObject({
79
+ type: z.literal("active"),
80
+ activeFlags: z.array(z.string())
81
+ }),
82
+ unknownTypedRecordSchema(KNOWN_THREAD_STATUS_TYPES)
83
+ ]);
84
+ var CodexTurnStatusSchema2 = z.enum([
85
+ "completed",
86
+ "interrupted",
87
+ "failed",
88
+ "inProgress"
89
+ ]);
90
+ var CodexTurnItemsViewSchema2 = z.union([
91
+ z.enum(["notLoaded", "summary", "full"]),
92
+ z.custom((value) => typeof value === "string" && value.length > 0, {
93
+ message: "Expected a non-empty TurnItemsView string"
94
+ })
95
+ ]);
96
+ var CODEX_THREAD_SOURCE_KINDS2 = [
97
+ "cli",
98
+ "vscode",
99
+ "exec",
100
+ "appServer",
101
+ "subAgent",
102
+ "subAgentReview",
103
+ "subAgentCompact",
104
+ "subAgentThreadSpawn",
105
+ "subAgentOther",
106
+ "unknown"
107
+ ];
108
+ var CodexThreadSourceKindSchema2 = z.enum(CODEX_THREAD_SOURCE_KINDS2);
109
+ var CodexCollaborationModeSchema2 = z.strictObject({
110
+ mode: z.enum(["plan", "default"]),
111
+ settings: z.strictObject({
112
+ model: z.string().min(1),
113
+ reasoning_effort: z.string().min(1).nullable().optional(),
114
+ developer_instructions: z.string().nullable().optional()
115
+ })
116
+ });
117
+ var CodexThreadItemSchema2 = z.looseObject({
118
+ type: z.string(),
119
+ id: z.string().min(1)
120
+ });
121
+ var CodexTurnSchema = z.looseObject({
122
+ id: z.string().min(1),
123
+ status: CodexTurnStatusSchema2,
124
+ error: z.looseObject({
125
+ message: z.string(),
126
+ codexErrorInfo: JsonRpcValueSchema2.nullable().optional()
127
+ }).nullable().optional(),
128
+ items: z.array(z.looseObject({ type: z.string(), clientId: z.string().nullable().optional() })).optional(),
129
+ startedAt: z.number().int().nullable().optional(),
130
+ completedAt: z.number().int().nullable().optional(),
131
+ durationMs: z.number().int().nullable().optional(),
132
+ rootTurnId: z.string().nullable().optional()
133
+ });
134
+ var CodexListedTurnItemSchema = z.looseObject({
135
+ type: z.string(),
136
+ clientId: z.string().nullable().optional()
137
+ });
138
+ var CodexListedTurnSchema2 = CodexTurnSchema.extend({
139
+ items: z.array(CodexListedTurnItemSchema),
140
+ itemsView: CodexTurnItemsViewSchema2.optional()
141
+ });
142
+ var CodexTurnsPageSchema2 = z.looseObject({
143
+ data: z.array(CodexListedTurnSchema2),
144
+ nextCursor: z.string().nullable().optional(),
145
+ backwardsCursor: z.string().nullable().optional()
146
+ });
147
+ var CodexThreadSchema2 = z.looseObject({
148
+ id: z.string().min(1),
149
+ name: z.string().nullable().optional(),
150
+ preview: z.string().optional(),
151
+ cwd: z.string().optional(),
152
+ model: z.string().nullable().optional(),
153
+ modelProvider: z.string().optional(),
154
+ reasoningEffort: z.string().nullable().optional(),
155
+ status: CodexThreadStatusSchema2.optional(),
156
+ canAcceptDirectInput: z.boolean().nullable().optional(),
157
+ cliVersion: z.string().optional(),
158
+ createdAt: z.number().int().optional(),
159
+ updatedAt: z.number().int().optional(),
160
+ recencyAt: z.number().int().nullable().optional(),
161
+ ephemeral: z.boolean().optional(),
162
+ path: z.string().nullable().optional(),
163
+ source: JsonRpcValueSchema2.optional(),
164
+ sessionId: z.string().optional(),
165
+ projectId: z.string().nullable().optional(),
166
+ forkedFromId: z.string().nullable().optional(),
167
+ parentThreadId: z.string().nullable().optional(),
168
+ attachedToThreadId: z.string().nullable().optional(),
169
+ originator: z.string().nullable().optional(),
170
+ agentNickname: z.string().nullable().optional(),
171
+ agentRole: z.string().nullable().optional(),
172
+ gitInfo: JsonRpcValueSchema2.nullable().optional(),
173
+ turns: z.array(CodexListedTurnSchema2).optional()
174
+ });
175
+ var CodexThreadContextSchema2 = z.object({
176
+ model: z.string().optional(),
177
+ modelProvider: z.string().optional(),
178
+ reasoningEffort: z.string().nullable().optional(),
179
+ approvalPolicy: CodexApprovalPolicySchema2.optional(),
180
+ sandbox: CodexSandboxPolicySchema2.optional(),
181
+ cwd: z.string().optional(),
182
+ runtimeWorkspaceRoots: z.array(z.string()).readonly().optional(),
183
+ thread: CodexThreadSchema2.optional()
184
+ });
185
+ var CodexInitializeResponseSchema = z.looseObject({
186
+ userAgent: z.string().nullable().optional()
187
+ });
188
+ var CodexInboundCollaborationModeSchema = z.looseObject({
189
+ mode: z.string(),
190
+ settings: z.looseObject({
191
+ model: z.string().optional(),
192
+ reasoning_effort: z.string().nullable().optional(),
193
+ developer_instructions: z.string().nullable().optional()
194
+ }).optional()
195
+ });
196
+ var CodexStartedThreadSchema = CodexThreadContextSchema2.extend({
197
+ thread: CodexThreadSchema2,
198
+ approvalsReviewer: z.string().optional(),
199
+ collaborationMode: CodexInboundCollaborationModeSchema.nullable().optional(),
200
+ turnsBackwardsCursor: z.string().nullable().optional(),
201
+ itemsBackwardsCursor: z.string().nullable().optional(),
202
+ serviceTier: z.string().nullable().optional(),
203
+ disabledPluginIds: z.array(z.string()).optional(),
204
+ instructionSources: z.array(z.string()).optional()
205
+ }).loose();
206
+ function extractCodexThreadContext(parsed) {
207
+ return {
208
+ ...parsed.model !== undefined && { model: parsed.model },
209
+ ...parsed.modelProvider !== undefined && { modelProvider: parsed.modelProvider },
210
+ ...parsed.reasoningEffort !== undefined && { reasoningEffort: parsed.reasoningEffort },
211
+ ...parsed.approvalPolicy !== undefined && { approvalPolicy: parsed.approvalPolicy },
212
+ ...parsed.sandbox !== undefined && { sandbox: parsed.sandbox },
213
+ ...parsed.cwd !== undefined && { cwd: parsed.cwd },
214
+ ...parsed.runtimeWorkspaceRoots !== undefined && {
215
+ runtimeWorkspaceRoots: parsed.runtimeWorkspaceRoots
216
+ },
217
+ thread: parsed.thread
218
+ };
219
+ }
220
+ var CodexStartedTurnSchema = z.looseObject({
221
+ turn: z.looseObject({ id: z.string().min(1) })
222
+ });
223
+ var CodexTurnSteerResponseSchema = z.looseObject({
224
+ turnId: z.string().min(1)
225
+ });
226
+ var CodexThreadRevertResponseSchema = z.looseObject({
227
+ thread: CodexThreadSchema2,
228
+ turnsBackwardsCursor: z.string().nullable().optional(),
229
+ itemsBackwardsCursor: z.string().nullable().optional()
230
+ });
231
+ var CodexApprovalParamsSchema = z.looseObject({
232
+ threadId: z.string().optional(),
233
+ turnId: z.string().optional(),
234
+ itemId: z.string(),
235
+ command: z.string().nullable().optional(),
236
+ cwd: z.string().nullable().optional(),
237
+ reason: z.string().nullable().optional(),
238
+ grantRoot: z.string().nullable().optional(),
239
+ kind: z.string().nullable().optional(),
240
+ approvalId: z.string().nullable().optional(),
241
+ startedAtMs: z.number().int().nullable().optional(),
242
+ commandActions: z.array(JsonRpcValueSchema2).nullable().optional(),
243
+ availableDecisions: z.array(JsonRpcValueSchema2).nullable().optional()
244
+ });
245
+ var CodexUserInputOptionSchema = z.looseObject({
246
+ label: z.string(),
247
+ description: z.string()
248
+ });
249
+ var CodexUserInputQuestionSchema = z.looseObject({
250
+ id: z.string(),
251
+ question: z.string(),
252
+ header: z.string(),
253
+ isOther: z.boolean().optional(),
254
+ isSecret: z.boolean().optional(),
255
+ options: z.array(CodexUserInputOptionSchema).nullable().optional()
256
+ });
257
+ var CodexUserInputParamsSchema = z.looseObject({
258
+ threadId: z.string().optional(),
259
+ turnId: z.string().optional(),
260
+ itemId: z.string(),
261
+ questions: z.array(CodexUserInputQuestionSchema)
262
+ });
263
+ var CodexUserInputAnswersSchema = z.record(z.string(), z.strictObject({ answers: z.array(z.string()) }));
264
+ var CodexPermissionProfileSchema = z.looseObject({
265
+ fileSystem: JsonRpcValueSchema2.nullable().optional(),
266
+ network: JsonRpcValueSchema2.nullable().optional()
267
+ });
268
+ var CodexPermissionsApprovalParamsSchema = z.looseObject({
269
+ threadId: z.string(),
270
+ turnId: z.string(),
271
+ itemId: z.string(),
272
+ cwd: z.string(),
273
+ permissions: CodexPermissionProfileSchema,
274
+ startedAtMs: z.number().int(),
275
+ reason: z.string().nullable().optional(),
276
+ environmentId: z.string().nullable().optional()
277
+ });
278
+ var CodexMcpElicitationBaseFields = {
279
+ serverName: z.string(),
280
+ threadId: z.string(),
281
+ turnId: z.string().nullable().optional(),
282
+ environmentId: z.string().nullable().optional(),
283
+ message: z.string(),
284
+ _meta: JsonRpcValueSchema2.optional()
285
+ };
286
+ var CodexMcpElicitationFormSchemaSchema = z.looseObject({
287
+ type: z.literal("object"),
288
+ properties: z.record(z.string(), JsonRpcValueSchema2),
289
+ required: z.array(z.string()).nullable().optional(),
290
+ $schema: z.string().nullable().optional()
291
+ });
292
+ var CodexMcpElicitationParamsSchema = z.discriminatedUnion("mode", [
293
+ z.looseObject({
294
+ ...CodexMcpElicitationBaseFields,
295
+ mode: z.literal("form"),
296
+ requestedSchema: CodexMcpElicitationFormSchemaSchema
297
+ }),
298
+ z.looseObject({
299
+ ...CodexMcpElicitationBaseFields,
300
+ mode: z.literal("openai/form"),
301
+ requestedSchema: JsonRpcValueSchema2
302
+ }),
303
+ z.looseObject({
304
+ ...CodexMcpElicitationBaseFields,
305
+ mode: z.literal("openaiForm"),
306
+ requestedSchema: JsonRpcValueSchema2
307
+ }),
308
+ z.looseObject({
309
+ ...CodexMcpElicitationBaseFields,
310
+ mode: z.literal("url"),
311
+ elicitationId: z.string(),
312
+ url: z.string()
313
+ })
314
+ ]);
315
+ var CodexMcpElicitationAnswerSchema = z.strictObject({
316
+ action: z.enum(["accept", "decline", "cancel"]),
317
+ content: JsonRpcValueSchema2.optional(),
318
+ _meta: JsonRpcValueSchema2.optional()
319
+ });
320
+ var CODEX_APPROVAL_REQUESTS = new Set([
321
+ "item/commandExecution/requestApproval",
322
+ "item/fileChange/requestApproval"
323
+ ]);
324
+ var CODEX_PERMISSIONS_APPROVAL_REQUEST = "item/permissions/requestApproval";
325
+ var CODEX_INPUT_REQUEST = "item/tool/requestUserInput";
326
+ var CODEX_ELICITATION_REQUEST = "mcpServer/elicitation/request";
327
+ var CODEX_APPROVAL_DECISION = {
328
+ approve: "accept",
329
+ approveForSession: "acceptForSession",
330
+ deny: "decline",
331
+ interrupted: "cancel"
332
+ };
333
+
334
+ // src/agent-executor/codex/unix-socket-target.ts
335
+ import { lstatSync, readlinkSync, realpathSync } from "node:fs";
336
+ import { basename, dirname, join, resolve } from "node:path";
337
+ var MAX_SYMLINK_HOPS = 40;
338
+
339
+ class CodexUnixSocketError2 extends Error {
340
+ kind;
341
+ socketPath;
342
+ constructor(kind, socketPath, message, options) {
343
+ super(message, options);
344
+ this.kind = kind;
345
+ this.socketPath = socketPath;
346
+ this.name = "CodexUnixSocketError";
347
+ }
348
+ }
349
+ function validateCodexUnixSocketPath(socketPath, caller) {
350
+ if (typeof socketPath !== "string" || socketPath.length === 0) {
351
+ throw new TypeError(`[stitchkit] ${caller}: unix socketPath must be a non-empty string`);
352
+ }
353
+ if (!socketPath.startsWith("/")) {
354
+ throw new TypeError(`[stitchkit] ${caller}: unix socketPath must be an absolute path starting with "/", received ${JSON.stringify(socketPath)}`);
355
+ }
356
+ if (socketPath.endsWith("/")) {
357
+ throw new TypeError(`[stitchkit] ${caller}: unix socketPath must not end with "/", received ${JSON.stringify(socketPath)}`);
358
+ }
359
+ if (/[\0\r\n\s?#]/.test(socketPath)) {
360
+ throw new TypeError(`[stitchkit] ${caller}: unix socketPath contains forbidden characters (whitespace, NUL, ?, or #)`);
361
+ }
362
+ assertUnixSocketPathLength(socketPath, caller);
363
+ }
364
+ function lstatTarget(targetPath, label, socketPath, caller, lstat = lstatSync) {
365
+ try {
366
+ return lstat(targetPath, { throwIfNoEntry: false });
367
+ } catch (error) {
368
+ if (errnoOf(error) === "ENOENT")
369
+ return;
370
+ throw new CodexUnixSocketError2("target-refused", socketPath, `[stitchkit] ${caller}: failed to inspect unix socket ${label} "${targetPath}"`, { cause: error });
371
+ }
372
+ }
373
+ function assertPrivateDirStats(dir, requiredUid, socketPath, caller, lstat = lstatSync) {
374
+ const stats = lstatTarget(dir, "directory", socketPath, caller, lstat);
375
+ if (stats === undefined)
376
+ return "absent";
377
+ const violation = unixSocketDirectoryViolation(dir, stats, caller, requiredUid);
378
+ if (violation !== undefined) {
379
+ throw new CodexUnixSocketError2("target-refused", socketPath, violation);
380
+ }
381
+ return "present";
382
+ }
383
+ function canonicalizePrivateDir(dir, requiredUid, socketPath, caller, lstat, realpath) {
384
+ if (assertPrivateDirStats(dir, requiredUid, socketPath, caller, lstat) === "absent") {
385
+ return;
386
+ }
387
+ let realDir;
388
+ try {
389
+ realDir = realpath(dir);
390
+ } catch (error) {
391
+ if (errnoOf(error) === "ENOENT")
392
+ return;
393
+ throw new CodexUnixSocketError2("target-refused", socketPath, `[stitchkit] ${caller}: failed to resolve unix socket directory "${dir}"`, { cause: error });
394
+ }
395
+ if (realDir !== dir && assertPrivateDirStats(realDir, requiredUid, socketPath, caller, lstat) === "absent") {
396
+ return;
397
+ }
398
+ return realDir;
399
+ }
400
+ function assertCodexUnixListenTargetAvailable(socketPath, caller) {
401
+ const dir = dirname(socketPath);
402
+ const requiredUid = typeof process.getuid === "function" ? process.getuid() : undefined;
403
+ if (assertPrivateDirStats(dir, requiredUid, socketPath, caller) === "absent") {
404
+ throw new CodexUnixSocketError2("target-refused", socketPath, `[stitchkit] ${caller}: unix socket directory "${dir}" does not exist`);
405
+ }
406
+ const existing = lstatTarget(socketPath, "path", socketPath, caller);
407
+ if (existing !== undefined) {
408
+ throw new CodexUnixSocketError2("target-refused", socketPath, `[stitchkit] ${caller}: unix socket path "${socketPath}" already exists — choose a fresh socket path or remove the stale socket first`);
409
+ }
410
+ }
411
+ function assertCodexUnixSocketClientTarget(socketPath, caller, expectedOwnerUid, fsOps) {
412
+ assertExpectedOwnerUid(expectedOwnerUid, caller);
413
+ if (socketPath.length === 0 || socketPath.endsWith("/")) {
414
+ throw new CodexUnixSocketError2("target-refused", socketPath, `[stitchkit] ${caller}: invalid unix socket target ${JSON.stringify(socketPath)}`);
415
+ }
416
+ const requiredUid = expectedOwnerUid !== undefined ? expectedOwnerUid : typeof process.getuid === "function" ? process.getuid() : undefined;
417
+ const lstat = fsOps?.lstatSync ?? lstatSync;
418
+ const readlink = fsOps?.readlinkSync ?? readlinkSync;
419
+ const realpath = fsOps?.realpathSync ?? realpathSync;
420
+ let currentPath = socketPath;
421
+ for (let hop = 0;hop <= MAX_SYMLINK_HOPS; hop += 1) {
422
+ const realDir = canonicalizePrivateDir(dirname(currentPath), requiredUid, socketPath, caller, lstat, realpath);
423
+ if (realDir === undefined)
424
+ return "absent";
425
+ const candidate = join(realDir, basename(currentPath));
426
+ const stats = lstatTarget(candidate, hop === 0 ? "path" : "resolved target", socketPath, caller, lstat);
427
+ if (stats === undefined)
428
+ return "absent";
429
+ if (requiredUid !== undefined && stats.uid !== requiredUid) {
430
+ throw new CodexUnixSocketError2("target-refused", socketPath, `[stitchkit] ${caller}: ${hop === 0 ? "unix socket" : "resolved unix socket target"} "${candidate}" is owned by uid ${stats.uid}, expected ${requiredUid}`);
431
+ }
432
+ if (!stats.isSymbolicLink()) {
433
+ if (!stats.isSocket()) {
434
+ throw new CodexUnixSocketError2("target-refused", socketPath, `[stitchkit] ${caller}: ${hop === 0 ? `"${candidate}" is not a unix socket` : `resolved unix socket target "${candidate}" is not a socket`}`);
435
+ }
436
+ return "present";
437
+ }
438
+ if (hop === MAX_SYMLINK_HOPS) {
439
+ throw new CodexUnixSocketError2("target-refused", socketPath, `[stitchkit] ${caller}: unix socket symlink "${socketPath}" exceeded ${MAX_SYMLINK_HOPS} hops`);
440
+ }
441
+ let linkTarget;
442
+ try {
443
+ linkTarget = readlink(candidate);
444
+ } catch (error) {
445
+ if (errnoOf(error) === "ENOENT")
446
+ return "absent";
447
+ throw new CodexUnixSocketError2("target-refused", socketPath, `[stitchkit] ${caller}: failed to read unix socket symlink "${candidate}"`, { cause: error });
448
+ }
449
+ if (linkTarget.length === 0 || linkTarget.endsWith("/")) {
450
+ throw new CodexUnixSocketError2("target-refused", socketPath, `[stitchkit] ${caller}: unix socket symlink "${candidate}" points to invalid target ${JSON.stringify(linkTarget)}`);
451
+ }
452
+ currentPath = resolve(realDir, linkTarget);
453
+ }
454
+ throw new CodexUnixSocketError2("target-refused", socketPath, `[stitchkit] ${caller}: unix socket symlink "${socketPath}" exceeded ${MAX_SYMLINK_HOPS} hops`);
455
+ }
456
+
457
+ // src/agent-executor/codex/ws-frame.ts
458
+ import { randomBytes } from "node:crypto";
459
+ var MAX_WS_FRAGMENTS = 1024;
460
+ var MAX_CONTROL_PAYLOAD_BYTES = 125;
461
+ function maskedWsFrameByteLength(payloadBytes) {
462
+ const headerLen = payloadBytes < 126 ? 2 : payloadBytes <= 65535 ? 4 : 10;
463
+ return headerLen + 4 + payloadBytes;
464
+ }
465
+ function encodeMaskedWsFrame(opcode, payload) {
466
+ const len = payload.byteLength;
467
+ const headerLen = len < 126 ? 2 : len <= 65535 ? 4 : 10;
468
+ const frame = Buffer.allocUnsafe(headerLen + 4 + len);
469
+ frame[0] = 128 | opcode & 15;
470
+ if (len < 126) {
471
+ frame[1] = 128 | len;
472
+ } else if (len <= 65535) {
473
+ frame[1] = 128 | 126;
474
+ frame.writeUInt16BE(len, 2);
475
+ } else {
476
+ frame[1] = 128 | 127;
477
+ const hi = Math.floor(len / 4294967296);
478
+ const lo = len >>> 0;
479
+ frame.writeUInt32BE(hi, 2);
480
+ frame.writeUInt32BE(lo, 6);
481
+ }
482
+ const mask = randomBytes(4);
483
+ frame[headerLen] = mask[0] ?? 0;
484
+ frame[headerLen + 1] = mask[1] ?? 0;
485
+ frame[headerLen + 2] = mask[2] ?? 0;
486
+ frame[headerLen + 3] = mask[3] ?? 0;
487
+ const bodyOffset = headerLen + 4;
488
+ for (let i = 0;i < len; i += 1) {
489
+ frame[bodyOffset + i] = (payload[i] ?? 0) ^ (mask[i & 3] ?? 0);
490
+ }
491
+ return frame;
492
+ }
493
+ function createByteQueue() {
494
+ const chunks = [];
495
+ let headOffset = 0;
496
+ let total = 0;
497
+ return {
498
+ get length() {
499
+ return total;
500
+ },
501
+ push(chunk) {
502
+ if (chunk.byteLength === 0)
503
+ return;
504
+ chunks.push(chunk);
505
+ total += chunk.byteLength;
506
+ },
507
+ peekBytes(count) {
508
+ const first = chunks[0];
509
+ if (first !== undefined && first.byteLength - headOffset >= count) {
510
+ return first.subarray(headOffset, headOffset + count);
511
+ }
512
+ const out = Buffer.allocUnsafe(count);
513
+ let written = 0;
514
+ let idx = 0;
515
+ let off = headOffset;
516
+ while (written < count && idx < chunks.length) {
517
+ const cur = chunks[idx];
518
+ if (cur === undefined)
519
+ break;
520
+ const take = Math.min(cur.byteLength - off, count - written);
521
+ cur.copy(out, written, off, off + take);
522
+ written += take;
523
+ idx += 1;
524
+ off = 0;
525
+ }
526
+ return out;
527
+ },
528
+ consume(count) {
529
+ const out = Buffer.allocUnsafe(count);
530
+ let written = 0;
531
+ while (written < count && chunks.length > 0) {
532
+ const cur = chunks[0];
533
+ if (cur === undefined)
534
+ break;
535
+ const avail = cur.byteLength - headOffset;
536
+ const take = Math.min(avail, count - written);
537
+ cur.copy(out, written, headOffset, headOffset + take);
538
+ written += take;
539
+ total -= take;
540
+ if (take === avail) {
541
+ chunks.shift();
542
+ headOffset = 0;
543
+ } else {
544
+ headOffset += take;
545
+ }
546
+ }
547
+ return out;
548
+ },
549
+ skip(count) {
550
+ let left = count;
551
+ while (left > 0 && chunks.length > 0) {
552
+ const cur = chunks[0];
553
+ if (cur === undefined)
554
+ break;
555
+ const avail = cur.byteLength - headOffset;
556
+ if (left >= avail) {
557
+ chunks.shift();
558
+ headOffset = 0;
559
+ total -= avail;
560
+ left -= avail;
561
+ } else {
562
+ headOffset += left;
563
+ total -= left;
564
+ left = 0;
565
+ }
566
+ }
567
+ },
568
+ clear() {
569
+ chunks.length = 0;
570
+ headOffset = 0;
571
+ total = 0;
572
+ }
573
+ };
574
+ }
575
+ function encodeUnmaskedWsFrame(opcode, payload) {
576
+ const len = payload.byteLength;
577
+ const headerLen = len < 126 ? 2 : len <= 65535 ? 4 : 10;
578
+ const frame = Buffer.allocUnsafe(headerLen + len);
579
+ frame[0] = 128 | opcode & 15;
580
+ if (len < 126) {
581
+ frame[1] = len;
582
+ } else if (len <= 65535) {
583
+ frame[1] = 126;
584
+ frame.writeUInt16BE(len, 2);
585
+ } else {
586
+ frame[1] = 127;
587
+ const hi = Math.floor(len / 4294967296);
588
+ const lo = len >>> 0;
589
+ frame.writeUInt32BE(hi, 2);
590
+ frame.writeUInt32BE(lo, 6);
591
+ }
592
+ Buffer.from(payload.buffer, payload.byteOffset, payload.byteLength).copy(frame, headerLen);
593
+ return frame;
594
+ }
595
+ function unmaskInPlace(payload, mask) {
596
+ const m0 = mask[0] ?? 0;
597
+ const m1 = mask[1] ?? 0;
598
+ const m2 = mask[2] ?? 0;
599
+ const m3 = mask[3] ?? 0;
600
+ for (let i = 0;i < payload.byteLength; i += 1) {
601
+ const k = (i & 3) === 0 ? m0 : (i & 3) === 1 ? m1 : (i & 3) === 2 ? m2 : m3;
602
+ payload[i] = (payload[i] ?? 0) ^ k;
603
+ }
604
+ }
605
+ function createWsFrameDecoder(handlers) {
606
+ const expectMasked = handlers.expectMasked === true;
607
+ const maskLen = expectMasked ? 4 : 0;
608
+ const utf8 = new TextDecoder("utf-8", { fatal: true });
609
+ const queue = createByteQueue();
610
+ let fragments;
611
+ let fragmentBytes = 0;
612
+ let stopped = false;
613
+ const fail = (message) => {
614
+ stopped = true;
615
+ queue.clear();
616
+ fragments = undefined;
617
+ fragmentBytes = 0;
618
+ handlers.onProtocolError(message);
619
+ };
620
+ return {
621
+ push(chunk) {
622
+ if (stopped || chunk.byteLength === 0)
623
+ return;
624
+ queue.push(chunk);
625
+ while (!stopped && queue.length >= 2) {
626
+ const head2 = queue.peekBytes(2);
627
+ const b0 = head2[0] ?? 0;
628
+ const b1 = head2[1] ?? 0;
629
+ if ((b0 & 112) !== 0)
630
+ return fail("WebSocket frame set reserved RSV bits");
631
+ const masked = (b1 & 128) !== 0;
632
+ if (expectMasked && !masked)
633
+ return fail("Client WebSocket frame must be masked");
634
+ if (!expectMasked && masked)
635
+ return fail("Server WebSocket frame must not be masked");
636
+ const fin = (b0 & 128) !== 0;
637
+ const opcode = b0 & 15;
638
+ const len7 = b1 & 127;
639
+ let headerLen = 2;
640
+ let payloadLen = len7;
641
+ if (len7 === 126) {
642
+ if (queue.length < 4)
643
+ break;
644
+ headerLen = 4;
645
+ payloadLen = queue.peekBytes(4).readUInt16BE(2);
646
+ } else if (len7 === 127) {
647
+ if (queue.length < 10)
648
+ break;
649
+ headerLen = 10;
650
+ const head10 = queue.peekBytes(10);
651
+ const hi = head10.readUInt32BE(2);
652
+ const lo = head10.readUInt32BE(6);
653
+ if ((hi & 2147483648) !== 0)
654
+ return fail("WebSocket 64-bit frame length has MSB set");
655
+ payloadLen = hi * 4294967296 + lo;
656
+ }
657
+ if (opcode >= 8) {
658
+ if (!fin)
659
+ return fail("Control WebSocket frame must not be fragmented");
660
+ if (payloadLen > MAX_CONTROL_PAYLOAD_BYTES) {
661
+ return fail(`Control WebSocket frame payload (${payloadLen} bytes) exceeds 125 bytes`);
662
+ }
663
+ if (opcode !== 8 && opcode !== 9 && opcode !== 10) {
664
+ return fail(`Unsupported WebSocket control opcode 0x${opcode.toString(16)}`);
665
+ }
666
+ } else {
667
+ if (opcode !== 0 && opcode !== 1) {
668
+ return fail(`Unsupported WebSocket data opcode 0x${opcode.toString(16)}`);
669
+ }
670
+ if (!Number.isSafeInteger(payloadLen) || payloadLen > handlers.maxFrameBytes) {
671
+ return fail(`WebSocket frame payload (${payloadLen} bytes) exceeds maxFrameBytes (${handlers.maxFrameBytes})`);
672
+ }
673
+ if (opcode === 1 && fragments !== undefined) {
674
+ return fail("Interleaved WebSocket text frame during fragmented message");
675
+ }
676
+ if (opcode === 0 && fragments === undefined) {
677
+ return fail("Unexpected WebSocket continuation frame without an active message");
678
+ }
679
+ if (fragments !== undefined) {
680
+ if (fragments.length + 1 > MAX_WS_FRAGMENTS) {
681
+ return fail(`Fragmented WebSocket message exceeded ${MAX_WS_FRAGMENTS} frames`);
682
+ }
683
+ if (fragmentBytes + payloadLen > handlers.maxFrameBytes) {
684
+ return fail(`Fragmented WebSocket message exceeded maxFrameBytes (${handlers.maxFrameBytes})`);
685
+ }
686
+ }
687
+ }
688
+ if (queue.length < headerLen + maskLen + payloadLen)
689
+ break;
690
+ queue.skip(headerLen);
691
+ const mask = expectMasked ? queue.consume(4) : undefined;
692
+ const payload = queue.consume(payloadLen);
693
+ if (mask !== undefined)
694
+ unmaskInPlace(payload, mask);
695
+ if (opcode === 9) {
696
+ handlers.onPing(payload);
697
+ } else if (opcode === 10) {} else if (opcode === 8) {
698
+ if (payload.byteLength === 1)
699
+ return fail("WebSocket close frame payload cannot be 1 byte");
700
+ const code = payload.byteLength >= 2 ? payload.readUInt16BE(0) : undefined;
701
+ let reason = "";
702
+ if (payload.byteLength > 2) {
703
+ try {
704
+ reason = utf8.decode(payload.subarray(2));
705
+ } catch {
706
+ return fail("WebSocket close frame reason is not valid UTF-8");
707
+ }
708
+ }
709
+ stopped = true;
710
+ queue.clear();
711
+ fragments = undefined;
712
+ fragmentBytes = 0;
713
+ handlers.onClose(code, reason);
714
+ return;
715
+ } else if (opcode === 1) {
716
+ if (fin) {
717
+ let text;
718
+ try {
719
+ text = utf8.decode(payload);
720
+ } catch {
721
+ return fail("WebSocket text frame is not valid UTF-8");
722
+ }
723
+ handlers.onMessage(text);
724
+ } else {
725
+ fragments = [payload];
726
+ fragmentBytes = payload.byteLength;
727
+ }
728
+ } else if (opcode === 0 && fragments !== undefined) {
729
+ fragments.push(payload);
730
+ fragmentBytes += payload.byteLength;
731
+ if (fin) {
732
+ const combined = Buffer.concat(fragments, fragmentBytes);
733
+ fragments = undefined;
734
+ fragmentBytes = 0;
735
+ let text;
736
+ try {
737
+ text = utf8.decode(combined);
738
+ } catch {
739
+ return fail("Reassembled WebSocket text message is not valid UTF-8");
740
+ }
741
+ handlers.onMessage(text);
742
+ }
743
+ }
744
+ }
745
+ }
746
+ };
747
+ }
748
+
749
+ export { CodexProtocolError2, parseCodexResponse, unknownTypedRecordSchema, CodexApprovalPolicySchema2, CodexSandboxModeSchema2, CodexSandboxPolicySchema2, CodexThreadStatusSchema2, CodexTurnStatusSchema2, CodexTurnItemsViewSchema2, CODEX_THREAD_SOURCE_KINDS2, CodexThreadSourceKindSchema2, CodexCollaborationModeSchema2, CodexThreadItemSchema2, CodexTurnSchema, CodexListedTurnSchema2, CodexTurnsPageSchema2, CodexThreadSchema2, CodexThreadContextSchema2, CodexInitializeResponseSchema, CodexStartedThreadSchema, extractCodexThreadContext, CodexStartedTurnSchema, CodexTurnSteerResponseSchema, CodexThreadRevertResponseSchema, CodexApprovalParamsSchema, CodexUserInputParamsSchema, CodexUserInputAnswersSchema, CodexPermissionsApprovalParamsSchema, CodexMcpElicitationParamsSchema, CodexMcpElicitationAnswerSchema, CODEX_APPROVAL_REQUESTS, CODEX_PERMISSIONS_APPROVAL_REQUEST, CODEX_INPUT_REQUEST, CODEX_ELICITATION_REQUEST, CODEX_APPROVAL_DECISION, CodexUnixSocketError2, validateCodexUnixSocketPath, assertCodexUnixListenTargetAvailable, assertCodexUnixSocketClientTarget, maskedWsFrameByteLength, encodeMaskedWsFrame, encodeUnmaskedWsFrame, createWsFrameDecoder };