@taptap/maker 0.0.22-beta.1 → 0.0.22
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/README.md +1 -1
- package/dist/maker.js +116 -41
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/maker.js
CHANGED
|
@@ -34260,7 +34260,7 @@ function applyDefaults(config2) {
|
|
|
34260
34260
|
}
|
|
34261
34261
|
|
|
34262
34262
|
// src/maker/server/mcp.ts
|
|
34263
|
-
var VERSION = true ? "0.0.22
|
|
34263
|
+
var VERSION = true ? "0.0.22" : "dev";
|
|
34264
34264
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
34265
34265
|
var ASYNC_BUILD_POLL_INTERVAL_MS = 5 * 1e3;
|
|
34266
34266
|
var ASYNC_BUILD_TIMEOUT_MS = 30 * 60 * 1e3;
|
|
@@ -34865,7 +34865,7 @@ async function formatStatus(options = {}) {
|
|
|
34865
34865
|
].filter(Boolean).join("\n");
|
|
34866
34866
|
}
|
|
34867
34867
|
function formatAsyncBuildStatus(projectRoot) {
|
|
34868
|
-
const active = readJsonFile2(
|
|
34868
|
+
const active = readJsonFile2(getAsyncBuildActiveFilePath(projectRoot));
|
|
34869
34869
|
if (!(active == null ? void 0 : active.taskId)) {
|
|
34870
34870
|
return ["Maker async build", "", "- status: inactive"].join("\n");
|
|
34871
34871
|
}
|
|
@@ -35798,12 +35798,64 @@ function parseJsonObjectFromText(text) {
|
|
|
35798
35798
|
if (!trimmed) {
|
|
35799
35799
|
return void 0;
|
|
35800
35800
|
}
|
|
35801
|
-
|
|
35802
|
-
|
|
35803
|
-
|
|
35804
|
-
|
|
35805
|
-
|
|
35801
|
+
for (const candidate of extractJsonObjectCandidates(trimmed)) {
|
|
35802
|
+
try {
|
|
35803
|
+
const parsed = JSON.parse(candidate);
|
|
35804
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
35805
|
+
return parsed;
|
|
35806
|
+
}
|
|
35807
|
+
} catch {
|
|
35808
|
+
}
|
|
35806
35809
|
}
|
|
35810
|
+
return void 0;
|
|
35811
|
+
}
|
|
35812
|
+
function extractJsonObjectCandidates(text) {
|
|
35813
|
+
var _a3;
|
|
35814
|
+
const candidates = /* @__PURE__ */ new Set([text]);
|
|
35815
|
+
const fencedJsonPattern = /```(?:json)?\s*([\s\S]*?)```/gi;
|
|
35816
|
+
let fencedMatch;
|
|
35817
|
+
while ((fencedMatch = fencedJsonPattern.exec(text)) !== null) {
|
|
35818
|
+
const candidate = (_a3 = fencedMatch[1]) == null ? void 0 : _a3.trim();
|
|
35819
|
+
if (candidate) {
|
|
35820
|
+
candidates.add(candidate);
|
|
35821
|
+
}
|
|
35822
|
+
}
|
|
35823
|
+
let start = -1;
|
|
35824
|
+
let depth = 0;
|
|
35825
|
+
let inString = false;
|
|
35826
|
+
let escaping = false;
|
|
35827
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
35828
|
+
const char = text[index];
|
|
35829
|
+
if (inString) {
|
|
35830
|
+
if (escaping) {
|
|
35831
|
+
escaping = false;
|
|
35832
|
+
} else if (char === "\\") {
|
|
35833
|
+
escaping = true;
|
|
35834
|
+
} else if (char === '"') {
|
|
35835
|
+
inString = false;
|
|
35836
|
+
}
|
|
35837
|
+
continue;
|
|
35838
|
+
}
|
|
35839
|
+
if (char === '"') {
|
|
35840
|
+
inString = true;
|
|
35841
|
+
continue;
|
|
35842
|
+
}
|
|
35843
|
+
if (char === "{") {
|
|
35844
|
+
if (depth === 0) {
|
|
35845
|
+
start = index;
|
|
35846
|
+
}
|
|
35847
|
+
depth += 1;
|
|
35848
|
+
continue;
|
|
35849
|
+
}
|
|
35850
|
+
if (char === "}" && depth > 0) {
|
|
35851
|
+
depth -= 1;
|
|
35852
|
+
if (depth === 0 && start >= 0) {
|
|
35853
|
+
candidates.add(text.slice(start, index + 1));
|
|
35854
|
+
start = -1;
|
|
35855
|
+
}
|
|
35856
|
+
}
|
|
35857
|
+
}
|
|
35858
|
+
return [...candidates].map((candidate) => candidate.trim()).filter(Boolean);
|
|
35807
35859
|
}
|
|
35808
35860
|
function attachAsyncBuildWatcher(buildResult, options) {
|
|
35809
35861
|
const remoteQueryRunner = options.queryAsyncBuildResult ? void 0 : createRemoteAsyncBuildQueryRunner(buildResult);
|
|
@@ -35844,9 +35896,10 @@ async function attachAndWaitAsyncBuildResult(buildResult, options) {
|
|
|
35844
35896
|
if (finalState.status === "failed") {
|
|
35845
35897
|
throw new RemoteBuildFailedError(finalResult);
|
|
35846
35898
|
}
|
|
35847
|
-
throw new
|
|
35848
|
-
|
|
35849
|
-
|
|
35899
|
+
throw new RemoteBuildFailedError({
|
|
35900
|
+
...finalResult,
|
|
35901
|
+
resultText: finalResult.resultText || `Async Maker build did not finish successfully: ${finalState.status}${finalState.error ? `: ${formatAsyncBuildDiagnostic(finalState.error)}` : ""}`
|
|
35902
|
+
});
|
|
35850
35903
|
}
|
|
35851
35904
|
function formatAsyncBuildDiagnostic(value) {
|
|
35852
35905
|
if (typeof value === "string") {
|
|
@@ -35858,7 +35911,7 @@ function formatAsyncBuildDiagnostic(value) {
|
|
|
35858
35911
|
return String(value);
|
|
35859
35912
|
}
|
|
35860
35913
|
}
|
|
35861
|
-
function createRemoteAsyncBuildQueryRunner(buildResult) {
|
|
35914
|
+
function createRemoteAsyncBuildQueryRunner(buildResult, options = {}) {
|
|
35862
35915
|
var _a3, _b;
|
|
35863
35916
|
const proxy = createRemoteProxyContext({
|
|
35864
35917
|
targetDir: buildResult.projectRoot,
|
|
@@ -35867,15 +35920,16 @@ function createRemoteAsyncBuildQueryRunner(buildResult) {
|
|
|
35867
35920
|
});
|
|
35868
35921
|
const queryToolName = ((_a3 = process.env.TAPTAP_MAKER_REMOTE_ASYNC_BUILD_QUERY_TOOL) == null ? void 0 : _a3.trim()) || DEFAULT_REMOTE_ASYNC_BUILD_QUERY_TOOL;
|
|
35869
35922
|
const taskIdParam = ((_b = process.env.TAPTAP_MAKER_REMOTE_ASYNC_BUILD_QUERY_TASK_ID_PARAM) == null ? void 0 : _b.trim()) || DEFAULT_REMOTE_ASYNC_BUILD_QUERY_TASK_ID_PARAM;
|
|
35870
|
-
|
|
35923
|
+
let client;
|
|
35924
|
+
const createTransport = options.createTransport || (() => trackMakerChildTransport(
|
|
35871
35925
|
new HiddenStdioClientTransport({
|
|
35872
35926
|
command: proxy.command,
|
|
35873
35927
|
args: proxy.args,
|
|
35874
35928
|
env: mergeStringEnv(process.env, proxy.envVars),
|
|
35875
35929
|
stderr: "pipe"
|
|
35876
35930
|
})
|
|
35877
|
-
);
|
|
35878
|
-
const
|
|
35931
|
+
));
|
|
35932
|
+
const createClient = options.createClient || (() => new Client(
|
|
35879
35933
|
{
|
|
35880
35934
|
name: "taptap-maker-async-build-query-forwarder",
|
|
35881
35935
|
version: VERSION
|
|
@@ -35883,31 +35937,47 @@ function createRemoteAsyncBuildQueryRunner(buildResult) {
|
|
|
35883
35937
|
{
|
|
35884
35938
|
capabilities: {}
|
|
35885
35939
|
}
|
|
35886
|
-
);
|
|
35887
|
-
|
|
35888
|
-
|
|
35889
|
-
|
|
35890
|
-
|
|
35940
|
+
));
|
|
35941
|
+
const ensureClient = async () => {
|
|
35942
|
+
if (client) {
|
|
35943
|
+
return client;
|
|
35944
|
+
}
|
|
35945
|
+
const nextClient = createClient();
|
|
35946
|
+
await nextClient.connect(createTransport());
|
|
35947
|
+
client = nextClient;
|
|
35948
|
+
return nextClient;
|
|
35949
|
+
};
|
|
35950
|
+
const close = async () => {
|
|
35951
|
+
const activeClient = client;
|
|
35952
|
+
client = void 0;
|
|
35953
|
+
if (activeClient) {
|
|
35954
|
+
await activeClient.close();
|
|
35891
35955
|
}
|
|
35892
|
-
await connectPromise;
|
|
35893
35956
|
};
|
|
35894
35957
|
return {
|
|
35895
35958
|
query: async (taskId) => {
|
|
35896
|
-
await
|
|
35897
|
-
|
|
35898
|
-
|
|
35899
|
-
|
|
35900
|
-
|
|
35901
|
-
|
|
35902
|
-
|
|
35903
|
-
|
|
35904
|
-
|
|
35905
|
-
|
|
35906
|
-
|
|
35959
|
+
const activeClient = await ensureClient();
|
|
35960
|
+
let result;
|
|
35961
|
+
try {
|
|
35962
|
+
result = await activeClient.callTool(
|
|
35963
|
+
{
|
|
35964
|
+
name: queryToolName,
|
|
35965
|
+
arguments: { [taskIdParam]: taskId }
|
|
35966
|
+
},
|
|
35967
|
+
void 0,
|
|
35968
|
+
{
|
|
35969
|
+
timeout: DEFAULT_BUILD_TIMEOUT_MS
|
|
35970
|
+
}
|
|
35971
|
+
);
|
|
35972
|
+
} catch (error2) {
|
|
35973
|
+
await close().catch(() => {
|
|
35974
|
+
});
|
|
35975
|
+
throw error2;
|
|
35976
|
+
}
|
|
35907
35977
|
return normalizeAsyncBuildQueryResult(result);
|
|
35908
35978
|
},
|
|
35909
35979
|
close: async () => {
|
|
35910
|
-
await
|
|
35980
|
+
await close().catch(() => {
|
|
35911
35981
|
});
|
|
35912
35982
|
}
|
|
35913
35983
|
};
|
|
@@ -36268,7 +36338,7 @@ function emitAsyncBuildPollProgress(watcher, result, onProgress) {
|
|
|
36268
36338
|
}
|
|
36269
36339
|
function stopExistingAsyncBuildResultWatcher(projectRoot, reason = "cancelled") {
|
|
36270
36340
|
var _a3;
|
|
36271
|
-
const activeFile =
|
|
36341
|
+
const activeFile = getAsyncBuildActiveFilePath(projectRoot);
|
|
36272
36342
|
const active = readJsonFile2(activeFile);
|
|
36273
36343
|
const watcher = activeAsyncBuildWatchers.get(activeFile);
|
|
36274
36344
|
if (!active && !watcher) {
|
|
@@ -36365,10 +36435,14 @@ function getAsyncBuildWatcherPaths(projectRoot, taskId) {
|
|
|
36365
36435
|
const normalizedProjectRoot = normalizeExistingProjectPath(projectRoot);
|
|
36366
36436
|
const buildDir = path15.join(normalizedProjectRoot, ".maker", "builds");
|
|
36367
36437
|
return {
|
|
36368
|
-
activeFile:
|
|
36438
|
+
activeFile: getAsyncBuildActiveFilePath(projectRoot),
|
|
36369
36439
|
stateFile: path15.join(buildDir, `${sanitizeAsyncBuildTaskId(taskId)}.json`)
|
|
36370
36440
|
};
|
|
36371
36441
|
}
|
|
36442
|
+
function getAsyncBuildActiveFilePath(projectRoot) {
|
|
36443
|
+
const normalizedProjectRoot = normalizeExistingProjectPath(projectRoot);
|
|
36444
|
+
return path15.join(normalizedProjectRoot, ".maker", "builds", "active-build.json");
|
|
36445
|
+
}
|
|
36372
36446
|
function normalizeExistingProjectPath(projectRoot) {
|
|
36373
36447
|
try {
|
|
36374
36448
|
return fs14.realpathSync(projectRoot);
|
|
@@ -37260,7 +37334,7 @@ function formatError2(error2) {
|
|
|
37260
37334
|
}
|
|
37261
37335
|
|
|
37262
37336
|
// src/maker/cli/commands.ts
|
|
37263
|
-
var VERSION2 = true ? "0.0.22
|
|
37337
|
+
var VERSION2 = true ? "0.0.22" : "dev";
|
|
37264
37338
|
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
37265
37339
|
var MAKER_NPM_PACKAGE = "@taptap/maker";
|
|
37266
37340
|
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp", "agents"]);
|
|
@@ -41547,9 +41621,6 @@ var TapTapMCPProxy = class {
|
|
|
41547
41621
|
if (!(error2 instanceof Error)) return false;
|
|
41548
41622
|
const errorMsg = error2.message.toLowerCase();
|
|
41549
41623
|
const errorCode = error2.code;
|
|
41550
|
-
if (this.isMcpApplicationError(error2)) {
|
|
41551
|
-
return false;
|
|
41552
|
-
}
|
|
41553
41624
|
const networkErrorCodes = [
|
|
41554
41625
|
"ECONNREFUSED",
|
|
41555
41626
|
// 连接拒绝
|
|
@@ -41571,6 +41642,12 @@ var TapTapMCPProxy = class {
|
|
|
41571
41642
|
if (errorCode && networkErrorCodes.includes(errorCode)) {
|
|
41572
41643
|
return true;
|
|
41573
41644
|
}
|
|
41645
|
+
if (errorMsg.includes("not connected") || this.isSessionInvalidError(error2)) {
|
|
41646
|
+
return true;
|
|
41647
|
+
}
|
|
41648
|
+
if (this.isMcpApplicationError(error2)) {
|
|
41649
|
+
return false;
|
|
41650
|
+
}
|
|
41574
41651
|
const networkErrorKeywords = [
|
|
41575
41652
|
"fetch failed",
|
|
41576
41653
|
"socket hang up",
|
|
@@ -41578,9 +41655,7 @@ var TapTapMCPProxy = class {
|
|
|
41578
41655
|
"connection refused",
|
|
41579
41656
|
"connection reset",
|
|
41580
41657
|
"timeout",
|
|
41581
|
-
"dns"
|
|
41582
|
-
"not connected"
|
|
41583
|
-
// 连接断开
|
|
41658
|
+
"dns"
|
|
41584
41659
|
];
|
|
41585
41660
|
if (networkErrorKeywords.some((keyword) => errorMsg.includes(keyword))) {
|
|
41586
41661
|
return true;
|