@uru-intelligence/cli 0.4.15 → 0.4.18
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/CHANGELOG.md +8 -0
- package/dist/library.mjs +458 -45
- package/dist/uru.mjs +2117 -212
- package/package.json +2 -4
package/dist/uru.mjs
CHANGED
|
@@ -80,6 +80,20 @@ var cliRemoteOperationContracts = [
|
|
|
80
80
|
errorResponses: [],
|
|
81
81
|
reason: "The tool parameters and result are intentionally open-world transport values. Individual tools remain CLI-only until their backend-owned exact output schemas are available."
|
|
82
82
|
},
|
|
83
|
+
{
|
|
84
|
+
id: "tool_control_plane.catalog.list",
|
|
85
|
+
operationId: "list_catalog_api_tool_control_plane_catalog_get",
|
|
86
|
+
method: "get",
|
|
87
|
+
path: "/api/tool-control-plane/catalog",
|
|
88
|
+
authentication: "bearer_required",
|
|
89
|
+
workspaceAuthorization: "optional_selector_server_validated",
|
|
90
|
+
inputSchema: "zListCatalogApiToolControlPlaneCatalogGetQuery",
|
|
91
|
+
successStatus: "200",
|
|
92
|
+
outputSchema: "CanonicalToolCatalogEntry[]",
|
|
93
|
+
responseShape: "exact",
|
|
94
|
+
stream: "none",
|
|
95
|
+
errorResponses: []
|
|
96
|
+
},
|
|
83
97
|
{
|
|
84
98
|
id: "auth.logout",
|
|
85
99
|
operationId: "logout_user_api_auth_logout_post",
|
|
@@ -211,6 +225,16 @@ function getCliRemoteOperationContract(id) {
|
|
|
211
225
|
function buildGemOperations(op) {
|
|
212
226
|
const gemOperations = [
|
|
213
227
|
op("gem.init", "gems", "Create a Gem project at a visible library/<name>.gem path.", "gem_control_plane", "init", "write"),
|
|
228
|
+
op("gem.git_source_setup", "gems", "Begin the nonce-bound GitHub source connection flow for the current workspace.", "gem_control_plane", "git_source_setup", "write"),
|
|
229
|
+
op("gem.git_source_connections_list", "gems", "List GitHub installations and repositories available to the current workspace actor.", "gem_query", "git_source_connections_list", "read"),
|
|
230
|
+
op("gem.git_source_connection_poll", "gems", "Read the state of a GitHub source setup continuation.", "gem_query", "git_source_connection_poll", "read"),
|
|
231
|
+
op("gem.git_source_connection_callback", "gems", "Complete a nonce-bound GitHub installation or OAuth callback.", "gem_control_plane", "git_source_connection_callback", "write"),
|
|
232
|
+
op("gem.git_source_inspect", "gems", "Inspect an exact GitHub ref before importing it as a Gem.", "gem_query", "git_source_inspect", "read"),
|
|
233
|
+
op("gem.git_source_import", "gems", "Import an inspected exact Git commit as a Git-backed Gem.", "gem_control_plane", "git_source_import", "write"),
|
|
234
|
+
op("gem.git_source_status", "gems", "Read Git source binding, policy, import, preview, and allowed-action state for a Gem.", "gem_query", "git_source_status", "read"),
|
|
235
|
+
op("gem.git_source_command", "gems", "Apply a bounded Git source command such as refresh, retry, policy change, publish, or preview approval.", "gem_control_plane", "git_source_command", "write"),
|
|
236
|
+
op("gem.git_source_preview_inspect", "gems", "Inspect the exact preview head and resource policy before approval.", "gem_query", "git_source_preview_inspect", "read"),
|
|
237
|
+
op("gem.git_source_preview_open", "gems", "Mint an authenticated URL for a ready Git source preview.", "gem_query", "git_source_preview_open", "read"),
|
|
214
238
|
op("gem.inspect", "gems", "Inspect Gem release readiness, bindings, secrets, and setup checks. Thumbnail image bytes are omitted by default; pass include_thumbnail=true to include them.", "gem_query", "inspect", "read"),
|
|
215
239
|
op("gem.fs_tree", "gems", "List files in a Gem project directory.", "gem_query", "fs_tree", "read"),
|
|
216
240
|
op("gem.fs_read", "gems", "Read a file from a Gem project directory.", "gem_query", "fs_read", "read"),
|
|
@@ -907,35 +931,338 @@ var DATASET_MANAGE_OPERATIONS = new Map([
|
|
|
907
931
|
["UPDATE_DATASET", "update"],
|
|
908
932
|
["DATASET_UPDATE", "update"]
|
|
909
933
|
]);
|
|
910
|
-
// ../../packages/platform-operations/src/
|
|
911
|
-
var
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
]
|
|
928
|
-
var
|
|
929
|
-
["LIST_DATASET_ROWS", "window.uru.datasets.queryRows"],
|
|
930
|
-
["DATASET_QUERY", "window.uru.datasets.queryRows"],
|
|
931
|
-
["UPSERT_DATASET_ROWS", "window.uru.datasets.upsertRows"],
|
|
932
|
-
["DELETE_DATASET_ROWS", "window.uru.datasets.deleteRows"],
|
|
933
|
-
["RESTORE_DATASET_ROWS", "window.uru.datasets.restoreRows"]
|
|
934
|
-
]);
|
|
934
|
+
// ../../packages/platform-operations/src/dataset_source_names.ts
|
|
935
|
+
var RETIRED_DATASET_SOURCE_NAMES = [
|
|
936
|
+
"CREATE_DATASET",
|
|
937
|
+
"DATASET_CREATE",
|
|
938
|
+
"UPDATE_DATASET",
|
|
939
|
+
"DATASET_UPDATE",
|
|
940
|
+
"LIST_DATASET_ROWS",
|
|
941
|
+
"DATASET_QUERY",
|
|
942
|
+
"GET_DATASET",
|
|
943
|
+
"DATASET_GET",
|
|
944
|
+
"UPSERT_DATASET_ROWS",
|
|
945
|
+
"DELETE_DATASET_ROWS",
|
|
946
|
+
"RESTORE_DATASET_ROWS",
|
|
947
|
+
"DATASET_ROWS",
|
|
948
|
+
"DATASET_SQL_READ",
|
|
949
|
+
"DATASET_SQL_WRITE",
|
|
950
|
+
"DATASET_SQL"
|
|
951
|
+
];
|
|
952
|
+
var RETIRED_DATASET_SOURCE_PATTERN = new RegExp(`\\b(${RETIRED_DATASET_SOURCE_NAMES.join("|")})\\b`);
|
|
935
953
|
// ../../packages/platform-operations/src/external_company_mcp_policy.ts
|
|
936
954
|
var externalCompanyMcpDeniedToolIds = new Set([
|
|
937
955
|
"MAGUIRE_WRITE_SQL"
|
|
938
956
|
]);
|
|
957
|
+
// ../../packages/platform-operations/src/tool_address.ts
|
|
958
|
+
var TOOL_OWNER_CLASSES = [
|
|
959
|
+
"platform",
|
|
960
|
+
"personal",
|
|
961
|
+
"adopted",
|
|
962
|
+
"company"
|
|
963
|
+
];
|
|
964
|
+
function isToolOwnerClass(value) {
|
|
965
|
+
return typeof value === "string" && TOOL_OWNER_CLASSES.includes(value);
|
|
966
|
+
}
|
|
967
|
+
var TOOL_CONNECTION_TYPES = [
|
|
968
|
+
"platform",
|
|
969
|
+
"composio",
|
|
970
|
+
"managed_mcp",
|
|
971
|
+
"external_mcp",
|
|
972
|
+
"company"
|
|
973
|
+
];
|
|
974
|
+
function isToolConnectionType(value) {
|
|
975
|
+
return typeof value === "string" && TOOL_CONNECTION_TYPES.includes(value);
|
|
976
|
+
}
|
|
977
|
+
var TOOL_CONNECTION_TYPE_LABELS = {
|
|
978
|
+
platform: "Uru",
|
|
979
|
+
composio: "Marketplace",
|
|
980
|
+
managed_mcp: "Managed MCP",
|
|
981
|
+
external_mcp: "Custom MCP",
|
|
982
|
+
company: "Company"
|
|
983
|
+
};
|
|
984
|
+
function toolConnectionTypeLabel(type) {
|
|
985
|
+
return TOOL_CONNECTION_TYPE_LABELS[type];
|
|
986
|
+
}
|
|
987
|
+
function parseToolAddress(address) {
|
|
988
|
+
const segments = address.trim().split(".");
|
|
989
|
+
if (segments.length !== 4) {
|
|
990
|
+
return null;
|
|
991
|
+
}
|
|
992
|
+
const [provider, owner, connection, tool] = segments;
|
|
993
|
+
if (provider === undefined || owner === undefined || connection === undefined || tool === undefined || provider === "" || tool === "" || !isToolOwnerClass(owner)) {
|
|
994
|
+
return null;
|
|
995
|
+
}
|
|
996
|
+
return { provider, owner, connection, tool };
|
|
997
|
+
}
|
|
998
|
+
var TOOL_SEARCH_MIN_TERM_LENGTH = 2;
|
|
999
|
+
var TOOL_SEARCH_MIN_PENALTY_TERM_LENGTH = 3;
|
|
1000
|
+
var TOOL_SEARCH_STOP_WORDS = new Set([
|
|
1001
|
+
"about",
|
|
1002
|
+
"after",
|
|
1003
|
+
"all",
|
|
1004
|
+
"am",
|
|
1005
|
+
"an",
|
|
1006
|
+
"and",
|
|
1007
|
+
"any",
|
|
1008
|
+
"are",
|
|
1009
|
+
"as",
|
|
1010
|
+
"at",
|
|
1011
|
+
"be",
|
|
1012
|
+
"been",
|
|
1013
|
+
"being",
|
|
1014
|
+
"but",
|
|
1015
|
+
"by",
|
|
1016
|
+
"can",
|
|
1017
|
+
"could",
|
|
1018
|
+
"did",
|
|
1019
|
+
"do",
|
|
1020
|
+
"does",
|
|
1021
|
+
"each",
|
|
1022
|
+
"for",
|
|
1023
|
+
"from",
|
|
1024
|
+
"had",
|
|
1025
|
+
"has",
|
|
1026
|
+
"have",
|
|
1027
|
+
"he",
|
|
1028
|
+
"her",
|
|
1029
|
+
"here",
|
|
1030
|
+
"him",
|
|
1031
|
+
"his",
|
|
1032
|
+
"how",
|
|
1033
|
+
"if",
|
|
1034
|
+
"in",
|
|
1035
|
+
"into",
|
|
1036
|
+
"is",
|
|
1037
|
+
"it",
|
|
1038
|
+
"its",
|
|
1039
|
+
"me",
|
|
1040
|
+
"mine",
|
|
1041
|
+
"my",
|
|
1042
|
+
"of",
|
|
1043
|
+
"on",
|
|
1044
|
+
"once",
|
|
1045
|
+
"onto",
|
|
1046
|
+
"or",
|
|
1047
|
+
"our",
|
|
1048
|
+
"ours",
|
|
1049
|
+
"out",
|
|
1050
|
+
"over",
|
|
1051
|
+
"please",
|
|
1052
|
+
"she",
|
|
1053
|
+
"should",
|
|
1054
|
+
"so",
|
|
1055
|
+
"some",
|
|
1056
|
+
"such",
|
|
1057
|
+
"than",
|
|
1058
|
+
"that",
|
|
1059
|
+
"the",
|
|
1060
|
+
"their",
|
|
1061
|
+
"theirs",
|
|
1062
|
+
"them",
|
|
1063
|
+
"then",
|
|
1064
|
+
"there",
|
|
1065
|
+
"these",
|
|
1066
|
+
"they",
|
|
1067
|
+
"this",
|
|
1068
|
+
"those",
|
|
1069
|
+
"to",
|
|
1070
|
+
"up",
|
|
1071
|
+
"us",
|
|
1072
|
+
"was",
|
|
1073
|
+
"we",
|
|
1074
|
+
"were",
|
|
1075
|
+
"what",
|
|
1076
|
+
"when",
|
|
1077
|
+
"where",
|
|
1078
|
+
"which",
|
|
1079
|
+
"while",
|
|
1080
|
+
"who",
|
|
1081
|
+
"whom",
|
|
1082
|
+
"why",
|
|
1083
|
+
"will",
|
|
1084
|
+
"with",
|
|
1085
|
+
"would",
|
|
1086
|
+
"you",
|
|
1087
|
+
"your",
|
|
1088
|
+
"yours"
|
|
1089
|
+
]);
|
|
1090
|
+
var TOOL_SEARCH_FIELD_WEIGHTS = {
|
|
1091
|
+
tool: 12,
|
|
1092
|
+
title: 8,
|
|
1093
|
+
address: 6,
|
|
1094
|
+
description: 5,
|
|
1095
|
+
category: 4
|
|
1096
|
+
};
|
|
1097
|
+
var PHRASE_EXACT_MULTIPLIER = 14;
|
|
1098
|
+
var PHRASE_PREFIX_MULTIPLIER = 9;
|
|
1099
|
+
var PHRASE_CONTAINS_MULTIPLIER = 6;
|
|
1100
|
+
var TERM_EXACT_MULTIPLIER = 4;
|
|
1101
|
+
var TERM_PARTIAL_MULTIPLIER = 2;
|
|
1102
|
+
var TERM_SUBSTRING_MULTIPLIER = 1;
|
|
1103
|
+
var TERM_PARTIAL_MIN_LENGTH = 4;
|
|
1104
|
+
var TOOL_SEARCH_MISS_PENALTY = 8;
|
|
1105
|
+
var TOOL_SEARCH_FULL_COVERAGE_BONUS = 25;
|
|
1106
|
+
function normalizeToolSearchText(value) {
|
|
1107
|
+
return value.replace(/([a-z0-9])([A-Z])/gu, "$1 $2").replace(/[_./:@-]+/gu, " ").toLowerCase().replace(/\s+/gu, " ").trim();
|
|
1108
|
+
}
|
|
1109
|
+
function stemToolSearchTerm(token) {
|
|
1110
|
+
if (token.length > 4 && token.endsWith("ies")) {
|
|
1111
|
+
return `${token.slice(0, -3)}y`;
|
|
1112
|
+
}
|
|
1113
|
+
if (token.length > 4 && (token.endsWith("ses") || token.endsWith("xes") || token.endsWith("zes") || token.endsWith("ches") || token.endsWith("shes"))) {
|
|
1114
|
+
return token.slice(0, -2);
|
|
1115
|
+
}
|
|
1116
|
+
if (token.length > 3 && token.endsWith("s") && !token.endsWith("ss") && !token.endsWith("us")) {
|
|
1117
|
+
return token.slice(0, -1);
|
|
1118
|
+
}
|
|
1119
|
+
return token;
|
|
1120
|
+
}
|
|
1121
|
+
function tokenizeToolSearchText(value) {
|
|
1122
|
+
return normalizeToolSearchText(value).split(/[^a-z0-9]+/u).filter((token) => token.length >= TOOL_SEARCH_MIN_TERM_LENGTH).map(stemToolSearchTerm);
|
|
1123
|
+
}
|
|
1124
|
+
function prepareToolSearchField(value) {
|
|
1125
|
+
const text = value ?? "";
|
|
1126
|
+
const tokens = tokenizeToolSearchText(text);
|
|
1127
|
+
return { raw: normalizeToolSearchText(text), tokens, phrase: tokens.join(" ") };
|
|
1128
|
+
}
|
|
1129
|
+
function toolSearchQueryTerms(query) {
|
|
1130
|
+
const seen = new Set;
|
|
1131
|
+
const terms = [];
|
|
1132
|
+
for (const token of tokenizeToolSearchText(query)) {
|
|
1133
|
+
if (TOOL_SEARCH_STOP_WORDS.has(token) || seen.has(token)) {
|
|
1134
|
+
continue;
|
|
1135
|
+
}
|
|
1136
|
+
seen.add(token);
|
|
1137
|
+
terms.push(token);
|
|
1138
|
+
}
|
|
1139
|
+
return terms;
|
|
1140
|
+
}
|
|
1141
|
+
function scoreToolSearchField(phrase, terms, field, weight) {
|
|
1142
|
+
if (field.raw === "") {
|
|
1143
|
+
return { score: 0, matched: new Set };
|
|
1144
|
+
}
|
|
1145
|
+
let score = 0;
|
|
1146
|
+
const matched = new Set;
|
|
1147
|
+
if (phrase.length >= TOOL_SEARCH_MIN_TERM_LENGTH) {
|
|
1148
|
+
if (field.phrase === phrase) {
|
|
1149
|
+
score += weight * PHRASE_EXACT_MULTIPLIER;
|
|
1150
|
+
} else if (field.phrase.startsWith(phrase)) {
|
|
1151
|
+
score += weight * PHRASE_PREFIX_MULTIPLIER;
|
|
1152
|
+
} else if (field.phrase.includes(phrase)) {
|
|
1153
|
+
score += weight * PHRASE_CONTAINS_MULTIPLIER;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
for (const term of terms) {
|
|
1157
|
+
if (field.tokens.includes(term)) {
|
|
1158
|
+
score += weight * TERM_EXACT_MULTIPLIER;
|
|
1159
|
+
matched.add(term);
|
|
1160
|
+
continue;
|
|
1161
|
+
}
|
|
1162
|
+
if (field.tokens.some((candidate) => (candidate.startsWith(term) || term.startsWith(candidate)) && Math.min(candidate.length, term.length) >= TERM_PARTIAL_MIN_LENGTH)) {
|
|
1163
|
+
score += weight * TERM_PARTIAL_MULTIPLIER;
|
|
1164
|
+
matched.add(term);
|
|
1165
|
+
continue;
|
|
1166
|
+
}
|
|
1167
|
+
if (field.raw.includes(term)) {
|
|
1168
|
+
score += weight * TERM_SUBSTRING_MULTIPLIER;
|
|
1169
|
+
matched.add(term);
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
return { score, matched };
|
|
1173
|
+
}
|
|
1174
|
+
function scoreToolRelevance(fields, query, options = {}) {
|
|
1175
|
+
const terms = toolSearchQueryTerms(query);
|
|
1176
|
+
if (terms.length === 0) {
|
|
1177
|
+
return 0;
|
|
1178
|
+
}
|
|
1179
|
+
const phrase = terms.join(" ");
|
|
1180
|
+
const scored = [
|
|
1181
|
+
scoreToolSearchField(phrase, terms, prepareToolSearchField(fields.tool), TOOL_SEARCH_FIELD_WEIGHTS.tool),
|
|
1182
|
+
scoreToolSearchField(phrase, terms, prepareToolSearchField(fields.title), TOOL_SEARCH_FIELD_WEIGHTS.title),
|
|
1183
|
+
scoreToolSearchField(phrase, terms, prepareToolSearchField(fields.address), TOOL_SEARCH_FIELD_WEIGHTS.address),
|
|
1184
|
+
scoreToolSearchField(phrase, terms, prepareToolSearchField(fields.description), TOOL_SEARCH_FIELD_WEIGHTS.description),
|
|
1185
|
+
scoreToolSearchField(phrase, terms, prepareToolSearchField(fields.category), TOOL_SEARCH_FIELD_WEIGHTS.category)
|
|
1186
|
+
];
|
|
1187
|
+
const matched = new Set;
|
|
1188
|
+
let score = 0;
|
|
1189
|
+
for (const field of scored) {
|
|
1190
|
+
score += field.score;
|
|
1191
|
+
for (const term of field.matched) {
|
|
1192
|
+
matched.add(term);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
if (matched.size === 0) {
|
|
1196
|
+
return 0;
|
|
1197
|
+
}
|
|
1198
|
+
if (matched.size === terms.length) {
|
|
1199
|
+
score += TOOL_SEARCH_FULL_COVERAGE_BONUS;
|
|
1200
|
+
} else if (options.missPenalty === true) {
|
|
1201
|
+
for (const term of terms) {
|
|
1202
|
+
if (!matched.has(term) && term.length >= TOOL_SEARCH_MIN_PENALTY_TERM_LENGTH) {
|
|
1203
|
+
score -= TOOL_SEARCH_MISS_PENALTY;
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
return score;
|
|
1208
|
+
}
|
|
1209
|
+
// ../../packages/platform-operations/src/tool_refusal_envelope.ts
|
|
1210
|
+
var TOOL_REFUSAL_STATUSES = [
|
|
1211
|
+
"approval_required",
|
|
1212
|
+
"refused_by_policy"
|
|
1213
|
+
];
|
|
1214
|
+
function isToolRefusalStatus(value) {
|
|
1215
|
+
return typeof value === "string" && TOOL_REFUSAL_STATUSES.includes(value);
|
|
1216
|
+
}
|
|
1217
|
+
var TOOL_REFUSAL_ENVELOPE_FIELDS = [
|
|
1218
|
+
"status",
|
|
1219
|
+
"questionId",
|
|
1220
|
+
"writeClass",
|
|
1221
|
+
"toolName"
|
|
1222
|
+
];
|
|
1223
|
+
function asRecord(value) {
|
|
1224
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
1225
|
+
return null;
|
|
1226
|
+
}
|
|
1227
|
+
return value;
|
|
1228
|
+
}
|
|
1229
|
+
function readToolRefusalEnvelope(value) {
|
|
1230
|
+
const record = asRecord(value);
|
|
1231
|
+
if (record === null) {
|
|
1232
|
+
return { outcome: "absent" };
|
|
1233
|
+
}
|
|
1234
|
+
const status = record["status"];
|
|
1235
|
+
if (!isToolRefusalStatus(status)) {
|
|
1236
|
+
return { outcome: "absent" };
|
|
1237
|
+
}
|
|
1238
|
+
const declared = TOOL_REFUSAL_ENVELOPE_FIELDS;
|
|
1239
|
+
for (const key of Object.keys(record).sort()) {
|
|
1240
|
+
if (!declared.includes(key)) {
|
|
1241
|
+
return { outcome: "undeclared_field", field: key };
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
const questionId = record["questionId"];
|
|
1245
|
+
if (typeof questionId !== "string" && questionId !== null) {
|
|
1246
|
+
return { outcome: "malformed_field", field: "questionId" };
|
|
1247
|
+
}
|
|
1248
|
+
const writeClass = record["writeClass"];
|
|
1249
|
+
if (typeof writeClass !== "string") {
|
|
1250
|
+
return { outcome: "malformed_field", field: "writeClass" };
|
|
1251
|
+
}
|
|
1252
|
+
const toolName = record["toolName"];
|
|
1253
|
+
if (toolName !== undefined && typeof toolName !== "string") {
|
|
1254
|
+
return { outcome: "malformed_field", field: "toolName" };
|
|
1255
|
+
}
|
|
1256
|
+
return {
|
|
1257
|
+
outcome: "envelope",
|
|
1258
|
+
envelope: {
|
|
1259
|
+
status,
|
|
1260
|
+
questionId,
|
|
1261
|
+
writeClass,
|
|
1262
|
+
...toolName === undefined ? {} : { toolName }
|
|
1263
|
+
}
|
|
1264
|
+
};
|
|
1265
|
+
}
|
|
939
1266
|
// ../../packages/platform-operations/src/wrapper_tool_names.ts
|
|
940
1267
|
var WRAPPER_LIST_TOOLS_SUFFIX = "__list_tools";
|
|
941
1268
|
var WRAPPER_EXECUTE_TOOL_SUFFIX = "__execute_tool";
|
|
@@ -1103,11 +1430,7 @@ var remoteContractsByCommand = {
|
|
|
1103
1430
|
"platform.tools.schema",
|
|
1104
1431
|
...TOOL_EXECUTION_CONTRACTS
|
|
1105
1432
|
],
|
|
1106
|
-
tools: [
|
|
1107
|
-
"platform.tools.list",
|
|
1108
|
-
"platform.tools.schema",
|
|
1109
|
-
...TOOL_EXECUTION_CONTRACTS
|
|
1110
|
-
],
|
|
1433
|
+
tools: ["tool_control_plane.catalog.list", ...TOOL_EXECUTION_CONTRACTS],
|
|
1111
1434
|
init: TOOL_EXECUTION_CONTRACTS,
|
|
1112
1435
|
build: TOOL_EXECUTION_CONTRACTS,
|
|
1113
1436
|
deploy: TOOL_EXECUTION_CONTRACTS,
|
|
@@ -1150,7 +1473,7 @@ var cliCommandSpecs = [
|
|
|
1150
1473
|
spec("mcp", "Print or install MCP client configuration", "optional", "optional", "write", TEXT_AND_JSON),
|
|
1151
1474
|
spec("complete", "Generate shell completion metadata", "none", "none", "read", TEXT_AND_JSON),
|
|
1152
1475
|
spec("update", "Check for a newer CLI and print the install command", "none", "none", "read", TEXT_AND_JSON),
|
|
1153
|
-
spec("tools", "
|
|
1476
|
+
spec("tools", "Search, inspect and run every tool you can reach", "required", "required", "write", ALL_OUTPUTS),
|
|
1154
1477
|
spec("init", "Initialize a Gem project", "required", "required", "write", TEXT_AND_JSON),
|
|
1155
1478
|
spec("build", "Build a Gem", "required", "required", "write", TEXT_AND_JSON),
|
|
1156
1479
|
spec("deploy", "Save and deploy a Gem Version", "required", "required", "write", ALL_OUTPUTS),
|
|
@@ -1196,6 +1519,14 @@ var booleanFlag = (token) => ({
|
|
|
1196
1519
|
});
|
|
1197
1520
|
var valueFlag = (token, options = {}) => ({ token, value: "required", ...options });
|
|
1198
1521
|
var paramsJsonFlag = () => valueFlag("--params-json", { aliases: ["--args-json"] });
|
|
1522
|
+
var toolParamsJsonFlag = () => valueFlag("--params-json", { aliases: ["--args-json", "-d", "--data"] });
|
|
1523
|
+
var toolCatalogFilterFlags = [
|
|
1524
|
+
valueFlag("--namespace"),
|
|
1525
|
+
valueFlag("--owner"),
|
|
1526
|
+
valueFlag("--type"),
|
|
1527
|
+
valueFlag("--category"),
|
|
1528
|
+
valueFlag("--limit")
|
|
1529
|
+
];
|
|
1199
1530
|
var enumFlag = (token, values) => ({ token, value: "one_of", values });
|
|
1200
1531
|
function pathSpec(path, binding, positionals = [], localFlags = [], options = {}) {
|
|
1201
1532
|
return {
|
|
@@ -1322,33 +1653,61 @@ var cliCommandPathSpecs = [
|
|
|
1322
1653
|
positionals: [required("operation-id")],
|
|
1323
1654
|
localFlags: [paramsJsonFlag()]
|
|
1324
1655
|
},
|
|
1656
|
+
{
|
|
1657
|
+
path: ["tools", "search"],
|
|
1658
|
+
binding: "tools",
|
|
1659
|
+
helpKey: "tools",
|
|
1660
|
+
positionals: [variadic("task")],
|
|
1661
|
+
localFlags: [...toolCatalogFilterFlags, valueFlag("--offset")]
|
|
1662
|
+
},
|
|
1325
1663
|
{
|
|
1326
1664
|
path: ["tools", "ls"],
|
|
1665
|
+
aliases: [["tools", "list"]],
|
|
1327
1666
|
binding: "tools",
|
|
1328
1667
|
helpKey: "tools",
|
|
1329
1668
|
positionals: [],
|
|
1330
|
-
localFlags: []
|
|
1669
|
+
localFlags: [...toolCatalogFilterFlags]
|
|
1670
|
+
},
|
|
1671
|
+
{
|
|
1672
|
+
path: ["tools", "connections"],
|
|
1673
|
+
binding: "tools",
|
|
1674
|
+
helpKey: "tools",
|
|
1675
|
+
positionals: [],
|
|
1676
|
+
localFlags: [valueFlag("--owner"), valueFlag("--type")]
|
|
1331
1677
|
},
|
|
1332
1678
|
{
|
|
1333
1679
|
path: ["tools", "schema"],
|
|
1334
1680
|
binding: "tools",
|
|
1335
1681
|
helpKey: "tools",
|
|
1336
|
-
positionals: [required("
|
|
1682
|
+
positionals: [required("address")],
|
|
1337
1683
|
localFlags: []
|
|
1338
1684
|
},
|
|
1339
1685
|
{
|
|
1340
1686
|
path: ["tools", "inspect"],
|
|
1341
1687
|
binding: "tools",
|
|
1342
1688
|
helpKey: "tools",
|
|
1343
|
-
positionals: [required("
|
|
1689
|
+
positionals: [required("address")],
|
|
1344
1690
|
localFlags: []
|
|
1345
1691
|
},
|
|
1346
1692
|
{
|
|
1347
1693
|
path: ["tools", "run"],
|
|
1348
1694
|
binding: "tools",
|
|
1349
1695
|
helpKey: "tools",
|
|
1350
|
-
positionals: [required("
|
|
1351
|
-
localFlags: [
|
|
1696
|
+
positionals: [required("address")],
|
|
1697
|
+
localFlags: [
|
|
1698
|
+
toolParamsJsonFlag(),
|
|
1699
|
+
booleanFlag("--get-schema"),
|
|
1700
|
+
booleanFlag("--dry-run"),
|
|
1701
|
+
booleanFlag("--parallel"),
|
|
1702
|
+
valueFlag("--mcp-url")
|
|
1703
|
+
]
|
|
1704
|
+
},
|
|
1705
|
+
{
|
|
1706
|
+
path: ["tools", "approve"],
|
|
1707
|
+
binding: "tools",
|
|
1708
|
+
helpKey: "tools",
|
|
1709
|
+
positionals: [required("question-id")],
|
|
1710
|
+
localFlags: [booleanFlag("--accept"), booleanFlag("--decline")]
|
|
1352
1711
|
},
|
|
1353
1712
|
...libraryPathSpecs(),
|
|
1354
1713
|
...datasetPathSpecs(),
|
|
@@ -1632,7 +1991,7 @@ function topLevelPathSpecs() {
|
|
|
1632
1991
|
pathSpec(["secrets"], "secrets"),
|
|
1633
1992
|
pathSpec(["env"], "env"),
|
|
1634
1993
|
pathSpec(["operations"], "operations"),
|
|
1635
|
-
pathSpec(["tools"], "tools"),
|
|
1994
|
+
pathSpec(["tools"], "tools", [variadic("address")], [valueFlag("--match"), valueFlag("--limit")]),
|
|
1636
1995
|
pathSpec(["mcp"], "mcp")
|
|
1637
1996
|
];
|
|
1638
1997
|
}
|
|
@@ -1765,6 +2124,25 @@ function gemPathSpecs() {
|
|
|
1765
2124
|
...gemRefFlags
|
|
1766
2125
|
]),
|
|
1767
2126
|
pathSpec(["gems", "status"], "gems", [optional("gem")], gemRefFlags),
|
|
2127
|
+
pathSpec(["gems", "source", "status"], "gems", [optional("gem")], gemRefFlags),
|
|
2128
|
+
pathSpec(["gems", "source", "refresh"], "gems", [optional("gem")], gemRefFlags),
|
|
2129
|
+
pathSpec(["gems", "source", "copy"], "gems", [optional("gem")], gemRefFlags),
|
|
2130
|
+
pathSpec(["gems", "source", "retry"], "gems", [optional("gem")], [...gemRefFlags, valueFlag("--import-id"), valueFlag("--idempotency-key")]),
|
|
2131
|
+
pathSpec(["gems", "source", "cancel"], "gems", [optional("gem")], [...gemRefFlags, valueFlag("--import-id"), booleanFlag("--yes")]),
|
|
2132
|
+
pathSpec(["gems", "source", "policy"], "gems", [optional("gem")], [
|
|
2133
|
+
...gemRefFlags,
|
|
2134
|
+
valueFlag("--expected-revision"),
|
|
2135
|
+
valueFlag("--automatic-publishing"),
|
|
2136
|
+
valueFlag("--previews-enabled")
|
|
2137
|
+
], { aliases: [["gems", "source", "change-policy"]] }),
|
|
2138
|
+
pathSpec(["gems", "source", "disconnect"], "gems", [optional("gem")], [...gemRefFlags, valueFlag("--expected-revision"), booleanFlag("--yes")]),
|
|
2139
|
+
pathSpec(["gems", "source", "change-source"], "gems", [optional("gem")], [
|
|
2140
|
+
...gemRefFlags,
|
|
2141
|
+
valueFlag("--expected-revision"),
|
|
2142
|
+
valueFlag("--ref"),
|
|
2143
|
+
valueFlag("--app-directory"),
|
|
2144
|
+
valueFlag("--commit-sha")
|
|
2145
|
+
], { aliases: [["gems", "source", "source-change"]] }),
|
|
1768
2146
|
pathSpec(["gems", "read"], "gems", [required("gem-path"), required("file")]),
|
|
1769
2147
|
pathSpec(["gems", "write"], "gems", [required("gem-path"), required("file")], [valueFlag("--file"), valueFlag("--content"), booleanFlag("--no-create")]),
|
|
1770
2148
|
pathSpec(["gems", "versions", "save"], "gems", [optional("gem")], [
|
|
@@ -2388,7 +2766,21 @@ var cliRootHelpGroups = [
|
|
|
2388
2766
|
{
|
|
2389
2767
|
command: "tools",
|
|
2390
2768
|
lines: [
|
|
2391
|
-
|
|
2769
|
+
' uru tools search "<task>" [--limit N] [--namespace NS] [--owner OWNER] [--type TYPE] [--category CAT]',
|
|
2770
|
+
" Rank every reachable tool against a task",
|
|
2771
|
+
" uru tools ls [--namespace NS] [--owner OWNER] [--type TYPE] [--category CAT]",
|
|
2772
|
+
" Every tool you can reach, by connection",
|
|
2773
|
+
" --owner platform|personal|adopted|company (whose it is)",
|
|
2774
|
+
" --type platform|composio|managed_mcp|external_mcp|company (what kind)",
|
|
2775
|
+
" uru tools <partial address> --help [--match TEXT] [--limit N]",
|
|
2776
|
+
" Drill into <provider>.<owner>.<connection>.<tool>",
|
|
2777
|
+
" uru tools schema <address> Input and output shape for one tool",
|
|
2778
|
+
" uru tools inspect <address> Owner, type, connection, write class, policy answer",
|
|
2779
|
+
" uru tools run <address> -d '{...}' Run a platform or connector tool",
|
|
2780
|
+
" uru tools run <address> --get-schema|--dry-run|--parallel",
|
|
2781
|
+
" uru tools approve <question-id> --accept|--decline Answer a call that parked for approval",
|
|
2782
|
+
" uru tools connections [--owner OWNER] [--type TYPE]",
|
|
2783
|
+
" Every connection behind your tools"
|
|
2392
2784
|
]
|
|
2393
2785
|
},
|
|
2394
2786
|
{
|
|
@@ -2462,7 +2854,7 @@ function spec(id, summary, auth, workspace, safety, outputModes, cancellation =
|
|
|
2462
2854
|
// package.json
|
|
2463
2855
|
var package_default = {
|
|
2464
2856
|
name: "@uru-intelligence/cli",
|
|
2465
|
-
version: "0.4.
|
|
2857
|
+
version: "0.4.18",
|
|
2466
2858
|
private: false,
|
|
2467
2859
|
description: "Uru full-platform command line interface",
|
|
2468
2860
|
repository: {
|
|
@@ -2492,9 +2884,7 @@ var package_default = {
|
|
|
2492
2884
|
"type-check": "tsc --noEmit",
|
|
2493
2885
|
test: "bun test",
|
|
2494
2886
|
"test:unit": "bun test",
|
|
2495
|
-
|
|
2496
|
-
"format:check": "prettier --check . --ignore-path ../../.prettierignore",
|
|
2497
|
-
ci: "bun run lint && bun run type-check && bun run test:unit && bun run docs:check && bun run changelog:check && bun run format:check && bun run build && bun run smoke:package && bun run smoke:binaries",
|
|
2887
|
+
ci: "bun run lint && bun run type-check && bun run test:unit && bun run docs:check && bun run changelog:check && bun run build && bun run smoke:package && bun run smoke:binaries",
|
|
2498
2888
|
build: "node scripts/build.mjs",
|
|
2499
2889
|
prepack: "bun run build",
|
|
2500
2890
|
"docs:generate": "bun scripts/generate-docs.mjs",
|
|
@@ -8913,6 +9303,19 @@ var zAppStorageResponse = object({
|
|
|
8913
9303
|
operation: _enum(["get", "put", "delete", "list"]),
|
|
8914
9304
|
value: unknown().optional()
|
|
8915
9305
|
});
|
|
9306
|
+
var zAppSubtoolEntry = object({
|
|
9307
|
+
classification: _enum(["read", "write", "unknown"]),
|
|
9308
|
+
description: string2().nullable(),
|
|
9309
|
+
namespace: string2(),
|
|
9310
|
+
subToolName: string2()
|
|
9311
|
+
});
|
|
9312
|
+
var zAppSubtoolsResponse = object({
|
|
9313
|
+
appName: string2(),
|
|
9314
|
+
message: string2(),
|
|
9315
|
+
subtools: array(zAppSubtoolEntry),
|
|
9316
|
+
success: boolean2(),
|
|
9317
|
+
totalSubtools: int()
|
|
9318
|
+
});
|
|
8916
9319
|
var zAppSupportBundleRecord = object({
|
|
8917
9320
|
artifactId: string2(),
|
|
8918
9321
|
buildId: string2().nullish(),
|
|
@@ -9463,21 +9866,21 @@ var zBacklinkInfo = object({
|
|
|
9463
9866
|
var zBillingSettingsResponse = object({
|
|
9464
9867
|
architectEnabled: boolean2(),
|
|
9465
9868
|
automationsEnabled: boolean2(),
|
|
9466
|
-
automationsHourlyRequestLimit: int(),
|
|
9467
9869
|
automationsMonthlyPriceUsd: number2(),
|
|
9468
9870
|
automationsPlanTier: string2(),
|
|
9469
9871
|
automationsWeeklyBudgetUsd: number2(),
|
|
9470
9872
|
billingEmail: string2().nullable(),
|
|
9471
9873
|
billingName: string2().nullable(),
|
|
9472
9874
|
chatEnabled: boolean2(),
|
|
9473
|
-
chatHourlyRequestLimit: int(),
|
|
9474
9875
|
chatMonthlyPriceUsd: number2(),
|
|
9475
9876
|
chatPlanTier: string2(),
|
|
9476
9877
|
chatWeeklyBudgetUsd: number2(),
|
|
9477
9878
|
isTrial: boolean2(),
|
|
9478
9879
|
markupPercentage: number2(),
|
|
9479
9880
|
planType: string2(),
|
|
9881
|
+
spendingAlertSentAt: string2().nullable(),
|
|
9480
9882
|
spendingAlertThresholdUsd: number2().nullable(),
|
|
9883
|
+
spendingLimitReachedAt: string2().nullable(),
|
|
9481
9884
|
spendingLimitUsd: number2().nullable(),
|
|
9482
9885
|
trialEndsAt: string2().nullable(),
|
|
9483
9886
|
workspaceId: string2()
|
|
@@ -9548,6 +9951,7 @@ var zBulkPermissionsUpdateResponse = object({
|
|
|
9548
9951
|
updatedCount: int()
|
|
9549
9952
|
});
|
|
9550
9953
|
var zCanonicalToolCatalogEntry = object({
|
|
9954
|
+
address: string2(),
|
|
9551
9955
|
agentAliasFragment: string2().nullish(),
|
|
9552
9956
|
agentVisibleNamespace: string2().nullish(),
|
|
9553
9957
|
annotations: record(string2(), unknown()).nullish(),
|
|
@@ -9569,14 +9973,16 @@ var zCanonicalToolCatalogEntry = object({
|
|
|
9569
9973
|
namespace: string2(),
|
|
9570
9974
|
normalizedSubtoolName: string2(),
|
|
9571
9975
|
outputSchema: record(string2(), unknown()).nullish(),
|
|
9976
|
+
owner: _enum(["platform", "personal", "adopted", "company"]),
|
|
9572
9977
|
ownerUserId: uuid2().nullable(),
|
|
9573
9978
|
personaLinkId: uuid2().nullish(),
|
|
9574
9979
|
personaName: string2().nullish(),
|
|
9575
9980
|
providerNativeToolName: string2(),
|
|
9576
|
-
providerType: string2(),
|
|
9577
9981
|
serviceSlug: string2(),
|
|
9578
9982
|
sourceUserName: string2().nullish(),
|
|
9579
9983
|
title: string2().nullish(),
|
|
9984
|
+
type: _enum(["platform", "composio", "managed_mcp", "external_mcp", "company"]),
|
|
9985
|
+
typeLabel: string2(),
|
|
9580
9986
|
visibilitySource: string2().nullish(),
|
|
9581
9987
|
workspaceId: uuid2().nullable(),
|
|
9582
9988
|
wrapperToolName: string2()
|
|
@@ -9930,6 +10336,7 @@ var zConnectResponse = object({
|
|
|
9930
10336
|
connectionId: string2().nullish(),
|
|
9931
10337
|
error: string2().nullish(),
|
|
9932
10338
|
errorType: string2().nullish(),
|
|
10339
|
+
expiresAt: exports_iso.datetime({ offset: true }).nullable(),
|
|
9933
10340
|
message: string2(),
|
|
9934
10341
|
providerNativeId: string2().nullish(),
|
|
9935
10342
|
success: boolean2()
|
|
@@ -9951,10 +10358,12 @@ var zConnectionApproval = object({
|
|
|
9951
10358
|
connectionIntegrationId: string2(),
|
|
9952
10359
|
connectionServiceName: string2(),
|
|
9953
10360
|
effectiveCapabilityIds: array(string2()),
|
|
10361
|
+
healthMessage: string2().nullable(),
|
|
9954
10362
|
id: string2(),
|
|
9955
10363
|
kind: _enum(["offer", "adoption"]),
|
|
9956
10364
|
offerId: string2().nullish(),
|
|
9957
10365
|
ownerCapabilityIds: array(string2()),
|
|
10366
|
+
ownerName: string2().nullable(),
|
|
9958
10367
|
providerType: string2(),
|
|
9959
10368
|
requestedAt: string2().nullish(),
|
|
9960
10369
|
requesterDisplayName: string2().nullish(),
|
|
@@ -10015,13 +10424,6 @@ var zConnectionSubtoolEntry = object({
|
|
|
10015
10424
|
toolSource: string2().nullish(),
|
|
10016
10425
|
wrapperToolName: string2().nullish()
|
|
10017
10426
|
});
|
|
10018
|
-
var zAppSubtoolsResponse = object({
|
|
10019
|
-
appName: string2(),
|
|
10020
|
-
message: string2(),
|
|
10021
|
-
subtools: array(zConnectionSubtoolEntry),
|
|
10022
|
-
success: boolean2(),
|
|
10023
|
-
totalSubtools: int()
|
|
10024
|
-
});
|
|
10025
10427
|
var zConnectionToolSummary = object({
|
|
10026
10428
|
adminBlocked: int().optional().default(0),
|
|
10027
10429
|
byEffectiveAccess: record(string2(), int()).optional(),
|
|
@@ -10555,6 +10957,266 @@ var zGemEditsPage = strictObject({
|
|
|
10555
10957
|
edits: array(zGemEdit),
|
|
10556
10958
|
nextCursor: string2().nullable()
|
|
10557
10959
|
});
|
|
10960
|
+
var zGemGitSourceCallbackRequest = strictObject({
|
|
10961
|
+
code: string2().min(1).max(2048).optional(),
|
|
10962
|
+
installationId: string2().regex(/^[1-9][0-9]{0,19}$\/u/).optional(),
|
|
10963
|
+
setupAction: _enum(["install", "update", "request"]).optional(),
|
|
10964
|
+
state: string2().regex(/^[A-Za-z0-9_-]{43}$\/u/)
|
|
10965
|
+
});
|
|
10966
|
+
var zGemGitSourceCommand = union([
|
|
10967
|
+
strictObject({
|
|
10968
|
+
action: _enum(["refresh"])
|
|
10969
|
+
}),
|
|
10970
|
+
strictObject({
|
|
10971
|
+
action: _enum(["retry"]),
|
|
10972
|
+
idempotencyKey: string2().min(1).max(200).regex(/^[A-Za-z0-9._:-]+$\/u/),
|
|
10973
|
+
importId: uuid2()
|
|
10974
|
+
}),
|
|
10975
|
+
strictObject({
|
|
10976
|
+
action: _enum(["cancel"]),
|
|
10977
|
+
importId: uuid2()
|
|
10978
|
+
}),
|
|
10979
|
+
strictObject({
|
|
10980
|
+
action: _enum(["change_policy"]),
|
|
10981
|
+
automaticPublishing: boolean2(),
|
|
10982
|
+
expectedRevision: int().gte(0),
|
|
10983
|
+
previewsEnabled: boolean2()
|
|
10984
|
+
}),
|
|
10985
|
+
strictObject({
|
|
10986
|
+
action: _enum(["publish"]),
|
|
10987
|
+
expectedRevision: int().gte(0),
|
|
10988
|
+
importId: uuid2()
|
|
10989
|
+
}),
|
|
10990
|
+
strictObject({
|
|
10991
|
+
action: _enum(["create_branch_preview"]),
|
|
10992
|
+
commitSha: string2().regex(/^[0-9a-f]{40}$\/iu/),
|
|
10993
|
+
ref: string2().min(1).max(512)
|
|
10994
|
+
}),
|
|
10995
|
+
strictObject({
|
|
10996
|
+
action: _enum(["approve_preview"]),
|
|
10997
|
+
headSha: string2().regex(/^[0-9a-f]{40}$\/iu/),
|
|
10998
|
+
previewId: uuid2(),
|
|
10999
|
+
resourcePolicyHash: string2().regex(/^[0-9a-f]{64}$\/iu/)
|
|
11000
|
+
}),
|
|
11001
|
+
strictObject({
|
|
11002
|
+
action: _enum(["expire_preview"]),
|
|
11003
|
+
previewId: uuid2()
|
|
11004
|
+
}),
|
|
11005
|
+
strictObject({
|
|
11006
|
+
action: _enum(["disconnect"]),
|
|
11007
|
+
expectedRevision: int().gte(0)
|
|
11008
|
+
}),
|
|
11009
|
+
strictObject({
|
|
11010
|
+
action: _enum(["reconnect"]),
|
|
11011
|
+
expectedRevision: int().gt(0)
|
|
11012
|
+
}),
|
|
11013
|
+
strictObject({
|
|
11014
|
+
action: _enum(["change_source"]),
|
|
11015
|
+
appDirectory: string2().max(240),
|
|
11016
|
+
commitSha: string2().regex(/^[0-9a-f]{40}$\/iu/),
|
|
11017
|
+
expectedRevision: int().gt(0),
|
|
11018
|
+
ref: string2().min(1).max(512)
|
|
11019
|
+
})
|
|
11020
|
+
]);
|
|
11021
|
+
var zGemGitSourceConnectRequest = strictObject({
|
|
11022
|
+
appDirectory: string2().max(240),
|
|
11023
|
+
automaticPublishing: boolean2(),
|
|
11024
|
+
commitSha: string2().regex(/^[0-9a-f]{40}$\/iu/),
|
|
11025
|
+
connectionId: uuid2(),
|
|
11026
|
+
folderId: uuid2().nullish(),
|
|
11027
|
+
idempotencyKey: string2().min(1).max(200).regex(/^[A-Za-z0-9._:-]+$\/u/),
|
|
11028
|
+
previewsEnabled: boolean2(),
|
|
11029
|
+
ref: string2().min(1).max(512),
|
|
11030
|
+
repositoryId: string2().regex(/^[1-9][0-9]{0,19}$\/u/),
|
|
11031
|
+
title: string2().min(1).max(256)
|
|
11032
|
+
});
|
|
11033
|
+
var zGemGitSourceImportError = strictObject({
|
|
11034
|
+
code: string2().min(1).max(128),
|
|
11035
|
+
message: string2().min(1).max(512)
|
|
11036
|
+
}).nullable();
|
|
11037
|
+
var zGemGitSourceImport = strictObject({
|
|
11038
|
+
attempt: int().gte(0),
|
|
11039
|
+
buildId: uuid2().nullable(),
|
|
11040
|
+
commitMessage: string2().max(16384),
|
|
11041
|
+
commitSha: string2().regex(/^[0-9a-f]{40}$\/iu/),
|
|
11042
|
+
completedAt: exports_iso.datetime({ offset: true }).nullable(),
|
|
11043
|
+
createdAt: exports_iso.datetime({ offset: true }),
|
|
11044
|
+
error: zGemGitSourceImportError,
|
|
11045
|
+
generation: int().gte(0),
|
|
11046
|
+
id: uuid2(),
|
|
11047
|
+
publication: _enum([
|
|
11048
|
+
"preparing",
|
|
11049
|
+
"awaiting_review",
|
|
11050
|
+
"authorized",
|
|
11051
|
+
"published",
|
|
11052
|
+
"superseded"
|
|
11053
|
+
]),
|
|
11054
|
+
ref: string2().min(1).max(512),
|
|
11055
|
+
releaseId: uuid2().nullable(),
|
|
11056
|
+
sourceRevisionId: uuid2().nullable(),
|
|
11057
|
+
stage: _enum([
|
|
11058
|
+
"queued",
|
|
11059
|
+
"fetching",
|
|
11060
|
+
"validating",
|
|
11061
|
+
"needs_version",
|
|
11062
|
+
"preparing",
|
|
11063
|
+
"ready",
|
|
11064
|
+
"needs_access",
|
|
11065
|
+
"needs_configuration",
|
|
11066
|
+
"needs_resource_grant",
|
|
11067
|
+
"budget_blocked",
|
|
11068
|
+
"failed",
|
|
11069
|
+
"canceled",
|
|
11070
|
+
"superseded"
|
|
11071
|
+
]),
|
|
11072
|
+
versionId: uuid2().nullable(),
|
|
11073
|
+
versionNumber: int().gte(1).nullable()
|
|
11074
|
+
});
|
|
11075
|
+
var zGemGitSourceInspectRequest = strictObject({
|
|
11076
|
+
appDirectory: string2().max(240),
|
|
11077
|
+
connectionId: uuid2(),
|
|
11078
|
+
ref: string2().min(1).max(512),
|
|
11079
|
+
repositoryId: string2().regex(/^[1-9][0-9]{0,19}$\/u/)
|
|
11080
|
+
});
|
|
11081
|
+
var zGemGitSourceInspectionDiagnostic = strictObject({
|
|
11082
|
+
code: string2().min(1).max(128),
|
|
11083
|
+
message: string2().min(1).max(512),
|
|
11084
|
+
path: string2().max(512).nullable()
|
|
11085
|
+
});
|
|
11086
|
+
var zGemGitSourceInspection = strictObject({
|
|
11087
|
+
appDirectory: string2().max(240),
|
|
11088
|
+
candidateDirectories: array(string2().max(240)).max(5000),
|
|
11089
|
+
commitMessage: string2().max(16384),
|
|
11090
|
+
commitSha: string2().regex(/^[0-9a-f]{40}$\/iu/),
|
|
11091
|
+
connectionId: uuid2(),
|
|
11092
|
+
diagnostics: array(zGemGitSourceInspectionDiagnostic).max(100),
|
|
11093
|
+
fileCount: int().gte(0).lte(5000),
|
|
11094
|
+
framework: string2().max(128).nullable(),
|
|
11095
|
+
proposedConfiguration: string2().max(65536).nullable(),
|
|
11096
|
+
ref: string2().min(1).max(512),
|
|
11097
|
+
repositoryId: string2().regex(/^[1-9][0-9]{0,19}$\/u/),
|
|
11098
|
+
resourceNeeds: array(object({
|
|
11099
|
+
kind: string2().min(1).max(128),
|
|
11100
|
+
name: string2().min(1).max(512)
|
|
11101
|
+
})).max(100),
|
|
11102
|
+
state: _enum(["ready", "needs_configuration", "rejected"]),
|
|
11103
|
+
totalBytes: int().gte(0).lte(25165824)
|
|
11104
|
+
});
|
|
11105
|
+
var zGemGitSourcePreview = strictObject({
|
|
11106
|
+
approvedHeadSha: string2().regex(/^[0-9a-f]{40}$\/iu/).nullable(),
|
|
11107
|
+
canOpen: boolean2(),
|
|
11108
|
+
error: zGemGitSourceImportError,
|
|
11109
|
+
expiresAt: exports_iso.datetime({ offset: true }),
|
|
11110
|
+
fork: boolean2(),
|
|
11111
|
+
headSha: string2().regex(/^[0-9a-f]{40}$\/iu/),
|
|
11112
|
+
id: uuid2(),
|
|
11113
|
+
pullRequestNumber: int().gt(0).nullable(),
|
|
11114
|
+
ref: string2().min(1).max(512),
|
|
11115
|
+
state: _enum([
|
|
11116
|
+
"needs_commit_review",
|
|
11117
|
+
"queued",
|
|
11118
|
+
"building",
|
|
11119
|
+
"ready",
|
|
11120
|
+
"failed",
|
|
11121
|
+
"expired"
|
|
11122
|
+
]),
|
|
11123
|
+
title: string2().max(16384)
|
|
11124
|
+
});
|
|
11125
|
+
var zGemGitSourcePreviewInspectRequest = strictObject({
|
|
11126
|
+
headSha: string2().regex(/^[0-9a-f]{40}$\/iu/)
|
|
11127
|
+
});
|
|
11128
|
+
var zGemGitSourcePreviewInspection = strictObject({
|
|
11129
|
+
appDirectory: string2().max(240),
|
|
11130
|
+
diagnostics: array(zGemGitSourceInspectionDiagnostic).max(100),
|
|
11131
|
+
headSha: string2().regex(/^[0-9a-f]{40}$\/iu/),
|
|
11132
|
+
previewId: uuid2(),
|
|
11133
|
+
proposedConfiguration: string2().max(65536).nullable(),
|
|
11134
|
+
ref: string2().min(1).max(512),
|
|
11135
|
+
resourceNeeds: array(object({
|
|
11136
|
+
kind: string2().min(1).max(128),
|
|
11137
|
+
name: string2().min(1).max(512)
|
|
11138
|
+
})).max(100),
|
|
11139
|
+
resourcePolicyHash: string2().regex(/^[0-9a-f]{64}$\/iu/).nullable(),
|
|
11140
|
+
state: _enum(["ready", "needs_configuration", "rejected"])
|
|
11141
|
+
});
|
|
11142
|
+
var zGemGitSourceRefs = array(object({
|
|
11143
|
+
kind: _enum(["branch", "tag"]),
|
|
11144
|
+
name: string2().min(1).max(512),
|
|
11145
|
+
ref: string2().min(1).max(512)
|
|
11146
|
+
})).max(2000);
|
|
11147
|
+
var zGemGitSourceRefsRequest = strictObject({
|
|
11148
|
+
connectionId: uuid2(),
|
|
11149
|
+
repositoryId: string2().regex(/^[1-9][0-9]{0,19}$\/u/)
|
|
11150
|
+
});
|
|
11151
|
+
var zGemGitSourceRepository = strictObject({
|
|
11152
|
+
connectionId: uuid2(),
|
|
11153
|
+
defaultBranch: string2().min(1).max(512),
|
|
11154
|
+
installationId: string2().regex(/^[1-9][0-9]{0,19}$\/u/),
|
|
11155
|
+
name: string2().min(1).max(255),
|
|
11156
|
+
owner: string2().min(1).max(255),
|
|
11157
|
+
private: boolean2(),
|
|
11158
|
+
repositoryId: string2().regex(/^[1-9][0-9]{0,19}$\/u/),
|
|
11159
|
+
url: url().max(2048)
|
|
11160
|
+
});
|
|
11161
|
+
var zGemGitSourceConnection = strictObject({
|
|
11162
|
+
authorizeUrl: url().max(2048).nullable(),
|
|
11163
|
+
expiresAt: exports_iso.datetime({ offset: true }).nullable(),
|
|
11164
|
+
id: uuid2().nullable(),
|
|
11165
|
+
installUrl: url().max(2048).nullable(),
|
|
11166
|
+
manageUrl: url().max(2048).nullable(),
|
|
11167
|
+
nextPage: int().gte(1).lte(101).nullable(),
|
|
11168
|
+
repositories: array(zGemGitSourceRepository).max(100),
|
|
11169
|
+
state: _enum([
|
|
11170
|
+
"not_connected",
|
|
11171
|
+
"awaiting_github",
|
|
11172
|
+
"pending_approval",
|
|
11173
|
+
"authorizing",
|
|
11174
|
+
"connected",
|
|
11175
|
+
"needs_access",
|
|
11176
|
+
"expired"
|
|
11177
|
+
])
|
|
11178
|
+
});
|
|
11179
|
+
var zGemGitSourceState = strictObject({
|
|
11180
|
+
allowedActions: array(_enum([
|
|
11181
|
+
"refresh",
|
|
11182
|
+
"retry",
|
|
11183
|
+
"cancel",
|
|
11184
|
+
"change_policy",
|
|
11185
|
+
"publish",
|
|
11186
|
+
"create_branch_preview",
|
|
11187
|
+
"approve_preview",
|
|
11188
|
+
"expire_preview",
|
|
11189
|
+
"disconnect",
|
|
11190
|
+
"reconnect",
|
|
11191
|
+
"change_source",
|
|
11192
|
+
"copy"
|
|
11193
|
+
])).max(12),
|
|
11194
|
+
artifactId: uuid2(),
|
|
11195
|
+
binding: object({
|
|
11196
|
+
access: _enum(["active", "suspended", "revoked", "needs_access"]),
|
|
11197
|
+
active: boolean2(),
|
|
11198
|
+
appDirectory: string2().max(240),
|
|
11199
|
+
currentCommitSha: string2().regex(/^[0-9a-f]{40}$\/iu/).nullable(),
|
|
11200
|
+
desiredCommitSha: string2().regex(/^[0-9a-f]{40}$\/iu/).nullable(),
|
|
11201
|
+
generation: int().gte(0),
|
|
11202
|
+
id: uuid2(),
|
|
11203
|
+
lastBuiltCommitSha: string2().regex(/^[0-9a-f]{40}$\/iu/).nullable(),
|
|
11204
|
+
ref: string2().min(1).max(512),
|
|
11205
|
+
repository: zGemGitSourceRepository
|
|
11206
|
+
}).nullable(),
|
|
11207
|
+
imports: array(zGemGitSourceImport).max(50),
|
|
11208
|
+
policy: object({
|
|
11209
|
+
automaticPublishing: boolean2(),
|
|
11210
|
+
previewsEnabled: boolean2(),
|
|
11211
|
+
revision: int().gte(0)
|
|
11212
|
+
}).nullable(),
|
|
11213
|
+
previews: array(zGemGitSourcePreview).max(50)
|
|
11214
|
+
});
|
|
11215
|
+
var zGemGitSourceImportResponse = strictObject({
|
|
11216
|
+
artifactId: uuid2(),
|
|
11217
|
+
import: zGemGitSourceImport,
|
|
11218
|
+
state: zGemGitSourceState
|
|
11219
|
+
});
|
|
10558
11220
|
var zGemLink = strictObject({
|
|
10559
11221
|
buildId: string2().optional(),
|
|
10560
11222
|
capabilityVersion: string2().optional(),
|
|
@@ -11072,7 +11734,7 @@ var zImpersonateResponse = object({
|
|
|
11072
11734
|
var zIntegrationHealthDismissRequest = object({
|
|
11073
11735
|
incidentIds: array(string2())
|
|
11074
11736
|
});
|
|
11075
|
-
var zIntegrationHealthExternalProvider = _enum(["none", "email", "slack"]).default("none");
|
|
11737
|
+
var zIntegrationHealthExternalProvider = _enum(["none", "email", "slack", "email_and_slack"]).default("none");
|
|
11076
11738
|
var zIntegrationHealthMarkReadRequest = object({
|
|
11077
11739
|
incidentIds: array(string2()).nullish()
|
|
11078
11740
|
});
|
|
@@ -11157,7 +11819,16 @@ var zInvitationValidationResponse = object({
|
|
|
11157
11819
|
workspaceSlug: string2()
|
|
11158
11820
|
});
|
|
11159
11821
|
var zLibraryBulkActionPreview = object({
|
|
11160
|
-
action:
|
|
11822
|
+
action: _enum([
|
|
11823
|
+
"deleteForever",
|
|
11824
|
+
"downloadDatasets",
|
|
11825
|
+
"editLabels",
|
|
11826
|
+
"move",
|
|
11827
|
+
"moveToWorkspace",
|
|
11828
|
+
"removeFromLibrary",
|
|
11829
|
+
"restore",
|
|
11830
|
+
"setFavorite"
|
|
11831
|
+
]),
|
|
11161
11832
|
affectedCount: int(),
|
|
11162
11833
|
confirmationRequired: boolean2(),
|
|
11163
11834
|
conflictCount: int(),
|
|
@@ -11226,7 +11897,16 @@ var zLibraryBulkActionStartRequest = object({
|
|
|
11226
11897
|
idempotencyKey: string2().min(1).max(128)
|
|
11227
11898
|
});
|
|
11228
11899
|
var zLibraryBulkJob = object({
|
|
11229
|
-
action:
|
|
11900
|
+
action: _enum([
|
|
11901
|
+
"deleteForever",
|
|
11902
|
+
"downloadDatasets",
|
|
11903
|
+
"editLabels",
|
|
11904
|
+
"move",
|
|
11905
|
+
"moveToWorkspace",
|
|
11906
|
+
"removeFromLibrary",
|
|
11907
|
+
"restore",
|
|
11908
|
+
"setFavorite"
|
|
11909
|
+
]),
|
|
11230
11910
|
download: object({
|
|
11231
11911
|
byteSize: int().nullable(),
|
|
11232
11912
|
filename: string2().nullable(),
|
|
@@ -11246,7 +11926,14 @@ var zLibraryBulkJob = object({
|
|
|
11246
11926
|
successful: int(),
|
|
11247
11927
|
total: int()
|
|
11248
11928
|
}),
|
|
11249
|
-
status:
|
|
11929
|
+
status: _enum([
|
|
11930
|
+
"completed",
|
|
11931
|
+
"completedWithErrors",
|
|
11932
|
+
"failed",
|
|
11933
|
+
"preview",
|
|
11934
|
+
"queued",
|
|
11935
|
+
"running"
|
|
11936
|
+
])
|
|
11250
11937
|
});
|
|
11251
11938
|
var zLibraryBulkSelectionEntry = object({
|
|
11252
11939
|
entryType: _enum(["item", "folder"]),
|
|
@@ -11254,7 +11941,16 @@ var zLibraryBulkSelectionEntry = object({
|
|
|
11254
11941
|
});
|
|
11255
11942
|
var zLibraryBulkSelectionPreview = object({
|
|
11256
11943
|
affectedCount: int(),
|
|
11257
|
-
availableActions: array(
|
|
11944
|
+
availableActions: array(_enum([
|
|
11945
|
+
"deleteForever",
|
|
11946
|
+
"downloadDatasets",
|
|
11947
|
+
"editLabels",
|
|
11948
|
+
"move",
|
|
11949
|
+
"moveToWorkspace",
|
|
11950
|
+
"removeFromLibrary",
|
|
11951
|
+
"restore",
|
|
11952
|
+
"setFavorite"
|
|
11953
|
+
])),
|
|
11258
11954
|
breakdown: object({
|
|
11259
11955
|
ownedCount: int(),
|
|
11260
11956
|
sharedReferenceCount: int(),
|
|
@@ -12030,6 +12726,7 @@ var zMcpConnectionOAuthStartRequest = object({
|
|
|
12030
12726
|
var zMcpConnectionOAuthStartResponse = object({
|
|
12031
12727
|
authorizationUrl: string2(),
|
|
12032
12728
|
connectionId: string2(),
|
|
12729
|
+
expiresAt: exports_iso.datetime({ offset: true }),
|
|
12033
12730
|
message: string2(),
|
|
12034
12731
|
success: boolean2()
|
|
12035
12732
|
});
|
|
@@ -12067,6 +12764,16 @@ var zExternalMemberResponse = object({
|
|
|
12067
12764
|
userName: string2().nullish(),
|
|
12068
12765
|
workspaceId: uuid2()
|
|
12069
12766
|
});
|
|
12767
|
+
var zMemberWithBlocks = object({
|
|
12768
|
+
blockedCount: int(),
|
|
12769
|
+
email: string2(),
|
|
12770
|
+
memberUserId: string2(),
|
|
12771
|
+
name: string2()
|
|
12772
|
+
});
|
|
12773
|
+
var zMembersWithBlocksResponse = object({
|
|
12774
|
+
members: array(zMemberWithBlocks),
|
|
12775
|
+
success: boolean2()
|
|
12776
|
+
});
|
|
12070
12777
|
var zModelCapabilities = object({
|
|
12071
12778
|
codeGeneration: int().gte(1).lte(10),
|
|
12072
12779
|
contextLength: int().gt(0),
|
|
@@ -12467,7 +13174,7 @@ var zPlatformToolExecuteResponse = object({
|
|
|
12467
13174
|
error: string2().nullish(),
|
|
12468
13175
|
errorCode: string2().nullish(),
|
|
12469
13176
|
errorDetails: unknown().optional(),
|
|
12470
|
-
errorId:
|
|
13177
|
+
errorId: string2().optional(),
|
|
12471
13178
|
errorMessage: string2().nullish(),
|
|
12472
13179
|
executionTimeMs: int().nullish(),
|
|
12473
13180
|
executorKind: string2().optional().default("platform"),
|
|
@@ -13309,15 +14016,15 @@ var zTeamResourcePolicyRequest = object({
|
|
|
13309
14016
|
});
|
|
13310
14017
|
var zTeamResponse = object({
|
|
13311
14018
|
createdAt: exports_iso.datetime({ offset: true }),
|
|
13312
|
-
createdBy:
|
|
14019
|
+
createdBy: string2().nullish(),
|
|
13313
14020
|
description: string2().nullish(),
|
|
13314
|
-
id:
|
|
14021
|
+
id: string2(),
|
|
13315
14022
|
memberCount: int().optional().default(0),
|
|
13316
14023
|
myRole: _enum(["member", "admin", "owner"]).nullish(),
|
|
13317
14024
|
name: string2(),
|
|
13318
14025
|
personaCount: int().optional().default(0),
|
|
13319
14026
|
updatedAt: exports_iso.datetime({ offset: true }),
|
|
13320
|
-
workspaceId:
|
|
14027
|
+
workspaceId: string2()
|
|
13321
14028
|
});
|
|
13322
14029
|
var zTeamToolGuardrailRequest = object({
|
|
13323
14030
|
blockWriteActions: boolean2().optional().default(false),
|
|
@@ -13701,7 +14408,21 @@ var zThreadQueuedInputView = object({
|
|
|
13701
14408
|
clientMessageId: string2(),
|
|
13702
14409
|
createdAtMs: int(),
|
|
13703
14410
|
disposition: zThreadQueueDisposition,
|
|
14411
|
+
intent: union([
|
|
14412
|
+
object({
|
|
14413
|
+
kind: _enum(["send"])
|
|
14414
|
+
}),
|
|
14415
|
+
object({
|
|
14416
|
+
editOfMessageId: string2(),
|
|
14417
|
+
kind: _enum(["edit"])
|
|
14418
|
+
}),
|
|
14419
|
+
object({
|
|
14420
|
+
kind: _enum(["branch"]),
|
|
14421
|
+
parentMessageId: string2()
|
|
14422
|
+
})
|
|
14423
|
+
]),
|
|
13704
14424
|
parts: array(zThreadInputPart),
|
|
14425
|
+
position: int(),
|
|
13705
14426
|
promotedRunId: string2().nullable(),
|
|
13706
14427
|
queuedInputId: string2(),
|
|
13707
14428
|
settledReason: _enum([
|
|
@@ -13709,6 +14430,7 @@ var zThreadQueuedInputView = object({
|
|
|
13709
14430
|
"target_run_orphaned",
|
|
13710
14431
|
"target_run_failed",
|
|
13711
14432
|
"target_run_cancelled",
|
|
14433
|
+
"intent_target_gone",
|
|
13712
14434
|
"unreachable_stale",
|
|
13713
14435
|
"claim_fingerprint_stale"
|
|
13714
14436
|
]).nullable(),
|
|
@@ -13716,7 +14438,7 @@ var zThreadQueuedInputView = object({
|
|
|
13716
14438
|
targetRunId: string2().nullable()
|
|
13717
14439
|
});
|
|
13718
14440
|
var zThreadQueueResponse = object({
|
|
13719
|
-
queued: zThreadQueuedInputView
|
|
14441
|
+
queued: array(zThreadQueuedInputView)
|
|
13720
14442
|
});
|
|
13721
14443
|
var zThreadQueueSteerNowResponse = object({
|
|
13722
14444
|
queued: zThreadQueuedInputView
|
|
@@ -14026,6 +14748,7 @@ var zThreadToolIdentity = object({
|
|
|
14026
14748
|
});
|
|
14027
14749
|
var zThreadMessagePart = union([
|
|
14028
14750
|
object({
|
|
14751
|
+
contentRef: string2().nullish(),
|
|
14029
14752
|
mentions: array(object({
|
|
14030
14753
|
agentId: string2().min(1),
|
|
14031
14754
|
handle: string2().min(1)
|
|
@@ -14124,6 +14847,8 @@ var zThreadMessagePart = union([
|
|
|
14124
14847
|
"tool_catalog_unavailable",
|
|
14125
14848
|
"sandbox_unavailable",
|
|
14126
14849
|
"sandbox_rate_limited",
|
|
14850
|
+
"tree_op_refused",
|
|
14851
|
+
"tree_rebuild_required",
|
|
14127
14852
|
"stale_writer",
|
|
14128
14853
|
"cancelled_by_user",
|
|
14129
14854
|
"internal_error"
|
|
@@ -14267,6 +14992,16 @@ var zToolActionClassificationRequest = object({
|
|
|
14267
14992
|
notes: string2().nullish(),
|
|
14268
14993
|
subToolName: string2().min(1)
|
|
14269
14994
|
});
|
|
14995
|
+
var zToolApprovalAnswerRequest = object({
|
|
14996
|
+
decision: _enum(["accept", "decline"])
|
|
14997
|
+
});
|
|
14998
|
+
var zToolApprovalAnswerResponse = object({
|
|
14999
|
+
alreadyResolved: boolean2(),
|
|
15000
|
+
approvalId: uuid2(),
|
|
15001
|
+
decidedAtMs: int(),
|
|
15002
|
+
decidedByUserId: uuid2().nullable(),
|
|
15003
|
+
decision: _enum(["approve", "approve_for_run", "deny", "cancel_run"])
|
|
15004
|
+
});
|
|
14270
15005
|
var zToolDefinitionResponse = object({
|
|
14271
15006
|
accountIdentifier: string2().nullish(),
|
|
14272
15007
|
accountLabel: string2().nullish(),
|
|
@@ -14534,21 +15269,19 @@ var zTriggersResponse = object({
|
|
|
14534
15269
|
var zUpdateBillingRequest = object({
|
|
14535
15270
|
architectEnabled: boolean2().nullish(),
|
|
14536
15271
|
automationsEnabled: boolean2().nullish(),
|
|
14537
|
-
automationsHourlyRequestLimit: int().nullish(),
|
|
14538
15272
|
automationsMonthlyPriceUsd: number2().nullish(),
|
|
14539
15273
|
automationsPlanTier: string2().nullish(),
|
|
14540
|
-
automationsWeeklyBudgetUsd: number2().nullish(),
|
|
14541
|
-
billingEmail:
|
|
15274
|
+
automationsWeeklyBudgetUsd: number2().gte(0).nullish(),
|
|
15275
|
+
billingEmail: email2().nullish(),
|
|
14542
15276
|
billingName: string2().nullish(),
|
|
14543
15277
|
chatEnabled: boolean2().nullish(),
|
|
14544
|
-
chatHourlyRequestLimit: int().nullish(),
|
|
14545
15278
|
chatMonthlyPriceUsd: number2().nullish(),
|
|
14546
15279
|
chatPlanTier: string2().nullish(),
|
|
14547
|
-
chatWeeklyBudgetUsd: number2().nullish(),
|
|
15280
|
+
chatWeeklyBudgetUsd: number2().gte(0).nullish(),
|
|
14548
15281
|
markupPercentage: number2().nullish(),
|
|
14549
15282
|
planType: string2().nullish(),
|
|
14550
|
-
spendingAlertThresholdUsd: number2().nullish(),
|
|
14551
|
-
spendingLimitUsd: number2().nullish()
|
|
15283
|
+
spendingAlertThresholdUsd: number2().gte(0).nullish(),
|
|
15284
|
+
spendingLimitUsd: number2().gte(0).nullish()
|
|
14552
15285
|
});
|
|
14553
15286
|
var zUpdateCollectionRequest = object({
|
|
14554
15287
|
description: string2().nullish(),
|
|
@@ -14649,15 +15382,21 @@ var zUploadResponse = object({
|
|
|
14649
15382
|
size: int(),
|
|
14650
15383
|
url: string2()
|
|
14651
15384
|
});
|
|
15385
|
+
var zUsageMonthStatus = object({
|
|
15386
|
+
alert_threshold_usd: number2().nullable(),
|
|
15387
|
+
limit_usd: number2().nullable(),
|
|
15388
|
+
percentage: number2(),
|
|
15389
|
+
remaining_usd: number2().nullable(),
|
|
15390
|
+
resets_in_seconds: int(),
|
|
15391
|
+
used_usd: number2()
|
|
15392
|
+
});
|
|
14652
15393
|
var zUsageStatusResponse = object({
|
|
14653
15394
|
automations: record(string2(), unknown()),
|
|
14654
|
-
chat: record(string2(), unknown())
|
|
15395
|
+
chat: record(string2(), unknown()),
|
|
15396
|
+
month: zUsageMonthStatus
|
|
14655
15397
|
});
|
|
14656
15398
|
var zUsageSummaryResponse = object({
|
|
14657
15399
|
dailyUsage: array(unknown()),
|
|
14658
|
-
hourlyRequestLimit: int(),
|
|
14659
|
-
hourlyRequestsUsed: int(),
|
|
14660
|
-
hourlyUsagePercentage: number2(),
|
|
14661
15400
|
modelUsage: record(string2(), unknown()),
|
|
14662
15401
|
serviceType: string2(),
|
|
14663
15402
|
totalCachedTokens: int(),
|
|
@@ -14856,8 +15595,10 @@ var zWorkspaceConnectionOffer = object({
|
|
|
14856
15595
|
decidedAt: string2().nullish(),
|
|
14857
15596
|
decidedByUserId: string2().nullish(),
|
|
14858
15597
|
deniedCapabilities: array(string2()),
|
|
15598
|
+
healthMessage: string2().nullable(),
|
|
14859
15599
|
id: string2(),
|
|
14860
15600
|
ownerCapabilities: array(string2()),
|
|
15601
|
+
ownerName: string2().nullable(),
|
|
14861
15602
|
ownerUserId: string2(),
|
|
14862
15603
|
providerType: string2(),
|
|
14863
15604
|
state: _enum(["pending", "approved", "rejected", "withdrawn", "revoked"]),
|
|
@@ -14950,6 +15691,20 @@ var zAuthSessionState = union([
|
|
|
14950
15691
|
workspaces: array(zWorkspaceLoginOption)
|
|
14951
15692
|
})
|
|
14952
15693
|
]);
|
|
15694
|
+
var zWorkspaceMemberListItem = object({
|
|
15695
|
+
createdAt: string2().nullable(),
|
|
15696
|
+
email: string2(),
|
|
15697
|
+
homeWorkspaceId: string2().nullable(),
|
|
15698
|
+
id: string2(),
|
|
15699
|
+
memberType: _enum(["internal", "external"]),
|
|
15700
|
+
name: string2(),
|
|
15701
|
+
role: string2(),
|
|
15702
|
+
status: _enum(["active", "inactive"]),
|
|
15703
|
+
updatedAt: string2().nullable()
|
|
15704
|
+
});
|
|
15705
|
+
var zWorkspaceMembersResponse = object({
|
|
15706
|
+
members: array(zWorkspaceMemberListItem)
|
|
15707
|
+
});
|
|
14953
15708
|
var zWorkspaceResourcePolicyRequest = object({
|
|
14954
15709
|
enabled: boolean2().optional().default(false),
|
|
14955
15710
|
personaRulesAlways: array(string2()).optional().default([]),
|
|
@@ -15375,7 +16130,6 @@ var zWhoamiApiAuthWhoamiGetHeaders = object({
|
|
|
15375
16130
|
var zGetWorkspaceMembersApiAuthWorkspaceWorkspaceIdMembersGetPath = object({
|
|
15376
16131
|
workspaceId: string2()
|
|
15377
16132
|
});
|
|
15378
|
-
var zGetWorkspaceMembersApiAuthWorkspaceWorkspaceIdMembersGetResponse = record(string2(), unknown());
|
|
15379
16133
|
var zRemoveWorkspaceMemberApiAuthWorkspaceWorkspaceIdMembersUserIdDeletePath = object({
|
|
15380
16134
|
workspaceId: string2(),
|
|
15381
16135
|
userId: string2()
|
|
@@ -15698,6 +16452,18 @@ var zBackgroundSyncStatusApiBackgroundSyncStatusGetResponse = record(string2(),
|
|
|
15698
16452
|
var zDeleteChatAccessConnectionApiChatAccessConnectionsProviderDeletePath = object({
|
|
15699
16453
|
provider: string2()
|
|
15700
16454
|
});
|
|
16455
|
+
var zGetChatAccessConnectionAttemptPath = object({
|
|
16456
|
+
provider: string2()
|
|
16457
|
+
});
|
|
16458
|
+
var zGetChatAccessConnectionAttemptResponse = object({
|
|
16459
|
+
attempt: union([zChatAccessDeviceCodeStart, zChatAccessBrowserPollStart]).nullable()
|
|
16460
|
+
});
|
|
16461
|
+
var zCancelChatAccessConnectionApiChatAccessConnectionsProviderCancelPostPath = object({
|
|
16462
|
+
provider: string2()
|
|
16463
|
+
});
|
|
16464
|
+
var zCancelChatAccessConnectionApiChatAccessConnectionsProviderCancelPostResponse = object({
|
|
16465
|
+
cancelled: boolean2()
|
|
16466
|
+
});
|
|
15701
16467
|
var zCompleteChatAccessConnectionApiChatAccessConnectionsProviderCompletePostPath = object({
|
|
15702
16468
|
provider: string2()
|
|
15703
16469
|
});
|
|
@@ -18685,15 +19451,6 @@ var zGetLibraryVisitorItemPreviewImageApiPlatformLibraryVisitorSessionsItemsItem
|
|
|
18685
19451
|
});
|
|
18686
19452
|
var zGetLibraryVisitorItemPreviewImageApiPlatformLibraryVisitorSessionsItemsItemIdPreviewImagePostResponse = zFilePreviewImageResponse.and(unknown());
|
|
18687
19453
|
var zVerifyLibraryVisitorSessionApiPlatformLibraryVisitorSessionsVerifyPostResponse = record(string2(), unknown());
|
|
18688
|
-
var zListPinnedArtifactsApiPlatformPinnedArtifactsGetResponse = record(string2(), unknown());
|
|
18689
|
-
var zUnpinArtifactApiPlatformPinnedArtifactsArtifactSlugDeletePath = object({
|
|
18690
|
-
artifactSlug: string2()
|
|
18691
|
-
});
|
|
18692
|
-
var zUnpinArtifactApiPlatformPinnedArtifactsArtifactSlugDeleteResponse = record(string2(), unknown());
|
|
18693
|
-
var zPinArtifactApiPlatformPinnedArtifactsArtifactSlugPostPath = object({
|
|
18694
|
-
artifactSlug: string2()
|
|
18695
|
-
});
|
|
18696
|
-
var zPinArtifactApiPlatformPinnedArtifactsArtifactSlugPostResponse = record(string2(), unknown());
|
|
18697
19454
|
var zSearchPromptsApiPlatformPromptsGetQuery = object({
|
|
18698
19455
|
query: string2().nullish(),
|
|
18699
19456
|
category: string2().nullish(),
|
|
@@ -19406,10 +20163,16 @@ var zThreadShareRevokePath = object({
|
|
|
19406
20163
|
threadId: uuid2(),
|
|
19407
20164
|
shareId: uuid2()
|
|
19408
20165
|
});
|
|
20166
|
+
var zToolApprovalAnswerPath = object({
|
|
20167
|
+
questionId: uuid2()
|
|
20168
|
+
});
|
|
19409
20169
|
var zListAvailableToolDefinitionsApiToolControlPlaneAvailableGetQuery = object({
|
|
19410
20170
|
enabledOnly: _enum(["true", "false"]).optional().default("true")
|
|
19411
20171
|
});
|
|
19412
20172
|
var zListAvailableToolDefinitionsApiToolControlPlaneAvailableGetResponse = array(zToolDefinitionResponse);
|
|
20173
|
+
var zListCatalogApiToolControlPlaneCatalogGetHeaders = object({
|
|
20174
|
+
"X-Uru-Workspace-Id": string2().min(1).optional()
|
|
20175
|
+
});
|
|
19413
20176
|
var zListCatalogApiToolControlPlaneCatalogGetQuery = object({
|
|
19414
20177
|
enabledOnly: _enum(["true", "false"]).optional().default("true")
|
|
19415
20178
|
});
|
|
@@ -19548,25 +20311,67 @@ var zDeleteUserProfileApiUserProfilesDeleteResponse = record(string2(), string2(
|
|
|
19548
20311
|
var zGetUserProfileByIdApiUserProfilesUserIdGetPath = object({
|
|
19549
20312
|
userId: uuid2()
|
|
19550
20313
|
});
|
|
19551
|
-
var
|
|
19552
|
-
|
|
20314
|
+
var zGetGemGitSourcePath = object({
|
|
20315
|
+
artifactId: uuid2()
|
|
19553
20316
|
});
|
|
19554
|
-
var
|
|
19555
|
-
|
|
19556
|
-
client_id: string2().min(1).max(200),
|
|
19557
|
-
redirect_uri: url(),
|
|
19558
|
-
scope: string2().min(1).max(200).optional().default("mcp"),
|
|
19559
|
-
state: string2().max(2048).nullish(),
|
|
19560
|
-
code_challenge: string2().min(43).max(128),
|
|
19561
|
-
code_challenge_method: string2().optional().default("S256"),
|
|
19562
|
-
resource: url()
|
|
20317
|
+
var zCommandGemGitSourcePath = object({
|
|
20318
|
+
artifactId: uuid2()
|
|
19563
20319
|
});
|
|
19564
|
-
var
|
|
19565
|
-
|
|
19566
|
-
|
|
19567
|
-
|
|
19568
|
-
|
|
19569
|
-
|
|
20320
|
+
var zInspectGemGitPreviewPath = object({
|
|
20321
|
+
artifactId: uuid2(),
|
|
20322
|
+
previewId: uuid2()
|
|
20323
|
+
});
|
|
20324
|
+
var zOpenGemGitPreviewPath = object({
|
|
20325
|
+
artifactId: uuid2(),
|
|
20326
|
+
previewId: uuid2()
|
|
20327
|
+
});
|
|
20328
|
+
var zOpenGemGitPreviewResponse = object({
|
|
20329
|
+
url: url()
|
|
20330
|
+
});
|
|
20331
|
+
var zListGemGitSourceConnectionsPath = object({
|
|
20332
|
+
workspaceId: uuid2()
|
|
20333
|
+
});
|
|
20334
|
+
var zListGemGitSourceConnectionsQuery = object({
|
|
20335
|
+
page: int().gte(1).lte(100).optional().default(1)
|
|
20336
|
+
});
|
|
20337
|
+
var zCompleteGemGitSourceConnectionPath = object({
|
|
20338
|
+
workspaceId: uuid2()
|
|
20339
|
+
});
|
|
20340
|
+
var zBeginGemGitSourceConnectionPath = object({
|
|
20341
|
+
workspaceId: uuid2()
|
|
20342
|
+
});
|
|
20343
|
+
var zGetGemGitSourceConnectionPath = object({
|
|
20344
|
+
workspaceId: uuid2(),
|
|
20345
|
+
setupId: uuid2()
|
|
20346
|
+
});
|
|
20347
|
+
var zImportGemGitSourcePath = object({
|
|
20348
|
+
workspaceId: uuid2()
|
|
20349
|
+
});
|
|
20350
|
+
var zInspectGemGitSourcePath = object({
|
|
20351
|
+
workspaceId: uuid2()
|
|
20352
|
+
});
|
|
20353
|
+
var zListGemGitSourceRefsPath = object({
|
|
20354
|
+
workspaceId: uuid2()
|
|
20355
|
+
});
|
|
20356
|
+
var zHealthCheckBasicAliasHealthGetResponse = object({
|
|
20357
|
+
status: string2()
|
|
20358
|
+
});
|
|
20359
|
+
var zAuthorizeOauthAuthorizeGetQuery = object({
|
|
20360
|
+
response_type: string2().regex(/^code$/),
|
|
20361
|
+
client_id: string2().min(1).max(200),
|
|
20362
|
+
redirect_uri: url(),
|
|
20363
|
+
scope: string2().min(1).max(200).optional().default("mcp"),
|
|
20364
|
+
state: string2().max(2048).nullish(),
|
|
20365
|
+
code_challenge: string2().min(43).max(128),
|
|
20366
|
+
code_challenge_method: string2().optional().default("S256"),
|
|
20367
|
+
resource: url()
|
|
20368
|
+
});
|
|
20369
|
+
var zAuthorizeOauthAuthorizeGetResponse = record(string2(), unknown());
|
|
20370
|
+
var zAuthorizeDecisionOauthAuthorizeDecisionPostResponse = record(string2(), string2());
|
|
20371
|
+
var zDeviceAuthorizationOauthDeviceCodePostBody = object({
|
|
20372
|
+
client_id: string2().nullish(),
|
|
20373
|
+
resource: url().nullish(),
|
|
20374
|
+
scope: string2().nullish()
|
|
19570
20375
|
});
|
|
19571
20376
|
var zValidateMcpTokenOauthMcpTokenValidatePostResponse = record(string2(), unknown());
|
|
19572
20377
|
var zRobotsTxtRobotsTxtGetResponse = string2();
|
|
@@ -20389,8 +21194,7 @@ function parseOAuthCallbackUrl(callbackUrl, expectedState) {
|
|
|
20389
21194
|
}
|
|
20390
21195
|
const error2 = url2.searchParams.get("error");
|
|
20391
21196
|
if (error2 !== null && error2 !== "") {
|
|
20392
|
-
|
|
20393
|
-
throw new CliError(description === null || description === "" ? `OAuth authorization failed: ${error2}` : `OAuth authorization failed: ${error2}: ${description}`, { code: ExitCode.AuthRequired, errorCode: "oauth_authorization_failed" });
|
|
21197
|
+
throw new CliError("OAuth authorization failed. Start sign-in again and approve access.", { code: ExitCode.AuthRequired, errorCode: "oauth_authorization_failed" });
|
|
20394
21198
|
}
|
|
20395
21199
|
const code = url2.searchParams.get("code") ?? "";
|
|
20396
21200
|
if (code === "") {
|
|
@@ -20723,12 +21527,21 @@ function errorMessage2(payload) {
|
|
|
20723
21527
|
if (!isRecord(payload)) {
|
|
20724
21528
|
return;
|
|
20725
21529
|
}
|
|
20726
|
-
const description = payload["error_description"];
|
|
20727
|
-
if (typeof description === "string" && description.trim() !== "") {
|
|
20728
|
-
return description;
|
|
20729
|
-
}
|
|
20730
21530
|
const error2 = payload["error"];
|
|
20731
|
-
|
|
21531
|
+
switch (error2) {
|
|
21532
|
+
case "access_denied":
|
|
21533
|
+
return "Authorization was denied. Start sign-in again.";
|
|
21534
|
+
case "invalid_grant":
|
|
21535
|
+
return "Authorization expired or was revoked. Sign in again.";
|
|
21536
|
+
case "invalid_client":
|
|
21537
|
+
return "The sign-in client is not accepted by the server.";
|
|
21538
|
+
case "expired_token":
|
|
21539
|
+
return "The sign-in request expired. Start sign-in again.";
|
|
21540
|
+
case "temporarily_unavailable":
|
|
21541
|
+
return "The sign-in service is temporarily unavailable.";
|
|
21542
|
+
default:
|
|
21543
|
+
return;
|
|
21544
|
+
}
|
|
20732
21545
|
}
|
|
20733
21546
|
function defaultSleep(milliseconds) {
|
|
20734
21547
|
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
@@ -20964,32 +21777,6 @@ function formatWorkspaces(workspaces, style = PLAIN_VISUAL, currentWorkspaceId)
|
|
|
20964
21777
|
currentId !== undefined && workspace.id === currentId ? "current" : ""
|
|
20965
21778
|
]));
|
|
20966
21779
|
}
|
|
20967
|
-
function formatTools(tools, style = PLAIN_VISUAL) {
|
|
20968
|
-
if (tools.length === 0) {
|
|
20969
|
-
return "No tools found";
|
|
20970
|
-
}
|
|
20971
|
-
if (!style.rich) {
|
|
20972
|
-
return tools.map((tool) => {
|
|
20973
|
-
const description = tool.description === undefined ? "" : ` ${tool.description}`;
|
|
20974
|
-
return `${tool.name}${description}`;
|
|
20975
|
-
}).join(`
|
|
20976
|
-
`);
|
|
20977
|
-
}
|
|
20978
|
-
return formatTable(style, ["NAME", "DESCRIPTION"], tools.map((tool) => [tool.name, tool.description ?? ""]));
|
|
20979
|
-
}
|
|
20980
|
-
function formatToolContract(contract) {
|
|
20981
|
-
const name = typeof contract["name"] === "string" ? contract["name"] : "unknown";
|
|
20982
|
-
const description = typeof contract["description"] === "string" ? contract["description"] : "";
|
|
20983
|
-
const schema = contract["inputSchema"];
|
|
20984
|
-
const lines = [`Name: ${name}`];
|
|
20985
|
-
if (description !== "") {
|
|
20986
|
-
lines.push(`Description: ${description}`);
|
|
20987
|
-
}
|
|
20988
|
-
lines.push("Input schema:");
|
|
20989
|
-
lines.push(JSON.stringify(schema ?? {}, null, 2));
|
|
20990
|
-
return lines.join(`
|
|
20991
|
-
`);
|
|
20992
|
-
}
|
|
20993
21780
|
function formatOperationContract(contract) {
|
|
20994
21781
|
const id = typeof contract["id"] === "string" ? contract["id"] : "unknown";
|
|
20995
21782
|
const family = typeof contract["family"] === "string" ? contract["family"] : "unknown";
|
|
@@ -21222,7 +22009,7 @@ or --output-format stream-json before the command to emit NDJSON events.
|
|
|
21222
22009
|
Print one explicit active Link URL. When a Gem has more than one active Link,
|
|
21223
22010
|
use --link to choose the Link rather than guessing which URL you mean.
|
|
21224
22011
|
`,
|
|
21225
|
-
gems: `Usage: uru gems <inspect|validate|build|deploy|verify|fs|status|read|write|edits|versions|releases|links|runs|capabilities|schedules|bindings|components|delegations|api|domains|analytics|power|logs> [...]
|
|
22012
|
+
gems: `Usage: uru gems <inspect|validate|build|deploy|verify|fs|status|source|read|write|edits|versions|releases|links|runs|capabilities|schedules|bindings|components|delegations|api|domains|analytics|power|logs> [...]
|
|
21226
22013
|
uru gems validate [library/name.gem] [--wait] [--timeout-ms 600000] [--poll-interval-ms 2000]
|
|
21227
22014
|
uru gems build [library/name.gem] [--force] [--wait] [--timeout-ms 600000] [--poll-interval-ms 2000]
|
|
21228
22015
|
|
|
@@ -21511,13 +22298,29 @@ env pull writes a metadata-only template (names and placeholders). It never
|
|
|
21511
22298
|
downloads remote secret values. env run overlays local values and redacts
|
|
21512
22299
|
those values from captured output.
|
|
21513
22300
|
`,
|
|
21514
|
-
tools: `Usage: uru tools
|
|
21515
|
-
uru tools
|
|
21516
|
-
uru tools
|
|
21517
|
-
uru tools
|
|
22301
|
+
tools: `Usage: uru tools search "<task>" [--limit N] [--namespace NS] [--owner OWNER]
|
|
22302
|
+
uru tools ls [--namespace NS] [--owner OWNER]
|
|
22303
|
+
uru tools <partial address> --help [--match TEXT] [--limit N]
|
|
22304
|
+
uru tools schema <address>
|
|
22305
|
+
uru tools inspect <address>
|
|
22306
|
+
uru tools run <address> -d '{...}' [--get-schema] [--dry-run] [--parallel]
|
|
22307
|
+
uru tools connections
|
|
22308
|
+
|
|
22309
|
+
Every tool you can reach: platform tools, your own connections, connections you
|
|
22310
|
+
adopted from a workspace offer, workspace connections, and MCP servers of any type.
|
|
22311
|
+
|
|
22312
|
+
An address is <provider>.<owner>.<connection>.<tool>, and owner is one of
|
|
22313
|
+
platform, personal, adopted, company. The connection type (Uru, Marketplace,
|
|
22314
|
+
Managed MCP, Custom MCP, Company) and its category print beside the address
|
|
22315
|
+
and filter with --type and --category. The flat <namespace>__<tool> wire name
|
|
22316
|
+
resolves to the same tool.
|
|
21518
22317
|
|
|
21519
|
-
|
|
21520
|
-
|
|
22318
|
+
\`--get-schema\` and \`--dry-run\` run nothing. \`--dry-run\` prints the resolved
|
|
22319
|
+
call and the policy answer. \`--parallel\` takes a JSON array and returns one
|
|
22320
|
+
result per input object. \`-d\` is the same flag as --params-json.
|
|
22321
|
+
|
|
22322
|
+
A refusal is always named: no_match, catalog_unavailable, namespace_unavailable,
|
|
22323
|
+
not_connected, not_adopted, approval_required, refused_by_policy.
|
|
21521
22324
|
`,
|
|
21522
22325
|
operations: `Usage: uru operations ls [--family <family>]
|
|
21523
22326
|
uru operations inspect <operation-id>
|
|
@@ -23309,7 +24112,10 @@ function adaptRegistryFamilyParams(params) {
|
|
|
23309
24112
|
var REGISTRY_FAMILY_SNAKE_CASE_ALIASES = new Set([
|
|
23310
24113
|
"automation_id",
|
|
23311
24114
|
"dataset_ids",
|
|
24115
|
+
"idempotency_key",
|
|
23312
24116
|
"item_id",
|
|
24117
|
+
"label_id",
|
|
24118
|
+
"label_value",
|
|
23313
24119
|
"max_results"
|
|
23314
24120
|
]);
|
|
23315
24121
|
function canonicalCliFieldToToolProtocol(key) {
|
|
@@ -23321,54 +24127,6 @@ function canonicalCliFieldToToolProtocol(key) {
|
|
|
23321
24127
|
}
|
|
23322
24128
|
return key.replace(/[A-Z]/g, (character) => `_${character.toLowerCase()}`);
|
|
23323
24129
|
}
|
|
23324
|
-
async function dispatchTools(ctx, sub, third, command) {
|
|
23325
|
-
if (sub === "ls") {
|
|
23326
|
-
await withWorkspace(ctx);
|
|
23327
|
-
const tools = await client(ctx).listTools();
|
|
23328
|
-
ctx.json ? writeJson(ctx.io, tools.map((tool) => tool.raw)) : writeText(ctx.io, formatTools(tools, visualFromTerminal(ctx.terminal, ctx.outputFormat)));
|
|
23329
|
-
return;
|
|
23330
|
-
}
|
|
23331
|
-
if (sub === "schema") {
|
|
23332
|
-
await withWorkspace(ctx);
|
|
23333
|
-
const name = requireCommandValue(third, "Usage: uru tools schema <name>");
|
|
23334
|
-
emitValue(ctx, await client(ctx).getToolSchema(name));
|
|
23335
|
-
return;
|
|
23336
|
-
}
|
|
23337
|
-
if (sub === "inspect") {
|
|
23338
|
-
await withWorkspace(ctx);
|
|
23339
|
-
const name = requireCommandValue(third, "Usage: uru tools inspect <name>");
|
|
23340
|
-
const schema = await client(ctx).getToolSchema(name);
|
|
23341
|
-
const contract = toolInspectContract(name, schema);
|
|
23342
|
-
emitValue(ctx, contract, formatToolContract(contract));
|
|
23343
|
-
return;
|
|
23344
|
-
}
|
|
23345
|
-
if (sub === "run") {
|
|
23346
|
-
await withWorkspace(ctx);
|
|
23347
|
-
const name = requireCommandValue(third, "Usage: uru tools run <name> --params-json '{...}'");
|
|
23348
|
-
const params = await paramsJson(command.slice(3), ["tools", "run"], paramsJsonOptions(ctx));
|
|
23349
|
-
const operation = getPlatformOperationForToolCall(name, params);
|
|
23350
|
-
if (operation !== undefined) {
|
|
23351
|
-
requireOperationConfirmation(ctx, operation, params);
|
|
23352
|
-
} else if (isRegisteredPlatformToolName(name)) {
|
|
23353
|
-
throw new CliError(unmappedPlatformToolCallMessage(name, params));
|
|
23354
|
-
}
|
|
23355
|
-
emitValue(ctx, await client(ctx).runTool(name, params));
|
|
23356
|
-
return;
|
|
23357
|
-
}
|
|
23358
|
-
throw new CliError("Usage: uru tools ls|schema|inspect|run");
|
|
23359
|
-
}
|
|
23360
|
-
function unmappedPlatformToolCallMessage(toolName, params) {
|
|
23361
|
-
const op2 = typeof params["op"] === "string" ? params["op"] : undefined;
|
|
23362
|
-
const normalizedTool = toolName.trim().toLowerCase();
|
|
23363
|
-
const normalizedOp = op2?.trim().toLowerCase();
|
|
23364
|
-
if (normalizedTool === "library_fs" && (normalizedOp === "ls" || normalizedOp === "stat" || normalizedOp === "read" || normalizedOp === "search")) {
|
|
23365
|
-
return `library_fs does not serve read op=${normalizedOp}. ` + "Use library_query (or `uru library ls|stat|search|read` / " + "`uru operations run library.<op>`).";
|
|
23366
|
-
}
|
|
23367
|
-
if (normalizedOp !== undefined) {
|
|
23368
|
-
return `No registered safety policy for ${toolName} op=${normalizedOp}. ` + "Refuse to execute. Check `uru operations search` for the supported operation id.";
|
|
23369
|
-
}
|
|
23370
|
-
return `No registered safety policy for ${toolName}. ` + "Refuse to execute without a mapped platform operation.";
|
|
23371
|
-
}
|
|
23372
24130
|
async function dispatchLibrary(ctx, sub, args) {
|
|
23373
24131
|
if (sub === "ls") {
|
|
23374
24132
|
const flags = parseLocalFlags(args, ["library", "ls"]);
|
|
@@ -24084,18 +24842,6 @@ function copyOptionalFlag(flags, target, flagName, paramName) {
|
|
|
24084
24842
|
target[paramName] = value;
|
|
24085
24843
|
}
|
|
24086
24844
|
}
|
|
24087
|
-
function toolInspectContract(name, schema) {
|
|
24088
|
-
if (!isJsonObject2(schema)) {
|
|
24089
|
-
return { name, inputSchema: {} };
|
|
24090
|
-
}
|
|
24091
|
-
const inputSchema = isJsonObject2(schema["inputSchema"]) ? schema["inputSchema"] : schema;
|
|
24092
|
-
const description = typeof schema["description"] === "string" ? schema["description"] : undefined;
|
|
24093
|
-
return {
|
|
24094
|
-
name: typeof schema["name"] === "string" ? schema["name"] : name,
|
|
24095
|
-
...description === undefined ? {} : { description },
|
|
24096
|
-
inputSchema
|
|
24097
|
-
};
|
|
24098
|
-
}
|
|
24099
24845
|
function familyPrefix(family) {
|
|
24100
24846
|
if (family === "automations") {
|
|
24101
24847
|
return "automation";
|
|
@@ -25126,8 +25872,275 @@ async function dispatchGemFs(ctx, verb, args, linkedProject) {
|
|
|
25126
25872
|
}
|
|
25127
25873
|
}
|
|
25128
25874
|
|
|
25875
|
+
// src/gem-git-source-commands.ts
|
|
25876
|
+
import { randomUUID } from "node:crypto";
|
|
25877
|
+
var GIT_SOURCE_PATH = "/api/v1/artifacts";
|
|
25878
|
+
async function dispatchGemGitSource(ctx, verb, args, linkedProject) {
|
|
25879
|
+
if (verb === undefined || verb === "help") {
|
|
25880
|
+
throw new CliError("Usage: uru gems source status|refresh|retry|cancel|copy|change-source|policy|disconnect <gem> ...");
|
|
25881
|
+
}
|
|
25882
|
+
if ((verb === "cancel" || verb === "disconnect") && !ctx.yes) {
|
|
25883
|
+
throw new CliError(`${verb} is destructive. Re-run with --yes to confirm.`, {
|
|
25884
|
+
errorCode: "confirmation_required",
|
|
25885
|
+
confirmationRequired: true,
|
|
25886
|
+
suggestedCommand: suggestCommandWithYes(ctx.argv)
|
|
25887
|
+
});
|
|
25888
|
+
}
|
|
25889
|
+
const flags = parseLocalFlags(args, ["gems", "source", verb]);
|
|
25890
|
+
const reference = await resolveArtifactReference(ctx, flags, linkedProject);
|
|
25891
|
+
if (verb === "copy") {
|
|
25892
|
+
const result2 = await client(ctx).api(`/api/platform/artifacts/${encodeURIComponent(reference.slug)}/clone`, { method: "POST" });
|
|
25893
|
+
emitValue(ctx, result2, formatCloneResult(result2));
|
|
25894
|
+
return;
|
|
25895
|
+
}
|
|
25896
|
+
if (verb === "status") {
|
|
25897
|
+
const result2 = await client(ctx).api(`${GIT_SOURCE_PATH}/${encodeURIComponent(reference.artifactId)}/git-source`, { method: "GET" });
|
|
25898
|
+
emitValue(ctx, result2, formatGitSourceState(result2));
|
|
25899
|
+
return;
|
|
25900
|
+
}
|
|
25901
|
+
const command = commandFromFlags(verb, flags);
|
|
25902
|
+
const result = await client(ctx).api(`${GIT_SOURCE_PATH}/${encodeURIComponent(reference.artifactId)}/git-source/commands`, { method: "POST", body: command });
|
|
25903
|
+
emitValue(ctx, result, formatGitSourceState(result));
|
|
25904
|
+
}
|
|
25905
|
+
function commandFromFlags(verb, flags) {
|
|
25906
|
+
switch (verb) {
|
|
25907
|
+
case "refresh":
|
|
25908
|
+
return toJsonCommand({ action: "refresh" });
|
|
25909
|
+
case "retry":
|
|
25910
|
+
return toJsonCommand({
|
|
25911
|
+
action: "retry",
|
|
25912
|
+
importId: requiredImportId(flags, "retry"),
|
|
25913
|
+
idempotencyKey: flags.values["--idempotency-key"]?.trim() || randomUUID()
|
|
25914
|
+
});
|
|
25915
|
+
case "cancel":
|
|
25916
|
+
return toJsonCommand({
|
|
25917
|
+
action: "cancel",
|
|
25918
|
+
importId: requiredImportId(flags, "cancel")
|
|
25919
|
+
});
|
|
25920
|
+
case "policy":
|
|
25921
|
+
case "change-policy":
|
|
25922
|
+
return toJsonCommand({
|
|
25923
|
+
action: "change_policy",
|
|
25924
|
+
expectedRevision: requiredInteger(flags, "--expected-revision"),
|
|
25925
|
+
automaticPublishing: requiredBoolean(flags, "--automatic-publishing"),
|
|
25926
|
+
previewsEnabled: requiredBoolean(flags, "--previews-enabled")
|
|
25927
|
+
});
|
|
25928
|
+
case "disconnect":
|
|
25929
|
+
return toJsonCommand({
|
|
25930
|
+
action: "disconnect",
|
|
25931
|
+
expectedRevision: requiredInteger(flags, "--expected-revision")
|
|
25932
|
+
});
|
|
25933
|
+
case "change-source":
|
|
25934
|
+
case "source-change":
|
|
25935
|
+
return toJsonCommand({
|
|
25936
|
+
action: "change_source",
|
|
25937
|
+
expectedRevision: requiredInteger(flags, "--expected-revision"),
|
|
25938
|
+
ref: requiredValue2(flags, "--ref"),
|
|
25939
|
+
appDirectory: requiredValue2(flags, "--app-directory"),
|
|
25940
|
+
commitSha: requiredValue2(flags, "--commit-sha")
|
|
25941
|
+
});
|
|
25942
|
+
default:
|
|
25943
|
+
throw new CliError("Usage: uru gems source status|refresh|retry|cancel|copy|change-source|policy|disconnect <gem> ...");
|
|
25944
|
+
}
|
|
25945
|
+
}
|
|
25946
|
+
async function resolveArtifactReference(ctx, flags, linkedProject) {
|
|
25947
|
+
const reference = gemPathFromArgs(flags, linkedProject);
|
|
25948
|
+
const inspected = await executeOperation(ctx, "gem.inspect", {
|
|
25949
|
+
path: reference
|
|
25950
|
+
});
|
|
25951
|
+
const artifactId = (isUuid(reference) ? reference : undefined) ?? findArtifactId(inspected);
|
|
25952
|
+
if (artifactId === undefined) {
|
|
25953
|
+
throw new CliError(`Gem inspection did not return an artifact id for ${reference}.`);
|
|
25954
|
+
}
|
|
25955
|
+
return {
|
|
25956
|
+
artifactId,
|
|
25957
|
+
slug: findArtifactSlug(inspected) ?? artifactId
|
|
25958
|
+
};
|
|
25959
|
+
}
|
|
25960
|
+
function findArtifactId(value) {
|
|
25961
|
+
if (isJsonObject2(value)) {
|
|
25962
|
+
const id = stringField2(value, [
|
|
25963
|
+
"artifact_id",
|
|
25964
|
+
"artifactId",
|
|
25965
|
+
"gem_id",
|
|
25966
|
+
"gemId"
|
|
25967
|
+
]);
|
|
25968
|
+
if (id !== undefined && isUuid(id)) {
|
|
25969
|
+
return id;
|
|
25970
|
+
}
|
|
25971
|
+
for (const nested of Object.values(value)) {
|
|
25972
|
+
const found = findArtifactId(nested);
|
|
25973
|
+
if (found !== undefined) {
|
|
25974
|
+
return found;
|
|
25975
|
+
}
|
|
25976
|
+
}
|
|
25977
|
+
return;
|
|
25978
|
+
}
|
|
25979
|
+
if (Array.isArray(value)) {
|
|
25980
|
+
for (const nested of value) {
|
|
25981
|
+
const found = findArtifactId(nested);
|
|
25982
|
+
if (found !== undefined) {
|
|
25983
|
+
return found;
|
|
25984
|
+
}
|
|
25985
|
+
}
|
|
25986
|
+
}
|
|
25987
|
+
return;
|
|
25988
|
+
}
|
|
25989
|
+
function isUuid(value) {
|
|
25990
|
+
return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu.test(value);
|
|
25991
|
+
}
|
|
25992
|
+
function findArtifactSlug(value) {
|
|
25993
|
+
if (isJsonObject2(value)) {
|
|
25994
|
+
const slug = stringField2(value, [
|
|
25995
|
+
"artifact_slug",
|
|
25996
|
+
"artifactSlug",
|
|
25997
|
+
"slug"
|
|
25998
|
+
]);
|
|
25999
|
+
if (slug !== undefined && !slug.includes("/")) {
|
|
26000
|
+
return slug;
|
|
26001
|
+
}
|
|
26002
|
+
for (const nested of Object.values(value)) {
|
|
26003
|
+
const found = findArtifactSlug(nested);
|
|
26004
|
+
if (found !== undefined) {
|
|
26005
|
+
return found;
|
|
26006
|
+
}
|
|
26007
|
+
}
|
|
26008
|
+
return;
|
|
26009
|
+
}
|
|
26010
|
+
if (Array.isArray(value)) {
|
|
26011
|
+
for (const nested of value) {
|
|
26012
|
+
const found = findArtifactSlug(nested);
|
|
26013
|
+
if (found !== undefined) {
|
|
26014
|
+
return found;
|
|
26015
|
+
}
|
|
26016
|
+
}
|
|
26017
|
+
}
|
|
26018
|
+
return;
|
|
26019
|
+
}
|
|
26020
|
+
function requiredImportId(flags, verb) {
|
|
26021
|
+
const importId = flags.values["--import-id"]?.trim();
|
|
26022
|
+
if (!importId) {
|
|
26023
|
+
throw new CliError(`Usage: uru gems source ${verb} [gem] --import-id <import-id>`);
|
|
26024
|
+
}
|
|
26025
|
+
return importId;
|
|
26026
|
+
}
|
|
26027
|
+
function requiredValue2(flags, token) {
|
|
26028
|
+
const value = flags.values[token]?.trim();
|
|
26029
|
+
if (value === undefined || value === "") {
|
|
26030
|
+
throw new CliError(`Missing ${token}.`);
|
|
26031
|
+
}
|
|
26032
|
+
return value;
|
|
26033
|
+
}
|
|
26034
|
+
function requiredInteger(flags, token) {
|
|
26035
|
+
const raw = requiredValue2(flags, token);
|
|
26036
|
+
const parsed = Number(raw);
|
|
26037
|
+
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
26038
|
+
throw new CliError(`${token} must be a non-negative integer.`);
|
|
26039
|
+
}
|
|
26040
|
+
return parsed;
|
|
26041
|
+
}
|
|
26042
|
+
function requiredBoolean(flags, token) {
|
|
26043
|
+
const raw = requiredValue2(flags, token).toLowerCase();
|
|
26044
|
+
if (raw === "true" || raw === "1" || raw === "yes" || raw === "on") {
|
|
26045
|
+
return true;
|
|
26046
|
+
}
|
|
26047
|
+
if (raw === "false" || raw === "0" || raw === "no" || raw === "off") {
|
|
26048
|
+
return false;
|
|
26049
|
+
}
|
|
26050
|
+
throw new CliError(`${token} must be true or false.`);
|
|
26051
|
+
}
|
|
26052
|
+
function toJsonCommand(command) {
|
|
26053
|
+
switch (command.action) {
|
|
26054
|
+
case "refresh":
|
|
26055
|
+
return { action: "refresh" };
|
|
26056
|
+
case "retry":
|
|
26057
|
+
return {
|
|
26058
|
+
action: "retry",
|
|
26059
|
+
importId: command.importId,
|
|
26060
|
+
idempotencyKey: command.idempotencyKey
|
|
26061
|
+
};
|
|
26062
|
+
case "cancel":
|
|
26063
|
+
return { action: "cancel", importId: command.importId };
|
|
26064
|
+
case "change_policy":
|
|
26065
|
+
return {
|
|
26066
|
+
action: "change_policy",
|
|
26067
|
+
expectedRevision: command.expectedRevision,
|
|
26068
|
+
automaticPublishing: command.automaticPublishing,
|
|
26069
|
+
previewsEnabled: command.previewsEnabled
|
|
26070
|
+
};
|
|
26071
|
+
case "publish":
|
|
26072
|
+
return {
|
|
26073
|
+
action: "publish",
|
|
26074
|
+
importId: command.importId,
|
|
26075
|
+
expectedRevision: command.expectedRevision
|
|
26076
|
+
};
|
|
26077
|
+
case "approve_preview":
|
|
26078
|
+
return {
|
|
26079
|
+
action: "approve_preview",
|
|
26080
|
+
previewId: command.previewId,
|
|
26081
|
+
headSha: command.headSha,
|
|
26082
|
+
resourcePolicyHash: command.resourcePolicyHash
|
|
26083
|
+
};
|
|
26084
|
+
case "expire_preview":
|
|
26085
|
+
return { action: "expire_preview", previewId: command.previewId };
|
|
26086
|
+
case "disconnect":
|
|
26087
|
+
return {
|
|
26088
|
+
action: "disconnect",
|
|
26089
|
+
expectedRevision: command.expectedRevision
|
|
26090
|
+
};
|
|
26091
|
+
case "reconnect":
|
|
26092
|
+
return {
|
|
26093
|
+
action: "reconnect",
|
|
26094
|
+
expectedRevision: command.expectedRevision
|
|
26095
|
+
};
|
|
26096
|
+
case "change_source":
|
|
26097
|
+
return {
|
|
26098
|
+
action: "change_source",
|
|
26099
|
+
expectedRevision: command.expectedRevision,
|
|
26100
|
+
ref: command.ref,
|
|
26101
|
+
appDirectory: command.appDirectory,
|
|
26102
|
+
commitSha: command.commitSha
|
|
26103
|
+
};
|
|
26104
|
+
}
|
|
26105
|
+
throw new CliError("Unsupported Git source command.");
|
|
26106
|
+
}
|
|
26107
|
+
function formatGitSourceState(value) {
|
|
26108
|
+
if (!isJsonObject2(value)) {
|
|
26109
|
+
return JSON.stringify(value, null, 2);
|
|
26110
|
+
}
|
|
26111
|
+
const artifactId = stringField2(value, ["artifactId", "artifact_id"]);
|
|
26112
|
+
const binding = isJsonObject2(value["binding"]) ? value["binding"] : undefined;
|
|
26113
|
+
const policy = isJsonObject2(value["policy"]) ? value["policy"] : undefined;
|
|
26114
|
+
const lines = [
|
|
26115
|
+
artifactId === undefined ? undefined : `Artifact: ${artifactId}`,
|
|
26116
|
+
binding === undefined ? "Source binding: none" : `Source binding: ${binding["active"] === true ? "active" : "inactive"}`,
|
|
26117
|
+
binding === undefined ? undefined : stringField2(binding, ["ref"]) === undefined ? undefined : `Ref: ${stringField2(binding, ["ref"])}`,
|
|
26118
|
+
binding === undefined ? undefined : stringField2(binding, ["currentCommitSha", "current_commit_sha"]) === undefined ? undefined : `Current commit: ${stringField2(binding, [
|
|
26119
|
+
"currentCommitSha",
|
|
26120
|
+
"current_commit_sha"
|
|
26121
|
+
])}`,
|
|
26122
|
+
policy === undefined ? undefined : `Policy: automatic publishing ${policy["automaticPublishing"] === true ? "on" : "off"}, previews ${policy["previewsEnabled"] === true ? "on" : "off"}`
|
|
26123
|
+
].filter((line) => line !== undefined);
|
|
26124
|
+
return lines.length === 0 ? JSON.stringify(value, null, 2) : lines.join(`
|
|
26125
|
+
`);
|
|
26126
|
+
}
|
|
26127
|
+
function formatCloneResult(value) {
|
|
26128
|
+
const record2 = isJsonObject2(value) ? value : undefined;
|
|
26129
|
+
const artifactId = record2 === undefined ? undefined : stringField2(record2, ["id", "artifactId", "artifact_id"]);
|
|
26130
|
+
const title = record2 === undefined ? undefined : stringField2(record2, ["title"]);
|
|
26131
|
+
if (artifactId === undefined && title === undefined) {
|
|
26132
|
+
return JSON.stringify(value, null, 2);
|
|
26133
|
+
}
|
|
26134
|
+
return [
|
|
26135
|
+
"Gem copied.",
|
|
26136
|
+
artifactId === undefined ? undefined : `Artifact: ${artifactId}`,
|
|
26137
|
+
title === undefined ? undefined : `Title: ${title}`
|
|
26138
|
+
].filter((line) => line !== undefined).join(`
|
|
26139
|
+
`);
|
|
26140
|
+
}
|
|
26141
|
+
|
|
25129
26142
|
// src/held-idempotency-keys.ts
|
|
25130
|
-
import { createHash as createHash3, randomUUID } from "node:crypto";
|
|
26143
|
+
import { createHash as createHash3, randomUUID as randomUUID2 } from "node:crypto";
|
|
25131
26144
|
import { constants } from "node:fs";
|
|
25132
26145
|
import { chmod, link, mkdir as mkdir3, open, readFile as readFile7, rename, rm as rm2 } from "node:fs/promises";
|
|
25133
26146
|
import { dirname as dirname4, join as join2 } from "node:path";
|
|
@@ -25142,7 +26155,7 @@ async function holdIdempotencyKey(io, stateHome, intent, now = new Date) {
|
|
|
25142
26155
|
return withHeldEntriesLock(path, async () => {
|
|
25143
26156
|
const stored = await readHeldEntries(path);
|
|
25144
26157
|
const existing = stored[fingerprint];
|
|
25145
|
-
const owner = `${process.pid}:${
|
|
26158
|
+
const owner = `${process.pid}:${randomUUID2()}`;
|
|
25146
26159
|
if (existing !== undefined) {
|
|
25147
26160
|
const updated = {
|
|
25148
26161
|
...existing,
|
|
@@ -25154,7 +26167,7 @@ async function holdIdempotencyKey(io, stateHome, intent, now = new Date) {
|
|
|
25154
26167
|
release: () => releaseHold(io, path, fingerprint, existing.key, owner)
|
|
25155
26168
|
};
|
|
25156
26169
|
}
|
|
25157
|
-
const key =
|
|
26170
|
+
const key = randomUUID2();
|
|
25158
26171
|
await writeHeldEntries(path, {
|
|
25159
26172
|
...stored,
|
|
25160
26173
|
[fingerprint]: { key, heldAt: now.toISOString(), owners: [owner] }
|
|
@@ -25264,7 +26277,7 @@ async function withHeldEntriesLock(path, action) {
|
|
|
25264
26277
|
continue;
|
|
25265
26278
|
}
|
|
25266
26279
|
try {
|
|
25267
|
-
const lockToken =
|
|
26280
|
+
const lockToken = randomUUID2();
|
|
25268
26281
|
const contents = `${process.pid}
|
|
25269
26282
|
${lockToken}
|
|
25270
26283
|
`;
|
|
@@ -25347,7 +26360,7 @@ async function tryCreateHeldLock(path) {
|
|
|
25347
26360
|
}
|
|
25348
26361
|
try {
|
|
25349
26362
|
const contents = `${process.pid}
|
|
25350
|
-
${
|
|
26363
|
+
${randomUUID2()}
|
|
25351
26364
|
`;
|
|
25352
26365
|
await handle.writeFile(contents, "utf8");
|
|
25353
26366
|
await handle.sync();
|
|
@@ -25406,7 +26419,7 @@ async function readHeldLockObservation(path) {
|
|
|
25406
26419
|
}
|
|
25407
26420
|
}
|
|
25408
26421
|
async function removeHeldLockIfMatches(path, expected) {
|
|
25409
|
-
const quarantinePath = `${path}.${process.pid}.${
|
|
26422
|
+
const quarantinePath = `${path}.${process.pid}.${randomUUID2()}.quarantine`;
|
|
25410
26423
|
try {
|
|
25411
26424
|
await rename(path, quarantinePath);
|
|
25412
26425
|
await syncParentDirectory(path);
|
|
@@ -25466,7 +26479,7 @@ async function writeHeldEntries(path, entries) {
|
|
|
25466
26479
|
}
|
|
25467
26480
|
const body = `${JSON.stringify(entries, null, 2)}
|
|
25468
26481
|
`;
|
|
25469
|
-
const temporaryPath = `${path}.${process.pid}.${
|
|
26482
|
+
const temporaryPath = `${path}.${process.pid}.${randomUUID2()}.tmp`;
|
|
25470
26483
|
let handle = null;
|
|
25471
26484
|
try {
|
|
25472
26485
|
handle = await open(temporaryPath, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY, constants.S_IRUSR | constants.S_IWUSR);
|
|
@@ -26309,6 +27322,11 @@ async function dispatchGems(ctx, sub, args, linkedProject) {
|
|
|
26309
27322
|
await dispatchGemFs(ctx, verb, rest, linkedProject);
|
|
26310
27323
|
return;
|
|
26311
27324
|
}
|
|
27325
|
+
if (sub === "source") {
|
|
27326
|
+
const [verb, ...rest] = args;
|
|
27327
|
+
await dispatchGemGitSource(ctx, verb, rest, linkedProject);
|
|
27328
|
+
return;
|
|
27329
|
+
}
|
|
26312
27330
|
if (await dispatchGemLifecycleResourceCommand(ctx, sub, args, linkedProject)) {
|
|
26313
27331
|
return;
|
|
26314
27332
|
}
|
|
@@ -26348,7 +27366,7 @@ async function dispatchGems(ctx, sub, args, linkedProject) {
|
|
|
26348
27366
|
await gemWrite(ctx, args);
|
|
26349
27367
|
return;
|
|
26350
27368
|
}
|
|
26351
|
-
throw new CliError("Usage: uru gems inspect|validate|build|deploy|verify|fs|edits|versions|releases|links|runs|capabilities|schedules|bindings|components|delegations|api|domains|analytics|power|checks|status|read|write");
|
|
27369
|
+
throw new CliError("Usage: uru gems inspect|validate|build|deploy|verify|fs|edits|versions|releases|links|runs|capabilities|schedules|bindings|components|delegations|api|domains|analytics|power|checks|status|source|read|write");
|
|
26352
27370
|
}
|
|
26353
27371
|
async function dispatchGemOperationalResourceCommand(ctx, sub, args, linkedProject) {
|
|
26354
27372
|
if (sub === "domains") {
|
|
@@ -27647,6 +28665,892 @@ function safeProjectPath(path) {
|
|
|
27647
28665
|
return parts.join("/");
|
|
27648
28666
|
}
|
|
27649
28667
|
|
|
28668
|
+
// src/tools-catalog.ts
|
|
28669
|
+
function isPlatformTool(tool) {
|
|
28670
|
+
return tool.type === "platform";
|
|
28671
|
+
}
|
|
28672
|
+
var TOOL_REFUSALS = {
|
|
28673
|
+
noMatch: "no_match",
|
|
28674
|
+
catalogUnavailable: "catalog_unavailable",
|
|
28675
|
+
namespaceUnavailable: "namespace_unavailable",
|
|
28676
|
+
notConnected: "not_connected",
|
|
28677
|
+
notAdopted: "not_adopted",
|
|
28678
|
+
approvalRequired: "approval_required",
|
|
28679
|
+
refusedByPolicy: "refused_by_policy"
|
|
28680
|
+
};
|
|
28681
|
+
function refuse(errorCode, message, suggestedCommand, cause) {
|
|
28682
|
+
const wrapped = cause instanceof CliError ? cause : undefined;
|
|
28683
|
+
return new CliError(message, {
|
|
28684
|
+
errorCode,
|
|
28685
|
+
...suggestedCommand === undefined ? {} : { suggestedCommand },
|
|
28686
|
+
...wrapped?.errorId === undefined ? {} : { errorId: wrapped.errorId },
|
|
28687
|
+
...wrapped?.httpStatus === undefined ? {} : { httpStatus: wrapped.httpStatus },
|
|
28688
|
+
...cause === undefined ? {} : { cause }
|
|
28689
|
+
});
|
|
28690
|
+
}
|
|
28691
|
+
function stringField5(row, key) {
|
|
28692
|
+
const value = row[key];
|
|
28693
|
+
return typeof value === "string" ? value : "";
|
|
28694
|
+
}
|
|
28695
|
+
function nullableStringField(row, key) {
|
|
28696
|
+
const value = row[key];
|
|
28697
|
+
return typeof value === "string" && value.trim() !== "" ? value : null;
|
|
28698
|
+
}
|
|
28699
|
+
function objectField(row, key) {
|
|
28700
|
+
const value = row[key];
|
|
28701
|
+
return isJsonObject(value) ? value : null;
|
|
28702
|
+
}
|
|
28703
|
+
function readCatalogRow(value) {
|
|
28704
|
+
if (!isJsonObject(value)) {
|
|
28705
|
+
return null;
|
|
28706
|
+
}
|
|
28707
|
+
const address = stringField5(value, "address");
|
|
28708
|
+
const owner = stringField5(value, "owner");
|
|
28709
|
+
const type = stringField5(value, "type");
|
|
28710
|
+
const parsed = parseToolAddress(address);
|
|
28711
|
+
if (parsed === null || !isToolOwnerClass(owner) || parsed.owner !== owner || !isToolConnectionType(type)) {
|
|
28712
|
+
return null;
|
|
28713
|
+
}
|
|
28714
|
+
const { provider, connection, tool } = parsed;
|
|
28715
|
+
const namespace = nullableStringField(value, "agentVisibleNamespace") ?? stringField5(value, "namespace");
|
|
28716
|
+
const subtool = stringField5(value, "normalizedSubtoolName");
|
|
28717
|
+
return {
|
|
28718
|
+
address,
|
|
28719
|
+
owner,
|
|
28720
|
+
type,
|
|
28721
|
+
typeLabel: toolConnectionTypeLabel(type),
|
|
28722
|
+
provider,
|
|
28723
|
+
connection,
|
|
28724
|
+
tool,
|
|
28725
|
+
flatName: type === "platform" ? subtool.toLowerCase() : `${namespace}__${tool}`,
|
|
28726
|
+
namespace,
|
|
28727
|
+
wrapperToolName: stringField5(value, "wrapperToolName"),
|
|
28728
|
+
providerNativeToolName: stringField5(value, "providerNativeToolName") || subtool,
|
|
28729
|
+
capabilityId: stringField5(value, "capabilityId"),
|
|
28730
|
+
connectionId: stringField5(value, "connectionId"),
|
|
28731
|
+
connectionLabel: stringField5(value, "displayName") || connection,
|
|
28732
|
+
description: stringField5(value, "description"),
|
|
28733
|
+
title: nullableStringField(value, "title"),
|
|
28734
|
+
category: nullableStringField(value, "category"),
|
|
28735
|
+
writeClass: stringField5(value, "classification") || "unknown",
|
|
28736
|
+
enabled: value["enabled"] !== false,
|
|
28737
|
+
inputSchema: objectField(value, "inputSchema") ?? {},
|
|
28738
|
+
outputSchema: objectField(value, "outputSchema")
|
|
28739
|
+
};
|
|
28740
|
+
}
|
|
28741
|
+
async function fetchToolCatalog(ctx) {
|
|
28742
|
+
let body;
|
|
28743
|
+
try {
|
|
28744
|
+
body = await client(ctx).api("/api/tool-control-plane/catalog", {
|
|
28745
|
+
method: "GET"
|
|
28746
|
+
});
|
|
28747
|
+
} catch (error2) {
|
|
28748
|
+
throw refuse(TOOL_REFUSALS.catalogUnavailable, `The tool catalog could not be read: ${error2 instanceof Error ? error2.message : String(error2)}`, "uru doctor", error2);
|
|
28749
|
+
}
|
|
28750
|
+
if (!Array.isArray(body)) {
|
|
28751
|
+
throw refuse(TOOL_REFUSALS.catalogUnavailable, "The tool catalog answered with something other than a list of tools.");
|
|
28752
|
+
}
|
|
28753
|
+
const tools = [];
|
|
28754
|
+
for (const row of body) {
|
|
28755
|
+
const tool = readCatalogRow(row);
|
|
28756
|
+
if (tool !== null) {
|
|
28757
|
+
tools.push(tool);
|
|
28758
|
+
}
|
|
28759
|
+
}
|
|
28760
|
+
return tools.sort((left, right) => left.address.localeCompare(right.address));
|
|
28761
|
+
}
|
|
28762
|
+
function filterTools(tools, filters) {
|
|
28763
|
+
const namespace = filters.namespace?.trim().toLowerCase();
|
|
28764
|
+
const owner = filters.owner?.trim().toLowerCase();
|
|
28765
|
+
const type = filters.type?.trim().toLowerCase();
|
|
28766
|
+
const category = filters.category?.trim().toLowerCase();
|
|
28767
|
+
return tools.filter((tool) => {
|
|
28768
|
+
if (namespace !== undefined && namespace !== "") {
|
|
28769
|
+
if (tool.namespace.toLowerCase() !== namespace && tool.provider.toLowerCase() !== namespace) {
|
|
28770
|
+
return false;
|
|
28771
|
+
}
|
|
28772
|
+
}
|
|
28773
|
+
if (owner !== undefined && owner !== "" && tool.owner !== owner) {
|
|
28774
|
+
return false;
|
|
28775
|
+
}
|
|
28776
|
+
if (type !== undefined && type !== "" && tool.type !== type) {
|
|
28777
|
+
return false;
|
|
28778
|
+
}
|
|
28779
|
+
if (category !== undefined && category !== "" && (tool.category ?? "").toLowerCase() !== category) {
|
|
28780
|
+
return false;
|
|
28781
|
+
}
|
|
28782
|
+
return true;
|
|
28783
|
+
});
|
|
28784
|
+
}
|
|
28785
|
+
function candidateNames(tool) {
|
|
28786
|
+
return [
|
|
28787
|
+
tool.address.toLowerCase(),
|
|
28788
|
+
tool.flatName.toLowerCase(),
|
|
28789
|
+
tool.wrapperToolName.toLowerCase(),
|
|
28790
|
+
tool.providerNativeToolName.toLowerCase(),
|
|
28791
|
+
tool.tool.toLowerCase()
|
|
28792
|
+
];
|
|
28793
|
+
}
|
|
28794
|
+
function resolveTool(tools, query) {
|
|
28795
|
+
const wanted = query.trim().toLowerCase();
|
|
28796
|
+
if (wanted === "") {
|
|
28797
|
+
return { kind: "no_match", near: [] };
|
|
28798
|
+
}
|
|
28799
|
+
for (let rank = 0;rank < 5; rank += 1) {
|
|
28800
|
+
const matches = tools.filter((tool) => candidateNames(tool)[rank] === wanted);
|
|
28801
|
+
if (matches.length === 1) {
|
|
28802
|
+
return { kind: "exact", tool: matches[0] };
|
|
28803
|
+
}
|
|
28804
|
+
if (matches.length > 1) {
|
|
28805
|
+
return { kind: "ambiguous", matches };
|
|
28806
|
+
}
|
|
28807
|
+
}
|
|
28808
|
+
return { kind: "no_match", near: nearAddresses(tools, wanted) };
|
|
28809
|
+
}
|
|
28810
|
+
function nearAddresses(tools, query, limit = 5) {
|
|
28811
|
+
const parts = query.toLowerCase().split(/[.\s_]+/u).filter((part) => part.length > 1);
|
|
28812
|
+
if (parts.length === 0) {
|
|
28813
|
+
return [];
|
|
28814
|
+
}
|
|
28815
|
+
const scored = tools.map((tool) => {
|
|
28816
|
+
const haystack = `${tool.address} ${tool.flatName}`.toLowerCase();
|
|
28817
|
+
const hits = parts.filter((part) => haystack.includes(part)).length;
|
|
28818
|
+
return { tool, hits };
|
|
28819
|
+
}).filter((entry) => entry.hits > 0);
|
|
28820
|
+
scored.sort((left, right) => right.hits - left.hits || left.tool.address.localeCompare(right.tool.address));
|
|
28821
|
+
return scored.slice(0, limit).map((entry) => entry.tool);
|
|
28822
|
+
}
|
|
28823
|
+
function noMatchError(query, near) {
|
|
28824
|
+
const suffix = near.length === 0 ? " Run `uru tools ls` to see every tool you can reach." : ` Did you mean: ${near.map((tool) => tool.address).join(", ")}?`;
|
|
28825
|
+
return refuse(TOOL_REFUSALS.noMatch, `No tool answers ${JSON.stringify(query)}.${suffix}`, "uru tools search");
|
|
28826
|
+
}
|
|
28827
|
+
async function fetchUnadoptedOffers(ctx) {
|
|
28828
|
+
let body;
|
|
28829
|
+
try {
|
|
28830
|
+
body = await client(ctx).api("/api/tool-control-plane/connection-offers", {
|
|
28831
|
+
method: "GET"
|
|
28832
|
+
});
|
|
28833
|
+
} catch {
|
|
28834
|
+
return [];
|
|
28835
|
+
}
|
|
28836
|
+
if (!Array.isArray(body)) {
|
|
28837
|
+
return [];
|
|
28838
|
+
}
|
|
28839
|
+
const offers = [];
|
|
28840
|
+
for (const row of body) {
|
|
28841
|
+
if (!isJsonObject(row))
|
|
28842
|
+
continue;
|
|
28843
|
+
const adoption = row["currentAdoptionStatus"];
|
|
28844
|
+
if (row["canAdopt"] !== true || adoption === "pending" || adoption === "approved") {
|
|
28845
|
+
continue;
|
|
28846
|
+
}
|
|
28847
|
+
const offerId = row["id"];
|
|
28848
|
+
const label = row["connectionDisplayName"];
|
|
28849
|
+
const service = row["connectionServiceName"];
|
|
28850
|
+
if (typeof offerId !== "string" || typeof label !== "string" || typeof service !== "string") {
|
|
28851
|
+
continue;
|
|
28852
|
+
}
|
|
28853
|
+
offers.push({ offerId, label, service: service.toLowerCase() });
|
|
28854
|
+
}
|
|
28855
|
+
return offers.sort((left, right) => left.label.localeCompare(right.label));
|
|
28856
|
+
}
|
|
28857
|
+
function offersMatching(offers, query) {
|
|
28858
|
+
const terms = query.toLowerCase().split(/[^a-z0-9]+/u).filter((term) => term.length > 1);
|
|
28859
|
+
if (terms.length === 0) {
|
|
28860
|
+
return [];
|
|
28861
|
+
}
|
|
28862
|
+
return offers.filter((offer) => {
|
|
28863
|
+
const haystack = `${offer.service} ${offer.label}`.toLowerCase();
|
|
28864
|
+
return terms.some((term) => haystack.includes(term));
|
|
28865
|
+
});
|
|
28866
|
+
}
|
|
28867
|
+
function notAdoptedError(query, offers) {
|
|
28868
|
+
const labels = offers.map((offer) => offer.label).join(", ");
|
|
28869
|
+
return refuse(TOOL_REFUSALS.notAdopted, `No tool answers ${JSON.stringify(query)} yet. This workspace offers ` + `${labels}, and you have not adopted it. Ask the owner or an admin ` + "to approve the adoption.", "uru tools connections");
|
|
28870
|
+
}
|
|
28871
|
+
function ambiguousError(query, matches) {
|
|
28872
|
+
return refuse(TOOL_REFUSALS.noMatch, `${JSON.stringify(query)} names ${String(matches.length)} tools. Use one full address: ${matches.slice(0, 5).map((tool) => tool.address).join(", ")}.`, "uru tools ls");
|
|
28873
|
+
}
|
|
28874
|
+
function searchTools(tools, query, limit, offset = 0) {
|
|
28875
|
+
const scored = tools.map((tool) => ({
|
|
28876
|
+
tool,
|
|
28877
|
+
score: scoreToolRelevance({
|
|
28878
|
+
address: tool.address,
|
|
28879
|
+
tool: tool.tool,
|
|
28880
|
+
title: tool.title,
|
|
28881
|
+
description: tool.description,
|
|
28882
|
+
category: tool.category
|
|
28883
|
+
}, query)
|
|
28884
|
+
})).filter((entry) => entry.score > 0);
|
|
28885
|
+
scored.sort((left, right) => right.score - left.score || left.tool.address.localeCompare(right.tool.address));
|
|
28886
|
+
return { hits: scored.slice(offset, offset + limit), total: scored.length, offset };
|
|
28887
|
+
}
|
|
28888
|
+
function summarizeConnections(tools) {
|
|
28889
|
+
const byConnection = new Map;
|
|
28890
|
+
for (const tool of tools) {
|
|
28891
|
+
const key = `${tool.provider}.${tool.owner}.${tool.connection}`;
|
|
28892
|
+
const existing = byConnection.get(key);
|
|
28893
|
+
byConnection.set(key, {
|
|
28894
|
+
connection: key,
|
|
28895
|
+
owner: tool.owner,
|
|
28896
|
+
provider: tool.provider,
|
|
28897
|
+
type: tool.type,
|
|
28898
|
+
typeLabel: tool.typeLabel,
|
|
28899
|
+
label: existing?.label ?? tool.connectionLabel,
|
|
28900
|
+
connectionId: existing?.connectionId ?? tool.connectionId,
|
|
28901
|
+
toolCount: (existing?.toolCount ?? 0) + 1,
|
|
28902
|
+
disabledToolCount: (existing?.disabledToolCount ?? 0) + (tool.enabled ? 0 : 1)
|
|
28903
|
+
});
|
|
28904
|
+
}
|
|
28905
|
+
return [...byConnection.values()].sort((left, right) => left.connection.localeCompare(right.connection));
|
|
28906
|
+
}
|
|
28907
|
+
function addressBranches(tools, prefix) {
|
|
28908
|
+
const wanted = prefix.trim().toLowerCase().replace(/\.+$/u, "");
|
|
28909
|
+
const depth = wanted === "" ? 0 : wanted.split(".").length;
|
|
28910
|
+
const branches = new Map;
|
|
28911
|
+
for (const tool of tools) {
|
|
28912
|
+
const segments = tool.address.split(".");
|
|
28913
|
+
if (wanted !== "" && !tool.address.toLowerCase().startsWith(`${wanted}.`)) {
|
|
28914
|
+
continue;
|
|
28915
|
+
}
|
|
28916
|
+
const segment = segments[depth];
|
|
28917
|
+
if (segment === undefined) {
|
|
28918
|
+
continue;
|
|
28919
|
+
}
|
|
28920
|
+
const existing = branches.get(segment);
|
|
28921
|
+
branches.set(segment, {
|
|
28922
|
+
count: (existing?.count ?? 0) + 1,
|
|
28923
|
+
leaf: depth === segments.length - 1
|
|
28924
|
+
});
|
|
28925
|
+
}
|
|
28926
|
+
return [...branches.entries()].map(([segment, value]) => ({
|
|
28927
|
+
segment,
|
|
28928
|
+
prefix: wanted === "" ? segment : `${wanted}.${segment}`,
|
|
28929
|
+
toolCount: value.count,
|
|
28930
|
+
leaf: value.leaf
|
|
28931
|
+
})).sort((left, right) => left.segment.localeCompare(right.segment));
|
|
28932
|
+
}
|
|
28933
|
+
|
|
28934
|
+
// src/tools-mcp.ts
|
|
28935
|
+
var MCP_PROTOCOL_VERSION = "2026-07-28";
|
|
28936
|
+
var PROTOCOL_VERSION_META_KEY = "io.modelcontextprotocol/protocolVersion";
|
|
28937
|
+
var CLIENT_CAPABILITIES_META_KEY = "io.modelcontextprotocol/clientCapabilities";
|
|
28938
|
+
var CLIENT_INFO_META_KEY = "io.modelcontextprotocol/clientInfo";
|
|
28939
|
+
function encodeMcpParamValue(value) {
|
|
28940
|
+
if (/^[ -~]*$/u.test(value)) {
|
|
28941
|
+
return value;
|
|
28942
|
+
}
|
|
28943
|
+
return `=?base64?${Buffer.from(value, "utf8").toString("base64")}?=`;
|
|
28944
|
+
}
|
|
28945
|
+
function resolveMcpUrl(args) {
|
|
28946
|
+
const chosen = args.explicit?.trim() || mcpProxyUrlFromApiUrl(args.apiUrl);
|
|
28947
|
+
if (chosen === undefined || chosen === "") {
|
|
28948
|
+
throw new CliError(`No MCP proxy is known for ${args.apiUrl}. Pass --mcp-url <url> to name one.`, { errorCode: "namespace_unavailable" });
|
|
28949
|
+
}
|
|
28950
|
+
const url2 = new URL(chosen);
|
|
28951
|
+
if (url2.pathname === "" || url2.pathname === "/") {
|
|
28952
|
+
url2.pathname = "/mcp";
|
|
28953
|
+
}
|
|
28954
|
+
return url2.toString().replace(/\/$/u, "");
|
|
28955
|
+
}
|
|
28956
|
+
|
|
28957
|
+
class McpCallError extends Error {
|
|
28958
|
+
status;
|
|
28959
|
+
data;
|
|
28960
|
+
constructor(message, status, data) {
|
|
28961
|
+
super(message);
|
|
28962
|
+
this.name = "McpCallError";
|
|
28963
|
+
this.status = status;
|
|
28964
|
+
this.data = data ?? null;
|
|
28965
|
+
}
|
|
28966
|
+
}
|
|
28967
|
+
function errorBodyOf(text) {
|
|
28968
|
+
try {
|
|
28969
|
+
const parsed = JSON.parse(text);
|
|
28970
|
+
return isJsonObject(parsed) ? parsed : null;
|
|
28971
|
+
} catch {
|
|
28972
|
+
return null;
|
|
28973
|
+
}
|
|
28974
|
+
}
|
|
28975
|
+
function parseEventStream(body) {
|
|
28976
|
+
let last;
|
|
28977
|
+
for (const rawEvent of body.split(/\n\n/u)) {
|
|
28978
|
+
const data = rawEvent.split(`
|
|
28979
|
+
`).filter((line) => line.startsWith("data:")).map((line) => line.slice(5).trim()).join("");
|
|
28980
|
+
if (data === "") {
|
|
28981
|
+
continue;
|
|
28982
|
+
}
|
|
28983
|
+
last = JSON.parse(data);
|
|
28984
|
+
}
|
|
28985
|
+
if (last === undefined) {
|
|
28986
|
+
throw new McpCallError("The MCP event stream carried no data frame.");
|
|
28987
|
+
}
|
|
28988
|
+
return last;
|
|
28989
|
+
}
|
|
28990
|
+
async function mcpRequest(options, method, params) {
|
|
28991
|
+
const headers = {
|
|
28992
|
+
"content-type": "application/json",
|
|
28993
|
+
accept: "application/json, text/event-stream",
|
|
28994
|
+
authorization: `Bearer ${options.token}`,
|
|
28995
|
+
"mcp-protocol-version": MCP_PROTOCOL_VERSION,
|
|
28996
|
+
"mcp-method": method
|
|
28997
|
+
};
|
|
28998
|
+
const name = params["name"];
|
|
28999
|
+
if (method === "tools/call" && typeof name === "string") {
|
|
29000
|
+
headers["mcp-name"] = encodeMcpParamValue(name);
|
|
29001
|
+
}
|
|
29002
|
+
if (options.workspaceId !== undefined && options.workspaceId !== "") {
|
|
29003
|
+
headers["x-uru-workspace-id"] = options.workspaceId;
|
|
29004
|
+
}
|
|
29005
|
+
const timeout = AbortSignal.timeout(options.timeoutMs ?? 60000);
|
|
29006
|
+
const signal = options.signal === undefined ? timeout : AbortSignal.any([options.signal, timeout]);
|
|
29007
|
+
const response = await options.fetchImpl(options.url, {
|
|
29008
|
+
method: "POST",
|
|
29009
|
+
headers,
|
|
29010
|
+
signal,
|
|
29011
|
+
body: JSON.stringify({
|
|
29012
|
+
jsonrpc: "2.0",
|
|
29013
|
+
id: 1,
|
|
29014
|
+
method,
|
|
29015
|
+
params: {
|
|
29016
|
+
...params,
|
|
29017
|
+
_meta: {
|
|
29018
|
+
[PROTOCOL_VERSION_META_KEY]: MCP_PROTOCOL_VERSION,
|
|
29019
|
+
[CLIENT_CAPABILITIES_META_KEY]: {},
|
|
29020
|
+
[CLIENT_INFO_META_KEY]: { name: "uru-cli", version: "1" }
|
|
29021
|
+
}
|
|
29022
|
+
}
|
|
29023
|
+
})
|
|
29024
|
+
});
|
|
29025
|
+
const text = await response.text();
|
|
29026
|
+
if (!response.ok) {
|
|
29027
|
+
throw new McpCallError(`MCP ${method} failed with HTTP ${String(response.status)}: ${text.slice(0, 500)}`, response.status, errorBodyOf(text));
|
|
29028
|
+
}
|
|
29029
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
29030
|
+
const payload = contentType.includes("text/event-stream") ? parseEventStream(text) : JSON.parse(text);
|
|
29031
|
+
const envelope = Array.isArray(payload) ? payload[0] : payload;
|
|
29032
|
+
if (!isJsonObject(envelope)) {
|
|
29033
|
+
throw new McpCallError(`MCP ${method} returned a non-object response.`);
|
|
29034
|
+
}
|
|
29035
|
+
const error2 = envelope["error"];
|
|
29036
|
+
if (isJsonObject(error2)) {
|
|
29037
|
+
const code = error2["code"];
|
|
29038
|
+
const message = error2["message"];
|
|
29039
|
+
const data = error2["data"];
|
|
29040
|
+
throw new McpCallError(`MCP ${method} error ${typeof code === "number" ? String(code) : "unknown"}: ${typeof message === "string" ? message : "no message"}`, undefined, isJsonObject(data) ? data : null);
|
|
29041
|
+
}
|
|
29042
|
+
return envelope["result"] ?? null;
|
|
29043
|
+
}
|
|
29044
|
+
async function callConnectorTool(options, call) {
|
|
29045
|
+
return mcpRequest(options, "tools/call", {
|
|
29046
|
+
name: call.wrapperToolName,
|
|
29047
|
+
arguments: {
|
|
29048
|
+
tool_name: call.providerNativeToolName,
|
|
29049
|
+
parameters: call.parameters
|
|
29050
|
+
}
|
|
29051
|
+
});
|
|
29052
|
+
}
|
|
29053
|
+
|
|
29054
|
+
// src/tools-commands.ts
|
|
29055
|
+
var TOOLS_SUBCOMMANDS = new Set([
|
|
29056
|
+
"search",
|
|
29057
|
+
"ls",
|
|
29058
|
+
"list",
|
|
29059
|
+
"schema",
|
|
29060
|
+
"inspect",
|
|
29061
|
+
"run",
|
|
29062
|
+
"connections",
|
|
29063
|
+
"approve"
|
|
29064
|
+
]);
|
|
29065
|
+
function parseParkedCallEnvelope(value) {
|
|
29066
|
+
if (!isJsonObject(value)) {
|
|
29067
|
+
return null;
|
|
29068
|
+
}
|
|
29069
|
+
const nested = value["parked"];
|
|
29070
|
+
if (isJsonObject(nested)) {
|
|
29071
|
+
return parseParkedCallEnvelope(nested);
|
|
29072
|
+
}
|
|
29073
|
+
const read = readToolRefusalEnvelope(value);
|
|
29074
|
+
return read.outcome === "envelope" ? read.envelope : null;
|
|
29075
|
+
}
|
|
29076
|
+
function parkedLines(envelope) {
|
|
29077
|
+
return [
|
|
29078
|
+
`Status ${envelope.status}`,
|
|
29079
|
+
`Question id ${envelope.questionId ?? "(none — nothing to approve)"}`,
|
|
29080
|
+
...envelope.toolName === undefined ? [] : [`Tool ${envelope.toolName}`],
|
|
29081
|
+
`Write class ${envelope.writeClass}`,
|
|
29082
|
+
...envelope.questionId === null ? [] : [
|
|
29083
|
+
`Answer it uru tools approve ${envelope.questionId} --accept`,
|
|
29084
|
+
` uru tools approve ${envelope.questionId} --decline`
|
|
29085
|
+
]
|
|
29086
|
+
];
|
|
29087
|
+
}
|
|
29088
|
+
function isToolsAddressDrillDown(command) {
|
|
29089
|
+
const [first, second] = command;
|
|
29090
|
+
return first === "tools" && second !== undefined && !second.startsWith("-") && !TOOLS_SUBCOMMANDS.has(second);
|
|
29091
|
+
}
|
|
29092
|
+
function limitFlag(flags, fallback) {
|
|
29093
|
+
const raw = flags.values["--limit"];
|
|
29094
|
+
if (raw === undefined) {
|
|
29095
|
+
return fallback;
|
|
29096
|
+
}
|
|
29097
|
+
const parsed = Number.parseInt(raw, 10);
|
|
29098
|
+
if (!Number.isInteger(parsed) || parsed < 1) {
|
|
29099
|
+
throw new CliError("--limit must be a positive whole number.");
|
|
29100
|
+
}
|
|
29101
|
+
return parsed;
|
|
29102
|
+
}
|
|
29103
|
+
function offsetFlag(flags) {
|
|
29104
|
+
const raw = flags.values["--offset"];
|
|
29105
|
+
if (raw === undefined) {
|
|
29106
|
+
return 0;
|
|
29107
|
+
}
|
|
29108
|
+
const parsed = Number.parseInt(raw, 10);
|
|
29109
|
+
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
29110
|
+
throw new CliError("--offset must be a whole number of 0 or more.");
|
|
29111
|
+
}
|
|
29112
|
+
return parsed;
|
|
29113
|
+
}
|
|
29114
|
+
function ownerFlag(flags) {
|
|
29115
|
+
const owner = flags.values["--owner"];
|
|
29116
|
+
if (owner === undefined) {
|
|
29117
|
+
return;
|
|
29118
|
+
}
|
|
29119
|
+
if (!TOOL_OWNER_CLASSES.includes(owner)) {
|
|
29120
|
+
throw new CliError(`--owner must be one of ${TOOL_OWNER_CLASSES.join(", ")}. ` + "It says whose connection a tool runs on; use --type for what kind it is.");
|
|
29121
|
+
}
|
|
29122
|
+
return owner;
|
|
29123
|
+
}
|
|
29124
|
+
function typeFlag(flags) {
|
|
29125
|
+
const type = flags.values["--type"];
|
|
29126
|
+
if (type === undefined) {
|
|
29127
|
+
return;
|
|
29128
|
+
}
|
|
29129
|
+
if (!TOOL_CONNECTION_TYPES.includes(type)) {
|
|
29130
|
+
throw new CliError(`--type must be one of ${TOOL_CONNECTION_TYPES.join(", ")}.`);
|
|
29131
|
+
}
|
|
29132
|
+
return type;
|
|
29133
|
+
}
|
|
29134
|
+
function catalogFilters(flags) {
|
|
29135
|
+
return {
|
|
29136
|
+
namespace: flags.values["--namespace"],
|
|
29137
|
+
owner: ownerFlag(flags),
|
|
29138
|
+
type: typeFlag(flags),
|
|
29139
|
+
category: flags.values["--category"]
|
|
29140
|
+
};
|
|
29141
|
+
}
|
|
29142
|
+
async function toolParameters(ctx, flags) {
|
|
29143
|
+
const raw = flags.values["--params-json"];
|
|
29144
|
+
if (raw === undefined) {
|
|
29145
|
+
return {};
|
|
29146
|
+
}
|
|
29147
|
+
const text = await readParamsJsonSource(raw, {
|
|
29148
|
+
cwd: ctx.cwd,
|
|
29149
|
+
...ctx.stdin === undefined ? {} : { stdin: ctx.stdin }
|
|
29150
|
+
});
|
|
29151
|
+
return parseParamsJson(text, "--params-json");
|
|
29152
|
+
}
|
|
29153
|
+
function toolRow(tool) {
|
|
29154
|
+
const write = tool.writeClass === "unknown" ? "?" : tool.writeClass;
|
|
29155
|
+
const summary = tool.description.split(`
|
|
29156
|
+
`)[0]?.trim() ?? "";
|
|
29157
|
+
const kind = tool.category === null ? tool.typeLabel : `${tool.typeLabel}/${tool.category}`;
|
|
29158
|
+
return ` ${tool.address} [${write}] ${kind} ${summary}`;
|
|
29159
|
+
}
|
|
29160
|
+
function toolJson(tool) {
|
|
29161
|
+
return {
|
|
29162
|
+
address: tool.address,
|
|
29163
|
+
owner: tool.owner,
|
|
29164
|
+
type: tool.type,
|
|
29165
|
+
typeLabel: tool.typeLabel,
|
|
29166
|
+
provider: tool.provider,
|
|
29167
|
+
connection: tool.connection,
|
|
29168
|
+
connectionLabel: tool.connectionLabel,
|
|
29169
|
+
tool: tool.tool,
|
|
29170
|
+
flatName: tool.flatName,
|
|
29171
|
+
writeClass: tool.writeClass,
|
|
29172
|
+
enabled: tool.enabled,
|
|
29173
|
+
description: tool.description,
|
|
29174
|
+
...tool.title === null ? {} : { title: tool.title },
|
|
29175
|
+
...tool.category === null ? {} : { category: tool.category }
|
|
29176
|
+
};
|
|
29177
|
+
}
|
|
29178
|
+
function groupedListing(tools) {
|
|
29179
|
+
if (tools.length === 0) {
|
|
29180
|
+
return "No tools. Connect an app in Uru, or ask for access to a workspace offer.";
|
|
29181
|
+
}
|
|
29182
|
+
const lines = [];
|
|
29183
|
+
let currentConnection = "";
|
|
29184
|
+
for (const tool of tools) {
|
|
29185
|
+
const connection = `${tool.provider}.${tool.owner}.${tool.connection}`;
|
|
29186
|
+
if (connection !== currentConnection) {
|
|
29187
|
+
currentConnection = connection;
|
|
29188
|
+
lines.push(`${connection} ${tool.typeLabel} (${tool.connectionLabel})`);
|
|
29189
|
+
}
|
|
29190
|
+
lines.push(toolRow(tool));
|
|
29191
|
+
}
|
|
29192
|
+
lines.push("");
|
|
29193
|
+
lines.push(`${String(tools.length)} tools.`);
|
|
29194
|
+
return lines.join(`
|
|
29195
|
+
`);
|
|
29196
|
+
}
|
|
29197
|
+
async function toolsSearch(ctx, args) {
|
|
29198
|
+
const flags = parseLocalFlags(args, ["tools", "search"]);
|
|
29199
|
+
const query = flags.positionals.join(" ").trim();
|
|
29200
|
+
if (query === "") {
|
|
29201
|
+
throw new CliError('Usage: uru tools search "<task>" [--limit N] [--offset N]');
|
|
29202
|
+
}
|
|
29203
|
+
const catalog = filterTools(await fetchToolCatalog(ctx), catalogFilters(flags));
|
|
29204
|
+
const limit = limitFlag(flags, 20);
|
|
29205
|
+
const offset = offsetFlag(flags);
|
|
29206
|
+
const { hits, total } = searchTools(catalog, query, limit, offset);
|
|
29207
|
+
if (total === 0) {
|
|
29208
|
+
const offers = offersMatching(await fetchUnadoptedOffers(ctx), query);
|
|
29209
|
+
if (offers.length > 0) {
|
|
29210
|
+
throw notAdoptedError(query, offers);
|
|
29211
|
+
}
|
|
29212
|
+
throw noMatchError(query, []);
|
|
29213
|
+
}
|
|
29214
|
+
const nextOffset = offset + hits.length;
|
|
29215
|
+
const hasMore = nextOffset < total;
|
|
29216
|
+
emitValue(ctx, {
|
|
29217
|
+
hits: hits.map((hit) => ({ ...toolJson(hit.tool), score: hit.score })),
|
|
29218
|
+
total,
|
|
29219
|
+
hasMore,
|
|
29220
|
+
nextOffset
|
|
29221
|
+
}, [
|
|
29222
|
+
...hits.map((hit) => `${toolRow(hit.tool)} (score ${String(hit.score)})`),
|
|
29223
|
+
"",
|
|
29224
|
+
`${String(hits.length)} of ${String(total)} matches${offset > 0 ? `, from ${String(offset)}` : ""}.${hasMore ? ` Next page: --offset ${String(nextOffset)}.` : ""}`
|
|
29225
|
+
].join(`
|
|
29226
|
+
`));
|
|
29227
|
+
}
|
|
29228
|
+
async function toolsList(ctx, args) {
|
|
29229
|
+
const flags = parseLocalFlags(args, ["tools", "ls"]);
|
|
29230
|
+
const tools = filterTools(await fetchToolCatalog(ctx), catalogFilters(flags));
|
|
29231
|
+
emitValue(ctx, tools.map(toolJson), groupedListing(tools));
|
|
29232
|
+
}
|
|
29233
|
+
async function toolsConnections(ctx, args) {
|
|
29234
|
+
const flags = parseLocalFlags(args, ["tools", "connections"]);
|
|
29235
|
+
const tools = filterTools(await fetchToolCatalog(ctx), {
|
|
29236
|
+
owner: ownerFlag(flags),
|
|
29237
|
+
type: typeFlag(flags)
|
|
29238
|
+
});
|
|
29239
|
+
const connections = summarizeConnections(tools);
|
|
29240
|
+
emitValue(ctx, connections.map((connection) => ({ ...connection })), connections.length === 0 ? "No connections." : connections.map((connection) => ` ${connection.connection} ${connection.typeLabel} ${connection.label} ${String(connection.toolCount)} tools${connection.disabledToolCount > 0 ? ` (${String(connection.disabledToolCount)} disabled)` : ""}`).join(`
|
|
29241
|
+
`));
|
|
29242
|
+
}
|
|
29243
|
+
async function requireTool(ctx, query) {
|
|
29244
|
+
const catalog = await fetchToolCatalog(ctx);
|
|
29245
|
+
const resolution = resolveTool(catalog, query);
|
|
29246
|
+
if (resolution.kind === "no_match") {
|
|
29247
|
+
throw noMatchError(query, resolution.near);
|
|
29248
|
+
}
|
|
29249
|
+
if (resolution.kind === "ambiguous") {
|
|
29250
|
+
throw ambiguousError(query, resolution.matches);
|
|
29251
|
+
}
|
|
29252
|
+
return { tool: resolution.tool, catalog };
|
|
29253
|
+
}
|
|
29254
|
+
async function toolSchemaAnswer(ctx, tool) {
|
|
29255
|
+
if (isPlatformTool(tool)) {
|
|
29256
|
+
return client(ctx).getToolSchema(tool.tool);
|
|
29257
|
+
}
|
|
29258
|
+
return {
|
|
29259
|
+
address: tool.address,
|
|
29260
|
+
inputSchema: tool.inputSchema,
|
|
29261
|
+
outputSchema: tool.outputSchema
|
|
29262
|
+
};
|
|
29263
|
+
}
|
|
29264
|
+
async function toolsSchema(ctx, args) {
|
|
29265
|
+
const flags = parseLocalFlags(args, ["tools", "schema"]);
|
|
29266
|
+
const query = flags.positionals[0];
|
|
29267
|
+
if (query === undefined) {
|
|
29268
|
+
throw new CliError("Usage: uru tools schema <address>");
|
|
29269
|
+
}
|
|
29270
|
+
const { tool } = await requireTool(ctx, query);
|
|
29271
|
+
emitValue(ctx, await toolSchemaAnswer(ctx, tool));
|
|
29272
|
+
}
|
|
29273
|
+
function policyAnswer(tool) {
|
|
29274
|
+
return {
|
|
29275
|
+
owner: tool.owner,
|
|
29276
|
+
connection: `${tool.provider}.${tool.owner}.${tool.connection}`,
|
|
29277
|
+
connectionLabel: tool.connectionLabel,
|
|
29278
|
+
type: tool.type,
|
|
29279
|
+
typeLabel: tool.typeLabel,
|
|
29280
|
+
category: tool.category,
|
|
29281
|
+
writeClass: tool.writeClass,
|
|
29282
|
+
namespaceServing: tool.enabled,
|
|
29283
|
+
execution: isPlatformTool(tool) ? "platform_execute_route" : "mcp_proxy_tools_call"
|
|
29284
|
+
};
|
|
29285
|
+
}
|
|
29286
|
+
async function toolsInspect(ctx, args) {
|
|
29287
|
+
const flags = parseLocalFlags(args, ["tools", "inspect"]);
|
|
29288
|
+
const query = flags.positionals[0];
|
|
29289
|
+
if (query === undefined) {
|
|
29290
|
+
throw new CliError("Usage: uru tools inspect <address>");
|
|
29291
|
+
}
|
|
29292
|
+
const { tool } = await requireTool(ctx, query);
|
|
29293
|
+
const answer = policyAnswer(tool);
|
|
29294
|
+
emitValue(ctx, { ...toolJson(tool), policy: answer }, [
|
|
29295
|
+
`Address ${tool.address}`,
|
|
29296
|
+
`Owner ${tool.owner}`,
|
|
29297
|
+
`Connection ${tool.connectionLabel} (${tool.connection})`,
|
|
29298
|
+
`Type ${tool.typeLabel} (${tool.type})`,
|
|
29299
|
+
`Category ${tool.category ?? "-"}`,
|
|
29300
|
+
`Write class ${tool.writeClass}`,
|
|
29301
|
+
`Serving ${tool.enabled ? "yes" : "no"}`,
|
|
29302
|
+
`Runs through ${String(answer["execution"])}`,
|
|
29303
|
+
`Flat name ${tool.flatName}`,
|
|
29304
|
+
"",
|
|
29305
|
+
tool.description
|
|
29306
|
+
].join(`
|
|
29307
|
+
`));
|
|
29308
|
+
}
|
|
29309
|
+
function assertServing(tool) {
|
|
29310
|
+
if (tool.enabled) {
|
|
29311
|
+
return;
|
|
29312
|
+
}
|
|
29313
|
+
throw refuse(TOOL_REFUSALS.namespaceUnavailable, `${tool.address} is in your catalog but its connection is not serving tools right now.`, `uru tools inspect ${tool.address}`);
|
|
29314
|
+
}
|
|
29315
|
+
function connectorRefusal(tool, error2) {
|
|
29316
|
+
const message = error2.message;
|
|
29317
|
+
const lower = message.toLowerCase();
|
|
29318
|
+
const envelope = parseParkedCallEnvelope(error2.data);
|
|
29319
|
+
if (envelope !== null && envelope.questionId !== null) {
|
|
29320
|
+
return refuse(envelope.status === "approval_required" ? TOOL_REFUSALS.approvalRequired : TOOL_REFUSALS.refusedByPolicy, [
|
|
29321
|
+
`${tool.address} did not run: ${envelope.status}.`,
|
|
29322
|
+
...parkedLines(envelope)
|
|
29323
|
+
].join(`
|
|
29324
|
+
`), `uru tools approve ${envelope.questionId} --accept`);
|
|
29325
|
+
}
|
|
29326
|
+
if (lower.includes("approval")) {
|
|
29327
|
+
return refuse(TOOL_REFUSALS.approvalRequired, `${tool.address} needs an approval before it runs: ${message}`, "uru tools inspect " + tool.address);
|
|
29328
|
+
}
|
|
29329
|
+
if (lower.includes("not connected") || lower.includes("missing exact connection") || lower.includes("connected_account")) {
|
|
29330
|
+
return refuse(TOOL_REFUSALS.notConnected, `${tool.address} has no live connection: ${message}. Connect ${tool.provider} in Uru, then retry.`, `uru tools connections`);
|
|
29331
|
+
}
|
|
29332
|
+
if (error2.status === 403 || lower.includes("policy") || lower.includes("denied")) {
|
|
29333
|
+
return refuse(TOOL_REFUSALS.refusedByPolicy, `${tool.address} was refused by workspace policy: ${message}`, `uru tools inspect ${tool.address}`);
|
|
29334
|
+
}
|
|
29335
|
+
if (error2.status === 404) {
|
|
29336
|
+
return refuse(TOOL_REFUSALS.namespaceUnavailable, `${tool.address} is in your catalog but the proxy does not serve it right now: ${message}`);
|
|
29337
|
+
}
|
|
29338
|
+
return refuse(TOOL_REFUSALS.refusedByPolicy, message);
|
|
29339
|
+
}
|
|
29340
|
+
async function runOneCall(ctx, tool, parameters, mcpUrl) {
|
|
29341
|
+
if (isPlatformTool(tool)) {
|
|
29342
|
+
const operation = getPlatformOperationForToolCall(tool.tool, parameters);
|
|
29343
|
+
if (operation !== undefined) {
|
|
29344
|
+
requireOperationConfirmation(ctx, operation, parameters);
|
|
29345
|
+
} else if (isRegisteredPlatformToolName(tool.tool)) {
|
|
29346
|
+
throw new CliError(unmappedPlatformToolCallMessage(tool.tool, parameters));
|
|
29347
|
+
}
|
|
29348
|
+
return client(ctx).runTool(tool.tool, parameters);
|
|
29349
|
+
}
|
|
29350
|
+
if (ctx.token === undefined) {
|
|
29351
|
+
throw new CliError("Authentication required. Run `uru login`, pass --token, or set URU_TOKEN.");
|
|
29352
|
+
}
|
|
29353
|
+
try {
|
|
29354
|
+
return await callConnectorTool({
|
|
29355
|
+
url: resolveMcpUrl({ apiUrl: ctx.apiUrl, explicit: mcpUrl }),
|
|
29356
|
+
token: ctx.token,
|
|
29357
|
+
workspaceId: ctx.workspace,
|
|
29358
|
+
fetchImpl: ctx.fetch ?? fetch,
|
|
29359
|
+
signal: ctx.abortSignal
|
|
29360
|
+
}, {
|
|
29361
|
+
wrapperToolName: tool.wrapperToolName,
|
|
29362
|
+
providerNativeToolName: tool.providerNativeToolName,
|
|
29363
|
+
parameters
|
|
29364
|
+
});
|
|
29365
|
+
} catch (error2) {
|
|
29366
|
+
if (error2 instanceof McpCallError) {
|
|
29367
|
+
throw connectorRefusal(tool, error2);
|
|
29368
|
+
}
|
|
29369
|
+
throw error2;
|
|
29370
|
+
}
|
|
29371
|
+
}
|
|
29372
|
+
async function toolsRun(ctx, args) {
|
|
29373
|
+
const flags = parseLocalFlags(args, ["tools", "run"]);
|
|
29374
|
+
const query = flags.positionals[0];
|
|
29375
|
+
if (query === undefined) {
|
|
29376
|
+
throw new CliError("Usage: uru tools run <address> -d '{...}'");
|
|
29377
|
+
}
|
|
29378
|
+
const { tool } = await requireTool(ctx, query);
|
|
29379
|
+
if (flags.booleans.has("--get-schema")) {
|
|
29380
|
+
emitValue(ctx, await toolSchemaAnswer(ctx, tool));
|
|
29381
|
+
return;
|
|
29382
|
+
}
|
|
29383
|
+
const parameters = await toolParameters(ctx, flags);
|
|
29384
|
+
const parallel = flags.booleans.has("--parallel");
|
|
29385
|
+
if (parallel && !Array.isArray(parameters)) {
|
|
29386
|
+
throw new CliError("--parallel needs a JSON array of input objects.");
|
|
29387
|
+
}
|
|
29388
|
+
if (!parallel && !isJsonObject(parameters)) {
|
|
29389
|
+
throw new CliError("-d must be a JSON object. Use --parallel for an array.");
|
|
29390
|
+
}
|
|
29391
|
+
if (flags.booleans.has("--dry-run")) {
|
|
29392
|
+
emitValue(ctx, {
|
|
29393
|
+
dryRun: true,
|
|
29394
|
+
address: tool.address,
|
|
29395
|
+
wrapperToolName: tool.wrapperToolName,
|
|
29396
|
+
providerNativeToolName: tool.providerNativeToolName,
|
|
29397
|
+
parameters,
|
|
29398
|
+
policy: policyAnswer(tool)
|
|
29399
|
+
}, [
|
|
29400
|
+
`Dry run — nothing was executed.`,
|
|
29401
|
+
`Address ${tool.address}`,
|
|
29402
|
+
`Connection ${tool.connectionLabel} (${tool.connection})`,
|
|
29403
|
+
`Write class ${tool.writeClass}`,
|
|
29404
|
+
`Serving ${tool.enabled ? "yes" : "no"}`,
|
|
29405
|
+
`Runs through ${String(policyAnswer(tool)["execution"])}`
|
|
29406
|
+
].join(`
|
|
29407
|
+
`));
|
|
29408
|
+
return;
|
|
29409
|
+
}
|
|
29410
|
+
assertServing(tool);
|
|
29411
|
+
const mcpUrl = flags.values["--mcp-url"];
|
|
29412
|
+
if (parallel) {
|
|
29413
|
+
const inputs = parameters;
|
|
29414
|
+
const results = [];
|
|
29415
|
+
for (const input of inputs) {
|
|
29416
|
+
if (!isJsonObject(input)) {
|
|
29417
|
+
throw new CliError("--parallel needs every array entry to be an object.");
|
|
29418
|
+
}
|
|
29419
|
+
results.push(await runOneCall(ctx, tool, input, mcpUrl));
|
|
29420
|
+
}
|
|
29421
|
+
emitValue(ctx, { address: tool.address, results });
|
|
29422
|
+
return;
|
|
29423
|
+
}
|
|
29424
|
+
const result = await runOneCall(ctx, tool, parameters, mcpUrl);
|
|
29425
|
+
const parked = parseParkedCallEnvelope(result);
|
|
29426
|
+
if (parked !== null) {
|
|
29427
|
+
emitValue(ctx, result, [
|
|
29428
|
+
`${tool.address} did not run yet.`,
|
|
29429
|
+
...parkedLines(parked)
|
|
29430
|
+
].join(`
|
|
29431
|
+
`));
|
|
29432
|
+
return;
|
|
29433
|
+
}
|
|
29434
|
+
emitValue(ctx, result);
|
|
29435
|
+
}
|
|
29436
|
+
async function toolsApprove(ctx, args) {
|
|
29437
|
+
const flags = parseLocalFlags(args, ["tools", "approve"]);
|
|
29438
|
+
const questionId = flags.positionals[0]?.trim();
|
|
29439
|
+
if (questionId === undefined || questionId === "") {
|
|
29440
|
+
throw new CliError("Usage: uru tools approve <question-id> --accept | --decline");
|
|
29441
|
+
}
|
|
29442
|
+
const accept = flags.booleans.has("--accept");
|
|
29443
|
+
const decline = flags.booleans.has("--decline");
|
|
29444
|
+
if (accept === decline) {
|
|
29445
|
+
throw new CliError("Choose exactly one of --accept or --decline for `uru tools approve`.");
|
|
29446
|
+
}
|
|
29447
|
+
const decision = accept ? "accept" : "decline";
|
|
29448
|
+
const answer = await client(ctx).api(`/api/tool-approvals/${encodeURIComponent(questionId)}`, { method: "POST", body: { decision } });
|
|
29449
|
+
if (!isJsonObject(answer)) {
|
|
29450
|
+
throw new CliError("The approval answer route returned a non-object response.");
|
|
29451
|
+
}
|
|
29452
|
+
const alreadyAnswered = answer["alreadyResolved"] === true;
|
|
29453
|
+
const settled = typeof answer["decision"] === "string" ? answer["decision"] : "unknown";
|
|
29454
|
+
emitValue(ctx, answer, [
|
|
29455
|
+
alreadyAnswered ? `This call was already answered: ${settled}.` : `Answered: ${settled}.`,
|
|
29456
|
+
`Question id ${questionId}`
|
|
29457
|
+
].join(`
|
|
29458
|
+
`));
|
|
29459
|
+
}
|
|
29460
|
+
async function toolsDrillDown(ctx, command) {
|
|
29461
|
+
const flags = parseLocalFlags(command.slice(1), ["tools"]);
|
|
29462
|
+
const prefix = flags.positionals.join(".").trim();
|
|
29463
|
+
const catalog = await fetchToolCatalog(ctx);
|
|
29464
|
+
const match = flags.values["--match"]?.trim().toLowerCase();
|
|
29465
|
+
const resolution = resolveTool(catalog, prefix);
|
|
29466
|
+
if (resolution.kind === "exact") {
|
|
29467
|
+
const tool = resolution.tool;
|
|
29468
|
+
emitValue(ctx, {
|
|
29469
|
+
...toolJson(tool),
|
|
29470
|
+
inputSchema: tool.inputSchema,
|
|
29471
|
+
outputSchema: tool.outputSchema
|
|
29472
|
+
}, [
|
|
29473
|
+
`${tool.address} [${tool.writeClass}]`,
|
|
29474
|
+
tool.description,
|
|
29475
|
+
"",
|
|
29476
|
+
"Input",
|
|
29477
|
+
JSON.stringify(tool.inputSchema, null, 2),
|
|
29478
|
+
"",
|
|
29479
|
+
"Output",
|
|
29480
|
+
JSON.stringify(tool.outputSchema ?? {}, null, 2)
|
|
29481
|
+
].join(`
|
|
29482
|
+
`));
|
|
29483
|
+
return;
|
|
29484
|
+
}
|
|
29485
|
+
const branches = addressBranches(catalog, prefix).filter((branch) => match === undefined || branch.segment.toLowerCase().includes(match));
|
|
29486
|
+
if (branches.length === 0) {
|
|
29487
|
+
throw noMatchError(prefix, resolution.kind === "no_match" ? resolution.near : []);
|
|
29488
|
+
}
|
|
29489
|
+
const limited = branches.slice(0, limitFlag(flags, 50));
|
|
29490
|
+
emitValue(ctx, { prefix, branches: limited.map((branch) => ({ ...branch })), total: branches.length }, [
|
|
29491
|
+
`${prefix}.*`,
|
|
29492
|
+
...limited.map((branch) => ` ${branch.prefix}${branch.leaf ? "" : ".*"} ${String(branch.toolCount)} tools`),
|
|
29493
|
+
"",
|
|
29494
|
+
`${String(limited.length)} of ${String(branches.length)} branches.`
|
|
29495
|
+
].join(`
|
|
29496
|
+
`));
|
|
29497
|
+
}
|
|
29498
|
+
async function dispatchTools(ctx, command) {
|
|
29499
|
+
const sub = command[1];
|
|
29500
|
+
const args = command.slice(2);
|
|
29501
|
+
await withWorkspace(ctx);
|
|
29502
|
+
if (sub === "search") {
|
|
29503
|
+
await toolsSearch(ctx, args);
|
|
29504
|
+
return;
|
|
29505
|
+
}
|
|
29506
|
+
if (sub === "ls" || sub === "list") {
|
|
29507
|
+
await toolsList(ctx, args);
|
|
29508
|
+
return;
|
|
29509
|
+
}
|
|
29510
|
+
if (sub === "connections") {
|
|
29511
|
+
await toolsConnections(ctx, args);
|
|
29512
|
+
return;
|
|
29513
|
+
}
|
|
29514
|
+
if (sub === "schema") {
|
|
29515
|
+
await toolsSchema(ctx, args);
|
|
29516
|
+
return;
|
|
29517
|
+
}
|
|
29518
|
+
if (sub === "inspect") {
|
|
29519
|
+
await toolsInspect(ctx, args);
|
|
29520
|
+
return;
|
|
29521
|
+
}
|
|
29522
|
+
if (sub === "run") {
|
|
29523
|
+
await toolsRun(ctx, args);
|
|
29524
|
+
return;
|
|
29525
|
+
}
|
|
29526
|
+
if (sub === "approve") {
|
|
29527
|
+
await toolsApprove(ctx, args);
|
|
29528
|
+
return;
|
|
29529
|
+
}
|
|
29530
|
+
if (isToolsAddressDrillDown(command)) {
|
|
29531
|
+
await toolsDrillDown(ctx, command);
|
|
29532
|
+
return;
|
|
29533
|
+
}
|
|
29534
|
+
throw new CliError("Usage: uru tools search|ls|schema|inspect|run|approve|connections, or `uru tools <partial address> --help`.");
|
|
29535
|
+
}
|
|
29536
|
+
function unmappedPlatformToolCallMessage(toolName, params) {
|
|
29537
|
+
const op2 = typeof params["op"] === "string" ? params["op"] : undefined;
|
|
29538
|
+
const mistakenOperation = typeof params["operation"] === "string" ? params["operation"] : undefined;
|
|
29539
|
+
const normalizedTool = toolName.trim().toLowerCase();
|
|
29540
|
+
const normalizedOp = op2?.trim().toLowerCase();
|
|
29541
|
+
if (mistakenOperation !== undefined && mistakenOperation.trim() !== "" && (op2 === undefined || op2.trim() === "")) {
|
|
29542
|
+
const suggested = mistakenOperation.trim();
|
|
29543
|
+
return `Platform tools take \`op\`, not \`operation\` (got operation=${suggested}). ` + `Retry with op=${suggested}.`;
|
|
29544
|
+
}
|
|
29545
|
+
if (normalizedTool === "library_fs" && (normalizedOp === "ls" || normalizedOp === "stat" || normalizedOp === "read" || normalizedOp === "search")) {
|
|
29546
|
+
return `library_fs does not serve read op=${normalizedOp}. ` + "Use library_query (or `uru library ls|stat|search|read` / " + "`uru operations run library.<op>`).";
|
|
29547
|
+
}
|
|
29548
|
+
if (normalizedOp !== undefined) {
|
|
29549
|
+
return `No registered safety policy for ${toolName} op=${normalizedOp}. ` + "Refuse to execute. Check `uru operations search` for the supported operation id.";
|
|
29550
|
+
}
|
|
29551
|
+
return `No registered safety policy for ${toolName}. ` + "Refuse to execute without a mapped platform operation.";
|
|
29552
|
+
}
|
|
29553
|
+
|
|
27650
29554
|
// src/token-env-secret-commands.ts
|
|
27651
29555
|
import { spawn } from "node:child_process";
|
|
27652
29556
|
import { chmod as chmod2, mkdir as mkdir6, readFile as readFile9, writeFile as writeFile5 } from "node:fs/promises";
|
|
@@ -28349,7 +30253,7 @@ var cliCommandRuntimeBindings = {
|
|
|
28349
30253
|
await dispatchUpdate(ctx, command.slice(1));
|
|
28350
30254
|
},
|
|
28351
30255
|
tools: async ({ ctx, command }) => {
|
|
28352
|
-
await dispatchTools(ctx, command
|
|
30256
|
+
await dispatchTools(ctx, command);
|
|
28353
30257
|
},
|
|
28354
30258
|
init: async ({ ctx, command }) => {
|
|
28355
30259
|
await withWorkspace(ctx);
|
|
@@ -28509,7 +30413,7 @@ async function dispatchRegistryFamilyCommand({
|
|
|
28509
30413
|
// src/config.ts
|
|
28510
30414
|
import { chmod as chmod3, mkdir as mkdir7, open as open2, readFile as readFile10, rename as rename3, rm as rm4 } from "node:fs/promises";
|
|
28511
30415
|
import { constants as constants2 } from "node:fs";
|
|
28512
|
-
import { randomUUID as
|
|
30416
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
28513
30417
|
import { homedir as homedir2 } from "node:os";
|
|
28514
30418
|
import { dirname as dirname7, join as join5 } from "node:path";
|
|
28515
30419
|
function resolveConfigHome(env = process.env) {
|
|
@@ -28545,7 +30449,7 @@ function createConfigStore(path = configPath()) {
|
|
|
28545
30449
|
await mkdir7(dirname7(path), { recursive: true });
|
|
28546
30450
|
const body = `${JSON.stringify(sanitizeConfig(config2), null, 2)}
|
|
28547
30451
|
`;
|
|
28548
|
-
const temporaryPath = `${path}.${process.pid}.${
|
|
30452
|
+
const temporaryPath = `${path}.${process.pid}.${randomUUID3()}.tmp`;
|
|
28549
30453
|
let handle = null;
|
|
28550
30454
|
try {
|
|
28551
30455
|
handle = await open2(temporaryPath, constants2.O_CREAT | constants2.O_EXCL | constants2.O_WRONLY, constants2.S_IRUSR | constants2.S_IWUSR);
|
|
@@ -29153,7 +31057,8 @@ async function runCli(options) {
|
|
|
29153
31057
|
writeText(io, CLI_VERSION);
|
|
29154
31058
|
return ExitCode.Ok;
|
|
29155
31059
|
}
|
|
29156
|
-
|
|
31060
|
+
const helpIsAddressDrillDown = parsed.flags.help && isToolsAddressDrillDown(parsed.command);
|
|
31061
|
+
if (parsed.flags.help && !helpIsAddressDrillDown || parsed.command.length === 0) {
|
|
29157
31062
|
const helpTerminal = detectTerminalCapabilities({
|
|
29158
31063
|
flags: parsed.flags,
|
|
29159
31064
|
...options.env === undefined ? {} : { env: options.env },
|