@hallohuman/hightea 0.1.15 → 0.1.30
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.
- package/dist/bin.js +171 -64
- package/dist/chunk-0r70ekxd.js +8 -0
- package/dist/chunk-13tpn1g6.js +465 -0
- package/dist/chunk-3rgfnt23.js +16 -0
- package/dist/{chunk-rs0vvh3x.js → chunk-9e325ntw.js} +15 -4
- package/dist/{chunk-3ah56pdt.js → chunk-cx3yvvkz.js} +174 -207
- package/dist/{chunk-h5s3wwdz.js → chunk-dvnzt54t.js} +1126 -2001
- package/dist/chunk-dvt4hb8z.js +1491 -0
- package/dist/chunk-gk8tyqac.js +184 -0
- package/dist/chunk-h8pdqn31.js +157 -0
- package/dist/{chunk-1xykqbdm.js → chunk-ph04jess.js} +5 -2
- package/dist/chunk-w0ebwtch.js +161 -0
- package/dist/{chunk-6ae0ftqh.js → chunk-y5r2yxx1.js} +1 -1
- package/dist/plugin/plugin.json +8 -1
- package/dist/plugin/plugin.mjs +2268 -629
- package/package.json +8 -5
- package/dist/chunk-hxs6jv2m.js +0 -91
|
@@ -1,727 +1,30 @@
|
|
|
1
|
-
// ../ahp-host/src/
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
(
|
|
26
|
-
|
|
27
|
-
|
|
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;
|
|
711
|
-
// ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/util.js
|
|
712
|
-
function getEnumValues(entries) {
|
|
713
|
-
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
714
|
-
const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
715
|
-
return values;
|
|
716
|
-
}
|
|
717
|
-
function joinValues(array, separator = "|") {
|
|
718
|
-
return array.map((val) => stringifyPrimitive(val)).join(separator);
|
|
719
|
-
}
|
|
720
|
-
function jsonStringifyReplacer(_, value) {
|
|
721
|
-
if (typeof value === "bigint")
|
|
722
|
-
return value.toString();
|
|
723
|
-
return value;
|
|
724
|
-
}
|
|
1
|
+
// ../ahp-host/src/apps.ts
|
|
2
|
+
import { constants } from "node:fs";
|
|
3
|
+
import { access, stat } from "node:fs/promises";
|
|
4
|
+
import { delimiter, isAbsolute, join } from "node:path";
|
|
5
|
+
import { installLine, knownAgents } from "@ahpd/sdk";
|
|
6
|
+
// ../members/src/waitlist.ts
|
|
7
|
+
var migrations = new WeakMap;
|
|
8
|
+
// ../members/src/invitations.ts
|
|
9
|
+
var INVITATION_TTL_MS = 30 * 86400000;
|
|
10
|
+
var migrations2 = new WeakMap;
|
|
11
|
+
// ../members/src/members-store.ts
|
|
12
|
+
var DEFAULT_SESSION_TTL_MS = 30 * 86400000;
|
|
13
|
+
var AGENT_BINDING_REQUEST_TTL_MS = 15 * 60000;
|
|
14
|
+
// ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/util.js
|
|
15
|
+
function getEnumValues(entries) {
|
|
16
|
+
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
17
|
+
const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
18
|
+
return values;
|
|
19
|
+
}
|
|
20
|
+
function joinValues(array, separator = "|") {
|
|
21
|
+
return array.map((val) => stringifyPrimitive(val)).join(separator);
|
|
22
|
+
}
|
|
23
|
+
function jsonStringifyReplacer(_, value) {
|
|
24
|
+
if (typeof value === "bigint")
|
|
25
|
+
return value.toString();
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
725
28
|
|
|
726
29
|
class Cached {
|
|
727
30
|
constructor(getter) {
|
|
@@ -4135,10 +3438,10 @@ class $ZodRegistry {
|
|
|
4135
3438
|
return this._map.has(schema);
|
|
4136
3439
|
}
|
|
4137
3440
|
}
|
|
4138
|
-
function
|
|
3441
|
+
function registry() {
|
|
4139
3442
|
return new $ZodRegistry;
|
|
4140
3443
|
}
|
|
4141
|
-
(_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry =
|
|
3444
|
+
(_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
|
|
4142
3445
|
var globalRegistry = globalThis.__zod_globalRegistry;
|
|
4143
3446
|
// ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/api.js
|
|
4144
3447
|
function snapshotChecks(def) {
|
|
@@ -6595,6 +5898,860 @@ function refine(fn, _params = {}) {
|
|
|
6595
5898
|
function superRefine(fn, params) {
|
|
6596
5899
|
return _superRefine(fn, params);
|
|
6597
5900
|
}
|
|
5901
|
+
// ../members/src/host-join-types.ts
|
|
5902
|
+
var HOST_REGISTRATION_SETTLE_BOUND_MS = 60000;
|
|
5903
|
+
var JOIN_ROUTE_REFUSAL_STATUS = {
|
|
5904
|
+
JOIN_LINK_INVALID: 410,
|
|
5905
|
+
JOIN_LINK_NOT_FOUND: 404,
|
|
5906
|
+
ROLE_NOT_ALLOWED: 400,
|
|
5907
|
+
NOT_A_MEMBER: 403,
|
|
5908
|
+
PEOPLE_LIMIT: 409,
|
|
5909
|
+
AGENTS_LIMIT: 409,
|
|
5910
|
+
FORBIDDEN: 403,
|
|
5911
|
+
HOST_REGISTRATION_CANCELLED: 410,
|
|
5912
|
+
HOST_REGISTRATION_CONFLICT: 409,
|
|
5913
|
+
AGENT_HOST_CONFLICT: 409,
|
|
5914
|
+
HOST_REGISTRATION_MISSING: 409,
|
|
5915
|
+
HOST_REGISTRATION_UNSETTLED: 503,
|
|
5916
|
+
INVALID_REQUEST: 400,
|
|
5917
|
+
BAD_ORIGIN: 403,
|
|
5918
|
+
UNAUTHENTICATED: 401,
|
|
5919
|
+
WORKSPACE_NOT_FOUND: 404
|
|
5920
|
+
};
|
|
5921
|
+
var HOST_JOIN_REMEDY = {
|
|
5922
|
+
HOST_REGISTRATION_CONFLICT: "this code was redeemed by a different host registration; a computer that already has a host in this workspace joins with the claim it already holds, or the owner mints a new code",
|
|
5923
|
+
AGENT_HOST_CONFLICT: "an agent in this code already rides another active host; revoke that host, then mint a new code",
|
|
5924
|
+
HOST_REGISTRATION_CANCELLED: "the owner cancelled this registration; mint a new code",
|
|
5925
|
+
HOST_REGISTRATION_MISSING: "this workspace no longer holds the pending registration; mint a new code",
|
|
5926
|
+
HOST_REGISTRATION_UNSETTLED: `this workspace has not answered the registration within ${HOST_REGISTRATION_SETTLE_BOUND_MS / 1000} seconds; the code is unspent, so run the same command again in a minute, or mint a new code`
|
|
5927
|
+
};
|
|
5928
|
+
function isJoinRouteRefusalCode(value) {
|
|
5929
|
+
return typeof value === "string" && Object.hasOwn(JOIN_ROUTE_REFUSAL_STATUS, value);
|
|
5930
|
+
}
|
|
5931
|
+
var id = string2().min(1).max(256);
|
|
5932
|
+
var digest = string2().regex(/^sha256:[a-f0-9]{64}$/u);
|
|
5933
|
+
var version2 = string2().min(1).max(64);
|
|
5934
|
+
var NameSchema = string2().trim().min(1).max(64).regex(/^[^\u0000-\u001f\u007f]+$/u, "a name carries no control characters");
|
|
5935
|
+
var HostNameSchema = NameSchema;
|
|
5936
|
+
var hostName = HostNameSchema;
|
|
5937
|
+
var HOST_AGENT_APPS = [
|
|
5938
|
+
"codex",
|
|
5939
|
+
"gemini",
|
|
5940
|
+
"copilot",
|
|
5941
|
+
"opencode",
|
|
5942
|
+
"kilo",
|
|
5943
|
+
"goose",
|
|
5944
|
+
"pi",
|
|
5945
|
+
"dsh",
|
|
5946
|
+
"copapo",
|
|
5947
|
+
"devin",
|
|
5948
|
+
"cursor",
|
|
5949
|
+
"amp",
|
|
5950
|
+
"qwen",
|
|
5951
|
+
"cline",
|
|
5952
|
+
"omp"
|
|
5953
|
+
];
|
|
5954
|
+
var HOST_AGENT_APP_NAMES = {
|
|
5955
|
+
codex: "Codex",
|
|
5956
|
+
gemini: "Gemini",
|
|
5957
|
+
copilot: "Copilot",
|
|
5958
|
+
opencode: "OpenCode",
|
|
5959
|
+
kilo: "Kilo",
|
|
5960
|
+
goose: "Goose",
|
|
5961
|
+
pi: "Pi",
|
|
5962
|
+
dsh: "dsh",
|
|
5963
|
+
copapo: "copapo",
|
|
5964
|
+
devin: "Devin",
|
|
5965
|
+
cursor: "Cursor",
|
|
5966
|
+
amp: "Amp",
|
|
5967
|
+
qwen: "Qwen Code",
|
|
5968
|
+
cline: "Cline",
|
|
5969
|
+
omp: "omp"
|
|
5970
|
+
};
|
|
5971
|
+
var isHostAgentApp = (value) => typeof value === "string" && Object.hasOwn(HOST_AGENT_APP_NAMES, value);
|
|
5972
|
+
var hostApp = _enum(HOST_AGENT_APPS);
|
|
5973
|
+
var HostJoinRedemptionSchema = object({ code: string2(), credentialHash: digest, pluginVersion: version2, ahpdVersion: version2, name: hostName.optional(), app: hostApp.optional(), hostId: string2().min(1).max(128).optional() }).strict();
|
|
5974
|
+
var HostJoinCommandSchema = object({
|
|
5975
|
+
workspaceId: id,
|
|
5976
|
+
hostId: id,
|
|
5977
|
+
ownerAccountId: id,
|
|
5978
|
+
credentialHash: digest,
|
|
5979
|
+
agentMemberIds: array(id),
|
|
5980
|
+
pluginVersion: version2,
|
|
5981
|
+
ahpdVersion: version2,
|
|
5982
|
+
registrationFingerprint: digest,
|
|
5983
|
+
name: hostName.optional()
|
|
5984
|
+
}).strict();
|
|
5985
|
+
var HostJoinGatewayReceiptSchema = object({ workspaceId: id, hostId: id, registrationFingerprint: digest, state: _enum(["registered", "cancelled"]) }).strict();
|
|
5986
|
+
var HostJoinGatewayResultSchema = union([
|
|
5987
|
+
object({ ok: literal(true), value: HostJoinGatewayReceiptSchema }).strict(),
|
|
5988
|
+
object({ ok: literal(false), code: _enum(["HOST_REGISTRATION_CONFLICT", "AGENT_HOST_CONFLICT", "HOST_REGISTRATION_MISSING"]), message: string2() }).strict()
|
|
5989
|
+
]);
|
|
5990
|
+
var HostJoinEffectSchema = union([
|
|
5991
|
+
object({ kind: literal("register"), command: HostJoinCommandSchema }).strict(),
|
|
5992
|
+
object({ kind: literal("cancel"), cancellation: union([
|
|
5993
|
+
object({ kind: literal("pending"), command: HostJoinCommandSchema }).strict(),
|
|
5994
|
+
object({ kind: literal("registered"), receipt: HostJoinGatewayReceiptSchema }).strict()
|
|
5995
|
+
]) }).strict()
|
|
5996
|
+
]);
|
|
5997
|
+
|
|
5998
|
+
// ../members/src/join-links.ts
|
|
5999
|
+
var JOIN_LINK_TTL_MS = 15 * 60000;
|
|
6000
|
+
var PERSON_JOIN_LINK_TTL_MS = 7 * 24 * 60 * 60000;
|
|
6001
|
+
var CODE_ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
6002
|
+
var CODE_LENGTH = 12;
|
|
6003
|
+
var BROWSER_APPROVAL_TTL_MS = 10 * 60000;
|
|
6004
|
+
var BASE64URL_32_BYTES = /^[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$/u;
|
|
6005
|
+
var APPROVAL_CHECK = /^[0-9A-F]{4}$/u;
|
|
6006
|
+
var BROWSER_LABEL = /^(?=.{1,64}$)[A-Za-z0-9][A-Za-z0-9._-]*(?: [A-Za-z0-9._-]+)*$/u;
|
|
6007
|
+
var BrowserApprovalPayloadSchema = object({
|
|
6008
|
+
browser: string2().trim().regex(BROWSER_LABEL),
|
|
6009
|
+
publicKey: string2().regex(BASE64URL_32_BYTES),
|
|
6010
|
+
personName: string2().trim().min(1).max(120).nullable(),
|
|
6011
|
+
check: string2().regex(APPROVAL_CHECK)
|
|
6012
|
+
});
|
|
6013
|
+
function normalizeCode(input, length) {
|
|
6014
|
+
const code = input.toUpperCase().replace(/[\s-]/g, "").replace(/O/g, "0").replace(/[IL]/g, "1");
|
|
6015
|
+
if (code.length !== length)
|
|
6016
|
+
return null;
|
|
6017
|
+
for (const symbol of code)
|
|
6018
|
+
if (!CODE_ALPHABET.includes(symbol))
|
|
6019
|
+
return null;
|
|
6020
|
+
return code;
|
|
6021
|
+
}
|
|
6022
|
+
function normalizeJoinCode(input) {
|
|
6023
|
+
return normalizeCode(input, CODE_LENGTH);
|
|
6024
|
+
}
|
|
6025
|
+
|
|
6026
|
+
// ../members/src/workspace-directory.ts
|
|
6027
|
+
var RESERVED_WORKSPACE_SLUGS = new Set([
|
|
6028
|
+
"www",
|
|
6029
|
+
"app",
|
|
6030
|
+
"api",
|
|
6031
|
+
"mcp",
|
|
6032
|
+
"ahp",
|
|
6033
|
+
"pages",
|
|
6034
|
+
"share",
|
|
6035
|
+
"host",
|
|
6036
|
+
"docs",
|
|
6037
|
+
"admin",
|
|
6038
|
+
"status",
|
|
6039
|
+
"mail"
|
|
6040
|
+
]);
|
|
6041
|
+
|
|
6042
|
+
// ../members/src/auth-routes.ts
|
|
6043
|
+
var HIGHTEA_SESSION_COOKIE = "ht_session";
|
|
6044
|
+
var HIGHTEA_STATE_COOKIE = "ht_auth_state";
|
|
6045
|
+
var CLEAR_STATE_COOKIE = `${HIGHTEA_STATE_COOKIE}=; Path=/auth; HttpOnly; Secure; SameSite=Lax; Max-Age=0`;
|
|
6046
|
+
var CLEAR_SESSION_COOKIE = `${HIGHTEA_SESSION_COOKIE}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0`;
|
|
6047
|
+
// ../../node_modules/.bun/hono@4.13.19/node_modules/hono/dist/utils/jwt/utf8.js
|
|
6048
|
+
var utf8Encoder = new TextEncoder;
|
|
6049
|
+
var utf8Decoder = new TextDecoder;
|
|
6050
|
+
|
|
6051
|
+
// ../members/src/mcp-oauth.ts
|
|
6052
|
+
var AGENT_LAST_SEEN_INTERVAL_MS = 5 * 60000;
|
|
6053
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/common/state.js
|
|
6054
|
+
var ChannelRecoveryKind;
|
|
6055
|
+
(function(ChannelRecoveryKind) {
|
|
6056
|
+
ChannelRecoveryKind["Snapshot"] = "snapshot";
|
|
6057
|
+
ChannelRecoveryKind["Replay"] = "replay";
|
|
6058
|
+
ChannelRecoveryKind["Live"] = "live";
|
|
6059
|
+
})(ChannelRecoveryKind || (ChannelRecoveryKind = {}));
|
|
6060
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-root/state.js
|
|
6061
|
+
var PolicyState;
|
|
6062
|
+
(function(PolicyState) {
|
|
6063
|
+
PolicyState["Enabled"] = "enabled";
|
|
6064
|
+
PolicyState["Disabled"] = "disabled";
|
|
6065
|
+
PolicyState["Unconfigured"] = "unconfigured";
|
|
6066
|
+
})(PolicyState || (PolicyState = {}));
|
|
6067
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-session/state.js
|
|
6068
|
+
var SessionLifecycle;
|
|
6069
|
+
(function(SessionLifecycle) {
|
|
6070
|
+
SessionLifecycle["Creating"] = "creating";
|
|
6071
|
+
SessionLifecycle["Ready"] = "ready";
|
|
6072
|
+
SessionLifecycle["Failed"] = "failed";
|
|
6073
|
+
})(SessionLifecycle || (SessionLifecycle = {}));
|
|
6074
|
+
var SessionStatus;
|
|
6075
|
+
(function(SessionStatus) {
|
|
6076
|
+
SessionStatus[SessionStatus["Idle"] = 1] = "Idle";
|
|
6077
|
+
SessionStatus[SessionStatus["Error"] = 2] = "Error";
|
|
6078
|
+
SessionStatus[SessionStatus["InProgress"] = 8] = "InProgress";
|
|
6079
|
+
SessionStatus[SessionStatus["InputNeeded"] = 24] = "InputNeeded";
|
|
6080
|
+
SessionStatus[SessionStatus["IsRead"] = 32] = "IsRead";
|
|
6081
|
+
SessionStatus[SessionStatus["IsArchived"] = 64] = "IsArchived";
|
|
6082
|
+
})(SessionStatus || (SessionStatus = {}));
|
|
6083
|
+
var SessionOriginKind;
|
|
6084
|
+
(function(SessionOriginKind) {
|
|
6085
|
+
SessionOriginKind["Automation"] = "automation";
|
|
6086
|
+
})(SessionOriginKind || (SessionOriginKind = {}));
|
|
6087
|
+
var SessionInputRequestKind;
|
|
6088
|
+
(function(SessionInputRequestKind) {
|
|
6089
|
+
SessionInputRequestKind["ChatInput"] = "chatInput";
|
|
6090
|
+
SessionInputRequestKind["ToolConfirmation"] = "toolConfirmation";
|
|
6091
|
+
SessionInputRequestKind["ToolClientExecution"] = "toolClientExecution";
|
|
6092
|
+
SessionInputRequestKind["ToolAuthentication"] = "toolAuthentication";
|
|
6093
|
+
})(SessionInputRequestKind || (SessionInputRequestKind = {}));
|
|
6094
|
+
var CustomizationType;
|
|
6095
|
+
(function(CustomizationType) {
|
|
6096
|
+
CustomizationType["Plugin"] = "plugin";
|
|
6097
|
+
CustomizationType["Directory"] = "directory";
|
|
6098
|
+
CustomizationType["Agent"] = "agent";
|
|
6099
|
+
CustomizationType["Skill"] = "skill";
|
|
6100
|
+
CustomizationType["Prompt"] = "prompt";
|
|
6101
|
+
CustomizationType["Rule"] = "rule";
|
|
6102
|
+
CustomizationType["Hook"] = "hook";
|
|
6103
|
+
CustomizationType["McpServer"] = "mcpServer";
|
|
6104
|
+
})(CustomizationType || (CustomizationType = {}));
|
|
6105
|
+
var CustomizationEnablementKind;
|
|
6106
|
+
(function(CustomizationEnablementKind) {
|
|
6107
|
+
CustomizationEnablementKind["Global"] = "global";
|
|
6108
|
+
CustomizationEnablementKind["Workspace"] = "workspace";
|
|
6109
|
+
CustomizationEnablementKind["Session"] = "session";
|
|
6110
|
+
})(CustomizationEnablementKind || (CustomizationEnablementKind = {}));
|
|
6111
|
+
var CustomizationLoadStatus;
|
|
6112
|
+
(function(CustomizationLoadStatus) {
|
|
6113
|
+
CustomizationLoadStatus["Loading"] = "loading";
|
|
6114
|
+
CustomizationLoadStatus["Loaded"] = "loaded";
|
|
6115
|
+
CustomizationLoadStatus["Degraded"] = "degraded";
|
|
6116
|
+
CustomizationLoadStatus["Error"] = "error";
|
|
6117
|
+
})(CustomizationLoadStatus || (CustomizationLoadStatus = {}));
|
|
6118
|
+
var McpServerStatus;
|
|
6119
|
+
(function(McpServerStatus) {
|
|
6120
|
+
McpServerStatus["Starting"] = "starting";
|
|
6121
|
+
McpServerStatus["Ready"] = "ready";
|
|
6122
|
+
McpServerStatus["AuthRequired"] = "authRequired";
|
|
6123
|
+
McpServerStatus["Error"] = "error";
|
|
6124
|
+
McpServerStatus["Stopped"] = "stopped";
|
|
6125
|
+
})(McpServerStatus || (McpServerStatus = {}));
|
|
6126
|
+
var McpAuthRequiredReason;
|
|
6127
|
+
(function(McpAuthRequiredReason) {
|
|
6128
|
+
McpAuthRequiredReason["Required"] = "required";
|
|
6129
|
+
McpAuthRequiredReason["Expired"] = "expired";
|
|
6130
|
+
McpAuthRequiredReason["InsufficientScope"] = "insufficientScope";
|
|
6131
|
+
})(McpAuthRequiredReason || (McpAuthRequiredReason = {}));
|
|
6132
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-chat/state.js
|
|
6133
|
+
var BackgroundWorkKind;
|
|
6134
|
+
(function(BackgroundWorkKind) {
|
|
6135
|
+
BackgroundWorkKind["Shell"] = "shell";
|
|
6136
|
+
BackgroundWorkKind["Subagent"] = "subagent";
|
|
6137
|
+
})(BackgroundWorkKind || (BackgroundWorkKind = {}));
|
|
6138
|
+
var ChatOriginKind;
|
|
6139
|
+
(function(ChatOriginKind) {
|
|
6140
|
+
ChatOriginKind["User"] = "user";
|
|
6141
|
+
ChatOriginKind["Fork"] = "fork";
|
|
6142
|
+
ChatOriginKind["SideChat"] = "sideChat";
|
|
6143
|
+
ChatOriginKind["Tool"] = "tool";
|
|
6144
|
+
})(ChatOriginKind || (ChatOriginKind = {}));
|
|
6145
|
+
var ChatInteractivity;
|
|
6146
|
+
(function(ChatInteractivity) {
|
|
6147
|
+
ChatInteractivity["Full"] = "full";
|
|
6148
|
+
ChatInteractivity["ReadOnly"] = "read-only";
|
|
6149
|
+
ChatInteractivity["Hidden"] = "hidden";
|
|
6150
|
+
})(ChatInteractivity || (ChatInteractivity = {}));
|
|
6151
|
+
var PendingMessageKind;
|
|
6152
|
+
(function(PendingMessageKind) {
|
|
6153
|
+
PendingMessageKind["Steering"] = "steering";
|
|
6154
|
+
PendingMessageKind["Queued"] = "queued";
|
|
6155
|
+
})(PendingMessageKind || (PendingMessageKind = {}));
|
|
6156
|
+
var ChatInputResponseKind;
|
|
6157
|
+
(function(ChatInputResponseKind) {
|
|
6158
|
+
ChatInputResponseKind["Accept"] = "accept";
|
|
6159
|
+
ChatInputResponseKind["Decline"] = "decline";
|
|
6160
|
+
ChatInputResponseKind["Cancel"] = "cancel";
|
|
6161
|
+
})(ChatInputResponseKind || (ChatInputResponseKind = {}));
|
|
6162
|
+
var ChatInputQuestionKind;
|
|
6163
|
+
(function(ChatInputQuestionKind) {
|
|
6164
|
+
ChatInputQuestionKind["Text"] = "text";
|
|
6165
|
+
ChatInputQuestionKind["Number"] = "number";
|
|
6166
|
+
ChatInputQuestionKind["Integer"] = "integer";
|
|
6167
|
+
ChatInputQuestionKind["Boolean"] = "boolean";
|
|
6168
|
+
ChatInputQuestionKind["SingleSelect"] = "single-select";
|
|
6169
|
+
ChatInputQuestionKind["MultiSelect"] = "multi-select";
|
|
6170
|
+
})(ChatInputQuestionKind || (ChatInputQuestionKind = {}));
|
|
6171
|
+
var ChatInputAnswerValueKind;
|
|
6172
|
+
(function(ChatInputAnswerValueKind) {
|
|
6173
|
+
ChatInputAnswerValueKind["Text"] = "text";
|
|
6174
|
+
ChatInputAnswerValueKind["Number"] = "number";
|
|
6175
|
+
ChatInputAnswerValueKind["Boolean"] = "boolean";
|
|
6176
|
+
ChatInputAnswerValueKind["Selected"] = "selected";
|
|
6177
|
+
ChatInputAnswerValueKind["SelectedMany"] = "selected-many";
|
|
6178
|
+
})(ChatInputAnswerValueKind || (ChatInputAnswerValueKind = {}));
|
|
6179
|
+
var ChatInputAnswerState;
|
|
6180
|
+
(function(ChatInputAnswerState) {
|
|
6181
|
+
ChatInputAnswerState["Draft"] = "draft";
|
|
6182
|
+
ChatInputAnswerState["Submitted"] = "submitted";
|
|
6183
|
+
ChatInputAnswerState["Skipped"] = "skipped";
|
|
6184
|
+
})(ChatInputAnswerState || (ChatInputAnswerState = {}));
|
|
6185
|
+
var TurnState;
|
|
6186
|
+
(function(TurnState) {
|
|
6187
|
+
TurnState["Complete"] = "complete";
|
|
6188
|
+
TurnState["Cancelled"] = "cancelled";
|
|
6189
|
+
TurnState["Error"] = "error";
|
|
6190
|
+
})(TurnState || (TurnState = {}));
|
|
6191
|
+
var MessageAttachmentKind;
|
|
6192
|
+
(function(MessageAttachmentKind) {
|
|
6193
|
+
MessageAttachmentKind["Simple"] = "simple";
|
|
6194
|
+
MessageAttachmentKind["EmbeddedResource"] = "embeddedResource";
|
|
6195
|
+
MessageAttachmentKind["Resource"] = "resource";
|
|
6196
|
+
MessageAttachmentKind["Annotations"] = "annotations";
|
|
6197
|
+
MessageAttachmentKind["Chat"] = "chat";
|
|
6198
|
+
})(MessageAttachmentKind || (MessageAttachmentKind = {}));
|
|
6199
|
+
var MessageKind;
|
|
6200
|
+
(function(MessageKind) {
|
|
6201
|
+
MessageKind["User"] = "user";
|
|
6202
|
+
MessageKind["Agent"] = "agent";
|
|
6203
|
+
MessageKind["Tool"] = "tool";
|
|
6204
|
+
MessageKind["Automation"] = "automation";
|
|
6205
|
+
MessageKind["SystemNotification"] = "systemNotification";
|
|
6206
|
+
})(MessageKind || (MessageKind = {}));
|
|
6207
|
+
var ResponsePartKind;
|
|
6208
|
+
(function(ResponsePartKind) {
|
|
6209
|
+
ResponsePartKind["Markdown"] = "markdown";
|
|
6210
|
+
ResponsePartKind["ContentRef"] = "contentRef";
|
|
6211
|
+
ResponsePartKind["ToolCall"] = "toolCall";
|
|
6212
|
+
ResponsePartKind["Reasoning"] = "reasoning";
|
|
6213
|
+
ResponsePartKind["SystemNotification"] = "systemNotification";
|
|
6214
|
+
ResponsePartKind["InputRequest"] = "inputRequest";
|
|
6215
|
+
ResponsePartKind["Error"] = "error";
|
|
6216
|
+
})(ResponsePartKind || (ResponsePartKind = {}));
|
|
6217
|
+
var ToolCallStatus;
|
|
6218
|
+
(function(ToolCallStatus) {
|
|
6219
|
+
ToolCallStatus["Streaming"] = "streaming";
|
|
6220
|
+
ToolCallStatus["PendingConfirmation"] = "pending-confirmation";
|
|
6221
|
+
ToolCallStatus["Running"] = "running";
|
|
6222
|
+
ToolCallStatus["AuthRequired"] = "auth-required";
|
|
6223
|
+
ToolCallStatus["PendingResultConfirmation"] = "pending-result-confirmation";
|
|
6224
|
+
ToolCallStatus["Completed"] = "completed";
|
|
6225
|
+
ToolCallStatus["Cancelled"] = "cancelled";
|
|
6226
|
+
})(ToolCallStatus || (ToolCallStatus = {}));
|
|
6227
|
+
var ToolCallConfirmationReason;
|
|
6228
|
+
(function(ToolCallConfirmationReason) {
|
|
6229
|
+
ToolCallConfirmationReason["NotNeeded"] = "not-needed";
|
|
6230
|
+
ToolCallConfirmationReason["UserAction"] = "user-action";
|
|
6231
|
+
ToolCallConfirmationReason["Setting"] = "setting";
|
|
6232
|
+
})(ToolCallConfirmationReason || (ToolCallConfirmationReason = {}));
|
|
6233
|
+
var ToolCallRiskAssessmentKind;
|
|
6234
|
+
(function(ToolCallRiskAssessmentKind) {
|
|
6235
|
+
ToolCallRiskAssessmentKind["Judge"] = "judge";
|
|
6236
|
+
})(ToolCallRiskAssessmentKind || (ToolCallRiskAssessmentKind = {}));
|
|
6237
|
+
var ToolCallRiskAssessmentStatus;
|
|
6238
|
+
(function(ToolCallRiskAssessmentStatus) {
|
|
6239
|
+
ToolCallRiskAssessmentStatus["Loading"] = "loading";
|
|
6240
|
+
ToolCallRiskAssessmentStatus["Complete"] = "complete";
|
|
6241
|
+
})(ToolCallRiskAssessmentStatus || (ToolCallRiskAssessmentStatus = {}));
|
|
6242
|
+
var ToolCallCancellationReason;
|
|
6243
|
+
(function(ToolCallCancellationReason) {
|
|
6244
|
+
ToolCallCancellationReason["Denied"] = "denied";
|
|
6245
|
+
ToolCallCancellationReason["Skipped"] = "skipped";
|
|
6246
|
+
ToolCallCancellationReason["ResultDenied"] = "result-denied";
|
|
6247
|
+
})(ToolCallCancellationReason || (ToolCallCancellationReason = {}));
|
|
6248
|
+
var ConfirmationOptionKind;
|
|
6249
|
+
(function(ConfirmationOptionKind) {
|
|
6250
|
+
ConfirmationOptionKind["Approve"] = "approve";
|
|
6251
|
+
ConfirmationOptionKind["Deny"] = "deny";
|
|
6252
|
+
})(ConfirmationOptionKind || (ConfirmationOptionKind = {}));
|
|
6253
|
+
var ToolCallContributorKind;
|
|
6254
|
+
(function(ToolCallContributorKind) {
|
|
6255
|
+
ToolCallContributorKind["Client"] = "client";
|
|
6256
|
+
ToolCallContributorKind["MCP"] = "mcp";
|
|
6257
|
+
})(ToolCallContributorKind || (ToolCallContributorKind = {}));
|
|
6258
|
+
var ToolResultContentType;
|
|
6259
|
+
(function(ToolResultContentType) {
|
|
6260
|
+
ToolResultContentType["Text"] = "text";
|
|
6261
|
+
ToolResultContentType["EmbeddedResource"] = "embeddedResource";
|
|
6262
|
+
ToolResultContentType["Resource"] = "resource";
|
|
6263
|
+
ToolResultContentType["FileEdit"] = "fileEdit";
|
|
6264
|
+
ToolResultContentType["Terminal"] = "terminal";
|
|
6265
|
+
ToolResultContentType["Subagent"] = "subagent";
|
|
6266
|
+
})(ToolResultContentType || (ToolResultContentType = {}));
|
|
6267
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-terminal/state.js
|
|
6268
|
+
var TerminalLifecycleStatus;
|
|
6269
|
+
(function(TerminalLifecycleStatus) {
|
|
6270
|
+
TerminalLifecycleStatus["Running"] = "running";
|
|
6271
|
+
TerminalLifecycleStatus["Exited"] = "exited";
|
|
6272
|
+
})(TerminalLifecycleStatus || (TerminalLifecycleStatus = {}));
|
|
6273
|
+
var TerminalClaimKind;
|
|
6274
|
+
(function(TerminalClaimKind) {
|
|
6275
|
+
TerminalClaimKind["Client"] = "client";
|
|
6276
|
+
TerminalClaimKind["Session"] = "session";
|
|
6277
|
+
})(TerminalClaimKind || (TerminalClaimKind = {}));
|
|
6278
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-changeset/state.js
|
|
6279
|
+
var ChangesetStatus;
|
|
6280
|
+
(function(ChangesetStatus) {
|
|
6281
|
+
ChangesetStatus["Computing"] = "computing";
|
|
6282
|
+
ChangesetStatus["Recomputing"] = "recomputing";
|
|
6283
|
+
ChangesetStatus["Ready"] = "ready";
|
|
6284
|
+
ChangesetStatus["Error"] = "error";
|
|
6285
|
+
})(ChangesetStatus || (ChangesetStatus = {}));
|
|
6286
|
+
var ChangesetFileStatus;
|
|
6287
|
+
(function(ChangesetFileStatus) {
|
|
6288
|
+
ChangesetFileStatus[ChangesetFileStatus["Editing"] = 1] = "Editing";
|
|
6289
|
+
})(ChangesetFileStatus || (ChangesetFileStatus = {}));
|
|
6290
|
+
var ChangesetOperationStatus;
|
|
6291
|
+
(function(ChangesetOperationStatus) {
|
|
6292
|
+
ChangesetOperationStatus["Idle"] = "idle";
|
|
6293
|
+
ChangesetOperationStatus["Running"] = "running";
|
|
6294
|
+
ChangesetOperationStatus["Error"] = "error";
|
|
6295
|
+
ChangesetOperationStatus["Disabled"] = "disabled";
|
|
6296
|
+
})(ChangesetOperationStatus || (ChangesetOperationStatus = {}));
|
|
6297
|
+
var ChangesetOperationScope;
|
|
6298
|
+
(function(ChangesetOperationScope) {
|
|
6299
|
+
ChangesetOperationScope["Changeset"] = "changeset";
|
|
6300
|
+
ChangesetOperationScope["Resource"] = "resource";
|
|
6301
|
+
ChangesetOperationScope["Range"] = "range";
|
|
6302
|
+
})(ChangesetOperationScope || (ChangesetOperationScope = {}));
|
|
6303
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-resource-watch/state.js
|
|
6304
|
+
var ResourceChangeType;
|
|
6305
|
+
(function(ResourceChangeType) {
|
|
6306
|
+
ResourceChangeType["Added"] = "added";
|
|
6307
|
+
ResourceChangeType["Updated"] = "updated";
|
|
6308
|
+
ResourceChangeType["Deleted"] = "deleted";
|
|
6309
|
+
})(ResourceChangeType || (ResourceChangeType = {}));
|
|
6310
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-automation/state.js
|
|
6311
|
+
var AutomationOperation;
|
|
6312
|
+
(function(AutomationOperation) {
|
|
6313
|
+
AutomationOperation["Update"] = "update";
|
|
6314
|
+
AutomationOperation["Remove"] = "remove";
|
|
6315
|
+
AutomationOperation["Run"] = "run";
|
|
6316
|
+
})(AutomationOperation || (AutomationOperation = {}));
|
|
6317
|
+
var AutomationMisfirePolicy;
|
|
6318
|
+
(function(AutomationMisfirePolicy) {
|
|
6319
|
+
AutomationMisfirePolicy["Skip"] = "skip";
|
|
6320
|
+
AutomationMisfirePolicy["RunOnce"] = "runOnce";
|
|
6321
|
+
})(AutomationMisfirePolicy || (AutomationMisfirePolicy = {}));
|
|
6322
|
+
var AutomationTriggerKind;
|
|
6323
|
+
(function(AutomationTriggerKind) {
|
|
6324
|
+
AutomationTriggerKind["Schedule"] = "schedule";
|
|
6325
|
+
AutomationTriggerKind["Event"] = "event";
|
|
6326
|
+
})(AutomationTriggerKind || (AutomationTriggerKind = {}));
|
|
6327
|
+
var AutomationDisableConditionKind;
|
|
6328
|
+
(function(AutomationDisableConditionKind) {
|
|
6329
|
+
AutomationDisableConditionKind["AfterRuns"] = "afterRuns";
|
|
6330
|
+
AutomationDisableConditionKind["AfterDate"] = "afterDate";
|
|
6331
|
+
})(AutomationDisableConditionKind || (AutomationDisableConditionKind = {}));
|
|
6332
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-automation-run/state.js
|
|
6333
|
+
var AutomationRunStatus;
|
|
6334
|
+
(function(AutomationRunStatus) {
|
|
6335
|
+
AutomationRunStatus["Pending"] = "pending";
|
|
6336
|
+
AutomationRunStatus["Running"] = "running";
|
|
6337
|
+
AutomationRunStatus["Completed"] = "completed";
|
|
6338
|
+
AutomationRunStatus["Failed"] = "failed";
|
|
6339
|
+
AutomationRunStatus["Cancelled"] = "cancelled";
|
|
6340
|
+
})(AutomationRunStatus || (AutomationRunStatus = {}));
|
|
6341
|
+
var AutomationRunOriginKind;
|
|
6342
|
+
(function(AutomationRunOriginKind) {
|
|
6343
|
+
AutomationRunOriginKind["Manual"] = "manual";
|
|
6344
|
+
AutomationRunOriginKind["Trigger"] = "trigger";
|
|
6345
|
+
})(AutomationRunOriginKind || (AutomationRunOriginKind = {}));
|
|
6346
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/common/actions.js
|
|
6347
|
+
var ActionType;
|
|
6348
|
+
(function(ActionType) {
|
|
6349
|
+
ActionType["RootAgentsChanged"] = "root/agentsChanged";
|
|
6350
|
+
ActionType["RootActiveSessionsChanged"] = "root/activeSessionsChanged";
|
|
6351
|
+
ActionType["SessionReady"] = "session/ready";
|
|
6352
|
+
ActionType["SessionCreationFailed"] = "session/creationFailed";
|
|
6353
|
+
ActionType["SessionChatAdded"] = "session/chatAdded";
|
|
6354
|
+
ActionType["SessionChatRemoved"] = "session/chatRemoved";
|
|
6355
|
+
ActionType["SessionChatUpdated"] = "session/chatUpdated";
|
|
6356
|
+
ActionType["SessionChatsReordered"] = "session/chatsReordered";
|
|
6357
|
+
ActionType["SessionDefaultChatChanged"] = "session/defaultChatChanged";
|
|
6358
|
+
ActionType["ChatTurnStarted"] = "chat/turnStarted";
|
|
6359
|
+
ActionType["ChatDelta"] = "chat/delta";
|
|
6360
|
+
ActionType["ChatResponsePart"] = "chat/responsePart";
|
|
6361
|
+
ActionType["ChatToolCallStart"] = "chat/toolCallStart";
|
|
6362
|
+
ActionType["ChatToolCallDelta"] = "chat/toolCallDelta";
|
|
6363
|
+
ActionType["ChatToolCallReady"] = "chat/toolCallReady";
|
|
6364
|
+
ActionType["ChatToolCallConfirmed"] = "chat/toolCallConfirmed";
|
|
6365
|
+
ActionType["ChatToolCallComplete"] = "chat/toolCallComplete";
|
|
6366
|
+
ActionType["ChatToolCallResultConfirmed"] = "chat/toolCallResultConfirmed";
|
|
6367
|
+
ActionType["ChatToolCallContentChanged"] = "chat/toolCallContentChanged";
|
|
6368
|
+
ActionType["ChatToolCallAuthRequired"] = "chat/toolCallAuthRequired";
|
|
6369
|
+
ActionType["ChatToolCallAuthResolved"] = "chat/toolCallAuthResolved";
|
|
6370
|
+
ActionType["ChatTurnComplete"] = "chat/turnComplete";
|
|
6371
|
+
ActionType["ChatTurnCancelled"] = "chat/turnCancelled";
|
|
6372
|
+
ActionType["ChatError"] = "chat/error";
|
|
6373
|
+
ActionType["ChatTurnResume"] = "chat/turnResume";
|
|
6374
|
+
ActionType["ChatActivityChanged"] = "chat/activityChanged";
|
|
6375
|
+
ActionType["ChatBackgroundWorkSet"] = "chat/backgroundWorkSet";
|
|
6376
|
+
ActionType["ChatBackgroundWorkRemoved"] = "chat/backgroundWorkRemoved";
|
|
6377
|
+
ActionType["ChatMovableChanged"] = "chat/movableChanged";
|
|
6378
|
+
ActionType["ChatChangesetsChanged"] = "chat/changesetsChanged";
|
|
6379
|
+
ActionType["ChatCanvasesChanged"] = "chat/canvasesChanged";
|
|
6380
|
+
ActionType["CanvasStateChanged"] = "canvas/stateChanged";
|
|
6381
|
+
ActionType["ChatWorkingDirectorySet"] = "chat/workingDirectorySet";
|
|
6382
|
+
ActionType["ChatWorkingDirectoryRemoved"] = "chat/workingDirectoryRemoved";
|
|
6383
|
+
ActionType["SessionTitleChanged"] = "session/titleChanged";
|
|
6384
|
+
ActionType["ChatUsage"] = "chat/usage";
|
|
6385
|
+
ActionType["ChatReasoning"] = "chat/reasoning";
|
|
6386
|
+
ActionType["SessionServerToolsChanged"] = "session/serverToolsChanged";
|
|
6387
|
+
ActionType["SessionActiveClientSet"] = "session/activeClientSet";
|
|
6388
|
+
ActionType["SessionActiveClientRemoved"] = "session/activeClientRemoved";
|
|
6389
|
+
ActionType["SessionWorkingDirectorySet"] = "session/workingDirectorySet";
|
|
6390
|
+
ActionType["SessionWorkingDirectoryRemoved"] = "session/workingDirectoryRemoved";
|
|
6391
|
+
ActionType["SessionWorkingDirectoryReplaced"] = "session/workingDirectoryReplaced";
|
|
6392
|
+
ActionType["SessionInputNeededSet"] = "session/inputNeededSet";
|
|
6393
|
+
ActionType["SessionInputNeededRemoved"] = "session/inputNeededRemoved";
|
|
6394
|
+
ActionType["ChatPendingMessageSet"] = "chat/pendingMessageSet";
|
|
6395
|
+
ActionType["ChatPendingMessageRemoved"] = "chat/pendingMessageRemoved";
|
|
6396
|
+
ActionType["ChatQueuedMessagesReordered"] = "chat/queuedMessagesReordered";
|
|
6397
|
+
ActionType["ChatDraftChanged"] = "chat/draftChanged";
|
|
6398
|
+
ActionType["ChatIsReadChanged"] = "chat/isReadChanged";
|
|
6399
|
+
ActionType["ChatIsArchivedChanged"] = "chat/isArchivedChanged";
|
|
6400
|
+
ActionType["ChatConfigChanged"] = "chat/configChanged";
|
|
6401
|
+
ActionType["ChatMoved"] = "chat/moved";
|
|
6402
|
+
ActionType["ChatInputRequested"] = "chat/inputRequested";
|
|
6403
|
+
ActionType["ChatInputAnswerChanged"] = "chat/inputAnswerChanged";
|
|
6404
|
+
ActionType["ChatInputCompleted"] = "chat/inputCompleted";
|
|
6405
|
+
ActionType["SessionCustomizationsChanged"] = "session/customizationsChanged";
|
|
6406
|
+
ActionType["SessionCustomizationToggled"] = "session/customizationToggled";
|
|
6407
|
+
ActionType["SessionCustomizationUpdated"] = "session/customizationUpdated";
|
|
6408
|
+
ActionType["SessionCustomizationRemoved"] = "session/customizationRemoved";
|
|
6409
|
+
ActionType["SessionMcpServerStateChanged"] = "session/mcpServerStateChanged";
|
|
6410
|
+
ActionType["SessionMcpServerStartRequested"] = "session/mcpServerStartRequested";
|
|
6411
|
+
ActionType["SessionMcpServerStopRequested"] = "session/mcpServerStopRequested";
|
|
6412
|
+
ActionType["SessionMcpServerBackgroundRequested"] = "session/mcpServerBackgroundRequested";
|
|
6413
|
+
ActionType["ChatTruncated"] = "chat/truncated";
|
|
6414
|
+
ActionType["ChatTurnsLoaded"] = "chat/turnsLoaded";
|
|
6415
|
+
ActionType["SessionIsReadChanged"] = "session/isReadChanged";
|
|
6416
|
+
ActionType["SessionIsArchivedChanged"] = "session/isArchivedChanged";
|
|
6417
|
+
ActionType["SessionActivityChanged"] = "session/activityChanged";
|
|
6418
|
+
ActionType["SessionChangesetsChanged"] = "session/changesetsChanged";
|
|
6419
|
+
ActionType["SessionConfigChanged"] = "session/configChanged";
|
|
6420
|
+
ActionType["SessionMetaChanged"] = "session/metaChanged";
|
|
6421
|
+
ActionType["ChangesetStatusChanged"] = "changeset/statusChanged";
|
|
6422
|
+
ActionType["ChangesetFileSet"] = "changeset/fileSet";
|
|
6423
|
+
ActionType["ChangesetFileRemoved"] = "changeset/fileRemoved";
|
|
6424
|
+
ActionType["ChangesetFilesReviewChanged"] = "changeset/filesReviewChanged";
|
|
6425
|
+
ActionType["ChangesetContentChanged"] = "changeset/contentChanged";
|
|
6426
|
+
ActionType["ChangesetOperationsChanged"] = "changeset/operationsChanged";
|
|
6427
|
+
ActionType["ChangesetOperationStatusChanged"] = "changeset/operationStatusChanged";
|
|
6428
|
+
ActionType["ChangesetCleared"] = "changeset/cleared";
|
|
6429
|
+
ActionType["AnnotationsSet"] = "annotations/set";
|
|
6430
|
+
ActionType["AnnotationsUpdated"] = "annotations/updated";
|
|
6431
|
+
ActionType["AnnotationsRemoved"] = "annotations/removed";
|
|
6432
|
+
ActionType["AnnotationsEntrySet"] = "annotations/entrySet";
|
|
6433
|
+
ActionType["AnnotationsEntryRemoved"] = "annotations/entryRemoved";
|
|
6434
|
+
ActionType["RootTerminalsChanged"] = "root/terminalsChanged";
|
|
6435
|
+
ActionType["RootConfigChanged"] = "root/configChanged";
|
|
6436
|
+
ActionType["TerminalData"] = "terminal/data";
|
|
6437
|
+
ActionType["TerminalInput"] = "terminal/input";
|
|
6438
|
+
ActionType["TerminalResized"] = "terminal/resized";
|
|
6439
|
+
ActionType["TerminalClaimed"] = "terminal/claimed";
|
|
6440
|
+
ActionType["TerminalTitleChanged"] = "terminal/titleChanged";
|
|
6441
|
+
ActionType["TerminalCwdChanged"] = "terminal/cwdChanged";
|
|
6442
|
+
ActionType["TerminalExited"] = "terminal/exited";
|
|
6443
|
+
ActionType["TerminalCleared"] = "terminal/cleared";
|
|
6444
|
+
ActionType["TerminalCommandDetectionAvailable"] = "terminal/commandDetectionAvailable";
|
|
6445
|
+
ActionType["TerminalCommandExecuted"] = "terminal/commandExecuted";
|
|
6446
|
+
ActionType["TerminalCommandFinished"] = "terminal/commandFinished";
|
|
6447
|
+
ActionType["ResourceWatchChanged"] = "resourceWatch/changed";
|
|
6448
|
+
ActionType["AutomationCreateRequested"] = "automation/createRequested";
|
|
6449
|
+
ActionType["AutomationUpdateRequested"] = "automation/updateRequested";
|
|
6450
|
+
ActionType["AutomationSet"] = "automation/set";
|
|
6451
|
+
ActionType["AutomationRemoved"] = "automation/removed";
|
|
6452
|
+
ActionType["AutomationRunLifecycleChanged"] = "automationRun/lifecycleChanged";
|
|
6453
|
+
ActionType["AutomationRunSessionSet"] = "automationRun/sessionSet";
|
|
6454
|
+
ActionType["AutomationRunSessionRemoved"] = "automationRun/sessionRemoved";
|
|
6455
|
+
ActionType["AutomationRunPrimarySessionChanged"] = "automationRun/primarySessionChanged";
|
|
6456
|
+
ActionType["AutomationRunCancelRequested"] = "automationRun/cancelRequested";
|
|
6457
|
+
})(ActionType || (ActionType = {}));
|
|
6458
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/action-origin.generated.js
|
|
6459
|
+
var IS_CLIENT_DISPATCHABLE = {
|
|
6460
|
+
[ActionType.RootAgentsChanged]: false,
|
|
6461
|
+
[ActionType.RootActiveSessionsChanged]: false,
|
|
6462
|
+
[ActionType.RootTerminalsChanged]: false,
|
|
6463
|
+
[ActionType.RootConfigChanged]: true,
|
|
6464
|
+
[ActionType.SessionReady]: false,
|
|
6465
|
+
[ActionType.SessionCreationFailed]: false,
|
|
6466
|
+
[ActionType.SessionChatAdded]: false,
|
|
6467
|
+
[ActionType.SessionChatRemoved]: false,
|
|
6468
|
+
[ActionType.SessionChatUpdated]: false,
|
|
6469
|
+
[ActionType.SessionChatsReordered]: false,
|
|
6470
|
+
[ActionType.SessionDefaultChatChanged]: false,
|
|
6471
|
+
[ActionType.SessionTitleChanged]: true,
|
|
6472
|
+
[ActionType.SessionServerToolsChanged]: false,
|
|
6473
|
+
[ActionType.SessionActiveClientSet]: true,
|
|
6474
|
+
[ActionType.SessionActiveClientRemoved]: true,
|
|
6475
|
+
[ActionType.SessionWorkingDirectorySet]: true,
|
|
6476
|
+
[ActionType.SessionWorkingDirectoryRemoved]: true,
|
|
6477
|
+
[ActionType.SessionWorkingDirectoryReplaced]: true,
|
|
6478
|
+
[ActionType.SessionInputNeededSet]: false,
|
|
6479
|
+
[ActionType.SessionInputNeededRemoved]: false,
|
|
6480
|
+
[ActionType.SessionCustomizationsChanged]: false,
|
|
6481
|
+
[ActionType.SessionCustomizationToggled]: true,
|
|
6482
|
+
[ActionType.SessionCustomizationUpdated]: false,
|
|
6483
|
+
[ActionType.SessionCustomizationRemoved]: false,
|
|
6484
|
+
[ActionType.SessionMcpServerStateChanged]: false,
|
|
6485
|
+
[ActionType.SessionMcpServerStartRequested]: true,
|
|
6486
|
+
[ActionType.SessionMcpServerStopRequested]: true,
|
|
6487
|
+
[ActionType.SessionMcpServerBackgroundRequested]: true,
|
|
6488
|
+
[ActionType.SessionIsReadChanged]: true,
|
|
6489
|
+
[ActionType.SessionIsArchivedChanged]: true,
|
|
6490
|
+
[ActionType.SessionActivityChanged]: false,
|
|
6491
|
+
[ActionType.SessionChangesetsChanged]: false,
|
|
6492
|
+
[ActionType.SessionConfigChanged]: true,
|
|
6493
|
+
[ActionType.SessionMetaChanged]: false,
|
|
6494
|
+
[ActionType.ChatTurnStarted]: true,
|
|
6495
|
+
[ActionType.ChatDelta]: false,
|
|
6496
|
+
[ActionType.ChatResponsePart]: false,
|
|
6497
|
+
[ActionType.ChatToolCallStart]: false,
|
|
6498
|
+
[ActionType.ChatToolCallDelta]: false,
|
|
6499
|
+
[ActionType.ChatToolCallReady]: false,
|
|
6500
|
+
[ActionType.ChatToolCallConfirmed]: true,
|
|
6501
|
+
[ActionType.ChatToolCallComplete]: true,
|
|
6502
|
+
[ActionType.ChatToolCallResultConfirmed]: true,
|
|
6503
|
+
[ActionType.ChatToolCallContentChanged]: true,
|
|
6504
|
+
[ActionType.ChatToolCallAuthRequired]: false,
|
|
6505
|
+
[ActionType.ChatToolCallAuthResolved]: false,
|
|
6506
|
+
[ActionType.ChatTurnComplete]: false,
|
|
6507
|
+
[ActionType.ChatTurnCancelled]: true,
|
|
6508
|
+
[ActionType.ChatError]: false,
|
|
6509
|
+
[ActionType.ChatTurnResume]: true,
|
|
6510
|
+
[ActionType.ChatActivityChanged]: false,
|
|
6511
|
+
[ActionType.ChatBackgroundWorkSet]: false,
|
|
6512
|
+
[ActionType.ChatBackgroundWorkRemoved]: false,
|
|
6513
|
+
[ActionType.ChatMovableChanged]: false,
|
|
6514
|
+
[ActionType.ChatChangesetsChanged]: false,
|
|
6515
|
+
[ActionType.ChatCanvasesChanged]: false,
|
|
6516
|
+
[ActionType.CanvasStateChanged]: false,
|
|
6517
|
+
[ActionType.ChatWorkingDirectorySet]: true,
|
|
6518
|
+
[ActionType.ChatWorkingDirectoryRemoved]: true,
|
|
6519
|
+
[ActionType.ChatUsage]: false,
|
|
6520
|
+
[ActionType.ChatReasoning]: false,
|
|
6521
|
+
[ActionType.ChatPendingMessageSet]: true,
|
|
6522
|
+
[ActionType.ChatPendingMessageRemoved]: true,
|
|
6523
|
+
[ActionType.ChatQueuedMessagesReordered]: true,
|
|
6524
|
+
[ActionType.ChatDraftChanged]: true,
|
|
6525
|
+
[ActionType.ChatIsReadChanged]: true,
|
|
6526
|
+
[ActionType.ChatIsArchivedChanged]: true,
|
|
6527
|
+
[ActionType.ChatConfigChanged]: true,
|
|
6528
|
+
[ActionType.ChatMoved]: false,
|
|
6529
|
+
[ActionType.ChatInputRequested]: false,
|
|
6530
|
+
[ActionType.ChatInputAnswerChanged]: true,
|
|
6531
|
+
[ActionType.ChatInputCompleted]: true,
|
|
6532
|
+
[ActionType.ChatTruncated]: true,
|
|
6533
|
+
[ActionType.ChatTurnsLoaded]: false,
|
|
6534
|
+
[ActionType.ChangesetStatusChanged]: false,
|
|
6535
|
+
[ActionType.ChangesetFileSet]: false,
|
|
6536
|
+
[ActionType.ChangesetFileRemoved]: false,
|
|
6537
|
+
[ActionType.ChangesetFilesReviewChanged]: true,
|
|
6538
|
+
[ActionType.ChangesetContentChanged]: false,
|
|
6539
|
+
[ActionType.ChangesetOperationsChanged]: false,
|
|
6540
|
+
[ActionType.ChangesetOperationStatusChanged]: false,
|
|
6541
|
+
[ActionType.ChangesetCleared]: false,
|
|
6542
|
+
[ActionType.AnnotationsSet]: true,
|
|
6543
|
+
[ActionType.AnnotationsUpdated]: true,
|
|
6544
|
+
[ActionType.AnnotationsRemoved]: true,
|
|
6545
|
+
[ActionType.AnnotationsEntrySet]: true,
|
|
6546
|
+
[ActionType.AnnotationsEntryRemoved]: true,
|
|
6547
|
+
[ActionType.TerminalData]: false,
|
|
6548
|
+
[ActionType.TerminalInput]: true,
|
|
6549
|
+
[ActionType.TerminalResized]: true,
|
|
6550
|
+
[ActionType.TerminalClaimed]: true,
|
|
6551
|
+
[ActionType.TerminalTitleChanged]: true,
|
|
6552
|
+
[ActionType.TerminalCwdChanged]: false,
|
|
6553
|
+
[ActionType.TerminalExited]: false,
|
|
6554
|
+
[ActionType.TerminalCleared]: true,
|
|
6555
|
+
[ActionType.TerminalCommandDetectionAvailable]: false,
|
|
6556
|
+
[ActionType.TerminalCommandExecuted]: false,
|
|
6557
|
+
[ActionType.TerminalCommandFinished]: false,
|
|
6558
|
+
[ActionType.ResourceWatchChanged]: false,
|
|
6559
|
+
[ActionType.AutomationCreateRequested]: true,
|
|
6560
|
+
[ActionType.AutomationUpdateRequested]: true,
|
|
6561
|
+
[ActionType.AutomationSet]: false,
|
|
6562
|
+
[ActionType.AutomationRemoved]: true,
|
|
6563
|
+
[ActionType.AutomationRunLifecycleChanged]: false,
|
|
6564
|
+
[ActionType.AutomationRunSessionSet]: false,
|
|
6565
|
+
[ActionType.AutomationRunSessionRemoved]: false,
|
|
6566
|
+
[ActionType.AutomationRunPrimarySessionChanged]: false,
|
|
6567
|
+
[ActionType.AutomationRunCancelRequested]: true
|
|
6568
|
+
};
|
|
6569
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/window-exempt.generated.js
|
|
6570
|
+
var WINDOW_EXEMPT_METHODS = [
|
|
6571
|
+
"channel/credit",
|
|
6572
|
+
"tcp/reset",
|
|
6573
|
+
"unsubscribe"
|
|
6574
|
+
];
|
|
6575
|
+
var windowExemptMethods = new Set(WINDOW_EXEMPT_METHODS);
|
|
6576
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/common/commands.js
|
|
6577
|
+
var PathStyle;
|
|
6578
|
+
(function(PathStyle) {
|
|
6579
|
+
PathStyle["Posix"] = "posix";
|
|
6580
|
+
PathStyle["Windows"] = "windows";
|
|
6581
|
+
})(PathStyle || (PathStyle = {}));
|
|
6582
|
+
var ReconnectResultType;
|
|
6583
|
+
(function(ReconnectResultType) {
|
|
6584
|
+
ReconnectResultType["Replay"] = "replay";
|
|
6585
|
+
ReconnectResultType["Snapshot"] = "snapshot";
|
|
6586
|
+
})(ReconnectResultType || (ReconnectResultType = {}));
|
|
6587
|
+
var ContentEncoding;
|
|
6588
|
+
(function(ContentEncoding) {
|
|
6589
|
+
ContentEncoding["Base64"] = "base64";
|
|
6590
|
+
ContentEncoding["Utf8"] = "utf-8";
|
|
6591
|
+
})(ContentEncoding || (ContentEncoding = {}));
|
|
6592
|
+
var ResourceWriteMode;
|
|
6593
|
+
(function(ResourceWriteMode) {
|
|
6594
|
+
ResourceWriteMode["Truncate"] = "truncate";
|
|
6595
|
+
ResourceWriteMode["Append"] = "append";
|
|
6596
|
+
ResourceWriteMode["Insert"] = "insert";
|
|
6597
|
+
})(ResourceWriteMode || (ResourceWriteMode = {}));
|
|
6598
|
+
var ResourceType;
|
|
6599
|
+
(function(ResourceType) {
|
|
6600
|
+
ResourceType["File"] = "file";
|
|
6601
|
+
ResourceType["Directory"] = "directory";
|
|
6602
|
+
ResourceType["Symlink"] = "symlink";
|
|
6603
|
+
})(ResourceType || (ResourceType = {}));
|
|
6604
|
+
var AuthenticateTargetKind;
|
|
6605
|
+
(function(AuthenticateTargetKind) {
|
|
6606
|
+
AuthenticateTargetKind["McpServer"] = "mcpServer";
|
|
6607
|
+
})(AuthenticateTargetKind || (AuthenticateTargetKind = {}));
|
|
6608
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-session/commands.js
|
|
6609
|
+
var CompletionItemKind;
|
|
6610
|
+
(function(CompletionItemKind) {
|
|
6611
|
+
CompletionItemKind["UserMessage"] = "userMessage";
|
|
6612
|
+
})(CompletionItemKind || (CompletionItemKind = {}));
|
|
6613
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-chat/commands.js
|
|
6614
|
+
var ChatSourceKind;
|
|
6615
|
+
(function(ChatSourceKind) {
|
|
6616
|
+
ChatSourceKind["Fork"] = "fork";
|
|
6617
|
+
ChatSourceKind["SideChat"] = "sideChat";
|
|
6618
|
+
})(ChatSourceKind || (ChatSourceKind = {}));
|
|
6619
|
+
var ChatMoveDestinationKind;
|
|
6620
|
+
(function(ChatMoveDestinationKind) {
|
|
6621
|
+
ChatMoveDestinationKind["Session"] = "session";
|
|
6622
|
+
ChatMoveDestinationKind["NewSession"] = "newSession";
|
|
6623
|
+
})(ChatMoveDestinationKind || (ChatMoveDestinationKind = {}));
|
|
6624
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-changeset/commands.js
|
|
6625
|
+
var ChangesetOperationTargetKind;
|
|
6626
|
+
(function(ChangesetOperationTargetKind) {
|
|
6627
|
+
ChangesetOperationTargetKind["Resource"] = "resource";
|
|
6628
|
+
ChangesetOperationTargetKind["Range"] = "range";
|
|
6629
|
+
})(ChangesetOperationTargetKind || (ChangesetOperationTargetKind = {}));
|
|
6630
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/common/notifications.js
|
|
6631
|
+
var AuthRequiredReason;
|
|
6632
|
+
(function(AuthRequiredReason) {
|
|
6633
|
+
AuthRequiredReason["Required"] = "required";
|
|
6634
|
+
AuthRequiredReason["Expired"] = "expired";
|
|
6635
|
+
})(AuthRequiredReason || (AuthRequiredReason = {}));
|
|
6636
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/version/registry.js
|
|
6637
|
+
var SUPPORTED_PROTOCOL_VERSIONS = Object.freeze([
|
|
6638
|
+
"1.0.0",
|
|
6639
|
+
"0.9.0"
|
|
6640
|
+
]);
|
|
6641
|
+
var ACTION_INTRODUCED_IN = {
|
|
6642
|
+
[ActionType.RootAgentsChanged]: "0.1.0",
|
|
6643
|
+
[ActionType.RootActiveSessionsChanged]: "0.1.0",
|
|
6644
|
+
[ActionType.SessionReady]: "0.1.0",
|
|
6645
|
+
[ActionType.SessionCreationFailed]: "0.1.0",
|
|
6646
|
+
[ActionType.SessionChatAdded]: "0.4.0",
|
|
6647
|
+
[ActionType.SessionChatRemoved]: "0.4.0",
|
|
6648
|
+
[ActionType.SessionChatUpdated]: "0.4.0",
|
|
6649
|
+
[ActionType.SessionChatsReordered]: "0.9.0",
|
|
6650
|
+
[ActionType.SessionDefaultChatChanged]: "0.4.0",
|
|
6651
|
+
[ActionType.SessionTitleChanged]: "0.1.0",
|
|
6652
|
+
[ActionType.SessionServerToolsChanged]: "0.1.0",
|
|
6653
|
+
[ActionType.SessionActiveClientSet]: "0.5.0",
|
|
6654
|
+
[ActionType.SessionActiveClientRemoved]: "0.5.0",
|
|
6655
|
+
[ActionType.SessionWorkingDirectorySet]: "0.7.0",
|
|
6656
|
+
[ActionType.SessionWorkingDirectoryRemoved]: "0.7.0",
|
|
6657
|
+
[ActionType.SessionWorkingDirectoryReplaced]: "0.8.0",
|
|
6658
|
+
[ActionType.SessionInputNeededSet]: "0.5.1",
|
|
6659
|
+
[ActionType.SessionInputNeededRemoved]: "0.5.1",
|
|
6660
|
+
[ActionType.SessionCustomizationsChanged]: "0.1.0",
|
|
6661
|
+
[ActionType.SessionCustomizationToggled]: "0.1.0",
|
|
6662
|
+
[ActionType.SessionCustomizationUpdated]: "0.1.0",
|
|
6663
|
+
[ActionType.SessionCustomizationRemoved]: "0.2.0",
|
|
6664
|
+
[ActionType.SessionMcpServerStateChanged]: "0.3.0",
|
|
6665
|
+
[ActionType.SessionMcpServerStartRequested]: "0.5.2",
|
|
6666
|
+
[ActionType.SessionMcpServerStopRequested]: "0.5.2",
|
|
6667
|
+
[ActionType.SessionMcpServerBackgroundRequested]: "0.9.0",
|
|
6668
|
+
[ActionType.SessionIsReadChanged]: "0.1.0",
|
|
6669
|
+
[ActionType.SessionIsArchivedChanged]: "0.1.0",
|
|
6670
|
+
[ActionType.SessionActivityChanged]: "0.1.0",
|
|
6671
|
+
[ActionType.SessionChangesetsChanged]: "0.2.0",
|
|
6672
|
+
[ActionType.SessionConfigChanged]: "0.1.0",
|
|
6673
|
+
[ActionType.SessionMetaChanged]: "0.1.0",
|
|
6674
|
+
[ActionType.ChatTurnStarted]: "0.4.0",
|
|
6675
|
+
[ActionType.ChatDelta]: "0.4.0",
|
|
6676
|
+
[ActionType.ChatResponsePart]: "0.4.0",
|
|
6677
|
+
[ActionType.ChatToolCallStart]: "0.4.0",
|
|
6678
|
+
[ActionType.ChatToolCallDelta]: "0.4.0",
|
|
6679
|
+
[ActionType.ChatToolCallReady]: "0.4.0",
|
|
6680
|
+
[ActionType.ChatToolCallConfirmed]: "0.4.0",
|
|
6681
|
+
[ActionType.ChatToolCallComplete]: "0.4.0",
|
|
6682
|
+
[ActionType.ChatToolCallResultConfirmed]: "0.4.0",
|
|
6683
|
+
[ActionType.ChatToolCallContentChanged]: "0.4.0",
|
|
6684
|
+
[ActionType.ChatToolCallAuthRequired]: "0.6.0",
|
|
6685
|
+
[ActionType.ChatToolCallAuthResolved]: "0.6.0",
|
|
6686
|
+
[ActionType.ChatTurnComplete]: "0.4.0",
|
|
6687
|
+
[ActionType.ChatTurnCancelled]: "0.4.0",
|
|
6688
|
+
[ActionType.ChatError]: "0.4.0",
|
|
6689
|
+
[ActionType.ChatTurnResume]: "0.9.0",
|
|
6690
|
+
[ActionType.ChatActivityChanged]: "0.5.0",
|
|
6691
|
+
[ActionType.ChatBackgroundWorkSet]: "0.9.0",
|
|
6692
|
+
[ActionType.ChatBackgroundWorkRemoved]: "0.9.0",
|
|
6693
|
+
[ActionType.ChatMovableChanged]: "0.9.0",
|
|
6694
|
+
[ActionType.ChatChangesetsChanged]: "0.9.0",
|
|
6695
|
+
[ActionType.ChatCanvasesChanged]: "0.10.0",
|
|
6696
|
+
[ActionType.CanvasStateChanged]: "0.10.0",
|
|
6697
|
+
[ActionType.ChatWorkingDirectorySet]: "0.7.0",
|
|
6698
|
+
[ActionType.ChatWorkingDirectoryRemoved]: "0.7.0",
|
|
6699
|
+
[ActionType.ChatUsage]: "0.4.0",
|
|
6700
|
+
[ActionType.ChatReasoning]: "0.4.0",
|
|
6701
|
+
[ActionType.ChatPendingMessageSet]: "0.4.0",
|
|
6702
|
+
[ActionType.ChatPendingMessageRemoved]: "0.4.0",
|
|
6703
|
+
[ActionType.ChatQueuedMessagesReordered]: "0.4.0",
|
|
6704
|
+
[ActionType.ChatDraftChanged]: "0.5.0",
|
|
6705
|
+
[ActionType.ChatIsReadChanged]: "0.9.0",
|
|
6706
|
+
[ActionType.ChatIsArchivedChanged]: "0.9.0",
|
|
6707
|
+
[ActionType.ChatConfigChanged]: "1.1.0",
|
|
6708
|
+
[ActionType.ChatMoved]: "1.1.0",
|
|
6709
|
+
[ActionType.ChatInputRequested]: "0.4.0",
|
|
6710
|
+
[ActionType.ChatInputAnswerChanged]: "0.4.0",
|
|
6711
|
+
[ActionType.ChatInputCompleted]: "0.4.0",
|
|
6712
|
+
[ActionType.ChatTruncated]: "0.4.0",
|
|
6713
|
+
[ActionType.ChatTurnsLoaded]: "0.5.1",
|
|
6714
|
+
[ActionType.ChangesetStatusChanged]: "0.2.0",
|
|
6715
|
+
[ActionType.ChangesetFileSet]: "0.2.0",
|
|
6716
|
+
[ActionType.ChangesetFileRemoved]: "0.2.0",
|
|
6717
|
+
[ActionType.ChangesetFilesReviewChanged]: "0.6.0",
|
|
6718
|
+
[ActionType.ChangesetContentChanged]: "0.4.0",
|
|
6719
|
+
[ActionType.ChangesetOperationsChanged]: "0.2.0",
|
|
6720
|
+
[ActionType.ChangesetOperationStatusChanged]: "0.3.0",
|
|
6721
|
+
[ActionType.ChangesetCleared]: "0.2.0",
|
|
6722
|
+
[ActionType.AnnotationsSet]: "0.4.0",
|
|
6723
|
+
[ActionType.AnnotationsUpdated]: "0.4.0",
|
|
6724
|
+
[ActionType.AnnotationsRemoved]: "0.4.0",
|
|
6725
|
+
[ActionType.AnnotationsEntrySet]: "0.4.0",
|
|
6726
|
+
[ActionType.AnnotationsEntryRemoved]: "0.4.0",
|
|
6727
|
+
[ActionType.RootTerminalsChanged]: "0.1.0",
|
|
6728
|
+
[ActionType.RootConfigChanged]: "0.1.0",
|
|
6729
|
+
[ActionType.TerminalData]: "0.1.0",
|
|
6730
|
+
[ActionType.TerminalInput]: "0.1.0",
|
|
6731
|
+
[ActionType.TerminalResized]: "0.1.0",
|
|
6732
|
+
[ActionType.TerminalClaimed]: "0.1.0",
|
|
6733
|
+
[ActionType.TerminalTitleChanged]: "0.1.0",
|
|
6734
|
+
[ActionType.TerminalCwdChanged]: "0.1.0",
|
|
6735
|
+
[ActionType.TerminalExited]: "0.1.0",
|
|
6736
|
+
[ActionType.TerminalCleared]: "0.1.0",
|
|
6737
|
+
[ActionType.TerminalCommandDetectionAvailable]: "0.1.0",
|
|
6738
|
+
[ActionType.TerminalCommandExecuted]: "0.1.0",
|
|
6739
|
+
[ActionType.TerminalCommandFinished]: "0.1.0",
|
|
6740
|
+
[ActionType.ResourceWatchChanged]: "0.2.0",
|
|
6741
|
+
[ActionType.AutomationCreateRequested]: "0.8.0",
|
|
6742
|
+
[ActionType.AutomationUpdateRequested]: "0.8.0",
|
|
6743
|
+
[ActionType.AutomationSet]: "0.8.0",
|
|
6744
|
+
[ActionType.AutomationRemoved]: "0.8.0",
|
|
6745
|
+
[ActionType.AutomationRunLifecycleChanged]: "0.8.0",
|
|
6746
|
+
[ActionType.AutomationRunSessionSet]: "0.8.0",
|
|
6747
|
+
[ActionType.AutomationRunSessionRemoved]: "0.8.0",
|
|
6748
|
+
[ActionType.AutomationRunPrimarySessionChanged]: "0.8.0",
|
|
6749
|
+
[ActionType.AutomationRunCancelRequested]: "0.8.0"
|
|
6750
|
+
};
|
|
6751
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-session/reducer.js
|
|
6752
|
+
var STATUS_ACTIVITY_MASK = (1 << 5) - 1;
|
|
6753
|
+
// ../../node_modules/.bun/@microsoft+agent-host-protocol@1.1.0/node_modules/@microsoft/agent-host-protocol/dist/types/channels-chat/reducer.js
|
|
6754
|
+
var STATUS_ACTIVITY_MASK2 = (1 << 5) - 1;
|
|
6598
6755
|
// ../ahp/src/source.ts
|
|
6599
6756
|
var SOURCE_ERROR_CODES = [
|
|
6600
6757
|
"SOURCE_UNBOUND",
|
|
@@ -6644,7 +6801,13 @@ var SourceObservationSchema = object({
|
|
|
6644
6801
|
}).strict();
|
|
6645
6802
|
var ReadArgs = object({ address: Address }).strict();
|
|
6646
6803
|
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({
|
|
6804
|
+
var AssignArgs = object({
|
|
6805
|
+
address: Address,
|
|
6806
|
+
ownerMemberId: Id,
|
|
6807
|
+
expectedOwner: Id.nullable(),
|
|
6808
|
+
intentId: Id,
|
|
6809
|
+
ifRevision: string2().min(1).max(256).optional()
|
|
6810
|
+
}).strict();
|
|
6648
6811
|
var WatchArgs = object({ on: boolean2() }).strict();
|
|
6649
6812
|
var Caller = object({ memberId: Id }).strict();
|
|
6650
6813
|
var request = (op, args) => object({ ...Binding, caller: Caller, op: literal(op), args }).strict();
|
|
@@ -6664,7 +6827,12 @@ var SourceListPageSchema = object({
|
|
|
6664
6827
|
progressAsOf: string2().min(1).max(64).optional(),
|
|
6665
6828
|
progressStale: object({ since: string2().min(1).max(64), reason: string2().min(1).max(4096) }).strict().optional()
|
|
6666
6829
|
}).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({
|
|
6830
|
+
var AssignReply = object({
|
|
6831
|
+
intentId: Id,
|
|
6832
|
+
result: unknown(),
|
|
6833
|
+
observation: SourceObservationSchema,
|
|
6834
|
+
revision: Id.nullable().optional()
|
|
6835
|
+
}).strict();
|
|
6668
6836
|
var BODIES = {
|
|
6669
6837
|
read: object({ observation: SourceObservationSchema }).strict(),
|
|
6670
6838
|
list: SourceListPageSchema,
|
|
@@ -6689,6 +6857,44 @@ var SourcePushSchema = object({ ...Binding, position: SourcePositionSchema, obse
|
|
|
6689
6857
|
return observations.every((one, index) => one.position.epoch === position.epoch && (index === 0 || BigInt(one.position.ordinal) === BigInt(observations[index - 1].position.ordinal) + 1n));
|
|
6690
6858
|
}, { message: "a push is one epoch of consecutive ordinals, numbered by its last" });
|
|
6691
6859
|
var SourceAckSchema = object({ applied: SourcePositionSchema.nullable(), seq: number2().int().min(0), relist: boolean2() }).strict();
|
|
6860
|
+
// ../ahp/src/records.ts
|
|
6861
|
+
var RECORDS_SCHEME = "x-hh-records";
|
|
6862
|
+
var RECORDS_CHANGED = `${RECORDS_SCHEME}/changed`;
|
|
6863
|
+
var RecordsAssignInputSchema = object({
|
|
6864
|
+
address: string2().min(1).max(1024),
|
|
6865
|
+
ownerMemberId: string2().min(1).max(256),
|
|
6866
|
+
expectedOwner: string2().min(1).max(256).nullable().optional(),
|
|
6867
|
+
ifRevision: string2().min(1).max(256),
|
|
6868
|
+
intentId: string2().min(1).max(256)
|
|
6869
|
+
}).strict();
|
|
6870
|
+
var SourceId = string2().min(1).max(256);
|
|
6871
|
+
var Address2 = string2().min(1).max(1024);
|
|
6872
|
+
var RecordsRecordSchema = object({
|
|
6873
|
+
address: Address2,
|
|
6874
|
+
revision: string2().min(1).max(256),
|
|
6875
|
+
scope: string2().min(1).max(256),
|
|
6876
|
+
columns: record(string2(), unknown()),
|
|
6877
|
+
extra: unknown().optional()
|
|
6878
|
+
}).strict();
|
|
6879
|
+
var RecordsSnapshotStateSchema = object({
|
|
6880
|
+
source: SourceId,
|
|
6881
|
+
epoch: string2().min(1).max(256),
|
|
6882
|
+
records: array(RecordsRecordSchema)
|
|
6883
|
+
}).strict();
|
|
6884
|
+
var RecordsChangedActionSchema = object({
|
|
6885
|
+
type: literal(RECORDS_CHANGED),
|
|
6886
|
+
source: SourceId,
|
|
6887
|
+
revision: string2().min(1).max(256),
|
|
6888
|
+
address: Address2,
|
|
6889
|
+
deleted: literal(true).optional(),
|
|
6890
|
+
record: RecordsRecordSchema.optional()
|
|
6891
|
+
}).strict();
|
|
6892
|
+
var RecordsActionNotificationSchema = object({
|
|
6893
|
+
channel: string2().min(1),
|
|
6894
|
+
serverSeq: number2().int().min(0).optional(),
|
|
6895
|
+
action: RecordsChangedActionSchema
|
|
6896
|
+
});
|
|
6897
|
+
var RECORDS_URI = new RegExp(`^${RECORDS_SCHEME}://[^/?#]+$`, "u");
|
|
6692
6898
|
// ../ahp/src/agent-records.ts
|
|
6693
6899
|
var AgentRecordRowSchema = object({
|
|
6694
6900
|
id: string2().min(1),
|
|
@@ -6722,7 +6928,9 @@ var MissingRefusalSchema = object({
|
|
|
6722
6928
|
data: object({ staleRevision: literal(0) })
|
|
6723
6929
|
});
|
|
6724
6930
|
// ../ahp/src/host-requests.ts
|
|
6725
|
-
var HOST_SCOPED_METHODS = ["subscribe", "x-ahpd/invokeOperation", "resourceRead"];
|
|
6931
|
+
var HOST_SCOPED_METHODS = ["subscribe", "x-ahpd/invokeOperation", "resourceRead", "listSessions", "authenticate"];
|
|
6932
|
+
var SERVICES_CHANNEL = "x-hh-services://";
|
|
6933
|
+
var SUBSCRIBE_CHANNELS = `${SERVICES_CHANNEL} and ${RECORDS_SCHEME}://<sourceId>`;
|
|
6726
6934
|
var HOST_REQUEST_METHODS = [
|
|
6727
6935
|
"x-ahpd/agents/list",
|
|
6728
6936
|
"x-ahpd/agents/put",
|
|
@@ -6742,1302 +6950,219 @@ var HostRequestMetaSchema = object({
|
|
|
6742
6950
|
}).strict();
|
|
6743
6951
|
var HOST_ANSWER_REASONS = ["unmapped", "timedOut", "outside"];
|
|
6744
6952
|
var HostAnswerReasonSchema = object({ reason: _enum(HOST_ANSWER_REASONS) }).strict();
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
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()
|
|
6953
|
+
var HostToolsServerSchema = object({
|
|
6954
|
+
resource: string2().min(1),
|
|
6955
|
+
customizationId: string2().min(1)
|
|
6789
6956
|
}).strict();
|
|
6790
|
-
var
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
|
|
6957
|
+
var HostToolsAnswerSchema = object({
|
|
6958
|
+
available: boolean2(),
|
|
6959
|
+
reason: string2().min(1).max(200).optional(),
|
|
6960
|
+
server: HostToolsServerSchema.optional()
|
|
6961
|
+
}).strict();
|
|
6962
|
+
var HostSessionRowSchema = object({
|
|
6963
|
+
resource: string2().min(1),
|
|
6964
|
+
_meta: object({
|
|
6965
|
+
"hh/agentMemberId": string2().min(1),
|
|
6966
|
+
"hh/hostTools": HostToolsAnswerSchema.optional()
|
|
6967
|
+
}).strict()
|
|
6968
|
+
}).strict();
|
|
6969
|
+
var HostSessionChangedSchema = object({
|
|
6970
|
+
channel: literal("ahp-root://"),
|
|
6795
6971
|
session: string2().min(1),
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
errorDetail: string2().max(256).optional()
|
|
6972
|
+
changes: object({
|
|
6973
|
+
_meta: object({
|
|
6974
|
+
"hh/agentMemberId": string2().min(1),
|
|
6975
|
+
"hh/hostTools": HostToolsAnswerSchema
|
|
6976
|
+
}).strict()
|
|
6977
|
+
}).strict()
|
|
6803
6978
|
}).strict();
|
|
6804
|
-
var
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
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;
|
|
6822
|
-
// ../members/src/host-join-types.ts
|
|
6823
|
-
var JOIN_ROUTE_REFUSAL_STATUS = {
|
|
6824
|
-
JOIN_LINK_INVALID: 410,
|
|
6825
|
-
JOIN_LINK_NOT_FOUND: 404,
|
|
6826
|
-
ROLE_NOT_ALLOWED: 400,
|
|
6827
|
-
NOT_A_MEMBER: 403,
|
|
6828
|
-
PEOPLE_LIMIT: 409,
|
|
6829
|
-
AGENTS_LIMIT: 409,
|
|
6830
|
-
FORBIDDEN: 403,
|
|
6831
|
-
HOST_REGISTRATION_CANCELLED: 410,
|
|
6832
|
-
HOST_REGISTRATION_CONFLICT: 409,
|
|
6833
|
-
AGENT_HOST_CONFLICT: 409,
|
|
6834
|
-
HOST_REGISTRATION_MISSING: 409,
|
|
6835
|
-
INVALID_REQUEST: 400,
|
|
6836
|
-
BAD_ORIGIN: 403,
|
|
6837
|
-
UNAUTHENTICATED: 401,
|
|
6838
|
-
WORKSPACE_NOT_FOUND: 404
|
|
6839
|
-
};
|
|
6840
|
-
function isJoinRouteRefusalCode(value) {
|
|
6841
|
-
return typeof value === "string" && Object.hasOwn(JOIN_ROUTE_REFUSAL_STATUS, value);
|
|
6842
|
-
}
|
|
6843
|
-
var id = string2().min(1).max(256);
|
|
6844
|
-
var digest = string2().regex(/^sha256:[a-f0-9]{64}$/u);
|
|
6845
|
-
var version2 = string2().min(1).max(64);
|
|
6846
|
-
var HostJoinRedemptionSchema = object({ code: string2(), credentialHash: digest, pluginVersion: version2, ahpdVersion: version2 }).strict();
|
|
6847
|
-
var HostJoinCommandSchema = object({
|
|
6848
|
-
workspaceId: id,
|
|
6849
|
-
hostId: id,
|
|
6850
|
-
ownerAccountId: id,
|
|
6851
|
-
credentialHash: digest,
|
|
6852
|
-
agentMemberIds: array(id),
|
|
6853
|
-
pluginVersion: version2,
|
|
6854
|
-
ahpdVersion: version2,
|
|
6855
|
-
registrationFingerprint: digest
|
|
6979
|
+
var HostAuthRequiredSchema = object({
|
|
6980
|
+
channel: string2().min(1),
|
|
6981
|
+
resource: string2().min(1),
|
|
6982
|
+
reason: literal("expired")
|
|
6856
6983
|
}).strict();
|
|
6857
|
-
|
|
6858
|
-
var
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
"
|
|
6887
|
-
"
|
|
6888
|
-
"
|
|
6889
|
-
"
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
var
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
function refusal(code) {
|
|
6915
|
-
throw new Error(code);
|
|
6916
|
-
}
|
|
6917
|
-
function errorCode(error) {
|
|
6918
|
-
return error !== null && typeof error === "object" && "code" in error && typeof error.code === "string" ? error.code : undefined;
|
|
6919
|
-
}
|
|
6920
|
-
async function privateHostDirectory(path) {
|
|
6921
|
-
await mkdir(path, { mode: 448 }).catch((error) => {
|
|
6922
|
-
if (errorCode(error) !== "EEXIST")
|
|
6923
|
-
refusal("HOST_JOIN_CUSTODY_IO");
|
|
6924
|
-
});
|
|
6925
|
-
const stat = await lstat(path);
|
|
6926
|
-
if (!stat.isDirectory() || stat.uid !== process.getuid?.() || (stat.mode & 63) !== 0) {
|
|
6927
|
-
refusal("HOST_JOIN_UNSAFE_PATH");
|
|
6928
|
-
}
|
|
6929
|
-
}
|
|
6930
|
-
async function flushDirectory(path) {
|
|
6931
|
-
const directory = await open2(path, constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW);
|
|
6932
|
-
try {
|
|
6933
|
-
await directory.sync();
|
|
6934
|
-
} finally {
|
|
6935
|
-
await directory.close();
|
|
6936
|
-
}
|
|
6937
|
-
}
|
|
6938
|
-
async function flushHostFile(path) {
|
|
6939
|
-
const file = await open2(path, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
6940
|
-
try {
|
|
6941
|
-
await file.sync();
|
|
6942
|
-
} finally {
|
|
6943
|
-
await file.close();
|
|
6944
|
-
}
|
|
6945
|
-
for (let directory = dirname(path);; directory = dirname(directory)) {
|
|
6946
|
-
await flushDirectory(directory);
|
|
6947
|
-
if (directory === dirname(directory))
|
|
6948
|
-
break;
|
|
6949
|
-
}
|
|
6950
|
-
}
|
|
6951
|
-
function canonicalIntent(input) {
|
|
6952
|
-
if (typeof input.origin !== "string" || typeof input.workspaceSlug !== "string" || typeof input.code !== "string" || typeof input.pluginVersion !== "string" || typeof input.ahpdVersion !== "string")
|
|
6953
|
-
refusal("HOST_JOIN_INVALID_INTENT");
|
|
6954
|
-
let origin;
|
|
6955
|
-
try {
|
|
6956
|
-
origin = new URL(input.origin);
|
|
6957
|
-
} catch {
|
|
6958
|
-
return refusal("HOST_JOIN_INVALID_INTENT");
|
|
6959
|
-
}
|
|
6960
|
-
const code = normalizeJoinCode(input.code);
|
|
6961
|
-
if (origin.protocol !== "https:" || origin.username || origin.password || origin.search || origin.hash || origin.pathname !== "/" || !code || !input.workspaceSlug || /[\s/\\?#]/u.test(input.workspaceSlug) || !input.pluginVersion || !input.ahpdVersion)
|
|
6962
|
-
refusal("HOST_JOIN_INVALID_INTENT");
|
|
6963
|
-
let ownerConfiguration;
|
|
6964
|
-
try {
|
|
6965
|
-
ownerConfiguration = JSON.parse(JSON.stringify(input.ownerConfiguration));
|
|
6966
|
-
} catch {
|
|
6967
|
-
return refusal("HOST_JOIN_INVALID_INTENT");
|
|
6968
|
-
}
|
|
6969
|
-
if (ownerConfiguration === null || typeof ownerConfiguration !== "object" || !isDeepStrictEqual(ownerConfiguration, input.ownerConfiguration))
|
|
6970
|
-
refusal("HOST_JOIN_INVALID_INTENT");
|
|
6971
|
-
return { ...input, origin: origin.origin, code, ownerConfiguration };
|
|
6972
|
-
}
|
|
6973
|
-
async function selectHostClaim(configHome, input) {
|
|
6974
|
-
const requested = canonicalIntent(input);
|
|
6975
|
-
let root;
|
|
6976
|
-
try {
|
|
6977
|
-
await mkdir(configHome, { recursive: true, mode: 448 });
|
|
6978
|
-
const stat = await lstat(configHome);
|
|
6979
|
-
if (!stat.isDirectory() || stat.uid !== process.getuid?.() || (stat.mode & 18) !== 0)
|
|
6980
|
-
refusal("HOST_JOIN_UNSAFE_PATH");
|
|
6981
|
-
root = await realpath(configHome);
|
|
6982
|
-
} catch {
|
|
6983
|
-
return refusal("HOST_JOIN_UNSAFE_PATH");
|
|
6984
|
+
// ../ahp/src/index.ts
|
|
6985
|
+
var HOST_TO_CLOUD_EVENTS = [
|
|
6986
|
+
"session/ready",
|
|
6987
|
+
"chat/turnStarted",
|
|
6988
|
+
"chat/turnComplete",
|
|
6989
|
+
"x-hh/turnFailed"
|
|
6990
|
+
];
|
|
6991
|
+
var BOUNDED_ERROR_CODES = [
|
|
6992
|
+
"OPERATION_NOT_ALLOWLISTED",
|
|
6993
|
+
"OPERATION_SHAPE_INVALID",
|
|
6994
|
+
"INVALID_OPERATION_SHAPE",
|
|
6995
|
+
"WORKSPACE_OR_MEMBER_UNKNOWN",
|
|
6996
|
+
"UNKNOWN_HOUSE_OR_MEMBER",
|
|
6997
|
+
"AGENT_NOT_MAPPED",
|
|
6998
|
+
"UNMAPPED_LOCAL_AGENT",
|
|
6999
|
+
"FOREIGN_SESSION",
|
|
7000
|
+
"FOREIGN_SESSION_REFUSED",
|
|
7001
|
+
"TOKEN_EXPIRED_OR_REVOKED",
|
|
7002
|
+
"HOST_REVOKED",
|
|
7003
|
+
"HOST_RESTARTED",
|
|
7004
|
+
"INPUT_REQUIRED",
|
|
7005
|
+
"APPROVAL_REQUIRED",
|
|
7006
|
+
"VERSION_UNSUPPORTED",
|
|
7007
|
+
"WAKE_NOT_SENT",
|
|
7008
|
+
"TURN_TIMED_OUT",
|
|
7009
|
+
"WAKE_TEXT_NOT_ALLOWED",
|
|
7010
|
+
"ROOM_ASKS_UNTRUSTED",
|
|
7011
|
+
"ASK_UNSIGNED",
|
|
7012
|
+
"KEY_NOT_FOR_AUTHOR",
|
|
7013
|
+
"ASK_STALE",
|
|
7014
|
+
"ASK_REPLAYED",
|
|
7015
|
+
"SERVICE_NOT_ALLOWED",
|
|
7016
|
+
"TURN_CANCELLED",
|
|
7017
|
+
...SOURCE_ERROR_CODES
|
|
7018
|
+
];
|
|
7019
|
+
var WAKE_TRIGGERS_MAX = 16;
|
|
7020
|
+
var WAKE_TRIGGER_BYTES_MAX = 48 * 1024;
|
|
7021
|
+
var WAKE_TRIGGERS_BYTES_MAX = 256 * 1024;
|
|
7022
|
+
var WakeTriggerSchema = object({
|
|
7023
|
+
id: string2().min(1),
|
|
7024
|
+
from: object({ memberId: string2().min(1) }).strict(),
|
|
7025
|
+
text: string2(),
|
|
7026
|
+
replyTo: string2().min(1).optional(),
|
|
7027
|
+
deleted: literal(true).optional(),
|
|
7028
|
+
signed: object({
|
|
7029
|
+
keyId: string2().min(1),
|
|
7030
|
+
createdAt: string2().min(1),
|
|
7031
|
+
signature: string2().min(1),
|
|
7032
|
+
clientId: string2().min(1),
|
|
7033
|
+
attachmentIds: array(string2().min(1))
|
|
7034
|
+
}).strict().optional()
|
|
7035
|
+
}).strict();
|
|
7036
|
+
var bytesOf = (value) => new TextEncoder().encode(JSON.stringify(value)).byteLength;
|
|
7037
|
+
var WakeTriggersSchema = array(WakeTriggerSchema).min(1).superRefine((triggers, ctx) => {
|
|
7038
|
+
if (triggers.length > WAKE_TRIGGERS_MAX) {
|
|
7039
|
+
ctx.addIssue({ code: "custom", message: `a wake carries at most ${WAKE_TRIGGERS_MAX} triggering envelopes, not ${triggers.length}` });
|
|
7040
|
+
return;
|
|
6984
7041
|
}
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
const home = join(claims, scope);
|
|
6989
|
-
const daemon = join(home, "ahpd");
|
|
6990
|
-
try {
|
|
6991
|
-
for (const directory of [application, claims, home, daemon])
|
|
6992
|
-
await privateHostDirectory(directory);
|
|
6993
|
-
const vaultFile = join(daemon, "vault.json");
|
|
6994
|
-
const candidate = await mkdtemp(join(daemon, ".claim-"));
|
|
6995
|
-
try {
|
|
6996
|
-
const candidateVault = join(candidate, "vault.json");
|
|
6997
|
-
const vault = fileVault({ file: candidateVault });
|
|
6998
|
-
await vault.set("host:hightea", `Bearer ${randomBytes(32).toString("base64url")}`);
|
|
6999
|
-
await vault.set("host:hightea-join", JSON.stringify({ schema: 1, ...requested }));
|
|
7000
|
-
try {
|
|
7001
|
-
await link(candidateVault, vaultFile);
|
|
7002
|
-
} catch (error) {
|
|
7003
|
-
if (errorCode(error) !== "EEXIST")
|
|
7004
|
-
refusal("HOST_JOIN_CUSTODY_PUBLICATION_FAILED");
|
|
7005
|
-
}
|
|
7006
|
-
const stat = await lstat(vaultFile);
|
|
7007
|
-
if (!stat.isFile() || stat.uid !== process.getuid?.() || (stat.mode & 511) !== 384)
|
|
7008
|
-
refusal("HOST_JOIN_UNSAFE_PATH");
|
|
7009
|
-
const selected = fileVault({ file: vaultFile });
|
|
7010
|
-
const authorization = await selected.get("host:hightea");
|
|
7011
|
-
const saved = await selected.get("host:hightea-join");
|
|
7012
|
-
if (!authorization || !/^Bearer [A-Za-z0-9_-]{43}$/u.test(authorization) || !saved)
|
|
7013
|
-
refusal("HOST_JOIN_CLAIM_CORRUPT");
|
|
7014
|
-
let metadata;
|
|
7015
|
-
try {
|
|
7016
|
-
metadata = JSON.parse(saved);
|
|
7017
|
-
} catch {
|
|
7018
|
-
return refusal("HOST_JOIN_CLAIM_CORRUPT");
|
|
7019
|
-
}
|
|
7020
|
-
if (!metadata || typeof metadata !== "object" || !("schema" in metadata) || metadata.schema !== 1)
|
|
7021
|
-
refusal("HOST_JOIN_CLAIM_CORRUPT");
|
|
7022
|
-
let original;
|
|
7023
|
-
try {
|
|
7024
|
-
original = canonicalIntent(metadata);
|
|
7025
|
-
} catch {
|
|
7026
|
-
return refusal("HOST_JOIN_CLAIM_CORRUPT");
|
|
7027
|
-
}
|
|
7028
|
-
if (original.origin !== requested.origin || original.workspaceSlug !== requested.workspaceSlug || original.code !== requested.code || !isDeepStrictEqual(original.ownerConfiguration, requested.ownerConfiguration))
|
|
7029
|
-
refusal("HOST_JOIN_CLAIM_CONFLICT");
|
|
7030
|
-
await flushHostFile(vaultFile);
|
|
7031
|
-
return { home, vaultFile, authorization, credentialHash: `sha256:${createHash("sha256").update(authorization.slice(7), "utf8").digest("hex")}`, intent: original };
|
|
7032
|
-
} finally {
|
|
7033
|
-
await rm(candidate, { recursive: true });
|
|
7034
|
-
}
|
|
7035
|
-
} catch (error) {
|
|
7036
|
-
if (error instanceof Error && /^HOST_JOIN_[A-Z_]+$/u.test(error.message))
|
|
7037
|
-
throw error;
|
|
7038
|
-
return refusal("HOST_JOIN_CUSTODY_IO");
|
|
7042
|
+
if (new Set(triggers.map((trigger) => trigger.id)).size !== triggers.length) {
|
|
7043
|
+
ctx.addIssue({ code: "custom", message: "a wake names each triggering message once" });
|
|
7044
|
+
return;
|
|
7039
7045
|
}
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
import { isRecordSlug, readJsonObject, writeJsonAtomic } from "@ahpd/sdk";
|
|
7047
|
-
async function saveHostConfiguration(claim, configuration) {
|
|
7048
|
-
return saveHostJson(claim, join2(claim.home, "ahpd"), "config.json", configuration);
|
|
7049
|
-
}
|
|
7050
|
-
async function saveHostAgentRecord(claim, record) {
|
|
7051
|
-
if (!isRecordSlug(record.id))
|
|
7052
|
-
throw new Error("HOST_JOIN_CONFIG_CONFLICT");
|
|
7053
|
-
const directory = join2(claim.home, "ahpd", "agents");
|
|
7054
|
-
await privateHostDirectory(directory);
|
|
7055
|
-
await saveHostJson(claim, directory, `${record.id}.json`, { ...record });
|
|
7056
|
-
}
|
|
7057
|
-
async function saveHostJson(claim, directory, name, configuration) {
|
|
7058
|
-
const destination = join2(directory, name);
|
|
7059
|
-
let candidate;
|
|
7060
|
-
try {
|
|
7061
|
-
if (JSON.stringify(configuration).includes(claim.authorization))
|
|
7062
|
-
throw new Error("HOST_JOIN_CONFIG_SECRET");
|
|
7063
|
-
candidate = await mkdtemp2(join2(directory, ".config-"));
|
|
7064
|
-
const staged = join2(candidate, "config.json");
|
|
7065
|
-
writeJsonAtomic(staged, configuration, { mode: 384 });
|
|
7066
|
-
try {
|
|
7067
|
-
await link2(staged, destination);
|
|
7068
|
-
} catch (error) {
|
|
7069
|
-
if (!error || typeof error !== "object" || !("code" in error) || error.code !== "EEXIST")
|
|
7070
|
-
throw new Error("HOST_JOIN_CONFIG_PUBLICATION_FAILED");
|
|
7071
|
-
}
|
|
7072
|
-
const stat = await lstat2(destination);
|
|
7073
|
-
if (!stat.isFile() || stat.uid !== process.getuid?.() || (stat.mode & 511) !== 384)
|
|
7074
|
-
throw new Error("HOST_JOIN_UNSAFE_PATH");
|
|
7075
|
-
const existing = readJsonObject(destination);
|
|
7076
|
-
if (!existing.ok)
|
|
7077
|
-
throw new Error("HOST_JOIN_CONFIG_CORRUPT");
|
|
7078
|
-
const backfill = {};
|
|
7079
|
-
for (const [key, value] of Object.entries(configuration)) {
|
|
7080
|
-
const restriction = key === "unattendedAutoApprove" && value === false || key === "pluginMarketplaces" && Array.isArray(value) && value.length === 0;
|
|
7081
|
-
if (name === "config.json" && restriction && !Object.hasOwn(existing.value, key)) {
|
|
7082
|
-
backfill[key] = value;
|
|
7083
|
-
continue;
|
|
7084
|
-
}
|
|
7085
|
-
if (!isDeepStrictEqual2(existing.value[key], value))
|
|
7086
|
-
throw new Error("HOST_JOIN_CONFIG_CONFLICT");
|
|
7087
|
-
}
|
|
7088
|
-
if (Object.keys(backfill).length > 0) {
|
|
7089
|
-
writeJsonAtomic(destination, { ...existing.value, ...backfill }, { mode: 384 });
|
|
7046
|
+
let total = 0;
|
|
7047
|
+
for (const trigger of triggers) {
|
|
7048
|
+
const size = bytesOf(trigger);
|
|
7049
|
+
if (size > WAKE_TRIGGER_BYTES_MAX) {
|
|
7050
|
+
ctx.addIssue({ code: "custom", message: `triggering envelope ${trigger.id} is ${size} bytes, over the ${WAKE_TRIGGER_BYTES_MAX}-byte limit` });
|
|
7051
|
+
return;
|
|
7090
7052
|
}
|
|
7091
|
-
|
|
7092
|
-
return destination;
|
|
7093
|
-
} catch (error) {
|
|
7094
|
-
if (error instanceof Error && /^HOST_JOIN_[A-Z_]+$/u.test(error.message))
|
|
7095
|
-
throw error;
|
|
7096
|
-
throw new Error("HOST_JOIN_CONFIG_IO");
|
|
7097
|
-
} finally {
|
|
7098
|
-
if (candidate !== undefined)
|
|
7099
|
-
await rm2(candidate, { recursive: true });
|
|
7100
|
-
}
|
|
7101
|
-
}
|
|
7102
|
-
|
|
7103
|
-
// ../ahp-host/src/join.ts
|
|
7104
|
-
import { isRecord } from "@ahpd/sdk";
|
|
7105
|
-
class HostJoinRefusal extends Error {
|
|
7106
|
-
kind;
|
|
7107
|
-
status;
|
|
7108
|
-
serverCode;
|
|
7109
|
-
constructor(kind, status, serverCode) {
|
|
7110
|
-
super(kind);
|
|
7111
|
-
this.kind = kind;
|
|
7112
|
-
this.status = status;
|
|
7113
|
-
this.serverCode = serverCode;
|
|
7114
|
-
}
|
|
7115
|
-
}
|
|
7116
|
-
function refusalKind(status, serverCode) {
|
|
7117
|
-
if (status === 401 || status === 403)
|
|
7118
|
-
return "HOST_JOIN_NOT_AUTHORISED";
|
|
7119
|
-
if (serverCode === "AGENT_HOST_CONFLICT" || serverCode === "HOST_REGISTRATION_CONFLICT")
|
|
7120
|
-
return "HOST_JOIN_AGENT_BOUND";
|
|
7121
|
-
return "HOST_JOIN_REJECTED";
|
|
7122
|
-
}
|
|
7123
|
-
async function redeemHostClaim(claim) {
|
|
7124
|
-
await flushHostFile(claim.vaultFile);
|
|
7125
|
-
const intent = claim.intent;
|
|
7126
|
-
const request = new Request(`${intent.origin}/api/ws/${encodeURIComponent(intent.workspaceSlug)}/join/${encodeURIComponent(intent.code)}`, {
|
|
7127
|
-
method: "POST",
|
|
7128
|
-
redirect: "error",
|
|
7129
|
-
headers: { "content-type": "application/json" },
|
|
7130
|
-
signal: AbortSignal.timeout(1e4),
|
|
7131
|
-
body: JSON.stringify({ credentialHash: claim.credentialHash, pluginVersion: intent.pluginVersion, ahpdVersion: intent.ahpdVersion })
|
|
7132
|
-
});
|
|
7133
|
-
let response;
|
|
7134
|
-
try {
|
|
7135
|
-
response = await fetch(request);
|
|
7136
|
-
} catch {
|
|
7137
|
-
throw new Error("HOST_JOIN_NETWORK_UNKNOWN");
|
|
7053
|
+
total += size;
|
|
7138
7054
|
}
|
|
7139
|
-
if (
|
|
7140
|
-
|
|
7141
|
-
try {
|
|
7142
|
-
error = await response.json();
|
|
7143
|
-
} catch {}
|
|
7144
|
-
if (isRecord(error) && isRecord(error.error) && error.error.code === "HOST_REGISTRATION_CANCELLED")
|
|
7145
|
-
throw new Error("HOST_JOIN_CANCELLED");
|
|
7146
|
-
throw new Error("HOST_JOIN_LINK_UNAVAILABLE");
|
|
7147
|
-
}
|
|
7148
|
-
if (response.status >= 500)
|
|
7149
|
-
throw new Error("HOST_JOIN_REMOTE_UNAVAILABLE");
|
|
7150
|
-
if (!response.ok) {
|
|
7151
|
-
let error;
|
|
7152
|
-
try {
|
|
7153
|
-
error = await response.json();
|
|
7154
|
-
} catch {}
|
|
7155
|
-
const serverCode = isRecord(error) && isRecord(error.error) && isJoinRouteRefusalCode(error.error.code) ? error.error.code : undefined;
|
|
7156
|
-
throw new HostJoinRefusal(refusalKind(response.status, serverCode), response.status, serverCode);
|
|
7055
|
+
if (total > WAKE_TRIGGERS_BYTES_MAX) {
|
|
7056
|
+
ctx.addIssue({ code: "custom", message: `the triggering envelopes take ${total} bytes, over the ${WAKE_TRIGGERS_BYTES_MAX}-byte limit` });
|
|
7157
7057
|
}
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7058
|
+
});
|
|
7059
|
+
var WakeMetaSchema = object({
|
|
7060
|
+
workspaceId: string2().min(1),
|
|
7061
|
+
deliveryId: string2().min(1),
|
|
7062
|
+
turnId: string2().min(1).optional(),
|
|
7063
|
+
agentMemberId: string2().min(1),
|
|
7064
|
+
threadRef: string2().min(1),
|
|
7065
|
+
afterMessageId: string2().min(1).optional(),
|
|
7066
|
+
triggeringMessageIds: array(string2().min(1)).min(1).refine((ids) => new Set(ids).size === ids.length).optional(),
|
|
7067
|
+
triggering: WakeTriggersSchema.optional(),
|
|
7068
|
+
agentToken: string2().min(1).max(4096).optional()
|
|
7069
|
+
}).strict().superRefine((meta, ctx) => {
|
|
7070
|
+
if (meta.agentToken !== undefined && meta.triggering !== undefined) {
|
|
7071
|
+
ctx.addIssue({ code: "custom", message: "a wake carries its triggering envelopes or the older bearer, never both" });
|
|
7163
7072
|
}
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7073
|
+
});
|
|
7074
|
+
var HostToCloudFrameSchema = object({
|
|
7075
|
+
event: _enum(HOST_TO_CLOUD_EVENTS),
|
|
7076
|
+
channel: string2().min(1),
|
|
7077
|
+
workspaceId: string2().min(1),
|
|
7078
|
+
deliveryId: string2().min(1),
|
|
7079
|
+
session: string2().min(1),
|
|
7080
|
+
chat: string2().min(1),
|
|
7081
|
+
turnId: string2().min(1).optional(),
|
|
7082
|
+
clientSeq: number2().int().min(1).optional(),
|
|
7083
|
+
turnState: _enum(["created", "running", "finished", "error"]),
|
|
7084
|
+
statusCode: string2().min(1).max(64),
|
|
7085
|
+
errorCode: _enum(BOUNDED_ERROR_CODES).optional(),
|
|
7086
|
+
errorDetail: string2().max(256).optional()
|
|
7087
|
+
}).strict();
|
|
7088
|
+
var HOST_ACTION_TYPES = [
|
|
7089
|
+
"session/ready",
|
|
7090
|
+
"chat/turnStarted",
|
|
7091
|
+
"chat/turnComplete",
|
|
7092
|
+
"chat/turnCancelled",
|
|
7093
|
+
"chat/error"
|
|
7094
|
+
];
|
|
7095
|
+
var HostActionNotificationSchema = object({
|
|
7096
|
+
channel: string2().min(1),
|
|
7097
|
+
serverSeq: number2().int().min(0).optional(),
|
|
7098
|
+
origin: object({ clientId: string2().min(1), clientSeq: number2().int().min(1) }).optional(),
|
|
7099
|
+
action: object({
|
|
7100
|
+
type: _enum(HOST_ACTION_TYPES),
|
|
7101
|
+
turnId: string2().min(1).optional(),
|
|
7102
|
+
part: object({ error: object({ errorType: string2().min(1) }) }).optional()
|
|
7103
|
+
})
|
|
7104
|
+
});
|
|
7105
|
+
var HOST_HEADER = "Hightea-Host";
|
|
7106
|
+
var LEGACY_HOST_HEADER = "x-hightea-host";
|
|
7168
7107
|
|
|
7169
|
-
// ../
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
import { fromEnvRef, isRecord as isRecord2, isRecordSlug as isRecordSlug2, readJsonObject as readJsonObject2, scopeOf, secretPaths, secretRef } from "@ahpd/sdk";
|
|
7175
|
-
import { checkManifest, checkStandalone, readManifest, readStandalone, resolvePlugin } from "@ahpd/server/dist/plugins.js";
|
|
7176
|
-
function fail(code = "HOST_JOIN_OWNER_RESOURCE") {
|
|
7177
|
-
throw new Error(code);
|
|
7178
|
-
}
|
|
7179
|
-
function reference(value) {
|
|
7180
|
-
const variable = fromEnvRef(value);
|
|
7181
|
-
if (variable !== undefined) {
|
|
7182
|
-
if (!process.env[variable])
|
|
7183
|
-
fail();
|
|
7184
|
-
return true;
|
|
7185
|
-
}
|
|
7186
|
-
const secret = secretRef(value);
|
|
7187
|
-
if (secret === undefined)
|
|
7188
|
-
return false;
|
|
7189
|
-
scopeOf(secret);
|
|
7190
|
-
return true;
|
|
7191
|
-
}
|
|
7192
|
-
async function executable(command) {
|
|
7193
|
-
const candidates = isAbsolute(command) ? [command] : (process.env.PATH ?? "").split(delimiter).map((path) => join3(path, command));
|
|
7108
|
+
// ../members/src/agent-token.ts
|
|
7109
|
+
var AGENT_TOKEN_TTL_MS = 15 * 60 * 1000;
|
|
7110
|
+
// ../ahp-host/src/apps.ts
|
|
7111
|
+
async function executable(command, pathValue) {
|
|
7112
|
+
const candidates = isAbsolute(command) ? [command] : pathValue.split(delimiter).filter((path) => path !== "").map((path) => join(path, command));
|
|
7194
7113
|
for (const candidate of candidates) {
|
|
7195
7114
|
try {
|
|
7196
|
-
await access(candidate,
|
|
7115
|
+
await access(candidate, constants.X_OK);
|
|
7197
7116
|
if ((await stat(candidate)).isFile())
|
|
7198
|
-
return;
|
|
7117
|
+
return true;
|
|
7199
7118
|
} catch {}
|
|
7200
7119
|
}
|
|
7201
|
-
|
|
7202
|
-
}
|
|
7203
|
-
async function readOwnerConfiguration(file) {
|
|
7204
|
-
const read = readJsonObject2(file);
|
|
7205
|
-
if (!read.ok)
|
|
7206
|
-
fail("HOST_JOIN_OWNER_INPUT");
|
|
7207
|
-
const body = read.value;
|
|
7208
|
-
if (!Array.isArray(body.agents) || body.agents.length === 0 || !Array.isArray(body.plugins) || body.plugins.length === 0 || !Array.isArray(body.records))
|
|
7209
|
-
fail();
|
|
7210
|
-
const engines = new Set;
|
|
7211
|
-
const direct = new Set;
|
|
7212
|
-
const plugins = [];
|
|
7213
|
-
try {
|
|
7214
|
-
for (const value of body.plugins) {
|
|
7215
|
-
const entry = typeof value === "string" ? { source: value } : value;
|
|
7216
|
-
if (!isRecord2(entry) || typeof entry.source !== "string" || entry.enabled === false)
|
|
7217
|
-
fail();
|
|
7218
|
-
const spec = entry;
|
|
7219
|
-
const resolved = resolvePlugin(spec, { cwd: dirname2(file), configDir: dirname2(file) });
|
|
7220
|
-
if (!resolved.path || !(await stat(resolved.path)).isFile())
|
|
7221
|
-
fail();
|
|
7222
|
-
const manifest = resolved.manifestPath ? readStandalone(resolved.manifestPath) : resolved.packageDir ? readManifest(resolved.packageDir) : undefined;
|
|
7223
|
-
if (!manifest || manifest.problem || (manifest.standalone ? checkStandalone(manifest) : checkManifest(manifest, resolved.packageDir)))
|
|
7224
|
-
fail();
|
|
7225
|
-
if (manifest.name === "@ahpd/bot" || manifest.name === "bot")
|
|
7226
|
-
fail("HOST_JOIN_OWNER_BOT");
|
|
7227
|
-
for (const name of manifest.contracts?.engines ?? [])
|
|
7228
|
-
engines.add(name);
|
|
7229
|
-
for (const name of manifest.contracts?.agents ?? [])
|
|
7230
|
-
direct.add(name);
|
|
7231
|
-
if (entry.options !== undefined && !isRecord2(entry.options))
|
|
7232
|
-
fail();
|
|
7233
|
-
const options = isRecord2(entry.options) ? entry.options : {};
|
|
7234
|
-
for (const path of secretPaths(manifest.optionsSchema ?? {}, options)) {
|
|
7235
|
-
let held = options;
|
|
7236
|
-
for (const part of path.split("."))
|
|
7237
|
-
held = isRecord2(held) ? held[part] : undefined;
|
|
7238
|
-
if (held !== undefined && !reference(held))
|
|
7239
|
-
fail("HOST_JOIN_OWNER_SECRET");
|
|
7240
|
-
}
|
|
7241
|
-
plugins.push({ ...entry, source: resolved.manifestPath ?? resolved.packageDir ?? resolved.path });
|
|
7242
|
-
}
|
|
7243
|
-
const records = [];
|
|
7244
|
-
const providers = new Set(direct);
|
|
7245
|
-
for (const record of body.records) {
|
|
7246
|
-
if (!isRecord2(record) || typeof record.id !== "string" || !isRecordSlug2(record.id) || providers.has(record.id) || typeof record.engine !== "string" || !engines.has(record.engine) || typeof record.owner !== "string" || typeof record.name !== "string" || !isRecord2(record.config) || record.mode !== undefined && record.mode !== "enabled")
|
|
7247
|
-
fail();
|
|
7248
|
-
if (record.model !== undefined && (typeof record.model !== "string" || record.model.trim() === ""))
|
|
7249
|
-
fail();
|
|
7250
|
-
if (record.engine === "acp" && typeof record.config.command !== "string")
|
|
7251
|
-
fail();
|
|
7252
|
-
if (record.config.command !== undefined) {
|
|
7253
|
-
if (typeof record.config.command !== "string" || !record.config.command)
|
|
7254
|
-
fail();
|
|
7255
|
-
await executable(record.config.command);
|
|
7256
|
-
}
|
|
7257
|
-
if (record.config.env !== undefined) {
|
|
7258
|
-
if (!isRecord2(record.config.env))
|
|
7259
|
-
fail();
|
|
7260
|
-
for (const value of Object.values(record.config.env))
|
|
7261
|
-
if (!reference(value))
|
|
7262
|
-
fail("HOST_JOIN_OWNER_SECRET");
|
|
7263
|
-
}
|
|
7264
|
-
providers.add(record.id);
|
|
7265
|
-
records.push(record);
|
|
7266
|
-
}
|
|
7267
|
-
const agents = [];
|
|
7268
|
-
const members = new Set;
|
|
7269
|
-
for (const entry of body.agents) {
|
|
7270
|
-
if (!Array.isArray(entry) || entry.length !== 2 || typeof entry[0] !== "string" || !entry[0] || members.has(entry[0]) || !isRecord2(entry[1]) || typeof entry[1].provider !== "string" || !providers.has(entry[1].provider) || typeof entry[1].workingDirectory !== "string")
|
|
7271
|
-
fail();
|
|
7272
|
-
const work = new URL(entry[1].workingDirectory);
|
|
7273
|
-
if (work.protocol !== "file:" || work.hostname || !(await stat(fileURLToPath(work))).isDirectory())
|
|
7274
|
-
fail();
|
|
7275
|
-
members.add(entry[0]);
|
|
7276
|
-
agents.push([entry[0], { provider: entry[1].provider, workingDirectory: work.href }]);
|
|
7277
|
-
}
|
|
7278
|
-
return { agents, plugins, records };
|
|
7279
|
-
} catch (error) {
|
|
7280
|
-
if (error instanceof Error && /^HOST_JOIN_OWNER_[A-Z_]+$/u.test(error.message))
|
|
7281
|
-
throw error;
|
|
7282
|
-
return fail();
|
|
7283
|
-
}
|
|
7284
|
-
}
|
|
7285
|
-
|
|
7286
|
-
// ../ahp-host/src/plugin-bundle.ts
|
|
7287
|
-
import { createHash as createHash2 } from "node:crypto";
|
|
7288
|
-
import { lstat as lstat3, mkdir as mkdir2, mkdtemp as mkdtemp3, readFile, rename, rm as rm3, writeFile } from "node:fs/promises";
|
|
7289
|
-
import { isAbsolute as isAbsolute2, join as join4, normalize } from "node:path";
|
|
7290
|
-
var PLUGIN_ID = "hightea-pipe";
|
|
7291
|
-
var RECORD = "bundle.json";
|
|
7292
|
-
function pluginBundleRoot(dataHome) {
|
|
7293
|
-
return join4(dataHome, "hightea", "plugins");
|
|
7294
|
-
}
|
|
7295
|
-
async function readSource(source) {
|
|
7296
|
-
let manifestBytes;
|
|
7297
|
-
try {
|
|
7298
|
-
manifestBytes = await readFile(join4(source, "plugin.json"));
|
|
7299
|
-
} catch {
|
|
7300
|
-
throw new Error("HOST_JOIN_PLUGIN_BUNDLE");
|
|
7301
|
-
}
|
|
7302
|
-
let manifest;
|
|
7303
|
-
try {
|
|
7304
|
-
manifest = JSON.parse(manifestBytes.toString("utf8"));
|
|
7305
|
-
} catch {
|
|
7306
|
-
throw new Error("HOST_JOIN_PLUGIN_BUNDLE");
|
|
7307
|
-
}
|
|
7308
|
-
const main = typeof manifest === "object" && manifest !== null && "main" in manifest ? manifest.main : undefined;
|
|
7309
|
-
const id = typeof manifest === "object" && manifest !== null && "id" in manifest ? manifest.id : undefined;
|
|
7310
|
-
const version = typeof manifest === "object" && manifest !== null && "version" in manifest ? manifest.version : undefined;
|
|
7311
|
-
if (id !== PLUGIN_ID || typeof version !== "string" || typeof main !== "string" || isAbsolute2(main) || normalize(main).startsWith("..") || normalize(main).includes("/") || ["plugin.json", RECORD].includes(normalize(main))) {
|
|
7312
|
-
throw new Error("HOST_JOIN_PLUGIN_BUNDLE");
|
|
7313
|
-
}
|
|
7314
|
-
let mainBytes;
|
|
7315
|
-
try {
|
|
7316
|
-
mainBytes = await readFile(join4(source, main));
|
|
7317
|
-
} catch {
|
|
7318
|
-
throw new Error("HOST_JOIN_PLUGIN_BUNDLE");
|
|
7319
|
-
}
|
|
7320
|
-
return { manifestBytes, version, main: normalize(main), mainBytes, sha256: bundleHash(manifestBytes, mainBytes) };
|
|
7321
|
-
}
|
|
7322
|
-
function bundleHash(manifestBytes, mainBytes) {
|
|
7323
|
-
return createHash2("sha256").update(manifestBytes).update("\x00").update(mainBytes).digest("hex");
|
|
7324
|
-
}
|
|
7325
|
-
async function readInstalledBundle(manifest) {
|
|
7326
|
-
const directory = join4(manifest, "..");
|
|
7327
|
-
let record;
|
|
7328
|
-
try {
|
|
7329
|
-
record = JSON.parse(await readFile(join4(directory, RECORD), "utf8"));
|
|
7330
|
-
} catch (error) {
|
|
7331
|
-
return { ok: false, reason: isMissing(error) ? "missing" : "corrupt" };
|
|
7332
|
-
}
|
|
7333
|
-
let source;
|
|
7334
|
-
try {
|
|
7335
|
-
source = await readSource(directory);
|
|
7336
|
-
} catch {
|
|
7337
|
-
return { ok: false, reason: "corrupt" };
|
|
7338
|
-
}
|
|
7339
|
-
if (typeof record !== "object" || record === null || !("version" in record) || !("sha256" in record) || typeof record.version !== "string" || record.sha256 !== source.sha256)
|
|
7340
|
-
return { ok: false, reason: "corrupt" };
|
|
7341
|
-
return { ok: true, bundle: { manifest, version: record.version, sha256: source.sha256 } };
|
|
7342
|
-
}
|
|
7343
|
-
async function installPluginBundle(dataHome, source, version) {
|
|
7344
|
-
if (!isAbsolute2(dataHome) || !/^[0-9A-Za-z.+-]+$/u.test(version))
|
|
7345
|
-
throw new Error("HOST_JOIN_UNSAFE_PATH");
|
|
7346
|
-
const wanted = await readSource(source);
|
|
7347
|
-
if (wanted.version !== version)
|
|
7348
|
-
throw new Error("HOST_JOIN_PLUGIN_BUNDLE");
|
|
7349
|
-
try {
|
|
7350
|
-
await mkdir2(dataHome, { recursive: true, mode: 448 });
|
|
7351
|
-
const stat = await lstat3(dataHome);
|
|
7352
|
-
if (!stat.isDirectory() || stat.uid !== process.getuid?.() || (stat.mode & 18) !== 0)
|
|
7353
|
-
throw new Error("unsafe");
|
|
7354
|
-
} catch {
|
|
7355
|
-
throw new Error("HOST_JOIN_UNSAFE_PATH");
|
|
7356
|
-
}
|
|
7357
|
-
const root = pluginBundleRoot(dataHome);
|
|
7358
|
-
for (const directory of [join4(dataHome, "hightea"), root])
|
|
7359
|
-
await privateHostDirectory(directory);
|
|
7360
|
-
const destination = join4(root, version);
|
|
7361
|
-
const manifest = join4(destination, "plugin.json");
|
|
7362
|
-
if (!await exists(destination)) {
|
|
7363
|
-
const staged = await mkdtemp3(join4(root, `.${version}-`));
|
|
7364
|
-
try {
|
|
7365
|
-
await writeFile(join4(staged, "plugin.json"), wanted.manifestBytes, { mode: 384 });
|
|
7366
|
-
await writeFile(join4(staged, wanted.main), wanted.mainBytes, { mode: 384 });
|
|
7367
|
-
await writeFile(join4(staged, RECORD), `${JSON.stringify({ version, sha256: wanted.sha256 })}
|
|
7368
|
-
`, { mode: 384 });
|
|
7369
|
-
try {
|
|
7370
|
-
await rename(staged, destination);
|
|
7371
|
-
} catch (error) {
|
|
7372
|
-
if (!isCode(error, "EEXIST") && !isCode(error, "ENOTEMPTY"))
|
|
7373
|
-
throw new Error("HOST_JOIN_CONFIG_IO");
|
|
7374
|
-
}
|
|
7375
|
-
} finally {
|
|
7376
|
-
await rm3(staged, { recursive: true, force: true });
|
|
7377
|
-
}
|
|
7378
|
-
}
|
|
7379
|
-
const installed = await readInstalledBundle(manifest);
|
|
7380
|
-
if (!installed.ok || installed.bundle.sha256 !== wanted.sha256 || installed.bundle.version !== version) {
|
|
7381
|
-
throw new Error("HOST_JOIN_PLUGIN_BUNDLE_CONFLICT");
|
|
7382
|
-
}
|
|
7383
|
-
return installed.bundle;
|
|
7384
|
-
}
|
|
7385
|
-
async function exists(path) {
|
|
7386
|
-
try {
|
|
7387
|
-
await lstat3(path);
|
|
7388
|
-
return true;
|
|
7389
|
-
} catch (error) {
|
|
7390
|
-
if (isMissing(error))
|
|
7391
|
-
return false;
|
|
7392
|
-
throw new Error("HOST_JOIN_UNSAFE_PATH");
|
|
7393
|
-
}
|
|
7394
|
-
}
|
|
7395
|
-
function isMissing(error) {
|
|
7396
|
-
return isCode(error, "ENOENT");
|
|
7397
|
-
}
|
|
7398
|
-
function isCode(error, code) {
|
|
7399
|
-
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
7400
|
-
}
|
|
7401
|
-
|
|
7402
|
-
// ../ahp-host/src/ask-gate.ts
|
|
7403
|
-
import { createPrivateKey, createPublicKey, generateKeyPairSync, sign as sign2 } from "node:crypto";
|
|
7404
|
-
import { appendFile, chmod, readFile as readFile2, rename as rename2, writeFile as writeFile2 } from "node:fs/promises";
|
|
7405
|
-
import { join as join6 } from "node:path";
|
|
7406
|
-
|
|
7407
|
-
// ../ahp-host/src/signed-asks.ts
|
|
7408
|
-
var ED25519_SPKI_HEADER = Buffer.from("302a300506032b6570032100", "hex");
|
|
7409
|
-
|
|
7410
|
-
// ../ahp-host/src/trusted-keys.ts
|
|
7411
|
-
import { createHash as createHash3 } from "node:crypto";
|
|
7412
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
7413
|
-
import { join as join5 } from "node:path";
|
|
7414
|
-
var TRUSTED_KEYS_FILE = "trusted-keys.json";
|
|
7415
|
-
var TRUSTED_KEY_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/u;
|
|
7416
|
-
var BASE64URL_32_BYTES = /^[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$/u;
|
|
7417
|
-
var base64url2 = (bytes) => Buffer.from(bytes).toString("base64url");
|
|
7418
|
-
function trustedKeyId(publicKey) {
|
|
7419
|
-
if (!BASE64URL_32_BYTES.test(publicKey)) {
|
|
7420
|
-
return { error: "TRUST_KEY_INVALID: the public key must be 43 base64url characters (a raw 32-byte Ed25519 key), as the browser's Members page shows it" };
|
|
7421
|
-
}
|
|
7422
|
-
return { keyId: base64url2(createHash3("sha256").update(Buffer.from(publicKey, "base64url")).digest()) };
|
|
7423
|
-
}
|
|
7424
|
-
function readTrustedKeys(configDir) {
|
|
7425
|
-
const file = join5(configDir, TRUSTED_KEYS_FILE);
|
|
7426
|
-
if (!existsSync(file))
|
|
7427
|
-
return { state: "missing", file };
|
|
7428
|
-
let parsed;
|
|
7429
|
-
try {
|
|
7430
|
-
parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
7431
|
-
} catch (error) {
|
|
7432
|
-
throw new Error(`TRUST_FILE_UNREADABLE: ${file} is not JSON (${error.message})`);
|
|
7433
|
-
}
|
|
7434
|
-
const record = parsed;
|
|
7435
|
-
if (typeof parsed !== "object" || parsed === null || record.v !== 1 || !Array.isArray(record.keys)) {
|
|
7436
|
-
throw new Error(`TRUST_FILE_UNREADABLE: ${file} is not a version 1 list of trusted keys`);
|
|
7437
|
-
}
|
|
7438
|
-
for (const key of record.keys) {
|
|
7439
|
-
const row = key;
|
|
7440
|
-
const id = typeof row.publicKey === "string" ? trustedKeyId(row.publicKey) : undefined;
|
|
7441
|
-
if (typeof row.name !== "string" || !TRUSTED_KEY_NAME.test(row.name) || id === undefined || "error" in id || row.keyId !== id.keyId || typeof row.addedAt !== "string") {
|
|
7442
|
-
throw new Error(`TRUST_FILE_UNREADABLE: ${file} holds an entry that is not a valid trusted key: ${JSON.stringify(key)}`);
|
|
7443
|
-
}
|
|
7444
|
-
}
|
|
7445
|
-
return { state: "read", file, keys: record.keys };
|
|
7446
|
-
}
|
|
7447
|
-
|
|
7448
|
-
// ../ahp-host/src/ask-gate.ts
|
|
7449
|
-
var HOST_SIGNING_KEY_FILE = "host-signing-key";
|
|
7450
|
-
var ASK_FRESH_MS = 10 * 60000;
|
|
7451
|
-
var ACTED_KEEP_MS = 30 * 24 * 60 * 60000;
|
|
7452
|
-
async function readHostSigningKey(configDir) {
|
|
7453
|
-
try {
|
|
7454
|
-
await readFile2(join6(configDir, HOST_SIGNING_KEY_FILE));
|
|
7455
|
-
} catch (error) {
|
|
7456
|
-
if (error.code === "ENOENT")
|
|
7457
|
-
return { state: "missing" };
|
|
7458
|
-
}
|
|
7459
|
-
try {
|
|
7460
|
-
return { state: "ok", key: await hostSigningKey(configDir) };
|
|
7461
|
-
} catch (error) {
|
|
7462
|
-
return { state: "unreadable", reason: error instanceof Error ? error.message : String(error) };
|
|
7463
|
-
}
|
|
7464
|
-
}
|
|
7465
|
-
async function hostSigningKey(configDir, now = () => Date.now()) {
|
|
7466
|
-
const file = join6(configDir, HOST_SIGNING_KEY_FILE);
|
|
7467
|
-
let pem;
|
|
7468
|
-
try {
|
|
7469
|
-
pem = await readFile2(file, "utf8");
|
|
7470
|
-
} catch (error) {
|
|
7471
|
-
if (error.code !== "ENOENT") {
|
|
7472
|
-
throw new Error(`HOST_KEY_UNREADABLE: ${file} exists but cannot be read (${String(error)}); it is never regenerated, fix or remove it by hand`);
|
|
7473
|
-
}
|
|
7474
|
-
}
|
|
7475
|
-
if (pem === undefined) {
|
|
7476
|
-
const made = generateKeyPairSync("ed25519").privateKey.export({ format: "pem", type: "pkcs8" }).toString();
|
|
7477
|
-
const temporary = `${file}.${String(process.pid)}.tmp`;
|
|
7478
|
-
await writeFile2(temporary, made, { mode: 384, flag: "wx" });
|
|
7479
|
-
await chmod(temporary, 384);
|
|
7480
|
-
await rename2(temporary, file);
|
|
7481
|
-
pem = made;
|
|
7482
|
-
}
|
|
7483
|
-
let privateKey;
|
|
7484
|
-
try {
|
|
7485
|
-
privateKey = createPrivateKey({ key: pem, format: "pem" });
|
|
7486
|
-
if (privateKey.asymmetricKeyType !== "ed25519")
|
|
7487
|
-
throw new Error(`a ${String(privateKey.asymmetricKeyType)} key, not Ed25519`);
|
|
7488
|
-
} catch (error) {
|
|
7489
|
-
throw new Error(`HOST_KEY_UNREADABLE: ${file} is not an Ed25519 PKCS8 key (${String(error)}); it is never regenerated, fix or remove it by hand`);
|
|
7490
|
-
}
|
|
7491
|
-
const publicKey = createPublicKey(privateKey).export({ format: "jwk" }).x;
|
|
7492
|
-
const id = publicKey === undefined ? { error: "no public key" } : trustedKeyId(publicKey);
|
|
7493
|
-
if ("error" in id)
|
|
7494
|
-
throw new Error(`HOST_KEY_UNREADABLE: ${file}: ${id.error}`);
|
|
7495
|
-
return { privateKey, trusted: { name: "this-host", keyId: id.keyId, publicKey, addedAt: new Date(now()).toISOString() } };
|
|
7496
|
-
}
|
|
7497
|
-
|
|
7498
|
-
// ../ahp-host/src/commands.ts
|
|
7499
|
-
var USAGE = "hightea host join --origin https://your-deployment --workspace SLUG --code CODE --owner-config /absolute/owner.json";
|
|
7500
|
-
var DIAGNOSTICS = {
|
|
7501
|
-
HOST_JOIN_USAGE: `Expected: ${USAGE}`,
|
|
7502
|
-
HOST_JOIN_INPUT: "Command input could not be read. Use --help for the supported options.",
|
|
7503
|
-
HOST_JOIN_INVALID_INTENT: "Use an HTTPS deployment origin, workspace slug and valid join code.",
|
|
7504
|
-
HOST_JOIN_OWNER_INPUT: "The --owner-config file must exist and contain a JSON object; its contents were not printed.",
|
|
7505
|
-
HOST_JOIN_OWNER_RESOURCE: "Check the explicit agent mappings, provider plugins, working directories, executables and referenced credentials in --owner-config. No code was redeemed.",
|
|
7506
|
-
HOST_JOIN_OWNER_SECRET: "Replace inline provider secrets with existing ahpd fromEnv or SecretRef values; the referenced resource must be available locally.",
|
|
7507
|
-
HOST_JOIN_OWNER_BOT: "@ahpd/bot is not allowed on a member host (bots run on the server); remove it from this owner's plugin list",
|
|
7508
|
-
HOST_JOIN_UNSAFE_PATH: "The selected configuration path must be owned by this user and private; symlinks and shared files are not used.",
|
|
7509
|
-
HOST_JOIN_CLAIM_CONFLICT: "This claim already holds different deployment or owner settings. Keep its vault and use the original settings to resume.",
|
|
7510
|
-
HOST_JOIN_CLAIM_CORRUPT: "The selected claim vault is invalid. Keep it for recovery; joining will not replace its credential.",
|
|
7511
|
-
HOST_JOIN_NETWORK_UNKNOWN: "The registration result is unknown. Keep this claim and rerun the same command to recover its receipt.",
|
|
7512
|
-
HOST_JOIN_REMOTE_UNAVAILABLE: "The deployment could not complete registration. Keep this claim and rerun the same command later.",
|
|
7513
|
-
HOST_JOIN_CANCELLED: "The owner cancelled this host registration. Keep the existing claim; request a new join code for another registration.",
|
|
7514
|
-
HOST_JOIN_LINK_UNAVAILABLE: "This join code is expired or unavailable. Keep the existing claim; request a new code if registration was not completed.",
|
|
7515
|
-
HOST_JOIN_REJECTED: "The deployment rejected registration. Check the deployment and workspace; the selected credential was retained.",
|
|
7516
|
-
HOST_JOIN_NOT_AUTHORISED: "The deployment refused this account for that workspace or agent. Join with the account that owns the agents in --owner-config; the selected credential was retained.",
|
|
7517
|
-
HOST_JOIN_AGENT_BOUND: "An agent in --owner-config already belongs to another host. Remove that host (or its registration) in the workspace, then rerun the same command; the selected credential was retained.",
|
|
7518
|
-
HOST_JOIN_RECEIPT_INVALID: "The deployment returned an invalid registration receipt. Keep this claim and retry against the correct deployment.",
|
|
7519
|
-
HOST_JOIN_CONFIG_CONFLICT: "Existing host configuration has different bindings or required settings. It was preserved; reconcile it with the original claim before retrying.",
|
|
7520
|
-
HOST_JOIN_CONFIG_CORRUPT: "Existing host configuration is invalid JSON. It was preserved for local repair; rerun after repairing it.",
|
|
7521
|
-
HOST_JOIN_CLAIM_VERSION: "This join code's claim was started by another hightea version. Finish it with that version, or request a new join code; nothing was redeemed or written.",
|
|
7522
|
-
HOST_JOIN_PLUGIN_BUNDLE: "This installation's host plugin is missing or unreadable. Reinstall @hallohuman/hightea; no configuration was written.",
|
|
7523
|
-
HOST_JOIN_PLUGIN_BUNDLE_CONFLICT: "The installed host plugin for this version differs from this installation's copy. It was preserved; reinstall the same version or repair that directory. No configuration was written."
|
|
7524
|
-
};
|
|
7525
|
-
function xdgHome(variable, fallback) {
|
|
7526
|
-
const home = process.env[variable] || join7(homedir(), fallback);
|
|
7527
|
-
if (!isAbsolute3(home))
|
|
7528
|
-
throw new Error("HOST_JOIN_UNSAFE_PATH");
|
|
7529
|
-
return home;
|
|
7530
|
-
}
|
|
7531
|
-
function installedDaemon() {
|
|
7532
|
-
const manifest = createRequire(import.meta.url).resolve("@ahpd/server/package.json");
|
|
7533
|
-
return { node: process.execPath, main: join7(dirname3(manifest), "dist", "main.js") };
|
|
7534
|
-
}
|
|
7535
|
-
var shellQuote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
|
|
7536
|
-
function hostStartCommand(claim, daemon = installedDaemon()) {
|
|
7537
|
-
return `XDG_CONFIG_HOME=${shellQuote(claim)} ${shellQuote(daemon.node)} ${shellQuote(daemon.main)} start`;
|
|
7538
|
-
}
|
|
7539
|
-
var SERVER_REFUSALS = {
|
|
7540
|
-
JOIN_LINK_INVALID: "the join code is no longer valid",
|
|
7541
|
-
JOIN_LINK_NOT_FOUND: "no such join code in that workspace",
|
|
7542
|
-
ROLE_NOT_ALLOWED: "the join code does not allow this role",
|
|
7543
|
-
NOT_A_MEMBER: "the signed-in account is not a member of that workspace",
|
|
7544
|
-
FORBIDDEN: "an agent in --owner-config belongs to another account",
|
|
7545
|
-
HOST_REGISTRATION_CANCELLED: "the owner cancelled this registration",
|
|
7546
|
-
HOST_REGISTRATION_CONFLICT: "this code was redeemed for a different host registration",
|
|
7547
|
-
AGENT_HOST_CONFLICT: "an agent already belongs to another active host",
|
|
7548
|
-
HOST_REGISTRATION_MISSING: "the pending registration is gone",
|
|
7549
|
-
INVALID_REQUEST: "the deployment did not accept this request's shape",
|
|
7550
|
-
BAD_ORIGIN: "the request came from another site",
|
|
7551
|
-
UNAUTHENTICATED: "the request carried no signed-in account",
|
|
7552
|
-
WORKSPACE_NOT_FOUND: "no such workspace for this account",
|
|
7553
|
-
PEOPLE_LIMIT: "that workspace is at its beta limit of people",
|
|
7554
|
-
AGENTS_LIMIT: "that workspace is at its beta limit of agents"
|
|
7555
|
-
};
|
|
7556
|
-
var REFUSAL_EXIT = { HOST_JOIN_NOT_AUTHORISED: 3, HOST_JOIN_AGENT_BOUND: 4, HOST_JOIN_REJECTED: 1 };
|
|
7557
|
-
function refusalLine(refusal) {
|
|
7558
|
-
const meaning = refusal.serverCode === undefined ? "" : ` The deployment says ${SERVER_REFUSALS[refusal.serverCode]}.`;
|
|
7559
|
-
return `${refusal.kind}: ${DIAGNOSTICS[refusal.kind]}${meaning} (HTTP ${refusal.status}, server code ${refusal.serverCode ?? "unrecognised"})`;
|
|
7120
|
+
return false;
|
|
7560
7121
|
}
|
|
7561
|
-
async function
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
const
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
});
|
|
7577
|
-
if (claim.intent.pluginVersion !== plugin.version)
|
|
7578
|
-
throw new Error("HOST_JOIN_CLAIM_VERSION");
|
|
7579
|
-
const vault = fileVault2({ file: claim.vaultFile });
|
|
7580
|
-
const checkReferences = async (value) => {
|
|
7581
|
-
const name = secretRef2(value);
|
|
7582
|
-
const variable = fromEnvRef2(value);
|
|
7583
|
-
if (variable !== undefined) {
|
|
7584
|
-
if (!process.env[variable])
|
|
7585
|
-
throw new Error("HOST_JOIN_OWNER_RESOURCE");
|
|
7586
|
-
} else if (name !== undefined) {
|
|
7587
|
-
try {
|
|
7588
|
-
await readSecret(vault, name);
|
|
7589
|
-
} catch {
|
|
7590
|
-
throw new Error("HOST_JOIN_OWNER_RESOURCE");
|
|
7591
|
-
}
|
|
7592
|
-
} else if (Array.isArray(value)) {
|
|
7593
|
-
for (const child of value)
|
|
7594
|
-
await checkReferences(child);
|
|
7595
|
-
} else if (isRecord3(value)) {
|
|
7596
|
-
for (const child of Object.values(value))
|
|
7597
|
-
await checkReferences(child);
|
|
7598
|
-
}
|
|
7599
|
-
};
|
|
7600
|
-
await checkReferences(ownerConfiguration);
|
|
7601
|
-
const bundle = await installPluginBundle(dataHome, plugin.directory, plugin.version);
|
|
7602
|
-
const receipt = await redeemHostClaim(claim);
|
|
7603
|
-
if (receipt.state === "pending") {
|
|
7604
|
-
console.log("Host registration pending. Run the same command again to resume.");
|
|
7605
|
-
return 2;
|
|
7606
|
-
}
|
|
7607
|
-
for (const record of ownerConfiguration.records)
|
|
7608
|
-
await saveHostAgentRecord(claim, record);
|
|
7609
|
-
const cloud = new URL(`/gateway/${encodeURIComponent(receipt.workspaceId)}/host`, claim.intent.origin);
|
|
7610
|
-
cloud.protocol = "wss:";
|
|
7611
|
-
await saveHostConfiguration(claim, {
|
|
7612
|
-
host: "127.0.0.1",
|
|
7613
|
-
updateCheck: false,
|
|
7614
|
-
httpApi: false,
|
|
7615
|
-
modelApi: false,
|
|
7616
|
-
mcpTools: "none",
|
|
7617
|
-
unattendedAutoApprove: false,
|
|
7618
|
-
pluginMarketplaces: [],
|
|
7619
|
-
plugins: [...ownerConfiguration.plugins, {
|
|
7620
|
-
source: bundle.manifest,
|
|
7621
|
-
grants: ["session:write", "session:state", "chat:turns", "agent:list"],
|
|
7622
|
-
options: {
|
|
7623
|
-
cloudUrl: cloud.href,
|
|
7624
|
-
workspaceId: receipt.workspaceId,
|
|
7625
|
-
agents: ownerConfiguration.agents,
|
|
7626
|
-
mcpUrl: new URL(`/w/${encodeURIComponent(receipt.workspaceId)}`, claim.intent.origin).href,
|
|
7627
|
-
headers: { [HOST_HEADER]: receipt.hostId, authorization: { $secret: "host:hightea" } }
|
|
7628
|
-
}
|
|
7629
|
-
}]
|
|
7122
|
+
async function agentAppsOnPath2(pathValue = process.env.PATH ?? "", platform = process.platform) {
|
|
7123
|
+
const found = [];
|
|
7124
|
+
for (const id of HOST_AGENT_APPS) {
|
|
7125
|
+
const row = knownAgents[id];
|
|
7126
|
+
if (row === undefined)
|
|
7127
|
+
throw new Error("HOST_JOIN_APPS_ROW_MISSING");
|
|
7128
|
+
if (!await executable(row.command, pathValue))
|
|
7129
|
+
continue;
|
|
7130
|
+
const install = installLine(row, platform);
|
|
7131
|
+
found.push({
|
|
7132
|
+
id,
|
|
7133
|
+
name: HOST_AGENT_APP_NAMES[id],
|
|
7134
|
+
command: row.command,
|
|
7135
|
+
...install === undefined ? {} : { install },
|
|
7136
|
+
...row.page === undefined ? {} : { page: row.page }
|
|
7630
7137
|
});
|
|
7631
|
-
console.log(`Host registered; local configuration saved. Start it with: ${hostStartCommand(claim.home)}`);
|
|
7632
|
-
return 0;
|
|
7633
|
-
} catch (error) {
|
|
7634
|
-
if (error instanceof HostJoinRefusal) {
|
|
7635
|
-
console.error(refusalLine(error));
|
|
7636
|
-
return REFUSAL_EXIT[error.kind];
|
|
7637
|
-
}
|
|
7638
|
-
const code = error instanceof Error && /^HOST_JOIN_[A-Z_]+$/u.test(error.message) ? error.message : "HOST_JOIN_INPUT";
|
|
7639
|
-
console.error(`${code}: ${DIAGNOSTICS[code] ?? "Local claim storage could not be safely published or flushed. Keep the existing files, check filesystem access and retry; no replacement credential was selected."}`);
|
|
7640
|
-
return 1;
|
|
7641
7138
|
}
|
|
7139
|
+
return found;
|
|
7642
7140
|
}
|
|
7643
|
-
function
|
|
7644
|
-
|
|
7141
|
+
function installLineOf2(app) {
|
|
7142
|
+
if (app.install !== undefined)
|
|
7143
|
+
return app.install;
|
|
7144
|
+
return app.page === undefined ? `install ${app.name}` : `install ${app.name}: ${app.page}`;
|
|
7645
7145
|
}
|
|
7646
|
-
|
|
7647
|
-
const
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
} catch (error) {
|
|
7652
|
-
const missing = typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
7653
|
-
return missing ? { claim, state: "pending" } : { claim, state: "unreadable", config };
|
|
7654
|
-
}
|
|
7655
|
-
let saved;
|
|
7656
|
-
try {
|
|
7657
|
-
saved = JSON.parse(text);
|
|
7658
|
-
} catch {
|
|
7659
|
-
return { claim, state: "unreadable", config };
|
|
7660
|
-
}
|
|
7661
|
-
const plugins = isRecord3(saved) && Array.isArray(saved.plugins) ? saved.plugins : [];
|
|
7662
|
-
const ours = plugins.find(isHighteaPipeEntry);
|
|
7663
|
-
if (ours === undefined || typeof ours.source !== "string" || !isRecord3(ours.options) || !isRecord3(ours.options.headers)) {
|
|
7664
|
-
return { claim, state: "unreadable", config };
|
|
7665
|
-
}
|
|
7666
|
-
const pluginBundle = ours.source;
|
|
7667
|
-
const installed = await readInstalledBundle(pluginBundle);
|
|
7668
|
-
const bundle = !installed.ok ? installed.reason : installed.bundle.version === basename(dirname3(pluginBundle)) ? "ok" : "wrong-version";
|
|
7146
|
+
function describedApp2(id, platform = process.platform) {
|
|
7147
|
+
const row = knownAgents[id];
|
|
7148
|
+
if (row === undefined)
|
|
7149
|
+
throw new Error("HOST_JOIN_APPS_ROW_MISSING");
|
|
7150
|
+
const install = installLine(row, platform);
|
|
7669
7151
|
return {
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
bundle,
|
|
7676
|
-
...installed.ok ? { pluginVersion: installed.bundle.version } : {},
|
|
7677
|
-
workspaceId: String(ours.options.workspaceId ?? ours.options.houseId),
|
|
7678
|
-
hostId: String(ours.options.headers[HOST_HEADER] ?? ours.options.headers[LEGACY_HOST_HEADER]),
|
|
7679
|
-
...typeof ours.options.cloudUrl === "string" ? { gateway: ours.options.cloudUrl } : {},
|
|
7680
|
-
signingKey: await statusSigningKey(dirname3(config)),
|
|
7681
|
-
...await statusHeldBundle(dirname3(config))
|
|
7152
|
+
id,
|
|
7153
|
+
name: HOST_AGENT_APP_NAMES[id],
|
|
7154
|
+
command: row.command,
|
|
7155
|
+
...install === undefined ? {} : { install },
|
|
7156
|
+
...row.page === undefined ? {} : { page: row.page }
|
|
7682
7157
|
};
|
|
7683
7158
|
}
|
|
7684
|
-
async function
|
|
7685
|
-
|
|
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
|
-
}
|
|
7690
|
-
async function statusSigningKey(configDir) {
|
|
7691
|
-
const read = await readHostSigningKey(configDir);
|
|
7692
|
-
if (read.state === "ok")
|
|
7693
|
-
return { state: "ok", keyId: read.key.trusted.keyId, publicKey: read.key.trusted.publicKey };
|
|
7694
|
-
return read;
|
|
7695
|
-
}
|
|
7696
|
-
function signingKeyLine(key) {
|
|
7697
|
-
if (key === undefined || key.state === "missing")
|
|
7698
|
-
return "(made on this host's first start)";
|
|
7699
|
-
if (key.state === "unreadable")
|
|
7700
|
-
return `unreadable: ${key.reason}`;
|
|
7701
|
-
return `${key.keyId} public ${key.publicKey} (another machine trusts it with: hightea host trust add <name> ${key.publicKey})`;
|
|
7702
|
-
}
|
|
7703
|
-
function versionNote(bundleVersion, cliVersion) {
|
|
7704
|
-
if (bundleVersion === undefined)
|
|
7705
|
-
return "";
|
|
7706
|
-
return bundleVersion === cliVersion ? `, version ${bundleVersion}` : `, version ${bundleVersion}; this CLI is ${cliVersion}`;
|
|
7707
|
-
}
|
|
7708
|
-
async function hostStatus2(options) {
|
|
7709
|
-
let claimsDirectory;
|
|
7710
|
-
try {
|
|
7711
|
-
claimsDirectory = join7(xdgHome("XDG_CONFIG_HOME", ".config"), "hightea", "claims");
|
|
7712
|
-
} catch {
|
|
7713
|
-
console.error(`HOST_STATUS_UNSAFE_PATH: ${DIAGNOSTICS.HOST_JOIN_UNSAFE_PATH}`);
|
|
7714
|
-
return 1;
|
|
7715
|
-
}
|
|
7716
|
-
let names = [];
|
|
7717
|
-
try {
|
|
7718
|
-
names = (await readdir(claimsDirectory)).filter((name) => !name.startsWith(".")).sort();
|
|
7719
|
-
} catch (error) {
|
|
7720
|
-
const missing = typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
7721
|
-
if (!missing) {
|
|
7722
|
-
console.error(`HOST_STATUS_UNREADABLE: cannot list ${claimsDirectory}`);
|
|
7723
|
-
return 1;
|
|
7724
|
-
}
|
|
7725
|
-
}
|
|
7726
|
-
const entries = await Promise.all(names.map((name) => readStatusEntry(join7(claimsDirectory, name))));
|
|
7727
|
-
if (options.json)
|
|
7728
|
-
console.log(JSON.stringify({ version: options.version, claims: claimsDirectory, hosts: entries }, null, 2));
|
|
7729
|
-
else {
|
|
7730
|
-
for (const entry of entries) {
|
|
7731
|
-
if (entry.state === "pending")
|
|
7732
|
-
console.log(`pending ${entry.claim} (registration not finished; rerun the same join command)`);
|
|
7733
|
-
else if (entry.state === "unreadable")
|
|
7734
|
-
console.log(`unreadable ${entry.config}`);
|
|
7735
|
-
else
|
|
7736
|
-
console.log([
|
|
7737
|
-
`joined workspace ${entry.workspaceId} host ${entry.hostId}`,
|
|
7738
|
-
` gateway ${entry.gateway ?? "(none)"}`,
|
|
7739
|
-
` config ${entry.config}`,
|
|
7740
|
-
` start ${entry.start}`,
|
|
7741
|
-
` plugin ${entry.pluginBundle} (${entry.bundle}${versionNote(entry.pluginVersion, options.version)})`,
|
|
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)" : ""}`]
|
|
7744
|
-
].join(`
|
|
7745
|
-
`));
|
|
7746
|
-
}
|
|
7747
|
-
}
|
|
7748
|
-
const broken = entries.filter((entry) => entry.state === "joined" && entry.bundle !== "ok");
|
|
7749
|
-
for (const entry of broken) {
|
|
7750
|
-
const why = entry.bundle === "missing" ? "is missing" : entry.bundle === "corrupt" ? "does not match its recorded hash" : `records version ${entry.pluginVersion}, not the version its directory names`;
|
|
7751
|
-
const cure = entry.bundle === "wrong-version" ? "Restore the bundle that directory name records, or re-join with a new code to install this CLI's bundle." : "Re-join with a new code to install this version's bundle.";
|
|
7752
|
-
console.error(`HOST_STATUS_PLUGIN_BUNDLE: the plugin bundle ${entry.pluginBundle} ${why}; the host cannot load it. ${cure}`);
|
|
7753
|
-
}
|
|
7754
|
-
if (broken.length > 0)
|
|
7755
|
-
return 2;
|
|
7756
|
-
if (entries.some((entry) => entry.state === "unreadable")) {
|
|
7757
|
-
console.error("HOST_STATUS_CONFIG_UNREADABLE: a saved host configuration could not be read; it was left unchanged.");
|
|
7758
|
-
return 1;
|
|
7759
|
-
}
|
|
7760
|
-
if (!entries.some((entry) => entry.state === "joined")) {
|
|
7761
|
-
console.error(`HOST_STATUS_NONE: no joined host under ${claimsDirectory}.`);
|
|
7762
|
-
return 1;
|
|
7763
|
-
}
|
|
7764
|
-
return 0;
|
|
7765
|
-
}
|
|
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"];
|
|
7777
|
-
async function localHost2(host) {
|
|
7778
|
-
let claims;
|
|
7779
|
-
try {
|
|
7780
|
-
claims = join7(xdgHome("XDG_CONFIG_HOME", ".config"), "hightea", "claims");
|
|
7781
|
-
} catch {
|
|
7782
|
-
return { error: `SERVICE_UNSAFE_PATH: ${DIAGNOSTICS.HOST_JOIN_UNSAFE_PATH}` };
|
|
7783
|
-
}
|
|
7784
|
-
let names = [];
|
|
7785
|
-
try {
|
|
7786
|
-
names = (await readdir(claims)).filter((name) => !name.startsWith(".")).sort();
|
|
7787
|
-
} catch (error) {
|
|
7788
|
-
const missing = typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
7789
|
-
if (!missing)
|
|
7790
|
-
return { error: `SERVICE_HOST_UNREADABLE: cannot list ${claims}` };
|
|
7791
|
-
}
|
|
7792
|
-
const entries = await Promise.all(names.map((name) => readStatusEntry(join7(claims, name))));
|
|
7793
|
-
const joined = entries.filter((entry) => entry.state === "joined");
|
|
7794
|
-
const wanted = host?.trim();
|
|
7795
|
-
if (wanted !== undefined && wanted !== "") {
|
|
7796
|
-
const named = joined.find((entry) => entry.hostId === wanted);
|
|
7797
|
-
if (named === undefined) {
|
|
7798
|
-
return { error: `SERVICE_HOST_UNKNOWN: no joined host ${wanted} on this machine (joined here: ${joined.map((entry) => entry.hostId).join(", ") || "none"})` };
|
|
7799
|
-
}
|
|
7800
|
-
return toLocalHost(named);
|
|
7801
|
-
}
|
|
7802
|
-
if (joined.length === 0) {
|
|
7803
|
-
const unreadable = entries.find((entry) => entry.state === "unreadable");
|
|
7804
|
-
return { error: unreadable === undefined ? `SERVICE_NO_HOST: no joined host under ${claims}; join this machine with \`hightea host join\` first` : `SERVICE_HOST_UNREADABLE: ${unreadable.config} could not be read; it was left unchanged` };
|
|
7805
|
-
}
|
|
7806
|
-
if (joined.length > 1) {
|
|
7807
|
-
return { error: `SERVICE_HOST_AMBIGUOUS: this machine holds ${joined.length} joined hosts (${joined.map((entry) => entry.hostId).join(", ")}); name one with --host <id>` };
|
|
7808
|
-
}
|
|
7809
|
-
return toLocalHost(joined[0]);
|
|
7810
|
-
}
|
|
7811
|
-
function toLocalHost(entry) {
|
|
7812
|
-
const config = entry.config;
|
|
7813
|
-
return { claim: entry.claim, configDir: dirname3(config), config, workspaceId: entry.workspaceId, hostId: entry.hostId };
|
|
7814
|
-
}
|
|
7815
|
-
async function hostServicesGrants2(options) {
|
|
7816
|
-
const found = await localHost2(options.host);
|
|
7817
|
-
if ("error" in found) {
|
|
7818
|
-
console.error(found.error);
|
|
7819
|
-
return 1;
|
|
7820
|
-
}
|
|
7821
|
-
const read = readJsonObject3(found.config);
|
|
7822
|
-
if (!read.ok) {
|
|
7823
|
-
console.error(`SERVICE_CONFIG_UNREADABLE: ${found.config} could not be read as a JSON object; it was left unchanged`);
|
|
7824
|
-
return 1;
|
|
7825
|
-
}
|
|
7826
|
-
const plugins = Array.isArray(read.value.plugins) ? read.value.plugins : [];
|
|
7827
|
-
const at = plugins.findIndex(isHighteaPipeEntry);
|
|
7828
|
-
const ours = plugins[at];
|
|
7829
|
-
if (ours === undefined) {
|
|
7830
|
-
console.error(`SERVICE_CONFIG_UNREADABLE: ${found.config} holds no Hightea plugin entry; it was left unchanged`);
|
|
7831
|
-
return 1;
|
|
7832
|
-
}
|
|
7833
|
-
if (ours.grants !== undefined && !(Array.isArray(ours.grants) && ours.grants.every((grant) => typeof grant === "string"))) {
|
|
7834
|
-
console.error(`SERVICE_CONFIG_UNREADABLE: the Hightea plugin entry's grants in ${found.config} are not a list of grants; it was left unchanged`);
|
|
7835
|
-
return 1;
|
|
7836
|
-
}
|
|
7837
|
-
const held = ours.grants ?? [];
|
|
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));
|
|
7842
|
-
const what = `Hightea managing this machine's services (host ${found.hostId})`;
|
|
7843
|
-
if (grants.length === held.length && grants.every((grant, index) => grant === held[index])) {
|
|
7844
|
-
console.log(`${what} is already ${options.enable ? "enabled" : "disabled"}; ${found.config} was left unchanged.`);
|
|
7845
|
-
return 0;
|
|
7846
|
-
}
|
|
7847
|
-
const next = plugins.slice();
|
|
7848
|
-
next[at] = { ...ours, grants };
|
|
7849
|
-
try {
|
|
7850
|
-
writeJsonAtomic2(found.config, { ...read.value, plugins: next }, { mode: 384 });
|
|
7851
|
-
} catch (error) {
|
|
7852
|
-
console.error(`SERVICE_CONFIG_UNWRITABLE: ${found.config}: ${error.message}`);
|
|
7853
|
-
return 1;
|
|
7854
|
-
}
|
|
7855
|
-
console.log(`${what} is now ${options.enable ? "enabled" : "disabled"}: ${options.enable ? "added" : "removed"} ${SERVICES_GRANTS.join(", ")} in ${found.config}.`);
|
|
7856
|
-
console.log(`It takes effect when this host's ahpd next loads its configuration; restart it with: ${hostStartCommand(found.claim)}`);
|
|
7857
|
-
return 0;
|
|
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 };
|
|
7159
|
+
async function appInstalled2(app, pathValue = process.env.PATH ?? "") {
|
|
7160
|
+
return executable(app.command, pathValue);
|
|
7941
7161
|
}
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
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;
|
|
7162
|
+
var isShippedApp2 = (value) => HOST_AGENT_APPS.includes(value);
|
|
7163
|
+
function noAgentAppsLine2(platform = process.platform) {
|
|
7164
|
+
const rows = HOST_AGENT_APPS.map((id) => describedApp2(id, platform));
|
|
7165
|
+
return "no agent app on this computer: " + rows.map((row) => `${row.name} (${installLineOf2(row)})`).join("; ") + ". Install one, then run the same command again. Nothing was redeemed and nothing was written.";
|
|
8041
7166
|
}
|
|
8042
7167
|
|
|
8043
|
-
export {
|
|
7168
|
+
export { isJoinRouteRefusalCode, isHostAgentApp, normalizeJoinCode, HOST_HEADER, LEGACY_HOST_HEADER, agentAppsOnPath2, installLineOf2, describedApp2, appInstalled2, isShippedApp2, noAgentAppsLine2 };
|