@homingbird/mcp 0.3.0 → 0.3.2
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/homingbird-mcp.mjs +1034 -101
- package/package.json +5 -5
package/dist/homingbird-mcp.mjs
CHANGED
|
@@ -8,7 +8,7 @@ var __export = (target2, all3) => {
|
|
|
8
8
|
// src/stdio.ts
|
|
9
9
|
import { spawn as spawn2 } from "node:child_process";
|
|
10
10
|
import { randomBytes as randomBytes2, randomInt } from "node:crypto";
|
|
11
|
-
import { homedir
|
|
11
|
+
import { homedir } from "node:os";
|
|
12
12
|
|
|
13
13
|
// ../kernel/src/data.ts
|
|
14
14
|
var tagged = (tag) => () => {
|
|
@@ -1070,49 +1070,414 @@ var makeSemaphore = (permits) => {
|
|
|
1070
1070
|
var makeMutex = () => makeSemaphore(1);
|
|
1071
1071
|
var QueueClosed = tagged("QueueClosed")();
|
|
1072
1072
|
|
|
1073
|
+
// ../cli/src/antigravity.ts
|
|
1074
|
+
var antigravityInput = (prompt) => `${JSON.stringify({ event: "user", message: { role: "user", content: [{ type: "text", text: prompt }] } })}
|
|
1075
|
+
`;
|
|
1076
|
+
var antigravityOutput = (printed) => {
|
|
1077
|
+
let response = null;
|
|
1078
|
+
for (const line of printed.split(/\r?\n/)) {
|
|
1079
|
+
const value = parsedJson(line);
|
|
1080
|
+
const event2 = StreamEvent.read(value);
|
|
1081
|
+
if (event2._tag === "Err" || event2.value.event !== "result") continue;
|
|
1082
|
+
const result2 = ResultEvent.read(value);
|
|
1083
|
+
if (result2._tag === "Err") return result_exports.err("printed a result event without a status");
|
|
1084
|
+
const { status: status2, response: said2 } = result2.value.result;
|
|
1085
|
+
if (status2 !== "SUCCESS") return result_exports.err(`reported ${statusLabel(status2)} instead of a response`);
|
|
1086
|
+
if (said2 === void 0) return result_exports.err("printed a result event without a response");
|
|
1087
|
+
response = said2;
|
|
1088
|
+
}
|
|
1089
|
+
return response === null ? result_exports.err("printed no result event") : result_exports.ok(response);
|
|
1090
|
+
};
|
|
1091
|
+
var ANTIGRAVITY_PRINT = [
|
|
1092
|
+
...["agy", "--print=", "--input-format=stream-json", "--output-format=stream-json", "--sandbox"]
|
|
1093
|
+
];
|
|
1094
|
+
var ANTIGRAVITY_READER_SETTINGS = {
|
|
1095
|
+
toolPermission: "request-review",
|
|
1096
|
+
permissions: {
|
|
1097
|
+
deny: ["read_file(*)", "write_file(*)", "command(*)", "mcp(*)", "read_url(*)", "execute_url(*)"]
|
|
1098
|
+
}
|
|
1099
|
+
};
|
|
1100
|
+
var StreamEvent = schema_exports.struct({ event: schema_exports.string() });
|
|
1101
|
+
var ResultEvent = schema_exports.struct({
|
|
1102
|
+
result: schema_exports.struct({ status: schema_exports.string(), response: schema_exports.optional(schema_exports.string()) })
|
|
1103
|
+
});
|
|
1104
|
+
var statusLabel = (status2) => /^[A-Z_]{1,40}$/.test(status2) ? status2 : "a failure";
|
|
1105
|
+
var parsedJson = (line) => {
|
|
1106
|
+
try {
|
|
1107
|
+
return JSON.parse(line);
|
|
1108
|
+
} catch {
|
|
1109
|
+
return null;
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
|
|
1073
1113
|
// ../cli/src/agent-presets.ts
|
|
1074
|
-
var
|
|
1114
|
+
var presetAgent = (preset, platform) => shellCommand(preset.agent.words, platform);
|
|
1115
|
+
var presetReader = (preset, platform) => preset.reader === null ? null : shellCommand(preset.reader.words, platform);
|
|
1116
|
+
var presetCommandOf = (command2, platform) => {
|
|
1117
|
+
for (const preset of AGENT_PRESETS)
|
|
1118
|
+
for (const role of ROLES) {
|
|
1119
|
+
const launch = preset[role];
|
|
1120
|
+
if (launch !== null && shellCommand(launch.words, platform) === command2.trim())
|
|
1121
|
+
return { preset, role, launch };
|
|
1122
|
+
}
|
|
1123
|
+
return null;
|
|
1124
|
+
};
|
|
1075
1125
|
var isReaderWithSomeTools = (reader) => AGENT_PRESETS.some(
|
|
1076
|
-
(preset) => preset.readerTools === "minimal" &&
|
|
1126
|
+
(preset) => preset.readerTools === "minimal" && SHELLS.some((platform) => presetReader(preset, platform) === reader.trim())
|
|
1077
1127
|
);
|
|
1128
|
+
var presetState = (preset) => {
|
|
1129
|
+
const state = preset.verifiedWith === null ? "not yet tested with the real CLI" : `verified with ${preset.verifiedWith}`;
|
|
1130
|
+
return preset.optionsSeenIn === null ? state : `${state}; options seen in ${preset.optionsSeenIn} --help`;
|
|
1131
|
+
};
|
|
1132
|
+
var shellCommand = (words, platform) => words.map((word) => shellWord(word, platform)).join(" ");
|
|
1078
1133
|
var AGENT_PRESETS = [
|
|
1079
1134
|
{
|
|
1080
1135
|
name: "claude",
|
|
1081
1136
|
program: "Claude Code",
|
|
1082
|
-
agent:
|
|
1083
|
-
|
|
1137
|
+
agent: {
|
|
1138
|
+
words: ["claude", "-p", "--permission-prompts", "none", "--settings", '{"disableAllHooks":true}'],
|
|
1139
|
+
probe: null,
|
|
1140
|
+
format: "text",
|
|
1141
|
+
withoutStrictMcp: null
|
|
1142
|
+
},
|
|
1143
|
+
reader: {
|
|
1144
|
+
words: [
|
|
1145
|
+
...["claude", "-p", "--tools", "", "--strict-mcp-config"],
|
|
1146
|
+
...["--permission-prompts", "none", "--settings", '{"disableAllHooks":true}']
|
|
1147
|
+
],
|
|
1148
|
+
probe: null,
|
|
1149
|
+
format: "text",
|
|
1150
|
+
withoutStrictMcp: [
|
|
1151
|
+
...["claude", "-p", "--tools", "", "--disallowedTools", "mcp__*"],
|
|
1152
|
+
...["--permission-prompts", "none", "--settings", '{"disableAllHooks":true}']
|
|
1153
|
+
]
|
|
1154
|
+
},
|
|
1084
1155
|
readerTools: "none",
|
|
1085
|
-
verifiedWith: "Claude Code 2.1.327"
|
|
1156
|
+
verifiedWith: "Claude Code 2.1.327",
|
|
1157
|
+
optionsSeenIn: "Claude Code 2.1.329",
|
|
1158
|
+
minimumVersion: "2.1.259",
|
|
1159
|
+
upgrade: "claude update",
|
|
1160
|
+
environment: {},
|
|
1161
|
+
signInCheck: null,
|
|
1162
|
+
mcpAttach: {
|
|
1163
|
+
words: (server) => [
|
|
1164
|
+
"--mcp-config",
|
|
1165
|
+
JSON.stringify({
|
|
1166
|
+
mcpServers: {
|
|
1167
|
+
homingbird: {
|
|
1168
|
+
type: "stdio",
|
|
1169
|
+
command: server.command,
|
|
1170
|
+
args: server.args,
|
|
1171
|
+
env: server.environment
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
}),
|
|
1175
|
+
"--strict-mcp-config"
|
|
1176
|
+
],
|
|
1177
|
+
verified: false
|
|
1178
|
+
}
|
|
1086
1179
|
},
|
|
1087
1180
|
{
|
|
1088
1181
|
name: "codex",
|
|
1089
1182
|
program: "Codex CLI",
|
|
1090
|
-
agent:
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1183
|
+
agent: {
|
|
1184
|
+
words: ["codex", "exec", "--skip-git-repo-check", "--ephemeral", "--sandbox", "workspace-write", "-"],
|
|
1185
|
+
probe: null,
|
|
1186
|
+
format: "text",
|
|
1187
|
+
withoutStrictMcp: null
|
|
1188
|
+
},
|
|
1189
|
+
reader: {
|
|
1190
|
+
words: [
|
|
1191
|
+
...[
|
|
1192
|
+
"codex",
|
|
1193
|
+
"exec",
|
|
1194
|
+
"--skip-git-repo-check",
|
|
1195
|
+
"--ephemeral",
|
|
1196
|
+
"--ignore-user-config",
|
|
1197
|
+
"--ignore-rules"
|
|
1198
|
+
],
|
|
1199
|
+
...["--sandbox", "read-only", "--disable", "shell_tool", "--disable", "unified_exec"],
|
|
1200
|
+
...["--disable", "view_image", "-c", 'web_search="disabled"'],
|
|
1201
|
+
...["-c", "features.plugins=false", "-c", "features.apps=false", "-"]
|
|
1202
|
+
],
|
|
1203
|
+
probe: {
|
|
1204
|
+
args: [
|
|
1205
|
+
...["--ignore-user-config", "-c", "features.plugins=false", "-c", "features.apps=false"],
|
|
1206
|
+
...["mcp", "list", "--json"]
|
|
1207
|
+
],
|
|
1208
|
+
timeoutMs: 15e3,
|
|
1209
|
+
wordsFrom: (printed) => codexServersSwitchedOff(printed)
|
|
1210
|
+
},
|
|
1211
|
+
format: "text",
|
|
1212
|
+
withoutStrictMcp: null
|
|
1213
|
+
},
|
|
1096
1214
|
readerTools: "minimal",
|
|
1097
|
-
verifiedWith: null
|
|
1215
|
+
verifiedWith: null,
|
|
1216
|
+
optionsSeenIn: null,
|
|
1217
|
+
minimumVersion: null,
|
|
1218
|
+
upgrade: "npm install -g @openai/codex@latest",
|
|
1219
|
+
environment: {},
|
|
1220
|
+
signInCheck: null,
|
|
1221
|
+
mcpAttach: {
|
|
1222
|
+
words: (server) => ["-c", `mcp_servers.homingbird=${codexServerTable(server)}`],
|
|
1223
|
+
verified: false
|
|
1224
|
+
}
|
|
1098
1225
|
},
|
|
1099
1226
|
{
|
|
1100
1227
|
name: "antigravity",
|
|
1101
1228
|
program: "Antigravity CLI (agy)",
|
|
1102
|
-
agent:
|
|
1103
|
-
reader:
|
|
1104
|
-
|
|
1105
|
-
|
|
1229
|
+
agent: { words: ANTIGRAVITY_PRINT, probe: null, format: "antigravity-stream", withoutStrictMcp: null },
|
|
1230
|
+
reader: {
|
|
1231
|
+
words: [...ANTIGRAVITY_PRINT, "--settings", JSON.stringify(ANTIGRAVITY_READER_SETTINGS)],
|
|
1232
|
+
probe: {
|
|
1233
|
+
args: ["--help"],
|
|
1234
|
+
timeoutMs: 1e4,
|
|
1235
|
+
wordsFrom: (printed) => antigravitySettingsOffered(printed)
|
|
1236
|
+
},
|
|
1237
|
+
format: "antigravity-stream",
|
|
1238
|
+
withoutStrictMcp: null
|
|
1239
|
+
},
|
|
1240
|
+
readerTools: "minimal",
|
|
1241
|
+
verifiedWith: null,
|
|
1242
|
+
optionsSeenIn: null,
|
|
1243
|
+
minimumVersion: "1.1.15",
|
|
1244
|
+
upgrade: "install the latest Antigravity CLI (agy)",
|
|
1245
|
+
environment: { AGY_CLI_DISABLE_AUTO_UPDATE: "true" },
|
|
1246
|
+
signInCheck: {
|
|
1247
|
+
args: ["-p", "/usage", "--output-format", "json", "--print-timeout", "15s"],
|
|
1248
|
+
timeoutMs: 2e4,
|
|
1249
|
+
problem: "Antigravity did not answer within 20 seconds, or is not signed in on this computer. Sign in first: run `agy` in a terminal, then start this again."
|
|
1250
|
+
},
|
|
1251
|
+
mcpAttach: null
|
|
1106
1252
|
},
|
|
1107
1253
|
{
|
|
1108
1254
|
name: "gemini",
|
|
1109
1255
|
program: "Gemini CLI, legacy: Code Assist Standard or Enterprise, or an API key",
|
|
1110
|
-
agent:
|
|
1256
|
+
agent: {
|
|
1257
|
+
words: ["gemini", "-p", "", "--output-format", "text", "--approval-mode", "default"],
|
|
1258
|
+
probe: null,
|
|
1259
|
+
format: "text",
|
|
1260
|
+
withoutStrictMcp: null
|
|
1261
|
+
},
|
|
1111
1262
|
reader: null,
|
|
1112
1263
|
readerTools: null,
|
|
1113
|
-
verifiedWith: null
|
|
1264
|
+
verifiedWith: null,
|
|
1265
|
+
optionsSeenIn: null,
|
|
1266
|
+
minimumVersion: null,
|
|
1267
|
+
upgrade: "npm install -g @google/gemini-cli@latest",
|
|
1268
|
+
environment: {},
|
|
1269
|
+
signInCheck: null,
|
|
1270
|
+
mcpAttach: null
|
|
1271
|
+
}
|
|
1272
|
+
];
|
|
1273
|
+
var ROLES = ["agent", "reader"];
|
|
1274
|
+
var antigravitySettingsOffered = (printed) => printed.exitCode === 0 && /^\s*--settings(?:[= \t]|$)/m.test(printed.output) ? result_exports.ok([]) : result_exports.err("agy --help does not list --settings, which the reader needs to deny every tool");
|
|
1275
|
+
var SHELLS = ["linux", "win32"];
|
|
1276
|
+
var PLAIN_WORD = /^[\w@+=:,./-]+$/;
|
|
1277
|
+
var shellWord = (word, platform) => {
|
|
1278
|
+
if (PLAIN_WORD.test(word)) return word;
|
|
1279
|
+
if (platform === "win32") return `"${word.replace(/(\\*)"/g, '$1$1\\"').replace(/(\\+)$/, "$1$1")}"`;
|
|
1280
|
+
return `'${word.replace(/'/g, `'\\''`)}'`;
|
|
1281
|
+
};
|
|
1282
|
+
var codexServersSwitchedOff = (printed) => {
|
|
1283
|
+
if (printed.exitCode !== 0)
|
|
1284
|
+
return result_exports.err(`codex mcp list exited with code ${printed.exitCode ?? "unknown"}`);
|
|
1285
|
+
const listed = CodexServers.read(jsonArrayIn(printed.output));
|
|
1286
|
+
if (listed._tag === "Err") return result_exports.err("codex mcp list --json printed no list of servers");
|
|
1287
|
+
return result_exports.ok(
|
|
1288
|
+
listed.value.flatMap((server) => ["-c", `mcp_servers.${JSON.stringify(server.name)}.enabled=false`])
|
|
1289
|
+
);
|
|
1290
|
+
};
|
|
1291
|
+
var codexServerTable = (server) => {
|
|
1292
|
+
const variables2 = Object.entries(server.environment).map(
|
|
1293
|
+
([name, value]) => `${name}=${JSON.stringify(value)}`
|
|
1294
|
+
);
|
|
1295
|
+
return `{command=${JSON.stringify(server.command)},args=[${server.args.map((arg) => JSON.stringify(arg)).join(",")}],env={${variables2.join(",")}}}`;
|
|
1296
|
+
};
|
|
1297
|
+
var CodexServers = schema_exports.array(schema_exports.struct({ name: schema_exports.string({ minLength: 1 }) }));
|
|
1298
|
+
var jsonArrayIn = (output) => {
|
|
1299
|
+
const start = output.indexOf("[");
|
|
1300
|
+
const end = output.lastIndexOf("]");
|
|
1301
|
+
if (start === -1 || end < start) return null;
|
|
1302
|
+
try {
|
|
1303
|
+
return JSON.parse(output.slice(start, end + 1));
|
|
1304
|
+
} catch {
|
|
1305
|
+
return null;
|
|
1306
|
+
}
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1309
|
+
// ../cli/src/agent-environment.ts
|
|
1310
|
+
var agentEnvironment = (variables2, secrets) => Object.fromEntries(
|
|
1311
|
+
Object.entries(variables2).flatMap(
|
|
1312
|
+
([name, value]) => value === void 0 || isWithheld(name, value, secrets) ? [] : [[name, value]]
|
|
1313
|
+
)
|
|
1314
|
+
);
|
|
1315
|
+
var PERSON_CLAUDE_CODE_VARIABLES = /* @__PURE__ */ new Set([
|
|
1316
|
+
"CLAUDE_CODE_OAUTH_TOKEN",
|
|
1317
|
+
"CLAUDE_CODE_USE_BEDROCK",
|
|
1318
|
+
"CLAUDE_CODE_USE_VERTEX",
|
|
1319
|
+
"CLAUDE_CODE_GIT_BASH_PATH",
|
|
1320
|
+
"CLAUDE_CODE_MAX_OUTPUT_TOKENS",
|
|
1321
|
+
"CLAUDE_CODE_SKIP_BEDROCK_AUTH",
|
|
1322
|
+
"CLAUDE_CODE_SKIP_VERTEX_AUTH"
|
|
1323
|
+
]);
|
|
1324
|
+
var PARENT_SESSION_VARIABLES = /* @__PURE__ */ new Set([
|
|
1325
|
+
"CLAUDECODE",
|
|
1326
|
+
"CLAUDE_EFFORT",
|
|
1327
|
+
"CLAUDE_PID",
|
|
1328
|
+
"MCP_SERVER_CONNECTION_BATCH_SIZE",
|
|
1329
|
+
"CODEX_THREAD_ID",
|
|
1330
|
+
"CODEX_SESSION_ID",
|
|
1331
|
+
"CODEX_TOOL_CALL_ID",
|
|
1332
|
+
"CODEX_VERSION",
|
|
1333
|
+
"CODEX_CI",
|
|
1334
|
+
"CODEX_PERMISSION_PROFILE"
|
|
1335
|
+
]);
|
|
1336
|
+
var PARENT_SESSION_PREFIXES = ["CLAUDE_CODE_", "CLAUDE_AGENT_SDK_", "CLAUDE_PREVIEW_"];
|
|
1337
|
+
var isParentSession = (name) => {
|
|
1338
|
+
const upper = name.toUpperCase();
|
|
1339
|
+
if (PARENT_SESSION_VARIABLES.has(upper)) return true;
|
|
1340
|
+
return PARENT_SESSION_PREFIXES.some((prefix) => upper.startsWith(prefix)) && !PERSON_CLAUDE_CODE_VARIABLES.has(upper);
|
|
1341
|
+
};
|
|
1342
|
+
var WITHHELD_NAME = /^(?:HOMINGBIRD|HB)_/i;
|
|
1343
|
+
var isWithheld = (name, value, secrets) => WITHHELD_NAME.test(name) || isParentSession(name) || secrets.some((secret) => secret !== "" && value.includes(secret));
|
|
1344
|
+
|
|
1345
|
+
// ../cli/src/agent-install-directories.ts
|
|
1346
|
+
var withAgentInstallDirectories = (variables2, platform) => {
|
|
1347
|
+
if (platform !== "win32") return variables2;
|
|
1348
|
+
const name = Object.keys(variables2).find((each) => each.toUpperCase() === "PATH");
|
|
1349
|
+
return name === void 0 ? variables2 : { ...variables2, [name]: agentSearchPath(variables2, platform) };
|
|
1350
|
+
};
|
|
1351
|
+
var agentSearchPath = (variables2, platform) => {
|
|
1352
|
+
const name = Object.keys(variables2).find((each) => each.toUpperCase() === "PATH");
|
|
1353
|
+
const path = name === void 0 ? void 0 : variables2[name];
|
|
1354
|
+
if (platform !== "win32" || path === void 0) return path;
|
|
1355
|
+
const listed = path.split(";").filter((directory2) => directory2 !== "");
|
|
1356
|
+
const added = installDirectories(variables2).filter(
|
|
1357
|
+
(directory2) => !listed.some((each) => each.toLowerCase() === directory2.toLowerCase())
|
|
1358
|
+
);
|
|
1359
|
+
return [...listed, ...added].join(";");
|
|
1360
|
+
};
|
|
1361
|
+
var installDirectories = (variables2) => {
|
|
1362
|
+
const profile = variables2.USERPROFILE;
|
|
1363
|
+
const local = variables2.LOCALAPPDATA ?? (profile === void 0 ? void 0 : `${profile}\\AppData\\Local`);
|
|
1364
|
+
const roaming = variables2.APPDATA ?? (profile === void 0 ? void 0 : `${profile}\\AppData\\Roaming`);
|
|
1365
|
+
return [
|
|
1366
|
+
...profile === void 0 ? [] : [`${profile}\\.local\\bin`],
|
|
1367
|
+
...local === void 0 ? [] : [`${local}\\Programs\\OpenAI\\Codex\\bin`, `${local}\\agy\\bin`],
|
|
1368
|
+
...roaming === void 0 ? [] : [`${roaming}\\npm`]
|
|
1369
|
+
];
|
|
1370
|
+
};
|
|
1371
|
+
|
|
1372
|
+
// ../cli/src/program-paths.ts
|
|
1373
|
+
var resolvedProgram = (command2, path) => task_exports.gen(function* () {
|
|
1374
|
+
const env = yield* task_exports.ask();
|
|
1375
|
+
const program = programWord(command2);
|
|
1376
|
+
if (program === null) return null;
|
|
1377
|
+
const pathExtensions = env.variables.PATHEXT ?? null;
|
|
1378
|
+
for (const candidate of candidatesFor(program, path, env.platform, pathExtensions, env.homeDirectory)) {
|
|
1379
|
+
if (yield* task_exports.promise(() => env.programs.isRunnable(candidate))) return yield* lastingPathOf(candidate);
|
|
1114
1380
|
}
|
|
1381
|
+
return null;
|
|
1382
|
+
});
|
|
1383
|
+
var lastingPathOf = (path) => versionManagerOf(path)?.isTemporary === true ? realPathOf(path) : task_exports.succeed(path);
|
|
1384
|
+
var candidatesFor = (program, path, platform, pathExtensions, home = null) => {
|
|
1385
|
+
const isWindows = platform === "win32";
|
|
1386
|
+
const located = isWindows ? program : expandHome(program, home);
|
|
1387
|
+
const names = isWindows && !/\.[^.\\/]+$/.test(program) ? (pathExtensions ?? DEFAULT_PATHEXT).split(";").filter((extension) => extension !== "").map((extension) => `${located}${extension.toLowerCase()}`) : [located];
|
|
1388
|
+
if (/[\\/]/.test(located)) return isAbsolute(located, isWindows) ? names : [];
|
|
1389
|
+
return path.split(isWindows ? ";" : ":").map(
|
|
1390
|
+
(directory2) => isWindows ? directory2.trim().replace(/^"(.*)"$/, "$1") : expandHome(directory2, home)
|
|
1391
|
+
).filter((directory2) => directory2 !== "").flatMap(
|
|
1392
|
+
(directory2) => names.map((name) => `${directory2.replace(/[\\/]+$/, "")}${isWindows ? "\\" : "/"}${name}`)
|
|
1393
|
+
);
|
|
1394
|
+
};
|
|
1395
|
+
var programWord = (command2) => {
|
|
1396
|
+
const first = command2.trim().split(/\s+/)[0] ?? "";
|
|
1397
|
+
return /^[A-Za-z0-9._+\-\\/:~]+$/.test(first) && !first.includes("=") ? first : null;
|
|
1398
|
+
};
|
|
1399
|
+
var versionManagerOf = (path) => VERSION_MANAGERS.find((manager) => manager.pattern.test(path)) ?? null;
|
|
1400
|
+
var VERSION_MANAGERS = [
|
|
1401
|
+
{ name: "fnm", pattern: /[\\/]fnm_multishells[\\/]/i, isTemporary: true },
|
|
1402
|
+
{ name: "fnm", pattern: /[\\/]\.?fnm[\\/]/i, isTemporary: false },
|
|
1403
|
+
{ name: "nvm", pattern: /[\\/]\.?nvm[\\/]/i, isTemporary: false },
|
|
1404
|
+
{ name: "Volta", pattern: /[\\/]\.?volta[\\/]/i, isTemporary: false },
|
|
1405
|
+
{ name: "asdf", pattern: /[\\/]\.asdf[\\/]/i, isTemporary: false },
|
|
1406
|
+
{ name: "mise", pattern: /[\\/]mise[\\/](installs|shims)[\\/]/i, isTemporary: false }
|
|
1115
1407
|
];
|
|
1408
|
+
var DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD";
|
|
1409
|
+
var expandHome = (path, home) => home !== null && (path === "~" || path.startsWith("~/")) ? `${home}${path.slice(1)}` : path;
|
|
1410
|
+
var isAbsolute = (program, isWindows) => isWindows ? /^([A-Za-z]:)?[\\/]/.test(program) : program.startsWith("/");
|
|
1411
|
+
var realPathOf = (path) => task_exports.gen(function* () {
|
|
1412
|
+
const env = yield* task_exports.ask();
|
|
1413
|
+
return (yield* task_exports.promise(() => env.programs.realPath(path))) ?? path;
|
|
1414
|
+
});
|
|
1415
|
+
|
|
1416
|
+
// ../cli/src/windows-shell.ts
|
|
1417
|
+
var cmdCommand = (systemRoot, command2) => [
|
|
1418
|
+
`${systemRoot}\\System32\\cmd.exe`,
|
|
1419
|
+
["/d", "/v:off", "/s", "/c", `"${command2}"`]
|
|
1420
|
+
];
|
|
1421
|
+
|
|
1422
|
+
// ../cli/src/agent-probe.ts
|
|
1423
|
+
var presetAsked = (preset, args, timeoutMs) => task_exports.gen(function* () {
|
|
1424
|
+
const env = yield* task_exports.ask();
|
|
1425
|
+
const variables2 = withAgentInstallDirectories(env.variables, env.platform);
|
|
1426
|
+
const environment = {
|
|
1427
|
+
...agentEnvironment(variables2, [env.credentialsFile ?? ""]),
|
|
1428
|
+
...preset.environment
|
|
1429
|
+
};
|
|
1430
|
+
const name = preset.agent.words[0];
|
|
1431
|
+
const path = agentSearchPath(env.variables, env.platform);
|
|
1432
|
+
const found = path === void 0 ? null : yield* resolvedProgram(name, path);
|
|
1433
|
+
const program = found ?? name;
|
|
1434
|
+
const [command2, words, verbatim] = env.platform === "win32" && /\.(?:cmd|bat)$/i.test(program) ? [
|
|
1435
|
+
...cmdCommand(variables2.SystemRoot ?? "C:\\Windows", shellCommand([program, ...args], "win32")),
|
|
1436
|
+
true
|
|
1437
|
+
] : [program, args, false];
|
|
1438
|
+
const finished = yield* task_exports.result(
|
|
1439
|
+
task_exports.tryPromise(
|
|
1440
|
+
(signal) => env.processes.run(command2, words, {
|
|
1441
|
+
environment,
|
|
1442
|
+
timeoutMs,
|
|
1443
|
+
signal,
|
|
1444
|
+
...verbatim && { windowsVerbatimArguments: true }
|
|
1445
|
+
}),
|
|
1446
|
+
() => null
|
|
1447
|
+
)
|
|
1448
|
+
);
|
|
1449
|
+
return finished._tag === "Ok" ? finished.value : { exitCode: null, output: "" };
|
|
1450
|
+
});
|
|
1451
|
+
|
|
1452
|
+
// ../cli/src/agent-version.ts
|
|
1453
|
+
var presetVersion = (preset) => task_exports.gen(function* () {
|
|
1454
|
+
const asked = yield* presetAsked(preset, ["--version"], VERSION_TIMEOUT_MS);
|
|
1455
|
+
if (asked.exitCode === null) return { status: "missing", version: null };
|
|
1456
|
+
const version = asked.exitCode === 0 ? versionIn(asked.output) : null;
|
|
1457
|
+
if (version === null) return { status: "unknown", version: null };
|
|
1458
|
+
const minimum = preset.minimumVersion;
|
|
1459
|
+
return minimum !== null && isOlder(version, minimum) ? { status: "too_old", version } : { status: "supported", version };
|
|
1460
|
+
});
|
|
1461
|
+
var versionLine = (preset, check) => {
|
|
1462
|
+
const needs = preset.minimumVersion === null ? "" : `, needs ${preset.minimumVersion} or later`;
|
|
1463
|
+
switch (check.status) {
|
|
1464
|
+
case "missing":
|
|
1465
|
+
return `not found on this PATH${needs}`;
|
|
1466
|
+
case "unknown":
|
|
1467
|
+
return `installed, version not readable${needs}`;
|
|
1468
|
+
case "too_old":
|
|
1469
|
+
return `${check.version}, too old${needs}: ${preset.upgrade}`;
|
|
1470
|
+
case "supported":
|
|
1471
|
+
return `${check.version}${needs}`;
|
|
1472
|
+
}
|
|
1473
|
+
};
|
|
1474
|
+
var versionIn = (printed) => printed.match(/\b(\d+)\.(\d+)\.(\d+)\b/)?.[0] ?? null;
|
|
1475
|
+
var isOlder = (version, minimum) => {
|
|
1476
|
+
const [a, b] = [version, minimum].map((each) => each.split(".").map(Number));
|
|
1477
|
+
for (let index = 0; index < 3; index++) if (a[index] !== b[index]) return a[index] < b[index];
|
|
1478
|
+
return false;
|
|
1479
|
+
};
|
|
1480
|
+
var VERSION_TIMEOUT_MS = 5e3;
|
|
1116
1481
|
|
|
1117
1482
|
// ../cli/src/failure.ts
|
|
1118
1483
|
var CliFailure = tagged("CliFailure")();
|
|
@@ -1121,6 +1486,24 @@ var failed = (message) => CliFailure({ message, exitCode: EXIT.failed });
|
|
|
1121
1486
|
var fromApiError = (error) => error._tag === "Unauthorized" ? CliFailure({ message: SIGNED_OUT_MESSAGE, exitCode: EXIT.signedOut }) : CliFailure({ message: error.message, exitCode: EXIT.failed });
|
|
1122
1487
|
var SIGNED_OUT_MESSAGE = "Not signed in. Run `homingbird login --server <url>` first.";
|
|
1123
1488
|
|
|
1489
|
+
// ../cli/src/agent-launch.ts
|
|
1490
|
+
var launchesAsGiven = (settings, platform) => ({
|
|
1491
|
+
agent: unprobed(settings.agent, platform),
|
|
1492
|
+
reader: settings.split === null ? null : unprobed(settings.split.reader, platform),
|
|
1493
|
+
installed: []
|
|
1494
|
+
});
|
|
1495
|
+
var unprobed = (command2, platform) => {
|
|
1496
|
+
const match = presetCommandOf(command2, platform);
|
|
1497
|
+
if (match === null) return launchAsGiven(command2);
|
|
1498
|
+
return { ...launchAsGiven(command2), format: match.launch.format, environment: match.preset.environment };
|
|
1499
|
+
};
|
|
1500
|
+
var launchAsGiven = (command2) => ({
|
|
1501
|
+
command: command2,
|
|
1502
|
+
format: "text",
|
|
1503
|
+
environment: {},
|
|
1504
|
+
withoutStrictMcp: null
|
|
1505
|
+
});
|
|
1506
|
+
|
|
1124
1507
|
// ../cli/src/arguments.ts
|
|
1125
1508
|
var RUN_TIMEOUT_DEFAULT_SECONDS = 300;
|
|
1126
1509
|
|
|
@@ -2176,6 +2559,7 @@ var NoteBasis = schema_exports.string({ maxLength: NOTE_BASIS_MAX });
|
|
|
2176
2559
|
var PROFILE_MAX = 500;
|
|
2177
2560
|
var Role = schema_exports.tolerant(schema_exports.literal("member", "admin"), UNKNOWN);
|
|
2178
2561
|
var MemberStatus = schema_exports.tolerant(schema_exports.literal("active", "deactivated"), UNKNOWN);
|
|
2562
|
+
var MemberKind = schema_exports.tolerant(schema_exports.literal("person", "channel_agent"), UNKNOWN);
|
|
2179
2563
|
var LOCALES = ["en", "ko"];
|
|
2180
2564
|
var Locale = schema_exports.tolerant(schema_exports.literal(...LOCALES), UNKNOWN);
|
|
2181
2565
|
var DEFAULT_LOCALE = "en";
|
|
@@ -2186,6 +2570,7 @@ var Member = schema_exports.struct({
|
|
|
2186
2570
|
profile: schema_exports.string({ maxLength: PROFILE_MAX }),
|
|
2187
2571
|
role: Role,
|
|
2188
2572
|
status: MemberStatus,
|
|
2573
|
+
kind: MemberKind,
|
|
2189
2574
|
createdAt: Timestamp,
|
|
2190
2575
|
character: schema_exports.nullable(schema_exports.tolerant(CharacterSpec, null))
|
|
2191
2576
|
});
|
|
@@ -2203,6 +2588,10 @@ var Channel = schema_exports.struct({
|
|
|
2203
2588
|
answering: schema_exports.boolean,
|
|
2204
2589
|
managing: schema_exports.boolean,
|
|
2205
2590
|
managedBy: GroupId,
|
|
2591
|
+
/** The channel's own agent, with the `channelAgents` feature on. */
|
|
2592
|
+
agent: schema_exports.optional(schema_exports.nullable(schema_exports.struct({ id: MemberId, name: schema_exports.string({ maxLength: 200 }) }))),
|
|
2593
|
+
/** Whether the viewer manages the channel themself, and so runs its agent and reviews its answers. */
|
|
2594
|
+
runsAgent: schema_exports.optional(schema_exports.boolean),
|
|
2206
2595
|
createdAt: Timestamp
|
|
2207
2596
|
});
|
|
2208
2597
|
var ChannelMember = schema_exports.struct({ memberId: MemberId, answering: schema_exports.boolean, manager: schema_exports.boolean });
|
|
@@ -2254,6 +2643,8 @@ var Note = schema_exports.struct({
|
|
|
2254
2643
|
basis: schema_exports.optional(schema_exports.nullable(NoteBasis)),
|
|
2255
2644
|
agentClient: schema_exports.optional(schema_exports.nullable(AgentLabel)),
|
|
2256
2645
|
agentModel: schema_exports.optional(schema_exports.nullable(AgentLabel)),
|
|
2646
|
+
/** The person who approved a channel's agent's note; its author is the agent. */
|
|
2647
|
+
approvedBy: schema_exports.optional(schema_exports.nullable(MemberId)),
|
|
2257
2648
|
/** A debate room's approved result, posted by a person whose agent took part: which room, which agents. */
|
|
2258
2649
|
fromDebate: schema_exports.optional(
|
|
2259
2650
|
schema_exports.struct({
|
|
@@ -2300,8 +2691,13 @@ var Conversation = schema_exports.struct({
|
|
|
2300
2691
|
lastNote: schema_exports.nullable(Note),
|
|
2301
2692
|
unreadCount: schema_exports.int({ min: 0 }),
|
|
2302
2693
|
draftCount: schema_exports.int({ min: 0 }),
|
|
2303
|
-
archivedAt: schema_exports.nullable(Timestamp)
|
|
2694
|
+
archivedAt: schema_exports.nullable(Timestamp),
|
|
2695
|
+
/** A question asked privately of this channel's agent: its managers, now and later, take part. */
|
|
2696
|
+
privateQuestionOf: schema_exports.optional(schema_exports.nullable(ChannelSlug)),
|
|
2697
|
+
muted: schema_exports.optional(schema_exports.boolean)
|
|
2304
2698
|
});
|
|
2699
|
+
var NOTIFICATION_LEVELS = ["all", "direct", "none"];
|
|
2700
|
+
var NotificationLevel = schema_exports.tolerant(schema_exports.literal(...NOTIFICATION_LEVELS), UNKNOWN);
|
|
2305
2701
|
var CredentialKind = schema_exports.tolerant(schema_exports.literal("human", "agent"), UNKNOWN);
|
|
2306
2702
|
var Credential = schema_exports.struct({
|
|
2307
2703
|
id: CredentialId,
|
|
@@ -2350,6 +2746,37 @@ var Group = schema_exports.struct({
|
|
|
2350
2746
|
createdAt: Timestamp
|
|
2351
2747
|
});
|
|
2352
2748
|
|
|
2749
|
+
// ../protocol/src/channel-agents.ts
|
|
2750
|
+
var CHANNEL_AGENT_NAME_MAX = 80;
|
|
2751
|
+
var ChannelAgentName = schema_exports.refine(
|
|
2752
|
+
"channel-agent-name",
|
|
2753
|
+
(text) => text.trim() !== "" && !/[\p{Cc}\p{Cf}]/u.test(text),
|
|
2754
|
+
"expected one line of printable text"
|
|
2755
|
+
)(schema_exports.string({ minLength: 1, maxLength: CHANNEL_AGENT_NAME_MAX }));
|
|
2756
|
+
var AgentCredential = schema_exports.struct({
|
|
2757
|
+
id: CredentialId,
|
|
2758
|
+
name: schema_exports.string({ maxLength: 200 }),
|
|
2759
|
+
client: schema_exports.string({ maxLength: 200 }),
|
|
2760
|
+
createdAt: Timestamp,
|
|
2761
|
+
expiresAt: Timestamp,
|
|
2762
|
+
lastUsedAt: schema_exports.nullable(Timestamp),
|
|
2763
|
+
revokedAt: schema_exports.nullable(Timestamp),
|
|
2764
|
+
issuedBy: schema_exports.nullable(MemberId)
|
|
2765
|
+
});
|
|
2766
|
+
var ChannelAgent = schema_exports.struct({
|
|
2767
|
+
agent: Member,
|
|
2768
|
+
channel: ChannelSlug,
|
|
2769
|
+
credentials: schema_exports.array(AgentCredential, { maxItems: 200 })
|
|
2770
|
+
});
|
|
2771
|
+
var Review = schema_exports.struct({
|
|
2772
|
+
note: Note,
|
|
2773
|
+
question: schema_exports.nullable(Note),
|
|
2774
|
+
channel: ChannelSlug,
|
|
2775
|
+
agent: Member,
|
|
2776
|
+
privately: schema_exports.boolean
|
|
2777
|
+
});
|
|
2778
|
+
var AgentListing = schema_exports.struct({ member: Member, channel: schema_exports.nullable(ChannelSlug) });
|
|
2779
|
+
|
|
2353
2780
|
// ../protocol/src/character-link.ts
|
|
2354
2781
|
var characterLink = (webClientUrl, spec) => `${webClientUrl.replace(/\/+$/, "")}/#/${CHARACTER_ROUTE}/${encodeCharacter(spec)}`;
|
|
2355
2782
|
var CHARACTER_ROUTE = "character";
|
|
@@ -2483,11 +2910,12 @@ var EventBody = schema_exports.openVariants(
|
|
|
2483
2910
|
"channel.left": { slug: ChannelSlug, conversationId: ConversationId },
|
|
2484
2911
|
"debate.changed": { debateId: DebateId, participantIds: schema_exports.array(MemberId, { maxItems: 8 }) },
|
|
2485
2912
|
"group.changed": { groupId: GroupId },
|
|
2913
|
+
"review.changed": { noteId: schema_exports.nullable(NoteId) },
|
|
2486
2914
|
resync: {}
|
|
2487
2915
|
},
|
|
2488
2916
|
UNKNOWN_EVENT
|
|
2489
2917
|
);
|
|
2490
|
-
var
|
|
2918
|
+
var StreamEvent2 = schema_exports.struct({
|
|
2491
2919
|
seq: schema_exports.int({ min: 0 }),
|
|
2492
2920
|
at: schema_exports.int({ min: 0 }),
|
|
2493
2921
|
body: EventBody
|
|
@@ -2519,13 +2947,22 @@ var fillPath = (path, params) => path.replace(/:([A-Za-z]+)/g, (_, key) => {
|
|
|
2519
2947
|
var Empty = schema_exports.struct({});
|
|
2520
2948
|
var Digits = schema_exports.string({ pattern: /^[0-9]{1,15}$/ });
|
|
2521
2949
|
var PageLimit = schema_exports.string({ pattern: /^[0-9]{1,3}$/ });
|
|
2522
|
-
var
|
|
2950
|
+
var RECIPIENTS_MAX = 50;
|
|
2951
|
+
var Recipients = schema_exports.array(MemberId, { minItems: 1, maxItems: RECIPIENTS_MAX });
|
|
2952
|
+
var DraftAsShown = schema_exports.struct({ body: NoteBody, conversationId: ConversationId });
|
|
2523
2953
|
var InboxItem = schema_exports.struct({ note: Note, author: Member, conversation: Conversation });
|
|
2524
2954
|
var DeviceRequest = schema_exports.struct({
|
|
2525
2955
|
userCode: schema_exports.string(),
|
|
2526
2956
|
client: schema_exports.string(),
|
|
2527
2957
|
expiresAt: schema_exports.int({ min: 0 })
|
|
2528
2958
|
});
|
|
2959
|
+
var JoinCode = schema_exports.struct({
|
|
2960
|
+
code: schema_exports.string(),
|
|
2961
|
+
serverUrl: schema_exports.string(),
|
|
2962
|
+
expiresAt: schema_exports.int({ min: 0 }),
|
|
2963
|
+
/** How long it still works, so a client counts down from its own clock, not the server's. */
|
|
2964
|
+
expiresInSeconds: schema_exports.optional(schema_exports.int({ min: 0 }))
|
|
2965
|
+
});
|
|
2529
2966
|
var ConsentRequest = schema_exports.struct({
|
|
2530
2967
|
id: schema_exports.string(),
|
|
2531
2968
|
client: schema_exports.string(),
|
|
@@ -2544,7 +2981,8 @@ var Me = schema_exports.struct({
|
|
|
2544
2981
|
member: Member,
|
|
2545
2982
|
credential: schema_exports.struct({ id: CredentialId, kind: CredentialKind, name: schema_exports.string() }),
|
|
2546
2983
|
contactMode: ContactMode,
|
|
2547
|
-
locale: schema_exports.optional(Locale)
|
|
2984
|
+
locale: schema_exports.optional(Locale),
|
|
2985
|
+
notifications: schema_exports.optional(NotificationLevel)
|
|
2548
2986
|
});
|
|
2549
2987
|
|
|
2550
2988
|
// ../protocol/src/analytics-values.ts
|
|
@@ -2555,11 +2993,13 @@ var ANALYTICS_PAGES = [
|
|
|
2555
2993
|
"group",
|
|
2556
2994
|
"channels",
|
|
2557
2995
|
"channel",
|
|
2996
|
+
"channel-agent",
|
|
2558
2997
|
"debates",
|
|
2559
2998
|
"debate",
|
|
2560
2999
|
"search",
|
|
2561
3000
|
"profile",
|
|
2562
3001
|
"agent",
|
|
3002
|
+
"measured",
|
|
2563
3003
|
"character",
|
|
2564
3004
|
"device",
|
|
2565
3005
|
"consent",
|
|
@@ -2812,13 +3252,23 @@ var AgentPeriod = schema_exports.struct({
|
|
|
2812
3252
|
previous: AgentFigures
|
|
2813
3253
|
});
|
|
2814
3254
|
var TrustWeek = schema_exports.struct({ start: Timestamp, decided: count, sentAsWritten: count });
|
|
3255
|
+
var WeekFigures = schema_exports.struct({
|
|
3256
|
+
notesSent: count,
|
|
3257
|
+
repliesReceived: count,
|
|
3258
|
+
/** The typical time from a colleague's new note to the person's first reply to it. */
|
|
3259
|
+
medianReplyMs: schema_exports.nullable(count),
|
|
3260
|
+
/** Answers of channels' agents the person approved as a manager, never counted as notes they sent. */
|
|
3261
|
+
approvedForChannels: schema_exports.optional(count)
|
|
3262
|
+
});
|
|
3263
|
+
var YourWeek = schema_exports.struct({ days: schema_exports.int({ min: 1 }), current: WeekFigures, previous: WeekFigures });
|
|
2815
3264
|
var AgentReport = schema_exports.struct({
|
|
2816
3265
|
generatedAt: Timestamp,
|
|
2817
3266
|
quickApprovalSeconds: schema_exports.int({ min: 1 }),
|
|
2818
3267
|
minimumDecided: schema_exports.int({ min: 1 }),
|
|
2819
3268
|
periods: schema_exports.array(AgentPeriod),
|
|
2820
3269
|
weeks: schema_exports.array(TrustWeek),
|
|
2821
|
-
sessions: SessionHealth
|
|
3270
|
+
sessions: SessionHealth,
|
|
3271
|
+
week: schema_exports.optional(YourWeek)
|
|
2822
3272
|
});
|
|
2823
3273
|
var PlaceTotals = schema_exports.struct({
|
|
2824
3274
|
place: PlaceName,
|
|
@@ -2828,6 +3278,31 @@ var PlaceTotals = schema_exports.struct({
|
|
|
2828
3278
|
discarded: schema_exports.nullable(count),
|
|
2829
3279
|
skipped: count
|
|
2830
3280
|
});
|
|
3281
|
+
var Authorship = schema_exports.struct({ agent: count, humanEdited: count, human: count });
|
|
3282
|
+
var Delivery = schema_exports.struct({
|
|
3283
|
+
received: schema_exports.nullable(count),
|
|
3284
|
+
toAgents: count,
|
|
3285
|
+
pickedUpQuickly: count,
|
|
3286
|
+
medianPickupMs: schema_exports.nullable(count),
|
|
3287
|
+
waitedWithoutAgent: count
|
|
3288
|
+
});
|
|
3289
|
+
var TeamTotals = schema_exports.struct({
|
|
3290
|
+
team: schema_exports.string({ minLength: 1, maxLength: 80 }),
|
|
3291
|
+
activeMembers: schema_exports.nullable(count),
|
|
3292
|
+
notesSent: schema_exports.nullable(count),
|
|
3293
|
+
sentAsWritten: schema_exports.nullable(count),
|
|
3294
|
+
sentAfterEdits: schema_exports.nullable(count),
|
|
3295
|
+
discarded: schema_exports.nullable(count),
|
|
3296
|
+
quickApprovals: schema_exports.nullable(count),
|
|
3297
|
+
medianDecisionMs: schema_exports.nullable(count),
|
|
3298
|
+
skipped: count
|
|
3299
|
+
});
|
|
3300
|
+
var ChannelAgentTotals = schema_exports.struct({
|
|
3301
|
+
written: count,
|
|
3302
|
+
sentAsWritten: count,
|
|
3303
|
+
sentAfterEdits: count,
|
|
3304
|
+
discarded: count
|
|
3305
|
+
});
|
|
2831
3306
|
var OrganizationFigures = schema_exports.struct({
|
|
2832
3307
|
activeMembers: count,
|
|
2833
3308
|
notesSent: count,
|
|
@@ -2846,20 +3321,63 @@ var OrganizationFigures = schema_exports.struct({
|
|
|
2846
3321
|
hiddenPlaces: count,
|
|
2847
3322
|
byClient: schema_exports.array(OrganizationLabelTotals),
|
|
2848
3323
|
byModel: schema_exports.array(OrganizationLabelTotals),
|
|
2849
|
-
hiddenLabels: count
|
|
3324
|
+
hiddenLabels: count,
|
|
3325
|
+
medianDecisionMs: schema_exports.optional(schema_exports.nullable(count)),
|
|
3326
|
+
authorship: schema_exports.optional(schema_exports.nullable(Authorship)),
|
|
3327
|
+
delivery: schema_exports.optional(schema_exports.nullable(Delivery)),
|
|
3328
|
+
channelAgents: schema_exports.optional(schema_exports.nullable(ChannelAgentTotals)),
|
|
3329
|
+
teams: schema_exports.optional(schema_exports.array(TeamTotals)),
|
|
3330
|
+
hiddenTeams: schema_exports.optional(count)
|
|
2850
3331
|
});
|
|
2851
3332
|
var OrganizationPeriod = schema_exports.struct({
|
|
2852
3333
|
days: schema_exports.int({ min: 1 }),
|
|
2853
3334
|
current: schema_exports.nullable(OrganizationFigures),
|
|
2854
3335
|
previous: schema_exports.nullable(OrganizationFigures)
|
|
2855
3336
|
});
|
|
3337
|
+
var QuickWeek = schema_exports.struct({
|
|
3338
|
+
start: Timestamp,
|
|
3339
|
+
sentAsWritten: schema_exports.nullable(count),
|
|
3340
|
+
quickApprovals: schema_exports.nullable(count)
|
|
3341
|
+
});
|
|
2856
3342
|
var OrganizationInsights = schema_exports.struct({
|
|
2857
3343
|
generatedAt: Timestamp,
|
|
2858
3344
|
quickApprovalSeconds: schema_exports.int({ min: 1 }),
|
|
2859
3345
|
minimumGroupSize: schema_exports.int({ min: 1 }),
|
|
2860
3346
|
blocks: schema_exports.nullable(count),
|
|
2861
|
-
periods: schema_exports.array(OrganizationPeriod)
|
|
3347
|
+
periods: schema_exports.array(OrganizationPeriod),
|
|
3348
|
+
weeks: schema_exports.optional(schema_exports.array(QuickWeek)),
|
|
3349
|
+
quickWarning: schema_exports.optional(schema_exports.boolean)
|
|
3350
|
+
});
|
|
3351
|
+
var ManagerApprovals = schema_exports.struct({
|
|
3352
|
+
memberId: MemberId,
|
|
3353
|
+
name: schema_exports.string({ maxLength: 200 }),
|
|
3354
|
+
approved: count
|
|
3355
|
+
});
|
|
3356
|
+
var ChannelAgentFigures = schema_exports.struct({
|
|
3357
|
+
written: count,
|
|
3358
|
+
sentAsWritten: count,
|
|
3359
|
+
sentAfterEdits: count,
|
|
3360
|
+
discarded: count,
|
|
3361
|
+
medianDecisionMs: schema_exports.nullable(count),
|
|
3362
|
+
quickApprovals: count,
|
|
3363
|
+
approvals: schema_exports.nullable(schema_exports.array(ManagerApprovals)),
|
|
3364
|
+
approvedByFormerManagers: schema_exports.optional(count)
|
|
3365
|
+
});
|
|
3366
|
+
var ChannelAgentPeriod = schema_exports.struct({
|
|
3367
|
+
days: schema_exports.int({ min: 1 }),
|
|
3368
|
+
current: ChannelAgentFigures,
|
|
3369
|
+
previous: ChannelAgentFigures
|
|
3370
|
+
});
|
|
3371
|
+
var ChannelAgentReport = schema_exports.struct({
|
|
3372
|
+
generatedAt: Timestamp,
|
|
3373
|
+
channel: ChannelSlug,
|
|
3374
|
+
quickApprovalSeconds: schema_exports.int({ min: 1 }),
|
|
3375
|
+
minimumGroupSize: schema_exports.int({ min: 1 }),
|
|
3376
|
+
waiting: count,
|
|
3377
|
+
periods: schema_exports.array(ChannelAgentPeriod)
|
|
2862
3378
|
});
|
|
3379
|
+
var QUICK_PICKUP_MS = 5 * 6e4;
|
|
3380
|
+
var PICKUP_WAIT_MS = 24 * 60 * 6e4;
|
|
2863
3381
|
|
|
2864
3382
|
// ../protocol/src/principles.ts
|
|
2865
3383
|
var PRINCIPLE_TOPIC_MAX = 80;
|
|
@@ -3004,6 +3522,40 @@ var AnalyticsBatch = schema_exports.struct({
|
|
|
3004
3522
|
});
|
|
3005
3523
|
var analyticsEvent = (name, properties, anonymousId, timestamp) => ({ event: name, properties, anonymousId, timestamp });
|
|
3006
3524
|
|
|
3525
|
+
// ../protocol/src/desk-wake.ts
|
|
3526
|
+
var DeskWake = schema_exports.struct({
|
|
3527
|
+
host: schema_exports.string({ maxLength: 253 }),
|
|
3528
|
+
headerNames: schema_exports.array(schema_exports.string({ maxLength: 64 }), { maxItems: 8 }),
|
|
3529
|
+
credentialId: CredentialId,
|
|
3530
|
+
enabled: schema_exports.boolean,
|
|
3531
|
+
lastWakeAt: schema_exports.nullable(Timestamp),
|
|
3532
|
+
lastStatus: schema_exports.tolerant(
|
|
3533
|
+
schema_exports.literal("never", "sent", "online", "not_online", "refused", "rate_limited", "unreachable"),
|
|
3534
|
+
UNKNOWN
|
|
3535
|
+
),
|
|
3536
|
+
failures: schema_exports.int({ min: 0 }),
|
|
3537
|
+
stoppedBecause: schema_exports.nullable(
|
|
3538
|
+
schema_exports.tolerant(schema_exports.literal("refused", "failures", "credential_gone", "unreadable"), UNKNOWN)
|
|
3539
|
+
),
|
|
3540
|
+
createdAt: Timestamp,
|
|
3541
|
+
updatedAt: Timestamp
|
|
3542
|
+
});
|
|
3543
|
+
var DESK_WAKE_HEADERS_MAX = 4;
|
|
3544
|
+
var DeskWakeHeader = schema_exports.struct({
|
|
3545
|
+
name: schema_exports.string({ pattern: /^[A-Za-z0-9-]{1,64}$/ }),
|
|
3546
|
+
value: schema_exports.string({ pattern: /^[!-~](?:[ -~]{0,3998}[!-~])?$/ })
|
|
3547
|
+
});
|
|
3548
|
+
var DeskWakeSetup = schema_exports.struct({
|
|
3549
|
+
url: schema_exports.string({ minLength: 9, maxLength: 2e3, pattern: /^https:\/\/\S+$/ }),
|
|
3550
|
+
headers: schema_exports.array(DeskWakeHeader, { maxItems: DESK_WAKE_HEADERS_MAX }),
|
|
3551
|
+
credentialId: CredentialId,
|
|
3552
|
+
enabled: schema_exports.boolean
|
|
3553
|
+
});
|
|
3554
|
+
var DeskWakeTest = schema_exports.struct({
|
|
3555
|
+
status: schema_exports.int({ min: 0, max: 599 }),
|
|
3556
|
+
outcome: DeskWake.fields.lastStatus
|
|
3557
|
+
});
|
|
3558
|
+
|
|
3007
3559
|
// ../protocol/src/contract.ts
|
|
3008
3560
|
var PushSubscription = schema_exports.struct({
|
|
3009
3561
|
endpoint: schema_exports.string({ minLength: 1, maxLength: 2e3, pattern: /^https:\/\// }),
|
|
@@ -3037,6 +3589,34 @@ var contract = {
|
|
|
3037
3589
|
response: Member
|
|
3038
3590
|
}),
|
|
3039
3591
|
"me.character.clear": route({ method: "DELETE", path: "/me/character", access: "human", response: Member }),
|
|
3592
|
+
"me.notifications.set": route({
|
|
3593
|
+
method: "PUT",
|
|
3594
|
+
path: "/me/notifications",
|
|
3595
|
+
access: "human",
|
|
3596
|
+
body: schema_exports.struct({ notifications: schema_exports.literal(...NOTIFICATION_LEVELS) }),
|
|
3597
|
+
response: schema_exports.struct({ notifications: NotificationLevel })
|
|
3598
|
+
}),
|
|
3599
|
+
"me.deskWake.get": route({
|
|
3600
|
+
method: "GET",
|
|
3601
|
+
path: "/me/desk-wake",
|
|
3602
|
+
access: "human",
|
|
3603
|
+
response: schema_exports.struct({ wake: schema_exports.nullable(DeskWake) })
|
|
3604
|
+
}),
|
|
3605
|
+
"me.deskWake.set": route({
|
|
3606
|
+
method: "PUT",
|
|
3607
|
+
path: "/me/desk-wake",
|
|
3608
|
+
access: "human",
|
|
3609
|
+
body: DeskWakeSetup,
|
|
3610
|
+
response: DeskWake
|
|
3611
|
+
}),
|
|
3612
|
+
"me.deskWake.remove": route({ method: "DELETE", path: "/me/desk-wake", access: "human", response: Empty }),
|
|
3613
|
+
"me.deskWake.test": route({
|
|
3614
|
+
method: "POST",
|
|
3615
|
+
path: "/me/desk-wake/test",
|
|
3616
|
+
access: "human",
|
|
3617
|
+
body: Empty,
|
|
3618
|
+
response: DeskWakeTest
|
|
3619
|
+
}),
|
|
3040
3620
|
"directory.list": route({
|
|
3041
3621
|
method: "GET",
|
|
3042
3622
|
path: "/directory",
|
|
@@ -3128,6 +3708,57 @@ var contract = {
|
|
|
3128
3708
|
body: schema_exports.struct({ groupId: GroupId }),
|
|
3129
3709
|
response: Channel
|
|
3130
3710
|
}),
|
|
3711
|
+
"channels.agent.get": route({
|
|
3712
|
+
method: "GET",
|
|
3713
|
+
path: "/channels/:slug/agent",
|
|
3714
|
+
access: "human",
|
|
3715
|
+
response: ChannelAgent
|
|
3716
|
+
}),
|
|
3717
|
+
"channels.agent.create": route({
|
|
3718
|
+
method: "PUT",
|
|
3719
|
+
path: "/channels/:slug/agent",
|
|
3720
|
+
access: "human",
|
|
3721
|
+
body: schema_exports.struct({ name: ChannelAgentName }),
|
|
3722
|
+
response: ChannelAgent
|
|
3723
|
+
}),
|
|
3724
|
+
"channels.agent.rename": route({
|
|
3725
|
+
method: "PATCH",
|
|
3726
|
+
path: "/channels/:slug/agent",
|
|
3727
|
+
access: "human",
|
|
3728
|
+
body: schema_exports.struct({ name: ChannelAgentName }),
|
|
3729
|
+
response: ChannelAgent
|
|
3730
|
+
}),
|
|
3731
|
+
"channels.agent.retire": route({
|
|
3732
|
+
method: "DELETE",
|
|
3733
|
+
path: "/channels/:slug/agent",
|
|
3734
|
+
access: "human",
|
|
3735
|
+
response: Empty
|
|
3736
|
+
}),
|
|
3737
|
+
"channels.agent.credentials.revoke": route({
|
|
3738
|
+
method: "DELETE",
|
|
3739
|
+
path: "/channels/:slug/agent/credentials/:id",
|
|
3740
|
+
access: "human",
|
|
3741
|
+
response: ChannelAgent
|
|
3742
|
+
}),
|
|
3743
|
+
"channels.agent.figures": route({
|
|
3744
|
+
method: "GET",
|
|
3745
|
+
path: "/channels/:slug/agent/figures",
|
|
3746
|
+
access: "human",
|
|
3747
|
+
response: ChannelAgentReport
|
|
3748
|
+
}),
|
|
3749
|
+
"channels.askPrivately": route({
|
|
3750
|
+
method: "POST",
|
|
3751
|
+
path: "/channels/:slug/private-question",
|
|
3752
|
+
access: "human",
|
|
3753
|
+
response: Conversation
|
|
3754
|
+
}),
|
|
3755
|
+
"reviews.list": route({
|
|
3756
|
+
method: "GET",
|
|
3757
|
+
path: "/reviews",
|
|
3758
|
+
access: "human",
|
|
3759
|
+
response: schema_exports.struct({ reviews: schema_exports.array(Review) })
|
|
3760
|
+
}),
|
|
3761
|
+
"reviews.get": route({ method: "GET", path: "/reviews/:id", access: "human", response: Review }),
|
|
3131
3762
|
"groups.list": route({
|
|
3132
3763
|
method: "GET",
|
|
3133
3764
|
path: "/groups",
|
|
@@ -3198,6 +3829,18 @@ var contract = {
|
|
|
3198
3829
|
access: "member",
|
|
3199
3830
|
response: Conversation
|
|
3200
3831
|
}),
|
|
3832
|
+
"conversations.mute": route({
|
|
3833
|
+
method: "PUT",
|
|
3834
|
+
path: "/conversations/:id/mute",
|
|
3835
|
+
access: "human",
|
|
3836
|
+
response: Conversation
|
|
3837
|
+
}),
|
|
3838
|
+
"conversations.unmute": route({
|
|
3839
|
+
method: "DELETE",
|
|
3840
|
+
path: "/conversations/:id/mute",
|
|
3841
|
+
access: "human",
|
|
3842
|
+
response: Conversation
|
|
3843
|
+
}),
|
|
3201
3844
|
"conversations.notes": route({
|
|
3202
3845
|
method: "GET",
|
|
3203
3846
|
path: "/conversations/:id/notes",
|
|
@@ -3282,7 +3925,10 @@ var contract = {
|
|
|
3282
3925
|
method: "POST",
|
|
3283
3926
|
path: "/drafts/:id/send",
|
|
3284
3927
|
access: "human",
|
|
3285
|
-
body: schema_exports.struct({
|
|
3928
|
+
body: schema_exports.struct({
|
|
3929
|
+
body: schema_exports.optional(NoteBody),
|
|
3930
|
+
expected: DraftAsShown
|
|
3931
|
+
}),
|
|
3286
3932
|
response: Note
|
|
3287
3933
|
}),
|
|
3288
3934
|
"drafts.discard": route({ method: "POST", path: "/drafts/:id/discard", access: "human", response: Note }),
|
|
@@ -3512,10 +4158,22 @@ var contract = {
|
|
|
3512
4158
|
access: "human",
|
|
3513
4159
|
body: schema_exports.struct({
|
|
3514
4160
|
approve: schema_exports.boolean,
|
|
3515
|
-
name: schema_exports.optional(schema_exports.string({ minLength: 1, maxLength: 200 }))
|
|
4161
|
+
name: schema_exports.optional(schema_exports.string({ minLength: 1, maxLength: 200 })),
|
|
4162
|
+
/** Issues the credential to this channel's agent instead of the person deciding. */
|
|
4163
|
+
channel: schema_exports.optional(ChannelSlug)
|
|
3516
4164
|
}),
|
|
3517
4165
|
response: Empty
|
|
3518
4166
|
}),
|
|
4167
|
+
"joinCodes.create": route({
|
|
4168
|
+
method: "POST",
|
|
4169
|
+
path: "/join-codes",
|
|
4170
|
+
access: "human",
|
|
4171
|
+
body: schema_exports.struct({
|
|
4172
|
+
/** Issues the credential to this channel's agent instead of the person creating the code. */
|
|
4173
|
+
channel: schema_exports.optional(ChannelSlug)
|
|
4174
|
+
}),
|
|
4175
|
+
response: JoinCode
|
|
4176
|
+
}),
|
|
3519
4177
|
"consent.get": route({ method: "GET", path: "/consent/:id", access: "human", response: ConsentRequest }),
|
|
3520
4178
|
"consent.decide": route({
|
|
3521
4179
|
method: "POST",
|
|
@@ -3582,7 +4240,7 @@ var contract = {
|
|
|
3582
4240
|
path: "/events/poll",
|
|
3583
4241
|
access: "member",
|
|
3584
4242
|
query: { after: schema_exports.optional(Digits), wait: schema_exports.optional(schema_exports.string({ pattern: /^[0-9]{1,2}$/ })) },
|
|
3585
|
-
response: schema_exports.struct({ events: schema_exports.array(
|
|
4243
|
+
response: schema_exports.struct({ events: schema_exports.array(StreamEvent2), cursor: schema_exports.int({ min: 0 }) })
|
|
3586
4244
|
}),
|
|
3587
4245
|
"answeringFlow.get": route({
|
|
3588
4246
|
method: "GET",
|
|
@@ -3607,7 +4265,7 @@ var contract = {
|
|
|
3607
4265
|
method: "GET",
|
|
3608
4266
|
path: "/admin/members",
|
|
3609
4267
|
access: "admin",
|
|
3610
|
-
response: schema_exports.struct({ members: schema_exports.array(Member) })
|
|
4268
|
+
response: schema_exports.struct({ members: schema_exports.array(Member), agents: schema_exports.optional(schema_exports.array(AgentListing)) })
|
|
3611
4269
|
}),
|
|
3612
4270
|
"admin.members.update": route({
|
|
3613
4271
|
method: "PATCH",
|
|
@@ -3683,6 +4341,10 @@ var FEATURES = {
|
|
|
3683
4341
|
default: true,
|
|
3684
4342
|
routes: ["me.character.set", "me.character.clear", "admin.members.resetCharacter"]
|
|
3685
4343
|
},
|
|
4344
|
+
mute: {
|
|
4345
|
+
default: true,
|
|
4346
|
+
routes: ["conversations.mute", "conversations.unmute", "me.notifications.set"]
|
|
4347
|
+
},
|
|
3686
4348
|
webPush: { default: true, routes: ["push.key", "push.subscribe", "push.test", "push.unsubscribe"] },
|
|
3687
4349
|
answeringFlow: { default: true, routes: ["answeringFlow.get"] },
|
|
3688
4350
|
teaching: {
|
|
@@ -3718,11 +4380,37 @@ var FEATURES = {
|
|
|
3718
4380
|
"debates.export"
|
|
3719
4381
|
]
|
|
3720
4382
|
},
|
|
4383
|
+
channelAgents: {
|
|
4384
|
+
default: false,
|
|
4385
|
+
routes: [
|
|
4386
|
+
"channels.agent.get",
|
|
4387
|
+
"channels.agent.create",
|
|
4388
|
+
"channels.agent.rename",
|
|
4389
|
+
"channels.agent.retire",
|
|
4390
|
+
"channels.agent.credentials.revoke",
|
|
4391
|
+
"channels.agent.figures",
|
|
4392
|
+
"channels.askPrivately",
|
|
4393
|
+
"reviews.list",
|
|
4394
|
+
"reviews.get"
|
|
4395
|
+
]
|
|
4396
|
+
},
|
|
4397
|
+
cloudDesk: {
|
|
4398
|
+
default: false,
|
|
4399
|
+
routes: ["me.deskWake.get", "me.deskWake.set", "me.deskWake.test"]
|
|
4400
|
+
},
|
|
4401
|
+
joinCodes: { default: true, routes: ["joinCodes.create"] },
|
|
3721
4402
|
analytics: { default: false, routes: ["analytics.track"] }
|
|
3722
4403
|
};
|
|
3723
4404
|
var FEATURE_NAMES = Object.keys(FEATURES);
|
|
3724
4405
|
var FeatureSwitches = schema_exports.record(schema_exports.boolean);
|
|
3725
4406
|
|
|
4407
|
+
// ../protocol/src/waking-events.ts
|
|
4408
|
+
var isWakingEvent = (body, viewerId) => {
|
|
4409
|
+
if (body.type === "note.sent") return body.note.authorId !== viewerId;
|
|
4410
|
+
if (body.type === "debate.changed") return viewerId !== null && body.participantIds.includes(viewerId);
|
|
4411
|
+
return body.type === "draft.requested" || body.type === "resync";
|
|
4412
|
+
};
|
|
4413
|
+
|
|
3726
4414
|
// ../protocol/src/debate-rules.ts
|
|
3727
4415
|
var turnsTakenBy = (room, memberId) => room.turns.filter((turn) => turn.memberId === memberId).length;
|
|
3728
4416
|
|
|
@@ -3866,12 +4554,16 @@ var AUDIT_EVENTS = {
|
|
|
3866
4554
|
}),
|
|
3867
4555
|
"credential.issued": event("security", "credential", {
|
|
3868
4556
|
kind: CredentialKind,
|
|
3869
|
-
grant: schema_exports.literal("browser", "device_code", "authorization_code"),
|
|
3870
|
-
clientKind: CLIENT_KIND
|
|
4557
|
+
grant: schema_exports.literal("browser", "device_code", "authorization_code", "join_code"),
|
|
4558
|
+
clientKind: CLIENT_KIND,
|
|
4559
|
+
channelAgent: schema_exports.optional(MemberId)
|
|
3871
4560
|
}),
|
|
3872
4561
|
"credential.renamed": event("security", "credential", {}),
|
|
3873
|
-
"credential.revoked": event("security", "credential", {
|
|
4562
|
+
"credential.revoked": event("security", "credential", {
|
|
4563
|
+
because: schema_exports.optional(schema_exports.literal("issuer_left", "agent_retired", "refresh_replayed"))
|
|
4564
|
+
}),
|
|
3874
4565
|
"credential.device_decided": event("security", "none", { approved: schema_exports.boolean }),
|
|
4566
|
+
"credential.join_code_created": event("security", "member", { channel: schema_exports.optional(ChannelSlug) }),
|
|
3875
4567
|
"credential.consent_decided": event("security", "auth_request", { approved: schema_exports.boolean }),
|
|
3876
4568
|
"oauth.client_registered": event("security", "oauth_client", { redirectHosts: hostList() }),
|
|
3877
4569
|
"oauth.client_resolved": event("security", "oauth_client", { redirectHosts: hostList() }),
|
|
@@ -3908,11 +4600,27 @@ var AUDIT_EVENTS = {
|
|
|
3908
4600
|
removed: schema_exports.array(MemberId, { maxItems: GROUP_MEMBERS_MAX }),
|
|
3909
4601
|
because: schema_exports.optional(schema_exports.literal("deactivated"))
|
|
3910
4602
|
}),
|
|
3911
|
-
"
|
|
4603
|
+
"desk_wake.registered": event("security", "member", { host: schema_exports.string({ maxLength: 253 }) }),
|
|
4604
|
+
"desk_wake.removed": event("security", "member", {
|
|
4605
|
+
host: schema_exports.string({ maxLength: 253 }),
|
|
4606
|
+
because: schema_exports.optional(schema_exports.literal("deactivated"))
|
|
4607
|
+
}),
|
|
4608
|
+
"desk_wake.stopped": event("security", "member", {
|
|
4609
|
+
host: schema_exports.string({ maxLength: 253 }),
|
|
4610
|
+
because: schema_exports.literal("refused", "failures", "credential_gone", "unreadable")
|
|
4611
|
+
}),
|
|
4612
|
+
"note.approved": event("full", "note", {
|
|
4613
|
+
conversationId: ConversationId,
|
|
4614
|
+
edited: schema_exports.boolean,
|
|
4615
|
+
agentId: schema_exports.optional(MemberId)
|
|
4616
|
+
}),
|
|
3912
4617
|
"note.discarded": event("full", "note", { conversationId: ConversationId }),
|
|
3913
4618
|
"member.profile_changed": event("full", "member", {
|
|
3914
4619
|
fields: schema_exports.array(schema_exports.literal("name", "profile", "locale"), { maxItems: 3 })
|
|
3915
4620
|
}),
|
|
4621
|
+
"member.notifications_changed": event("full", "member", {
|
|
4622
|
+
notifications: schema_exports.literal(...NOTIFICATION_LEVELS)
|
|
4623
|
+
}),
|
|
3916
4624
|
"character.set": event("full", "member", {}),
|
|
3917
4625
|
"character.cleared": event("full", "member", {}),
|
|
3918
4626
|
"character.reset": event("full", "member", {}),
|
|
@@ -3928,12 +4636,19 @@ var AUDIT_EVENTS = {
|
|
|
3928
4636
|
"group.created": event("full", "group", { memberCount: schema_exports.int({ min: 0 }) }),
|
|
3929
4637
|
"group.renamed": event("full", "group", {}),
|
|
3930
4638
|
"group.deleted": event("full", "group", {}),
|
|
4639
|
+
"channel.agent_created": event("security", "member", { channel: ChannelSlug }),
|
|
4640
|
+
"channel.agent_renamed": event("full", "member", { channel: ChannelSlug }),
|
|
4641
|
+
"channel.agent_retired": event("security", "member", {
|
|
4642
|
+
channel: ChannelSlug,
|
|
4643
|
+
because: schema_exports.optional(schema_exports.literal("channel_archived"))
|
|
4644
|
+
}),
|
|
3931
4645
|
"channel.answering_changed": event("full", "channel", { on: schema_exports.boolean }),
|
|
3932
4646
|
"channel.renamed": event("full", "channel", {
|
|
3933
4647
|
fields: schema_exports.array(schema_exports.literal("slug", "description"), { maxItems: 2 }),
|
|
3934
4648
|
slug: schema_exports.optional(change(ChannelSlug))
|
|
3935
4649
|
}),
|
|
3936
4650
|
"channel.archived": event("full", "channel", { moveMembersTo: schema_exports.optional(ChannelSlug) }),
|
|
4651
|
+
"conversation.mute_changed": event("full", "conversation", { muted: schema_exports.boolean }),
|
|
3937
4652
|
"contact.requested": event("full", "member", {}),
|
|
3938
4653
|
"contact.accepted": event("full", "member", {}),
|
|
3939
4654
|
"contact.removed": event("full", "member", {}),
|
|
@@ -3986,6 +4701,11 @@ var ROUTE_AUDIT = {
|
|
|
3986
4701
|
"me.update": { event: "member.profile_changed", target: "member" },
|
|
3987
4702
|
"me.character.set": { event: "character.set", target: "member" },
|
|
3988
4703
|
"me.character.clear": { event: "character.cleared", target: "member" },
|
|
4704
|
+
"me.notifications.set": { event: "member.notifications_changed", target: "member" },
|
|
4705
|
+
"me.deskWake.get": read(),
|
|
4706
|
+
"me.deskWake.set": { event: "desk_wake.registered", target: "member" },
|
|
4707
|
+
"me.deskWake.remove": { event: "desk_wake.removed", target: "member" },
|
|
4708
|
+
"me.deskWake.test": { none: "A test wake keeps nothing; the operational log says how it went." },
|
|
3989
4709
|
"directory.list": read(),
|
|
3990
4710
|
"channels.list": read(),
|
|
3991
4711
|
"channels.get": read(),
|
|
@@ -3999,6 +4719,15 @@ var ROUTE_AUDIT = {
|
|
|
3999
4719
|
"channels.members.add": { event: "channel.member_added", target: "channel" },
|
|
4000
4720
|
"channels.members.remove": { event: "channel.member_removed", target: "channel" },
|
|
4001
4721
|
"channels.managers.addTeam": { event: "group.members_changed", target: "group" },
|
|
4722
|
+
"channels.agent.get": read(),
|
|
4723
|
+
"channels.agent.figures": read(),
|
|
4724
|
+
"channels.agent.create": { event: "channel.agent_created", target: "member" },
|
|
4725
|
+
"channels.agent.rename": { event: "channel.agent_renamed", target: "member" },
|
|
4726
|
+
"channels.agent.retire": { event: "channel.agent_retired", target: "member" },
|
|
4727
|
+
"channels.agent.credentials.revoke": { event: "credential.revoked", target: "credential" },
|
|
4728
|
+
"channels.askPrivately": activity(),
|
|
4729
|
+
"reviews.list": read(),
|
|
4730
|
+
"reviews.get": read(),
|
|
4002
4731
|
"groups.list": read(),
|
|
4003
4732
|
"groups.get": read(),
|
|
4004
4733
|
"groups.rename": { event: "group.renamed", target: "group" },
|
|
@@ -4012,6 +4741,8 @@ var ROUTE_AUDIT = {
|
|
|
4012
4741
|
"conversations.list": read(),
|
|
4013
4742
|
"conversations.create": activity(),
|
|
4014
4743
|
"conversations.get": read(),
|
|
4744
|
+
"conversations.mute": { event: "conversation.mute_changed", target: "conversation" },
|
|
4745
|
+
"conversations.unmute": { event: "conversation.mute_changed", target: "conversation" },
|
|
4015
4746
|
"conversations.notes": read(),
|
|
4016
4747
|
"notes.get": read(),
|
|
4017
4748
|
"notes.read": activity(),
|
|
@@ -4054,6 +4785,7 @@ var ROUTE_AUDIT = {
|
|
|
4054
4785
|
"credentials.revoke": { event: "credential.revoked", target: "credential" },
|
|
4055
4786
|
"device.get": read(),
|
|
4056
4787
|
"device.decide": { event: "credential.device_decided", target: "none" },
|
|
4788
|
+
"joinCodes.create": { event: "credential.join_code_created", target: "member" },
|
|
4057
4789
|
"consent.get": read(),
|
|
4058
4790
|
"consent.decide": { event: "credential.consent_decided", target: "auth_request" },
|
|
4059
4791
|
"push.key": read(),
|
|
@@ -4614,7 +5346,7 @@ var readCredentialsFile = (path, server) => task_exports.gen(function* () {
|
|
|
4614
5346
|
if ((yield* env.files.mode(path)) === null)
|
|
4615
5347
|
return yield* task_exports.fail(
|
|
4616
5348
|
CliFailure({
|
|
4617
|
-
message: `The credentials file ${path} does not exist. ${
|
|
5349
|
+
message: `The credentials file ${path} does not exist. ${createCredentialsFile(path, server)}`,
|
|
4618
5350
|
exitCode: EXIT.signedOut
|
|
4619
5351
|
})
|
|
4620
5352
|
);
|
|
@@ -4626,7 +5358,9 @@ var readCredentialsFile = (path, server) => task_exports.gen(function* () {
|
|
|
4626
5358
|
const decoded = StoredCredential.decode(parseJson(content));
|
|
4627
5359
|
if (decoded._tag === "Err")
|
|
4628
5360
|
return yield* task_exports.fail(
|
|
4629
|
-
failed(
|
|
5361
|
+
failed(
|
|
5362
|
+
`The credentials file ${path} does not hold an agent credential. ${createCredentialsFile(path, server)}`
|
|
5363
|
+
)
|
|
4630
5364
|
);
|
|
4631
5365
|
if (server !== null && serverKey(decoded.value.serverUrl) !== serverKey(server))
|
|
4632
5366
|
return yield* task_exports.fail(
|
|
@@ -4656,7 +5390,7 @@ var serverKey = (serverUrl) => {
|
|
|
4656
5390
|
var AGENTS_DIRECTORY = "agents";
|
|
4657
5391
|
var SUFFIX = ".json";
|
|
4658
5392
|
var SHARED_READ_BITS = 36;
|
|
4659
|
-
var
|
|
5393
|
+
var createCredentialsFile = (path, server) => `Create it on a computer where you can approve the sign-in: homingbird login --server ${server ?? "<url>"} --credentials-file ${path}`;
|
|
4660
5394
|
var agentsDirectory = (env) => `${credentialDirectory(env)}/${AGENTS_DIRECTORY}`;
|
|
4661
5395
|
var pathFor = (env, serverUrl) => `${agentsDirectory(env)}/${encodeURIComponent(serverKey(serverUrl))}${SUFFIX}`;
|
|
4662
5396
|
var parseJson = (content) => {
|
|
@@ -4690,7 +5424,9 @@ var countUsage = (api, name, properties) => task_exports.catchAll(() => task_exp
|
|
|
4690
5424
|
var ANALYTICS_NOTICE = "This Homingbird server counts anonymous usage, such as which agent preset a desk runs, never notes, names or email addresses. Turn it off with `homingbird analytics off` or DO_NOT_TRACK=1.";
|
|
4691
5425
|
var isDoNotTrack = (variables2) => variables2.DO_NOT_TRACK !== void 0 && variables2.DO_NOT_TRACK !== "" && variables2.DO_NOT_TRACK !== "0";
|
|
4692
5426
|
var presetLabel = (agent) => {
|
|
4693
|
-
const name = AGENT_PRESETS.find(
|
|
5427
|
+
const name = AGENT_PRESETS.find(
|
|
5428
|
+
(preset) => preset.name === agent || ["linux", "win32"].some((shell) => presetAgent(preset, shell) === agent)
|
|
5429
|
+
)?.name;
|
|
4694
5430
|
return ANALYTICS_AGENT_PRESETS.find((known) => known === name) ?? "custom";
|
|
4695
5431
|
};
|
|
4696
5432
|
var AnalyticsSettings = schema_exports.struct({
|
|
@@ -4916,7 +5652,7 @@ var pollOnce = (options, cursor) => task_exports.gen(function* () {
|
|
|
4916
5652
|
});
|
|
4917
5653
|
var UNREADABLE_PROBLEM = "The server sent an event this client cannot read; it was skipped.";
|
|
4918
5654
|
var arrivedFrom = (raw) => {
|
|
4919
|
-
const event2 =
|
|
5655
|
+
const event2 = StreamEvent2.read(raw);
|
|
4920
5656
|
if (event2._tag === "Ok") return { event: event2.value, seq: event2.value.seq };
|
|
4921
5657
|
const seq = raw?.seq;
|
|
4922
5658
|
return { event: null, seq: typeof seq === "number" && Number.isSafeInteger(seq) ? seq : null };
|
|
@@ -4991,6 +5727,9 @@ var post = (options, path, fields) => task_exports.gen(function* () {
|
|
|
4991
5727
|
});
|
|
4992
5728
|
var unreachable = () => DeviceFlowFailed({ reason: "unreachable", message: "The Homingbird server could not be reached." });
|
|
4993
5729
|
|
|
5730
|
+
// ../client/src/join-code.ts
|
|
5731
|
+
var JoinCodeRefused = tagged("JoinCodeRefused")();
|
|
5732
|
+
|
|
4994
5733
|
// ../client/src/protocol-check.ts
|
|
4995
5734
|
var requireReadableServer = (api) => task_exports.flatMap((info) => {
|
|
4996
5735
|
const side = upgradeNeeded(info);
|
|
@@ -5327,6 +6066,17 @@ var summaryOf = (note) => ({
|
|
|
5327
6066
|
body: note.body
|
|
5328
6067
|
});
|
|
5329
6068
|
|
|
6069
|
+
// ../cli/src/web-client.ts
|
|
6070
|
+
var reviewLink = (serverUrl, slug, draftId = null) => {
|
|
6071
|
+
const page = `${serverUrl.replace(/\/+$/, "")}/#/channel/${encodeURIComponent(slug)}/agent`;
|
|
6072
|
+
return draftId === null ? page : `${page}?draft=${encodeURIComponent(draftId)}`;
|
|
6073
|
+
};
|
|
6074
|
+
var reviewChannelOf = (api, member) => member.kind !== "channel_agent" ? task_exports.succeed(null) : task_exports.catchAll(() => task_exports.succeed(null))(
|
|
6075
|
+
task_exports.map(
|
|
6076
|
+
(listed) => listed.channels.find((channel) => channel.agent?.id === member.id)?.slug ?? null
|
|
6077
|
+
)(api["channels.list"]({ query: { limit: "100" } }))
|
|
6078
|
+
);
|
|
6079
|
+
|
|
5330
6080
|
// ../cli/src/commands/logout.ts
|
|
5331
6081
|
var logout = task_exports.gen(function* () {
|
|
5332
6082
|
const env = yield* task_exports.ask();
|
|
@@ -5365,6 +6115,15 @@ var isRemoved = (path) => task_exports.gen(function* () {
|
|
|
5365
6115
|
});
|
|
5366
6116
|
var REVOKE_IN_WEB_CLIENT = "Revoke it in the web client's device list.";
|
|
5367
6117
|
|
|
6118
|
+
// ../cli/src/commands/open.ts
|
|
6119
|
+
var channelOfThisAgent = task_exports.catchAll(() => task_exports.succeed(null))(
|
|
6120
|
+
task_exports.gen(function* () {
|
|
6121
|
+
const { api } = yield* openSession;
|
|
6122
|
+
const me = yield* calling(api["me.get"]({}));
|
|
6123
|
+
return yield* reviewChannelOf(api, me.member);
|
|
6124
|
+
})
|
|
6125
|
+
);
|
|
6126
|
+
|
|
5368
6127
|
// ../cli/src/answering-flow.ts
|
|
5369
6128
|
var answeringFlowFor = (api, conversationId) => task_exports.gen(function* () {
|
|
5370
6129
|
const [flow, principles] = yield* task_exports.all([
|
|
@@ -5391,11 +6150,16 @@ var overview = task_exports.gen(function* () {
|
|
|
5391
6150
|
const me = yield* calling(api["me.get"]({}));
|
|
5392
6151
|
const parts = yield* task_exports.struct({ conversations, awaiting: inbox(false), drafts });
|
|
5393
6152
|
const answeringFlow = yield* answeringFlowFor(api);
|
|
6153
|
+
const reviewChannel = yield* reviewChannelOf(api, me.member);
|
|
5394
6154
|
return outcome(
|
|
5395
6155
|
{
|
|
5396
6156
|
signedIn: true,
|
|
5397
6157
|
server: credential.serverUrl,
|
|
5398
|
-
member: { id: me.member.id, name: me.member.name, email: me.member.email },
|
|
6158
|
+
member: { id: me.member.id, name: me.member.name, email: me.member.email, kind: me.member.kind },
|
|
6159
|
+
...reviewChannel !== null && {
|
|
6160
|
+
reviewChannel,
|
|
6161
|
+
reviewLink: reviewLink(credential.serverUrl, reviewChannel)
|
|
6162
|
+
},
|
|
5399
6163
|
...parts.conversations.json,
|
|
5400
6164
|
awaiting: parts.awaiting.json.items,
|
|
5401
6165
|
...parts.drafts.json,
|
|
@@ -5410,11 +6174,52 @@ var overview = task_exports.gen(function* () {
|
|
|
5410
6174
|
"Waiting for a reply",
|
|
5411
6175
|
parts.awaiting.text,
|
|
5412
6176
|
"",
|
|
5413
|
-
"Drafts waiting for approval"
|
|
5414
|
-
parts.drafts.text
|
|
6177
|
+
reviewChannel === null ? "Drafts waiting for approval" : `Drafts waiting for the managers of #${reviewChannel}`,
|
|
6178
|
+
parts.drafts.text,
|
|
6179
|
+
...reviewChannel === null ? [] : ["", `They review them at ${reviewLink(credential.serverUrl, reviewChannel)}`]
|
|
6180
|
+
].join("\n")
|
|
6181
|
+
);
|
|
6182
|
+
});
|
|
6183
|
+
|
|
6184
|
+
// ../cli/src/commands/presets.ts
|
|
6185
|
+
var presets = task_exports.gen(function* () {
|
|
6186
|
+
const env = yield* task_exports.ask();
|
|
6187
|
+
const { platform } = env;
|
|
6188
|
+
const installed = yield* task_exports.forEach(AGENT_PRESETS, presetVersion);
|
|
6189
|
+
return outcome(
|
|
6190
|
+
{
|
|
6191
|
+
presets: AGENT_PRESETS.map((preset, index) => ({
|
|
6192
|
+
name: preset.name,
|
|
6193
|
+
program: preset.program,
|
|
6194
|
+
agent: presetAgent(preset, platform),
|
|
6195
|
+
reader: presetReader(preset, platform),
|
|
6196
|
+
readerTools: preset.readerTools,
|
|
6197
|
+
verifiedWith: preset.verifiedWith,
|
|
6198
|
+
optionsSeenIn: preset.optionsSeenIn,
|
|
6199
|
+
minimumVersion: preset.minimumVersion,
|
|
6200
|
+
installed: installed[index],
|
|
6201
|
+
state: presetState(preset)
|
|
6202
|
+
}))
|
|
6203
|
+
},
|
|
6204
|
+
[
|
|
6205
|
+
"Agent presets for run and service install (--agent <name>):",
|
|
6206
|
+
...AGENT_PRESETS.flatMap((preset, index) => [
|
|
6207
|
+
"",
|
|
6208
|
+
` ${preset.name} ${preset.program}; ${presetState(preset)}`,
|
|
6209
|
+
` here: ${versionLine(preset, installed[index])}`,
|
|
6210
|
+
` agent: ${presetAgent(preset, platform)}`,
|
|
6211
|
+
` reader: ${readerLine(preset, platform)}`
|
|
6212
|
+
]),
|
|
6213
|
+
"",
|
|
6214
|
+
"Any other --agent value is run as the command it is."
|
|
5415
6215
|
].join("\n")
|
|
5416
6216
|
);
|
|
5417
6217
|
});
|
|
6218
|
+
var readerLine = (preset, platform) => {
|
|
6219
|
+
const reader = presetReader(preset, platform);
|
|
6220
|
+
if (reader === null) return "none known; with --split, give --reader yourself";
|
|
6221
|
+
return preset.readerTools === "minimal" ? `${reader} (minimal tools, not none)` : `${reader} (no tools)`;
|
|
6222
|
+
};
|
|
5418
6223
|
|
|
5419
6224
|
// ../cli/src/commands/requests.ts
|
|
5420
6225
|
var requests = task_exports.gen(function* () {
|
|
@@ -5481,6 +6286,7 @@ var serviceVariables = (spec) => [
|
|
|
5481
6286
|
var serviceLockPath = (configDirectory, server) => `${configDirectory}/desks/service-${serviceSlug(server)}.lock`;
|
|
5482
6287
|
var serviceStopPath = (configDirectory, server) => `${configDirectory}/desks/service-${serviceSlug(server)}.stop`;
|
|
5483
6288
|
var serviceMissingPath = (configDirectory, server) => `${configDirectory}/desks/service-${serviceSlug(server)}.missing`;
|
|
6289
|
+
var serviceAgentsPath = (configDirectory, server) => `${configDirectory}/desks/service-${serviceSlug(server)}.agents`;
|
|
5484
6290
|
var serviceSlug = (server) => {
|
|
5485
6291
|
const key = serverKey(server);
|
|
5486
6292
|
const whole = key.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+/, "");
|
|
@@ -5526,16 +6332,33 @@ var shortHash = (text) => {
|
|
|
5526
6332
|
};
|
|
5527
6333
|
var CREDENTIALS_FILE_VARIABLE = "HOMINGBIRD_CREDENTIALS_FILE";
|
|
5528
6334
|
|
|
5529
|
-
// ../cli/src/agent-
|
|
5530
|
-
var
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
)
|
|
5535
|
-
|
|
5536
|
-
|
|
6335
|
+
// ../cli/src/agent-errors.ts
|
|
6336
|
+
var firstErrorLine = (run3, secrets) => {
|
|
6337
|
+
const line = (run3.errors ?? "").split(/\r?\n/).map((each) => each.trim()).find((each) => each !== "");
|
|
6338
|
+
if (line === void 0) return null;
|
|
6339
|
+
const withheld = secrets.reduce(
|
|
6340
|
+
(text, secret) => secret === "" ? text : text.split(secret).join("[withheld]"),
|
|
6341
|
+
line
|
|
6342
|
+
);
|
|
6343
|
+
const clean = withheld.replace(/[\u0000-\u001f\u007f-\u009f---]/g, "");
|
|
6344
|
+
return clean.length <= ERROR_LINE_MAX ? clean : `${clean.slice(0, ERROR_LINE_MAX - 1)}\u2026`;
|
|
6345
|
+
};
|
|
6346
|
+
var isManagedMcpRefusal = (run3) => run3.exitCode !== 0 && MANAGED_MCP_REFUSAL.test(run3.errors ?? "");
|
|
6347
|
+
var MANAGED_MCP_REFUSAL = /cannot use --strict-mcp-config when an enterprise MCP config is present/i;
|
|
6348
|
+
var ERROR_LINE_MAX = 160;
|
|
5537
6349
|
|
|
5538
6350
|
// ../cli/src/commands/run.ts
|
|
6351
|
+
var installedMcpServer = task_exports.gen(function* () {
|
|
6352
|
+
const env = yield* task_exports.ask();
|
|
6353
|
+
const [node, script] = env.program;
|
|
6354
|
+
if (node === void 0 || script === void 0) return null;
|
|
6355
|
+
const bundle = script.replace(
|
|
6356
|
+
/[\\/]cli[\\/]dist[\\/][^\\/]+$/,
|
|
6357
|
+
(found) => found.replace(/cli([\\/])dist\1[^\\/]+$/, "mcp$1dist$1homingbird-mcp.mjs")
|
|
6358
|
+
);
|
|
6359
|
+
if (bundle === script || !(yield* env.files.exists(bundle))) return null;
|
|
6360
|
+
return [node, bundle];
|
|
6361
|
+
});
|
|
5539
6362
|
var runDesk = (session, settings, report) => task_exports.gen(function* () {
|
|
5540
6363
|
const env = yield* task_exports.ask();
|
|
5541
6364
|
const { agent, timeoutSeconds, split } = settings;
|
|
@@ -5562,6 +6385,9 @@ var runDesk = (session, settings, report) => task_exports.gen(function* () {
|
|
|
5562
6385
|
member,
|
|
5563
6386
|
agent,
|
|
5564
6387
|
split,
|
|
6388
|
+
launches: settings.launches ?? launchesAsGiven(settings, env.platform ?? "linux"),
|
|
6389
|
+
credentialsFile: env.credentialsFile ?? "",
|
|
6390
|
+
platform: env.platform ?? "linux",
|
|
5565
6391
|
isService: settings.isService === true,
|
|
5566
6392
|
pause: deskPausePath(env, session.credential.serverUrl, member.id),
|
|
5567
6393
|
timeoutMs: timeoutSeconds * 1e3,
|
|
@@ -5600,7 +6426,7 @@ Every draft waits for approval in the web client.${runner.isService ? "" : " Pre
|
|
|
5600
6426
|
);
|
|
5601
6427
|
yield* task_exports.ensuring(task_exports.sync(() => stopping.abort()))(
|
|
5602
6428
|
stream_exports.forEach(
|
|
5603
|
-
(event2) =>
|
|
6429
|
+
(event2) => isWakingEvent(event2.body, member.id) ? answerWaitingOrStop(runner) : task_exports.unit
|
|
5604
6430
|
)(events)
|
|
5605
6431
|
);
|
|
5606
6432
|
});
|
|
@@ -5633,13 +6459,6 @@ var MINIMAL_READER_WARNING = "Split mode: this preset reader runs with minimal t
|
|
|
5633
6459
|
var MINIMAL_READER_REFUSED = "Split mode with --require-toolless-reader: this preset reader runs with minimal tools, not none. Give --reader a command that runs without tools.";
|
|
5634
6460
|
var SAME_READER_REFUSED = "Split mode with --require-toolless-reader needs a --reader command different from --agent, one that runs without tools.";
|
|
5635
6461
|
var STOPPING = [EXIT.signedOut];
|
|
5636
|
-
var WAKING = [
|
|
5637
|
-
"note.sent",
|
|
5638
|
-
"draft.requested",
|
|
5639
|
-
"debate.changed",
|
|
5640
|
-
"resync"
|
|
5641
|
-
];
|
|
5642
|
-
var isWaking = (event2, viewerId) => WAKING.includes(event2.body.type) && !(event2.body.type === "note.sent" && event2.body.note.authorId === viewerId) && !(event2.body.type === "debate.changed" && !event2.body.participantIds.includes(viewerId));
|
|
5643
6462
|
var answerWaiting = (runner) => task_exports.gen(function* () {
|
|
5644
6463
|
for (; ; ) {
|
|
5645
6464
|
yield* untilResumed(runner);
|
|
@@ -5685,7 +6504,7 @@ var debateDeskOf = (runner) => ({
|
|
|
5685
6504
|
tried: runner.triedDebates,
|
|
5686
6505
|
told: runner.told,
|
|
5687
6506
|
report: runner.report,
|
|
5688
|
-
run: (role, prompt, what) => outputOf(runner, role
|
|
6507
|
+
run: (role, prompt, what) => outputOf(runner, role, prompt, what),
|
|
5689
6508
|
warn
|
|
5690
6509
|
});
|
|
5691
6510
|
var untilResumed = (runner) => task_exports.gen(function* () {
|
|
@@ -5783,7 +6602,7 @@ var withoutOptions = (words) => {
|
|
|
5783
6602
|
};
|
|
5784
6603
|
var LAUNCHERS = /* @__PURE__ */ new Set(["env", "npx", "bunx"]);
|
|
5785
6604
|
var draftedBy = (runner, prompt, what) => task_exports.gen(function* () {
|
|
5786
|
-
const output = yield* outputOf(runner,
|
|
6605
|
+
const output = yield* outputOf(runner, "agent", prompt, what);
|
|
5787
6606
|
if (output === null) return null;
|
|
5788
6607
|
const reply = runnerReplyIn(output);
|
|
5789
6608
|
const problem = replyProblem(reply);
|
|
@@ -5793,7 +6612,7 @@ var draftedBy = (runner, prompt, what) => task_exports.gen(function* () {
|
|
|
5793
6612
|
var extractedFrom = (runner, note, authors, what) => task_exports.gen(function* () {
|
|
5794
6613
|
const env = yield* task_exports.ask();
|
|
5795
6614
|
const prompt = readerPrompt(quotedNote(note, { authors, nonce: env.nonce }));
|
|
5796
|
-
const output = yield* outputOf(runner,
|
|
6615
|
+
const output = yield* outputOf(runner, "reader", prompt, what);
|
|
5797
6616
|
const extracted = output === null ? null : extractionIn(output);
|
|
5798
6617
|
if (extracted === null) {
|
|
5799
6618
|
if (output !== null)
|
|
@@ -5809,33 +6628,61 @@ var extractedOriginalOf = (runner, request, authors) => task_exports.gen(functio
|
|
|
5809
6628
|
if (note._tag === "Err") return `(The note ${request.inReplyTo} could not be loaded.)`;
|
|
5810
6629
|
return (yield* extractedFrom(runner, note.value, authors, `the note ${note.value.id}`)) ?? UNREADABLE;
|
|
5811
6630
|
});
|
|
5812
|
-
var outputOf = (runner,
|
|
5813
|
-
const
|
|
5814
|
-
const environment = agentEnvironment(env.variables, [
|
|
5815
|
-
runner.session.credential.token,
|
|
5816
|
-
env.credentialsFile ?? ""
|
|
5817
|
-
]);
|
|
6631
|
+
var outputOf = (runner, role, prompt, what) => task_exports.gen(function* () {
|
|
6632
|
+
const launch = role === "agent" ? runner.launches.agent : runner.launches.reader;
|
|
5818
6633
|
const finished = yield* task_exports.result(
|
|
5819
6634
|
task_exports.timeout(runner.timeoutMs)(
|
|
5820
|
-
task_exports.
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
6635
|
+
task_exports.gen(function* () {
|
|
6636
|
+
const first = yield* launched(runner, launch, prompt);
|
|
6637
|
+
const fallback = launch.withoutStrictMcp;
|
|
6638
|
+
if (fallback === null || !isManagedMcpRefusal(first)) return first;
|
|
6639
|
+
yield* warn(role === "reader" ? MANAGED_MCP_WARNING : MANAGED_MCP_AGENT_WARNING);
|
|
6640
|
+
runner.launches = { ...runner.launches, [role]: fallback };
|
|
6641
|
+
return yield* launched(runner, fallback, prompt);
|
|
6642
|
+
})
|
|
5824
6643
|
)
|
|
5825
6644
|
);
|
|
5826
|
-
const reason = finished._tag === "Ok" ? exitProblem(finished.value,
|
|
5827
|
-
if (reason
|
|
5828
|
-
|
|
6645
|
+
const reason = finished._tag === "Ok" ? exitProblem(finished.value, launch.command, secretsOf(runner), runner.platform) : finished.error._tag === "TimeoutError" ? `did not finish within ${runner.timeoutMs / 1e3} seconds` : `could not be started (${finished.error.message})`;
|
|
6646
|
+
if (reason !== null || finished._tag !== "Ok")
|
|
6647
|
+
return yield* task_exports.as(null)(warn(`The ${role} command ${reason}; nothing was drafted for ${what}.`));
|
|
6648
|
+
if (launch.format === "text") return finished.value.output;
|
|
6649
|
+
const denied = firstErrorLine(finished.value, secretsOf(runner));
|
|
6650
|
+
if (denied !== null)
|
|
6651
|
+
yield* warn(`The ${role} command finished but reported, perhaps a tool it was denied: ${denied}`);
|
|
6652
|
+
const reply = antigravityOutput(finished.value.output);
|
|
6653
|
+
if (reply._tag === "Ok") return reply.value;
|
|
6654
|
+
return yield* task_exports.as(null)(warn(`The ${role} command ${reply.error}; nothing was drafted for ${what}.`));
|
|
6655
|
+
});
|
|
6656
|
+
var MANAGED_MCP_AGENT_WARNING = "Claude Code refused --strict-mcp-config because your organization manages its MCP configuration: the agent now runs without the Homingbird MCP server.";
|
|
6657
|
+
var MANAGED_MCP_WARNING = "Claude Code refused --strict-mcp-config because your organization manages its MCP configuration: the reader now runs without it, with every MCP tool denied.";
|
|
6658
|
+
var launched = (runner, launch, prompt) => task_exports.gen(function* () {
|
|
6659
|
+
const env = yield* task_exports.ask();
|
|
6660
|
+
const environment = {
|
|
6661
|
+
...agentEnvironment(env.variables, secretsOf(runner)),
|
|
6662
|
+
...launch.environment
|
|
6663
|
+
};
|
|
6664
|
+
const input = launch.format === "antigravity-stream" ? antigravityInput(prompt) : prompt;
|
|
6665
|
+
return yield* task_exports.tryPromise(
|
|
6666
|
+
(signal) => env.launcher.runAgent(launch.command, input, environment, signal),
|
|
6667
|
+
(cause) => failed(cause instanceof Error ? cause.message : String(cause))
|
|
6668
|
+
);
|
|
5829
6669
|
});
|
|
5830
|
-
var
|
|
6670
|
+
var secretsOf = (runner) => [
|
|
6671
|
+
runner.session.credential.token,
|
|
6672
|
+
runner.credentialsFile
|
|
6673
|
+
];
|
|
6674
|
+
var exitProblem = (finished, command2, secrets, platform) => {
|
|
5831
6675
|
if (finished.exitCode === 0) return null;
|
|
5832
|
-
if (finished.exitCode
|
|
5833
|
-
|
|
6676
|
+
if (SHELL_COMMAND_NOT_FOUND.includes(finished.exitCode ?? 0)) return notFound(command2, platform);
|
|
6677
|
+
const said2 = firstErrorLine(finished, secrets);
|
|
6678
|
+
return `exited with code ${finished.exitCode ?? "unknown"}${said2 === null ? "" : ` (${said2})`}`;
|
|
5834
6679
|
};
|
|
5835
|
-
var SHELL_COMMAND_NOT_FOUND = 127;
|
|
5836
|
-
var notFound = (command2) => {
|
|
6680
|
+
var SHELL_COMMAND_NOT_FOUND = [127, 9009];
|
|
6681
|
+
var notFound = (command2, platform) => {
|
|
5837
6682
|
const program = command2.trim().split(/\s+/)[0] ?? command2;
|
|
5838
|
-
|
|
6683
|
+
const name = program.replace(/^.*[\\/]/, "");
|
|
6684
|
+
const example = platform === "win32" ? `C:\\Users\\you\\AppData\\Roaming\\npm\\${name}.cmd` : `/usr/local/bin/${name}`;
|
|
6685
|
+
return `could not be found: "${program}" is not on the PATH this runs with; give its absolute path, such as ${example}, or set PATH`;
|
|
5839
6686
|
};
|
|
5840
6687
|
var labelsOf = (runner, reply) => ({
|
|
5841
6688
|
client: runnerClient(runner.agent),
|
|
@@ -5953,7 +6800,12 @@ var runKeyService = {
|
|
|
5953
6800
|
return result_exports.err(
|
|
5954
6801
|
`A Windows service cannot hold a value with " or %: ${unsafe}. Give the agent command without them.`
|
|
5955
6802
|
);
|
|
5956
|
-
|
|
6803
|
+
const line = commandLine(runnerCommand(paths.logPath, checked2));
|
|
6804
|
+
if (line.length > COMMAND_LINE_MAX)
|
|
6805
|
+
return result_exports.err(
|
|
6806
|
+
`The service's command line would be ${line.length} characters, more than the ${COMMAND_LINE_MAX} Windows starts. Give shorter paths or a shorter agent command.`
|
|
6807
|
+
);
|
|
6808
|
+
return result_exports.ok(line);
|
|
5957
6809
|
})(requirePrintable(spec)),
|
|
5958
6810
|
install: (paths, definition, spec) => {
|
|
5959
6811
|
const [program, ...args] = runnerCommand(paths.logPath, spec);
|
|
@@ -5981,6 +6833,7 @@ var runnerCommand = (logPath, spec) => [
|
|
|
5981
6833
|
credentialsFile: spec.credentialsFile
|
|
5982
6834
|
})
|
|
5983
6835
|
];
|
|
6836
|
+
var COMMAND_LINE_MAX = 32767;
|
|
5984
6837
|
var commandLine = (words) => words.map(windowsArgument).join(" ");
|
|
5985
6838
|
var isServiceAccount = (user) => {
|
|
5986
6839
|
const name = user.split("\\").at(-1);
|
|
@@ -6077,6 +6930,7 @@ var serviceStatus = task_exports.gen(function* () {
|
|
|
6077
6930
|
const running = manager.stopsThroughRunner ? yield* isClaimLive(paths.lockPath) : state?.running ?? false;
|
|
6078
6931
|
const loaded = state?.loaded ?? false;
|
|
6079
6932
|
const waitingFor = running ? yield* missingProgramOf(paths) : null;
|
|
6933
|
+
const agents = running && waitingFor === null ? yield* agentsOf(paths) : [];
|
|
6080
6934
|
return outcome(
|
|
6081
6935
|
{
|
|
6082
6936
|
service: paths.name,
|
|
@@ -6087,6 +6941,7 @@ var serviceStatus = task_exports.gen(function* () {
|
|
|
6087
6941
|
running,
|
|
6088
6942
|
lastExit: state?.lastExit ?? null,
|
|
6089
6943
|
waitingFor,
|
|
6944
|
+
agents,
|
|
6090
6945
|
definition: paths.definitionPath,
|
|
6091
6946
|
log: paths.logPath,
|
|
6092
6947
|
signedIn: signInProblem === null
|
|
@@ -6097,6 +6952,7 @@ var serviceStatus = task_exports.gen(function* () {
|
|
|
6097
6952
|
...installed ? [
|
|
6098
6953
|
`Running: ${running ? waitingFor === null ? "yes" : "yes, waiting for a missing program" : loaded ? "no" : "no, not loaded"}`,
|
|
6099
6954
|
...waitingFor === null ? [] : [`Waiting: ${waitingFor}`],
|
|
6955
|
+
...agents.map((line) => `Agent: ${line}`),
|
|
6100
6956
|
...manager.stopsThroughRunner ? [] : [`Last exit: ${state?.lastExit ?? "none"}`]
|
|
6101
6957
|
] : [],
|
|
6102
6958
|
`Log: ${paths.logPath}`,
|
|
@@ -6145,6 +7001,11 @@ var missingProgramOf = (paths) => task_exports.gen(function* () {
|
|
|
6145
7001
|
const written = yield* env.files.read(serviceMissingPath(credentialDirectory(env), server));
|
|
6146
7002
|
return written?.trim() || null;
|
|
6147
7003
|
});
|
|
7004
|
+
var agentsOf = (paths) => task_exports.gen(function* () {
|
|
7005
|
+
const env = yield* task_exports.ask();
|
|
7006
|
+
const written = yield* env.files.read(serviceAgentsPath(credentialDirectory(env), paths.server));
|
|
7007
|
+
return (written ?? "").split("\n").filter((line) => line.trim() !== "");
|
|
7008
|
+
});
|
|
6148
7009
|
var installedState = (manager, paths, needsState) => task_exports.gen(function* () {
|
|
6149
7010
|
const env = yield* task_exports.ask();
|
|
6150
7011
|
if (manager.writesFile) {
|
|
@@ -6291,7 +7152,7 @@ var PRIVATE_DIRECTORY_MODE = 448;
|
|
|
6291
7152
|
|
|
6292
7153
|
// ../cli/src/node-launcher.ts
|
|
6293
7154
|
import { spawn } from "node:child_process";
|
|
6294
|
-
var nodeLauncher = (platform, start = spawn, kill = (pid, signal) => process.kill(pid, signal), agentErrors = "inherit", systemRoot = process.env.SystemRoot ?? "C:\\Windows") => ({
|
|
7155
|
+
var nodeLauncher = (platform, start = spawn, kill = (pid, signal) => process.kill(pid, signal), agentErrors = "inherit", systemRoot = process.env.SystemRoot ?? "C:\\Windows", writeError = (chunk) => void process.stderr.write(chunk)) => ({
|
|
6295
7156
|
openInBrowser: (url) => {
|
|
6296
7157
|
if (!isWebAddress(url)) return Promise.resolve(false);
|
|
6297
7158
|
const [command2, ...args] = openerCommand(platform, url);
|
|
@@ -6306,14 +7167,17 @@ var nodeLauncher = (platform, start = spawn, kill = (pid, signal) => process.kil
|
|
|
6306
7167
|
},
|
|
6307
7168
|
runAgent: (command2, prompt, environment, signal) => new Promise((resolve, reject) => {
|
|
6308
7169
|
const isWindows = platform === "win32";
|
|
6309
|
-
const
|
|
6310
|
-
|
|
6311
|
-
|
|
7170
|
+
const [program, args] = isWindows ? cmdCommand(systemRoot, command2) : [command2, []];
|
|
7171
|
+
const child = start(program, args, {
|
|
7172
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
7173
|
+
shell: !isWindows,
|
|
6312
7174
|
env: { ...environment },
|
|
6313
|
-
...isWindows ? { windowsHide: true } : { detached: true }
|
|
7175
|
+
...isWindows ? { windowsHide: true, windowsVerbatimArguments: true } : { detached: true }
|
|
6314
7176
|
});
|
|
6315
7177
|
const chunks = [];
|
|
7178
|
+
const errorChunks = [];
|
|
6316
7179
|
let size = 0;
|
|
7180
|
+
let errorSize = 0;
|
|
6317
7181
|
const stopGroup = () => {
|
|
6318
7182
|
if (isWindows) stopProcessTree(child.pid, start, systemRoot);
|
|
6319
7183
|
else stopProcessGroup(child.pid, kill);
|
|
@@ -6326,15 +7190,28 @@ var nodeLauncher = (platform, start = spawn, kill = (pid, signal) => process.kil
|
|
|
6326
7190
|
size += chunk.length;
|
|
6327
7191
|
if (size <= AGENT_OUTPUT_MAX_BYTES) chunks.push(chunk);
|
|
6328
7192
|
});
|
|
7193
|
+
child.stderr?.on("data", (chunk) => {
|
|
7194
|
+
if (agentErrors === "inherit") writeError(chunk);
|
|
7195
|
+
errorSize += chunk.length;
|
|
7196
|
+
if (errorSize <= AGENT_ERRORS_MAX_BYTES) errorChunks.push(chunk);
|
|
7197
|
+
});
|
|
6329
7198
|
child.stdin?.on("error", () => {
|
|
6330
7199
|
});
|
|
6331
7200
|
child.once("error", reject);
|
|
6332
|
-
child.once(
|
|
7201
|
+
child.once(
|
|
7202
|
+
"close",
|
|
7203
|
+
(exitCode) => resolve({
|
|
7204
|
+
exitCode,
|
|
7205
|
+
output: Buffer.concat(chunks).toString("utf8"),
|
|
7206
|
+
errors: Buffer.concat(errorChunks).toString("utf8")
|
|
7207
|
+
})
|
|
7208
|
+
);
|
|
6333
7209
|
child.stdin?.end(prompt);
|
|
6334
7210
|
})
|
|
6335
7211
|
});
|
|
6336
7212
|
var openerCommand = (platform, url) => platform === "darwin" ? ["open", url] : platform === "win32" ? ["rundll32", "url.dll,FileProtocolHandler", url] : ["xdg-open", url];
|
|
6337
7213
|
var AGENT_OUTPUT_MAX_BYTES = 1e6;
|
|
7214
|
+
var AGENT_ERRORS_MAX_BYTES = 64e3;
|
|
6338
7215
|
var isWebAddress = (url) => URL.canParse(url) && ["http:", "https:"].includes(new URL(url).protocol);
|
|
6339
7216
|
var taskkillCommand = (systemRoot, pid) => [
|
|
6340
7217
|
`${systemRoot}\\System32\\taskkill.exe`,
|
|
@@ -6425,6 +7302,15 @@ var PERMISSION_BITS = 511;
|
|
|
6425
7302
|
import { chmod as chmod2, mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
|
|
6426
7303
|
import { dirname as dirname2, join } from "node:path";
|
|
6427
7304
|
var credentialFilePath = (environment, homeDirectory) => join(environment.XDG_CONFIG_HOME || join(homeDirectory, ".config"), "homingbird", "mcp-credentials.json");
|
|
7305
|
+
var readRunnerCredential = (path, serverUrl) => task_exports.catchAll(() => task_exports.succeed(null))(
|
|
7306
|
+
task_exports.gen(function* () {
|
|
7307
|
+
const text = yield* task_exports.tryPromise(() => readFile2(path, "utf8"), unreadable);
|
|
7308
|
+
const parsed3 = yield* task_exports.attempt(() => JSON.parse(text), unreadable);
|
|
7309
|
+
const decoded = RunnerCredential.decode(parsed3);
|
|
7310
|
+
if (decoded._tag === "Err") return null;
|
|
7311
|
+
return sameServer(decoded.value.serverUrl, serverUrl) ? decoded.value.token : null;
|
|
7312
|
+
})
|
|
7313
|
+
);
|
|
6428
7314
|
var readCredential2 = (path, serverUrl) => task_exports.map((all3) => all3[serverUrl] ?? null)(readAll(path));
|
|
6429
7315
|
var storeCredential = (path, serverUrl, credential) => task_exports.flatMap((all3) => writeAll(path, { ...all3, [serverUrl]: credential }))(readAll(path));
|
|
6430
7316
|
var removeCredential2 = (path, serverUrl) => task_exports.flatMap((all3) => {
|
|
@@ -6447,6 +7333,11 @@ var readAll = (path) => task_exports.catchAll(() => task_exports.succeed({}))(
|
|
|
6447
7333
|
})
|
|
6448
7334
|
);
|
|
6449
7335
|
var unreadable = () => "unreadable";
|
|
7336
|
+
var RunnerCredential = schema_exports.struct({
|
|
7337
|
+
serverUrl: schema_exports.string({ pattern: /^https?:\/\// }),
|
|
7338
|
+
token: schema_exports.string({ minLength: 1 })
|
|
7339
|
+
});
|
|
7340
|
+
var sameServer = (a, b) => a.replace(/\/+$/, "") === b.replace(/\/+$/, "");
|
|
6450
7341
|
|
|
6451
7342
|
// src/browser-opener.ts
|
|
6452
7343
|
var browserOpener = (launch, platform, serverUrl) => (url) => isWithin(serverUrl, url) ? task_exports.catchAll(() => task_exports.succeed(false))(
|
|
@@ -6488,11 +7379,6 @@ var waitingTriggers = (context, except = /* @__PURE__ */ new Set()) => task_expo
|
|
|
6488
7379
|
var waitingNoteIds = (context) => task_exports.map(
|
|
6489
7380
|
({ items }) => new Set(items.map((item) => item.note.id))
|
|
6490
7381
|
)(context.api["inbox.list"]({ query: {} }));
|
|
6491
|
-
var WAKING_EVENTS = [
|
|
6492
|
-
"note.sent",
|
|
6493
|
-
"draft.requested",
|
|
6494
|
-
"resync"
|
|
6495
|
-
];
|
|
6496
7382
|
var announcedRequests = () => {
|
|
6497
7383
|
const seen = /* @__PURE__ */ new Set();
|
|
6498
7384
|
return { has: (id) => seen.has(id), add: (id) => void seen.add(id) };
|
|
@@ -6591,7 +7477,7 @@ var makeChannel = (context, write) => {
|
|
|
6591
7477
|
isOpen = true;
|
|
6592
7478
|
}),
|
|
6593
7479
|
online: pushWhenOpen,
|
|
6594
|
-
received: (event2) =>
|
|
7480
|
+
received: (event2) => isWakingEvent(event2.body, null) ? pushWhenOpen : task_exports.unit
|
|
6595
7481
|
};
|
|
6596
7482
|
};
|
|
6597
7483
|
var channelNotification = (trigger) => ({
|
|
@@ -6734,6 +7620,8 @@ var BASIS_DESCRIPTION = 'What you read or relied on for this draft, such as "Rea
|
|
|
6734
7620
|
var SIGN_IN_FIRST = "Not signed in to Homingbird. Call the login tool first.";
|
|
6735
7621
|
var ANALYTICS_NOTICE2 = "This Homingbird server counts anonymous usage from the web client and the command line, never notes, names or email addresses; this MCP adapter sends none. People turn it off with `homingbird analytics off` or DO_NOT_TRACK=1.";
|
|
6736
7622
|
var makeLocalSession = (options) => {
|
|
7623
|
+
const runnerCredential = options.runnerCredentialPath ?? null;
|
|
7624
|
+
if (runnerCredential !== null) return runnersSession(options, runnerCredential);
|
|
6737
7625
|
const { serverUrl, credentialPath, scope, clock } = options;
|
|
6738
7626
|
const fetching = options.fetch !== void 0 ? { fetch: options.fetch } : {};
|
|
6739
7627
|
const flow = {
|
|
@@ -6865,6 +7753,37 @@ The code ${pending.userCode} is already filled in: one click there finishes it.
|
|
|
6865
7753
|
})
|
|
6866
7754
|
};
|
|
6867
7755
|
};
|
|
7756
|
+
var runnersSession = (options, path) => {
|
|
7757
|
+
const { serverUrl } = options;
|
|
7758
|
+
const fetching = options.fetch !== void 0 ? { fetch: options.fetch } : {};
|
|
7759
|
+
let token = null;
|
|
7760
|
+
let refused2 = false;
|
|
7761
|
+
const signedOutText = () => `Not signed in to ${serverUrl}: ${refused2 ? "the server no longer accepts" : "this server could not read"} the runner\u2019s credential in ${path}. Sign in again with homingbird login.`;
|
|
7762
|
+
return {
|
|
7763
|
+
state: () => token === null ? { kind: "signed_out", note: null } : { kind: "signed_in" },
|
|
7764
|
+
token: () => token,
|
|
7765
|
+
protocolProblem: () => null,
|
|
7766
|
+
credentialWasRefused: () => {
|
|
7767
|
+
token = null;
|
|
7768
|
+
refused2 = true;
|
|
7769
|
+
},
|
|
7770
|
+
restore: task_exports.map((read2) => void (token = read2))(readRunnerCredential(path, serverUrl)),
|
|
7771
|
+
login: task_exports.succeed(RUNNERS_CREDENTIAL),
|
|
7772
|
+
logout: task_exports.succeed(RUNNERS_CREDENTIAL),
|
|
7773
|
+
status: task_exports.gen(function* () {
|
|
7774
|
+
if (token === null) return signedOutText();
|
|
7775
|
+
const me = yield* task_exports.result(httpApi({ serverUrl, token: () => token, ...fetching })["me.get"]({}));
|
|
7776
|
+
if (me._tag === "Ok")
|
|
7777
|
+
return `Signed in to ${serverUrl} as ${me.value.member.name} <${me.value.member.email}>, with the runner\u2019s credential "${me.value.credential.name}".`;
|
|
7778
|
+
if (me.error._tag !== "Unauthorized")
|
|
7779
|
+
return `Signed in to ${serverUrl}, but it cannot be reached right now.`;
|
|
7780
|
+
token = null;
|
|
7781
|
+
refused2 = true;
|
|
7782
|
+
return signedOutText();
|
|
7783
|
+
})
|
|
7784
|
+
};
|
|
7785
|
+
};
|
|
7786
|
+
var RUNNERS_CREDENTIAL = "This Homingbird server was started by homingbird run for one agent run, with the runner\u2019s own credential: there is nothing to sign in or out of here.";
|
|
6868
7787
|
var REVOKED_AND_REMOVED = "Signed out of Homingbird. The server revoked the credential, and it was removed from this device.";
|
|
6869
7788
|
var REMOVED_ONLY_HERE = "Signed out of Homingbird on this device only: the credential was removed here, but the server did not confirm that it revoked it, so it may still work. Revoke it in the web client's device list.";
|
|
6870
7789
|
var EXPIRY_MARGIN_MS = 6e4;
|
|
@@ -7332,6 +8251,7 @@ var webClientLink2 = (webClientUrl, conversationId) => {
|
|
|
7332
8251
|
const base2 = webClientUrl.replace(/\/+$/, "");
|
|
7333
8252
|
return conversationId === null ? `${base2}/` : `${base2}/#/c/${conversationId}`;
|
|
7334
8253
|
};
|
|
8254
|
+
var draftLink2 = (webClientUrl, draft2) => `${webClientUrl.replace(/\/+$/, "")}/#/c/${encodeURIComponent(draft2.conversationId)}?draft=${encodeURIComponent(draft2.id)}`;
|
|
7335
8255
|
|
|
7336
8256
|
// src/tools.ts
|
|
7337
8257
|
var WAIT_MAX_SECONDS = 50;
|
|
@@ -7620,13 +8540,13 @@ var TOOLS = [
|
|
|
7620
8540
|
input: { conversationId: schema_exports.optional(ConversationId), draftId: schema_exports.optional(NoteId) },
|
|
7621
8541
|
describe: {
|
|
7622
8542
|
conversationId: "Open this conversation. Leave out to open the front page.",
|
|
7623
|
-
draftId: "Open the conversation
|
|
8543
|
+
draftId: "Open this draft\u2019s card in the conversation it is waiting in."
|
|
7624
8544
|
},
|
|
7625
8545
|
run: ({ conversationId, draftId }, context) => task_exports.gen(function* () {
|
|
7626
8546
|
if (context.webClientUrl === null)
|
|
7627
8547
|
return "The address of the Homingbird web client is not known here. Ask your human to open their Homingbird in a browser.";
|
|
7628
|
-
const
|
|
7629
|
-
const link = webClientLink2(context.webClientUrl,
|
|
8548
|
+
const draft2 = conversationId === void 0 && draftId !== void 0 ? yield* context.api["notes.get"]({ params: { id: draftId } }) : null;
|
|
8549
|
+
const link = draft2 === null ? webClientLink2(context.webClientUrl, conversationId ?? null) : draft2.status === "draft" ? draftLink2(context.webClientUrl, draft2) : webClientLink2(context.webClientUrl, draft2.conversationId);
|
|
7630
8550
|
const opened = context.openInBrowser === void 0 ? false : yield* context.openInBrowser(link);
|
|
7631
8551
|
return opened ? `Opened ${link} in your human's browser. Tell them it is open, and show the link in case it did not come to the front.` : `Show this link to your human: ${link}
|
|
7632
8552
|
They approve, edit or discard drafts there. Opening it sends nothing.`;
|
|
@@ -7727,7 +8647,7 @@ var arrived = (triggers) => [
|
|
|
7727
8647
|
...triggers.map((trigger) => trigger.text)
|
|
7728
8648
|
].join("\n\n");
|
|
7729
8649
|
var awaitingApproval = (draft2, context) => {
|
|
7730
|
-
const where = context.webClientUrl === null ? "" : ` at ${
|
|
8650
|
+
const where = context.webClientUrl === null ? "" : ` at ${draftLink2(context.webClientUrl, draft2)}`;
|
|
7731
8651
|
return `Draft ${draft2.id} is saved in conversation ${draft2.conversationId}. It has NOT been sent. Your human has to approve it in the Homingbird web client${where}. Show them that link. ${APPROVAL_RULE}`;
|
|
7732
8652
|
};
|
|
7733
8653
|
var DESK_INBOX_ADVICE = "For each note, call draft_reply with its note id; for each request, call draft_note with its requestId.";
|
|
@@ -7801,12 +8721,16 @@ var METHODS = {
|
|
|
7801
8721
|
"tools/list": (_, context) => task_exports.map((debates2) => ({
|
|
7802
8722
|
tools: [
|
|
7803
8723
|
...(context.local?.tools ?? []).map(localDefinition),
|
|
7804
|
-
...toolDefinitions().filter(
|
|
8724
|
+
...toolDefinitions().filter(
|
|
8725
|
+
(tool3) => (debates2 || !DEBATE_TOOL_NAMES.includes(String(tool3.name))) && !(context.withheldTools ?? []).includes(String(tool3.name))
|
|
8726
|
+
)
|
|
7805
8727
|
]
|
|
7806
8728
|
}))((context.local?.blockedBecause() ?? null) === null ? offersDebates(context.api) : task_exports.succeed(true)),
|
|
7807
8729
|
"tools/call": (params, context) => {
|
|
7808
8730
|
const local = context.local?.tools.find((each) => each.name === params.name);
|
|
7809
8731
|
if (local !== void 0) return task_exports.map(said)(local.run);
|
|
8732
|
+
if ((context.withheldTools ?? []).includes(String(params.name)))
|
|
8733
|
+
return task_exports.fail(invalidParams(`Unknown tool: ${String(params.name)}`));
|
|
7810
8734
|
const blocked = context.local?.blockedBecause() ?? null;
|
|
7811
8735
|
if (blocked !== null) return task_exports.succeed(refused(blocked));
|
|
7812
8736
|
return task_exports.map((result2) => {
|
|
@@ -7921,10 +8845,18 @@ var USAGE2 = [
|
|
|
7921
8845
|
" the agent command by default. Also HOMINGBIRD_READER.",
|
|
7922
8846
|
" --require-toolless-reader Refuse to start when the reader is the agent command itself.",
|
|
7923
8847
|
"",
|
|
8848
|
+
"HOMINGBIRD_CREDENTIALS_FILE names the credential file of the runner that started this server for",
|
|
8849
|
+
"one agent run, as homingbird run --attach-mcp does; it then only reads that file.",
|
|
8850
|
+
"",
|
|
7924
8851
|
"Signing in happens from the MCP client: ask your agent to log in."
|
|
7925
8852
|
].join("\n");
|
|
8853
|
+
var RUNNERS_SERVER_ONLY = "HOMINGBIRD_CREDENTIALS_FILE is set: this server answers one agent run of homingbird run, so it takes no --run-agent, --desk or --channel.";
|
|
8854
|
+
var RUNNER_WITHHELD_TOOLS = ["skip_note", "wait_for_notes"];
|
|
7926
8855
|
var runStdioProgram = (program) => task_exports.gen(function* () {
|
|
7927
8856
|
const options = yield* task_exports.fromResult(optionsFrom(program));
|
|
8857
|
+
const runnerCredentialPath = program.environment.HOMINGBIRD_CREDENTIALS_FILE?.trim() || null;
|
|
8858
|
+
if (runnerCredentialPath !== null && (options.agent !== null || options.isChannel))
|
|
8859
|
+
return yield* task_exports.fail(ProgramFailed({ message: RUNNERS_SERVER_ONLY }));
|
|
7928
8860
|
const deskEnv = program.deskEnv;
|
|
7929
8861
|
if (options.agent !== null && deskEnv === void 0)
|
|
7930
8862
|
return yield* task_exports.fail(ProgramFailed({ message: "This build of homingbird-mcp cannot run a desk." }));
|
|
@@ -7951,6 +8883,7 @@ var runStdioProgram = (program) => task_exports.gen(function* () {
|
|
|
7951
8883
|
serverUrl: options.serverUrl,
|
|
7952
8884
|
clientName: options.clientName,
|
|
7953
8885
|
credentialPath: program.credentialPath,
|
|
8886
|
+
runnerCredentialPath,
|
|
7954
8887
|
scope,
|
|
7955
8888
|
clock,
|
|
7956
8889
|
...fetching,
|
|
@@ -7969,6 +8902,7 @@ var runStdioProgram = (program) => task_exports.gen(function* () {
|
|
|
7969
8902
|
local: localAdapterOf(session, desk2),
|
|
7970
8903
|
desk: options.isDesk,
|
|
7971
8904
|
announced,
|
|
8905
|
+
...runnerCredentialPath !== null && { withheldTools: RUNNER_WITHHELD_TOOLS },
|
|
7972
8906
|
...opening,
|
|
7973
8907
|
...channel !== null && {
|
|
7974
8908
|
channel: {
|
|
@@ -8016,7 +8950,7 @@ ${USAGE2}` })
|
|
|
8016
8950
|
agent: agent === "" ? null : agent,
|
|
8017
8951
|
split: isSplit ? { reader: reader === "" ? agent : reader, requireToollessReader } : null,
|
|
8018
8952
|
serverUrl: serverUrl.replace(/\/+$/, ""),
|
|
8019
|
-
clientName: flag("--name") ??
|
|
8953
|
+
clientName: flag("--name") ?? "MCP agent",
|
|
8020
8954
|
isChannel: program.arguments.includes("--channel") || program.arguments.includes("--desk"),
|
|
8021
8955
|
isDesk: program.arguments.includes("--desk")
|
|
8022
8956
|
}) : err(ProgramFailed({ message: USAGE2 }));
|
|
@@ -8024,7 +8958,7 @@ ${USAGE2}` })
|
|
|
8024
8958
|
var ProgramFailed = tagged("ProgramFailed")();
|
|
8025
8959
|
|
|
8026
8960
|
// src/version.ts
|
|
8027
|
-
var ADAPTER_VERSION = "0.3.
|
|
8961
|
+
var ADAPTER_VERSION = "0.3.2";
|
|
8028
8962
|
|
|
8029
8963
|
// src/stdio.ts
|
|
8030
8964
|
var NONCE_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
@@ -8035,7 +8969,6 @@ var exit2 = await task_exports.run(
|
|
|
8035
8969
|
arguments: process.argv.slice(2),
|
|
8036
8970
|
environment: process.env,
|
|
8037
8971
|
credentialPath: credentialFilePath(process.env, homedir()),
|
|
8038
|
-
hostName: hostname(),
|
|
8039
8972
|
version: ADAPTER_VERSION,
|
|
8040
8973
|
input: process.stdin,
|
|
8041
8974
|
write: (line) => process.stdout.write(line),
|