@foldkit/devtools-mcp 0.18.0 → 0.19.0-canary.26614ae9952e
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/server.js +175 -183
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +17 -17
- package/package.json +4 -3
package/dist/server.js
CHANGED
|
@@ -1524,8 +1524,8 @@ var require_dataType = __commonJS({
|
|
|
1524
1524
|
return types;
|
|
1525
1525
|
}
|
|
1526
1526
|
exports.getSchemaTypes = getSchemaTypes;
|
|
1527
|
-
function getJSONTypes(
|
|
1528
|
-
const types = Array.isArray(
|
|
1527
|
+
function getJSONTypes(ts) {
|
|
1528
|
+
const types = Array.isArray(ts) ? ts : ts ? [ts] : [];
|
|
1529
1529
|
if (types.every(rules_1.isJSONType))
|
|
1530
1530
|
return types;
|
|
1531
1531
|
throw new Error("type must be JSONType or JSONType[]: " + types.join(","));
|
|
@@ -2567,18 +2567,18 @@ var require_validate = __commonJS({
|
|
|
2567
2567
|
});
|
|
2568
2568
|
narrowSchemaTypes(it, types);
|
|
2569
2569
|
}
|
|
2570
|
-
function checkMultipleTypes(it,
|
|
2571
|
-
if (
|
|
2570
|
+
function checkMultipleTypes(it, ts) {
|
|
2571
|
+
if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
|
|
2572
2572
|
strictTypesError(it, "use allowUnionTypes to allow union type keyword");
|
|
2573
2573
|
}
|
|
2574
2574
|
}
|
|
2575
|
-
function checkKeywordTypes(it,
|
|
2575
|
+
function checkKeywordTypes(it, ts) {
|
|
2576
2576
|
const rules = it.self.RULES.all;
|
|
2577
2577
|
for (const keyword in rules) {
|
|
2578
2578
|
const rule = rules[keyword];
|
|
2579
2579
|
if (typeof rule == "object" && (0, applicability_1.shouldUseRule)(it.schema, rule)) {
|
|
2580
2580
|
const { type: type3 } = rule.definition;
|
|
2581
|
-
if (type3.length && !type3.some((t) => hasApplicableType(
|
|
2581
|
+
if (type3.length && !type3.some((t) => hasApplicableType(ts, t))) {
|
|
2582
2582
|
strictTypesError(it, `missing type "${type3.join(",")}" for keyword "${keyword}"`);
|
|
2583
2583
|
}
|
|
2584
2584
|
}
|
|
@@ -2587,18 +2587,18 @@ var require_validate = __commonJS({
|
|
|
2587
2587
|
function hasApplicableType(schTs, kwdT) {
|
|
2588
2588
|
return schTs.includes(kwdT) || kwdT === "number" && schTs.includes("integer");
|
|
2589
2589
|
}
|
|
2590
|
-
function includesType(
|
|
2591
|
-
return
|
|
2590
|
+
function includesType(ts, t) {
|
|
2591
|
+
return ts.includes(t) || t === "integer" && ts.includes("number");
|
|
2592
2592
|
}
|
|
2593
2593
|
function narrowSchemaTypes(it, withTypes) {
|
|
2594
|
-
const
|
|
2594
|
+
const ts = [];
|
|
2595
2595
|
for (const t of it.dataTypes) {
|
|
2596
2596
|
if (includesType(withTypes, t))
|
|
2597
|
-
|
|
2597
|
+
ts.push(t);
|
|
2598
2598
|
else if (withTypes.includes("integer") && t === "number")
|
|
2599
|
-
|
|
2599
|
+
ts.push("integer");
|
|
2600
2600
|
}
|
|
2601
|
-
it.dataTypes =
|
|
2601
|
+
it.dataTypes = ts;
|
|
2602
2602
|
}
|
|
2603
2603
|
function strictTypesError(it, msg) {
|
|
2604
2604
|
const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
|
|
@@ -46912,8 +46912,58 @@ var makeCallable = (tag4, fields) => {
|
|
|
46912
46912
|
}
|
|
46913
46913
|
});
|
|
46914
46914
|
};
|
|
46915
|
-
|
|
46916
|
-
|
|
46915
|
+
var reservedUnionPropertyNames = /* @__PURE__ */ new Set(["members", "subset"]);
|
|
46916
|
+
var taggedUnionTypeOnlyPropertyNames = /* @__PURE__ */ new Set([
|
|
46917
|
+
"Rebuild",
|
|
46918
|
+
"~type.parameters",
|
|
46919
|
+
"Type",
|
|
46920
|
+
"Encoded",
|
|
46921
|
+
"DecodingServices",
|
|
46922
|
+
"EncodingServices",
|
|
46923
|
+
"~type.make.in",
|
|
46924
|
+
"~type.make",
|
|
46925
|
+
"~type.constructor.default",
|
|
46926
|
+
"Iso",
|
|
46927
|
+
"~type.mutability",
|
|
46928
|
+
"~type.optionality",
|
|
46929
|
+
"~encoded.mutability",
|
|
46930
|
+
"~encoded.optionality"
|
|
46931
|
+
]);
|
|
46932
|
+
var defineUnion = (variantLabel, casesByTag) => {
|
|
46933
|
+
const union7 = Schema_exports.TaggedUnion(casesByTag);
|
|
46934
|
+
const conflictingNames = Array_exports.filter(
|
|
46935
|
+
Object.keys(casesByTag),
|
|
46936
|
+
(name) => Reflect.has(union7, name) || taggedUnionTypeOnlyPropertyNames.has(name) || reservedUnionPropertyNames.has(name)
|
|
46937
|
+
);
|
|
46938
|
+
if (Array_exports.isArrayNonEmpty(conflictingNames)) {
|
|
46939
|
+
throw new Error(
|
|
46940
|
+
`${variantLabel} names conflict with union properties: ${conflictingNames.join(", ")}`
|
|
46941
|
+
);
|
|
46942
|
+
}
|
|
46943
|
+
const callables = {};
|
|
46944
|
+
for (const [tag4, fields] of Object.entries(casesByTag)) {
|
|
46945
|
+
callables[tag4] = makeCallable(tag4, fields);
|
|
46946
|
+
}
|
|
46947
|
+
const subset = (tags3) => {
|
|
46948
|
+
const members = [];
|
|
46949
|
+
for (const tag4 of tags3) {
|
|
46950
|
+
const member = callables[tag4];
|
|
46951
|
+
if (!Object.hasOwn(callables, tag4) || member === void 0) {
|
|
46952
|
+
throw new Error(`Union subset contains an unknown variant: ${tag4}`);
|
|
46953
|
+
}
|
|
46954
|
+
members.push(member);
|
|
46955
|
+
}
|
|
46956
|
+
return Schema_exports.Union(members);
|
|
46957
|
+
};
|
|
46958
|
+
return Object.assign(union7, callables, {
|
|
46959
|
+
// NOTE: Schema.TaggedUnion does not expose the member list that Schema.Union
|
|
46960
|
+
// does. Machine.define uses that list to enumerate the state tags.
|
|
46961
|
+
members: Object.values(callables),
|
|
46962
|
+
subset
|
|
46963
|
+
});
|
|
46964
|
+
};
|
|
46965
|
+
function defineTaggedUnion(casesByTag) {
|
|
46966
|
+
return defineUnion("Variant", casesByTag);
|
|
46917
46967
|
}
|
|
46918
46968
|
|
|
46919
46969
|
// ../foldkit/src/devTools/protocol.ts
|
|
@@ -46947,118 +46997,58 @@ var RuntimeInfo = Schema_exports.Struct({
|
|
|
46947
46997
|
url: Schema_exports.String,
|
|
46948
46998
|
title: Schema_exports.String
|
|
46949
46999
|
});
|
|
46950
|
-
var RequestGetModel = ts("RequestGetModel", {
|
|
46951
|
-
maybePath: Schema_exports.OptionFromNullOr(Schema_exports.String),
|
|
46952
|
-
expand: Schema_exports.Boolean
|
|
46953
|
-
});
|
|
46954
|
-
var RequestGetModelAt = ts("RequestGetModelAt", {
|
|
46955
|
-
index: Schema_exports.Number,
|
|
46956
|
-
maybePath: Schema_exports.OptionFromNullOr(Schema_exports.String),
|
|
46957
|
-
expand: Schema_exports.Boolean
|
|
46958
|
-
});
|
|
46959
|
-
var RequestListMessages = ts("RequestListMessages", {
|
|
46960
|
-
limit: Schema_exports.Number,
|
|
46961
|
-
maybeSinceIndex: Schema_exports.OptionFromNullOr(Schema_exports.Number),
|
|
46962
|
-
maybeChangedPathsMatch: Schema_exports.OptionFromNullOr(Schema_exports.Array(Schema_exports.String)).pipe(
|
|
46963
|
-
Schema_exports.withDecodingDefault(Effect_exports.succeed(null))
|
|
46964
|
-
),
|
|
46965
|
-
fromEnd: Schema_exports.Boolean.pipe(Schema_exports.withDecodingDefault(Effect_exports.succeed(false)))
|
|
46966
|
-
});
|
|
46967
|
-
var RequestCountMessagesByTag = ts("RequestCountMessagesByTag", {
|
|
46968
|
-
maybeSinceIndex: Schema_exports.OptionFromNullOr(Schema_exports.Number),
|
|
46969
|
-
maybeChangedPathsMatch: Schema_exports.OptionFromNullOr(Schema_exports.Array(Schema_exports.String))
|
|
46970
|
-
});
|
|
46971
|
-
var RequestDiffModels = ts("RequestDiffModels", {
|
|
46972
|
-
fromIndex: Schema_exports.Number,
|
|
46973
|
-
toIndex: Schema_exports.Number,
|
|
46974
|
-
maybeChangedPathsMatch: Schema_exports.OptionFromNullOr(Schema_exports.Array(Schema_exports.String))
|
|
46975
|
-
});
|
|
46976
|
-
var RequestGetMessage = ts("RequestGetMessage", {
|
|
46977
|
-
index: Schema_exports.Number
|
|
46978
|
-
});
|
|
46979
|
-
var RequestListKeyframes = ts("RequestListKeyframes");
|
|
46980
|
-
var RequestReplayToKeyframe = ts("RequestReplayToKeyframe", {
|
|
46981
|
-
keyframeIndex: Schema_exports.Number
|
|
46982
|
-
});
|
|
46983
|
-
var RequestResume = ts("RequestResume");
|
|
46984
|
-
var RequestGetInit = ts("RequestGetInit");
|
|
46985
|
-
var RequestGetRuntimeState = ts("RequestGetRuntimeState");
|
|
46986
|
-
var RequestDispatchMessage = ts("RequestDispatchMessage", {
|
|
46987
|
-
message: Schema_exports.Unknown
|
|
46988
|
-
});
|
|
46989
47000
|
var MAX_DISPATCH_BATCH_SIZE = 100;
|
|
46990
|
-
var
|
|
46991
|
-
|
|
46992
|
-
|
|
46993
|
-
|
|
46994
|
-
|
|
46995
|
-
|
|
46996
|
-
|
|
46997
|
-
|
|
46998
|
-
|
|
46999
|
-
|
|
47000
|
-
RequestListMessages
|
|
47001
|
-
|
|
47002
|
-
|
|
47003
|
-
|
|
47004
|
-
|
|
47005
|
-
|
|
47006
|
-
|
|
47007
|
-
|
|
47008
|
-
|
|
47009
|
-
|
|
47010
|
-
|
|
47011
|
-
|
|
47012
|
-
|
|
47013
|
-
|
|
47014
|
-
|
|
47015
|
-
|
|
47016
|
-
|
|
47017
|
-
|
|
47018
|
-
}
|
|
47019
|
-
|
|
47020
|
-
|
|
47021
|
-
|
|
47022
|
-
}
|
|
47023
|
-
|
|
47024
|
-
|
|
47001
|
+
var Request = defineTaggedUnion({
|
|
47002
|
+
RequestGetModel: {
|
|
47003
|
+
maybePath: Schema_exports.OptionFromNullOr(Schema_exports.String),
|
|
47004
|
+
expand: Schema_exports.Boolean
|
|
47005
|
+
},
|
|
47006
|
+
RequestGetModelAt: {
|
|
47007
|
+
index: Schema_exports.Number,
|
|
47008
|
+
maybePath: Schema_exports.OptionFromNullOr(Schema_exports.String),
|
|
47009
|
+
expand: Schema_exports.Boolean
|
|
47010
|
+
},
|
|
47011
|
+
RequestListMessages: {
|
|
47012
|
+
limit: Schema_exports.Number,
|
|
47013
|
+
maybeSinceIndex: Schema_exports.OptionFromNullOr(Schema_exports.Number),
|
|
47014
|
+
maybeChangedPathsMatch: Schema_exports.OptionFromNullOr(Schema_exports.Array(Schema_exports.String)).pipe(
|
|
47015
|
+
Schema_exports.withDecodingDefault(Effect_exports.succeed(null))
|
|
47016
|
+
),
|
|
47017
|
+
fromEnd: Schema_exports.Boolean.pipe(Schema_exports.withDecodingDefault(Effect_exports.succeed(false)))
|
|
47018
|
+
},
|
|
47019
|
+
RequestCountMessagesByTag: {
|
|
47020
|
+
maybeSinceIndex: Schema_exports.OptionFromNullOr(Schema_exports.Number),
|
|
47021
|
+
maybeChangedPathsMatch: Schema_exports.OptionFromNullOr(Schema_exports.Array(Schema_exports.String))
|
|
47022
|
+
},
|
|
47023
|
+
RequestDiffModels: {
|
|
47024
|
+
fromIndex: Schema_exports.Number,
|
|
47025
|
+
toIndex: Schema_exports.Number,
|
|
47026
|
+
maybeChangedPathsMatch: Schema_exports.OptionFromNullOr(Schema_exports.Array(Schema_exports.String))
|
|
47027
|
+
},
|
|
47028
|
+
RequestGetMessage: { index: Schema_exports.Number },
|
|
47029
|
+
RequestListKeyframes: {},
|
|
47030
|
+
RequestReplayToKeyframe: { keyframeIndex: Schema_exports.Number },
|
|
47031
|
+
RequestResume: {},
|
|
47032
|
+
RequestDispatchMessage: { message: Schema_exports.Unknown },
|
|
47033
|
+
RequestDispatchMessages: { messages: Schema_exports.Array(Schema_exports.Unknown) },
|
|
47034
|
+
RequestListRuntimes: {},
|
|
47035
|
+
RequestGetInit: {},
|
|
47036
|
+
RequestGetRuntimeState: {},
|
|
47037
|
+
RequestGetMessageSchema: { maybeVariantTag: Schema_exports.OptionFromNullOr(Schema_exports.String) }
|
|
47025
47038
|
});
|
|
47026
47039
|
var MessageTagCount = Schema_exports.Struct({
|
|
47027
47040
|
tag: Schema_exports.String,
|
|
47028
47041
|
count: Schema_exports.Number
|
|
47029
47042
|
});
|
|
47030
|
-
var
|
|
47031
|
-
|
|
47032
|
-
|
|
47033
|
-
scannedFromIndex: Schema_exports.Number,
|
|
47034
|
-
scannedToIndex: Schema_exports.Number
|
|
47043
|
+
var DiffValue = defineTaggedUnion({
|
|
47044
|
+
Absent: {},
|
|
47045
|
+
Present: { value: Schema_exports.Unknown }
|
|
47035
47046
|
});
|
|
47036
|
-
var DiffValueAbsent = ts("Absent");
|
|
47037
|
-
var DiffValuePresent = ts("Present", { value: Schema_exports.Unknown });
|
|
47038
|
-
var DiffValue = Schema_exports.Union([DiffValueAbsent, DiffValuePresent]);
|
|
47039
47047
|
var ModelDiffChange = Schema_exports.Struct({
|
|
47040
47048
|
path: Schema_exports.String,
|
|
47041
47049
|
before: DiffValue,
|
|
47042
47050
|
after: DiffValue
|
|
47043
47051
|
});
|
|
47044
|
-
var ResponseModelDiff = ts("ResponseModelDiff", {
|
|
47045
|
-
fromIndex: Schema_exports.Number,
|
|
47046
|
-
toIndex: Schema_exports.Number,
|
|
47047
|
-
changes: Schema_exports.Array(ModelDiffChange)
|
|
47048
|
-
});
|
|
47049
|
-
var ResponseKeyframes = ts("ResponseKeyframes", {
|
|
47050
|
-
keyframes: Schema_exports.Array(KeyframeInfo)
|
|
47051
|
-
});
|
|
47052
|
-
var ResponseReplayed = ts("ResponseReplayed", {
|
|
47053
|
-
model: Schema_exports.Unknown
|
|
47054
|
-
});
|
|
47055
|
-
var ResponseResumed = ts("ResponseResumed");
|
|
47056
|
-
var ResponseDispatched = ts("ResponseDispatched", {
|
|
47057
|
-
acceptedAtIndex: Schema_exports.Number
|
|
47058
|
-
});
|
|
47059
|
-
var ResponseDispatchedBatch = ts("ResponseDispatchedBatch", {
|
|
47060
|
-
acceptedAtIndices: Schema_exports.Array(Schema_exports.Number)
|
|
47061
|
-
});
|
|
47062
47052
|
var MessageSchemaIndexEntry = Schema_exports.Struct({
|
|
47063
47053
|
tag: Schema_exports.String,
|
|
47064
47054
|
payloadFields: Schema_exports.Array(Schema_exports.String),
|
|
@@ -47067,62 +47057,56 @@ var MessageSchemaIndexEntry = Schema_exports.Struct({
|
|
|
47067
47057
|
var MessageSchemaIndex = Schema_exports.Struct({
|
|
47068
47058
|
variants: Schema_exports.Array(MessageSchemaIndexEntry)
|
|
47069
47059
|
});
|
|
47070
|
-
var
|
|
47071
|
-
index: MessageSchemaIndex
|
|
47060
|
+
var MessageSchemaResult = defineTaggedUnion({
|
|
47061
|
+
MessageSchemaIndexResult: { index: MessageSchemaIndex },
|
|
47062
|
+
MessageSchemaDocumentResult: { document: Schema_exports.Unknown }
|
|
47072
47063
|
});
|
|
47073
|
-
var
|
|
47074
|
-
|
|
47075
|
-
|
|
47076
|
-
|
|
47077
|
-
|
|
47078
|
-
|
|
47079
|
-
|
|
47080
|
-
|
|
47081
|
-
|
|
47082
|
-
|
|
47083
|
-
|
|
47084
|
-
|
|
47085
|
-
}
|
|
47086
|
-
|
|
47087
|
-
|
|
47088
|
-
|
|
47089
|
-
|
|
47090
|
-
}
|
|
47091
|
-
|
|
47092
|
-
|
|
47093
|
-
|
|
47094
|
-
|
|
47095
|
-
|
|
47096
|
-
|
|
47097
|
-
|
|
47098
|
-
|
|
47099
|
-
|
|
47100
|
-
|
|
47101
|
-
}
|
|
47102
|
-
|
|
47103
|
-
|
|
47104
|
-
|
|
47105
|
-
|
|
47106
|
-
|
|
47107
|
-
|
|
47108
|
-
|
|
47109
|
-
|
|
47110
|
-
|
|
47111
|
-
|
|
47112
|
-
|
|
47113
|
-
|
|
47114
|
-
ResponseInit,
|
|
47115
|
-
ResponseRuntimeState,
|
|
47116
|
-
ResponseMessageSchema,
|
|
47117
|
-
ResponseError
|
|
47118
|
-
]);
|
|
47119
|
-
var EventConnected = ts("EventConnected", {
|
|
47120
|
-
runtime: RuntimeInfo
|
|
47064
|
+
var Response = defineTaggedUnion({
|
|
47065
|
+
ResponseModel: { value: Schema_exports.Unknown, atPath: Schema_exports.String, summarized: Schema_exports.Boolean },
|
|
47066
|
+
ResponseMessages: {
|
|
47067
|
+
entries: Schema_exports.Array(SerializedEntry),
|
|
47068
|
+
maybeNextIndex: Schema_exports.OptionFromNullOr(Schema_exports.Number)
|
|
47069
|
+
},
|
|
47070
|
+
ResponseMessage: { entry: SerializedEntry },
|
|
47071
|
+
ResponseMessageCounts: {
|
|
47072
|
+
counts: Schema_exports.Array(MessageTagCount),
|
|
47073
|
+
totalCount: Schema_exports.Number,
|
|
47074
|
+
scannedFromIndex: Schema_exports.Number,
|
|
47075
|
+
scannedToIndex: Schema_exports.Number
|
|
47076
|
+
},
|
|
47077
|
+
ResponseModelDiff: {
|
|
47078
|
+
fromIndex: Schema_exports.Number,
|
|
47079
|
+
toIndex: Schema_exports.Number,
|
|
47080
|
+
changes: Schema_exports.Array(ModelDiffChange)
|
|
47081
|
+
},
|
|
47082
|
+
ResponseKeyframes: { keyframes: Schema_exports.Array(KeyframeInfo) },
|
|
47083
|
+
ResponseReplayed: { model: Schema_exports.Unknown },
|
|
47084
|
+
ResponseResumed: {},
|
|
47085
|
+
ResponseDispatched: { acceptedAtIndex: Schema_exports.Number },
|
|
47086
|
+
ResponseDispatchedBatch: { acceptedAtIndices: Schema_exports.Array(Schema_exports.Number) },
|
|
47087
|
+
ResponseRuntimes: { runtimes: Schema_exports.Array(RuntimeInfo) },
|
|
47088
|
+
ResponseInit: {
|
|
47089
|
+
maybeModel: Schema_exports.OptionFromNullOr(Schema_exports.Unknown),
|
|
47090
|
+
commands: Schema_exports.Array(SerializedCommand),
|
|
47091
|
+
mountStarts: Schema_exports.Array(SerializedMount)
|
|
47092
|
+
},
|
|
47093
|
+
ResponseRuntimeState: {
|
|
47094
|
+
currentIndex: Schema_exports.Number,
|
|
47095
|
+
startIndex: Schema_exports.Number,
|
|
47096
|
+
totalEntries: Schema_exports.Number,
|
|
47097
|
+
isPaused: Schema_exports.Boolean,
|
|
47098
|
+
maybePausedAtIndex: Schema_exports.OptionFromNullOr(Schema_exports.Number),
|
|
47099
|
+
hasInitModel: Schema_exports.Boolean
|
|
47100
|
+
},
|
|
47101
|
+
ResponseMessageSchema: {
|
|
47102
|
+
maybeResult: Schema_exports.OptionFromNullOr(MessageSchemaResult)
|
|
47103
|
+
},
|
|
47104
|
+
ResponseError: { reason: Schema_exports.String }
|
|
47121
47105
|
});
|
|
47122
|
-
var
|
|
47123
|
-
|
|
47106
|
+
var Event = defineTaggedUnion({
|
|
47107
|
+
EventConnected: { runtime: RuntimeInfo },
|
|
47108
|
+
EventDisconnected: { connectionId: Schema_exports.String }
|
|
47124
47109
|
});
|
|
47125
|
-
var Event = Schema_exports.Union([EventConnected, EventDisconnected]);
|
|
47126
47110
|
var RequestFrame = Schema_exports.Struct({
|
|
47127
47111
|
id: Schema_exports.String,
|
|
47128
47112
|
maybeConnectionId: Schema_exports.OptionFromNullOr(Schema_exports.String),
|
|
@@ -47284,7 +47268,7 @@ var resolveRuntimeId = (wsClient, explicit) => {
|
|
|
47284
47268
|
}
|
|
47285
47269
|
return Effect_exports.gen(function* () {
|
|
47286
47270
|
const response = yield* wsClient.sendRequest(
|
|
47287
|
-
RequestListRuntimes(),
|
|
47271
|
+
Request.RequestListRuntimes(),
|
|
47288
47272
|
Option_exports.none()
|
|
47289
47273
|
);
|
|
47290
47274
|
return yield* Match_exports.value(response).pipe(
|
|
@@ -47341,7 +47325,7 @@ var buildTools = (wsClient) => [
|
|
|
47341
47325
|
inputSchema: toInputSchema(GetModelInput),
|
|
47342
47326
|
handle: runRuntimeTool(
|
|
47343
47327
|
GetModelInput,
|
|
47344
|
-
({ path, expand }) => RequestGetModel({
|
|
47328
|
+
({ path, expand }) => Request.RequestGetModel({
|
|
47345
47329
|
maybePath: Option_exports.fromNullishOr(path),
|
|
47346
47330
|
expand: expand ?? false
|
|
47347
47331
|
}),
|
|
@@ -47354,7 +47338,7 @@ var buildTools = (wsClient) => [
|
|
|
47354
47338
|
inputSchema: toInputSchema(GetModelAtInput),
|
|
47355
47339
|
handle: runRuntimeTool(
|
|
47356
47340
|
GetModelAtInput,
|
|
47357
|
-
({ index: index2, path, expand }) => RequestGetModelAt({
|
|
47341
|
+
({ index: index2, path, expand }) => Request.RequestGetModelAt({
|
|
47358
47342
|
index: index2,
|
|
47359
47343
|
maybePath: Option_exports.fromNullishOr(path),
|
|
47360
47344
|
expand: expand ?? false
|
|
@@ -47368,7 +47352,7 @@ var buildTools = (wsClient) => [
|
|
|
47368
47352
|
inputSchema: toInputSchema(ListMessagesInput),
|
|
47369
47353
|
handle: runRuntimeTool(
|
|
47370
47354
|
ListMessagesInput,
|
|
47371
|
-
({ limit, since_index, changed_paths_match, from_end }) => RequestListMessages({
|
|
47355
|
+
({ limit, since_index, changed_paths_match, from_end }) => Request.RequestListMessages({
|
|
47372
47356
|
limit: limit ?? DEFAULT_LIST_MESSAGES_LIMIT,
|
|
47373
47357
|
maybeSinceIndex: Option_exports.fromNullishOr(since_index),
|
|
47374
47358
|
maybeChangedPathsMatch: Option_exports.fromNullishOr(changed_paths_match),
|
|
@@ -47383,7 +47367,7 @@ var buildTools = (wsClient) => [
|
|
|
47383
47367
|
inputSchema: toInputSchema(CountMessagesByTagInput),
|
|
47384
47368
|
handle: runRuntimeTool(
|
|
47385
47369
|
CountMessagesByTagInput,
|
|
47386
|
-
({ since_index, changed_paths_match }) => RequestCountMessagesByTag({
|
|
47370
|
+
({ since_index, changed_paths_match }) => Request.RequestCountMessagesByTag({
|
|
47387
47371
|
maybeSinceIndex: Option_exports.fromNullishOr(since_index),
|
|
47388
47372
|
maybeChangedPathsMatch: Option_exports.fromNullishOr(changed_paths_match)
|
|
47389
47373
|
}),
|
|
@@ -47396,7 +47380,7 @@ var buildTools = (wsClient) => [
|
|
|
47396
47380
|
inputSchema: toInputSchema(DiffModelsInput),
|
|
47397
47381
|
handle: runRuntimeTool(
|
|
47398
47382
|
DiffModelsInput,
|
|
47399
|
-
({ from_index, to_index, changed_paths_match }) => RequestDiffModels({
|
|
47383
|
+
({ from_index, to_index, changed_paths_match }) => Request.RequestDiffModels({
|
|
47400
47384
|
fromIndex: from_index,
|
|
47401
47385
|
toIndex: to_index,
|
|
47402
47386
|
maybeChangedPathsMatch: Option_exports.fromNullishOr(changed_paths_match)
|
|
@@ -47410,7 +47394,7 @@ var buildTools = (wsClient) => [
|
|
|
47410
47394
|
inputSchema: toInputSchema(GetMessageInput),
|
|
47411
47395
|
handle: runRuntimeTool(
|
|
47412
47396
|
GetMessageInput,
|
|
47413
|
-
({ index: index2 }) => RequestGetMessage({ index: index2 }),
|
|
47397
|
+
({ index: index2 }) => Request.RequestGetMessage({ index: index2 }),
|
|
47414
47398
|
wsClient
|
|
47415
47399
|
)
|
|
47416
47400
|
},
|
|
@@ -47418,7 +47402,11 @@ var buildTools = (wsClient) => [
|
|
|
47418
47402
|
name: "foldkit_get_init",
|
|
47419
47403
|
description: "Read the runtime's initial Model, the Commands returned from the application's `init` function, and the Mounts that fired during the first render. The init entry is the synthetic row at index -1 in the DevTools panel; this tool exposes the same data without time-travelling the runtime. `maybeModel` is `None` until the runtime has finished its first render and recorded init, then stays `Some` for the rest of the runtime's life. `commands` lists init-time Commands in the order they were produced, each with its name and `args` (`Some(record)` when the Command declared an args schema, `None` otherwise); `mountStarts` lists Mounts whose elements appeared in the initial render, each with its name and `args` (`Some(record)` when the Mount declared an args schema, `None` otherwise).",
|
|
47420
47404
|
inputSchema: toInputSchema(GetInitInput),
|
|
47421
|
-
handle: runRuntimeTool(
|
|
47405
|
+
handle: runRuntimeTool(
|
|
47406
|
+
GetInitInput,
|
|
47407
|
+
() => Request.RequestGetInit(),
|
|
47408
|
+
wsClient
|
|
47409
|
+
)
|
|
47422
47410
|
},
|
|
47423
47411
|
{
|
|
47424
47412
|
name: "foldkit_get_runtime_state",
|
|
@@ -47426,7 +47414,7 @@ var buildTools = (wsClient) => [
|
|
|
47426
47414
|
inputSchema: toInputSchema(GetRuntimeStateInput),
|
|
47427
47415
|
handle: runRuntimeTool(
|
|
47428
47416
|
GetRuntimeStateInput,
|
|
47429
|
-
() => RequestGetRuntimeState(),
|
|
47417
|
+
() => Request.RequestGetRuntimeState(),
|
|
47430
47418
|
wsClient
|
|
47431
47419
|
)
|
|
47432
47420
|
},
|
|
@@ -47436,7 +47424,7 @@ var buildTools = (wsClient) => [
|
|
|
47436
47424
|
inputSchema: toInputSchema(ListKeyframesInput),
|
|
47437
47425
|
handle: runRuntimeTool(
|
|
47438
47426
|
ListKeyframesInput,
|
|
47439
|
-
() => RequestListKeyframes(),
|
|
47427
|
+
() => Request.RequestListKeyframes(),
|
|
47440
47428
|
wsClient
|
|
47441
47429
|
)
|
|
47442
47430
|
},
|
|
@@ -47446,7 +47434,7 @@ var buildTools = (wsClient) => [
|
|
|
47446
47434
|
inputSchema: toInputSchema(ReplayToKeyframeInput),
|
|
47447
47435
|
handle: runRuntimeTool(
|
|
47448
47436
|
ReplayToKeyframeInput,
|
|
47449
|
-
({ keyframe_index }) => RequestReplayToKeyframe({ keyframeIndex: keyframe_index }),
|
|
47437
|
+
({ keyframe_index }) => Request.RequestReplayToKeyframe({ keyframeIndex: keyframe_index }),
|
|
47450
47438
|
wsClient
|
|
47451
47439
|
)
|
|
47452
47440
|
},
|
|
@@ -47454,7 +47442,11 @@ var buildTools = (wsClient) => [
|
|
|
47454
47442
|
name: "foldkit_resume",
|
|
47455
47443
|
description: "Resume normal execution of a Foldkit runtime that was paused by foldkit_replay_to_keyframe.",
|
|
47456
47444
|
inputSchema: toInputSchema(ResumeInput),
|
|
47457
|
-
handle: runRuntimeTool(
|
|
47445
|
+
handle: runRuntimeTool(
|
|
47446
|
+
ResumeInput,
|
|
47447
|
+
() => Request.RequestResume(),
|
|
47448
|
+
wsClient
|
|
47449
|
+
)
|
|
47458
47450
|
},
|
|
47459
47451
|
{
|
|
47460
47452
|
name: "foldkit_get_message_schema",
|
|
@@ -47462,7 +47454,7 @@ var buildTools = (wsClient) => [
|
|
|
47462
47454
|
inputSchema: toInputSchema(GetMessageSchemaInput),
|
|
47463
47455
|
handle: runRuntimeTool(
|
|
47464
47456
|
GetMessageSchemaInput,
|
|
47465
|
-
({ variant_tag }) => RequestGetMessageSchema({
|
|
47457
|
+
({ variant_tag }) => Request.RequestGetMessageSchema({
|
|
47466
47458
|
maybeVariantTag: Option_exports.fromNullishOr(variant_tag)
|
|
47467
47459
|
}),
|
|
47468
47460
|
wsClient
|
|
@@ -47474,7 +47466,7 @@ var buildTools = (wsClient) => [
|
|
|
47474
47466
|
inputSchema: toInputSchema(DispatchMessageInput),
|
|
47475
47467
|
handle: runRuntimeTool(
|
|
47476
47468
|
DispatchMessageInput,
|
|
47477
|
-
({ message }) => RequestDispatchMessage({ message }),
|
|
47469
|
+
({ message }) => Request.RequestDispatchMessage({ message }),
|
|
47478
47470
|
wsClient
|
|
47479
47471
|
)
|
|
47480
47472
|
},
|
|
@@ -47484,7 +47476,7 @@ var buildTools = (wsClient) => [
|
|
|
47484
47476
|
inputSchema: toInputSchema(DispatchMessagesInput),
|
|
47485
47477
|
handle: runRuntimeTool(
|
|
47486
47478
|
DispatchMessagesInput,
|
|
47487
|
-
({ messages }) => RequestDispatchMessages({ messages }),
|
|
47479
|
+
({ messages }) => Request.RequestDispatchMessages({ messages }),
|
|
47488
47480
|
wsClient
|
|
47489
47481
|
)
|
|
47490
47482
|
},
|
|
@@ -47494,7 +47486,7 @@ var buildTools = (wsClient) => [
|
|
|
47494
47486
|
inputSchema: NO_INPUT_SCHEMA,
|
|
47495
47487
|
handle: () => Effect_exports.gen(function* () {
|
|
47496
47488
|
const response = yield* wsClient.sendRequest(
|
|
47497
|
-
RequestListRuntimes(),
|
|
47489
|
+
Request.RequestListRuntimes(),
|
|
47498
47490
|
Option_exports.none()
|
|
47499
47491
|
);
|
|
47500
47492
|
return responseToToolResult(response);
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAA8B,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAA8B,MAAM,QAAQ,CAAA;AAOlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AA0L3D,KAAK,UAAU,GAAG,QAAQ,CAAC;IACzB,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAA;IAChE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAC,CAAA;AAEF,8HAA8H;AAC9H,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;CACzD,CAAC,CAAA;AAsHF;;;;GAIG;AACH,eAAO,MAAM,UAAU,GACrB,UAAU,eAAe,KACxB,aAAa,CAAC,cAAc,CAsM9B,CAAA"}
|
package/dist/tools.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Array, Effect, Match, Option, Schema as S } from 'effect';
|
|
2
|
-
import { MAX_DISPATCH_BATCH_SIZE,
|
|
2
|
+
import { MAX_DISPATCH_BATCH_SIZE, Request, } from 'foldkit/devtools-protocol';
|
|
3
3
|
const RUNTIME_ID_DESCRIPTION = 'Optional connection id of a specific Foldkit runtime. Defaults to the most recently connected runtime.';
|
|
4
4
|
const DEFAULT_LIST_MESSAGES_LIMIT = 50;
|
|
5
5
|
const RuntimeIdField = S.optional(S.String.annotate({ description: RUNTIME_ID_DESCRIPTION }));
|
|
@@ -150,7 +150,7 @@ const resolveRuntimeId = (wsClient, explicit) => {
|
|
|
150
150
|
return Effect.succeed(explicit);
|
|
151
151
|
}
|
|
152
152
|
return Effect.gen(function* () {
|
|
153
|
-
const response = yield* wsClient.sendRequest(RequestListRuntimes(), Option.none());
|
|
153
|
+
const response = yield* wsClient.sendRequest(Request.RequestListRuntimes(), Option.none());
|
|
154
154
|
return yield* Match.value(response).pipe(Match.tag('ResponseRuntimes', ({ runtimes }) => Array.last(runtimes).pipe(Option.match({
|
|
155
155
|
onNone: () => Effect.fail(new Error('No connected Foldkit runtimes. Open a Foldkit dev page and try again.')),
|
|
156
156
|
onSome: runtime => Effect.succeed(runtime.connectionId),
|
|
@@ -184,7 +184,7 @@ export const buildTools = (wsClient) => [
|
|
|
184
184
|
name: 'foldkit_get_model',
|
|
185
185
|
description: "Snapshot the current Model from a connected Foldkit runtime. By default the response is summarized (large arrays/records/strings collapse to `_summary` placeholders) to keep payloads small for AI agents. Pass `path` (e.g. 'root.session.user') to narrow to a subtree, and `expand: true` to receive the literal value at that path. Returns `{ value, atPath, summarized }`.",
|
|
186
186
|
inputSchema: toInputSchema(GetModelInput),
|
|
187
|
-
handle: runRuntimeTool(GetModelInput, ({ path, expand }) => RequestGetModel({
|
|
187
|
+
handle: runRuntimeTool(GetModelInput, ({ path, expand }) => Request.RequestGetModel({
|
|
188
188
|
maybePath: Option.fromNullishOr(path),
|
|
189
189
|
expand: expand ?? false,
|
|
190
190
|
}), wsClient),
|
|
@@ -193,7 +193,7 @@ export const buildTools = (wsClient) => [
|
|
|
193
193
|
name: 'foldkit_get_model_at',
|
|
194
194
|
description: "Snapshot a historical Model after a given history entry was applied. Pass `index: N - 1` to read the Model just before message N. Same `path`/`expand` semantics as foldkit_get_model. Indices outside the retained history range (older entries are evicted past the rolling buffer) are rejected with the readable range. For the initial Model (and the names of Commands returned from the application's `init`), use foldkit_get_init.",
|
|
195
195
|
inputSchema: toInputSchema(GetModelAtInput),
|
|
196
|
-
handle: runRuntimeTool(GetModelAtInput, ({ index, path, expand }) => RequestGetModelAt({
|
|
196
|
+
handle: runRuntimeTool(GetModelAtInput, ({ index, path, expand }) => Request.RequestGetModelAt({
|
|
197
197
|
index,
|
|
198
198
|
maybePath: Option.fromNullishOr(path),
|
|
199
199
|
expand: expand ?? false,
|
|
@@ -203,7 +203,7 @@ export const buildTools = (wsClient) => [
|
|
|
203
203
|
name: 'foldkit_list_messages',
|
|
204
204
|
description: 'List Message history entries from a Foldkit runtime. Filter server-side with `changed_paths_match` to ask in Model terms (which Messages touched this subtree), read the most recent entries with `from_end: true`, and paginate forward via `since_index` using the returned `maybeNextIndex` (the absolute index of the next matching entry). On busy histories (drag, scroll, keystroke flows), call foldkit_count_messages_by_tag first to learn what is worth filtering.',
|
|
205
205
|
inputSchema: toInputSchema(ListMessagesInput),
|
|
206
|
-
handle: runRuntimeTool(ListMessagesInput, ({ limit, since_index, changed_paths_match, from_end }) => RequestListMessages({
|
|
206
|
+
handle: runRuntimeTool(ListMessagesInput, ({ limit, since_index, changed_paths_match, from_end }) => Request.RequestListMessages({
|
|
207
207
|
limit: limit ?? DEFAULT_LIST_MESSAGES_LIMIT,
|
|
208
208
|
maybeSinceIndex: Option.fromNullishOr(since_index),
|
|
209
209
|
maybeChangedPathsMatch: Option.fromNullishOr(changed_paths_match),
|
|
@@ -214,7 +214,7 @@ export const buildTools = (wsClient) => [
|
|
|
214
214
|
name: 'foldkit_count_messages_by_tag',
|
|
215
215
|
description: 'Count retained Message history entries by tag, without payloads. Returns `{ counts: [{ tag, count }], totalCount, scannedFromIndex, scannedToIndex }` sorted by count descending. A cheap reconnaissance call before paging through history: it surfaces the high-frequency Messages worth filtering out, and with `changed_paths_match` it answers which Message tags touch a Model subtree. Accepts the same `since_index`/`changed_paths_match` filters as foldkit_list_messages.',
|
|
216
216
|
inputSchema: toInputSchema(CountMessagesByTagInput),
|
|
217
|
-
handle: runRuntimeTool(CountMessagesByTagInput, ({ since_index, changed_paths_match }) => RequestCountMessagesByTag({
|
|
217
|
+
handle: runRuntimeTool(CountMessagesByTagInput, ({ since_index, changed_paths_match }) => Request.RequestCountMessagesByTag({
|
|
218
218
|
maybeSinceIndex: Option.fromNullishOr(since_index),
|
|
219
219
|
maybeChangedPathsMatch: Option.fromNullishOr(changed_paths_match),
|
|
220
220
|
}), wsClient),
|
|
@@ -223,7 +223,7 @@ export const buildTools = (wsClient) => [
|
|
|
223
223
|
name: 'foldkit_diff_models',
|
|
224
224
|
description: "Diff the Models at two history indices server-side. Returns path-level changes `{ path, before, after }` sorted by path (numeric segments in numeric order), with values summarized. Each side is `{ _tag: 'Present', value }`, or `{ _tag: 'Absent' }` when the path does not exist on that side (a key or element that was added or removed). `from_index`/`to_index` follow foldkit_get_model_at semantics: the Model right after that entry was applied, with -1 for the initial Model. Pass `changed_paths_match` to narrow the diff to a Model subtree. Far cheaper than fetching two snapshots and diffing client-side; follow up with foldkit_get_model_at plus `path`/`expand: true` to read a changed subtree at full fidelity.",
|
|
225
225
|
inputSchema: toInputSchema(DiffModelsInput),
|
|
226
|
-
handle: runRuntimeTool(DiffModelsInput, ({ from_index, to_index, changed_paths_match }) => RequestDiffModels({
|
|
226
|
+
handle: runRuntimeTool(DiffModelsInput, ({ from_index, to_index, changed_paths_match }) => Request.RequestDiffModels({
|
|
227
227
|
fromIndex: from_index,
|
|
228
228
|
toIndex: to_index,
|
|
229
229
|
maybeChangedPathsMatch: Option.fromNullishOr(changed_paths_match),
|
|
@@ -233,43 +233,43 @@ export const buildTools = (wsClient) => [
|
|
|
233
233
|
name: 'foldkit_get_message',
|
|
234
234
|
description: 'Read a single Message history entry by absolute index. The response carries the SerializedEntry (tag, message body, commands, mountStarts, mountEnds, timestamp, `isModelChanged`, `changedPaths` for leaf-level mutations, `affectedPaths` adding their ancestor paths). Each entry in `commands` carries the Command name and `args` (`Some(record)` when the Command declared an args schema, `None` otherwise). `mountStarts` lists Mounts that fired during the render after this Message; `mountEnds` lists Mounts whose elements were unmounted during that render. Each Mount carries its `name` and `args` (`Some(record)` when the Mount declared an args schema, `None` otherwise). For Submodel-routed entries (tag matches `Got*Message`), the entry also carries `submodelPath` listing wrapper tags from outer to inner and `maybeLeafTag` naming the innermost child Message. Model snapshots are not included; call foldkit_get_model_at with `index - 1` (before) and `index` (after) to inspect Model state around the entry.',
|
|
235
235
|
inputSchema: toInputSchema(GetMessageInput),
|
|
236
|
-
handle: runRuntimeTool(GetMessageInput, ({ index }) => RequestGetMessage({ index }), wsClient),
|
|
236
|
+
handle: runRuntimeTool(GetMessageInput, ({ index }) => Request.RequestGetMessage({ index }), wsClient),
|
|
237
237
|
},
|
|
238
238
|
{
|
|
239
239
|
name: 'foldkit_get_init',
|
|
240
240
|
description: "Read the runtime's initial Model, the Commands returned from the application's `init` function, and the Mounts that fired during the first render. The init entry is the synthetic row at index -1 in the DevTools panel; this tool exposes the same data without time-travelling the runtime. `maybeModel` is `None` until the runtime has finished its first render and recorded init, then stays `Some` for the rest of the runtime's life. `commands` lists init-time Commands in the order they were produced, each with its name and `args` (`Some(record)` when the Command declared an args schema, `None` otherwise); `mountStarts` lists Mounts whose elements appeared in the initial render, each with its name and `args` (`Some(record)` when the Mount declared an args schema, `None` otherwise).",
|
|
241
241
|
inputSchema: toInputSchema(GetInitInput),
|
|
242
|
-
handle: runRuntimeTool(GetInitInput, () => RequestGetInit(), wsClient),
|
|
242
|
+
handle: runRuntimeTool(GetInitInput, () => Request.RequestGetInit(), wsClient),
|
|
243
243
|
},
|
|
244
244
|
{
|
|
245
245
|
name: 'foldkit_get_runtime_state',
|
|
246
246
|
description: "Snapshot the runtime's DevTools state: history bounds, current paused/live status, and whether init is recorded. Returns `currentIndex` (the absolute index of the most recent Message, or -1 when none), `startIndex` (the earliest absolute index still retained in the rolling buffer), `totalEntries` (count of retained entries), `isPaused`, `maybePausedAtIndex` (`Some(index)` when paused, `None` otherwise), and `hasInitModel`. Use it to reason about what `foldkit_list_messages` and `foldkit_get_message` will see, and to detect whether the runtime is currently paused at a replayed snapshot.",
|
|
247
247
|
inputSchema: toInputSchema(GetRuntimeStateInput),
|
|
248
|
-
handle: runRuntimeTool(GetRuntimeStateInput, () => RequestGetRuntimeState(), wsClient),
|
|
248
|
+
handle: runRuntimeTool(GetRuntimeStateInput, () => Request.RequestGetRuntimeState(), wsClient),
|
|
249
249
|
},
|
|
250
250
|
{
|
|
251
251
|
name: 'foldkit_list_keyframes',
|
|
252
252
|
description: 'List the available keyframes (replayable Model snapshots) from a Foldkit runtime.',
|
|
253
253
|
inputSchema: toInputSchema(ListKeyframesInput),
|
|
254
|
-
handle: runRuntimeTool(ListKeyframesInput, () => RequestListKeyframes(), wsClient),
|
|
254
|
+
handle: runRuntimeTool(ListKeyframesInput, () => Request.RequestListKeyframes(), wsClient),
|
|
255
255
|
},
|
|
256
256
|
{
|
|
257
257
|
name: 'foldkit_replay_to_keyframe',
|
|
258
258
|
description: 'Time-travel a Foldkit runtime back to a previous Model snapshot. Pass `keyframe_index: -1` for the initial Model, or a non-negative index for the state right after that history entry. The runtime is paused at the snapshot until foldkit_resume is called.',
|
|
259
259
|
inputSchema: toInputSchema(ReplayToKeyframeInput),
|
|
260
|
-
handle: runRuntimeTool(ReplayToKeyframeInput, ({ keyframe_index }) => RequestReplayToKeyframe({ keyframeIndex: keyframe_index }), wsClient),
|
|
260
|
+
handle: runRuntimeTool(ReplayToKeyframeInput, ({ keyframe_index }) => Request.RequestReplayToKeyframe({ keyframeIndex: keyframe_index }), wsClient),
|
|
261
261
|
},
|
|
262
262
|
{
|
|
263
263
|
name: 'foldkit_resume',
|
|
264
264
|
description: 'Resume normal execution of a Foldkit runtime that was paused by foldkit_replay_to_keyframe.',
|
|
265
265
|
inputSchema: toInputSchema(ResumeInput),
|
|
266
|
-
handle: runRuntimeTool(ResumeInput, () => RequestResume(), wsClient),
|
|
266
|
+
handle: runRuntimeTool(ResumeInput, () => Request.RequestResume(), wsClient),
|
|
267
267
|
},
|
|
268
268
|
{
|
|
269
269
|
name: 'foldkit_get_message_schema',
|
|
270
270
|
description: 'Describe the Message Schema for a Foldkit runtime so agents can construct valid payloads for `foldkit_dispatch_message`. Call with no arguments to receive a small variant index (every top-level variant\'s `_tag`, its payload field names, and which payload fields are themselves tagged-union shapes). Then call with `variant_tag: "ChosenVariant"` to drill in. The argument is a dot-separated path of variant `_tag` values: each segment names a variant, and the walker steps through the variant\'s single tagged-union payload field to reach the next. So `"GotMobileMenuDialogMessage"` narrows one level; `"GotMobileMenuDialogMessage.GotAnimationMessage"` narrows two levels of a Submodel chain. Discriminated unions deeper than the supplied path collapse to `{ "_summary": "union", "variants": [...] }` placeholders so the response stays compact even for deeply-nested apps; extend the path to drill further. `S.Option` fields render as `anyOf: [{_tag: "Some", value}, {_tag: "None"}]`. The full document follows the JSON Schema draft-2020-12 shape from `Schema.toJsonSchemaDocument`: `{ dialect, schema, definitions }`. Returns `maybeResult: None` when the runtime hasn\'t configured `DevToolsConfig.Message` (dispatch is also unavailable). Fields with no JSON representation, notably `S.instanceOf(File)` for user-uploaded files, render as `{type: "null"}`; those variants can\'t be dispatched via MCP because their values live in browser memory.',
|
|
271
271
|
inputSchema: toInputSchema(GetMessageSchemaInput),
|
|
272
|
-
handle: runRuntimeTool(GetMessageSchemaInput, ({ variant_tag }) => RequestGetMessageSchema({
|
|
272
|
+
handle: runRuntimeTool(GetMessageSchemaInput, ({ variant_tag }) => Request.RequestGetMessageSchema({
|
|
273
273
|
maybeVariantTag: Option.fromNullishOr(variant_tag),
|
|
274
274
|
}), wsClient),
|
|
275
275
|
},
|
|
@@ -277,20 +277,20 @@ export const buildTools = (wsClient) => [
|
|
|
277
277
|
name: 'foldkit_dispatch_message',
|
|
278
278
|
description: "Dispatch a Message into a Foldkit runtime, as if the application itself produced it. Requires the runtime to have configured DevToolsConfig.Message; without it, dispatch is rejected. Call `foldkit_get_message_schema` with no arguments to enumerate the variants, then with `variant_tag` to learn one variant's exact payload shape, before constructing the Message object. The runtime decodes the payload and returns a clean error if it doesn't match. To dispatch several Messages in order with one call, use foldkit_dispatch_messages.",
|
|
279
279
|
inputSchema: toInputSchema(DispatchMessageInput),
|
|
280
|
-
handle: runRuntimeTool(DispatchMessageInput, ({ message }) => RequestDispatchMessage({ message }), wsClient),
|
|
280
|
+
handle: runRuntimeTool(DispatchMessageInput, ({ message }) => Request.RequestDispatchMessage({ message }), wsClient),
|
|
281
281
|
},
|
|
282
282
|
{
|
|
283
283
|
name: 'foldkit_dispatch_messages',
|
|
284
284
|
description: `Dispatch an ordered batch of Messages into a Foldkit runtime in one call, first to last, as if the application produced them in quick succession. Prefer this over repeated foldkit_dispatch_message calls when staging state that takes several Messages: reproducing a bug, filling a form, or building a history fixture. Takes 1 to ${MAX_DISPATCH_BATCH_SIZE} Messages. Validation is all-or-nothing: the runtime decodes every payload against the Message Schema before dispatching any of them, and one invalid entry rejects the whole batch with an error naming its zero-based position, so there is never a partially applied prefix to clean up. On success the response carries acceptedAtIndices, the predicted history index for each Message in request order; the runtime may still record its own Messages between entries (for example a Command completing mid-burst), exactly as with rapid user input, and Messages excluded from history via excludeFromHistory are dispatched but never recorded, so entries after one land below their predicted index. Requires DevToolsConfig.Message, like foldkit_dispatch_message.`,
|
|
285
285
|
inputSchema: toInputSchema(DispatchMessagesInput),
|
|
286
|
-
handle: runRuntimeTool(DispatchMessagesInput, ({ messages }) => RequestDispatchMessages({ messages }), wsClient),
|
|
286
|
+
handle: runRuntimeTool(DispatchMessagesInput, ({ messages }) => Request.RequestDispatchMessages({ messages }), wsClient),
|
|
287
287
|
},
|
|
288
288
|
{
|
|
289
289
|
name: 'foldkit_list_runtimes',
|
|
290
290
|
description: 'List Foldkit runtimes (browser tabs) currently connected to the dev server.',
|
|
291
291
|
inputSchema: NO_INPUT_SCHEMA,
|
|
292
292
|
handle: () => Effect.gen(function* () {
|
|
293
|
-
const response = yield* wsClient.sendRequest(RequestListRuntimes(), Option.none());
|
|
293
|
+
const response = yield* wsClient.sendRequest(Request.RequestListRuntimes(), Option.none());
|
|
294
294
|
return responseToToolResult(response);
|
|
295
295
|
}).pipe(Effect.catch(error => Effect.succeed(formatError(errorReason(error))))),
|
|
296
296
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foldkit/devtools-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0-canary.26614ae9952e",
|
|
4
4
|
"description": "MCP server exposing Foldkit DevTools to AI agents (Claude Code, Cursor, etc.)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/server.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"effect": "4.0.0-rc.112",
|
|
20
|
-
"foldkit": "
|
|
20
|
+
"foldkit": "0.153.0-canary.26614ae9952e"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"esbuild": "^0.28.1",
|
|
31
31
|
"rimraf": "^6.1.3",
|
|
32
32
|
"typescript": "^6.0.3",
|
|
33
|
-
"foldkit": "0.
|
|
33
|
+
"foldkit": "0.153.0-canary.26614ae9952e"
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"dist"
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"url": "https://github.com/foldkit/foldkit.git",
|
|
50
50
|
"directory": "packages/devtools-mcp"
|
|
51
51
|
},
|
|
52
|
+
"homepage": "https://foldkit.dev/ai/mcp",
|
|
52
53
|
"publishConfig": {
|
|
53
54
|
"access": "public"
|
|
54
55
|
},
|