@botiverse/raft-daemon 1.0.4 → 1.0.6
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-7K62FEME.js → chunk-33F5EBC3.js} +424 -71
- package/dist/cli/index.js +635 -108
- package/dist/core.js +1 -1
- package/dist/{dist-WK22442Z.js → dist-RESRARWP.js} +623 -102
- package/dist/index.js +1 -1
- package/package.json +8 -7
package/dist/cli/index.js
CHANGED
|
@@ -28051,6 +28051,48 @@ function toCliError(err) {
|
|
|
28051
28051
|
return new InternalBugError(err);
|
|
28052
28052
|
}
|
|
28053
28053
|
|
|
28054
|
+
// src/core/io.ts
|
|
28055
|
+
init_esm_shims();
|
|
28056
|
+
function defaultCliIo() {
|
|
28057
|
+
return {
|
|
28058
|
+
stdin: process.stdin,
|
|
28059
|
+
stdout: process.stdout,
|
|
28060
|
+
stderr: process.stderr
|
|
28061
|
+
};
|
|
28062
|
+
}
|
|
28063
|
+
|
|
28064
|
+
// src/core/renderer.ts
|
|
28065
|
+
init_esm_shims();
|
|
28066
|
+
function renderError(io, err) {
|
|
28067
|
+
io.stderr.write(`Error: ${err.message}
|
|
28068
|
+
`);
|
|
28069
|
+
io.stderr.write(`Code: ${err.code}
|
|
28070
|
+
`);
|
|
28071
|
+
if (err.layer) {
|
|
28072
|
+
io.stderr.write(`Layer: ${err.layer}
|
|
28073
|
+
`);
|
|
28074
|
+
}
|
|
28075
|
+
if (err.correlationId) {
|
|
28076
|
+
io.stderr.write(`Correlation: ${err.correlationId}
|
|
28077
|
+
`);
|
|
28078
|
+
}
|
|
28079
|
+
if (err.draftSaved !== void 0) {
|
|
28080
|
+
io.stderr.write(`Draft saved: ${err.draftSaved ? "yes" : "no"}
|
|
28081
|
+
`);
|
|
28082
|
+
}
|
|
28083
|
+
if (err.suggestedNextAction) {
|
|
28084
|
+
io.stderr.write(`Next action: ${err.suggestedNextAction}
|
|
28085
|
+
`);
|
|
28086
|
+
}
|
|
28087
|
+
}
|
|
28088
|
+
function writeText(io, text) {
|
|
28089
|
+
io.stdout.write(text);
|
|
28090
|
+
}
|
|
28091
|
+
function writeJson(io, payload) {
|
|
28092
|
+
io.stdout.write(`${JSON.stringify(payload)}
|
|
28093
|
+
`);
|
|
28094
|
+
}
|
|
28095
|
+
|
|
28054
28096
|
// src/version.ts
|
|
28055
28097
|
init_esm_shims();
|
|
28056
28098
|
import { readFileSync } from "fs";
|
|
@@ -28082,9 +28124,6 @@ init_esm_shims();
|
|
|
28082
28124
|
// src/client.ts
|
|
28083
28125
|
init_esm_shims();
|
|
28084
28126
|
|
|
28085
|
-
// src/agentApiPath.ts
|
|
28086
|
-
init_esm_shims();
|
|
28087
|
-
|
|
28088
28127
|
// ../shared/src/index.ts
|
|
28089
28128
|
init_esm_shims();
|
|
28090
28129
|
|
|
@@ -28167,6 +28206,7 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
28167
28206
|
{ id: "moonshotai/kimi-k2-thinking-turbo", label: "Kimi K2 Thinking Turbo" },
|
|
28168
28207
|
{ id: "moonshotai/kimi-k2-0905-preview", label: "Kimi K2 0905" },
|
|
28169
28208
|
{ id: "moonshotai/kimi-k2-0711-preview", label: "Kimi K2 0711" },
|
|
28209
|
+
{ id: "moonshotai/kimi-k3", label: "Kimi K3" },
|
|
28170
28210
|
{ id: "moonshotai/kimi-k2.6", label: "Kimi K2.6" },
|
|
28171
28211
|
{ id: "moonshotai/kimi-k2.5", label: "Kimi K2.5" },
|
|
28172
28212
|
{ id: "moonshotai/kimi-k2-turbo-preview", label: "Kimi K2 Turbo" }
|
|
@@ -28178,6 +28218,7 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
28178
28218
|
{ id: "moonshotai-cn/kimi-k2-thinking-turbo", label: "Kimi K2 Thinking Turbo" },
|
|
28179
28219
|
{ id: "moonshotai-cn/kimi-k2-0905-preview", label: "Kimi K2 0905" },
|
|
28180
28220
|
{ id: "moonshotai-cn/kimi-k2-0711-preview", label: "Kimi K2 0711" },
|
|
28221
|
+
{ id: "moonshotai-cn/kimi-k3", label: "Kimi K3" },
|
|
28181
28222
|
{ id: "moonshotai-cn/kimi-k2.6", label: "Kimi K2.6" },
|
|
28182
28223
|
{ id: "moonshotai-cn/kimi-k2.5", label: "Kimi K2.5" },
|
|
28183
28224
|
{ id: "moonshotai-cn/kimi-k2-turbo-preview", label: "Kimi K2 Turbo" }
|
|
@@ -28185,7 +28226,9 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
28185
28226
|
"kimi-coding": [
|
|
28186
28227
|
{ id: "kimi-coding/kimi-k2-thinking", label: "Kimi K2 Thinking" },
|
|
28187
28228
|
{ id: "kimi-coding/k2p7", label: "Kimi K2.7 Code" },
|
|
28188
|
-
{ id: "kimi-coding/
|
|
28229
|
+
{ id: "kimi-coding/k3", label: "Kimi K3" },
|
|
28230
|
+
{ id: "kimi-coding/kimi-for-coding", label: "Kimi For Coding" },
|
|
28231
|
+
{ id: "kimi-coding/kimi-for-coding-highspeed", label: "Kimi For Coding HighSpeed" }
|
|
28189
28232
|
],
|
|
28190
28233
|
"openrouter": [
|
|
28191
28234
|
{ id: "openrouter/anthropic/claude-fable-5", label: "Anthropic: Claude Fable 5" },
|
|
@@ -28208,11 +28251,15 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
28208
28251
|
{ id: "openrouter/anthropic/claude-3-haiku", label: "Anthropic: Claude 3 Haiku" },
|
|
28209
28252
|
{ id: "openrouter/~anthropic/claude-haiku-latest", label: "Anthropic Claude Haiku Latest" },
|
|
28210
28253
|
{ id: "openrouter/openai/gpt-5.1-codex-max", label: "OpenAI: GPT-5.1-Codex-Max" },
|
|
28254
|
+
{ id: "openrouter/kwaipilot/kat-coder-pro-v2.5", label: "Kwaipilot: KAT-Coder-Pro V2.5" },
|
|
28211
28255
|
{ id: "openrouter/kwaipilot/kat-coder-pro-v2", label: "Kwaipilot: KAT-Coder-Pro V2" },
|
|
28212
28256
|
{ id: "openrouter/qwen/qwen3-max-thinking", label: "Qwen: Qwen3 Max Thinking" },
|
|
28213
28257
|
{ id: "openrouter/nvidia/nemotron-3-ultra-550b-a55b", label: "NVIDIA: Nemotron 3 Ultra" },
|
|
28214
28258
|
{ id: "openrouter/google/gemini-2.5-pro-preview", label: "Google: Gemini 2.5 Pro Preview 06-05" },
|
|
28215
28259
|
{ id: "openrouter/google/gemini-2.5-pro-preview-05-06", label: "Google: Gemini 2.5 Pro Preview 05-06" },
|
|
28260
|
+
{ id: "openrouter/openai/gpt-5.6-luna-pro", label: "OpenAI: GPT-5.6 Luna Pro" },
|
|
28261
|
+
{ id: "openrouter/openai/gpt-5.6-sol-pro", label: "OpenAI: GPT-5.6 Sol Pro" },
|
|
28262
|
+
{ id: "openrouter/openai/gpt-5.6-terra-pro", label: "OpenAI: GPT-5.6 Terra Pro" },
|
|
28216
28263
|
{ id: "openrouter/openai/gpt-5.5-pro", label: "OpenAI: GPT-5.5 Pro" },
|
|
28217
28264
|
{ id: "openrouter/openai/gpt-5.4-pro", label: "OpenAI: GPT-5.4 Pro" },
|
|
28218
28265
|
{ id: "openrouter/openai/gpt-5.2-pro", label: "OpenAI: GPT-5.2 Pro" },
|
|
@@ -28227,6 +28274,7 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
28227
28274
|
{ id: "openrouter/upstage/solar-pro-3", label: "Upstage: Solar Pro 3" },
|
|
28228
28275
|
{ id: "openrouter/google/gemini-2.5-pro", label: "Google: Gemini 2.5 Pro" },
|
|
28229
28276
|
{ id: "openrouter/xiaomi/mimo-v2.5-pro", label: "Xiaomi: MiMo-V2.5-Pro" },
|
|
28277
|
+
{ id: "openrouter/nex-agi/nex-n2-pro", label: "Nex AGI: Nex-N2-Pro" },
|
|
28230
28278
|
{ id: "openrouter/amazon/nova-premier-v1", label: "Amazon: Nova Premier 1.0" },
|
|
28231
28279
|
{ id: "openrouter/amazon/nova-pro-v1", label: "Amazon: Nova Pro 1.0" },
|
|
28232
28280
|
{ id: "openrouter/~google/gemini-pro-latest", label: "Google Gemini Pro Latest" },
|
|
@@ -28241,6 +28289,7 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
28241
28289
|
{ id: "openrouter/qwen/qwen3-coder-next", label: "Qwen: Qwen3 Coder Next" },
|
|
28242
28290
|
{ id: "openrouter/qwen/qwen3-coder-plus", label: "Qwen: Qwen3 Coder Plus" },
|
|
28243
28291
|
{ id: "openrouter/moonshotai/kimi-k2.7-code", label: "MoonshotAI: Kimi K2.7 Code" },
|
|
28292
|
+
{ id: "openrouter/kwaipilot/kat-coder-air-v2.5", label: "Kwaipilot: KAT-Coder-Air V2.5" },
|
|
28244
28293
|
{ id: "openrouter/qwen/qwen3-235b-a22b-thinking-2507", label: "Qwen: Qwen3 235B A22B Thinking 2507" },
|
|
28245
28294
|
{ id: "openrouter/qwen/qwen3-30b-a3b-thinking-2507", label: "Qwen: Qwen3 30B A3B Thinking 2507" },
|
|
28246
28295
|
{ id: "openrouter/qwen/qwen-plus-2025-07-28:thinking", label: "Qwen: Qwen Plus 0728 (thinking)" },
|
|
@@ -28313,6 +28362,9 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
28313
28362
|
{ id: "openrouter/qwen/qwen3-8b", label: "Qwen: Qwen3 8B" },
|
|
28314
28363
|
{ id: "openrouter/qwen/qwen3-vl-8b-instruct", label: "Qwen: Qwen3 VL 8B Instruct" },
|
|
28315
28364
|
{ id: "openrouter/qwen/qwen-2.5-7b-instruct", label: "Qwen: Qwen2.5 7B Instruct" },
|
|
28365
|
+
{ id: "openrouter/openai/gpt-5.6-luna", label: "OpenAI: GPT-5.6 Luna" },
|
|
28366
|
+
{ id: "openrouter/openai/gpt-5.6-sol", label: "OpenAI: GPT-5.6 Sol" },
|
|
28367
|
+
{ id: "openrouter/openai/gpt-5.6-terra", label: "OpenAI: GPT-5.6 Terra" },
|
|
28316
28368
|
{ id: "openrouter/openai/gpt-5.5", label: "OpenAI: GPT-5.5" },
|
|
28317
28369
|
{ id: "openrouter/openai/gpt-5.4", label: "OpenAI: GPT-5.4" },
|
|
28318
28370
|
{ id: "openrouter/openai/gpt-5.3-chat", label: "OpenAI: GPT-5.3 Chat" },
|
|
@@ -28328,6 +28380,7 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
28328
28380
|
{ id: "openrouter/z-ai/glm-4.7", label: "Z.ai: GLM 4.7" },
|
|
28329
28381
|
{ id: "openrouter/z-ai/glm-4.6", label: "Z.ai: GLM 4.6" },
|
|
28330
28382
|
{ id: "openrouter/z-ai/glm-4.6v", label: "Z.ai: GLM 4.6V" },
|
|
28383
|
+
{ id: "openrouter/x-ai/grok-4.5", label: "xAI: Grok 4.5" },
|
|
28331
28384
|
{ id: "openrouter/z-ai/glm-4.5", label: "Z.ai: GLM 4.5" },
|
|
28332
28385
|
{ id: "openrouter/z-ai/glm-4.5-air", label: "Z.ai: GLM 4.5 Air" },
|
|
28333
28386
|
{ id: "openrouter/z-ai/glm-4.5v", label: "Z.ai: GLM 4.5V" },
|
|
@@ -28348,11 +28401,14 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
28348
28401
|
{ id: "openrouter/deepseek/deepseek-chat-v3.1", label: "DeepSeek: DeepSeek V3.1" },
|
|
28349
28402
|
{ id: "openrouter/deepseek/deepseek-v3.1-terminus", label: "DeepSeek: DeepSeek V3.1 Terminus" },
|
|
28350
28403
|
{ id: "openrouter/mistralai/mistral-medium-3.1", label: "Mistral: Mistral Medium 3.1" },
|
|
28404
|
+
{ id: "openrouter/aion-labs/aion-3.0", label: "AionLabs: Aion-3.0" },
|
|
28351
28405
|
{ id: "openrouter/deepseek/deepseek-chat", label: "DeepSeek: DeepSeek V3" },
|
|
28352
28406
|
{ id: "openrouter/minimax/minimax-m3", label: "MiniMax: MiniMax M3" },
|
|
28353
28407
|
{ id: "openrouter/mistralai/mistral-medium-3", label: "Mistral: Mistral Medium 3" },
|
|
28408
|
+
{ id: "openrouter/moonshotai/kimi-k3", label: "MoonshotAI: Kimi K3" },
|
|
28354
28409
|
{ id: "openrouter/openai/o3", label: "OpenAI: o3" },
|
|
28355
28410
|
{ id: "openrouter/openai/o3-deep-research", label: "OpenAI: o3 Deep Research" },
|
|
28411
|
+
{ id: "openrouter/tencent/hy3", label: "Tencent: Hy3" },
|
|
28356
28412
|
{ id: "openrouter/tencent/hy3-preview", label: "Tencent: Hy3 preview" },
|
|
28357
28413
|
{ id: "openrouter/minimax/minimax-m2.7", label: "MiniMax: MiniMax M2.7" },
|
|
28358
28414
|
{ id: "openrouter/inclusionai/ling-2.6-1t", label: "inclusionAI: Ling-2.6-1T" },
|
|
@@ -28362,10 +28418,12 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
28362
28418
|
{ id: "openrouter/moonshotai/kimi-k2.5", label: "MoonshotAI: Kimi K2.5" },
|
|
28363
28419
|
{ id: "openrouter/xiaomi/mimo-v2.5", label: "Xiaomi: MiMo-V2.5" },
|
|
28364
28420
|
{ id: "openrouter/minimax/minimax-m2.1", label: "MiniMax: MiniMax M2.1" },
|
|
28421
|
+
{ id: "openrouter/poolside/laguna-xs-2.1", label: "Poolside: Laguna XS 2.1" },
|
|
28422
|
+
{ id: "openrouter/aion-labs/aion-2.0", label: "AionLabs: Aion-2.0" },
|
|
28365
28423
|
{ id: "openrouter/inception/mercury-2", label: "Inception: Mercury 2" },
|
|
28366
28424
|
{ id: "openrouter/minimax/minimax-m2", label: "MiniMax: MiniMax M2" },
|
|
28367
|
-
{ id: "openrouter/poolside/laguna-xs.2", label: "Poolside: Laguna XS.2" },
|
|
28368
28425
|
{ id: "openrouter/bytedance-seed/seed-1.6", label: "ByteDance Seed: Seed 1.6" },
|
|
28426
|
+
{ id: "openrouter/meta/muse-spark-1.1", label: "Meta: Muse Spark 1.1" },
|
|
28369
28427
|
{ id: "openrouter/deepseek/deepseek-r1", label: "DeepSeek: R1" },
|
|
28370
28428
|
{ id: "openrouter/minimax/minimax-m1", label: "MiniMax: MiniMax M1" },
|
|
28371
28429
|
{ id: "openrouter/openai/o1", label: "OpenAI: o1" },
|
|
@@ -28383,7 +28441,7 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
28383
28441
|
{ id: "openrouter/qwen/qwen-plus", label: "Qwen: Qwen-Plus" },
|
|
28384
28442
|
{ id: "openrouter/rekaai/reka-edge", label: "Reka Edge" },
|
|
28385
28443
|
{ id: "openrouter/relace/relace-search", label: "Relace: Relace Search" },
|
|
28386
|
-
{ id: "openrouter/
|
|
28444
|
+
{ id: "openrouter/~x-ai/grok-latest", label: "xAI: Grok Latest" },
|
|
28387
28445
|
{ id: "openrouter/openai/gpt-3.5-turbo-0613", label: "OpenAI: GPT-3.5 Turbo (older v0613)" },
|
|
28388
28446
|
{ id: "openrouter/openai/gpt-3.5-turbo-16k", label: "OpenAI: GPT-3.5 Turbo 16k" },
|
|
28389
28447
|
{ id: "openrouter/z-ai/glm-5-turbo", label: "Z.ai: GLM 5 Turbo" },
|
|
@@ -28416,28 +28474,28 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
28416
28474
|
{ id: "openrouter/openai/o4-mini", label: "OpenAI: o4 Mini" },
|
|
28417
28475
|
{ id: "openrouter/openai/o4-mini-deep-research", label: "OpenAI: o4 Mini Deep Research" },
|
|
28418
28476
|
{ id: "openrouter/openai/o4-mini-high", label: "OpenAI: o4 Mini High" },
|
|
28477
|
+
{ id: "openrouter/aion-labs/aion-3.0-mini", label: "AionLabs: Aion-3.0-Mini" },
|
|
28419
28478
|
{ id: "openrouter/openai/o3-mini", label: "OpenAI: o3 Mini" },
|
|
28420
28479
|
{ id: "openrouter/openai/o3-mini-high", label: "OpenAI: o3 Mini High" },
|
|
28421
28480
|
{ id: "openrouter/amazon/nova-2-lite-v1", label: "Amazon: Nova 2 Lite" },
|
|
28422
28481
|
{ id: "openrouter/bytedance-seed/seed-2.0-lite", label: "ByteDance Seed: Seed-2.0-Lite" },
|
|
28423
28482
|
{ id: "openrouter/bytedance-seed/seed-2.0-mini", label: "ByteDance Seed: Seed-2.0-Mini" },
|
|
28483
|
+
{ id: "openrouter/nex-agi/nex-n2-mini", label: "Nex AGI: Nex-N2-Mini" },
|
|
28424
28484
|
{ id: "openrouter/amazon/nova-lite-v1", label: "Amazon: Nova Lite 1.0" },
|
|
28425
28485
|
{ id: "openrouter/amazon/nova-micro-v1", label: "Amazon: Nova Micro 1.0" },
|
|
28426
|
-
{ id: "openrouter/arcee-ai/trinity-mini", label: "Arcee AI: Trinity Mini" },
|
|
28427
28486
|
{ id: "openrouter/cohere/north-mini-code:free", label: "Cohere: North Mini Code (free)" },
|
|
28428
28487
|
{ id: "openrouter/~openai/gpt-mini-latest", label: "OpenAI GPT Mini Latest" },
|
|
28429
28488
|
{ id: "openrouter/openai/gpt-audio-mini", label: "OpenAI: GPT Audio Mini" },
|
|
28430
|
-
{ id: "openrouter/openai/gpt-oss-120b:free", label: "OpenAI: gpt-oss-120b (free)" },
|
|
28431
28489
|
{ id: "openrouter/qwen/qwen3-next-80b-a3b-instruct:free", label: "Qwen: Qwen3 Next 80B A3B Instruct (free)" },
|
|
28432
28490
|
{ id: "openrouter/meta-llama/llama-3.3-70b-instruct:free", label: "Meta: Llama 3.3 70B Instruct (free)" },
|
|
28433
28491
|
{ id: "openrouter/google/gemma-4-31b-it:free", label: "Google: Gemma 4 31B (free)" },
|
|
28434
28492
|
{ id: "openrouter/nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free", label: "NVIDIA: Nemotron 3 Nano Omni (free)" },
|
|
28435
28493
|
{ id: "openrouter/google/gemma-4-26b-a4b-it:free", label: "Google: Gemma 4 26B A4B (free)" },
|
|
28436
28494
|
{ id: "openrouter/openai/gpt-oss-20b:free", label: "OpenAI: gpt-oss-20b (free)" },
|
|
28437
|
-
{ id: "openrouter/
|
|
28495
|
+
{ id: "openrouter/tencent/hy3:free", label: "Tencent: Hy3 (free)" },
|
|
28496
|
+
{ id: "openrouter/poolside/laguna-xs-2.1:free", label: "Poolside: Laguna XS 2.1 (free)" },
|
|
28438
28497
|
{ id: "openrouter/poolside/laguna-m.1:free", label: "Poolside: Laguna M.1 (free)" },
|
|
28439
28498
|
{ id: "openrouter/openrouter/free", label: "Free Models Router" },
|
|
28440
|
-
{ id: "openrouter/google/gemini-2.5-flash-lite-preview-09-2025", label: "Google: Gemini 2.5 Flash Lite Preview 09-2025" },
|
|
28441
28499
|
{ id: "openrouter/google/gemini-3.1-flash-lite", label: "Google: Gemini 3.1 Flash Lite" },
|
|
28442
28500
|
{ id: "openrouter/google/gemini-3.1-flash-lite-preview", label: "Google: Gemini 3.1 Flash Lite Preview" },
|
|
28443
28501
|
{ id: "openrouter/google/gemini-2.5-flash-lite", label: "Google: Gemini 2.5 Flash Lite" },
|
|
@@ -28462,6 +28520,9 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
28462
28520
|
{ id: "openai/gpt-4o-2024-11-20", label: "GPT-4o (2024-11-20)" },
|
|
28463
28521
|
{ id: "openai/gpt-4o-2024-08-06", label: "GPT-4o (2024-08-06)" },
|
|
28464
28522
|
{ id: "openai/gpt-4o-2024-05-13", label: "GPT-4o (2024-05-13)" },
|
|
28523
|
+
{ id: "openai/gpt-5.6-luna", label: "GPT-5.6 Luna" },
|
|
28524
|
+
{ id: "openai/gpt-5.6-sol", label: "GPT-5.6 Sol" },
|
|
28525
|
+
{ id: "openai/gpt-5.6-terra", label: "GPT-5.6 Terra" },
|
|
28465
28526
|
{ id: "openai/gpt-5.5", label: "GPT-5.5" },
|
|
28466
28527
|
{ id: "openai/gpt-5.4", label: "GPT-5.4" },
|
|
28467
28528
|
{ id: "openai/gpt-5.3-chat-latest", label: "GPT-5.3 Chat (latest)" },
|
|
@@ -28476,6 +28537,7 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
28476
28537
|
{ id: "openai/gpt-4o", label: "GPT-4o" },
|
|
28477
28538
|
{ id: "openai/o3", label: "o3" },
|
|
28478
28539
|
{ id: "openai/o3-deep-research", label: "o3-deep-research" },
|
|
28540
|
+
{ id: "openai/gpt-realtime-2.1", label: "GPT-Realtime-2.1" },
|
|
28479
28541
|
{ id: "openai/o1", label: "o1" },
|
|
28480
28542
|
{ id: "openai/gpt-4-turbo", label: "GPT-4 Turbo" },
|
|
28481
28543
|
{ id: "openai/gpt-5.4-mini", label: "GPT-5.4 mini" },
|
|
@@ -28491,8 +28553,6 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
28491
28553
|
],
|
|
28492
28554
|
"anthropic": [
|
|
28493
28555
|
{ id: "anthropic/claude-fable-5", label: "Claude Fable 5" },
|
|
28494
|
-
{ id: "anthropic/claude-3-opus-20240229", label: "Claude Opus 3" },
|
|
28495
|
-
{ id: "anthropic/claude-opus-4-20250514", label: "Claude Opus 4" },
|
|
28496
28556
|
{ id: "anthropic/claude-opus-4-5-20251101", label: "Claude Opus 4.5" },
|
|
28497
28557
|
{ id: "anthropic/claude-opus-4-1-20250805", label: "Claude Opus 4.1" },
|
|
28498
28558
|
{ id: "anthropic/claude-opus-4-8", label: "Claude Opus 4.8" },
|
|
@@ -28500,18 +28560,10 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
28500
28560
|
{ id: "anthropic/claude-opus-4-6", label: "Claude Opus 4.6" },
|
|
28501
28561
|
{ id: "anthropic/claude-opus-4-5", label: "Claude Opus 4.5 (latest)" },
|
|
28502
28562
|
{ id: "anthropic/claude-opus-4-1", label: "Claude Opus 4.1 (latest)" },
|
|
28503
|
-
{ id: "anthropic/claude-opus-4-0", label: "Claude Opus 4 (latest)" },
|
|
28504
|
-
{ id: "anthropic/claude-3-7-sonnet-20250219", label: "Claude Sonnet 3.7" },
|
|
28505
|
-
{ id: "anthropic/claude-3-5-sonnet-20241022", label: "Claude Sonnet 3.5 v2" },
|
|
28506
|
-
{ id: "anthropic/claude-3-5-sonnet-20240620", label: "Claude Sonnet 3.5" },
|
|
28507
|
-
{ id: "anthropic/claude-3-sonnet-20240229", label: "Claude Sonnet 3" },
|
|
28508
|
-
{ id: "anthropic/claude-sonnet-4-20250514", label: "Claude Sonnet 4" },
|
|
28509
28563
|
{ id: "anthropic/claude-sonnet-4-5-20250929", label: "Claude Sonnet 4.5" },
|
|
28510
28564
|
{ id: "anthropic/claude-sonnet-5", label: "Claude Sonnet 5" },
|
|
28511
28565
|
{ id: "anthropic/claude-sonnet-4-6", label: "Claude Sonnet 4.6" },
|
|
28512
28566
|
{ id: "anthropic/claude-sonnet-4-5", label: "Claude Sonnet 4.5 (latest)" },
|
|
28513
|
-
{ id: "anthropic/claude-sonnet-4-0", label: "Claude Sonnet 4 (latest)" },
|
|
28514
|
-
{ id: "anthropic/claude-3-haiku-20240307", label: "Claude Haiku 3" },
|
|
28515
28567
|
{ id: "anthropic/claude-haiku-4-5-20251001", label: "Claude Haiku 4.5" },
|
|
28516
28568
|
{ id: "anthropic/claude-haiku-4-5", label: "Claude Haiku 4.5 (latest)" }
|
|
28517
28569
|
],
|
|
@@ -28534,13 +28586,9 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
28534
28586
|
{ id: "google/gemini-flash-lite-latest", label: "Gemini Flash-Lite Latest" }
|
|
28535
28587
|
],
|
|
28536
28588
|
"xai": [
|
|
28537
|
-
{ id: "xai/grok-4.
|
|
28538
|
-
{ id: "xai/grok-4.20-0309-reasoning", label: "Grok 4.20 (Reasoning)" },
|
|
28539
|
-
{ id: "xai/grok-code-fast-1", label: "Grok Code Fast 1" },
|
|
28589
|
+
{ id: "xai/grok-4.5", label: "Grok 4.5" },
|
|
28540
28590
|
{ id: "xai/grok-4.3", label: "Grok 4.3" },
|
|
28541
|
-
{ id: "xai/grok-
|
|
28542
|
-
{ id: "xai/grok-build-0.1", label: "Grok Build 0.1" },
|
|
28543
|
-
{ id: "xai/grok-3-fast", label: "Grok 3 Fast" }
|
|
28591
|
+
{ id: "xai/grok-build-0.1", label: "Grok Build 0.1" }
|
|
28544
28592
|
],
|
|
28545
28593
|
"xiaomi": [
|
|
28546
28594
|
{ id: "xiaomi/mimo-v2.5-pro", label: "MiMo-V2.5-Pro" },
|
|
@@ -28561,20 +28609,20 @@ var RUNTIME_PROVIDER_DISPLAY_NAMES = {
|
|
|
28561
28609
|
"anthropic": "Anthropic",
|
|
28562
28610
|
"deepseek": "DeepSeek",
|
|
28563
28611
|
"fusecode": "FuseCode",
|
|
28564
|
-
"google": "Google
|
|
28612
|
+
"google": "Google",
|
|
28565
28613
|
"kimi-coding": "Kimi For Coding",
|
|
28566
28614
|
"minimax": "MiniMax",
|
|
28567
|
-
"minimax-cn": "MiniMax
|
|
28615
|
+
"minimax-cn": "MiniMax CN",
|
|
28568
28616
|
"moonshotai": "Moonshot AI",
|
|
28569
|
-
"moonshotai-cn": "Moonshot AI
|
|
28617
|
+
"moonshotai-cn": "Moonshot AI CN",
|
|
28570
28618
|
"openai": "OpenAI",
|
|
28571
28619
|
"opencode": "OpenCode Zen",
|
|
28572
|
-
"opencode-go": "OpenCode Go",
|
|
28620
|
+
"opencode-go": "OpenCode Zen Go",
|
|
28573
28621
|
"openrouter": "OpenRouter",
|
|
28574
28622
|
"xai": "xAI",
|
|
28575
|
-
"xiaomi": "Xiaomi
|
|
28576
|
-
"zai": "
|
|
28577
|
-
"zai-coding-cn": "
|
|
28623
|
+
"xiaomi": "Xiaomi",
|
|
28624
|
+
"zai": "Z.AI",
|
|
28625
|
+
"zai-coding-cn": "Z.AI Coding CN"
|
|
28578
28626
|
};
|
|
28579
28627
|
|
|
28580
28628
|
// ../shared/src/runtimeProviderDisplay.ts
|
|
@@ -28646,6 +28694,30 @@ var SLOCK_REF_DM_PEER_PATTERN = String.raw`[\w-]+`;
|
|
|
28646
28694
|
var SLOCK_REF_THREAD_SHORT_ID_PATTERN = String.raw`[\da-f]{6,8}`;
|
|
28647
28695
|
var SLOCK_REF_MESSAGE_ID_PATTERN = String.raw`[A-Za-z0-9][A-Za-z0-9-]{1,63}`;
|
|
28648
28696
|
var SLOCK_REF_TASK_NUMBER_PATTERN = String.raw`[1-9]\d*`;
|
|
28697
|
+
function createSlockUserRefRegex() {
|
|
28698
|
+
return new RegExp(`@(${SLOCK_REF_USER_NAME_PATTERN})`, "gu");
|
|
28699
|
+
}
|
|
28700
|
+
function createSlockChannelThreadRefRegex() {
|
|
28701
|
+
return new RegExp(`#(${SLOCK_REF_CHANNEL_NAME_PATTERN}):(${SLOCK_REF_THREAD_SHORT_ID_PATTERN})`, "giu");
|
|
28702
|
+
}
|
|
28703
|
+
function createSlockChannelRefRegex() {
|
|
28704
|
+
return new RegExp(`#(${SLOCK_REF_CHANNEL_NAME_PATTERN})`, "gu");
|
|
28705
|
+
}
|
|
28706
|
+
function createSlockDmThreadRefRegex() {
|
|
28707
|
+
return new RegExp(`dm:@(${SLOCK_REF_DM_PEER_PATTERN}):(${SLOCK_REF_THREAD_SHORT_ID_PATTERN})`, "giu");
|
|
28708
|
+
}
|
|
28709
|
+
function createSlockDmRefRegex() {
|
|
28710
|
+
return new RegExp(`dm:@(${SLOCK_REF_DM_PEER_PATTERN})`, "giu");
|
|
28711
|
+
}
|
|
28712
|
+
function createSlockMessageRefRegex() {
|
|
28713
|
+
return new RegExp(
|
|
28714
|
+
`#(${SLOCK_REF_CHANNEL_NAME_PATTERN})(?::(${SLOCK_REF_THREAD_SHORT_ID_PATTERN}))?\\s+msg=(${SLOCK_REF_MESSAGE_ID_PATTERN})`,
|
|
28715
|
+
"giu"
|
|
28716
|
+
);
|
|
28717
|
+
}
|
|
28718
|
+
function createSlockBareTaskRefRegex() {
|
|
28719
|
+
return new RegExp(`(^|[^\\w/])(?:(task\\s+))?#(${SLOCK_REF_TASK_NUMBER_PATTERN})\\b`, "giu");
|
|
28720
|
+
}
|
|
28649
28721
|
var USER_RE = new RegExp(String.raw`^@(${SLOCK_REF_USER_NAME_PATTERN})$`, "u");
|
|
28650
28722
|
var CHANNEL_RE = new RegExp(String.raw`^#(${SLOCK_REF_CHANNEL_NAME_PATTERN})$`, "u");
|
|
28651
28723
|
var CHANNEL_THREAD_RE = new RegExp(
|
|
@@ -28666,9 +28738,267 @@ var DM_MESSAGE_RE = new RegExp(
|
|
|
28666
28738
|
String.raw`^dm:@(${SLOCK_REF_DM_PEER_PATTERN})(?::(${SLOCK_REF_THREAD_SHORT_ID_PATTERN}))?\s+msg=(${SLOCK_REF_MESSAGE_ID_PATTERN})$`,
|
|
28667
28739
|
"iu"
|
|
28668
28740
|
);
|
|
28741
|
+
function parseSlockRefTarget(rawTarget) {
|
|
28742
|
+
const target = rawTarget.trim();
|
|
28743
|
+
if (!target) return null;
|
|
28744
|
+
const channelMessage = CHANNEL_MESSAGE_RE.exec(target);
|
|
28745
|
+
if (channelMessage) {
|
|
28746
|
+
return {
|
|
28747
|
+
kind: "message",
|
|
28748
|
+
channelName: channelMessage[1],
|
|
28749
|
+
threadParentShortId: channelMessage[2] ?? null,
|
|
28750
|
+
messageId: channelMessage[3]
|
|
28751
|
+
};
|
|
28752
|
+
}
|
|
28753
|
+
const dmMessage = DM_MESSAGE_RE.exec(target);
|
|
28754
|
+
if (dmMessage) {
|
|
28755
|
+
return {
|
|
28756
|
+
kind: "dm-message",
|
|
28757
|
+
peerName: dmMessage[1],
|
|
28758
|
+
threadParentShortId: dmMessage[2] ?? null,
|
|
28759
|
+
messageId: dmMessage[3]
|
|
28760
|
+
};
|
|
28761
|
+
}
|
|
28762
|
+
const channelThread = CHANNEL_THREAD_RE.exec(target);
|
|
28763
|
+
if (channelThread) {
|
|
28764
|
+
return { kind: "channel-thread", channelName: channelThread[1], threadShortId: channelThread[2] };
|
|
28765
|
+
}
|
|
28766
|
+
const dmThread = DM_THREAD_RE.exec(target);
|
|
28767
|
+
if (dmThread) {
|
|
28768
|
+
return { kind: "dm-thread", peerName: dmThread[1], threadShortId: dmThread[2] };
|
|
28769
|
+
}
|
|
28770
|
+
const task = TASK_RE.exec(target);
|
|
28771
|
+
if (task) return { kind: "task", taskNumber: Number(task[1]) };
|
|
28772
|
+
const user = USER_RE.exec(target);
|
|
28773
|
+
if (user) return { kind: "user", name: user[1] };
|
|
28774
|
+
const channel = CHANNEL_RE.exec(target);
|
|
28775
|
+
if (channel) return { kind: "channel", channelName: channel[1] };
|
|
28776
|
+
const dm = DM_RE.exec(target);
|
|
28777
|
+
if (dm) return { kind: "dm", peerName: dm[1] };
|
|
28778
|
+
return null;
|
|
28779
|
+
}
|
|
28780
|
+
function formatSlockRefTarget(target) {
|
|
28781
|
+
switch (target.kind) {
|
|
28782
|
+
case "user":
|
|
28783
|
+
return `@${target.name}`;
|
|
28784
|
+
case "channel":
|
|
28785
|
+
return `#${target.channelName}`;
|
|
28786
|
+
case "channel-thread":
|
|
28787
|
+
return `#${target.channelName}:${target.threadShortId}`;
|
|
28788
|
+
case "dm":
|
|
28789
|
+
return `dm:@${target.peerName}`;
|
|
28790
|
+
case "dm-thread":
|
|
28791
|
+
return `dm:@${target.peerName}:${target.threadShortId}`;
|
|
28792
|
+
case "task":
|
|
28793
|
+
return `task #${target.taskNumber}`;
|
|
28794
|
+
case "message":
|
|
28795
|
+
return target.threadParentShortId ? `#${target.channelName}:${target.threadParentShortId} msg=${target.messageId}` : `#${target.channelName} msg=${target.messageId}`;
|
|
28796
|
+
case "dm-message":
|
|
28797
|
+
return target.threadParentShortId ? `dm:@${target.peerName}:${target.threadParentShortId} msg=${target.messageId}` : `dm:@${target.peerName} msg=${target.messageId}`;
|
|
28798
|
+
}
|
|
28799
|
+
}
|
|
28800
|
+
function markdownCodeSpans(source) {
|
|
28801
|
+
const spans = [];
|
|
28802
|
+
const fenced = /```[\s\S]*?```/g;
|
|
28803
|
+
for (const match of source.matchAll(fenced)) {
|
|
28804
|
+
spans.push({ start: match.index ?? 0, end: (match.index ?? 0) + match[0].length });
|
|
28805
|
+
}
|
|
28806
|
+
const inline = /``[^`]+``|`[^`]+`/g;
|
|
28807
|
+
for (const match of source.matchAll(inline)) {
|
|
28808
|
+
const start = match.index ?? 0;
|
|
28809
|
+
const end = start + match[0].length;
|
|
28810
|
+
if (!spans.some((span) => start >= span.start && end <= span.end)) {
|
|
28811
|
+
spans.push({ start, end });
|
|
28812
|
+
}
|
|
28813
|
+
}
|
|
28814
|
+
return spans.sort((a, b) => a.start - b.start);
|
|
28815
|
+
}
|
|
28816
|
+
function visitMarkdownProseChunks(source, visitor) {
|
|
28817
|
+
const spans = markdownCodeSpans(source);
|
|
28818
|
+
if (spans.length === 0) {
|
|
28819
|
+
visitor(source, 0);
|
|
28820
|
+
return;
|
|
28821
|
+
}
|
|
28822
|
+
let cursor = 0;
|
|
28823
|
+
for (const span of spans) {
|
|
28824
|
+
if (span.start > cursor) visitor(source.slice(cursor, span.start), cursor);
|
|
28825
|
+
cursor = span.end;
|
|
28826
|
+
}
|
|
28827
|
+
if (cursor < source.length) visitor(source.slice(cursor), cursor);
|
|
28828
|
+
}
|
|
28829
|
+
function collectParsedRef(refs, raw, start, end, dedupe) {
|
|
28830
|
+
const target = parseSlockRefTarget(raw);
|
|
28831
|
+
if (!target) return;
|
|
28832
|
+
const canonical = formatSlockRefTarget(target);
|
|
28833
|
+
refs.set(dedupe ? canonical : `${start}:${end}:${canonical}`, { raw, target, start, end });
|
|
28834
|
+
}
|
|
28835
|
+
function extractSlockRefTargetsFromChunk(chunk, chunkOffset, dedupe) {
|
|
28836
|
+
const refs = /* @__PURE__ */ new Map();
|
|
28837
|
+
const occupiedRanges = [];
|
|
28838
|
+
function occupy(match) {
|
|
28839
|
+
if (match.index === void 0) return;
|
|
28840
|
+
occupiedRanges.push({ start: match.index, end: match.index + match[0].length });
|
|
28841
|
+
}
|
|
28842
|
+
function isInsideOccupied(match, offset = 0) {
|
|
28843
|
+
if (match.index === void 0) return false;
|
|
28844
|
+
const start = match.index + offset;
|
|
28845
|
+
const end = start + match[0].length - offset;
|
|
28846
|
+
return occupiedRanges.some((range) => start >= range.start && end <= range.end);
|
|
28847
|
+
}
|
|
28848
|
+
for (const match of chunk.matchAll(new RegExp(String.raw`<([^<>\n]+)>`, "gu"))) {
|
|
28849
|
+
const raw = match[1] ?? "";
|
|
28850
|
+
const rawStart = (match.index ?? 0) + 1;
|
|
28851
|
+
collectParsedRef(refs, raw, chunkOffset + rawStart, chunkOffset + rawStart + raw.length, dedupe);
|
|
28852
|
+
occupy(match);
|
|
28853
|
+
}
|
|
28854
|
+
for (const match of chunk.matchAll(createSlockMessageRefRegex())) {
|
|
28855
|
+
collectParsedRef(
|
|
28856
|
+
refs,
|
|
28857
|
+
match[2] ? `#${match[1]}:${match[2]} msg=${match[3]}` : `#${match[1]} msg=${match[3]}`,
|
|
28858
|
+
chunkOffset + (match.index ?? 0),
|
|
28859
|
+
chunkOffset + (match.index ?? 0) + match[0].length,
|
|
28860
|
+
dedupe
|
|
28861
|
+
);
|
|
28862
|
+
occupy(match);
|
|
28863
|
+
}
|
|
28864
|
+
for (const match of chunk.matchAll(createSlockDmThreadRefRegex())) {
|
|
28865
|
+
collectParsedRef(
|
|
28866
|
+
refs,
|
|
28867
|
+
`dm:@${match[1]}:${match[2]}`,
|
|
28868
|
+
chunkOffset + (match.index ?? 0),
|
|
28869
|
+
chunkOffset + (match.index ?? 0) + match[0].length,
|
|
28870
|
+
dedupe
|
|
28871
|
+
);
|
|
28872
|
+
occupy(match);
|
|
28873
|
+
}
|
|
28874
|
+
for (const match of chunk.matchAll(createSlockDmRefRegex())) {
|
|
28875
|
+
if (isInsideOccupied(match)) continue;
|
|
28876
|
+
collectParsedRef(
|
|
28877
|
+
refs,
|
|
28878
|
+
`dm:@${match[1]}`,
|
|
28879
|
+
chunkOffset + (match.index ?? 0),
|
|
28880
|
+
chunkOffset + (match.index ?? 0) + match[0].length,
|
|
28881
|
+
dedupe
|
|
28882
|
+
);
|
|
28883
|
+
occupy(match);
|
|
28884
|
+
}
|
|
28885
|
+
for (const match of chunk.matchAll(createSlockChannelThreadRefRegex())) {
|
|
28886
|
+
if (isInsideOccupied(match)) continue;
|
|
28887
|
+
collectParsedRef(
|
|
28888
|
+
refs,
|
|
28889
|
+
`#${match[1]}:${match[2]}`,
|
|
28890
|
+
chunkOffset + (match.index ?? 0),
|
|
28891
|
+
chunkOffset + (match.index ?? 0) + match[0].length,
|
|
28892
|
+
dedupe
|
|
28893
|
+
);
|
|
28894
|
+
occupy(match);
|
|
28895
|
+
}
|
|
28896
|
+
for (const match of chunk.matchAll(createSlockBareTaskRefRegex())) {
|
|
28897
|
+
const raw = `task #${match[3]}`;
|
|
28898
|
+
const rawStart = (match.index ?? 0) + match[1].length;
|
|
28899
|
+
collectParsedRef(
|
|
28900
|
+
refs,
|
|
28901
|
+
raw,
|
|
28902
|
+
chunkOffset + rawStart,
|
|
28903
|
+
chunkOffset + rawStart + match[0].length - match[1].length,
|
|
28904
|
+
dedupe
|
|
28905
|
+
);
|
|
28906
|
+
occupy(match);
|
|
28907
|
+
}
|
|
28908
|
+
for (const match of chunk.matchAll(createSlockUserRefRegex())) {
|
|
28909
|
+
if (isInsideOccupied(match)) continue;
|
|
28910
|
+
collectParsedRef(
|
|
28911
|
+
refs,
|
|
28912
|
+
`@${match[1]}`,
|
|
28913
|
+
chunkOffset + (match.index ?? 0),
|
|
28914
|
+
chunkOffset + (match.index ?? 0) + match[0].length,
|
|
28915
|
+
dedupe
|
|
28916
|
+
);
|
|
28917
|
+
occupy(match);
|
|
28918
|
+
}
|
|
28919
|
+
for (const match of chunk.matchAll(createSlockChannelRefRegex())) {
|
|
28920
|
+
if (isInsideOccupied(match)) continue;
|
|
28921
|
+
collectParsedRef(
|
|
28922
|
+
refs,
|
|
28923
|
+
`#${match[1]}`,
|
|
28924
|
+
chunkOffset + (match.index ?? 0),
|
|
28925
|
+
chunkOffset + (match.index ?? 0) + match[0].length,
|
|
28926
|
+
dedupe
|
|
28927
|
+
);
|
|
28928
|
+
occupy(match);
|
|
28929
|
+
}
|
|
28930
|
+
return refs;
|
|
28931
|
+
}
|
|
28932
|
+
function extractSlockRefTargets(source, options = {}) {
|
|
28933
|
+
const refs = /* @__PURE__ */ new Map();
|
|
28934
|
+
const dedupe = options.dedupe ?? true;
|
|
28935
|
+
const collectChunk = (chunk, offset) => {
|
|
28936
|
+
const chunkRefs = extractSlockRefTargetsFromChunk(chunk, offset, dedupe);
|
|
28937
|
+
for (const [key, value] of chunkRefs) refs.set(key, value);
|
|
28938
|
+
};
|
|
28939
|
+
if (options.includeMarkdownCode) {
|
|
28940
|
+
collectChunk(source, 0);
|
|
28941
|
+
} else {
|
|
28942
|
+
visitMarkdownProseChunks(source, collectChunk);
|
|
28943
|
+
}
|
|
28944
|
+
return [...refs.values()].sort((a, b) => a.start - b.start || a.end - b.end);
|
|
28945
|
+
}
|
|
28669
28946
|
|
|
28670
28947
|
// ../shared/src/thirdPartyInertRenderer.ts
|
|
28671
28948
|
init_esm_shims();
|
|
28949
|
+
function escapeAgentMarkupLiterals(value) {
|
|
28950
|
+
return value.replace(/<\/?(?:result|preview|match)\b[^>]*>|<omit\s*\/>/gi, (tag) => tag.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"));
|
|
28951
|
+
}
|
|
28952
|
+
function neutralizeSlockRefLiterals(value) {
|
|
28953
|
+
const refs = extractSlockRefTargets(value, { dedupe: false, includeMarkdownCode: true }).filter((ref) => ref.start < ref.end).sort((a, b) => a.start - b.start || b.end - a.end);
|
|
28954
|
+
if (refs.length === 0) return value;
|
|
28955
|
+
let output = "";
|
|
28956
|
+
let cursor = 0;
|
|
28957
|
+
for (let index = 0; index < refs.length; ) {
|
|
28958
|
+
const first = refs[index];
|
|
28959
|
+
if (first.start < cursor) {
|
|
28960
|
+
index++;
|
|
28961
|
+
continue;
|
|
28962
|
+
}
|
|
28963
|
+
const cluster = [first];
|
|
28964
|
+
let clusterEnd = first.end;
|
|
28965
|
+
index++;
|
|
28966
|
+
while (index < refs.length && refs[index].start < clusterEnd) {
|
|
28967
|
+
const next = refs[index];
|
|
28968
|
+
cluster.push(next);
|
|
28969
|
+
clusterEnd = Math.max(clusterEnd, next.end);
|
|
28970
|
+
index++;
|
|
28971
|
+
}
|
|
28972
|
+
output += value.slice(cursor, first.start);
|
|
28973
|
+
output += cluster.map((ref) => neutralSlockRefLabel(ref.target)).join(" ");
|
|
28974
|
+
cursor = clusterEnd;
|
|
28975
|
+
}
|
|
28976
|
+
output += value.slice(cursor);
|
|
28977
|
+
return output;
|
|
28978
|
+
}
|
|
28979
|
+
function neutralSlockRefLabel(target) {
|
|
28980
|
+
switch (target.kind) {
|
|
28981
|
+
case "user":
|
|
28982
|
+
return `user:${target.name}`;
|
|
28983
|
+
case "channel":
|
|
28984
|
+
return `channel:${target.channelName}`;
|
|
28985
|
+
case "channel-thread":
|
|
28986
|
+
return `channel:${target.channelName}:${target.threadShortId}`;
|
|
28987
|
+
case "dm":
|
|
28988
|
+
return `dm:user:${target.peerName}`;
|
|
28989
|
+
case "dm-thread":
|
|
28990
|
+
return `dm:user:${target.peerName}:${target.threadShortId}`;
|
|
28991
|
+
case "task":
|
|
28992
|
+
return `task:${target.taskNumber}`;
|
|
28993
|
+
case "message":
|
|
28994
|
+
return target.threadParentShortId ? `channel:${target.channelName}:${target.threadParentShortId} msg=${target.messageId}` : `channel:${target.channelName} msg=${target.messageId}`;
|
|
28995
|
+
case "dm-message":
|
|
28996
|
+
return target.threadParentShortId ? `dm:user:${target.peerName}:${target.threadParentShortId} msg=${target.messageId}` : `dm:user:${target.peerName} msg=${target.messageId}`;
|
|
28997
|
+
}
|
|
28998
|
+
}
|
|
28999
|
+
function renderThirdPartyInertJson(value) {
|
|
29000
|
+
return neutralizeSlockRefLiterals(escapeAgentMarkupLiterals(JSON.stringify(value, null, 2)));
|
|
29001
|
+
}
|
|
28672
29002
|
|
|
28673
29003
|
// ../shared/src/producerFactLineage.ts
|
|
28674
29004
|
init_esm_shims();
|
|
@@ -43107,6 +43437,53 @@ init_esm_shims();
|
|
|
43107
43437
|
var ATTENTION_HINT_SCHEMA = "attention-dependency-hint.v1";
|
|
43108
43438
|
var ATTENTION_HINT_DEFAULT_WINDOW_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
43109
43439
|
|
|
43440
|
+
// ../shared/src/knowledgeContext.ts
|
|
43441
|
+
init_esm_shims();
|
|
43442
|
+
var MIN_KNOWLEDGE_CONTEXT_LENGTH = 12;
|
|
43443
|
+
var MAX_KNOWLEDGE_CONTEXT_LENGTH = 500;
|
|
43444
|
+
var RAFT_CLIENT_CAPABILITIES_HEADER = "X-Raft-Client-Capabilities";
|
|
43445
|
+
var MANUAL_CONTEXT_CAPABILITY = "manual-context-v1";
|
|
43446
|
+
var MANUAL_INDEX_COMMAND = 'raft manual get index --intent "Learn available Raft workflows" --reason "Browse the topic catalog after a missing topic"';
|
|
43447
|
+
function validateKnowledgeContext(raw, field) {
|
|
43448
|
+
if (raw === void 0 || raw === null || raw === "") {
|
|
43449
|
+
return { ok: false, value: null, error: `${field} is required` };
|
|
43450
|
+
}
|
|
43451
|
+
if (typeof raw !== "string") {
|
|
43452
|
+
return { ok: false, value: null, error: `${field} must be a string` };
|
|
43453
|
+
}
|
|
43454
|
+
const value = raw.trim();
|
|
43455
|
+
if (value.length < MIN_KNOWLEDGE_CONTEXT_LENGTH) {
|
|
43456
|
+
return {
|
|
43457
|
+
ok: false,
|
|
43458
|
+
value: null,
|
|
43459
|
+
error: `${field} must be at least ${MIN_KNOWLEDGE_CONTEXT_LENGTH} characters`
|
|
43460
|
+
};
|
|
43461
|
+
}
|
|
43462
|
+
if (value.length > MAX_KNOWLEDGE_CONTEXT_LENGTH) {
|
|
43463
|
+
return {
|
|
43464
|
+
ok: false,
|
|
43465
|
+
value: null,
|
|
43466
|
+
error: `${field} must be at most ${MAX_KNOWLEDGE_CONTEXT_LENGTH} characters`
|
|
43467
|
+
};
|
|
43468
|
+
}
|
|
43469
|
+
const unsafeError = classifyUnsafeKnowledgeContext(value, field);
|
|
43470
|
+
if (unsafeError) return { ok: false, value: null, error: unsafeError };
|
|
43471
|
+
return { ok: true, value };
|
|
43472
|
+
}
|
|
43473
|
+
function classifyUnsafeKnowledgeContext(value, field) {
|
|
43474
|
+
if (/\[target=.*\bmsg=/.test(value)) return `${field} must not contain raw Slock message headers`;
|
|
43475
|
+
if (/```[\s\S]*```/.test(value)) return `${field} must not contain raw prompts or code blocks`;
|
|
43476
|
+
if (/https?:\/\//i.test(value)) return `${field} must not contain URLs`;
|
|
43477
|
+
if (/\bsk_(?:agent|machine|computer)_[a-z0-9_-]+\b/i.test(value)) {
|
|
43478
|
+
return `${field} must not contain credentials`;
|
|
43479
|
+
}
|
|
43480
|
+
if (/\bBearer\s+\S+/i.test(value) || /\b(?:api[_ -]?key|token|password|secret)\s*[:=]\s*\S+/i.test(value)) {
|
|
43481
|
+
return `${field} must not contain credentials`;
|
|
43482
|
+
}
|
|
43483
|
+
if (value.split(/\r?\n/).length > 4) return `${field} must be a concise natural-language summary`;
|
|
43484
|
+
return null;
|
|
43485
|
+
}
|
|
43486
|
+
|
|
43110
43487
|
// ../shared/src/agentApiContract.ts
|
|
43111
43488
|
var AGENT_API_BASE_PATH = "/internal/agent-api";
|
|
43112
43489
|
var optionalStringSchema = external_exports.string().trim().optional();
|
|
@@ -43136,7 +43513,11 @@ var agentApiHistoryQuerySchema = passthroughObject({
|
|
|
43136
43513
|
});
|
|
43137
43514
|
var agentApiKnowledgeGetQuerySchema = passthroughObject({
|
|
43138
43515
|
topic: external_exports.string().trim().min(1),
|
|
43139
|
-
|
|
43516
|
+
// Optional at the transport schema during the staged rollout. The current
|
|
43517
|
+
// CLI advertises manual-context-v1 and requires both before sending; the
|
|
43518
|
+
// server keeps legacy published clients compatible until the fleet gate.
|
|
43519
|
+
intent: external_exports.string().trim().min(MIN_KNOWLEDGE_CONTEXT_LENGTH).max(MAX_KNOWLEDGE_CONTEXT_LENGTH).optional(),
|
|
43520
|
+
reason: external_exports.string().trim().min(MIN_KNOWLEDGE_CONTEXT_LENGTH).max(MAX_KNOWLEDGE_CONTEXT_LENGTH).optional(),
|
|
43140
43521
|
turn_id: optionalStringSchema,
|
|
43141
43522
|
trace_id: optionalStringSchema
|
|
43142
43523
|
});
|
|
@@ -43152,7 +43533,8 @@ var agentApiKnowledgeGetResponseSchema = passthroughObject({
|
|
|
43152
43533
|
var agentApiKnowledgeSearchQuerySchema = passthroughObject({
|
|
43153
43534
|
query: external_exports.string().trim().min(1),
|
|
43154
43535
|
scope: optionalStringSchema,
|
|
43155
|
-
|
|
43536
|
+
intent: external_exports.string().trim().min(MIN_KNOWLEDGE_CONTEXT_LENGTH).max(MAX_KNOWLEDGE_CONTEXT_LENGTH).optional(),
|
|
43537
|
+
reason: external_exports.string().trim().min(MIN_KNOWLEDGE_CONTEXT_LENGTH).max(MAX_KNOWLEDGE_CONTEXT_LENGTH).optional(),
|
|
43156
43538
|
turn_id: optionalStringSchema,
|
|
43157
43539
|
trace_id: optionalStringSchema
|
|
43158
43540
|
});
|
|
@@ -43640,6 +44022,8 @@ var agentApiMessageEnvelopeSchema = passthroughObject({
|
|
|
43640
44022
|
task_assignee_id: external_exports.string().nullable().optional(),
|
|
43641
44023
|
taskAssigneeType: external_exports.string().nullable().optional(),
|
|
43642
44024
|
task_assignee_type: external_exports.string().nullable().optional(),
|
|
44025
|
+
taskAssigneeName: external_exports.string().nullable().optional(),
|
|
44026
|
+
task_assignee_name: external_exports.string().nullable().optional(),
|
|
43643
44027
|
threadId: external_exports.string().nullable().optional(),
|
|
43644
44028
|
replyCount: external_exports.number().int().nonnegative().nullable().optional()
|
|
43645
44029
|
});
|
|
@@ -43824,6 +44208,7 @@ var agentApiCreatedTaskEnvelopeSchema = passthroughObject({
|
|
|
43824
44208
|
status: taskStatusSchema,
|
|
43825
44209
|
claimedByType: external_exports.enum(["user", "agent"]).nullable(),
|
|
43826
44210
|
claimedById: external_exports.string().nullable(),
|
|
44211
|
+
claimedByName: external_exports.string().nullable().optional(),
|
|
43827
44212
|
claimedAt: external_exports.string().datetime().nullable()
|
|
43828
44213
|
});
|
|
43829
44214
|
var agentApiTaskAssignmentReceiptSchema = passthroughObject({
|
|
@@ -45185,6 +45570,22 @@ function createDaemonApiClient(transportOrOptions, maybeOptions = {}) {
|
|
|
45185
45570
|
|
|
45186
45571
|
// ../shared/src/agentInbox.ts
|
|
45187
45572
|
init_esm_shims();
|
|
45573
|
+
var NON_MEMBER_MENTION_REPLY_GUIDANCE = "[Raft notice: You were notified as a non-member, so you cannot reply in that channel. If no reply is needed, no action is required. Otherwise, DM the person who mentioned you or join the channel to participate.]";
|
|
45574
|
+
function projectAgentReplyAffordance(facts) {
|
|
45575
|
+
if (facts.non_member_mention !== true) return null;
|
|
45576
|
+
return {
|
|
45577
|
+
kind: "non_member_mention",
|
|
45578
|
+
guidance: NON_MEMBER_MENTION_REPLY_GUIDANCE
|
|
45579
|
+
};
|
|
45580
|
+
}
|
|
45581
|
+
function formatAgentReplyAffordance(facts) {
|
|
45582
|
+
return projectAgentReplyAffordance(facts)?.guidance ?? "";
|
|
45583
|
+
}
|
|
45584
|
+
function formatAgentReplyAffordanceSuffix(facts) {
|
|
45585
|
+
const guidance = formatAgentReplyAffordance(facts);
|
|
45586
|
+
return guidance ? `
|
|
45587
|
+
${guidance}` : "";
|
|
45588
|
+
}
|
|
45188
45589
|
function formatAgentInboxSnapshot(rows) {
|
|
45189
45590
|
if (rows.length === 0) return "Inbox: empty";
|
|
45190
45591
|
return [
|
|
@@ -45208,6 +45609,7 @@ function formatAgentInboxRowDetails(row) {
|
|
|
45208
45609
|
}
|
|
45209
45610
|
function formatAgentInboxFlag(flag) {
|
|
45210
45611
|
if (flag === "mention") return "you were mentioned";
|
|
45612
|
+
if (flag === "non_member_mention") return formatAgentReplyAffordance({ non_member_mention: true });
|
|
45211
45613
|
return flag;
|
|
45212
45614
|
}
|
|
45213
45615
|
function shortMessageId(value) {
|
|
@@ -45406,6 +45808,9 @@ var SUPPORTED_TRANSLATION_LANGUAGE_SET = new Set(
|
|
|
45406
45808
|
SUPPORTED_TRANSLATION_LANGUAGE_CODES
|
|
45407
45809
|
);
|
|
45408
45810
|
|
|
45811
|
+
// ../shared/src/displayLocales.ts
|
|
45812
|
+
init_esm_shims();
|
|
45813
|
+
|
|
45409
45814
|
// ../shared/src/timeFormatPreference.ts
|
|
45410
45815
|
init_esm_shims();
|
|
45411
45816
|
|
|
@@ -45653,7 +46058,7 @@ var CANONICAL_MESSAGE_EXCLUSIONS = Object.freeze({
|
|
|
45653
46058
|
* applyTarget=task-domain, messageFold=excluded. Fan out to the task
|
|
45654
46059
|
* consumer at ingress; message fold never applies these. */
|
|
45655
46060
|
taskDomainProjection: Object.freeze({
|
|
45656
|
-
fields: ["taskAssigneeId", "taskAssigneeType", "taskClaimedAt", "taskCompletedAt", "taskNumber", "taskStatus"],
|
|
46061
|
+
fields: ["taskAssigneeId", "taskAssigneeName", "taskAssigneeType", "taskClaimedAt", "taskCompletedAt", "taskNumber", "taskStatus"],
|
|
45657
46062
|
migrationStatus: "active-consumers (web taskStore / KMP task projection); dual-dispatch at ingress"
|
|
45658
46063
|
}),
|
|
45659
46064
|
/** Emitted but consumed by no canonical client surface. */
|
|
@@ -46045,6 +46450,7 @@ var TRIAL_END_DATE = /* @__PURE__ */ new Date("2026-06-23T12:00:00Z");
|
|
|
46045
46450
|
var TRIAL_DURATION_DAYS = (TRIAL_END_DATE.getTime() - TRIAL_START_DATE.getTime()) / (24 * 60 * 60 * 1e3);
|
|
46046
46451
|
|
|
46047
46452
|
// src/agentApiPath.ts
|
|
46453
|
+
init_esm_shims();
|
|
46048
46454
|
function buildAgentApiRoutePath(routeKey, pathParams, query) {
|
|
46049
46455
|
const path11 = buildAgentApiRawRoutePath(routeKey, { params: pathParams, query });
|
|
46050
46456
|
if (typeof path11 === "string") return path11;
|
|
@@ -46663,6 +47069,7 @@ var ApiClient = class {
|
|
|
46663
47069
|
const url2 = new URL(pathname, this.ctx.serverUrl);
|
|
46664
47070
|
const headers = this.buildAuthHeaders();
|
|
46665
47071
|
headers["Content-Type"] = "application/json";
|
|
47072
|
+
headers[RAFT_CLIENT_CAPABILITIES_HEADER] = MANUAL_CONTEXT_CAPABILITY;
|
|
46666
47073
|
if (this.ctx.activeCapabilities && this.ctx.activeCapabilities.length > 0) {
|
|
46667
47074
|
headers["X-Slock-Agent-Active-Capabilities"] = this.ctx.activeCapabilities.join(",");
|
|
46668
47075
|
}
|
|
@@ -46938,16 +47345,6 @@ function loadAgentContext(env = process.env) {
|
|
|
46938
47345
|
);
|
|
46939
47346
|
}
|
|
46940
47347
|
|
|
46941
|
-
// src/core/io.ts
|
|
46942
|
-
init_esm_shims();
|
|
46943
|
-
function defaultCliIo() {
|
|
46944
|
-
return {
|
|
46945
|
-
stdin: process.stdin,
|
|
46946
|
-
stdout: process.stdout,
|
|
46947
|
-
stderr: process.stderr
|
|
46948
|
-
};
|
|
46949
|
-
}
|
|
46950
|
-
|
|
46951
47348
|
// src/core/context.ts
|
|
46952
47349
|
function bootstrapSuggestedNextAction(code) {
|
|
46953
47350
|
switch (code) {
|
|
@@ -46996,38 +47393,6 @@ function createCommandContext(options = {}) {
|
|
|
46996
47393
|
};
|
|
46997
47394
|
}
|
|
46998
47395
|
|
|
46999
|
-
// src/core/renderer.ts
|
|
47000
|
-
init_esm_shims();
|
|
47001
|
-
function renderError(io, err) {
|
|
47002
|
-
io.stderr.write(`Error: ${err.message}
|
|
47003
|
-
`);
|
|
47004
|
-
io.stderr.write(`Code: ${err.code}
|
|
47005
|
-
`);
|
|
47006
|
-
if (err.layer) {
|
|
47007
|
-
io.stderr.write(`Layer: ${err.layer}
|
|
47008
|
-
`);
|
|
47009
|
-
}
|
|
47010
|
-
if (err.correlationId) {
|
|
47011
|
-
io.stderr.write(`Correlation: ${err.correlationId}
|
|
47012
|
-
`);
|
|
47013
|
-
}
|
|
47014
|
-
if (err.draftSaved !== void 0) {
|
|
47015
|
-
io.stderr.write(`Draft saved: ${err.draftSaved ? "yes" : "no"}
|
|
47016
|
-
`);
|
|
47017
|
-
}
|
|
47018
|
-
if (err.suggestedNextAction) {
|
|
47019
|
-
io.stderr.write(`Next action: ${err.suggestedNextAction}
|
|
47020
|
-
`);
|
|
47021
|
-
}
|
|
47022
|
-
}
|
|
47023
|
-
function writeText(io, text) {
|
|
47024
|
-
io.stdout.write(text);
|
|
47025
|
-
}
|
|
47026
|
-
function writeJson(io, payload) {
|
|
47027
|
-
io.stdout.write(`${JSON.stringify(payload)}
|
|
47028
|
-
`);
|
|
47029
|
-
}
|
|
47030
|
-
|
|
47031
47396
|
// src/core/command.ts
|
|
47032
47397
|
function defineCommand(spec, handler) {
|
|
47033
47398
|
return { spec, handler };
|
|
@@ -47641,13 +48006,20 @@ async function mintAndPersist(ctx, options, accessToken, paths) {
|
|
|
47641
48006
|
) + "\n",
|
|
47642
48007
|
{ mode: 384 }
|
|
47643
48008
|
);
|
|
47644
|
-
ctx.io.stdout.write(
|
|
47645
|
-
|
|
47646
|
-
|
|
47647
|
-
|
|
47648
|
-
|
|
47649
|
-
|
|
47650
|
-
|
|
48009
|
+
ctx.io.stdout.write(formatAuthorizedLoginReport({
|
|
48010
|
+
agentName: minted.agentName,
|
|
48011
|
+
server: options.server,
|
|
48012
|
+
credentialPath: paths.credentialPath,
|
|
48013
|
+
profileSlug: paths.profileSlug
|
|
48014
|
+
}));
|
|
48015
|
+
}
|
|
48016
|
+
function formatAuthorizedLoginReport(input) {
|
|
48017
|
+
const manualCommand = 'raft manual get raft-cli-overview --intent "Get productive on Raft as a new agent" --reason "Just logged in, need the CLI basics"';
|
|
48018
|
+
return `state: authorized
|
|
48019
|
+
Logged in as '${input.agentName}' on ${input.server}. Credential saved to ${input.credentialPath}.
|
|
48020
|
+
Next (if you are the human operator): start your agent with RAFT_PROFILE=${input.profileSlug} in its environment, and let the agent run \`${manualCommand}\` to learn the Raft CLI.
|
|
48021
|
+
Next (if you are the agent): run \`${manualCommand}\`, then use \`raft --profile ${input.profileSlug} \u2026\` for all commands.
|
|
48022
|
+
`;
|
|
47651
48023
|
}
|
|
47652
48024
|
function formatVerificationHandoff(action, options) {
|
|
47653
48025
|
const mins = Math.max(0, Math.floor(action.expiresInSeconds / 60));
|
|
@@ -50921,6 +51293,47 @@ function registerUserInfoCommand(parent, runtimeOptions) {
|
|
|
50921
51293
|
|
|
50922
51294
|
// src/commands/knowledge/get.ts
|
|
50923
51295
|
init_esm_shims();
|
|
51296
|
+
|
|
51297
|
+
// src/commands/knowledge/context.ts
|
|
51298
|
+
init_esm_shims();
|
|
51299
|
+
var INTENT_GUIDANCE = `Retry with --intent "Set up a multi-agent review pipeline for my team" \u2014 describe the user's ultimate goal in Raft, not the query or topic.`;
|
|
51300
|
+
var REASON_GUIDANCE = 'Retry with --reason "Unsure whether a muted channel still delivers @mentions to me" \u2014 describe why the Manual is needed now, not "need info" or a restatement of the query.';
|
|
51301
|
+
var SAFETY_GUIDANCE = "Don't include secrets, credentials, private URLs, or raw message content.";
|
|
51302
|
+
function contextGuidance(field) {
|
|
51303
|
+
return field === "intent" ? INTENT_GUIDANCE : REASON_GUIDANCE;
|
|
51304
|
+
}
|
|
51305
|
+
function throwKnowledgeContextError(field, message) {
|
|
51306
|
+
const code = field === "intent" ? "knowledge_intent_invalid" : "knowledge_reason_invalid";
|
|
51307
|
+
throw new CliError({
|
|
51308
|
+
code,
|
|
51309
|
+
message,
|
|
51310
|
+
suggestedNextAction: `${contextGuidance(field)} ${SAFETY_GUIDANCE}`
|
|
51311
|
+
});
|
|
51312
|
+
}
|
|
51313
|
+
function requireKnowledgeContexts(rawIntent, rawReason) {
|
|
51314
|
+
const intent = validateKnowledgeContext(rawIntent, "intent");
|
|
51315
|
+
const reason = validateKnowledgeContext(rawReason, "reason");
|
|
51316
|
+
if (!intent.ok) {
|
|
51317
|
+
if (!reason.ok) {
|
|
51318
|
+
throw new CliError({
|
|
51319
|
+
code: "KNOWLEDGE_CONTEXT_INVALID",
|
|
51320
|
+
message: `Both Manual context fields are invalid: ${intent.error}; ${reason.error}`,
|
|
51321
|
+
suggestedNextAction: `Retry the same command with both required fields:
|
|
51322
|
+
${INTENT_GUIDANCE}
|
|
51323
|
+
${REASON_GUIDANCE}
|
|
51324
|
+
` + SAFETY_GUIDANCE
|
|
51325
|
+
});
|
|
51326
|
+
}
|
|
51327
|
+
throwKnowledgeContextError("intent", intent.error);
|
|
51328
|
+
}
|
|
51329
|
+
if (!reason.ok) throwKnowledgeContextError("reason", reason.error);
|
|
51330
|
+
return { intent: intent.value, reason: reason.value };
|
|
51331
|
+
}
|
|
51332
|
+
function formatManualIndexCommand() {
|
|
51333
|
+
return MANUAL_INDEX_COMMAND;
|
|
51334
|
+
}
|
|
51335
|
+
|
|
51336
|
+
// src/commands/knowledge/get.ts
|
|
50924
51337
|
function formatKnowledgeStdout(content) {
|
|
50925
51338
|
return content.endsWith("\n") ? content : `${content}
|
|
50926
51339
|
`;
|
|
@@ -50931,6 +51344,7 @@ function toKnowledgeErrorCode(errorCode2, status) {
|
|
|
50931
51344
|
case "SCOPE_DENIED":
|
|
50932
51345
|
case "knowledge_agent_missing":
|
|
50933
51346
|
case "knowledge_internal_error":
|
|
51347
|
+
case "knowledge_intent_invalid":
|
|
50934
51348
|
case "knowledge_not_found":
|
|
50935
51349
|
case "knowledge_reason_invalid":
|
|
50936
51350
|
case "knowledge_source_invalid":
|
|
@@ -50949,9 +51363,13 @@ var knowledgeGetCommand = defineCommand(
|
|
|
50949
51363
|
description: "Fetch a Raft Manual for Agents topic from the current server",
|
|
50950
51364
|
arguments: ["<topic>"],
|
|
50951
51365
|
options: [
|
|
51366
|
+
{
|
|
51367
|
+
flags: "--intent <text>",
|
|
51368
|
+
description: "Required: what the user ultimately wants to accomplish with Raft (12-500 chars)"
|
|
51369
|
+
},
|
|
50952
51370
|
{
|
|
50953
51371
|
flags: "--reason <text>",
|
|
50954
|
-
description: "
|
|
51372
|
+
description: "Required: why Manual is needed at this point (12-500 chars)"
|
|
50955
51373
|
},
|
|
50956
51374
|
{
|
|
50957
51375
|
flags: "--turn-id <id>",
|
|
@@ -50964,14 +51382,16 @@ var knowledgeGetCommand = defineCommand(
|
|
|
50964
51382
|
hidden: true
|
|
50965
51383
|
}
|
|
50966
51384
|
],
|
|
50967
|
-
helpAfter:
|
|
51385
|
+
helpAfter: '\nTopics:\n Use this to list available manual topics:\n raft manual get index --intent "Learn available Raft workflows" --reason "Need the topic catalog before answering"\n'
|
|
50968
51386
|
},
|
|
50969
51387
|
async (ctx, topic, opts) => {
|
|
51388
|
+
const { intent, reason } = requireKnowledgeContexts(opts.intent, opts.reason);
|
|
50970
51389
|
const agentContext = ctx.loadAgentContext();
|
|
50971
51390
|
const client = ctx.createApiClient(agentContext);
|
|
50972
51391
|
const res = await createAgentApiSurfaceClient(client).knowledge.get({
|
|
50973
51392
|
topic,
|
|
50974
|
-
|
|
51393
|
+
intent,
|
|
51394
|
+
reason,
|
|
50975
51395
|
turn_id: opts.turnId,
|
|
50976
51396
|
trace_id: opts.traceId
|
|
50977
51397
|
});
|
|
@@ -50979,7 +51399,8 @@ var knowledgeGetCommand = defineCommand(
|
|
|
50979
51399
|
throw new CliError({
|
|
50980
51400
|
code: toKnowledgeErrorCode(res.errorCode, res.status),
|
|
50981
51401
|
message: res.error ?? `HTTP ${res.status}`,
|
|
50982
|
-
suggestedNextAction: res.suggestedNextAction ?? (res.errorCode === "knowledge_not_found" ?
|
|
51402
|
+
suggestedNextAction: res.suggestedNextAction ?? (res.errorCode === "knowledge_not_found" ? `No topic matched. Retry with a close topic id, keeping your --intent/--reason. To browse all topics, run:
|
|
51403
|
+
${formatManualIndexCommand()}` : void 0)
|
|
50983
51404
|
});
|
|
50984
51405
|
}
|
|
50985
51406
|
const data = res.data;
|
|
@@ -51012,6 +51433,7 @@ function toKnowledgeSearchErrorCode(errorCode2, status) {
|
|
|
51012
51433
|
case "SCOPE_DENIED":
|
|
51013
51434
|
case "knowledge_agent_missing":
|
|
51014
51435
|
case "knowledge_internal_error":
|
|
51436
|
+
case "knowledge_intent_invalid":
|
|
51015
51437
|
case "knowledge_not_found":
|
|
51016
51438
|
case "knowledge_query_invalid":
|
|
51017
51439
|
case "knowledge_reason_invalid":
|
|
@@ -51035,9 +51457,13 @@ var knowledgeSearchCommand = defineCommand(
|
|
|
51035
51457
|
flags: "--scope <scope>",
|
|
51036
51458
|
description: "Optional search scope. Currently supports: recipes"
|
|
51037
51459
|
},
|
|
51460
|
+
{
|
|
51461
|
+
flags: "--intent <text>",
|
|
51462
|
+
description: "Required: what the user ultimately wants to accomplish with Raft (12-500 chars)"
|
|
51463
|
+
},
|
|
51038
51464
|
{
|
|
51039
51465
|
flags: "--reason <text>",
|
|
51040
|
-
description: "
|
|
51466
|
+
description: "Required: why Manual is needed at this point (12-500 chars)"
|
|
51041
51467
|
},
|
|
51042
51468
|
{
|
|
51043
51469
|
flags: "--turn-id <id>",
|
|
@@ -51050,15 +51476,17 @@ var knowledgeSearchCommand = defineCommand(
|
|
|
51050
51476
|
hidden: true
|
|
51051
51477
|
}
|
|
51052
51478
|
],
|
|
51053
|
-
helpAfter: '\nExamples:\n raft manual search "preview before merge" --scope recipes\n raft manual get recipes/technique/preview-env\n'
|
|
51479
|
+
helpAfter: '\nExamples:\n raft manual search "preview before merge" --scope recipes --intent "Safely preview a change before merge" --reason "Need the recommended preview workflow now"\n raft manual get recipes/technique/preview-env --intent "Safely preview a change before merge" --reason "Need exact preview setup steps now"\n'
|
|
51054
51480
|
},
|
|
51055
51481
|
async (ctx, keywords, opts) => {
|
|
51482
|
+
const { intent, reason } = requireKnowledgeContexts(opts.intent, opts.reason);
|
|
51056
51483
|
const agentContext = ctx.loadAgentContext();
|
|
51057
51484
|
const client = ctx.createApiClient(agentContext);
|
|
51058
51485
|
const res = await createAgentApiSurfaceClient(client).knowledge.search({
|
|
51059
51486
|
query: keywords,
|
|
51060
51487
|
scope: opts.scope,
|
|
51061
|
-
|
|
51488
|
+
intent,
|
|
51489
|
+
reason,
|
|
51062
51490
|
turn_id: opts.turnId,
|
|
51063
51491
|
trace_id: opts.traceId
|
|
51064
51492
|
});
|
|
@@ -51066,7 +51494,8 @@ var knowledgeSearchCommand = defineCommand(
|
|
|
51066
51494
|
throw new CliError({
|
|
51067
51495
|
code: toKnowledgeSearchErrorCode(res.errorCode, res.status),
|
|
51068
51496
|
message: res.error ?? `HTTP ${res.status}`,
|
|
51069
|
-
suggestedNextAction: res.suggestedNextAction ?? (res.errorCode === "knowledge_not_found" ?
|
|
51497
|
+
suggestedNextAction: res.suggestedNextAction ?? (res.errorCode === "knowledge_not_found" ? `Retry with different keywords, keeping your --intent/--reason. To browse all topics, run:
|
|
51498
|
+
${formatManualIndexCommand()}` : void 0)
|
|
51070
51499
|
});
|
|
51071
51500
|
}
|
|
51072
51501
|
const data = res.data;
|
|
@@ -51279,6 +51708,10 @@ function formatAttachmentSuffix(attachments) {
|
|
|
51279
51708
|
if (!attachments?.length) return "";
|
|
51280
51709
|
return ` [${attachments.length} attachment${attachments.length > 1 ? "s" : ""}: ${attachments.map((a) => `${a.filename} (id:${a.id})`).join(", ")} \u2014 use raft attachment view to download]`;
|
|
51281
51710
|
}
|
|
51711
|
+
function formatTaskAssigneeSuffix(assigneeId, assigneeName) {
|
|
51712
|
+
if (!assigneeId) return "";
|
|
51713
|
+
return assigneeName ? ` assignee=@${assigneeName}` : " assignee=<unresolved>";
|
|
51714
|
+
}
|
|
51282
51715
|
function formatMessageLine(m) {
|
|
51283
51716
|
if (m.third_party_event) {
|
|
51284
51717
|
const msgId2 = m.message_id ? m.message_id.slice(0, 8) : m.third_party_event.id.slice(0, 8);
|
|
@@ -51287,9 +51720,11 @@ function formatMessageLine(m) {
|
|
|
51287
51720
|
const content2 = m.content ?? "";
|
|
51288
51721
|
const source = event.source;
|
|
51289
51722
|
const sourceSuffix = source?.resource ? `; resource=${source.resource}${source.access_token_id_hash ? `; access_token_id_hash=${source.access_token_id_hash}` : ""}` : "";
|
|
51290
|
-
const provenance = `
|
|
51723
|
+
const provenance = `kind=${event.kind}; payload_hash=${event.payload_hash}${sourceSuffix}`;
|
|
51291
51724
|
return `[target=agent-event:${event.id.slice(0, 8)} msg=${msgId2} time=${time4} type=third_party_app] @${event.client_id} \u2014 ${event.client_name}: ${provenance}
|
|
51292
|
-
${content2}
|
|
51725
|
+
${content2}${event.payload ? `
|
|
51726
|
+
payload:
|
|
51727
|
+
${renderThirdPartyInertJson(event.payload)}` : ""}`;
|
|
51293
51728
|
}
|
|
51294
51729
|
const target = formatTarget(m);
|
|
51295
51730
|
const msgId = m.message_id ? m.message_id.slice(0, 8) : "-";
|
|
@@ -51297,8 +51732,8 @@ ${content2}`;
|
|
|
51297
51732
|
const senderType = ` type=${m.sender_type}`;
|
|
51298
51733
|
const content = m.content ?? "";
|
|
51299
51734
|
const attachSuffix = formatAttachmentSuffix(m.attachments);
|
|
51300
|
-
const taskSuffix = m.task_status ? ` [task #${m.task_number} status=${m.task_status}${m.task_assignee_id
|
|
51301
|
-
return `[target=${target} msg=${msgId} time=${time3}${senderType}] ${formatSenderHandle(m)}: ${content}${attachSuffix}${taskSuffix}`;
|
|
51735
|
+
const taskSuffix = m.task_status ? ` [task #${m.task_number} status=${m.task_status}${formatTaskAssigneeSuffix(m.task_assignee_id, m.task_assignee_name)}]` : "";
|
|
51736
|
+
return `[target=${target} msg=${msgId} time=${time3}${senderType}] ${formatSenderHandle(m)}: ${content}${attachSuffix}${taskSuffix}${formatAgentReplyAffordanceSuffix(m)}`;
|
|
51302
51737
|
}
|
|
51303
51738
|
function formatMessages(messages) {
|
|
51304
51739
|
if (messages.length === 0) return "No new messages.";
|
|
@@ -51330,7 +51765,8 @@ function formatHistoryMessageLine(channel, m, index, total) {
|
|
|
51330
51765
|
if (replyTarget) headerParts.push(`replyTarget=${replyTarget}`);
|
|
51331
51766
|
}
|
|
51332
51767
|
const attachSuffix = formatAttachmentSuffix(m.attachments);
|
|
51333
|
-
const
|
|
51768
|
+
const assigneeName = m.taskAssigneeName ?? m.task_assignee_name ?? null;
|
|
51769
|
+
const taskSuffix = m.taskStatus ? ` [task #${m.taskNumber} status=${m.taskStatus}${formatTaskAssigneeSuffix(m.taskAssigneeId, assigneeName)}]` : "";
|
|
51334
51770
|
const handle = senderDescription ? `@${senderName} \u2014 ${senderDescription}` : `@${senderName}`;
|
|
51335
51771
|
return `[${headerParts.join(" ")}] ${handle}: ${m.content ?? ""}${attachSuffix}${taskSuffix}`;
|
|
51336
51772
|
}
|
|
@@ -51381,14 +51817,14 @@ function renderSearchSource(result2) {
|
|
|
51381
51817
|
if (result2.channelType === "thread") {
|
|
51382
51818
|
const shortId = typeof result2.channelName === "string" && result2.channelName.startsWith("thread-") ? result2.channelName.slice(7) : typeof result2.threadId === "string" && result2.threadId ? result2.threadId.slice(0, 8) : result2.channelName;
|
|
51383
51819
|
if (result2.parentChannelType === "dm") {
|
|
51384
|
-
return `dm:${
|
|
51820
|
+
return `dm:${neutralizeSlockRefLiterals2(result2.parentChannelName ?? "unknown")}:${shortId}`;
|
|
51385
51821
|
}
|
|
51386
|
-
return `thread:${
|
|
51822
|
+
return `thread:${neutralizeSlockRefLiterals2(result2.parentChannelName ?? "unknown")}:${shortId}`;
|
|
51387
51823
|
}
|
|
51388
51824
|
if (result2.channelType === "dm") {
|
|
51389
|
-
return `dm:${
|
|
51825
|
+
return `dm:${neutralizeSlockRefLiterals2(result2.channelName ?? "unknown")}`;
|
|
51390
51826
|
}
|
|
51391
|
-
return `channel:${
|
|
51827
|
+
return `channel:${neutralizeSlockRefLiterals2(result2.channelName ?? "unknown")}`;
|
|
51392
51828
|
}
|
|
51393
51829
|
var PREVIEW_BEFORE_CHARS = 80;
|
|
51394
51830
|
var PREVIEW_AFTER_CHARS = 120;
|
|
@@ -51458,11 +51894,11 @@ function trimPreviewWindow(content, start, end) {
|
|
|
51458
51894
|
function escapeSearchComponentLiterals(text) {
|
|
51459
51895
|
return text.replace(/<\/?(?:result|preview|match)\b[^>]*>|<omit\s*\/>/gi, (tag) => tag.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"));
|
|
51460
51896
|
}
|
|
51461
|
-
function
|
|
51897
|
+
function neutralizeSlockRefLiterals2(text) {
|
|
51462
51898
|
return text.replace(/\bdm:@([A-Za-z0-9][A-Za-z0-9_-]*)/g, "dm:user:$1").replace(/\btask #([0-9]+)\b/g, "task:$1").replace(/(^|[\n\s([{"'`;])@([A-Za-z0-9][A-Za-z0-9_-]*)/g, "$1user:$2").replace(/(^|[\n\s([{"'`;])#([A-Za-z][A-Za-z0-9_-]*)/g, "$1channel:$2");
|
|
51463
51899
|
}
|
|
51464
51900
|
function renderPreviewText(text) {
|
|
51465
|
-
return
|
|
51901
|
+
return neutralizeSlockRefLiterals2(escapeSearchComponentLiterals(text));
|
|
51466
51902
|
}
|
|
51467
51903
|
function renderSearchPreview(content, query) {
|
|
51468
51904
|
const foundMatch = findSearchMatch(content, query);
|
|
@@ -51498,7 +51934,7 @@ function formatSearchResults(query, data) {
|
|
|
51498
51934
|
const formatted = data.results.map((result2, index) => {
|
|
51499
51935
|
const ref = `msg:${result2.id}`;
|
|
51500
51936
|
const content = result2.content ?? result2.snippet ?? "";
|
|
51501
|
-
const sender =
|
|
51937
|
+
const sender = neutralizeSlockRefLiterals2(result2.senderName ?? "unknown");
|
|
51502
51938
|
const senderType = result2.senderType ? ` (${result2.senderType})` : "";
|
|
51503
51939
|
return [
|
|
51504
51940
|
`<result ref="${ref}">`,
|
|
@@ -51648,6 +52084,9 @@ function formatMentionActionResults(action, results) {
|
|
|
51648
52084
|
lines.push(` deduped: ${result2.dedupedResolutionIds.join(", ")}`);
|
|
51649
52085
|
}
|
|
51650
52086
|
}
|
|
52087
|
+
if (action === "notify" && results.some((result2) => result2.status === "queued" && result2.reason !== "already_queued")) {
|
|
52088
|
+
lines.push("", `Recipient guidance: ${formatAgentReplyAffordance({ non_member_mention: true })}`);
|
|
52089
|
+
}
|
|
51651
52090
|
return `${lines.join("\n")}
|
|
51652
52091
|
`;
|
|
51653
52092
|
}
|
|
@@ -52827,7 +53266,7 @@ function formatTaskList(channel, data, statusFilter) {
|
|
|
52827
53266
|
return `No${statusFilter && statusFilter !== "all" ? ` ${statusFilter}` : ""} tasks in ${channel}.`;
|
|
52828
53267
|
}
|
|
52829
53268
|
const formatted = data.tasks.map((t) => {
|
|
52830
|
-
const assignee = t.
|
|
53269
|
+
const assignee = t.claimedById ? ` \u2192 ${t.claimedByName ? `@${t.claimedByName}` : "<unresolved>"}` : "";
|
|
52831
53270
|
const creator = t.createdByName ? ` (by @${t.createdByName})` : "";
|
|
52832
53271
|
const msgId = t.messageId ? ` msg=${t.messageId.slice(0, 8)}` : "";
|
|
52833
53272
|
const legacy = t.isLegacy ? " [LEGACY \u2014 read-only]" : "";
|
|
@@ -52839,7 +53278,7 @@ ${formatted}`;
|
|
|
52839
53278
|
}
|
|
52840
53279
|
function formatTasksCreated(channel, data) {
|
|
52841
53280
|
const created = data.tasks.map((t) => {
|
|
52842
|
-
const assignee = t.
|
|
53281
|
+
const assignee = t.claimedById ? t.claimedByName ? `@${t.claimedByName}` : "<unresolved>" : "unassigned";
|
|
52843
53282
|
return `#${t.taskNumber} [${t.status}] assignee=${assignee} claimedAt=${t.claimedAt ?? "null"} msg=${t.messageId.slice(0, 8)} "${t.title}"`;
|
|
52844
53283
|
}).join("\n");
|
|
52845
53284
|
const threadHints = data.tasks.map((t) => `#${t.taskNumber} \u2192 raft message send --target "${channel}:${t.messageId.slice(0, 8)}"`).join("\n");
|
|
@@ -55661,12 +56100,92 @@ function registerMigrateCommands(parent, runtimeOptions = {}) {
|
|
|
55661
56100
|
|
|
55662
56101
|
// src/index.ts
|
|
55663
56102
|
var program2 = new Command();
|
|
56103
|
+
function stripCommanderPrefix(message) {
|
|
56104
|
+
return message.replace(/^error:\s*/i, "");
|
|
56105
|
+
}
|
|
56106
|
+
function userCommandArgs(argv) {
|
|
56107
|
+
const args = argv.slice(2);
|
|
56108
|
+
const commandArgs = [];
|
|
56109
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
56110
|
+
const arg = args[index];
|
|
56111
|
+
if (arg === "--") {
|
|
56112
|
+
commandArgs.push(...args.slice(index + 1));
|
|
56113
|
+
break;
|
|
56114
|
+
}
|
|
56115
|
+
if (arg === "-p" || arg === "--profile") {
|
|
56116
|
+
index += 1;
|
|
56117
|
+
continue;
|
|
56118
|
+
}
|
|
56119
|
+
if (arg.startsWith("--profile=")) continue;
|
|
56120
|
+
commandArgs.push(arg);
|
|
56121
|
+
}
|
|
56122
|
+
return commandArgs;
|
|
56123
|
+
}
|
|
56124
|
+
function commandHelpTarget(program3, userArgs) {
|
|
56125
|
+
const path11 = [];
|
|
56126
|
+
let cursor = program3;
|
|
56127
|
+
for (const arg of userArgs) {
|
|
56128
|
+
if (arg.startsWith("-")) break;
|
|
56129
|
+
const child = cursor.commands.find((candidate) => candidate.name() === arg || candidate.alias() === arg);
|
|
56130
|
+
if (!child) break;
|
|
56131
|
+
path11.push(child.name());
|
|
56132
|
+
cursor = child;
|
|
56133
|
+
}
|
|
56134
|
+
return ["raft", ...path11].join(" ");
|
|
56135
|
+
}
|
|
56136
|
+
function visibleSubcommandList(program3, userArgs) {
|
|
56137
|
+
let cursor = program3;
|
|
56138
|
+
for (const arg of userArgs) {
|
|
56139
|
+
if (arg.startsWith("-")) break;
|
|
56140
|
+
const child = cursor.commands.find((candidate) => candidate.name() === arg || candidate.alias() === arg);
|
|
56141
|
+
if (!child) break;
|
|
56142
|
+
cursor = child;
|
|
56143
|
+
}
|
|
56144
|
+
return cursor.createHelp().visibleCommands(cursor).filter((candidate) => candidate.name() !== "help").map((candidate) => candidate.name()).join(", ");
|
|
56145
|
+
}
|
|
56146
|
+
function parseStageErrorToCliError(err, program3, argv) {
|
|
56147
|
+
const userArgs = userCommandArgs(argv);
|
|
56148
|
+
const helpTarget = commandHelpTarget(program3, userArgs);
|
|
56149
|
+
const subcommands = visibleSubcommandList(program3, userArgs);
|
|
56150
|
+
const message = stripCommanderPrefix(err.message);
|
|
56151
|
+
switch (err.code) {
|
|
56152
|
+
case "commander.missingArgument":
|
|
56153
|
+
return new CliError({
|
|
56154
|
+
code: "INVALID_ARG",
|
|
56155
|
+
message,
|
|
56156
|
+
suggestedNextAction: helpTarget === "raft manual get" ? "Run `raft manual get index` for the topic index, or `raft manual get --help` for syntax." : `Run \`${helpTarget} --help\` for syntax.`
|
|
56157
|
+
});
|
|
56158
|
+
case "commander.unknownCommand":
|
|
56159
|
+
return new CliError({
|
|
56160
|
+
code: "INVALID_ARG",
|
|
56161
|
+
message,
|
|
56162
|
+
suggestedNextAction: subcommands ? `Run \`${helpTarget} --help\` to list valid subcommands: ${subcommands}.` : `Run \`${helpTarget} --help\` to list available subcommands.`
|
|
56163
|
+
});
|
|
56164
|
+
case "commander.unknownOption":
|
|
56165
|
+
return new CliError({
|
|
56166
|
+
code: "INVALID_ARG",
|
|
56167
|
+
message,
|
|
56168
|
+
suggestedNextAction: `Run \`${helpTarget} --help\` to list supported flags.`
|
|
56169
|
+
});
|
|
56170
|
+
default:
|
|
56171
|
+
return new CliError({
|
|
56172
|
+
code: "INVALID_ARG",
|
|
56173
|
+
message,
|
|
56174
|
+
suggestedNextAction: `Run \`${helpTarget} --help\` for syntax.`
|
|
56175
|
+
});
|
|
56176
|
+
}
|
|
56177
|
+
}
|
|
55664
56178
|
program2.name("raft").description(
|
|
55665
56179
|
"Agent-facing CLI for Raft. Two entry shapes: (A) external agent via `raft agent login --profile-slug <slug>` to create a profile, then `raft --profile <slug>` (or RAFT_PROFILE=<slug>) to use it; (B) daemon-injected runner, where the local managed-runner wrapper sets the SLOCK_AGENT_* env vars for you."
|
|
55666
56180
|
).option(
|
|
55667
56181
|
"-p, --profile <slug>",
|
|
55668
56182
|
"Use an existing local profile credential. Equivalent to setting RAFT_PROFILE=<slug>. To create a new profile, use `raft agent login --profile-slug <slug>`."
|
|
55669
56183
|
).version(readCliVersion());
|
|
56184
|
+
program2.exitOverride();
|
|
56185
|
+
program2.configureOutput({
|
|
56186
|
+
outputError: () => {
|
|
56187
|
+
}
|
|
56188
|
+
});
|
|
55670
56189
|
program2.hook("preAction", () => {
|
|
55671
56190
|
const opts = program2.opts();
|
|
55672
56191
|
if (opts.profile) {
|
|
@@ -55701,7 +56220,7 @@ var userCmd = program2.command("user").description("User and agent introspection
|
|
|
55701
56220
|
registerUserInfoCommand(userCmd);
|
|
55702
56221
|
var manualCmd = program2.command("manual").description("Look up Raft operating topics and agent recipes").addHelpText(
|
|
55703
56222
|
"after",
|
|
55704
|
-
'\nCommon agent flows:\n raft manual get index\n raft manual get recipes/seeded
|
|
56223
|
+
'\nCommon agent flows:\n raft manual get index --intent "Learn available Raft workflows" --reason "Need the topic catalog before answering"\n raft manual get recipes/seeded --intent "Choose a safe Raft workflow" --reason "Need the core recipe map now"\n raft manual search "preview before merge" --scope recipes --intent "Safely preview a change before merge" --reason "Need the recommended preview workflow now"\n\nUse `raft manual get --help` and `raft manual search --help` for options.\n'
|
|
55705
56224
|
);
|
|
55706
56225
|
registerKnowledgeGetCommand(manualCmd);
|
|
55707
56226
|
registerKnowledgeSearchCommand(manualCmd);
|
|
@@ -55752,6 +56271,14 @@ registerActionPrepareCommand(actionCmd);
|
|
|
55752
56271
|
program2.parseAsync(process.argv, { from: "node" }).catch((err) => {
|
|
55753
56272
|
if (err instanceof CliExit) {
|
|
55754
56273
|
process.exitCode = err.exitCode;
|
|
56274
|
+
} else if (err instanceof CommanderError) {
|
|
56275
|
+
if (err.code === "commander.helpDisplayed" || err.code === "commander.version") {
|
|
56276
|
+
process.exitCode = err.exitCode;
|
|
56277
|
+
return;
|
|
56278
|
+
}
|
|
56279
|
+
const cliError2 = parseStageErrorToCliError(err, program2, process.argv);
|
|
56280
|
+
renderError(defaultCliIo(), cliError2);
|
|
56281
|
+
process.exitCode = cliError2.exitCode;
|
|
55755
56282
|
} else {
|
|
55756
56283
|
process.stderr.write(`Unexpected error: ${err?.message ?? err}
|
|
55757
56284
|
`);
|