@botiverse/raft-daemon 0.65.0 → 0.66.0-play.20260702142221
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-53ZFBLI4.js → chunk-BJDMCNEX.js} +1495 -494
- package/dist/cli/index.js +2575 -866
- package/dist/core.js +5 -1
- package/dist/{dist-OGRAMTIO.js → dist-7Y7CP5NK.js} +2542 -857
- package/dist/index.js +5 -3
- package/package.json +3 -3
|
@@ -16,20 +16,21 @@ import path4 from "path";
|
|
|
16
16
|
import fs2 from "fs";
|
|
17
17
|
import path5 from "path";
|
|
18
18
|
import { randomUUID } from "crypto";
|
|
19
|
+
import { basename } from "path";
|
|
20
|
+
import { existsSync, readFileSync as readFileSync2, statSync } from "fs";
|
|
19
21
|
import fs3 from "fs";
|
|
20
22
|
import os2 from "os";
|
|
21
23
|
import path6 from "path";
|
|
22
24
|
import fs4 from "fs";
|
|
23
25
|
import os3 from "os";
|
|
24
26
|
import path7 from "path";
|
|
25
|
-
import { existsSync, statSync, readFileSync as
|
|
26
|
-
import { basename } from "path";
|
|
27
|
-
import { writeFileSync } from "fs";
|
|
27
|
+
import { existsSync as existsSync2, statSync as statSync2, readFileSync as readFileSync3 } from "fs";
|
|
28
28
|
import { basename as basename2 } from "path";
|
|
29
|
-
import {
|
|
29
|
+
import { writeFileSync } from "fs";
|
|
30
30
|
import fs5 from "fs";
|
|
31
31
|
import os4 from "os";
|
|
32
32
|
import path8 from "path";
|
|
33
|
+
import fs6 from "fs";
|
|
33
34
|
var require2 = __raftCreateRequire(import.meta.url);
|
|
34
35
|
var __create = Object.create;
|
|
35
36
|
var __defProp = Object.defineProperty;
|
|
@@ -1013,7 +1014,7 @@ var require_command = __commonJS({
|
|
|
1013
1014
|
var EventEmitter = __require("events").EventEmitter;
|
|
1014
1015
|
var childProcess = __require("child_process");
|
|
1015
1016
|
var path9 = __require("path");
|
|
1016
|
-
var
|
|
1017
|
+
var fs7 = __require("fs");
|
|
1017
1018
|
var process3 = __require("process");
|
|
1018
1019
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
1019
1020
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -1946,10 +1947,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1946
1947
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1947
1948
|
function findFile(baseDir, baseName) {
|
|
1948
1949
|
const localBin = path9.resolve(baseDir, baseName);
|
|
1949
|
-
if (
|
|
1950
|
+
if (fs7.existsSync(localBin)) return localBin;
|
|
1950
1951
|
if (sourceExt.includes(path9.extname(baseName))) return void 0;
|
|
1951
1952
|
const foundExt = sourceExt.find(
|
|
1952
|
-
(ext) =>
|
|
1953
|
+
(ext) => fs7.existsSync(`${localBin}${ext}`)
|
|
1953
1954
|
);
|
|
1954
1955
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1955
1956
|
return void 0;
|
|
@@ -1961,7 +1962,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1961
1962
|
if (this._scriptPath) {
|
|
1962
1963
|
let resolvedScriptPath;
|
|
1963
1964
|
try {
|
|
1964
|
-
resolvedScriptPath =
|
|
1965
|
+
resolvedScriptPath = fs7.realpathSync(this._scriptPath);
|
|
1965
1966
|
} catch (err) {
|
|
1966
1967
|
resolvedScriptPath = this._scriptPath;
|
|
1967
1968
|
}
|
|
@@ -15439,7 +15440,7 @@ var require_mock_utils = __commonJS({
|
|
|
15439
15440
|
}
|
|
15440
15441
|
return normalizedQp;
|
|
15441
15442
|
}
|
|
15442
|
-
function
|
|
15443
|
+
function safeUrl2(path9) {
|
|
15443
15444
|
if (typeof path9 !== "string") {
|
|
15444
15445
|
return path9;
|
|
15445
15446
|
}
|
|
@@ -15475,10 +15476,10 @@ var require_mock_utils = __commonJS({
|
|
|
15475
15476
|
}
|
|
15476
15477
|
function getMockDispatch(mockDispatches, key) {
|
|
15477
15478
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
15478
|
-
const resolvedPath = typeof basePath === "string" ?
|
|
15479
|
+
const resolvedPath = typeof basePath === "string" ? safeUrl2(basePath) : basePath;
|
|
15479
15480
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
15480
15481
|
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path9, ignoreTrailingSlash }) => {
|
|
15481
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(
|
|
15482
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl2(path9)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl2(path9), resolvedPath);
|
|
15482
15483
|
});
|
|
15483
15484
|
if (matchedMockDispatches.length === 0) {
|
|
15484
15485
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -27890,427 +27891,420 @@ var PI_BUILTIN_PROVIDER_MODELS_GENERATED = {
|
|
|
27890
27891
|
{ id: "deepseek/deepseek-v4-flash", label: "DeepSeek V4 Flash" }
|
|
27891
27892
|
],
|
|
27892
27893
|
"minimax": [
|
|
27894
|
+
{ id: "minimax/MiniMax-M3", label: "MiniMax-M3" },
|
|
27893
27895
|
{ id: "minimax/MiniMax-M2.7", label: "MiniMax-M2.7" },
|
|
27894
|
-
{ id: "minimax/MiniMax-M2.7-highspeed", label: "MiniMax-M2.7-highspeed" }
|
|
27895
|
-
{ id: "minimax/MiniMax-M3", label: "MiniMax-M3" }
|
|
27896
|
+
{ id: "minimax/MiniMax-M2.7-highspeed", label: "MiniMax-M2.7-highspeed" }
|
|
27896
27897
|
],
|
|
27897
27898
|
"minimax-cn": [
|
|
27899
|
+
{ id: "minimax-cn/MiniMax-M3", label: "MiniMax-M3" },
|
|
27898
27900
|
{ id: "minimax-cn/MiniMax-M2.7", label: "MiniMax-M2.7" },
|
|
27899
|
-
{ id: "minimax-cn/MiniMax-M2.7-highspeed", label: "MiniMax-M2.7-highspeed" }
|
|
27900
|
-
{ id: "minimax-cn/MiniMax-M3", label: "MiniMax-M3" }
|
|
27901
|
+
{ id: "minimax-cn/MiniMax-M2.7-highspeed", label: "MiniMax-M2.7-highspeed" }
|
|
27901
27902
|
],
|
|
27902
27903
|
"zai": [
|
|
27904
|
+
{ id: "zai/glm-5.2", label: "GLM-5.2" },
|
|
27903
27905
|
{ id: "zai/glm-5.1", label: "GLM-5.1" },
|
|
27904
|
-
{ id: "zai/glm-4.5-air", label: "GLM-4.5-Air" },
|
|
27905
27906
|
{ id: "zai/glm-4.7", label: "GLM-4.7" },
|
|
27907
|
+
{ id: "zai/glm-4.5-air", label: "GLM-4.5-Air" },
|
|
27906
27908
|
{ id: "zai/glm-5-turbo", label: "GLM-5-Turbo" },
|
|
27907
|
-
{ id: "zai/glm-5.2", label: "GLM-5.2" },
|
|
27908
27909
|
{ id: "zai/glm-5v-turbo", label: "GLM-5V-Turbo" }
|
|
27909
27910
|
],
|
|
27910
27911
|
"zai-coding-cn": [
|
|
27912
|
+
{ id: "zai-coding-cn/glm-5.2", label: "GLM-5.2" },
|
|
27911
27913
|
{ id: "zai-coding-cn/glm-5.1", label: "GLM-5.1" },
|
|
27912
|
-
{ id: "zai-coding-cn/glm-4.5-air", label: "GLM-4.5-Air" },
|
|
27913
27914
|
{ id: "zai-coding-cn/glm-4.7", label: "GLM-4.7" },
|
|
27915
|
+
{ id: "zai-coding-cn/glm-4.5-air", label: "GLM-4.5-Air" },
|
|
27914
27916
|
{ id: "zai-coding-cn/glm-5-turbo", label: "GLM-5-Turbo" },
|
|
27915
|
-
{ id: "zai-coding-cn/glm-5.2", label: "GLM-5.2" },
|
|
27916
27917
|
{ id: "zai-coding-cn/glm-5v-turbo", label: "GLM-5V-Turbo" }
|
|
27917
27918
|
],
|
|
27918
27919
|
"moonshotai": [
|
|
27919
|
-
{ id: "moonshotai/kimi-k2.
|
|
27920
|
-
{ id: "moonshotai/kimi-k2-0711-preview", label: "Kimi K2 0711" },
|
|
27921
|
-
{ id: "moonshotai/kimi-k2-0905-preview", label: "Kimi K2 0905" },
|
|
27920
|
+
{ id: "moonshotai/kimi-k2.7-code", label: "Kimi K2.7 Code" },
|
|
27922
27921
|
{ id: "moonshotai/kimi-k2-thinking", label: "Kimi K2 Thinking" },
|
|
27922
|
+
{ id: "moonshotai/kimi-k2.7-code-highspeed", label: "Kimi K2.7 Code HighSpeed" },
|
|
27923
27923
|
{ id: "moonshotai/kimi-k2-thinking-turbo", label: "Kimi K2 Thinking Turbo" },
|
|
27924
|
-
{ id: "moonshotai/kimi-k2-
|
|
27924
|
+
{ id: "moonshotai/kimi-k2-0905-preview", label: "Kimi K2 0905" },
|
|
27925
|
+
{ id: "moonshotai/kimi-k2-0711-preview", label: "Kimi K2 0711" },
|
|
27926
|
+
{ id: "moonshotai/kimi-k2.6", label: "Kimi K2.6" },
|
|
27925
27927
|
{ id: "moonshotai/kimi-k2.5", label: "Kimi K2.5" },
|
|
27926
|
-
{ id: "moonshotai/kimi-k2
|
|
27927
|
-
{ id: "moonshotai/kimi-k2.7-code-highspeed", label: "Kimi K2.7 Code HighSpeed" }
|
|
27928
|
+
{ id: "moonshotai/kimi-k2-turbo-preview", label: "Kimi K2 Turbo" }
|
|
27928
27929
|
],
|
|
27929
27930
|
"moonshotai-cn": [
|
|
27930
|
-
{ id: "moonshotai-cn/kimi-k2.
|
|
27931
|
-
{ id: "moonshotai-cn/kimi-k2-0711-preview", label: "Kimi K2 0711" },
|
|
27932
|
-
{ id: "moonshotai-cn/kimi-k2-0905-preview", label: "Kimi K2 0905" },
|
|
27931
|
+
{ id: "moonshotai-cn/kimi-k2.7-code", label: "Kimi K2.7 Code" },
|
|
27933
27932
|
{ id: "moonshotai-cn/kimi-k2-thinking", label: "Kimi K2 Thinking" },
|
|
27933
|
+
{ id: "moonshotai-cn/kimi-k2.7-code-highspeed", label: "Kimi K2.7 Code HighSpeed" },
|
|
27934
27934
|
{ id: "moonshotai-cn/kimi-k2-thinking-turbo", label: "Kimi K2 Thinking Turbo" },
|
|
27935
|
-
{ id: "moonshotai-cn/kimi-k2-
|
|
27935
|
+
{ id: "moonshotai-cn/kimi-k2-0905-preview", label: "Kimi K2 0905" },
|
|
27936
|
+
{ id: "moonshotai-cn/kimi-k2-0711-preview", label: "Kimi K2 0711" },
|
|
27937
|
+
{ id: "moonshotai-cn/kimi-k2.6", label: "Kimi K2.6" },
|
|
27936
27938
|
{ id: "moonshotai-cn/kimi-k2.5", label: "Kimi K2.5" },
|
|
27937
|
-
{ id: "moonshotai-cn/kimi-k2
|
|
27938
|
-
{ id: "moonshotai-cn/kimi-k2.7-code-highspeed", label: "Kimi K2.7 Code HighSpeed" }
|
|
27939
|
+
{ id: "moonshotai-cn/kimi-k2-turbo-preview", label: "Kimi K2 Turbo" }
|
|
27939
27940
|
],
|
|
27940
27941
|
"kimi-coding": [
|
|
27941
|
-
{ id: "kimi-coding/kimi-
|
|
27942
|
+
{ id: "kimi-coding/kimi-k2-thinking", label: "Kimi K2 Thinking" },
|
|
27942
27943
|
{ id: "kimi-coding/k2p7", label: "Kimi K2.7 Code" },
|
|
27943
|
-
{ id: "kimi-coding/kimi-
|
|
27944
|
+
{ id: "kimi-coding/kimi-for-coding", label: "Kimi For Coding" }
|
|
27944
27945
|
],
|
|
27945
27946
|
"openrouter": [
|
|
27946
|
-
{ id: "openrouter/moonshotai/kimi-k2.6", label: "MoonshotAI: Kimi K2.6" },
|
|
27947
|
-
{ id: "openrouter/ai21/jamba-large-1.7", label: "AI21: Jamba Large 1.7" },
|
|
27948
|
-
{ id: "openrouter/amazon/nova-2-lite-v1", label: "Amazon: Nova 2 Lite" },
|
|
27949
|
-
{ id: "openrouter/amazon/nova-lite-v1", label: "Amazon: Nova Lite 1.0" },
|
|
27950
|
-
{ id: "openrouter/amazon/nova-micro-v1", label: "Amazon: Nova Micro 1.0" },
|
|
27951
|
-
{ id: "openrouter/amazon/nova-premier-v1", label: "Amazon: Nova Premier 1.0" },
|
|
27952
|
-
{ id: "openrouter/amazon/nova-pro-v1", label: "Amazon: Nova Pro 1.0" },
|
|
27953
|
-
{ id: "openrouter/anthropic/claude-3-haiku", label: "Anthropic: Claude 3 Haiku" },
|
|
27954
|
-
{ id: "openrouter/anthropic/claude-3.5-haiku", label: "Anthropic: Claude 3.5 Haiku" },
|
|
27955
27947
|
{ id: "openrouter/anthropic/claude-fable-5", label: "Anthropic: Claude Fable 5" },
|
|
27956
|
-
{ id: "openrouter
|
|
27957
|
-
{ id: "openrouter/anthropic/claude-opus-4", label: "Anthropic: Claude Opus 4" },
|
|
27958
|
-
{ id: "openrouter/anthropic/claude-opus-4.1", label: "Anthropic: Claude Opus 4.1" },
|
|
27959
|
-
{ id: "openrouter/anthropic/claude-opus-4.5", label: "Anthropic: Claude Opus 4.5" },
|
|
27960
|
-
{ id: "openrouter/anthropic/claude-opus-4.6", label: "Anthropic: Claude Opus 4.6" },
|
|
27961
|
-
{ id: "openrouter/anthropic/claude-opus-4.6-fast", label: "Anthropic: Claude Opus 4.6 (Fast)" },
|
|
27962
|
-
{ id: "openrouter/anthropic/claude-opus-4.7", label: "Anthropic: Claude Opus 4.7" },
|
|
27963
|
-
{ id: "openrouter/anthropic/claude-opus-4.7-fast", label: "Anthropic: Claude Opus 4.7 (Fast)" },
|
|
27948
|
+
{ id: "openrouter/~anthropic/claude-fable-latest", label: "Anthropic: Claude Fable Latest" },
|
|
27964
27949
|
{ id: "openrouter/anthropic/claude-opus-4.8", label: "Anthropic: Claude Opus 4.8" },
|
|
27950
|
+
{ id: "openrouter/anthropic/claude-opus-4.7", label: "Anthropic: Claude Opus 4.7" },
|
|
27951
|
+
{ id: "openrouter/anthropic/claude-opus-4.6", label: "Anthropic: Claude Opus 4.6" },
|
|
27952
|
+
{ id: "openrouter/anthropic/claude-opus-4.5", label: "Anthropic: Claude Opus 4.5" },
|
|
27953
|
+
{ id: "openrouter/anthropic/claude-opus-4.1", label: "Anthropic: Claude Opus 4.1" },
|
|
27954
|
+
{ id: "openrouter/anthropic/claude-opus-4", label: "Anthropic: Claude Opus 4" },
|
|
27955
|
+
{ id: "openrouter/~anthropic/claude-opus-latest", label: "Anthropic: Claude Opus Latest" },
|
|
27965
27956
|
{ id: "openrouter/anthropic/claude-opus-4.8-fast", label: "Anthropic: Claude Opus 4.8 (Fast)" },
|
|
27966
|
-
{ id: "openrouter/anthropic/claude-
|
|
27967
|
-
{ id: "openrouter/anthropic/claude-sonnet-
|
|
27957
|
+
{ id: "openrouter/anthropic/claude-opus-4.7-fast", label: "Anthropic: Claude Opus 4.7 (Fast)" },
|
|
27958
|
+
{ id: "openrouter/anthropic/claude-sonnet-5", label: "Anthropic: Claude Sonnet 5" },
|
|
27968
27959
|
{ id: "openrouter/anthropic/claude-sonnet-4.6", label: "Anthropic: Claude Sonnet 4.6" },
|
|
27969
|
-
{ id: "openrouter/
|
|
27970
|
-
{ id: "openrouter/
|
|
27971
|
-
{ id: "openrouter/
|
|
27972
|
-
{ id: "openrouter/
|
|
27973
|
-
{ id: "openrouter/
|
|
27974
|
-
{ id: "openrouter/
|
|
27975
|
-
{ id: "openrouter/
|
|
27976
|
-
{ id: "openrouter/
|
|
27977
|
-
{ id: "openrouter/
|
|
27978
|
-
{ id: "openrouter/
|
|
27979
|
-
{ id: "openrouter/cohere/north-mini-code:free", label: "Cohere: North Mini Code (free)" },
|
|
27980
|
-
{ id: "openrouter/deepseek/deepseek-chat", label: "DeepSeek: DeepSeek V3" },
|
|
27981
|
-
{ id: "openrouter/deepseek/deepseek-chat-v3-0324", label: "DeepSeek: DeepSeek V3 0324" },
|
|
27982
|
-
{ id: "openrouter/deepseek/deepseek-chat-v3.1", label: "DeepSeek: DeepSeek V3.1" },
|
|
27983
|
-
{ id: "openrouter/deepseek/deepseek-r1", label: "DeepSeek: R1" },
|
|
27984
|
-
{ id: "openrouter/deepseek/deepseek-r1-0528", label: "DeepSeek: R1 0528" },
|
|
27985
|
-
{ id: "openrouter/deepseek/deepseek-v3.1-terminus", label: "DeepSeek: DeepSeek V3.1 Terminus" },
|
|
27986
|
-
{ id: "openrouter/deepseek/deepseek-v3.2", label: "DeepSeek: DeepSeek V3.2" },
|
|
27987
|
-
{ id: "openrouter/deepseek/deepseek-v3.2-exp", label: "DeepSeek: DeepSeek V3.2 Exp" },
|
|
27988
|
-
{ id: "openrouter/deepseek/deepseek-v4-flash", label: "DeepSeek: DeepSeek V4 Flash" },
|
|
27989
|
-
{ id: "openrouter/deepseek/deepseek-v4-pro", label: "DeepSeek: DeepSeek V4 Pro" },
|
|
27990
|
-
{ id: "openrouter/essentialai/rnj-1-instruct", label: "EssentialAI: Rnj 1 Instruct" },
|
|
27991
|
-
{ id: "openrouter/google/gemini-2.5-flash", label: "Google: Gemini 2.5 Flash" },
|
|
27992
|
-
{ id: "openrouter/google/gemini-2.5-flash-lite", label: "Google: Gemini 2.5 Flash Lite" },
|
|
27993
|
-
{ id: "openrouter/google/gemini-2.5-flash-lite-preview-09-2025", label: "Google: Gemini 2.5 Flash Lite Preview 09-2025" },
|
|
27994
|
-
{ id: "openrouter/google/gemini-2.5-pro", label: "Google: Gemini 2.5 Pro" },
|
|
27960
|
+
{ id: "openrouter/anthropic/claude-sonnet-4.5", label: "Anthropic: Claude Sonnet 4.5" },
|
|
27961
|
+
{ id: "openrouter/anthropic/claude-sonnet-4", label: "Anthropic: Claude Sonnet 4" },
|
|
27962
|
+
{ id: "openrouter/~anthropic/claude-sonnet-latest", label: "Anthropic Claude Sonnet Latest" },
|
|
27963
|
+
{ id: "openrouter/anthropic/claude-haiku-4.5", label: "Anthropic: Claude Haiku 4.5" },
|
|
27964
|
+
{ id: "openrouter/anthropic/claude-3-haiku", label: "Anthropic: Claude 3 Haiku" },
|
|
27965
|
+
{ id: "openrouter/~anthropic/claude-haiku-latest", label: "Anthropic Claude Haiku Latest" },
|
|
27966
|
+
{ id: "openrouter/openai/gpt-5.1-codex-max", label: "OpenAI: GPT-5.1-Codex-Max" },
|
|
27967
|
+
{ id: "openrouter/kwaipilot/kat-coder-pro-v2", label: "Kwaipilot: KAT-Coder-Pro V2" },
|
|
27968
|
+
{ id: "openrouter/qwen/qwen3-max-thinking", label: "Qwen: Qwen3 Max Thinking" },
|
|
27969
|
+
{ id: "openrouter/nvidia/nemotron-3-ultra-550b-a55b", label: "NVIDIA: Nemotron 3 Ultra" },
|
|
27995
27970
|
{ id: "openrouter/google/gemini-2.5-pro-preview", label: "Google: Gemini 2.5 Pro Preview 06-05" },
|
|
27996
27971
|
{ id: "openrouter/google/gemini-2.5-pro-preview-05-06", label: "Google: Gemini 2.5 Pro Preview 05-06" },
|
|
27997
|
-
{ id: "openrouter/
|
|
27998
|
-
{ id: "openrouter/
|
|
27999
|
-
{ id: "openrouter/
|
|
28000
|
-
{ id: "openrouter/
|
|
27972
|
+
{ id: "openrouter/openai/gpt-5.5-pro", label: "OpenAI: GPT-5.5 Pro" },
|
|
27973
|
+
{ id: "openrouter/openai/gpt-5.4-pro", label: "OpenAI: GPT-5.4 Pro" },
|
|
27974
|
+
{ id: "openrouter/openai/gpt-5.2-pro", label: "OpenAI: GPT-5.2 Pro" },
|
|
27975
|
+
{ id: "openrouter/openai/gpt-5-pro", label: "OpenAI: GPT-5 Pro" },
|
|
27976
|
+
{ id: "openrouter/deepseek/deepseek-v4-pro", label: "DeepSeek: DeepSeek V4 Pro" },
|
|
27977
|
+
{ id: "openrouter/qwen/qwen3.7-max", label: "Qwen: Qwen3.7 Max" },
|
|
27978
|
+
{ id: "openrouter/qwen/qwen3.6-max-preview", label: "Qwen: Qwen3.6 Max Preview" },
|
|
28001
27979
|
{ id: "openrouter/google/gemini-3.1-pro-preview", label: "Google: Gemini 3.1 Pro Preview" },
|
|
28002
27980
|
{ id: "openrouter/google/gemini-3.1-pro-preview-customtools", label: "Google: Gemini 3.1 Pro Preview Custom Tools" },
|
|
28003
|
-
{ id: "openrouter/
|
|
28004
|
-
{ id: "openrouter/
|
|
27981
|
+
{ id: "openrouter/openai/o3-pro", label: "OpenAI: o3 Pro" },
|
|
27982
|
+
{ id: "openrouter/qwen/qwen3-max", label: "Qwen: Qwen3 Max" },
|
|
27983
|
+
{ id: "openrouter/upstage/solar-pro-3", label: "Upstage: Solar Pro 3" },
|
|
27984
|
+
{ id: "openrouter/google/gemini-2.5-pro", label: "Google: Gemini 2.5 Pro" },
|
|
27985
|
+
{ id: "openrouter/xiaomi/mimo-v2.5-pro", label: "Xiaomi: MiMo-V2.5-Pro" },
|
|
27986
|
+
{ id: "openrouter/amazon/nova-premier-v1", label: "Amazon: Nova Premier 1.0" },
|
|
27987
|
+
{ id: "openrouter/amazon/nova-pro-v1", label: "Amazon: Nova Pro 1.0" },
|
|
27988
|
+
{ id: "openrouter/~google/gemini-pro-latest", label: "Google Gemini Pro Latest" },
|
|
27989
|
+
{ id: "openrouter/sakana/fugu-ultra", label: "Sakana: Fugu Ultra" },
|
|
27990
|
+
{ id: "openrouter/arcee-ai/trinity-large-thinking", label: "Arcee AI: Trinity Large Thinking" },
|
|
27991
|
+
{ id: "openrouter/qwen/qwen3-coder", label: "Qwen: Qwen3 Coder 480B A35B" },
|
|
27992
|
+
{ id: "openrouter/qwen/qwen3-coder-30b-a3b-instruct", label: "Qwen: Qwen3 Coder 30B A3B Instruct" },
|
|
27993
|
+
{ id: "openrouter/openai/gpt-5.3-codex", label: "OpenAI: GPT-5.3-Codex" },
|
|
27994
|
+
{ id: "openrouter/openai/gpt-5.2-codex", label: "OpenAI: GPT-5.2-Codex" },
|
|
27995
|
+
{ id: "openrouter/openai/gpt-5.1-codex", label: "OpenAI: GPT-5.1-Codex" },
|
|
27996
|
+
{ id: "openrouter/openai/gpt-5-codex", label: "OpenAI: GPT-5 Codex" },
|
|
27997
|
+
{ id: "openrouter/qwen/qwen3-coder-next", label: "Qwen: Qwen3 Coder Next" },
|
|
27998
|
+
{ id: "openrouter/qwen/qwen3-coder-plus", label: "Qwen: Qwen3 Coder Plus" },
|
|
27999
|
+
{ id: "openrouter/moonshotai/kimi-k2.7-code", label: "MoonshotAI: Kimi K2.7 Code" },
|
|
28000
|
+
{ id: "openrouter/qwen/qwen3-235b-a22b-thinking-2507", label: "Qwen: Qwen3 235B A22B Thinking 2507" },
|
|
28001
|
+
{ id: "openrouter/qwen/qwen3-30b-a3b-thinking-2507", label: "Qwen: Qwen3 30B A3B Thinking 2507" },
|
|
28002
|
+
{ id: "openrouter/qwen/qwen-plus-2025-07-28:thinking", label: "Qwen: Qwen Plus 0728 (thinking)" },
|
|
28003
|
+
{ id: "openrouter/qwen/qwen3-vl-235b-a22b-thinking", label: "Qwen: Qwen3 VL 235B A22B Thinking" },
|
|
28004
|
+
{ id: "openrouter/qwen/qwen3-next-80b-a3b-thinking", label: "Qwen: Qwen3 Next 80B A3B Thinking" },
|
|
28005
|
+
{ id: "openrouter/qwen/qwen3-vl-30b-a3b-thinking", label: "Qwen: Qwen3 VL 30B A3B Thinking" },
|
|
28006
|
+
{ id: "openrouter/qwen/qwen3-vl-8b-thinking", label: "Qwen: Qwen3 VL 8B Thinking" },
|
|
28007
|
+
{ id: "openrouter/google/gemini-3-pro-image", label: "Google: Nano Banana Pro (Gemini 3 Pro Image)" },
|
|
28008
|
+
{ id: "openrouter/moonshotai/kimi-k2-thinking", label: "MoonshotAI: Kimi K2 Thinking" },
|
|
28009
|
+
{ id: "openrouter/qwen/qwen3-coder-flash", label: "Qwen: Qwen3 Coder Flash" },
|
|
28010
|
+
{ id: "openrouter/mistralai/mistral-large-2512", label: "Mistral: Mistral Large 3 2512" },
|
|
28011
|
+
{ id: "openrouter/mistralai/mistral-large-2407", label: "Mistral Large 2407" },
|
|
28012
|
+
{ id: "openrouter/nvidia/nemotron-3-super-120b-a12b", label: "NVIDIA: Nemotron 3 Super" },
|
|
28013
|
+
{ id: "openrouter/nvidia/llama-3.3-nemotron-super-49b-v1.5", label: "NVIDIA: Llama 3.3 Nemotron Super 49B V1.5" },
|
|
28014
|
+
{ id: "openrouter/ai21/jamba-large-1.7", label: "AI21: Jamba Large 1.7" },
|
|
28015
|
+
{ id: "openrouter/arcee-ai/virtuoso-large", label: "Arcee AI: Virtuoso Large" },
|
|
28016
|
+
{ id: "openrouter/mistralai/mistral-large", label: "Mistral Large" },
|
|
28017
|
+
{ id: "openrouter/nvidia/nemotron-3-ultra-550b-a55b:free", label: "NVIDIA: Nemotron 3 Ultra (free)" },
|
|
28018
|
+
{ id: "openrouter/openai/gpt-5.1-codex-mini", label: "OpenAI: GPT-5.1-Codex-Mini" },
|
|
28019
|
+
{ id: "openrouter/qwen/qwen3.5-plus-20260420", label: "Qwen: Qwen3.5 Plus 2026-04-20" },
|
|
28020
|
+
{ id: "openrouter/mistralai/mistral-small-2603", label: "Mistral: Mistral Small 4" },
|
|
28021
|
+
{ id: "openrouter/mistralai/devstral-2512", label: "Mistral: Devstral 2 2512" },
|
|
28022
|
+
{ id: "openrouter/mistralai/ministral-14b-2512", label: "Mistral: Ministral 3 14B 2512" },
|
|
28023
|
+
{ id: "openrouter/mistralai/ministral-3b-2512", label: "Mistral: Ministral 3 3B 2512" },
|
|
28024
|
+
{ id: "openrouter/mistralai/ministral-8b-2512", label: "Mistral: Ministral 3 8B 2512" },
|
|
28025
|
+
{ id: "openrouter/mistralai/codestral-2508", label: "Mistral: Codestral 2508" },
|
|
28026
|
+
{ id: "openrouter/mistralai/voxtral-small-24b-2507", label: "Mistral: Voxtral Small 24B 2507" },
|
|
28027
|
+
{ id: "openrouter/qwen/qwen3-235b-a22b-2507", label: "Qwen: Qwen3 235B A22B Instruct 2507" },
|
|
28028
|
+
{ id: "openrouter/qwen/qwen3-30b-a3b-instruct-2507", label: "Qwen: Qwen3 30B A3B Instruct 2507" },
|
|
28029
|
+
{ id: "openrouter/qwen/qwen3.5-plus-02-15", label: "Qwen: Qwen3.5 Plus 2026-02-15" },
|
|
28030
|
+
{ id: "openrouter/qwen/qwen-plus-2025-07-28", label: "Qwen: Qwen Plus 0728" },
|
|
28031
|
+
{ id: "openrouter/openai/gpt-4o-2024-11-20", label: "OpenAI: GPT-4o (2024-11-20)" },
|
|
28032
|
+
{ id: "openrouter/openai/gpt-4o-2024-08-06", label: "OpenAI: GPT-4o (2024-08-06)" },
|
|
28033
|
+
{ id: "openrouter/openai/gpt-4o-2024-05-13", label: "OpenAI: GPT-4o (2024-05-13)" },
|
|
28034
|
+
{ id: "openrouter/moonshotai/kimi-k2-0905", label: "MoonshotAI: Kimi K2 0905" },
|
|
28035
|
+
{ id: "openrouter/moonshotai/kimi-k2", label: "MoonshotAI: Kimi K2 0711" },
|
|
28036
|
+
{ id: "openrouter/deepseek/deepseek-r1-0528", label: "DeepSeek: R1 0528" },
|
|
28037
|
+
{ id: "openrouter/qwen/qwen3-coder:free", label: "Qwen: Qwen3 Coder 480B A35B (free)" },
|
|
28038
|
+
{ id: "openrouter/qwen/qwen3.5-397b-a17b", label: "Qwen: Qwen3.5 397B A17B" },
|
|
28039
|
+
{ id: "openrouter/deepseek/deepseek-chat-v3-0324", label: "DeepSeek: DeepSeek V3 0324" },
|
|
28040
|
+
{ id: "openrouter/qwen/qwen3-235b-a22b", label: "Qwen: Qwen3 235B A22B" },
|
|
28041
|
+
{ id: "openrouter/qwen/qwen3-vl-235b-a22b-instruct", label: "Qwen: Qwen3 VL 235B A22B Instruct" },
|
|
28042
|
+
{ id: "openrouter/openai/gpt-oss-120b", label: "OpenAI: gpt-oss-120b" },
|
|
28043
|
+
{ id: "openrouter/qwen/qwen3-next-80b-a3b-instruct", label: "Qwen: Qwen3 Next 80B A3B Instruct" },
|
|
28044
|
+
{ id: "openrouter/qwen/qwen-2.5-72b-instruct", label: "Qwen2.5 72B Instruct" },
|
|
28045
|
+
{ id: "openrouter/meta-llama/llama-3.1-70b-instruct", label: "Meta: Llama 3.1 70B Instruct" },
|
|
28046
|
+
{ id: "openrouter/meta-llama/llama-3.3-70b-instruct", label: "Meta: Llama 3.3 70B Instruct" },
|
|
28047
|
+
{ id: "openrouter/sao10k/l3.1-euryale-70b", label: "Sao10K: Llama 3.1 Euryale 70B v2.2" },
|
|
28048
|
+
{ id: "openrouter/qwen/qwen3.6-35b-a3b", label: "Qwen: Qwen3.6 35B A3B" },
|
|
28049
|
+
{ id: "openrouter/qwen/qwen3-32b", label: "Qwen: Qwen3 32B" },
|
|
28050
|
+
{ id: "openrouter/qwen/qwen3-vl-32b-instruct", label: "Qwen: Qwen3 VL 32B Instruct" },
|
|
28051
|
+
{ id: "openrouter/google/gemma-4-31b-it", label: "Google: Gemma 4 31B" },
|
|
28052
|
+
{ id: "openrouter/qwen/qwen3-30b-a3b", label: "Qwen: Qwen3 30B A3B" },
|
|
28053
|
+
{ id: "openrouter/qwen/qwen3-vl-30b-a3b-instruct", label: "Qwen: Qwen3 VL 30B A3B Instruct" },
|
|
28054
|
+
{ id: "openrouter/cohere/command-r-08-2024", label: "Cohere: Command R (08-2024)" },
|
|
28055
|
+
{ id: "openrouter/cohere/command-r-plus-08-2024", label: "Cohere: Command R+ (08-2024)" },
|
|
28005
28056
|
{ id: "openrouter/google/gemma-3-27b-it", label: "Google: Gemma 3 27B" },
|
|
28057
|
+
{ id: "openrouter/qwen/qwen3.6-27b", label: "Qwen: Qwen3.6 27B" },
|
|
28006
28058
|
{ id: "openrouter/google/gemma-4-26b-a4b-it", label: "Google: Gemma 4 26B A4B " },
|
|
28007
|
-
{ id: "openrouter/
|
|
28008
|
-
{ id: "openrouter/
|
|
28009
|
-
{ id: "openrouter/
|
|
28059
|
+
{ id: "openrouter/mistralai/mistral-small-3.2-24b-instruct", label: "Mistral: Mistral Small 3.2 24B" },
|
|
28060
|
+
{ id: "openrouter/mistralai/mixtral-8x22b-instruct", label: "Mistral: Mixtral 8x22B Instruct" },
|
|
28061
|
+
{ id: "openrouter/openai/gpt-oss-20b", label: "OpenAI: gpt-oss-20b" },
|
|
28062
|
+
{ id: "openrouter/openai/gpt-oss-safeguard-20b", label: "OpenAI: gpt-oss-safeguard-20b" },
|
|
28063
|
+
{ id: "openrouter/qwen/qwen3-14b", label: "Qwen: Qwen3 14B" },
|
|
28064
|
+
{ id: "openrouter/google/gemma-3-12b-it", label: "Google: Gemma 3 12B" },
|
|
28065
|
+
{ id: "openrouter/thedrummer/unslopnemo-12b", label: "TheDrummer: UnslopNemo 12B" },
|
|
28066
|
+
{ id: "openrouter/qwen/qwen3.5-122b-a10b", label: "Qwen: Qwen3.5-122B-A10B" },
|
|
28010
28067
|
{ id: "openrouter/ibm-granite/granite-4.1-8b", label: "IBM: Granite 4.1 8B" },
|
|
28011
|
-
{ id: "openrouter/inception/mercury-2", label: "Inception: Mercury 2" },
|
|
28012
|
-
{ id: "openrouter/inclusionai/ling-2.6-1t", label: "inclusionAI: Ling-2.6-1T" },
|
|
28013
|
-
{ id: "openrouter/inclusionai/ling-2.6-flash", label: "inclusionAI: Ling-2.6-flash" },
|
|
28014
|
-
{ id: "openrouter/inclusionai/ring-2.6-1t", label: "inclusionAI: Ring-2.6-1T" },
|
|
28015
|
-
{ id: "openrouter/kwaipilot/kat-coder-pro-v2", label: "Kwaipilot: KAT-Coder-Pro V2" },
|
|
28016
|
-
{ id: "openrouter/liquid/lfm-2.5-1.2b-thinking:free", label: "LiquidAI: LFM2.5-1.2B-Thinking (free)" },
|
|
28017
|
-
{ id: "openrouter/meta-llama/llama-3.1-70b-instruct", label: "Meta: Llama 3.1 70B Instruct" },
|
|
28018
28068
|
{ id: "openrouter/meta-llama/llama-3.1-8b-instruct", label: "Meta: Llama 3.1 8B Instruct" },
|
|
28019
|
-
{ id: "openrouter/
|
|
28020
|
-
{ id: "openrouter/
|
|
28069
|
+
{ id: "openrouter/qwen/qwen3-8b", label: "Qwen: Qwen3 8B" },
|
|
28070
|
+
{ id: "openrouter/qwen/qwen3-vl-8b-instruct", label: "Qwen: Qwen3 VL 8B Instruct" },
|
|
28071
|
+
{ id: "openrouter/qwen/qwen-2.5-7b-instruct", label: "Qwen: Qwen2.5 7B Instruct" },
|
|
28072
|
+
{ id: "openrouter/openai/gpt-5.5", label: "OpenAI: GPT-5.5" },
|
|
28073
|
+
{ id: "openrouter/openai/gpt-5.4", label: "OpenAI: GPT-5.4" },
|
|
28074
|
+
{ id: "openrouter/openai/gpt-5.3-chat", label: "OpenAI: GPT-5.3 Chat" },
|
|
28075
|
+
{ id: "openrouter/openai/gpt-5.2", label: "OpenAI: GPT-5.2" },
|
|
28076
|
+
{ id: "openrouter/openai/gpt-5.2-chat", label: "OpenAI: GPT-5.2 Chat" },
|
|
28077
|
+
{ id: "openrouter/z-ai/glm-5.2", label: "Z.ai: GLM 5.2" },
|
|
28078
|
+
{ id: "openrouter/openai/gpt-5.1", label: "OpenAI: GPT-5.1" },
|
|
28079
|
+
{ id: "openrouter/openai/gpt-5.1-chat", label: "OpenAI: GPT-5.1 Chat" },
|
|
28080
|
+
{ id: "openrouter/z-ai/glm-5.1", label: "Z.ai: GLM 5.1" },
|
|
28081
|
+
{ id: "openrouter/openai/gpt-5", label: "OpenAI: GPT-5" },
|
|
28082
|
+
{ id: "openrouter/z-ai/glm-5", label: "Z.ai: GLM 5" },
|
|
28083
|
+
{ id: "openrouter/x-ai/grok-4.20", label: "xAI: Grok 4.20" },
|
|
28084
|
+
{ id: "openrouter/z-ai/glm-4.7", label: "Z.ai: GLM 4.7" },
|
|
28085
|
+
{ id: "openrouter/z-ai/glm-4.6", label: "Z.ai: GLM 4.6" },
|
|
28086
|
+
{ id: "openrouter/z-ai/glm-4.6v", label: "Z.ai: GLM 4.6V" },
|
|
28087
|
+
{ id: "openrouter/z-ai/glm-4.5", label: "Z.ai: GLM 4.5" },
|
|
28088
|
+
{ id: "openrouter/z-ai/glm-4.5-air", label: "Z.ai: GLM 4.5 Air" },
|
|
28089
|
+
{ id: "openrouter/z-ai/glm-4.5v", label: "Z.ai: GLM 4.5V" },
|
|
28090
|
+
{ id: "openrouter/x-ai/grok-4.3", label: "xAI: Grok 4.3" },
|
|
28091
|
+
{ id: "openrouter/openai/gpt-4.1", label: "OpenAI: GPT-4.1" },
|
|
28021
28092
|
{ id: "openrouter/meta-llama/llama-4-maverick", label: "Meta: Llama 4 Maverick" },
|
|
28022
28093
|
{ id: "openrouter/meta-llama/llama-4-scout", label: "Meta: Llama 4 Scout" },
|
|
28023
|
-
{ id: "openrouter/
|
|
28024
|
-
{ id: "openrouter/
|
|
28025
|
-
{ id: "openrouter/
|
|
28026
|
-
{ id: "openrouter/
|
|
28027
|
-
{ id: "openrouter/
|
|
28028
|
-
{ id: "openrouter/
|
|
28029
|
-
{ id: "openrouter/
|
|
28030
|
-
{ id: "openrouter/mistralai/devstral-2512", label: "Mistral: Devstral 2 2512" },
|
|
28031
|
-
{ id: "openrouter/mistralai/ministral-14b-2512", label: "Mistral: Ministral 3 14B 2512" },
|
|
28032
|
-
{ id: "openrouter/mistralai/ministral-3b-2512", label: "Mistral: Ministral 3 3B 2512" },
|
|
28033
|
-
{ id: "openrouter/mistralai/ministral-8b-2512", label: "Mistral: Ministral 3 8B 2512" },
|
|
28034
|
-
{ id: "openrouter/mistralai/mistral-large", label: "Mistral Large" },
|
|
28035
|
-
{ id: "openrouter/mistralai/mistral-large-2407", label: "Mistral Large 2407" },
|
|
28036
|
-
{ id: "openrouter/mistralai/mistral-large-2512", label: "Mistral: Mistral Large 3 2512" },
|
|
28037
|
-
{ id: "openrouter/mistralai/mistral-medium-3", label: "Mistral: Mistral Medium 3" },
|
|
28094
|
+
{ id: "openrouter/openai/gpt-4", label: "OpenAI: GPT-4" },
|
|
28095
|
+
{ id: "openrouter/openai/gpt-4o", label: "OpenAI: GPT-4o" },
|
|
28096
|
+
{ id: "openrouter/qwen/qwen3.7-plus", label: "Qwen: Qwen3.7 Plus" },
|
|
28097
|
+
{ id: "openrouter/qwen/qwen3.6-plus", label: "Qwen: Qwen3.6 Plus" },
|
|
28098
|
+
{ id: "openrouter/qwen/qwen3.5-35b-a3b", label: "Qwen: Qwen3.5-35B-A3B" },
|
|
28099
|
+
{ id: "openrouter/qwen/qwen3.5-27b", label: "Qwen: Qwen3.5-27B" },
|
|
28100
|
+
{ id: "openrouter/qwen/qwen3.5-9b", label: "Qwen: Qwen3.5-9B" },
|
|
28038
28101
|
{ id: "openrouter/mistralai/mistral-medium-3-5", label: "Mistral: Mistral Medium 3.5" },
|
|
28102
|
+
{ id: "openrouter/deepseek/deepseek-v3.2", label: "DeepSeek: DeepSeek V3.2" },
|
|
28103
|
+
{ id: "openrouter/deepseek/deepseek-v3.2-exp", label: "DeepSeek: DeepSeek V3.2 Exp" },
|
|
28104
|
+
{ id: "openrouter/deepseek/deepseek-chat-v3.1", label: "DeepSeek: DeepSeek V3.1" },
|
|
28105
|
+
{ id: "openrouter/deepseek/deepseek-v3.1-terminus", label: "DeepSeek: DeepSeek V3.1 Terminus" },
|
|
28039
28106
|
{ id: "openrouter/mistralai/mistral-medium-3.1", label: "Mistral: Mistral Medium 3.1" },
|
|
28107
|
+
{ id: "openrouter/deepseek/deepseek-chat", label: "DeepSeek: DeepSeek V3" },
|
|
28108
|
+
{ id: "openrouter/minimax/minimax-m3", label: "MiniMax: MiniMax M3" },
|
|
28109
|
+
{ id: "openrouter/mistralai/mistral-medium-3", label: "Mistral: Mistral Medium 3" },
|
|
28110
|
+
{ id: "openrouter/openai/o3", label: "OpenAI: o3" },
|
|
28111
|
+
{ id: "openrouter/openai/o3-deep-research", label: "OpenAI: o3 Deep Research" },
|
|
28112
|
+
{ id: "openrouter/tencent/hy3-preview", label: "Tencent: Hy3 preview" },
|
|
28113
|
+
{ id: "openrouter/minimax/minimax-m2.7", label: "MiniMax: MiniMax M2.7" },
|
|
28114
|
+
{ id: "openrouter/inclusionai/ling-2.6-1t", label: "inclusionAI: Ling-2.6-1T" },
|
|
28115
|
+
{ id: "openrouter/inclusionai/ring-2.6-1t", label: "inclusionAI: Ring-2.6-1T" },
|
|
28116
|
+
{ id: "openrouter/moonshotai/kimi-k2.6", label: "MoonshotAI: Kimi K2.6" },
|
|
28117
|
+
{ id: "openrouter/minimax/minimax-m2.5", label: "MiniMax: MiniMax M2.5" },
|
|
28118
|
+
{ id: "openrouter/moonshotai/kimi-k2.5", label: "MoonshotAI: Kimi K2.5" },
|
|
28119
|
+
{ id: "openrouter/xiaomi/mimo-v2.5", label: "Xiaomi: MiMo-V2.5" },
|
|
28120
|
+
{ id: "openrouter/minimax/minimax-m2.1", label: "MiniMax: MiniMax M2.1" },
|
|
28121
|
+
{ id: "openrouter/inception/mercury-2", label: "Inception: Mercury 2" },
|
|
28122
|
+
{ id: "openrouter/minimax/minimax-m2", label: "MiniMax: MiniMax M2" },
|
|
28123
|
+
{ id: "openrouter/poolside/laguna-xs.2", label: "Poolside: Laguna XS.2" },
|
|
28124
|
+
{ id: "openrouter/bytedance-seed/seed-1.6", label: "ByteDance Seed: Seed 1.6" },
|
|
28125
|
+
{ id: "openrouter/deepseek/deepseek-r1", label: "DeepSeek: R1" },
|
|
28126
|
+
{ id: "openrouter/minimax/minimax-m1", label: "MiniMax: MiniMax M1" },
|
|
28127
|
+
{ id: "openrouter/openai/o1", label: "OpenAI: o1" },
|
|
28128
|
+
{ id: "openrouter/poolside/laguna-m.1", label: "Poolside: Laguna M.1" },
|
|
28129
|
+
{ id: "openrouter/x-ai/grok-build-0.1", label: "xAI: Grok Build 0.1" },
|
|
28130
|
+
{ id: "openrouter/auto", label: "Auto" },
|
|
28131
|
+
{ id: "openrouter/openrouter/auto", label: "Auto Router" },
|
|
28040
28132
|
{ id: "openrouter/mistralai/mistral-nemo", label: "Mistral: Mistral Nemo" },
|
|
28041
28133
|
{ id: "openrouter/mistralai/mistral-saba", label: "Mistral: Saba" },
|
|
28042
|
-
{ id: "openrouter/
|
|
28043
|
-
{ id: "openrouter/
|
|
28044
|
-
{ id: "openrouter/
|
|
28045
|
-
{ id: "openrouter/
|
|
28046
|
-
{ id: "openrouter/
|
|
28047
|
-
{ id: "openrouter/
|
|
28048
|
-
{ id: "openrouter/
|
|
28049
|
-
{ id: "openrouter/
|
|
28050
|
-
{ id: "openrouter/
|
|
28051
|
-
{ id: "openrouter/nex-agi/nex-n2-pro:free", label: "Nex AGI: Nex-N2-Pro (free)" },
|
|
28052
|
-
{ id: "openrouter/nvidia/llama-3.3-nemotron-super-49b-v1.5", label: "NVIDIA: Llama 3.3 Nemotron Super 49B V1.5" },
|
|
28053
|
-
{ id: "openrouter/nvidia/nemotron-3-nano-30b-a3b", label: "NVIDIA: Nemotron 3 Nano 30B A3B" },
|
|
28054
|
-
{ id: "openrouter/nvidia/nemotron-3-nano-30b-a3b:free", label: "NVIDIA: Nemotron 3 Nano 30B A3B (free)" },
|
|
28055
|
-
{ id: "openrouter/nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free", label: "NVIDIA: Nemotron 3 Nano Omni (free)" },
|
|
28056
|
-
{ id: "openrouter/nvidia/nemotron-3-super-120b-a12b", label: "NVIDIA: Nemotron 3 Super" },
|
|
28057
|
-
{ id: "openrouter/nvidia/nemotron-3-super-120b-a12b:free", label: "NVIDIA: Nemotron 3 Super (free)" },
|
|
28058
|
-
{ id: "openrouter/nvidia/nemotron-3-ultra-550b-a55b", label: "NVIDIA: Nemotron 3 Ultra" },
|
|
28059
|
-
{ id: "openrouter/nvidia/nemotron-3-ultra-550b-a55b:free", label: "NVIDIA: Nemotron 3 Ultra (free)" },
|
|
28060
|
-
{ id: "openrouter/nvidia/nemotron-nano-12b-v2-vl:free", label: "NVIDIA: Nemotron Nano 12B 2 VL (free)" },
|
|
28061
|
-
{ id: "openrouter/nvidia/nemotron-nano-9b-v2:free", label: "NVIDIA: Nemotron Nano 9B V2 (free)" },
|
|
28062
|
-
{ id: "openrouter/openai/gpt-3.5-turbo", label: "OpenAI: GPT-3.5 Turbo" },
|
|
28134
|
+
{ id: "openrouter/~moonshotai/kimi-latest", label: "MoonshotAI Kimi Latest" },
|
|
28135
|
+
{ id: "openrouter/~openai/gpt-latest", label: "OpenAI GPT Latest" },
|
|
28136
|
+
{ id: "openrouter/openai/gpt-audio", label: "OpenAI: GPT Audio" },
|
|
28137
|
+
{ id: "openrouter/openai/gpt-chat-latest", label: "OpenAI: GPT Chat Latest" },
|
|
28138
|
+
{ id: "openrouter/openrouter/fusion", label: "OpenRouter: Fusion" },
|
|
28139
|
+
{ id: "openrouter/qwen/qwen-plus", label: "Qwen: Qwen-Plus" },
|
|
28140
|
+
{ id: "openrouter/rekaai/reka-edge", label: "Reka Edge" },
|
|
28141
|
+
{ id: "openrouter/relace/relace-search", label: "Relace: Relace Search" },
|
|
28142
|
+
{ id: "openrouter/liquid/lfm-2.5-1.2b-thinking:free", label: "LiquidAI: LFM2.5-1.2B-Thinking (free)" },
|
|
28063
28143
|
{ id: "openrouter/openai/gpt-3.5-turbo-0613", label: "OpenAI: GPT-3.5 Turbo (older v0613)" },
|
|
28064
28144
|
{ id: "openrouter/openai/gpt-3.5-turbo-16k", label: "OpenAI: GPT-3.5 Turbo 16k" },
|
|
28065
|
-
{ id: "openrouter/
|
|
28145
|
+
{ id: "openrouter/z-ai/glm-5-turbo", label: "Z.ai: GLM 5 Turbo" },
|
|
28146
|
+
{ id: "openrouter/z-ai/glm-5v-turbo", label: "Z.ai: GLM 5V Turbo" },
|
|
28147
|
+
{ id: "openrouter/z-ai/glm-4.7-flash", label: "Z.ai: GLM 4.7 Flash" },
|
|
28148
|
+
{ id: "openrouter/deepseek/deepseek-v4-flash", label: "DeepSeek: DeepSeek V4 Flash" },
|
|
28066
28149
|
{ id: "openrouter/openai/gpt-4-turbo", label: "OpenAI: GPT-4 Turbo" },
|
|
28067
28150
|
{ id: "openrouter/openai/gpt-4-turbo-preview", label: "OpenAI: GPT-4 Turbo Preview" },
|
|
28068
|
-
{ id: "openrouter/
|
|
28069
|
-
{ id: "openrouter/
|
|
28070
|
-
{ id: "openrouter/
|
|
28071
|
-
{ id: "openrouter/openai/gpt-
|
|
28072
|
-
{ id: "openrouter/
|
|
28073
|
-
{ id: "openrouter/
|
|
28074
|
-
{ id: "openrouter/
|
|
28075
|
-
{ id: "openrouter/
|
|
28151
|
+
{ id: "openrouter/stepfun/step-3.7-flash", label: "StepFun: Step 3.7 Flash" },
|
|
28152
|
+
{ id: "openrouter/qwen/qwen3.6-flash", label: "Qwen: Qwen3.6 Flash" },
|
|
28153
|
+
{ id: "openrouter/google/gemini-3.5-flash", label: "Google: Gemini 3.5 Flash" },
|
|
28154
|
+
{ id: "openrouter/openai/gpt-3.5-turbo", label: "OpenAI: GPT-3.5 Turbo" },
|
|
28155
|
+
{ id: "openrouter/qwen/qwen3.5-flash-02-23", label: "Qwen: Qwen3.5-Flash" },
|
|
28156
|
+
{ id: "openrouter/stepfun/step-3.5-flash", label: "StepFun: Step 3.5 Flash" },
|
|
28157
|
+
{ id: "openrouter/google/gemini-3-flash-preview", label: "Google: Gemini 3 Flash Preview" },
|
|
28158
|
+
{ id: "openrouter/inclusionai/ling-2.6-flash", label: "inclusionAI: Ling-2.6-flash" },
|
|
28159
|
+
{ id: "openrouter/google/gemini-2.5-flash", label: "Google: Gemini 2.5 Flash" },
|
|
28160
|
+
{ id: "openrouter/bytedance-seed/seed-1.6-flash", label: "ByteDance Seed: Seed 1.6 Flash" },
|
|
28161
|
+
{ id: "openrouter/~google/gemini-flash-latest", label: "Google Gemini Flash Latest" },
|
|
28162
|
+
{ id: "openrouter/nvidia/nemotron-3-super-120b-a12b:free", label: "NVIDIA: Nemotron 3 Super (free)" },
|
|
28076
28163
|
{ id: "openrouter/openai/gpt-4o-mini-2024-07-18", label: "OpenAI: GPT-4o-mini (2024-07-18)" },
|
|
28077
|
-
{ id: "openrouter/
|
|
28078
|
-
{ id: "openrouter/openai/gpt-5-codex", label: "OpenAI: GPT-5 Codex" },
|
|
28079
|
-
{ id: "openrouter/openai/gpt-5-mini", label: "OpenAI: GPT-5 Mini" },
|
|
28080
|
-
{ id: "openrouter/openai/gpt-5-nano", label: "OpenAI: GPT-5 Nano" },
|
|
28081
|
-
{ id: "openrouter/openai/gpt-5-pro", label: "OpenAI: GPT-5 Pro" },
|
|
28082
|
-
{ id: "openrouter/openai/gpt-5.1", label: "OpenAI: GPT-5.1" },
|
|
28083
|
-
{ id: "openrouter/openai/gpt-5.1-chat", label: "OpenAI: GPT-5.1 Chat" },
|
|
28084
|
-
{ id: "openrouter/openai/gpt-5.1-codex", label: "OpenAI: GPT-5.1-Codex" },
|
|
28085
|
-
{ id: "openrouter/openai/gpt-5.1-codex-max", label: "OpenAI: GPT-5.1-Codex-Max" },
|
|
28086
|
-
{ id: "openrouter/openai/gpt-5.1-codex-mini", label: "OpenAI: GPT-5.1-Codex-Mini" },
|
|
28087
|
-
{ id: "openrouter/openai/gpt-5.2", label: "OpenAI: GPT-5.2" },
|
|
28088
|
-
{ id: "openrouter/openai/gpt-5.2-chat", label: "OpenAI: GPT-5.2 Chat" },
|
|
28089
|
-
{ id: "openrouter/openai/gpt-5.2-codex", label: "OpenAI: GPT-5.2-Codex" },
|
|
28090
|
-
{ id: "openrouter/openai/gpt-5.2-pro", label: "OpenAI: GPT-5.2 Pro" },
|
|
28091
|
-
{ id: "openrouter/openai/gpt-5.3-chat", label: "OpenAI: GPT-5.3 Chat" },
|
|
28092
|
-
{ id: "openrouter/openai/gpt-5.3-codex", label: "OpenAI: GPT-5.3-Codex" },
|
|
28093
|
-
{ id: "openrouter/openai/gpt-5.4", label: "OpenAI: GPT-5.4" },
|
|
28164
|
+
{ id: "openrouter/nvidia/nemotron-3-nano-30b-a3b", label: "NVIDIA: Nemotron 3 Nano 30B A3B" },
|
|
28094
28165
|
{ id: "openrouter/openai/gpt-5.4-mini", label: "OpenAI: GPT-5.4 Mini" },
|
|
28095
28166
|
{ id: "openrouter/openai/gpt-5.4-nano", label: "OpenAI: GPT-5.4 Nano" },
|
|
28096
|
-
{ id: "openrouter/openai/gpt-5
|
|
28097
|
-
{ id: "openrouter/openai/gpt-5
|
|
28098
|
-
{ id: "openrouter/openai/gpt-
|
|
28099
|
-
{ id: "openrouter/openai/gpt-
|
|
28100
|
-
{ id: "openrouter/openai/gpt-
|
|
28101
|
-
{ id: "openrouter/openai/gpt-chat-latest", label: "OpenAI: GPT Chat Latest" },
|
|
28102
|
-
{ id: "openrouter/openai/gpt-oss-120b", label: "OpenAI: gpt-oss-120b" },
|
|
28103
|
-
{ id: "openrouter/openai/gpt-oss-120b:free", label: "OpenAI: gpt-oss-120b (free)" },
|
|
28104
|
-
{ id: "openrouter/openai/gpt-oss-20b", label: "OpenAI: gpt-oss-20b" },
|
|
28105
|
-
{ id: "openrouter/openai/gpt-oss-20b:free", label: "OpenAI: gpt-oss-20b (free)" },
|
|
28106
|
-
{ id: "openrouter/openai/gpt-oss-safeguard-20b", label: "OpenAI: gpt-oss-safeguard-20b" },
|
|
28107
|
-
{ id: "openrouter/openai/o1", label: "OpenAI: o1" },
|
|
28108
|
-
{ id: "openrouter/openai/o3", label: "OpenAI: o3" },
|
|
28109
|
-
{ id: "openrouter/openai/o3-deep-research", label: "OpenAI: o3 Deep Research" },
|
|
28110
|
-
{ id: "openrouter/openai/o3-mini", label: "OpenAI: o3 Mini" },
|
|
28111
|
-
{ id: "openrouter/openai/o3-mini-high", label: "OpenAI: o3 Mini High" },
|
|
28112
|
-
{ id: "openrouter/openai/o3-pro", label: "OpenAI: o3 Pro" },
|
|
28167
|
+
{ id: "openrouter/openai/gpt-5-mini", label: "OpenAI: GPT-5 Mini" },
|
|
28168
|
+
{ id: "openrouter/openai/gpt-5-nano", label: "OpenAI: GPT-5 Nano" },
|
|
28169
|
+
{ id: "openrouter/openai/gpt-4.1-mini", label: "OpenAI: GPT-4.1 Mini" },
|
|
28170
|
+
{ id: "openrouter/openai/gpt-4.1-nano", label: "OpenAI: GPT-4.1 Nano" },
|
|
28171
|
+
{ id: "openrouter/openai/gpt-4o-mini", label: "OpenAI: GPT-4o-mini" },
|
|
28113
28172
|
{ id: "openrouter/openai/o4-mini", label: "OpenAI: o4 Mini" },
|
|
28114
28173
|
{ id: "openrouter/openai/o4-mini-deep-research", label: "OpenAI: o4 Mini Deep Research" },
|
|
28115
28174
|
{ id: "openrouter/openai/o4-mini-high", label: "OpenAI: o4 Mini High" },
|
|
28116
|
-
{ id: "openrouter/
|
|
28117
|
-
{ id: "openrouter/
|
|
28118
|
-
{ id: "openrouter/
|
|
28119
|
-
{ id: "openrouter/
|
|
28120
|
-
{ id: "openrouter/
|
|
28121
|
-
{ id: "openrouter/
|
|
28122
|
-
{ id: "openrouter/
|
|
28123
|
-
{ id: "openrouter/
|
|
28124
|
-
{ id: "openrouter/
|
|
28125
|
-
{ id: "openrouter/
|
|
28126
|
-
{ id: "openrouter/
|
|
28127
|
-
{ id: "openrouter/
|
|
28128
|
-
{ id: "openrouter/qwen/qwen-plus-2025-07-28", label: "Qwen: Qwen Plus 0728" },
|
|
28129
|
-
{ id: "openrouter/qwen/qwen-plus-2025-07-28:thinking", label: "Qwen: Qwen Plus 0728 (thinking)" },
|
|
28130
|
-
{ id: "openrouter/qwen/qwen3-14b", label: "Qwen: Qwen3 14B" },
|
|
28131
|
-
{ id: "openrouter/qwen/qwen3-235b-a22b", label: "Qwen: Qwen3 235B A22B" },
|
|
28132
|
-
{ id: "openrouter/qwen/qwen3-235b-a22b-2507", label: "Qwen: Qwen3 235B A22B Instruct 2507" },
|
|
28133
|
-
{ id: "openrouter/qwen/qwen3-235b-a22b-thinking-2507", label: "Qwen: Qwen3 235B A22B Thinking 2507" },
|
|
28134
|
-
{ id: "openrouter/qwen/qwen3-30b-a3b", label: "Qwen: Qwen3 30B A3B" },
|
|
28135
|
-
{ id: "openrouter/qwen/qwen3-30b-a3b-instruct-2507", label: "Qwen: Qwen3 30B A3B Instruct 2507" },
|
|
28136
|
-
{ id: "openrouter/qwen/qwen3-30b-a3b-thinking-2507", label: "Qwen: Qwen3 30B A3B Thinking 2507" },
|
|
28137
|
-
{ id: "openrouter/qwen/qwen3-32b", label: "Qwen: Qwen3 32B" },
|
|
28138
|
-
{ id: "openrouter/qwen/qwen3-8b", label: "Qwen: Qwen3 8B" },
|
|
28139
|
-
{ id: "openrouter/qwen/qwen3-coder", label: "Qwen: Qwen3 Coder 480B A35B" },
|
|
28140
|
-
{ id: "openrouter/qwen/qwen3-coder-30b-a3b-instruct", label: "Qwen: Qwen3 Coder 30B A3B Instruct" },
|
|
28141
|
-
{ id: "openrouter/qwen/qwen3-coder-flash", label: "Qwen: Qwen3 Coder Flash" },
|
|
28142
|
-
{ id: "openrouter/qwen/qwen3-coder-next", label: "Qwen: Qwen3 Coder Next" },
|
|
28143
|
-
{ id: "openrouter/qwen/qwen3-coder-plus", label: "Qwen: Qwen3 Coder Plus" },
|
|
28144
|
-
{ id: "openrouter/qwen/qwen3-coder:free", label: "Qwen: Qwen3 Coder 480B A35B (free)" },
|
|
28145
|
-
{ id: "openrouter/qwen/qwen3-max", label: "Qwen: Qwen3 Max" },
|
|
28146
|
-
{ id: "openrouter/qwen/qwen3-max-thinking", label: "Qwen: Qwen3 Max Thinking" },
|
|
28147
|
-
{ id: "openrouter/qwen/qwen3-next-80b-a3b-instruct", label: "Qwen: Qwen3 Next 80B A3B Instruct" },
|
|
28175
|
+
{ id: "openrouter/openai/o3-mini", label: "OpenAI: o3 Mini" },
|
|
28176
|
+
{ id: "openrouter/openai/o3-mini-high", label: "OpenAI: o3 Mini High" },
|
|
28177
|
+
{ id: "openrouter/amazon/nova-2-lite-v1", label: "Amazon: Nova 2 Lite" },
|
|
28178
|
+
{ id: "openrouter/bytedance-seed/seed-2.0-lite", label: "ByteDance Seed: Seed-2.0-Lite" },
|
|
28179
|
+
{ id: "openrouter/bytedance-seed/seed-2.0-mini", label: "ByteDance Seed: Seed-2.0-Mini" },
|
|
28180
|
+
{ id: "openrouter/amazon/nova-lite-v1", label: "Amazon: Nova Lite 1.0" },
|
|
28181
|
+
{ id: "openrouter/amazon/nova-micro-v1", label: "Amazon: Nova Micro 1.0" },
|
|
28182
|
+
{ id: "openrouter/arcee-ai/trinity-mini", label: "Arcee AI: Trinity Mini" },
|
|
28183
|
+
{ id: "openrouter/cohere/north-mini-code:free", label: "Cohere: North Mini Code (free)" },
|
|
28184
|
+
{ id: "openrouter/~openai/gpt-mini-latest", label: "OpenAI GPT Mini Latest" },
|
|
28185
|
+
{ id: "openrouter/openai/gpt-audio-mini", label: "OpenAI: GPT Audio Mini" },
|
|
28186
|
+
{ id: "openrouter/openai/gpt-oss-120b:free", label: "OpenAI: gpt-oss-120b (free)" },
|
|
28148
28187
|
{ id: "openrouter/qwen/qwen3-next-80b-a3b-instruct:free", label: "Qwen: Qwen3 Next 80B A3B Instruct (free)" },
|
|
28149
|
-
{ id: "openrouter/
|
|
28150
|
-
{ id: "openrouter/
|
|
28151
|
-
{ id: "openrouter/
|
|
28152
|
-
{ id: "openrouter/
|
|
28153
|
-
{ id: "openrouter/
|
|
28154
|
-
{ id: "openrouter/
|
|
28155
|
-
{ id: "openrouter/
|
|
28156
|
-
{ id: "openrouter/
|
|
28157
|
-
{ id: "openrouter/
|
|
28158
|
-
{ id: "openrouter/
|
|
28159
|
-
{ id: "openrouter/
|
|
28160
|
-
{ id: "openrouter/
|
|
28161
|
-
{ id: "openrouter/
|
|
28162
|
-
{ id: "openrouter/
|
|
28163
|
-
{ id: "openrouter/
|
|
28164
|
-
{ id: "openrouter/qwen/qwen3.5-plus-20260420", label: "Qwen: Qwen3.5 Plus 2026-04-20" },
|
|
28165
|
-
{ id: "openrouter/qwen/qwen3.6-27b", label: "Qwen: Qwen3.6 27B" },
|
|
28166
|
-
{ id: "openrouter/qwen/qwen3.6-35b-a3b", label: "Qwen: Qwen3.6 35B A3B" },
|
|
28167
|
-
{ id: "openrouter/qwen/qwen3.6-flash", label: "Qwen: Qwen3.6 Flash" },
|
|
28168
|
-
{ id: "openrouter/qwen/qwen3.6-max-preview", label: "Qwen: Qwen3.6 Max Preview" },
|
|
28169
|
-
{ id: "openrouter/qwen/qwen3.6-plus", label: "Qwen: Qwen3.6 Plus" },
|
|
28170
|
-
{ id: "openrouter/qwen/qwen3.7-max", label: "Qwen: Qwen3.7 Max" },
|
|
28171
|
-
{ id: "openrouter/qwen/qwen3.7-plus", label: "Qwen: Qwen3.7 Plus" },
|
|
28172
|
-
{ id: "openrouter/rekaai/reka-edge", label: "Reka Edge" },
|
|
28173
|
-
{ id: "openrouter/relace/relace-search", label: "Relace: Relace Search" },
|
|
28174
|
-
{ id: "openrouter/sao10k/l3.1-euryale-70b", label: "Sao10K: Llama 3.1 Euryale 70B v2.2" },
|
|
28175
|
-
{ id: "openrouter/stepfun/step-3.5-flash", label: "StepFun: Step 3.5 Flash" },
|
|
28176
|
-
{ id: "openrouter/stepfun/step-3.7-flash", label: "StepFun: Step 3.7 Flash" },
|
|
28177
|
-
{ id: "openrouter/tencent/hy3-preview", label: "Tencent: Hy3 preview" },
|
|
28178
|
-
{ id: "openrouter/thedrummer/rocinante-12b", label: "TheDrummer: Rocinante 12B" },
|
|
28179
|
-
{ id: "openrouter/thedrummer/unslopnemo-12b", label: "TheDrummer: UnslopNemo 12B" },
|
|
28180
|
-
{ id: "openrouter/upstage/solar-pro-3", label: "Upstage: Solar Pro 3" },
|
|
28181
|
-
{ id: "openrouter/x-ai/grok-4.20", label: "xAI: Grok 4.20" },
|
|
28182
|
-
{ id: "openrouter/x-ai/grok-4.3", label: "xAI: Grok 4.3" },
|
|
28183
|
-
{ id: "openrouter/x-ai/grok-build-0.1", label: "xAI: Grok Build 0.1" },
|
|
28184
|
-
{ id: "openrouter/xiaomi/mimo-v2.5", label: "Xiaomi: MiMo-V2.5" },
|
|
28185
|
-
{ id: "openrouter/xiaomi/mimo-v2.5-pro", label: "Xiaomi: MiMo-V2.5-Pro" },
|
|
28186
|
-
{ id: "openrouter/z-ai/glm-4.5", label: "Z.ai: GLM 4.5" },
|
|
28187
|
-
{ id: "openrouter/z-ai/glm-4.5-air", label: "Z.ai: GLM 4.5 Air" },
|
|
28188
|
-
{ id: "openrouter/z-ai/glm-4.5v", label: "Z.ai: GLM 4.5V" },
|
|
28189
|
-
{ id: "openrouter/z-ai/glm-4.6", label: "Z.ai: GLM 4.6" },
|
|
28190
|
-
{ id: "openrouter/z-ai/glm-4.6v", label: "Z.ai: GLM 4.6V" },
|
|
28191
|
-
{ id: "openrouter/z-ai/glm-4.7", label: "Z.ai: GLM 4.7" },
|
|
28192
|
-
{ id: "openrouter/z-ai/glm-4.7-flash", label: "Z.ai: GLM 4.7 Flash" },
|
|
28193
|
-
{ id: "openrouter/z-ai/glm-5", label: "Z.ai: GLM 5" },
|
|
28194
|
-
{ id: "openrouter/z-ai/glm-5-turbo", label: "Z.ai: GLM 5 Turbo" },
|
|
28195
|
-
{ id: "openrouter/z-ai/glm-5.1", label: "Z.ai: GLM 5.1" },
|
|
28196
|
-
{ id: "openrouter/z-ai/glm-5.2", label: "Z.ai: GLM 5.2" },
|
|
28197
|
-
{ id: "openrouter/~anthropic/claude-fable-latest", label: "Anthropic: Claude Fable Latest" },
|
|
28198
|
-
{ id: "openrouter/~anthropic/claude-haiku-latest", label: "Anthropic Claude Haiku Latest" },
|
|
28199
|
-
{ id: "openrouter/~anthropic/claude-opus-latest", label: "Anthropic: Claude Opus Latest" },
|
|
28200
|
-
{ id: "openrouter/~anthropic/claude-sonnet-latest", label: "Anthropic Claude Sonnet Latest" },
|
|
28201
|
-
{ id: "openrouter/~google/gemini-flash-latest", label: "Google Gemini Flash Latest" },
|
|
28202
|
-
{ id: "openrouter/~google/gemini-pro-latest", label: "Google Gemini Pro Latest" },
|
|
28203
|
-
{ id: "openrouter/~moonshotai/kimi-latest", label: "MoonshotAI Kimi Latest" },
|
|
28204
|
-
{ id: "openrouter/~openai/gpt-latest", label: "OpenAI GPT Latest" },
|
|
28205
|
-
{ id: "openrouter/~openai/gpt-mini-latest", label: "OpenAI GPT Mini Latest" }
|
|
28188
|
+
{ id: "openrouter/meta-llama/llama-3.3-70b-instruct:free", label: "Meta: Llama 3.3 70B Instruct (free)" },
|
|
28189
|
+
{ id: "openrouter/google/gemma-4-31b-it:free", label: "Google: Gemma 4 31B (free)" },
|
|
28190
|
+
{ id: "openrouter/nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free", label: "NVIDIA: Nemotron 3 Nano Omni (free)" },
|
|
28191
|
+
{ id: "openrouter/google/gemma-4-26b-a4b-it:free", label: "Google: Gemma 4 26B A4B (free)" },
|
|
28192
|
+
{ id: "openrouter/openai/gpt-oss-20b:free", label: "OpenAI: gpt-oss-20b (free)" },
|
|
28193
|
+
{ id: "openrouter/poolside/laguna-xs.2:free", label: "Poolside: Laguna XS.2 (free)" },
|
|
28194
|
+
{ id: "openrouter/poolside/laguna-m.1:free", label: "Poolside: Laguna M.1 (free)" },
|
|
28195
|
+
{ id: "openrouter/openrouter/free", label: "Free Models Router" },
|
|
28196
|
+
{ id: "openrouter/google/gemini-2.5-flash-lite-preview-09-2025", label: "Google: Gemini 2.5 Flash Lite Preview 09-2025" },
|
|
28197
|
+
{ id: "openrouter/google/gemini-3.1-flash-lite", label: "Google: Gemini 3.1 Flash Lite" },
|
|
28198
|
+
{ id: "openrouter/google/gemini-3.1-flash-lite-preview", label: "Google: Gemini 3.1 Flash Lite Preview" },
|
|
28199
|
+
{ id: "openrouter/google/gemini-2.5-flash-lite", label: "Google: Gemini 2.5 Flash Lite" },
|
|
28200
|
+
{ id: "openrouter/nvidia/nemotron-3-nano-30b-a3b:free", label: "NVIDIA: Nemotron 3 Nano 30B A3B (free)" },
|
|
28201
|
+
{ id: "openrouter/nvidia/nemotron-nano-12b-v2-vl:free", label: "NVIDIA: Nemotron Nano 12B 2 VL (free)" },
|
|
28202
|
+
{ id: "openrouter/nvidia/nemotron-nano-9b-v2:free", label: "NVIDIA: Nemotron Nano 9B V2 (free)" }
|
|
28206
28203
|
],
|
|
28207
28204
|
"openai": [
|
|
28208
|
-
{ id: "openai/gpt-5.4", label: "GPT-5.4" },
|
|
28209
|
-
{ id: "openai/gpt-4", label: "GPT-4" },
|
|
28210
|
-
{ id: "openai/gpt-4-turbo", label: "GPT-4 Turbo" },
|
|
28211
|
-
{ id: "openai/gpt-4.1", label: "GPT-4.1" },
|
|
28212
|
-
{ id: "openai/gpt-4.1-mini", label: "GPT-4.1 mini" },
|
|
28213
|
-
{ id: "openai/gpt-4.1-nano", label: "GPT-4.1 nano" },
|
|
28214
|
-
{ id: "openai/gpt-4o", label: "GPT-4o" },
|
|
28215
|
-
{ id: "openai/gpt-4o-2024-05-13", label: "GPT-4o (2024-05-13)" },
|
|
28216
|
-
{ id: "openai/gpt-4o-2024-08-06", label: "GPT-4o (2024-08-06)" },
|
|
28217
|
-
{ id: "openai/gpt-4o-2024-11-20", label: "GPT-4o (2024-11-20)" },
|
|
28218
|
-
{ id: "openai/gpt-4o-mini", label: "GPT-4o mini" },
|
|
28219
|
-
{ id: "openai/gpt-5", label: "GPT-5" },
|
|
28220
|
-
{ id: "openai/gpt-5-chat-latest", label: "GPT-5 Chat Latest" },
|
|
28221
|
-
{ id: "openai/gpt-5-codex", label: "GPT-5-Codex" },
|
|
28222
|
-
{ id: "openai/gpt-5-mini", label: "GPT-5 Mini" },
|
|
28223
|
-
{ id: "openai/gpt-5-nano", label: "GPT-5 Nano" },
|
|
28224
|
-
{ id: "openai/gpt-5-pro", label: "GPT-5 Pro" },
|
|
28225
|
-
{ id: "openai/gpt-5.1", label: "GPT-5.1" },
|
|
28226
|
-
{ id: "openai/gpt-5.1-chat-latest", label: "GPT-5.1 Chat" },
|
|
28227
|
-
{ id: "openai/gpt-5.1-codex", label: "GPT-5.1 Codex" },
|
|
28228
28205
|
{ id: "openai/gpt-5.1-codex-max", label: "GPT-5.1 Codex Max" },
|
|
28229
|
-
{ id: "openai/gpt-5.
|
|
28230
|
-
{ id: "openai/gpt-5.
|
|
28231
|
-
{ id: "openai/gpt-5.2-chat-latest", label: "GPT-5.2 Chat" },
|
|
28232
|
-
{ id: "openai/gpt-5.2-codex", label: "GPT-5.2 Codex" },
|
|
28206
|
+
{ id: "openai/gpt-5.5-pro", label: "GPT-5.5 Pro" },
|
|
28207
|
+
{ id: "openai/gpt-5.4-pro", label: "GPT-5.4 Pro" },
|
|
28233
28208
|
{ id: "openai/gpt-5.2-pro", label: "GPT-5.2 Pro" },
|
|
28234
|
-
{ id: "openai/gpt-5
|
|
28209
|
+
{ id: "openai/gpt-5-pro", label: "GPT-5 Pro" },
|
|
28210
|
+
{ id: "openai/o3-pro", label: "o3-pro" },
|
|
28211
|
+
{ id: "openai/o1-pro", label: "o1-pro" },
|
|
28235
28212
|
{ id: "openai/gpt-5.3-codex", label: "GPT-5.3 Codex" },
|
|
28236
28213
|
{ id: "openai/gpt-5.3-codex-spark", label: "GPT-5.3 Codex Spark" },
|
|
28237
|
-
{ id: "openai/gpt-5.
|
|
28238
|
-
{ id: "openai/gpt-5.
|
|
28239
|
-
{ id: "openai/gpt-5
|
|
28214
|
+
{ id: "openai/gpt-5.2-codex", label: "GPT-5.2 Codex" },
|
|
28215
|
+
{ id: "openai/gpt-5.1-codex", label: "GPT-5.1 Codex" },
|
|
28216
|
+
{ id: "openai/gpt-5-codex", label: "GPT-5-Codex" },
|
|
28217
|
+
{ id: "openai/gpt-5.1-codex-mini", label: "GPT-5.1 Codex mini" },
|
|
28218
|
+
{ id: "openai/gpt-4o-2024-11-20", label: "GPT-4o (2024-11-20)" },
|
|
28219
|
+
{ id: "openai/gpt-4o-2024-08-06", label: "GPT-4o (2024-08-06)" },
|
|
28220
|
+
{ id: "openai/gpt-4o-2024-05-13", label: "GPT-4o (2024-05-13)" },
|
|
28240
28221
|
{ id: "openai/gpt-5.5", label: "GPT-5.5" },
|
|
28241
|
-
{ id: "openai/gpt-5.
|
|
28242
|
-
{ id: "openai/
|
|
28243
|
-
{ id: "openai/
|
|
28222
|
+
{ id: "openai/gpt-5.4", label: "GPT-5.4" },
|
|
28223
|
+
{ id: "openai/gpt-5.3-chat-latest", label: "GPT-5.3 Chat (latest)" },
|
|
28224
|
+
{ id: "openai/gpt-5.2", label: "GPT-5.2" },
|
|
28225
|
+
{ id: "openai/gpt-5.2-chat-latest", label: "GPT-5.2 Chat" },
|
|
28226
|
+
{ id: "openai/gpt-5.1", label: "GPT-5.1" },
|
|
28227
|
+
{ id: "openai/gpt-5.1-chat-latest", label: "GPT-5.1 Chat" },
|
|
28228
|
+
{ id: "openai/gpt-5", label: "GPT-5" },
|
|
28229
|
+
{ id: "openai/gpt-5-chat-latest", label: "GPT-5 Chat Latest" },
|
|
28230
|
+
{ id: "openai/gpt-4.1", label: "GPT-4.1" },
|
|
28231
|
+
{ id: "openai/gpt-4", label: "GPT-4" },
|
|
28232
|
+
{ id: "openai/gpt-4o", label: "GPT-4o" },
|
|
28244
28233
|
{ id: "openai/o3", label: "o3" },
|
|
28245
28234
|
{ id: "openai/o3-deep-research", label: "o3-deep-research" },
|
|
28246
|
-
{ id: "openai/
|
|
28247
|
-
{ id: "openai/
|
|
28235
|
+
{ id: "openai/o1", label: "o1" },
|
|
28236
|
+
{ id: "openai/gpt-4-turbo", label: "GPT-4 Turbo" },
|
|
28237
|
+
{ id: "openai/gpt-5.4-mini", label: "GPT-5.4 mini" },
|
|
28238
|
+
{ id: "openai/gpt-5.4-nano", label: "GPT-5.4 nano" },
|
|
28239
|
+
{ id: "openai/gpt-5-mini", label: "GPT-5 Mini" },
|
|
28240
|
+
{ id: "openai/gpt-5-nano", label: "GPT-5 Nano" },
|
|
28241
|
+
{ id: "openai/gpt-4.1-mini", label: "GPT-4.1 mini" },
|
|
28242
|
+
{ id: "openai/gpt-4.1-nano", label: "GPT-4.1 nano" },
|
|
28243
|
+
{ id: "openai/gpt-4o-mini", label: "GPT-4o mini" },
|
|
28248
28244
|
{ id: "openai/o4-mini", label: "o4-mini" },
|
|
28249
|
-
{ id: "openai/o4-mini-deep-research", label: "o4-mini-deep-research" }
|
|
28245
|
+
{ id: "openai/o4-mini-deep-research", label: "o4-mini-deep-research" },
|
|
28246
|
+
{ id: "openai/o3-mini", label: "o3-mini" }
|
|
28250
28247
|
],
|
|
28251
28248
|
"anthropic": [
|
|
28252
|
-
{ id: "anthropic/claude-opus-4-8", label: "Claude Opus 4.8" },
|
|
28253
|
-
{ id: "anthropic/claude-3-5-haiku-20241022", label: "Claude Haiku 3.5" },
|
|
28254
|
-
{ id: "anthropic/claude-3-5-haiku-latest", label: "Claude Haiku 3.5 (latest)" },
|
|
28255
|
-
{ id: "anthropic/claude-3-5-sonnet-20240620", label: "Claude Sonnet 3.5" },
|
|
28256
|
-
{ id: "anthropic/claude-3-5-sonnet-20241022", label: "Claude Sonnet 3.5 v2" },
|
|
28257
|
-
{ id: "anthropic/claude-3-7-sonnet-20250219", label: "Claude Sonnet 3.7" },
|
|
28258
|
-
{ id: "anthropic/claude-3-haiku-20240307", label: "Claude Haiku 3" },
|
|
28259
|
-
{ id: "anthropic/claude-3-opus-20240229", label: "Claude Opus 3" },
|
|
28260
|
-
{ id: "anthropic/claude-3-sonnet-20240229", label: "Claude Sonnet 3" },
|
|
28261
28249
|
{ id: "anthropic/claude-fable-5", label: "Claude Fable 5" },
|
|
28262
|
-
{ id: "anthropic/claude-
|
|
28263
|
-
{ id: "anthropic/claude-haiku-4-5-20251001", label: "Claude Haiku 4.5" },
|
|
28264
|
-
{ id: "anthropic/claude-opus-4-0", label: "Claude Opus 4 (latest)" },
|
|
28265
|
-
{ id: "anthropic/claude-opus-4-1", label: "Claude Opus 4.1 (latest)" },
|
|
28266
|
-
{ id: "anthropic/claude-opus-4-1-20250805", label: "Claude Opus 4.1" },
|
|
28250
|
+
{ id: "anthropic/claude-3-opus-20240229", label: "Claude Opus 3" },
|
|
28267
28251
|
{ id: "anthropic/claude-opus-4-20250514", label: "Claude Opus 4" },
|
|
28268
|
-
{ id: "anthropic/claude-opus-4-5", label: "Claude Opus 4.5 (latest)" },
|
|
28269
28252
|
{ id: "anthropic/claude-opus-4-5-20251101", label: "Claude Opus 4.5" },
|
|
28270
|
-
{ id: "anthropic/claude-opus-4-
|
|
28253
|
+
{ id: "anthropic/claude-opus-4-1-20250805", label: "Claude Opus 4.1" },
|
|
28254
|
+
{ id: "anthropic/claude-opus-4-8", label: "Claude Opus 4.8" },
|
|
28271
28255
|
{ id: "anthropic/claude-opus-4-7", label: "Claude Opus 4.7" },
|
|
28272
|
-
{ id: "anthropic/claude-
|
|
28256
|
+
{ id: "anthropic/claude-opus-4-6", label: "Claude Opus 4.6" },
|
|
28257
|
+
{ id: "anthropic/claude-opus-4-5", label: "Claude Opus 4.5 (latest)" },
|
|
28258
|
+
{ id: "anthropic/claude-opus-4-1", label: "Claude Opus 4.1 (latest)" },
|
|
28259
|
+
{ id: "anthropic/claude-opus-4-0", label: "Claude Opus 4 (latest)" },
|
|
28260
|
+
{ id: "anthropic/claude-3-7-sonnet-20250219", label: "Claude Sonnet 3.7" },
|
|
28261
|
+
{ id: "anthropic/claude-3-5-sonnet-20241022", label: "Claude Sonnet 3.5 v2" },
|
|
28262
|
+
{ id: "anthropic/claude-3-5-sonnet-20240620", label: "Claude Sonnet 3.5" },
|
|
28263
|
+
{ id: "anthropic/claude-3-sonnet-20240229", label: "Claude Sonnet 3" },
|
|
28273
28264
|
{ id: "anthropic/claude-sonnet-4-20250514", label: "Claude Sonnet 4" },
|
|
28274
|
-
{ id: "anthropic/claude-sonnet-4-5", label: "Claude Sonnet 4.5 (latest)" },
|
|
28275
28265
|
{ id: "anthropic/claude-sonnet-4-5-20250929", label: "Claude Sonnet 4.5" },
|
|
28276
|
-
{ id: "anthropic/claude-sonnet-
|
|
28266
|
+
{ id: "anthropic/claude-sonnet-5", label: "Claude Sonnet 5" },
|
|
28267
|
+
{ id: "anthropic/claude-sonnet-4-6", label: "Claude Sonnet 4.6" },
|
|
28268
|
+
{ id: "anthropic/claude-sonnet-4-5", label: "Claude Sonnet 4.5 (latest)" },
|
|
28269
|
+
{ id: "anthropic/claude-sonnet-4-0", label: "Claude Sonnet 4 (latest)" },
|
|
28270
|
+
{ id: "anthropic/claude-3-haiku-20240307", label: "Claude Haiku 3" },
|
|
28271
|
+
{ id: "anthropic/claude-haiku-4-5-20251001", label: "Claude Haiku 4.5" },
|
|
28272
|
+
{ id: "anthropic/claude-haiku-4-5", label: "Claude Haiku 4.5 (latest)" }
|
|
28277
28273
|
],
|
|
28278
28274
|
"google": [
|
|
28279
28275
|
{ id: "google/gemini-3.1-pro-preview", label: "Gemini 3.1 Pro Preview" },
|
|
28280
|
-
{ id: "google/gemini-
|
|
28281
|
-
{ id: "google/gemini-
|
|
28282
|
-
{ id: "google/gemini-2.5-flash", label: "Gemini 2.5 Flash" },
|
|
28283
|
-
{ id: "google/gemini-2.5-flash-lite", label: "Gemini 2.5 Flash-Lite" },
|
|
28276
|
+
{ id: "google/gemini-3.1-pro-preview-customtools", label: "Gemini 3.1 Pro Preview Custom Tools" },
|
|
28277
|
+
{ id: "google/gemini-3-pro-preview", label: "Gemini 3 Pro Preview" },
|
|
28284
28278
|
{ id: "google/gemini-2.5-pro", label: "Gemini 2.5 Pro" },
|
|
28279
|
+
{ id: "google/gemma-4-31b-it", label: "Gemma 4 31B IT" },
|
|
28280
|
+
{ id: "google/gemma-4-26b-a4b-it", label: "Gemma 4 26B A4B IT" },
|
|
28281
|
+
{ id: "google/gemini-3.5-flash", label: "Gemini 3.5 Flash" },
|
|
28285
28282
|
{ id: "google/gemini-3-flash-preview", label: "Gemini 3 Flash Preview" },
|
|
28286
|
-
{ id: "google/gemini-
|
|
28283
|
+
{ id: "google/gemini-2.5-flash", label: "Gemini 2.5 Flash" },
|
|
28284
|
+
{ id: "google/gemini-2.0-flash", label: "Gemini 2.0 Flash" },
|
|
28285
|
+
{ id: "google/gemini-flash-latest", label: "Gemini Flash Latest" },
|
|
28287
28286
|
{ id: "google/gemini-3.1-flash-lite", label: "Gemini 3.1 Flash Lite" },
|
|
28288
28287
|
{ id: "google/gemini-3.1-flash-lite-preview", label: "Gemini 3.1 Flash Lite Preview" },
|
|
28289
|
-
{ id: "google/gemini-
|
|
28290
|
-
{ id: "google/gemini-
|
|
28291
|
-
{ id: "google/gemini-flash-latest", label: "Gemini Flash Latest" }
|
|
28292
|
-
{ id: "google/gemini-flash-lite-latest", label: "Gemini Flash-Lite Latest" },
|
|
28293
|
-
{ id: "google/gemma-4-26b-a4b-it", label: "Gemma 4 26B A4B IT" },
|
|
28294
|
-
{ id: "google/gemma-4-31b-it", label: "Gemma 4 31B IT" },
|
|
28295
|
-
{ id: "google/gemma-4-E2B-it", label: "Gemma 4 E2B IT" },
|
|
28296
|
-
{ id: "google/gemma-4-E4B-it", label: "Gemma 4 E4B IT" }
|
|
28288
|
+
{ id: "google/gemini-2.5-flash-lite", label: "Gemini 2.5 Flash-Lite" },
|
|
28289
|
+
{ id: "google/gemini-2.0-flash-lite", label: "Gemini 2.0 Flash-Lite" },
|
|
28290
|
+
{ id: "google/gemini-flash-lite-latest", label: "Gemini Flash-Lite Latest" }
|
|
28297
28291
|
],
|
|
28298
28292
|
"xai": [
|
|
28299
|
-
{ id: "xai/grok-4.20-0309-reasoning", label: "Grok 4.20 (Reasoning)" },
|
|
28300
|
-
{ id: "xai/grok-3", label: "Grok 3" },
|
|
28301
|
-
{ id: "xai/grok-3-fast", label: "Grok 3 Fast" },
|
|
28302
28293
|
{ id: "xai/grok-4.20-0309-non-reasoning", label: "Grok 4.20 (Non-Reasoning)" },
|
|
28294
|
+
{ id: "xai/grok-4.20-0309-reasoning", label: "Grok 4.20 (Reasoning)" },
|
|
28295
|
+
{ id: "xai/grok-code-fast-1", label: "Grok Code Fast 1" },
|
|
28303
28296
|
{ id: "xai/grok-4.3", label: "Grok 4.3" },
|
|
28297
|
+
{ id: "xai/grok-3", label: "Grok 3" },
|
|
28304
28298
|
{ id: "xai/grok-build-0.1", label: "Grok Build 0.1" },
|
|
28305
|
-
{ id: "xai/grok-
|
|
28299
|
+
{ id: "xai/grok-3-fast", label: "Grok 3 Fast" }
|
|
28306
28300
|
],
|
|
28307
28301
|
"xiaomi": [
|
|
28308
28302
|
{ id: "xiaomi/mimo-v2.5-pro", label: "MiMo-V2.5-Pro" },
|
|
28309
|
-
{ id: "xiaomi/mimo-v2-
|
|
28310
|
-
{ id: "xiaomi/mimo-v2-omni", label: "MiMo-V2-Omni" },
|
|
28303
|
+
{ id: "xiaomi/mimo-v2.5-pro-ultraspeed", label: "MiMo-V2.5-Pro-UltraSpeed" },
|
|
28311
28304
|
{ id: "xiaomi/mimo-v2-pro", label: "MiMo-V2-Pro" },
|
|
28312
28305
|
{ id: "xiaomi/mimo-v2.5", label: "MiMo-V2.5" },
|
|
28313
|
-
{ id: "xiaomi/mimo-v2
|
|
28306
|
+
{ id: "xiaomi/mimo-v2-omni", label: "MiMo-V2-Omni" },
|
|
28307
|
+
{ id: "xiaomi/mimo-v2-flash", label: "MiMo-V2-Flash" }
|
|
28314
28308
|
]
|
|
28315
28309
|
};
|
|
28316
28310
|
init_esm_shims();
|
|
@@ -42354,6 +42348,21 @@ var agentApiHistoryQuerySchema = passthroughObject({
|
|
|
42354
42348
|
around: optionalStringSchema,
|
|
42355
42349
|
limit: optionalStringSchema
|
|
42356
42350
|
});
|
|
42351
|
+
var agentApiKnowledgeGetQuerySchema = passthroughObject({
|
|
42352
|
+
topic: external_exports.string().trim().min(1),
|
|
42353
|
+
reason: optionalStringSchema,
|
|
42354
|
+
turn_id: optionalStringSchema,
|
|
42355
|
+
trace_id: optionalStringSchema
|
|
42356
|
+
});
|
|
42357
|
+
var agentApiKnowledgeGetResponseSchema = passthroughObject({
|
|
42358
|
+
ok: external_exports.literal(true),
|
|
42359
|
+
docId: external_exports.string(),
|
|
42360
|
+
topicOrPath: external_exports.string(),
|
|
42361
|
+
docVersion: external_exports.string(),
|
|
42362
|
+
docState: external_exports.string(),
|
|
42363
|
+
contentType: external_exports.string(),
|
|
42364
|
+
content: external_exports.string()
|
|
42365
|
+
});
|
|
42357
42366
|
var agentApiMessageSearchQuerySchema = passthroughObject({
|
|
42358
42367
|
q: optionalStringSchema,
|
|
42359
42368
|
channel: optionalStringSchema,
|
|
@@ -42391,6 +42400,58 @@ var agentApiMessageReactionBodySchema = passthroughObject({
|
|
|
42391
42400
|
var agentApiChannelMembershipParamsSchema = passthroughObject({
|
|
42392
42401
|
channelId: external_exports.string().trim().min(1).transform(asChannelId)
|
|
42393
42402
|
});
|
|
42403
|
+
var agentApiAttachmentDownloadParamsSchema = passthroughObject({
|
|
42404
|
+
attachmentId: external_exports.string().trim().min(1)
|
|
42405
|
+
});
|
|
42406
|
+
var agentApiAttachmentCommentsParamsSchema = passthroughObject({
|
|
42407
|
+
attachmentId: external_exports.string().trim().min(1)
|
|
42408
|
+
});
|
|
42409
|
+
var agentApiAttachmentCommentsQuerySchema = passthroughObject({
|
|
42410
|
+
limit: optionalStringSchema
|
|
42411
|
+
});
|
|
42412
|
+
var agentApiAttachmentCommentAnchorSchema = passthroughObject({
|
|
42413
|
+
type: external_exports.string().trim().min(1),
|
|
42414
|
+
data: external_exports.record(external_exports.string(), external_exports.unknown())
|
|
42415
|
+
});
|
|
42416
|
+
var agentApiAttachmentCommentReactionSchema = passthroughObject({
|
|
42417
|
+
emoji: external_exports.string().trim().min(1),
|
|
42418
|
+
reactorType: external_exports.string().trim().min(1),
|
|
42419
|
+
reactorId: external_exports.string().trim().min(1),
|
|
42420
|
+
createdAt: external_exports.string().datetime()
|
|
42421
|
+
});
|
|
42422
|
+
var agentApiAttachmentCommentResolvedBySchema = passthroughObject({
|
|
42423
|
+
reactorId: external_exports.string().trim().min(1),
|
|
42424
|
+
reactorType: external_exports.string().trim().min(1)
|
|
42425
|
+
});
|
|
42426
|
+
var agentApiAttachmentCommentSchema = passthroughObject({
|
|
42427
|
+
id: external_exports.string().trim().min(1),
|
|
42428
|
+
channelId: external_exports.string().trim().min(1).optional(),
|
|
42429
|
+
senderId: external_exports.string().trim().min(1),
|
|
42430
|
+
senderType: external_exports.enum(["user", "agent"]),
|
|
42431
|
+
senderName: external_exports.string().trim().min(1),
|
|
42432
|
+
senderAvatarUrl: nullableStringSchema.optional(),
|
|
42433
|
+
senderGravatarHash: nullableStringSchema.optional(),
|
|
42434
|
+
content: external_exports.string(),
|
|
42435
|
+
createdAt: external_exports.string().datetime(),
|
|
42436
|
+
reactions: external_exports.array(agentApiAttachmentCommentReactionSchema),
|
|
42437
|
+
anchor: agentApiAttachmentCommentAnchorSchema.nullable(),
|
|
42438
|
+
resolved: external_exports.boolean().optional(),
|
|
42439
|
+
resolvedBy: agentApiAttachmentCommentResolvedBySchema.nullable().optional(),
|
|
42440
|
+
resolvedAt: external_exports.string().datetime().nullable().optional()
|
|
42441
|
+
});
|
|
42442
|
+
var agentApiAttachmentCommentsResponseSchema = passthroughObject({
|
|
42443
|
+
comments: external_exports.array(agentApiAttachmentCommentSchema),
|
|
42444
|
+
threadChannelId: nullableStringSchema.optional(),
|
|
42445
|
+
viewer: passthroughObject({
|
|
42446
|
+
canComment: external_exports.boolean(),
|
|
42447
|
+
reason: external_exports.string().optional(),
|
|
42448
|
+
canResolve: external_exports.boolean(),
|
|
42449
|
+
resolveAction: passthroughObject({
|
|
42450
|
+
type: external_exports.string().trim().min(1),
|
|
42451
|
+
emoji: external_exports.string().trim().min(1)
|
|
42452
|
+
}).optional()
|
|
42453
|
+
}).optional()
|
|
42454
|
+
});
|
|
42394
42455
|
var agentApiChannelMembersQuerySchema = passthroughObject({
|
|
42395
42456
|
channel: external_exports.string().trim().min(1)
|
|
42396
42457
|
});
|
|
@@ -42545,6 +42606,9 @@ var agentApiIntegrationAppPrepareBodySchema = passthroughObject({
|
|
|
42545
42606
|
unsafeDemoUrlOverride: optionalBooleanSchema,
|
|
42546
42607
|
draftHint: optionalStringSchema
|
|
42547
42608
|
});
|
|
42609
|
+
var agentApiIntegrationAppRotateSecretBodySchema = passthroughObject({
|
|
42610
|
+
clientKey: external_exports.string().trim().min(1)
|
|
42611
|
+
});
|
|
42548
42612
|
var agentApiActionPrepareBodySchema = passthroughObject({
|
|
42549
42613
|
target: external_exports.string().trim().min(1),
|
|
42550
42614
|
action: actionCardActionSchema
|
|
@@ -42552,6 +42616,9 @@ var agentApiActionPrepareBodySchema = passthroughObject({
|
|
|
42552
42616
|
var agentApiServerInfoResponseSchema = passthroughObject({
|
|
42553
42617
|
runtimeContext: passthroughObject({
|
|
42554
42618
|
agentId: external_exports.string(),
|
|
42619
|
+
runtime: external_exports.string().optional(),
|
|
42620
|
+
model: external_exports.string().optional(),
|
|
42621
|
+
reasoningEffort: reasoningEffortSchema.nullable().optional(),
|
|
42555
42622
|
serverId: external_exports.string(),
|
|
42556
42623
|
machineId: external_exports.string().nullable().optional(),
|
|
42557
42624
|
machineName: external_exports.string().nullable().optional(),
|
|
@@ -42568,10 +42635,12 @@ var agentApiServerInfoResponseSchema = passthroughObject({
|
|
|
42568
42635
|
joined: external_exports.boolean()
|
|
42569
42636
|
})),
|
|
42570
42637
|
agents: external_exports.array(passthroughObject({
|
|
42571
|
-
name: external_exports.string()
|
|
42638
|
+
name: external_exports.string(),
|
|
42639
|
+
role: external_exports.enum(["owner", "admin", "member"]).nullable().optional()
|
|
42572
42640
|
})),
|
|
42573
42641
|
humans: external_exports.array(passthroughObject({
|
|
42574
|
-
name: external_exports.string()
|
|
42642
|
+
name: external_exports.string(),
|
|
42643
|
+
role: external_exports.enum(["owner", "admin", "member"]).nullable().optional()
|
|
42575
42644
|
}))
|
|
42576
42645
|
});
|
|
42577
42646
|
var agentApiMentionActionsPendingQuerySchema = passthroughObject({
|
|
@@ -42646,6 +42715,12 @@ var agentApiIntegrationAppPrepareResponseSchema = passthroughObject({
|
|
|
42646
42715
|
integrationUpdateAppRegistrationOperationSchema
|
|
42647
42716
|
])
|
|
42648
42717
|
});
|
|
42718
|
+
var agentApiIntegrationAppRotateSecretResponseSchema = passthroughObject({
|
|
42719
|
+
clientId: external_exports.string(),
|
|
42720
|
+
clientKey: external_exports.string(),
|
|
42721
|
+
clientName: external_exports.string(),
|
|
42722
|
+
clientSecret: external_exports.string()
|
|
42723
|
+
});
|
|
42649
42724
|
var agentApiAttachmentEnvelopeSchema = passthroughObject({
|
|
42650
42725
|
id: external_exports.string(),
|
|
42651
42726
|
filename: external_exports.string()
|
|
@@ -42781,6 +42856,21 @@ var agentApiChannelMembersResponseSchema = passthroughObject({
|
|
|
42781
42856
|
role: optionalStringSchema
|
|
42782
42857
|
}))
|
|
42783
42858
|
});
|
|
42859
|
+
var agentApiChannelMuteResponseSchema = passthroughObject({
|
|
42860
|
+
activityMuted: optionalBooleanSchema,
|
|
42861
|
+
muteFromSeq: nullableNumberSchema.optional(),
|
|
42862
|
+
attention: passthroughObject({
|
|
42863
|
+
state: optionalStringSchema,
|
|
42864
|
+
ordinaryActivity: optionalStringSchema,
|
|
42865
|
+
unmuteCommand: optionalStringSchema,
|
|
42866
|
+
unmuteApi: optionalStringSchema,
|
|
42867
|
+
muteCommand: optionalStringSchema,
|
|
42868
|
+
muteApi: optionalStringSchema,
|
|
42869
|
+
stillArrives: optionalStringArraySchema,
|
|
42870
|
+
threadBoundary: optionalStringSchema,
|
|
42871
|
+
catchUp: optionalStringSchema
|
|
42872
|
+
}).optional()
|
|
42873
|
+
});
|
|
42784
42874
|
var agentApiTaskClaimResultSchema = passthroughObject({
|
|
42785
42875
|
taskNumber: external_exports.number().int().positive().optional(),
|
|
42786
42876
|
messageId: optionalStringSchema,
|
|
@@ -42893,6 +42983,16 @@ var agentApiContract = {
|
|
|
42893
42983
|
request: { query: agentApiHistoryQuerySchema },
|
|
42894
42984
|
response: { body: agentApiHistoryResponseSchema }
|
|
42895
42985
|
}),
|
|
42986
|
+
knowledgeGet: route({
|
|
42987
|
+
key: "knowledgeGet",
|
|
42988
|
+
method: "GET",
|
|
42989
|
+
path: "/knowledge",
|
|
42990
|
+
client: { resource: "knowledge", method: "get" },
|
|
42991
|
+
capability: "knowledge",
|
|
42992
|
+
description: "Fetch a Slock Manual for Agents topic from the current server.",
|
|
42993
|
+
request: { query: agentApiKnowledgeGetQuerySchema },
|
|
42994
|
+
response: { body: agentApiKnowledgeGetResponseSchema }
|
|
42995
|
+
}),
|
|
42896
42996
|
messageSend: route({
|
|
42897
42997
|
key: "messageSend",
|
|
42898
42998
|
method: "POST",
|
|
@@ -42963,6 +43063,26 @@ var agentApiContract = {
|
|
|
42963
43063
|
request: { params: agentApiChannelMembershipParamsSchema },
|
|
42964
43064
|
response: { body: agentApiOkResponseSchema }
|
|
42965
43065
|
}),
|
|
43066
|
+
channelMute: route({
|
|
43067
|
+
key: "channelMute",
|
|
43068
|
+
method: "POST",
|
|
43069
|
+
path: "/channels/:channelId/mute",
|
|
43070
|
+
client: { resource: "channels", method: "mute" },
|
|
43071
|
+
capability: "channels",
|
|
43072
|
+
description: "Mute ordinary activity delivery for a visible regular channel as the bound agent credential.",
|
|
43073
|
+
request: { params: agentApiChannelMembershipParamsSchema },
|
|
43074
|
+
response: { body: agentApiChannelMuteResponseSchema }
|
|
43075
|
+
}),
|
|
43076
|
+
channelUnmute: route({
|
|
43077
|
+
key: "channelUnmute",
|
|
43078
|
+
method: "POST",
|
|
43079
|
+
path: "/channels/:channelId/unmute",
|
|
43080
|
+
client: { resource: "channels", method: "unmute" },
|
|
43081
|
+
capability: "channels",
|
|
43082
|
+
description: "Unmute ordinary activity delivery for a visible regular channel as the bound agent credential.",
|
|
43083
|
+
request: { params: agentApiChannelMembershipParamsSchema },
|
|
43084
|
+
response: { body: agentApiChannelMuteResponseSchema }
|
|
43085
|
+
}),
|
|
42966
43086
|
channelMembers: route({
|
|
42967
43087
|
key: "channelMembers",
|
|
42968
43088
|
method: "GET",
|
|
@@ -43153,6 +43273,16 @@ var agentApiContract = {
|
|
|
43153
43273
|
request: { body: agentApiProfileUpdateBodySchema },
|
|
43154
43274
|
response: { body: agentApiProfileViewSchema }
|
|
43155
43275
|
}),
|
|
43276
|
+
profileAvatarUpdate: route({
|
|
43277
|
+
key: "profileAvatarUpdate",
|
|
43278
|
+
method: "POST",
|
|
43279
|
+
path: "/profile/avatar",
|
|
43280
|
+
client: { resource: "profile", method: "updateAvatar" },
|
|
43281
|
+
capability: "server",
|
|
43282
|
+
description: "Update the bound agent profile avatar using multipart form data.",
|
|
43283
|
+
request: {},
|
|
43284
|
+
response: { body: agentApiProfileViewSchema }
|
|
43285
|
+
}),
|
|
43156
43286
|
integrationList: route({
|
|
43157
43287
|
key: "integrationList",
|
|
43158
43288
|
method: "GET",
|
|
@@ -43183,6 +43313,22 @@ var agentApiContract = {
|
|
|
43183
43313
|
request: { body: agentApiIntegrationAppPrepareBodySchema },
|
|
43184
43314
|
response: { body: agentApiIntegrationAppPrepareResponseSchema }
|
|
43185
43315
|
}),
|
|
43316
|
+
integrationAppRotateSecret: route({
|
|
43317
|
+
key: "integrationAppRotateSecret",
|
|
43318
|
+
method: "POST",
|
|
43319
|
+
path: "/integrations/app/rotate-secret",
|
|
43320
|
+
client: { resource: "integrations", method: "rotateAppSecret" },
|
|
43321
|
+
// Mirrors integrationAppPrepare's "read" capability: the AgentApiCapability
|
|
43322
|
+
// enum has no generic "mutation"/"integrations" scope, and the sibling
|
|
43323
|
+
// integration app routes (prepare/login) all gate on "read". Owner-scope is
|
|
43324
|
+
// enforced server-side in rotateClientSecretForAgent's WHERE clause (and the
|
|
43325
|
+
// bound agent credential), so the capability tier is not the security
|
|
43326
|
+
// boundary here. Keep parity with integrationAppPrepare.
|
|
43327
|
+
capability: "read",
|
|
43328
|
+
description: "Regenerate the one-time client secret for a server-local integration app the calling agent owns; invalidates the previous secret.",
|
|
43329
|
+
request: { body: agentApiIntegrationAppRotateSecretBodySchema },
|
|
43330
|
+
response: { body: agentApiIntegrationAppRotateSecretResponseSchema }
|
|
43331
|
+
}),
|
|
43186
43332
|
actionPrepare: route({
|
|
43187
43333
|
key: "actionPrepare",
|
|
43188
43334
|
method: "POST",
|
|
@@ -43202,13 +43348,43 @@ var agentApiContract = {
|
|
|
43202
43348
|
description: "Upload a multipart attachment as the bound agent credential.",
|
|
43203
43349
|
request: {},
|
|
43204
43350
|
response: { body: agentApiAttachmentUploadResponseSchema }
|
|
43351
|
+
}),
|
|
43352
|
+
attachmentDownload: route({
|
|
43353
|
+
key: "attachmentDownload",
|
|
43354
|
+
method: "GET",
|
|
43355
|
+
path: "/attachments/:attachmentId",
|
|
43356
|
+
client: { resource: "attachments", method: "download" },
|
|
43357
|
+
capability: "read",
|
|
43358
|
+
description: "Download attachment bytes visible to the bound agent credential.",
|
|
43359
|
+
request: { params: agentApiAttachmentDownloadParamsSchema },
|
|
43360
|
+
response: { kind: "binary" }
|
|
43361
|
+
}),
|
|
43362
|
+
attachmentCommentsList: route({
|
|
43363
|
+
key: "attachmentCommentsList",
|
|
43364
|
+
method: "GET",
|
|
43365
|
+
path: "/attachments/:attachmentId/comments",
|
|
43366
|
+
client: { resource: "attachments", method: "comments" },
|
|
43367
|
+
capability: "read",
|
|
43368
|
+
description: "List comments scoped to an attachment visible to the bound agent credential.",
|
|
43369
|
+
request: { params: agentApiAttachmentCommentsParamsSchema, query: agentApiAttachmentCommentsQuerySchema },
|
|
43370
|
+
response: { body: agentApiAttachmentCommentsResponseSchema }
|
|
43205
43371
|
})
|
|
43206
43372
|
};
|
|
43207
|
-
function
|
|
43208
|
-
return
|
|
43373
|
+
function getAgentApiResponseKind(response) {
|
|
43374
|
+
return "kind" in response ? response.kind ?? "json" : "json";
|
|
43209
43375
|
}
|
|
43210
43376
|
function parseAgentApiResponse(key, value) {
|
|
43211
|
-
|
|
43377
|
+
const response = agentApiContract[key].response;
|
|
43378
|
+
if (getAgentApiResponseKind(response) === "binary") {
|
|
43379
|
+
if (!(value instanceof Uint8Array)) {
|
|
43380
|
+
throw new TypeError(`Agent API ${key} response did not contain binary bytes`);
|
|
43381
|
+
}
|
|
43382
|
+
return value;
|
|
43383
|
+
}
|
|
43384
|
+
if (!("body" in response)) {
|
|
43385
|
+
throw new TypeError(`Agent API ${key} response contract is missing a JSON body schema`);
|
|
43386
|
+
}
|
|
43387
|
+
return response.body.parse(value);
|
|
43212
43388
|
}
|
|
43213
43389
|
init_esm_shims();
|
|
43214
43390
|
function failure(routeKey, reason, message, details = {}) {
|
|
@@ -43221,17 +43397,17 @@ function failure(routeKey, reason, message, details = {}) {
|
|
|
43221
43397
|
};
|
|
43222
43398
|
}
|
|
43223
43399
|
function encodePathParams(routeKey, params) {
|
|
43224
|
-
const
|
|
43400
|
+
const route3 = agentApiContract[routeKey];
|
|
43225
43401
|
let parsed;
|
|
43226
43402
|
try {
|
|
43227
|
-
parsed = "params" in
|
|
43403
|
+
parsed = "params" in route3.request ? route3.request.params.parse(params ?? {}) : {};
|
|
43228
43404
|
} catch (cause) {
|
|
43229
|
-
return failure(routeKey, "request_contract_mismatch", `Agent API ${
|
|
43405
|
+
return failure(routeKey, "request_contract_mismatch", `Agent API ${route3.key} path params did not match the shared contract`, { cause });
|
|
43230
43406
|
}
|
|
43231
|
-
return
|
|
43407
|
+
return route3.path.replace(/:([A-Za-z][A-Za-z0-9_]*)/g, (_match, key) => {
|
|
43232
43408
|
const value = parsed[key];
|
|
43233
43409
|
if (value === void 0 || value === null) {
|
|
43234
|
-
throw new MissingPathParamError(
|
|
43410
|
+
throw new MissingPathParamError(route3.key, key);
|
|
43235
43411
|
}
|
|
43236
43412
|
return encodeURIComponent(String(value));
|
|
43237
43413
|
});
|
|
@@ -43245,12 +43421,12 @@ var MissingPathParamError = class extends Error {
|
|
|
43245
43421
|
};
|
|
43246
43422
|
function encodeQuery(routeKey, query) {
|
|
43247
43423
|
if (query === void 0) return void 0;
|
|
43248
|
-
const
|
|
43424
|
+
const route3 = agentApiContract[routeKey];
|
|
43249
43425
|
let parsed;
|
|
43250
43426
|
try {
|
|
43251
|
-
parsed = "query" in
|
|
43427
|
+
parsed = "query" in route3.request ? route3.request.query.parse(query) : {};
|
|
43252
43428
|
} catch (cause) {
|
|
43253
|
-
return failure(routeKey, "request_contract_mismatch", `Agent API ${
|
|
43429
|
+
return failure(routeKey, "request_contract_mismatch", `Agent API ${route3.key} query did not match the shared contract`, { cause });
|
|
43254
43430
|
}
|
|
43255
43431
|
const params = new URLSearchParams();
|
|
43256
43432
|
for (const [key, value] of Object.entries(parsed)) {
|
|
@@ -43265,11 +43441,11 @@ function encodeQuery(routeKey, query) {
|
|
|
43265
43441
|
}
|
|
43266
43442
|
function parseBody(routeKey, body) {
|
|
43267
43443
|
if (body === void 0) return void 0;
|
|
43268
|
-
const
|
|
43444
|
+
const route3 = agentApiContract[routeKey];
|
|
43269
43445
|
try {
|
|
43270
|
-
return "body" in
|
|
43446
|
+
return "body" in route3.request ? route3.request.body.parse(body) : void 0;
|
|
43271
43447
|
} catch (cause) {
|
|
43272
|
-
return failure(routeKey, "request_contract_mismatch", `Agent API ${
|
|
43448
|
+
return failure(routeKey, "request_contract_mismatch", `Agent API ${route3.key} body did not match the shared contract`, { cause });
|
|
43273
43449
|
}
|
|
43274
43450
|
}
|
|
43275
43451
|
function isAgentApiRawFailure(value) {
|
|
@@ -43295,7 +43471,7 @@ function buildAgentApiRawRoutePath(routeKey, options = {}) {
|
|
|
43295
43471
|
return `${options.pathPrefix ?? AGENT_API_BASE_PATH}${path9}${suffix}`;
|
|
43296
43472
|
}
|
|
43297
43473
|
async function requestAgentApiRawRoute(transport, routeKey, options = {}) {
|
|
43298
|
-
const
|
|
43474
|
+
const route3 = agentApiContract[routeKey];
|
|
43299
43475
|
const path9 = buildAgentApiRawRoutePath(routeKey, options);
|
|
43300
43476
|
if (typeof path9 !== "string") return path9;
|
|
43301
43477
|
const body = parseBody(routeKey, options.body);
|
|
@@ -43304,12 +43480,12 @@ async function requestAgentApiRawRoute(transport, routeKey, options = {}) {
|
|
|
43304
43480
|
try {
|
|
43305
43481
|
response = await transport.request({
|
|
43306
43482
|
routeKey,
|
|
43307
|
-
method:
|
|
43483
|
+
method: route3.method,
|
|
43308
43484
|
path: path9,
|
|
43309
43485
|
body
|
|
43310
43486
|
});
|
|
43311
43487
|
} catch (cause) {
|
|
43312
|
-
return failure(routeKey, "transport_error", `Agent API ${
|
|
43488
|
+
return failure(routeKey, "transport_error", `Agent API ${route3.key} transport request failed`, { cause });
|
|
43313
43489
|
}
|
|
43314
43490
|
if (!response.ok) {
|
|
43315
43491
|
return failure(routeKey, "http_error", response.error ?? `HTTP ${response.status}`, {
|
|
@@ -43319,8 +43495,22 @@ async function requestAgentApiRawRoute(transport, routeKey, options = {}) {
|
|
|
43319
43495
|
response: response.data
|
|
43320
43496
|
});
|
|
43321
43497
|
}
|
|
43498
|
+
if (getAgentApiResponseKind(route3.response) === "binary") {
|
|
43499
|
+
if (!(response.data instanceof Uint8Array)) {
|
|
43500
|
+
return failure(routeKey, "response_contract_mismatch", `Agent API ${route3.key} response did not contain binary bytes`, {
|
|
43501
|
+
status: response.status,
|
|
43502
|
+
response: response.data
|
|
43503
|
+
});
|
|
43504
|
+
}
|
|
43505
|
+
return {
|
|
43506
|
+
ok: true,
|
|
43507
|
+
routeKey,
|
|
43508
|
+
status: response.status,
|
|
43509
|
+
data: response.data
|
|
43510
|
+
};
|
|
43511
|
+
}
|
|
43322
43512
|
if (response.data === null) {
|
|
43323
|
-
return failure(routeKey, "empty_response", `Agent API ${
|
|
43513
|
+
return failure(routeKey, "empty_response", `Agent API ${route3.key} returned an empty response body`, {
|
|
43324
43514
|
status: response.status
|
|
43325
43515
|
});
|
|
43326
43516
|
}
|
|
@@ -43332,7 +43522,7 @@ async function requestAgentApiRawRoute(transport, routeKey, options = {}) {
|
|
|
43332
43522
|
data: parseAgentApiResponse(routeKey, response.data)
|
|
43333
43523
|
};
|
|
43334
43524
|
} catch (cause) {
|
|
43335
|
-
return failure(routeKey, "response_contract_mismatch", `Agent API ${
|
|
43525
|
+
return failure(routeKey, "response_contract_mismatch", `Agent API ${route3.key} response did not match the shared contract`, {
|
|
43336
43526
|
status: response.status,
|
|
43337
43527
|
cause,
|
|
43338
43528
|
response: response.data
|
|
@@ -43340,16 +43530,16 @@ async function requestAgentApiRawRoute(transport, routeKey, options = {}) {
|
|
|
43340
43530
|
}
|
|
43341
43531
|
}
|
|
43342
43532
|
function requestOptionsFromMethodArgs(routeKey, pathPrefix, args) {
|
|
43343
|
-
const
|
|
43533
|
+
const route3 = agentApiContract[routeKey];
|
|
43344
43534
|
let index = 0;
|
|
43345
43535
|
const requestOptions = { pathPrefix };
|
|
43346
|
-
if ("params" in
|
|
43536
|
+
if ("params" in route3.request) {
|
|
43347
43537
|
requestOptions.params = args[index++];
|
|
43348
43538
|
}
|
|
43349
|
-
if ("query" in
|
|
43539
|
+
if ("query" in route3.request) {
|
|
43350
43540
|
requestOptions.query = args[index++];
|
|
43351
43541
|
}
|
|
43352
|
-
if ("body" in
|
|
43542
|
+
if ("body" in route3.request) {
|
|
43353
43543
|
requestOptions.body = args[index++];
|
|
43354
43544
|
}
|
|
43355
43545
|
return requestOptions;
|
|
@@ -43357,9 +43547,9 @@ function requestOptionsFromMethodArgs(routeKey, pathPrefix, args) {
|
|
|
43357
43547
|
function createAgentApiRawClient(transport, options = {}) {
|
|
43358
43548
|
const pathPrefix = options.pathPrefix ?? AGENT_API_BASE_PATH;
|
|
43359
43549
|
const client = {};
|
|
43360
|
-
for (const
|
|
43361
|
-
const routeKey =
|
|
43362
|
-
const { resource, method } =
|
|
43550
|
+
for (const route3 of Object.values(agentApiContract)) {
|
|
43551
|
+
const routeKey = route3.key;
|
|
43552
|
+
const { resource, method } = route3.client;
|
|
43363
43553
|
const resourceClient = client[resource] ??= {};
|
|
43364
43554
|
resourceClient[method] = (...args) => requestAgentApiRawRoute(
|
|
43365
43555
|
transport,
|
|
@@ -43380,7 +43570,10 @@ async function authHeadersForRequest(auth, request) {
|
|
|
43380
43570
|
if (!auth) return void 0;
|
|
43381
43571
|
return typeof auth === "function" ? auth(request) : auth;
|
|
43382
43572
|
}
|
|
43383
|
-
async function parseFetchResponse(response) {
|
|
43573
|
+
async function parseFetchResponse(response, responseKind) {
|
|
43574
|
+
if (response.ok && responseKind === "binary") {
|
|
43575
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
43576
|
+
}
|
|
43384
43577
|
const text = await response.text();
|
|
43385
43578
|
if (!text.trim()) return null;
|
|
43386
43579
|
try {
|
|
@@ -43416,8 +43609,9 @@ function createAgentApiFetchTransport(options) {
|
|
|
43416
43609
|
request: async (input) => {
|
|
43417
43610
|
await options.throttle?.beforeRequest?.(input);
|
|
43418
43611
|
const authHeaders = await authHeadersForRequest(options.auth, input);
|
|
43612
|
+
const responseKind = getAgentApiResponseKind(agentApiContract[input.routeKey].response);
|
|
43419
43613
|
const headers = mergeHeaders(
|
|
43420
|
-
{ accept: "application/json" },
|
|
43614
|
+
{ accept: responseKind === "binary" ? "*/*" : "application/json" },
|
|
43421
43615
|
input.body === void 0 ? void 0 : { "content-type": "application/json" },
|
|
43422
43616
|
options.headers,
|
|
43423
43617
|
authHeaders
|
|
@@ -43431,7 +43625,7 @@ function createAgentApiFetchTransport(options) {
|
|
|
43431
43625
|
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
|
43432
43626
|
try {
|
|
43433
43627
|
const response = await fetchImpl(`${baseUrl}${input.path}`, init);
|
|
43434
|
-
return transportResponseFromFetch(response, await parseFetchResponse(response));
|
|
43628
|
+
return transportResponseFromFetch(response, await parseFetchResponse(response, responseKind));
|
|
43435
43629
|
} catch (cause) {
|
|
43436
43630
|
lastError = cause;
|
|
43437
43631
|
if (attempt === maxAttempts) throw cause;
|
|
@@ -43441,33 +43635,33 @@ function createAgentApiFetchTransport(options) {
|
|
|
43441
43635
|
}
|
|
43442
43636
|
};
|
|
43443
43637
|
}
|
|
43444
|
-
function errorFromRawFailure(
|
|
43445
|
-
if (
|
|
43638
|
+
function errorFromRawFailure(failure3) {
|
|
43639
|
+
if (failure3.reason === "transport_error") {
|
|
43446
43640
|
return {
|
|
43447
43641
|
kind: "transport",
|
|
43448
|
-
reason:
|
|
43449
|
-
message:
|
|
43450
|
-
cause:
|
|
43642
|
+
reason: failure3.reason,
|
|
43643
|
+
message: failure3.message,
|
|
43644
|
+
cause: failure3.cause
|
|
43451
43645
|
};
|
|
43452
43646
|
}
|
|
43453
|
-
if (
|
|
43647
|
+
if (failure3.reason === "http_error") {
|
|
43454
43648
|
return {
|
|
43455
43649
|
kind: "http",
|
|
43456
|
-
reason:
|
|
43457
|
-
message:
|
|
43458
|
-
status:
|
|
43459
|
-
errorCode:
|
|
43460
|
-
suggestedNextAction:
|
|
43461
|
-
response:
|
|
43650
|
+
reason: failure3.reason,
|
|
43651
|
+
message: failure3.message,
|
|
43652
|
+
status: failure3.status ?? 0,
|
|
43653
|
+
errorCode: failure3.errorCode,
|
|
43654
|
+
suggestedNextAction: failure3.suggestedNextAction,
|
|
43655
|
+
response: failure3.response
|
|
43462
43656
|
};
|
|
43463
43657
|
}
|
|
43464
43658
|
return {
|
|
43465
43659
|
kind: "validation",
|
|
43466
|
-
reason:
|
|
43467
|
-
message:
|
|
43468
|
-
status:
|
|
43469
|
-
cause:
|
|
43470
|
-
response:
|
|
43660
|
+
reason: failure3.reason,
|
|
43661
|
+
message: failure3.message,
|
|
43662
|
+
status: failure3.status,
|
|
43663
|
+
cause: failure3.cause,
|
|
43664
|
+
response: failure3.response
|
|
43471
43665
|
};
|
|
43472
43666
|
}
|
|
43473
43667
|
function agentApiClientResultFromRaw(result2) {
|
|
@@ -43515,6 +43709,369 @@ function createAgentApiClient(transportOrOptions, maybeOptions = {}) {
|
|
|
43515
43709
|
};
|
|
43516
43710
|
}
|
|
43517
43711
|
init_esm_shims();
|
|
43712
|
+
var DAEMON_API_BASE_PATH = "/internal/agent-api";
|
|
43713
|
+
var optionalStringSchema2 = external_exports.string().trim().optional();
|
|
43714
|
+
var optionalNonNegativeIntSchema = external_exports.number().int().nonnegative().optional();
|
|
43715
|
+
var optionalQueryIntSchema = external_exports.union([external_exports.number().int().nonnegative(), external_exports.string().trim().min(1)]).optional();
|
|
43716
|
+
var nullableNumberSchema2 = external_exports.number().finite().nullable();
|
|
43717
|
+
var passthroughObject2 = (shape) => external_exports.object(shape).passthrough();
|
|
43718
|
+
var daemonApiInboxFlagSchema = external_exports.enum(["mention", "thread", "dm", "task"]);
|
|
43719
|
+
var daemonApiInboxTargetRowSchema = passthroughObject2({
|
|
43720
|
+
target: external_exports.string().trim().min(1),
|
|
43721
|
+
channelId: optionalStringSchema2,
|
|
43722
|
+
channelType: optionalStringSchema2,
|
|
43723
|
+
pendingCount: external_exports.number().int().nonnegative(),
|
|
43724
|
+
firstPendingMsgId: optionalStringSchema2,
|
|
43725
|
+
firstPendingSeq: optionalNonNegativeIntSchema,
|
|
43726
|
+
latestMsgId: optionalStringSchema2,
|
|
43727
|
+
latestSeq: optionalNonNegativeIntSchema,
|
|
43728
|
+
latestSenderName: optionalStringSchema2,
|
|
43729
|
+
latestSenderType: external_exports.enum(["human", "agent", "system"]).optional(),
|
|
43730
|
+
flags: external_exports.array(daemonApiInboxFlagSchema)
|
|
43731
|
+
});
|
|
43732
|
+
var daemonApiInboxCheckResponseSchema = passthroughObject2({
|
|
43733
|
+
rows: external_exports.array(daemonApiInboxTargetRowSchema).optional()
|
|
43734
|
+
});
|
|
43735
|
+
var daemonApiWakeHintsQuerySchema = passthroughObject2({
|
|
43736
|
+
since: external_exports.union([external_exports.literal("latest"), external_exports.number().int().nonnegative(), external_exports.string().trim().min(1)]).optional(),
|
|
43737
|
+
limit: optionalQueryIntSchema
|
|
43738
|
+
});
|
|
43739
|
+
var daemonApiWakeHintSchema = passthroughObject2({
|
|
43740
|
+
hintId: optionalStringSchema2,
|
|
43741
|
+
hint_id: optionalStringSchema2,
|
|
43742
|
+
eventId: optionalStringSchema2,
|
|
43743
|
+
event_id: optionalStringSchema2,
|
|
43744
|
+
messageId: external_exports.string().nullable().optional(),
|
|
43745
|
+
message_id: external_exports.string().nullable().optional(),
|
|
43746
|
+
seq: optionalNonNegativeIntSchema,
|
|
43747
|
+
id: optionalStringSchema2,
|
|
43748
|
+
target: optionalStringSchema2,
|
|
43749
|
+
targetType: optionalStringSchema2,
|
|
43750
|
+
target_type: optionalStringSchema2,
|
|
43751
|
+
reason: optionalStringSchema2,
|
|
43752
|
+
wake_reason: optionalStringSchema2,
|
|
43753
|
+
createdAt: optionalStringSchema2,
|
|
43754
|
+
created_at: optionalStringSchema2
|
|
43755
|
+
});
|
|
43756
|
+
var daemonApiWakeHintsFetchResponseSchema = passthroughObject2({
|
|
43757
|
+
hints: external_exports.array(daemonApiWakeHintSchema).optional(),
|
|
43758
|
+
wake_hints: external_exports.array(daemonApiWakeHintSchema).optional(),
|
|
43759
|
+
last_seen_hint_seq: nullableNumberSchema2.optional(),
|
|
43760
|
+
last_hint_seq: nullableNumberSchema2.optional(),
|
|
43761
|
+
has_more: external_exports.boolean().optional()
|
|
43762
|
+
});
|
|
43763
|
+
var daemonApiActivityEventSchema = passthroughObject2({
|
|
43764
|
+
schema: optionalStringSchema2
|
|
43765
|
+
});
|
|
43766
|
+
var daemonApiActivityForwardBodySchema = passthroughObject2({
|
|
43767
|
+
schema: external_exports.literal("raft-agent-activity-ingest.v1"),
|
|
43768
|
+
coreSessionId: optionalStringSchema2,
|
|
43769
|
+
adapterInstance: optionalStringSchema2,
|
|
43770
|
+
events: external_exports.array(daemonApiActivityEventSchema),
|
|
43771
|
+
dropped: optionalNonNegativeIntSchema
|
|
43772
|
+
});
|
|
43773
|
+
var daemonApiActivityForwardResponseSchema = passthroughObject2({
|
|
43774
|
+
ok: external_exports.literal(true).optional(),
|
|
43775
|
+
acceptedCount: external_exports.number().int().nonnegative().optional(),
|
|
43776
|
+
rejectedCount: external_exports.number().int().nonnegative().optional(),
|
|
43777
|
+
droppedCount: external_exports.number().int().nonnegative().optional()
|
|
43778
|
+
});
|
|
43779
|
+
function route2(input) {
|
|
43780
|
+
return {
|
|
43781
|
+
...input,
|
|
43782
|
+
fullPath: `${DAEMON_API_BASE_PATH}${input.path}`
|
|
43783
|
+
};
|
|
43784
|
+
}
|
|
43785
|
+
var daemonApiContract = {
|
|
43786
|
+
inboxCheck: route2({
|
|
43787
|
+
key: "inboxCheck",
|
|
43788
|
+
method: "GET",
|
|
43789
|
+
path: "/inbox",
|
|
43790
|
+
client: { resource: "inbox", method: "check" },
|
|
43791
|
+
description: "Read the managed-runner daemon inbox snapshot without draining message content.",
|
|
43792
|
+
request: {},
|
|
43793
|
+
response: { body: daemonApiInboxCheckResponseSchema }
|
|
43794
|
+
}),
|
|
43795
|
+
wakeHintsFetch: route2({
|
|
43796
|
+
key: "wakeHintsFetch",
|
|
43797
|
+
method: "GET",
|
|
43798
|
+
path: "/wake-hints",
|
|
43799
|
+
client: { resource: "wakeHints", method: "fetch" },
|
|
43800
|
+
description: "Peek content-free wake hints without advancing delivery cursors.",
|
|
43801
|
+
request: { query: daemonApiWakeHintsQuerySchema },
|
|
43802
|
+
response: { body: daemonApiWakeHintsFetchResponseSchema }
|
|
43803
|
+
}),
|
|
43804
|
+
activityForward: route2({
|
|
43805
|
+
key: "activityForward",
|
|
43806
|
+
method: "POST",
|
|
43807
|
+
path: "/activity",
|
|
43808
|
+
client: { resource: "activity", method: "forward" },
|
|
43809
|
+
description: "Forward plugin-observed activity from a local bridge to the daemon/server activity ingest path.",
|
|
43810
|
+
request: { body: daemonApiActivityForwardBodySchema },
|
|
43811
|
+
response: { body: daemonApiActivityForwardResponseSchema }
|
|
43812
|
+
})
|
|
43813
|
+
};
|
|
43814
|
+
function parseDaemonApiResponse(routeKey, data) {
|
|
43815
|
+
return daemonApiContract[routeKey].response.body.parse(data);
|
|
43816
|
+
}
|
|
43817
|
+
init_esm_shims();
|
|
43818
|
+
function failure2(routeKey, reason, message, details = {}) {
|
|
43819
|
+
return {
|
|
43820
|
+
ok: false,
|
|
43821
|
+
...routeKey ? { routeKey } : {},
|
|
43822
|
+
reason,
|
|
43823
|
+
message,
|
|
43824
|
+
...details
|
|
43825
|
+
};
|
|
43826
|
+
}
|
|
43827
|
+
function encodeQuery2(routeKey, query) {
|
|
43828
|
+
if (query === void 0) return void 0;
|
|
43829
|
+
const route3 = daemonApiContract[routeKey];
|
|
43830
|
+
let parsed;
|
|
43831
|
+
try {
|
|
43832
|
+
parsed = "query" in route3.request ? route3.request.query.parse(query) : {};
|
|
43833
|
+
} catch (cause) {
|
|
43834
|
+
return failure2(routeKey, "request_contract_mismatch", `Daemon API ${route3.key} query did not match the shared contract`, { cause });
|
|
43835
|
+
}
|
|
43836
|
+
const params = new URLSearchParams();
|
|
43837
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
43838
|
+
if (value === void 0 || value === null) continue;
|
|
43839
|
+
if (Array.isArray(value)) {
|
|
43840
|
+
for (const item of value) params.append(key, String(item));
|
|
43841
|
+
continue;
|
|
43842
|
+
}
|
|
43843
|
+
params.set(key, String(value));
|
|
43844
|
+
}
|
|
43845
|
+
return params;
|
|
43846
|
+
}
|
|
43847
|
+
function parseBody2(routeKey, body) {
|
|
43848
|
+
if (body === void 0) return void 0;
|
|
43849
|
+
const route3 = daemonApiContract[routeKey];
|
|
43850
|
+
try {
|
|
43851
|
+
return "body" in route3.request ? route3.request.body.parse(body) : void 0;
|
|
43852
|
+
} catch (cause) {
|
|
43853
|
+
return failure2(routeKey, "request_contract_mismatch", `Daemon API ${route3.key} body did not match the shared contract`, { cause });
|
|
43854
|
+
}
|
|
43855
|
+
}
|
|
43856
|
+
function isDaemonApiRawFailure(value) {
|
|
43857
|
+
return Boolean(
|
|
43858
|
+
value && typeof value === "object" && value.ok === false && typeof value.reason === "string" && typeof value.message === "string"
|
|
43859
|
+
);
|
|
43860
|
+
}
|
|
43861
|
+
function buildDaemonApiRawRoutePath(routeKey, options = {}) {
|
|
43862
|
+
const route3 = daemonApiContract[routeKey];
|
|
43863
|
+
const query = encodeQuery2(routeKey, options.query);
|
|
43864
|
+
if (query && !(query instanceof URLSearchParams)) return query;
|
|
43865
|
+
const suffix = query && query.size > 0 ? `?${query.toString()}` : "";
|
|
43866
|
+
return `${options.pathPrefix ?? DAEMON_API_BASE_PATH}${route3.path}${suffix}`;
|
|
43867
|
+
}
|
|
43868
|
+
async function requestDaemonApiRawRoute(transport, routeKey, options = {}) {
|
|
43869
|
+
const route3 = daemonApiContract[routeKey];
|
|
43870
|
+
const path9 = buildDaemonApiRawRoutePath(routeKey, options);
|
|
43871
|
+
if (typeof path9 !== "string") return path9;
|
|
43872
|
+
const body = parseBody2(routeKey, options.body);
|
|
43873
|
+
if (isDaemonApiRawFailure(body)) return body;
|
|
43874
|
+
let response;
|
|
43875
|
+
try {
|
|
43876
|
+
response = await transport.request({
|
|
43877
|
+
routeKey,
|
|
43878
|
+
method: route3.method,
|
|
43879
|
+
path: path9,
|
|
43880
|
+
body
|
|
43881
|
+
});
|
|
43882
|
+
} catch (cause) {
|
|
43883
|
+
return failure2(routeKey, "transport_error", `Daemon API ${route3.key} transport request failed`, { cause });
|
|
43884
|
+
}
|
|
43885
|
+
if (!response.ok) {
|
|
43886
|
+
return failure2(routeKey, "http_error", response.error ?? `HTTP ${response.status}`, {
|
|
43887
|
+
status: response.status,
|
|
43888
|
+
errorCode: response.errorCode,
|
|
43889
|
+
suggestedNextAction: response.suggestedNextAction,
|
|
43890
|
+
response: response.data
|
|
43891
|
+
});
|
|
43892
|
+
}
|
|
43893
|
+
if (response.data === null) {
|
|
43894
|
+
return failure2(routeKey, "empty_response", `Daemon API ${route3.key} returned an empty response body`, {
|
|
43895
|
+
status: response.status
|
|
43896
|
+
});
|
|
43897
|
+
}
|
|
43898
|
+
try {
|
|
43899
|
+
return {
|
|
43900
|
+
ok: true,
|
|
43901
|
+
routeKey,
|
|
43902
|
+
status: response.status,
|
|
43903
|
+
data: parseDaemonApiResponse(routeKey, response.data)
|
|
43904
|
+
};
|
|
43905
|
+
} catch (cause) {
|
|
43906
|
+
return failure2(routeKey, "response_contract_mismatch", `Daemon API ${route3.key} response did not match the shared contract`, {
|
|
43907
|
+
status: response.status,
|
|
43908
|
+
cause,
|
|
43909
|
+
response: response.data
|
|
43910
|
+
});
|
|
43911
|
+
}
|
|
43912
|
+
}
|
|
43913
|
+
function requestOptionsFromMethodArgs2(routeKey, pathPrefix, args) {
|
|
43914
|
+
const route3 = daemonApiContract[routeKey];
|
|
43915
|
+
let index = 0;
|
|
43916
|
+
const requestOptions = { pathPrefix };
|
|
43917
|
+
if ("query" in route3.request) {
|
|
43918
|
+
requestOptions.query = args[index++];
|
|
43919
|
+
}
|
|
43920
|
+
if ("body" in route3.request) {
|
|
43921
|
+
requestOptions.body = args[index++];
|
|
43922
|
+
}
|
|
43923
|
+
return requestOptions;
|
|
43924
|
+
}
|
|
43925
|
+
function createDaemonApiRawClient(transport, options = {}) {
|
|
43926
|
+
const pathPrefix = options.pathPrefix ?? DAEMON_API_BASE_PATH;
|
|
43927
|
+
const client = {};
|
|
43928
|
+
for (const route3 of Object.values(daemonApiContract)) {
|
|
43929
|
+
const routeKey = route3.key;
|
|
43930
|
+
const { resource, method } = route3.client;
|
|
43931
|
+
const resourceClient = client[resource] ??= {};
|
|
43932
|
+
resourceClient[method] = (...args) => requestDaemonApiRawRoute(
|
|
43933
|
+
transport,
|
|
43934
|
+
routeKey,
|
|
43935
|
+
requestOptionsFromMethodArgs2(routeKey, pathPrefix, args)
|
|
43936
|
+
);
|
|
43937
|
+
}
|
|
43938
|
+
return client;
|
|
43939
|
+
}
|
|
43940
|
+
init_esm_shims();
|
|
43941
|
+
function normalizeBaseUrl2(baseUrl) {
|
|
43942
|
+
return baseUrl.replace(/\/+$/, "");
|
|
43943
|
+
}
|
|
43944
|
+
function mergeHeaders2(...headers) {
|
|
43945
|
+
return Object.assign({}, ...headers.filter(Boolean));
|
|
43946
|
+
}
|
|
43947
|
+
async function authHeadersForRequest2(auth, request) {
|
|
43948
|
+
if (!auth) return void 0;
|
|
43949
|
+
return typeof auth === "function" ? auth(request) : auth;
|
|
43950
|
+
}
|
|
43951
|
+
async function parseFetchResponse2(response) {
|
|
43952
|
+
const text = await response.text();
|
|
43953
|
+
if (!text.trim()) return null;
|
|
43954
|
+
try {
|
|
43955
|
+
return JSON.parse(text);
|
|
43956
|
+
} catch {
|
|
43957
|
+
return text;
|
|
43958
|
+
}
|
|
43959
|
+
}
|
|
43960
|
+
function transportResponseFromFetch2(response, data) {
|
|
43961
|
+
if (response.ok) {
|
|
43962
|
+
return {
|
|
43963
|
+
ok: true,
|
|
43964
|
+
status: response.status,
|
|
43965
|
+
data,
|
|
43966
|
+
error: null
|
|
43967
|
+
};
|
|
43968
|
+
}
|
|
43969
|
+
const objectData = data && typeof data === "object" ? data : {};
|
|
43970
|
+
return {
|
|
43971
|
+
ok: false,
|
|
43972
|
+
status: response.status,
|
|
43973
|
+
data,
|
|
43974
|
+
error: typeof objectData.error === "string" ? objectData.error : response.statusText || `HTTP ${response.status}`,
|
|
43975
|
+
errorCode: typeof objectData.errorCode === "string" ? objectData.errorCode : null,
|
|
43976
|
+
suggestedNextAction: typeof objectData.suggestedNextAction === "string" ? objectData.suggestedNextAction : null
|
|
43977
|
+
};
|
|
43978
|
+
}
|
|
43979
|
+
function createDaemonApiFetchTransport(options) {
|
|
43980
|
+
const fetchImpl = options.fetch ?? fetch;
|
|
43981
|
+
const baseUrl = normalizeBaseUrl2(options.baseUrl);
|
|
43982
|
+
return {
|
|
43983
|
+
request: async (input) => {
|
|
43984
|
+
const authHeaders = await authHeadersForRequest2(options.auth, input);
|
|
43985
|
+
const headers = mergeHeaders2(
|
|
43986
|
+
{ accept: "application/json" },
|
|
43987
|
+
input.body === void 0 ? void 0 : { "content-type": "application/json" },
|
|
43988
|
+
options.headers,
|
|
43989
|
+
authHeaders
|
|
43990
|
+
);
|
|
43991
|
+
const init = {
|
|
43992
|
+
method: input.method,
|
|
43993
|
+
headers,
|
|
43994
|
+
body: input.body === void 0 ? void 0 : JSON.stringify(input.body)
|
|
43995
|
+
};
|
|
43996
|
+
const response = await fetchImpl(`${baseUrl}${input.path}`, init);
|
|
43997
|
+
return transportResponseFromFetch2(response, await parseFetchResponse2(response));
|
|
43998
|
+
}
|
|
43999
|
+
};
|
|
44000
|
+
}
|
|
44001
|
+
function errorFromRawFailure2(failure3) {
|
|
44002
|
+
if (failure3.reason === "transport_error") {
|
|
44003
|
+
return {
|
|
44004
|
+
kind: "transport",
|
|
44005
|
+
reason: failure3.reason,
|
|
44006
|
+
message: failure3.message,
|
|
44007
|
+
cause: failure3.cause
|
|
44008
|
+
};
|
|
44009
|
+
}
|
|
44010
|
+
if (failure3.reason === "http_error") {
|
|
44011
|
+
return {
|
|
44012
|
+
kind: "http",
|
|
44013
|
+
reason: failure3.reason,
|
|
44014
|
+
message: failure3.message,
|
|
44015
|
+
status: failure3.status ?? 0,
|
|
44016
|
+
errorCode: failure3.errorCode,
|
|
44017
|
+
suggestedNextAction: failure3.suggestedNextAction,
|
|
44018
|
+
response: failure3.response
|
|
44019
|
+
};
|
|
44020
|
+
}
|
|
44021
|
+
return {
|
|
44022
|
+
kind: "validation",
|
|
44023
|
+
reason: failure3.reason,
|
|
44024
|
+
message: failure3.message,
|
|
44025
|
+
status: failure3.status,
|
|
44026
|
+
cause: failure3.cause,
|
|
44027
|
+
response: failure3.response
|
|
44028
|
+
};
|
|
44029
|
+
}
|
|
44030
|
+
function daemonApiClientResultFromRaw(result2) {
|
|
44031
|
+
if (result2.ok) {
|
|
44032
|
+
const success2 = result2;
|
|
44033
|
+
return {
|
|
44034
|
+
ok: true,
|
|
44035
|
+
routeKey: success2.routeKey,
|
|
44036
|
+
status: success2.status,
|
|
44037
|
+
data: success2.data
|
|
44038
|
+
};
|
|
44039
|
+
}
|
|
44040
|
+
return {
|
|
44041
|
+
ok: false,
|
|
44042
|
+
routeKey: result2.routeKey,
|
|
44043
|
+
status: result2.status,
|
|
44044
|
+
error: errorFromRawFailure2(result2)
|
|
44045
|
+
};
|
|
44046
|
+
}
|
|
44047
|
+
function wrapRawClient2(rawClient) {
|
|
44048
|
+
const client = {};
|
|
44049
|
+
for (const [resource, methods] of Object.entries(rawClient)) {
|
|
44050
|
+
client[resource] = {};
|
|
44051
|
+
for (const [method, rawMethod] of Object.entries(methods)) {
|
|
44052
|
+
client[resource][method] = async (...args) => daemonApiClientResultFromRaw(await rawMethod(...args));
|
|
44053
|
+
}
|
|
44054
|
+
}
|
|
44055
|
+
return client;
|
|
44056
|
+
}
|
|
44057
|
+
function createDaemonApiClient(transportOrOptions, maybeOptions = {}) {
|
|
44058
|
+
const options = "request" in transportOrOptions ? { ...maybeOptions, transport: transportOrOptions } : transportOrOptions;
|
|
44059
|
+
const transport = options.transport ?? (options.fetch ? createDaemonApiFetchTransport(options.fetch) : void 0);
|
|
44060
|
+
if (!transport) {
|
|
44061
|
+
throw new Error("createDaemonApiClient requires either a transport or fetch options");
|
|
44062
|
+
}
|
|
44063
|
+
const pathPrefix = options.pathPrefix ?? DAEMON_API_BASE_PATH;
|
|
44064
|
+
const rawClient = createDaemonApiRawClient(transport, { pathPrefix });
|
|
44065
|
+
const generated = wrapRawClient2(rawClient);
|
|
44066
|
+
return {
|
|
44067
|
+
...generated,
|
|
44068
|
+
request: async (routeKey, requestOptions = {}) => daemonApiClientResultFromRaw(await requestDaemonApiRawRoute(transport, routeKey, {
|
|
44069
|
+
pathPrefix,
|
|
44070
|
+
...requestOptions
|
|
44071
|
+
}))
|
|
44072
|
+
};
|
|
44073
|
+
}
|
|
44074
|
+
init_esm_shims();
|
|
43518
44075
|
function formatAgentInboxSnapshot(rows) {
|
|
43519
44076
|
if (rows.length === 0) return "Inbox: empty";
|
|
43520
44077
|
return [
|
|
@@ -43721,6 +44278,7 @@ init_esm_shims();
|
|
|
43721
44278
|
init_esm_shims();
|
|
43722
44279
|
init_esm_shims();
|
|
43723
44280
|
init_esm_shims();
|
|
44281
|
+
init_esm_shims();
|
|
43724
44282
|
var NoopFailpointRegistry = class {
|
|
43725
44283
|
get enabled() {
|
|
43726
44284
|
return false;
|
|
@@ -43848,13 +44406,15 @@ var RUNTIME_MODELS = {
|
|
|
43848
44406
|
builtin: Object.values(PI_BUILTIN_PROVIDER_MODELS).flat().map((model) => ({ id: model.id, label: model.label || formatRuntimeProviderModelLabel(model.id), verified: "launchable" })),
|
|
43849
44407
|
claude: [
|
|
43850
44408
|
{ id: "opus", label: "Claude Opus" },
|
|
44409
|
+
{ id: "fable", label: "Claude Fable" },
|
|
44410
|
+
{ id: "sonnet", label: "Claude Sonnet" },
|
|
44411
|
+
{ id: "haiku", label: "Claude Haiku" },
|
|
43851
44412
|
{ id: "claude-opus-4-8", label: "Claude Opus 4.8" },
|
|
43852
44413
|
{ id: "claude-opus-4-7", label: "Claude Opus 4.7" },
|
|
43853
44414
|
{ id: "claude-opus-4-6", label: "Claude Opus 4.6" },
|
|
43854
|
-
{ id: "fable", label: "Claude Fable" },
|
|
43855
|
-
{ id: "sonnet", label: "Claude Sonnet" },
|
|
44415
|
+
{ id: "claude-fable-5", label: "Claude Fable 5" },
|
|
44416
|
+
{ id: "claude-sonnet-5", label: "Claude Sonnet 5" },
|
|
43856
44417
|
{ id: "claude-sonnet-4-6", label: "Claude Sonnet 4.6" },
|
|
43857
|
-
{ id: "haiku", label: "Claude Haiku" },
|
|
43858
44418
|
{ id: "claude-haiku-4-5", label: "Claude Haiku 4.5" }
|
|
43859
44419
|
],
|
|
43860
44420
|
codex: [
|
|
@@ -44026,66 +44586,84 @@ function buildAgentApiEventsPath(query) {
|
|
|
44026
44586
|
}
|
|
44027
44587
|
function rawTransportForClient(client) {
|
|
44028
44588
|
return {
|
|
44029
|
-
request: async (input) =>
|
|
44589
|
+
request: async (input) => {
|
|
44590
|
+
const route3 = agentApiContract[input.routeKey];
|
|
44591
|
+
if (getAgentApiResponseKind(route3.response) === "binary") {
|
|
44592
|
+
if (typeof client.requestBinary !== "function") {
|
|
44593
|
+
throw new CliError({
|
|
44594
|
+
code: "VIEW_FAILED",
|
|
44595
|
+
message: "Agent API binary download transport is unavailable in this CLI context"
|
|
44596
|
+
});
|
|
44597
|
+
}
|
|
44598
|
+
const response = await client.requestBinary(input.method, input.path);
|
|
44599
|
+
return {
|
|
44600
|
+
ok: response.ok,
|
|
44601
|
+
status: response.status,
|
|
44602
|
+
data: response.ok ? response.body : null,
|
|
44603
|
+
error: response.error
|
|
44604
|
+
};
|
|
44605
|
+
}
|
|
44606
|
+
return client.request(input.method, input.path, input.body);
|
|
44607
|
+
}
|
|
44030
44608
|
};
|
|
44031
44609
|
}
|
|
44032
|
-
function cliErrorFromRawFailure(
|
|
44033
|
-
switch (
|
|
44610
|
+
function cliErrorFromRawFailure(failure3) {
|
|
44611
|
+
switch (failure3.reason) {
|
|
44034
44612
|
case "missing_path_param":
|
|
44035
44613
|
case "request_contract_mismatch":
|
|
44036
44614
|
return new CliError({
|
|
44037
44615
|
code: "INVALID_ARG",
|
|
44038
|
-
message:
|
|
44039
|
-
cause:
|
|
44616
|
+
message: failure3.message,
|
|
44617
|
+
cause: failure3.cause
|
|
44040
44618
|
});
|
|
44041
44619
|
case "empty_response":
|
|
44042
44620
|
case "response_contract_mismatch":
|
|
44043
44621
|
case "missing_route":
|
|
44044
44622
|
return new CliError({
|
|
44045
44623
|
code: "INVALID_JSON_RESPONSE",
|
|
44046
|
-
message:
|
|
44047
|
-
cause:
|
|
44624
|
+
message: failure3.message,
|
|
44625
|
+
cause: failure3.cause
|
|
44048
44626
|
});
|
|
44049
44627
|
case "transport_error":
|
|
44050
44628
|
case "http_error":
|
|
44051
44629
|
return new CliError({
|
|
44052
44630
|
code: "CHECK_FAILED",
|
|
44053
|
-
message:
|
|
44054
|
-
cause:
|
|
44631
|
+
message: failure3.message,
|
|
44632
|
+
cause: failure3.cause
|
|
44055
44633
|
});
|
|
44056
44634
|
}
|
|
44057
44635
|
}
|
|
44058
|
-
function cliErrorFromClientFailure(
|
|
44059
|
-
switch (
|
|
44636
|
+
function cliErrorFromClientFailure(failure3) {
|
|
44637
|
+
switch (failure3.error.kind) {
|
|
44060
44638
|
case "validation":
|
|
44061
|
-
switch (
|
|
44639
|
+
switch (failure3.error.reason) {
|
|
44062
44640
|
case "missing_path_param":
|
|
44063
44641
|
case "request_contract_mismatch":
|
|
44064
44642
|
return new CliError({
|
|
44065
44643
|
code: "INVALID_ARG",
|
|
44066
|
-
message:
|
|
44067
|
-
cause:
|
|
44644
|
+
message: failure3.error.message,
|
|
44645
|
+
cause: failure3.error.cause
|
|
44068
44646
|
});
|
|
44069
44647
|
case "empty_response":
|
|
44070
44648
|
case "response_contract_mismatch":
|
|
44071
44649
|
case "missing_route":
|
|
44072
44650
|
return new CliError({
|
|
44073
44651
|
code: "INVALID_JSON_RESPONSE",
|
|
44074
|
-
message:
|
|
44075
|
-
cause:
|
|
44652
|
+
message: failure3.error.message,
|
|
44653
|
+
cause: failure3.error.cause
|
|
44076
44654
|
});
|
|
44077
44655
|
}
|
|
44078
44656
|
break;
|
|
44079
44657
|
case "transport":
|
|
44080
44658
|
return new CliError({
|
|
44081
44659
|
code: "CHECK_FAILED",
|
|
44082
|
-
message:
|
|
44083
|
-
cause:
|
|
44660
|
+
message: failure3.error.message,
|
|
44661
|
+
cause: failure3.error.cause
|
|
44084
44662
|
});
|
|
44085
44663
|
case "http":
|
|
44086
44664
|
return new CliError({
|
|
44087
44665
|
code: "CHECK_FAILED",
|
|
44088
|
-
message:
|
|
44666
|
+
message: failure3.error.message
|
|
44089
44667
|
});
|
|
44090
44668
|
}
|
|
44091
44669
|
}
|
|
@@ -44147,38 +44725,20 @@ async function requestMultipartContractAgentApiRoute(client, routeKey, form) {
|
|
|
44147
44725
|
});
|
|
44148
44726
|
}
|
|
44149
44727
|
}
|
|
44150
|
-
function
|
|
44151
|
-
const agentApi = createAgentApiClient(rawTransportForClient(client)
|
|
44152
|
-
pathPrefix: buildLegacyAgentApiPath(agentId, "")
|
|
44153
|
-
});
|
|
44728
|
+
function createAgentApiSurfaceClient(client) {
|
|
44729
|
+
const agentApi = createAgentApiClient(rawTransportForClient(client));
|
|
44154
44730
|
return {
|
|
44155
44731
|
server: {
|
|
44156
44732
|
info: () => requestClientAsApiResponse(agentApi.server.info())
|
|
44157
44733
|
},
|
|
44734
|
+
events: {
|
|
44735
|
+
get: (query) => requestClientAsApiResponse(agentApi.events.get(query))
|
|
44736
|
+
},
|
|
44158
44737
|
history: {
|
|
44159
44738
|
read: (query) => requestClientAsApiResponse(agentApi.history.read(query))
|
|
44160
44739
|
},
|
|
44161
|
-
|
|
44162
|
-
|
|
44163
|
-
resolve: (params) => requestClientAsApiResponse(agentApi.messages.resolve(params)),
|
|
44164
|
-
addReaction: (params, body) => requestClientAsApiResponse(agentApi.messages.addReaction(params, body)),
|
|
44165
|
-
removeReaction: (params, body) => requestClientAsApiResponse(agentApi.messages.removeReaction(params, body))
|
|
44166
|
-
},
|
|
44167
|
-
channels: {
|
|
44168
|
-
join: (params) => requestClientAsApiResponse(agentApi.channels.join(params)),
|
|
44169
|
-
leave: (params) => requestClientAsApiResponse(agentApi.channels.leave(params))
|
|
44170
|
-
},
|
|
44171
|
-
mentions: {
|
|
44172
|
-
pendingActions: (query) => requestClientAsApiResponse(agentApi.mentions.pendingActions(query ?? {})),
|
|
44173
|
-
executeAction: (body) => requestClientAsApiResponse(agentApi.mentions.executeAction(body))
|
|
44174
|
-
}
|
|
44175
|
-
};
|
|
44176
|
-
}
|
|
44177
|
-
function createAgentApiSurfaceClient(client) {
|
|
44178
|
-
const agentApi = createAgentApiClient(rawTransportForClient(client));
|
|
44179
|
-
return {
|
|
44180
|
-
events: {
|
|
44181
|
-
get: (query) => requestClientAsApiResponse(agentApi.events.get(query))
|
|
44740
|
+
knowledge: {
|
|
44741
|
+
get: (query) => requestClientAsApiResponse(agentApi.knowledge.get(query))
|
|
44182
44742
|
},
|
|
44183
44743
|
tasks: {
|
|
44184
44744
|
list: (query) => requestClientAsApiResponse(agentApi.tasks.list(query)),
|
|
@@ -44196,9 +44756,17 @@ function createAgentApiSurfaceClient(client) {
|
|
|
44196
44756
|
log: (params) => requestClientAsApiResponse(agentApi.reminders.log(params))
|
|
44197
44757
|
},
|
|
44198
44758
|
messages: {
|
|
44199
|
-
|
|
44759
|
+
send: (body) => requestClientAsApiResponse(agentApi.messages.send(body)),
|
|
44760
|
+
resolve: (params) => requestClientAsApiResponse(agentApi.messages.resolve(params)),
|
|
44761
|
+
search: (query) => requestClientAsApiResponse(agentApi.messages.search(query)),
|
|
44762
|
+
addReaction: (params, body) => requestClientAsApiResponse(agentApi.messages.addReaction(params, body)),
|
|
44763
|
+
removeReaction: (params, body) => requestClientAsApiResponse(agentApi.messages.removeReaction(params, body))
|
|
44200
44764
|
},
|
|
44201
44765
|
channels: {
|
|
44766
|
+
join: (params) => requestClientAsApiResponse(agentApi.channels.join(params)),
|
|
44767
|
+
leave: (params) => requestClientAsApiResponse(agentApi.channels.leave(params)),
|
|
44768
|
+
mute: (params) => requestClientAsApiResponse(agentApi.channels.mute(params)),
|
|
44769
|
+
unmute: (params) => requestClientAsApiResponse(agentApi.channels.unmute(params)),
|
|
44202
44770
|
members: (query) => requestClientAsApiResponse(agentApi.channels.members(query)),
|
|
44203
44771
|
resolve: (body) => requestClientAsApiResponse(agentApi.channels.resolve(body))
|
|
44204
44772
|
},
|
|
@@ -44207,18 +44775,27 @@ function createAgentApiSurfaceClient(client) {
|
|
|
44207
44775
|
},
|
|
44208
44776
|
profile: {
|
|
44209
44777
|
show: (query) => requestClientAsApiResponse(agentApi.profile.show(query)),
|
|
44210
|
-
update: (body) => requestClientAsApiResponse(agentApi.profile.update(body))
|
|
44778
|
+
update: (body) => requestClientAsApiResponse(agentApi.profile.update(body)),
|
|
44779
|
+
updateAvatar: (form) => requestMultipartContractAgentApiRoute(client, "profileAvatarUpdate", form)
|
|
44211
44780
|
},
|
|
44212
44781
|
integrations: {
|
|
44213
44782
|
list: () => requestClientAsApiResponse(agentApi.integrations.list()),
|
|
44214
44783
|
login: (body) => requestClientAsApiResponse(agentApi.integrations.login(body)),
|
|
44215
|
-
prepareApp: (body) => requestClientAsApiResponse(agentApi.integrations.prepareApp(body))
|
|
44784
|
+
prepareApp: (body) => requestClientAsApiResponse(agentApi.integrations.prepareApp(body)),
|
|
44785
|
+
rotateAppSecret: (body) => requestClientAsApiResponse(agentApi.integrations.rotateAppSecret(body))
|
|
44216
44786
|
},
|
|
44217
44787
|
actions: {
|
|
44218
44788
|
prepare: (body) => requestClientAsApiResponse(agentApi.actions.prepare(body))
|
|
44219
44789
|
},
|
|
44790
|
+
mentions: {
|
|
44791
|
+
pendingActions: (query) => requestClientAsApiResponse(agentApi.mentions.pendingActions(query ?? {})),
|
|
44792
|
+
executeAction: (body) => requestClientAsApiResponse(agentApi.mentions.executeAction(body))
|
|
44793
|
+
},
|
|
44220
44794
|
attachments: {
|
|
44221
|
-
upload: (form) => requestMultipartContractAgentApiRoute(client, "attachmentUpload", form)
|
|
44795
|
+
upload: (form) => requestMultipartContractAgentApiRoute(client, "attachmentUpload", form),
|
|
44796
|
+
download: (params) => requestClientAsApiResponse(agentApi.attachments.download(params)),
|
|
44797
|
+
view: (params) => requestClientAsApiResponse(agentApi.attachments.download(params)),
|
|
44798
|
+
comments: (params, query = {}) => requestClientAsApiResponse(agentApi.attachments.comments(params, query))
|
|
44222
44799
|
}
|
|
44223
44800
|
};
|
|
44224
44801
|
}
|
|
@@ -44307,7 +44884,6 @@ function routeFamilyForPath(pathname) {
|
|
|
44307
44884
|
if (normalized === "/internal/agent-api/activity") return "agent-api/activity";
|
|
44308
44885
|
if (normalized === "/internal/agent-api/events") return "agent-api/events";
|
|
44309
44886
|
if (normalized === "/internal/agent-api/inbox") return "agent-api/inbox";
|
|
44310
|
-
if (normalized === "/internal/agent-api/receive-ack") return "agent-api/events";
|
|
44311
44887
|
if (normalized === "/internal/agent-api/tasks/claim") return "tasks/claim";
|
|
44312
44888
|
if (normalized === "/internal/agent-api/tasks/update-status") return "tasks/update";
|
|
44313
44889
|
if (normalized === "/internal/agent-api/tasks" || normalized.startsWith("/internal/agent-api/tasks/")) {
|
|
@@ -44337,7 +44913,7 @@ function routeFamilyForPath(pathname) {
|
|
|
44337
44913
|
const firstAfterAgentId = parts[3] ?? "unknown";
|
|
44338
44914
|
if (firstAfterAgentId === "server") return "server";
|
|
44339
44915
|
if (firstAfterAgentId === "send") return "agent-api/send";
|
|
44340
|
-
if (firstAfterAgentId === "history" || firstAfterAgentId === "search" || firstAfterAgentId === "receive"
|
|
44916
|
+
if (firstAfterAgentId === "history" || firstAfterAgentId === "search" || firstAfterAgentId === "receive") {
|
|
44341
44917
|
return "agent-api/events";
|
|
44342
44918
|
}
|
|
44343
44919
|
if (firstAfterAgentId === "channel-members") return "channel-members";
|
|
@@ -44440,6 +45016,7 @@ var ApiClient = class {
|
|
|
44440
45016
|
if (!pathname.startsWith(agentPrefix)) return pathname;
|
|
44441
45017
|
const suffix = pathname.slice(agentPrefix.length);
|
|
44442
45018
|
if (suffix === "/server") return "/internal/agent-api/server";
|
|
45019
|
+
if (suffix === "/server/avatar") return "/internal/agent-api/server/avatar";
|
|
44443
45020
|
if (suffix === "/send") return "/internal/agent-api/send";
|
|
44444
45021
|
if (suffix.startsWith("/history")) return `/internal/agent-api/history${suffix.slice("/history".length)}`;
|
|
44445
45022
|
if (suffix.startsWith("/search")) return `/internal/agent-api/search${suffix.slice("/search".length)}`;
|
|
@@ -44457,6 +45034,7 @@ var ApiClient = class {
|
|
|
44457
45034
|
if (suffix === "/resolve-channel") return "/internal/agent-api/resolve-channel";
|
|
44458
45035
|
if (suffix === "/threads/unfollow") return "/internal/agent-api/threads/unfollow";
|
|
44459
45036
|
if (suffix === "/prepare-action") return "/internal/agent-api/prepare-action";
|
|
45037
|
+
if (suffix === "/channels") return "/internal/agent-api/channels";
|
|
44460
45038
|
if (suffix === "/tasks" || suffix.startsWith("/tasks?") || suffix.startsWith("/tasks/")) {
|
|
44461
45039
|
return `/internal/agent-api${suffix}`;
|
|
44462
45040
|
}
|
|
@@ -44477,6 +45055,14 @@ var ApiClient = class {
|
|
|
44477
45055
|
if (channelMembership) {
|
|
44478
45056
|
return `/internal/agent-api/channels/${channelMembership[1]}/${channelMembership[2]}`;
|
|
44479
45057
|
}
|
|
45058
|
+
const channelUpdate = /^\/channels\/([^/]+)$/.exec(suffix);
|
|
45059
|
+
if (channelUpdate) {
|
|
45060
|
+
return `/internal/agent-api/channels/${channelUpdate[1]}`;
|
|
45061
|
+
}
|
|
45062
|
+
const channelAddMember = /^\/channels\/([^/]+)\/members$/.exec(suffix);
|
|
45063
|
+
if (channelAddMember) {
|
|
45064
|
+
return `/internal/agent-api/channels/${channelAddMember[1]}/members`;
|
|
45065
|
+
}
|
|
44480
45066
|
return pathname;
|
|
44481
45067
|
}
|
|
44482
45068
|
normalizeAgentCredentialResponse(pathname, data) {
|
|
@@ -44616,10 +45202,7 @@ var ApiClient = class {
|
|
|
44616
45202
|
const res = await this.fetchWithTransportTrace(url2, pathname, init);
|
|
44617
45203
|
return this.parseJsonResponse(res);
|
|
44618
45204
|
}
|
|
44619
|
-
|
|
44620
|
-
// For non-JSON downloads (binary attachments). Caller is responsible for
|
|
44621
|
-
// consuming the body. On non-2xx, attempts to surface a JSON error.
|
|
44622
|
-
async requestRaw(method, pathname) {
|
|
45205
|
+
async requestBody(method, pathname) {
|
|
44623
45206
|
pathname = this.rewriteAgentCredentialPath(pathname);
|
|
44624
45207
|
const url2 = new URL(pathname, this.ctx.serverUrl);
|
|
44625
45208
|
const dispatcher = buildFetchDispatcher(url2.toString());
|
|
@@ -44646,6 +45229,21 @@ var ApiClient = class {
|
|
|
44646
45229
|
}
|
|
44647
45230
|
return { ok: res.ok, status: res.status, response: res, error: error48 };
|
|
44648
45231
|
}
|
|
45232
|
+
async requestBinary(method, pathname) {
|
|
45233
|
+
const res = await this.requestBody(method, pathname);
|
|
45234
|
+
if (!res.ok) {
|
|
45235
|
+
return { ok: false, status: res.status, body: new Uint8Array(), error: res.error };
|
|
45236
|
+
}
|
|
45237
|
+
return {
|
|
45238
|
+
ok: true,
|
|
45239
|
+
status: res.status,
|
|
45240
|
+
body: new Uint8Array(await res.response.arrayBuffer()),
|
|
45241
|
+
error: null
|
|
45242
|
+
};
|
|
45243
|
+
}
|
|
45244
|
+
async streamWakeHints(query) {
|
|
45245
|
+
return this.requestBody("GET", `/internal/agent-api/wake-hints/stream?${query.toString()}`);
|
|
45246
|
+
}
|
|
44649
45247
|
};
|
|
44650
45248
|
init_esm_shims();
|
|
44651
45249
|
var RAW_AGENT_ENV_KEYS = [
|
|
@@ -44714,21 +45312,21 @@ function readProfileCredential(slug, env) {
|
|
|
44714
45312
|
}
|
|
44715
45313
|
return { filePath, data: parsed };
|
|
44716
45314
|
}
|
|
44717
|
-
function readTokenFromFile(filePath) {
|
|
45315
|
+
function readTokenFromFile(filePath, envName) {
|
|
44718
45316
|
let raw;
|
|
44719
45317
|
try {
|
|
44720
45318
|
raw = fs.readFileSync(filePath, "utf-8");
|
|
44721
45319
|
} catch (err) {
|
|
44722
45320
|
throw new AgentBootstrapError(
|
|
44723
45321
|
"TOKEN_FILE_UNREADABLE",
|
|
44724
|
-
|
|
45322
|
+
`${envName}=${filePath} could not be read: ${err.message}`
|
|
44725
45323
|
);
|
|
44726
45324
|
}
|
|
44727
45325
|
const token = raw.trim();
|
|
44728
45326
|
if (!token) {
|
|
44729
45327
|
throw new AgentBootstrapError(
|
|
44730
45328
|
"TOKEN_FILE_EMPTY",
|
|
44731
|
-
|
|
45329
|
+
`${envName}=${filePath} is empty`
|
|
44732
45330
|
);
|
|
44733
45331
|
}
|
|
44734
45332
|
return token;
|
|
@@ -44781,7 +45379,7 @@ function loadAgentContext(env = process.env) {
|
|
|
44781
45379
|
"Set only one of SLOCK_AGENT_PROXY_TOKEN or SLOCK_AGENT_PROXY_TOKEN_FILE"
|
|
44782
45380
|
);
|
|
44783
45381
|
}
|
|
44784
|
-
const token = agentProxyToken ?? (agentProxyTokenFile ? readTokenFromFile(agentProxyTokenFile) : null);
|
|
45382
|
+
const token = agentProxyToken ?? (agentProxyTokenFile ? readTokenFromFile(agentProxyTokenFile, "SLOCK_AGENT_PROXY_TOKEN_FILE") : null);
|
|
44785
45383
|
if (!token) {
|
|
44786
45384
|
throw new AgentBootstrapError(
|
|
44787
45385
|
"MISSING_AGENT_PROXY_TOKEN",
|
|
@@ -44799,32 +45397,16 @@ function loadAgentContext(env = process.env) {
|
|
|
44799
45397
|
};
|
|
44800
45398
|
}
|
|
44801
45399
|
const tokenFile = env.SLOCK_AGENT_TOKEN_FILE;
|
|
44802
|
-
if (tokenFile) {
|
|
44803
|
-
return {
|
|
44804
|
-
agentId,
|
|
44805
|
-
serverUrl,
|
|
44806
|
-
serverId,
|
|
44807
|
-
token: readTokenFromFile(tokenFile),
|
|
44808
|
-
clientMode: "legacy-machine",
|
|
44809
|
-
secretSource: "legacy-token-file",
|
|
44810
|
-
activeCapabilities
|
|
44811
|
-
};
|
|
44812
|
-
}
|
|
44813
45400
|
const tokenLiteral = env.SLOCK_AGENT_TOKEN;
|
|
44814
|
-
if (tokenLiteral) {
|
|
44815
|
-
|
|
44816
|
-
|
|
44817
|
-
|
|
44818
|
-
|
|
44819
|
-
token: tokenLiteral,
|
|
44820
|
-
clientMode: "legacy-machine",
|
|
44821
|
-
secretSource: "legacy-token-env",
|
|
44822
|
-
activeCapabilities
|
|
44823
|
-
};
|
|
45401
|
+
if (tokenFile || tokenLiteral) {
|
|
45402
|
+
throw new AgentBootstrapError(
|
|
45403
|
+
"LEGACY_MACHINE_UNSUPPORTED",
|
|
45404
|
+
"SLOCK_AGENT_TOKEN_FILE/SLOCK_AGENT_TOKEN machine-token bootstrap is no longer supported by this CLI. Upgrade or restart the daemon so it injects SLOCK_AGENT_PROXY_URL plus SLOCK_AGENT_PROXY_TOKEN_FILE, or use RAFT_PROFILE with a credential from `raft agent login`."
|
|
45405
|
+
);
|
|
44824
45406
|
}
|
|
44825
45407
|
throw new AgentBootstrapError(
|
|
44826
45408
|
"MISSING_TOKEN",
|
|
44827
|
-
"Neither SLOCK_AGENT_PROXY_TOKEN_FILE
|
|
45409
|
+
"Neither SLOCK_AGENT_PROXY_TOKEN_FILE nor SLOCK_AGENT_PROXY_TOKEN is set. The daemon should inject proxy credentials when spawning the agent process, or use RAFT_PROFILE with a credential from `raft agent login`."
|
|
44828
45410
|
);
|
|
44829
45411
|
}
|
|
44830
45412
|
init_esm_shims();
|
|
@@ -45677,6 +46259,82 @@ function describeMintError(code, serverUrl) {
|
|
|
45677
46259
|
}
|
|
45678
46260
|
init_esm_shims();
|
|
45679
46261
|
init_esm_shims();
|
|
46262
|
+
function rawTransportForClient2(client) {
|
|
46263
|
+
return {
|
|
46264
|
+
request: (input) => client.request(input.method, input.path, input.body)
|
|
46265
|
+
};
|
|
46266
|
+
}
|
|
46267
|
+
function cliErrorFromClientFailure2(failure3) {
|
|
46268
|
+
switch (failure3.error.kind) {
|
|
46269
|
+
case "validation":
|
|
46270
|
+
switch (failure3.error.reason) {
|
|
46271
|
+
case "request_contract_mismatch":
|
|
46272
|
+
return new CliError({
|
|
46273
|
+
code: "INVALID_ARG",
|
|
46274
|
+
message: failure3.error.message,
|
|
46275
|
+
cause: failure3.error.cause
|
|
46276
|
+
});
|
|
46277
|
+
case "empty_response":
|
|
46278
|
+
case "response_contract_mismatch":
|
|
46279
|
+
return new CliError({
|
|
46280
|
+
code: "INVALID_JSON_RESPONSE",
|
|
46281
|
+
message: failure3.error.message,
|
|
46282
|
+
cause: failure3.error.cause
|
|
46283
|
+
});
|
|
46284
|
+
}
|
|
46285
|
+
break;
|
|
46286
|
+
case "transport":
|
|
46287
|
+
return new CliError({
|
|
46288
|
+
code: "CHECK_FAILED",
|
|
46289
|
+
message: failure3.error.message,
|
|
46290
|
+
cause: failure3.error.cause
|
|
46291
|
+
});
|
|
46292
|
+
case "http":
|
|
46293
|
+
return new CliError({
|
|
46294
|
+
code: "CHECK_FAILED",
|
|
46295
|
+
message: failure3.error.message
|
|
46296
|
+
});
|
|
46297
|
+
}
|
|
46298
|
+
}
|
|
46299
|
+
function apiResponseFromClientResult2(result2) {
|
|
46300
|
+
if (result2.ok) {
|
|
46301
|
+
return {
|
|
46302
|
+
ok: true,
|
|
46303
|
+
status: result2.status,
|
|
46304
|
+
data: result2.data,
|
|
46305
|
+
error: null
|
|
46306
|
+
};
|
|
46307
|
+
}
|
|
46308
|
+
if (result2.error.kind === "http") {
|
|
46309
|
+
return {
|
|
46310
|
+
ok: false,
|
|
46311
|
+
status: result2.error.status,
|
|
46312
|
+
data: null,
|
|
46313
|
+
error: result2.error.message,
|
|
46314
|
+
errorCode: result2.error.errorCode,
|
|
46315
|
+
suggestedNextAction: result2.error.suggestedNextAction
|
|
46316
|
+
};
|
|
46317
|
+
}
|
|
46318
|
+
throw cliErrorFromClientFailure2(result2);
|
|
46319
|
+
}
|
|
46320
|
+
async function requestClientAsApiResponse2(result2) {
|
|
46321
|
+
return apiResponseFromClientResult2(await result2);
|
|
46322
|
+
}
|
|
46323
|
+
function createDaemonApiSurfaceClient(client) {
|
|
46324
|
+
const daemonApi = createDaemonApiClient(rawTransportForClient2(client));
|
|
46325
|
+
return {
|
|
46326
|
+
inbox: {
|
|
46327
|
+
check: () => requestClientAsApiResponse2(daemonApi.inbox.check())
|
|
46328
|
+
},
|
|
46329
|
+
wakeHints: {
|
|
46330
|
+
fetch: (query) => requestClientAsApiResponse2(daemonApi.wakeHints.fetch(query))
|
|
46331
|
+
},
|
|
46332
|
+
activity: {
|
|
46333
|
+
forward: (body) => requestClientAsApiResponse2(daemonApi.activity.forward(body))
|
|
46334
|
+
}
|
|
46335
|
+
};
|
|
46336
|
+
}
|
|
46337
|
+
init_esm_shims();
|
|
45680
46338
|
var AGENT_COMMS_PROTOCOL_VERSION = "agent-comms-core.v1";
|
|
45681
46339
|
var AGENT_PROOF_SCHEMA_VERSION = "agent-proof.v1";
|
|
45682
46340
|
var AgentCommsBridgeLockError = class extends Error {
|
|
@@ -46480,17 +47138,17 @@ function statusFailureClass(status) {
|
|
|
46480
47138
|
if (status === 404 || status === 410) return "no_session";
|
|
46481
47139
|
return "injection_failed";
|
|
46482
47140
|
}
|
|
46483
|
-
function buildRaftChannelWakeFailedEvent(input,
|
|
47141
|
+
function buildRaftChannelWakeFailedEvent(input, failure3) {
|
|
46484
47142
|
return validateExternalAgentWakeEventEnvelope({
|
|
46485
47143
|
...input,
|
|
46486
47144
|
schema: "slock-external-agent-wake-event.v1",
|
|
46487
47145
|
kind: "wake_attempt",
|
|
46488
47146
|
outcome: "failed",
|
|
46489
47147
|
failureMeta: {
|
|
46490
|
-
failureClass:
|
|
46491
|
-
...
|
|
47148
|
+
failureClass: failure3.failureClass,
|
|
47149
|
+
...failure3.retryAfterMs ? { retryAfterMs: failure3.retryAfterMs } : {}
|
|
46492
47150
|
},
|
|
46493
|
-
reason:
|
|
47151
|
+
reason: failure3.reason,
|
|
46494
47152
|
lifecycleState: "degraded_backoff",
|
|
46495
47153
|
authority: {
|
|
46496
47154
|
source: "wake_adapter",
|
|
@@ -46533,11 +47191,12 @@ var agentBridgeCommand = defineCommand(
|
|
|
46533
47191
|
const limit = parsePositiveInt(options.limit, 50, "limit");
|
|
46534
47192
|
const activityDrainLimit = parsePositiveInt(options.activityDrainLimit, 50, "activity-drain-limit");
|
|
46535
47193
|
const client = ctx.createApiClient(agentContext);
|
|
46536
|
-
const
|
|
46537
|
-
const
|
|
47194
|
+
const daemonApi = createDaemonApiSurfaceClient(client);
|
|
47195
|
+
const pollSource = createDaemonApiWakeHintSource(daemonApi);
|
|
47196
|
+
const streamSource = options.once ? null : createDaemonApiWakeHintStreamSource(client, ctx.env);
|
|
46538
47197
|
const wakeAdapter = createWakeAdapter(options, ctx.env);
|
|
46539
47198
|
const activitySource = createActivityDrainSource(options, ctx.env);
|
|
46540
|
-
const activitySink = activitySource ?
|
|
47199
|
+
const activitySink = activitySource ? createDaemonApiActivitySink(daemonApi) : void 0;
|
|
46541
47200
|
let bridgeLock;
|
|
46542
47201
|
try {
|
|
46543
47202
|
bridgeLock = acquireAgentCommsBridgeLock({
|
|
@@ -46696,14 +47355,13 @@ var agentBridgeCommand = defineCommand(
|
|
|
46696
47355
|
function registerAgentBridgeCommand(parent, runtimeOptions) {
|
|
46697
47356
|
registerCliCommand(parent, agentBridgeCommand, runtimeOptions);
|
|
46698
47357
|
}
|
|
46699
|
-
function
|
|
47358
|
+
function createDaemonApiWakeHintSource(client) {
|
|
46700
47359
|
return {
|
|
46701
47360
|
async fetchWakeHints(input) {
|
|
46702
|
-
const
|
|
46703
|
-
since:
|
|
46704
|
-
limit:
|
|
47361
|
+
const response = await client.wakeHints.fetch({
|
|
47362
|
+
since: input.since,
|
|
47363
|
+
limit: input.limit
|
|
46705
47364
|
});
|
|
46706
|
-
const response = await client.request("GET", `/internal/agent-api/wake-hints?${query.toString()}`);
|
|
46707
47365
|
if (!response.ok) {
|
|
46708
47366
|
throw new CliError({
|
|
46709
47367
|
code: response.status >= 500 ? "SERVER_5XX" : "BRIDGE_WAKE_HINTS_FAILED",
|
|
@@ -46718,8 +47376,8 @@ function createAgentApiWakeHintSource(client) {
|
|
|
46718
47376
|
}
|
|
46719
47377
|
};
|
|
46720
47378
|
}
|
|
46721
|
-
function
|
|
46722
|
-
if (!client.
|
|
47379
|
+
function createDaemonApiWakeHintStreamSource(client, env = process.env) {
|
|
47380
|
+
if (!client.streamWakeHints) return null;
|
|
46723
47381
|
let reader = null;
|
|
46724
47382
|
let bufferedText = "";
|
|
46725
47383
|
let pendingEvent = {};
|
|
@@ -46734,7 +47392,7 @@ function createAgentApiWakeHintStreamSource(client, env = process.env) {
|
|
|
46734
47392
|
async function ensureReader(since) {
|
|
46735
47393
|
if (reader) return reader;
|
|
46736
47394
|
const query = new URLSearchParams({ since: String(since) });
|
|
46737
|
-
const response = await client.
|
|
47395
|
+
const response = await client.streamWakeHints(query);
|
|
46738
47396
|
if (!response.ok) {
|
|
46739
47397
|
throw new CliError({
|
|
46740
47398
|
code: response.status === 404 || response.status === 405 || response.status === 501 ? "BRIDGE_WAKE_STREAM_UNAVAILABLE" : response.status >= 500 ? "SERVER_5XX" : "BRIDGE_WAKE_STREAM_FAILED",
|
|
@@ -46919,10 +47577,10 @@ function createActivityDrainSource(options, env = process.env) {
|
|
|
46919
47577
|
}
|
|
46920
47578
|
};
|
|
46921
47579
|
}
|
|
46922
|
-
function
|
|
47580
|
+
function createDaemonApiActivitySink(client) {
|
|
46923
47581
|
return {
|
|
46924
47582
|
async forwardActivity(input) {
|
|
46925
|
-
const response = await client.
|
|
47583
|
+
const response = await client.activity.forward(input);
|
|
46926
47584
|
if (!response.ok) {
|
|
46927
47585
|
throw new CliError({
|
|
46928
47586
|
code: response.status >= 500 ? "SERVER_5XX" : "BRIDGE_ACTIVITY_FORWARD_FAILED",
|
|
@@ -47054,6 +47712,9 @@ function formatRuntimeContext(ctx) {
|
|
|
47054
47712
|
"Authoritative context for this agent process. Do not infer computer identity from hostname or cwd when this section is present."
|
|
47055
47713
|
];
|
|
47056
47714
|
if (ctx.agentId) lines.push(`- Agent ID: ${ctx.agentId}`);
|
|
47715
|
+
if (ctx.runtime) lines.push(`- Runtime: ${ctx.runtime}`);
|
|
47716
|
+
if (ctx.model) lines.push(`- Model: ${ctx.model}`);
|
|
47717
|
+
if (ctx.reasoningEffort) lines.push(`- Reasoning: ${ctx.reasoningEffort}`);
|
|
47057
47718
|
if (ctx.serverId) lines.push(`- Server ID: ${ctx.serverId}`);
|
|
47058
47719
|
if (ctx.machineName || ctx.machineId) {
|
|
47059
47720
|
const label = ctx.machineName && ctx.machineId ? `${ctx.machineName} (${ctx.machineId})` : ctx.machineName || ctx.machineId;
|
|
@@ -47067,14 +47728,26 @@ function formatRuntimeContext(ctx) {
|
|
|
47067
47728
|
|
|
47068
47729
|
` : "";
|
|
47069
47730
|
}
|
|
47731
|
+
function roleLabel(role) {
|
|
47732
|
+
return role && role !== "member" ? ` (${role})` : "";
|
|
47733
|
+
}
|
|
47734
|
+
function formatCurrentAgent(data) {
|
|
47735
|
+
if (!data.serverRole) return "";
|
|
47736
|
+
const lines = ["### Current Agent"];
|
|
47737
|
+
lines.push(`- Role: ${data.serverRole}`);
|
|
47738
|
+
return `${lines.join("\n")}
|
|
47739
|
+
|
|
47740
|
+
`;
|
|
47741
|
+
}
|
|
47070
47742
|
function formatServerInfo(data) {
|
|
47071
47743
|
let text = "## Server\n\n";
|
|
47072
47744
|
const channels = data.channels ?? [];
|
|
47073
47745
|
const agents = data.agents ?? [];
|
|
47074
47746
|
const humans = data.humans ?? [];
|
|
47075
47747
|
text += formatRuntimeContext(data.runtimeContext);
|
|
47748
|
+
text += formatCurrentAgent(data);
|
|
47076
47749
|
text += "### Channels\n";
|
|
47077
|
-
text +=
|
|
47750
|
+
text += "Visible public channels may appear even when `joined=false`. Private channels are shown only when you are a member; do not disclose private-channel names, membership, or content outside that channel. Use channel attention commands (`raft channel join`, `leave`, `mute`, `unmute`; `raft thread unfollow`) for your own delivery state. Admin agents can manage regular channels (`raft channel create`, `update`, `add-member`, `remove-member`) and server profile (`raft server update`). Run any subcommand with `--help` for syntax.\n";
|
|
47078
47751
|
if (channels.length > 0) {
|
|
47079
47752
|
for (const t of channels) {
|
|
47080
47753
|
const visibility = t.type === "private" ? "private" : "public";
|
|
@@ -47088,10 +47761,12 @@ function formatServerInfo(data) {
|
|
|
47088
47761
|
}
|
|
47089
47762
|
text += "\n### Agents\n";
|
|
47090
47763
|
text += "Other AI agents in this server.\n";
|
|
47764
|
+
text += "Role labels show server-level owner/admin authority; no role label means ordinary member.\n";
|
|
47091
47765
|
if (agents.length > 0) {
|
|
47092
47766
|
for (const a of agents) {
|
|
47093
|
-
|
|
47094
|
-
|
|
47767
|
+
const role = roleLabel(a.role);
|
|
47768
|
+
text += a.description ? ` - @${a.name} (${a.status})${role} \u2014 ${a.description}
|
|
47769
|
+
` : ` - @${a.name} (${a.status})${role}
|
|
47095
47770
|
`;
|
|
47096
47771
|
}
|
|
47097
47772
|
} else {
|
|
@@ -47100,10 +47775,12 @@ function formatServerInfo(data) {
|
|
|
47100
47775
|
text += "\n### Humans\n";
|
|
47101
47776
|
text += `To start a new DM: raft message send --target "dm:@name" <<'SLOCKMSG' followed by the message body and SLOCKMSG. To reply in an existing DM: reuse the target from received messages.
|
|
47102
47777
|
`;
|
|
47778
|
+
text += "Role labels show server-level owner/admin authority; no role label means ordinary member.\n";
|
|
47103
47779
|
if (humans.length > 0) {
|
|
47104
47780
|
for (const u of humans) {
|
|
47105
|
-
|
|
47106
|
-
|
|
47781
|
+
const role = roleLabel(u.role);
|
|
47782
|
+
text += u.description ? ` - @${u.name}${role} \u2014 ${u.description}
|
|
47783
|
+
` : ` - @${u.name}${role}
|
|
47107
47784
|
`;
|
|
47108
47785
|
}
|
|
47109
47786
|
} else {
|
|
@@ -47121,10 +47798,12 @@ function formatChannelMembers(data) {
|
|
|
47121
47798
|
`;
|
|
47122
47799
|
text += "Members means join/post authority for this surface.\n\n";
|
|
47123
47800
|
text += "### Agents\n";
|
|
47801
|
+
text += "Role labels show server-level owner/admin authority; no role label means ordinary member.\n";
|
|
47124
47802
|
if (agents.length > 0) {
|
|
47125
47803
|
for (const a of agents) {
|
|
47126
|
-
|
|
47127
|
-
|
|
47804
|
+
const role = roleLabel(a.role);
|
|
47805
|
+
text += a.description ? ` - @${a.name} (${a.status})${role} \u2014 ${a.description}
|
|
47806
|
+
` : ` - @${a.name} (${a.status})${role}
|
|
47128
47807
|
`;
|
|
47129
47808
|
}
|
|
47130
47809
|
} else {
|
|
@@ -47134,7 +47813,7 @@ function formatChannelMembers(data) {
|
|
|
47134
47813
|
text += "Role labels show server-level owner/admin authority; no role label means ordinary member.\n";
|
|
47135
47814
|
if (humans.length > 0) {
|
|
47136
47815
|
for (const u of humans) {
|
|
47137
|
-
const role =
|
|
47816
|
+
const role = roleLabel(u.role);
|
|
47138
47817
|
text += u.description ? ` - @${u.name}${role} \u2014 ${u.description}
|
|
47139
47818
|
` : ` - @${u.name}${role}
|
|
47140
47819
|
`;
|
|
@@ -47175,6 +47854,65 @@ function registerChannelMembersCommand(parent, runtimeOptions) {
|
|
|
47175
47854
|
registerCliCommand(parent, channelMembersCommand, runtimeOptions);
|
|
47176
47855
|
}
|
|
47177
47856
|
init_esm_shims();
|
|
47857
|
+
function normalizeChannelName(raw) {
|
|
47858
|
+
return (raw ?? "").trim().replace(/^#/, "");
|
|
47859
|
+
}
|
|
47860
|
+
function formatCreateChannelResult(channel) {
|
|
47861
|
+
const target = `#${channel.name}`;
|
|
47862
|
+
const visibility = channel.type === "private" ? "private" : "public";
|
|
47863
|
+
return `Created ${target} (${visibility}). You are joined and can send messages there.`;
|
|
47864
|
+
}
|
|
47865
|
+
var channelCreateCommand = defineCommand(
|
|
47866
|
+
{
|
|
47867
|
+
name: "create",
|
|
47868
|
+
description: "Create a public or private channel when this agent has server admin authority",
|
|
47869
|
+
options: [
|
|
47870
|
+
{
|
|
47871
|
+
flags: "--name <name>",
|
|
47872
|
+
description: "Channel name, with or without a leading '#'"
|
|
47873
|
+
},
|
|
47874
|
+
{
|
|
47875
|
+
flags: "--description <description>",
|
|
47876
|
+
description: "Optional channel description"
|
|
47877
|
+
},
|
|
47878
|
+
{
|
|
47879
|
+
flags: "--private",
|
|
47880
|
+
description: "Create a private channel instead of a public channel"
|
|
47881
|
+
}
|
|
47882
|
+
]
|
|
47883
|
+
},
|
|
47884
|
+
async (ctx, opts) => {
|
|
47885
|
+
const name = normalizeChannelName(opts.name);
|
|
47886
|
+
if (!name) {
|
|
47887
|
+
throw new CliError({
|
|
47888
|
+
code: "INVALID_ARG",
|
|
47889
|
+
message: "--name is required"
|
|
47890
|
+
});
|
|
47891
|
+
}
|
|
47892
|
+
const agentContext = ctx.loadAgentContext();
|
|
47893
|
+
const client = ctx.createApiClient(agentContext);
|
|
47894
|
+
const res = await client.request(
|
|
47895
|
+
"POST",
|
|
47896
|
+
`/internal/agent/${encodeURIComponent(agentContext.agentId)}/channels`,
|
|
47897
|
+
{
|
|
47898
|
+
name,
|
|
47899
|
+
description: opts.description,
|
|
47900
|
+
visibility: opts.private ? "private" : "public"
|
|
47901
|
+
}
|
|
47902
|
+
);
|
|
47903
|
+
if (!res.ok || !res.data) {
|
|
47904
|
+
throw new CliError({
|
|
47905
|
+
code: res.status >= 500 ? "SERVER_5XX" : "CREATE_FAILED",
|
|
47906
|
+
message: res.error ?? `HTTP ${res.status}`
|
|
47907
|
+
});
|
|
47908
|
+
}
|
|
47909
|
+
writeText(ctx.io, formatCreateChannelResult(res.data) + "\n");
|
|
47910
|
+
}
|
|
47911
|
+
);
|
|
47912
|
+
function registerChannelCreateCommand(parent, runtimeOptions) {
|
|
47913
|
+
registerCliCommand(parent, channelCreateCommand, runtimeOptions);
|
|
47914
|
+
}
|
|
47915
|
+
init_esm_shims();
|
|
47178
47916
|
init_esm_shims();
|
|
47179
47917
|
function parseRegularChannelTarget(target) {
|
|
47180
47918
|
if (!target.startsWith("#")) return null;
|
|
@@ -47210,7 +47948,8 @@ var channelLeaveCommand = defineCommand(
|
|
|
47210
47948
|
}
|
|
47211
47949
|
const agentContext = ctx.loadAgentContext();
|
|
47212
47950
|
const client = ctx.createApiClient(agentContext);
|
|
47213
|
-
const
|
|
47951
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
47952
|
+
const infoRes = await agentApi.server.info();
|
|
47214
47953
|
if (!infoRes.ok) {
|
|
47215
47954
|
throw new CliError({
|
|
47216
47955
|
code: infoRes.status >= 500 ? "SERVER_5XX" : "INFO_FAILED",
|
|
@@ -47228,7 +47967,7 @@ var channelLeaveCommand = defineCommand(
|
|
|
47228
47967
|
writeText(ctx.io, formatAlreadyNotJoined(target) + "\n");
|
|
47229
47968
|
return;
|
|
47230
47969
|
}
|
|
47231
|
-
const leaveRes = await
|
|
47970
|
+
const leaveRes = await agentApi.channels.leave({
|
|
47232
47971
|
channelId: channel.id
|
|
47233
47972
|
});
|
|
47234
47973
|
if (!leaveRes.ok) {
|
|
@@ -47243,6 +47982,271 @@ var channelLeaveCommand = defineCommand(
|
|
|
47243
47982
|
function registerChannelLeaveCommand(parent, runtimeOptions) {
|
|
47244
47983
|
registerCliCommand(parent, channelLeaveCommand, runtimeOptions);
|
|
47245
47984
|
}
|
|
47985
|
+
function normalizeChannelName2(raw) {
|
|
47986
|
+
return (raw ?? "").trim().replace(/^#/, "");
|
|
47987
|
+
}
|
|
47988
|
+
function formatUpdateChannelResult(channel) {
|
|
47989
|
+
const visibility = channel.type === "private" ? "private" : "public";
|
|
47990
|
+
return `Updated #${channel.name} (${visibility}).`;
|
|
47991
|
+
}
|
|
47992
|
+
var channelUpdateCommand = defineCommand(
|
|
47993
|
+
{
|
|
47994
|
+
name: "update",
|
|
47995
|
+
description: "Edit a regular channel when this agent has server admin authority",
|
|
47996
|
+
options: [
|
|
47997
|
+
{
|
|
47998
|
+
flags: "--target <target>",
|
|
47999
|
+
description: "Regular channel to edit, e.g. '#engineering'"
|
|
48000
|
+
},
|
|
48001
|
+
{
|
|
48002
|
+
flags: "--name <name>",
|
|
48003
|
+
description: "New channel name, with or without a leading '#'"
|
|
48004
|
+
},
|
|
48005
|
+
{
|
|
48006
|
+
flags: "--description <description>",
|
|
48007
|
+
description: "New channel description"
|
|
48008
|
+
},
|
|
48009
|
+
{
|
|
48010
|
+
flags: "--public",
|
|
48011
|
+
description: "Make the channel public"
|
|
48012
|
+
},
|
|
48013
|
+
{
|
|
48014
|
+
flags: "--private",
|
|
48015
|
+
description: "Make the channel private"
|
|
48016
|
+
}
|
|
48017
|
+
]
|
|
48018
|
+
},
|
|
48019
|
+
async (ctx, opts) => {
|
|
48020
|
+
const target = opts.target ?? "";
|
|
48021
|
+
const channelName = parseRegularChannelTarget(target);
|
|
48022
|
+
if (!channelName) {
|
|
48023
|
+
throw new CliError({
|
|
48024
|
+
code: "INVALID_TARGET",
|
|
48025
|
+
message: "Target must be a regular channel in the form '#channel-name'. DMs and thread targets are not supported."
|
|
48026
|
+
});
|
|
48027
|
+
}
|
|
48028
|
+
if (opts.public && opts.private) {
|
|
48029
|
+
throw new CliError({
|
|
48030
|
+
code: "INVALID_ARG",
|
|
48031
|
+
message: "Use either --public or --private, not both."
|
|
48032
|
+
});
|
|
48033
|
+
}
|
|
48034
|
+
const body = {};
|
|
48035
|
+
if (opts.name !== void 0) body.name = normalizeChannelName2(opts.name);
|
|
48036
|
+
if (opts.description !== void 0) body.description = opts.description;
|
|
48037
|
+
if (opts.public) body.visibility = "public";
|
|
48038
|
+
if (opts.private) body.visibility = "private";
|
|
48039
|
+
if (body.name === void 0 && body.description === void 0 && body.visibility === void 0) {
|
|
48040
|
+
throw new CliError({
|
|
48041
|
+
code: "INVALID_ARG",
|
|
48042
|
+
message: "Provide at least one of --name, --description, --public, or --private."
|
|
48043
|
+
});
|
|
48044
|
+
}
|
|
48045
|
+
const agentContext = ctx.loadAgentContext();
|
|
48046
|
+
const client = ctx.createApiClient(agentContext);
|
|
48047
|
+
const infoRes = await client.request(
|
|
48048
|
+
"GET",
|
|
48049
|
+
`/internal/agent/${encodeURIComponent(agentContext.agentId)}/server`
|
|
48050
|
+
);
|
|
48051
|
+
if (!infoRes.ok) {
|
|
48052
|
+
throw new CliError({
|
|
48053
|
+
code: infoRes.status >= 500 ? "SERVER_5XX" : "INFO_FAILED",
|
|
48054
|
+
message: infoRes.error ?? `HTTP ${infoRes.status}`
|
|
48055
|
+
});
|
|
48056
|
+
}
|
|
48057
|
+
const channel = (infoRes.data?.channels ?? []).find((candidate) => candidate.name === channelName);
|
|
48058
|
+
if (!channel) {
|
|
48059
|
+
throw new CliError({
|
|
48060
|
+
code: "NOT_FOUND",
|
|
48061
|
+
message: `Channel not found: ${target}`
|
|
48062
|
+
});
|
|
48063
|
+
}
|
|
48064
|
+
const updateRes = await client.request(
|
|
48065
|
+
"PATCH",
|
|
48066
|
+
`/internal/agent/${encodeURIComponent(agentContext.agentId)}/channels/${encodeURIComponent(channel.id)}`,
|
|
48067
|
+
body
|
|
48068
|
+
);
|
|
48069
|
+
if (!updateRes.ok || !updateRes.data) {
|
|
48070
|
+
throw new CliError({
|
|
48071
|
+
code: updateRes.status >= 500 ? "SERVER_5XX" : "UPDATE_FAILED",
|
|
48072
|
+
message: updateRes.error ?? `HTTP ${updateRes.status}`
|
|
48073
|
+
});
|
|
48074
|
+
}
|
|
48075
|
+
writeText(ctx.io, formatUpdateChannelResult(updateRes.data) + "\n");
|
|
48076
|
+
}
|
|
48077
|
+
);
|
|
48078
|
+
function registerChannelUpdateCommand(parent, runtimeOptions) {
|
|
48079
|
+
registerCliCommand(parent, channelUpdateCommand, runtimeOptions);
|
|
48080
|
+
}
|
|
48081
|
+
init_esm_shims();
|
|
48082
|
+
function normalizeHandle(raw) {
|
|
48083
|
+
return (raw ?? "").trim().replace(/^@/, "");
|
|
48084
|
+
}
|
|
48085
|
+
function formatAddMemberResult(target, memberType, memberName, alreadyMember) {
|
|
48086
|
+
const member = `@${memberName}`;
|
|
48087
|
+
if (alreadyMember) {
|
|
48088
|
+
return `${member} is already in ${target}.`;
|
|
48089
|
+
}
|
|
48090
|
+
return `Added ${member} to ${target} as ${memberType === "agent" ? "an agent" : "a user"}.`;
|
|
48091
|
+
}
|
|
48092
|
+
var channelAddMemberCommand = defineCommand(
|
|
48093
|
+
{
|
|
48094
|
+
name: "add-member",
|
|
48095
|
+
description: "Add a human or agent to a regular channel when this agent has server admin authority",
|
|
48096
|
+
options: [
|
|
48097
|
+
{
|
|
48098
|
+
flags: "--target <target>",
|
|
48099
|
+
description: "Regular channel to add a member to, e.g. '#engineering'"
|
|
48100
|
+
},
|
|
48101
|
+
{
|
|
48102
|
+
flags: "--user <handle>",
|
|
48103
|
+
description: "Human handle to add, e.g. '@alice'"
|
|
48104
|
+
},
|
|
48105
|
+
{
|
|
48106
|
+
flags: "--agent <handle>",
|
|
48107
|
+
description: "Agent handle to add, e.g. '@assistant'"
|
|
48108
|
+
}
|
|
48109
|
+
]
|
|
48110
|
+
},
|
|
48111
|
+
async (ctx, opts) => {
|
|
48112
|
+
const target = opts.target ?? "";
|
|
48113
|
+
const channelName = parseRegularChannelTarget(target);
|
|
48114
|
+
if (!channelName) {
|
|
48115
|
+
throw new CliError({
|
|
48116
|
+
code: "INVALID_TARGET",
|
|
48117
|
+
message: "Target must be a regular channel in the form '#channel-name'. DMs and thread targets are not supported."
|
|
48118
|
+
});
|
|
48119
|
+
}
|
|
48120
|
+
const user = normalizeHandle(opts.user);
|
|
48121
|
+
const agent = normalizeHandle(opts.agent);
|
|
48122
|
+
if ((user ? 1 : 0) + (agent ? 1 : 0) !== 1) {
|
|
48123
|
+
throw new CliError({
|
|
48124
|
+
code: "INVALID_ARG",
|
|
48125
|
+
message: "Provide exactly one of --user or --agent."
|
|
48126
|
+
});
|
|
48127
|
+
}
|
|
48128
|
+
const agentContext = ctx.loadAgentContext();
|
|
48129
|
+
const client = ctx.createApiClient(agentContext);
|
|
48130
|
+
const infoRes = await client.request(
|
|
48131
|
+
"GET",
|
|
48132
|
+
`/internal/agent/${encodeURIComponent(agentContext.agentId)}/server`
|
|
48133
|
+
);
|
|
48134
|
+
if (!infoRes.ok) {
|
|
48135
|
+
throw new CliError({
|
|
48136
|
+
code: infoRes.status >= 500 ? "SERVER_5XX" : "INFO_FAILED",
|
|
48137
|
+
message: infoRes.error ?? `HTTP ${infoRes.status}`
|
|
48138
|
+
});
|
|
48139
|
+
}
|
|
48140
|
+
const channel = (infoRes.data?.channels ?? []).find((candidate) => candidate.name === channelName);
|
|
48141
|
+
if (!channel) {
|
|
48142
|
+
throw new CliError({
|
|
48143
|
+
code: "NOT_FOUND",
|
|
48144
|
+
message: `Channel not found: ${target}`
|
|
48145
|
+
});
|
|
48146
|
+
}
|
|
48147
|
+
const body = user ? { user } : { agent };
|
|
48148
|
+
const addRes = await client.request(
|
|
48149
|
+
"POST",
|
|
48150
|
+
`/internal/agent/${encodeURIComponent(agentContext.agentId)}/channels/${encodeURIComponent(channel.id)}/members`,
|
|
48151
|
+
body
|
|
48152
|
+
);
|
|
48153
|
+
if (!addRes.ok) {
|
|
48154
|
+
throw new CliError({
|
|
48155
|
+
code: addRes.status >= 500 ? "SERVER_5XX" : "MEMBERS_FAILED",
|
|
48156
|
+
message: addRes.error ?? `HTTP ${addRes.status}`
|
|
48157
|
+
});
|
|
48158
|
+
}
|
|
48159
|
+
const memberName = addRes.data?.member?.name ?? (user || agent);
|
|
48160
|
+
const memberType = addRes.data?.member?.type === "agent" ? "agent" : "user";
|
|
48161
|
+
writeText(ctx.io, formatAddMemberResult(target, memberType, memberName, addRes.data?.alreadyMember === true) + "\n");
|
|
48162
|
+
}
|
|
48163
|
+
);
|
|
48164
|
+
function registerChannelAddMemberCommand(parent, runtimeOptions) {
|
|
48165
|
+
registerCliCommand(parent, channelAddMemberCommand, runtimeOptions);
|
|
48166
|
+
}
|
|
48167
|
+
init_esm_shims();
|
|
48168
|
+
function normalizeHandle2(raw) {
|
|
48169
|
+
return (raw ?? "").trim().replace(/^@/, "");
|
|
48170
|
+
}
|
|
48171
|
+
function formatRemoveMemberResult(target, memberName, wasMember) {
|
|
48172
|
+
const member = `@${memberName}`;
|
|
48173
|
+
return wasMember ? `Removed ${member} from ${target}.` : `${member} was not in ${target}.`;
|
|
48174
|
+
}
|
|
48175
|
+
var channelRemoveMemberCommand = defineCommand(
|
|
48176
|
+
{
|
|
48177
|
+
name: "remove-member",
|
|
48178
|
+
description: "Remove a human or agent from a regular channel when this agent has server admin authority",
|
|
48179
|
+
options: [
|
|
48180
|
+
{
|
|
48181
|
+
flags: "--target <target>",
|
|
48182
|
+
description: "Regular channel to remove a member from, e.g. '#engineering'"
|
|
48183
|
+
},
|
|
48184
|
+
{
|
|
48185
|
+
flags: "--user <handle>",
|
|
48186
|
+
description: "Human handle to remove, e.g. '@alice'"
|
|
48187
|
+
},
|
|
48188
|
+
{
|
|
48189
|
+
flags: "--agent <handle>",
|
|
48190
|
+
description: "Agent handle to remove, e.g. '@assistant'"
|
|
48191
|
+
}
|
|
48192
|
+
]
|
|
48193
|
+
},
|
|
48194
|
+
async (ctx, opts) => {
|
|
48195
|
+
const target = opts.target ?? "";
|
|
48196
|
+
const channelName = parseRegularChannelTarget(target);
|
|
48197
|
+
if (!channelName) {
|
|
48198
|
+
throw new CliError({
|
|
48199
|
+
code: "INVALID_TARGET",
|
|
48200
|
+
message: "Target must be a regular channel in the form '#channel-name'. DMs and thread targets are not supported."
|
|
48201
|
+
});
|
|
48202
|
+
}
|
|
48203
|
+
const user = normalizeHandle2(opts.user);
|
|
48204
|
+
const agent = normalizeHandle2(opts.agent);
|
|
48205
|
+
if ((user ? 1 : 0) + (agent ? 1 : 0) !== 1) {
|
|
48206
|
+
throw new CliError({
|
|
48207
|
+
code: "INVALID_ARG",
|
|
48208
|
+
message: "Provide exactly one of --user or --agent."
|
|
48209
|
+
});
|
|
48210
|
+
}
|
|
48211
|
+
const agentContext = ctx.loadAgentContext();
|
|
48212
|
+
const client = ctx.createApiClient(agentContext);
|
|
48213
|
+
const infoRes = await client.request(
|
|
48214
|
+
"GET",
|
|
48215
|
+
`/internal/agent/${encodeURIComponent(agentContext.agentId)}/server`
|
|
48216
|
+
);
|
|
48217
|
+
if (!infoRes.ok) {
|
|
48218
|
+
throw new CliError({
|
|
48219
|
+
code: infoRes.status >= 500 ? "SERVER_5XX" : "INFO_FAILED",
|
|
48220
|
+
message: infoRes.error ?? `HTTP ${infoRes.status}`
|
|
48221
|
+
});
|
|
48222
|
+
}
|
|
48223
|
+
const channel = (infoRes.data?.channels ?? []).find((candidate) => candidate.name === channelName);
|
|
48224
|
+
if (!channel) {
|
|
48225
|
+
throw new CliError({
|
|
48226
|
+
code: "NOT_FOUND",
|
|
48227
|
+
message: `Channel not found: ${target}`
|
|
48228
|
+
});
|
|
48229
|
+
}
|
|
48230
|
+
const body = user ? { user } : { agent };
|
|
48231
|
+
const removeRes = await client.request(
|
|
48232
|
+
"DELETE",
|
|
48233
|
+
`/internal/agent/${encodeURIComponent(agentContext.agentId)}/channels/${encodeURIComponent(channel.id)}/members`,
|
|
48234
|
+
body
|
|
48235
|
+
);
|
|
48236
|
+
if (!removeRes.ok) {
|
|
48237
|
+
throw new CliError({
|
|
48238
|
+
code: removeRes.status >= 500 ? "SERVER_5XX" : "MEMBERS_FAILED",
|
|
48239
|
+
message: removeRes.error ?? `HTTP ${removeRes.status}`
|
|
48240
|
+
});
|
|
48241
|
+
}
|
|
48242
|
+
const memberName = removeRes.data?.member?.name ?? (user || agent);
|
|
48243
|
+
writeText(ctx.io, formatRemoveMemberResult(target, memberName, removeRes.data?.wasMember === true) + "\n");
|
|
48244
|
+
}
|
|
48245
|
+
);
|
|
48246
|
+
function registerChannelRemoveMemberCommand(parent, runtimeOptions) {
|
|
48247
|
+
registerCliCommand(parent, channelRemoveMemberCommand, runtimeOptions);
|
|
48248
|
+
}
|
|
48249
|
+
init_esm_shims();
|
|
47246
48250
|
function formatJoinChannelResult(target) {
|
|
47247
48251
|
return `Joined ${target}. You can now send messages there and receive ordinary channel delivery.`;
|
|
47248
48252
|
}
|
|
@@ -47271,7 +48275,8 @@ var channelJoinCommand = defineCommand(
|
|
|
47271
48275
|
}
|
|
47272
48276
|
const agentContext = ctx.loadAgentContext();
|
|
47273
48277
|
const client = ctx.createApiClient(agentContext);
|
|
47274
|
-
const
|
|
48278
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
48279
|
+
const infoRes = await agentApi.server.info();
|
|
47275
48280
|
if (!infoRes.ok) {
|
|
47276
48281
|
throw new CliError({
|
|
47277
48282
|
code: infoRes.status >= 500 ? "SERVER_5XX" : "INFO_FAILED",
|
|
@@ -47289,7 +48294,7 @@ var channelJoinCommand = defineCommand(
|
|
|
47289
48294
|
writeText(ctx.io, formatAlreadyJoined(target) + "\n");
|
|
47290
48295
|
return;
|
|
47291
48296
|
}
|
|
47292
|
-
const joinRes = await
|
|
48297
|
+
const joinRes = await agentApi.channels.join({
|
|
47293
48298
|
channelId: channel.id
|
|
47294
48299
|
});
|
|
47295
48300
|
if (!joinRes.ok) {
|
|
@@ -47345,7 +48350,8 @@ function makeChannelMuteCommand(action) {
|
|
|
47345
48350
|
}
|
|
47346
48351
|
const agentContext = ctx.loadAgentContext();
|
|
47347
48352
|
const client = ctx.createApiClient(agentContext);
|
|
47348
|
-
const
|
|
48353
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
48354
|
+
const infoRes = await agentApi.server.info();
|
|
47349
48355
|
if (!infoRes.ok) {
|
|
47350
48356
|
throw new CliError({
|
|
47351
48357
|
code: infoRes.status >= 500 ? "SERVER_5XX" : "INFO_FAILED",
|
|
@@ -47359,10 +48365,7 @@ function makeChannelMuteCommand(action) {
|
|
|
47359
48365
|
message: `Channel not found: ${target}`
|
|
47360
48366
|
});
|
|
47361
48367
|
}
|
|
47362
|
-
const res = await
|
|
47363
|
-
"POST",
|
|
47364
|
-
`/internal/agent/${encodeURIComponent(agentContext.agentId)}/channels/${encodeURIComponent(channel.id)}/${action}`
|
|
47365
|
-
);
|
|
48368
|
+
const res = action === "mute" ? await agentApi.channels.mute({ channelId: channel.id }) : await agentApi.channels.unmute({ channelId: channel.id });
|
|
47366
48369
|
if (!res.ok) {
|
|
47367
48370
|
throw new CliError({
|
|
47368
48371
|
code: res.status >= 500 ? "SERVER_5XX" : action === "mute" ? "MUTE_FAILED" : "UNMUTE_FAILED",
|
|
@@ -47391,7 +48394,7 @@ var serverInfoCommand = defineCommand(
|
|
|
47391
48394
|
async (ctx) => {
|
|
47392
48395
|
const agentContext = ctx.loadAgentContext();
|
|
47393
48396
|
const client = ctx.createApiClient(agentContext);
|
|
47394
|
-
const res = await
|
|
48397
|
+
const res = await createAgentApiSurfaceClient(client).server.info();
|
|
47395
48398
|
if (!res.ok) {
|
|
47396
48399
|
const code = res.status >= 500 ? "SERVER_5XX" : "INFO_FAILED";
|
|
47397
48400
|
throw new CliError({
|
|
@@ -47413,14 +48416,327 @@ function registerServerInfoCommand(parent, runtimeOptions) {
|
|
|
47413
48416
|
registerCliCommand(parent, serverInfoCommand, runtimeOptions);
|
|
47414
48417
|
}
|
|
47415
48418
|
init_esm_shims();
|
|
47416
|
-
|
|
47417
|
-
|
|
47418
|
-
|
|
47419
|
-
if (
|
|
47420
|
-
|
|
47421
|
-
|
|
47422
|
-
return
|
|
48419
|
+
init_esm_shims();
|
|
48420
|
+
init_esm_shims();
|
|
48421
|
+
function formatCreatedAgents(createdAgents) {
|
|
48422
|
+
if (createdAgents.length === 0) {
|
|
48423
|
+
return ["- Created Agents: none"];
|
|
48424
|
+
}
|
|
48425
|
+
return [
|
|
48426
|
+
`- Created Agents (${createdAgents.length}):`,
|
|
48427
|
+
...createdAgents.map((createdAgent) => ` - @${createdAgent.name} (${getRuntimeDisplayName(createdAgent.runtime)}, ${createdAgent.status})`)
|
|
48428
|
+
];
|
|
48429
|
+
}
|
|
48430
|
+
function formatHumanProfile(profile) {
|
|
48431
|
+
const lines = [
|
|
48432
|
+
"## Profile",
|
|
48433
|
+
"",
|
|
48434
|
+
"- Type: human",
|
|
48435
|
+
`- Handle: @${profile.name}`,
|
|
48436
|
+
`- Display Name: ${profile.displayName ?? "(none)"}`,
|
|
48437
|
+
`- Description: ${profile.description ?? "(none)"}`,
|
|
48438
|
+
`- Membership: ${profile.membershipStatus}`
|
|
48439
|
+
];
|
|
48440
|
+
if (profile.role) lines.push(`- Role: ${profile.role}`);
|
|
48441
|
+
if (profile.joinedAt) lines.push(`- Joined: ${profile.joinedAt}`);
|
|
48442
|
+
if (profile.email) lines.push(`- Email: ${profile.email}`);
|
|
48443
|
+
return [...lines, ...formatCreatedAgents(profile.createdAgents)].join("\n");
|
|
48444
|
+
}
|
|
48445
|
+
function formatCreator(profile) {
|
|
48446
|
+
if (!profile.creator) return null;
|
|
48447
|
+
return profile.creator.displayName ? `${profile.creator.displayName} (@${profile.creator.name})` : `@${profile.creator.name}`;
|
|
48448
|
+
}
|
|
48449
|
+
function formatAgentProfile(profile) {
|
|
48450
|
+
const lines = [
|
|
48451
|
+
"## Profile",
|
|
48452
|
+
"",
|
|
48453
|
+
"- Type: agent",
|
|
48454
|
+
`- Handle: @${profile.name}`,
|
|
48455
|
+
`- Display Name: ${profile.displayName ?? "(none)"}`,
|
|
48456
|
+
`- Description: ${profile.description ?? "(none)"}`,
|
|
48457
|
+
`- Status: ${profile.status}`,
|
|
48458
|
+
`- Role: ${profile.serverRole}`,
|
|
48459
|
+
`- Runtime: ${getRuntimeDisplayName(profile.runtime)}`,
|
|
48460
|
+
`- Model: ${profile.model}`,
|
|
48461
|
+
`- Reasoning: ${profile.reasoningEffort ?? "medium"}`
|
|
48462
|
+
];
|
|
48463
|
+
if (profile.executionMode) lines.push(`- Execution: ${profile.executionMode}`);
|
|
48464
|
+
if (profile.computerName || profile.computerId) {
|
|
48465
|
+
const label = profile.computerName && profile.computerId ? `${profile.computerName} (${profile.computerId})` : profile.computerName ?? profile.computerId;
|
|
48466
|
+
lines.push(`- Computer: ${label}`);
|
|
48467
|
+
}
|
|
48468
|
+
if (profile.computerHostname) lines.push(`- Hostname: ${profile.computerHostname}`);
|
|
48469
|
+
if (profile.daemonVersion) lines.push(`- Daemon: v${profile.daemonVersion}`);
|
|
48470
|
+
lines.push(`- Created: ${profile.createdAt}`);
|
|
48471
|
+
if (profile.deletedAt) lines.push(`- Deleted At: ${profile.deletedAt}`);
|
|
48472
|
+
const creator = formatCreator(profile);
|
|
48473
|
+
if (creator) lines.push(`- Creator: ${creator}`);
|
|
48474
|
+
return [...lines, ...formatCreatedAgents(profile.createdAgents)].join("\n");
|
|
48475
|
+
}
|
|
48476
|
+
function formatProfile(profile) {
|
|
48477
|
+
return profile.kind === "human" ? formatHumanProfile(profile) : formatAgentProfile(profile);
|
|
48478
|
+
}
|
|
48479
|
+
var MAX_PROFILE_AVATAR_BYTES = 2 * 1024 * 1024;
|
|
48480
|
+
var PROFILE_AVATAR_MIME_TYPES = /* @__PURE__ */ new Set([
|
|
48481
|
+
"image/jpeg",
|
|
48482
|
+
"image/png",
|
|
48483
|
+
"image/gif",
|
|
48484
|
+
"image/webp"
|
|
48485
|
+
]);
|
|
48486
|
+
var FILENAME_MIME_MAP = {
|
|
48487
|
+
".jpg": "image/jpeg",
|
|
48488
|
+
".jpeg": "image/jpeg",
|
|
48489
|
+
".png": "image/png",
|
|
48490
|
+
".gif": "image/gif",
|
|
48491
|
+
".webp": "image/webp"
|
|
48492
|
+
};
|
|
48493
|
+
var MAX_PROFILE_DESCRIPTION_LENGTH = 3e3;
|
|
48494
|
+
var MAX_PROFILE_DISPLAY_NAME_LENGTH = 80;
|
|
48495
|
+
function inferImageMimeType(filename, buffer) {
|
|
48496
|
+
const lowerFilename = filename.toLowerCase();
|
|
48497
|
+
if (buffer.length >= 8 && buffer.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]))) {
|
|
48498
|
+
return "image/png";
|
|
48499
|
+
}
|
|
48500
|
+
if (buffer.length >= 3 && buffer.subarray(0, 3).equals(Buffer.from([255, 216, 255]))) {
|
|
48501
|
+
return "image/jpeg";
|
|
48502
|
+
}
|
|
48503
|
+
if (buffer.length >= 6) {
|
|
48504
|
+
const header = buffer.subarray(0, 6).toString("ascii");
|
|
48505
|
+
if (header === "GIF87a" || header === "GIF89a") return "image/gif";
|
|
48506
|
+
}
|
|
48507
|
+
if (buffer.length >= 12 && buffer.subarray(0, 4).toString("ascii") === "RIFF" && buffer.subarray(8, 12).toString("ascii") === "WEBP") {
|
|
48508
|
+
return "image/webp";
|
|
48509
|
+
}
|
|
48510
|
+
const dot = lowerFilename.lastIndexOf(".");
|
|
48511
|
+
return dot >= 0 ? FILENAME_MIME_MAP[lowerFilename.slice(dot)] ?? null : null;
|
|
48512
|
+
}
|
|
48513
|
+
function readAvatarFile(avatarFile) {
|
|
48514
|
+
if (!existsSync(avatarFile)) {
|
|
48515
|
+
throw cliError("PROFILE_FILE_NOT_FOUND", `Avatar file does not exist: ${avatarFile}`);
|
|
48516
|
+
}
|
|
48517
|
+
const stat2 = statSync(avatarFile);
|
|
48518
|
+
if (!stat2.isFile()) {
|
|
48519
|
+
throw cliError("PROFILE_FILE_NOT_FOUND", `Avatar file is not a regular file: ${avatarFile}`);
|
|
48520
|
+
}
|
|
48521
|
+
if (stat2.size > MAX_PROFILE_AVATAR_BYTES) {
|
|
48522
|
+
throw cliError(
|
|
48523
|
+
"PROFILE_AVATAR_TOO_LARGE",
|
|
48524
|
+
`Avatar file is ${stat2.size} bytes; max size is ${MAX_PROFILE_AVATAR_BYTES} bytes`
|
|
48525
|
+
);
|
|
48526
|
+
}
|
|
48527
|
+
const buffer = readFileSync2(avatarFile);
|
|
48528
|
+
const filename = basename(avatarFile);
|
|
48529
|
+
const mimeType = inferImageMimeType(filename, buffer);
|
|
48530
|
+
if (!mimeType || !PROFILE_AVATAR_MIME_TYPES.has(mimeType)) {
|
|
48531
|
+
throw cliError(
|
|
48532
|
+
"PROFILE_AVATAR_BAD_FORMAT",
|
|
48533
|
+
"Avatar must be a JPEG, PNG, GIF, or WebP image"
|
|
48534
|
+
);
|
|
48535
|
+
}
|
|
48536
|
+
return { filename, buffer, mimeType };
|
|
48537
|
+
}
|
|
48538
|
+
function normalizeAvatarUrl(avatarUrl) {
|
|
48539
|
+
const trimmed = avatarUrl.trim();
|
|
48540
|
+
if (trimmed.length === 0) {
|
|
48541
|
+
throw cliError("INVALID_ARG", "--avatar-url must not be empty");
|
|
48542
|
+
}
|
|
48543
|
+
if (!trimmed.startsWith("pixel:")) {
|
|
48544
|
+
throw cliError("INVALID_ARG", "--avatar-url currently supports only pixel avatar URLs; use --avatar-file for image uploads");
|
|
48545
|
+
}
|
|
48546
|
+
return trimmed;
|
|
48547
|
+
}
|
|
48548
|
+
var profileUpdateCommand = defineCommand(
|
|
48549
|
+
{
|
|
48550
|
+
name: "update",
|
|
48551
|
+
description: "Update your own profile",
|
|
48552
|
+
options: [
|
|
48553
|
+
{ flags: "--avatar-file <path>", description: "Path to a local image file to use as your avatar" },
|
|
48554
|
+
{ flags: "--avatar-url <value>", description: "Set a pixel avatar URL such as pixel:random:<seed>" },
|
|
48555
|
+
{ flags: "--display-name <name>", description: "Set your display name (non-empty)" },
|
|
48556
|
+
{ flags: "--description <text>", description: "Set your profile description (non-empty)" },
|
|
48557
|
+
{ flags: "--json", description: "Emit machine-readable JSON" }
|
|
48558
|
+
]
|
|
48559
|
+
},
|
|
48560
|
+
async (ctx, opts) => {
|
|
48561
|
+
const hasAvatar = opts.avatarFile !== void 0;
|
|
48562
|
+
const hasAvatarUrl = opts.avatarUrl !== void 0;
|
|
48563
|
+
const hasDisplayName = opts.displayName !== void 0;
|
|
48564
|
+
const hasDescription = opts.description !== void 0;
|
|
48565
|
+
if (!hasAvatar && !hasAvatarUrl && !hasDisplayName && !hasDescription) {
|
|
48566
|
+
throw cliError("INVALID_ARG", "Provide at least one of --avatar-file, --avatar-url, --display-name, or --description");
|
|
48567
|
+
}
|
|
48568
|
+
if (hasAvatar && hasAvatarUrl) {
|
|
48569
|
+
throw cliError("INVALID_ARG", "Use either --avatar-file or --avatar-url, not both");
|
|
48570
|
+
}
|
|
48571
|
+
let normalizedAvatarUrl;
|
|
48572
|
+
if (hasAvatarUrl) {
|
|
48573
|
+
normalizedAvatarUrl = normalizeAvatarUrl(opts.avatarUrl);
|
|
48574
|
+
}
|
|
48575
|
+
let trimmedDisplayName;
|
|
48576
|
+
if (hasDisplayName) {
|
|
48577
|
+
trimmedDisplayName = opts.displayName.trim();
|
|
48578
|
+
if (trimmedDisplayName.length === 0) {
|
|
48579
|
+
throw cliError("INVALID_ARG", "--display-name must not be empty");
|
|
48580
|
+
}
|
|
48581
|
+
if (trimmedDisplayName.length > MAX_PROFILE_DISPLAY_NAME_LENGTH) {
|
|
48582
|
+
throw cliError("INVALID_ARG", `--display-name must be at most ${MAX_PROFILE_DISPLAY_NAME_LENGTH} characters`);
|
|
48583
|
+
}
|
|
48584
|
+
}
|
|
48585
|
+
if (hasDescription) {
|
|
48586
|
+
if (opts.description.length === 0) {
|
|
48587
|
+
throw cliError("INVALID_ARG", "--description must not be empty");
|
|
48588
|
+
}
|
|
48589
|
+
if (opts.description.length > MAX_PROFILE_DESCRIPTION_LENGTH) {
|
|
48590
|
+
throw cliError("INVALID_ARG", `--description must be at most ${MAX_PROFILE_DESCRIPTION_LENGTH} characters`);
|
|
48591
|
+
}
|
|
48592
|
+
}
|
|
48593
|
+
const avatar = hasAvatar ? readAvatarFile(opts.avatarFile) : null;
|
|
48594
|
+
const agentContext = ctx.loadAgentContext();
|
|
48595
|
+
const client = ctx.createApiClient(agentContext);
|
|
48596
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
48597
|
+
let latestProfile = null;
|
|
48598
|
+
if (hasAvatarUrl || hasDisplayName || hasDescription) {
|
|
48599
|
+
const body = {};
|
|
48600
|
+
if (hasAvatarUrl) {
|
|
48601
|
+
body.avatarUrl = normalizedAvatarUrl;
|
|
48602
|
+
}
|
|
48603
|
+
if (hasDisplayName) {
|
|
48604
|
+
body.displayName = trimmedDisplayName;
|
|
48605
|
+
}
|
|
48606
|
+
if (hasDescription) {
|
|
48607
|
+
body.description = opts.description;
|
|
48608
|
+
}
|
|
48609
|
+
const res = await agentApi.profile.update(body);
|
|
48610
|
+
if (!res.ok || !res.data) {
|
|
48611
|
+
const code = res.errorCode ?? (res.status >= 500 ? "SERVER_5XX" : "PROFILE_UPDATE_FAILED");
|
|
48612
|
+
throw cliError(code, res.error ?? `HTTP ${res.status}`);
|
|
48613
|
+
}
|
|
48614
|
+
latestProfile = res.data;
|
|
48615
|
+
}
|
|
48616
|
+
if (hasAvatar) {
|
|
48617
|
+
const form = new FormData();
|
|
48618
|
+
const avatarBytes = Uint8Array.from(avatar.buffer);
|
|
48619
|
+
form.append("avatar", new Blob([avatarBytes], { type: avatar.mimeType }), avatar.filename);
|
|
48620
|
+
const res = await agentApi.profile.updateAvatar(form);
|
|
48621
|
+
if (!res.ok || !res.data) {
|
|
48622
|
+
const code = res.errorCode ?? (res.status >= 500 ? "SERVER_5XX" : "PROFILE_UPDATE_FAILED");
|
|
48623
|
+
throw cliError(code, res.error ?? `HTTP ${res.status}`);
|
|
48624
|
+
}
|
|
48625
|
+
latestProfile = res.data;
|
|
48626
|
+
}
|
|
48627
|
+
if (!latestProfile) {
|
|
48628
|
+
throw cliError("PROFILE_UPDATE_FAILED", "No profile returned from server");
|
|
48629
|
+
}
|
|
48630
|
+
if (opts.json) {
|
|
48631
|
+
writeJson(ctx.io, { ok: true, data: latestProfile });
|
|
48632
|
+
return;
|
|
48633
|
+
}
|
|
48634
|
+
writeText(ctx.io, `${formatProfile(latestProfile)}
|
|
48635
|
+
`);
|
|
48636
|
+
}
|
|
48637
|
+
);
|
|
48638
|
+
function registerProfileUpdateCommand(parent, runtimeOptions = {}) {
|
|
48639
|
+
registerCliCommand(parent, profileUpdateCommand, runtimeOptions);
|
|
48640
|
+
}
|
|
48641
|
+
function formatServerUpdateResult(server) {
|
|
48642
|
+
return `Updated server ${server.name ?? server.id ?? "profile"}.`;
|
|
47423
48643
|
}
|
|
48644
|
+
var serverUpdateCommand = defineCommand(
|
|
48645
|
+
{
|
|
48646
|
+
name: "update",
|
|
48647
|
+
description: "Update the current server profile when this agent has server admin authority",
|
|
48648
|
+
options: [
|
|
48649
|
+
{
|
|
48650
|
+
flags: "--name <name>",
|
|
48651
|
+
description: "Set the server name"
|
|
48652
|
+
},
|
|
48653
|
+
{
|
|
48654
|
+
flags: "--avatar-file <path>",
|
|
48655
|
+
description: "Path to a local image file to use as the server avatar"
|
|
48656
|
+
},
|
|
48657
|
+
{
|
|
48658
|
+
flags: "--json",
|
|
48659
|
+
description: "Emit machine-readable JSON"
|
|
48660
|
+
}
|
|
48661
|
+
]
|
|
48662
|
+
},
|
|
48663
|
+
async (ctx, opts) => {
|
|
48664
|
+
const hasName = opts.name !== void 0;
|
|
48665
|
+
const hasAvatar = opts.avatarFile !== void 0;
|
|
48666
|
+
if (!hasName && !hasAvatar) {
|
|
48667
|
+
throw new CliError({
|
|
48668
|
+
code: "INVALID_ARG",
|
|
48669
|
+
message: "Provide at least one of --name or --avatar-file."
|
|
48670
|
+
});
|
|
48671
|
+
}
|
|
48672
|
+
let trimmedName;
|
|
48673
|
+
if (hasName) {
|
|
48674
|
+
trimmedName = opts.name.trim();
|
|
48675
|
+
if (!trimmedName) {
|
|
48676
|
+
throw new CliError({
|
|
48677
|
+
code: "INVALID_ARG",
|
|
48678
|
+
message: "--name must not be empty"
|
|
48679
|
+
});
|
|
48680
|
+
}
|
|
48681
|
+
if (trimmedName.length > 100) {
|
|
48682
|
+
throw new CliError({
|
|
48683
|
+
code: "INVALID_ARG",
|
|
48684
|
+
message: "--name must be 100 characters or fewer"
|
|
48685
|
+
});
|
|
48686
|
+
}
|
|
48687
|
+
}
|
|
48688
|
+
const avatar = hasAvatar ? readAvatarFile(opts.avatarFile) : null;
|
|
48689
|
+
const agentContext = ctx.loadAgentContext();
|
|
48690
|
+
const client = ctx.createApiClient(agentContext);
|
|
48691
|
+
let latestServer = null;
|
|
48692
|
+
if (hasName) {
|
|
48693
|
+
const res = await client.request(
|
|
48694
|
+
"PATCH",
|
|
48695
|
+
`/internal/agent/${encodeURIComponent(agentContext.agentId)}/server`,
|
|
48696
|
+
{ name: trimmedName }
|
|
48697
|
+
);
|
|
48698
|
+
if (!res.ok || !res.data) {
|
|
48699
|
+
throw new CliError({
|
|
48700
|
+
code: res.status >= 500 ? "SERVER_5XX" : "UPDATE_FAILED",
|
|
48701
|
+
message: res.error ?? `HTTP ${res.status}`
|
|
48702
|
+
});
|
|
48703
|
+
}
|
|
48704
|
+
latestServer = res.data;
|
|
48705
|
+
}
|
|
48706
|
+
if (hasAvatar) {
|
|
48707
|
+
const form = new FormData();
|
|
48708
|
+
const avatarBytes = Uint8Array.from(avatar.buffer);
|
|
48709
|
+
form.append("avatar", new Blob([avatarBytes], { type: avatar.mimeType }), avatar.filename);
|
|
48710
|
+
const res = await client.requestMultipart(
|
|
48711
|
+
"POST",
|
|
48712
|
+
`/internal/agent/${encodeURIComponent(agentContext.agentId)}/server/avatar`,
|
|
48713
|
+
form
|
|
48714
|
+
);
|
|
48715
|
+
if (!res.ok || !res.data) {
|
|
48716
|
+
throw new CliError({
|
|
48717
|
+
code: res.status >= 500 ? "SERVER_5XX" : "UPDATE_FAILED",
|
|
48718
|
+
message: res.error ?? `HTTP ${res.status}`
|
|
48719
|
+
});
|
|
48720
|
+
}
|
|
48721
|
+
latestServer = res.data;
|
|
48722
|
+
}
|
|
48723
|
+
if (!latestServer) {
|
|
48724
|
+
throw new CliError({
|
|
48725
|
+
code: "UPDATE_FAILED",
|
|
48726
|
+
message: "No server profile returned from server"
|
|
48727
|
+
});
|
|
48728
|
+
}
|
|
48729
|
+
if (opts.json) {
|
|
48730
|
+
writeJson(ctx.io, { ok: true, data: latestServer });
|
|
48731
|
+
return;
|
|
48732
|
+
}
|
|
48733
|
+
writeText(ctx.io, formatServerUpdateResult(latestServer) + "\n");
|
|
48734
|
+
}
|
|
48735
|
+
);
|
|
48736
|
+
function registerServerUpdateCommand(parent, runtimeOptions) {
|
|
48737
|
+
registerCliCommand(parent, serverUpdateCommand, runtimeOptions);
|
|
48738
|
+
}
|
|
48739
|
+
init_esm_shims();
|
|
47424
48740
|
function formatKnowledgeStdout(content) {
|
|
47425
48741
|
return content.endsWith("\n") ? content : `${content}
|
|
47426
48742
|
`;
|
|
@@ -47467,10 +48783,12 @@ var knowledgeGetCommand = defineCommand(
|
|
|
47467
48783
|
async (ctx, topic, opts) => {
|
|
47468
48784
|
const agentContext = ctx.loadAgentContext();
|
|
47469
48785
|
const client = ctx.createApiClient(agentContext);
|
|
47470
|
-
const res = await client.
|
|
47471
|
-
|
|
47472
|
-
|
|
47473
|
-
|
|
48786
|
+
const res = await createAgentApiSurfaceClient(client).knowledge.get({
|
|
48787
|
+
topic,
|
|
48788
|
+
reason: opts.reason,
|
|
48789
|
+
turn_id: opts.turnId,
|
|
48790
|
+
trace_id: opts.traceId
|
|
48791
|
+
});
|
|
47474
48792
|
if (!res.ok) {
|
|
47475
48793
|
throw new CliError({
|
|
47476
48794
|
code: toKnowledgeErrorCode(res.errorCode, res.status),
|
|
@@ -47508,7 +48826,7 @@ var inboxCheckCommand = defineCommand(
|
|
|
47508
48826
|
});
|
|
47509
48827
|
}
|
|
47510
48828
|
const client = ctx.createApiClient(agentContext);
|
|
47511
|
-
const response = await client.
|
|
48829
|
+
const response = await createDaemonApiSurfaceClient(client).inbox.check();
|
|
47512
48830
|
if (!response.ok) {
|
|
47513
48831
|
throw new CliError({
|
|
47514
48832
|
code: response.status >= 500 ? "SERVER_5XX" : "INBOX_CHECK_FAILED",
|
|
@@ -47857,6 +49175,7 @@ function renderSearchPreview(content, query) {
|
|
|
47857
49175
|
}
|
|
47858
49176
|
function formatSearchResults(query, data) {
|
|
47859
49177
|
if (!data.results || data.results.length === 0) return "No search results.";
|
|
49178
|
+
const trimmedQuery = query.trim();
|
|
47860
49179
|
const formatted = data.results.map((result2, index) => {
|
|
47861
49180
|
const ref = `msg:${result2.id}`;
|
|
47862
49181
|
const content = result2.content ?? result2.snippet ?? "";
|
|
@@ -47869,14 +49188,14 @@ function formatSearchResults(query, data) {
|
|
|
47869
49188
|
`Time: ${result2.createdAt ? toLocalTime(result2.createdAt) : "-"}`,
|
|
47870
49189
|
"",
|
|
47871
49190
|
"<preview>",
|
|
47872
|
-
renderSearchPreview(content,
|
|
49191
|
+
renderSearchPreview(content, trimmedQuery),
|
|
47873
49192
|
"</preview>",
|
|
47874
49193
|
"</result>"
|
|
47875
49194
|
].join("\n");
|
|
47876
49195
|
}).join("\n\n");
|
|
47877
49196
|
const resultLabel = data.results.length === 1 ? "result" : "results";
|
|
47878
49197
|
return [
|
|
47879
|
-
`Search results for: "${
|
|
49198
|
+
trimmedQuery ? `Search results for: "${trimmedQuery}" (${data.results.length} ${resultLabel})` : `Filtered message results (${data.results.length} ${resultLabel})`,
|
|
47880
49199
|
"",
|
|
47881
49200
|
formatted,
|
|
47882
49201
|
"",
|
|
@@ -48174,7 +49493,8 @@ var messageSendCommand = defineCommand(
|
|
|
48174
49493
|
]
|
|
48175
49494
|
},
|
|
48176
49495
|
async (ctx, positionalContent, opts) => {
|
|
48177
|
-
|
|
49496
|
+
const target = opts.target?.trim() ?? "";
|
|
49497
|
+
if (!target) {
|
|
48178
49498
|
throw cliError("INVALID_ARG", "--target is required");
|
|
48179
49499
|
}
|
|
48180
49500
|
try {
|
|
@@ -48215,14 +49535,14 @@ var messageSendCommand = defineCommand(
|
|
|
48215
49535
|
const agentContext = ctx.loadAgentContext();
|
|
48216
49536
|
const client = ctx.createApiClient(agentContext);
|
|
48217
49537
|
if (opts.sendDraft) {
|
|
48218
|
-
const savedDraft = getSavedDraft(agentContext.agentId,
|
|
49538
|
+
const savedDraft = getSavedDraft(agentContext.agentId, target);
|
|
48219
49539
|
if (!savedDraft) {
|
|
48220
49540
|
throw cliError(
|
|
48221
49541
|
"SEND_DRAFT_NOT_FOUND",
|
|
48222
49542
|
[
|
|
48223
49543
|
"No saved draft exists for this target.",
|
|
48224
49544
|
"To create or update a draft, send message content normally:",
|
|
48225
|
-
` raft message send --target "${
|
|
49545
|
+
` raft message send --target "${target}" <<'${MESSAGE_HEREDOC_DELIMITER}'`,
|
|
48226
49546
|
" message body",
|
|
48227
49547
|
` ${MESSAGE_HEREDOC_DELIMITER}`
|
|
48228
49548
|
].join("\n")
|
|
@@ -48234,15 +49554,15 @@ var messageSendCommand = defineCommand(
|
|
|
48234
49554
|
previousDraftReholdCount = savedDraft.reholdCount;
|
|
48235
49555
|
seenUpToSeq = savedDraft.seenUpToSeq;
|
|
48236
49556
|
} else {
|
|
48237
|
-
const previousDraft = getSavedDraft(agentContext.agentId,
|
|
49557
|
+
const previousDraft = getSavedDraft(agentContext.agentId, target);
|
|
48238
49558
|
previousDraftReholdCount = previousDraft?.reholdCount ?? 0;
|
|
48239
49559
|
seenUpToSeq = previousDraft?.seenUpToSeq;
|
|
48240
49560
|
}
|
|
48241
49561
|
if (seenUpToSeq === void 0) {
|
|
48242
|
-
seenUpToSeq = getConsumedSeq(agentContext.agentId,
|
|
49562
|
+
seenUpToSeq = getConsumedSeq(agentContext.agentId, target);
|
|
48243
49563
|
}
|
|
48244
49564
|
const body = {
|
|
48245
|
-
target
|
|
49565
|
+
target,
|
|
48246
49566
|
content: outgoingContent,
|
|
48247
49567
|
draftReholdCount: previousDraftReholdCount
|
|
48248
49568
|
};
|
|
@@ -48258,7 +49578,7 @@ var messageSendCommand = defineCommand(
|
|
|
48258
49578
|
if (outgoingAttachmentIds.length > 0) {
|
|
48259
49579
|
body.attachmentIds = outgoingAttachmentIds;
|
|
48260
49580
|
}
|
|
48261
|
-
const agentApi =
|
|
49581
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
48262
49582
|
const res = await agentApi.messages.send(body);
|
|
48263
49583
|
if (!res.ok) {
|
|
48264
49584
|
const code = res.status >= 500 ? "SERVER_5XX" : "SEND_FAILED";
|
|
@@ -48270,21 +49590,21 @@ var messageSendCommand = defineCommand(
|
|
|
48270
49590
|
}
|
|
48271
49591
|
if (data.state === "held") {
|
|
48272
49592
|
if (typeof data.seenUpToSeq === "number" && Number.isFinite(data.seenUpToSeq)) {
|
|
48273
|
-
recordConsumedSeqs(agentContext.agentId, { [
|
|
49593
|
+
recordConsumedSeqs(agentContext.agentId, { [target]: data.seenUpToSeq });
|
|
48274
49594
|
}
|
|
48275
|
-
setSavedDraft(agentContext.agentId,
|
|
49595
|
+
setSavedDraft(agentContext.agentId, target, {
|
|
48276
49596
|
content: outgoingContent,
|
|
48277
49597
|
attachmentIds: outgoingAttachmentIds,
|
|
48278
49598
|
savedAt: Date.now(),
|
|
48279
49599
|
reholdCount: previousDraftReholdCount + 1,
|
|
48280
49600
|
seenUpToSeq: data.seenUpToSeq
|
|
48281
49601
|
});
|
|
48282
|
-
writeText(ctx.io, formatHeldSendOutput(
|
|
49602
|
+
writeText(ctx.io, formatHeldSendOutput(target, data));
|
|
48283
49603
|
return;
|
|
48284
49604
|
}
|
|
48285
|
-
clearSavedDraft(agentContext.agentId,
|
|
49605
|
+
clearSavedDraft(agentContext.agentId, target);
|
|
48286
49606
|
const shortId = data.messageId ? data.messageId.slice(0, 8) : null;
|
|
48287
|
-
const replyHint = shortId ? ` (to reply in this message's thread, use target "${
|
|
49607
|
+
const replyHint = shortId ? ` (to reply in this message's thread, use target "${target.includes(":") ? target : target + ":" + shortId}")` : "";
|
|
48288
49608
|
let unreadSection = "";
|
|
48289
49609
|
if (data.recentUnread && data.recentUnread.length > 0) {
|
|
48290
49610
|
unreadSection = `
|
|
@@ -48296,7 +49616,7 @@ ${formatMessages(data.recentUnread)}`;
|
|
|
48296
49616
|
const mentionSection = pendingMentionActions.length > 0 ? `
|
|
48297
49617
|
|
|
48298
49618
|
${formatPendingMentionActions(pendingMentionActions, { source: "send" }).trimEnd()}` : "";
|
|
48299
|
-
writeText(ctx.io, `Message sent to ${
|
|
49619
|
+
writeText(ctx.io, `Message sent to ${target}. Message ID: ${data.messageId}${replyHint}${mentionSection}${unreadSection}
|
|
48300
49620
|
`);
|
|
48301
49621
|
}
|
|
48302
49622
|
);
|
|
@@ -48316,47 +49636,18 @@ function sortedMessages(messages) {
|
|
|
48316
49636
|
function result(messages, opts = {}) {
|
|
48317
49637
|
return {
|
|
48318
49638
|
messages: sortedMessages(messages),
|
|
48319
|
-
...opts.ackFailure ? { ackFailure: opts.ackFailure } : {},
|
|
48320
49639
|
...opts.drainedMore ? { drainedMore: true } : {},
|
|
48321
49640
|
...opts.hasMore ? { hasMore: true } : {},
|
|
48322
49641
|
...opts.drainComplete ? { drainComplete: true } : {}
|
|
48323
49642
|
};
|
|
48324
49643
|
}
|
|
48325
|
-
function hasMoreField(data) {
|
|
48326
|
-
if (!data) return false;
|
|
48327
|
-
return Object.prototype.hasOwnProperty.call(data, "has_more") || Object.prototype.hasOwnProperty.call(data, "hasMore");
|
|
48328
|
-
}
|
|
48329
49644
|
async function drainInbox(ctx, opts, client = new ApiClient(ctx)) {
|
|
48330
|
-
const agentPath = `/internal/agent/${encodeURIComponent(ctx.agentId)}`;
|
|
48331
49645
|
const failCode = opts.block ? "WAIT_FAILED" : "CHECK_FAILED";
|
|
48332
|
-
const
|
|
48333
|
-
if (opts.block) query.push("block=true");
|
|
48334
|
-
if (opts.block && opts.timeoutMs !== void 0) query.push(`timeout=${opts.timeoutMs}`);
|
|
48335
|
-
const usesAgentApiSurface = ctx.clientMode === "managed-runner" || ctx.clientMode === "self-hosted-runner";
|
|
48336
|
-
const path9 = query.length > 0 ? `${agentPath}/receive?${query.join("&")}` : `${agentPath}/receive`;
|
|
49646
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
48337
49647
|
const allMessages = [];
|
|
48338
49648
|
let sawHasMore = false;
|
|
48339
49649
|
for (let round = 0; round < MAX_DRAIN_ROUNDS; round += 1) {
|
|
48340
|
-
|
|
48341
|
-
const res2 = await createAgentApiSurfaceClient(client).events.get({ since: "latest" });
|
|
48342
|
-
if (!res2.ok) {
|
|
48343
|
-
if (allMessages.length > 0) {
|
|
48344
|
-
return result(allMessages, { drainedMore: sawHasMore, hasMore: true });
|
|
48345
|
-
}
|
|
48346
|
-
throw new CliError({
|
|
48347
|
-
code: res2.status >= 500 ? "SERVER_5XX" : failCode,
|
|
48348
|
-
message: res2.error ?? `HTTP ${res2.status}`
|
|
48349
|
-
});
|
|
48350
|
-
}
|
|
48351
|
-
const messages2 = res2.data?.events ?? [];
|
|
48352
|
-
allMessages.push(...messages2);
|
|
48353
|
-
const hasMore2 = res2.data?.has_more === true;
|
|
48354
|
-
const drainComplete2 = !hasMore2 && allMessages.length > 0;
|
|
48355
|
-
sawHasMore = sawHasMore || hasMore2;
|
|
48356
|
-
if (hasMore2 && messages2.length > 0) continue;
|
|
48357
|
-
return result(allMessages, { drainedMore: sawHasMore, hasMore: hasMore2, drainComplete: drainComplete2 });
|
|
48358
|
-
}
|
|
48359
|
-
const res = await client.request("GET", path9);
|
|
49650
|
+
const res = await agentApi.events.get({ since: "latest" });
|
|
48360
49651
|
if (!res.ok) {
|
|
48361
49652
|
if (allMessages.length > 0) {
|
|
48362
49653
|
return result(allMessages, { drainedMore: sawHasMore, hasMore: true });
|
|
@@ -48366,25 +49657,13 @@ async function drainInbox(ctx, opts, client = new ApiClient(ctx)) {
|
|
|
48366
49657
|
message: res.error ?? `HTTP ${res.status}`
|
|
48367
49658
|
});
|
|
48368
49659
|
}
|
|
48369
|
-
const messages = res.data?.
|
|
49660
|
+
const messages = res.data?.events ?? [];
|
|
48370
49661
|
allMessages.push(...messages);
|
|
48371
|
-
const hasMore = res.data?.has_more === true
|
|
48372
|
-
const
|
|
48373
|
-
const drainComplete = hasExplicitHasMore && !hasMore && allMessages.length > 0;
|
|
49662
|
+
const hasMore = res.data?.has_more === true;
|
|
49663
|
+
const drainComplete = !hasMore && allMessages.length > 0;
|
|
48374
49664
|
sawHasMore = sawHasMore || hasMore;
|
|
48375
|
-
|
|
48376
|
-
|
|
48377
|
-
const ack = await client.request("POST", `${agentPath}/receive-ack`, { seqs });
|
|
48378
|
-
if (!ack.ok) {
|
|
48379
|
-
const ackCode = ack.status >= 500 ? "SERVER_5XX" : "ACK_FAILED";
|
|
48380
|
-
const ackMessage = ack.error ?? `HTTP ${ack.status}`;
|
|
48381
|
-
return result(allMessages, {
|
|
48382
|
-
ackFailure: { code: ackCode, message: ackMessage },
|
|
48383
|
-
drainedMore: sawHasMore,
|
|
48384
|
-
hasMore
|
|
48385
|
-
});
|
|
48386
|
-
}
|
|
48387
|
-
if (!hasMore) return result(allMessages, { drainedMore: sawHasMore, drainComplete });
|
|
49665
|
+
if (hasMore && messages.length > 0) continue;
|
|
49666
|
+
return result(allMessages, { drainedMore: sawHasMore, hasMore, drainComplete });
|
|
48388
49667
|
}
|
|
48389
49668
|
return result(allMessages, { drainedMore: sawHasMore, hasMore: true });
|
|
48390
49669
|
}
|
|
@@ -48488,7 +49767,7 @@ var messageReadCommand = defineCommand(
|
|
|
48488
49767
|
const readOpts = validateReadOpts(opts);
|
|
48489
49768
|
const agentContext = ctx.loadAgentContext();
|
|
48490
49769
|
const client = ctx.createApiClient(agentContext);
|
|
48491
|
-
const agentApi =
|
|
49770
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
48492
49771
|
const res = await agentApi.history.read({
|
|
48493
49772
|
channel: readOpts.channel,
|
|
48494
49773
|
...readOpts.before !== void 0 ? { before: readOpts.before } : {},
|
|
@@ -48561,29 +49840,53 @@ function parsePositiveInt3(name, raw) {
|
|
|
48561
49840
|
}
|
|
48562
49841
|
return n;
|
|
48563
49842
|
}
|
|
48564
|
-
function
|
|
48565
|
-
|
|
48566
|
-
|
|
49843
|
+
function parseNonNegativeInt(name, raw) {
|
|
49844
|
+
if (raw === void 0) return void 0;
|
|
49845
|
+
const n = Number(raw);
|
|
49846
|
+
if (!Number.isFinite(n) || !Number.isInteger(n) || n < 0) {
|
|
48567
49847
|
throw new CliError({
|
|
48568
49848
|
code: "INVALID_ARG",
|
|
48569
|
-
message:
|
|
49849
|
+
message: `--${name} must be a non-negative integer; got ${raw}`
|
|
48570
49850
|
});
|
|
48571
49851
|
}
|
|
49852
|
+
return n;
|
|
49853
|
+
}
|
|
49854
|
+
function normalizeSearchOpts(opts) {
|
|
49855
|
+
const query = opts.query?.trim();
|
|
48572
49856
|
if (opts.sort !== void 0 && opts.sort !== "relevance" && opts.sort !== "recent") {
|
|
48573
49857
|
throw new CliError({
|
|
48574
49858
|
code: "INVALID_ARG",
|
|
48575
49859
|
message: `--sort must be "relevance" or "recent"; got ${opts.sort}`
|
|
48576
49860
|
});
|
|
48577
49861
|
}
|
|
49862
|
+
const channel = opts.channel?.trim();
|
|
49863
|
+
const sender = opts.sender ? normalizeMemberHandleRef(opts.sender) : void 0;
|
|
49864
|
+
const hasFilter = Boolean(channel || sender || opts.before || opts.after);
|
|
49865
|
+
if (!query && !hasFilter) {
|
|
49866
|
+
throw new CliError({
|
|
49867
|
+
code: "INVALID_ARG",
|
|
49868
|
+
message: "--query is required unless --sender, --channel, --before, or --after is provided"
|
|
49869
|
+
});
|
|
49870
|
+
}
|
|
49871
|
+
if (!query && opts.sort === "relevance") {
|
|
49872
|
+
throw new CliError({
|
|
49873
|
+
code: "INVALID_ARG",
|
|
49874
|
+
message: "--sort relevance requires --query; filter-only search is sorted by recent"
|
|
49875
|
+
});
|
|
49876
|
+
}
|
|
48578
49877
|
const limit = parsePositiveInt3("limit", opts.limit);
|
|
49878
|
+
const offset = parseNonNegativeInt("offset", opts.offset);
|
|
49879
|
+
const sort = opts.sort ?? (query ? void 0 : "recent");
|
|
48579
49880
|
return {
|
|
48580
|
-
query,
|
|
48581
|
-
|
|
48582
|
-
...
|
|
48583
|
-
...
|
|
49881
|
+
...query ? { query } : {},
|
|
49882
|
+
displayQuery: query ?? "",
|
|
49883
|
+
...channel ? { channel } : {},
|
|
49884
|
+
...sender ? { sender } : {},
|
|
49885
|
+
...sort ? { sort } : {},
|
|
48584
49886
|
...opts.before ? { before: opts.before } : {},
|
|
48585
49887
|
...opts.after ? { after: opts.after } : {},
|
|
48586
|
-
...limit !== void 0 ? { limit } : {}
|
|
49888
|
+
...limit !== void 0 ? { limit } : {},
|
|
49889
|
+
...offset !== void 0 ? { offset } : {}
|
|
48587
49890
|
};
|
|
48588
49891
|
}
|
|
48589
49892
|
function toSearchErrorCode(errorCode2, status) {
|
|
@@ -48600,13 +49903,14 @@ var messageSearchCommand = defineCommand(
|
|
|
48600
49903
|
name: "search",
|
|
48601
49904
|
description: "Search messages across channels the agent can see",
|
|
48602
49905
|
options: [
|
|
48603
|
-
{ flags: "--query <q>", description: "Search query string" },
|
|
49906
|
+
{ flags: "--query <q>", description: "Search query string (optional when filters are provided)" },
|
|
48604
49907
|
{ flags: "--channel <target>", description: "Restrict to a single channel/DM/thread" },
|
|
48605
49908
|
{ flags: "--sender <handle>", description: "Restrict to messages by sender handle, e.g. @alice" },
|
|
48606
|
-
{ flags: "--sort <mode>", description: "Sort results by relevance or recent (default: relevance)" },
|
|
49909
|
+
{ flags: "--sort <mode>", description: "Sort results by relevance or recent (default: relevance; filter-only searches use recent)" },
|
|
48607
49910
|
{ flags: "--before <iso>", description: "Only messages before this ISO datetime" },
|
|
48608
49911
|
{ flags: "--after <iso>", description: "Only messages after this ISO datetime" },
|
|
48609
|
-
{ flags: "--limit <n>", description: "Max results (server default applies if omitted)" }
|
|
49912
|
+
{ flags: "--limit <n>", description: "Max results (server default applies if omitted)" },
|
|
49913
|
+
{ flags: "--offset <n>", description: "Skip this many results (server default applies if omitted)" }
|
|
48610
49914
|
]
|
|
48611
49915
|
},
|
|
48612
49916
|
async (ctx, opts) => {
|
|
@@ -48615,13 +49919,14 @@ var messageSearchCommand = defineCommand(
|
|
|
48615
49919
|
const client = ctx.createApiClient(agentContext);
|
|
48616
49920
|
const agentApi = createAgentApiSurfaceClient(client);
|
|
48617
49921
|
const res = await agentApi.messages.search({
|
|
48618
|
-
q: searchOpts.query,
|
|
49922
|
+
...searchOpts.query ? { q: searchOpts.query } : {},
|
|
48619
49923
|
...searchOpts.channel ? { channel: searchOpts.channel } : {},
|
|
48620
49924
|
...searchOpts.sender ? { sender: searchOpts.sender } : {},
|
|
48621
49925
|
...searchOpts.sort ? { sort: searchOpts.sort } : {},
|
|
48622
49926
|
...searchOpts.before ? { before: searchOpts.before } : {},
|
|
48623
49927
|
...searchOpts.after ? { after: searchOpts.after } : {},
|
|
48624
|
-
...searchOpts.limit !== void 0 ? { limit: String(searchOpts.limit) } : {}
|
|
49928
|
+
...searchOpts.limit !== void 0 ? { limit: String(searchOpts.limit) } : {},
|
|
49929
|
+
...searchOpts.offset !== void 0 ? { offset: String(searchOpts.offset) } : {}
|
|
48625
49930
|
});
|
|
48626
49931
|
if (!res.ok) {
|
|
48627
49932
|
throw new CliError({
|
|
@@ -48629,7 +49934,7 @@ var messageSearchCommand = defineCommand(
|
|
|
48629
49934
|
message: res.error ?? `HTTP ${res.status}`
|
|
48630
49935
|
});
|
|
48631
49936
|
}
|
|
48632
|
-
writeText(ctx.io, `${formatSearchResults(searchOpts.
|
|
49937
|
+
writeText(ctx.io, `${formatSearchResults(searchOpts.displayQuery, res.data)}
|
|
48633
49938
|
`);
|
|
48634
49939
|
}
|
|
48635
49940
|
);
|
|
@@ -48677,7 +49982,7 @@ var messageResolveCommand = defineCommand(
|
|
|
48677
49982
|
}
|
|
48678
49983
|
const agentContext = ctx.loadAgentContext();
|
|
48679
49984
|
const client = ctx.createApiClient(agentContext);
|
|
48680
|
-
const res = await
|
|
49985
|
+
const res = await createAgentApiSurfaceClient(client).messages.resolve({ msgId: asMessageId(id) });
|
|
48681
49986
|
if (!res.ok) {
|
|
48682
49987
|
const mapped = mapResolveError(res);
|
|
48683
49988
|
throw new CliError(mapped);
|
|
@@ -48734,7 +50039,7 @@ var messageReactCommand = defineCommand(
|
|
|
48734
50039
|
}
|
|
48735
50040
|
const agentContext = ctx.loadAgentContext();
|
|
48736
50041
|
const client = ctx.createApiClient(agentContext);
|
|
48737
|
-
const agentApi =
|
|
50042
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
48738
50043
|
const messageId = asMessageId(opts.messageId.trim());
|
|
48739
50044
|
const res = opts.remove ? await agentApi.messages.removeReaction({ msgId: messageId }, { emoji: emoji3 }) : await agentApi.messages.addReaction({ msgId: messageId }, { emoji: emoji3 });
|
|
48740
50045
|
if (!res.ok) {
|
|
@@ -48752,7 +50057,7 @@ function registerReactCommand(parent, runtimeOptions = {}) {
|
|
|
48752
50057
|
init_esm_shims();
|
|
48753
50058
|
var MAX_ATTACHMENT_UPLOAD_BYTES = 50 * 1024 * 1024;
|
|
48754
50059
|
var MAX_ATTACHMENT_UPLOAD_LABEL = "50MB";
|
|
48755
|
-
var
|
|
50060
|
+
var FILENAME_MIME_MAP2 = {
|
|
48756
50061
|
".jpg": "image/jpeg",
|
|
48757
50062
|
".jpeg": "image/jpeg",
|
|
48758
50063
|
".png": "image/png",
|
|
@@ -48775,7 +50080,7 @@ var AttachmentUploadArgError = class extends Error {
|
|
|
48775
50080
|
function inferMimeTypeFromFilename(filename) {
|
|
48776
50081
|
const index = filename.lastIndexOf(".");
|
|
48777
50082
|
const ext = index >= 0 ? filename.slice(index).toLowerCase() : "";
|
|
48778
|
-
return
|
|
50083
|
+
return FILENAME_MIME_MAP2[ext] || null;
|
|
48779
50084
|
}
|
|
48780
50085
|
function inferMimeTypeFromBuffer(buffer) {
|
|
48781
50086
|
if (buffer.length >= 8 && buffer.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]))) {
|
|
@@ -48850,10 +50155,10 @@ var attachmentUploadCommand = defineCommand(
|
|
|
48850
50155
|
if (typeof opts.path !== "string" || opts.path.length === 0) {
|
|
48851
50156
|
throw cliError("INVALID_ARG", "--path is required");
|
|
48852
50157
|
}
|
|
48853
|
-
if (!
|
|
50158
|
+
if (!existsSync2(opts.path)) {
|
|
48854
50159
|
throw cliError("INVALID_ARG", `--path does not exist: ${opts.path}`);
|
|
48855
50160
|
}
|
|
48856
|
-
const stat2 =
|
|
50161
|
+
const stat2 = statSync2(opts.path);
|
|
48857
50162
|
if (!stat2.isFile()) {
|
|
48858
50163
|
throw cliError("INVALID_ARG", `--path is not a regular file: ${opts.path}`);
|
|
48859
50164
|
}
|
|
@@ -48869,8 +50174,8 @@ var attachmentUploadCommand = defineCommand(
|
|
|
48869
50174
|
"v0 server requires a channel to attach the upload to. Pass --channel '#name', 'dm:@peer', or a thread target."
|
|
48870
50175
|
);
|
|
48871
50176
|
}
|
|
48872
|
-
const buffer =
|
|
48873
|
-
const filename =
|
|
50177
|
+
const buffer = readFileSync3(opts.path);
|
|
50178
|
+
const filename = basename2(opts.path);
|
|
48874
50179
|
let explicitMimeType;
|
|
48875
50180
|
try {
|
|
48876
50181
|
explicitMimeType = normalizeExplicitMimeType(opts.mimeType);
|
|
@@ -48944,17 +50249,20 @@ var attachmentViewCommand = defineCommand(
|
|
|
48944
50249
|
const { id, output } = validateViewOpts(opts);
|
|
48945
50250
|
const agentContext = ctx.loadAgentContext();
|
|
48946
50251
|
const client = ctx.createApiClient(agentContext);
|
|
48947
|
-
const res = await client.
|
|
48948
|
-
"GET",
|
|
48949
|
-
`/api/attachments/${encodeURIComponent(id)}`
|
|
48950
|
-
);
|
|
50252
|
+
const res = await createAgentApiSurfaceClient(client).attachments.view({ attachmentId: id });
|
|
48951
50253
|
if (!res.ok) {
|
|
48952
50254
|
throw new CliError({
|
|
48953
50255
|
code: res.status >= 500 ? "SERVER_5XX" : "VIEW_FAILED",
|
|
48954
50256
|
message: res.error ?? `HTTP ${res.status}`
|
|
48955
50257
|
});
|
|
48956
50258
|
}
|
|
48957
|
-
|
|
50259
|
+
if (res.data === null) {
|
|
50260
|
+
throw new CliError({
|
|
50261
|
+
code: "VIEW_FAILED",
|
|
50262
|
+
message: "Attachment download returned no bytes"
|
|
50263
|
+
});
|
|
50264
|
+
}
|
|
50265
|
+
const buffer = Buffer.from(res.data);
|
|
48958
50266
|
writeFileSync(output, buffer);
|
|
48959
50267
|
writeText(ctx.io, `Downloaded to: ${output}
|
|
48960
50268
|
`);
|
|
@@ -49002,11 +50310,9 @@ var attachmentCommentsCommand = defineCommand(
|
|
|
49002
50310
|
}
|
|
49003
50311
|
const agentContext = ctx.loadAgentContext();
|
|
49004
50312
|
const client = ctx.createApiClient(agentContext);
|
|
49005
|
-
const
|
|
49006
|
-
const
|
|
49007
|
-
|
|
49008
|
-
`/api/attachments/${encodeURIComponent(id)}/comments${limitParam}`
|
|
49009
|
-
);
|
|
50313
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
50314
|
+
const limit = opts.limit && Number.isFinite(Number(opts.limit)) ? String(Number(opts.limit)) : void 0;
|
|
50315
|
+
const res = await agentApi.attachments.comments({ attachmentId: id }, limit ? { limit } : {});
|
|
49010
50316
|
if (!res.ok || !res.data) {
|
|
49011
50317
|
const code = res.status >= 500 ? "SERVER_5XX" : "COMMENTS_FAILED";
|
|
49012
50318
|
throw new CliError({ code, message: res.error ?? `HTTP ${res.status}` });
|
|
@@ -49065,7 +50371,7 @@ function formatClaimResults(channel, data) {
|
|
|
49065
50371
|
const msgShort = r.messageId ? r.messageId.slice(0, 8) : "";
|
|
49066
50372
|
return `${label} (msg:${msgShort}): claimed`;
|
|
49067
50373
|
}
|
|
49068
|
-
return `${label}: FAILED \u2014 ${r.reason || "already claimed"}. Do not
|
|
50374
|
+
return `${label}: FAILED \u2014 ${r.reason || "already claimed"}. Do not work on this task unless an owner/admin explicitly redirects it to you.`;
|
|
49069
50375
|
});
|
|
49070
50376
|
const succeeded = data.results.filter((r) => r.success).length;
|
|
49071
50377
|
const failed = data.results.length - succeeded;
|
|
@@ -49404,7 +50710,7 @@ function buildMentionExecuteCommand(action) {
|
|
|
49404
50710
|
const ids = normalizeResolutionIds(resolutionIds);
|
|
49405
50711
|
const agentContext = ctx.loadAgentContext();
|
|
49406
50712
|
const client = ctx.createApiClient(agentContext);
|
|
49407
|
-
const res = await
|
|
50713
|
+
const res = await createAgentApiSurfaceClient(client).mentions.executeAction({
|
|
49408
50714
|
action,
|
|
49409
50715
|
resolutionIds: ids
|
|
49410
50716
|
});
|
|
@@ -49434,7 +50740,7 @@ var mentionPendingCommand = defineCommand(
|
|
|
49434
50740
|
async (ctx, opts = {}) => {
|
|
49435
50741
|
const agentContext = ctx.loadAgentContext();
|
|
49436
50742
|
const client = ctx.createApiClient(agentContext);
|
|
49437
|
-
const res = await
|
|
50743
|
+
const res = await createAgentApiSurfaceClient(client).mentions.pendingActions();
|
|
49438
50744
|
if (!res.ok || !res.data) {
|
|
49439
50745
|
throw cliError(res.status >= 500 ? "SERVER_5XX" : "MENTION_PENDING_FAILED", res.error ?? `HTTP ${res.status}`);
|
|
49440
50746
|
}
|
|
@@ -49454,65 +50760,6 @@ function registerMentionCommands(parent, runtimeOptions = {}) {
|
|
|
49454
50760
|
registerMentionExecuteCommands(parent, runtimeOptions);
|
|
49455
50761
|
}
|
|
49456
50762
|
init_esm_shims();
|
|
49457
|
-
init_esm_shims();
|
|
49458
|
-
function formatCreatedAgents(createdAgents) {
|
|
49459
|
-
if (createdAgents.length === 0) {
|
|
49460
|
-
return ["- Created Agents: none"];
|
|
49461
|
-
}
|
|
49462
|
-
return [
|
|
49463
|
-
`- Created Agents (${createdAgents.length}):`,
|
|
49464
|
-
...createdAgents.map((createdAgent) => ` - @${createdAgent.name} (${getRuntimeDisplayName(createdAgent.runtime)}, ${createdAgent.status})`)
|
|
49465
|
-
];
|
|
49466
|
-
}
|
|
49467
|
-
function formatHumanProfile(profile) {
|
|
49468
|
-
const lines = [
|
|
49469
|
-
"## Profile",
|
|
49470
|
-
"",
|
|
49471
|
-
"- Type: human",
|
|
49472
|
-
`- Handle: @${profile.name}`,
|
|
49473
|
-
`- Display Name: ${profile.displayName ?? "(none)"}`,
|
|
49474
|
-
`- Description: ${profile.description ?? "(none)"}`,
|
|
49475
|
-
`- Membership: ${profile.membershipStatus}`
|
|
49476
|
-
];
|
|
49477
|
-
if (profile.role) lines.push(`- Role: ${profile.role}`);
|
|
49478
|
-
if (profile.joinedAt) lines.push(`- Joined: ${profile.joinedAt}`);
|
|
49479
|
-
if (profile.email) lines.push(`- Email: ${profile.email}`);
|
|
49480
|
-
return [...lines, ...formatCreatedAgents(profile.createdAgents)].join("\n");
|
|
49481
|
-
}
|
|
49482
|
-
function formatCreator(profile) {
|
|
49483
|
-
if (!profile.creator) return null;
|
|
49484
|
-
return profile.creator.displayName ? `${profile.creator.displayName} (@${profile.creator.name})` : `@${profile.creator.name}`;
|
|
49485
|
-
}
|
|
49486
|
-
function formatAgentProfile(profile) {
|
|
49487
|
-
const lines = [
|
|
49488
|
-
"## Profile",
|
|
49489
|
-
"",
|
|
49490
|
-
"- Type: agent",
|
|
49491
|
-
`- Handle: @${profile.name}`,
|
|
49492
|
-
`- Display Name: ${profile.displayName ?? "(none)"}`,
|
|
49493
|
-
`- Description: ${profile.description ?? "(none)"}`,
|
|
49494
|
-
`- Status: ${profile.status}`,
|
|
49495
|
-
`- Role: ${profile.serverRole}`,
|
|
49496
|
-
`- Runtime: ${getRuntimeDisplayName(profile.runtime)}`,
|
|
49497
|
-
`- Model: ${profile.model}`,
|
|
49498
|
-
`- Reasoning: ${profile.reasoningEffort ?? "medium"}`
|
|
49499
|
-
];
|
|
49500
|
-
if (profile.executionMode) lines.push(`- Execution: ${profile.executionMode}`);
|
|
49501
|
-
if (profile.computerName || profile.computerId) {
|
|
49502
|
-
const label = profile.computerName && profile.computerId ? `${profile.computerName} (${profile.computerId})` : profile.computerName ?? profile.computerId;
|
|
49503
|
-
lines.push(`- Computer: ${label}`);
|
|
49504
|
-
}
|
|
49505
|
-
if (profile.computerHostname) lines.push(`- Hostname: ${profile.computerHostname}`);
|
|
49506
|
-
if (profile.daemonVersion) lines.push(`- Daemon: v${profile.daemonVersion}`);
|
|
49507
|
-
lines.push(`- Created: ${profile.createdAt}`);
|
|
49508
|
-
if (profile.deletedAt) lines.push(`- Deleted At: ${profile.deletedAt}`);
|
|
49509
|
-
const creator = formatCreator(profile);
|
|
49510
|
-
if (creator) lines.push(`- Creator: ${creator}`);
|
|
49511
|
-
return [...lines, ...formatCreatedAgents(profile.createdAgents)].join("\n");
|
|
49512
|
-
}
|
|
49513
|
-
function formatProfile(profile) {
|
|
49514
|
-
return profile.kind === "human" ? formatHumanProfile(profile) : formatAgentProfile(profile);
|
|
49515
|
-
}
|
|
49516
50763
|
function normalizeTarget(target) {
|
|
49517
50764
|
if (target === void 0) return null;
|
|
49518
50765
|
const trimmed = target.trim();
|
|
@@ -49562,173 +50809,6 @@ function registerProfileShowCommand(parent, runtimeOptions) {
|
|
|
49562
50809
|
registerCliCommand(parent, profileShowCommand, runtimeOptions);
|
|
49563
50810
|
}
|
|
49564
50811
|
init_esm_shims();
|
|
49565
|
-
var MAX_PROFILE_AVATAR_BYTES = 2 * 1024 * 1024;
|
|
49566
|
-
var PROFILE_AVATAR_MIME_TYPES = /* @__PURE__ */ new Set([
|
|
49567
|
-
"image/jpeg",
|
|
49568
|
-
"image/png",
|
|
49569
|
-
"image/gif",
|
|
49570
|
-
"image/webp"
|
|
49571
|
-
]);
|
|
49572
|
-
var FILENAME_MIME_MAP2 = {
|
|
49573
|
-
".jpg": "image/jpeg",
|
|
49574
|
-
".jpeg": "image/jpeg",
|
|
49575
|
-
".png": "image/png",
|
|
49576
|
-
".gif": "image/gif",
|
|
49577
|
-
".webp": "image/webp"
|
|
49578
|
-
};
|
|
49579
|
-
var MAX_PROFILE_DESCRIPTION_LENGTH = 3e3;
|
|
49580
|
-
var MAX_PROFILE_DISPLAY_NAME_LENGTH = 80;
|
|
49581
|
-
function inferImageMimeType(filename, buffer) {
|
|
49582
|
-
const lowerFilename = filename.toLowerCase();
|
|
49583
|
-
if (buffer.length >= 8 && buffer.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]))) {
|
|
49584
|
-
return "image/png";
|
|
49585
|
-
}
|
|
49586
|
-
if (buffer.length >= 3 && buffer.subarray(0, 3).equals(Buffer.from([255, 216, 255]))) {
|
|
49587
|
-
return "image/jpeg";
|
|
49588
|
-
}
|
|
49589
|
-
if (buffer.length >= 6) {
|
|
49590
|
-
const header = buffer.subarray(0, 6).toString("ascii");
|
|
49591
|
-
if (header === "GIF87a" || header === "GIF89a") return "image/gif";
|
|
49592
|
-
}
|
|
49593
|
-
if (buffer.length >= 12 && buffer.subarray(0, 4).toString("ascii") === "RIFF" && buffer.subarray(8, 12).toString("ascii") === "WEBP") {
|
|
49594
|
-
return "image/webp";
|
|
49595
|
-
}
|
|
49596
|
-
const dot = lowerFilename.lastIndexOf(".");
|
|
49597
|
-
return dot >= 0 ? FILENAME_MIME_MAP2[lowerFilename.slice(dot)] ?? null : null;
|
|
49598
|
-
}
|
|
49599
|
-
function readAvatarFile(avatarFile) {
|
|
49600
|
-
if (!existsSync2(avatarFile)) {
|
|
49601
|
-
throw cliError("PROFILE_FILE_NOT_FOUND", `Avatar file does not exist: ${avatarFile}`);
|
|
49602
|
-
}
|
|
49603
|
-
const stat2 = statSync2(avatarFile);
|
|
49604
|
-
if (!stat2.isFile()) {
|
|
49605
|
-
throw cliError("PROFILE_FILE_NOT_FOUND", `Avatar file is not a regular file: ${avatarFile}`);
|
|
49606
|
-
}
|
|
49607
|
-
if (stat2.size > MAX_PROFILE_AVATAR_BYTES) {
|
|
49608
|
-
throw cliError(
|
|
49609
|
-
"PROFILE_AVATAR_TOO_LARGE",
|
|
49610
|
-
`Avatar file is ${stat2.size} bytes; max size is ${MAX_PROFILE_AVATAR_BYTES} bytes`
|
|
49611
|
-
);
|
|
49612
|
-
}
|
|
49613
|
-
const buffer = readFileSync3(avatarFile);
|
|
49614
|
-
const filename = basename2(avatarFile);
|
|
49615
|
-
const mimeType = inferImageMimeType(filename, buffer);
|
|
49616
|
-
if (!mimeType || !PROFILE_AVATAR_MIME_TYPES.has(mimeType)) {
|
|
49617
|
-
throw cliError(
|
|
49618
|
-
"PROFILE_AVATAR_BAD_FORMAT",
|
|
49619
|
-
"Avatar must be a JPEG, PNG, GIF, or WebP image"
|
|
49620
|
-
);
|
|
49621
|
-
}
|
|
49622
|
-
return { filename, buffer, mimeType };
|
|
49623
|
-
}
|
|
49624
|
-
function normalizeAvatarUrl(avatarUrl) {
|
|
49625
|
-
const trimmed = avatarUrl.trim();
|
|
49626
|
-
if (trimmed.length === 0) {
|
|
49627
|
-
throw cliError("INVALID_ARG", "--avatar-url must not be empty");
|
|
49628
|
-
}
|
|
49629
|
-
if (!trimmed.startsWith("pixel:")) {
|
|
49630
|
-
throw cliError("INVALID_ARG", "--avatar-url currently supports only pixel avatar URLs; use --avatar-file for image uploads");
|
|
49631
|
-
}
|
|
49632
|
-
return trimmed;
|
|
49633
|
-
}
|
|
49634
|
-
var profileUpdateCommand = defineCommand(
|
|
49635
|
-
{
|
|
49636
|
-
name: "update",
|
|
49637
|
-
description: "Update your own profile",
|
|
49638
|
-
options: [
|
|
49639
|
-
{ flags: "--avatar-file <path>", description: "Path to a local image file to use as your avatar" },
|
|
49640
|
-
{ flags: "--avatar-url <value>", description: "Set a pixel avatar URL such as pixel:random:<seed>" },
|
|
49641
|
-
{ flags: "--display-name <name>", description: "Set your display name (non-empty)" },
|
|
49642
|
-
{ flags: "--description <text>", description: "Set your profile description (non-empty)" },
|
|
49643
|
-
{ flags: "--json", description: "Emit machine-readable JSON" }
|
|
49644
|
-
]
|
|
49645
|
-
},
|
|
49646
|
-
async (ctx, opts) => {
|
|
49647
|
-
const hasAvatar = opts.avatarFile !== void 0;
|
|
49648
|
-
const hasAvatarUrl = opts.avatarUrl !== void 0;
|
|
49649
|
-
const hasDisplayName = opts.displayName !== void 0;
|
|
49650
|
-
const hasDescription = opts.description !== void 0;
|
|
49651
|
-
if (!hasAvatar && !hasAvatarUrl && !hasDisplayName && !hasDescription) {
|
|
49652
|
-
throw cliError("INVALID_ARG", "Provide at least one of --avatar-file, --avatar-url, --display-name, or --description");
|
|
49653
|
-
}
|
|
49654
|
-
if (hasAvatar && hasAvatarUrl) {
|
|
49655
|
-
throw cliError("INVALID_ARG", "Use either --avatar-file or --avatar-url, not both");
|
|
49656
|
-
}
|
|
49657
|
-
let normalizedAvatarUrl;
|
|
49658
|
-
if (hasAvatarUrl) {
|
|
49659
|
-
normalizedAvatarUrl = normalizeAvatarUrl(opts.avatarUrl);
|
|
49660
|
-
}
|
|
49661
|
-
let trimmedDisplayName;
|
|
49662
|
-
if (hasDisplayName) {
|
|
49663
|
-
trimmedDisplayName = opts.displayName.trim();
|
|
49664
|
-
if (trimmedDisplayName.length === 0) {
|
|
49665
|
-
throw cliError("INVALID_ARG", "--display-name must not be empty");
|
|
49666
|
-
}
|
|
49667
|
-
if (trimmedDisplayName.length > MAX_PROFILE_DISPLAY_NAME_LENGTH) {
|
|
49668
|
-
throw cliError("INVALID_ARG", `--display-name must be at most ${MAX_PROFILE_DISPLAY_NAME_LENGTH} characters`);
|
|
49669
|
-
}
|
|
49670
|
-
}
|
|
49671
|
-
if (hasDescription) {
|
|
49672
|
-
if (opts.description.length === 0) {
|
|
49673
|
-
throw cliError("INVALID_ARG", "--description must not be empty");
|
|
49674
|
-
}
|
|
49675
|
-
if (opts.description.length > MAX_PROFILE_DESCRIPTION_LENGTH) {
|
|
49676
|
-
throw cliError("INVALID_ARG", `--description must be at most ${MAX_PROFILE_DESCRIPTION_LENGTH} characters`);
|
|
49677
|
-
}
|
|
49678
|
-
}
|
|
49679
|
-
const avatar = hasAvatar ? readAvatarFile(opts.avatarFile) : null;
|
|
49680
|
-
const agentContext = ctx.loadAgentContext();
|
|
49681
|
-
const client = ctx.createApiClient(agentContext);
|
|
49682
|
-
const agentApi = createAgentApiSurfaceClient(client);
|
|
49683
|
-
let latestProfile = null;
|
|
49684
|
-
if (hasAvatarUrl || hasDisplayName || hasDescription) {
|
|
49685
|
-
const body = {};
|
|
49686
|
-
if (hasAvatarUrl) {
|
|
49687
|
-
body.avatarUrl = normalizedAvatarUrl;
|
|
49688
|
-
}
|
|
49689
|
-
if (hasDisplayName) {
|
|
49690
|
-
body.displayName = trimmedDisplayName;
|
|
49691
|
-
}
|
|
49692
|
-
if (hasDescription) {
|
|
49693
|
-
body.description = opts.description;
|
|
49694
|
-
}
|
|
49695
|
-
const res = await agentApi.profile.update(body);
|
|
49696
|
-
if (!res.ok || !res.data) {
|
|
49697
|
-
const code = res.errorCode ?? (res.status >= 500 ? "SERVER_5XX" : "PROFILE_UPDATE_FAILED");
|
|
49698
|
-
throw cliError(code, res.error ?? `HTTP ${res.status}`);
|
|
49699
|
-
}
|
|
49700
|
-
latestProfile = res.data;
|
|
49701
|
-
}
|
|
49702
|
-
if (hasAvatar) {
|
|
49703
|
-
const form = new FormData();
|
|
49704
|
-
const avatarBytes = Uint8Array.from(avatar.buffer);
|
|
49705
|
-
form.append("avatar", new Blob([avatarBytes], { type: avatar.mimeType }), avatar.filename);
|
|
49706
|
-
const res = await client.requestMultipart(
|
|
49707
|
-
"POST",
|
|
49708
|
-
"/internal/agent-api/profile/avatar",
|
|
49709
|
-
form
|
|
49710
|
-
);
|
|
49711
|
-
if (!res.ok || !res.data) {
|
|
49712
|
-
const code = res.errorCode ?? (res.status >= 500 ? "SERVER_5XX" : "PROFILE_UPDATE_FAILED");
|
|
49713
|
-
throw cliError(code, res.error ?? `HTTP ${res.status}`);
|
|
49714
|
-
}
|
|
49715
|
-
latestProfile = res.data;
|
|
49716
|
-
}
|
|
49717
|
-
if (!latestProfile) {
|
|
49718
|
-
throw cliError("PROFILE_UPDATE_FAILED", "No profile returned from server");
|
|
49719
|
-
}
|
|
49720
|
-
if (opts.json) {
|
|
49721
|
-
writeJson(ctx.io, { ok: true, data: latestProfile });
|
|
49722
|
-
return;
|
|
49723
|
-
}
|
|
49724
|
-
writeText(ctx.io, `${formatProfile(latestProfile)}
|
|
49725
|
-
`);
|
|
49726
|
-
}
|
|
49727
|
-
);
|
|
49728
|
-
function registerProfileUpdateCommand(parent, runtimeOptions = {}) {
|
|
49729
|
-
registerCliCommand(parent, profileUpdateCommand, runtimeOptions);
|
|
49730
|
-
}
|
|
49731
|
-
init_esm_shims();
|
|
49732
50812
|
init_esm_shims();
|
|
49733
50813
|
function formatMaybe(value) {
|
|
49734
50814
|
return value?.trim() || "-";
|
|
@@ -49753,6 +50833,7 @@ function pushServiceBlock(lines, service, active) {
|
|
|
49753
50833
|
if (service.agentManifestUrl) {
|
|
49754
50834
|
lines.push(` agent behavior manifest: ${service.agentManifestUrl}`);
|
|
49755
50835
|
lines.push(` local CLI env: raft integration env --service ${JSON.stringify(service.clientId)}`);
|
|
50836
|
+
lines.push(` if manifest exposes HTTP API actions: raft integration invoke --service ${JSON.stringify(service.clientId)} --list-actions`);
|
|
49756
50837
|
}
|
|
49757
50838
|
if (service.homepageUrl) lines.push(` homepage: ${service.homepageUrl}`);
|
|
49758
50839
|
if (service.description) lines.push(` description: ${service.description}`);
|
|
@@ -49792,6 +50873,7 @@ function formatIntegrationList(data) {
|
|
|
49792
50873
|
if (login.agentManifestUrl) {
|
|
49793
50874
|
lines.push(` agent behavior manifest: ${login.agentManifestUrl}`);
|
|
49794
50875
|
lines.push(` local CLI env: raft integration env --service ${JSON.stringify(login.clientId)}`);
|
|
50876
|
+
lines.push(` if manifest exposes HTTP API actions: raft integration invoke --service ${JSON.stringify(login.clientId)} --list-actions`);
|
|
49795
50877
|
}
|
|
49796
50878
|
lines.push(` created: ${login.createdAt}`);
|
|
49797
50879
|
}
|
|
@@ -49828,14 +50910,15 @@ function formatIntegrationLogin(data) {
|
|
|
49828
50910
|
if (data.service.agentManifestUrl) {
|
|
49829
50911
|
lines.push(`agent behavior manifest: ${data.service.agentManifestUrl}`);
|
|
49830
50912
|
lines.push(`local CLI env: raft integration env --service ${JSON.stringify(data.service.clientId)}`);
|
|
50913
|
+
lines.push(`if manifest exposes HTTP API actions: raft integration invoke --service ${JSON.stringify(data.service.clientId)} --list-actions`);
|
|
49831
50914
|
}
|
|
49832
50915
|
lines.push("complete: this agent login is configured in Slock; no human OAuth is required");
|
|
49833
50916
|
lines.push("identity: run `raft profile show` if the service or human asks for your Slock Agent identity card");
|
|
49834
50917
|
const callbackHandoffUrl = buildAgentCallbackHandoffUrl(data.service.returnUrl, data.requestId);
|
|
49835
50918
|
if (callbackHandoffUrl) {
|
|
49836
50919
|
lines.push(`service callback handoff URL: ${callbackHandoffUrl}`);
|
|
49837
|
-
lines.push("
|
|
49838
|
-
lines.push(
|
|
50920
|
+
lines.push("note: stateless Login with Raft API-action services use this callback once to create their service session");
|
|
50921
|
+
lines.push(`next: prefer \`raft integration invoke --service ${JSON.stringify(data.service.clientId)} --list-actions\` when the service manifest exposes actions`);
|
|
49839
50922
|
} else {
|
|
49840
50923
|
lines.push("next: use the service, or run `raft integration list` to confirm active login");
|
|
49841
50924
|
}
|
|
@@ -49927,7 +51010,10 @@ init_esm_shims();
|
|
|
49927
51010
|
init_esm_shims();
|
|
49928
51011
|
var AGENT_MANIFEST_MAX_BYTES = 64 * 1024;
|
|
49929
51012
|
var AGENT_MANIFEST_SCHEMA_V0 = "slock-agent-manifest.v0";
|
|
51013
|
+
var RAFT_AGENT_MANIFEST_SCHEMA_V0 = "raft-agent-manifest.v0";
|
|
49930
51014
|
var AGENT_MANIFEST_SCHEMA_V0_URL = "https://app.slock.ai/schemas/agent-manifest.v0.json";
|
|
51015
|
+
var RAFT_AGENT_MANIFEST_WELL_KNOWN_PATH = "/.well-known/raft-agent-manifest.json";
|
|
51016
|
+
var SLOCK_AGENT_MANIFEST_WELL_KNOWN_PATH = "/.well-known/slock-agent-manifest.json";
|
|
49931
51017
|
var AgentManifestFetchError = class extends Error {
|
|
49932
51018
|
constructor(message, status) {
|
|
49933
51019
|
super(message);
|
|
@@ -49972,10 +51058,125 @@ function requireCommand(value) {
|
|
|
49972
51058
|
}
|
|
49973
51059
|
return command;
|
|
49974
51060
|
}
|
|
51061
|
+
function requireName(value, field) {
|
|
51062
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
51063
|
+
throw new Error(`${field} must be a non-empty string`);
|
|
51064
|
+
}
|
|
51065
|
+
const name = value.trim();
|
|
51066
|
+
if (!/^[A-Za-z0-9._:-]{1,80}$/.test(name)) {
|
|
51067
|
+
throw new Error(`${field} may only contain letters, digits, dot, underscore, colon, or dash`);
|
|
51068
|
+
}
|
|
51069
|
+
return name;
|
|
51070
|
+
}
|
|
51071
|
+
function optionalString(value) {
|
|
51072
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
51073
|
+
}
|
|
51074
|
+
function requireEndpointPath(value, field) {
|
|
51075
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
51076
|
+
throw new Error(`${field} must be a non-empty path string`);
|
|
51077
|
+
}
|
|
51078
|
+
const path9 = value.trim();
|
|
51079
|
+
if (!path9.startsWith("/")) {
|
|
51080
|
+
throw new Error(`${field} must start with /`);
|
|
51081
|
+
}
|
|
51082
|
+
if (path9.startsWith("//")) {
|
|
51083
|
+
throw new Error(`${field} must be a relative service path`);
|
|
51084
|
+
}
|
|
51085
|
+
try {
|
|
51086
|
+
const parsed = new URL(path9, "https://manifest.local");
|
|
51087
|
+
if (parsed.origin !== "https://manifest.local" || parsed.username || parsed.password || parsed.hash) {
|
|
51088
|
+
throw new Error();
|
|
51089
|
+
}
|
|
51090
|
+
} catch {
|
|
51091
|
+
throw new Error(`${field} must be a relative service path`);
|
|
51092
|
+
}
|
|
51093
|
+
return path9;
|
|
51094
|
+
}
|
|
51095
|
+
function normalizeActionMethod(value) {
|
|
51096
|
+
if (typeof value !== "string") {
|
|
51097
|
+
throw new Error("actions[].endpoint.method must be a string");
|
|
51098
|
+
}
|
|
51099
|
+
const method = value.trim().toUpperCase();
|
|
51100
|
+
if (method !== "GET" && method !== "POST" && method !== "PUT" && method !== "PATCH" && method !== "DELETE") {
|
|
51101
|
+
throw new Error("actions[].endpoint.method must be GET, POST, PUT, PATCH, or DELETE");
|
|
51102
|
+
}
|
|
51103
|
+
return method;
|
|
51104
|
+
}
|
|
51105
|
+
function normalizeActionFields(value, field) {
|
|
51106
|
+
if (value === void 0) return void 0;
|
|
51107
|
+
if (!isRecord(value)) throw new Error(`${field} must be an object when present`);
|
|
51108
|
+
const fields = {};
|
|
51109
|
+
for (const [key, raw] of Object.entries(value)) {
|
|
51110
|
+
const name = requireName(key, `${field} key`);
|
|
51111
|
+
if (!isRecord(raw)) throw new Error(`${field}.${name} must be an object`);
|
|
51112
|
+
if (typeof raw.type !== "string" || !raw.type.trim()) {
|
|
51113
|
+
throw new Error(`${field}.${name}.type must be a non-empty string`);
|
|
51114
|
+
}
|
|
51115
|
+
fields[name] = {
|
|
51116
|
+
type: raw.type.trim(),
|
|
51117
|
+
description: optionalString(raw.description),
|
|
51118
|
+
required: raw.required === true
|
|
51119
|
+
};
|
|
51120
|
+
}
|
|
51121
|
+
return fields;
|
|
51122
|
+
}
|
|
51123
|
+
function normalizeActionReturns(value) {
|
|
51124
|
+
if (value === void 0) return void 0;
|
|
51125
|
+
if (!isRecord(value)) throw new Error("actions[].returns must be an object when present");
|
|
51126
|
+
const fields = {};
|
|
51127
|
+
for (const [key, raw] of Object.entries(value)) {
|
|
51128
|
+
const name = requireName(key, "actions[].returns key");
|
|
51129
|
+
if (!isRecord(raw)) throw new Error(`actions[].returns.${name} must be an object`);
|
|
51130
|
+
if (typeof raw.type !== "string" || !raw.type.trim()) {
|
|
51131
|
+
throw new Error(`actions[].returns.${name}.type must be a non-empty string`);
|
|
51132
|
+
}
|
|
51133
|
+
fields[name] = {
|
|
51134
|
+
type: raw.type.trim(),
|
|
51135
|
+
description: optionalString(raw.description)
|
|
51136
|
+
};
|
|
51137
|
+
}
|
|
51138
|
+
return fields;
|
|
51139
|
+
}
|
|
51140
|
+
function normalizeActions(value) {
|
|
51141
|
+
if (value === void 0) return void 0;
|
|
51142
|
+
if (!Array.isArray(value)) throw new Error("actions must be an array when present");
|
|
51143
|
+
const actions = value.map((raw, index) => {
|
|
51144
|
+
if (!isRecord(raw)) throw new Error(`actions[${index}] must be an object`);
|
|
51145
|
+
const endpoint = raw.endpoint;
|
|
51146
|
+
if (!isRecord(endpoint)) throw new Error(`actions[${index}].endpoint must be an object`);
|
|
51147
|
+
return {
|
|
51148
|
+
name: requireName(raw.name, `actions[${index}].name`),
|
|
51149
|
+
description: optionalString(raw.description),
|
|
51150
|
+
endpoint: {
|
|
51151
|
+
method: normalizeActionMethod(endpoint.method),
|
|
51152
|
+
path: requireEndpointPath(endpoint.path, `actions[${index}].endpoint.path`)
|
|
51153
|
+
},
|
|
51154
|
+
parameters: normalizeActionFields(raw.parameters, `actions[${index}].parameters`),
|
|
51155
|
+
returns: normalizeActionReturns(raw.returns)
|
|
51156
|
+
};
|
|
51157
|
+
});
|
|
51158
|
+
const seen = /* @__PURE__ */ new Set();
|
|
51159
|
+
for (const action of actions) {
|
|
51160
|
+
if (seen.has(action.name)) throw new Error(`duplicate action name: ${action.name}`);
|
|
51161
|
+
seen.add(action.name);
|
|
51162
|
+
}
|
|
51163
|
+
return actions;
|
|
51164
|
+
}
|
|
51165
|
+
function normalizeAuth(value) {
|
|
51166
|
+
if (value === void 0) return void 0;
|
|
51167
|
+
if (!isRecord(value)) throw new Error("auth must be an object when present");
|
|
51168
|
+
if (value.type !== "login_with_raft") {
|
|
51169
|
+
throw new Error("auth.type must be login_with_raft");
|
|
51170
|
+
}
|
|
51171
|
+
return {
|
|
51172
|
+
type: "login_with_raft",
|
|
51173
|
+
login_url: value.login_url === void 0 ? void 0 : requireUrl(value.login_url, "auth.login_url")
|
|
51174
|
+
};
|
|
51175
|
+
}
|
|
49975
51176
|
function validateAgentManifestV0(value) {
|
|
49976
51177
|
if (!isRecord(value)) throw new Error("manifest must be a JSON object");
|
|
49977
|
-
if (value.schema !== AGENT_MANIFEST_SCHEMA_V0 && value.schema !== AGENT_MANIFEST_SCHEMA_V0_URL) {
|
|
49978
|
-
throw new Error(`manifest schema must be ${AGENT_MANIFEST_SCHEMA_V0}`);
|
|
51178
|
+
if (value.schema !== AGENT_MANIFEST_SCHEMA_V0 && value.schema !== RAFT_AGENT_MANIFEST_SCHEMA_V0 && value.schema !== AGENT_MANIFEST_SCHEMA_V0_URL) {
|
|
51179
|
+
throw new Error(`manifest schema must be ${AGENT_MANIFEST_SCHEMA_V0} or ${RAFT_AGENT_MANIFEST_SCHEMA_V0}`);
|
|
49979
51180
|
}
|
|
49980
51181
|
const execution = value.execution;
|
|
49981
51182
|
if (!isRecord(execution)) throw new Error("execution must be an object");
|
|
@@ -49997,12 +51198,17 @@ function validateAgentManifestV0(value) {
|
|
|
49997
51198
|
return {
|
|
49998
51199
|
schema: AGENT_MANIFEST_SCHEMA_V0,
|
|
49999
51200
|
service: typeof value.service === "string" && value.service.trim() ? value.service.trim() : void 0,
|
|
51201
|
+
name: optionalString(value.name),
|
|
51202
|
+
description: optionalString(value.description),
|
|
50000
51203
|
docs_url: value.docs_url === void 0 ? void 0 : requireUrl(value.docs_url, "docs_url"),
|
|
51204
|
+
app_origin: value.app_origin === void 0 ? void 0 : requireUrl(value.app_origin, "app_origin"),
|
|
50001
51205
|
execution: {
|
|
50002
51206
|
mode: execution.mode,
|
|
50003
51207
|
command: execution.mode === "local_cli" ? requireCommand(execution.command) : void 0,
|
|
50004
51208
|
base_url: execution.base_url === void 0 ? void 0 : requireUrl(execution.base_url, "execution.base_url")
|
|
50005
51209
|
},
|
|
51210
|
+
auth: normalizeAuth(value.auth),
|
|
51211
|
+
actions: normalizeActions(value.actions),
|
|
50006
51212
|
credential_boundary: credentialStorage ? {
|
|
50007
51213
|
storage: credentialStorage,
|
|
50008
51214
|
forbid_user_home: forbidUserHome
|
|
@@ -50050,13 +51256,45 @@ async function fetchAgentManifest(url2) {
|
|
|
50050
51256
|
}
|
|
50051
51257
|
return validateAgentManifestV0(parsedJson);
|
|
50052
51258
|
}
|
|
51259
|
+
function wellKnownAliasUrl(url2) {
|
|
51260
|
+
const parsed = new URL(url2);
|
|
51261
|
+
if (parsed.pathname === RAFT_AGENT_MANIFEST_WELL_KNOWN_PATH) {
|
|
51262
|
+
parsed.pathname = SLOCK_AGENT_MANIFEST_WELL_KNOWN_PATH;
|
|
51263
|
+
return parsed.toString();
|
|
51264
|
+
}
|
|
51265
|
+
if (parsed.pathname === SLOCK_AGENT_MANIFEST_WELL_KNOWN_PATH) {
|
|
51266
|
+
parsed.pathname = RAFT_AGENT_MANIFEST_WELL_KNOWN_PATH;
|
|
51267
|
+
return parsed.toString();
|
|
51268
|
+
}
|
|
51269
|
+
return null;
|
|
51270
|
+
}
|
|
51271
|
+
function shouldTryWellKnownAlias(err) {
|
|
51272
|
+
if (err instanceof AgentManifestFetchError) return err.status === 404 || err.status === 410;
|
|
51273
|
+
return err instanceof AgentManifestResponseFormatError;
|
|
51274
|
+
}
|
|
51275
|
+
async function fetchAgentManifestWithWellKnownAliases(url2, fetchManifestImpl = fetchAgentManifest) {
|
|
51276
|
+
try {
|
|
51277
|
+
return await fetchManifestImpl(url2);
|
|
51278
|
+
} catch (err) {
|
|
51279
|
+
if (!shouldTryWellKnownAlias(err)) throw err;
|
|
51280
|
+
const alias = wellKnownAliasUrl(url2);
|
|
51281
|
+
if (!alias) throw err;
|
|
51282
|
+
return await fetchManifestImpl(alias);
|
|
51283
|
+
}
|
|
51284
|
+
}
|
|
50053
51285
|
function sanitizePathSegment(value) {
|
|
50054
51286
|
const segment = value.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
50055
51287
|
return segment || "service";
|
|
50056
51288
|
}
|
|
50057
|
-
function resolveSlockHome(env) {
|
|
50058
|
-
|
|
50059
|
-
|
|
51289
|
+
function resolveSlockHome(env, homeDir = os4.homedir()) {
|
|
51290
|
+
const configured = env.SLOCK_HOME?.trim() || env.RAFT_HOME?.trim();
|
|
51291
|
+
const raw = configured && configured.length > 0 ? configured : path8.join(homeDir, ".slock");
|
|
51292
|
+
return path8.resolve(expandHome(raw, homeDir));
|
|
51293
|
+
}
|
|
51294
|
+
function expandHome(input, homeDir) {
|
|
51295
|
+
if (input === "~") return homeDir;
|
|
51296
|
+
if (input.startsWith("~/")) return path8.join(homeDir, input.slice(2));
|
|
51297
|
+
return input;
|
|
50060
51298
|
}
|
|
50061
51299
|
function buildLocalCliProfileEnv(input) {
|
|
50062
51300
|
if (input.manifest.execution.mode !== "local_cli" || !input.manifest.execution.command) {
|
|
@@ -50068,7 +51306,7 @@ function buildLocalCliProfileEnv(input) {
|
|
|
50068
51306
|
if (input.manifest.credential_boundary.forbid_user_home !== true) {
|
|
50069
51307
|
throw new Error("manifest must set credential_boundary.forbid_user_home=true for local_cli isolation");
|
|
50070
51308
|
}
|
|
50071
|
-
const root = resolveSlockHome(input.env ?? process.env);
|
|
51309
|
+
const root = resolveSlockHome(input.env ?? process.env, input.homeDir);
|
|
50072
51310
|
const profileHome = path8.join(
|
|
50073
51311
|
root,
|
|
50074
51312
|
"integration-profiles",
|
|
@@ -50120,7 +51358,10 @@ function findService(data, service) {
|
|
|
50120
51358
|
}
|
|
50121
51359
|
function describeNoLocalEnv(manifest) {
|
|
50122
51360
|
if (manifest.execution.mode !== "local_cli") {
|
|
50123
|
-
|
|
51361
|
+
if (manifest.actions && manifest.actions.length > 0) {
|
|
51362
|
+
return "manifest exposes HTTP API actions; no local CLI env is required";
|
|
51363
|
+
}
|
|
51364
|
+
return "manifest execution mode is http_api; no local CLI env is required";
|
|
50124
51365
|
}
|
|
50125
51366
|
if (!manifest.credential_boundary) {
|
|
50126
51367
|
return "manifest does not request a Slock-managed local environment";
|
|
@@ -50165,7 +51406,7 @@ async function resolveIntegrationEnv(input) {
|
|
|
50165
51406
|
message: describeMissingManifest({ service: input.service })
|
|
50166
51407
|
};
|
|
50167
51408
|
}
|
|
50168
|
-
const fetchManifestImpl = input.fetchManifest ?? fetchAgentManifest;
|
|
51409
|
+
const fetchManifestImpl = input.fetchManifest ?? (isInferredWellKnownManifest(input.service) ? fetchAgentManifestWithWellKnownAliases : fetchAgentManifest);
|
|
50169
51410
|
let manifest;
|
|
50170
51411
|
try {
|
|
50171
51412
|
manifest = await fetchManifestImpl(input.service.agentManifestUrl);
|
|
@@ -50204,13 +51445,19 @@ async function resolveIntegrationEnv(input) {
|
|
|
50204
51445
|
}
|
|
50205
51446
|
}
|
|
50206
51447
|
function formatNoLocalEnv(input) {
|
|
50207
|
-
|
|
51448
|
+
const lines = [
|
|
50208
51449
|
`# Slock integration profile for ${input.service}`,
|
|
50209
51450
|
input.manifestUrl ? `# manifest: ${input.manifestUrl}` : "# manifest: none declared",
|
|
50210
51451
|
"# No local CLI environment exports are required for this service.",
|
|
50211
|
-
`# ${input.message}
|
|
50212
|
-
|
|
50213
|
-
|
|
51452
|
+
`# ${input.message}`
|
|
51453
|
+
];
|
|
51454
|
+
if (input.actions && input.actions.length > 0) {
|
|
51455
|
+
lines.push(`# API actions: ${input.actions.join(", ")}`);
|
|
51456
|
+
lines.push(`# list actions: raft integration invoke --service ${JSON.stringify(input.service)} --list-actions`);
|
|
51457
|
+
lines.push(`# invoke action: raft integration invoke --service ${JSON.stringify(input.service)} --action <name>`);
|
|
51458
|
+
}
|
|
51459
|
+
lines.push("# Slock did not set HOME/XDG exports and did not execute manifest commands.");
|
|
51460
|
+
return lines.join("\n");
|
|
50214
51461
|
}
|
|
50215
51462
|
var integrationEnvCommand = defineCommand(
|
|
50216
51463
|
{
|
|
@@ -50254,6 +51501,7 @@ var integrationEnvCommand = defineCommand(
|
|
|
50254
51501
|
manifestUrl: resolution.manifestUrl,
|
|
50255
51502
|
requiresLocalEnv: false,
|
|
50256
51503
|
command: resolution.manifest?.execution.command ?? null,
|
|
51504
|
+
actions: resolution.manifest?.actions?.map((action) => action.name) ?? [],
|
|
50257
51505
|
env: {},
|
|
50258
51506
|
message: resolution.message
|
|
50259
51507
|
}
|
|
@@ -50263,7 +51511,8 @@ var integrationEnvCommand = defineCommand(
|
|
|
50263
51511
|
writeText(cmdCtx.io, `${formatNoLocalEnv({
|
|
50264
51512
|
service: resolution.service.clientId,
|
|
50265
51513
|
manifestUrl: resolution.manifestUrl,
|
|
50266
|
-
message: resolution.message
|
|
51514
|
+
message: resolution.message,
|
|
51515
|
+
actions: resolution.manifest?.actions?.map((action) => action.name) ?? []
|
|
50267
51516
|
})}
|
|
50268
51517
|
`);
|
|
50269
51518
|
return;
|
|
@@ -50290,6 +51539,16 @@ function registerIntegrationEnvCommand(parent, runtimeOptions = {}) {
|
|
|
50290
51539
|
registerCliCommand(parent, integrationEnvCommand, runtimeOptions);
|
|
50291
51540
|
}
|
|
50292
51541
|
init_esm_shims();
|
|
51542
|
+
function normalizeService2(value) {
|
|
51543
|
+
return value.trim().toLowerCase();
|
|
51544
|
+
}
|
|
51545
|
+
function findService2(data, service) {
|
|
51546
|
+
const normalized = normalizeService2(service);
|
|
51547
|
+
if (!normalized) return null;
|
|
51548
|
+
return data.services.find(
|
|
51549
|
+
(candidate) => candidate.id === service || normalizeService2(candidate.clientId) === normalized || normalizeService2(candidate.name) === normalized
|
|
51550
|
+
) ?? null;
|
|
51551
|
+
}
|
|
50293
51552
|
function normalizeScopes2(raw) {
|
|
50294
51553
|
if (!raw || raw.length === 0) return void 0;
|
|
50295
51554
|
const scopes = Array.from(new Set(
|
|
@@ -50300,6 +51559,391 @@ function normalizeScopes2(raw) {
|
|
|
50300
51559
|
}
|
|
50301
51560
|
return scopes;
|
|
50302
51561
|
}
|
|
51562
|
+
function parseHandlerArgs(serviceArgOrOpts, actionArgOrOpts, maybeOpts) {
|
|
51563
|
+
if (typeof serviceArgOrOpts === "object" && serviceArgOrOpts !== null) {
|
|
51564
|
+
return { opts: serviceArgOrOpts };
|
|
51565
|
+
}
|
|
51566
|
+
if (typeof actionArgOrOpts === "object" && actionArgOrOpts !== null) {
|
|
51567
|
+
return { serviceArg: serviceArgOrOpts, opts: actionArgOrOpts };
|
|
51568
|
+
}
|
|
51569
|
+
return { serviceArg: serviceArgOrOpts, actionArg: actionArgOrOpts, opts: maybeOpts ?? {} };
|
|
51570
|
+
}
|
|
51571
|
+
function readTextReference(value) {
|
|
51572
|
+
if (!value.startsWith("@")) return value;
|
|
51573
|
+
const path9 = value.slice(1);
|
|
51574
|
+
if (!path9) throw cliError("INVALID_ARG", "@ file references must include a path");
|
|
51575
|
+
if (path9 === "-") return fs6.readFileSync(0, "utf8");
|
|
51576
|
+
return fs6.readFileSync(path9, "utf8");
|
|
51577
|
+
}
|
|
51578
|
+
function parseJsonObject(raw, label) {
|
|
51579
|
+
let parsed;
|
|
51580
|
+
try {
|
|
51581
|
+
parsed = JSON.parse(raw);
|
|
51582
|
+
} catch (err) {
|
|
51583
|
+
throw cliError("INVALID_ARG", `${label} is not valid JSON: ${err.message}`);
|
|
51584
|
+
}
|
|
51585
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
51586
|
+
throw cliError("INVALID_ARG", `${label} must be a JSON object`);
|
|
51587
|
+
}
|
|
51588
|
+
return parsed;
|
|
51589
|
+
}
|
|
51590
|
+
function parseActionPayload(opts) {
|
|
51591
|
+
if (opts.dataJson && opts.dataFile) {
|
|
51592
|
+
throw cliError("INVALID_ARG", "use only one of --data-json or --data-file");
|
|
51593
|
+
}
|
|
51594
|
+
const payload = {};
|
|
51595
|
+
if (opts.dataJson) {
|
|
51596
|
+
Object.assign(payload, parseJsonObject(opts.dataJson, "--data-json"));
|
|
51597
|
+
}
|
|
51598
|
+
if (opts.dataFile) {
|
|
51599
|
+
const raw = opts.dataFile === "-" ? fs6.readFileSync(0, "utf8") : fs6.readFileSync(opts.dataFile, "utf8");
|
|
51600
|
+
Object.assign(payload, parseJsonObject(raw, "--data-file"));
|
|
51601
|
+
}
|
|
51602
|
+
for (const rawParam of opts.param ?? []) {
|
|
51603
|
+
const separator = rawParam.indexOf("=");
|
|
51604
|
+
if (separator <= 0) {
|
|
51605
|
+
throw cliError("INVALID_ARG", "--param values must use key=value");
|
|
51606
|
+
}
|
|
51607
|
+
const key = rawParam.slice(0, separator).trim();
|
|
51608
|
+
if (!key) throw cliError("INVALID_ARG", "--param keys must not be empty");
|
|
51609
|
+
payload[key] = readTextReference(rawParam.slice(separator + 1));
|
|
51610
|
+
}
|
|
51611
|
+
return payload;
|
|
51612
|
+
}
|
|
51613
|
+
function validateRequiredParams(action, payload) {
|
|
51614
|
+
for (const [name, spec] of Object.entries(action.parameters ?? {})) {
|
|
51615
|
+
if (!spec.required) continue;
|
|
51616
|
+
if (payload[name] === void 0 || payload[name] === null || payload[name] === "") {
|
|
51617
|
+
throw cliError("INVALID_ARG", `missing required parameter ${name}`);
|
|
51618
|
+
}
|
|
51619
|
+
}
|
|
51620
|
+
}
|
|
51621
|
+
function safeUrl(value, label) {
|
|
51622
|
+
let url2;
|
|
51623
|
+
try {
|
|
51624
|
+
url2 = new URL(value);
|
|
51625
|
+
} catch {
|
|
51626
|
+
throw cliError("INVALID_ARG", `${label} must be a valid URL`);
|
|
51627
|
+
}
|
|
51628
|
+
if (url2.protocol !== "https:" && url2.protocol !== "http:") {
|
|
51629
|
+
throw cliError("INVALID_ARG", `${label} must use http or https`);
|
|
51630
|
+
}
|
|
51631
|
+
if (url2.username || url2.password) {
|
|
51632
|
+
throw cliError("INVALID_ARG", `${label} must not include credentials`);
|
|
51633
|
+
}
|
|
51634
|
+
return url2;
|
|
51635
|
+
}
|
|
51636
|
+
function resolveActionUrl(input) {
|
|
51637
|
+
const base = input.manifest.execution.base_url ?? input.manifest.app_origin ?? input.service.homepageUrl ?? (input.service.returnUrl ? safeUrl(input.service.returnUrl, "service return URL").origin : null);
|
|
51638
|
+
if (!base) {
|
|
51639
|
+
throw cliError(
|
|
51640
|
+
"INVALID_ARG",
|
|
51641
|
+
"manifest must provide execution.base_url or app_origin, or the service must provide a homepage/return URL"
|
|
51642
|
+
);
|
|
51643
|
+
}
|
|
51644
|
+
const baseUrl = safeUrl(base, "action base URL");
|
|
51645
|
+
return new URL(input.action.endpoint.path, baseUrl);
|
|
51646
|
+
}
|
|
51647
|
+
function setCookieHeaderValues(headers) {
|
|
51648
|
+
const getSetCookie = headers.getSetCookie;
|
|
51649
|
+
return typeof getSetCookie === "function" ? getSetCookie.call(headers) : [headers.get("set-cookie")].filter((value) => Boolean(value));
|
|
51650
|
+
}
|
|
51651
|
+
function defaultCookiePath(pathname) {
|
|
51652
|
+
if (!pathname.startsWith("/") || pathname === "/") return "/";
|
|
51653
|
+
const lastSlash = pathname.lastIndexOf("/");
|
|
51654
|
+
if (lastSlash <= 0) return "/";
|
|
51655
|
+
return pathname.slice(0, lastSlash);
|
|
51656
|
+
}
|
|
51657
|
+
function parseSessionCookie(value, sourceUrl) {
|
|
51658
|
+
const parts = value.split(";").map((part) => part.trim()).filter(Boolean);
|
|
51659
|
+
const pair = parts.shift();
|
|
51660
|
+
if (!pair || !pair.includes("=") || pair.startsWith("=")) return null;
|
|
51661
|
+
const sourceHost = sourceUrl.hostname.toLowerCase();
|
|
51662
|
+
let host = sourceHost;
|
|
51663
|
+
let path9 = defaultCookiePath(sourceUrl.pathname);
|
|
51664
|
+
let secure = false;
|
|
51665
|
+
for (const part of parts) {
|
|
51666
|
+
const separator = part.indexOf("=");
|
|
51667
|
+
const rawName = separator >= 0 ? part.slice(0, separator) : part;
|
|
51668
|
+
const rawValue = separator >= 0 ? part.slice(separator + 1) : "";
|
|
51669
|
+
const name = rawName.trim().toLowerCase();
|
|
51670
|
+
if (name === "secure") {
|
|
51671
|
+
secure = true;
|
|
51672
|
+
} else if (name === "path" && rawValue.trim().startsWith("/")) {
|
|
51673
|
+
path9 = rawValue.trim();
|
|
51674
|
+
} else if (name === "domain") {
|
|
51675
|
+
const domain2 = rawValue.trim().replace(/^\./, "").toLowerCase();
|
|
51676
|
+
if (domain2 !== sourceHost) return null;
|
|
51677
|
+
host = domain2;
|
|
51678
|
+
}
|
|
51679
|
+
}
|
|
51680
|
+
return { pair, host, path: path9, secure };
|
|
51681
|
+
}
|
|
51682
|
+
function cookiePathMatches(requestPath, cookiePath) {
|
|
51683
|
+
if (requestPath === cookiePath) return true;
|
|
51684
|
+
if (cookiePath.endsWith("/")) return requestPath.startsWith(cookiePath);
|
|
51685
|
+
return requestPath.startsWith(`${cookiePath}/`);
|
|
51686
|
+
}
|
|
51687
|
+
function cookieHeaderForUrl(cookies, url2) {
|
|
51688
|
+
const host = url2.hostname.toLowerCase();
|
|
51689
|
+
const valid = cookies.filter((cookie) => cookie.host === host).filter((cookie) => !cookie.secure || url2.protocol === "https:").filter((cookie) => cookiePathMatches(url2.pathname || "/", cookie.path)).map((cookie) => cookie.pair);
|
|
51690
|
+
return valid.length > 0 ? valid.join("; ") : null;
|
|
51691
|
+
}
|
|
51692
|
+
function sessionCookiesFromSetCookie(headers, sourceUrl) {
|
|
51693
|
+
return setCookieHeaderValues(headers).map((value) => parseSessionCookie(value, sourceUrl)).filter((value) => Boolean(value));
|
|
51694
|
+
}
|
|
51695
|
+
async function establishServiceSession(input) {
|
|
51696
|
+
const callbackUrl = buildAgentCallbackHandoffUrl(input.service.returnUrl, input.login.requestId);
|
|
51697
|
+
if (!callbackUrl) {
|
|
51698
|
+
throw cliError("INTEGRATION_INVOKE_FAILED", "service return URL cannot be used for Agent Login callback handoff");
|
|
51699
|
+
}
|
|
51700
|
+
const parsedCallbackUrl = safeUrl(callbackUrl, "service callback URL");
|
|
51701
|
+
const response = await fetch(callbackUrl, {
|
|
51702
|
+
method: "GET",
|
|
51703
|
+
redirect: "manual",
|
|
51704
|
+
headers: { accept: "text/html,application/json" }
|
|
51705
|
+
});
|
|
51706
|
+
if (response.status < 200 || response.status >= 400) {
|
|
51707
|
+
throw cliError("INTEGRATION_INVOKE_FAILED", `service callback handoff failed with HTTP ${response.status}`);
|
|
51708
|
+
}
|
|
51709
|
+
const cookies = sessionCookiesFromSetCookie(response.headers, parsedCallbackUrl);
|
|
51710
|
+
if (cookies.length === 0) {
|
|
51711
|
+
throw cliError(
|
|
51712
|
+
"INTEGRATION_INVOKE_FAILED",
|
|
51713
|
+
"service callback handoff did not set a session cookie; the service may not support stateless Agent Login API actions yet"
|
|
51714
|
+
);
|
|
51715
|
+
}
|
|
51716
|
+
return cookies;
|
|
51717
|
+
}
|
|
51718
|
+
function appendPayloadAsQuery(url2, payload) {
|
|
51719
|
+
for (const [key, value] of Object.entries(payload)) {
|
|
51720
|
+
if (value === void 0 || value === null) continue;
|
|
51721
|
+
url2.searchParams.set(key, typeof value === "string" ? value : JSON.stringify(value));
|
|
51722
|
+
}
|
|
51723
|
+
}
|
|
51724
|
+
async function invokeHttpAction(input) {
|
|
51725
|
+
const url2 = new URL(input.url);
|
|
51726
|
+
const cookie = cookieHeaderForUrl(input.cookies, url2);
|
|
51727
|
+
if (!cookie) {
|
|
51728
|
+
throw cliError(
|
|
51729
|
+
"INTEGRATION_INVOKE_FAILED",
|
|
51730
|
+
"service callback handoff did not set a session cookie usable for the action URL; ensure the cookie host and Path cover the action endpoint"
|
|
51731
|
+
);
|
|
51732
|
+
}
|
|
51733
|
+
const headers = {
|
|
51734
|
+
accept: "application/json,text/plain,*/*",
|
|
51735
|
+
cookie
|
|
51736
|
+
};
|
|
51737
|
+
const init = {
|
|
51738
|
+
method: input.action.endpoint.method,
|
|
51739
|
+
headers,
|
|
51740
|
+
redirect: "follow"
|
|
51741
|
+
};
|
|
51742
|
+
if (input.action.endpoint.method === "GET") {
|
|
51743
|
+
appendPayloadAsQuery(url2, input.payload);
|
|
51744
|
+
} else {
|
|
51745
|
+
headers["content-type"] = "application/json";
|
|
51746
|
+
init.body = JSON.stringify(input.payload);
|
|
51747
|
+
}
|
|
51748
|
+
const response = await fetch(url2, init);
|
|
51749
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
51750
|
+
if (contentType.includes("application/json")) {
|
|
51751
|
+
const value2 = await response.json().catch(() => {
|
|
51752
|
+
throw cliError("INVALID_JSON_RESPONSE", `service action returned invalid JSON (HTTP ${response.status})`);
|
|
51753
|
+
});
|
|
51754
|
+
if (!response.ok) {
|
|
51755
|
+
const message = value2 && typeof value2 === "object" && "error" in value2 ? String(value2.error) : `service action failed with HTTP ${response.status}`;
|
|
51756
|
+
throw cliError("INTEGRATION_INVOKE_FAILED", message);
|
|
51757
|
+
}
|
|
51758
|
+
return { kind: "json", status: response.status, value: value2 };
|
|
51759
|
+
}
|
|
51760
|
+
const value = await response.text();
|
|
51761
|
+
if (!response.ok) {
|
|
51762
|
+
throw cliError("INTEGRATION_INVOKE_FAILED", value || `service action failed with HTTP ${response.status}`);
|
|
51763
|
+
}
|
|
51764
|
+
return { kind: "text", status: response.status, value };
|
|
51765
|
+
}
|
|
51766
|
+
function formatActions(input) {
|
|
51767
|
+
const actions = input.manifest.actions ?? [];
|
|
51768
|
+
const lines = [
|
|
51769
|
+
`Actions for ${input.service.name}`,
|
|
51770
|
+
`service: ${input.service.clientId}`,
|
|
51771
|
+
`manifest: ${input.manifestUrl}`
|
|
51772
|
+
];
|
|
51773
|
+
if (actions.length === 0) {
|
|
51774
|
+
lines.push("- none");
|
|
51775
|
+
return lines.join("\n");
|
|
51776
|
+
}
|
|
51777
|
+
for (const action of actions) {
|
|
51778
|
+
const required2 = Object.entries(action.parameters ?? {}).filter(([, param]) => param.required).map(([name]) => name);
|
|
51779
|
+
lines.push(`- ${action.name}`);
|
|
51780
|
+
lines.push(` endpoint: ${action.endpoint.method} ${action.endpoint.path}`);
|
|
51781
|
+
if (action.description) lines.push(` description: ${action.description}`);
|
|
51782
|
+
if (required2.length > 0) lines.push(` required params: ${required2.join(", ")}`);
|
|
51783
|
+
}
|
|
51784
|
+
lines.push(`next: raft integration invoke --service ${JSON.stringify(input.service.clientId)} --action ${JSON.stringify(actions[0]?.name ?? "<name>")}`);
|
|
51785
|
+
return lines.join("\n");
|
|
51786
|
+
}
|
|
51787
|
+
function pickViewerUrl(value) {
|
|
51788
|
+
return value && typeof value === "object" && typeof value.viewerUrl === "string" ? value.viewerUrl : null;
|
|
51789
|
+
}
|
|
51790
|
+
function formatActionResult(input) {
|
|
51791
|
+
const lines = [
|
|
51792
|
+
`Action invoked: ${input.action.name}`,
|
|
51793
|
+
`service: ${input.service.clientId}`,
|
|
51794
|
+
`status: HTTP ${input.result.status}`
|
|
51795
|
+
];
|
|
51796
|
+
if (input.result.kind === "json") {
|
|
51797
|
+
const viewerUrl = pickViewerUrl(input.result.value);
|
|
51798
|
+
if (viewerUrl) lines.push(`viewer URL: ${viewerUrl}`);
|
|
51799
|
+
lines.push("result:");
|
|
51800
|
+
lines.push(JSON.stringify(input.result.value, null, 2));
|
|
51801
|
+
} else if (input.result.value) {
|
|
51802
|
+
lines.push("result:");
|
|
51803
|
+
lines.push(input.result.value);
|
|
51804
|
+
}
|
|
51805
|
+
return lines.join("\n");
|
|
51806
|
+
}
|
|
51807
|
+
async function fetchManifestForInvoke(service) {
|
|
51808
|
+
if (!service.agentManifestUrl) {
|
|
51809
|
+
throw cliError("INTEGRATION_MANIFEST_MISSING", `${service.name} does not expose an agent behavior manifest`);
|
|
51810
|
+
}
|
|
51811
|
+
try {
|
|
51812
|
+
const fetchManifest = service.agentManifestUrlSource === "well_known" ? fetchAgentManifestWithWellKnownAliases : fetchAgentManifest;
|
|
51813
|
+
return await fetchManifest(service.agentManifestUrl);
|
|
51814
|
+
} catch (err) {
|
|
51815
|
+
if (err instanceof AgentManifestFetchError && (err.status === 404 || err.status === 410)) {
|
|
51816
|
+
throw cliError("INTEGRATION_MANIFEST_MISSING", "agent behavior manifest was not found", { cause: err });
|
|
51817
|
+
}
|
|
51818
|
+
if (err instanceof AgentManifestResponseFormatError) {
|
|
51819
|
+
throw cliError("INTEGRATION_MANIFEST_INVALID", err.message, { cause: err });
|
|
51820
|
+
}
|
|
51821
|
+
throw cliError("INTEGRATION_MANIFEST_INVALID", err.message, { cause: err });
|
|
51822
|
+
}
|
|
51823
|
+
}
|
|
51824
|
+
var integrationInvokeCommand = defineCommand(
|
|
51825
|
+
{
|
|
51826
|
+
name: "invoke",
|
|
51827
|
+
description: "Invoke a manifest-backed HTTP API action for a registered integration",
|
|
51828
|
+
arguments: ["[service]", "[action]"],
|
|
51829
|
+
options: [
|
|
51830
|
+
{ flags: "--service <id>", description: "Registered service id, client id, or exact service name" },
|
|
51831
|
+
{ flags: "--action <name>", description: "Manifest action name to invoke" },
|
|
51832
|
+
{ flags: "--list-actions", description: "List manifest actions instead of invoking one" },
|
|
51833
|
+
{
|
|
51834
|
+
flags: "--param <key=value>",
|
|
51835
|
+
description: "Action parameter; repeatable. Use key=@file or key=@- to read text",
|
|
51836
|
+
parse: (value, previous = []) => {
|
|
51837
|
+
previous.push(value);
|
|
51838
|
+
return previous;
|
|
51839
|
+
}
|
|
51840
|
+
},
|
|
51841
|
+
{ flags: "--data-json <json>", description: "JSON object request body for the action" },
|
|
51842
|
+
{ flags: "--data-file <path>", description: "JSON object request body file, or - for stdin" },
|
|
51843
|
+
{
|
|
51844
|
+
flags: "--scope <scope>",
|
|
51845
|
+
description: "Login scope to request before invoking; can be repeated or comma-separated",
|
|
51846
|
+
parse: (value, previous = []) => {
|
|
51847
|
+
previous.push(value);
|
|
51848
|
+
return previous;
|
|
51849
|
+
}
|
|
51850
|
+
},
|
|
51851
|
+
{ flags: "--target <target>", description: "Conversation target to post a human approval card when approval is required" },
|
|
51852
|
+
{ flags: "--json", description: "Emit machine-readable JSON" }
|
|
51853
|
+
]
|
|
51854
|
+
},
|
|
51855
|
+
async (cmdCtx, serviceArgOrOpts, actionArgOrOpts, maybeOpts) => {
|
|
51856
|
+
const { serviceArg, actionArg, opts } = parseHandlerArgs(serviceArgOrOpts, actionArgOrOpts, maybeOpts);
|
|
51857
|
+
const serviceQuery = (opts.service ?? serviceArg ?? "").trim();
|
|
51858
|
+
const actionName = (opts.action ?? actionArg ?? "").trim();
|
|
51859
|
+
if (!serviceQuery) throw cliError("INVALID_ARG", "--service or service argument is required");
|
|
51860
|
+
if (!opts.listActions && !actionName) throw cliError("INVALID_ARG", "--action or action argument is required");
|
|
51861
|
+
const agentContext = cmdCtx.loadAgentContext();
|
|
51862
|
+
const client = cmdCtx.createApiClient(agentContext);
|
|
51863
|
+
const api = createAgentApiSurfaceClient(client);
|
|
51864
|
+
const listRes = await api.integrations.list();
|
|
51865
|
+
if (!listRes.ok || !listRes.data) {
|
|
51866
|
+
const code = listRes.status >= 500 ? "SERVER_5XX" : "INTEGRATION_LIST_FAILED";
|
|
51867
|
+
throw cliError(code, listRes.error ?? `HTTP ${listRes.status}`);
|
|
51868
|
+
}
|
|
51869
|
+
const service = findService2(listRes.data, serviceQuery);
|
|
51870
|
+
if (!service) {
|
|
51871
|
+
throw cliError("INTEGRATION_NOT_FOUND", `No registered integration matched ${serviceQuery}`);
|
|
51872
|
+
}
|
|
51873
|
+
const manifest = await fetchManifestForInvoke(service);
|
|
51874
|
+
if (manifest.execution.mode !== "http_api") {
|
|
51875
|
+
throw cliError("INTEGRATION_MANIFEST_UNSUPPORTED", "manifest execution mode is not http_api");
|
|
51876
|
+
}
|
|
51877
|
+
if (opts.listActions) {
|
|
51878
|
+
if (opts.json) {
|
|
51879
|
+
writeJson(cmdCtx.io, {
|
|
51880
|
+
ok: true,
|
|
51881
|
+
data: {
|
|
51882
|
+
service: service.clientId,
|
|
51883
|
+
manifestUrl: service.agentManifestUrl,
|
|
51884
|
+
actions: manifest.actions ?? []
|
|
51885
|
+
}
|
|
51886
|
+
});
|
|
51887
|
+
return;
|
|
51888
|
+
}
|
|
51889
|
+
writeText(cmdCtx.io, `${formatActions({ service, manifestUrl: service.agentManifestUrl ?? "-", manifest })}
|
|
51890
|
+
`);
|
|
51891
|
+
return;
|
|
51892
|
+
}
|
|
51893
|
+
const action = (manifest.actions ?? []).find((candidate) => candidate.name === actionName);
|
|
51894
|
+
if (!action) throw cliError("INVALID_ARG", `manifest does not define action ${actionName}`);
|
|
51895
|
+
const payload = parseActionPayload(opts);
|
|
51896
|
+
validateRequiredParams(action, payload);
|
|
51897
|
+
const scopes = normalizeScopes2(opts.scope);
|
|
51898
|
+
const loginRes = await api.integrations.login({
|
|
51899
|
+
service: service.clientId,
|
|
51900
|
+
scopes,
|
|
51901
|
+
target: opts.target?.trim() || void 0
|
|
51902
|
+
});
|
|
51903
|
+
if (!loginRes.ok || !loginRes.data) {
|
|
51904
|
+
const code = loginRes.status >= 500 ? "SERVER_5XX" : "INTEGRATION_LOGIN_FAILED";
|
|
51905
|
+
throw cliError(code, loginRes.error ?? `HTTP ${loginRes.status}`);
|
|
51906
|
+
}
|
|
51907
|
+
if (loginRes.data.status === "approval_required") {
|
|
51908
|
+
throw cliError(
|
|
51909
|
+
"INTEGRATION_APPROVAL_REQUIRED",
|
|
51910
|
+
"human approval is required before invoking this integration action",
|
|
51911
|
+
{ suggestedNextAction: "Ask a server owner/admin to approve the integration login request, then rerun the command." }
|
|
51912
|
+
);
|
|
51913
|
+
}
|
|
51914
|
+
const cookies = await establishServiceSession({ login: loginRes.data, service });
|
|
51915
|
+
const url2 = resolveActionUrl({ service, manifest, action });
|
|
51916
|
+
const result2 = await invokeHttpAction({ url: url2, action, payload, cookies });
|
|
51917
|
+
if (opts.json) {
|
|
51918
|
+
writeJson(cmdCtx.io, {
|
|
51919
|
+
ok: true,
|
|
51920
|
+
data: {
|
|
51921
|
+
service: service.clientId,
|
|
51922
|
+
action: action.name,
|
|
51923
|
+
status: result2.status,
|
|
51924
|
+
result: result2.value
|
|
51925
|
+
}
|
|
51926
|
+
});
|
|
51927
|
+
return;
|
|
51928
|
+
}
|
|
51929
|
+
writeText(cmdCtx.io, `${formatActionResult({ service, action, result: result2 })}
|
|
51930
|
+
`);
|
|
51931
|
+
}
|
|
51932
|
+
);
|
|
51933
|
+
function registerIntegrationInvokeCommand(parent, runtimeOptions = {}) {
|
|
51934
|
+
registerCliCommand(parent, integrationInvokeCommand, runtimeOptions);
|
|
51935
|
+
}
|
|
51936
|
+
init_esm_shims();
|
|
51937
|
+
function normalizeScopes3(raw) {
|
|
51938
|
+
if (!raw || raw.length === 0) return void 0;
|
|
51939
|
+
const scopes = Array.from(new Set(
|
|
51940
|
+
raw.flatMap((value) => value.split(",")).map((value) => value.trim()).filter(Boolean)
|
|
51941
|
+
)).sort();
|
|
51942
|
+
if (scopes.length === 0) {
|
|
51943
|
+
throw cliError("INVALID_ARG", "--scope must include at least one non-empty scope");
|
|
51944
|
+
}
|
|
51945
|
+
return scopes;
|
|
51946
|
+
}
|
|
50303
51947
|
function requiredTrimmed(value, flag) {
|
|
50304
51948
|
const trimmed = value?.trim() ?? "";
|
|
50305
51949
|
if (!trimmed) throw cliError("INVALID_ARG", `${flag} is required`);
|
|
@@ -50328,7 +51972,7 @@ function formatAppPrepare(data) {
|
|
|
50328
51972
|
async function prepareApp(mode, ctx, opts) {
|
|
50329
51973
|
const target = requiredTrimmed(opts.target, "--target");
|
|
50330
51974
|
const clientKey = requiredTrimmed(opts.clientKey, "--client-key");
|
|
50331
|
-
const scopes =
|
|
51975
|
+
const scopes = normalizeScopes3([...opts.scope ?? [], ...opts.scopes ?? []]);
|
|
50332
51976
|
const agentContext = ctx.loadAgentContext();
|
|
50333
51977
|
const client = ctx.createApiClient(agentContext);
|
|
50334
51978
|
const body = {
|
|
@@ -50359,6 +52003,40 @@ async function prepareApp(mode, ctx, opts) {
|
|
|
50359
52003
|
writeText(ctx.io, `${formatAppPrepare(res.data)}
|
|
50360
52004
|
`);
|
|
50361
52005
|
}
|
|
52006
|
+
function formatAppRotateSecret(data) {
|
|
52007
|
+
return [
|
|
52008
|
+
`Integration app secret regenerated for ${data.clientName} (${data.clientKey})`,
|
|
52009
|
+
`client secret: ${data.clientSecret}`,
|
|
52010
|
+
"shown once \u2014 store it now; regenerating again invalidates the previous secret"
|
|
52011
|
+
].join("\n");
|
|
52012
|
+
}
|
|
52013
|
+
async function rotateAppSecret(ctx, opts) {
|
|
52014
|
+
const clientKey = requiredTrimmed(opts.client, "--client");
|
|
52015
|
+
const agentContext = ctx.loadAgentContext();
|
|
52016
|
+
const client = ctx.createApiClient(agentContext);
|
|
52017
|
+
const res = await createAgentApiSurfaceClient(client).integrations.rotateAppSecret({ clientKey });
|
|
52018
|
+
if (!res.ok || !res.data) {
|
|
52019
|
+
const code = res.status >= 500 ? "SERVER_5XX" : "INTEGRATION_APP_ROTATE_SECRET_FAILED";
|
|
52020
|
+
throw cliError(code, res.error ?? `HTTP ${res.status}`);
|
|
52021
|
+
}
|
|
52022
|
+
if (opts.json) {
|
|
52023
|
+
writeJson(ctx.io, { ok: true, data: res.data });
|
|
52024
|
+
return;
|
|
52025
|
+
}
|
|
52026
|
+
writeText(ctx.io, `${formatAppRotateSecret(res.data)}
|
|
52027
|
+
`);
|
|
52028
|
+
}
|
|
52029
|
+
var integrationAppRotateSecretCommand = defineCommand(
|
|
52030
|
+
{
|
|
52031
|
+
name: "rotate-secret",
|
|
52032
|
+
description: "Regenerate the one-time client secret for a server-local app you registered (invalidates the previous secret)",
|
|
52033
|
+
options: [
|
|
52034
|
+
{ flags: "--client <key>", description: "App client key / OAuth client_id you registered" },
|
|
52035
|
+
{ flags: "--json", description: "Emit machine-readable JSON" }
|
|
52036
|
+
]
|
|
52037
|
+
},
|
|
52038
|
+
async (ctx, opts) => rotateAppSecret(ctx, opts)
|
|
52039
|
+
);
|
|
50362
52040
|
var sharedOptions = [
|
|
50363
52041
|
{ flags: "--client-key <key>", description: "Stable app client key / OAuth client_id to reserve or update" },
|
|
50364
52042
|
{ flags: "--name <name>", description: "App display name" },
|
|
@@ -50408,6 +52086,7 @@ function registerIntegrationAppCommands(parent, runtimeOptions = {}) {
|
|
|
50408
52086
|
const prepareCmd = appCmd.command("prepare").description("Prepare app registration/update action cards");
|
|
50409
52087
|
registerCliCommand(prepareCmd, integrationAppPrepareRegisterCommand, runtimeOptions);
|
|
50410
52088
|
registerCliCommand(prepareCmd, integrationAppPrepareUpdateCommand, runtimeOptions);
|
|
52089
|
+
registerCliCommand(appCmd, integrationAppRotateSecretCommand, runtimeOptions);
|
|
50411
52090
|
}
|
|
50412
52091
|
init_esm_shims();
|
|
50413
52092
|
init_esm_shims();
|
|
@@ -50800,6 +52479,10 @@ registerAgentListCommand(agentCmd);
|
|
|
50800
52479
|
registerAgentBridgeCommand(agentCmd);
|
|
50801
52480
|
var channelCmd = program2.command("channel").description("Channel membership and attention operations");
|
|
50802
52481
|
registerChannelMembersCommand(channelCmd);
|
|
52482
|
+
registerChannelCreateCommand(channelCmd);
|
|
52483
|
+
registerChannelUpdateCommand(channelCmd);
|
|
52484
|
+
registerChannelAddMemberCommand(channelCmd);
|
|
52485
|
+
registerChannelRemoveMemberCommand(channelCmd);
|
|
50803
52486
|
registerChannelJoinCommand(channelCmd);
|
|
50804
52487
|
registerChannelLeaveCommand(channelCmd);
|
|
50805
52488
|
registerChannelMuteCommand(channelCmd);
|
|
@@ -50808,6 +52491,7 @@ var threadCmd = program2.command("thread").description("Thread attention operati
|
|
|
50808
52491
|
registerThreadUnfollowCommand(threadCmd);
|
|
50809
52492
|
var serverCmd = program2.command("server").description("Server / workspace introspection");
|
|
50810
52493
|
registerServerInfoCommand(serverCmd);
|
|
52494
|
+
registerServerUpdateCommand(serverCmd);
|
|
50811
52495
|
var manualCmd = program2.command("manual").description("Slock Manual for Agents retrieval (canonical operating topics)");
|
|
50812
52496
|
registerKnowledgeGetCommand(manualCmd);
|
|
50813
52497
|
var knowledgeCmd = program2.command("knowledge").description("Legacy alias for `raft manual`");
|
|
@@ -50840,6 +52524,7 @@ var integrationCmd = program2.command("integration").description("Third-party se
|
|
|
50840
52524
|
registerIntegrationListCommand(integrationCmd);
|
|
50841
52525
|
registerIntegrationLoginCommand(integrationCmd);
|
|
50842
52526
|
registerIntegrationEnvCommand(integrationCmd);
|
|
52527
|
+
registerIntegrationInvokeCommand(integrationCmd);
|
|
50843
52528
|
registerIntegrationAppCommands(integrationCmd);
|
|
50844
52529
|
var reminderCmd = program2.command("reminder").description("Reminder operations");
|
|
50845
52530
|
registerReminderScheduleCommand(reminderCmd);
|