@hallohuman/hightea 0.1.9 → 0.1.15

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.
@@ -1,26 +1,713 @@
1
1
  // ../ahp-host/src/commands.ts
2
- import { readdir, readFile as readFile3 } from "node:fs/promises";
2
+ import { readdir, readFile as readFile3, realpath as realpath2, rm as rm4 } from "node:fs/promises";
3
3
  import { createRequire } from "node:module";
4
4
  import { homedir } from "node:os";
5
5
  import { basename, dirname as dirname3, isAbsolute as isAbsolute3, join as join7, resolve } from "node:path";
6
6
  import { fromEnvRef as fromEnvRef2, isRecord as isRecord3, readJsonObject as readJsonObject3, readSecret, secretRef as secretRef2, writeJsonAtomic as writeJsonAtomic2 } from "@ahpd/sdk";
7
7
  import { fileVault as fileVault2 } from "@ahpd/server/dist/vault.js";
8
8
 
9
- // ../ahp-host/src/claim.ts
10
- import { createHash, randomBytes } from "node:crypto";
11
- import { constants } from "node:fs";
12
- import { link, lstat, mkdir, mkdtemp, open as open2, realpath, rm } from "node:fs/promises";
13
- import { dirname, join } from "node:path";
14
- import { isDeepStrictEqual } from "node:util";
15
- import { fileVault } from "@ahpd/server/dist/vault.js";
16
- // ../members/src/waitlist.ts
17
- var migrations = new WeakMap;
18
- // ../members/src/invitations.ts
19
- var INVITATION_TTL_MS = 30 * 86400000;
20
- var migrations2 = new WeakMap;
21
- // ../members/src/members-store.ts
22
- var DEFAULT_SESSION_TTL_MS = 30 * 86400000;
23
- var AGENT_BINDING_REQUEST_TTL_MS = 15 * 60000;
9
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/common/state.js
10
+ var ChannelRecoveryKind;
11
+ (function(ChannelRecoveryKind) {
12
+ ChannelRecoveryKind["Snapshot"] = "snapshot";
13
+ ChannelRecoveryKind["Replay"] = "replay";
14
+ ChannelRecoveryKind["Live"] = "live";
15
+ })(ChannelRecoveryKind || (ChannelRecoveryKind = {}));
16
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-root/state.js
17
+ var PolicyState;
18
+ (function(PolicyState) {
19
+ PolicyState["Enabled"] = "enabled";
20
+ PolicyState["Disabled"] = "disabled";
21
+ PolicyState["Unconfigured"] = "unconfigured";
22
+ })(PolicyState || (PolicyState = {}));
23
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-session/state.js
24
+ var SessionLifecycle;
25
+ (function(SessionLifecycle) {
26
+ SessionLifecycle["Creating"] = "creating";
27
+ SessionLifecycle["Ready"] = "ready";
28
+ SessionLifecycle["Failed"] = "failed";
29
+ })(SessionLifecycle || (SessionLifecycle = {}));
30
+ var SessionStatus;
31
+ (function(SessionStatus) {
32
+ SessionStatus[SessionStatus["Idle"] = 1] = "Idle";
33
+ SessionStatus[SessionStatus["Error"] = 2] = "Error";
34
+ SessionStatus[SessionStatus["InProgress"] = 8] = "InProgress";
35
+ SessionStatus[SessionStatus["InputNeeded"] = 24] = "InputNeeded";
36
+ SessionStatus[SessionStatus["IsRead"] = 32] = "IsRead";
37
+ SessionStatus[SessionStatus["IsArchived"] = 64] = "IsArchived";
38
+ })(SessionStatus || (SessionStatus = {}));
39
+ var SessionOriginKind;
40
+ (function(SessionOriginKind) {
41
+ SessionOriginKind["Automation"] = "automation";
42
+ })(SessionOriginKind || (SessionOriginKind = {}));
43
+ var SessionInputRequestKind;
44
+ (function(SessionInputRequestKind) {
45
+ SessionInputRequestKind["ChatInput"] = "chatInput";
46
+ SessionInputRequestKind["ToolConfirmation"] = "toolConfirmation";
47
+ SessionInputRequestKind["ToolClientExecution"] = "toolClientExecution";
48
+ SessionInputRequestKind["ToolAuthentication"] = "toolAuthentication";
49
+ })(SessionInputRequestKind || (SessionInputRequestKind = {}));
50
+ var CustomizationType;
51
+ (function(CustomizationType) {
52
+ CustomizationType["Plugin"] = "plugin";
53
+ CustomizationType["Directory"] = "directory";
54
+ CustomizationType["Agent"] = "agent";
55
+ CustomizationType["Skill"] = "skill";
56
+ CustomizationType["Prompt"] = "prompt";
57
+ CustomizationType["Rule"] = "rule";
58
+ CustomizationType["Hook"] = "hook";
59
+ CustomizationType["McpServer"] = "mcpServer";
60
+ })(CustomizationType || (CustomizationType = {}));
61
+ var CustomizationEnablementKind;
62
+ (function(CustomizationEnablementKind) {
63
+ CustomizationEnablementKind["Global"] = "global";
64
+ CustomizationEnablementKind["Workspace"] = "workspace";
65
+ CustomizationEnablementKind["Session"] = "session";
66
+ })(CustomizationEnablementKind || (CustomizationEnablementKind = {}));
67
+ var CustomizationLoadStatus;
68
+ (function(CustomizationLoadStatus) {
69
+ CustomizationLoadStatus["Loading"] = "loading";
70
+ CustomizationLoadStatus["Loaded"] = "loaded";
71
+ CustomizationLoadStatus["Degraded"] = "degraded";
72
+ CustomizationLoadStatus["Error"] = "error";
73
+ })(CustomizationLoadStatus || (CustomizationLoadStatus = {}));
74
+ var McpServerStatus;
75
+ (function(McpServerStatus) {
76
+ McpServerStatus["Starting"] = "starting";
77
+ McpServerStatus["Ready"] = "ready";
78
+ McpServerStatus["AuthRequired"] = "authRequired";
79
+ McpServerStatus["Error"] = "error";
80
+ McpServerStatus["Stopped"] = "stopped";
81
+ })(McpServerStatus || (McpServerStatus = {}));
82
+ var McpAuthRequiredReason;
83
+ (function(McpAuthRequiredReason) {
84
+ McpAuthRequiredReason["Required"] = "required";
85
+ McpAuthRequiredReason["Expired"] = "expired";
86
+ McpAuthRequiredReason["InsufficientScope"] = "insufficientScope";
87
+ })(McpAuthRequiredReason || (McpAuthRequiredReason = {}));
88
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-chat/state.js
89
+ var BackgroundWorkKind;
90
+ (function(BackgroundWorkKind) {
91
+ BackgroundWorkKind["Shell"] = "shell";
92
+ BackgroundWorkKind["Subagent"] = "subagent";
93
+ })(BackgroundWorkKind || (BackgroundWorkKind = {}));
94
+ var ChatOriginKind;
95
+ (function(ChatOriginKind) {
96
+ ChatOriginKind["User"] = "user";
97
+ ChatOriginKind["Fork"] = "fork";
98
+ ChatOriginKind["SideChat"] = "sideChat";
99
+ ChatOriginKind["Tool"] = "tool";
100
+ })(ChatOriginKind || (ChatOriginKind = {}));
101
+ var ChatInteractivity;
102
+ (function(ChatInteractivity) {
103
+ ChatInteractivity["Full"] = "full";
104
+ ChatInteractivity["ReadOnly"] = "read-only";
105
+ ChatInteractivity["Hidden"] = "hidden";
106
+ })(ChatInteractivity || (ChatInteractivity = {}));
107
+ var PendingMessageKind;
108
+ (function(PendingMessageKind) {
109
+ PendingMessageKind["Steering"] = "steering";
110
+ PendingMessageKind["Queued"] = "queued";
111
+ })(PendingMessageKind || (PendingMessageKind = {}));
112
+ var ChatInputResponseKind;
113
+ (function(ChatInputResponseKind) {
114
+ ChatInputResponseKind["Accept"] = "accept";
115
+ ChatInputResponseKind["Decline"] = "decline";
116
+ ChatInputResponseKind["Cancel"] = "cancel";
117
+ })(ChatInputResponseKind || (ChatInputResponseKind = {}));
118
+ var ChatInputQuestionKind;
119
+ (function(ChatInputQuestionKind) {
120
+ ChatInputQuestionKind["Text"] = "text";
121
+ ChatInputQuestionKind["Number"] = "number";
122
+ ChatInputQuestionKind["Integer"] = "integer";
123
+ ChatInputQuestionKind["Boolean"] = "boolean";
124
+ ChatInputQuestionKind["SingleSelect"] = "single-select";
125
+ ChatInputQuestionKind["MultiSelect"] = "multi-select";
126
+ })(ChatInputQuestionKind || (ChatInputQuestionKind = {}));
127
+ var ChatInputAnswerValueKind;
128
+ (function(ChatInputAnswerValueKind) {
129
+ ChatInputAnswerValueKind["Text"] = "text";
130
+ ChatInputAnswerValueKind["Number"] = "number";
131
+ ChatInputAnswerValueKind["Boolean"] = "boolean";
132
+ ChatInputAnswerValueKind["Selected"] = "selected";
133
+ ChatInputAnswerValueKind["SelectedMany"] = "selected-many";
134
+ })(ChatInputAnswerValueKind || (ChatInputAnswerValueKind = {}));
135
+ var ChatInputAnswerState;
136
+ (function(ChatInputAnswerState) {
137
+ ChatInputAnswerState["Draft"] = "draft";
138
+ ChatInputAnswerState["Submitted"] = "submitted";
139
+ ChatInputAnswerState["Skipped"] = "skipped";
140
+ })(ChatInputAnswerState || (ChatInputAnswerState = {}));
141
+ var TurnState;
142
+ (function(TurnState) {
143
+ TurnState["Complete"] = "complete";
144
+ TurnState["Cancelled"] = "cancelled";
145
+ TurnState["Error"] = "error";
146
+ })(TurnState || (TurnState = {}));
147
+ var MessageAttachmentKind;
148
+ (function(MessageAttachmentKind) {
149
+ MessageAttachmentKind["Simple"] = "simple";
150
+ MessageAttachmentKind["EmbeddedResource"] = "embeddedResource";
151
+ MessageAttachmentKind["Resource"] = "resource";
152
+ MessageAttachmentKind["Annotations"] = "annotations";
153
+ MessageAttachmentKind["Chat"] = "chat";
154
+ })(MessageAttachmentKind || (MessageAttachmentKind = {}));
155
+ var MessageKind;
156
+ (function(MessageKind) {
157
+ MessageKind["User"] = "user";
158
+ MessageKind["Agent"] = "agent";
159
+ MessageKind["Tool"] = "tool";
160
+ MessageKind["Automation"] = "automation";
161
+ MessageKind["SystemNotification"] = "systemNotification";
162
+ })(MessageKind || (MessageKind = {}));
163
+ var ResponsePartKind;
164
+ (function(ResponsePartKind) {
165
+ ResponsePartKind["Markdown"] = "markdown";
166
+ ResponsePartKind["ContentRef"] = "contentRef";
167
+ ResponsePartKind["ToolCall"] = "toolCall";
168
+ ResponsePartKind["Reasoning"] = "reasoning";
169
+ ResponsePartKind["SystemNotification"] = "systemNotification";
170
+ ResponsePartKind["InputRequest"] = "inputRequest";
171
+ ResponsePartKind["Error"] = "error";
172
+ })(ResponsePartKind || (ResponsePartKind = {}));
173
+ var ToolCallStatus;
174
+ (function(ToolCallStatus) {
175
+ ToolCallStatus["Streaming"] = "streaming";
176
+ ToolCallStatus["PendingConfirmation"] = "pending-confirmation";
177
+ ToolCallStatus["Running"] = "running";
178
+ ToolCallStatus["AuthRequired"] = "auth-required";
179
+ ToolCallStatus["PendingResultConfirmation"] = "pending-result-confirmation";
180
+ ToolCallStatus["Completed"] = "completed";
181
+ ToolCallStatus["Cancelled"] = "cancelled";
182
+ })(ToolCallStatus || (ToolCallStatus = {}));
183
+ var ToolCallConfirmationReason;
184
+ (function(ToolCallConfirmationReason) {
185
+ ToolCallConfirmationReason["NotNeeded"] = "not-needed";
186
+ ToolCallConfirmationReason["UserAction"] = "user-action";
187
+ ToolCallConfirmationReason["Setting"] = "setting";
188
+ })(ToolCallConfirmationReason || (ToolCallConfirmationReason = {}));
189
+ var ToolCallRiskAssessmentKind;
190
+ (function(ToolCallRiskAssessmentKind) {
191
+ ToolCallRiskAssessmentKind["Judge"] = "judge";
192
+ })(ToolCallRiskAssessmentKind || (ToolCallRiskAssessmentKind = {}));
193
+ var ToolCallRiskAssessmentStatus;
194
+ (function(ToolCallRiskAssessmentStatus) {
195
+ ToolCallRiskAssessmentStatus["Loading"] = "loading";
196
+ ToolCallRiskAssessmentStatus["Complete"] = "complete";
197
+ })(ToolCallRiskAssessmentStatus || (ToolCallRiskAssessmentStatus = {}));
198
+ var ToolCallCancellationReason;
199
+ (function(ToolCallCancellationReason) {
200
+ ToolCallCancellationReason["Denied"] = "denied";
201
+ ToolCallCancellationReason["Skipped"] = "skipped";
202
+ ToolCallCancellationReason["ResultDenied"] = "result-denied";
203
+ })(ToolCallCancellationReason || (ToolCallCancellationReason = {}));
204
+ var ConfirmationOptionKind;
205
+ (function(ConfirmationOptionKind) {
206
+ ConfirmationOptionKind["Approve"] = "approve";
207
+ ConfirmationOptionKind["Deny"] = "deny";
208
+ })(ConfirmationOptionKind || (ConfirmationOptionKind = {}));
209
+ var ToolCallContributorKind;
210
+ (function(ToolCallContributorKind) {
211
+ ToolCallContributorKind["Client"] = "client";
212
+ ToolCallContributorKind["MCP"] = "mcp";
213
+ })(ToolCallContributorKind || (ToolCallContributorKind = {}));
214
+ var ToolResultContentType;
215
+ (function(ToolResultContentType) {
216
+ ToolResultContentType["Text"] = "text";
217
+ ToolResultContentType["EmbeddedResource"] = "embeddedResource";
218
+ ToolResultContentType["Resource"] = "resource";
219
+ ToolResultContentType["FileEdit"] = "fileEdit";
220
+ ToolResultContentType["Terminal"] = "terminal";
221
+ ToolResultContentType["Subagent"] = "subagent";
222
+ })(ToolResultContentType || (ToolResultContentType = {}));
223
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-terminal/state.js
224
+ var TerminalLifecycleStatus;
225
+ (function(TerminalLifecycleStatus) {
226
+ TerminalLifecycleStatus["Running"] = "running";
227
+ TerminalLifecycleStatus["Exited"] = "exited";
228
+ })(TerminalLifecycleStatus || (TerminalLifecycleStatus = {}));
229
+ var TerminalClaimKind;
230
+ (function(TerminalClaimKind) {
231
+ TerminalClaimKind["Client"] = "client";
232
+ TerminalClaimKind["Session"] = "session";
233
+ })(TerminalClaimKind || (TerminalClaimKind = {}));
234
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-changeset/state.js
235
+ var ChangesetStatus;
236
+ (function(ChangesetStatus) {
237
+ ChangesetStatus["Computing"] = "computing";
238
+ ChangesetStatus["Recomputing"] = "recomputing";
239
+ ChangesetStatus["Ready"] = "ready";
240
+ ChangesetStatus["Error"] = "error";
241
+ })(ChangesetStatus || (ChangesetStatus = {}));
242
+ var ChangesetFileStatus;
243
+ (function(ChangesetFileStatus) {
244
+ ChangesetFileStatus[ChangesetFileStatus["Editing"] = 1] = "Editing";
245
+ })(ChangesetFileStatus || (ChangesetFileStatus = {}));
246
+ var ChangesetOperationStatus;
247
+ (function(ChangesetOperationStatus) {
248
+ ChangesetOperationStatus["Idle"] = "idle";
249
+ ChangesetOperationStatus["Running"] = "running";
250
+ ChangesetOperationStatus["Error"] = "error";
251
+ ChangesetOperationStatus["Disabled"] = "disabled";
252
+ })(ChangesetOperationStatus || (ChangesetOperationStatus = {}));
253
+ var ChangesetOperationScope;
254
+ (function(ChangesetOperationScope) {
255
+ ChangesetOperationScope["Changeset"] = "changeset";
256
+ ChangesetOperationScope["Resource"] = "resource";
257
+ ChangesetOperationScope["Range"] = "range";
258
+ })(ChangesetOperationScope || (ChangesetOperationScope = {}));
259
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-resource-watch/state.js
260
+ var ResourceChangeType;
261
+ (function(ResourceChangeType) {
262
+ ResourceChangeType["Added"] = "added";
263
+ ResourceChangeType["Updated"] = "updated";
264
+ ResourceChangeType["Deleted"] = "deleted";
265
+ })(ResourceChangeType || (ResourceChangeType = {}));
266
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-automation/state.js
267
+ var AutomationOperation;
268
+ (function(AutomationOperation) {
269
+ AutomationOperation["Update"] = "update";
270
+ AutomationOperation["Remove"] = "remove";
271
+ AutomationOperation["Run"] = "run";
272
+ })(AutomationOperation || (AutomationOperation = {}));
273
+ var AutomationMisfirePolicy;
274
+ (function(AutomationMisfirePolicy) {
275
+ AutomationMisfirePolicy["Skip"] = "skip";
276
+ AutomationMisfirePolicy["RunOnce"] = "runOnce";
277
+ })(AutomationMisfirePolicy || (AutomationMisfirePolicy = {}));
278
+ var AutomationTriggerKind;
279
+ (function(AutomationTriggerKind) {
280
+ AutomationTriggerKind["Schedule"] = "schedule";
281
+ AutomationTriggerKind["Event"] = "event";
282
+ })(AutomationTriggerKind || (AutomationTriggerKind = {}));
283
+ var AutomationDisableConditionKind;
284
+ (function(AutomationDisableConditionKind) {
285
+ AutomationDisableConditionKind["AfterRuns"] = "afterRuns";
286
+ AutomationDisableConditionKind["AfterDate"] = "afterDate";
287
+ })(AutomationDisableConditionKind || (AutomationDisableConditionKind = {}));
288
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-automation-run/state.js
289
+ var AutomationRunStatus;
290
+ (function(AutomationRunStatus) {
291
+ AutomationRunStatus["Pending"] = "pending";
292
+ AutomationRunStatus["Running"] = "running";
293
+ AutomationRunStatus["Completed"] = "completed";
294
+ AutomationRunStatus["Failed"] = "failed";
295
+ AutomationRunStatus["Cancelled"] = "cancelled";
296
+ })(AutomationRunStatus || (AutomationRunStatus = {}));
297
+ var AutomationRunOriginKind;
298
+ (function(AutomationRunOriginKind) {
299
+ AutomationRunOriginKind["Manual"] = "manual";
300
+ AutomationRunOriginKind["Trigger"] = "trigger";
301
+ })(AutomationRunOriginKind || (AutomationRunOriginKind = {}));
302
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/common/actions.js
303
+ var ActionType;
304
+ (function(ActionType) {
305
+ ActionType["RootAgentsChanged"] = "root/agentsChanged";
306
+ ActionType["RootActiveSessionsChanged"] = "root/activeSessionsChanged";
307
+ ActionType["SessionReady"] = "session/ready";
308
+ ActionType["SessionCreationFailed"] = "session/creationFailed";
309
+ ActionType["SessionChatAdded"] = "session/chatAdded";
310
+ ActionType["SessionChatRemoved"] = "session/chatRemoved";
311
+ ActionType["SessionChatUpdated"] = "session/chatUpdated";
312
+ ActionType["SessionChatsReordered"] = "session/chatsReordered";
313
+ ActionType["SessionDefaultChatChanged"] = "session/defaultChatChanged";
314
+ ActionType["ChatTurnStarted"] = "chat/turnStarted";
315
+ ActionType["ChatDelta"] = "chat/delta";
316
+ ActionType["ChatResponsePart"] = "chat/responsePart";
317
+ ActionType["ChatToolCallStart"] = "chat/toolCallStart";
318
+ ActionType["ChatToolCallDelta"] = "chat/toolCallDelta";
319
+ ActionType["ChatToolCallReady"] = "chat/toolCallReady";
320
+ ActionType["ChatToolCallConfirmed"] = "chat/toolCallConfirmed";
321
+ ActionType["ChatToolCallComplete"] = "chat/toolCallComplete";
322
+ ActionType["ChatToolCallResultConfirmed"] = "chat/toolCallResultConfirmed";
323
+ ActionType["ChatToolCallContentChanged"] = "chat/toolCallContentChanged";
324
+ ActionType["ChatToolCallAuthRequired"] = "chat/toolCallAuthRequired";
325
+ ActionType["ChatToolCallAuthResolved"] = "chat/toolCallAuthResolved";
326
+ ActionType["ChatTurnComplete"] = "chat/turnComplete";
327
+ ActionType["ChatTurnCancelled"] = "chat/turnCancelled";
328
+ ActionType["ChatError"] = "chat/error";
329
+ ActionType["ChatTurnResume"] = "chat/turnResume";
330
+ ActionType["ChatActivityChanged"] = "chat/activityChanged";
331
+ ActionType["ChatBackgroundWorkSet"] = "chat/backgroundWorkSet";
332
+ ActionType["ChatBackgroundWorkRemoved"] = "chat/backgroundWorkRemoved";
333
+ ActionType["ChatMovableChanged"] = "chat/movableChanged";
334
+ ActionType["ChatChangesetsChanged"] = "chat/changesetsChanged";
335
+ ActionType["ChatCanvasesChanged"] = "chat/canvasesChanged";
336
+ ActionType["CanvasStateChanged"] = "canvas/stateChanged";
337
+ ActionType["ChatWorkingDirectorySet"] = "chat/workingDirectorySet";
338
+ ActionType["ChatWorkingDirectoryRemoved"] = "chat/workingDirectoryRemoved";
339
+ ActionType["SessionTitleChanged"] = "session/titleChanged";
340
+ ActionType["ChatUsage"] = "chat/usage";
341
+ ActionType["ChatReasoning"] = "chat/reasoning";
342
+ ActionType["SessionServerToolsChanged"] = "session/serverToolsChanged";
343
+ ActionType["SessionActiveClientSet"] = "session/activeClientSet";
344
+ ActionType["SessionActiveClientRemoved"] = "session/activeClientRemoved";
345
+ ActionType["SessionWorkingDirectorySet"] = "session/workingDirectorySet";
346
+ ActionType["SessionWorkingDirectoryRemoved"] = "session/workingDirectoryRemoved";
347
+ ActionType["SessionWorkingDirectoryReplaced"] = "session/workingDirectoryReplaced";
348
+ ActionType["SessionInputNeededSet"] = "session/inputNeededSet";
349
+ ActionType["SessionInputNeededRemoved"] = "session/inputNeededRemoved";
350
+ ActionType["ChatPendingMessageSet"] = "chat/pendingMessageSet";
351
+ ActionType["ChatPendingMessageRemoved"] = "chat/pendingMessageRemoved";
352
+ ActionType["ChatQueuedMessagesReordered"] = "chat/queuedMessagesReordered";
353
+ ActionType["ChatDraftChanged"] = "chat/draftChanged";
354
+ ActionType["ChatIsReadChanged"] = "chat/isReadChanged";
355
+ ActionType["ChatIsArchivedChanged"] = "chat/isArchivedChanged";
356
+ ActionType["ChatConfigChanged"] = "chat/configChanged";
357
+ ActionType["ChatMoved"] = "chat/moved";
358
+ ActionType["ChatInputRequested"] = "chat/inputRequested";
359
+ ActionType["ChatInputAnswerChanged"] = "chat/inputAnswerChanged";
360
+ ActionType["ChatInputCompleted"] = "chat/inputCompleted";
361
+ ActionType["SessionCustomizationsChanged"] = "session/customizationsChanged";
362
+ ActionType["SessionCustomizationToggled"] = "session/customizationToggled";
363
+ ActionType["SessionCustomizationUpdated"] = "session/customizationUpdated";
364
+ ActionType["SessionCustomizationRemoved"] = "session/customizationRemoved";
365
+ ActionType["SessionMcpServerStateChanged"] = "session/mcpServerStateChanged";
366
+ ActionType["SessionMcpServerStartRequested"] = "session/mcpServerStartRequested";
367
+ ActionType["SessionMcpServerStopRequested"] = "session/mcpServerStopRequested";
368
+ ActionType["SessionMcpServerBackgroundRequested"] = "session/mcpServerBackgroundRequested";
369
+ ActionType["ChatTruncated"] = "chat/truncated";
370
+ ActionType["ChatTurnsLoaded"] = "chat/turnsLoaded";
371
+ ActionType["SessionIsReadChanged"] = "session/isReadChanged";
372
+ ActionType["SessionIsArchivedChanged"] = "session/isArchivedChanged";
373
+ ActionType["SessionActivityChanged"] = "session/activityChanged";
374
+ ActionType["SessionChangesetsChanged"] = "session/changesetsChanged";
375
+ ActionType["SessionConfigChanged"] = "session/configChanged";
376
+ ActionType["SessionMetaChanged"] = "session/metaChanged";
377
+ ActionType["ChangesetStatusChanged"] = "changeset/statusChanged";
378
+ ActionType["ChangesetFileSet"] = "changeset/fileSet";
379
+ ActionType["ChangesetFileRemoved"] = "changeset/fileRemoved";
380
+ ActionType["ChangesetFilesReviewChanged"] = "changeset/filesReviewChanged";
381
+ ActionType["ChangesetContentChanged"] = "changeset/contentChanged";
382
+ ActionType["ChangesetOperationsChanged"] = "changeset/operationsChanged";
383
+ ActionType["ChangesetOperationStatusChanged"] = "changeset/operationStatusChanged";
384
+ ActionType["ChangesetCleared"] = "changeset/cleared";
385
+ ActionType["AnnotationsSet"] = "annotations/set";
386
+ ActionType["AnnotationsUpdated"] = "annotations/updated";
387
+ ActionType["AnnotationsRemoved"] = "annotations/removed";
388
+ ActionType["AnnotationsEntrySet"] = "annotations/entrySet";
389
+ ActionType["AnnotationsEntryRemoved"] = "annotations/entryRemoved";
390
+ ActionType["RootTerminalsChanged"] = "root/terminalsChanged";
391
+ ActionType["RootConfigChanged"] = "root/configChanged";
392
+ ActionType["TerminalData"] = "terminal/data";
393
+ ActionType["TerminalInput"] = "terminal/input";
394
+ ActionType["TerminalResized"] = "terminal/resized";
395
+ ActionType["TerminalClaimed"] = "terminal/claimed";
396
+ ActionType["TerminalTitleChanged"] = "terminal/titleChanged";
397
+ ActionType["TerminalCwdChanged"] = "terminal/cwdChanged";
398
+ ActionType["TerminalExited"] = "terminal/exited";
399
+ ActionType["TerminalCleared"] = "terminal/cleared";
400
+ ActionType["TerminalCommandDetectionAvailable"] = "terminal/commandDetectionAvailable";
401
+ ActionType["TerminalCommandExecuted"] = "terminal/commandExecuted";
402
+ ActionType["TerminalCommandFinished"] = "terminal/commandFinished";
403
+ ActionType["ResourceWatchChanged"] = "resourceWatch/changed";
404
+ ActionType["AutomationCreateRequested"] = "automation/createRequested";
405
+ ActionType["AutomationUpdateRequested"] = "automation/updateRequested";
406
+ ActionType["AutomationSet"] = "automation/set";
407
+ ActionType["AutomationRemoved"] = "automation/removed";
408
+ ActionType["AutomationRunLifecycleChanged"] = "automationRun/lifecycleChanged";
409
+ ActionType["AutomationRunSessionSet"] = "automationRun/sessionSet";
410
+ ActionType["AutomationRunSessionRemoved"] = "automationRun/sessionRemoved";
411
+ ActionType["AutomationRunPrimarySessionChanged"] = "automationRun/primarySessionChanged";
412
+ ActionType["AutomationRunCancelRequested"] = "automationRun/cancelRequested";
413
+ })(ActionType || (ActionType = {}));
414
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/action-origin.generated.js
415
+ var IS_CLIENT_DISPATCHABLE = {
416
+ [ActionType.RootAgentsChanged]: false,
417
+ [ActionType.RootActiveSessionsChanged]: false,
418
+ [ActionType.RootTerminalsChanged]: false,
419
+ [ActionType.RootConfigChanged]: true,
420
+ [ActionType.SessionReady]: false,
421
+ [ActionType.SessionCreationFailed]: false,
422
+ [ActionType.SessionChatAdded]: false,
423
+ [ActionType.SessionChatRemoved]: false,
424
+ [ActionType.SessionChatUpdated]: false,
425
+ [ActionType.SessionChatsReordered]: false,
426
+ [ActionType.SessionDefaultChatChanged]: false,
427
+ [ActionType.SessionTitleChanged]: true,
428
+ [ActionType.SessionServerToolsChanged]: false,
429
+ [ActionType.SessionActiveClientSet]: true,
430
+ [ActionType.SessionActiveClientRemoved]: true,
431
+ [ActionType.SessionWorkingDirectorySet]: true,
432
+ [ActionType.SessionWorkingDirectoryRemoved]: true,
433
+ [ActionType.SessionWorkingDirectoryReplaced]: true,
434
+ [ActionType.SessionInputNeededSet]: false,
435
+ [ActionType.SessionInputNeededRemoved]: false,
436
+ [ActionType.SessionCustomizationsChanged]: false,
437
+ [ActionType.SessionCustomizationToggled]: true,
438
+ [ActionType.SessionCustomizationUpdated]: false,
439
+ [ActionType.SessionCustomizationRemoved]: false,
440
+ [ActionType.SessionMcpServerStateChanged]: false,
441
+ [ActionType.SessionMcpServerStartRequested]: true,
442
+ [ActionType.SessionMcpServerStopRequested]: true,
443
+ [ActionType.SessionMcpServerBackgroundRequested]: true,
444
+ [ActionType.SessionIsReadChanged]: true,
445
+ [ActionType.SessionIsArchivedChanged]: true,
446
+ [ActionType.SessionActivityChanged]: false,
447
+ [ActionType.SessionChangesetsChanged]: false,
448
+ [ActionType.SessionConfigChanged]: true,
449
+ [ActionType.SessionMetaChanged]: false,
450
+ [ActionType.ChatTurnStarted]: true,
451
+ [ActionType.ChatDelta]: false,
452
+ [ActionType.ChatResponsePart]: false,
453
+ [ActionType.ChatToolCallStart]: false,
454
+ [ActionType.ChatToolCallDelta]: false,
455
+ [ActionType.ChatToolCallReady]: false,
456
+ [ActionType.ChatToolCallConfirmed]: true,
457
+ [ActionType.ChatToolCallComplete]: true,
458
+ [ActionType.ChatToolCallResultConfirmed]: true,
459
+ [ActionType.ChatToolCallContentChanged]: true,
460
+ [ActionType.ChatToolCallAuthRequired]: false,
461
+ [ActionType.ChatToolCallAuthResolved]: false,
462
+ [ActionType.ChatTurnComplete]: false,
463
+ [ActionType.ChatTurnCancelled]: true,
464
+ [ActionType.ChatError]: false,
465
+ [ActionType.ChatTurnResume]: true,
466
+ [ActionType.ChatActivityChanged]: false,
467
+ [ActionType.ChatBackgroundWorkSet]: false,
468
+ [ActionType.ChatBackgroundWorkRemoved]: false,
469
+ [ActionType.ChatMovableChanged]: false,
470
+ [ActionType.ChatChangesetsChanged]: false,
471
+ [ActionType.ChatCanvasesChanged]: false,
472
+ [ActionType.CanvasStateChanged]: false,
473
+ [ActionType.ChatWorkingDirectorySet]: true,
474
+ [ActionType.ChatWorkingDirectoryRemoved]: true,
475
+ [ActionType.ChatUsage]: false,
476
+ [ActionType.ChatReasoning]: false,
477
+ [ActionType.ChatPendingMessageSet]: true,
478
+ [ActionType.ChatPendingMessageRemoved]: true,
479
+ [ActionType.ChatQueuedMessagesReordered]: true,
480
+ [ActionType.ChatDraftChanged]: true,
481
+ [ActionType.ChatIsReadChanged]: true,
482
+ [ActionType.ChatIsArchivedChanged]: true,
483
+ [ActionType.ChatConfigChanged]: true,
484
+ [ActionType.ChatMoved]: false,
485
+ [ActionType.ChatInputRequested]: false,
486
+ [ActionType.ChatInputAnswerChanged]: true,
487
+ [ActionType.ChatInputCompleted]: true,
488
+ [ActionType.ChatTruncated]: true,
489
+ [ActionType.ChatTurnsLoaded]: false,
490
+ [ActionType.ChangesetStatusChanged]: false,
491
+ [ActionType.ChangesetFileSet]: false,
492
+ [ActionType.ChangesetFileRemoved]: false,
493
+ [ActionType.ChangesetFilesReviewChanged]: true,
494
+ [ActionType.ChangesetContentChanged]: false,
495
+ [ActionType.ChangesetOperationsChanged]: false,
496
+ [ActionType.ChangesetOperationStatusChanged]: false,
497
+ [ActionType.ChangesetCleared]: false,
498
+ [ActionType.AnnotationsSet]: true,
499
+ [ActionType.AnnotationsUpdated]: true,
500
+ [ActionType.AnnotationsRemoved]: true,
501
+ [ActionType.AnnotationsEntrySet]: true,
502
+ [ActionType.AnnotationsEntryRemoved]: true,
503
+ [ActionType.TerminalData]: false,
504
+ [ActionType.TerminalInput]: true,
505
+ [ActionType.TerminalResized]: true,
506
+ [ActionType.TerminalClaimed]: true,
507
+ [ActionType.TerminalTitleChanged]: true,
508
+ [ActionType.TerminalCwdChanged]: false,
509
+ [ActionType.TerminalExited]: false,
510
+ [ActionType.TerminalCleared]: true,
511
+ [ActionType.TerminalCommandDetectionAvailable]: false,
512
+ [ActionType.TerminalCommandExecuted]: false,
513
+ [ActionType.TerminalCommandFinished]: false,
514
+ [ActionType.ResourceWatchChanged]: false,
515
+ [ActionType.AutomationCreateRequested]: true,
516
+ [ActionType.AutomationUpdateRequested]: true,
517
+ [ActionType.AutomationSet]: false,
518
+ [ActionType.AutomationRemoved]: true,
519
+ [ActionType.AutomationRunLifecycleChanged]: false,
520
+ [ActionType.AutomationRunSessionSet]: false,
521
+ [ActionType.AutomationRunSessionRemoved]: false,
522
+ [ActionType.AutomationRunPrimarySessionChanged]: false,
523
+ [ActionType.AutomationRunCancelRequested]: true
524
+ };
525
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/window-exempt.generated.js
526
+ var WINDOW_EXEMPT_METHODS = [
527
+ "channel/credit",
528
+ "tcp/reset",
529
+ "unsubscribe"
530
+ ];
531
+ var windowExemptMethods = new Set(WINDOW_EXEMPT_METHODS);
532
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/common/commands.js
533
+ var PathStyle;
534
+ (function(PathStyle) {
535
+ PathStyle["Posix"] = "posix";
536
+ PathStyle["Windows"] = "windows";
537
+ })(PathStyle || (PathStyle = {}));
538
+ var ReconnectResultType;
539
+ (function(ReconnectResultType) {
540
+ ReconnectResultType["Replay"] = "replay";
541
+ ReconnectResultType["Snapshot"] = "snapshot";
542
+ })(ReconnectResultType || (ReconnectResultType = {}));
543
+ var ContentEncoding;
544
+ (function(ContentEncoding) {
545
+ ContentEncoding["Base64"] = "base64";
546
+ ContentEncoding["Utf8"] = "utf-8";
547
+ })(ContentEncoding || (ContentEncoding = {}));
548
+ var ResourceWriteMode;
549
+ (function(ResourceWriteMode) {
550
+ ResourceWriteMode["Truncate"] = "truncate";
551
+ ResourceWriteMode["Append"] = "append";
552
+ ResourceWriteMode["Insert"] = "insert";
553
+ })(ResourceWriteMode || (ResourceWriteMode = {}));
554
+ var ResourceType;
555
+ (function(ResourceType) {
556
+ ResourceType["File"] = "file";
557
+ ResourceType["Directory"] = "directory";
558
+ ResourceType["Symlink"] = "symlink";
559
+ })(ResourceType || (ResourceType = {}));
560
+ var AuthenticateTargetKind;
561
+ (function(AuthenticateTargetKind) {
562
+ AuthenticateTargetKind["McpServer"] = "mcpServer";
563
+ })(AuthenticateTargetKind || (AuthenticateTargetKind = {}));
564
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-session/commands.js
565
+ var CompletionItemKind;
566
+ (function(CompletionItemKind) {
567
+ CompletionItemKind["UserMessage"] = "userMessage";
568
+ })(CompletionItemKind || (CompletionItemKind = {}));
569
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-chat/commands.js
570
+ var ChatSourceKind;
571
+ (function(ChatSourceKind) {
572
+ ChatSourceKind["Fork"] = "fork";
573
+ ChatSourceKind["SideChat"] = "sideChat";
574
+ })(ChatSourceKind || (ChatSourceKind = {}));
575
+ var ChatMoveDestinationKind;
576
+ (function(ChatMoveDestinationKind) {
577
+ ChatMoveDestinationKind["Session"] = "session";
578
+ ChatMoveDestinationKind["NewSession"] = "newSession";
579
+ })(ChatMoveDestinationKind || (ChatMoveDestinationKind = {}));
580
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-changeset/commands.js
581
+ var ChangesetOperationTargetKind;
582
+ (function(ChangesetOperationTargetKind) {
583
+ ChangesetOperationTargetKind["Resource"] = "resource";
584
+ ChangesetOperationTargetKind["Range"] = "range";
585
+ })(ChangesetOperationTargetKind || (ChangesetOperationTargetKind = {}));
586
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/common/notifications.js
587
+ var AuthRequiredReason;
588
+ (function(AuthRequiredReason) {
589
+ AuthRequiredReason["Required"] = "required";
590
+ AuthRequiredReason["Expired"] = "expired";
591
+ })(AuthRequiredReason || (AuthRequiredReason = {}));
592
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/version/registry.js
593
+ var SUPPORTED_PROTOCOL_VERSIONS = Object.freeze([
594
+ "1.0.0",
595
+ "0.9.0"
596
+ ]);
597
+ var ACTION_INTRODUCED_IN = {
598
+ [ActionType.RootAgentsChanged]: "0.1.0",
599
+ [ActionType.RootActiveSessionsChanged]: "0.1.0",
600
+ [ActionType.SessionReady]: "0.1.0",
601
+ [ActionType.SessionCreationFailed]: "0.1.0",
602
+ [ActionType.SessionChatAdded]: "0.4.0",
603
+ [ActionType.SessionChatRemoved]: "0.4.0",
604
+ [ActionType.SessionChatUpdated]: "0.4.0",
605
+ [ActionType.SessionChatsReordered]: "0.9.0",
606
+ [ActionType.SessionDefaultChatChanged]: "0.4.0",
607
+ [ActionType.SessionTitleChanged]: "0.1.0",
608
+ [ActionType.SessionServerToolsChanged]: "0.1.0",
609
+ [ActionType.SessionActiveClientSet]: "0.5.0",
610
+ [ActionType.SessionActiveClientRemoved]: "0.5.0",
611
+ [ActionType.SessionWorkingDirectorySet]: "0.7.0",
612
+ [ActionType.SessionWorkingDirectoryRemoved]: "0.7.0",
613
+ [ActionType.SessionWorkingDirectoryReplaced]: "0.8.0",
614
+ [ActionType.SessionInputNeededSet]: "0.5.1",
615
+ [ActionType.SessionInputNeededRemoved]: "0.5.1",
616
+ [ActionType.SessionCustomizationsChanged]: "0.1.0",
617
+ [ActionType.SessionCustomizationToggled]: "0.1.0",
618
+ [ActionType.SessionCustomizationUpdated]: "0.1.0",
619
+ [ActionType.SessionCustomizationRemoved]: "0.2.0",
620
+ [ActionType.SessionMcpServerStateChanged]: "0.3.0",
621
+ [ActionType.SessionMcpServerStartRequested]: "0.5.2",
622
+ [ActionType.SessionMcpServerStopRequested]: "0.5.2",
623
+ [ActionType.SessionMcpServerBackgroundRequested]: "0.9.0",
624
+ [ActionType.SessionIsReadChanged]: "0.1.0",
625
+ [ActionType.SessionIsArchivedChanged]: "0.1.0",
626
+ [ActionType.SessionActivityChanged]: "0.1.0",
627
+ [ActionType.SessionChangesetsChanged]: "0.2.0",
628
+ [ActionType.SessionConfigChanged]: "0.1.0",
629
+ [ActionType.SessionMetaChanged]: "0.1.0",
630
+ [ActionType.ChatTurnStarted]: "0.4.0",
631
+ [ActionType.ChatDelta]: "0.4.0",
632
+ [ActionType.ChatResponsePart]: "0.4.0",
633
+ [ActionType.ChatToolCallStart]: "0.4.0",
634
+ [ActionType.ChatToolCallDelta]: "0.4.0",
635
+ [ActionType.ChatToolCallReady]: "0.4.0",
636
+ [ActionType.ChatToolCallConfirmed]: "0.4.0",
637
+ [ActionType.ChatToolCallComplete]: "0.4.0",
638
+ [ActionType.ChatToolCallResultConfirmed]: "0.4.0",
639
+ [ActionType.ChatToolCallContentChanged]: "0.4.0",
640
+ [ActionType.ChatToolCallAuthRequired]: "0.6.0",
641
+ [ActionType.ChatToolCallAuthResolved]: "0.6.0",
642
+ [ActionType.ChatTurnComplete]: "0.4.0",
643
+ [ActionType.ChatTurnCancelled]: "0.4.0",
644
+ [ActionType.ChatError]: "0.4.0",
645
+ [ActionType.ChatTurnResume]: "0.9.0",
646
+ [ActionType.ChatActivityChanged]: "0.5.0",
647
+ [ActionType.ChatBackgroundWorkSet]: "0.9.0",
648
+ [ActionType.ChatBackgroundWorkRemoved]: "0.9.0",
649
+ [ActionType.ChatMovableChanged]: "0.9.0",
650
+ [ActionType.ChatChangesetsChanged]: "0.9.0",
651
+ [ActionType.ChatCanvasesChanged]: "0.10.0",
652
+ [ActionType.CanvasStateChanged]: "0.10.0",
653
+ [ActionType.ChatWorkingDirectorySet]: "0.7.0",
654
+ [ActionType.ChatWorkingDirectoryRemoved]: "0.7.0",
655
+ [ActionType.ChatUsage]: "0.4.0",
656
+ [ActionType.ChatReasoning]: "0.4.0",
657
+ [ActionType.ChatPendingMessageSet]: "0.4.0",
658
+ [ActionType.ChatPendingMessageRemoved]: "0.4.0",
659
+ [ActionType.ChatQueuedMessagesReordered]: "0.4.0",
660
+ [ActionType.ChatDraftChanged]: "0.5.0",
661
+ [ActionType.ChatIsReadChanged]: "0.9.0",
662
+ [ActionType.ChatIsArchivedChanged]: "0.9.0",
663
+ [ActionType.ChatConfigChanged]: "1.1.0",
664
+ [ActionType.ChatMoved]: "1.1.0",
665
+ [ActionType.ChatInputRequested]: "0.4.0",
666
+ [ActionType.ChatInputAnswerChanged]: "0.4.0",
667
+ [ActionType.ChatInputCompleted]: "0.4.0",
668
+ [ActionType.ChatTruncated]: "0.4.0",
669
+ [ActionType.ChatTurnsLoaded]: "0.5.1",
670
+ [ActionType.ChangesetStatusChanged]: "0.2.0",
671
+ [ActionType.ChangesetFileSet]: "0.2.0",
672
+ [ActionType.ChangesetFileRemoved]: "0.2.0",
673
+ [ActionType.ChangesetFilesReviewChanged]: "0.6.0",
674
+ [ActionType.ChangesetContentChanged]: "0.4.0",
675
+ [ActionType.ChangesetOperationsChanged]: "0.2.0",
676
+ [ActionType.ChangesetOperationStatusChanged]: "0.3.0",
677
+ [ActionType.ChangesetCleared]: "0.2.0",
678
+ [ActionType.AnnotationsSet]: "0.4.0",
679
+ [ActionType.AnnotationsUpdated]: "0.4.0",
680
+ [ActionType.AnnotationsRemoved]: "0.4.0",
681
+ [ActionType.AnnotationsEntrySet]: "0.4.0",
682
+ [ActionType.AnnotationsEntryRemoved]: "0.4.0",
683
+ [ActionType.RootTerminalsChanged]: "0.1.0",
684
+ [ActionType.RootConfigChanged]: "0.1.0",
685
+ [ActionType.TerminalData]: "0.1.0",
686
+ [ActionType.TerminalInput]: "0.1.0",
687
+ [ActionType.TerminalResized]: "0.1.0",
688
+ [ActionType.TerminalClaimed]: "0.1.0",
689
+ [ActionType.TerminalTitleChanged]: "0.1.0",
690
+ [ActionType.TerminalCwdChanged]: "0.1.0",
691
+ [ActionType.TerminalExited]: "0.1.0",
692
+ [ActionType.TerminalCleared]: "0.1.0",
693
+ [ActionType.TerminalCommandDetectionAvailable]: "0.1.0",
694
+ [ActionType.TerminalCommandExecuted]: "0.1.0",
695
+ [ActionType.TerminalCommandFinished]: "0.1.0",
696
+ [ActionType.ResourceWatchChanged]: "0.2.0",
697
+ [ActionType.AutomationCreateRequested]: "0.8.0",
698
+ [ActionType.AutomationUpdateRequested]: "0.8.0",
699
+ [ActionType.AutomationSet]: "0.8.0",
700
+ [ActionType.AutomationRemoved]: "0.8.0",
701
+ [ActionType.AutomationRunLifecycleChanged]: "0.8.0",
702
+ [ActionType.AutomationRunSessionSet]: "0.8.0",
703
+ [ActionType.AutomationRunSessionRemoved]: "0.8.0",
704
+ [ActionType.AutomationRunPrimarySessionChanged]: "0.8.0",
705
+ [ActionType.AutomationRunCancelRequested]: "0.8.0"
706
+ };
707
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-session/reducer.js
708
+ var STATUS_ACTIVITY_MASK = (1 << 5) - 1;
709
+ // ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-chat/reducer.js
710
+ var STATUS_ACTIVITY_MASK2 = (1 << 5) - 1;
24
711
  // ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/util.js
25
712
  function getEnumValues(entries) {
26
713
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
@@ -61,6 +748,14 @@ function cleanRegex(source) {
61
748
  const end = source.endsWith("$") ? source.length - 1 : source.length;
62
749
  return source.slice(start, end);
63
750
  }
751
+ function floatSafeRemainder(val, step) {
752
+ const ratio = val / step;
753
+ const roundedRatio = Math.round(ratio);
754
+ const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
755
+ if (Math.abs(ratio - roundedRatio) < tolerance)
756
+ return 0;
757
+ return ratio - roundedRatio;
758
+ }
64
759
  function assignProp(target, prop, value) {
65
760
  Object.defineProperty(target, prop, {
66
761
  value,
@@ -1000,6 +1695,9 @@ function datetime(args) {
1000
1695
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
1001
1696
  }
1002
1697
  var anyString = /^[\s\S]{0,}$/;
1698
+ var integer = /^-?\d+$/;
1699
+ var number = /^-?\d+(?:\.\d+)?$/;
1700
+ var boolean = /^(?:true|false)$/i;
1003
1701
  var lowercase = /^[^A-Z]*$/;
1004
1702
  var uppercase = /^[^a-z]*$/;
1005
1703
 
@@ -1014,6 +1712,136 @@ var _whenHasLength = (payload) => {
1014
1712
  const val = payload.value;
1015
1713
  return !nullish(val) && val.length !== undefined;
1016
1714
  };
1715
+ var numericOriginMap = {
1716
+ number: "number",
1717
+ bigint: "bigint",
1718
+ object: "date"
1719
+ };
1720
+ var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
1721
+ $ZodCheck.init(inst, def);
1722
+ const origin = numericOriginMap[typeof def.value];
1723
+ inst._zod.check = (payload) => {
1724
+ if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
1725
+ return;
1726
+ }
1727
+ payload.issues.push({
1728
+ origin: numericOriginMap[typeof payload.value] ?? origin,
1729
+ code: "too_big",
1730
+ maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
1731
+ input: payload.value,
1732
+ inclusive: def.inclusive,
1733
+ inst,
1734
+ continue: !def.abort
1735
+ });
1736
+ };
1737
+ });
1738
+ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
1739
+ $ZodCheck.init(inst, def);
1740
+ const origin = numericOriginMap[typeof def.value];
1741
+ inst._zod.check = (payload) => {
1742
+ if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
1743
+ return;
1744
+ }
1745
+ payload.issues.push({
1746
+ origin: numericOriginMap[typeof payload.value] ?? origin,
1747
+ code: "too_small",
1748
+ minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
1749
+ input: payload.value,
1750
+ inclusive: def.inclusive,
1751
+ inst,
1752
+ continue: !def.abort
1753
+ });
1754
+ };
1755
+ });
1756
+ var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
1757
+ $ZodCheck.init(inst, def);
1758
+ inst._zod.check = (payload) => {
1759
+ if (typeof payload.value !== typeof def.value)
1760
+ throw new Error("Cannot mix number and bigint in multiple_of check.");
1761
+ const isMultiple = typeof payload.value === "bigint" ? def.value !== BigInt(0) && payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0;
1762
+ if (isMultiple)
1763
+ return;
1764
+ payload.issues.push({
1765
+ origin: typeof payload.value,
1766
+ code: "not_multiple_of",
1767
+ divisor: def.value,
1768
+ input: payload.value,
1769
+ inst,
1770
+ continue: !def.abort
1771
+ });
1772
+ };
1773
+ });
1774
+ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => {
1775
+ $ZodCheck.init(inst, def);
1776
+ def.format = def.format || "float64";
1777
+ const isInt = def.format?.includes("int");
1778
+ const origin = isInt ? "int" : "number";
1779
+ const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
1780
+ inst._zod.check = (payload) => {
1781
+ const input = payload.value;
1782
+ if (isInt) {
1783
+ if (!Number.isInteger(input)) {
1784
+ payload.issues.push({
1785
+ expected: origin,
1786
+ format: def.format,
1787
+ code: "invalid_type",
1788
+ continue: false,
1789
+ input,
1790
+ inst
1791
+ });
1792
+ return;
1793
+ }
1794
+ if (!Number.isSafeInteger(input)) {
1795
+ if (input > 0) {
1796
+ payload.issues.push({
1797
+ input,
1798
+ code: "too_big",
1799
+ maximum: Number.MAX_SAFE_INTEGER,
1800
+ note: "Integers must be within the safe integer range.",
1801
+ inst,
1802
+ origin,
1803
+ inclusive: true,
1804
+ continue: !def.abort
1805
+ });
1806
+ } else {
1807
+ payload.issues.push({
1808
+ input,
1809
+ code: "too_small",
1810
+ minimum: Number.MIN_SAFE_INTEGER,
1811
+ note: "Integers must be within the safe integer range.",
1812
+ inst,
1813
+ origin,
1814
+ inclusive: true,
1815
+ continue: !def.abort
1816
+ });
1817
+ }
1818
+ return;
1819
+ }
1820
+ }
1821
+ if (input < minimum) {
1822
+ payload.issues.push({
1823
+ origin: "number",
1824
+ input,
1825
+ code: "too_small",
1826
+ minimum,
1827
+ inclusive: true,
1828
+ inst,
1829
+ continue: !def.abort
1830
+ });
1831
+ }
1832
+ if (input > maximum) {
1833
+ payload.issues.push({
1834
+ origin: "number",
1835
+ input,
1836
+ code: "too_big",
1837
+ maximum,
1838
+ inclusive: true,
1839
+ inst,
1840
+ continue: !def.abort
1841
+ });
1842
+ }
1843
+ };
1844
+ });
1017
1845
  var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
1018
1846
  var _a;
1019
1847
  $ZodCheck.init(inst, def);
@@ -1724,6 +2552,53 @@ var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
1724
2552
  });
1725
2553
  };
1726
2554
  });
2555
+ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
2556
+ $ZodType.init(inst, def);
2557
+ inst._zod.pattern = number;
2558
+ inst._zod.parse = (payload, _ctx) => {
2559
+ if (def.coerce)
2560
+ try {
2561
+ payload.value = Number(payload.value);
2562
+ } catch (_) {}
2563
+ const input = payload.value;
2564
+ if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
2565
+ return payload;
2566
+ }
2567
+ const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? String(input) : undefined : undefined;
2568
+ payload.issues.push({
2569
+ expected: "number",
2570
+ code: "invalid_type",
2571
+ input,
2572
+ inst,
2573
+ ...received ? { received } : {}
2574
+ });
2575
+ return payload;
2576
+ };
2577
+ });
2578
+ var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
2579
+ $ZodCheckNumberFormat.init(inst, def);
2580
+ $ZodNumber.init(inst, def);
2581
+ });
2582
+ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
2583
+ $ZodType.init(inst, def);
2584
+ inst._zod.pattern = boolean;
2585
+ inst._zod.parse = (payload, _ctx) => {
2586
+ if (def.coerce)
2587
+ try {
2588
+ payload.value = Boolean(payload.value);
2589
+ } catch (_) {}
2590
+ const input = payload.value;
2591
+ if (typeof input === "boolean")
2592
+ return payload;
2593
+ payload.issues.push({
2594
+ expected: "boolean",
2595
+ code: "invalid_type",
2596
+ input,
2597
+ inst
2598
+ });
2599
+ return payload;
2600
+ };
2601
+ });
1727
2602
  var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
1728
2603
  $ZodType.init(inst, def);
1729
2604
  inst._zod.parse = (payload) => payload;
@@ -2177,6 +3052,89 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
2177
3052
  });
2178
3053
  };
2179
3054
  });
3055
+ function discriminatorMap(def) {
3056
+ const map = new Map;
3057
+ for (const option of def.options) {
3058
+ const values = option._zod.propValues?.[def.discriminator];
3059
+ if (!values || values.size === 0)
3060
+ throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
3061
+ for (const value of values) {
3062
+ if (map.has(value)) {
3063
+ if (value !== undefined)
3064
+ throw new Error(`Duplicate discriminator value "${String(value)}"`);
3065
+ map.set(value, null);
3066
+ } else {
3067
+ map.set(value, option);
3068
+ }
3069
+ }
3070
+ }
3071
+ return map;
3072
+ }
3073
+ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
3074
+ def.inclusive = false;
3075
+ $ZodUnion.init(inst, def);
3076
+ const _super = inst._zod.parse;
3077
+ defineLazyInternal(inst, "propValues", (zod) => {
3078
+ const propValues = {};
3079
+ let undefinedCount = 0;
3080
+ for (const option of zod.def.options) {
3081
+ const pv = option._zod.propValues;
3082
+ if (!pv || Object.keys(pv).length === 0)
3083
+ throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
3084
+ if (pv[zod.def.discriminator]?.has(undefined))
3085
+ undefinedCount++;
3086
+ for (const [k, v] of Object.entries(pv)) {
3087
+ if (!Object.prototype.hasOwnProperty.call(propValues, k)) {
3088
+ assignProp(propValues, k, new Set);
3089
+ }
3090
+ for (const val of v) {
3091
+ propValues[k].add(val);
3092
+ }
3093
+ }
3094
+ }
3095
+ if (!zod.def.unionFallback && undefinedCount > 1)
3096
+ propValues[zod.def.discriminator]?.delete(undefined);
3097
+ return propValues;
3098
+ });
3099
+ def.options.forEach((option, i) => {
3100
+ const propShape = rawShape(option._zod.def);
3101
+ if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
3102
+ throw new Error(`Invalid discriminated union option at index "${i}"`);
3103
+ }
3104
+ });
3105
+ const disc = cached(() => discriminatorMap(def));
3106
+ inst._zod.parse = (payload, ctx) => {
3107
+ const input = payload.value;
3108
+ if (!isObject(input)) {
3109
+ payload.issues.push({
3110
+ code: "invalid_type",
3111
+ expected: "object",
3112
+ input,
3113
+ inst
3114
+ });
3115
+ return payload;
3116
+ }
3117
+ const value = input?.[def.discriminator];
3118
+ const opt = disc.value.get(value);
3119
+ if (opt && (value !== undefined || ctx.direction !== "backward")) {
3120
+ return opt._zod.run(payload, ctx);
3121
+ }
3122
+ if (def.unionFallback || ctx.direction === "backward") {
3123
+ return _super(payload, ctx);
3124
+ }
3125
+ payload.issues.push({
3126
+ code: "invalid_union",
3127
+ errors: [],
3128
+ note: "No matching discriminator",
3129
+ discriminator: def.discriminator,
3130
+ options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
3131
+ input,
3132
+ path: [def.discriminator],
3133
+ inst
3134
+ });
3135
+ return payload;
3136
+ };
3137
+ });
2180
3138
  var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
2181
3139
  $ZodType.init(inst, def);
2182
3140
  inst._zod.parse = (payload, ctx) => {
@@ -2291,6 +3249,161 @@ function handleIntersectionResults(result, left, right) {
2291
3249
  result.value = merged.data;
2292
3250
  return result;
2293
3251
  }
3252
+ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
3253
+ $ZodType.init(inst, def);
3254
+ const memo = globalConfig.memoizer;
3255
+ memo?.attach(inst);
3256
+ inst._zod.parse = (payload, ctx) => {
3257
+ const input = payload.value;
3258
+ if (!isPlainObject(input)) {
3259
+ payload.issues.push({
3260
+ expected: "record",
3261
+ code: "invalid_type",
3262
+ input,
3263
+ inst
3264
+ });
3265
+ return payload;
3266
+ }
3267
+ const proms = [];
3268
+ const values = def.keyType._zod.values;
3269
+ if (values && !def.partial) {
3270
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
3271
+ const recordKeys = new Set;
3272
+ for (const key of values) {
3273
+ if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
3274
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
3275
+ if (key === "__proto__")
3276
+ continue;
3277
+ const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
3278
+ if (keyResult instanceof Promise) {
3279
+ throw new Error("Async schemas not supported in object keys currently");
3280
+ }
3281
+ if (keyResult.issues.length) {
3282
+ payload.issues.push({
3283
+ code: "invalid_key",
3284
+ origin: "record",
3285
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
3286
+ input: key,
3287
+ path: [key],
3288
+ inst
3289
+ });
3290
+ continue;
3291
+ }
3292
+ const outKey = keyResult.value;
3293
+ if (outKey === "__proto__")
3294
+ continue;
3295
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
3296
+ if (result instanceof Promise) {
3297
+ proms.push(result.then((result) => {
3298
+ if (result.issues.length) {
3299
+ payload.issues.push(...prefixIssues(key, result.issues));
3300
+ }
3301
+ payload.value[outKey] = result.value;
3302
+ }));
3303
+ } else {
3304
+ if (result.issues.length) {
3305
+ payload.issues.push(...prefixIssues(key, result.issues));
3306
+ }
3307
+ payload.value[outKey] = result.value;
3308
+ }
3309
+ }
3310
+ }
3311
+ let unrecognized;
3312
+ for (const key in input) {
3313
+ if (!recordKeys.has(key)) {
3314
+ if (def.mode === "loose") {
3315
+ if (key === "__proto__")
3316
+ continue;
3317
+ payload.value[key] = input[key];
3318
+ } else {
3319
+ unrecognized = unrecognized ?? [];
3320
+ unrecognized.push(key);
3321
+ }
3322
+ }
3323
+ }
3324
+ if (unrecognized && unrecognized.length > 0) {
3325
+ payload.issues.push({
3326
+ code: "unrecognized_keys",
3327
+ input,
3328
+ inst,
3329
+ keys: unrecognized,
3330
+ continue: true
3331
+ });
3332
+ }
3333
+ } else {
3334
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
3335
+ let unrecognized;
3336
+ for (const key of Reflect.ownKeys(input)) {
3337
+ if (key === "__proto__")
3338
+ continue;
3339
+ if (!Object.prototype.propertyIsEnumerable.call(input, key))
3340
+ continue;
3341
+ let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
3342
+ if (keyResult instanceof Promise) {
3343
+ throw new Error("Async schemas not supported in object keys currently");
3344
+ }
3345
+ const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
3346
+ if (checkNumericKey) {
3347
+ const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
3348
+ if (retryResult instanceof Promise) {
3349
+ throw new Error("Async schemas not supported in object keys currently");
3350
+ }
3351
+ if (retryResult.issues.length === 0) {
3352
+ keyResult = retryResult;
3353
+ }
3354
+ }
3355
+ if (keyResult.issues.length) {
3356
+ if (def.mode === "loose") {
3357
+ payload.value[key] = input[key];
3358
+ } else if (values) {
3359
+ unrecognized = unrecognized ?? [];
3360
+ unrecognized.push(key);
3361
+ } else {
3362
+ payload.issues.push({
3363
+ code: "invalid_key",
3364
+ origin: "record",
3365
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
3366
+ input: key,
3367
+ path: [key],
3368
+ inst
3369
+ });
3370
+ }
3371
+ continue;
3372
+ }
3373
+ const outKey = keyResult.value;
3374
+ if (outKey === "__proto__")
3375
+ continue;
3376
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
3377
+ if (result instanceof Promise) {
3378
+ proms.push(result.then((result) => {
3379
+ if (result.issues.length) {
3380
+ payload.issues.push(...prefixIssues(key, result.issues));
3381
+ }
3382
+ payload.value[outKey] = result.value;
3383
+ }));
3384
+ } else {
3385
+ if (result.issues.length) {
3386
+ payload.issues.push(...prefixIssues(key, result.issues));
3387
+ }
3388
+ payload.value[outKey] = result.value;
3389
+ }
3390
+ }
3391
+ if (unrecognized && unrecognized.length > 0) {
3392
+ payload.issues.push({
3393
+ code: "unrecognized_keys",
3394
+ input,
3395
+ inst,
3396
+ keys: unrecognized,
3397
+ continue: true
3398
+ });
3399
+ }
3400
+ }
3401
+ if (proms.length) {
3402
+ return Promise.all(proms).then(() => payload);
3403
+ }
3404
+ return payload;
3405
+ };
3406
+ });
2294
3407
  var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
2295
3408
  $ZodType.init(inst, def);
2296
3409
  const values = getEnumValues(def.entries);
@@ -3022,10 +4135,10 @@ class $ZodRegistry {
3022
4135
  return this._map.has(schema);
3023
4136
  }
3024
4137
  }
3025
- function registry() {
4138
+ function registry2() {
3026
4139
  return new $ZodRegistry;
3027
4140
  }
3028
- (_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
4141
+ (_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry2());
3029
4142
  var globalRegistry = globalThis.__zod_globalRegistry;
3030
4143
  // ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/api.js
3031
4144
  function snapshotChecks(def) {
@@ -3273,6 +4386,24 @@ function _isoDuration(Class, params) {
3273
4386
  ...normalizeParams(params)
3274
4387
  });
3275
4388
  }
4389
+ function _number(Class, params) {
4390
+ return new Class(snapshotChecks({ type: "number", checks: [], ...normalizeParams(params) }));
4391
+ }
4392
+ function _int(Class, params) {
4393
+ return new Class({
4394
+ type: "number",
4395
+ check: "number_format",
4396
+ abort: false,
4397
+ format: "safeint",
4398
+ ...normalizeParams(params)
4399
+ });
4400
+ }
4401
+ function _boolean(Class, params) {
4402
+ return new Class({
4403
+ type: "boolean",
4404
+ ...normalizeParams(params)
4405
+ });
4406
+ }
3276
4407
  function _unknown(Class) {
3277
4408
  return new Class({
3278
4409
  type: "unknown"
@@ -3284,6 +4415,45 @@ function _never(Class, params) {
3284
4415
  ...normalizeParams(params)
3285
4416
  });
3286
4417
  }
4418
+ function _lt(value, params) {
4419
+ return new $ZodCheckLessThan({
4420
+ check: "less_than",
4421
+ ...normalizeParams(params),
4422
+ value,
4423
+ inclusive: false
4424
+ });
4425
+ }
4426
+ function _lte(value, params) {
4427
+ return new $ZodCheckLessThan({
4428
+ check: "less_than",
4429
+ ...normalizeParams(params),
4430
+ value,
4431
+ inclusive: true
4432
+ });
4433
+ }
4434
+ function _gt(value, params) {
4435
+ return new $ZodCheckGreaterThan({
4436
+ check: "greater_than",
4437
+ ...normalizeParams(params),
4438
+ value,
4439
+ inclusive: false
4440
+ });
4441
+ }
4442
+ function _gte(value, params) {
4443
+ return new $ZodCheckGreaterThan({
4444
+ check: "greater_than",
4445
+ ...normalizeParams(params),
4446
+ value,
4447
+ inclusive: true
4448
+ });
4449
+ }
4450
+ function _multipleOf(value, params) {
4451
+ return new $ZodCheckMultipleOf({
4452
+ check: "multiple_of",
4453
+ ...normalizeParams(params),
4454
+ value
4455
+ });
4456
+ }
3287
4457
  function _maxLength(maximum, params) {
3288
4458
  const ch = new $ZodCheckMaxLength({
3289
4459
  check: "max_length",
@@ -4074,6 +5244,51 @@ var stringProcessor = (schema, ctx, _json, _params) => {
4074
5244
  }
4075
5245
  }
4076
5246
  };
5247
+ var numberProcessor = (schema, ctx, _json, params) => {
5248
+ const json = _json;
5249
+ const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
5250
+ json.type = isInt ? "integer" : "number";
5251
+ const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
5252
+ const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
5253
+ const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
5254
+ if (exMin) {
5255
+ if (legacy) {
5256
+ json.minimum = exclusiveMinimum;
5257
+ json.exclusiveMinimum = true;
5258
+ } else {
5259
+ json.exclusiveMinimum = exclusiveMinimum;
5260
+ }
5261
+ } else if (typeof minimum === "number") {
5262
+ json.minimum = minimum;
5263
+ }
5264
+ if (exMax) {
5265
+ if (legacy) {
5266
+ json.maximum = exclusiveMaximum;
5267
+ json.exclusiveMaximum = true;
5268
+ } else {
5269
+ json.exclusiveMaximum = exclusiveMaximum;
5270
+ }
5271
+ } else if (typeof maximum === "number") {
5272
+ json.maximum = maximum;
5273
+ }
5274
+ if (multipleOf) {
5275
+ const divisors = new Set;
5276
+ for (const divisor of multipleOf) {
5277
+ if (Number.isFinite(divisor) && divisor !== 0)
5278
+ divisors.add(Math.abs(divisor));
5279
+ else
5280
+ handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
5281
+ }
5282
+ const [first, ...rest] = divisors;
5283
+ if (first !== undefined)
5284
+ json.multipleOf = first;
5285
+ if (rest.length)
5286
+ json.allOf = [...json.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
5287
+ }
5288
+ };
5289
+ var booleanProcessor = (_schema, _ctx, json, _params) => {
5290
+ json.type = "boolean";
5291
+ };
4077
5292
  var neverProcessor = (_schema, _ctx, json, _params) => {
4078
5293
  json.not = {};
4079
5294
  };
@@ -4229,7 +5444,112 @@ var intersectionProcessor = (schema, ctx, json, params) => {
4229
5444
  json.allOf = allOf;
4230
5445
  ctx.intersections.push(allOf);
4231
5446
  };
5447
+ function stringifyKeyNames(bySchema, json, visited) {
5448
+ if (json.$ref) {
5449
+ if (visited.has(json))
5450
+ return json;
5451
+ visited.add(json);
5452
+ const def = bySchema.get(json)?.def;
5453
+ if (!def)
5454
+ return json;
5455
+ const inlined = stringifyKeyNames(bySchema, def, visited);
5456
+ return inlined === def ? json : inlined;
5457
+ }
5458
+ for (const keyword of ["anyOf", "oneOf"]) {
5459
+ const branches = json[keyword];
5460
+ if (!Array.isArray(branches))
5461
+ continue;
5462
+ const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited));
5463
+ if (mapped.some((branch, i) => branch !== branches[i]))
5464
+ json = { ...json, [keyword]: mapped };
5465
+ }
5466
+ const types = Array.isArray(json.type) ? json.type : [json.type];
5467
+ const numericType = !types.includes("string") && types.some((t) => t === "number" || t === "integer");
5468
+ const values = json.enum ?? (json.const !== undefined ? [json.const] : undefined);
5469
+ if (!numericType && !values?.some((v) => typeof v === "number"))
5470
+ return json;
5471
+ const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json;
5472
+ if (rest.enum)
5473
+ rest.enum = rest.enum.map((v) => typeof v === "number" ? String(v) : v);
5474
+ else if (typeof rest.const === "number")
5475
+ rest.const = String(rest.const);
5476
+ if (!numericType)
5477
+ return rest;
5478
+ rest.type = "string";
5479
+ if (!values)
5480
+ rest.pattern = (types.includes("number") ? number : integer).source;
5481
+ return rest;
5482
+ }
4232
5483
  var pendingRecords = new WeakMap;
5484
+ function rewriteKeyNames(ctx) {
5485
+ const bySchema = new Map;
5486
+ for (const entry of ctx.seen.values()) {
5487
+ if (entry.def && !bySchema.has(entry.schema))
5488
+ bySchema.set(entry.schema, entry);
5489
+ }
5490
+ const rewrites = new Map;
5491
+ for (const record of pendingRecords.get(ctx) ?? []) {
5492
+ const seen = ctx.seen.get(record);
5493
+ const names = (seen?.def ?? seen?.schema)?.propertyNames;
5494
+ if (!names || names === true || rewrites.has(names))
5495
+ continue;
5496
+ const rewritten = stringifyKeyNames(bySchema, names, new Set);
5497
+ if (rewritten !== names)
5498
+ rewrites.set(names, rewritten);
5499
+ }
5500
+ if (!rewrites.size)
5501
+ return;
5502
+ for (const entry of ctx.seen.values()) {
5503
+ for (const carrier of [entry.schema, entry.def]) {
5504
+ const rewritten = carrier && rewrites.get(carrier.propertyNames);
5505
+ if (rewritten)
5506
+ carrier.propertyNames = rewritten;
5507
+ }
5508
+ }
5509
+ }
5510
+ var recordProcessor = (schema, ctx, _json, params) => {
5511
+ const json = _json;
5512
+ const def = schema._zod.def;
5513
+ json.type = "object";
5514
+ const keyType = def.keyType;
5515
+ const patterns = aggregateChecks(keyType).patterns;
5516
+ if (def.mode === "loose" && patterns && patterns.size > 0) {
5517
+ const valueSchema = processSchema(def.valueType, ctx, {
5518
+ ...params,
5519
+ path: [...params.path, "patternProperties", "*"]
5520
+ });
5521
+ json.patternProperties = {};
5522
+ for (const pattern of patterns) {
5523
+ assignProp(json.patternProperties, exactPattern(pattern).source, valueSchema);
5524
+ }
5525
+ } else {
5526
+ if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
5527
+ json.propertyNames = processSchema(def.keyType, ctx, {
5528
+ ...params,
5529
+ path: [...params.path, "propertyNames"]
5530
+ });
5531
+ let pending = pendingRecords.get(ctx);
5532
+ if (!pending) {
5533
+ pending = [];
5534
+ pendingRecords.set(ctx, pending);
5535
+ ctx.deferred.push(() => rewriteKeyNames(ctx));
5536
+ }
5537
+ pending.push(schema);
5538
+ }
5539
+ json.additionalProperties = processSchema(def.valueType, ctx, {
5540
+ ...params,
5541
+ path: [...params.path, "additionalProperties"]
5542
+ });
5543
+ }
5544
+ const keyValues = keyType._zod.values;
5545
+ const omittableOnInput = ctx.io === "input" && inputOptin(def.valueType) !== undefined;
5546
+ if (keyValues && !def.partial && !omittableOnInput) {
5547
+ const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
5548
+ if (validKeyValues.length > 0) {
5549
+ json.required = validKeyValues.map(String);
5550
+ }
5551
+ }
5552
+ };
4233
5553
  var nullableProcessor = (schema, ctx, json, params) => {
4234
5554
  const def = schema._zod.def;
4235
5555
  const inner = processSchema(def.innerType, ctx, params);
@@ -4792,6 +6112,90 @@ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
4792
6112
  $ZodJWT.init(inst, def);
4793
6113
  ZodStringFormat.init(inst, def);
4794
6114
  });
6115
+ var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
6116
+ $ZodNumber.init(inst, def);
6117
+ ZodType.init(inst, def);
6118
+ inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
6119
+ inst.isFinite = true;
6120
+ }, /* @__PURE__ */ derived({
6121
+ minValue: (inst) => {
6122
+ const { minimum, exclusiveMinimum } = aggregateChecks(inst);
6123
+ return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
6124
+ },
6125
+ maxValue: (inst) => {
6126
+ const { maximum, exclusiveMaximum } = aggregateChecks(inst);
6127
+ return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
6128
+ },
6129
+ isInt: (inst) => {
6130
+ const { isInt, multipleOf } = aggregateChecks(inst);
6131
+ return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
6132
+ },
6133
+ format: (inst) => aggregateChecks(inst).format ?? null
6134
+ }, {
6135
+ gt(value, params) {
6136
+ return this.check(_gt(value, params));
6137
+ },
6138
+ gte(value, params) {
6139
+ return this.check(_gte(value, params));
6140
+ },
6141
+ min(value, params) {
6142
+ return this.check(_gte(value, params));
6143
+ },
6144
+ lt(value, params) {
6145
+ return this.check(_lt(value, params));
6146
+ },
6147
+ lte(value, params) {
6148
+ return this.check(_lte(value, params));
6149
+ },
6150
+ max(value, params) {
6151
+ return this.check(_lte(value, params));
6152
+ },
6153
+ int(params) {
6154
+ return this.check(int(params));
6155
+ },
6156
+ safe(params) {
6157
+ return this.check(int(params));
6158
+ },
6159
+ positive(params) {
6160
+ return this.check(_gt(0, params));
6161
+ },
6162
+ nonnegative(params) {
6163
+ return this.check(_gte(0, params));
6164
+ },
6165
+ negative(params) {
6166
+ return this.check(_lt(0, params));
6167
+ },
6168
+ nonpositive(params) {
6169
+ return this.check(_lte(0, params));
6170
+ },
6171
+ multipleOf(value, params) {
6172
+ return this.check(_multipleOf(value, params));
6173
+ },
6174
+ step(value, params) {
6175
+ return this.check(_multipleOf(value, params));
6176
+ },
6177
+ finite() {
6178
+ return this;
6179
+ }
6180
+ }));
6181
+ function number2(params) {
6182
+ return _number(ZodNumber, params);
6183
+ }
6184
+ var ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
6185
+ $ZodNumberFormat.init(inst, def);
6186
+ ZodNumber.init(inst, def);
6187
+ });
6188
+ function int(params) {
6189
+ return _int(ZodNumberFormat, params);
6190
+ }
6191
+ var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
6192
+ $ZodBoolean.init(inst, def);
6193
+ ZodType.init(inst, def);
6194
+ inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
6195
+ });
6196
+ function boolean2(params) {
6197
+ return _boolean(ZodBoolean, params);
6198
+ }
4795
6199
  var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
4796
6200
  $ZodUnknown.init(inst, def);
4797
6201
  ZodType.init(inst, def);
@@ -4905,6 +6309,18 @@ function union(options, params) {
4905
6309
  ...normalizeParams(params)
4906
6310
  });
4907
6311
  }
6312
+ var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
6313
+ ZodUnion.init(inst, def);
6314
+ $ZodDiscriminatedUnion.init(inst, def);
6315
+ });
6316
+ function discriminatedUnion(discriminator, options, params) {
6317
+ return new ZodDiscriminatedUnion({
6318
+ type: "union",
6319
+ options,
6320
+ discriminator,
6321
+ ...normalizeParams(params)
6322
+ });
6323
+ }
4908
6324
  var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
4909
6325
  $ZodIntersection.init(inst, def);
4910
6326
  ZodType.init(inst, def);
@@ -4917,6 +6333,30 @@ function intersection(left, right) {
4917
6333
  right
4918
6334
  });
4919
6335
  }
6336
+ var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
6337
+ _ensureDefaultMemoizer();
6338
+ $ZodRecord.init(inst, def);
6339
+ ZodType.init(inst, def);
6340
+ inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
6341
+ inst.keyType = def.keyType;
6342
+ inst.valueType = def.valueType;
6343
+ });
6344
+ function record(keyType, valueType, params) {
6345
+ if (!valueType || !valueType._zod) {
6346
+ return new ZodRecord({
6347
+ type: "record",
6348
+ keyType: string2(),
6349
+ valueType: keyType,
6350
+ ...normalizeParams(valueType)
6351
+ });
6352
+ }
6353
+ return new ZodRecord({
6354
+ type: "record",
6355
+ keyType,
6356
+ valueType,
6357
+ ...normalizeParams(params)
6358
+ });
6359
+ }
4920
6360
  var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
4921
6361
  $ZodEnum.init(inst, def);
4922
6362
  ZodType.init(inst, def);
@@ -5155,6 +6595,230 @@ function refine(fn, _params = {}) {
5155
6595
  function superRefine(fn, params) {
5156
6596
  return _superRefine(fn, params);
5157
6597
  }
6598
+ // ../ahp/src/source.ts
6599
+ var SOURCE_ERROR_CODES = [
6600
+ "SOURCE_UNBOUND",
6601
+ "SOURCE_UNAVAILABLE",
6602
+ "SERVICE_IDENTITY_UNAVAILABLE",
6603
+ "SERVICE_IDENTITY_NOT_GRANTED",
6604
+ "AGENT_NOT_MAPPED",
6605
+ "NOT_MAPPED",
6606
+ "INVALID_ADDRESS",
6607
+ "HOST_OFFLINE",
6608
+ "SOURCE_GAP",
6609
+ "FRAME_TOO_LARGE",
6610
+ "ITEM_TOO_LARGE",
6611
+ "STALE_EXPECTATION",
6612
+ "SOURCE_READER_RESTARTING"
6613
+ ];
6614
+ var SOURCE_FRAME_MAX_BYTES = 512 * 1024;
6615
+ var SOURCE_PAGE_BUDGET_BYTES = 256 * 1024;
6616
+ var SOURCE_LIST_LIMIT_MAX = 1000;
6617
+ var Id = string2().min(1).max(256);
6618
+ var Address = string2().min(1).max(1024);
6619
+ var Ordinal = string2().regex(/^(0|[1-9][0-9]{0,17})$/u);
6620
+ var SourcePositionSchema = object({ epoch: Id, ordinal: Ordinal }).strict();
6621
+ var Binding = { workspaceId: Id, sourceId: Id, hostId: Id };
6622
+ var SourceRowSchema = object({
6623
+ address: Address,
6624
+ version: Id,
6625
+ scope: Id,
6626
+ columns: object({
6627
+ title: string2().max(4096),
6628
+ state: Id,
6629
+ owner: Id.nullable(),
6630
+ parent: Address.nullable(),
6631
+ project: Address.nullable(),
6632
+ labels: array(Id).max(256),
6633
+ url: string2().max(2048).nullable(),
6634
+ updatedAt: string2().max(64).nullable()
6635
+ }).strict(),
6636
+ extra: unknown()
6637
+ }).strict();
6638
+ var SourceObservationSchema = object({
6639
+ position: SourcePositionSchema,
6640
+ change: discriminatedUnion("op", [
6641
+ object({ op: literal("upsert"), row: SourceRowSchema }).strict(),
6642
+ object({ op: literal("delete"), address: Address }).strict()
6643
+ ])
6644
+ }).strict();
6645
+ var ReadArgs = object({ address: Address }).strict();
6646
+ var ListArgs = object({ page: string2().min(1).max(4096).optional(), limit: number2().int().min(1).max(SOURCE_LIST_LIMIT_MAX) }).strict();
6647
+ var AssignArgs = object({ address: Address, ownerMemberId: Id, expectedOwner: Id.nullable(), intentId: Id }).strict();
6648
+ var WatchArgs = object({ on: boolean2() }).strict();
6649
+ var Caller = object({ memberId: Id }).strict();
6650
+ var request = (op, args) => object({ ...Binding, caller: Caller, op: literal(op), args }).strict();
6651
+ var SourceRequestSchema = discriminatedUnion("op", [
6652
+ request("read", ReadArgs),
6653
+ request("list", ListArgs),
6654
+ request("assign", AssignArgs),
6655
+ request("watch", WatchArgs)
6656
+ ]);
6657
+ var SourceListPageSchema = object({
6658
+ generation: Id,
6659
+ snapshot: Id,
6660
+ base: SourcePositionSchema,
6661
+ rows: array(SourceRowSchema),
6662
+ next: string2().min(1).max(4096).nullable(),
6663
+ complete: boolean2(),
6664
+ progressAsOf: string2().min(1).max(64).optional(),
6665
+ progressStale: object({ since: string2().min(1).max(64), reason: string2().min(1).max(4096) }).strict().optional()
6666
+ }).strict().refine((page) => page.rows.length > 0 || page.complete && page.next === null, { message: "a page carries at least one item" }).refine((page) => page.complete === (page.next === null), { message: "a page is complete exactly when it has no next token" });
6667
+ var AssignReply = object({ intentId: Id, result: unknown(), observation: SourceObservationSchema }).strict();
6668
+ var BODIES = {
6669
+ read: object({ observation: SourceObservationSchema }).strict(),
6670
+ list: SourceListPageSchema,
6671
+ assign: AssignReply,
6672
+ watch: object({ on: boolean2() }).strict()
6673
+ };
6674
+ var ErrorCode = _enum(SOURCE_ERROR_CODES);
6675
+ var NOT_SOURCE_CODES = ["OPERATION_NOT_ALLOWLISTED", "OPERATION_SHAPE_INVALID"];
6676
+ var response = (op) => union([
6677
+ object({ ...Binding, op: literal(op), outcome: _enum(["applied", "noop"]), body: BODIES[op] }).strict(),
6678
+ object({ ...Binding, op: literal(op), outcome: _enum(["applied", "noop"]), code: literal("SOURCE_READER_RESTARTING"), body: BODIES[op] }).strict(),
6679
+ object({ ...Binding, op: literal(op), outcome: literal("rejected"), code: ErrorCode, body: BODIES[op] }).strict(),
6680
+ object({ ...Binding, op: literal(op), outcome: _enum(["unknown", "refused"]), code: union([ErrorCode.exclude(["ITEM_TOO_LARGE"]), _enum(NOT_SOURCE_CODES)]) }).strict(),
6681
+ object({ ...Binding, op: literal(op), outcome: literal("refused"), code: literal("ITEM_TOO_LARGE"), item: Address }).strict()
6682
+ ]);
6683
+ var SourceResponseSchema = union([response("read"), response("list"), response("assign"), response("watch")]);
6684
+ var SourcePushSchema = object({ ...Binding, position: SourcePositionSchema, observations: array(SourceObservationSchema).min(1) }).strict().refine((push) => {
6685
+ const { observations, position } = push;
6686
+ const last = observations[observations.length - 1];
6687
+ if (last === undefined || last.position.epoch !== position.epoch || last.position.ordinal !== position.ordinal)
6688
+ return false;
6689
+ return observations.every((one, index) => one.position.epoch === position.epoch && (index === 0 || BigInt(one.position.ordinal) === BigInt(observations[index - 1].position.ordinal) + 1n));
6690
+ }, { message: "a push is one epoch of consecutive ordinals, numbered by its last" });
6691
+ var SourceAckSchema = object({ applied: SourcePositionSchema.nullable(), seq: number2().int().min(0), relist: boolean2() }).strict();
6692
+ // ../ahp/src/agent-records.ts
6693
+ var AgentRecordRowSchema = object({
6694
+ id: string2().min(1),
6695
+ revision: number2().int().min(0),
6696
+ state: string2(),
6697
+ operations: array(string2())
6698
+ }).passthrough();
6699
+ var ifRevision = number2().int().min(0);
6700
+ var AgentPutRequestSchema = object({
6701
+ id: string2().min(1),
6702
+ engine: string2().min(1),
6703
+ owner: string2().min(1),
6704
+ name: string2().min(1),
6705
+ description: string2().optional(),
6706
+ tags: array(string2()).optional(),
6707
+ model: unknown().optional(),
6708
+ config: record(string2(), unknown()),
6709
+ ifRevision
6710
+ }).passthrough();
6711
+ var AgentRemoveRequestSchema = object({ id: string2().min(1), ifRevision }).strict();
6712
+ var AgentModeRequestSchema = object({ id: string2().min(1), ifRevision }).strict();
6713
+ var JSON_RPC_INVALID_PARAMS = -32602;
6714
+ var StaleRefusalSchema = object({
6715
+ code: literal(JSON_RPC_INVALID_PARAMS),
6716
+ message: string2(),
6717
+ data: object({ staleRevision: number2().int().min(1), row: AgentRecordRowSchema })
6718
+ });
6719
+ var MissingRefusalSchema = object({
6720
+ code: literal(JSON_RPC_INVALID_PARAMS),
6721
+ message: string2(),
6722
+ data: object({ staleRevision: literal(0) })
6723
+ });
6724
+ // ../ahp/src/host-requests.ts
6725
+ var HOST_SCOPED_METHODS = ["subscribe", "x-ahpd/invokeOperation", "resourceRead"];
6726
+ var HOST_REQUEST_METHODS = [
6727
+ "x-ahpd/agents/list",
6728
+ "x-ahpd/agents/put",
6729
+ "x-ahpd/agents/remove",
6730
+ "x-ahpd/agents/enable",
6731
+ "x-ahpd/agents/pause",
6732
+ "x-ahpd/agents/disable",
6733
+ ...HOST_SCOPED_METHODS
6734
+ ];
6735
+ var HOST_REQUEST_TIMEOUT_MS = 1e4;
6736
+ var HOST_LOCAL_TIMEOUT_MS = HOST_REQUEST_TIMEOUT_MS - 1000;
6737
+ var HostRequestMetaSchema = object({
6738
+ workspaceId: string2().min(1),
6739
+ hostId: string2().min(1),
6740
+ agentMemberId: string2().min(1).optional(),
6741
+ caller: string2().min(1).max(256).optional()
6742
+ }).strict();
6743
+ var HOST_ANSWER_REASONS = ["unmapped", "timedOut", "outside"];
6744
+ var HostAnswerReasonSchema = object({ reason: _enum(HOST_ANSWER_REASONS) }).strict();
6745
+ // ../ahp/src/index.ts
6746
+ var HOST_TO_CLOUD_EVENTS = [
6747
+ "session/ready",
6748
+ "chat/turnStarted",
6749
+ "chat/turnComplete",
6750
+ "x-hh/turnFailed"
6751
+ ];
6752
+ var BOUNDED_ERROR_CODES = [
6753
+ "OPERATION_NOT_ALLOWLISTED",
6754
+ "OPERATION_SHAPE_INVALID",
6755
+ "INVALID_OPERATION_SHAPE",
6756
+ "WORKSPACE_OR_MEMBER_UNKNOWN",
6757
+ "UNKNOWN_HOUSE_OR_MEMBER",
6758
+ "AGENT_NOT_MAPPED",
6759
+ "UNMAPPED_LOCAL_AGENT",
6760
+ "FOREIGN_SESSION",
6761
+ "FOREIGN_SESSION_REFUSED",
6762
+ "TOKEN_EXPIRED_OR_REVOKED",
6763
+ "HOST_REVOKED",
6764
+ "HOST_RESTARTED",
6765
+ "INPUT_REQUIRED",
6766
+ "APPROVAL_REQUIRED",
6767
+ "VERSION_UNSUPPORTED",
6768
+ "WAKE_NOT_SENT",
6769
+ "TURN_TIMED_OUT",
6770
+ "WAKE_TEXT_NOT_ALLOWED",
6771
+ "ROOM_ASKS_UNTRUSTED",
6772
+ "ASK_UNSIGNED",
6773
+ "KEY_NOT_FOR_AUTHOR",
6774
+ "ASK_STALE",
6775
+ "ASK_REPLAYED",
6776
+ "REPLAYED_ASK",
6777
+ "SERVICE_NOT_ALLOWED",
6778
+ ...SOURCE_ERROR_CODES
6779
+ ];
6780
+ var WakeMetaSchema = object({
6781
+ workspaceId: string2().min(1),
6782
+ deliveryId: string2().min(1),
6783
+ turnId: string2().min(1).optional(),
6784
+ agentMemberId: string2().min(1),
6785
+ threadRef: string2().min(1),
6786
+ afterMessageId: string2().min(1).optional(),
6787
+ triggeringMessageIds: array(string2().min(1)).min(1).refine((ids) => new Set(ids).size === ids.length).optional(),
6788
+ agentToken: string2().min(1).optional()
6789
+ }).strict();
6790
+ var HostToCloudFrameSchema = object({
6791
+ event: _enum(HOST_TO_CLOUD_EVENTS),
6792
+ channel: string2().min(1),
6793
+ workspaceId: string2().min(1),
6794
+ deliveryId: string2().min(1),
6795
+ session: string2().min(1),
6796
+ chat: string2().min(1),
6797
+ turnId: string2().min(1).optional(),
6798
+ clientSeq: number2().int().min(1).optional(),
6799
+ turnState: _enum(["created", "running", "finished", "error"]),
6800
+ statusCode: string2().min(1).max(64),
6801
+ errorCode: _enum(BOUNDED_ERROR_CODES).optional(),
6802
+ errorDetail: string2().max(256).optional()
6803
+ }).strict();
6804
+ var HOST_HEADER = "Hightea-Host";
6805
+ var LEGACY_HOST_HEADER = "x-hightea-host";
6806
+
6807
+ // ../ahp-host/src/claim.ts
6808
+ import { createHash, randomBytes } from "node:crypto";
6809
+ import { constants } from "node:fs";
6810
+ import { link, lstat, mkdir, mkdtemp, open as open2, realpath, rm } from "node:fs/promises";
6811
+ import { dirname, join } from "node:path";
6812
+ import { isDeepStrictEqual } from "node:util";
6813
+ import { fileVault } from "@ahpd/server/dist/vault.js";
6814
+ // ../members/src/waitlist.ts
6815
+ var migrations = new WeakMap;
6816
+ // ../members/src/invitations.ts
6817
+ var INVITATION_TTL_MS = 30 * 86400000;
6818
+ var migrations2 = new WeakMap;
6819
+ // ../members/src/members-store.ts
6820
+ var DEFAULT_SESSION_TTL_MS = 30 * 86400000;
6821
+ var AGENT_BINDING_REQUEST_TTL_MS = 15 * 60000;
5158
6822
  // ../members/src/host-join-types.ts
5159
6823
  var JOIN_ROUTE_REFUSAL_STATUS = {
5160
6824
  JOIN_LINK_INVALID: 410,
@@ -5957,10 +7621,10 @@ async function hostJoin2(input, plugin) {
5957
7621
  grants: ["session:write", "session:state", "chat:turns", "agent:list"],
5958
7622
  options: {
5959
7623
  cloudUrl: cloud.href,
5960
- houseId: receipt.workspaceId,
7624
+ workspaceId: receipt.workspaceId,
5961
7625
  agents: ownerConfiguration.agents,
5962
7626
  mcpUrl: new URL(`/w/${encodeURIComponent(receipt.workspaceId)}`, claim.intent.origin).href,
5963
- headers: { "x-hightea-host": receipt.hostId, authorization: { $secret: "host:hightea" } }
7627
+ headers: { [HOST_HEADER]: receipt.hostId, authorization: { $secret: "host:hightea" } }
5964
7628
  }
5965
7629
  }]
5966
7630
  });
@@ -5977,7 +7641,7 @@ async function hostJoin2(input, plugin) {
5977
7641
  }
5978
7642
  }
5979
7643
  function isHighteaPipeEntry(entry) {
5980
- return isRecord3(entry) && isRecord3(entry.options) && typeof entry.options.houseId === "string" && isRecord3(entry.options.headers) && typeof entry.options.headers["x-hightea-host"] === "string";
7644
+ return isRecord3(entry) && isRecord3(entry.options) && typeof (entry.options.workspaceId ?? entry.options.houseId) === "string" && isRecord3(entry.options.headers) && typeof (entry.options.headers[HOST_HEADER] ?? entry.options.headers[LEGACY_HOST_HEADER]) === "string";
5981
7645
  }
5982
7646
  async function readStatusEntry(claim) {
5983
7647
  const config = join7(claim, "ahpd", "config.json");
@@ -6010,12 +7674,19 @@ async function readStatusEntry(claim) {
6010
7674
  pluginBundle,
6011
7675
  bundle,
6012
7676
  ...installed.ok ? { pluginVersion: installed.bundle.version } : {},
6013
- workspaceId: String(ours.options.houseId),
6014
- hostId: String(ours.options.headers["x-hightea-host"]),
7677
+ workspaceId: String(ours.options.workspaceId ?? ours.options.houseId),
7678
+ hostId: String(ours.options.headers[HOST_HEADER] ?? ours.options.headers[LEGACY_HOST_HEADER]),
6015
7679
  ...typeof ours.options.cloudUrl === "string" ? { gateway: ours.options.cloudUrl } : {},
6016
- signingKey: await statusSigningKey(dirname3(config))
7680
+ signingKey: await statusSigningKey(dirname3(config)),
7681
+ ...await statusHeldBundle(dirname3(config))
6017
7682
  };
6018
7683
  }
7684
+ async function statusHeldBundle(configDir) {
7685
+ const held = await readPipeUpdate(configDir);
7686
+ if (held === undefined || held instanceof Error)
7687
+ return {};
7688
+ return { heldBundle: { from: held.from, toVersion: held.toVersion, connected: await readPipeConnected(configDir) === held.toVersion } };
7689
+ }
6019
7690
  async function statusSigningKey(configDir) {
6020
7691
  const read = await readHostSigningKey(configDir);
6021
7692
  if (read.state === "ok")
@@ -6068,7 +7739,8 @@ async function hostStatus2(options) {
6068
7739
  ` config ${entry.config}`,
6069
7740
  ` start ${entry.start}`,
6070
7741
  ` plugin ${entry.pluginBundle} (${entry.bundle}${versionNote(entry.pluginVersion, options.version)})`,
6071
- ` key ${signingKeyLine(entry.signingKey)}`
7742
+ ` key ${signingKeyLine(entry.signingKey)}`,
7743
+ ...entry.heldBundle === undefined ? [] : [` held ${entry.heldBundle.from} until this host connects at ${entry.heldBundle.toVersion}${entry.heldBundle.connected ? " (it has; the next `hightea host update` removes it)" : ""}`]
6072
7744
  ].join(`
6073
7745
  `));
6074
7746
  }
@@ -6091,7 +7763,17 @@ async function hostStatus2(options) {
6091
7763
  }
6092
7764
  return 0;
6093
7765
  }
6094
- var SERVICES_GRANTS = ["services:list", "services:get", "services:put", "services:delete", "services:control"];
7766
+ var SERVICES_GRANTS = [
7767
+ "service:watch",
7768
+ "service:logs",
7769
+ "service:put",
7770
+ "service:remove",
7771
+ "service:start",
7772
+ "service:stop",
7773
+ "service:restart",
7774
+ "service:accept"
7775
+ ];
7776
+ var RETIRED_SERVICES_GRANTS = ["services:list", "services:get", "services:put", "services:delete", "services:control"];
6095
7777
  async function localHost2(host) {
6096
7778
  let claims;
6097
7779
  try {
@@ -6153,8 +7835,10 @@ async function hostServicesGrants2(options) {
6153
7835
  return 1;
6154
7836
  }
6155
7837
  const held = ours.grants ?? [];
6156
- const services = SERVICES_GRANTS;
6157
- const grants = options.enable ? [...held, ...SERVICES_GRANTS.filter((grant) => !held.includes(grant))] : held.filter((grant) => !services.includes(grant));
7838
+ const services = [...SERVICES_GRANTS, ...RETIRED_SERVICES_GRANTS];
7839
+ const retired = RETIRED_SERVICES_GRANTS;
7840
+ const kept = held.filter((grant) => !retired.includes(grant));
7841
+ const grants = options.enable ? [...kept, ...SERVICES_GRANTS.filter((grant) => !kept.includes(grant))] : held.filter((grant) => !services.includes(grant));
6158
7842
  const what = `Hightea managing this machine's services (host ${found.hostId})`;
6159
7843
  if (grants.length === held.length && grants.every((grant, index) => grant === held[index])) {
6160
7844
  console.log(`${what} is already ${options.enable ? "enabled" : "disabled"}; ${found.config} was left unchanged.`);
@@ -6172,5 +7856,188 @@ async function hostServicesGrants2(options) {
6172
7856
  console.log(`It takes effect when this host's ahpd next loads its configuration; restart it with: ${hostStartCommand(found.claim)}`);
6173
7857
  return 0;
6174
7858
  }
7859
+ function versionParts(version) {
7860
+ const match = /^(\d+)\.(\d+)\.(\d+)$/u.exec(version);
7861
+ return match === null ? undefined : [Number(match[1]), Number(match[2]), Number(match[3])];
7862
+ }
7863
+ function compareVersions(a, b) {
7864
+ for (let index = 0;index < 3; index++)
7865
+ if (a[index] !== b[index])
7866
+ return a[index] - b[index];
7867
+ return 0;
7868
+ }
7869
+ var PIPE_UPDATE_FILE = "pipe-update.json";
7870
+ var PIPE_CONNECTED_FILE = "pipe-connected.json";
7871
+ async function readPipeUpdate(configDir) {
7872
+ let text;
7873
+ try {
7874
+ text = await readFile3(join7(configDir, PIPE_UPDATE_FILE), "utf8");
7875
+ } catch (error) {
7876
+ return isRecord3(error) && error.code === "ENOENT" ? undefined : new Error(`cannot read ${join7(configDir, PIPE_UPDATE_FILE)}`);
7877
+ }
7878
+ let value;
7879
+ try {
7880
+ value = JSON.parse(text);
7881
+ } catch {
7882
+ return new Error(`${join7(configDir, PIPE_UPDATE_FILE)} is not JSON`);
7883
+ }
7884
+ if (!isRecord3(value) || typeof value.from !== "string" || typeof value.to !== "string" || typeof value.fromVersion !== "string" || typeof value.toVersion !== "string" || typeof value.at !== "string")
7885
+ return new Error(`${join7(configDir, PIPE_UPDATE_FILE)} is not an update record`);
7886
+ return { from: value.from, to: value.to, fromVersion: value.fromVersion, toVersion: value.toVersion, at: value.at };
7887
+ }
7888
+ async function readPipeConnected(configDir) {
7889
+ try {
7890
+ const value = JSON.parse(await readFile3(join7(configDir, PIPE_CONNECTED_FILE), "utf8"));
7891
+ return isRecord3(value) && typeof value.version === "string" ? value.version : undefined;
7892
+ } catch {
7893
+ return;
7894
+ }
7895
+ }
7896
+ async function machineEntries() {
7897
+ let claims;
7898
+ try {
7899
+ claims = join7(xdgHome("XDG_CONFIG_HOME", ".config"), "hightea", "claims");
7900
+ } catch {
7901
+ return { error: `HOST_UPDATE_UNSAFE_PATH: ${DIAGNOSTICS.HOST_JOIN_UNSAFE_PATH}` };
7902
+ }
7903
+ let names;
7904
+ try {
7905
+ names = (await readdir(claims)).filter((name) => !name.startsWith(".")).sort();
7906
+ } catch {
7907
+ return { error: `HOST_UPDATE_HOST_UNREADABLE: cannot list ${claims}` };
7908
+ }
7909
+ return { claims, entries: await Promise.all(names.map((name) => readStatusEntry(join7(claims, name)))) };
7910
+ }
7911
+ async function prunableBundleDirectory(held, entries) {
7912
+ let directory;
7913
+ let root;
7914
+ try {
7915
+ directory = await realpath2(dirname3(held.from));
7916
+ } catch {
7917
+ return { refused: "it cannot be resolved" };
7918
+ }
7919
+ try {
7920
+ root = await realpath2(pluginBundleRoot(xdgHome("XDG_DATA_HOME", join7(".local", "share"))));
7921
+ } catch {
7922
+ return { refused: "the plugin bundles root cannot be resolved" };
7923
+ }
7924
+ if (dirname3(directory) !== root)
7925
+ return { refused: `it is not directly under the plugin bundles root ${root}` };
7926
+ if (basename(directory) !== held.fromVersion)
7927
+ return { refused: `it is not the bundle directory of version ${held.fromVersion}` };
7928
+ for (const entry of entries) {
7929
+ if (entry.pluginBundle === undefined)
7930
+ continue;
7931
+ let named;
7932
+ try {
7933
+ named = await realpath2(dirname3(entry.pluginBundle));
7934
+ } catch {
7935
+ continue;
7936
+ }
7937
+ if (named === directory)
7938
+ return { refused: `${entry.config} names it now` };
7939
+ }
7940
+ return { directory };
7941
+ }
7942
+ async function pruneHeldBundle(found) {
7943
+ const held = await readPipeUpdate(found.configDir);
7944
+ if (held === undefined)
7945
+ return;
7946
+ if (held instanceof Error) {
7947
+ console.error(`HOST_UPDATE_RECORD_UNREADABLE: ${held.message}; no bundle was removed`);
7948
+ return;
7949
+ }
7950
+ const connected = await readPipeConnected(found.configDir);
7951
+ if (connected !== held.toVersion) {
7952
+ console.log(`Keeping the previous plugin bundle ${dirname3(held.from)} until this host connects at ${held.toVersion}; restart it with: ${hostStartCommand(found.claim)}`);
7953
+ return;
7954
+ }
7955
+ const machine = await machineEntries();
7956
+ if ("error" in machine) {
7957
+ console.error(`${machine.error}; the previous bundle ${dirname3(held.from)} was kept`);
7958
+ return;
7959
+ }
7960
+ const users = machine.entries.filter((entry) => entry.pluginBundle === held.from || entry.state === "unreadable");
7961
+ if (users.length > 0) {
7962
+ console.log(`Keeping the previous plugin bundle ${dirname3(held.from)}: ${users.map((entry) => entry.state === "unreadable" ? `${entry.config} (unreadable)` : entry.config).join(", ")} may still name it.`);
7963
+ return;
7964
+ }
7965
+ const target = await prunableBundleDirectory(held, machine.entries);
7966
+ if ("refused" in target) {
7967
+ console.error(`HOST_UPDATE_PRUNE_REFUSED: ${dirname3(held.from)}: ${target.refused}; nothing was removed`);
7968
+ return;
7969
+ }
7970
+ try {
7971
+ await rm4(target.directory, { recursive: true, force: true });
7972
+ await rm4(join7(found.configDir, PIPE_UPDATE_FILE), { force: true });
7973
+ } catch (error) {
7974
+ console.error(`HOST_UPDATE_PRUNE_FAILED: ${dirname3(held.from)}: ${error.message}`);
7975
+ return;
7976
+ }
7977
+ console.log(`Removed the previous plugin bundle ${dirname3(held.from)} (${held.fromVersion}); this host has connected at ${held.toVersion}.`);
7978
+ }
7979
+ async function hostUpdate2(options, plugin) {
7980
+ const found = await localHost2(options.host);
7981
+ if ("error" in found) {
7982
+ console.error(found.error.replace(/^SERVICE_/u, "HOST_UPDATE_"));
7983
+ return 1;
7984
+ }
7985
+ const read = readJsonObject3(found.config);
7986
+ if (!read.ok) {
7987
+ console.error(`HOST_UPDATE_CONFIG_UNREADABLE: ${found.config} could not be read as a JSON object; it was left unchanged`);
7988
+ return 1;
7989
+ }
7990
+ const plugins = Array.isArray(read.value.plugins) ? read.value.plugins : [];
7991
+ const at = plugins.findIndex(isHighteaPipeEntry);
7992
+ const ours = plugins[at];
7993
+ if (ours === undefined || typeof ours.source !== "string") {
7994
+ console.error(`HOST_UPDATE_CONFIG_UNREADABLE: ${found.config} holds no Hightea plugin entry with a source; it was left unchanged`);
7995
+ return 1;
7996
+ }
7997
+ const installed = await readInstalledBundle(ours.source);
7998
+ if (!installed.ok) {
7999
+ console.error(`HOST_UPDATE_BUNDLE_UNREADABLE: the installed plugin bundle ${ours.source} is ${installed.reason}; nothing changed. \`hightea host status\` names the repair.`);
8000
+ return 1;
8001
+ }
8002
+ const from = installed.bundle.version;
8003
+ const fromParts = versionParts(from);
8004
+ const toParts = versionParts(plugin.version);
8005
+ if (fromParts === undefined || toParts === undefined) {
8006
+ console.error(`HOST_UPDATE_VERSION_UNREADABLE: cannot order the installed bundle ${from} against this CLI's ${plugin.version} (each must be x.y.z); nothing changed`);
8007
+ return 1;
8008
+ }
8009
+ const order = compareVersions(toParts, fromParts);
8010
+ if (order < 0) {
8011
+ console.error(`HOST_UPDATE_DOWNGRADE: host ${found.hostId} runs plugin bundle ${from}, newer than this CLI's ${plugin.version}; nothing changed. Update the CLI instead.`);
8012
+ return 1;
8013
+ }
8014
+ if (order === 0) {
8015
+ console.log(`Host ${found.hostId} already runs plugin bundle ${from}; ${found.config} was left unchanged.`);
8016
+ await pruneHeldBundle(found);
8017
+ return 0;
8018
+ }
8019
+ await pruneHeldBundle(found);
8020
+ let bundle;
8021
+ try {
8022
+ bundle = await installPluginBundle(xdgHome("XDG_DATA_HOME", join7(".local", "share")), plugin.directory, plugin.version);
8023
+ } catch (error) {
8024
+ const code = error instanceof Error && /^HOST_JOIN_[A-Z_]+$/u.test(error.message) ? error.message : "HOST_JOIN_CONFIG_IO";
8025
+ console.error(`${code.replace(/^HOST_JOIN_/u, "HOST_UPDATE_")}: ${DIAGNOSTICS[code] ?? "the new bundle could not be installed"} ${found.config} was left unchanged.`);
8026
+ return 1;
8027
+ }
8028
+ const record = { from: ours.source, to: bundle.manifest, fromVersion: from, toVersion: bundle.version, at: new Date().toISOString() };
8029
+ const next = plugins.slice();
8030
+ next[at] = { ...ours, source: bundle.manifest };
8031
+ try {
8032
+ writeJsonAtomic2(join7(found.configDir, PIPE_UPDATE_FILE), record, { mode: 384 });
8033
+ writeJsonAtomic2(found.config, { ...read.value, plugins: next }, { mode: 384 });
8034
+ } catch (error) {
8035
+ console.error(`HOST_UPDATE_CONFIG_UNWRITABLE: ${found.config}: ${error.message}`);
8036
+ return 1;
8037
+ }
8038
+ console.log(`Host ${found.hostId} now loads plugin bundle ${bundle.version} (was ${from}), same host id and credentials; ${found.config} changed only its source.`);
8039
+ console.log(`The previous bundle ${dirname3(ours.source)} is kept until the host connects at ${bundle.version}. Restart it with: ${hostStartCommand(found.claim)}`);
8040
+ return 0;
8041
+ }
6175
8042
 
6176
- export { TRUSTED_KEY_NAME, trustedKeyId, readTrustedKeys, hostJoin2, hostStatus2, localHost2, hostServicesGrants2 };
8043
+ export { TRUSTED_KEY_NAME, trustedKeyId, readTrustedKeys, hostJoin2, hostStatus2, localHost2, hostServicesGrants2, hostUpdate2 };