@botiverse/raft-daemon 0.63.6 → 0.63.7-play.20260628145435
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/{chunk-DUWRNQQE.js → chunk-GY4WDH5I.js} +1924 -223
- package/dist/cli/index.js +35099 -5441
- package/dist/core.js +7 -1
- package/dist/dist-CBVXAPI6.js +50304 -0
- package/dist/index.js +5 -3
- package/package.json +4 -4
- package/dist/dist-S7UP42L2.js +0 -20986
|
@@ -11,16 +11,488 @@ function makeIsMember(members) {
|
|
|
11
11
|
return (value) => typeof value === "string" && set.has(value);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
// ../shared/src/piBuiltinModels.generated.ts
|
|
15
|
+
var PI_BUILTIN_PROVIDER_API_KEY_ENV_KEYS_GENERATED = {
|
|
16
|
+
"deepseek": "DEEPSEEK_API_KEY",
|
|
17
|
+
"minimax": "MINIMAX_API_KEY",
|
|
18
|
+
"minimax-cn": "MINIMAX_CN_API_KEY",
|
|
19
|
+
"zai": "ZAI_API_KEY",
|
|
20
|
+
"zai-coding-cn": "ZAI_CODING_CN_API_KEY",
|
|
21
|
+
"moonshotai": "MOONSHOT_API_KEY",
|
|
22
|
+
"moonshotai-cn": "MOONSHOT_API_KEY",
|
|
23
|
+
"kimi-coding": "KIMI_API_KEY",
|
|
24
|
+
"openrouter": "OPENROUTER_API_KEY",
|
|
25
|
+
"openai": "OPENAI_API_KEY",
|
|
26
|
+
"anthropic": "ANTHROPIC_API_KEY",
|
|
27
|
+
"google": "GEMINI_API_KEY",
|
|
28
|
+
"xai": "XAI_API_KEY",
|
|
29
|
+
"xiaomi": "XIAOMI_API_KEY"
|
|
30
|
+
};
|
|
31
|
+
var PI_BUILTIN_PROVIDER_BLOCKED_HOST_ENV_KEYS_GENERATED = {
|
|
32
|
+
"deepseek": ["DEEPSEEK_API_KEY"],
|
|
33
|
+
"minimax": ["MINIMAX_API_KEY"],
|
|
34
|
+
"minimax-cn": ["MINIMAX_CN_API_KEY"],
|
|
35
|
+
"zai": ["ZAI_API_KEY"],
|
|
36
|
+
"zai-coding-cn": ["ZAI_CODING_CN_API_KEY"],
|
|
37
|
+
"moonshotai": ["MOONSHOT_API_KEY"],
|
|
38
|
+
"moonshotai-cn": ["MOONSHOT_API_KEY"],
|
|
39
|
+
"kimi-coding": ["KIMI_API_KEY"],
|
|
40
|
+
"openrouter": ["OPENROUTER_API_KEY"],
|
|
41
|
+
"openai": ["OPENAI_API_KEY"],
|
|
42
|
+
"anthropic": ["ANTHROPIC_OAUTH_TOKEN", "ANTHROPIC_API_KEY"],
|
|
43
|
+
"google": ["GEMINI_API_KEY"],
|
|
44
|
+
"xai": ["XAI_API_KEY"],
|
|
45
|
+
"xiaomi": ["XIAOMI_API_KEY"]
|
|
46
|
+
};
|
|
47
|
+
var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
48
|
+
"deepseek": [
|
|
49
|
+
{ id: "deepseek/deepseek-v4-pro", label: "DeepSeek V4 Pro" },
|
|
50
|
+
{ id: "deepseek/deepseek-v4-flash", label: "DeepSeek V4 Flash" }
|
|
51
|
+
],
|
|
52
|
+
"minimax": [
|
|
53
|
+
{ id: "minimax/MiniMax-M2.7", label: "MiniMax-M2.7" },
|
|
54
|
+
{ id: "minimax/MiniMax-M2.7-highspeed", label: "MiniMax-M2.7-highspeed" },
|
|
55
|
+
{ id: "minimax/MiniMax-M3", label: "MiniMax-M3" }
|
|
56
|
+
],
|
|
57
|
+
"minimax-cn": [
|
|
58
|
+
{ id: "minimax-cn/MiniMax-M2.7", label: "MiniMax-M2.7" },
|
|
59
|
+
{ id: "minimax-cn/MiniMax-M2.7-highspeed", label: "MiniMax-M2.7-highspeed" },
|
|
60
|
+
{ id: "minimax-cn/MiniMax-M3", label: "MiniMax-M3" }
|
|
61
|
+
],
|
|
62
|
+
"zai": [
|
|
63
|
+
{ id: "zai/glm-5.1", label: "GLM-5.1" },
|
|
64
|
+
{ id: "zai/glm-4.5-air", label: "GLM-4.5-Air" },
|
|
65
|
+
{ id: "zai/glm-4.7", label: "GLM-4.7" },
|
|
66
|
+
{ id: "zai/glm-5-turbo", label: "GLM-5-Turbo" },
|
|
67
|
+
{ id: "zai/glm-5.2", label: "GLM-5.2" },
|
|
68
|
+
{ id: "zai/glm-5v-turbo", label: "GLM-5V-Turbo" }
|
|
69
|
+
],
|
|
70
|
+
"zai-coding-cn": [
|
|
71
|
+
{ id: "zai-coding-cn/glm-5.1", label: "GLM-5.1" },
|
|
72
|
+
{ id: "zai-coding-cn/glm-4.5-air", label: "GLM-4.5-Air" },
|
|
73
|
+
{ id: "zai-coding-cn/glm-4.7", label: "GLM-4.7" },
|
|
74
|
+
{ id: "zai-coding-cn/glm-5-turbo", label: "GLM-5-Turbo" },
|
|
75
|
+
{ id: "zai-coding-cn/glm-5.2", label: "GLM-5.2" },
|
|
76
|
+
{ id: "zai-coding-cn/glm-5v-turbo", label: "GLM-5V-Turbo" }
|
|
77
|
+
],
|
|
78
|
+
"moonshotai": [
|
|
79
|
+
{ id: "moonshotai/kimi-k2.6", label: "Kimi K2.6" },
|
|
80
|
+
{ id: "moonshotai/kimi-k2-0711-preview", label: "Kimi K2 0711" },
|
|
81
|
+
{ id: "moonshotai/kimi-k2-0905-preview", label: "Kimi K2 0905" },
|
|
82
|
+
{ id: "moonshotai/kimi-k2-thinking", label: "Kimi K2 Thinking" },
|
|
83
|
+
{ id: "moonshotai/kimi-k2-thinking-turbo", label: "Kimi K2 Thinking Turbo" },
|
|
84
|
+
{ id: "moonshotai/kimi-k2-turbo-preview", label: "Kimi K2 Turbo" },
|
|
85
|
+
{ id: "moonshotai/kimi-k2.5", label: "Kimi K2.5" },
|
|
86
|
+
{ id: "moonshotai/kimi-k2.7-code", label: "Kimi K2.7 Code" },
|
|
87
|
+
{ id: "moonshotai/kimi-k2.7-code-highspeed", label: "Kimi K2.7 Code HighSpeed" }
|
|
88
|
+
],
|
|
89
|
+
"moonshotai-cn": [
|
|
90
|
+
{ id: "moonshotai-cn/kimi-k2.6", label: "Kimi K2.6" },
|
|
91
|
+
{ id: "moonshotai-cn/kimi-k2-0711-preview", label: "Kimi K2 0711" },
|
|
92
|
+
{ id: "moonshotai-cn/kimi-k2-0905-preview", label: "Kimi K2 0905" },
|
|
93
|
+
{ id: "moonshotai-cn/kimi-k2-thinking", label: "Kimi K2 Thinking" },
|
|
94
|
+
{ id: "moonshotai-cn/kimi-k2-thinking-turbo", label: "Kimi K2 Thinking Turbo" },
|
|
95
|
+
{ id: "moonshotai-cn/kimi-k2-turbo-preview", label: "Kimi K2 Turbo" },
|
|
96
|
+
{ id: "moonshotai-cn/kimi-k2.5", label: "Kimi K2.5" },
|
|
97
|
+
{ id: "moonshotai-cn/kimi-k2.7-code", label: "Kimi K2.7 Code" },
|
|
98
|
+
{ id: "moonshotai-cn/kimi-k2.7-code-highspeed", label: "Kimi K2.7 Code HighSpeed" }
|
|
99
|
+
],
|
|
100
|
+
"kimi-coding": [
|
|
101
|
+
{ id: "kimi-coding/kimi-for-coding", label: "Kimi For Coding" },
|
|
102
|
+
{ id: "kimi-coding/k2p7", label: "Kimi K2.7 Code" },
|
|
103
|
+
{ id: "kimi-coding/kimi-k2-thinking", label: "Kimi K2 Thinking" }
|
|
104
|
+
],
|
|
105
|
+
"openrouter": [
|
|
106
|
+
{ id: "openrouter/moonshotai/kimi-k2.6", label: "MoonshotAI: Kimi K2.6" },
|
|
107
|
+
{ id: "openrouter/ai21/jamba-large-1.7", label: "AI21: Jamba Large 1.7" },
|
|
108
|
+
{ id: "openrouter/amazon/nova-2-lite-v1", label: "Amazon: Nova 2 Lite" },
|
|
109
|
+
{ id: "openrouter/amazon/nova-lite-v1", label: "Amazon: Nova Lite 1.0" },
|
|
110
|
+
{ id: "openrouter/amazon/nova-micro-v1", label: "Amazon: Nova Micro 1.0" },
|
|
111
|
+
{ id: "openrouter/amazon/nova-premier-v1", label: "Amazon: Nova Premier 1.0" },
|
|
112
|
+
{ id: "openrouter/amazon/nova-pro-v1", label: "Amazon: Nova Pro 1.0" },
|
|
113
|
+
{ id: "openrouter/anthropic/claude-3-haiku", label: "Anthropic: Claude 3 Haiku" },
|
|
114
|
+
{ id: "openrouter/anthropic/claude-3.5-haiku", label: "Anthropic: Claude 3.5 Haiku" },
|
|
115
|
+
{ id: "openrouter/anthropic/claude-fable-5", label: "Anthropic: Claude Fable 5" },
|
|
116
|
+
{ id: "openrouter/anthropic/claude-haiku-4.5", label: "Anthropic: Claude Haiku 4.5" },
|
|
117
|
+
{ id: "openrouter/anthropic/claude-opus-4", label: "Anthropic: Claude Opus 4" },
|
|
118
|
+
{ id: "openrouter/anthropic/claude-opus-4.1", label: "Anthropic: Claude Opus 4.1" },
|
|
119
|
+
{ id: "openrouter/anthropic/claude-opus-4.5", label: "Anthropic: Claude Opus 4.5" },
|
|
120
|
+
{ id: "openrouter/anthropic/claude-opus-4.6", label: "Anthropic: Claude Opus 4.6" },
|
|
121
|
+
{ id: "openrouter/anthropic/claude-opus-4.6-fast", label: "Anthropic: Claude Opus 4.6 (Fast)" },
|
|
122
|
+
{ id: "openrouter/anthropic/claude-opus-4.7", label: "Anthropic: Claude Opus 4.7" },
|
|
123
|
+
{ id: "openrouter/anthropic/claude-opus-4.7-fast", label: "Anthropic: Claude Opus 4.7 (Fast)" },
|
|
124
|
+
{ id: "openrouter/anthropic/claude-opus-4.8", label: "Anthropic: Claude Opus 4.8" },
|
|
125
|
+
{ id: "openrouter/anthropic/claude-opus-4.8-fast", label: "Anthropic: Claude Opus 4.8 (Fast)" },
|
|
126
|
+
{ id: "openrouter/anthropic/claude-sonnet-4", label: "Anthropic: Claude Sonnet 4" },
|
|
127
|
+
{ id: "openrouter/anthropic/claude-sonnet-4.5", label: "Anthropic: Claude Sonnet 4.5" },
|
|
128
|
+
{ id: "openrouter/anthropic/claude-sonnet-4.6", label: "Anthropic: Claude Sonnet 4.6" },
|
|
129
|
+
{ id: "openrouter/arcee-ai/trinity-large-thinking", label: "Arcee AI: Trinity Large Thinking" },
|
|
130
|
+
{ id: "openrouter/arcee-ai/trinity-mini", label: "Arcee AI: Trinity Mini" },
|
|
131
|
+
{ id: "openrouter/arcee-ai/virtuoso-large", label: "Arcee AI: Virtuoso Large" },
|
|
132
|
+
{ id: "openrouter/auto", label: "Auto" },
|
|
133
|
+
{ id: "openrouter/bytedance-seed/seed-1.6", label: "ByteDance Seed: Seed 1.6" },
|
|
134
|
+
{ id: "openrouter/bytedance-seed/seed-1.6-flash", label: "ByteDance Seed: Seed 1.6 Flash" },
|
|
135
|
+
{ id: "openrouter/bytedance-seed/seed-2.0-lite", label: "ByteDance Seed: Seed-2.0-Lite" },
|
|
136
|
+
{ id: "openrouter/bytedance-seed/seed-2.0-mini", label: "ByteDance Seed: Seed-2.0-Mini" },
|
|
137
|
+
{ id: "openrouter/cohere/command-r-08-2024", label: "Cohere: Command R (08-2024)" },
|
|
138
|
+
{ id: "openrouter/cohere/command-r-plus-08-2024", label: "Cohere: Command R+ (08-2024)" },
|
|
139
|
+
{ id: "openrouter/cohere/north-mini-code:free", label: "Cohere: North Mini Code (free)" },
|
|
140
|
+
{ id: "openrouter/deepseek/deepseek-chat", label: "DeepSeek: DeepSeek V3" },
|
|
141
|
+
{ id: "openrouter/deepseek/deepseek-chat-v3-0324", label: "DeepSeek: DeepSeek V3 0324" },
|
|
142
|
+
{ id: "openrouter/deepseek/deepseek-chat-v3.1", label: "DeepSeek: DeepSeek V3.1" },
|
|
143
|
+
{ id: "openrouter/deepseek/deepseek-r1", label: "DeepSeek: R1" },
|
|
144
|
+
{ id: "openrouter/deepseek/deepseek-r1-0528", label: "DeepSeek: R1 0528" },
|
|
145
|
+
{ id: "openrouter/deepseek/deepseek-v3.1-terminus", label: "DeepSeek: DeepSeek V3.1 Terminus" },
|
|
146
|
+
{ id: "openrouter/deepseek/deepseek-v3.2", label: "DeepSeek: DeepSeek V3.2" },
|
|
147
|
+
{ id: "openrouter/deepseek/deepseek-v3.2-exp", label: "DeepSeek: DeepSeek V3.2 Exp" },
|
|
148
|
+
{ id: "openrouter/deepseek/deepseek-v4-flash", label: "DeepSeek: DeepSeek V4 Flash" },
|
|
149
|
+
{ id: "openrouter/deepseek/deepseek-v4-pro", label: "DeepSeek: DeepSeek V4 Pro" },
|
|
150
|
+
{ id: "openrouter/essentialai/rnj-1-instruct", label: "EssentialAI: Rnj 1 Instruct" },
|
|
151
|
+
{ id: "openrouter/google/gemini-2.5-flash", label: "Google: Gemini 2.5 Flash" },
|
|
152
|
+
{ id: "openrouter/google/gemini-2.5-flash-lite", label: "Google: Gemini 2.5 Flash Lite" },
|
|
153
|
+
{ id: "openrouter/google/gemini-2.5-flash-lite-preview-09-2025", label: "Google: Gemini 2.5 Flash Lite Preview 09-2025" },
|
|
154
|
+
{ id: "openrouter/google/gemini-2.5-pro", label: "Google: Gemini 2.5 Pro" },
|
|
155
|
+
{ id: "openrouter/google/gemini-2.5-pro-preview", label: "Google: Gemini 2.5 Pro Preview 06-05" },
|
|
156
|
+
{ id: "openrouter/google/gemini-2.5-pro-preview-05-06", label: "Google: Gemini 2.5 Pro Preview 05-06" },
|
|
157
|
+
{ id: "openrouter/google/gemini-3-flash-preview", label: "Google: Gemini 3 Flash Preview" },
|
|
158
|
+
{ id: "openrouter/google/gemini-3-pro-image", label: "Google: Nano Banana Pro (Gemini 3 Pro Image)" },
|
|
159
|
+
{ id: "openrouter/google/gemini-3.1-flash-lite", label: "Google: Gemini 3.1 Flash Lite" },
|
|
160
|
+
{ id: "openrouter/google/gemini-3.1-flash-lite-preview", label: "Google: Gemini 3.1 Flash Lite Preview" },
|
|
161
|
+
{ id: "openrouter/google/gemini-3.1-pro-preview", label: "Google: Gemini 3.1 Pro Preview" },
|
|
162
|
+
{ id: "openrouter/google/gemini-3.1-pro-preview-customtools", label: "Google: Gemini 3.1 Pro Preview Custom Tools" },
|
|
163
|
+
{ id: "openrouter/google/gemini-3.5-flash", label: "Google: Gemini 3.5 Flash" },
|
|
164
|
+
{ id: "openrouter/google/gemma-3-12b-it", label: "Google: Gemma 3 12B" },
|
|
165
|
+
{ id: "openrouter/google/gemma-3-27b-it", label: "Google: Gemma 3 27B" },
|
|
166
|
+
{ id: "openrouter/google/gemma-4-26b-a4b-it", label: "Google: Gemma 4 26B A4B " },
|
|
167
|
+
{ id: "openrouter/google/gemma-4-26b-a4b-it:free", label: "Google: Gemma 4 26B A4B (free)" },
|
|
168
|
+
{ id: "openrouter/google/gemma-4-31b-it", label: "Google: Gemma 4 31B" },
|
|
169
|
+
{ id: "openrouter/google/gemma-4-31b-it:free", label: "Google: Gemma 4 31B (free)" },
|
|
170
|
+
{ id: "openrouter/ibm-granite/granite-4.1-8b", label: "IBM: Granite 4.1 8B" },
|
|
171
|
+
{ id: "openrouter/inception/mercury-2", label: "Inception: Mercury 2" },
|
|
172
|
+
{ id: "openrouter/inclusionai/ling-2.6-1t", label: "inclusionAI: Ling-2.6-1T" },
|
|
173
|
+
{ id: "openrouter/inclusionai/ling-2.6-flash", label: "inclusionAI: Ling-2.6-flash" },
|
|
174
|
+
{ id: "openrouter/inclusionai/ring-2.6-1t", label: "inclusionAI: Ring-2.6-1T" },
|
|
175
|
+
{ id: "openrouter/kwaipilot/kat-coder-pro-v2", label: "Kwaipilot: KAT-Coder-Pro V2" },
|
|
176
|
+
{ id: "openrouter/liquid/lfm-2.5-1.2b-thinking:free", label: "LiquidAI: LFM2.5-1.2B-Thinking (free)" },
|
|
177
|
+
{ id: "openrouter/meta-llama/llama-3.1-70b-instruct", label: "Meta: Llama 3.1 70B Instruct" },
|
|
178
|
+
{ id: "openrouter/meta-llama/llama-3.1-8b-instruct", label: "Meta: Llama 3.1 8B Instruct" },
|
|
179
|
+
{ id: "openrouter/meta-llama/llama-3.3-70b-instruct", label: "Meta: Llama 3.3 70B Instruct" },
|
|
180
|
+
{ id: "openrouter/meta-llama/llama-3.3-70b-instruct:free", label: "Meta: Llama 3.3 70B Instruct (free)" },
|
|
181
|
+
{ id: "openrouter/meta-llama/llama-4-maverick", label: "Meta: Llama 4 Maverick" },
|
|
182
|
+
{ id: "openrouter/meta-llama/llama-4-scout", label: "Meta: Llama 4 Scout" },
|
|
183
|
+
{ id: "openrouter/minimax/minimax-m1", label: "MiniMax: MiniMax M1" },
|
|
184
|
+
{ id: "openrouter/minimax/minimax-m2", label: "MiniMax: MiniMax M2" },
|
|
185
|
+
{ id: "openrouter/minimax/minimax-m2.1", label: "MiniMax: MiniMax M2.1" },
|
|
186
|
+
{ id: "openrouter/minimax/minimax-m2.5", label: "MiniMax: MiniMax M2.5" },
|
|
187
|
+
{ id: "openrouter/minimax/minimax-m2.7", label: "MiniMax: MiniMax M2.7" },
|
|
188
|
+
{ id: "openrouter/minimax/minimax-m3", label: "MiniMax: MiniMax M3" },
|
|
189
|
+
{ id: "openrouter/mistralai/codestral-2508", label: "Mistral: Codestral 2508" },
|
|
190
|
+
{ id: "openrouter/mistralai/devstral-2512", label: "Mistral: Devstral 2 2512" },
|
|
191
|
+
{ id: "openrouter/mistralai/ministral-14b-2512", label: "Mistral: Ministral 3 14B 2512" },
|
|
192
|
+
{ id: "openrouter/mistralai/ministral-3b-2512", label: "Mistral: Ministral 3 3B 2512" },
|
|
193
|
+
{ id: "openrouter/mistralai/ministral-8b-2512", label: "Mistral: Ministral 3 8B 2512" },
|
|
194
|
+
{ id: "openrouter/mistralai/mistral-large", label: "Mistral Large" },
|
|
195
|
+
{ id: "openrouter/mistralai/mistral-large-2407", label: "Mistral Large 2407" },
|
|
196
|
+
{ id: "openrouter/mistralai/mistral-large-2512", label: "Mistral: Mistral Large 3 2512" },
|
|
197
|
+
{ id: "openrouter/mistralai/mistral-medium-3", label: "Mistral: Mistral Medium 3" },
|
|
198
|
+
{ id: "openrouter/mistralai/mistral-medium-3-5", label: "Mistral: Mistral Medium 3.5" },
|
|
199
|
+
{ id: "openrouter/mistralai/mistral-medium-3.1", label: "Mistral: Mistral Medium 3.1" },
|
|
200
|
+
{ id: "openrouter/mistralai/mistral-nemo", label: "Mistral: Mistral Nemo" },
|
|
201
|
+
{ id: "openrouter/mistralai/mistral-saba", label: "Mistral: Saba" },
|
|
202
|
+
{ id: "openrouter/mistralai/mistral-small-2603", label: "Mistral: Mistral Small 4" },
|
|
203
|
+
{ id: "openrouter/mistralai/mistral-small-3.2-24b-instruct", label: "Mistral: Mistral Small 3.2 24B" },
|
|
204
|
+
{ id: "openrouter/mistralai/mixtral-8x22b-instruct", label: "Mistral: Mixtral 8x22B Instruct" },
|
|
205
|
+
{ id: "openrouter/mistralai/voxtral-small-24b-2507", label: "Mistral: Voxtral Small 24B 2507" },
|
|
206
|
+
{ id: "openrouter/moonshotai/kimi-k2", label: "MoonshotAI: Kimi K2 0711" },
|
|
207
|
+
{ id: "openrouter/moonshotai/kimi-k2-0905", label: "MoonshotAI: Kimi K2 0905" },
|
|
208
|
+
{ id: "openrouter/moonshotai/kimi-k2-thinking", label: "MoonshotAI: Kimi K2 Thinking" },
|
|
209
|
+
{ id: "openrouter/moonshotai/kimi-k2.5", label: "MoonshotAI: Kimi K2.5" },
|
|
210
|
+
{ id: "openrouter/moonshotai/kimi-k2.7-code", label: "MoonshotAI: Kimi K2.7 Code" },
|
|
211
|
+
{ id: "openrouter/nex-agi/nex-n2-pro:free", label: "Nex AGI: Nex-N2-Pro (free)" },
|
|
212
|
+
{ id: "openrouter/nvidia/llama-3.3-nemotron-super-49b-v1.5", label: "NVIDIA: Llama 3.3 Nemotron Super 49B V1.5" },
|
|
213
|
+
{ id: "openrouter/nvidia/nemotron-3-nano-30b-a3b", label: "NVIDIA: Nemotron 3 Nano 30B A3B" },
|
|
214
|
+
{ id: "openrouter/nvidia/nemotron-3-nano-30b-a3b:free", label: "NVIDIA: Nemotron 3 Nano 30B A3B (free)" },
|
|
215
|
+
{ id: "openrouter/nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free", label: "NVIDIA: Nemotron 3 Nano Omni (free)" },
|
|
216
|
+
{ id: "openrouter/nvidia/nemotron-3-super-120b-a12b", label: "NVIDIA: Nemotron 3 Super" },
|
|
217
|
+
{ id: "openrouter/nvidia/nemotron-3-super-120b-a12b:free", label: "NVIDIA: Nemotron 3 Super (free)" },
|
|
218
|
+
{ id: "openrouter/nvidia/nemotron-3-ultra-550b-a55b", label: "NVIDIA: Nemotron 3 Ultra" },
|
|
219
|
+
{ id: "openrouter/nvidia/nemotron-3-ultra-550b-a55b:free", label: "NVIDIA: Nemotron 3 Ultra (free)" },
|
|
220
|
+
{ id: "openrouter/nvidia/nemotron-nano-12b-v2-vl:free", label: "NVIDIA: Nemotron Nano 12B 2 VL (free)" },
|
|
221
|
+
{ id: "openrouter/nvidia/nemotron-nano-9b-v2:free", label: "NVIDIA: Nemotron Nano 9B V2 (free)" },
|
|
222
|
+
{ id: "openrouter/openai/gpt-3.5-turbo", label: "OpenAI: GPT-3.5 Turbo" },
|
|
223
|
+
{ id: "openrouter/openai/gpt-3.5-turbo-0613", label: "OpenAI: GPT-3.5 Turbo (older v0613)" },
|
|
224
|
+
{ id: "openrouter/openai/gpt-3.5-turbo-16k", label: "OpenAI: GPT-3.5 Turbo 16k" },
|
|
225
|
+
{ id: "openrouter/openai/gpt-4", label: "OpenAI: GPT-4" },
|
|
226
|
+
{ id: "openrouter/openai/gpt-4-turbo", label: "OpenAI: GPT-4 Turbo" },
|
|
227
|
+
{ id: "openrouter/openai/gpt-4-turbo-preview", label: "OpenAI: GPT-4 Turbo Preview" },
|
|
228
|
+
{ id: "openrouter/openai/gpt-4.1", label: "OpenAI: GPT-4.1" },
|
|
229
|
+
{ id: "openrouter/openai/gpt-4.1-mini", label: "OpenAI: GPT-4.1 Mini" },
|
|
230
|
+
{ id: "openrouter/openai/gpt-4.1-nano", label: "OpenAI: GPT-4.1 Nano" },
|
|
231
|
+
{ id: "openrouter/openai/gpt-4o", label: "OpenAI: GPT-4o" },
|
|
232
|
+
{ id: "openrouter/openai/gpt-4o-2024-05-13", label: "OpenAI: GPT-4o (2024-05-13)" },
|
|
233
|
+
{ id: "openrouter/openai/gpt-4o-2024-08-06", label: "OpenAI: GPT-4o (2024-08-06)" },
|
|
234
|
+
{ id: "openrouter/openai/gpt-4o-2024-11-20", label: "OpenAI: GPT-4o (2024-11-20)" },
|
|
235
|
+
{ id: "openrouter/openai/gpt-4o-mini", label: "OpenAI: GPT-4o-mini" },
|
|
236
|
+
{ id: "openrouter/openai/gpt-4o-mini-2024-07-18", label: "OpenAI: GPT-4o-mini (2024-07-18)" },
|
|
237
|
+
{ id: "openrouter/openai/gpt-5", label: "OpenAI: GPT-5" },
|
|
238
|
+
{ id: "openrouter/openai/gpt-5-codex", label: "OpenAI: GPT-5 Codex" },
|
|
239
|
+
{ id: "openrouter/openai/gpt-5-mini", label: "OpenAI: GPT-5 Mini" },
|
|
240
|
+
{ id: "openrouter/openai/gpt-5-nano", label: "OpenAI: GPT-5 Nano" },
|
|
241
|
+
{ id: "openrouter/openai/gpt-5-pro", label: "OpenAI: GPT-5 Pro" },
|
|
242
|
+
{ id: "openrouter/openai/gpt-5.1", label: "OpenAI: GPT-5.1" },
|
|
243
|
+
{ id: "openrouter/openai/gpt-5.1-chat", label: "OpenAI: GPT-5.1 Chat" },
|
|
244
|
+
{ id: "openrouter/openai/gpt-5.1-codex", label: "OpenAI: GPT-5.1-Codex" },
|
|
245
|
+
{ id: "openrouter/openai/gpt-5.1-codex-max", label: "OpenAI: GPT-5.1-Codex-Max" },
|
|
246
|
+
{ id: "openrouter/openai/gpt-5.1-codex-mini", label: "OpenAI: GPT-5.1-Codex-Mini" },
|
|
247
|
+
{ id: "openrouter/openai/gpt-5.2", label: "OpenAI: GPT-5.2" },
|
|
248
|
+
{ id: "openrouter/openai/gpt-5.2-chat", label: "OpenAI: GPT-5.2 Chat" },
|
|
249
|
+
{ id: "openrouter/openai/gpt-5.2-codex", label: "OpenAI: GPT-5.2-Codex" },
|
|
250
|
+
{ id: "openrouter/openai/gpt-5.2-pro", label: "OpenAI: GPT-5.2 Pro" },
|
|
251
|
+
{ id: "openrouter/openai/gpt-5.3-chat", label: "OpenAI: GPT-5.3 Chat" },
|
|
252
|
+
{ id: "openrouter/openai/gpt-5.3-codex", label: "OpenAI: GPT-5.3-Codex" },
|
|
253
|
+
{ id: "openrouter/openai/gpt-5.4", label: "OpenAI: GPT-5.4" },
|
|
254
|
+
{ id: "openrouter/openai/gpt-5.4-mini", label: "OpenAI: GPT-5.4 Mini" },
|
|
255
|
+
{ id: "openrouter/openai/gpt-5.4-nano", label: "OpenAI: GPT-5.4 Nano" },
|
|
256
|
+
{ id: "openrouter/openai/gpt-5.4-pro", label: "OpenAI: GPT-5.4 Pro" },
|
|
257
|
+
{ id: "openrouter/openai/gpt-5.5", label: "OpenAI: GPT-5.5" },
|
|
258
|
+
{ id: "openrouter/openai/gpt-5.5-pro", label: "OpenAI: GPT-5.5 Pro" },
|
|
259
|
+
{ id: "openrouter/openai/gpt-audio", label: "OpenAI: GPT Audio" },
|
|
260
|
+
{ id: "openrouter/openai/gpt-audio-mini", label: "OpenAI: GPT Audio Mini" },
|
|
261
|
+
{ id: "openrouter/openai/gpt-chat-latest", label: "OpenAI: GPT Chat Latest" },
|
|
262
|
+
{ id: "openrouter/openai/gpt-oss-120b", label: "OpenAI: gpt-oss-120b" },
|
|
263
|
+
{ id: "openrouter/openai/gpt-oss-120b:free", label: "OpenAI: gpt-oss-120b (free)" },
|
|
264
|
+
{ id: "openrouter/openai/gpt-oss-20b", label: "OpenAI: gpt-oss-20b" },
|
|
265
|
+
{ id: "openrouter/openai/gpt-oss-20b:free", label: "OpenAI: gpt-oss-20b (free)" },
|
|
266
|
+
{ id: "openrouter/openai/gpt-oss-safeguard-20b", label: "OpenAI: gpt-oss-safeguard-20b" },
|
|
267
|
+
{ id: "openrouter/openai/o1", label: "OpenAI: o1" },
|
|
268
|
+
{ id: "openrouter/openai/o3", label: "OpenAI: o3" },
|
|
269
|
+
{ id: "openrouter/openai/o3-deep-research", label: "OpenAI: o3 Deep Research" },
|
|
270
|
+
{ id: "openrouter/openai/o3-mini", label: "OpenAI: o3 Mini" },
|
|
271
|
+
{ id: "openrouter/openai/o3-mini-high", label: "OpenAI: o3 Mini High" },
|
|
272
|
+
{ id: "openrouter/openai/o3-pro", label: "OpenAI: o3 Pro" },
|
|
273
|
+
{ id: "openrouter/openai/o4-mini", label: "OpenAI: o4 Mini" },
|
|
274
|
+
{ id: "openrouter/openai/o4-mini-deep-research", label: "OpenAI: o4 Mini Deep Research" },
|
|
275
|
+
{ id: "openrouter/openai/o4-mini-high", label: "OpenAI: o4 Mini High" },
|
|
276
|
+
{ id: "openrouter/openrouter/auto", label: "Auto Router" },
|
|
277
|
+
{ id: "openrouter/openrouter/free", label: "Free Models Router" },
|
|
278
|
+
{ id: "openrouter/openrouter/fusion", label: "OpenRouter: Fusion" },
|
|
279
|
+
{ id: "openrouter/openrouter/owl-alpha", label: "Owl Alpha" },
|
|
280
|
+
{ id: "openrouter/poolside/laguna-m.1", label: "Poolside: Laguna M.1" },
|
|
281
|
+
{ id: "openrouter/poolside/laguna-m.1:free", label: "Poolside: Laguna M.1 (free)" },
|
|
282
|
+
{ id: "openrouter/poolside/laguna-xs.2", label: "Poolside: Laguna XS.2" },
|
|
283
|
+
{ id: "openrouter/poolside/laguna-xs.2:free", label: "Poolside: Laguna XS.2 (free)" },
|
|
284
|
+
{ id: "openrouter/prime-intellect/intellect-3", label: "Prime Intellect: INTELLECT-3" },
|
|
285
|
+
{ id: "openrouter/qwen/qwen-2.5-72b-instruct", label: "Qwen2.5 72B Instruct" },
|
|
286
|
+
{ id: "openrouter/qwen/qwen-2.5-7b-instruct", label: "Qwen: Qwen2.5 7B Instruct" },
|
|
287
|
+
{ id: "openrouter/qwen/qwen-plus", label: "Qwen: Qwen-Plus" },
|
|
288
|
+
{ id: "openrouter/qwen/qwen-plus-2025-07-28", label: "Qwen: Qwen Plus 0728" },
|
|
289
|
+
{ id: "openrouter/qwen/qwen-plus-2025-07-28:thinking", label: "Qwen: Qwen Plus 0728 (thinking)" },
|
|
290
|
+
{ id: "openrouter/qwen/qwen3-14b", label: "Qwen: Qwen3 14B" },
|
|
291
|
+
{ id: "openrouter/qwen/qwen3-235b-a22b", label: "Qwen: Qwen3 235B A22B" },
|
|
292
|
+
{ id: "openrouter/qwen/qwen3-235b-a22b-2507", label: "Qwen: Qwen3 235B A22B Instruct 2507" },
|
|
293
|
+
{ id: "openrouter/qwen/qwen3-235b-a22b-thinking-2507", label: "Qwen: Qwen3 235B A22B Thinking 2507" },
|
|
294
|
+
{ id: "openrouter/qwen/qwen3-30b-a3b", label: "Qwen: Qwen3 30B A3B" },
|
|
295
|
+
{ id: "openrouter/qwen/qwen3-30b-a3b-instruct-2507", label: "Qwen: Qwen3 30B A3B Instruct 2507" },
|
|
296
|
+
{ id: "openrouter/qwen/qwen3-30b-a3b-thinking-2507", label: "Qwen: Qwen3 30B A3B Thinking 2507" },
|
|
297
|
+
{ id: "openrouter/qwen/qwen3-32b", label: "Qwen: Qwen3 32B" },
|
|
298
|
+
{ id: "openrouter/qwen/qwen3-8b", label: "Qwen: Qwen3 8B" },
|
|
299
|
+
{ id: "openrouter/qwen/qwen3-coder", label: "Qwen: Qwen3 Coder 480B A35B" },
|
|
300
|
+
{ id: "openrouter/qwen/qwen3-coder-30b-a3b-instruct", label: "Qwen: Qwen3 Coder 30B A3B Instruct" },
|
|
301
|
+
{ id: "openrouter/qwen/qwen3-coder-flash", label: "Qwen: Qwen3 Coder Flash" },
|
|
302
|
+
{ id: "openrouter/qwen/qwen3-coder-next", label: "Qwen: Qwen3 Coder Next" },
|
|
303
|
+
{ id: "openrouter/qwen/qwen3-coder-plus", label: "Qwen: Qwen3 Coder Plus" },
|
|
304
|
+
{ id: "openrouter/qwen/qwen3-coder:free", label: "Qwen: Qwen3 Coder 480B A35B (free)" },
|
|
305
|
+
{ id: "openrouter/qwen/qwen3-max", label: "Qwen: Qwen3 Max" },
|
|
306
|
+
{ id: "openrouter/qwen/qwen3-max-thinking", label: "Qwen: Qwen3 Max Thinking" },
|
|
307
|
+
{ id: "openrouter/qwen/qwen3-next-80b-a3b-instruct", label: "Qwen: Qwen3 Next 80B A3B Instruct" },
|
|
308
|
+
{ id: "openrouter/qwen/qwen3-next-80b-a3b-instruct:free", label: "Qwen: Qwen3 Next 80B A3B Instruct (free)" },
|
|
309
|
+
{ id: "openrouter/qwen/qwen3-next-80b-a3b-thinking", label: "Qwen: Qwen3 Next 80B A3B Thinking" },
|
|
310
|
+
{ id: "openrouter/qwen/qwen3-vl-235b-a22b-instruct", label: "Qwen: Qwen3 VL 235B A22B Instruct" },
|
|
311
|
+
{ id: "openrouter/qwen/qwen3-vl-235b-a22b-thinking", label: "Qwen: Qwen3 VL 235B A22B Thinking" },
|
|
312
|
+
{ id: "openrouter/qwen/qwen3-vl-30b-a3b-instruct", label: "Qwen: Qwen3 VL 30B A3B Instruct" },
|
|
313
|
+
{ id: "openrouter/qwen/qwen3-vl-30b-a3b-thinking", label: "Qwen: Qwen3 VL 30B A3B Thinking" },
|
|
314
|
+
{ id: "openrouter/qwen/qwen3-vl-32b-instruct", label: "Qwen: Qwen3 VL 32B Instruct" },
|
|
315
|
+
{ id: "openrouter/qwen/qwen3-vl-8b-instruct", label: "Qwen: Qwen3 VL 8B Instruct" },
|
|
316
|
+
{ id: "openrouter/qwen/qwen3-vl-8b-thinking", label: "Qwen: Qwen3 VL 8B Thinking" },
|
|
317
|
+
{ id: "openrouter/qwen/qwen3.5-122b-a10b", label: "Qwen: Qwen3.5-122B-A10B" },
|
|
318
|
+
{ id: "openrouter/qwen/qwen3.5-27b", label: "Qwen: Qwen3.5-27B" },
|
|
319
|
+
{ id: "openrouter/qwen/qwen3.5-35b-a3b", label: "Qwen: Qwen3.5-35B-A3B" },
|
|
320
|
+
{ id: "openrouter/qwen/qwen3.5-397b-a17b", label: "Qwen: Qwen3.5 397B A17B" },
|
|
321
|
+
{ id: "openrouter/qwen/qwen3.5-9b", label: "Qwen: Qwen3.5-9B" },
|
|
322
|
+
{ id: "openrouter/qwen/qwen3.5-flash-02-23", label: "Qwen: Qwen3.5-Flash" },
|
|
323
|
+
{ id: "openrouter/qwen/qwen3.5-plus-02-15", label: "Qwen: Qwen3.5 Plus 2026-02-15" },
|
|
324
|
+
{ id: "openrouter/qwen/qwen3.5-plus-20260420", label: "Qwen: Qwen3.5 Plus 2026-04-20" },
|
|
325
|
+
{ id: "openrouter/qwen/qwen3.6-27b", label: "Qwen: Qwen3.6 27B" },
|
|
326
|
+
{ id: "openrouter/qwen/qwen3.6-35b-a3b", label: "Qwen: Qwen3.6 35B A3B" },
|
|
327
|
+
{ id: "openrouter/qwen/qwen3.6-flash", label: "Qwen: Qwen3.6 Flash" },
|
|
328
|
+
{ id: "openrouter/qwen/qwen3.6-max-preview", label: "Qwen: Qwen3.6 Max Preview" },
|
|
329
|
+
{ id: "openrouter/qwen/qwen3.6-plus", label: "Qwen: Qwen3.6 Plus" },
|
|
330
|
+
{ id: "openrouter/qwen/qwen3.7-max", label: "Qwen: Qwen3.7 Max" },
|
|
331
|
+
{ id: "openrouter/qwen/qwen3.7-plus", label: "Qwen: Qwen3.7 Plus" },
|
|
332
|
+
{ id: "openrouter/rekaai/reka-edge", label: "Reka Edge" },
|
|
333
|
+
{ id: "openrouter/relace/relace-search", label: "Relace: Relace Search" },
|
|
334
|
+
{ id: "openrouter/sao10k/l3.1-euryale-70b", label: "Sao10K: Llama 3.1 Euryale 70B v2.2" },
|
|
335
|
+
{ id: "openrouter/stepfun/step-3.5-flash", label: "StepFun: Step 3.5 Flash" },
|
|
336
|
+
{ id: "openrouter/stepfun/step-3.7-flash", label: "StepFun: Step 3.7 Flash" },
|
|
337
|
+
{ id: "openrouter/tencent/hy3-preview", label: "Tencent: Hy3 preview" },
|
|
338
|
+
{ id: "openrouter/thedrummer/rocinante-12b", label: "TheDrummer: Rocinante 12B" },
|
|
339
|
+
{ id: "openrouter/thedrummer/unslopnemo-12b", label: "TheDrummer: UnslopNemo 12B" },
|
|
340
|
+
{ id: "openrouter/upstage/solar-pro-3", label: "Upstage: Solar Pro 3" },
|
|
341
|
+
{ id: "openrouter/x-ai/grok-4.20", label: "xAI: Grok 4.20" },
|
|
342
|
+
{ id: "openrouter/x-ai/grok-4.3", label: "xAI: Grok 4.3" },
|
|
343
|
+
{ id: "openrouter/x-ai/grok-build-0.1", label: "xAI: Grok Build 0.1" },
|
|
344
|
+
{ id: "openrouter/xiaomi/mimo-v2.5", label: "Xiaomi: MiMo-V2.5" },
|
|
345
|
+
{ id: "openrouter/xiaomi/mimo-v2.5-pro", label: "Xiaomi: MiMo-V2.5-Pro" },
|
|
346
|
+
{ id: "openrouter/z-ai/glm-4.5", label: "Z.ai: GLM 4.5" },
|
|
347
|
+
{ id: "openrouter/z-ai/glm-4.5-air", label: "Z.ai: GLM 4.5 Air" },
|
|
348
|
+
{ id: "openrouter/z-ai/glm-4.5v", label: "Z.ai: GLM 4.5V" },
|
|
349
|
+
{ id: "openrouter/z-ai/glm-4.6", label: "Z.ai: GLM 4.6" },
|
|
350
|
+
{ id: "openrouter/z-ai/glm-4.6v", label: "Z.ai: GLM 4.6V" },
|
|
351
|
+
{ id: "openrouter/z-ai/glm-4.7", label: "Z.ai: GLM 4.7" },
|
|
352
|
+
{ id: "openrouter/z-ai/glm-4.7-flash", label: "Z.ai: GLM 4.7 Flash" },
|
|
353
|
+
{ id: "openrouter/z-ai/glm-5", label: "Z.ai: GLM 5" },
|
|
354
|
+
{ id: "openrouter/z-ai/glm-5-turbo", label: "Z.ai: GLM 5 Turbo" },
|
|
355
|
+
{ id: "openrouter/z-ai/glm-5.1", label: "Z.ai: GLM 5.1" },
|
|
356
|
+
{ id: "openrouter/z-ai/glm-5.2", label: "Z.ai: GLM 5.2" },
|
|
357
|
+
{ id: "openrouter/~anthropic/claude-fable-latest", label: "Anthropic: Claude Fable Latest" },
|
|
358
|
+
{ id: "openrouter/~anthropic/claude-haiku-latest", label: "Anthropic Claude Haiku Latest" },
|
|
359
|
+
{ id: "openrouter/~anthropic/claude-opus-latest", label: "Anthropic: Claude Opus Latest" },
|
|
360
|
+
{ id: "openrouter/~anthropic/claude-sonnet-latest", label: "Anthropic Claude Sonnet Latest" },
|
|
361
|
+
{ id: "openrouter/~google/gemini-flash-latest", label: "Google Gemini Flash Latest" },
|
|
362
|
+
{ id: "openrouter/~google/gemini-pro-latest", label: "Google Gemini Pro Latest" },
|
|
363
|
+
{ id: "openrouter/~moonshotai/kimi-latest", label: "MoonshotAI Kimi Latest" },
|
|
364
|
+
{ id: "openrouter/~openai/gpt-latest", label: "OpenAI GPT Latest" },
|
|
365
|
+
{ id: "openrouter/~openai/gpt-mini-latest", label: "OpenAI GPT Mini Latest" }
|
|
366
|
+
],
|
|
367
|
+
"openai": [
|
|
368
|
+
{ id: "openai/gpt-5.4", label: "GPT-5.4" },
|
|
369
|
+
{ id: "openai/gpt-4", label: "GPT-4" },
|
|
370
|
+
{ id: "openai/gpt-4-turbo", label: "GPT-4 Turbo" },
|
|
371
|
+
{ id: "openai/gpt-4.1", label: "GPT-4.1" },
|
|
372
|
+
{ id: "openai/gpt-4.1-mini", label: "GPT-4.1 mini" },
|
|
373
|
+
{ id: "openai/gpt-4.1-nano", label: "GPT-4.1 nano" },
|
|
374
|
+
{ id: "openai/gpt-4o", label: "GPT-4o" },
|
|
375
|
+
{ id: "openai/gpt-4o-2024-05-13", label: "GPT-4o (2024-05-13)" },
|
|
376
|
+
{ id: "openai/gpt-4o-2024-08-06", label: "GPT-4o (2024-08-06)" },
|
|
377
|
+
{ id: "openai/gpt-4o-2024-11-20", label: "GPT-4o (2024-11-20)" },
|
|
378
|
+
{ id: "openai/gpt-4o-mini", label: "GPT-4o mini" },
|
|
379
|
+
{ id: "openai/gpt-5", label: "GPT-5" },
|
|
380
|
+
{ id: "openai/gpt-5-chat-latest", label: "GPT-5 Chat Latest" },
|
|
381
|
+
{ id: "openai/gpt-5-codex", label: "GPT-5-Codex" },
|
|
382
|
+
{ id: "openai/gpt-5-mini", label: "GPT-5 Mini" },
|
|
383
|
+
{ id: "openai/gpt-5-nano", label: "GPT-5 Nano" },
|
|
384
|
+
{ id: "openai/gpt-5-pro", label: "GPT-5 Pro" },
|
|
385
|
+
{ id: "openai/gpt-5.1", label: "GPT-5.1" },
|
|
386
|
+
{ id: "openai/gpt-5.1-chat-latest", label: "GPT-5.1 Chat" },
|
|
387
|
+
{ id: "openai/gpt-5.1-codex", label: "GPT-5.1 Codex" },
|
|
388
|
+
{ id: "openai/gpt-5.1-codex-max", label: "GPT-5.1 Codex Max" },
|
|
389
|
+
{ id: "openai/gpt-5.1-codex-mini", label: "GPT-5.1 Codex mini" },
|
|
390
|
+
{ id: "openai/gpt-5.2", label: "GPT-5.2" },
|
|
391
|
+
{ id: "openai/gpt-5.2-chat-latest", label: "GPT-5.2 Chat" },
|
|
392
|
+
{ id: "openai/gpt-5.2-codex", label: "GPT-5.2 Codex" },
|
|
393
|
+
{ id: "openai/gpt-5.2-pro", label: "GPT-5.2 Pro" },
|
|
394
|
+
{ id: "openai/gpt-5.3-chat-latest", label: "GPT-5.3 Chat (latest)" },
|
|
395
|
+
{ id: "openai/gpt-5.3-codex", label: "GPT-5.3 Codex" },
|
|
396
|
+
{ id: "openai/gpt-5.3-codex-spark", label: "GPT-5.3 Codex Spark" },
|
|
397
|
+
{ id: "openai/gpt-5.4-mini", label: "GPT-5.4 mini" },
|
|
398
|
+
{ id: "openai/gpt-5.4-nano", label: "GPT-5.4 nano" },
|
|
399
|
+
{ id: "openai/gpt-5.4-pro", label: "GPT-5.4 Pro" },
|
|
400
|
+
{ id: "openai/gpt-5.5", label: "GPT-5.5" },
|
|
401
|
+
{ id: "openai/gpt-5.5-pro", label: "GPT-5.5 Pro" },
|
|
402
|
+
{ id: "openai/o1", label: "o1" },
|
|
403
|
+
{ id: "openai/o1-pro", label: "o1-pro" },
|
|
404
|
+
{ id: "openai/o3", label: "o3" },
|
|
405
|
+
{ id: "openai/o3-deep-research", label: "o3-deep-research" },
|
|
406
|
+
{ id: "openai/o3-mini", label: "o3-mini" },
|
|
407
|
+
{ id: "openai/o3-pro", label: "o3-pro" },
|
|
408
|
+
{ id: "openai/o4-mini", label: "o4-mini" },
|
|
409
|
+
{ id: "openai/o4-mini-deep-research", label: "o4-mini-deep-research" }
|
|
410
|
+
],
|
|
411
|
+
"anthropic": [
|
|
412
|
+
{ id: "anthropic/claude-opus-4-8", label: "Claude Opus 4.8" },
|
|
413
|
+
{ id: "anthropic/claude-3-5-haiku-20241022", label: "Claude Haiku 3.5" },
|
|
414
|
+
{ id: "anthropic/claude-3-5-haiku-latest", label: "Claude Haiku 3.5 (latest)" },
|
|
415
|
+
{ id: "anthropic/claude-3-5-sonnet-20240620", label: "Claude Sonnet 3.5" },
|
|
416
|
+
{ id: "anthropic/claude-3-5-sonnet-20241022", label: "Claude Sonnet 3.5 v2" },
|
|
417
|
+
{ id: "anthropic/claude-3-7-sonnet-20250219", label: "Claude Sonnet 3.7" },
|
|
418
|
+
{ id: "anthropic/claude-3-haiku-20240307", label: "Claude Haiku 3" },
|
|
419
|
+
{ id: "anthropic/claude-3-opus-20240229", label: "Claude Opus 3" },
|
|
420
|
+
{ id: "anthropic/claude-3-sonnet-20240229", label: "Claude Sonnet 3" },
|
|
421
|
+
{ id: "anthropic/claude-fable-5", label: "Claude Fable 5" },
|
|
422
|
+
{ id: "anthropic/claude-haiku-4-5", label: "Claude Haiku 4.5 (latest)" },
|
|
423
|
+
{ id: "anthropic/claude-haiku-4-5-20251001", label: "Claude Haiku 4.5" },
|
|
424
|
+
{ id: "anthropic/claude-opus-4-0", label: "Claude Opus 4 (latest)" },
|
|
425
|
+
{ id: "anthropic/claude-opus-4-1", label: "Claude Opus 4.1 (latest)" },
|
|
426
|
+
{ id: "anthropic/claude-opus-4-1-20250805", label: "Claude Opus 4.1" },
|
|
427
|
+
{ id: "anthropic/claude-opus-4-20250514", label: "Claude Opus 4" },
|
|
428
|
+
{ id: "anthropic/claude-opus-4-5", label: "Claude Opus 4.5 (latest)" },
|
|
429
|
+
{ id: "anthropic/claude-opus-4-5-20251101", label: "Claude Opus 4.5" },
|
|
430
|
+
{ id: "anthropic/claude-opus-4-6", label: "Claude Opus 4.6" },
|
|
431
|
+
{ id: "anthropic/claude-opus-4-7", label: "Claude Opus 4.7" },
|
|
432
|
+
{ id: "anthropic/claude-sonnet-4-0", label: "Claude Sonnet 4 (latest)" },
|
|
433
|
+
{ id: "anthropic/claude-sonnet-4-20250514", label: "Claude Sonnet 4" },
|
|
434
|
+
{ id: "anthropic/claude-sonnet-4-5", label: "Claude Sonnet 4.5 (latest)" },
|
|
435
|
+
{ id: "anthropic/claude-sonnet-4-5-20250929", label: "Claude Sonnet 4.5" },
|
|
436
|
+
{ id: "anthropic/claude-sonnet-4-6", label: "Claude Sonnet 4.6" }
|
|
437
|
+
],
|
|
438
|
+
"google": [
|
|
439
|
+
{ id: "google/gemini-3.1-pro-preview", label: "Gemini 3.1 Pro Preview" },
|
|
440
|
+
{ id: "google/gemini-2.0-flash", label: "Gemini 2.0 Flash" },
|
|
441
|
+
{ id: "google/gemini-2.0-flash-lite", label: "Gemini 2.0 Flash-Lite" },
|
|
442
|
+
{ id: "google/gemini-2.5-flash", label: "Gemini 2.5 Flash" },
|
|
443
|
+
{ id: "google/gemini-2.5-flash-lite", label: "Gemini 2.5 Flash-Lite" },
|
|
444
|
+
{ id: "google/gemini-2.5-pro", label: "Gemini 2.5 Pro" },
|
|
445
|
+
{ id: "google/gemini-3-flash-preview", label: "Gemini 3 Flash Preview" },
|
|
446
|
+
{ id: "google/gemini-3-pro-preview", label: "Gemini 3 Pro Preview" },
|
|
447
|
+
{ id: "google/gemini-3.1-flash-lite", label: "Gemini 3.1 Flash Lite" },
|
|
448
|
+
{ id: "google/gemini-3.1-flash-lite-preview", label: "Gemini 3.1 Flash Lite Preview" },
|
|
449
|
+
{ id: "google/gemini-3.1-pro-preview-customtools", label: "Gemini 3.1 Pro Preview Custom Tools" },
|
|
450
|
+
{ id: "google/gemini-3.5-flash", label: "Gemini 3.5 Flash" },
|
|
451
|
+
{ id: "google/gemini-flash-latest", label: "Gemini Flash Latest" },
|
|
452
|
+
{ id: "google/gemini-flash-lite-latest", label: "Gemini Flash-Lite Latest" },
|
|
453
|
+
{ id: "google/gemma-4-26b-a4b-it", label: "Gemma 4 26B A4B IT" },
|
|
454
|
+
{ id: "google/gemma-4-31b-it", label: "Gemma 4 31B IT" },
|
|
455
|
+
{ id: "google/gemma-4-E2B-it", label: "Gemma 4 E2B IT" },
|
|
456
|
+
{ id: "google/gemma-4-E4B-it", label: "Gemma 4 E4B IT" }
|
|
457
|
+
],
|
|
458
|
+
"xai": [
|
|
459
|
+
{ id: "xai/grok-4.20-0309-reasoning", label: "Grok 4.20 (Reasoning)" },
|
|
460
|
+
{ id: "xai/grok-3", label: "Grok 3" },
|
|
461
|
+
{ id: "xai/grok-3-fast", label: "Grok 3 Fast" },
|
|
462
|
+
{ id: "xai/grok-4.20-0309-non-reasoning", label: "Grok 4.20 (Non-Reasoning)" },
|
|
463
|
+
{ id: "xai/grok-4.3", label: "Grok 4.3" },
|
|
464
|
+
{ id: "xai/grok-build-0.1", label: "Grok Build 0.1" },
|
|
465
|
+
{ id: "xai/grok-code-fast-1", label: "Grok Code Fast 1" }
|
|
466
|
+
],
|
|
467
|
+
"xiaomi": [
|
|
468
|
+
{ id: "xiaomi/mimo-v2.5-pro", label: "MiMo-V2.5-Pro" },
|
|
469
|
+
{ id: "xiaomi/mimo-v2-flash", label: "MiMo-V2-Flash" },
|
|
470
|
+
{ id: "xiaomi/mimo-v2-omni", label: "MiMo-V2-Omni" },
|
|
471
|
+
{ id: "xiaomi/mimo-v2-pro", label: "MiMo-V2-Pro" },
|
|
472
|
+
{ id: "xiaomi/mimo-v2.5", label: "MiMo-V2.5" },
|
|
473
|
+
{ id: "xiaomi/mimo-v2.5-pro-ultraspeed", label: "MiMo-V2.5-Pro-UltraSpeed" }
|
|
474
|
+
]
|
|
475
|
+
};
|
|
476
|
+
|
|
14
477
|
// ../shared/src/generated/runtimeProviderDisplayNames.ts
|
|
15
478
|
var RUNTIME_PROVIDER_DISPLAY_NAMES = {
|
|
16
479
|
"anthropic": "Anthropic",
|
|
17
480
|
"deepseek": "DeepSeek",
|
|
18
481
|
"fusecode": "FuseCode",
|
|
19
|
-
"google": "Google",
|
|
482
|
+
"google": "Google Gemini",
|
|
483
|
+
"kimi-coding": "Kimi For Coding",
|
|
484
|
+
"minimax": "MiniMax",
|
|
485
|
+
"minimax-cn": "MiniMax (China)",
|
|
486
|
+
"moonshotai": "Moonshot AI",
|
|
487
|
+
"moonshotai-cn": "Moonshot AI (China)",
|
|
20
488
|
"openai": "OpenAI",
|
|
21
|
-
"opencode": "OpenCode",
|
|
489
|
+
"opencode": "OpenCode Zen",
|
|
22
490
|
"opencode-go": "OpenCode Go",
|
|
23
|
-
"openrouter": "OpenRouter"
|
|
491
|
+
"openrouter": "OpenRouter",
|
|
492
|
+
"xai": "xAI",
|
|
493
|
+
"xiaomi": "Xiaomi MiMo",
|
|
494
|
+
"zai": "ZAI",
|
|
495
|
+
"zai-coding-cn": "ZAI Coding Plan (China)"
|
|
24
496
|
};
|
|
25
497
|
|
|
26
498
|
// ../shared/src/runtimeProviderDisplay.ts
|
|
@@ -63,6 +535,7 @@ function formatRuntimeProviderLabelToken(token) {
|
|
|
63
535
|
nemotron: "Nemotron",
|
|
64
536
|
omni: "Omni",
|
|
65
537
|
opus: "Opus",
|
|
538
|
+
openai: "OpenAI",
|
|
66
539
|
pro: "Pro",
|
|
67
540
|
sonnet: "Sonnet",
|
|
68
541
|
super: "Super"
|
|
@@ -77,6 +550,187 @@ function formatRuntimeProviderLabelToken(token) {
|
|
|
77
550
|
return normalized.charAt(0).toUpperCase() + normalized.slice(1);
|
|
78
551
|
}
|
|
79
552
|
|
|
553
|
+
// ../shared/src/runtimeConfigLegacy.ts
|
|
554
|
+
function isPlainRecord(value) {
|
|
555
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
556
|
+
}
|
|
557
|
+
function whitelistRecord(record, knownFields) {
|
|
558
|
+
const known = new Set(knownFields);
|
|
559
|
+
const value = {};
|
|
560
|
+
let droppedCount = 0;
|
|
561
|
+
for (const [key, fieldValue] of Object.entries(record)) {
|
|
562
|
+
if (known.has(key)) {
|
|
563
|
+
value[key] = fieldValue;
|
|
564
|
+
} else {
|
|
565
|
+
droppedCount += 1;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return { value, droppedCount };
|
|
569
|
+
}
|
|
570
|
+
function sanitizeStoredRuntimeConfig(record, deps) {
|
|
571
|
+
const topLevel = whitelistRecord(record, deps.runtimeConfigFields);
|
|
572
|
+
const value = { ...topLevel.value };
|
|
573
|
+
let droppedCount = topLevel.droppedCount;
|
|
574
|
+
const runtime = typeof value.runtime === "string" ? value.runtime : void 0;
|
|
575
|
+
if (isPlainRecord(value.model)) {
|
|
576
|
+
const model = whitelistRecord(value.model, deps.modelConfigFields);
|
|
577
|
+
value.model = model.value;
|
|
578
|
+
droppedCount += model.droppedCount;
|
|
579
|
+
}
|
|
580
|
+
if (isPlainRecord(value.mode)) {
|
|
581
|
+
const mode = whitelistRecord(value.mode, deps.modeConfigFields);
|
|
582
|
+
value.mode = mode.value;
|
|
583
|
+
droppedCount += mode.droppedCount;
|
|
584
|
+
}
|
|
585
|
+
if (isPlainRecord(value.provider)) {
|
|
586
|
+
const provider = whitelistRecord(value.provider, deps.providerKnownFieldsFor(runtime, value.provider));
|
|
587
|
+
value.provider = provider.value;
|
|
588
|
+
droppedCount += provider.droppedCount;
|
|
589
|
+
}
|
|
590
|
+
return { value, droppedCount };
|
|
591
|
+
}
|
|
592
|
+
function normalizeEnvVars(envVars) {
|
|
593
|
+
if (!isPlainRecord(envVars)) return null;
|
|
594
|
+
const normalized = {};
|
|
595
|
+
for (const [key, value] of Object.entries(envVars)) {
|
|
596
|
+
if (typeof key === "string" && typeof value === "string") {
|
|
597
|
+
normalized[key] = value;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return Object.keys(normalized).length > 0 ? normalized : null;
|
|
601
|
+
}
|
|
602
|
+
function isPresetRuntimeModel(runtimeModels, runtime, model) {
|
|
603
|
+
return (runtimeModels[runtime] ?? []).some((candidate) => candidate.id === model);
|
|
604
|
+
}
|
|
605
|
+
function hasMapKey(map, key) {
|
|
606
|
+
return Object.prototype.hasOwnProperty.call(map, key);
|
|
607
|
+
}
|
|
608
|
+
function modelConfigFromLegacy(runtimeModels, runtime, model) {
|
|
609
|
+
return isPresetRuntimeModel(runtimeModels, runtime, model) ? { kind: "preset", id: model } : { kind: "custom", name: model };
|
|
610
|
+
}
|
|
611
|
+
function parseProviderConfig(runtime, value, builtinProviderEnvKeys, builtinGatewayProviderEnvKeys, piBuiltinProviderEnvKeys, legacyApiUrl, legacyApiKey) {
|
|
612
|
+
if (runtime === "builtin") {
|
|
613
|
+
const providerId = isPlainRecord(value) && typeof value.providerId === "string" ? value.providerId.trim() : "";
|
|
614
|
+
if (value && isPlainRecord(value) && (value.kind === "preset" || value.kind === "managed") && providerId && typeof value.apiKey === "string" && value.apiKey.trim() && hasMapKey(builtinProviderEnvKeys, providerId)) {
|
|
615
|
+
return { kind: "preset", providerId, apiKey: value.apiKey.trim() };
|
|
616
|
+
}
|
|
617
|
+
if (value && isPlainRecord(value) && value.kind === "gateway" && providerId && typeof value.baseUrl === "string" && value.baseUrl.trim() && typeof value.apiKey === "string" && value.apiKey.trim() && hasMapKey(builtinGatewayProviderEnvKeys, providerId)) {
|
|
618
|
+
return { kind: "gateway", providerId, baseUrl: value.baseUrl.trim(), apiKey: value.apiKey.trim() };
|
|
619
|
+
}
|
|
620
|
+
return void 0;
|
|
621
|
+
}
|
|
622
|
+
if (runtime === "claude") {
|
|
623
|
+
if (!isPlainRecord(value)) return { kind: "default" };
|
|
624
|
+
if (value.kind === "custom" && typeof value.apiUrl === "string" && value.apiUrl.trim() && typeof value.apiKey === "string" && value.apiKey.trim()) {
|
|
625
|
+
return { kind: "custom", apiUrl: value.apiUrl.trim(), apiKey: value.apiKey.trim() };
|
|
626
|
+
}
|
|
627
|
+
if (value.kind === "custom" && legacyApiUrl?.trim() && legacyApiKey?.trim()) {
|
|
628
|
+
return { kind: "custom", apiUrl: legacyApiUrl.trim(), apiKey: legacyApiKey.trim() };
|
|
629
|
+
}
|
|
630
|
+
return { kind: "default" };
|
|
631
|
+
}
|
|
632
|
+
if (runtime === "pi") {
|
|
633
|
+
if (!isPlainRecord(value)) return { kind: "default" };
|
|
634
|
+
if (value.kind === "pi-builtin" && typeof value.providerId === "string" && value.providerId.trim() && typeof value.apiKey === "string" && value.apiKey.trim() && Object.prototype.hasOwnProperty.call(piBuiltinProviderEnvKeys, value.providerId.trim())) {
|
|
635
|
+
return { kind: "pi-builtin", providerId: value.providerId.trim(), apiKey: value.apiKey.trim() };
|
|
636
|
+
}
|
|
637
|
+
return { kind: "default" };
|
|
638
|
+
}
|
|
639
|
+
return void 0;
|
|
640
|
+
}
|
|
641
|
+
function parseModelConfig(runtimeModels, runtime, value, fallback, usesLegacyClaudeCustomProvider, legacyCustomModel) {
|
|
642
|
+
if (!isPlainRecord(value)) return modelConfigFromLegacy(runtimeModels, runtime, fallback);
|
|
643
|
+
if (value.kind === "custom" && typeof value.name === "string" && value.name.trim()) {
|
|
644
|
+
return { kind: "custom", name: value.name.trim() };
|
|
645
|
+
}
|
|
646
|
+
if (value.kind === "preset" && typeof value.id === "string" && value.id.trim() && isPresetRuntimeModel(runtimeModels, runtime, value.id.trim())) {
|
|
647
|
+
return { kind: "preset", id: value.id.trim() };
|
|
648
|
+
}
|
|
649
|
+
if (usesLegacyClaudeCustomProvider && runtime === "claude" && legacyCustomModel?.trim()) {
|
|
650
|
+
return { kind: "custom", name: legacyCustomModel.trim() };
|
|
651
|
+
}
|
|
652
|
+
return modelConfigFromLegacy(runtimeModels, runtime, fallback);
|
|
653
|
+
}
|
|
654
|
+
function parseModeConfig(value) {
|
|
655
|
+
if (!isPlainRecord(value)) return { kind: "default" };
|
|
656
|
+
if (value.kind === "fast") return { kind: "fast" };
|
|
657
|
+
return { kind: "default" };
|
|
658
|
+
}
|
|
659
|
+
function parseCommandConfig(runtime, value) {
|
|
660
|
+
if (runtime !== "claude" || typeof value !== "string") return void 0;
|
|
661
|
+
const command = value.trim();
|
|
662
|
+
return command ? command : void 0;
|
|
663
|
+
}
|
|
664
|
+
function providerKind(config) {
|
|
665
|
+
return config.provider?.kind ?? "none";
|
|
666
|
+
}
|
|
667
|
+
function classifyBuiltInGatewayBaseUrlHost(baseUrl) {
|
|
668
|
+
let hostname = "";
|
|
669
|
+
try {
|
|
670
|
+
hostname = new URL(baseUrl).hostname.toLowerCase();
|
|
671
|
+
} catch {
|
|
672
|
+
return "public";
|
|
673
|
+
}
|
|
674
|
+
if (hostname === "localhost" || hostname === "::1" || hostname === "[::1]" || hostname.startsWith("127.")) return "localhost";
|
|
675
|
+
const ipv4 = hostname.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
|
|
676
|
+
if (ipv4) {
|
|
677
|
+
const [a, b] = ipv4.slice(1).map((part) => Number(part));
|
|
678
|
+
if (a === 10 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168 || a === 169 && b === 254) return "private";
|
|
679
|
+
}
|
|
680
|
+
if (hostname === "0.0.0.0" || hostname === "::" || hostname.startsWith("fc") || hostname.startsWith("fd") || hostname.startsWith("fe80:")) return "private";
|
|
681
|
+
return "public";
|
|
682
|
+
}
|
|
683
|
+
function builtInSelectionTraceAttrs(config) {
|
|
684
|
+
if (config.runtime !== "builtin") return {};
|
|
685
|
+
return {
|
|
686
|
+
provider_id: config.provider.providerId,
|
|
687
|
+
model_kind: config.model.kind,
|
|
688
|
+
...config.model.kind === "preset" ? { model_id: config.model.id } : {},
|
|
689
|
+
...config.provider.kind === "gateway" ? {
|
|
690
|
+
base_url_present: true,
|
|
691
|
+
base_url_host_class: classifyBuiltInGatewayBaseUrlHost(config.provider.baseUrl)
|
|
692
|
+
} : {}
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
function hydrateLegacyRuntimeConfigWithTrace(input, deps) {
|
|
696
|
+
const stored = isPlainRecord(input.runtimeConfig) && input.runtimeConfig.version === deps.runtimeConfigVersion ? input.runtimeConfig : null;
|
|
697
|
+
const sanitized = stored ? sanitizeStoredRuntimeConfig(stored, deps) : null;
|
|
698
|
+
const storedConfig = sanitized?.value ?? null;
|
|
699
|
+
const runtime = typeof stored?.runtime === "string" && stored.runtime.trim() || typeof input.runtime === "string" && input.runtime.trim() || "claude";
|
|
700
|
+
const fallbackModel = typeof input.model === "string" && input.model.trim() || deps.getDefaultModel(runtime);
|
|
701
|
+
const legacyEnvVars = normalizeEnvVars(input.envVars);
|
|
702
|
+
const storedEnvVars = normalizeEnvVars(storedConfig?.envVars);
|
|
703
|
+
const legacyClaudeApiUrl = runtime === "claude" ? legacyEnvVars?.ANTHROPIC_BASE_URL : void 0;
|
|
704
|
+
const legacyClaudeApiKey = runtime === "claude" ? legacyEnvVars?.ANTHROPIC_API_KEY : void 0;
|
|
705
|
+
const legacyClaudeCustomModel = runtime === "claude" ? legacyEnvVars?.ANTHROPIC_CUSTOM_MODEL_OPTION : void 0;
|
|
706
|
+
const provider = stored ? parseProviderConfig(runtime, storedConfig?.provider, deps.builtinProviderEnvKeys, deps.builtinGatewayProviderEnvKeys, deps.piBuiltinProviderEnvKeys, legacyClaudeApiUrl, legacyClaudeApiKey) : runtime === "claude" && legacyClaudeApiUrl && legacyClaudeApiKey ? { kind: "custom", apiUrl: legacyClaudeApiUrl, apiKey: legacyClaudeApiKey } : runtime === "claude" ? { kind: "default" } : void 0;
|
|
707
|
+
const usesLegacyClaudeCustomProvider = runtime === "claude" && provider?.kind === "custom";
|
|
708
|
+
const command = stored ? parseCommandConfig(runtime, storedConfig?.command) : void 0;
|
|
709
|
+
const config = deps.composeRuntimeConfig({
|
|
710
|
+
runtime,
|
|
711
|
+
provider,
|
|
712
|
+
model: stored ? parseModelConfig(deps.runtimeModels, runtime, storedConfig?.model, fallbackModel, usesLegacyClaudeCustomProvider, legacyClaudeCustomModel) : modelConfigFromLegacy(deps.runtimeModels, runtime, fallbackModel),
|
|
713
|
+
mode: stored ? parseModeConfig(storedConfig?.mode) : { kind: "default" },
|
|
714
|
+
reasoningEffort: storedConfig?.reasoningEffort ?? input.reasoningEffort ?? null,
|
|
715
|
+
// Runtime-owned env vars are legacy launch mirrors for provider/model
|
|
716
|
+
// settings. Strip them from user envVars during hydration so the canonical
|
|
717
|
+
// RuntimeConfig provider/model arms remain the only source for generated
|
|
718
|
+
// launch env.
|
|
719
|
+
envVars: deps.stripControlledRuntimeEnvVars(runtime, stored ? storedEnvVars : legacyEnvVars),
|
|
720
|
+
command
|
|
721
|
+
});
|
|
722
|
+
return {
|
|
723
|
+
config,
|
|
724
|
+
trace: {
|
|
725
|
+
outcome: sanitized && sanitized.droppedCount > 0 ? "legacy_sanitized" : "accepted",
|
|
726
|
+
runtime: config.runtime,
|
|
727
|
+
provider_kind: providerKind(config),
|
|
728
|
+
...builtInSelectionTraceAttrs(config),
|
|
729
|
+
...sanitized && sanitized.droppedCount > 0 ? { unknown_fields_dropped_count: sanitized.droppedCount } : {}
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
|
|
80
734
|
// ../shared/src/slockRefs.ts
|
|
81
735
|
var SLOCK_REF_CHANNEL_NAME_PATTERN = String.raw`[\p{L}\p{N}_-]+`;
|
|
82
736
|
var SLOCK_REF_USER_NAME_PATTERN = SLOCK_REF_CHANNEL_NAME_PATTERN;
|
|
@@ -136,6 +790,7 @@ function projectApmHeldFreshnessEnvelope(input) {
|
|
|
136
790
|
outcome: "held",
|
|
137
791
|
subtype: "freshness",
|
|
138
792
|
reason: "newer_messages_available",
|
|
793
|
+
decision: input.decision ?? "local_hold",
|
|
139
794
|
producerFactId: input.producerFactId,
|
|
140
795
|
available_actions: apmHeldFreshnessAvailableActions(input.action),
|
|
141
796
|
heldMessages: input.heldMessages,
|
|
@@ -154,10 +809,16 @@ function projectApmHeldFreshnessEnvelope(input) {
|
|
|
154
809
|
}
|
|
155
810
|
function projectApmHeldFreshnessActivity(input) {
|
|
156
811
|
const title = input.action === "send" ? "Send held by freshness check" : input.action === "task_claim" ? "Task claim held by freshness check" : "Task update held by freshness check";
|
|
812
|
+
const messageNoun = input.messageCount === 1 ? "message" : "messages";
|
|
813
|
+
const countLine = input.decision === "syncing_hold" ? `unreviewed synced context for this target: ${input.messageCount} ${messageNoun}` : `new messages: ${input.messageCount} newer ${messageNoun}`;
|
|
814
|
+
const decisionLines = input.decision === "syncing_hold" ? [
|
|
815
|
+
"reason: this target's latest synced context was not yet in your reviewed context",
|
|
816
|
+
input.action === "send" ? "action: review the synced context before sending" : "action: review the synced context, then retry this action"
|
|
817
|
+
] : ["decision: local hold; review the newer context before retrying"];
|
|
157
818
|
const text = [
|
|
158
819
|
input.target ? `target: ${input.target}` : null,
|
|
159
|
-
|
|
160
|
-
|
|
820
|
+
countLine,
|
|
821
|
+
...decisionLines
|
|
161
822
|
].filter((line) => Boolean(line)).join("\n");
|
|
162
823
|
return {
|
|
163
824
|
clauseId: "SMR-006",
|
|
@@ -1137,6 +1798,424 @@ var actionCardActionSchema = z.discriminatedUnion("type", [
|
|
|
1137
1798
|
integrationUpdateAppRegistrationOperationSchema
|
|
1138
1799
|
]);
|
|
1139
1800
|
|
|
1801
|
+
// ../shared/src/agentApiContract.ts
|
|
1802
|
+
import { z as z2 } from "zod";
|
|
1803
|
+
var AGENT_API_BASE_PATH = "/internal/agent-api";
|
|
1804
|
+
var optionalStringSchema = z2.string().trim().optional();
|
|
1805
|
+
var optionalStringArraySchema = z2.array(z2.string().trim().min(1)).optional();
|
|
1806
|
+
var optionalBooleanSchema = z2.boolean().optional();
|
|
1807
|
+
var optionalNumberSchema = z2.number().finite().optional();
|
|
1808
|
+
var nullableStringSchema = z2.string().nullable();
|
|
1809
|
+
var nullableNumberSchema = z2.number().finite().nullable();
|
|
1810
|
+
var optionalIsoTimestampSchema = z2.string().datetime().optional();
|
|
1811
|
+
var passthroughObject = (shape) => z2.object(shape).passthrough();
|
|
1812
|
+
var taskStatusSchema = z2.enum(["todo", "in_progress", "in_review", "done", "closed"]);
|
|
1813
|
+
var agentApiEventsQuerySchema = passthroughObject({
|
|
1814
|
+
since: optionalStringSchema,
|
|
1815
|
+
limit: optionalStringSchema
|
|
1816
|
+
});
|
|
1817
|
+
var agentApiHistoryQuerySchema = passthroughObject({
|
|
1818
|
+
channel: z2.string().trim().min(1),
|
|
1819
|
+
before: optionalStringSchema,
|
|
1820
|
+
after: optionalStringSchema,
|
|
1821
|
+
around: optionalStringSchema,
|
|
1822
|
+
limit: optionalStringSchema
|
|
1823
|
+
});
|
|
1824
|
+
var agentApiSendBodySchema = passthroughObject({
|
|
1825
|
+
target: z2.string().optional(),
|
|
1826
|
+
content: z2.string().optional(),
|
|
1827
|
+
attachmentIds: optionalStringArraySchema,
|
|
1828
|
+
idempotencyKey: optionalStringSchema,
|
|
1829
|
+
continue: optionalBooleanSchema,
|
|
1830
|
+
sendDraft: optionalBooleanSchema,
|
|
1831
|
+
continueAnyway: optionalBooleanSchema,
|
|
1832
|
+
draftReholdCount: optionalNumberSchema,
|
|
1833
|
+
draftReplacedExisting: optionalBooleanSchema,
|
|
1834
|
+
seenUpToSeq: optionalNumberSchema
|
|
1835
|
+
});
|
|
1836
|
+
var agentApiMessageResolveParamsSchema = passthroughObject({
|
|
1837
|
+
msgId: z2.string().trim().min(1)
|
|
1838
|
+
});
|
|
1839
|
+
var agentApiMessageReactionParamsSchema = passthroughObject({
|
|
1840
|
+
msgId: z2.string().trim().min(1)
|
|
1841
|
+
});
|
|
1842
|
+
var agentApiMessageReactionBodySchema = passthroughObject({
|
|
1843
|
+
emoji: z2.string().trim().min(1).max(16).refine((value) => !/\s/.test(value), {
|
|
1844
|
+
message: "A single reaction emoji is required"
|
|
1845
|
+
})
|
|
1846
|
+
});
|
|
1847
|
+
var agentApiChannelMembershipParamsSchema = passthroughObject({
|
|
1848
|
+
channelId: z2.string().trim().min(1)
|
|
1849
|
+
});
|
|
1850
|
+
var agentApiTaskClaimBodySchema = passthroughObject({
|
|
1851
|
+
channel: z2.string().trim().min(1),
|
|
1852
|
+
task_numbers: z2.array(z2.number().int().positive()).optional(),
|
|
1853
|
+
message_ids: optionalStringArraySchema
|
|
1854
|
+
});
|
|
1855
|
+
var agentApiTaskListQuerySchema = passthroughObject({
|
|
1856
|
+
channel: z2.string().trim().min(1),
|
|
1857
|
+
status: z2.union([taskStatusSchema, z2.literal("all")]).optional()
|
|
1858
|
+
});
|
|
1859
|
+
var agentApiTaskCreateBodySchema = passthroughObject({
|
|
1860
|
+
channel: z2.string().trim().min(1),
|
|
1861
|
+
tasks: z2.array(passthroughObject({
|
|
1862
|
+
title: z2.string().trim().min(1)
|
|
1863
|
+
})).min(1)
|
|
1864
|
+
});
|
|
1865
|
+
var agentApiTaskUnclaimBodySchema = passthroughObject({
|
|
1866
|
+
channel: z2.string().trim().min(1),
|
|
1867
|
+
task_number: z2.number().int().positive()
|
|
1868
|
+
});
|
|
1869
|
+
var agentApiTaskUpdateStatusBodySchema = passthroughObject({
|
|
1870
|
+
channel: z2.string().trim().min(1),
|
|
1871
|
+
task_number: z2.number().int().positive(),
|
|
1872
|
+
status: taskStatusSchema
|
|
1873
|
+
});
|
|
1874
|
+
var agentApiServerInfoResponseSchema = passthroughObject({
|
|
1875
|
+
runtimeContext: passthroughObject({
|
|
1876
|
+
agentId: z2.string(),
|
|
1877
|
+
serverId: z2.string(),
|
|
1878
|
+
machineId: z2.string().nullable().optional(),
|
|
1879
|
+
machineName: z2.string().nullable().optional(),
|
|
1880
|
+
machineHostname: z2.string().nullable().optional(),
|
|
1881
|
+
machineOs: z2.string().nullable().optional(),
|
|
1882
|
+
daemonVersion: z2.string().nullable().optional(),
|
|
1883
|
+
workspacePath: z2.string().nullable().optional()
|
|
1884
|
+
}),
|
|
1885
|
+
serverRole: z2.string().nullable().optional(),
|
|
1886
|
+
serverCapabilities: passthroughObject({}).optional(),
|
|
1887
|
+
channels: z2.array(passthroughObject({
|
|
1888
|
+
id: z2.string(),
|
|
1889
|
+
name: z2.string(),
|
|
1890
|
+
joined: z2.boolean()
|
|
1891
|
+
})),
|
|
1892
|
+
agents: z2.array(passthroughObject({
|
|
1893
|
+
name: z2.string()
|
|
1894
|
+
})),
|
|
1895
|
+
humans: z2.array(passthroughObject({
|
|
1896
|
+
name: z2.string()
|
|
1897
|
+
}))
|
|
1898
|
+
});
|
|
1899
|
+
var agentApiMentionActionsPendingQuerySchema = passthroughObject({
|
|
1900
|
+
limit: optionalStringSchema
|
|
1901
|
+
});
|
|
1902
|
+
var agentApiMentionActionEnvelopeSchema = passthroughObject({
|
|
1903
|
+
resolutionId: z2.string()
|
|
1904
|
+
});
|
|
1905
|
+
var agentApiMentionActionsPendingResponseSchema = passthroughObject({
|
|
1906
|
+
pendingMentionActions: z2.array(agentApiMentionActionEnvelopeSchema),
|
|
1907
|
+
has_more: z2.boolean().optional()
|
|
1908
|
+
});
|
|
1909
|
+
var agentApiMentionActionsExecuteBodySchema = passthroughObject({
|
|
1910
|
+
action: z2.enum(["notify", "add"]),
|
|
1911
|
+
resolutionIds: optionalStringArraySchema,
|
|
1912
|
+
ids: optionalStringArraySchema
|
|
1913
|
+
});
|
|
1914
|
+
var agentApiMentionActionsExecuteResponseSchema = passthroughObject({
|
|
1915
|
+
ok: z2.literal(true),
|
|
1916
|
+
action: z2.enum(["notify", "add"]),
|
|
1917
|
+
results: z2.array(agentApiMentionActionEnvelopeSchema)
|
|
1918
|
+
});
|
|
1919
|
+
var agentApiAttachmentEnvelopeSchema = passthroughObject({
|
|
1920
|
+
id: z2.string(),
|
|
1921
|
+
filename: z2.string()
|
|
1922
|
+
});
|
|
1923
|
+
var agentApiMessageEnvelopeSchema = passthroughObject({
|
|
1924
|
+
seq: optionalNumberSchema,
|
|
1925
|
+
id: optionalStringSchema,
|
|
1926
|
+
message_id: optionalStringSchema,
|
|
1927
|
+
timestamp: optionalIsoTimestampSchema,
|
|
1928
|
+
createdAt: optionalIsoTimestampSchema,
|
|
1929
|
+
senderType: optionalStringSchema,
|
|
1930
|
+
sender_type: optionalStringSchema,
|
|
1931
|
+
senderName: optionalStringSchema,
|
|
1932
|
+
sender_name: optionalStringSchema,
|
|
1933
|
+
senderDescription: z2.string().nullable().optional(),
|
|
1934
|
+
sender_description: z2.string().nullable().optional(),
|
|
1935
|
+
channel_type: optionalStringSchema,
|
|
1936
|
+
channel_name: optionalStringSchema,
|
|
1937
|
+
parent_channel_type: optionalStringSchema,
|
|
1938
|
+
parent_channel_name: optionalStringSchema,
|
|
1939
|
+
content: optionalStringSchema,
|
|
1940
|
+
attachments: z2.array(agentApiAttachmentEnvelopeSchema).optional(),
|
|
1941
|
+
taskStatus: z2.string().nullable().optional(),
|
|
1942
|
+
task_status: z2.string().nullable().optional(),
|
|
1943
|
+
taskNumber: z2.number().int().positive().nullable().optional(),
|
|
1944
|
+
task_number: z2.number().int().positive().nullable().optional(),
|
|
1945
|
+
taskAssigneeId: z2.string().nullable().optional(),
|
|
1946
|
+
task_assignee_id: z2.string().nullable().optional(),
|
|
1947
|
+
taskAssigneeType: z2.string().nullable().optional(),
|
|
1948
|
+
task_assignee_type: z2.string().nullable().optional(),
|
|
1949
|
+
threadId: z2.string().nullable().optional(),
|
|
1950
|
+
replyCount: z2.number().int().nonnegative().nullable().optional()
|
|
1951
|
+
});
|
|
1952
|
+
var agentApiEventsResponseSchema = passthroughObject({
|
|
1953
|
+
events: z2.array(agentApiMessageEnvelopeSchema),
|
|
1954
|
+
last_seen_msgId: nullableStringSchema,
|
|
1955
|
+
last_seen_seq: nullableNumberSchema,
|
|
1956
|
+
reply_target: nullableStringSchema,
|
|
1957
|
+
pending_notice_ids: z2.array(z2.string()),
|
|
1958
|
+
wake_reason: z2.string().nullable(),
|
|
1959
|
+
has_more: z2.boolean()
|
|
1960
|
+
});
|
|
1961
|
+
var agentApiHistoryResponseSchema = passthroughObject({
|
|
1962
|
+
messages: z2.array(agentApiMessageEnvelopeSchema),
|
|
1963
|
+
has_more: z2.boolean(),
|
|
1964
|
+
has_older: z2.boolean(),
|
|
1965
|
+
has_newer: z2.boolean(),
|
|
1966
|
+
last_read_seq: nullableNumberSchema.optional()
|
|
1967
|
+
});
|
|
1968
|
+
var agentApiHeldFreshnessResponseSchema = passthroughObject({
|
|
1969
|
+
ok: z2.literal(true).optional(),
|
|
1970
|
+
state: z2.literal("held"),
|
|
1971
|
+
outcome: z2.literal("held").optional(),
|
|
1972
|
+
subtype: z2.literal("freshness").optional(),
|
|
1973
|
+
reason: z2.string().optional(),
|
|
1974
|
+
decision: z2.enum(["local_hold", "syncing_hold"]).optional(),
|
|
1975
|
+
producerFactId: optionalStringSchema,
|
|
1976
|
+
available_actions: z2.array(z2.string()).optional(),
|
|
1977
|
+
heldMessages: z2.array(agentApiMessageEnvelopeSchema).optional(),
|
|
1978
|
+
recentUnread: z2.array(agentApiMessageEnvelopeSchema).optional(),
|
|
1979
|
+
newMessageCount: optionalNumberSchema,
|
|
1980
|
+
shownMessageCount: optionalNumberSchema,
|
|
1981
|
+
omittedMessageCount: optionalNumberSchema,
|
|
1982
|
+
mentionAnnotation: passthroughObject({
|
|
1983
|
+
formalMentionCount: z2.number().finite()
|
|
1984
|
+
}).optional(),
|
|
1985
|
+
continueAnywaySuggested: optionalBooleanSchema,
|
|
1986
|
+
seenUpToSeq: optionalNumberSchema,
|
|
1987
|
+
seenUpToMessageId: nullableStringSchema.optional()
|
|
1988
|
+
});
|
|
1989
|
+
var agentApiSendSentResponseSchema = passthroughObject({
|
|
1990
|
+
ok: z2.literal(true),
|
|
1991
|
+
state: z2.literal("sent"),
|
|
1992
|
+
messageId: z2.string(),
|
|
1993
|
+
messageSeq: optionalNumberSchema,
|
|
1994
|
+
recentUnread: z2.array(agentApiMessageEnvelopeSchema).optional(),
|
|
1995
|
+
pendingMentionActions: z2.array(agentApiMessageEnvelopeSchema).optional()
|
|
1996
|
+
});
|
|
1997
|
+
var agentApiSendResponseSchema = z2.discriminatedUnion("state", [
|
|
1998
|
+
agentApiSendSentResponseSchema,
|
|
1999
|
+
agentApiHeldFreshnessResponseSchema
|
|
2000
|
+
]);
|
|
2001
|
+
var agentApiMessageResolveResponseSchema = passthroughObject({
|
|
2002
|
+
message: agentApiMessageEnvelopeSchema
|
|
2003
|
+
});
|
|
2004
|
+
var agentApiOkResponseSchema = passthroughObject({
|
|
2005
|
+
ok: z2.literal(true)
|
|
2006
|
+
});
|
|
2007
|
+
var agentApiTaskClaimResultSchema = passthroughObject({
|
|
2008
|
+
taskNumber: z2.number().int().positive().optional(),
|
|
2009
|
+
messageId: optionalStringSchema,
|
|
2010
|
+
success: z2.boolean(),
|
|
2011
|
+
reason: optionalStringSchema
|
|
2012
|
+
});
|
|
2013
|
+
var agentApiTaskClaimSuccessResponseSchema = passthroughObject({
|
|
2014
|
+
results: z2.array(agentApiTaskClaimResultSchema)
|
|
2015
|
+
});
|
|
2016
|
+
var agentApiTaskClaimResponseSchema = z2.union([
|
|
2017
|
+
agentApiTaskClaimSuccessResponseSchema,
|
|
2018
|
+
agentApiHeldFreshnessResponseSchema
|
|
2019
|
+
]);
|
|
2020
|
+
var agentApiTaskEnvelopeSchema = passthroughObject({
|
|
2021
|
+
taskNumber: z2.number().int().positive().optional(),
|
|
2022
|
+
status: z2.string().optional(),
|
|
2023
|
+
title: optionalStringSchema,
|
|
2024
|
+
claimedByName: z2.string().nullable().optional(),
|
|
2025
|
+
createdByName: z2.string().nullable().optional(),
|
|
2026
|
+
messageId: z2.string().nullable().optional(),
|
|
2027
|
+
isLegacy: optionalBooleanSchema
|
|
2028
|
+
});
|
|
2029
|
+
var agentApiTaskListResponseSchema = passthroughObject({
|
|
2030
|
+
tasks: z2.array(agentApiTaskEnvelopeSchema)
|
|
2031
|
+
});
|
|
2032
|
+
var agentApiCreatedTaskEnvelopeSchema = passthroughObject({
|
|
2033
|
+
taskNumber: z2.number().int().positive(),
|
|
2034
|
+
messageId: z2.string(),
|
|
2035
|
+
title: z2.string()
|
|
2036
|
+
});
|
|
2037
|
+
var agentApiTaskCreateResponseSchema = passthroughObject({
|
|
2038
|
+
tasks: z2.array(agentApiCreatedTaskEnvelopeSchema)
|
|
2039
|
+
});
|
|
2040
|
+
var agentApiTaskUnclaimResponseSchema = passthroughObject({
|
|
2041
|
+
ok: z2.literal(true)
|
|
2042
|
+
});
|
|
2043
|
+
var agentApiTaskUpdateStatusSuccessResponseSchema = passthroughObject({
|
|
2044
|
+
ok: z2.literal(true)
|
|
2045
|
+
});
|
|
2046
|
+
var agentApiTaskUpdateStatusResponseSchema = z2.union([
|
|
2047
|
+
agentApiTaskUpdateStatusSuccessResponseSchema,
|
|
2048
|
+
agentApiHeldFreshnessResponseSchema
|
|
2049
|
+
]);
|
|
2050
|
+
function route(input) {
|
|
2051
|
+
return {
|
|
2052
|
+
...input,
|
|
2053
|
+
fullPath: `${AGENT_API_BASE_PATH}${input.path}`
|
|
2054
|
+
};
|
|
2055
|
+
}
|
|
2056
|
+
var agentApiContract = {
|
|
2057
|
+
events: route({
|
|
2058
|
+
key: "events",
|
|
2059
|
+
method: "GET",
|
|
2060
|
+
path: "/events",
|
|
2061
|
+
client: { resource: "events", method: "get" },
|
|
2062
|
+
capability: "read",
|
|
2063
|
+
description: "Drain pending events for the bound agent credential.",
|
|
2064
|
+
request: { query: agentApiEventsQuerySchema },
|
|
2065
|
+
response: { body: agentApiEventsResponseSchema }
|
|
2066
|
+
}),
|
|
2067
|
+
historyRead: route({
|
|
2068
|
+
key: "historyRead",
|
|
2069
|
+
method: "GET",
|
|
2070
|
+
path: "/history",
|
|
2071
|
+
client: { resource: "history", method: "read" },
|
|
2072
|
+
capability: "read",
|
|
2073
|
+
description: "Read visible history for a channel, DM, or thread target.",
|
|
2074
|
+
request: { query: agentApiHistoryQuerySchema },
|
|
2075
|
+
response: { body: agentApiHistoryResponseSchema }
|
|
2076
|
+
}),
|
|
2077
|
+
messageSend: route({
|
|
2078
|
+
key: "messageSend",
|
|
2079
|
+
method: "POST",
|
|
2080
|
+
path: "/send",
|
|
2081
|
+
client: { resource: "messages", method: "send" },
|
|
2082
|
+
capability: "send",
|
|
2083
|
+
description: "Send a message as the bound agent credential.",
|
|
2084
|
+
request: { body: agentApiSendBodySchema },
|
|
2085
|
+
response: { body: agentApiSendResponseSchema }
|
|
2086
|
+
}),
|
|
2087
|
+
messageResolve: route({
|
|
2088
|
+
key: "messageResolve",
|
|
2089
|
+
method: "GET",
|
|
2090
|
+
path: "/messages/:msgId/resolve",
|
|
2091
|
+
client: { resource: "messages", method: "resolve" },
|
|
2092
|
+
capability: "read",
|
|
2093
|
+
description: "Resolve a message id exactly and return the canonical visible message.",
|
|
2094
|
+
request: { params: agentApiMessageResolveParamsSchema },
|
|
2095
|
+
response: { body: agentApiMessageResolveResponseSchema }
|
|
2096
|
+
}),
|
|
2097
|
+
messageReactionAdd: route({
|
|
2098
|
+
key: "messageReactionAdd",
|
|
2099
|
+
method: "POST",
|
|
2100
|
+
path: "/messages/:msgId/reactions",
|
|
2101
|
+
client: { resource: "messages", method: "addReaction" },
|
|
2102
|
+
capability: "reactions",
|
|
2103
|
+
description: "Add a reaction to a visible message as the bound agent credential.",
|
|
2104
|
+
request: { params: agentApiMessageReactionParamsSchema, body: agentApiMessageReactionBodySchema },
|
|
2105
|
+
response: { body: agentApiMessageEnvelopeSchema }
|
|
2106
|
+
}),
|
|
2107
|
+
messageReactionRemove: route({
|
|
2108
|
+
key: "messageReactionRemove",
|
|
2109
|
+
method: "DELETE",
|
|
2110
|
+
path: "/messages/:msgId/reactions",
|
|
2111
|
+
client: { resource: "messages", method: "removeReaction" },
|
|
2112
|
+
capability: "reactions",
|
|
2113
|
+
description: "Remove a reaction from a visible message as the bound agent credential.",
|
|
2114
|
+
request: { params: agentApiMessageReactionParamsSchema, body: agentApiMessageReactionBodySchema },
|
|
2115
|
+
response: { body: agentApiMessageEnvelopeSchema }
|
|
2116
|
+
}),
|
|
2117
|
+
channelJoin: route({
|
|
2118
|
+
key: "channelJoin",
|
|
2119
|
+
method: "POST",
|
|
2120
|
+
path: "/channels/:channelId/join",
|
|
2121
|
+
client: { resource: "channels", method: "join" },
|
|
2122
|
+
capability: "channels",
|
|
2123
|
+
description: "Join a visible public channel as the bound agent credential.",
|
|
2124
|
+
request: { params: agentApiChannelMembershipParamsSchema },
|
|
2125
|
+
response: { body: agentApiOkResponseSchema }
|
|
2126
|
+
}),
|
|
2127
|
+
channelLeave: route({
|
|
2128
|
+
key: "channelLeave",
|
|
2129
|
+
method: "POST",
|
|
2130
|
+
path: "/channels/:channelId/leave",
|
|
2131
|
+
client: { resource: "channels", method: "leave" },
|
|
2132
|
+
capability: "channels",
|
|
2133
|
+
description: "Leave a joined regular channel as the bound agent credential.",
|
|
2134
|
+
request: { params: agentApiChannelMembershipParamsSchema },
|
|
2135
|
+
response: { body: agentApiOkResponseSchema }
|
|
2136
|
+
}),
|
|
2137
|
+
serverInfo: route({
|
|
2138
|
+
key: "serverInfo",
|
|
2139
|
+
method: "GET",
|
|
2140
|
+
path: "/server",
|
|
2141
|
+
client: { resource: "server", method: "info" },
|
|
2142
|
+
capability: "server",
|
|
2143
|
+
description: "List channels, agents, humans, and runtime context visible to the bound agent.",
|
|
2144
|
+
request: {},
|
|
2145
|
+
response: { body: agentApiServerInfoResponseSchema }
|
|
2146
|
+
}),
|
|
2147
|
+
mentionActionsPending: route({
|
|
2148
|
+
key: "mentionActionsPending",
|
|
2149
|
+
method: "GET",
|
|
2150
|
+
path: "/mention-actions/pending",
|
|
2151
|
+
client: { resource: "mentions", method: "pendingActions" },
|
|
2152
|
+
capability: "mentions",
|
|
2153
|
+
description: "List sender-side pending mention actions for unresolved outsider mentions.",
|
|
2154
|
+
request: { query: agentApiMentionActionsPendingQuerySchema },
|
|
2155
|
+
response: { body: agentApiMentionActionsPendingResponseSchema }
|
|
2156
|
+
}),
|
|
2157
|
+
mentionActionsExecute: route({
|
|
2158
|
+
key: "mentionActionsExecute",
|
|
2159
|
+
method: "POST",
|
|
2160
|
+
path: "/mention-actions/execute",
|
|
2161
|
+
client: { resource: "mentions", method: "executeAction" },
|
|
2162
|
+
capability: "mentions",
|
|
2163
|
+
description: "Execute sender-side mention resolution actions.",
|
|
2164
|
+
request: { body: agentApiMentionActionsExecuteBodySchema },
|
|
2165
|
+
response: { body: agentApiMentionActionsExecuteResponseSchema }
|
|
2166
|
+
}),
|
|
2167
|
+
taskClaim: route({
|
|
2168
|
+
key: "taskClaim",
|
|
2169
|
+
method: "POST",
|
|
2170
|
+
path: "/tasks/claim",
|
|
2171
|
+
client: { resource: "tasks", method: "claim" },
|
|
2172
|
+
capability: "tasks",
|
|
2173
|
+
description: "Claim one or more tasks by task number or message id.",
|
|
2174
|
+
request: { body: agentApiTaskClaimBodySchema },
|
|
2175
|
+
response: { body: agentApiTaskClaimResponseSchema }
|
|
2176
|
+
}),
|
|
2177
|
+
taskList: route({
|
|
2178
|
+
key: "taskList",
|
|
2179
|
+
method: "GET",
|
|
2180
|
+
path: "/tasks",
|
|
2181
|
+
client: { resource: "tasks", method: "list" },
|
|
2182
|
+
capability: "tasks",
|
|
2183
|
+
description: "List tasks in a channel.",
|
|
2184
|
+
request: { query: agentApiTaskListQuerySchema },
|
|
2185
|
+
response: { body: agentApiTaskListResponseSchema }
|
|
2186
|
+
}),
|
|
2187
|
+
taskCreate: route({
|
|
2188
|
+
key: "taskCreate",
|
|
2189
|
+
method: "POST",
|
|
2190
|
+
path: "/tasks",
|
|
2191
|
+
client: { resource: "tasks", method: "create" },
|
|
2192
|
+
capability: "tasks",
|
|
2193
|
+
description: "Create one or more tasks in a channel.",
|
|
2194
|
+
request: { body: agentApiTaskCreateBodySchema },
|
|
2195
|
+
response: { body: agentApiTaskCreateResponseSchema }
|
|
2196
|
+
}),
|
|
2197
|
+
taskUnclaim: route({
|
|
2198
|
+
key: "taskUnclaim",
|
|
2199
|
+
method: "POST",
|
|
2200
|
+
path: "/tasks/unclaim",
|
|
2201
|
+
client: { resource: "tasks", method: "unclaim" },
|
|
2202
|
+
capability: "tasks",
|
|
2203
|
+
description: "Release a previously claimed task.",
|
|
2204
|
+
request: { body: agentApiTaskUnclaimBodySchema },
|
|
2205
|
+
response: { body: agentApiTaskUnclaimResponseSchema }
|
|
2206
|
+
}),
|
|
2207
|
+
taskUpdateStatus: route({
|
|
2208
|
+
key: "taskUpdateStatus",
|
|
2209
|
+
method: "POST",
|
|
2210
|
+
path: "/tasks/update-status",
|
|
2211
|
+
client: { resource: "tasks", method: "updateStatus" },
|
|
2212
|
+
capability: "tasks",
|
|
2213
|
+
description: "Update a task status.",
|
|
2214
|
+
request: { body: agentApiTaskUpdateStatusBodySchema },
|
|
2215
|
+
response: { body: agentApiTaskUpdateStatusResponseSchema }
|
|
2216
|
+
})
|
|
2217
|
+
};
|
|
2218
|
+
|
|
1140
2219
|
// ../shared/src/agentInbox.ts
|
|
1141
2220
|
function formatAgentInboxDelta(rows, options = {}) {
|
|
1142
2221
|
const totalPendingMessages = options.totalPendingMessages;
|
|
@@ -1150,17 +2229,21 @@ function formatAgentInboxDelta(rows, options = {}) {
|
|
|
1150
2229
|
function formatAgentInboxRowDetails(row) {
|
|
1151
2230
|
const parts = [`pending: ${row.pendingCount} message${row.pendingCount === 1 ? "" : "s"}`];
|
|
1152
2231
|
if (row.firstPendingMsgId) parts.push(`first msg=${shortMessageId(row.firstPendingMsgId)}`);
|
|
1153
|
-
if (row.latestSenderName) parts.push(`latest @${row.latestSenderName}`);
|
|
2232
|
+
if (row.latestSenderName) parts.push(`latest sender @${row.latestSenderName}`);
|
|
1154
2233
|
if (row.latestMsgId) parts.push(`latest msg=${shortMessageId(row.latestMsgId)}`);
|
|
1155
|
-
parts.push(...row.flags);
|
|
2234
|
+
parts.push(...row.flags.map(formatAgentInboxFlag));
|
|
1156
2235
|
return parts.join(" \xB7 ");
|
|
1157
2236
|
}
|
|
2237
|
+
function formatAgentInboxFlag(flag) {
|
|
2238
|
+
if (flag === "mention") return "you were mentioned";
|
|
2239
|
+
return flag;
|
|
2240
|
+
}
|
|
1158
2241
|
function shortMessageId(value) {
|
|
1159
2242
|
return value.slice(0, 8);
|
|
1160
2243
|
}
|
|
1161
2244
|
|
|
1162
2245
|
// ../shared/src/externalAgentIntegration.ts
|
|
1163
|
-
import { z as
|
|
2246
|
+
import { z as z3 } from "zod";
|
|
1164
2247
|
var EXTERNAL_AGENT_COMMS_PROTOCOL_VERSION = "agent-comms-core.v1";
|
|
1165
2248
|
var EXTERNAL_AGENT_PROOF_SCHEMA_VERSION = "agent-proof.v1";
|
|
1166
2249
|
var EXTERNAL_RUNTIME_INTEGRATION_MANIFEST_SCHEMA = "slock-external-runtime-integration.v1";
|
|
@@ -1204,35 +2287,35 @@ var externalAgentAdapterFailureValues = [
|
|
|
1204
2287
|
"auth_revoked"
|
|
1205
2288
|
];
|
|
1206
2289
|
var externalAgentServerApiModeValues = ["interim-agent-api-events", "agent-inbox-protocol"];
|
|
1207
|
-
var nonEmptyStringSchema =
|
|
1208
|
-
var isoTimestampSchema =
|
|
2290
|
+
var nonEmptyStringSchema = z3.string().min(1);
|
|
2291
|
+
var isoTimestampSchema = z3.string().refine((value) => !Number.isNaN(Date.parse(value)), {
|
|
1209
2292
|
message: "must be a parseable timestamp"
|
|
1210
2293
|
});
|
|
1211
|
-
var externalRuntimeIntegrationManifestSchema =
|
|
1212
|
-
schema:
|
|
2294
|
+
var externalRuntimeIntegrationManifestSchema = z3.object({
|
|
2295
|
+
schema: z3.literal(EXTERNAL_RUNTIME_INTEGRATION_MANIFEST_SCHEMA),
|
|
1213
2296
|
runtimeId: nonEmptyStringSchema,
|
|
1214
|
-
integrationPattern:
|
|
1215
|
-
commsMode:
|
|
1216
|
-
commsProtocolVersion:
|
|
1217
|
-
proofSchemaVersion:
|
|
2297
|
+
integrationPattern: z3.enum(externalAgentIntegrationPatternValues),
|
|
2298
|
+
commsMode: z3.enum(externalAgentCommsModeValues),
|
|
2299
|
+
commsProtocolVersion: z3.literal(EXTERNAL_AGENT_COMMS_PROTOCOL_VERSION),
|
|
2300
|
+
proofSchemaVersion: z3.literal(EXTERNAL_AGENT_PROOF_SCHEMA_VERSION),
|
|
1218
2301
|
minSlockCliVersion: nonEmptyStringSchema,
|
|
1219
|
-
multiplex:
|
|
1220
|
-
agentIsolation:
|
|
1221
|
-
bridgeLifecycle:
|
|
1222
|
-
explicitStartOnly:
|
|
1223
|
-
oneShotCommandsBridgeIndependent:
|
|
1224
|
-
requiresBridgeFailureCodes:
|
|
1225
|
-
autoStartDefault:
|
|
2302
|
+
multiplex: z3.boolean(),
|
|
2303
|
+
agentIsolation: z3.enum(externalAgentIsolationValues),
|
|
2304
|
+
bridgeLifecycle: z3.object({
|
|
2305
|
+
explicitStartOnly: z3.literal(true),
|
|
2306
|
+
oneShotCommandsBridgeIndependent: z3.literal(true),
|
|
2307
|
+
requiresBridgeFailureCodes: z3.array(z3.enum(["BRIDGE_NOT_RUNNING", "NO_CORE_SESSION"])).min(1),
|
|
2308
|
+
autoStartDefault: z3.literal(false)
|
|
1226
2309
|
}).strict(),
|
|
1227
|
-
serverApi:
|
|
1228
|
-
mode:
|
|
1229
|
-
deliveryOnly:
|
|
1230
|
-
cursorAuthority:
|
|
2310
|
+
serverApi: z3.object({
|
|
2311
|
+
mode: z3.enum(externalAgentServerApiModeValues),
|
|
2312
|
+
deliveryOnly: z3.boolean(),
|
|
2313
|
+
cursorAuthority: z3.literal("model_seen_only")
|
|
1231
2314
|
}).strict(),
|
|
1232
|
-
wakeAdapter:
|
|
1233
|
-
kind:
|
|
2315
|
+
wakeAdapter: z3.object({
|
|
2316
|
+
kind: z3.enum(externalAgentWakeAdapterKindValues),
|
|
1234
2317
|
protocol: nonEmptyStringSchema,
|
|
1235
|
-
requiresInteractiveSession:
|
|
2318
|
+
requiresInteractiveSession: z3.boolean().optional()
|
|
1236
2319
|
}).strict()
|
|
1237
2320
|
}).strict().superRefine((value, ctx) => {
|
|
1238
2321
|
if (!value.bridgeLifecycle.requiresBridgeFailureCodes.includes("BRIDGE_NOT_RUNNING")) {
|
|
@@ -1257,8 +2340,8 @@ var externalRuntimeIntegrationManifestSchema = z2.object({
|
|
|
1257
2340
|
});
|
|
1258
2341
|
}
|
|
1259
2342
|
});
|
|
1260
|
-
var externalAgentWakeEventBaseSchema =
|
|
1261
|
-
schema:
|
|
2343
|
+
var externalAgentWakeEventBaseSchema = z3.object({
|
|
2344
|
+
schema: z3.literal(EXTERNAL_AGENT_WAKE_EVENT_SCHEMA),
|
|
1262
2345
|
eventId: nonEmptyStringSchema,
|
|
1263
2346
|
attemptId: nonEmptyStringSchema,
|
|
1264
2347
|
messageId: nonEmptyStringSchema,
|
|
@@ -1268,30 +2351,30 @@ var externalAgentWakeEventBaseSchema = z2.object({
|
|
|
1268
2351
|
adapterInstance: nonEmptyStringSchema,
|
|
1269
2352
|
runtimeSession: nonEmptyStringSchema.nullable(),
|
|
1270
2353
|
occurredAt: isoTimestampSchema,
|
|
1271
|
-
lifecycleState:
|
|
1272
|
-
authority:
|
|
1273
|
-
source:
|
|
1274
|
-
provenance:
|
|
2354
|
+
lifecycleState: z3.enum(externalAgentCommsLifecycleStateValues),
|
|
2355
|
+
authority: z3.object({
|
|
2356
|
+
source: z3.enum(externalAgentLifecycleSourceValues),
|
|
2357
|
+
provenance: z3.enum(externalAgentLifecycleProvenanceValues)
|
|
1275
2358
|
}).strict()
|
|
1276
2359
|
}).strict();
|
|
1277
2360
|
var externalAgentProofEventEnvelopeSchema = externalAgentWakeEventBaseSchema.extend({
|
|
1278
|
-
kind:
|
|
1279
|
-
proofLevel:
|
|
1280
|
-
outcome:
|
|
1281
|
-
failureMeta:
|
|
1282
|
-
reason:
|
|
2361
|
+
kind: z3.literal("proof"),
|
|
2362
|
+
proofLevel: z3.enum(externalAgentWakeProofLevelValues),
|
|
2363
|
+
outcome: z3.literal("ok"),
|
|
2364
|
+
failureMeta: z3.undefined().optional(),
|
|
2365
|
+
reason: z3.string().optional()
|
|
1283
2366
|
});
|
|
1284
2367
|
var externalAgentFailedWakeEventEnvelopeSchema = externalAgentWakeEventBaseSchema.extend({
|
|
1285
|
-
kind:
|
|
1286
|
-
proofLevel:
|
|
1287
|
-
outcome:
|
|
1288
|
-
failureMeta:
|
|
1289
|
-
failureClass:
|
|
1290
|
-
retryAfterMs:
|
|
2368
|
+
kind: z3.literal("wake_attempt"),
|
|
2369
|
+
proofLevel: z3.undefined().optional(),
|
|
2370
|
+
outcome: z3.literal("failed"),
|
|
2371
|
+
failureMeta: z3.object({
|
|
2372
|
+
failureClass: z3.enum(externalAgentAdapterFailureValues),
|
|
2373
|
+
retryAfterMs: z3.number().int().positive().optional()
|
|
1291
2374
|
}).strict(),
|
|
1292
2375
|
reason: nonEmptyStringSchema
|
|
1293
2376
|
});
|
|
1294
|
-
var externalAgentWakeEventEnvelopeSchema =
|
|
2377
|
+
var externalAgentWakeEventEnvelopeSchema = z3.discriminatedUnion("kind", [
|
|
1295
2378
|
externalAgentProofEventEnvelopeSchema,
|
|
1296
2379
|
externalAgentFailedWakeEventEnvelopeSchema
|
|
1297
2380
|
]);
|
|
@@ -1379,9 +2462,30 @@ var SERVER_CAPABILITY_MATRIX = {
|
|
|
1379
2462
|
|
|
1380
2463
|
// ../shared/src/index.ts
|
|
1381
2464
|
var RUNTIME_CONFIG_VERSION = 1;
|
|
2465
|
+
var BUILTIN_RUNTIME_PROVIDER_ENV_KEYS = PI_BUILTIN_PROVIDER_API_KEY_ENV_KEYS_GENERATED;
|
|
2466
|
+
var BUILTIN_RUNTIME_PROVIDERS = Object.entries(BUILTIN_RUNTIME_PROVIDER_ENV_KEYS).map(([id, envKey]) => ({ id, envKey }));
|
|
1382
2467
|
var PI_BUILTIN_PROVIDER_ENV_KEYS = {
|
|
1383
|
-
deepseek:
|
|
2468
|
+
deepseek: BUILTIN_RUNTIME_PROVIDER_ENV_KEYS.deepseek
|
|
1384
2469
|
};
|
|
2470
|
+
var BUILTIN_RUNTIME_PROVIDER_BLOCKED_HOST_ENV_KEYS = Array.from(new Set(
|
|
2471
|
+
Object.values(PI_BUILTIN_PROVIDER_BLOCKED_HOST_ENV_KEYS_GENERATED).flat()
|
|
2472
|
+
));
|
|
2473
|
+
var BUILTIN_RUNTIME_GATEWAY_PROVIDERS = [
|
|
2474
|
+
{ id: "openai-compatible", envKey: "OPENAI_API_KEY", baseUrlEnvKey: "OPENAI_BASE_URL" },
|
|
2475
|
+
{ id: "anthropic-compatible", envKey: "ANTHROPIC_API_KEY", baseUrlEnvKey: "ANTHROPIC_BASE_URL" }
|
|
2476
|
+
];
|
|
2477
|
+
var BUILTIN_RUNTIME_GATEWAY_PROVIDER_ENV_KEYS = Object.fromEntries(BUILTIN_RUNTIME_GATEWAY_PROVIDERS.map((provider) => [provider.id, provider.envKey]));
|
|
2478
|
+
var BUILTIN_RUNTIME_GATEWAY_PROVIDER_BASE_URL_ENV_KEYS = Object.fromEntries(BUILTIN_RUNTIME_GATEWAY_PROVIDERS.map((provider) => [provider.id, provider.baseUrlEnvKey]));
|
|
2479
|
+
var BUILTIN_RUNTIME_CONTROLLED_ENV_KEYS = Array.from(/* @__PURE__ */ new Set([
|
|
2480
|
+
...Object.values(BUILTIN_RUNTIME_PROVIDER_ENV_KEYS),
|
|
2481
|
+
...Object.values(BUILTIN_RUNTIME_GATEWAY_PROVIDER_ENV_KEYS),
|
|
2482
|
+
...Object.values(BUILTIN_RUNTIME_GATEWAY_PROVIDER_BASE_URL_ENV_KEYS)
|
|
2483
|
+
]));
|
|
2484
|
+
var BUILTIN_RUNTIME_HOST_PROVIDER_ENV_SCRUB_KEYS = Array.from(/* @__PURE__ */ new Set([
|
|
2485
|
+
...BUILTIN_RUNTIME_CONTROLLED_ENV_KEYS,
|
|
2486
|
+
...BUILTIN_RUNTIME_PROVIDER_BLOCKED_HOST_ENV_KEYS
|
|
2487
|
+
]));
|
|
2488
|
+
var PI_BUILTIN_PROVIDER_MODELS = PI_BUILTIN_PROVIDER_MODELS_GENERATED;
|
|
1385
2489
|
var AGENT_ACTIVITIES = ["online", "thinking", "working", "error", "offline"];
|
|
1386
2490
|
var isAgentActivity = makeIsMember(AGENT_ACTIVITIES);
|
|
1387
2491
|
var VALID_ACTIVITIES = new Set(AGENT_ACTIVITIES);
|
|
@@ -1389,6 +2493,7 @@ var EXTERNAL_AGENT_RUNTIME_ID = "external";
|
|
|
1389
2493
|
var EXTERNAL_AGENT_RUNTIME_MODEL = "external";
|
|
1390
2494
|
var EXTERNAL_AGENT_RUNTIME_DISPLAY_NAME = "External agent";
|
|
1391
2495
|
var RUNTIMES = [
|
|
2496
|
+
{ id: "builtin", displayName: "Built-in", binary: "", supported: true },
|
|
1392
2497
|
{ id: "claude", displayName: "Claude Code", binary: "claude", supported: true },
|
|
1393
2498
|
{ id: "codex", displayName: "Codex CLI", binary: "codex", supported: true },
|
|
1394
2499
|
{ id: "antigravity", displayName: "Antigravity CLI", binary: "agy", supported: true },
|
|
@@ -1407,6 +2512,7 @@ var RUNTIME_MODELS = {
|
|
|
1407
2512
|
[EXTERNAL_AGENT_RUNTIME_ID]: [
|
|
1408
2513
|
{ id: EXTERNAL_AGENT_RUNTIME_MODEL, label: EXTERNAL_AGENT_RUNTIME_DISPLAY_NAME }
|
|
1409
2514
|
],
|
|
2515
|
+
builtin: Object.values(PI_BUILTIN_PROVIDER_MODELS).flat().map((model) => ({ id: model.id, label: model.label || formatRuntimeProviderModelLabel(model.id), verified: "launchable" })),
|
|
1410
2516
|
claude: [
|
|
1411
2517
|
{ id: "opus", label: "Claude Opus" },
|
|
1412
2518
|
{ id: "claude-opus-4-8", label: "Claude Opus 4.8" },
|
|
@@ -1486,18 +2592,79 @@ function getDefaultModel(runtimeId) {
|
|
|
1486
2592
|
return models?.[0]?.id ?? "sonnet";
|
|
1487
2593
|
}
|
|
1488
2594
|
var CONTROLLED_RUNTIME_ENV_KEYS = {
|
|
2595
|
+
// Built-in owns all provider credential/base-url env keys for its launch
|
|
2596
|
+
// plan. Scrub both keys we materialize and host provider keys Pi may read
|
|
2597
|
+
// directly, including defensive aliases such as ANTHROPIC_OAUTH_TOKEN.
|
|
2598
|
+
builtin: BUILTIN_RUNTIME_HOST_PROVIDER_ENV_SCRUB_KEYS,
|
|
1489
2599
|
claude: ["ANTHROPIC_BASE_URL", "ANTHROPIC_API_KEY", "ANTHROPIC_CUSTOM_MODEL_OPTION"],
|
|
1490
2600
|
// Pi-runtime builtin-provider env vars (e.g. DEEPSEEK_API_KEY). Owned by
|
|
1491
|
-
//
|
|
2601
|
+
// PiRuntimeProviderConfig.pi-builtin → buildLaunchPlan, not by
|
|
1492
2602
|
// user-supplied envVars: reading from PI_BUILTIN_PROVIDER_ENV_KEYS keeps
|
|
1493
2603
|
// this list in sync as new providers are added.
|
|
1494
2604
|
pi: Object.values(PI_BUILTIN_PROVIDER_ENV_KEYS)
|
|
1495
2605
|
};
|
|
1496
|
-
|
|
2606
|
+
var RUNTIME_CONFIG_FIELDS = [
|
|
2607
|
+
"version",
|
|
2608
|
+
"runtime",
|
|
2609
|
+
"provider",
|
|
2610
|
+
"model",
|
|
2611
|
+
"mode",
|
|
2612
|
+
"reasoningEffort",
|
|
2613
|
+
"envVars",
|
|
2614
|
+
"command",
|
|
2615
|
+
"hostUserState"
|
|
2616
|
+
];
|
|
2617
|
+
var MODEL_CONFIG_FIELDS = ["kind", "id", "name"];
|
|
2618
|
+
var MODE_CONFIG_FIELDS = ["kind"];
|
|
2619
|
+
var CLAUDE_DEFAULT_PROVIDER_FIELDS = ["kind"];
|
|
2620
|
+
var CLAUDE_CUSTOM_PROVIDER_FIELDS = ["kind", "apiUrl", "apiKey"];
|
|
2621
|
+
var PI_DEFAULT_PROVIDER_FIELDS = ["kind"];
|
|
2622
|
+
var PI_BUILTIN_PROVIDER_FIELDS = ["kind", "providerId", "apiKey"];
|
|
2623
|
+
var BUILTIN_PRESET_PROVIDER_FIELDS = ["kind", "providerId", "apiKey"];
|
|
2624
|
+
var BUILTIN_GATEWAY_PROVIDER_FIELDS = ["kind", "providerId", "baseUrl", "apiKey"];
|
|
2625
|
+
var UNKNOWN_PROVIDER_FIELDS = ["kind"];
|
|
2626
|
+
function isPlainRecord2(value) {
|
|
1497
2627
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
1498
2628
|
}
|
|
1499
|
-
function
|
|
1500
|
-
|
|
2629
|
+
function providerKnownFieldsFor(runtime, provider) {
|
|
2630
|
+
const kind = typeof provider.kind === "string" ? provider.kind : void 0;
|
|
2631
|
+
if (runtime === "builtin") {
|
|
2632
|
+
if (kind === "preset" || kind === "managed") return BUILTIN_PRESET_PROVIDER_FIELDS;
|
|
2633
|
+
if (kind === "gateway") return BUILTIN_GATEWAY_PROVIDER_FIELDS;
|
|
2634
|
+
}
|
|
2635
|
+
if (runtime === "claude") {
|
|
2636
|
+
if (kind === "default") return CLAUDE_DEFAULT_PROVIDER_FIELDS;
|
|
2637
|
+
if (kind === "custom") return CLAUDE_CUSTOM_PROVIDER_FIELDS;
|
|
2638
|
+
}
|
|
2639
|
+
if (runtime === "pi") {
|
|
2640
|
+
if (kind === "default") return PI_DEFAULT_PROVIDER_FIELDS;
|
|
2641
|
+
if (kind === "pi-builtin") return PI_BUILTIN_PROVIDER_FIELDS;
|
|
2642
|
+
}
|
|
2643
|
+
return UNKNOWN_PROVIDER_FIELDS;
|
|
2644
|
+
}
|
|
2645
|
+
function providerKind2(config) {
|
|
2646
|
+
return config.provider?.kind ?? "none";
|
|
2647
|
+
}
|
|
2648
|
+
function providerKeyPresent(config) {
|
|
2649
|
+
if (config.runtime === "builtin") return config.provider.apiKey.length > 0;
|
|
2650
|
+
if (config.runtime === "claude") return config.provider?.kind === "custom" && config.provider.apiKey.length > 0;
|
|
2651
|
+
if (config.runtime === "pi") return config.provider?.kind === "pi-builtin" && config.provider.apiKey.length > 0;
|
|
2652
|
+
return false;
|
|
2653
|
+
}
|
|
2654
|
+
function builtInSelectionTraceAttrs2(config) {
|
|
2655
|
+
if (config.runtime !== "builtin") return {};
|
|
2656
|
+
return {
|
|
2657
|
+
provider_id: config.provider.providerId,
|
|
2658
|
+
model_kind: config.model.kind,
|
|
2659
|
+
...config.model.kind === "preset" ? { model_id: config.model.id } : {},
|
|
2660
|
+
...config.provider.kind === "gateway" ? {
|
|
2661
|
+
base_url_present: true,
|
|
2662
|
+
base_url_host_class: classifyBuiltInGatewayBaseUrlHost2(config.provider.baseUrl)
|
|
2663
|
+
} : {}
|
|
2664
|
+
};
|
|
2665
|
+
}
|
|
2666
|
+
function normalizeEnvVars2(envVars) {
|
|
2667
|
+
if (!isPlainRecord2(envVars)) return null;
|
|
1501
2668
|
const normalized = {};
|
|
1502
2669
|
for (const [key, value] of Object.entries(envVars)) {
|
|
1503
2670
|
if (typeof key === "string" && typeof value === "string") {
|
|
@@ -1510,7 +2677,7 @@ function getControlledRuntimeEnvKeys(runtime) {
|
|
|
1510
2677
|
return CONTROLLED_RUNTIME_ENV_KEYS[runtime] ?? [];
|
|
1511
2678
|
}
|
|
1512
2679
|
function stripControlledRuntimeEnvVars(runtime, envVars) {
|
|
1513
|
-
const normalized =
|
|
2680
|
+
const normalized = normalizeEnvVars2(envVars);
|
|
1514
2681
|
if (!normalized) return null;
|
|
1515
2682
|
const controlled = new Set(getControlledRuntimeEnvKeys(runtime));
|
|
1516
2683
|
for (const key of controlled) {
|
|
@@ -1518,83 +2685,108 @@ function stripControlledRuntimeEnvVars(runtime, envVars) {
|
|
|
1518
2685
|
}
|
|
1519
2686
|
return Object.keys(normalized).length > 0 ? normalized : null;
|
|
1520
2687
|
}
|
|
1521
|
-
function
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
function parseProviderConfig(runtime, value, legacyApiUrl, legacyApiKey) {
|
|
1528
|
-
if (runtime === "claude") {
|
|
1529
|
-
if (!isPlainRecord(value)) return { kind: "default" };
|
|
1530
|
-
if (value.kind === "custom" && typeof value.apiUrl === "string" && value.apiUrl.trim() && typeof value.apiKey === "string" && value.apiKey.trim()) {
|
|
1531
|
-
return { kind: "custom", apiUrl: value.apiUrl.trim(), apiKey: value.apiKey.trim() };
|
|
1532
|
-
}
|
|
1533
|
-
if (value.kind === "custom" && legacyApiUrl?.trim() && legacyApiKey?.trim()) {
|
|
1534
|
-
return { kind: "custom", apiUrl: legacyApiUrl.trim(), apiKey: legacyApiKey.trim() };
|
|
1535
|
-
}
|
|
1536
|
-
return { kind: "default" };
|
|
2688
|
+
function classifyBuiltInGatewayBaseUrlHost2(baseUrl) {
|
|
2689
|
+
let hostname = "";
|
|
2690
|
+
try {
|
|
2691
|
+
hostname = new URL(baseUrl).hostname.toLowerCase();
|
|
2692
|
+
} catch {
|
|
2693
|
+
return "public";
|
|
1537
2694
|
}
|
|
1538
|
-
if (
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
2695
|
+
if (hostname === "localhost" || hostname === "::1" || hostname === "[::1]" || hostname.startsWith("127.")) return "localhost";
|
|
2696
|
+
const ipv4 = hostname.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
|
|
2697
|
+
if (ipv4) {
|
|
2698
|
+
const octets = ipv4.slice(1).map((part) => Number(part));
|
|
2699
|
+
const [a, b] = octets;
|
|
2700
|
+
if (a === 10 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168 || a === 169 && b === 254) return "private";
|
|
1544
2701
|
}
|
|
1545
|
-
|
|
2702
|
+
if (hostname === "0.0.0.0" || hostname === "::" || hostname.startsWith("fc") || hostname.startsWith("fd") || hostname.startsWith("fe80:")) {
|
|
2703
|
+
return "private";
|
|
2704
|
+
}
|
|
2705
|
+
return "public";
|
|
1546
2706
|
}
|
|
1547
|
-
function
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
2707
|
+
function composeRuntimeConfig(input) {
|
|
2708
|
+
const base = {
|
|
2709
|
+
version: RUNTIME_CONFIG_VERSION,
|
|
2710
|
+
model: input.model,
|
|
2711
|
+
mode: input.mode,
|
|
2712
|
+
reasoningEffort: input.reasoningEffort ?? null,
|
|
2713
|
+
envVars: input.envVars ?? null
|
|
2714
|
+
};
|
|
2715
|
+
if (input.runtime === "builtin") {
|
|
2716
|
+
return {
|
|
2717
|
+
...base,
|
|
2718
|
+
runtime: "builtin",
|
|
2719
|
+
provider: input.provider,
|
|
2720
|
+
hostUserState: "forbidden"
|
|
2721
|
+
};
|
|
1551
2722
|
}
|
|
1552
|
-
if (
|
|
1553
|
-
return {
|
|
2723
|
+
if (input.runtime === "claude") {
|
|
2724
|
+
return {
|
|
2725
|
+
...base,
|
|
2726
|
+
runtime: "claude",
|
|
2727
|
+
provider: input.provider,
|
|
2728
|
+
...input.command ? { command: input.command } : {}
|
|
2729
|
+
};
|
|
1554
2730
|
}
|
|
1555
|
-
if (
|
|
1556
|
-
return {
|
|
2731
|
+
if (input.runtime === "pi") {
|
|
2732
|
+
return {
|
|
2733
|
+
...base,
|
|
2734
|
+
runtime: "pi",
|
|
2735
|
+
provider: input.provider
|
|
2736
|
+
};
|
|
1557
2737
|
}
|
|
1558
|
-
return modelConfigFromLegacy(runtime, fallback);
|
|
1559
|
-
}
|
|
1560
|
-
function parseModeConfig(value) {
|
|
1561
|
-
if (!isPlainRecord(value)) return { kind: "default" };
|
|
1562
|
-
if (value.kind === "fast") return { kind: "fast" };
|
|
1563
|
-
return { kind: "default" };
|
|
1564
|
-
}
|
|
1565
|
-
function parseCommandConfig(runtime, value) {
|
|
1566
|
-
if (runtime !== "claude" || typeof value !== "string") return void 0;
|
|
1567
|
-
const command = value.trim();
|
|
1568
|
-
return command ? command : void 0;
|
|
1569
|
-
}
|
|
1570
|
-
function hydrateRuntimeConfig(input) {
|
|
1571
|
-
const stored = isPlainRecord(input.runtimeConfig) && input.runtimeConfig.version === RUNTIME_CONFIG_VERSION ? input.runtimeConfig : null;
|
|
1572
|
-
const runtime = typeof stored?.runtime === "string" && stored.runtime.trim() || typeof input.runtime === "string" && input.runtime.trim() || "claude";
|
|
1573
|
-
const fallbackModel = typeof input.model === "string" && input.model.trim() || getDefaultModel(runtime);
|
|
1574
|
-
const legacyEnvVars = normalizeEnvVars(input.envVars);
|
|
1575
|
-
const storedEnvVars = normalizeEnvVars(stored?.envVars);
|
|
1576
|
-
const legacyClaudeApiUrl = runtime === "claude" ? legacyEnvVars?.ANTHROPIC_BASE_URL : void 0;
|
|
1577
|
-
const legacyClaudeApiKey = runtime === "claude" ? legacyEnvVars?.ANTHROPIC_API_KEY : void 0;
|
|
1578
|
-
const legacyClaudeCustomModel = runtime === "claude" ? legacyEnvVars?.ANTHROPIC_CUSTOM_MODEL_OPTION : void 0;
|
|
1579
|
-
const provider = stored ? parseProviderConfig(runtime, stored.provider, legacyClaudeApiUrl, legacyClaudeApiKey) : runtime === "claude" && legacyClaudeApiUrl && legacyClaudeApiKey ? { kind: "custom", apiUrl: legacyClaudeApiUrl, apiKey: legacyClaudeApiKey } : runtime === "claude" ? { kind: "default" } : void 0;
|
|
1580
|
-
const command = stored ? parseCommandConfig(runtime, stored.command) : void 0;
|
|
1581
2738
|
return {
|
|
1582
|
-
|
|
1583
|
-
runtime
|
|
1584
|
-
...provider ? { provider } : {},
|
|
1585
|
-
model: stored ? parseModelConfig(runtime, stored.model, fallbackModel, provider, legacyClaudeCustomModel) : modelConfigFromLegacy(runtime, fallbackModel),
|
|
1586
|
-
mode: stored ? parseModeConfig(stored.mode) : { kind: "default" },
|
|
1587
|
-
reasoningEffort: stored?.reasoningEffort ?? input.reasoningEffort ?? null,
|
|
1588
|
-
envVars: stripControlledRuntimeEnvVars(runtime, stored ? storedEnvVars : legacyEnvVars),
|
|
1589
|
-
...command ? { command } : {}
|
|
2739
|
+
...base,
|
|
2740
|
+
runtime: input.runtime
|
|
1590
2741
|
};
|
|
1591
2742
|
}
|
|
2743
|
+
function hydrateRuntimeConfig(input) {
|
|
2744
|
+
return hydrateRuntimeConfigWithTrace(input).config;
|
|
2745
|
+
}
|
|
2746
|
+
function hydrateRuntimeConfigWithTrace(input) {
|
|
2747
|
+
return hydrateLegacyRuntimeConfigWithTrace(input, {
|
|
2748
|
+
runtimeConfigVersion: RUNTIME_CONFIG_VERSION,
|
|
2749
|
+
runtimeModels: RUNTIME_MODELS,
|
|
2750
|
+
runtimeConfigFields: RUNTIME_CONFIG_FIELDS,
|
|
2751
|
+
modelConfigFields: MODEL_CONFIG_FIELDS,
|
|
2752
|
+
modeConfigFields: MODE_CONFIG_FIELDS,
|
|
2753
|
+
getDefaultModel,
|
|
2754
|
+
builtinProviderEnvKeys: BUILTIN_RUNTIME_PROVIDER_ENV_KEYS,
|
|
2755
|
+
builtinGatewayProviderEnvKeys: BUILTIN_RUNTIME_GATEWAY_PROVIDER_ENV_KEYS,
|
|
2756
|
+
piBuiltinProviderEnvKeys: PI_BUILTIN_PROVIDER_ENV_KEYS,
|
|
2757
|
+
providerKnownFieldsFor,
|
|
2758
|
+
stripControlledRuntimeEnvVars,
|
|
2759
|
+
composeRuntimeConfig
|
|
2760
|
+
});
|
|
2761
|
+
}
|
|
1592
2762
|
function runtimeConfigModelValue(config) {
|
|
1593
2763
|
return config.model.kind === "custom" ? config.model.name : config.model.id;
|
|
1594
2764
|
}
|
|
1595
|
-
function
|
|
1596
|
-
|
|
2765
|
+
function runtimeConfigSource(config) {
|
|
2766
|
+
if (config.runtime === "builtin") return "agent_config";
|
|
2767
|
+
if (config.runtime === "claude") {
|
|
2768
|
+
return config.provider?.kind === "custom" ? "agent_config" : "host_claude_config";
|
|
2769
|
+
}
|
|
2770
|
+
if (config.runtime === "pi") {
|
|
2771
|
+
return config.provider?.kind === "pi-builtin" ? "agent_config" : "local_pi_config";
|
|
2772
|
+
}
|
|
2773
|
+
return config.provider ? "agent_config" : "host_runtime_config";
|
|
2774
|
+
}
|
|
2775
|
+
function buildLaunchPlan(config) {
|
|
2776
|
+
const normalized = config;
|
|
1597
2777
|
const generatedEnvVars = {};
|
|
2778
|
+
if (normalized.runtime === "builtin") {
|
|
2779
|
+
if (normalized.provider.kind === "preset") {
|
|
2780
|
+
const envKey = BUILTIN_RUNTIME_PROVIDER_ENV_KEYS[normalized.provider.providerId];
|
|
2781
|
+
if (envKey) generatedEnvVars[envKey] = normalized.provider.apiKey;
|
|
2782
|
+
}
|
|
2783
|
+
if (normalized.provider.kind === "gateway") {
|
|
2784
|
+
const apiKeyEnvKey = BUILTIN_RUNTIME_GATEWAY_PROVIDER_ENV_KEYS[normalized.provider.providerId];
|
|
2785
|
+
const baseUrlEnvKey = BUILTIN_RUNTIME_GATEWAY_PROVIDER_BASE_URL_ENV_KEYS[normalized.provider.providerId];
|
|
2786
|
+
if (apiKeyEnvKey) generatedEnvVars[apiKeyEnvKey] = normalized.provider.apiKey;
|
|
2787
|
+
if (baseUrlEnvKey) generatedEnvVars[baseUrlEnvKey] = normalized.provider.baseUrl;
|
|
2788
|
+
}
|
|
2789
|
+
}
|
|
1598
2790
|
if (normalized.runtime === "claude") {
|
|
1599
2791
|
if (normalized.provider?.kind === "custom") {
|
|
1600
2792
|
generatedEnvVars.ANTHROPIC_BASE_URL = normalized.provider.apiUrl;
|
|
@@ -1613,14 +2805,30 @@ function runtimeConfigToLaunchFields(config) {
|
|
|
1613
2805
|
...generatedEnvVars
|
|
1614
2806
|
};
|
|
1615
2807
|
return {
|
|
2808
|
+
// Compatibility output for launch paths only; persist/re-parse RuntimeConfig for decisions instead of inferring config semantics back from env vars.
|
|
1616
2809
|
runtime: normalized.runtime,
|
|
1617
2810
|
model: runtimeConfigModelValue(normalized),
|
|
1618
2811
|
mode: normalized.mode,
|
|
2812
|
+
configSource: runtimeConfigSource(normalized),
|
|
1619
2813
|
reasoningEffort: normalized.reasoningEffort ?? null,
|
|
1620
2814
|
envVars: Object.keys(envVars).length > 0 ? envVars : null,
|
|
1621
|
-
...normalized.command ? { command: normalized.command } : {}
|
|
2815
|
+
...normalized.command ? { command: normalized.command } : {},
|
|
2816
|
+
trace: {
|
|
2817
|
+
outcome: "materialized",
|
|
2818
|
+
runtime: normalized.runtime,
|
|
2819
|
+
provider_kind: providerKind2(normalized),
|
|
2820
|
+
...builtInSelectionTraceAttrs2(normalized),
|
|
2821
|
+
config_source: runtimeConfigSource(normalized),
|
|
2822
|
+
provider_key_present: providerKeyPresent(normalized),
|
|
2823
|
+
...providerKeyPresent(normalized) ? { provider_key_source: "runtime_config_plaintext" } : {},
|
|
2824
|
+
env_key_count: Object.keys(envVars).length
|
|
2825
|
+
}
|
|
1622
2826
|
};
|
|
1623
2827
|
}
|
|
2828
|
+
function runtimeConfigToLaunchFields(config) {
|
|
2829
|
+
const { trace: _, configSource: _configSource, ...launchFields } = buildLaunchPlan(config);
|
|
2830
|
+
return launchFields;
|
|
2831
|
+
}
|
|
1624
2832
|
var PRO_SEAT_MONTHLY_USD = 10;
|
|
1625
2833
|
var PRO_AGENT_SEAT_BLOCK_SIZE = 10;
|
|
1626
2834
|
var PRO_AGENT_SEAT_FRACTION = 1 / PRO_AGENT_SEAT_BLOCK_SIZE;
|
|
@@ -1650,6 +2858,13 @@ var PLAN_CONFIG = {
|
|
|
1650
2858
|
price: 0,
|
|
1651
2859
|
extraAgentPrice: 0
|
|
1652
2860
|
},
|
|
2861
|
+
partner: {
|
|
2862
|
+
displayName: "Partner",
|
|
2863
|
+
limits: { maxMachines: -1, maxAgents: -1, maxChannels: -1, messageHistoryDays: -1, includedAgents: -1 },
|
|
2864
|
+
comingSoon: false,
|
|
2865
|
+
price: 0,
|
|
2866
|
+
extraAgentPrice: 0
|
|
2867
|
+
},
|
|
1653
2868
|
pro: {
|
|
1654
2869
|
displayName: "Pro",
|
|
1655
2870
|
limits: { maxMachines: -1, maxAgents: PRO_PACK_AGENT_SEATS, maxChannels: -1, messageHistoryDays: -1, includedAgents: PRO_PACK_AGENT_SEATS },
|
|
@@ -2683,6 +3898,19 @@ function listLegacySlockStatePaths(slockHome = resolveSlockHome(), homeDir = os.
|
|
|
2683
3898
|
return candidates.filter((candidate) => existsSync(candidate.path));
|
|
2684
3899
|
}
|
|
2685
3900
|
|
|
3901
|
+
// src/authEnv.ts
|
|
3902
|
+
var DAEMON_API_KEY_ENV = "SLOCK_MACHINE_API_KEY";
|
|
3903
|
+
var SLOCK_AGENT_TOKEN_ENV = "SLOCK_AGENT_TOKEN";
|
|
3904
|
+
function scrubDaemonAuthEnv(env) {
|
|
3905
|
+
delete env[DAEMON_API_KEY_ENV];
|
|
3906
|
+
return env;
|
|
3907
|
+
}
|
|
3908
|
+
function scrubDaemonChildEnv(env) {
|
|
3909
|
+
delete env[DAEMON_API_KEY_ENV];
|
|
3910
|
+
delete env[SLOCK_AGENT_TOKEN_ENV];
|
|
3911
|
+
return env;
|
|
3912
|
+
}
|
|
3913
|
+
|
|
2686
3914
|
// src/agentCredentialProxy.ts
|
|
2687
3915
|
import { randomBytes } from "crypto";
|
|
2688
3916
|
import http from "http";
|
|
@@ -2871,7 +4099,7 @@ function reduceApmGatedReviewBoundaryFlush(_state, input) {
|
|
|
2871
4099
|
}
|
|
2872
4100
|
function reduceApmGatedTurnEnd(_state, input = {}) {
|
|
2873
4101
|
const shouldDeliverQueuedMessages = Boolean(
|
|
2874
|
-
input.inboxLength && input.inboxLength > 0 && input.supportsStdinNotification && input.hasSession
|
|
4102
|
+
input.inboxLength && input.inboxLength > 0 && input.supportsStdinNotification && (input.hasSession || input.canDeliverWithoutSession)
|
|
2875
4103
|
);
|
|
2876
4104
|
return {
|
|
2877
4105
|
nextState: {
|
|
@@ -3475,6 +4703,7 @@ function heldPlan(input, held, trace) {
|
|
|
3475
4703
|
localResponse: projectApmHeldFreshnessEnvelope({
|
|
3476
4704
|
producerFactId,
|
|
3477
4705
|
action: input.action,
|
|
4706
|
+
decision: held.decision.decision,
|
|
3478
4707
|
heldMessages: held.context.heldMessages,
|
|
3479
4708
|
newMessageCount: held.context.newMessageCount,
|
|
3480
4709
|
omittedMessageCount: held.context.omittedMessageCount,
|
|
@@ -3598,7 +4827,7 @@ function projectBucket(target, messages) {
|
|
|
3598
4827
|
if (message.channel_type === "thread") flags.add("thread");
|
|
3599
4828
|
if (message.channel_type === "dm") flags.add("dm");
|
|
3600
4829
|
if (message.task_number || message.task_status) flags.add("task");
|
|
3601
|
-
if (message.
|
|
4830
|
+
if (message.mentioned === true) flags.add("mention");
|
|
3602
4831
|
}
|
|
3603
4832
|
return stripUndefined({
|
|
3604
4833
|
target,
|
|
@@ -4250,7 +5479,9 @@ var LOOPBACK_NO_PROXY = "127.0.0.1,localhost";
|
|
|
4250
5479
|
var CLI_TRANSPORT_TRACE_DIR_ENV = "SLOCK_CLI_TRANSPORT_TRACE_DIR";
|
|
4251
5480
|
var safePathPart = (value) => value.replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
4252
5481
|
var RAW_CREDENTIAL_ENV_DENYLIST = [
|
|
4253
|
-
"
|
|
5482
|
+
"SLOCK_AGENT_TOKEN",
|
|
5483
|
+
"SLOCK_AGENT_CREDENTIAL_KEY",
|
|
5484
|
+
"SLOCK_AGENT_CREDENTIAL_KEY_FILE"
|
|
4254
5485
|
];
|
|
4255
5486
|
var WORKSPACE_CLI_TRANSPORT_FILENAMES = [
|
|
4256
5487
|
"agent-token",
|
|
@@ -4335,7 +5566,7 @@ function cleanupWorkspaceCliTransportFiles(workingDirectory) {
|
|
|
4335
5566
|
rmSync(path2.join(legacySlockDir, filename), { force: true });
|
|
4336
5567
|
}
|
|
4337
5568
|
}
|
|
4338
|
-
function writeOpencliWrapper(slockDir, opencliBinPath, platform = process.platform) {
|
|
5569
|
+
function writeOpencliWrapper(slockDir, opencliBinPath, platform = process.platform, execIsElectron = Boolean(process.versions.electron)) {
|
|
4339
5570
|
const fallbacks = deriveOpencliFallbackCandidates(opencliBinPath);
|
|
4340
5571
|
let binPath = opencliBinPath;
|
|
4341
5572
|
if (!existsSync2(binPath)) {
|
|
@@ -4351,7 +5582,7 @@ fi
|
|
|
4351
5582
|
path2.join(slockDir, "opencli"),
|
|
4352
5583
|
`#!/usr/bin/env bash
|
|
4353
5584
|
OPENCLI_BIN=${shellSingleQuote(binPath)}
|
|
4354
|
-
${posixFallbackBlock}exec ${shellSingleQuote(process.execPath)} "$OPENCLI_BIN" "$@"
|
|
5585
|
+
${posixFallbackBlock}${execIsElectron ? "export ELECTRON_RUN_AS_NODE=1\n" : ""}exec ${shellSingleQuote(process.execPath)} "$OPENCLI_BIN" "$@"
|
|
4355
5586
|
`,
|
|
4356
5587
|
{ mode: 493 }
|
|
4357
5588
|
);
|
|
@@ -4365,6 +5596,7 @@ ${posixFallbackBlock}exec ${shellSingleQuote(process.execPath)} "$OPENCLI_BIN" "
|
|
|
4365
5596
|
"chcp 65001 >NUL 2>NUL",
|
|
4366
5597
|
`set "OPENCLI_BIN=${binPath}"`,
|
|
4367
5598
|
...fallbacks.map((candidate) => `if not exist "%OPENCLI_BIN%" set "OPENCLI_BIN=${candidate}"`),
|
|
5599
|
+
...execIsElectron ? [`set "ELECTRON_RUN_AS_NODE=1"`] : [],
|
|
4368
5600
|
`"${process.execPath}" "%OPENCLI_BIN%" %*`,
|
|
4369
5601
|
""
|
|
4370
5602
|
].join("\r\n") + "\r\n";
|
|
@@ -4446,7 +5678,7 @@ function runtimeContextEnv(config) {
|
|
|
4446
5678
|
function buildCliTransportSystemPrompt(config, opts) {
|
|
4447
5679
|
return buildCliSystemPrompt(config, opts);
|
|
4448
5680
|
}
|
|
4449
|
-
async function prepareCliTransport(ctx, extraEnv = {}, platform = process.platform) {
|
|
5681
|
+
async function prepareCliTransport(ctx, extraEnv = {}, platform = process.platform, execIsElectron = Boolean(process.versions.electron)) {
|
|
4450
5682
|
if (!ctx.slockCliPath) {
|
|
4451
5683
|
throw new Error(`${ctx.config.runtime} driver: slockCliPath is required (daemon must inject it)`);
|
|
4452
5684
|
}
|
|
@@ -4503,7 +5735,7 @@ fi
|
|
|
4503
5735
|
const posixBody = `#!/usr/bin/env bash
|
|
4504
5736
|
${posixLoopbackNoProxyPrelude()}
|
|
4505
5737
|
SLOCK_CLI=${shellSingleQuote(cliPath)}
|
|
4506
|
-
${posixCliFallbackBlock}${posixCredentialPrefix}exec ${shellSingleQuote(process.execPath)} "$SLOCK_CLI" "$@"
|
|
5738
|
+
${posixCliFallbackBlock}${execIsElectron ? "export ELECTRON_RUN_AS_NODE=1\n" : ""}${posixCredentialPrefix}exec ${shellSingleQuote(process.execPath)} "$SLOCK_CLI" "$@"
|
|
4507
5739
|
`;
|
|
4508
5740
|
writeFileSync(posixWrapper, posixBody, { mode: 493 });
|
|
4509
5741
|
writeFileSync(posixRaftWrapper, posixBody, { mode: 493 });
|
|
@@ -4530,6 +5762,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
|
|
|
4530
5762
|
cmdCredentialLine.trimEnd(),
|
|
4531
5763
|
`set "SLOCK_CLI=${cliPath}"`,
|
|
4532
5764
|
...cmdCliFallbackLines,
|
|
5765
|
+
...execIsElectron ? [`set "ELECTRON_RUN_AS_NODE=1"`] : [],
|
|
4533
5766
|
`"${process.execPath}" "%SLOCK_CLI%" %*`,
|
|
4534
5767
|
""
|
|
4535
5768
|
].filter((line) => line.length > 0).join("\r\n") + "\r\n";
|
|
@@ -4562,6 +5795,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
|
|
|
4562
5795
|
"$env:LC_ALL = 'C.UTF-8'",
|
|
4563
5796
|
...powershellLoopbackNoProxyLines(),
|
|
4564
5797
|
...psCredentialLines,
|
|
5798
|
+
...execIsElectron ? ["$env:ELECTRON_RUN_AS_NODE = '1'"] : [],
|
|
4565
5799
|
`$node = ${powershellSingleQuote(process.execPath)}`,
|
|
4566
5800
|
`$cli = ${powershellSingleQuote(cliPath)}`,
|
|
4567
5801
|
...cliPath === "__cli" || cliFallbackCandidates.length === 0 ? [] : [
|
|
@@ -4584,10 +5818,10 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
|
|
|
4584
5818
|
}
|
|
4585
5819
|
const opencliBinPath = resolveOpencliBinPath();
|
|
4586
5820
|
if (opencliBinPath) {
|
|
4587
|
-
writeOpencliWrapper(slockDir, opencliBinPath, platform);
|
|
5821
|
+
writeOpencliWrapper(slockDir, opencliBinPath, platform, execIsElectron);
|
|
4588
5822
|
}
|
|
4589
5823
|
const wrapperPath = platform === "win32" ? path2.join(slockDir, "slock.cmd") : posixWrapper;
|
|
4590
|
-
const launchRuntimeFields = runtimeConfigToLaunchFields(ctx.config);
|
|
5824
|
+
const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(ctx.config));
|
|
4591
5825
|
const spawnEnv = {
|
|
4592
5826
|
...process.env,
|
|
4593
5827
|
FORCE_COLOR: "0",
|
|
@@ -4602,7 +5836,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
|
|
|
4602
5836
|
SLOCK_SERVER_URL: ctx.config.serverUrl,
|
|
4603
5837
|
PATH: `${slockDir}${path2.delimiter}${process.env.PATH ?? ""}`
|
|
4604
5838
|
};
|
|
4605
|
-
|
|
5839
|
+
scrubDaemonChildEnv(spawnEnv);
|
|
4606
5840
|
for (const key of RAW_CREDENTIAL_ENV_DENYLIST) {
|
|
4607
5841
|
delete spawnEnv[key];
|
|
4608
5842
|
}
|
|
@@ -4914,7 +6148,7 @@ var CLAUDE_CUSTOM_PROVIDER_HOST_ENV_KEYS = [
|
|
|
4914
6148
|
"CLAUDE_CODE_USE_CCR_V2"
|
|
4915
6149
|
];
|
|
4916
6150
|
function isClaudeCustomProviderConfig(config) {
|
|
4917
|
-
const launchRuntimeFields = runtimeConfigToLaunchFields(config);
|
|
6151
|
+
const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(config));
|
|
4918
6152
|
return launchRuntimeFields.runtime === "claude" && Boolean(launchRuntimeFields.envVars?.ANTHROPIC_BASE_URL) && Boolean(launchRuntimeFields.envVars?.ANTHROPIC_API_KEY);
|
|
4919
6153
|
}
|
|
4920
6154
|
function clearInheritedClaudeProviderEnv(explicitEnv) {
|
|
@@ -4956,7 +6190,7 @@ function buildClaudeProviderIsolationEnv(ctx) {
|
|
|
4956
6190
|
if (!isClaudeCustomProviderConfig(ctx.config)) {
|
|
4957
6191
|
return {};
|
|
4958
6192
|
}
|
|
4959
|
-
const launchRuntimeFields = runtimeConfigToLaunchFields(ctx.config);
|
|
6193
|
+
const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(ctx.config));
|
|
4960
6194
|
return {
|
|
4961
6195
|
...clearInheritedClaudeProviderEnv(launchRuntimeFields.envVars)
|
|
4962
6196
|
};
|
|
@@ -5124,7 +6358,7 @@ function requiresWindowsShell(command, platform = process.platform) {
|
|
|
5124
6358
|
}
|
|
5125
6359
|
function resolveCommandOnPath(command, deps = {}) {
|
|
5126
6360
|
const platform = deps.platform ?? process.platform;
|
|
5127
|
-
const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
|
|
6361
|
+
const env = scrubDaemonChildEnv({ ...withWindowsUserEnvironment(deps.env ?? process.env, deps) });
|
|
5128
6362
|
const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
|
|
5129
6363
|
const existsSyncFn = deps.existsSyncFn ?? existsSync3;
|
|
5130
6364
|
if (platform === "win32") {
|
|
@@ -5150,7 +6384,7 @@ function firstExistingPath(candidates, deps = {}) {
|
|
|
5150
6384
|
return null;
|
|
5151
6385
|
}
|
|
5152
6386
|
function readCommandVersion(command, args = [], deps = {}) {
|
|
5153
|
-
const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
|
|
6387
|
+
const env = scrubDaemonChildEnv({ ...withWindowsUserEnvironment(deps.env ?? process.env, deps) });
|
|
5154
6388
|
const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
|
|
5155
6389
|
try {
|
|
5156
6390
|
const output = normalizeExecOutput(execFileSyncFn(command, [...args, "--version"], {
|
|
@@ -5190,7 +6424,7 @@ function resolveClaudeCommand(deps = {}) {
|
|
|
5190
6424
|
], deps);
|
|
5191
6425
|
}
|
|
5192
6426
|
function resolveClaudeLaunchCommand(config, deps = {}) {
|
|
5193
|
-
const launchRuntimeFields = runtimeConfigToLaunchFields(config);
|
|
6427
|
+
const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(config));
|
|
5194
6428
|
return launchRuntimeFields.command?.trim() || resolveClaudeCommand(deps);
|
|
5195
6429
|
}
|
|
5196
6430
|
function probeClaude(deps = {}) {
|
|
@@ -5202,7 +6436,7 @@ function probeClaude(deps = {}) {
|
|
|
5202
6436
|
};
|
|
5203
6437
|
}
|
|
5204
6438
|
function buildClaudeArgs(config, opts) {
|
|
5205
|
-
const launchRuntimeFields = runtimeConfigToLaunchFields(config);
|
|
6439
|
+
const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(config));
|
|
5206
6440
|
const args = [
|
|
5207
6441
|
"--allow-dangerously-skip-permissions",
|
|
5208
6442
|
"--dangerously-skip-permissions",
|
|
@@ -5275,6 +6509,10 @@ var ClaudeDriver = class {
|
|
|
5275
6509
|
// arbitrary busy instant can collide with active signed thinking blocks. The
|
|
5276
6510
|
// daemon therefore gates busy delivery on Claude stream-json boundaries.
|
|
5277
6511
|
busyDeliveryMode = "gated";
|
|
6512
|
+
// Claude can report a new session id before the conversation is resumable.
|
|
6513
|
+
// Treat fresh session ids as delivery-ready only after the producing turn
|
|
6514
|
+
// reaches a boundary; existing --resume sessions are ready at launch.
|
|
6515
|
+
liveSessionReadyAt = "turn_end";
|
|
5278
6516
|
supportsNativeStandingPrompt = true;
|
|
5279
6517
|
eventNormalizer = new ClaudeEventNormalizer();
|
|
5280
6518
|
probe() {
|
|
@@ -5369,14 +6607,14 @@ function resolveCodexHomeRootFromEnv(env = process.env, opts = {}) {
|
|
|
5369
6607
|
return path6.join(opts.defaultHomeDir ?? os2.homedir(), ".codex");
|
|
5370
6608
|
}
|
|
5371
6609
|
function hasConfiguredCodexHome(config, baseEnv = process.env) {
|
|
5372
|
-
const launchRuntimeFields = config ? runtimeConfigToLaunchFields(config) : null;
|
|
6610
|
+
const launchRuntimeFields = config ? runtimeConfigToLaunchFields(hydrateRuntimeConfig(config)) : null;
|
|
5373
6611
|
return Boolean(readConfiguredCodexHome({
|
|
5374
6612
|
...baseEnv,
|
|
5375
6613
|
...launchRuntimeFields?.envVars || {}
|
|
5376
6614
|
}));
|
|
5377
6615
|
}
|
|
5378
6616
|
function resolveCodexHomeRootFromConfig(config, defaultHomeDir, cwd, baseEnv = process.env, _opts = {}) {
|
|
5379
|
-
const launchRuntimeFields = runtimeConfigToLaunchFields(config);
|
|
6617
|
+
const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(config));
|
|
5380
6618
|
const env = {
|
|
5381
6619
|
...baseEnv,
|
|
5382
6620
|
...launchRuntimeFields.envVars || {}
|
|
@@ -6288,7 +7526,7 @@ var CodexDriver = class {
|
|
|
6288
7526
|
// the daemon. They replace the previous transcript-mtime heuristic.
|
|
6289
7527
|
experimentalRawEvents: true
|
|
6290
7528
|
};
|
|
6291
|
-
const launchRuntimeFields = runtimeConfigToLaunchFields(ctx.config);
|
|
7529
|
+
const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(ctx.config));
|
|
6292
7530
|
if (launchRuntimeFields.model) {
|
|
6293
7531
|
threadParams.model = launchRuntimeFields.model;
|
|
6294
7532
|
}
|
|
@@ -6829,7 +8067,7 @@ function buildAntigravityArgs(ctx) {
|
|
|
6829
8067
|
const args = [
|
|
6830
8068
|
"--print",
|
|
6831
8069
|
"--print-timeout",
|
|
6832
|
-
runtimeConfigToLaunchFields(ctx.config).envVars?.ANTIGRAVITY_PRINT_TIMEOUT || DEFAULT_PRINT_TIMEOUT,
|
|
8070
|
+
runtimeConfigToLaunchFields(hydrateRuntimeConfig(ctx.config)).envVars?.ANTIGRAVITY_PRINT_TIMEOUT || DEFAULT_PRINT_TIMEOUT,
|
|
6833
8071
|
"--dangerously-skip-permissions"
|
|
6834
8072
|
];
|
|
6835
8073
|
if (ctx.config.sessionId) {
|
|
@@ -6972,7 +8210,7 @@ var CopilotDriver = class {
|
|
|
6972
8210
|
"-p",
|
|
6973
8211
|
ctx.prompt
|
|
6974
8212
|
];
|
|
6975
|
-
const launchRuntimeFields = runtimeConfigToLaunchFields(ctx.config);
|
|
8213
|
+
const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(ctx.config));
|
|
6976
8214
|
if (launchRuntimeFields.model && launchRuntimeFields.model !== "default") {
|
|
6977
8215
|
args.push("--model", launchRuntimeFields.model);
|
|
6978
8216
|
}
|
|
@@ -7110,7 +8348,7 @@ var CursorDriver = class {
|
|
|
7110
8348
|
"--approve-mcps",
|
|
7111
8349
|
"--trust"
|
|
7112
8350
|
];
|
|
7113
|
-
const launchRuntimeFields = runtimeConfigToLaunchFields(ctx.config);
|
|
8351
|
+
const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(ctx.config));
|
|
7114
8352
|
if (launchRuntimeFields.model && launchRuntimeFields.model !== "default") {
|
|
7115
8353
|
args.push("--model", launchRuntimeFields.model);
|
|
7116
8354
|
}
|
|
@@ -7230,11 +8468,11 @@ function detectCursorModels(runCommand = runCursorModelsCommand) {
|
|
|
7230
8468
|
return parseCursorModelsOutput(String(result.stdout || ""));
|
|
7231
8469
|
}
|
|
7232
8470
|
function buildCursorModelProbeEnv(deps = {}) {
|
|
7233
|
-
return withWindowsUserEnvironment({
|
|
8471
|
+
return scrubDaemonChildEnv(withWindowsUserEnvironment({
|
|
7234
8472
|
...deps.env ?? process.env,
|
|
7235
8473
|
FORCE_COLOR: "0",
|
|
7236
8474
|
NO_COLOR: "1"
|
|
7237
|
-
}, deps);
|
|
8475
|
+
}, deps));
|
|
7238
8476
|
}
|
|
7239
8477
|
function runCursorModelsCommand() {
|
|
7240
8478
|
return spawnSync("cursor-agent", ["models"], {
|
|
@@ -7250,7 +8488,7 @@ import { existsSync as existsSync5 } from "fs";
|
|
|
7250
8488
|
import path8 from "path";
|
|
7251
8489
|
async function buildGeminiSpawnEnv(ctx, platform = process.platform) {
|
|
7252
8490
|
const { spawnEnv } = await prepareCliTransport(ctx, { NO_COLOR: "1" }, platform);
|
|
7253
|
-
const launchEnvVars = runtimeConfigToLaunchFields(ctx.config).envVars;
|
|
8491
|
+
const launchEnvVars = runtimeConfigToLaunchFields(hydrateRuntimeConfig(ctx.config)).envVars;
|
|
7254
8492
|
if (!Object.prototype.hasOwnProperty.call(launchEnvVars ?? {}, "GEMINI_CLI_TRUST_WORKSPACE")) {
|
|
7255
8493
|
spawnEnv.GEMINI_CLI_TRUST_WORKSPACE = "true";
|
|
7256
8494
|
}
|
|
@@ -7274,7 +8512,7 @@ function buildGeminiArgs(config) {
|
|
|
7274
8512
|
"-p",
|
|
7275
8513
|
""
|
|
7276
8514
|
];
|
|
7277
|
-
const launchRuntimeFields = runtimeConfigToLaunchFields(config);
|
|
8515
|
+
const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(config));
|
|
7278
8516
|
if (launchRuntimeFields.model && launchRuntimeFields.model !== "default") {
|
|
7279
8517
|
args.push("--model", launchRuntimeFields.model);
|
|
7280
8518
|
}
|
|
@@ -7290,7 +8528,7 @@ function resolveGeminiSpawn(commandArgs, deps = {}) {
|
|
|
7290
8528
|
}
|
|
7291
8529
|
const execFileSyncFn = deps.execFileSyncFn ?? execFileSync3;
|
|
7292
8530
|
const existsSyncFn = deps.existsSyncFn ?? existsSync5;
|
|
7293
|
-
const env = deps.env ?? process.env;
|
|
8531
|
+
const env = scrubDaemonChildEnv({ ...deps.env ?? process.env });
|
|
7294
8532
|
const winPath = path8.win32;
|
|
7295
8533
|
let geminiEntry = null;
|
|
7296
8534
|
try {
|
|
@@ -7427,12 +8665,15 @@ var GeminiDriver = class {
|
|
|
7427
8665
|
// src/drivers/kimi.ts
|
|
7428
8666
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
7429
8667
|
import { spawn as spawn7 } from "child_process";
|
|
7430
|
-
import { existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
8668
|
+
import { chmodSync, existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
7431
8669
|
import os4 from "os";
|
|
7432
8670
|
import path9 from "path";
|
|
7433
8671
|
var KIMI_WIRE_PROTOCOL_VERSION = "1.3";
|
|
7434
8672
|
var KIMI_SYSTEM_PROMPT_FILE = ".slock-kimi-system.md";
|
|
7435
8673
|
var KIMI_AGENT_FILE = ".slock-kimi-agent.yaml";
|
|
8674
|
+
var KIMI_GENERATED_CONFIG_FILE = ".slock-kimi-config.toml";
|
|
8675
|
+
var SLOCK_KIMI_CONFIG_CONTENT_ENV = "SLOCK_KIMI_CONFIG_CONTENT";
|
|
8676
|
+
var SLOCK_KIMI_CONFIG_FILE_ENV = "SLOCK_KIMI_CONFIG_FILE";
|
|
7436
8677
|
function parseToolArguments(raw) {
|
|
7437
8678
|
if (typeof raw !== "string") return raw;
|
|
7438
8679
|
try {
|
|
@@ -7441,6 +8682,73 @@ function parseToolArguments(raw) {
|
|
|
7441
8682
|
return raw;
|
|
7442
8683
|
}
|
|
7443
8684
|
}
|
|
8685
|
+
function readKimiConfigSource(home = os4.homedir(), env = process.env) {
|
|
8686
|
+
const inlineConfig = env[SLOCK_KIMI_CONFIG_CONTENT_ENV];
|
|
8687
|
+
if (inlineConfig && inlineConfig.trim()) {
|
|
8688
|
+
return {
|
|
8689
|
+
raw: inlineConfig,
|
|
8690
|
+
explicitPath: null,
|
|
8691
|
+
sourcePath: SLOCK_KIMI_CONFIG_CONTENT_ENV
|
|
8692
|
+
};
|
|
8693
|
+
}
|
|
8694
|
+
const explicitPath = env[SLOCK_KIMI_CONFIG_FILE_ENV];
|
|
8695
|
+
const configPath = explicitPath && explicitPath.trim() ? explicitPath : path9.join(home, ".kimi", "config.toml");
|
|
8696
|
+
try {
|
|
8697
|
+
return {
|
|
8698
|
+
raw: readFileSync3(configPath, "utf8"),
|
|
8699
|
+
explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
|
|
8700
|
+
sourcePath: configPath
|
|
8701
|
+
};
|
|
8702
|
+
} catch {
|
|
8703
|
+
return {
|
|
8704
|
+
raw: null,
|
|
8705
|
+
explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
|
|
8706
|
+
sourcePath: configPath
|
|
8707
|
+
};
|
|
8708
|
+
}
|
|
8709
|
+
}
|
|
8710
|
+
function buildKimiSpawnEnv(env = process.env) {
|
|
8711
|
+
const spawnEnv = { ...env, FORCE_COLOR: "0", NO_COLOR: "1" };
|
|
8712
|
+
delete spawnEnv[SLOCK_KIMI_CONFIG_CONTENT_ENV];
|
|
8713
|
+
delete spawnEnv[SLOCK_KIMI_CONFIG_FILE_ENV];
|
|
8714
|
+
return scrubDaemonChildEnv(spawnEnv);
|
|
8715
|
+
}
|
|
8716
|
+
function buildKimiEffectiveEnv(ctx, overrideEnv) {
|
|
8717
|
+
return {
|
|
8718
|
+
...process.env,
|
|
8719
|
+
...ctx.config.envVars || {},
|
|
8720
|
+
...overrideEnv || {}
|
|
8721
|
+
};
|
|
8722
|
+
}
|
|
8723
|
+
function buildKimiLaunchOptions(ctx, opts = {}) {
|
|
8724
|
+
const env = buildKimiEffectiveEnv(ctx, opts.env);
|
|
8725
|
+
const source = readKimiConfigSource(opts.home ?? os4.homedir(), env);
|
|
8726
|
+
const args = [];
|
|
8727
|
+
let configFilePath = null;
|
|
8728
|
+
let configContent = null;
|
|
8729
|
+
if (source.explicitPath) {
|
|
8730
|
+
configFilePath = source.explicitPath;
|
|
8731
|
+
} else if (source.raw !== null && source.sourcePath === SLOCK_KIMI_CONFIG_CONTENT_ENV) {
|
|
8732
|
+
configFilePath = path9.join(ctx.workingDirectory, KIMI_GENERATED_CONFIG_FILE);
|
|
8733
|
+
configContent = source.raw;
|
|
8734
|
+
if (opts.writeGeneratedConfig !== false) {
|
|
8735
|
+
writeFileSync3(configFilePath, source.raw, { encoding: "utf8", mode: 384 });
|
|
8736
|
+
chmodSync(configFilePath, 384);
|
|
8737
|
+
}
|
|
8738
|
+
}
|
|
8739
|
+
if (configFilePath) {
|
|
8740
|
+
args.push("--config-file", configFilePath);
|
|
8741
|
+
}
|
|
8742
|
+
if (ctx.config.model && ctx.config.model !== "default") {
|
|
8743
|
+
args.push("--model", ctx.config.model);
|
|
8744
|
+
}
|
|
8745
|
+
return {
|
|
8746
|
+
args,
|
|
8747
|
+
env: buildKimiSpawnEnv(env),
|
|
8748
|
+
configFilePath,
|
|
8749
|
+
configContent
|
|
8750
|
+
};
|
|
8751
|
+
}
|
|
7444
8752
|
function resolveKimiSpawn(commandArgs, deps = {}) {
|
|
7445
8753
|
return {
|
|
7446
8754
|
command: resolveCommandOnPath("kimi", deps) ?? "kimi",
|
|
@@ -7464,7 +8772,25 @@ var KimiDriver = class {
|
|
|
7464
8772
|
};
|
|
7465
8773
|
model = {
|
|
7466
8774
|
detectedModelsVerifiedAs: "launchable",
|
|
7467
|
-
toLaunchSpec: (modelId) =>
|
|
8775
|
+
toLaunchSpec: (modelId, ctx, opts) => {
|
|
8776
|
+
if (!ctx) return { args: ["--model", modelId] };
|
|
8777
|
+
const launchCtx = {
|
|
8778
|
+
...ctx,
|
|
8779
|
+
config: {
|
|
8780
|
+
...ctx.config,
|
|
8781
|
+
model: modelId
|
|
8782
|
+
}
|
|
8783
|
+
};
|
|
8784
|
+
const launch = buildKimiLaunchOptions(launchCtx, {
|
|
8785
|
+
home: opts?.home,
|
|
8786
|
+
writeGeneratedConfig: false
|
|
8787
|
+
});
|
|
8788
|
+
return {
|
|
8789
|
+
args: launch.args,
|
|
8790
|
+
env: launch.env,
|
|
8791
|
+
configFiles: launch.configFilePath ? [launch.configFilePath] : void 0
|
|
8792
|
+
};
|
|
8793
|
+
}
|
|
7468
8794
|
};
|
|
7469
8795
|
supportsStdinNotification = true;
|
|
7470
8796
|
busyDeliveryMode = "direct";
|
|
@@ -7488,21 +8814,23 @@ var KimiDriver = class {
|
|
|
7488
8814
|
` system_prompt_path: ./${KIMI_SYSTEM_PROMPT_FILE}`,
|
|
7489
8815
|
""
|
|
7490
8816
|
].join("\n"), "utf8");
|
|
8817
|
+
const launch = buildKimiLaunchOptions(ctx);
|
|
7491
8818
|
const args = [
|
|
7492
8819
|
"--wire",
|
|
7493
8820
|
"--yolo",
|
|
7494
8821
|
"--agent-file",
|
|
7495
8822
|
agentFilePath,
|
|
7496
8823
|
"--session",
|
|
7497
|
-
this.sessionId
|
|
8824
|
+
this.sessionId,
|
|
8825
|
+
...launch.args
|
|
7498
8826
|
];
|
|
7499
|
-
const launchRuntimeFields = runtimeConfigToLaunchFields(ctx.config);
|
|
8827
|
+
const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(ctx.config));
|
|
7500
8828
|
if (launchRuntimeFields.model && launchRuntimeFields.model !== "default") {
|
|
7501
8829
|
args.push("--model", launchRuntimeFields.model);
|
|
7502
8830
|
}
|
|
7503
8831
|
const spawnEnv = (await prepareCliTransport(ctx, { NO_COLOR: "1" })).spawnEnv;
|
|
7504
|
-
const
|
|
7505
|
-
const proc = spawn7(
|
|
8832
|
+
const spawnTarget = resolveKimiSpawn(args);
|
|
8833
|
+
const proc = spawn7(spawnTarget.command, spawnTarget.args, {
|
|
7506
8834
|
cwd: ctx.workingDirectory,
|
|
7507
8835
|
stdio: ["pipe", "pipe", "pipe"],
|
|
7508
8836
|
env: spawnEnv,
|
|
@@ -7510,7 +8838,7 @@ var KimiDriver = class {
|
|
|
7510
8838
|
// and has an 8191-character command-line limit. Kimi's official
|
|
7511
8839
|
// installer/uv entrypoint is an executable, so launch it directly and
|
|
7512
8840
|
// keep prompts on stdin / files instead of routing through cmd.exe.
|
|
7513
|
-
shell:
|
|
8841
|
+
shell: spawnTarget.shell
|
|
7514
8842
|
});
|
|
7515
8843
|
proc.stdin?.write(JSON.stringify({
|
|
7516
8844
|
jsonrpc: "2.0",
|
|
@@ -7623,14 +8951,9 @@ var KimiDriver = class {
|
|
|
7623
8951
|
return detectKimiModels();
|
|
7624
8952
|
}
|
|
7625
8953
|
};
|
|
7626
|
-
function detectKimiModels(home = os4.homedir()) {
|
|
7627
|
-
const
|
|
7628
|
-
|
|
7629
|
-
try {
|
|
7630
|
-
raw = readFileSync3(configPath, "utf8");
|
|
7631
|
-
} catch {
|
|
7632
|
-
return null;
|
|
7633
|
-
}
|
|
8954
|
+
function detectKimiModels(home = os4.homedir(), opts = {}) {
|
|
8955
|
+
const raw = readKimiConfigSource(home, opts.env).raw;
|
|
8956
|
+
if (raw === null) return null;
|
|
7634
8957
|
const models = [];
|
|
7635
8958
|
const sectionRe = /^\s*\[models(?:\.([^\]]+)|"\.[^"]+"|\."[^"]+")\s*\]\s*$/gm;
|
|
7636
8959
|
const lineRe = /^\s*\[models\.(.+?)\s*\]\s*$/gm;
|
|
@@ -7815,7 +9138,7 @@ async function createKimiAgentSessionForContext(ctx, sessionId) {
|
|
|
7815
9138
|
userAgentSuffix: `slock-daemon/${getDaemonVersion()}`
|
|
7816
9139
|
}
|
|
7817
9140
|
});
|
|
7818
|
-
const launchRuntimeFields = runtimeConfigToLaunchFields(ctx.config);
|
|
9141
|
+
const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(ctx.config));
|
|
7819
9142
|
const sessionFields = {
|
|
7820
9143
|
workDir: ctx.workingDirectory,
|
|
7821
9144
|
...launchRuntimeFields.model && launchRuntimeFields.model !== "default" ? { model: launchRuntimeFields.model } : {}
|
|
@@ -8156,7 +9479,7 @@ function parseOpenCodeConfigContent(raw) {
|
|
|
8156
9479
|
return {};
|
|
8157
9480
|
}
|
|
8158
9481
|
function parseUserOpenCodeConfig(ctx) {
|
|
8159
|
-
const raw = runtimeConfigToLaunchFields(ctx.config).envVars?.OPENCODE_CONFIG_CONTENT;
|
|
9482
|
+
const raw = runtimeConfigToLaunchFields(hydrateRuntimeConfig(ctx.config)).envVars?.OPENCODE_CONFIG_CONTENT;
|
|
8160
9483
|
return parseOpenCodeConfigContent(raw);
|
|
8161
9484
|
}
|
|
8162
9485
|
function readLocalOpenCodeConfig(home = os5.homedir()) {
|
|
@@ -8254,7 +9577,7 @@ async function buildOpenCodeLaunchOptions(ctx, home = os5.homedir(), version = n
|
|
|
8254
9577
|
"--dir",
|
|
8255
9578
|
ctx.workingDirectory
|
|
8256
9579
|
];
|
|
8257
|
-
const launchRuntimeFields = runtimeConfigToLaunchFields(ctx.config);
|
|
9580
|
+
const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(ctx.config));
|
|
8258
9581
|
if (launchRuntimeFields.model && launchRuntimeFields.model !== "default") {
|
|
8259
9582
|
args.push("--model", launchRuntimeFields.model);
|
|
8260
9583
|
}
|
|
@@ -8296,7 +9619,7 @@ function runOpenCodeModelsCommand(home, deps = {}) {
|
|
|
8296
9619
|
const platform = deps.platform ?? process.platform;
|
|
8297
9620
|
const spawnSyncFn = deps.spawnSyncFn ?? spawnSync2;
|
|
8298
9621
|
const result = spawnSyncFn("opencode", ["models"], {
|
|
8299
|
-
env: { ...process.env, HOME: home, FORCE_COLOR: "0", NO_COLOR: "1" },
|
|
9622
|
+
env: scrubDaemonChildEnv({ ...process.env, HOME: home, FORCE_COLOR: "0", NO_COLOR: "1" }),
|
|
8300
9623
|
encoding: "utf8",
|
|
8301
9624
|
timeout: 5e3,
|
|
8302
9625
|
shell: platform === "win32"
|
|
@@ -8568,7 +9891,25 @@ import {
|
|
|
8568
9891
|
VERSION as PI_SDK_VERSION
|
|
8569
9892
|
} from "@earendil-works/pi-coding-agent";
|
|
8570
9893
|
var PI_SESSION_DIR = ".pi-sessions";
|
|
9894
|
+
var BUILTIN_SESSION_DIR = ".builtin-sessions";
|
|
9895
|
+
var BUILTIN_AGENT_DIR = ".builtin-runtime";
|
|
8571
9896
|
var PI_SDK_COMPACTION_ENABLED = true;
|
|
9897
|
+
var BUILTIN_BLOCKED_HOST_AMBIENT_CREDENTIAL_ENV_KEYS = [
|
|
9898
|
+
"AZURE_OPENAI_BASE_URL",
|
|
9899
|
+
"AZURE_OPENAI_RESOURCE_NAME",
|
|
9900
|
+
"AZURE_OPENAI_API_VERSION",
|
|
9901
|
+
"AZURE_OPENAI_DEPLOYMENT_NAME_MAP",
|
|
9902
|
+
"CLOUDFLARE_ACCOUNT_ID",
|
|
9903
|
+
"AWS_PROFILE",
|
|
9904
|
+
"AWS_ACCESS_KEY_ID",
|
|
9905
|
+
"AWS_SECRET_ACCESS_KEY",
|
|
9906
|
+
"AWS_BEARER_TOKEN_BEDROCK",
|
|
9907
|
+
"AWS_REGION"
|
|
9908
|
+
];
|
|
9909
|
+
var BUILTIN_BLOCKED_HOST_PROVIDER_ENV_KEYS = Array.from(/* @__PURE__ */ new Set([
|
|
9910
|
+
...BUILTIN_RUNTIME_HOST_PROVIDER_ENV_SCRUB_KEYS,
|
|
9911
|
+
...BUILTIN_BLOCKED_HOST_AMBIENT_CREDENTIAL_ENV_KEYS
|
|
9912
|
+
]));
|
|
8572
9913
|
function createPiSdkEventMappingState(sessionId = null) {
|
|
8573
9914
|
return {
|
|
8574
9915
|
sessionId,
|
|
@@ -8579,9 +9920,77 @@ function createPiSdkEventMappingState(sessionId = null) {
|
|
|
8579
9920
|
function buildPiSessionDir(workingDirectory) {
|
|
8580
9921
|
return path12.join(workingDirectory, PI_SESSION_DIR);
|
|
8581
9922
|
}
|
|
9923
|
+
function buildBuiltInSessionDir(workingDirectory) {
|
|
9924
|
+
return path12.join(workingDirectory, BUILTIN_SESSION_DIR);
|
|
9925
|
+
}
|
|
9926
|
+
function buildBuiltInAgentDir(workingDirectory) {
|
|
9927
|
+
return path12.join(workingDirectory, BUILTIN_AGENT_DIR);
|
|
9928
|
+
}
|
|
8582
9929
|
async function buildPiSpawnEnv(ctx) {
|
|
8583
9930
|
return (await prepareCliTransport(ctx, { NO_COLOR: "1" })).spawnEnv;
|
|
8584
9931
|
}
|
|
9932
|
+
function seedBuiltInAuthStorage(authStorage, runtimeConfig) {
|
|
9933
|
+
if (runtimeConfig.runtime !== "builtin") return;
|
|
9934
|
+
if (runtimeConfig.provider.kind === "preset") {
|
|
9935
|
+
authStorage.setRuntimeApiKey(runtimeConfig.provider.providerId, runtimeConfig.provider.apiKey);
|
|
9936
|
+
return;
|
|
9937
|
+
}
|
|
9938
|
+
if (runtimeConfig.provider.providerId === "openai-compatible") {
|
|
9939
|
+
authStorage.setRuntimeApiKey("openai", runtimeConfig.provider.apiKey);
|
|
9940
|
+
} else if (runtimeConfig.provider.providerId === "anthropic-compatible") {
|
|
9941
|
+
authStorage.setRuntimeApiKey("anthropic", runtimeConfig.provider.apiKey);
|
|
9942
|
+
}
|
|
9943
|
+
}
|
|
9944
|
+
function buildPiSessionCreateEnvPatch(runtimeConfig, envVars) {
|
|
9945
|
+
if (runtimeConfig.runtime !== "builtin" || !envVars) return envVars;
|
|
9946
|
+
const providerApiKeyEnvNames = /* @__PURE__ */ new Set([
|
|
9947
|
+
...Object.values(BUILTIN_RUNTIME_PROVIDER_ENV_KEYS),
|
|
9948
|
+
...Object.values(BUILTIN_RUNTIME_GATEWAY_PROVIDER_ENV_KEYS)
|
|
9949
|
+
]);
|
|
9950
|
+
const filtered = Object.fromEntries(
|
|
9951
|
+
Object.entries(envVars).filter(([key]) => !providerApiKeyEnvNames.has(key))
|
|
9952
|
+
);
|
|
9953
|
+
return Object.keys(filtered).length > 0 ? filtered : null;
|
|
9954
|
+
}
|
|
9955
|
+
var processEnvPatchTail = Promise.resolve();
|
|
9956
|
+
async function runWithProcessEnvPatchLock(fn) {
|
|
9957
|
+
const previous = processEnvPatchTail;
|
|
9958
|
+
let release;
|
|
9959
|
+
processEnvPatchTail = new Promise((resolve) => {
|
|
9960
|
+
release = resolve;
|
|
9961
|
+
});
|
|
9962
|
+
await previous;
|
|
9963
|
+
try {
|
|
9964
|
+
return await fn();
|
|
9965
|
+
} finally {
|
|
9966
|
+
release();
|
|
9967
|
+
}
|
|
9968
|
+
}
|
|
9969
|
+
async function withProcessEnvPatch(patch, fn, opts = {}) {
|
|
9970
|
+
const keys = /* @__PURE__ */ new Set([...opts.removeFirst ?? [], ...Object.keys(patch ?? {})]);
|
|
9971
|
+
if (keys.size === 0) return fn();
|
|
9972
|
+
return runWithProcessEnvPatchLock(async () => {
|
|
9973
|
+
const previous = {};
|
|
9974
|
+
for (const key of keys) {
|
|
9975
|
+
previous[key] = process.env[key];
|
|
9976
|
+
delete process.env[key];
|
|
9977
|
+
}
|
|
9978
|
+
for (const [key, value] of Object.entries(patch ?? {})) {
|
|
9979
|
+
process.env[key] = value;
|
|
9980
|
+
}
|
|
9981
|
+
try {
|
|
9982
|
+
return await fn();
|
|
9983
|
+
} finally {
|
|
9984
|
+
for (const [key, value] of Object.entries(previous)) {
|
|
9985
|
+
if (value === void 0) {
|
|
9986
|
+
delete process.env[key];
|
|
9987
|
+
} else {
|
|
9988
|
+
process.env[key] = value;
|
|
9989
|
+
}
|
|
9990
|
+
}
|
|
9991
|
+
}
|
|
9992
|
+
});
|
|
9993
|
+
}
|
|
8585
9994
|
function resolvePiModelFromRegistry(modelId, modelRegistry) {
|
|
8586
9995
|
if (!modelId || modelId === "default") return void 0;
|
|
8587
9996
|
const [provider, ...modelParts] = modelId.split("/");
|
|
@@ -8590,6 +9999,27 @@ function resolvePiModelFromRegistry(modelId, modelRegistry) {
|
|
|
8590
9999
|
}
|
|
8591
10000
|
return modelRegistry.getAll().find((model) => model.id === modelId);
|
|
8592
10001
|
}
|
|
10002
|
+
function configureBuiltInGatewayCustomModel(modelRegistry, runtimeConfig) {
|
|
10003
|
+
if (runtimeConfig.runtime !== "builtin") return;
|
|
10004
|
+
if (runtimeConfig.provider.kind !== "gateway") return;
|
|
10005
|
+
if (runtimeConfig.model.kind !== "custom") return;
|
|
10006
|
+
const provider = runtimeConfig.provider.providerId === "openai-compatible" ? { id: "openai", api: "openai-completions", apiKeyEnv: "OPENAI_API_KEY" } : { id: "anthropic", api: "anthropic-messages", apiKeyEnv: "ANTHROPIC_API_KEY" };
|
|
10007
|
+
modelRegistry.registerProvider(provider.id, {
|
|
10008
|
+
name: getRuntimeProviderDisplayName(runtimeConfig.provider.providerId),
|
|
10009
|
+
baseUrl: runtimeConfig.provider.baseUrl,
|
|
10010
|
+
apiKey: `$${provider.apiKeyEnv}`,
|
|
10011
|
+
api: provider.api,
|
|
10012
|
+
models: [{
|
|
10013
|
+
id: runtimeConfig.model.name,
|
|
10014
|
+
name: runtimeConfig.model.name,
|
|
10015
|
+
reasoning: true,
|
|
10016
|
+
input: ["text"],
|
|
10017
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
10018
|
+
contextWindow: 2e5,
|
|
10019
|
+
maxTokens: 8192
|
|
10020
|
+
}]
|
|
10021
|
+
});
|
|
10022
|
+
}
|
|
8593
10023
|
function findPiSessionFile(sessionDir, sessionId) {
|
|
8594
10024
|
let entries;
|
|
8595
10025
|
try {
|
|
@@ -8796,12 +10226,25 @@ var PI_RUNTIME_SESSION_DESCRIPTOR = {
|
|
|
8796
10226
|
};
|
|
8797
10227
|
var PI_IDLE_PROMPT_RETRY_MS = 25;
|
|
8798
10228
|
var PI_IDLE_PROMPT_MAX_WAIT_MS = 1e3;
|
|
8799
|
-
async function createPiAgentSessionForContext(ctx, sessionId) {
|
|
8800
|
-
const sessionDir = buildPiSessionDir(ctx.workingDirectory);
|
|
10229
|
+
async function createPiAgentSessionForContext(ctx, sessionId, opts = {}) {
|
|
10230
|
+
const sessionDir = opts.sessionDir ?? buildPiSessionDir(ctx.workingDirectory);
|
|
8801
10231
|
mkdirSync3(sessionDir, { recursive: true });
|
|
8802
|
-
const
|
|
10232
|
+
const runtimeConfig = hydrateRuntimeConfig(ctx.config);
|
|
10233
|
+
const launchPlan = buildLaunchPlan(runtimeConfig);
|
|
10234
|
+
const { trace: launchTrace, configSource: _configSource, ...launchRuntimeFields } = launchPlan;
|
|
10235
|
+
const launchTraceEvidenceAttrs = opts.exposeLaunchTraceEvidence ? {
|
|
10236
|
+
config_source: launchTrace.config_source,
|
|
10237
|
+
...runtimeConfig.runtime === "builtin" ? { host_user_state: runtimeConfig.hostUserState } : {},
|
|
10238
|
+
...launchTrace.provider_id ? { provider_id: launchTrace.provider_id } : {},
|
|
10239
|
+
...launchTrace.model_kind ? { model_kind: launchTrace.model_kind } : {},
|
|
10240
|
+
...launchTrace.model_id ? { model_id: launchTrace.model_id } : {},
|
|
10241
|
+
...launchTrace.base_url_present !== void 0 ? { base_url_present: launchTrace.base_url_present } : {},
|
|
10242
|
+
...launchTrace.base_url_host_class ? { base_url_host_class: launchTrace.base_url_host_class } : {},
|
|
10243
|
+
provider_key_present: launchTrace.provider_key_present,
|
|
10244
|
+
...launchTrace.provider_key_source ? { provider_key_source: launchTrace.provider_key_source } : {}
|
|
10245
|
+
} : {};
|
|
8803
10246
|
const requestedModel = launchRuntimeFields.model || "default";
|
|
8804
|
-
const traceSpan = ctx.tracer?.startSpan("daemon.pi.session.create", {
|
|
10247
|
+
const traceSpan = ctx.tracer?.startSpan(opts.traceName ?? "daemon.pi.session.create", {
|
|
8805
10248
|
surface: "daemon",
|
|
8806
10249
|
kind: "internal",
|
|
8807
10250
|
attrs: {
|
|
@@ -8810,15 +10253,22 @@ async function createPiAgentSessionForContext(ctx, sessionId) {
|
|
|
8810
10253
|
runtime: ctx.config.runtime,
|
|
8811
10254
|
model: ctx.config.model,
|
|
8812
10255
|
session_id_present: Boolean(sessionId),
|
|
8813
|
-
requested_model: requestedModel
|
|
10256
|
+
requested_model: requestedModel,
|
|
10257
|
+
...launchTraceEvidenceAttrs
|
|
8814
10258
|
}
|
|
8815
10259
|
});
|
|
10260
|
+
const logPrefix = opts.logPrefix ?? "pi-driver";
|
|
10261
|
+
const traceEventPrefix = opts.traceEventPrefix ?? "daemon.pi.session";
|
|
8816
10262
|
try {
|
|
8817
10263
|
const spawnEnv = await buildPiSpawnEnv(ctx);
|
|
8818
|
-
const agentDir = spawnEnv.PI_CODING_AGENT_DIR
|
|
10264
|
+
const agentDir = opts.agentDir ?? spawnEnv.PI_CODING_AGENT_DIR ?? getAgentDir();
|
|
10265
|
+
mkdirSync3(agentDir, { recursive: true });
|
|
8819
10266
|
const authStorage = AuthStorage.create(path12.join(agentDir, "auth.json"));
|
|
10267
|
+
seedBuiltInAuthStorage(authStorage, runtimeConfig);
|
|
8820
10268
|
const settingsManager = SettingsManager.create(ctx.workingDirectory, agentDir);
|
|
8821
|
-
const
|
|
10269
|
+
const providerEnvScope = opts.isolateHostProviderEnv ? BUILTIN_BLOCKED_HOST_PROVIDER_ENV_KEYS : void 0;
|
|
10270
|
+
const sessionCreateEnvPatch = buildPiSessionCreateEnvPatch(runtimeConfig, launchRuntimeFields.envVars);
|
|
10271
|
+
const services = await withProcessEnvPatch(sessionCreateEnvPatch, () => createAgentSessionServices({
|
|
8822
10272
|
cwd: ctx.workingDirectory,
|
|
8823
10273
|
agentDir,
|
|
8824
10274
|
authStorage,
|
|
@@ -8826,23 +10276,27 @@ async function createPiAgentSessionForContext(ctx, sessionId) {
|
|
|
8826
10276
|
resourceLoaderOptions: {
|
|
8827
10277
|
systemPromptOverride: () => ctx.standingPrompt
|
|
8828
10278
|
}
|
|
8829
|
-
});
|
|
10279
|
+
}), { removeFirst: providerEnvScope });
|
|
10280
|
+
configureBuiltInGatewayCustomModel(services.modelRegistry, runtimeConfig);
|
|
8830
10281
|
applyPiDaemonSettingsOverrides(services.settingsManager);
|
|
8831
10282
|
logPiServiceDiagnostics("create_session", services);
|
|
8832
|
-
addPiServiceTraceEvent(traceSpan,
|
|
8833
|
-
agent_dir_source: spawnEnv.PI_CODING_AGENT_DIR ? "spawn_env" : "default"
|
|
10283
|
+
addPiServiceTraceEvent(traceSpan, `${traceEventPrefix}.services_ready`, services, {
|
|
10284
|
+
agent_dir_source: opts.agentDirSource ?? (spawnEnv.PI_CODING_AGENT_DIR ? "spawn_env" : "default"),
|
|
10285
|
+
...launchTraceEvidenceAttrs
|
|
8834
10286
|
});
|
|
8835
10287
|
const model = resolvePiModelFromRegistry(launchRuntimeFields.model, services.modelRegistry);
|
|
8836
10288
|
const resolvedModel = formatPiModelLogId(model);
|
|
8837
|
-
traceSpan?.addEvent(
|
|
10289
|
+
traceSpan?.addEvent(`${traceEventPrefix}.model_resolved`, {
|
|
8838
10290
|
available_models_count: services.modelRegistry.getAvailable().length,
|
|
8839
10291
|
requested_model: requestedModel,
|
|
8840
10292
|
requested_model_explicit: requestedModel !== "default",
|
|
8841
10293
|
resolved_model: resolvedModel,
|
|
8842
|
-
resolved_model_present: Boolean(model)
|
|
10294
|
+
resolved_model_present: Boolean(model),
|
|
10295
|
+
...launchTraceEvidenceAttrs
|
|
8843
10296
|
});
|
|
8844
10297
|
console.info(
|
|
8845
|
-
"[
|
|
10298
|
+
"[%s] create_session services_ready agentDir=%s available=%d requested=%s resolved=%s",
|
|
10299
|
+
logPrefix,
|
|
8846
10300
|
agentDir,
|
|
8847
10301
|
services.modelRegistry.getAvailable().length,
|
|
8848
10302
|
requestedModel,
|
|
@@ -8850,13 +10304,15 @@ async function createPiAgentSessionForContext(ctx, sessionId) {
|
|
|
8850
10304
|
);
|
|
8851
10305
|
if (launchRuntimeFields.model && launchRuntimeFields.model !== "default" && !model) {
|
|
8852
10306
|
console.warn(
|
|
8853
|
-
"[
|
|
10307
|
+
"[%s] create_session missing_model requested=%s available=%d",
|
|
10308
|
+
logPrefix,
|
|
8854
10309
|
requestedModel,
|
|
8855
10310
|
services.modelRegistry.getAvailable().length
|
|
8856
10311
|
);
|
|
8857
|
-
traceSpan?.addEvent(
|
|
10312
|
+
traceSpan?.addEvent(`${traceEventPrefix}.missing_model`, {
|
|
8858
10313
|
available_models_count: services.modelRegistry.getAvailable().length,
|
|
8859
|
-
requested_model: requestedModel
|
|
10314
|
+
requested_model: requestedModel,
|
|
10315
|
+
...launchTraceEvidenceAttrs
|
|
8860
10316
|
});
|
|
8861
10317
|
traceSpan?.end("error", {
|
|
8862
10318
|
attrs: {
|
|
@@ -8864,14 +10320,21 @@ async function createPiAgentSessionForContext(ctx, sessionId) {
|
|
|
8864
10320
|
available_models_count: services.modelRegistry.getAvailable().length,
|
|
8865
10321
|
requested_model: requestedModel,
|
|
8866
10322
|
resolved_model_present: false,
|
|
8867
|
-
...piServiceDiagnosticTraceAttrs(services)
|
|
10323
|
+
...piServiceDiagnosticTraceAttrs(services),
|
|
10324
|
+
...launchTraceEvidenceAttrs
|
|
8868
10325
|
}
|
|
8869
10326
|
});
|
|
8870
10327
|
throw new Error(`Pi model not found: ${launchRuntimeFields.model}`);
|
|
8871
10328
|
}
|
|
8872
10329
|
const existingSessionFile = ctx.config.sessionId ? findPiSessionFile(sessionDir, ctx.config.sessionId) : null;
|
|
8873
10330
|
const sessionManager = existingSessionFile ? SessionManager.open(existingSessionFile, sessionDir, ctx.workingDirectory) : SessionManager.create(ctx.workingDirectory, sessionDir, { id: sessionId });
|
|
8874
|
-
const {
|
|
10331
|
+
const toolSpawnEnv = { ...spawnEnv };
|
|
10332
|
+
if (opts.exposeLaunchEnvToTools === false) {
|
|
10333
|
+
for (const key of Object.keys(launchRuntimeFields.envVars ?? {})) {
|
|
10334
|
+
delete toolSpawnEnv[key];
|
|
10335
|
+
}
|
|
10336
|
+
}
|
|
10337
|
+
const { session } = await withProcessEnvPatch(sessionCreateEnvPatch, () => createAgentSessionFromServices({
|
|
8875
10338
|
services,
|
|
8876
10339
|
sessionManager,
|
|
8877
10340
|
model,
|
|
@@ -8882,16 +10345,17 @@ async function createPiAgentSessionForContext(ctx, sessionId) {
|
|
|
8882
10345
|
...spawnContext,
|
|
8883
10346
|
env: {
|
|
8884
10347
|
...spawnContext.env,
|
|
8885
|
-
...
|
|
10348
|
+
...toolSpawnEnv
|
|
8886
10349
|
}
|
|
8887
10350
|
})
|
|
8888
10351
|
})
|
|
8889
10352
|
]
|
|
8890
|
-
});
|
|
8891
|
-
traceSpan?.addEvent(
|
|
10353
|
+
}), { removeFirst: providerEnvScope });
|
|
10354
|
+
traceSpan?.addEvent(`${traceEventPrefix}.started`, {
|
|
8892
10355
|
requested_model: requestedModel,
|
|
8893
10356
|
resolved_model: resolvedModel,
|
|
8894
|
-
session_id_present: Boolean(session.sessionId)
|
|
10357
|
+
session_id_present: Boolean(session.sessionId),
|
|
10358
|
+
...launchTraceEvidenceAttrs
|
|
8895
10359
|
});
|
|
8896
10360
|
traceSpan?.end("ok", {
|
|
8897
10361
|
attrs: {
|
|
@@ -8900,11 +10364,13 @@ async function createPiAgentSessionForContext(ctx, sessionId) {
|
|
|
8900
10364
|
requested_model: requestedModel,
|
|
8901
10365
|
resolved_model: resolvedModel,
|
|
8902
10366
|
resolved_model_present: Boolean(model),
|
|
8903
|
-
...piServiceDiagnosticTraceAttrs(services)
|
|
10367
|
+
...piServiceDiagnosticTraceAttrs(services),
|
|
10368
|
+
...launchTraceEvidenceAttrs
|
|
8904
10369
|
}
|
|
8905
10370
|
});
|
|
8906
10371
|
console.info(
|
|
8907
|
-
"[
|
|
10372
|
+
"[%s] create_session started sessionId=%s requested=%s resolved=%s",
|
|
10373
|
+
logPrefix,
|
|
8908
10374
|
sessionId,
|
|
8909
10375
|
requestedModel,
|
|
8910
10376
|
resolvedModel
|
|
@@ -8914,7 +10380,8 @@ async function createPiAgentSessionForContext(ctx, sessionId) {
|
|
|
8914
10380
|
traceSpan?.end("error", {
|
|
8915
10381
|
attrs: {
|
|
8916
10382
|
outcome: "error",
|
|
8917
|
-
error_class: error instanceof Error ? error.name : typeof error
|
|
10383
|
+
error_class: error instanceof Error ? error.name : typeof error,
|
|
10384
|
+
...launchTraceEvidenceAttrs
|
|
8918
10385
|
}
|
|
8919
10386
|
});
|
|
8920
10387
|
throw error;
|
|
@@ -9163,6 +10630,48 @@ var PiDriver = class {
|
|
|
9163
10630
|
});
|
|
9164
10631
|
}
|
|
9165
10632
|
};
|
|
10633
|
+
var BuiltInDriver = class extends PiDriver {
|
|
10634
|
+
id = "builtin";
|
|
10635
|
+
model = {
|
|
10636
|
+
detectedModelsVerifiedAs: "launchable",
|
|
10637
|
+
toLaunchSpec: (modelId) => ({ params: { model: modelId } })
|
|
10638
|
+
};
|
|
10639
|
+
probe() {
|
|
10640
|
+
return {
|
|
10641
|
+
available: true,
|
|
10642
|
+
version: PI_SDK_VERSION
|
|
10643
|
+
};
|
|
10644
|
+
}
|
|
10645
|
+
async detectModels(_ctx) {
|
|
10646
|
+
return { models: RUNTIME_MODELS.builtin };
|
|
10647
|
+
}
|
|
10648
|
+
createSession(ctx) {
|
|
10649
|
+
this.sessionId = ctx.config.sessionId || null;
|
|
10650
|
+
return new PiSdkRuntimeSession(ctx, (sessionId) => {
|
|
10651
|
+
this.sessionId = sessionId;
|
|
10652
|
+
}, (sessionCtx, sessionId) => createPiAgentSessionForContext(sessionCtx, sessionId, {
|
|
10653
|
+
agentDir: buildBuiltInAgentDir(sessionCtx.workingDirectory),
|
|
10654
|
+
sessionDir: buildBuiltInSessionDir(sessionCtx.workingDirectory),
|
|
10655
|
+
traceName: "daemon.builtin.session.create",
|
|
10656
|
+
traceEventPrefix: "daemon.builtin.session",
|
|
10657
|
+
logPrefix: "builtin-driver",
|
|
10658
|
+
agentDirSource: "managed_builtin",
|
|
10659
|
+
exposeLaunchTraceEvidence: true,
|
|
10660
|
+
exposeLaunchEnvToTools: false,
|
|
10661
|
+
isolateHostProviderEnv: true
|
|
10662
|
+
}));
|
|
10663
|
+
}
|
|
10664
|
+
buildSystemPrompt(config, _agentId) {
|
|
10665
|
+
return buildCliTransportSystemPrompt(config, {
|
|
10666
|
+
extraCriticalRules: [],
|
|
10667
|
+
postStartupNotes: [
|
|
10668
|
+
"**Built-in runtime note:** Slock keeps this runtime in an isolated SDK session. While you are working, Slock may send inbox-count notifications into the current turn; call `raft message check` at natural breakpoints."
|
|
10669
|
+
],
|
|
10670
|
+
includeStdinNotificationSection: true,
|
|
10671
|
+
messageNotificationStyle: "direct"
|
|
10672
|
+
});
|
|
10673
|
+
}
|
|
10674
|
+
};
|
|
9166
10675
|
function delay(ms) {
|
|
9167
10676
|
return new Promise((resolve) => {
|
|
9168
10677
|
const timer = setTimeout(resolve, ms);
|
|
@@ -9314,6 +10823,7 @@ function createChildProcessRuntimeSession(driver, ctx) {
|
|
|
9314
10823
|
|
|
9315
10824
|
// src/drivers/index.ts
|
|
9316
10825
|
var driverFactories = {
|
|
10826
|
+
builtin: () => new BuiltInDriver(),
|
|
9317
10827
|
claude: () => new ClaudeDriver(),
|
|
9318
10828
|
codex: () => new CodexDriver(),
|
|
9319
10829
|
antigravity: () => new AntigravityDriver(),
|
|
@@ -10345,6 +11855,9 @@ var RUNTIME_ERROR_FINGERPRINT_FENCE_THRESHOLD = 3;
|
|
|
10345
11855
|
var SPAWN_FAIL_BACKOFF_BASE_MS = 1e3;
|
|
10346
11856
|
var SPAWN_FAIL_BACKOFF_MAX_MS = 3e4;
|
|
10347
11857
|
var SPAWN_FAIL_BACKOFF_THRESHOLD = 3;
|
|
11858
|
+
var RUNNER_CREDENTIAL_MINT_BACKOFF_BASE_MS = 6e4;
|
|
11859
|
+
var RUNNER_CREDENTIAL_MINT_BACKOFF_MAX_MS = 10 * 6e4;
|
|
11860
|
+
var RUNNER_CREDENTIAL_MINT_BACKOFF_THRESHOLD = 0;
|
|
10348
11861
|
var COMPACTION_STALE_MS = 5 * 6e4;
|
|
10349
11862
|
var RUNTIME_PROGRESS_STALE_MS = 15 * 6e4;
|
|
10350
11863
|
var DEFAULT_RUNTIME_START_TIMEOUT_MS = 2 * 6e4;
|
|
@@ -11369,12 +12882,14 @@ var AgentProcessManager = class _AgentProcessManager {
|
|
|
11369
12882
|
}
|
|
11370
12883
|
// ----- SPAWN-FAIL BACKOFF (per-agent) ----------------------------------
|
|
11371
12884
|
// Anchored at auto_restart_from_idle (apm:3596) + runtime_profile_auto_restart (apm:4137).
|
|
11372
|
-
//
|
|
11373
|
-
//
|
|
11374
|
-
//
|
|
11375
|
-
//
|
|
11376
|
-
//
|
|
11377
|
-
//
|
|
12885
|
+
// Generic spawn errors keep a threshold > 1 so single-transient hiccups behave as today.
|
|
12886
|
+
// Runner credential mint failures are different: one outer spawn failure already means the
|
|
12887
|
+
// inner credential-mint loop exhausted RUNNER_CREDENTIAL_MINT_MAX_ATTEMPTS. Those enter a
|
|
12888
|
+
// longer cooldown immediately so repeated wakes don't keep burning three network fetches.
|
|
12889
|
+
// Successful spawn resets state. State lives outside AgentProcess because spawn fails BEFORE
|
|
12890
|
+
// ap exists and the rate-window must persist across stop/respawn (else stop/start churn
|
|
12891
|
+
// bypasses the cap — CC1 lifecycle pattern). Never advances any consume cursor or model-seen
|
|
12892
|
+
// state (3-cursor orthogonality with CC1/CC2).
|
|
11378
12893
|
getOrCreateSpawnFailBackoff(agentId) {
|
|
11379
12894
|
let state = this.agentSpawnFailBackoff.get(agentId);
|
|
11380
12895
|
if (!state) {
|
|
@@ -11395,12 +12910,16 @@ var AgentProcessManager = class _AgentProcessManager {
|
|
|
11395
12910
|
const state = this.getOrCreateSpawnFailBackoff(agentId);
|
|
11396
12911
|
state.attempts += 1;
|
|
11397
12912
|
state.reason = reason;
|
|
11398
|
-
|
|
12913
|
+
const isRunnerCredentialMint = reason === "runner_credential_mint";
|
|
12914
|
+
const threshold = isRunnerCredentialMint ? RUNNER_CREDENTIAL_MINT_BACKOFF_THRESHOLD : SPAWN_FAIL_BACKOFF_THRESHOLD;
|
|
12915
|
+
const baseMs = isRunnerCredentialMint ? RUNNER_CREDENTIAL_MINT_BACKOFF_BASE_MS : SPAWN_FAIL_BACKOFF_BASE_MS;
|
|
12916
|
+
const maxMs = isRunnerCredentialMint ? RUNNER_CREDENTIAL_MINT_BACKOFF_MAX_MS : SPAWN_FAIL_BACKOFF_MAX_MS;
|
|
12917
|
+
if (state.attempts <= threshold) {
|
|
11399
12918
|
state.untilMs = 0;
|
|
11400
12919
|
return { backoffActive: false, attempts: state.attempts, untilMs: 0 };
|
|
11401
12920
|
}
|
|
11402
|
-
const exponent = Math.min(state.attempts -
|
|
11403
|
-
const baseDelay = Math.min(
|
|
12921
|
+
const exponent = Math.min(state.attempts - threshold - 1, 10);
|
|
12922
|
+
const baseDelay = Math.min(maxMs, baseMs * Math.pow(2, exponent));
|
|
11404
12923
|
state.untilMs = this.clockNow() + Math.floor(baseDelay);
|
|
11405
12924
|
if (state.timer) clearTimeout(state.timer);
|
|
11406
12925
|
state.timer = setTimeout(() => {
|
|
@@ -11998,7 +13517,7 @@ var AgentProcessManager = class _AgentProcessManager {
|
|
|
11998
13517
|
recordFreshnessDecisionActivity(agentId, input, producerFactId) {
|
|
11999
13518
|
if (input.decision !== "local_hold" && input.decision !== "syncing_hold") return;
|
|
12000
13519
|
const ap = this.agents.get(agentId);
|
|
12001
|
-
const messageCount = input.pendingCount ?? input.heldMessageCount ?? 0;
|
|
13520
|
+
const messageCount = input.decision === "syncing_hold" ? input.heldMessageCount ?? input.pendingCount ?? 0 : input.pendingCount ?? input.heldMessageCount ?? 0;
|
|
12002
13521
|
const entry = projectApmHeldFreshnessActivity({
|
|
12003
13522
|
producerFactId,
|
|
12004
13523
|
action: input.action,
|
|
@@ -12149,6 +13668,20 @@ var AgentProcessManager = class _AgentProcessManager {
|
|
|
12149
13668
|
if (driver.requiresSessionInitForDelivery) return null;
|
|
12150
13669
|
return config.sessionId || null;
|
|
12151
13670
|
}
|
|
13671
|
+
initialSessionReadyForDelivery(driver, config, sessionId) {
|
|
13672
|
+
if (!sessionId) return false;
|
|
13673
|
+
if (config.sessionId && config.sessionId === sessionId) return true;
|
|
13674
|
+
return driver.liveSessionReadyAt !== "turn_end";
|
|
13675
|
+
}
|
|
13676
|
+
markSessionReadyForDelivery(ap, source) {
|
|
13677
|
+
if (!ap.sessionId) return;
|
|
13678
|
+
if (source === "turn_end" || ap.driver.liveSessionReadyAt !== "turn_end") {
|
|
13679
|
+
ap.sessionReadyForDelivery = true;
|
|
13680
|
+
}
|
|
13681
|
+
}
|
|
13682
|
+
canDeliverToRuntimeSession(ap) {
|
|
13683
|
+
return Boolean(ap.sessionId && ap.sessionReadyForDelivery);
|
|
13684
|
+
}
|
|
12152
13685
|
restartSafeSessionId(ap) {
|
|
12153
13686
|
return ap.sessionId || (ap.driver.requiresSessionInitForDelivery ? ap.config.sessionId || null : null);
|
|
12154
13687
|
}
|
|
@@ -12198,9 +13731,11 @@ var AgentProcessManager = class _AgentProcessManager {
|
|
|
12198
13731
|
const nextLaunchId = start.launchId || ap.launchId || null;
|
|
12199
13732
|
const requiresSessionInit = ap.driver.requiresSessionInitForDelivery === true;
|
|
12200
13733
|
const nextSessionId = ap.sessionId || (requiresSessionInit ? null : start.config.sessionId || null);
|
|
13734
|
+
const nextSessionReadyForDelivery = nextSessionId ? nextSessionId === ap.sessionId ? ap.sessionReadyForDelivery : this.initialSessionReadyForDelivery(ap.driver, start.config, nextSessionId) : false;
|
|
12201
13735
|
const nextConfigSessionId = nextSessionId || (requiresSessionInit ? start.config.sessionId || null : ap.config.sessionId || start.config.sessionId || null);
|
|
12202
13736
|
ap.launchId = nextLaunchId;
|
|
12203
13737
|
ap.sessionId = nextSessionId;
|
|
13738
|
+
ap.sessionReadyForDelivery = nextSessionReadyForDelivery;
|
|
12204
13739
|
ap.config = {
|
|
12205
13740
|
...start.config,
|
|
12206
13741
|
sessionId: nextConfigSessionId
|
|
@@ -12617,6 +14152,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
12617
14152
|
inbox: wakeMessageDeliveredAsInboxUpdate && wakeMessage ? [wakeMessage, ...startingInboxMessages] : startingInboxMessages,
|
|
12618
14153
|
config: liveProcessConfig,
|
|
12619
14154
|
sessionId: initialSessionId,
|
|
14155
|
+
sessionReadyForDelivery: this.initialSessionReadyForDelivery(driver, liveProcessConfig, initialSessionId),
|
|
12620
14156
|
launchId: effectiveLaunchId,
|
|
12621
14157
|
startupWakeMessage: wakeMessage,
|
|
12622
14158
|
startupUnreadSummary: unreadSummary,
|
|
@@ -13335,6 +14871,15 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
13335
14871
|
if (!silent) {
|
|
13336
14872
|
logger.warn(`[Agent ${agentId}] Stop timed out; force killing`);
|
|
13337
14873
|
}
|
|
14874
|
+
this.recordDaemonTrace("daemon.agent.stop.timeout_sigkill", {
|
|
14875
|
+
agent_id: agentId,
|
|
14876
|
+
pid: typeof ap.runtime.pid === "number" ? ap.runtime.pid : void 0,
|
|
14877
|
+
timeout_ms: 5e3,
|
|
14878
|
+
reason: "wait_timeout",
|
|
14879
|
+
signal: "SIGKILL"
|
|
14880
|
+
});
|
|
14881
|
+
void ap.runtime.stop({ signal: "SIGKILL" }).catch(() => {
|
|
14882
|
+
});
|
|
13338
14883
|
resolve();
|
|
13339
14884
|
}, 5e3);
|
|
13340
14885
|
ap.runtime.on("exit", () => {
|
|
@@ -13593,7 +15138,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
13593
15138
|
if (!transientDelivery && this.queueDeliveryForRuntimeErrorBackoff(agentId, ap, message)) {
|
|
13594
15139
|
return true;
|
|
13595
15140
|
}
|
|
13596
|
-
if (isIdle && ap.driver.supportsStdinNotification && ap
|
|
15141
|
+
if (isIdle && ap.driver.supportsStdinNotification && this.canDeliverToRuntimeSession(ap)) {
|
|
13597
15142
|
if (transientDelivery) {
|
|
13598
15143
|
this.commitApmIdleState(agentId, ap, false);
|
|
13599
15144
|
this.startRuntimeTrace(agentId, ap, "stdin-idle-delivery", [message]);
|
|
@@ -13611,6 +15156,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
13611
15156
|
process_present: true,
|
|
13612
15157
|
runtime: ap.config.runtime,
|
|
13613
15158
|
session_id_present: true,
|
|
15159
|
+
session_ready_for_delivery: true,
|
|
13614
15160
|
launchId: ap.launchId || void 0,
|
|
13615
15161
|
stdin_delivery_accepted: stdinAccepted2,
|
|
13616
15162
|
delivered_messages_count: 1,
|
|
@@ -13629,6 +15175,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
13629
15175
|
process_present: true,
|
|
13630
15176
|
runtime: ap.config.runtime,
|
|
13631
15177
|
session_id_present: true,
|
|
15178
|
+
session_ready_for_delivery: true,
|
|
13632
15179
|
launchId: ap.launchId || void 0,
|
|
13633
15180
|
is_idle: isIdle,
|
|
13634
15181
|
inbox_count: ap.inbox.length,
|
|
@@ -13711,6 +15258,20 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
13711
15258
|
}));
|
|
13712
15259
|
return true;
|
|
13713
15260
|
}
|
|
15261
|
+
if (!this.canDeliverToRuntimeSession(ap)) {
|
|
15262
|
+
this.recordDaemonTrace("daemon.agent.delivery.routed", this.deliveryTraceAttrs(agentId, message, {
|
|
15263
|
+
outcome: "queued_before_session_ready",
|
|
15264
|
+
accepted: true,
|
|
15265
|
+
process_present: true,
|
|
15266
|
+
runtime: ap.config.runtime,
|
|
15267
|
+
session_id_present: true,
|
|
15268
|
+
session_ready_for_delivery: false,
|
|
15269
|
+
launchId: ap.launchId || void 0,
|
|
15270
|
+
is_idle: isIdle,
|
|
15271
|
+
inbox_count: ap.inbox.length
|
|
15272
|
+
}));
|
|
15273
|
+
return true;
|
|
15274
|
+
}
|
|
13714
15275
|
if (ap.gatedSteering.compacting) {
|
|
13715
15276
|
ap.notifications.add();
|
|
13716
15277
|
ap.notifications.clearTimer();
|
|
@@ -13817,8 +15378,74 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
13817
15378
|
async stopAll() {
|
|
13818
15379
|
this.cancelAllQueuedAgentStarts("daemon shutdown");
|
|
13819
15380
|
this.idleAgentConfigs.clear();
|
|
15381
|
+
const pids = [];
|
|
15382
|
+
for (const ap of this.agents.values()) {
|
|
15383
|
+
if (typeof ap.runtime.pid === "number") pids.push(ap.runtime.pid);
|
|
15384
|
+
}
|
|
13820
15385
|
const ids = [...this.agents.keys()];
|
|
15386
|
+
this.recordDaemonTrace("daemon.agent.stop_all.started", {
|
|
15387
|
+
agent_count: ids.length,
|
|
15388
|
+
pid_count: pids.length,
|
|
15389
|
+
pids: pids.join(",")
|
|
15390
|
+
});
|
|
13821
15391
|
await Promise.all(ids.map((id) => this.stopAgent(id, { wait: true, silent: true })));
|
|
15392
|
+
const survivors = pids.filter((pid) => {
|
|
15393
|
+
try {
|
|
15394
|
+
process.kill(pid, 0);
|
|
15395
|
+
return true;
|
|
15396
|
+
} catch {
|
|
15397
|
+
return false;
|
|
15398
|
+
}
|
|
15399
|
+
});
|
|
15400
|
+
if (survivors.length > 0) {
|
|
15401
|
+
for (const pid of survivors) {
|
|
15402
|
+
logger.warn(`[Daemon] Agent subprocess ${pid} survived stopAll; sending SIGKILL`);
|
|
15403
|
+
try {
|
|
15404
|
+
process.kill(pid, "SIGKILL");
|
|
15405
|
+
} catch {
|
|
15406
|
+
}
|
|
15407
|
+
}
|
|
15408
|
+
this.recordDaemonTrace("daemon.agent.stop_all.survivor_reaped", {
|
|
15409
|
+
survivor_count: survivors.length,
|
|
15410
|
+
survivor_pids: survivors.join(","),
|
|
15411
|
+
reason: "shutdown_survivor",
|
|
15412
|
+
signal: "SIGKILL"
|
|
15413
|
+
});
|
|
15414
|
+
const deadline = Date.now() + 2e3;
|
|
15415
|
+
while (Date.now() < deadline) {
|
|
15416
|
+
const alive = survivors.filter((pid) => {
|
|
15417
|
+
try {
|
|
15418
|
+
process.kill(pid, 0);
|
|
15419
|
+
return true;
|
|
15420
|
+
} catch {
|
|
15421
|
+
return false;
|
|
15422
|
+
}
|
|
15423
|
+
});
|
|
15424
|
+
if (alive.length === 0) break;
|
|
15425
|
+
await new Promise((r) => setTimeout(r, 50));
|
|
15426
|
+
}
|
|
15427
|
+
const stillAlive = survivors.filter((pid) => {
|
|
15428
|
+
try {
|
|
15429
|
+
process.kill(pid, 0);
|
|
15430
|
+
return true;
|
|
15431
|
+
} catch {
|
|
15432
|
+
return false;
|
|
15433
|
+
}
|
|
15434
|
+
});
|
|
15435
|
+
const outcome = stillAlive.length > 0 ? "survivors_still_alive" : "survivors_killed";
|
|
15436
|
+
this.recordDaemonTrace("daemon.agent.stop_all.completed", {
|
|
15437
|
+
survivor_count: survivors.length,
|
|
15438
|
+
reaped_count: survivors.length - stillAlive.length,
|
|
15439
|
+
still_alive_count: stillAlive.length,
|
|
15440
|
+
outcome
|
|
15441
|
+
}, stillAlive.length > 0 ? "error" : "ok");
|
|
15442
|
+
} else {
|
|
15443
|
+
this.recordDaemonTrace("daemon.agent.stop_all.completed", {
|
|
15444
|
+
agent_count: ids.length,
|
|
15445
|
+
survivor_count: 0,
|
|
15446
|
+
outcome: "all_dead"
|
|
15447
|
+
});
|
|
15448
|
+
}
|
|
13822
15449
|
}
|
|
13823
15450
|
getRunningAgentIds() {
|
|
13824
15451
|
return [...this.agents.keys()];
|
|
@@ -13958,7 +15585,8 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
13958
15585
|
};
|
|
13959
15586
|
const ap = this.agents.get(agentId);
|
|
13960
15587
|
const isIdle = ap ? this.isApmIdle(ap) : false;
|
|
13961
|
-
|
|
15588
|
+
const sessionReadyForDelivery = ap ? this.canDeliverToRuntimeSession(ap) : false;
|
|
15589
|
+
if (ap && !(sessionReadyForDelivery && ap.driver.supportsStdinNotification && isIdle) && !(sessionReadyForDelivery && ap.runtime.descriptor.busyDelivery === "direct")) {
|
|
13962
15590
|
this.enqueueRuntimeProfileNotification(agentId, ap, message, kind, key);
|
|
13963
15591
|
span.end("ok", {
|
|
13964
15592
|
attrs: {
|
|
@@ -13966,13 +15594,14 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
13966
15594
|
runtime: ap.config.runtime,
|
|
13967
15595
|
launchId: ap.launchId || void 0,
|
|
13968
15596
|
session_id_present: Boolean(ap.sessionId),
|
|
15597
|
+
session_ready_for_delivery: sessionReadyForDelivery,
|
|
13969
15598
|
supports_stdin_notification: ap.driver.supportsStdinNotification,
|
|
13970
15599
|
busy_delivery_mode: ap.driver.busyDeliveryMode
|
|
13971
15600
|
}
|
|
13972
15601
|
});
|
|
13973
15602
|
return true;
|
|
13974
15603
|
}
|
|
13975
|
-
if (ap
|
|
15604
|
+
if (ap && sessionReadyForDelivery && ap.driver.supportsStdinNotification && isIdle) {
|
|
13976
15605
|
this.commitApmIdleState(agentId, ap, false);
|
|
13977
15606
|
this.startRuntimeTrace(agentId, ap, "runtime-profile", [message]);
|
|
13978
15607
|
const written = this.deliverMessagesViaStdin(agentId, ap, [message], "idle");
|
|
@@ -13988,7 +15617,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
13988
15617
|
});
|
|
13989
15618
|
return written;
|
|
13990
15619
|
}
|
|
13991
|
-
if (ap
|
|
15620
|
+
if (ap && sessionReadyForDelivery && ap.runtime.descriptor.busyDelivery === "direct") {
|
|
13992
15621
|
const written = this.deliverMessagesViaStdin(agentId, ap, [message], "busy");
|
|
13993
15622
|
span.end(written ? "ok" : "error", {
|
|
13994
15623
|
attrs: {
|
|
@@ -14510,7 +16139,8 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
14510
16139
|
entries.push({ kind: "status", activity, detail });
|
|
14511
16140
|
}
|
|
14512
16141
|
const launchId = launchIdOverride || ap?.launchId || void 0;
|
|
14513
|
-
const clientSeq =
|
|
16142
|
+
const clientSeq = this.nextActivityClientSeq(agentId);
|
|
16143
|
+
const producerFactId = this.buildActivityProducerFactId(agentId, launchId, clientSeq);
|
|
14514
16144
|
this.sendToServer({
|
|
14515
16145
|
type: "agent:activity",
|
|
14516
16146
|
agentId,
|
|
@@ -14518,9 +16148,10 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
14518
16148
|
detail,
|
|
14519
16149
|
entries,
|
|
14520
16150
|
launchId,
|
|
14521
|
-
clientSeq
|
|
16151
|
+
clientSeq,
|
|
16152
|
+
producerFactId
|
|
14522
16153
|
});
|
|
14523
|
-
this.recordActivityProducedTrace(agentId, activity, detail, entries, ap, launchId, clientSeq);
|
|
16154
|
+
this.recordActivityProducedTrace(agentId, activity, detail, entries, ap, launchId, clientSeq, producerFactId);
|
|
14524
16155
|
if (ap) {
|
|
14525
16156
|
ap.lastActivity = activity;
|
|
14526
16157
|
ap.lastActivityDetail = detail;
|
|
@@ -14533,15 +16164,17 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
14533
16164
|
});
|
|
14534
16165
|
const heartbeatLaunchId = launchIdOverride || ap.launchId || void 0;
|
|
14535
16166
|
const heartbeatClientSeq = this.nextActivityClientSeq(agentId);
|
|
16167
|
+
const heartbeatProducerFactId = this.buildActivityProducerFactId(agentId, heartbeatLaunchId, heartbeatClientSeq);
|
|
14536
16168
|
this.sendToServer({
|
|
14537
16169
|
type: "agent:activity",
|
|
14538
16170
|
agentId,
|
|
14539
16171
|
activity: ap.lastActivity,
|
|
14540
16172
|
detail: ap.lastActivityDetail,
|
|
14541
16173
|
launchId: heartbeatLaunchId,
|
|
14542
|
-
clientSeq: heartbeatClientSeq
|
|
16174
|
+
clientSeq: heartbeatClientSeq,
|
|
16175
|
+
producerFactId: heartbeatProducerFactId
|
|
14543
16176
|
});
|
|
14544
|
-
this.recordActivityProducedTrace(agentId, ap.lastActivity, ap.lastActivityDetail, [], ap, heartbeatLaunchId, heartbeatClientSeq);
|
|
16177
|
+
this.recordActivityProducedTrace(agentId, ap.lastActivity, ap.lastActivityDetail, [], ap, heartbeatLaunchId, heartbeatClientSeq, heartbeatProducerFactId);
|
|
14545
16178
|
}, ACTIVITY_HEARTBEAT_MS);
|
|
14546
16179
|
}
|
|
14547
16180
|
} else {
|
|
@@ -14552,7 +16185,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
14552
16185
|
}
|
|
14553
16186
|
}
|
|
14554
16187
|
}
|
|
14555
|
-
recordActivityProducedTrace(agentId, activity, detail, entries, ap, launchId, clientSeq) {
|
|
16188
|
+
recordActivityProducedTrace(agentId, activity, detail, entries, ap, launchId, clientSeq, producerFactId) {
|
|
14556
16189
|
const runtimeContext = ap?.config.runtimeContext;
|
|
14557
16190
|
this.recordDaemonTrace("daemon.agent.activity.produced", {
|
|
14558
16191
|
agentId,
|
|
@@ -14570,11 +16203,16 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
14570
16203
|
clientSeq,
|
|
14571
16204
|
client_seq: clientSeq,
|
|
14572
16205
|
client_seq_present: typeof clientSeq === "number",
|
|
16206
|
+
producerFactId,
|
|
16207
|
+
producer_fact_id: producerFactId,
|
|
14573
16208
|
correlation_id: `agent:${agentId}:daemonActivity:${launchId ?? "legacy"}:${clientSeq ?? "unsequenced"}`,
|
|
14574
16209
|
session_id_present: Boolean(ap?.sessionId),
|
|
14575
16210
|
runtime: ap?.config.runtime
|
|
14576
16211
|
});
|
|
14577
16212
|
}
|
|
16213
|
+
buildActivityProducerFactId(agentId, launchId, clientSeq) {
|
|
16214
|
+
return `daemon_activity:${agentId}:${launchId ?? "legacy"}:${clientSeq}`;
|
|
16215
|
+
}
|
|
14578
16216
|
/**
|
|
14579
16217
|
* Respond to a server-issued `agent:activity_probe`. Echoes the
|
|
14580
16218
|
* agent's current `lastActivity` back through the existing
|
|
@@ -14601,7 +16239,8 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
14601
16239
|
const activity = ap?.lastActivity || "offline";
|
|
14602
16240
|
const detail = ap?.lastActivityDetail || (ap ? "" : "Agent not running");
|
|
14603
16241
|
const launchId = ap?.launchId || void 0;
|
|
14604
|
-
const clientSeq =
|
|
16242
|
+
const clientSeq = this.nextActivityClientSeq(agentId);
|
|
16243
|
+
const producerFactId = this.buildActivityProducerFactId(agentId, launchId, clientSeq);
|
|
14605
16244
|
this.sendToServer({
|
|
14606
16245
|
type: "agent:activity",
|
|
14607
16246
|
agentId,
|
|
@@ -14609,9 +16248,10 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
14609
16248
|
detail,
|
|
14610
16249
|
launchId,
|
|
14611
16250
|
probeId,
|
|
14612
|
-
clientSeq
|
|
16251
|
+
clientSeq,
|
|
16252
|
+
producerFactId
|
|
14613
16253
|
});
|
|
14614
|
-
this.recordActivityProducedTrace(agentId, activity, detail, [], ap, launchId, clientSeq);
|
|
16254
|
+
this.recordActivityProducedTrace(agentId, activity, detail, [], ap, launchId, clientSeq, producerFactId);
|
|
14615
16255
|
}
|
|
14616
16256
|
flushPendingTrajectory(agentId) {
|
|
14617
16257
|
const ap = this.agents.get(agentId);
|
|
@@ -14896,6 +16536,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
14896
16536
|
model: ap.config.model,
|
|
14897
16537
|
reason,
|
|
14898
16538
|
hasSession: Boolean(ap.sessionId),
|
|
16539
|
+
sessionReadyForDelivery: ap.sessionReadyForDelivery,
|
|
14899
16540
|
...this.messagesTraceAttrs(messages),
|
|
14900
16541
|
...inputTraceAttrs,
|
|
14901
16542
|
...this.runtimeLaunchPolicyTraceAttrs(ap.config),
|
|
@@ -14904,6 +16545,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
14904
16545
|
});
|
|
14905
16546
|
span.addEvent("daemon.turn.started", {
|
|
14906
16547
|
reason,
|
|
16548
|
+
sessionReadyForDelivery: ap.sessionReadyForDelivery,
|
|
14907
16549
|
...this.messagesTraceAttrs(messages),
|
|
14908
16550
|
...inputTraceAttrs,
|
|
14909
16551
|
...this.runtimeLaunchPolicyTraceAttrs(ap.config),
|
|
@@ -15004,7 +16646,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
15004
16646
|
notifyGatedSteeringBoundary(agentId, ap, reason) {
|
|
15005
16647
|
const readiness = reduceApmGatedFlushReadiness(ap.gatedSteering, {
|
|
15006
16648
|
isGated: ap.runtime.descriptor.busyDelivery === "gated",
|
|
15007
|
-
hasSession:
|
|
16649
|
+
hasSession: this.canDeliverToRuntimeSession(ap),
|
|
15008
16650
|
inboxLength: ap.inbox.length,
|
|
15009
16651
|
reason
|
|
15010
16652
|
});
|
|
@@ -15453,7 +17095,10 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
15453
17095
|
}
|
|
15454
17096
|
switch (event.kind) {
|
|
15455
17097
|
case "session_init":
|
|
15456
|
-
if (ap)
|
|
17098
|
+
if (ap) {
|
|
17099
|
+
ap.sessionId = event.sessionId;
|
|
17100
|
+
this.markSessionReadyForDelivery(ap, "session_init");
|
|
17101
|
+
}
|
|
15457
17102
|
this.sendToServer({ type: "agent:session", agentId, sessionId: event.sessionId, launchId: ap?.launchId || void 0 });
|
|
15458
17103
|
this.sendRuntimeProfileReport(agentId, "session_init");
|
|
15459
17104
|
break;
|
|
@@ -15564,8 +17209,10 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
15564
17209
|
flushBoundaryMessages: false
|
|
15565
17210
|
});
|
|
15566
17211
|
this.flushPendingTrajectory(agentId);
|
|
17212
|
+
const turnEndSessionId = event.sessionId ?? ap?.driver.currentSessionId ?? void 0;
|
|
15567
17213
|
if (ap) {
|
|
15568
|
-
if (
|
|
17214
|
+
if (turnEndSessionId) ap.sessionId = turnEndSessionId;
|
|
17215
|
+
this.markSessionReadyForDelivery(ap, "turn_end");
|
|
15569
17216
|
const stickyTerminalFailure = classifyStickyTerminalFailure(ap);
|
|
15570
17217
|
if (!stickyTerminalFailure && ap.runtimeErrorDeliveryBackoff.reason === "runtime_error") {
|
|
15571
17218
|
this.clearRuntimeErrorDeliveryBackoffWithTrace(agentId, ap, "turn_end_unclassified_runtime_error");
|
|
@@ -15573,7 +17220,8 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
15573
17220
|
const reduction = reduceApmGatedTurnEnd(ap.gatedSteering, {
|
|
15574
17221
|
inboxLength: stickyTerminalFailure ? 0 : ap.inbox.length,
|
|
15575
17222
|
supportsStdinNotification: ap.driver.supportsStdinNotification,
|
|
15576
|
-
hasSession:
|
|
17223
|
+
hasSession: this.canDeliverToRuntimeSession(ap),
|
|
17224
|
+
canDeliverWithoutSession: !ap.driver.requiresSessionInitForDelivery,
|
|
15577
17225
|
terminateProcessOnTurnEnd: ap.driver.terminateProcessOnTurnEnd === true
|
|
15578
17226
|
});
|
|
15579
17227
|
this.commitGatedSteeringDecisionState(agentId, ap, reduction.nextState, { event: "turn_end" });
|
|
@@ -15619,8 +17267,8 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
15619
17267
|
}
|
|
15620
17268
|
}
|
|
15621
17269
|
}
|
|
15622
|
-
if (
|
|
15623
|
-
this.sendToServer({ type: "agent:session", agentId, sessionId:
|
|
17270
|
+
if (turnEndSessionId) {
|
|
17271
|
+
this.sendToServer({ type: "agent:session", agentId, sessionId: turnEndSessionId, launchId: ap?.launchId || void 0 });
|
|
15624
17272
|
this.sendRuntimeProfileReport(agentId, "turn_end");
|
|
15625
17273
|
}
|
|
15626
17274
|
break;
|
|
@@ -15826,6 +17474,22 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
|
|
|
15826
17474
|
if (count === 0) return false;
|
|
15827
17475
|
if (this.isApmIdle(ap)) return false;
|
|
15828
17476
|
if (!ap.sessionId) return false;
|
|
17477
|
+
if (!this.canDeliverToRuntimeSession(ap)) {
|
|
17478
|
+
ap.notifications.add(count);
|
|
17479
|
+
this.recordDaemonTrace("daemon.agent.stdin_notification", {
|
|
17480
|
+
agentId,
|
|
17481
|
+
runtime: ap.config.runtime,
|
|
17482
|
+
model: ap.config.model,
|
|
17483
|
+
launchId: ap.launchId || void 0,
|
|
17484
|
+
outcome: "suppressed_session_not_ready",
|
|
17485
|
+
mode: "busy",
|
|
17486
|
+
pending_notification_count: count,
|
|
17487
|
+
inbox_count: ap.inbox.length,
|
|
17488
|
+
session_id_present: true,
|
|
17489
|
+
session_ready_for_delivery: false
|
|
17490
|
+
});
|
|
17491
|
+
return false;
|
|
17492
|
+
}
|
|
15829
17493
|
const runtimeErrorBackoffRemainingMs = this.runtimeErrorDeliveryBackoffRemainingMs(ap);
|
|
15830
17494
|
if (runtimeErrorBackoffRemainingMs > 0) {
|
|
15831
17495
|
ap.notifications.add(count);
|
|
@@ -16297,6 +17961,7 @@ var DaemonConnection = class {
|
|
|
16297
17961
|
this.pendingActivityByAgent.delete(msg.agentId);
|
|
16298
17962
|
}
|
|
16299
17963
|
this.ws.send(JSON.stringify(msg));
|
|
17964
|
+
this.traceActivitySent(msg, "websocket_open");
|
|
16300
17965
|
return;
|
|
16301
17966
|
}
|
|
16302
17967
|
this.observeLaunchIdentity(msg);
|
|
@@ -16494,12 +18159,35 @@ var DaemonConnection = class {
|
|
|
16494
18159
|
this.pendingActivityByAgent.clear();
|
|
16495
18160
|
for (const msg of pending) {
|
|
16496
18161
|
ws.send(JSON.stringify(msg));
|
|
18162
|
+
this.traceActivitySent(msg, "replay");
|
|
16497
18163
|
}
|
|
16498
18164
|
this.trace("daemon.connection.outbound_replayed", {
|
|
16499
18165
|
outbound_message_kind: "agent:activity",
|
|
16500
18166
|
message_count: pending.length
|
|
16501
18167
|
});
|
|
16502
18168
|
}
|
|
18169
|
+
traceActivitySent(msg, sendPath) {
|
|
18170
|
+
if (msg.type !== "agent:activity") return;
|
|
18171
|
+
this.trace("daemon.agent.activity.sent", {
|
|
18172
|
+
agentId: msg.agentId,
|
|
18173
|
+
agent_id: msg.agentId,
|
|
18174
|
+
activity: msg.activity,
|
|
18175
|
+
detail_present: Boolean(msg.detail),
|
|
18176
|
+
entry_kinds: (msg.entries ?? []).map((entry) => entry.kind).join(","),
|
|
18177
|
+
launchId: msg.launchId,
|
|
18178
|
+
launch_id: msg.launchId,
|
|
18179
|
+
launch_id_present: Boolean(msg.launchId),
|
|
18180
|
+
clientSeq: msg.clientSeq,
|
|
18181
|
+
client_seq: msg.clientSeq,
|
|
18182
|
+
client_seq_present: typeof msg.clientSeq === "number",
|
|
18183
|
+
producerFactId: msg.producerFactId,
|
|
18184
|
+
producer_fact_id: msg.producerFactId,
|
|
18185
|
+
producer_fact_id_present: Boolean(msg.producerFactId),
|
|
18186
|
+
correlation_id: msg.producerFactId ?? `agent:${msg.agentId}:daemonActivity:${msg.launchId ?? "legacy"}:${msg.clientSeq ?? "unsequenced"}`,
|
|
18187
|
+
probe_id_present: Boolean(msg.probeId),
|
|
18188
|
+
send_path: sendPath
|
|
18189
|
+
});
|
|
18190
|
+
}
|
|
16503
18191
|
lastInboundAgeBucket() {
|
|
16504
18192
|
return durationMsBucket(this.lastInboundAt == null ? null : this.clock.now() - this.lastInboundAt);
|
|
16505
18193
|
}
|
|
@@ -17241,6 +18929,16 @@ var DAEMON_CORE_TRACE_ATTR_CONTRACTS = {
|
|
|
17241
18929
|
},
|
|
17242
18930
|
endAttrs: ["outcome", "available_models_count", "diagnostics_count", "diagnostic_info_count", "diagnostic_warning_count", "requested_model", "resolved_model", "resolved_model_present", "error_class"]
|
|
17243
18931
|
},
|
|
18932
|
+
"daemon.builtin.session.create": {
|
|
18933
|
+
spanAttrs: ["agentId", "launchId", "runtime", "model", "session_id_present", "requested_model", "config_source", "host_user_state", "provider_id", "model_kind", "model_id", "base_url_present", "base_url_host_class", "provider_key_present", "provider_key_source"],
|
|
18934
|
+
eventAttrs: {
|
|
18935
|
+
"daemon.builtin.session.services_ready": ["available_models_count", "diagnostics_count", "diagnostic_info_count", "diagnostic_warning_count", "agent_dir_source", "config_source", "host_user_state", "provider_id", "model_kind", "model_id", "base_url_present", "base_url_host_class", "provider_key_present", "provider_key_source"],
|
|
18936
|
+
"daemon.builtin.session.model_resolved": ["available_models_count", "requested_model", "requested_model_explicit", "resolved_model", "resolved_model_present", "config_source", "host_user_state", "provider_id", "model_kind", "model_id", "base_url_present", "base_url_host_class", "provider_key_present", "provider_key_source"],
|
|
18937
|
+
"daemon.builtin.session.missing_model": ["available_models_count", "requested_model", "config_source", "host_user_state", "provider_id", "model_kind", "model_id", "base_url_present", "base_url_host_class", "provider_key_present", "provider_key_source"],
|
|
18938
|
+
"daemon.builtin.session.started": ["requested_model", "resolved_model", "session_id_present", "config_source", "host_user_state", "provider_id", "model_kind", "model_id", "base_url_present", "base_url_host_class", "provider_key_present", "provider_key_source"]
|
|
18939
|
+
},
|
|
18940
|
+
endAttrs: ["outcome", "available_models_count", "diagnostics_count", "diagnostic_info_count", "diagnostic_warning_count", "requested_model", "resolved_model", "resolved_model_present", "error_class", "config_source", "host_user_state", "provider_id", "model_kind", "model_id", "base_url_present", "base_url_host_class", "provider_key_present", "provider_key_source"]
|
|
18941
|
+
},
|
|
17244
18942
|
"daemon.connection.local_disconnect_observed": {
|
|
17245
18943
|
spanAttrs: ["running_agents_count", "idle_agents_count"]
|
|
17246
18944
|
},
|
|
@@ -17254,7 +18952,7 @@ var DAEMON_CORE_TRACE_ATTR_CONTRACTS = {
|
|
|
17254
18952
|
spanAttrs: ["agentId", "event_kind", "runtime"]
|
|
17255
18953
|
}
|
|
17256
18954
|
};
|
|
17257
|
-
var DAEMON_CLI_USAGE =
|
|
18955
|
+
var DAEMON_CLI_USAGE = `Usage: slock-daemon --server-url <url> (--api-key <key> or ${DAEMON_API_KEY_ENV}=<key>)`;
|
|
17258
18956
|
var RunnerCredentialMintError2 = class extends Error {
|
|
17259
18957
|
code;
|
|
17260
18958
|
retryable;
|
|
@@ -17290,9 +18988,9 @@ function runnerCredentialErrorDetail2(error) {
|
|
|
17290
18988
|
async function waitForRunnerCredentialRetry2() {
|
|
17291
18989
|
await new Promise((resolve) => setTimeout(resolve, RUNNER_CREDENTIAL_MINT_RETRY_DELAY_MS2));
|
|
17292
18990
|
}
|
|
17293
|
-
function parseDaemonCliArgs(args) {
|
|
18991
|
+
function parseDaemonCliArgs(args, env = {}) {
|
|
17294
18992
|
let serverUrl = "";
|
|
17295
|
-
let apiKey = "";
|
|
18993
|
+
let apiKey = env[DAEMON_API_KEY_ENV] ?? "";
|
|
17296
18994
|
for (let i = 0; i < args.length; i++) {
|
|
17297
18995
|
if (args[i] === "--server-url" && args[i + 1]) serverUrl = args[++i];
|
|
17298
18996
|
if (args[i] === "--api-key" && args[i + 1]) apiKey = args[++i];
|
|
@@ -17329,7 +19027,7 @@ function resolveSlockCliPathOrEmpty(moduleUrl = import.meta.url) {
|
|
|
17329
19027
|
}
|
|
17330
19028
|
async function runBundledSlockCli(argv) {
|
|
17331
19029
|
process.argv = [process.execPath, "slock", ...argv];
|
|
17332
|
-
await import("./dist-
|
|
19030
|
+
await import("./dist-CBVXAPI6.js");
|
|
17333
19031
|
}
|
|
17334
19032
|
function detectRuntimes(tracer = noopTracer) {
|
|
17335
19033
|
const ids = [];
|
|
@@ -18266,9 +19964,12 @@ var DaemonCore = class {
|
|
|
18266
19964
|
|
|
18267
19965
|
export {
|
|
18268
19966
|
subscribeDaemonLogs,
|
|
19967
|
+
DAEMON_API_KEY_ENV,
|
|
19968
|
+
scrubDaemonAuthEnv,
|
|
18269
19969
|
resolveWorkspaceDirectoryPath,
|
|
18270
19970
|
scanWorkspaceDirectories,
|
|
18271
19971
|
deleteWorkspaceDirectory,
|
|
19972
|
+
DAEMON_CORE_TRACE_ATTR_CONTRACTS,
|
|
18272
19973
|
DAEMON_CLI_USAGE,
|
|
18273
19974
|
parseDaemonCliArgs,
|
|
18274
19975
|
readDaemonVersion,
|