@epoch-agent/protocol 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,1254 @@
1
+ // src/tool.ts
2
+ var ToolExposure = /* @__PURE__ */ ((ToolExposure2) => {
3
+ ToolExposure2["Direct"] = "direct";
4
+ ToolExposure2["Deferred"] = "deferred";
5
+ ToolExposure2["Hidden"] = "hidden";
6
+ return ToolExposure2;
7
+ })(ToolExposure || {});
8
+
9
+ // src/diagnostics.ts
10
+ function hasFailure(list) {
11
+ return list.some((d) => d.status === "failed");
12
+ }
13
+ function diagnosticToLine(d) {
14
+ return `${d.module}: ${d.detail}`;
15
+ }
16
+ var DiagnosticSink = class {
17
+ list = [];
18
+ add(module, status, detail, code) {
19
+ const render = typeof detail === "string" ? () => detail : detail;
20
+ this.list.push({ module, status, detail: render, ...code ? { code } : {} });
21
+ }
22
+ /** 正常。`detail` 缺省是 `OK`(与改造前的字符串一致) */
23
+ ok(module, detail = "OK") {
24
+ this.add(module, "ok", detail);
25
+ }
26
+ /** 能用,但用户该知道(降级、回退到默认值、缺可选依赖) */
27
+ warn(module, detail, code) {
28
+ this.add(module, "warn", detail, code);
29
+ }
30
+ /** 起不来。**注意这会让 `epoch doctor` 退非 0** */
31
+ failed(module, detail, code) {
32
+ this.add(module, "failed", detail, code);
33
+ }
34
+ /** 没配所以没起。既不是成功也不是失败 —— 伪装成任何一种都是在骗人 */
35
+ skipped(module, detail) {
36
+ this.add(module, "skipped", detail);
37
+ }
38
+ /**
39
+ * 结构化的那一份(宿主用)。
40
+ *
41
+ * @param lang 用哪个语言渲染 `detail`。**不给 = 进程语言**,也就是这一轮之前的
42
+ * 全部行为(CLI / `epoch doctor` / 没带 `?lang=` 的请求走的都是这条)。
43
+ * ⚠️ **只换 `detail`** —— `module` / `code` / `status` 是契约,
44
+ * 跟着语言变等于让宿主的去重和分支按语言分叉(见文件头)
45
+ */
46
+ toList(lang) {
47
+ return this.list.map((d) => ({
48
+ module: d.module,
49
+ status: d.status,
50
+ detail: d.detail(lang),
51
+ ...d.code ? { code: d.code } : {}
52
+ }));
53
+ }
54
+ /** 字符串那一份(CLI / TUI 用)。**派生**,不是另一份状态 */
55
+ toStrings() {
56
+ return this.toList().map(diagnosticToLine);
57
+ }
58
+ get length() {
59
+ return this.list.length;
60
+ }
61
+ };
62
+
63
+ // src/agent-role.ts
64
+ var DEFAULT_AGENT_ROLE = "general";
65
+ var AGENT_ROLE_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
66
+ function isValidAgentRoleName(name) {
67
+ return AGENT_ROLE_NAME_PATTERN.test(name);
68
+ }
69
+
70
+ // src/commands.ts
71
+ var RESERVED_COMMAND_NAMES = [
72
+ "help",
73
+ "?",
74
+ "clear",
75
+ "cls",
76
+ "status",
77
+ "model",
78
+ "permission",
79
+ "perm",
80
+ "plan",
81
+ "tools",
82
+ "tasks",
83
+ "context",
84
+ "ctx",
85
+ "thinking",
86
+ "diagnostics",
87
+ "doctor",
88
+ "exit",
89
+ "quit",
90
+ "q",
91
+ // 方案 25 PR-4 补的九条。**登记的是全集,不是「这次注册了的」** ——
92
+ // 一条命令因为宿主缺能力而没注册,不代表自定义命令就可以占它的名字:
93
+ // 那样升个版、或者换个宿主,同一个文件就突然撞名了
94
+ "cost",
95
+ "export",
96
+ "skills",
97
+ "agents",
98
+ "mcp",
99
+ "memory",
100
+ "diff",
101
+ "init",
102
+ "copy",
103
+ "compact",
104
+ "resume",
105
+ "permissions",
106
+ "perms",
107
+ // 方案 27 PR-3。它和 `/clear` 属于同一类「逃生通道」:被一个坏掉的自定义命令
108
+ // 顶掉之后,用户失去的是**把工作区退回去**的那条路 —— 而他会在最需要它的
109
+ // 那一刻才发现
110
+ "rewind",
111
+ // 方案 32。同样是逃生通道,而且是这一条名单里唯一**能自我修复**的那个:
112
+ // 一个插件把界面搞砸之后,`/plugin` 是用户不重启就能停用它的唯一入口 ——
113
+ // 让插件自己占掉这个名字等于把灭火器锁在着火的屋里
114
+ "plugin",
115
+ "plugins",
116
+ // 方案 52。它**不是**逃生通道,登记的理由是另一条(也是这份名单更常见的那条):
117
+ // 目标是一段会话里唯一「模型改不了、只有人能改」的东西,而一个自定义命令
118
+ // 顶掉 `/goal` 之后,用户失去的正是那个入口 —— 于是完成判据就只剩模型自己
119
+ // 说了算,而这恰好是方案 52 §3.1 花一整节禁掉的事。
120
+ "goal"
121
+ ];
122
+ var COMMAND_NAME_PATTERN = /^[a-z0-9_]+(?:[-:][a-z0-9_]+)*$/;
123
+ function isValidCommandName(name) {
124
+ return COMMAND_NAME_PATTERN.test(name);
125
+ }
126
+
127
+ // src/keybindings.ts
128
+ var KEY_ACTIONS = [
129
+ // ── global:App 那一层的 useInput ────────────────────────────────
130
+ "interrupt",
131
+ "rewind",
132
+ "clear-screen",
133
+ "open-artifact",
134
+ "transcript-search",
135
+ "exit",
136
+ "exit-if-empty",
137
+ // ── input:输入框(没有补全面板时)───────────────────────────────
138
+ "submit",
139
+ "newline",
140
+ "history-prev",
141
+ "history-next",
142
+ "cursor-left",
143
+ "cursor-right",
144
+ "line-start",
145
+ "line-end",
146
+ "kill-word",
147
+ "kill-line-start",
148
+ "kill-line-end",
149
+ "delete-char-left",
150
+ "delete-char-right",
151
+ "paste-image",
152
+ // ── dialog:补全面板开着时 ───────────────────────────────────────
153
+ "complete",
154
+ "complete-prev",
155
+ "complete-next"
156
+ ];
157
+ var SIMULTANEOUS_CONTEXTS = [
158
+ ["global", "input"],
159
+ ["global", "dialog"]
160
+ ];
161
+ var ACTION_CONTEXTS = {
162
+ interrupt: ["global"],
163
+ rewind: ["global"],
164
+ "clear-screen": ["global"],
165
+ "open-artifact": ["global"],
166
+ "transcript-search": ["global"],
167
+ exit: ["global"],
168
+ "exit-if-empty": ["global"],
169
+ submit: ["input", "dialog"],
170
+ newline: ["input"],
171
+ "history-prev": ["input"],
172
+ "history-next": ["input"],
173
+ "cursor-left": ["input"],
174
+ "cursor-right": ["input"],
175
+ "line-start": ["input"],
176
+ "line-end": ["input"],
177
+ "kill-word": ["input"],
178
+ "kill-line-start": ["input"],
179
+ "kill-line-end": ["input"],
180
+ "delete-char-left": ["input"],
181
+ "delete-char-right": ["input"],
182
+ "paste-image": ["input"],
183
+ complete: ["dialog"],
184
+ "complete-prev": ["dialog"],
185
+ "complete-next": ["dialog"]
186
+ };
187
+ var RESERVED_CHORDS = ["ctrl+c", "ctrl+d"];
188
+ var KEY_NAMES = {
189
+ esc: "escape",
190
+ escape: "escape",
191
+ enter: "enter",
192
+ return: "enter",
193
+ cr: "enter",
194
+ tab: "tab",
195
+ space: "space",
196
+ backspace: "backspace",
197
+ bs: "backspace",
198
+ delete: "delete",
199
+ del: "delete",
200
+ up: "up",
201
+ uparrow: "up",
202
+ down: "down",
203
+ downarrow: "down",
204
+ left: "left",
205
+ leftarrow: "left",
206
+ right: "right",
207
+ rightarrow: "right",
208
+ home: "home",
209
+ end: "end",
210
+ pageup: "pageup",
211
+ pgup: "pageup",
212
+ pagedown: "pagedown",
213
+ pgdn: "pagedown"
214
+ };
215
+ var MODIFIERS = {
216
+ ctrl: "ctrl",
217
+ control: "ctrl",
218
+ alt: "alt",
219
+ meta: "alt",
220
+ option: "alt",
221
+ opt: "alt",
222
+ shift: "shift"
223
+ };
224
+ function chordId(chord) {
225
+ const parts = [];
226
+ if (chord.ctrl) parts.push("ctrl");
227
+ if (chord.alt) parts.push("alt");
228
+ if (chord.shift) parts.push("shift");
229
+ parts.push(chord.key);
230
+ return parts.join("+");
231
+ }
232
+ function parseChord(text) {
233
+ const raw = text.trim().toLowerCase();
234
+ if (raw.length === 0 || /\s/.test(raw)) return void 0;
235
+ const segments = raw.endsWith("+") ? [...raw.slice(0, -1).split("+"), "+"] : raw.split("+");
236
+ const name = segments.pop();
237
+ if (name === void 0 || name.length === 0) return void 0;
238
+ const named = KEY_NAMES[name];
239
+ if (named === void 0 && [...name].length !== 1) return void 0;
240
+ const chord = { key: named ?? name };
241
+ for (const segment of segments) {
242
+ const modifier = MODIFIERS[segment];
243
+ if (modifier === void 0) return void 0;
244
+ chord[modifier] = true;
245
+ }
246
+ return chord;
247
+ }
248
+ function isKeyAction(value) {
249
+ return KEY_ACTIONS.includes(value);
250
+ }
251
+
252
+ // src/config.ts
253
+ var SHELL_KINDS = ["cmd", "powershell", "pwsh"];
254
+ var PROVIDER_INFOS = [
255
+ { type: "openai", label: "OpenAI", apiKeyEnv: "OPENAI_API_KEY", interactive: true },
256
+ { type: "anthropic", label: "Anthropic", apiKeyEnv: "ANTHROPIC_API_KEY", interactive: true },
257
+ {
258
+ type: "google",
259
+ label: "Google Gemini",
260
+ apiKeyEnv: "GOOGLE_GENERATIVE_AI_API_KEY",
261
+ interactive: true
262
+ },
263
+ { type: "deepseek", label: "DeepSeek", apiKeyEnv: "DEEPSEEK_API_KEY", interactive: true },
264
+ { type: "groq", label: "Groq", apiKeyEnv: "GROQ_API_KEY", interactive: true },
265
+ { type: "mistral", label: "Mistral", apiKeyEnv: "MISTRAL_API_KEY", interactive: true },
266
+ {
267
+ type: "moonshotai",
268
+ label: "Moonshot / Kimi",
269
+ apiKeyEnv: "MOONSHOT_API_KEY",
270
+ interactive: true
271
+ },
272
+ { type: "cohere", label: "Cohere", apiKeyEnv: "COHERE_API_KEY", interactive: true },
273
+ { type: "xai", label: "xAI / Grok", apiKeyEnv: "XAI_API_KEY", interactive: true },
274
+ { type: "perplexity", label: "Perplexity", apiKeyEnv: "PERPLEXITY_API_KEY", interactive: true },
275
+ { type: "togetherai", label: "Together AI", apiKeyEnv: "TOGETHER_API_KEY", interactive: true },
276
+ { type: "ollama", label: "Ollama (\u672C\u5730)", apiKeyEnv: null, interactive: true },
277
+ {
278
+ type: "openai-compatible",
279
+ label: "OpenAI Compatible (\u901A\u7528\u9002\u914D)",
280
+ apiKeyEnv: "OPENAI_API_KEY",
281
+ interactive: true
282
+ },
283
+ {
284
+ type: "amazon-bedrock",
285
+ label: "Amazon Bedrock",
286
+ apiKeyEnv: "AWS_BEARER_TOKEN_BEDROCK",
287
+ interactive: false
288
+ },
289
+ { type: "azure", label: "Azure OpenAI", apiKeyEnv: "AZURE_API_KEY", interactive: false }
290
+ ];
291
+ var PROVIDER_TYPES = PROVIDER_INFOS.map((p) => p.type);
292
+ function isProviderType(value) {
293
+ return PROVIDER_TYPES.includes(value);
294
+ }
295
+ function getProviderInfo(type) {
296
+ return PROVIDER_INFOS.find((p) => p.type === type);
297
+ }
298
+ function apiKeyEnvVar(type) {
299
+ return getProviderInfo(type)?.apiKeyEnv ?? null;
300
+ }
301
+ var API_KEY_ENV_VARS = Array.from(
302
+ new Set(PROVIDER_INFOS.map((p) => p.apiKeyEnv).filter((v) => v !== null))
303
+ );
304
+ var SEARCH_PROVIDER_TYPES = ["tavily", "brave", "searxng"];
305
+ function isSearchProviderType(value) {
306
+ return SEARCH_PROVIDER_TYPES.includes(value);
307
+ }
308
+ var SEARCH_API_KEY_ENV = {
309
+ tavily: "TAVILY_API_KEY",
310
+ brave: "BRAVE_SEARCH_API_KEY",
311
+ searxng: null
312
+ };
313
+
314
+ // src/model-ref.ts
315
+ function parseModelRef(raw) {
316
+ const value = raw.trim();
317
+ if (!value) return void 0;
318
+ const slash = value.indexOf("/");
319
+ if (slash > 0) {
320
+ const head = value.slice(0, slash);
321
+ const rest = value.slice(slash + 1);
322
+ if (rest && isProviderType(head)) return { provider: head, model: rest };
323
+ }
324
+ return { model: value };
325
+ }
326
+
327
+ // src/telemetry.ts
328
+ var GEN_AI = {
329
+ OPERATION_NAME: "gen_ai.operation.name",
330
+ REQUEST_MODEL: "gen_ai.request.model",
331
+ RESPONSE_MODEL: "gen_ai.response.model",
332
+ TOOL_NAME: "gen_ai.tool.name",
333
+ TOOL_CALL_ID: "gen_ai.tool.call_id",
334
+ USAGE_INPUT_TOKENS: "gen_ai.usage.input_tokens",
335
+ USAGE_OUTPUT_TOKENS: "gen_ai.usage.output_tokens",
336
+ CONVERSATION_ID: "gen_ai.conversation.id"
337
+ };
338
+ var METRIC = {
339
+ TOKEN_USAGE: "epoch.token.usage",
340
+ TOOL_CALL_COUNT: "epoch.tool.call.count",
341
+ TOOL_CALL_LATENCY: "epoch.tool.call.latency",
342
+ TOOL_APPROVAL: "epoch.tool.approval.count",
343
+ LLM_CALL_LATENCY: "epoch.llm.call.latency",
344
+ PROVIDER_FALLBACK: "epoch.provider.fallback.count",
345
+ /**
346
+ * 换模型的次数(方案 26 #13)。属性 `origin` 分辨谁换的
347
+ * (`user-switch` / `command-frontmatter` / `fallback`)。
348
+ *
349
+ * 和 {@link METRIC.MODEL_FALLBACK} 分成两个名字而不是靠一个属性区分,
350
+ * 是因为看板上「用户主动换了几次」和「引擎被迫降了几次」是两条完全不同的
351
+ * 曲线:前者高说明默认模型选得不好,后者高说明 provider 在抖。
352
+ */
353
+ MODEL_SWITCH: "epoch.model.switch.count",
354
+ /** 同一 provider 内模型级降级的次数(方案 26 #10/#11),属性带 from/to */
355
+ MODEL_FALLBACK: "epoch.model.fallback.count",
356
+ CONTEXT_COMPACTION: "epoch.context.compaction.count",
357
+ STARTUP_DURATION: "epoch.startup.duration"
358
+ };
359
+ var NOOP_SPAN = {
360
+ setAttribute: () => {
361
+ },
362
+ recordError: () => {
363
+ },
364
+ end: () => {
365
+ }
366
+ };
367
+ var NOOP_TELEMETRY = {
368
+ startSpan: () => NOOP_SPAN,
369
+ counter: () => {
370
+ },
371
+ histogram: () => {
372
+ }
373
+ };
374
+
375
+ // src/permission.ts
376
+ var PERMISSION_LEVELS = [
377
+ "default",
378
+ "acceptEdits",
379
+ "plan",
380
+ "auto",
381
+ "bypass"
382
+ ];
383
+ function isPermissionLevel(value) {
384
+ return PERMISSION_LEVELS.includes(value);
385
+ }
386
+ var OPERATION_TYPES = [
387
+ "file_read",
388
+ "file_write",
389
+ "command",
390
+ "network",
391
+ "code_exec"
392
+ ];
393
+ function isOperationType(value) {
394
+ return OPERATION_TYPES.includes(value);
395
+ }
396
+ var OUTCOME_SET = {
397
+ "allow-once": true,
398
+ "allow-session": true,
399
+ "allow-always": true,
400
+ deny: true,
401
+ "plan-execute": true,
402
+ "plan-readonly": true,
403
+ "plan-revise": true
404
+ };
405
+ var APPROVAL_OUTCOMES = Object.keys(
406
+ OUTCOME_SET
407
+ );
408
+ function isApprovalOutcome(value) {
409
+ return Object.hasOwn(OUTCOME_SET, value);
410
+ }
411
+ function normalizeApproval(reply) {
412
+ return typeof reply === "string" ? { outcome: reply } : reply;
413
+ }
414
+
415
+ // src/plan.ts
416
+ var PLAN_OUTCOMES = ["plan-execute", "plan-readonly", "plan-revise"];
417
+ function isPlanOutcome(value) {
418
+ return PLAN_OUTCOMES.includes(value);
419
+ }
420
+ var PLAN_OUTCOME_LABELS = {
421
+ "plan-execute": "\u6279\u51C6\u5E76\u6267\u884C",
422
+ "plan-readonly": "\u6279\u51C6\uFF0C\u4F46\u4FDD\u6301\u53EA\u8BFB",
423
+ "plan-revise": "\u8BA9\u6211\u6539\u4E00\u4E0B",
424
+ deny: "\u62D2\u7EDD"
425
+ };
426
+
427
+ // src/schedule.ts
428
+ var SCHEDULE_INTERVAL_MINUTES = [
429
+ 5,
430
+ 10,
431
+ 15,
432
+ 20,
433
+ 30,
434
+ 60,
435
+ 120,
436
+ 180,
437
+ 240,
438
+ 360,
439
+ 480,
440
+ 720
441
+ ];
442
+ var SCHEDULE_RUN_STATUSES = [
443
+ "ok",
444
+ "failed",
445
+ "denied",
446
+ "timeout",
447
+ "budget",
448
+ "skipped-overlap",
449
+ "skipped-window",
450
+ "missed"
451
+ ];
452
+
453
+ // src/question.ts
454
+ var MAX_QUESTIONS = 4;
455
+ var MIN_OPTIONS = 2;
456
+ var MAX_OPTIONS = 4;
457
+ var MAX_HEADER_CHARS = 12;
458
+ function isQuestionAnswerMap(value) {
459
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
460
+ return Object.values(value).every(
461
+ (v) => typeof v === "string" || Array.isArray(v) && v.every((x) => typeof x === "string")
462
+ );
463
+ }
464
+
465
+ // src/message.ts
466
+ var OMIT_LABEL = {
467
+ binary: "\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u672A\u9644\u5185\u5BB9",
468
+ denied: "\u6743\u9650\u672A\u653E\u884C\uFF0C\u672A\u9644\u5185\u5BB9",
469
+ unreadable: "\u8BFB\u53D6\u5931\u8D25\uFF0C\u672A\u9644\u5185\u5BB9",
470
+ "over-limit": "\u8D85\u51FA\u672C\u6761\u6D88\u606F\u7684\u9644\u4EF6\u4E0A\u9650\uFF0C\u672A\u9644\u5185\u5BB9",
471
+ "not-restored": "\u4F1A\u8BDD\u6062\u590D\u540E\u4E0D\u91CD\u8BFB\u5185\u5BB9\uFF0C\u9700\u8981\u5C31\u8C03 file_read"
472
+ };
473
+ function filePartSummary(part) {
474
+ if (part.omitted) return `[\u6587\u4EF6 ${part.path}\uFF1A${OMIT_LABEL[part.omitted]}]`;
475
+ const truncated = part.truncatedTo === void 0 ? "" : `\uFF0C\u5DF2\u622A\u65AD\u5230 ${part.truncatedTo} \u5B57\u8282`;
476
+ return `[\u6587\u4EF6 ${part.path}${truncated}]`;
477
+ }
478
+ function contentToText(content) {
479
+ if (typeof content === "string") return content;
480
+ return content.map((p) => {
481
+ if (p.type === "text") return p.text;
482
+ if (p.type === "file") return filePartSummary(p);
483
+ return `[\u56FE\u7247 ${p.mediaType ?? "\u672A\u77E5\u7C7B\u578B"}]`;
484
+ }).join("\n");
485
+ }
486
+
487
+ // src/mentions.ts
488
+ var CJK_PUNCT = "\uFF0C\u3002\uFF1B\uFF1A\uFF01\uFF1F\u3001\uFF09\u3011\u300B\u300D\u300F\uFF08\u3010\u300A\u300C\u300E";
489
+ var MENTION_RE = new RegExp(String.raw`(^|\s)@([^\s${CJK_PUNCT}]+)`, "gu");
490
+ function extractMentions(text) {
491
+ const out = [];
492
+ const seen = /* @__PURE__ */ new Set();
493
+ for (const match of text.matchAll(MENTION_RE)) {
494
+ const raw = (match[2] ?? "").split("\\").join("/");
495
+ const path = raw.replace(/[,.;:!?)\]}]+$/u, "");
496
+ if (!path || seen.has(path)) continue;
497
+ seen.add(path);
498
+ out.push(path);
499
+ }
500
+ return out;
501
+ }
502
+
503
+ // src/system-note.ts
504
+ var SYSTEM_NOTE_PREFIX = "[\u7CFB\u7EDF] ";
505
+ function systemNote(body) {
506
+ return `${SYSTEM_NOTE_PREFIX}${body}`;
507
+ }
508
+ function stripSystemNote(text) {
509
+ if (!text.startsWith(SYSTEM_NOTE_PREFIX)) return void 0;
510
+ return text.slice(SYSTEM_NOTE_PREFIX.length);
511
+ }
512
+
513
+ // src/usage.ts
514
+ function promptTokens(usage) {
515
+ return usage.inputTokens + (usage.cacheHitTokens ?? 0) + (usage.cacheWriteTokens ?? 0);
516
+ }
517
+ function compressionThresholdTokens(contextLength, threshold) {
518
+ return contextLength * threshold;
519
+ }
520
+ function isContextNearlyFull(prompt, contextLength, threshold) {
521
+ return prompt >= compressionThresholdTokens(contextLength, threshold);
522
+ }
523
+ function totalUsageTokens(usage) {
524
+ return usage.totalTokens ?? promptTokens(usage) + usage.outputTokens;
525
+ }
526
+
527
+ // src/wire.ts
528
+ var HUB_EVENT_TYPES = /* @__PURE__ */ new Set([
529
+ "connected",
530
+ "session-state",
531
+ "approval-resolved",
532
+ "question-resolved",
533
+ "stream-reset",
534
+ "session-cooled"
535
+ ]);
536
+ function isWireHubEvent(event) {
537
+ return HUB_EVENT_TYPES.has(event.type);
538
+ }
539
+ var WIRE_AUTH_COOKIE = "epoch_web_token";
540
+ var WIRE_AUTH_TOKEN_PARAM = "token";
541
+ var WIRE_AUTH_COOKIE_ATTRS = "HttpOnly; SameSite=Strict; Path=/";
542
+
543
+ // src/headless-wire.ts
544
+ var HEADLESS_PROTOCOL_VERSION = 1;
545
+ var HEADLESS_OUTPUT_FORMATS = ["text", "json", "stream-json"];
546
+ function isHeadlessOutputFormat(value) {
547
+ return HEADLESS_OUTPUT_FORMATS.includes(value);
548
+ }
549
+ var HEADLESS_INPUT_FORMATS = ["text", "stream-json"];
550
+ function isHeadlessInputFormat(value) {
551
+ return HEADLESS_INPUT_FORMATS.includes(value);
552
+ }
553
+ var LIFECYCLE_EVENT_TYPES = /* @__PURE__ */ new Set([
554
+ "init",
555
+ "result"
556
+ ]);
557
+ function isHeadlessLifecycleEvent(event) {
558
+ return LIFECYCLE_EVENT_TYPES.has(event.type);
559
+ }
560
+ var HEADLESS_INPUT_EVENT_TYPES = /* @__PURE__ */ new Set([
561
+ "user-message",
562
+ "approval-response",
563
+ "question-response",
564
+ "abort",
565
+ "close"
566
+ ]);
567
+
568
+ // src/wire-rest.ts
569
+ function wireFields() {
570
+ return (spec) => Object.keys(spec);
571
+ }
572
+ function conformsToWire(value, fields) {
573
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
574
+ const record = value;
575
+ return fields.every((field) => field in record && record[field] !== void 0);
576
+ }
577
+ var WIRE_HEALTH_FIELDS = wireFields()({
578
+ ok: true,
579
+ version: true
580
+ });
581
+ var WIRE_WORKSPACE_REF_FIELDS = wireFields()({
582
+ root: true,
583
+ name: true
584
+ });
585
+ var WIRE_SESSION_WORKSPACE_FIELDS = wireFields()({
586
+ root: true,
587
+ name: true,
588
+ extraRoots: true,
589
+ trusted: true,
590
+ instructionFiles: true,
591
+ skippedInstructionFiles: true
592
+ });
593
+ var WIRE_COMPRESSION_LINE_FIELDS = wireFields()({
594
+ contextLength: true,
595
+ threshold: true,
596
+ auto: true
597
+ });
598
+ var WIRE_ABOUT_FIELDS = wireFields()({
599
+ version: true,
600
+ nodeVersion: true,
601
+ platform: true,
602
+ homeDir: true,
603
+ dbPath: true
604
+ // ⚠️ `profile` 是可选键,故意不在这张表上(同 `WIRE_CONFIG_FIELDS` 那条 ⚠️)
605
+ });
606
+ var WIRE_CONFIG_FIELDS = wireFields()({
607
+ sessionId: true,
608
+ model: true,
609
+ permission: true,
610
+ workspace: true,
611
+ knownWorkspaces: true,
612
+ usageScope: true,
613
+ compression: true,
614
+ provider: true,
615
+ tools: true,
616
+ diagnostics: true,
617
+ about: true,
618
+ lanExposed: true
619
+ // ⚠️ `maxCostUsd` 和 `brand` **故意不在这张表上**,它们是可选键 ——
620
+ // 写进来编译不过(见 `wireFields` 那条 ⚠️)。这份清单是 `conformsToWire()`
621
+ // 的运行时判据,可选键一旦进来,「宿主没配所以没这个键」就会被判成不合契约,
622
+ // 而那恰恰是这两个字段的**正常形态**
623
+ });
624
+ var WIRE_SESSION_SUMMARY_FIELDS = wireFields()({
625
+ id: true,
626
+ state: true,
627
+ live: true,
628
+ title: true,
629
+ model: true,
630
+ messageCount: true,
631
+ costUsd: true,
632
+ startedAt: true,
633
+ updatedAt: true,
634
+ endedAt: true,
635
+ pendingApprovals: true,
636
+ pendingQuestions: true,
637
+ pendingSince: true,
638
+ workspace: true,
639
+ turnStartedAt: true,
640
+ lastFinish: true,
641
+ role: true
642
+ });
643
+ var WIRE_SESSION_FINISH_FIELDS = wireFields()({
644
+ reason: true,
645
+ durationMs: true,
646
+ runUsage: true
647
+ });
648
+ var WIRE_SESSION_LIST_FIELDS = wireFields()({
649
+ sessions: true
650
+ });
651
+ var WIRE_CREATE_SESSION_FIELDS = wireFields()({
652
+ sessionId: true,
653
+ created: true,
654
+ workspace: true
655
+ });
656
+ var WIRE_SESSION_RESPONSE_FIELDS = wireFields()({
657
+ session: true
658
+ });
659
+ var WIRE_DELETE_SESSION_FIELDS = wireFields()({
660
+ deleted: true,
661
+ checkpointsRemoved: true
662
+ });
663
+ var WIRE_PATCH_SESSION_FIELDS = wireFields()({
664
+ title: true
665
+ });
666
+ var WIRE_PATCH_SESSION_RESPONSE_FIELDS = wireFields()({
667
+ session: true
668
+ });
669
+ var WIRE_MESSAGE_LIST_FIELDS = wireFields()({
670
+ messages: true
671
+ });
672
+ var WIRE_SEND_MESSAGE_FIELDS = wireFields()({
673
+ message: true
674
+ // `role` 是可选的,所以**不在**清单里 —— 同下面 `command` 那条。
675
+ // 绝大多数消息不挑专家,写进来等于让正常路径判成不合契约
676
+ });
677
+ var WIRE_SEND_MESSAGE_RESPONSE_FIELDS = wireFields()({
678
+ accepted: true,
679
+ queued: true
680
+ // `command` 是可选的,所以**不在**清单里 —— 见 `wireFields` 的那条警告。
681
+ // 绝大多数消息不是命令,把它写进来等于让正常路径判成不合契约
682
+ });
683
+ var WIRE_ABORT_FIELDS = wireFields()({
684
+ aborted: true
685
+ });
686
+ var WIRE_APPROVAL_LIST_FIELDS = wireFields()({
687
+ state: true,
688
+ approvals: true
689
+ });
690
+ var WIRE_APPROVAL_ROW_FIELDS = wireFields()({
691
+ type: true,
692
+ requestId: true,
693
+ request: true
694
+ });
695
+ var WIRE_RESPOND_APPROVAL_FIELDS = wireFields()({
696
+ outcome: true
697
+ });
698
+ var WIRE_RESPOND_APPROVAL_RESPONSE_FIELDS = wireFields()({
699
+ resolved: true
700
+ });
701
+ var WIRE_QUESTION_LIST_FIELDS = wireFields()({
702
+ state: true,
703
+ questions: true
704
+ });
705
+ var WIRE_QUESTION_ROW_FIELDS = wireFields()({
706
+ type: true,
707
+ requestId: true,
708
+ request: true
709
+ });
710
+ var WIRE_RESPOND_QUESTION_FIELDS = wireFields()({
711
+ answers: true
712
+ });
713
+ var WIRE_RESPOND_QUESTION_RESPONSE_FIELDS = wireFields()({
714
+ resolved: true
715
+ });
716
+ var WIRE_DIFF_FILE_FIELDS = wireFields()({
717
+ path: true,
718
+ status: true,
719
+ oldContent: true,
720
+ newContent: true,
721
+ oldBytes: true,
722
+ newBytes: true
723
+ });
724
+ var WIRE_WORKSPACE_DIFF_FIELDS = wireFields()({
725
+ source: true,
726
+ root: true,
727
+ files: true,
728
+ truncated: true,
729
+ notes: true
730
+ });
731
+ var WIRE_PLAN_FIELDS = wireFields()({
732
+ plan: true,
733
+ mode: true
734
+ });
735
+ var WIRE_SESSION_WORKSPACE_RESPONSE_FIELDS = wireFields()({
736
+ binding: true
737
+ });
738
+ var WIRE_ERROR_FIELDS = wireFields()({
739
+ error: true
740
+ });
741
+ var WIRE_BACKGROUND_TASK_FIELDS = wireFields()({
742
+ info: true,
743
+ output: true,
744
+ omittedBytes: true
745
+ });
746
+ var WIRE_TASKS_FIELDS = wireFields()({
747
+ tasks: true
748
+ });
749
+ var WIRE_PLAN_MODE_STATE_FIELDS = wireFields()({
750
+ active: true,
751
+ from: true
752
+ });
753
+ var WIRE_PLAN_ACTIONS = ["enter", "exit"];
754
+ function isWirePlanAction(value) {
755
+ return WIRE_PLAN_ACTIONS.includes(value);
756
+ }
757
+ var WIRE_PLAN_MODE_REQUEST_FIELDS = wireFields()({
758
+ action: true
759
+ });
760
+ var WIRE_PLAN_MODE_RESPONSE_FIELDS = wireFields()({
761
+ mode: true,
762
+ changed: true
763
+ });
764
+ var WIRE_CHECKPOINT_SUMMARY_FIELDS = wireFields()({
765
+ turnIndex: true,
766
+ createdAt: true,
767
+ preview: true,
768
+ fileCount: true,
769
+ incomplete: true
770
+ });
771
+ var WIRE_CHECKPOINT_LIST_FIELDS = wireFields()({
772
+ checkpoints: true
773
+ });
774
+ var WIRE_REWIND_FILE_PLAN_FIELDS = wireFields()({
775
+ path: true,
776
+ action: true,
777
+ drift: true
778
+ });
779
+ var WIRE_REWIND_PREVIEW_FIELDS = wireFields()({
780
+ turnIndex: true,
781
+ createdAt: true,
782
+ preview: true,
783
+ canRewindConversation: true,
784
+ incomplete: true,
785
+ files: true,
786
+ conflicts: true
787
+ });
788
+ var WIRE_REWIND_SCOPES = ["files", "conversation", "both"];
789
+ function isWireRewindScope(value) {
790
+ return WIRE_REWIND_SCOPES.includes(value);
791
+ }
792
+ var WIRE_REWIND_REQUEST_FIELDS = wireFields()({
793
+ turnIndex: true,
794
+ scope: true
795
+ });
796
+ var WIRE_REWIND_OUTCOME_FIELDS = wireFields()({
797
+ restored: true,
798
+ deleted: true,
799
+ recreated: true,
800
+ skippedConflicts: true
801
+ });
802
+ var WIRE_REWIND_RESPONSE_FIELDS = wireFields()({
803
+ files: true,
804
+ messagesRemoved: true
805
+ });
806
+ var WIRE_CUSTOM_COMMAND_FIELDS = wireFields()({
807
+ name: true,
808
+ description: true
809
+ });
810
+ var WIRE_COMMANDS_FIELDS = wireFields()({
811
+ commands: true
812
+ });
813
+ var WIRE_COMMAND_EXPANSION_FIELDS = wireFields()({
814
+ name: true,
815
+ warnings: true
816
+ });
817
+ var WIRE_WORKSPACE_DIR_ENTRY_FIELDS = wireFields()({
818
+ name: true,
819
+ path: true,
820
+ known: true,
821
+ readable: true,
822
+ group: true
823
+ });
824
+ var WIRE_WORKSPACE_DIRS_FIELDS = wireFields()({
825
+ path: true,
826
+ parent: true,
827
+ entries: true,
828
+ omitted: true,
829
+ hidden: true
830
+ });
831
+ var WIRE_CREATE_WORKSPACE_FIELDS = wireFields()({
832
+ parent: true,
833
+ name: true
834
+ });
835
+ var WIRE_CREATE_WORKSPACE_RESPONSE_FIELDS = wireFields()({
836
+ entry: true
837
+ });
838
+
839
+ // src/wire-capability.ts
840
+ var WIRE_AGENT_ROLE_FIELDS = wireFields()({
841
+ name: true,
842
+ description: true,
843
+ source: true,
844
+ tools: true,
845
+ maxTurns: true,
846
+ toolsCut: true
847
+ });
848
+ var WIRE_SKILL_FIELDS = wireFields()({
849
+ name: true,
850
+ category: true,
851
+ description: true,
852
+ tokens: true,
853
+ scope: true,
854
+ type: true
855
+ });
856
+ var WIRE_BUILTIN_CONNECTOR_FIELDS = wireFields()({
857
+ name: true,
858
+ toolCount: true
859
+ });
860
+ var WIRE_MCP_CONNECTOR_FIELDS = wireFields()({
861
+ name: true,
862
+ state: true,
863
+ toolCount: true,
864
+ reconnectAttempts: true,
865
+ source: true
866
+ });
867
+ var WIRE_CAPABILITY_PROJECT_FIELDS = wireFields()({
868
+ root: true,
869
+ trusted: true
870
+ });
871
+ var WIRE_CAPABILITIES_FIELDS = wireFields()({
872
+ roles: true,
873
+ skills: true,
874
+ builtinConnectors: true,
875
+ mcpServers: true,
876
+ project: true
877
+ });
878
+ var WIRE_MCP_RECONNECT_FIELDS = wireFields()({
879
+ ok: true,
880
+ server: true
881
+ });
882
+ var WIRE_MCP_ADD_FIELDS = wireFields()({
883
+ name: true,
884
+ transport: true
885
+ });
886
+ var WIRE_MCP_ADD_RESPONSE_FIELDS = wireFields()({
887
+ server: true,
888
+ configPath: true
889
+ });
890
+ var WIRE_SKILL_BODY_FIELDS = wireFields()({
891
+ name: true,
892
+ body: true,
893
+ truncated: true,
894
+ bytes: true
895
+ });
896
+ var WIRE_SKILL_IMPORT_PREVIEW_FIELDS = wireFields()({
897
+ ok: true,
898
+ source: true,
899
+ form: true,
900
+ skills: true,
901
+ issues: true,
902
+ token: true,
903
+ detail: true,
904
+ reason: true
905
+ });
906
+ var WIRE_SKILL_IMPORT_FIELDS = wireFields()({
907
+ ok: true,
908
+ imported: true,
909
+ skipped: true,
910
+ detail: true,
911
+ reason: true
912
+ });
913
+
914
+ // src/wire-agent-role.ts
915
+ var WIRE_ROLE_ADD_FIELDS = wireFields()({
916
+ name: true,
917
+ description: true
918
+ });
919
+ var WIRE_ROLE_ADD_RESPONSE_FIELDS = wireFields()({
920
+ role: true,
921
+ path: true
922
+ });
923
+
924
+ // src/wire-mcp-config.ts
925
+ var WIRE_MCP_CONFIG_ISSUE_FIELDS = wireFields()({
926
+ path: true,
927
+ message: true
928
+ });
929
+ var WIRE_MCP_CONFIG_FIELDS = wireFields()({
930
+ configPath: true,
931
+ text: true,
932
+ exists: true,
933
+ revision: true,
934
+ issues: true
935
+ });
936
+ var WIRE_MCP_CONFIG_SAVE_FIELDS = wireFields()({
937
+ text: true,
938
+ revision: true
939
+ });
940
+ var WIRE_MCP_CONFIG_SAVE_RESPONSE_FIELDS = wireFields()({
941
+ configPath: true,
942
+ revision: true,
943
+ issues: true
944
+ });
945
+ var WIRE_MCP_CONFIG_APPLY_FIELDS = wireFields()({
946
+ revision: true
947
+ });
948
+ var WIRE_MCP_APPLY_ENTRY_FIELDS = wireFields()({
949
+ name: true,
950
+ action: true
951
+ });
952
+ var WIRE_MCP_APPLY_RESPONSE_FIELDS = wireFields()({
953
+ configPath: true,
954
+ revision: true,
955
+ issues: true,
956
+ changes: true
957
+ });
958
+
959
+ // src/wire-security.ts
960
+ var WIRE_SANDBOX_STATUS_FIELDS = wireFields()({
961
+ level: true,
962
+ backend: true,
963
+ reason: true,
964
+ platform: true,
965
+ covers: true,
966
+ excludes: true
967
+ });
968
+ var WIRE_PERMISSION_RULE_FIELDS = wireFields()({
969
+ verdict: true,
970
+ rule: true,
971
+ layer: true
972
+ });
973
+ var WIRE_PERMISSION_SHADOW_FIELDS = wireFields()({
974
+ kind: true,
975
+ rule: true,
976
+ by: true
977
+ });
978
+ var WIRE_MANAGED_LOCK_FIELDS = wireFields()({
979
+ present: true,
980
+ path: true,
981
+ rulesOnly: true,
982
+ bypassDisabled: true
983
+ });
984
+ var WIRE_PERMISSION_STATUS_FIELDS = wireFields()({
985
+ level: true,
986
+ configured: true,
987
+ configuredLayer: true,
988
+ rules: true,
989
+ shadows: true,
990
+ managed: true
991
+ });
992
+ var WIRE_SECURITY_WORKSPACE_FIELDS = wireFields()({
993
+ root: true,
994
+ name: true,
995
+ extraRoots: true,
996
+ trusted: true,
997
+ instructionFiles: true,
998
+ skippedInstructionFiles: true,
999
+ trustLevel: true,
1000
+ unloadedExtraInstructionFiles: true
1001
+ });
1002
+ var WIRE_KNOWN_WORKSPACE_FIELDS = wireFields()({
1003
+ root: true,
1004
+ name: true,
1005
+ level: true,
1006
+ trusted: true,
1007
+ current: true
1008
+ });
1009
+ var WIRE_POLICY_DIR_FIELDS = wireFields()({
1010
+ dir: true,
1011
+ source: true,
1012
+ ruleCount: true
1013
+ });
1014
+ var WIRE_POLICY_STATUS_FIELDS = wireFields()({
1015
+ dirs: true,
1016
+ projectSkipped: true,
1017
+ skippedDir: true
1018
+ });
1019
+ var WIRE_AUDIT_ROW_FIELDS = wireFields()({
1020
+ at: true,
1021
+ toolName: true,
1022
+ type: true,
1023
+ target: true,
1024
+ outcome: true,
1025
+ code: true
1026
+ });
1027
+ var WIRE_AUDIT_LOG_FIELDS = wireFields()({
1028
+ rows: true,
1029
+ dropped: true
1030
+ });
1031
+ var WIRE_SECURITY_FIELDS = wireFields()({
1032
+ sandbox: true,
1033
+ permission: true,
1034
+ workspace: true,
1035
+ knownWorkspaces: true,
1036
+ policy: true,
1037
+ audit: true
1038
+ });
1039
+
1040
+ // src/wire-permission.ts
1041
+ var WIRE_BLOCKED_LEVEL_FIELDS = wireFields()({
1042
+ level: true,
1043
+ reason: true
1044
+ });
1045
+ var WIRE_PERMISSION_STATE_FIELDS = wireFields()({
1046
+ level: true,
1047
+ editable: true,
1048
+ blocked: true,
1049
+ planMode: true
1050
+ });
1051
+ var WIRE_PERMISSION_SET_REQUEST_FIELDS = wireFields()({
1052
+ level: true
1053
+ });
1054
+ var WIRE_PERMISSION_SET_RESPONSE_FIELDS = wireFields()({
1055
+ ok: true,
1056
+ changed: true,
1057
+ state: true
1058
+ });
1059
+
1060
+ // src/wire-settings.ts
1061
+ var WIRE_SETTING_WRITE_LAYERS = ["user", "projectLocal"];
1062
+ function isWireSettingWriteLayer(value) {
1063
+ return typeof value === "string" && WIRE_SETTING_WRITE_LAYERS.includes(value);
1064
+ }
1065
+ var WIRE_SETTING_WRITE_FIELDS = wireFields()({
1066
+ layer: true,
1067
+ path: true,
1068
+ apply: true
1069
+ });
1070
+ var WIRE_SETTING_STEP_FIELDS = wireFields()({ layer: true });
1071
+ var WIRE_SETTING_ROW_FIELDS = wireFields()({
1072
+ key: true,
1073
+ layer: true,
1074
+ chain: true,
1075
+ overridable: true,
1076
+ writes: true
1077
+ });
1078
+ var WIRE_SETTINGS_FIELDS = wireFields()({
1079
+ rows: true,
1080
+ overridableKeys: true,
1081
+ managedPath: true
1082
+ });
1083
+ var WIRE_SETTINGS_WRITE_REQUEST_FIELDS = wireFields()({
1084
+ key: true,
1085
+ layer: true,
1086
+ value: true
1087
+ });
1088
+ var WIRE_SETTINGS_WRITE_FIELDS = wireFields()({
1089
+ key: true,
1090
+ layer: true,
1091
+ path: true,
1092
+ value: true,
1093
+ apply: true
1094
+ });
1095
+
1096
+ // src/wire-model.ts
1097
+ var WIRE_MODEL_SELECTION_FIELDS = wireFields()({
1098
+ provider: true,
1099
+ model: true,
1100
+ origin: true
1101
+ });
1102
+ var WIRE_MODEL_FIELDS = wireFields()({
1103
+ selection: true,
1104
+ configured: true
1105
+ });
1106
+ var WIRE_MODEL_SET_FIELDS = wireFields()({
1107
+ model: true
1108
+ });
1109
+
1110
+ // src/wire-provider.ts
1111
+ var WIRE_PROVIDER_OPTION_FIELDS = wireFields()({
1112
+ type: true,
1113
+ label: true,
1114
+ envVar: true,
1115
+ hasKey: true
1116
+ });
1117
+ var WIRE_PROVIDERS_FIELDS = wireFields()({
1118
+ providers: true
1119
+ });
1120
+ var WIRE_MODEL_SUGGESTIONS_FIELDS = wireFields()({
1121
+ provider: true,
1122
+ models: true,
1123
+ source: true,
1124
+ status: true
1125
+ });
1126
+ var WIRE_PROVIDER_MODELS_FIELDS = wireFields()({
1127
+ suggestions: true
1128
+ });
1129
+
1130
+ // src/wire-tools.ts
1131
+ var WIRE_TOOL_GATE_FIELDS = wireFields()({
1132
+ verdict: true,
1133
+ by: true,
1134
+ conditional: true
1135
+ // ⚠️ `rule` / `layer` 是可选键,**故意不在这张表上**(同 `WIRE_CONFIG_FIELDS`
1136
+ // 那条 ⚠️):没命中规则、或者反查不到层,正是它们的正常形态
1137
+ });
1138
+ var WIRE_TOOL_ROW_FIELDS = wireFields()({
1139
+ name: true,
1140
+ description: true,
1141
+ source: true,
1142
+ type: true,
1143
+ calls: true
1144
+ // ⚠️ `gate` 是可选键,理由同上面那条
1145
+ });
1146
+ var WIRE_TOOLS_FIELDS = wireFields()({
1147
+ tools: true,
1148
+ level: true
1149
+ });
1150
+
1151
+ // src/wire-artifacts.ts
1152
+ var WIRE_FILE_CHANGE_FIELDS = wireFields()({
1153
+ path: true,
1154
+ tool: true,
1155
+ writes: true,
1156
+ messageId: true
1157
+ });
1158
+ var WIRE_ARTIFACTS_FIELDS = wireFields()({
1159
+ changes: true,
1160
+ root: true
1161
+ });
1162
+
1163
+ // src/wire-schedule.ts
1164
+ var WIRE_SCHEDULE_ISSUE_CODES = [
1165
+ "name-empty",
1166
+ "prompt-empty",
1167
+ "permission-unknown",
1168
+ "work-dir-missing",
1169
+ "budget-missing",
1170
+ "max-turns-invalid",
1171
+ "timeout-invalid",
1172
+ "trigger-time-invalid",
1173
+ "trigger-weekdays-empty",
1174
+ "trigger-days-invalid",
1175
+ "trigger-interval-invalid",
1176
+ "trigger-once-date-invalid",
1177
+ "trigger-once-past",
1178
+ "date-range-invalid",
1179
+ "date-range-on-once",
1180
+ "rule-invalid",
1181
+ "bypass-needs-workdir",
1182
+ "bypass-workdir-too-broad",
1183
+ "bypass-needs-limits",
1184
+ "bypass-not-confirmed"
1185
+ ];
1186
+ var WIRE_SCHEDULE_CAPABILITY_FIELDS = wireFields()({
1187
+ backend: true,
1188
+ canRegister: true
1189
+ });
1190
+ var WIRE_SCHEDULE_DEFAULTS_FIELDS = wireFields()({
1191
+ maxTurns: true,
1192
+ timeoutMs: true,
1193
+ allowTools: true,
1194
+ allowOperations: true,
1195
+ allowRules: true
1196
+ });
1197
+ var WIRE_SCHEDULE_ROW_FIELDS = wireFields()({
1198
+ schedule: true,
1199
+ nextRunAt: true,
1200
+ allowlistApplies: true
1201
+ });
1202
+ var WIRE_SCHEDULE_LIST_FIELDS = wireFields()({
1203
+ schedules: true,
1204
+ capability: true,
1205
+ defaults: true,
1206
+ recentRuns: true
1207
+ });
1208
+ var WIRE_SCHEDULE_FIELDS = wireFields()({ row: true });
1209
+ var WIRE_SCHEDULE_RUNS_FIELDS = wireFields()({ runs: true });
1210
+ var WIRE_SCHEDULE_CREATE_FIELDS = wireFields()({
1211
+ name: true,
1212
+ prompt: true,
1213
+ permission: true,
1214
+ trigger: true,
1215
+ maxBudgetUsd: true
1216
+ });
1217
+ var WIRE_SCHEDULE_SAVE_FIELDS = wireFields()({
1218
+ ok: true,
1219
+ issues: true
1220
+ });
1221
+ var WIRE_SCHEDULE_DELETE_FIELDS = wireFields()({
1222
+ removed: true
1223
+ });
1224
+ var WIRE_SCHEDULE_RUN_FIELDS = wireFields()({
1225
+ status: true,
1226
+ exitCode: true
1227
+ });
1228
+ var WIRE_SCHEDULE_FIX_FIELDS = wireFields()({
1229
+ added: true,
1230
+ row: true
1231
+ });
1232
+ var WIRE_SCHEDULE_FIX_REQUEST_FIELDS = wireFields()({
1233
+ runId: true
1234
+ });
1235
+ var WIRE_SCHEDULE_RECORDING_FIELDS = wireFields()({
1236
+ runId: true,
1237
+ frames: true,
1238
+ missing: true,
1239
+ truncated: true
1240
+ });
1241
+
1242
+ // src/secret.ts
1243
+ var SECRET_SERVICE = "epoch-agent";
1244
+ var MCP_DATA_KEY_NAME = "mcp-auth-data-key";
1245
+
1246
+ // src/i18n.ts
1247
+ var LANGS = ["zh", "en"];
1248
+ var DEFAULT_LANG = "zh";
1249
+ function isLang(value) {
1250
+ return LANGS.includes(value);
1251
+ }
1252
+ var WIRE_LANG_PARAM = "lang";
1253
+
1254
+ export { ACTION_CONTEXTS, AGENT_ROLE_NAME_PATTERN, API_KEY_ENV_VARS, APPROVAL_OUTCOMES, COMMAND_NAME_PATTERN, DEFAULT_AGENT_ROLE, DEFAULT_LANG, DiagnosticSink, GEN_AI, HEADLESS_INPUT_EVENT_TYPES, HEADLESS_INPUT_FORMATS, HEADLESS_OUTPUT_FORMATS, HEADLESS_PROTOCOL_VERSION, KEY_ACTIONS, LANGS, MAX_HEADER_CHARS, MAX_OPTIONS, MAX_QUESTIONS, MCP_DATA_KEY_NAME, METRIC, MIN_OPTIONS, NOOP_TELEMETRY, OPERATION_TYPES, PERMISSION_LEVELS, PLAN_OUTCOMES, PLAN_OUTCOME_LABELS, PROVIDER_INFOS, PROVIDER_TYPES, RESERVED_CHORDS, RESERVED_COMMAND_NAMES, SCHEDULE_INTERVAL_MINUTES, SCHEDULE_RUN_STATUSES, SEARCH_API_KEY_ENV, SEARCH_PROVIDER_TYPES, SECRET_SERVICE, SHELL_KINDS, SIMULTANEOUS_CONTEXTS, SYSTEM_NOTE_PREFIX, ToolExposure, WIRE_ABORT_FIELDS, WIRE_ABOUT_FIELDS, WIRE_AGENT_ROLE_FIELDS, WIRE_APPROVAL_LIST_FIELDS, WIRE_APPROVAL_ROW_FIELDS, WIRE_ARTIFACTS_FIELDS, WIRE_AUDIT_LOG_FIELDS, WIRE_AUDIT_ROW_FIELDS, WIRE_AUTH_COOKIE, WIRE_AUTH_COOKIE_ATTRS, WIRE_AUTH_TOKEN_PARAM, WIRE_BACKGROUND_TASK_FIELDS, WIRE_BLOCKED_LEVEL_FIELDS, WIRE_BUILTIN_CONNECTOR_FIELDS, WIRE_CAPABILITIES_FIELDS, WIRE_CAPABILITY_PROJECT_FIELDS, WIRE_CHECKPOINT_LIST_FIELDS, WIRE_CHECKPOINT_SUMMARY_FIELDS, WIRE_COMMANDS_FIELDS, WIRE_COMMAND_EXPANSION_FIELDS, WIRE_COMPRESSION_LINE_FIELDS, WIRE_CONFIG_FIELDS, WIRE_CREATE_SESSION_FIELDS, WIRE_CREATE_WORKSPACE_FIELDS, WIRE_CREATE_WORKSPACE_RESPONSE_FIELDS, WIRE_CUSTOM_COMMAND_FIELDS, WIRE_DELETE_SESSION_FIELDS, WIRE_DIFF_FILE_FIELDS, WIRE_ERROR_FIELDS, WIRE_FILE_CHANGE_FIELDS, WIRE_HEALTH_FIELDS, WIRE_KNOWN_WORKSPACE_FIELDS, WIRE_LANG_PARAM, WIRE_MANAGED_LOCK_FIELDS, WIRE_MCP_ADD_FIELDS, WIRE_MCP_ADD_RESPONSE_FIELDS, WIRE_MCP_APPLY_ENTRY_FIELDS, WIRE_MCP_APPLY_RESPONSE_FIELDS, WIRE_MCP_CONFIG_APPLY_FIELDS, WIRE_MCP_CONFIG_FIELDS, WIRE_MCP_CONFIG_ISSUE_FIELDS, WIRE_MCP_CONFIG_SAVE_FIELDS, WIRE_MCP_CONFIG_SAVE_RESPONSE_FIELDS, WIRE_MCP_CONNECTOR_FIELDS, WIRE_MCP_RECONNECT_FIELDS, WIRE_MESSAGE_LIST_FIELDS, WIRE_MODEL_FIELDS, WIRE_MODEL_SELECTION_FIELDS, WIRE_MODEL_SET_FIELDS, WIRE_MODEL_SUGGESTIONS_FIELDS, WIRE_PATCH_SESSION_FIELDS, WIRE_PATCH_SESSION_RESPONSE_FIELDS, WIRE_PERMISSION_RULE_FIELDS, WIRE_PERMISSION_SET_REQUEST_FIELDS, WIRE_PERMISSION_SET_RESPONSE_FIELDS, WIRE_PERMISSION_SHADOW_FIELDS, WIRE_PERMISSION_STATE_FIELDS, WIRE_PERMISSION_STATUS_FIELDS, WIRE_PLAN_ACTIONS, WIRE_PLAN_FIELDS, WIRE_PLAN_MODE_REQUEST_FIELDS, WIRE_PLAN_MODE_RESPONSE_FIELDS, WIRE_PLAN_MODE_STATE_FIELDS, WIRE_POLICY_DIR_FIELDS, WIRE_POLICY_STATUS_FIELDS, WIRE_PROVIDERS_FIELDS, WIRE_PROVIDER_MODELS_FIELDS, WIRE_PROVIDER_OPTION_FIELDS, WIRE_QUESTION_LIST_FIELDS, WIRE_QUESTION_ROW_FIELDS, WIRE_RESPOND_APPROVAL_FIELDS, WIRE_RESPOND_APPROVAL_RESPONSE_FIELDS, WIRE_RESPOND_QUESTION_FIELDS, WIRE_RESPOND_QUESTION_RESPONSE_FIELDS, WIRE_REWIND_FILE_PLAN_FIELDS, WIRE_REWIND_OUTCOME_FIELDS, WIRE_REWIND_PREVIEW_FIELDS, WIRE_REWIND_REQUEST_FIELDS, WIRE_REWIND_RESPONSE_FIELDS, WIRE_REWIND_SCOPES, WIRE_ROLE_ADD_FIELDS, WIRE_ROLE_ADD_RESPONSE_FIELDS, WIRE_SANDBOX_STATUS_FIELDS, WIRE_SCHEDULE_CAPABILITY_FIELDS, WIRE_SCHEDULE_CREATE_FIELDS, WIRE_SCHEDULE_DEFAULTS_FIELDS, WIRE_SCHEDULE_DELETE_FIELDS, WIRE_SCHEDULE_FIELDS, WIRE_SCHEDULE_FIX_FIELDS, WIRE_SCHEDULE_FIX_REQUEST_FIELDS, WIRE_SCHEDULE_ISSUE_CODES, WIRE_SCHEDULE_LIST_FIELDS, WIRE_SCHEDULE_RECORDING_FIELDS, WIRE_SCHEDULE_ROW_FIELDS, WIRE_SCHEDULE_RUNS_FIELDS, WIRE_SCHEDULE_RUN_FIELDS, WIRE_SCHEDULE_SAVE_FIELDS, WIRE_SECURITY_FIELDS, WIRE_SECURITY_WORKSPACE_FIELDS, WIRE_SEND_MESSAGE_FIELDS, WIRE_SEND_MESSAGE_RESPONSE_FIELDS, WIRE_SESSION_FINISH_FIELDS, WIRE_SESSION_LIST_FIELDS, WIRE_SESSION_RESPONSE_FIELDS, WIRE_SESSION_SUMMARY_FIELDS, WIRE_SESSION_WORKSPACE_FIELDS, WIRE_SESSION_WORKSPACE_RESPONSE_FIELDS, WIRE_SETTINGS_FIELDS, WIRE_SETTINGS_WRITE_FIELDS, WIRE_SETTINGS_WRITE_REQUEST_FIELDS, WIRE_SETTING_ROW_FIELDS, WIRE_SETTING_STEP_FIELDS, WIRE_SETTING_WRITE_FIELDS, WIRE_SETTING_WRITE_LAYERS, WIRE_SKILL_BODY_FIELDS, WIRE_SKILL_FIELDS, WIRE_SKILL_IMPORT_FIELDS, WIRE_SKILL_IMPORT_PREVIEW_FIELDS, WIRE_TASKS_FIELDS, WIRE_TOOLS_FIELDS, WIRE_TOOL_GATE_FIELDS, WIRE_TOOL_ROW_FIELDS, WIRE_WORKSPACE_DIFF_FIELDS, WIRE_WORKSPACE_DIRS_FIELDS, WIRE_WORKSPACE_DIR_ENTRY_FIELDS, WIRE_WORKSPACE_REF_FIELDS, apiKeyEnvVar, chordId, compressionThresholdTokens, conformsToWire, contentToText, diagnosticToLine, extractMentions, filePartSummary, getProviderInfo, hasFailure, isApprovalOutcome, isContextNearlyFull, isHeadlessInputFormat, isHeadlessLifecycleEvent, isHeadlessOutputFormat, isKeyAction, isLang, isOperationType, isPermissionLevel, isPlanOutcome, isProviderType, isQuestionAnswerMap, isSearchProviderType, isValidAgentRoleName, isValidCommandName, isWireHubEvent, isWirePlanAction, isWireRewindScope, isWireSettingWriteLayer, normalizeApproval, parseChord, parseModelRef, promptTokens, stripSystemNote, systemNote, totalUsageTokens, wireFields };