@kitman-sh/cli 0.12.0-rc.7 → 0.12.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-15geyg2d.js → chunk-3cgshf16.js} +98 -101
- package/dist/{chunk-j5t5nye5.js → chunk-3kxwb7qn.js} +7 -7
- package/dist/{chunk-bheg4ybe.js → chunk-6pqxsnk1.js} +22 -23
- package/dist/{chunk-e4an66v2.js → chunk-7959aeck.js} +5 -5
- package/dist/{chunk-xwya1er0.js → chunk-892qrkb3.js} +14 -60
- package/dist/{chunk-0346hwh6.js → chunk-8sz25ptv.js} +4 -5
- package/dist/{chunk-1t12wvv1.js → chunk-9c9vrbh4.js} +205 -216
- package/dist/{chunk-8twjqszj.js → chunk-9q7qc1dg.js} +1 -1
- package/dist/{chunk-z450wa10.js → chunk-bz4bp0q7.js} +3 -4
- package/dist/{chunk-znar1th3.js → chunk-d8qcmqh5.js} +4 -4
- package/dist/{chunk-2e91ymwn.js → chunk-det0tmx7.js} +1 -1
- package/dist/{chunk-xe8qf2xy.js → chunk-dh09wyed.js} +127 -129
- package/dist/{chunk-ewhzaqp3.js → chunk-e711ebdj.js} +2 -2
- package/dist/{chunk-wc2kba4z.js → chunk-ey4mf341.js} +6 -7
- package/dist/{chunk-qrm334c6.js → chunk-jg8n8z0z.js} +4 -4
- package/dist/{chunk-4w4spvb1.js → chunk-jwc8bdga.js} +5 -5
- package/dist/{chunk-nzjb36ad.js → chunk-mm2m3bys.js} +1 -1
- package/dist/{chunk-r5sw3fe0.js → chunk-mmpcdj8f.js} +10 -12
- package/dist/{chunk-0qz10ek8.js → chunk-s8m2tzdr.js} +4 -4
- package/dist/{chunk-xcf887a4.js → chunk-scb6qgy2.js} +47 -49
- package/dist/{chunk-5j848ckb.js → chunk-skqn4h13.js} +2 -2
- package/dist/{chunk-56knbdt6.js → chunk-vkchn89k.js} +23 -25
- package/dist/{chunk-pd2vz4bm.js → chunk-vrms6e1m.js} +13 -15
- package/dist/{chunk-vtfwjhzh.js → chunk-x3cc7dfc.js} +379 -63
- package/dist/{chunk-gspfm7qh.js → chunk-y7vjk8vv.js} +31 -165
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-c6rbt85q.js +0 -141
|
@@ -103,11 +103,22 @@ import {
|
|
|
103
103
|
isMaxLength,
|
|
104
104
|
TaggedError2,
|
|
105
105
|
JsonObject,
|
|
106
|
+
toJsonValue,
|
|
107
|
+
isOneOf,
|
|
108
|
+
isKeyOf,
|
|
109
|
+
toJsonObject,
|
|
110
|
+
isBoolean2,
|
|
111
|
+
isFunction2,
|
|
112
|
+
isNumber2,
|
|
113
|
+
isObject2,
|
|
114
|
+
isJsonObject,
|
|
115
|
+
isString2,
|
|
116
|
+
kindOf,
|
|
106
117
|
decodeJsonString,
|
|
107
118
|
decodeJsonStringOption,
|
|
108
119
|
encodeJsonStringSync,
|
|
109
120
|
encodePrettyJsonString
|
|
110
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-x3cc7dfc.js";
|
|
111
122
|
import {
|
|
112
123
|
currentTimeMillis,
|
|
113
124
|
SecureRandom,
|
|
@@ -147,8 +158,8 @@ import {
|
|
|
147
158
|
sessionForApi,
|
|
148
159
|
readAuthStore,
|
|
149
160
|
agentCredentialForApi,
|
|
161
|
+
make5,
|
|
150
162
|
make6,
|
|
151
|
-
make7,
|
|
152
163
|
Service,
|
|
153
164
|
shouldRefresh,
|
|
154
165
|
refreshSession,
|
|
@@ -159,26 +170,13 @@ import {
|
|
|
159
170
|
runMcpEffect,
|
|
160
171
|
createAgentAuthSignedFetch,
|
|
161
172
|
setupMcpAgentCredential
|
|
162
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-9c9vrbh4.js";
|
|
163
174
|
import {
|
|
164
175
|
guard,
|
|
165
176
|
Id,
|
|
166
177
|
Timestamp,
|
|
167
178
|
ActorType
|
|
168
|
-
} from "./chunk-
|
|
169
|
-
import {
|
|
170
|
-
toJsonValue,
|
|
171
|
-
isOneOf,
|
|
172
|
-
isKeyOf,
|
|
173
|
-
toJsonObject,
|
|
174
|
-
isBoolean,
|
|
175
|
-
isFunction,
|
|
176
|
-
isNumber,
|
|
177
|
-
isObject,
|
|
178
|
-
isJsonObject,
|
|
179
|
-
isString,
|
|
180
|
-
kindOf
|
|
181
|
-
} from "./chunk-c6rbt85q.js";
|
|
179
|
+
} from "./chunk-s8m2tzdr.js";
|
|
182
180
|
import {
|
|
183
181
|
join,
|
|
184
182
|
interrupt,
|
|
@@ -192,21 +190,21 @@ import {
|
|
|
192
190
|
withDefault,
|
|
193
191
|
option,
|
|
194
192
|
String2
|
|
195
|
-
} from "./chunk-
|
|
193
|
+
} from "./chunk-y7vjk8vv.js";
|
|
196
194
|
import {
|
|
197
195
|
searchDocs2,
|
|
198
196
|
readDoc2
|
|
199
|
-
} from "./chunk-
|
|
197
|
+
} from "./chunk-det0tmx7.js";
|
|
200
198
|
import {
|
|
201
199
|
nextInt
|
|
202
|
-
} from "./chunk-
|
|
200
|
+
} from "./chunk-mm2m3bys.js";
|
|
203
201
|
import {
|
|
204
202
|
layerJson,
|
|
205
|
-
|
|
203
|
+
make3,
|
|
206
204
|
withHeaders,
|
|
207
205
|
layerProtocolSocket,
|
|
208
206
|
ConnectionHooks
|
|
209
|
-
} from "./chunk-
|
|
207
|
+
} from "./chunk-jwc8bdga.js";
|
|
210
208
|
|
|
211
209
|
// apps/cli/src/mcp.ts
|
|
212
210
|
import { tmpdir as tmpdir2 } from "os";
|
|
@@ -215,7 +213,7 @@ import { tmpdir as tmpdir2 } from "os";
|
|
|
215
213
|
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
|
|
216
214
|
|
|
217
215
|
// packages/core/src/question-recommendation.ts
|
|
218
|
-
var optionValue = (option) =>
|
|
216
|
+
var optionValue = (option) => isString2(option) ? option : option.value;
|
|
219
217
|
var recommendationProblem = (question) => {
|
|
220
218
|
const options = question.options?.map(optionValue);
|
|
221
219
|
const reason = question.recommendationReason?.trim() ?? "";
|
|
@@ -1958,56 +1956,56 @@ var LivePresenceSubscriptionMessage = Union([
|
|
|
1958
1956
|
LivePresenceSubscriptionUpdate
|
|
1959
1957
|
]);
|
|
1960
1958
|
|
|
1961
|
-
class LiveRpcs extends
|
|
1959
|
+
class LiveRpcs extends make6(make5("Session", {
|
|
1962
1960
|
success: Struct({ workspaceId: String4, clientKind: String4 }),
|
|
1963
1961
|
error: LiveRpcError
|
|
1964
|
-
}),
|
|
1962
|
+
}), make5("Subscribe", {
|
|
1965
1963
|
payload: LiveSubscribeInput,
|
|
1966
1964
|
success: LiveSubscriptionMessage,
|
|
1967
1965
|
error: LiveRpcError,
|
|
1968
1966
|
stream: true
|
|
1969
|
-
}),
|
|
1967
|
+
}), make5("Replay", {
|
|
1970
1968
|
payload: LiveReplayInput,
|
|
1971
1969
|
success: ArraySchema(LiveEvent),
|
|
1972
1970
|
error: LiveRpcError
|
|
1973
|
-
}),
|
|
1971
|
+
}), make5("Ack", {
|
|
1974
1972
|
payload: LiveAckInput,
|
|
1975
1973
|
success: LiveAckResult,
|
|
1976
1974
|
error: LiveRpcError
|
|
1977
|
-
}),
|
|
1975
|
+
}), make5("SubscribeWeb", {
|
|
1978
1976
|
payload: LiveWebSubscribeInput,
|
|
1979
1977
|
success: LiveWebSubscriptionMessage,
|
|
1980
1978
|
error: LiveRpcError,
|
|
1981
1979
|
stream: true
|
|
1982
|
-
}),
|
|
1980
|
+
}), make5("SubscriptionStatus", {
|
|
1983
1981
|
payload: { subscriptionId: String4 },
|
|
1984
1982
|
success: LiveSubscriptionStatus,
|
|
1985
1983
|
error: LiveRpcError
|
|
1986
|
-
}),
|
|
1984
|
+
}), make5("ReplayWeb", {
|
|
1987
1985
|
payload: LiveWebReplayInput,
|
|
1988
1986
|
success: LiveWebReplayResult,
|
|
1989
1987
|
error: LiveRpcError
|
|
1990
|
-
}),
|
|
1988
|
+
}), make5("AckWeb", {
|
|
1991
1989
|
payload: LiveWebAckInput,
|
|
1992
1990
|
success: LiveWebAckResult,
|
|
1993
1991
|
error: LiveRpcError
|
|
1994
|
-
}),
|
|
1992
|
+
}), make5("PublishPresence", {
|
|
1995
1993
|
payload: LivePresencePublishInput,
|
|
1996
1994
|
success: LivePresenceEntry,
|
|
1997
1995
|
error: LiveRpcError
|
|
1998
|
-
}),
|
|
1996
|
+
}), make5("SubscribePresence", {
|
|
1999
1997
|
payload: LivePresenceSubscribeInput,
|
|
2000
1998
|
success: LivePresenceSubscriptionMessage,
|
|
2001
1999
|
error: LiveRpcError,
|
|
2002
2000
|
stream: true
|
|
2003
|
-
}),
|
|
2001
|
+
}), make5("ClearPresence", {
|
|
2004
2002
|
payload: { scope: optional(LiveScope) },
|
|
2005
2003
|
error: LiveRpcError
|
|
2006
|
-
}),
|
|
2004
|
+
}), make5("RecordSessionUpdate", {
|
|
2007
2005
|
payload: { sessionId: String4, input: SessionUpdateCreate },
|
|
2008
2006
|
success: SessionUpdate,
|
|
2009
2007
|
error: LiveRpcError
|
|
2010
|
-
}),
|
|
2008
|
+
}), make5("EndSession", {
|
|
2011
2009
|
payload: { sessionId: String4, input: SessionEnd },
|
|
2012
2010
|
success: Session,
|
|
2013
2011
|
error: LiveRpcError
|
|
@@ -2058,8 +2056,8 @@ function connectKitmanLiveRoot(protocol) {
|
|
|
2058
2056
|
brokenListeners.forEach((listener) => listener(new Error("Live connection dropped")));
|
|
2059
2057
|
})
|
|
2060
2058
|
});
|
|
2061
|
-
const layer = (
|
|
2062
|
-
const client = await runPromise(buildWithScope(layer, scope).pipe(flatMap3((context) =>
|
|
2059
|
+
const layer = (isString2(protocol) ? liveWebSocketProtocol(protocol) : protocol()).pipe(provideMerge(hooks));
|
|
2060
|
+
const client = await runPromise(buildWithScope(layer, scope).pipe(flatMap3((context) => make3(LiveRpcs).pipe(provideContext2(context))), provide(scope)));
|
|
2063
2061
|
let abandon = () => {};
|
|
2064
2062
|
const abandoned = new Promise((_resolve, reject) => {
|
|
2065
2063
|
abandon = reject;
|
|
@@ -2973,7 +2971,7 @@ function createOperationDescriptors() {
|
|
|
2973
2971
|
}
|
|
2974
2972
|
function operationTypeScript(schema) {
|
|
2975
2973
|
if (schema.type === "object") {
|
|
2976
|
-
const required = new Set(Array.isArray(schema.required) ? schema.required.filter((item) =>
|
|
2974
|
+
const required = new Set(Array.isArray(schema.required) ? schema.required.filter((item) => isString2(item)) : []);
|
|
2977
2975
|
const properties = isSchema(schema.properties) ? schema.properties : {};
|
|
2978
2976
|
const fields = Object.entries(properties).map(([key, value]) => `${key}${required.has(key) ? "" : "?"}: ${schemaTypeScript(isSchema(value) ? value : {})}`);
|
|
2979
2977
|
const objectType = fields.length > 0 ? `{ ${fields.join("; ")} }` : "{ [key: string]: unknown }";
|
|
@@ -2987,7 +2985,7 @@ function operationTypeScript(schema) {
|
|
|
2987
2985
|
}
|
|
2988
2986
|
function dependentRequiredFields(schema) {
|
|
2989
2987
|
const parts = [schema, ...Array.isArray(schema.allOf) ? schema.allOf.filter(isSchema) : []];
|
|
2990
|
-
return parts.flatMap((part) => isSchema(part.dependentRequired) ? Object.entries(part.dependentRequired).flatMap(([field, needed]) => Array.isArray(needed) ? [[field, needed.filter(
|
|
2988
|
+
return parts.flatMap((part) => isSchema(part.dependentRequired) ? Object.entries(part.dependentRequired).flatMap(([field, needed]) => Array.isArray(needed) ? [[field, needed.filter(isString2)]] : []) : []);
|
|
2991
2989
|
}
|
|
2992
2990
|
function schemaTypeScript(schema) {
|
|
2993
2991
|
if ("const" in schema)
|
|
@@ -3011,7 +3009,7 @@ function schemaTypeScript(schema) {
|
|
|
3011
3009
|
return "unknown";
|
|
3012
3010
|
}
|
|
3013
3011
|
function isSchema(value) {
|
|
3014
|
-
return
|
|
3012
|
+
return isObject2(value) && value !== null && !Array.isArray(value);
|
|
3015
3013
|
}
|
|
3016
3014
|
function isReadOnlyOperation(name) {
|
|
3017
3015
|
return /^(whoami|list|get|search|render|export)/.test(name);
|
|
@@ -5426,13 +5424,13 @@ var executeCodeMode = fnUntraced(function* (input, options) {
|
|
|
5426
5424
|
message: `Code Mode secure-exec failed with exit code ${outcome.exitCode}`
|
|
5427
5425
|
});
|
|
5428
5426
|
const returned = yield* decodeJsonString(outcome.text).pipe(map8((json) => isJsonObject(json) ? json : {}), mapError2(() => new CodeModeExecutionError({ message: "Code Mode secure-exec returned an unreadable result" })));
|
|
5429
|
-
if (
|
|
5427
|
+
if (isString2(returned.thrown))
|
|
5430
5428
|
return yield* new CodeModeExecutionError({ message: `Code Mode code threw ${returned.thrown}` });
|
|
5431
5429
|
const finishedAt = yield* currentTimeMillis;
|
|
5432
5430
|
return {
|
|
5433
5431
|
value: returned.value,
|
|
5434
5432
|
output: Array.isArray(returned.output) ? returned.output : [],
|
|
5435
|
-
logs: Array.isArray(returned.logs) ? returned.logs.filter(
|
|
5433
|
+
logs: Array.isArray(returned.logs) ? returned.logs.filter(isString2) : [],
|
|
5436
5434
|
metadata: { codeHash, durationMs: finishedAt - startedAt, backend: "secure-exec" }
|
|
5437
5435
|
};
|
|
5438
5436
|
}), (warm) => forkDetach(disposeGuest(warm)).pipe(asVoid));
|
|
@@ -5460,7 +5458,7 @@ function createHostBinding(dispatch, context) {
|
|
|
5460
5458
|
});
|
|
5461
5459
|
const operationName = body.operationName;
|
|
5462
5460
|
const args = body.args;
|
|
5463
|
-
if (!
|
|
5461
|
+
if (!isString2(operationName) || operationName.length === 0 || !isJsonObject(args))
|
|
5464
5462
|
return yield* new CodeModeExecutionError({ message: "Invalid Kitman Code Mode call" });
|
|
5465
5463
|
return yield* dispatch(operationName, args);
|
|
5466
5464
|
}))
|
|
@@ -5714,7 +5712,7 @@ function formatCodeModeResult(output, options = {}) {
|
|
|
5714
5712
|
function slimCodeModeFields(output, options) {
|
|
5715
5713
|
const slim = (value) => slimNested(value, options.workspaceId);
|
|
5716
5714
|
return Object.fromEntries(Object.entries(output).map(([key, value]) => {
|
|
5717
|
-
if (key === "result" && !
|
|
5715
|
+
if (key === "result" && !isString2(value))
|
|
5718
5716
|
return [key, slim(value)];
|
|
5719
5717
|
if ((key === "emittedOutput" || key === "logs") && Array.isArray(value))
|
|
5720
5718
|
return [key, slim(value)];
|
|
@@ -5722,13 +5720,13 @@ function slimCodeModeFields(output, options) {
|
|
|
5722
5720
|
}));
|
|
5723
5721
|
}
|
|
5724
5722
|
function slimNested(value, workspaceId) {
|
|
5725
|
-
if (
|
|
5723
|
+
if (isString2(value))
|
|
5726
5724
|
return cutText(value);
|
|
5727
5725
|
if (Array.isArray(value))
|
|
5728
5726
|
return value.map((item) => slimNested(item, workspaceId));
|
|
5729
5727
|
if (!isRecord(value))
|
|
5730
5728
|
return value;
|
|
5731
|
-
const isTask =
|
|
5729
|
+
const isTask = isString2(value.key) && TaskKeyPattern.test(value.key);
|
|
5732
5730
|
return Object.fromEntries(Object.entries(value).flatMap(([key, child]) => {
|
|
5733
5731
|
if (key === "id" && isTask)
|
|
5734
5732
|
return [];
|
|
@@ -5754,10 +5752,10 @@ function preserveExecutionPauseMetadata(output, safeOutput) {
|
|
|
5754
5752
|
return {
|
|
5755
5753
|
...safeOutput,
|
|
5756
5754
|
status: "waiting_for_interaction",
|
|
5757
|
-
...
|
|
5758
|
-
...
|
|
5759
|
-
...
|
|
5760
|
-
...
|
|
5755
|
+
...isString2(output.executionId) ? { executionId: output.executionId } : undefined,
|
|
5756
|
+
...isNumber2(output.ttlMs) && Number.isFinite(output.ttlMs) ? { ttlMs: output.ttlMs } : undefined,
|
|
5757
|
+
...isString2(output.createdAt) ? { createdAt: output.createdAt } : undefined,
|
|
5758
|
+
...isString2(output.expiresAt) ? { expiresAt: output.expiresAt } : undefined,
|
|
5761
5759
|
...isRecord(safeOutput.interaction) ? { interaction: safeOutput.interaction } : undefined
|
|
5762
5760
|
};
|
|
5763
5761
|
}
|
|
@@ -5781,7 +5779,7 @@ Kitman MCP recovery: refresh the delegated MCP grants with an active Kitman CLI
|
|
|
5781
5779
|
class McpToolInputError extends TaggedError("McpToolInputError") {
|
|
5782
5780
|
}
|
|
5783
5781
|
function isRecord(value) {
|
|
5784
|
-
return
|
|
5782
|
+
return isObject2(value) && value !== null && !Array.isArray(value);
|
|
5785
5783
|
}
|
|
5786
5784
|
function toolOutputSummary(output) {
|
|
5787
5785
|
if (Array.isArray(output))
|
|
@@ -5807,7 +5805,7 @@ repoBinding: ${recordSummary(repoBinding)}`;
|
|
|
5807
5805
|
return "";
|
|
5808
5806
|
}
|
|
5809
5807
|
function resolverTeamContextSummary(output) {
|
|
5810
|
-
if (!
|
|
5808
|
+
if (!isString2(output.resolutionSource))
|
|
5811
5809
|
return "";
|
|
5812
5810
|
const lines = [
|
|
5813
5811
|
`workspaceId: ${stringOrNull(output.workspaceId)}`,
|
|
@@ -5816,14 +5814,14 @@ function resolverTeamContextSummary(output) {
|
|
|
5816
5814
|
];
|
|
5817
5815
|
const warnings = output.warnings;
|
|
5818
5816
|
if (Array.isArray(warnings)) {
|
|
5819
|
-
lines.push(`warnings: ${warnings.length === 0 ? "[]" : warnings.map((warning) =>
|
|
5817
|
+
lines.push(`warnings: ${warnings.length === 0 ? "[]" : warnings.map((warning) => isString2(warning) ? sanitizeSummaryField(warning) : primitiveSummary(warning)).join("; ")}`);
|
|
5820
5818
|
}
|
|
5821
5819
|
return `
|
|
5822
5820
|
${lines.join(`
|
|
5823
5821
|
`)}`;
|
|
5824
5822
|
}
|
|
5825
5823
|
function stringOrNull(value) {
|
|
5826
|
-
return
|
|
5824
|
+
return isString2(value) && value.length > 0 ? sanitizeSummaryField(value) : "null";
|
|
5827
5825
|
}
|
|
5828
5826
|
function itemListSummary(items) {
|
|
5829
5827
|
if (items.length === 0)
|
|
@@ -5858,10 +5856,10 @@ function operationDescriptorSummary(record) {
|
|
|
5858
5856
|
const summary = stringField(record, "summary");
|
|
5859
5857
|
if (name.length === 0 || summary.length === 0 || !Array.isArray(record.namespacePath))
|
|
5860
5858
|
return "";
|
|
5861
|
-
const path = record.namespacePath.every((part) =>
|
|
5859
|
+
const path = record.namespacePath.every((part) => isString2(part)) ? record.namespacePath.join(".") : "";
|
|
5862
5860
|
const parameters = sdkParameterSummary(record.sdk);
|
|
5863
5861
|
const required = schemaRequiredSummary(record.inputSchema);
|
|
5864
|
-
const examples = Array.isArray(record.examples) ? record.examples.filter((example) =>
|
|
5862
|
+
const examples = Array.isArray(record.examples) ? record.examples.filter((example) => isString2(example)).slice(0, 2).map(sanitizeSummaryField).join("; ") : "";
|
|
5865
5863
|
const parts = [
|
|
5866
5864
|
name,
|
|
5867
5865
|
path.length > 0 ? `kitman.${sanitizeSummaryField(path)}(...)` : "",
|
|
@@ -5882,7 +5880,7 @@ function sdkParameterSummary(value) {
|
|
|
5882
5880
|
if (!isRecord(parameter))
|
|
5883
5881
|
return [];
|
|
5884
5882
|
const name = parameter.name;
|
|
5885
|
-
if (!
|
|
5883
|
+
if (!isString2(name) || name.length === 0)
|
|
5886
5884
|
return [];
|
|
5887
5885
|
const required = parameter.required === false ? "?" : "";
|
|
5888
5886
|
return [`${sanitizeSummaryField(name)}${required}`];
|
|
@@ -5891,7 +5889,7 @@ function sdkParameterSummary(value) {
|
|
|
5891
5889
|
function schemaRequiredSummary(value) {
|
|
5892
5890
|
if (!isRecord(value) || !Array.isArray(value.required))
|
|
5893
5891
|
return "";
|
|
5894
|
-
return value.required.filter((item) =>
|
|
5892
|
+
return value.required.filter((item) => isString2(item)).map(sanitizeSummaryField).join(", ");
|
|
5895
5893
|
}
|
|
5896
5894
|
function primitiveSummary(value) {
|
|
5897
5895
|
if (value === null)
|
|
@@ -5908,7 +5906,7 @@ function repositorySummary(record) {
|
|
|
5908
5906
|
}
|
|
5909
5907
|
function stringField(record, key) {
|
|
5910
5908
|
const value = record[key];
|
|
5911
|
-
return
|
|
5909
|
+
return isString2(value) ? sanitizeSummaryField(value) : "";
|
|
5912
5910
|
}
|
|
5913
5911
|
function sanitizeSummaryField(value) {
|
|
5914
5912
|
const singleLine = value.replace(/[\p{C}\s]+/gu, " ").trim();
|
|
@@ -5966,11 +5964,11 @@ function createCodeModeHost(options) {
|
|
|
5966
5964
|
return describeOperation(descriptors, args);
|
|
5967
5965
|
if (operationName === "__kitman_docs_search")
|
|
5968
5966
|
return searchDocs2({
|
|
5969
|
-
query:
|
|
5970
|
-
limit:
|
|
5967
|
+
query: isString2(args.query) ? args.query : "",
|
|
5968
|
+
limit: isNumber2(args.limit) ? args.limit : undefined
|
|
5971
5969
|
});
|
|
5972
5970
|
if (operationName === "__kitman_docs_read")
|
|
5973
|
-
return readDoc2({ path:
|
|
5971
|
+
return readDoc2({ path: isString2(args.path) ? args.path : "" });
|
|
5974
5972
|
const prepared = yield* result(prepareArgs(operationName, args));
|
|
5975
5973
|
if (isFailure(prepared))
|
|
5976
5974
|
return { ok: false, error: safeToolError(prepared.failure) };
|
|
@@ -5994,11 +5992,11 @@ function createCodeModeHost(options) {
|
|
|
5994
5992
|
const pause = yield* result(options.onApprovalRequired(request));
|
|
5995
5993
|
if (isFailure(pause))
|
|
5996
5994
|
return { ok: false, error: safeToolError(pause.failure) };
|
|
5997
|
-
const executionId =
|
|
5995
|
+
const executionId = isString2(pause.success) ? pause.success : pause.success.executionId;
|
|
5998
5996
|
return {
|
|
5999
5997
|
__kitmanPaused: true,
|
|
6000
5998
|
__kitmanPauseToken: pauseToken,
|
|
6001
|
-
...
|
|
5999
|
+
...isString2(pause.success) ? undefined : pause.success,
|
|
6002
6000
|
status: "waiting_for_interaction",
|
|
6003
6001
|
executionId,
|
|
6004
6002
|
interaction: {
|
|
@@ -6031,8 +6029,8 @@ function createCodeModeHost(options) {
|
|
|
6031
6029
|
};
|
|
6032
6030
|
}
|
|
6033
6031
|
function describeOperation(descriptors, args) {
|
|
6034
|
-
const name =
|
|
6035
|
-
const path =
|
|
6032
|
+
const name = isString2(args.name) ? args.name : undefined;
|
|
6033
|
+
const path = isString2(args.path) ? args.path : Array.isArray(args.path) && args.path.every(isString2) ? args.path.join(".") : undefined;
|
|
6036
6034
|
const operation = [...descriptors.values()].find((candidate) => candidate.name === name || candidate.namespacePath.join(".") === path);
|
|
6037
6035
|
if (operation !== undefined) {
|
|
6038
6036
|
const described = { ...operation, path: operation.namespacePath.join("."), operationName: operation.name };
|
|
@@ -6079,18 +6077,18 @@ function declaredTypes(schema) {
|
|
|
6079
6077
|
return declared.filter(isJsonType);
|
|
6080
6078
|
}
|
|
6081
6079
|
function isJsonType(value) {
|
|
6082
|
-
return
|
|
6080
|
+
return isString2(value) && isKeyOf(jsonTypeNames, value);
|
|
6083
6081
|
}
|
|
6084
6082
|
function matchesType(type, value) {
|
|
6085
6083
|
switch (type) {
|
|
6086
6084
|
case "string":
|
|
6087
|
-
return
|
|
6085
|
+
return isString2(value);
|
|
6088
6086
|
case "number":
|
|
6089
|
-
return
|
|
6087
|
+
return isNumber2(value);
|
|
6090
6088
|
case "integer":
|
|
6091
6089
|
return Number.isInteger(value);
|
|
6092
6090
|
case "boolean":
|
|
6093
|
-
return
|
|
6091
|
+
return isBoolean2(value);
|
|
6094
6092
|
case "array":
|
|
6095
6093
|
return Array.isArray(value);
|
|
6096
6094
|
case "object":
|
|
@@ -6106,7 +6104,7 @@ function validateArraySchemaValue(operationName, path, schema, value) {
|
|
|
6106
6104
|
function validateObjectSchemaValue(operationName, path, schema, value) {
|
|
6107
6105
|
const required = Array.isArray(schema.required) ? schema.required : [];
|
|
6108
6106
|
for (const key of required) {
|
|
6109
|
-
if (
|
|
6107
|
+
if (isString2(key) && value[key] === undefined)
|
|
6110
6108
|
throw new Error(`${operationName} ${path} is missing required field ${key}.`);
|
|
6111
6109
|
}
|
|
6112
6110
|
for (const [field, needed] of dependentRequiredFields(schema)) {
|
|
@@ -6163,9 +6161,9 @@ function summarizeArgs(args) {
|
|
|
6163
6161
|
return Object.fromEntries(Object.entries(args).map(([key, value]) => [key, summarizeValue(value)]));
|
|
6164
6162
|
}
|
|
6165
6163
|
function summarizeValue(value) {
|
|
6166
|
-
if (
|
|
6164
|
+
if (isString2(value))
|
|
6167
6165
|
return value.length > 120 ? `${value.slice(0, 119)}\u2026` : value;
|
|
6168
|
-
if (
|
|
6166
|
+
if (isNumber2(value) || isBoolean2(value) || value === null)
|
|
6169
6167
|
return value;
|
|
6170
6168
|
if (Array.isArray(value))
|
|
6171
6169
|
return `[${value.length} items]`;
|
|
@@ -6192,7 +6190,7 @@ function sanitizeErrorMessage2(value) {
|
|
|
6192
6190
|
return value.replace(/https?:\/\/[^\s?]+\?[^\s]+/gu, (url) => `${url.slice(0, url.indexOf("?"))}?<redacted>`).replace(/(bearer\s+)[^\s]+/giu, "$1<redacted>").replace(/((?:token|secret|private[_-]?key)\s*[=:]\s*)[^\s,;]+/giu, "$1<redacted>").replace(/[\p{C}\s]+/gu, " ").trim();
|
|
6193
6191
|
}
|
|
6194
6192
|
function isRecord2(value) {
|
|
6195
|
-
return
|
|
6193
|
+
return isObject2(value) && value !== null && !Array.isArray(value);
|
|
6196
6194
|
}
|
|
6197
6195
|
function resourceIds(value) {
|
|
6198
6196
|
const ids = new Set;
|
|
@@ -6206,7 +6204,7 @@ function resourceIds(value) {
|
|
|
6206
6204
|
return;
|
|
6207
6205
|
for (const key of ["id", "workspaceId", "teamId", "taskId", "sessionId", "contextPackId", "agentRunId"]) {
|
|
6208
6206
|
const value = item[key];
|
|
6209
|
-
if (
|
|
6207
|
+
if (isString2(value) && value.length > 0)
|
|
6210
6208
|
ids.add(`${key}:${value}`);
|
|
6211
6209
|
}
|
|
6212
6210
|
for (const child of Object.values(item))
|
|
@@ -6307,7 +6305,7 @@ function createCodeModeExecutionStore(options = {}) {
|
|
|
6307
6305
|
}
|
|
6308
6306
|
while (entries.size > maxEntries) {
|
|
6309
6307
|
const executionId = entries.keys().next().value;
|
|
6310
|
-
if (!
|
|
6308
|
+
if (!isString2(executionId))
|
|
6311
6309
|
break;
|
|
6312
6310
|
const entry = entries.get(executionId);
|
|
6313
6311
|
if (entry !== undefined && (entry.status === "paused" || entry.status === "resuming"))
|
|
@@ -6501,17 +6499,17 @@ function safeArgumentSummary(args) {
|
|
|
6501
6499
|
]));
|
|
6502
6500
|
}
|
|
6503
6501
|
function safeArgumentValue(value) {
|
|
6504
|
-
if (
|
|
6502
|
+
if (isString2(value))
|
|
6505
6503
|
return value.length > 120 ? `${value.slice(0, 119)}\u2026` : value;
|
|
6506
|
-
if (
|
|
6504
|
+
if (isNumber2(value))
|
|
6507
6505
|
return Number(value);
|
|
6508
|
-
if (
|
|
6506
|
+
if (isBoolean2(value))
|
|
6509
6507
|
return Boolean(value);
|
|
6510
6508
|
if (value === null)
|
|
6511
6509
|
return null;
|
|
6512
6510
|
if (Array.isArray(value))
|
|
6513
6511
|
return `[${value.length} items]`;
|
|
6514
|
-
if (
|
|
6512
|
+
if (isObject2(value) && value !== null)
|
|
6515
6513
|
return `{${Object.keys(value).slice(0, 5).join(", ")}}`;
|
|
6516
6514
|
return kindOf(value);
|
|
6517
6515
|
}
|
|
@@ -6636,11 +6634,11 @@ var waitRun = (waitOnce, input, context) => gen(function* () {
|
|
|
6636
6634
|
});
|
|
6637
6635
|
var waitInput = (args) => gen(function* () {
|
|
6638
6636
|
const { run, until = "attention", timeoutSeconds } = args;
|
|
6639
|
-
if (!
|
|
6637
|
+
if (!isString2(run) || run.length === 0)
|
|
6640
6638
|
return yield* new McpToolInputError({ message: "run is required." });
|
|
6641
6639
|
if (!isOneOf(RunWaitUntils, until))
|
|
6642
6640
|
return yield* new McpToolInputError({ message: `until must be ${RunWaitUntils.join(" or ")}.` });
|
|
6643
|
-
if (timeoutSeconds !== undefined && (!
|
|
6641
|
+
if (timeoutSeconds !== undefined && (!isNumber2(timeoutSeconds) || timeoutSeconds < 0))
|
|
6644
6642
|
return yield* new McpToolInputError({ message: "timeoutSeconds must be a number of seconds, 0 or more." });
|
|
6645
6643
|
return {
|
|
6646
6644
|
runId: run,
|
|
@@ -6651,7 +6649,7 @@ var waitInput = (args) => gen(function* () {
|
|
|
6651
6649
|
var reasonOf = (waited) => isJsonObject(waited) ? waited.reason : undefined;
|
|
6652
6650
|
var runStatusOf = (waited) => {
|
|
6653
6651
|
const run = isJsonObject(waited) ? waited.run : undefined;
|
|
6654
|
-
return isJsonObject(run) &&
|
|
6652
|
+
return isJsonObject(run) && isString2(run.status) ? run.status : "still running";
|
|
6655
6653
|
};
|
|
6656
6654
|
|
|
6657
6655
|
// apps/mcp/src/code-mode.ts
|
|
@@ -6696,7 +6694,7 @@ function registerCodeModeTools(server, options = {}) {
|
|
|
6696
6694
|
const dispatchOperation = options.dispatchOperation;
|
|
6697
6695
|
const operations = options.operations ?? publicOperationDescriptors;
|
|
6698
6696
|
const executionStore = options.executionStore ?? createCodeModeExecutionStore();
|
|
6699
|
-
const resolveExecutionOwner = () =>
|
|
6697
|
+
const resolveExecutionOwner = () => isFunction2(options.executionOwner) ? options.executionOwner() : options.executionOwner ?? { sessionId: "local-process", actorDigest: "local-process" };
|
|
6700
6698
|
const pauseToken = runSync(newExecutionId);
|
|
6701
6699
|
const runCode = (input) => gen(function* () {
|
|
6702
6700
|
const dispatcher = dispatchOperation ?? executeCapability;
|
|
@@ -6920,19 +6918,19 @@ function codeModeSafeError(error) {
|
|
|
6920
6918
|
}
|
|
6921
6919
|
function stringArg(args, key) {
|
|
6922
6920
|
const value = args[key];
|
|
6923
|
-
return
|
|
6921
|
+
return isString2(value) && value.length > 0 ? succeed6(value) : fail7(new McpToolInputError({ message: `${key} is required.` }));
|
|
6924
6922
|
}
|
|
6925
6923
|
function optionalStringArg(args, key) {
|
|
6926
6924
|
const value = args[key];
|
|
6927
6925
|
if (value === undefined)
|
|
6928
6926
|
return undefined_;
|
|
6929
|
-
return
|
|
6927
|
+
return isString2(value) && value.length > 0 ? succeed6(value) : fail7(new McpToolInputError({ message: `${key} must be a non-empty string.` }));
|
|
6930
6928
|
}
|
|
6931
6929
|
function optionalBooleanArg(args, key) {
|
|
6932
6930
|
const value = args[key];
|
|
6933
6931
|
if (value === undefined)
|
|
6934
6932
|
return succeed6(false);
|
|
6935
|
-
return
|
|
6933
|
+
return isBoolean2(value) ? succeed6(value) : fail7(new McpToolInputError({ message: `${key} must be a boolean.` }));
|
|
6936
6934
|
}
|
|
6937
6935
|
function optionalResumeAction(args) {
|
|
6938
6936
|
const value = args.action;
|
|
@@ -7000,7 +6998,7 @@ function fieldLabel(field) {
|
|
|
7000
6998
|
}
|
|
7001
6999
|
function topLevelNamespaces(operations) {
|
|
7002
7000
|
return [
|
|
7003
|
-
...new Set(operations.flatMap((operation) =>
|
|
7001
|
+
...new Set(operations.flatMap((operation) => isString2(operation.namespacePath[0]) ? [operation.namespacePath[0]] : []))
|
|
7004
7002
|
].sort();
|
|
7005
7003
|
}
|
|
7006
7004
|
var newExecutionId = gen(function* () {
|
|
@@ -7015,11 +7013,11 @@ function summarizeArgs2(args) {
|
|
|
7015
7013
|
return Object.fromEntries(Object.entries(args).map(([key, value]) => [key, sensitiveArgumentKey2(key) ? "<redacted>" : summarizeValue2(value)]));
|
|
7016
7014
|
}
|
|
7017
7015
|
function summarizeValue2(value) {
|
|
7018
|
-
if (
|
|
7016
|
+
if (isString2(value))
|
|
7019
7017
|
return value.length > 120 ? `${value.slice(0, 119)}\u2026` : value;
|
|
7020
|
-
if (
|
|
7018
|
+
if (isNumber2(value))
|
|
7021
7019
|
return Number(value);
|
|
7022
|
-
if (
|
|
7020
|
+
if (isBoolean2(value))
|
|
7023
7021
|
return Boolean(value);
|
|
7024
7022
|
if (value === null)
|
|
7025
7023
|
return null;
|
|
@@ -7032,10 +7030,10 @@ function summarizeValue2(value) {
|
|
|
7032
7030
|
function approvalDetails(operationName, args) {
|
|
7033
7031
|
if (operationName !== "updateWorkspace")
|
|
7034
7032
|
return;
|
|
7035
|
-
const workspaceId =
|
|
7033
|
+
const workspaceId = isString2(args.workspaceId) && args.workspaceId.length > 0 ? args.workspaceId : undefined;
|
|
7036
7034
|
const input = isRecord3(args.input) ? args.input : undefined;
|
|
7037
|
-
const newName =
|
|
7038
|
-
const newSlug =
|
|
7035
|
+
const newName = isString2(input?.name) && input.name.length > 0 ? input.name : undefined;
|
|
7036
|
+
const newSlug = isString2(input?.slug) && input.slug.length > 0 ? input.slug : undefined;
|
|
7039
7037
|
if (workspaceId === undefined && newName === undefined && newSlug === undefined)
|
|
7040
7038
|
return;
|
|
7041
7039
|
return {
|
|
@@ -7048,19 +7046,19 @@ function sensitiveArgumentKey2(key) {
|
|
|
7048
7046
|
return /(?:password|token|secret|private[_-]?key|api[_-]?key|authorization|cookie|credential|url|uri)/iu.test(key);
|
|
7049
7047
|
}
|
|
7050
7048
|
function isPausedExecution(value, pauseToken) {
|
|
7051
|
-
return isRecord3(value) && value.__kitmanPaused === true && value.__kitmanPauseToken === pauseToken && value.status === "waiting_for_interaction" &&
|
|
7049
|
+
return isRecord3(value) && value.__kitmanPaused === true && value.__kitmanPauseToken === pauseToken && value.status === "waiting_for_interaction" && isString2(value.executionId);
|
|
7052
7050
|
}
|
|
7053
7051
|
function publicPauseValue(value) {
|
|
7054
7052
|
const { __kitmanPaused: _paused, __kitmanPauseToken: _token, ...publicValue } = value;
|
|
7055
7053
|
return publicValue;
|
|
7056
7054
|
}
|
|
7057
7055
|
function isRecord3(value) {
|
|
7058
|
-
return
|
|
7056
|
+
return isObject2(value) && value !== null && !Array.isArray(value);
|
|
7059
7057
|
}
|
|
7060
7058
|
|
|
7061
7059
|
// packages/sdk/src/namespaces.generated.ts
|
|
7062
7060
|
function isNamespaceNode(value) {
|
|
7063
|
-
return
|
|
7061
|
+
return isObject2(value) && value !== null && !isFunction2(value);
|
|
7064
7062
|
}
|
|
7065
7063
|
function assertCompleteNamespaces(node) {
|
|
7066
7064
|
for (const descriptor of publicOperationDescriptors) {
|
|
@@ -7073,7 +7071,7 @@ function assertCompleteNamespaces(node) {
|
|
|
7073
7071
|
throw new Error(`SDK namespace is missing ${descriptor.namespacePath.join(".")}`);
|
|
7074
7072
|
current = child;
|
|
7075
7073
|
}
|
|
7076
|
-
if (!
|
|
7074
|
+
if (!isFunction2(current))
|
|
7077
7075
|
throw new Error(`SDK namespace leaf is invalid at ${descriptor.namespacePath.join(".")}`);
|
|
7078
7076
|
}
|
|
7079
7077
|
}
|
|
@@ -7095,12 +7093,12 @@ function createKitmanSdkNamespaces(client) {
|
|
|
7095
7093
|
node = nextNode;
|
|
7096
7094
|
continue;
|
|
7097
7095
|
}
|
|
7098
|
-
if (
|
|
7096
|
+
if (isFunction2(child))
|
|
7099
7097
|
throw new Error(`SDK namespace conflict at ${segment}`);
|
|
7100
7098
|
node = child;
|
|
7101
7099
|
}
|
|
7102
7100
|
const method = Reflect.get(client, descriptor.name);
|
|
7103
|
-
if (!
|
|
7101
|
+
if (!isFunction2(method))
|
|
7104
7102
|
throw new Error(`SDK operation ${descriptor.name} has no client method`);
|
|
7105
7103
|
node[leaf] = method.bind(client);
|
|
7106
7104
|
}
|
|
@@ -8111,7 +8109,7 @@ function sdkParameters(descriptor, args) {
|
|
|
8111
8109
|
}
|
|
8112
8110
|
function methodValue(client, methodName) {
|
|
8113
8111
|
const value = Object.getOwnPropertyDescriptor(client, methodName)?.value ?? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(client), methodName)?.value;
|
|
8114
|
-
return
|
|
8112
|
+
return isFunction2(value) ? value : undefined;
|
|
8115
8113
|
}
|
|
8116
8114
|
|
|
8117
8115
|
// apps/mcp/src/step-tools.ts
|
|
@@ -8202,22 +8200,22 @@ var AskArguments = {
|
|
|
8202
8200
|
};
|
|
8203
8201
|
var askBody = (args) => {
|
|
8204
8202
|
const options = Array.isArray(args.options) ? args.options.flatMap((option) => {
|
|
8205
|
-
if (
|
|
8203
|
+
if (isString2(option))
|
|
8206
8204
|
return [option];
|
|
8207
8205
|
if (!isJsonObject(option))
|
|
8208
8206
|
return [];
|
|
8209
8207
|
const entry = option;
|
|
8210
|
-
if (!
|
|
8208
|
+
if (!isString2(entry.value))
|
|
8211
8209
|
return [];
|
|
8212
8210
|
return [
|
|
8213
|
-
|
|
8211
|
+
isString2(entry.description) ? { value: entry.value, description: entry.description } : { value: entry.value }
|
|
8214
8212
|
];
|
|
8215
8213
|
}) : undefined;
|
|
8216
8214
|
return {
|
|
8217
|
-
prompt:
|
|
8215
|
+
prompt: isString2(args.prompt) ? args.prompt : "",
|
|
8218
8216
|
...options === undefined ? undefined : { options },
|
|
8219
|
-
...
|
|
8220
|
-
...
|
|
8217
|
+
...isString2(args.recommended) ? { recommended: args.recommended } : undefined,
|
|
8218
|
+
...isString2(args.recommendationReason) ? { recommendationReason: args.recommendationReason } : undefined,
|
|
8221
8219
|
...args.informationOnly === true ? { informationOnly: true } : undefined
|
|
8222
8220
|
};
|
|
8223
8221
|
};
|
|
@@ -8272,7 +8270,7 @@ function registerStepTools(server, adapt, input) {
|
|
|
8272
8270
|
description: "Read the brief for the Step you are working on: its instructions, Context Pack and Output schema. A long brief comes in pages; each names the offset of the next.",
|
|
8273
8271
|
inputSchema: adapt(StepBriefArguments),
|
|
8274
8272
|
annotations: { readOnlyHint: true, idempotentHint: true }
|
|
8275
|
-
}, (args) => run(map8(request("/brief"), (brief) => text(briefPage(brief.prompt,
|
|
8273
|
+
}, (args) => run(map8(request("/brief"), (brief) => text(briefPage(brief.prompt, isNumber2(args.offset) ? args.offset : 0)))));
|
|
8276
8274
|
const closed = (question) => gen(function* () {
|
|
8277
8275
|
let current = question;
|
|
8278
8276
|
const interval = fromInputUnsafe(input.answerPollInterval ?? "2 seconds");
|
|
@@ -8321,8 +8319,8 @@ function registerStepTools(server, adapt, input) {
|
|
|
8321
8319
|
outputSchema: adapt(AnyResult),
|
|
8322
8320
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
|
|
8323
8321
|
}, (args) => run(map8(request("/session-updates", {
|
|
8324
|
-
kind:
|
|
8325
|
-
content:
|
|
8322
|
+
kind: isString2(args.kind) ? args.kind : "progress",
|
|
8323
|
+
content: isString2(args.content) ? args.content : ""
|
|
8326
8324
|
}), (result) => ({ content: [{ type: "text", text: "SessionUpdate recorded." }], structuredContent: result }))));
|
|
8327
8325
|
const answerOf = (question) => map8(closed(question), (current) => current.answer === undefined ? failure(`The Question was closed without an answer (${current.status}). Stop and submit what you have.`) : {
|
|
8328
8326
|
content: [
|
|
@@ -8356,7 +8354,7 @@ function registerStepTools(server, adapt, input) {
|
|
|
8356
8354
|
inputSchema: adapt(SkillsArguments),
|
|
8357
8355
|
annotations: { readOnlyHint: true, idempotentHint: false }
|
|
8358
8356
|
}, (args) => runMcpEffect(map8(loadable, (skills) => {
|
|
8359
|
-
const name =
|
|
8357
|
+
const name = isString2(args.name) ? args.name : undefined;
|
|
8360
8358
|
if (name === undefined)
|
|
8361
8359
|
return skills.length === 0 ? text("This Step has no skills to load.") : text(skills.map((found) => `- ${found.name}: ${skillDescription(found.skill)}`).join(`
|
|
8362
8360
|
`));
|
|
@@ -8408,8 +8406,8 @@ The skill's directory, for the files it points to: ${skillsDir}/${name}`);
|
|
|
8408
8406
|
return yield* bodyOf(response);
|
|
8409
8407
|
const body = yield* promise(() => response.json().catch(() => ({})));
|
|
8410
8408
|
const refused = isJsonObject(body) && isJsonObject(body.error) ? body.error : {};
|
|
8411
|
-
const code =
|
|
8412
|
-
const message =
|
|
8409
|
+
const code = isString2(refused.code) ? refused.code : "";
|
|
8410
|
+
const message = isString2(refused.message) ? refused.message : "";
|
|
8413
8411
|
return yield* new StepToolRequestError({
|
|
8414
8412
|
message: `Kitman did not keep ${name} (${code.replace(/^run_file_/, "")}): ${message}`
|
|
8415
8413
|
});
|
|
@@ -8425,7 +8423,7 @@ The skill's directory, for the files it points to: ${skillsDir}/${name}`);
|
|
|
8425
8423
|
outputSchema: adapt(AnyResult),
|
|
8426
8424
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true }
|
|
8427
8425
|
}, (args) => run(gen(function* () {
|
|
8428
|
-
const path =
|
|
8426
|
+
const path = isString2(args.path) ? args.path : "";
|
|
8429
8427
|
const real = yield* attachable(path);
|
|
8430
8428
|
const fs = yield* FileSystem;
|
|
8431
8429
|
const name = (yield* Path).basename(real);
|
|
@@ -8434,7 +8432,7 @@ The skill's directory, for the files it points to: ${skillsDir}/${name}`);
|
|
|
8434
8432
|
yield* runForEach(fs.stream(real), (chunk) => sync2(() => hash.update(chunk))).pipe(mapError2(unreadable(path)));
|
|
8435
8433
|
const slotted = yield* slot(name, {
|
|
8436
8434
|
name,
|
|
8437
|
-
...
|
|
8435
|
+
...isString2(args.caption) ? { caption: args.caption } : undefined,
|
|
8438
8436
|
contentType: runFileContentType(name),
|
|
8439
8437
|
byteSize,
|
|
8440
8438
|
sha256: hash.digest("hex")
|
|
@@ -8633,7 +8631,7 @@ var withCodeModeTeamDefaults = fnUntraced(function* (operationName, args, sessio
|
|
|
8633
8631
|
return yield* ambiguousTeamContextError(context);
|
|
8634
8632
|
return withWorkspace;
|
|
8635
8633
|
});
|
|
8636
|
-
var hasText = (value) =>
|
|
8634
|
+
var hasText = (value) => isString2(value) && value.length > 0;
|
|
8637
8635
|
function operationUses(operationName, parameterName) {
|
|
8638
8636
|
const descriptor = publicOperationDescriptorByName.get(operationName);
|
|
8639
8637
|
return descriptor?.sdk.parameters.some((parameter) => parameter.name === parameterName) === true;
|
|
@@ -8642,7 +8640,7 @@ function contextWorkspaceId(context) {
|
|
|
8642
8640
|
if (!isJsonObject(context))
|
|
8643
8641
|
return;
|
|
8644
8642
|
const { workspaceId } = context;
|
|
8645
|
-
return
|
|
8643
|
+
return isString2(workspaceId) && workspaceId.length > 0 ? workspaceId : undefined;
|
|
8646
8644
|
}
|
|
8647
8645
|
function ambiguousTeamContextError(context) {
|
|
8648
8646
|
const candidates = teamContextCandidates(context);
|
|
@@ -8662,16 +8660,16 @@ function teamContextCandidates(context) {
|
|
|
8662
8660
|
if (!isJsonObject(candidate))
|
|
8663
8661
|
return [];
|
|
8664
8662
|
const { id, name } = candidate;
|
|
8665
|
-
if (!
|
|
8663
|
+
if (!isString2(id) || id.length === 0)
|
|
8666
8664
|
return [];
|
|
8667
|
-
return
|
|
8665
|
+
return isString2(name) && name.length > 0 ? [`${name} (${id})`] : [id];
|
|
8668
8666
|
});
|
|
8669
8667
|
}
|
|
8670
8668
|
var persistSelectedTeamContext = fnUntraced(function* (cwd, args) {
|
|
8671
8669
|
const fs = yield* FileSystem;
|
|
8672
8670
|
const path = yield* Path;
|
|
8673
|
-
const teamId =
|
|
8674
|
-
const workspaceId =
|
|
8671
|
+
const teamId = isString2(args.teamId) && args.teamId.length > 0 ? args.teamId : undefined;
|
|
8672
|
+
const workspaceId = isString2(args.workspaceId) && args.workspaceId.length > 0 ? args.workspaceId : undefined;
|
|
8675
8673
|
if (teamId === undefined)
|
|
8676
8674
|
return yield* new McpToolInputError({ message: "useTeamContext requires teamId." });
|
|
8677
8675
|
if (cwd === undefined)
|
|
@@ -8714,7 +8712,7 @@ function teamIdsFrom(...values) {
|
|
|
8714
8712
|
if (!isJsonObject(value))
|
|
8715
8713
|
return;
|
|
8716
8714
|
const teamId = value.teamId;
|
|
8717
|
-
if (
|
|
8715
|
+
if (isString2(teamId) && teamId.length > 0)
|
|
8718
8716
|
teamIds.add(teamId);
|
|
8719
8717
|
for (const item of Object.values(value))
|
|
8720
8718
|
visit(item);
|
|
@@ -8727,8 +8725,8 @@ var withTeamContextResolverDefaults = fnUntraced(function* (args, workspaceId, t
|
|
|
8727
8725
|
const identity = yield* gitRemoteIdentityForCwd(cwd);
|
|
8728
8726
|
return {
|
|
8729
8727
|
...args,
|
|
8730
|
-
...
|
|
8731
|
-
...
|
|
8728
|
+
...isString2(args.workspaceId) && args.workspaceId.length > 0 || workspaceId === undefined ? undefined : { workspaceId },
|
|
8729
|
+
...isString2(args.teamId) && args.teamId.length > 0 || teamId === undefined ? undefined : { teamId },
|
|
8732
8730
|
...identity === undefined || isJsonObject(args.repoIdentity) ? undefined : { repoIdentity: identity }
|
|
8733
8731
|
};
|
|
8734
8732
|
});
|
|
@@ -8832,7 +8830,7 @@ function preferredTeamId(value) {
|
|
|
8832
8830
|
if (!isJsonObject(value))
|
|
8833
8831
|
return;
|
|
8834
8832
|
const { preferredTeamId: teamId } = value;
|
|
8835
|
-
return
|
|
8833
|
+
return isString2(teamId) && teamId.length > 0 ? teamId : undefined;
|
|
8836
8834
|
}
|
|
8837
8835
|
|
|
8838
8836
|
// apps/mcp/src/config.ts
|
|
@@ -8944,7 +8942,7 @@ function parseJwk(value) {
|
|
|
8944
8942
|
return;
|
|
8945
8943
|
const jwk = {};
|
|
8946
8944
|
for (const [key, item] of Object.entries(record)) {
|
|
8947
|
-
if (
|
|
8945
|
+
if (isString2(item) || isBoolean2(item) || isStringArray(item))
|
|
8948
8946
|
jwk[key] = item;
|
|
8949
8947
|
}
|
|
8950
8948
|
return Object.keys(jwk).length > 0 ? jwk : undefined;
|
|
@@ -8956,13 +8954,13 @@ function jsonObject(value) {
|
|
|
8956
8954
|
return isJsonObject(value) ? value : undefined;
|
|
8957
8955
|
}
|
|
8958
8956
|
function stringValue(value) {
|
|
8959
|
-
return
|
|
8957
|
+
return isString2(value) && value.length > 0 ? value : undefined;
|
|
8960
8958
|
}
|
|
8961
8959
|
function optionalStringValue(value) {
|
|
8962
8960
|
return value === undefined ? undefined : stringValue(value);
|
|
8963
8961
|
}
|
|
8964
8962
|
function isStringArray(value) {
|
|
8965
|
-
return Array.isArray(value) && value.every((item) =>
|
|
8963
|
+
return Array.isArray(value) && value.every((item) => isString2(item));
|
|
8966
8964
|
}
|
|
8967
8965
|
// apps/mcp/src/http.ts
|
|
8968
8966
|
import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/server";
|