@taptap/maker 0.0.22-beta.1 → 0.0.23-beta.1
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 +131 -631
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/maker.js
CHANGED
|
@@ -29902,6 +29902,14 @@ function escapeRegExp(value) {
|
|
|
29902
29902
|
}
|
|
29903
29903
|
|
|
29904
29904
|
// src/maker/cli/projects.ts
|
|
29905
|
+
var MAKER_PROJECT_BASE_DIRECTORIES = [
|
|
29906
|
+
"assets",
|
|
29907
|
+
"assets/image",
|
|
29908
|
+
"assets/sprites",
|
|
29909
|
+
"assets/video",
|
|
29910
|
+
"assets/audio",
|
|
29911
|
+
"scripts"
|
|
29912
|
+
];
|
|
29905
29913
|
var MakerGitError = class extends Error {
|
|
29906
29914
|
constructor(failure) {
|
|
29907
29915
|
super(failure.message);
|
|
@@ -30031,6 +30039,11 @@ async function createMakerProject(options) {
|
|
|
30031
30039
|
}
|
|
30032
30040
|
return project;
|
|
30033
30041
|
}
|
|
30042
|
+
function ensureMakerProjectBaseDirectories(targetDir) {
|
|
30043
|
+
for (const relativeDir of MAKER_PROJECT_BASE_DIRECTORIES) {
|
|
30044
|
+
fs7.mkdirSync(path8.join(targetDir, relativeDir), { recursive: true });
|
|
30045
|
+
}
|
|
30046
|
+
}
|
|
30034
30047
|
async function cloneMakerProject(options) {
|
|
30035
30048
|
var _a3, _b, _c, _d, _e, _f, _g, _h;
|
|
30036
30049
|
const target = path8.resolve(options.targetDir);
|
|
@@ -30103,6 +30116,7 @@ async function cloneMakerProject(options) {
|
|
|
30103
30116
|
user_id: options.userId || await resolveMakerProjectUserId(options),
|
|
30104
30117
|
sce_endpoint: options.sceEndpoint
|
|
30105
30118
|
});
|
|
30119
|
+
ensureMakerProjectBaseDirectories(target);
|
|
30106
30120
|
finalizeStagedDevKitGitignore(target);
|
|
30107
30121
|
(_e = options.onProgress) == null ? void 0 : _e.call(options, {
|
|
30108
30122
|
progress: 100,
|
|
@@ -30175,6 +30189,7 @@ async function cloneMakerProject(options) {
|
|
|
30175
30189
|
user_id: options.userId || await resolveMakerProjectUserId(options),
|
|
30176
30190
|
sce_endpoint: options.sceEndpoint
|
|
30177
30191
|
});
|
|
30192
|
+
ensureMakerProjectBaseDirectories(target);
|
|
30178
30193
|
(_h = options.onProgress) == null ? void 0 : _h.call(options, {
|
|
30179
30194
|
progress: 100,
|
|
30180
30195
|
total: 100,
|
|
@@ -34260,13 +34275,8 @@ function applyDefaults(config2) {
|
|
|
34260
34275
|
}
|
|
34261
34276
|
|
|
34262
34277
|
// src/maker/server/mcp.ts
|
|
34263
|
-
var VERSION = true ? "0.0.
|
|
34278
|
+
var VERSION = true ? "0.0.23-beta.1" : "dev";
|
|
34264
34279
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
34265
|
-
var ASYNC_BUILD_POLL_INTERVAL_MS = 5 * 1e3;
|
|
34266
|
-
var ASYNC_BUILD_TIMEOUT_MS = 30 * 60 * 1e3;
|
|
34267
|
-
var DEFAULT_REMOTE_ASYNC_BUILD_PARAM = "async";
|
|
34268
|
-
var DEFAULT_REMOTE_ASYNC_BUILD_QUERY_TOOL = "query_build";
|
|
34269
|
-
var DEFAULT_REMOTE_ASYNC_BUILD_QUERY_TASK_ID_PARAM = "build_id";
|
|
34270
34280
|
var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
34271
34281
|
var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
34272
34282
|
var PREVIEW_REFRESH_TIMEOUT_MS = 15 * 1e3;
|
|
@@ -34353,10 +34363,6 @@ var tools = [
|
|
|
34353
34363
|
type: "number",
|
|
34354
34364
|
description: "Optional remote build timeout in milliseconds. Defaults to 10 minutes. If timed out, do not retry blindly; inspect remote build logs first."
|
|
34355
34365
|
},
|
|
34356
|
-
async_build: {
|
|
34357
|
-
type: "boolean",
|
|
34358
|
-
description: "Async remote build preference. If true, Maker MCP forwards remote build async:true in any IDE. If false, it keeps synchronous remote build. If omitted, WorkBuddy defaults to async and other IDEs default to sync. For async builds, this tool keeps the current MCP call open, polls query_build(build_id) every 5 seconds, and returns only after success, failure, replacement by a newer build, or 30 minutes."
|
|
34359
|
-
},
|
|
34360
34366
|
message: {
|
|
34361
34367
|
type: "string",
|
|
34362
34368
|
description: "Optional commit message used when local changes or the empty wake-up commit need to be committed before build."
|
|
@@ -34675,7 +34681,6 @@ async function startMakerMcpServer() {
|
|
|
34675
34681
|
serverUrl: args.server_url,
|
|
34676
34682
|
env: args.env,
|
|
34677
34683
|
timeoutMs: args.timeout_ms,
|
|
34678
|
-
asyncBuild: args.async_build,
|
|
34679
34684
|
message: args.message,
|
|
34680
34685
|
files: args.files,
|
|
34681
34686
|
confirmRemoteBuildWithoutSubmit: args.confirm_remote_build_without_submit,
|
|
@@ -34844,8 +34849,6 @@ async function formatStatus(options = {}) {
|
|
|
34844
34849
|
"",
|
|
34845
34850
|
remoteSyncText,
|
|
34846
34851
|
"",
|
|
34847
|
-
identify.projectRoot ? formatAsyncBuildStatus(identify.projectRoot) : "",
|
|
34848
|
-
"",
|
|
34849
34852
|
identify.projectRoot ? await formatMakerProxyToolsStatusSafely({ targetDir: identify.projectRoot }) : "",
|
|
34850
34853
|
"",
|
|
34851
34854
|
formatAuthNextStep({ hasPat: Boolean(pat), isProjectBound: Boolean(identify.projectRoot) }),
|
|
@@ -34864,29 +34867,6 @@ async function formatStatus(options = {}) {
|
|
|
34864
34867
|
projectSection
|
|
34865
34868
|
].filter(Boolean).join("\n");
|
|
34866
34869
|
}
|
|
34867
|
-
function formatAsyncBuildStatus(projectRoot) {
|
|
34868
|
-
const active = readJsonFile2(getAsyncBuildWatcherPaths(projectRoot, "unused").activeFile);
|
|
34869
|
-
if (!(active == null ? void 0 : active.taskId)) {
|
|
34870
|
-
return ["Maker async build", "", "- status: inactive"].join("\n");
|
|
34871
|
-
}
|
|
34872
|
-
const stale = active.pid !== void 0 && active.pid !== process.pid;
|
|
34873
|
-
const state = active.stateFile ? readJsonFile2(active.stateFile) : void 0;
|
|
34874
|
-
return [
|
|
34875
|
-
"Maker async build",
|
|
34876
|
-
"",
|
|
34877
|
-
`- status: ${stale ? "stale" : "active"}`,
|
|
34878
|
-
`- build_id: ${active.taskId}`,
|
|
34879
|
-
active.reused !== void 0 ? `- reused: ${active.reused ? "yes" : "no"}` : "",
|
|
34880
|
-
active.pid ? `- watcher_pid: ${active.pid}` : "",
|
|
34881
|
-
stale ? "- note: active marker belongs to a previous MCP process; polling is not durable after restart" : "",
|
|
34882
|
-
active.stateFile ? `- state_file: ${active.stateFile}` : "",
|
|
34883
|
-
active.deadlineAt ? `- deadline_at: ${active.deadlineAt}` : "",
|
|
34884
|
-
(state == null ? void 0 : state.status) ? `- last_status: ${state.status}` : "",
|
|
34885
|
-
(state == null ? void 0 : state.updatedAt) ? `- updated_at: ${state.updatedAt}` : "",
|
|
34886
|
-
`- poll_interval_ms: ${ASYNC_BUILD_POLL_INTERVAL_MS}`,
|
|
34887
|
-
`- timeout_ms: ${ASYNC_BUILD_TIMEOUT_MS}`
|
|
34888
|
-
].filter(Boolean).join("\n");
|
|
34889
|
-
}
|
|
34890
34870
|
function formatAuthNextStep(options) {
|
|
34891
34871
|
if (options.hasPat) {
|
|
34892
34872
|
return "";
|
|
@@ -35558,7 +35538,6 @@ function formatDuration(ms) {
|
|
|
35558
35538
|
}
|
|
35559
35539
|
return `${minutes}m ${seconds}s`;
|
|
35560
35540
|
}
|
|
35561
|
-
var activeAsyncBuildWatchers = /* @__PURE__ */ new Map();
|
|
35562
35541
|
function formatMakerAppWebUrl(projectId, env) {
|
|
35563
35542
|
const makerEnv = env === "rnd" || env === "production" ? env : void 0;
|
|
35564
35543
|
const url2 = new URL(`${getMakerWebUrl(makerEnv)}/app/${encodeURIComponent(projectId)}`);
|
|
@@ -35610,22 +35589,6 @@ async function buildCurrentDirectory(options) {
|
|
|
35610
35589
|
buildFailure: toMakerBuildFailure(error2)
|
|
35611
35590
|
};
|
|
35612
35591
|
}
|
|
35613
|
-
if (buildResult.mode === "remote_build_async_started") {
|
|
35614
|
-
try {
|
|
35615
|
-
return {
|
|
35616
|
-
...await attachAndWaitAsyncBuildResult(buildResult, options),
|
|
35617
|
-
submitResult
|
|
35618
|
-
};
|
|
35619
|
-
} catch (error2) {
|
|
35620
|
-
return {
|
|
35621
|
-
mode: "build_failed_after_submit",
|
|
35622
|
-
projectRoot: localChanges.projectRoot,
|
|
35623
|
-
projectId: (config2 == null ? void 0 : config2.project_id) || "unknown",
|
|
35624
|
-
submitResult,
|
|
35625
|
-
buildFailure: toMakerBuildFailure(error2)
|
|
35626
|
-
};
|
|
35627
|
-
}
|
|
35628
|
-
}
|
|
35629
35592
|
return {
|
|
35630
35593
|
...buildResult,
|
|
35631
35594
|
submitResult
|
|
@@ -35633,9 +35596,6 @@ async function buildCurrentDirectory(options) {
|
|
|
35633
35596
|
}
|
|
35634
35597
|
try {
|
|
35635
35598
|
const buildResult = await runRemoteBuildCurrentDirectory(options, options.targetDir);
|
|
35636
|
-
if (buildResult.mode === "remote_build_async_started") {
|
|
35637
|
-
return await attachAndWaitAsyncBuildResult(buildResult, options);
|
|
35638
|
-
}
|
|
35639
35599
|
return buildResult;
|
|
35640
35600
|
} catch (error2) {
|
|
35641
35601
|
if (error2 instanceof RemoteBuildFailedError) {
|
|
@@ -35653,9 +35613,6 @@ async function buildCurrentDirectory(options) {
|
|
|
35653
35613
|
async function runRemoteBuildCurrentDirectory(options, targetDir) {
|
|
35654
35614
|
if (options.callRemoteBuild) {
|
|
35655
35615
|
const injectedResult = await options.callRemoteBuild(targetDir);
|
|
35656
|
-
if (injectedResult.mode === "remote_build_async_started") {
|
|
35657
|
-
return injectedResult;
|
|
35658
|
-
}
|
|
35659
35616
|
return attachBuildSuccessSideEffects(injectedResult, {
|
|
35660
35617
|
refreshPreview: options.refreshPreview || skipPreviewRefresh,
|
|
35661
35618
|
startRuntimeLogWatch: options.startRuntimeLogWatch
|
|
@@ -35667,7 +35624,6 @@ async function runRemoteBuildCurrentDirectory(options, targetDir) {
|
|
|
35667
35624
|
env: options.env
|
|
35668
35625
|
});
|
|
35669
35626
|
const buildArgs = createBuildArgs(proxy.projectRoot, options);
|
|
35670
|
-
const asyncBuildForwarded = shouldForwardAsyncBuild(options.asyncBuild);
|
|
35671
35627
|
const timeoutMs = options.timeoutMs || DEFAULT_BUILD_TIMEOUT_MS;
|
|
35672
35628
|
const result = await retryMakerProxyOperation(
|
|
35673
35629
|
async () => {
|
|
@@ -35739,36 +35695,14 @@ async function runRemoteBuildCurrentDirectory(options, targetDir) {
|
|
|
35739
35695
|
env: proxy.env,
|
|
35740
35696
|
timeoutMs,
|
|
35741
35697
|
buildArgs,
|
|
35742
|
-
resultText
|
|
35743
|
-
asyncBuild: asyncBuildForwarded
|
|
35698
|
+
resultText
|
|
35744
35699
|
});
|
|
35745
|
-
if (buildCallResult.mode === "remote_build_async_started") {
|
|
35746
|
-
return buildCallResult;
|
|
35747
|
-
}
|
|
35748
35700
|
return attachBuildSuccessSideEffects(buildCallResult, {
|
|
35749
35701
|
refreshPreview: options.refreshPreview,
|
|
35750
35702
|
startRuntimeLogWatch: options.startRuntimeLogWatch || startRuntimeLogWatch
|
|
35751
35703
|
});
|
|
35752
35704
|
}
|
|
35753
35705
|
function createRemoteBuildCallResult(options) {
|
|
35754
|
-
const asyncReceipt = options.asyncBuild ? extractAsyncBuildReceipt(options.resultText) : void 0;
|
|
35755
|
-
const taskId = asyncReceipt == null ? void 0 : asyncReceipt.taskId;
|
|
35756
|
-
if (taskId) {
|
|
35757
|
-
return {
|
|
35758
|
-
mode: "remote_build_async_started",
|
|
35759
|
-
projectRoot: options.projectRoot,
|
|
35760
|
-
projectId: options.projectId,
|
|
35761
|
-
projectPath: options.projectPath,
|
|
35762
|
-
serverUrl: options.serverUrl,
|
|
35763
|
-
env: options.env,
|
|
35764
|
-
makerUrl: formatMakerAppWebUrl(options.projectId, options.env),
|
|
35765
|
-
timeoutMs: options.timeoutMs,
|
|
35766
|
-
buildArgs: options.buildArgs,
|
|
35767
|
-
taskId,
|
|
35768
|
-
reused: asyncReceipt.reused,
|
|
35769
|
-
resultText: options.resultText
|
|
35770
|
-
};
|
|
35771
|
-
}
|
|
35772
35706
|
return {
|
|
35773
35707
|
mode: "remote_build",
|
|
35774
35708
|
projectRoot: options.projectRoot,
|
|
@@ -35782,174 +35716,6 @@ function createRemoteBuildCallResult(options) {
|
|
|
35782
35716
|
resultText: options.resultText
|
|
35783
35717
|
};
|
|
35784
35718
|
}
|
|
35785
|
-
function extractAsyncBuildReceipt(resultText) {
|
|
35786
|
-
const parsed = parseJsonObjectFromText(resultText);
|
|
35787
|
-
const taskId = (parsed == null ? void 0 : parsed.build_id) || (parsed == null ? void 0 : parsed.buildId) || (parsed == null ? void 0 : parsed.task_id) || (parsed == null ? void 0 : parsed.taskId) || (parsed == null ? void 0 : parsed.build_task_id) || (parsed == null ? void 0 : parsed.buildTaskId);
|
|
35788
|
-
if (typeof taskId !== "string" || !taskId.trim()) {
|
|
35789
|
-
return void 0;
|
|
35790
|
-
}
|
|
35791
|
-
return {
|
|
35792
|
-
taskId: taskId.trim(),
|
|
35793
|
-
...typeof (parsed == null ? void 0 : parsed.reused) === "boolean" ? { reused: parsed.reused } : {}
|
|
35794
|
-
};
|
|
35795
|
-
}
|
|
35796
|
-
function parseJsonObjectFromText(text) {
|
|
35797
|
-
const trimmed = text.trim();
|
|
35798
|
-
if (!trimmed) {
|
|
35799
|
-
return void 0;
|
|
35800
|
-
}
|
|
35801
|
-
try {
|
|
35802
|
-
const parsed = JSON.parse(trimmed);
|
|
35803
|
-
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : void 0;
|
|
35804
|
-
} catch {
|
|
35805
|
-
return void 0;
|
|
35806
|
-
}
|
|
35807
|
-
}
|
|
35808
|
-
function attachAsyncBuildWatcher(buildResult, options) {
|
|
35809
|
-
const remoteQueryRunner = options.queryAsyncBuildResult ? void 0 : createRemoteAsyncBuildQueryRunner(buildResult);
|
|
35810
|
-
const queryBuildResult = options.queryAsyncBuildResult || ((taskId) => (remoteQueryRunner == null ? void 0 : remoteQueryRunner.query(taskId)) || Promise.reject(new Error("Async build query runner is not available")));
|
|
35811
|
-
return {
|
|
35812
|
-
...buildResult,
|
|
35813
|
-
asyncBuildWatch: startAsyncBuildResultWatcher({
|
|
35814
|
-
projectRoot: buildResult.projectRoot,
|
|
35815
|
-
projectId: buildResult.projectId,
|
|
35816
|
-
projectPath: buildResult.projectPath,
|
|
35817
|
-
serverUrl: buildResult.serverUrl,
|
|
35818
|
-
env: buildResult.env,
|
|
35819
|
-
taskId: buildResult.taskId,
|
|
35820
|
-
reused: buildResult.reused,
|
|
35821
|
-
sourceBuildResult: buildResult,
|
|
35822
|
-
queryBuildResult: () => queryBuildResult(buildResult.taskId),
|
|
35823
|
-
refreshPreview: options.refreshPreview || refreshMakerPreview,
|
|
35824
|
-
startRuntimeLogWatch: options.startRuntimeLogWatch || startRuntimeLogWatch,
|
|
35825
|
-
pollIntervalMs: options.asyncBuildPollIntervalMs,
|
|
35826
|
-
onProgress: options.onProgress,
|
|
35827
|
-
onStop: () => remoteQueryRunner == null ? void 0 : remoteQueryRunner.close()
|
|
35828
|
-
})
|
|
35829
|
-
};
|
|
35830
|
-
}
|
|
35831
|
-
async function attachAndWaitAsyncBuildResult(buildResult, options) {
|
|
35832
|
-
var _a3, _b;
|
|
35833
|
-
const watched = attachAsyncBuildWatcher(buildResult, options);
|
|
35834
|
-
const activeFile = (_a3 = watched.asyncBuildWatch) == null ? void 0 : _a3.activeFile;
|
|
35835
|
-
const completion = activeFile ? (_b = activeAsyncBuildWatchers.get(activeFile)) == null ? void 0 : _b.completion : void 0;
|
|
35836
|
-
if (!completion) {
|
|
35837
|
-
throw new Error("Async build watcher did not start");
|
|
35838
|
-
}
|
|
35839
|
-
const finalState = await completion;
|
|
35840
|
-
const finalResult = asyncWatcherStateToRemoteBuildResult(finalState, buildResult);
|
|
35841
|
-
if (finalState.status === "succeeded") {
|
|
35842
|
-
return finalResult;
|
|
35843
|
-
}
|
|
35844
|
-
if (finalState.status === "failed") {
|
|
35845
|
-
throw new RemoteBuildFailedError(finalResult);
|
|
35846
|
-
}
|
|
35847
|
-
throw new Error(
|
|
35848
|
-
`Async Maker build did not finish successfully: ${finalState.status}${finalState.error ? `: ${formatAsyncBuildDiagnostic(finalState.error)}` : ""}`
|
|
35849
|
-
);
|
|
35850
|
-
}
|
|
35851
|
-
function formatAsyncBuildDiagnostic(value) {
|
|
35852
|
-
if (typeof value === "string") {
|
|
35853
|
-
return value;
|
|
35854
|
-
}
|
|
35855
|
-
try {
|
|
35856
|
-
return JSON.stringify(value);
|
|
35857
|
-
} catch {
|
|
35858
|
-
return String(value);
|
|
35859
|
-
}
|
|
35860
|
-
}
|
|
35861
|
-
function createRemoteAsyncBuildQueryRunner(buildResult) {
|
|
35862
|
-
var _a3, _b;
|
|
35863
|
-
const proxy = createRemoteProxyContext({
|
|
35864
|
-
targetDir: buildResult.projectRoot,
|
|
35865
|
-
serverUrl: buildResult.serverUrl,
|
|
35866
|
-
env: buildResult.env === "rnd" || buildResult.env === "production" ? buildResult.env : void 0
|
|
35867
|
-
});
|
|
35868
|
-
const queryToolName = ((_a3 = process.env.TAPTAP_MAKER_REMOTE_ASYNC_BUILD_QUERY_TOOL) == null ? void 0 : _a3.trim()) || DEFAULT_REMOTE_ASYNC_BUILD_QUERY_TOOL;
|
|
35869
|
-
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
|
-
const transport = trackMakerChildTransport(
|
|
35871
|
-
new HiddenStdioClientTransport({
|
|
35872
|
-
command: proxy.command,
|
|
35873
|
-
args: proxy.args,
|
|
35874
|
-
env: mergeStringEnv(process.env, proxy.envVars),
|
|
35875
|
-
stderr: "pipe"
|
|
35876
|
-
})
|
|
35877
|
-
);
|
|
35878
|
-
const client = new Client(
|
|
35879
|
-
{
|
|
35880
|
-
name: "taptap-maker-async-build-query-forwarder",
|
|
35881
|
-
version: VERSION
|
|
35882
|
-
},
|
|
35883
|
-
{
|
|
35884
|
-
capabilities: {}
|
|
35885
|
-
}
|
|
35886
|
-
);
|
|
35887
|
-
let connectPromise;
|
|
35888
|
-
const ensureConnected = async () => {
|
|
35889
|
-
if (!connectPromise) {
|
|
35890
|
-
connectPromise = client.connect(transport);
|
|
35891
|
-
}
|
|
35892
|
-
await connectPromise;
|
|
35893
|
-
};
|
|
35894
|
-
return {
|
|
35895
|
-
query: async (taskId) => {
|
|
35896
|
-
await ensureConnected();
|
|
35897
|
-
const result = await client.callTool(
|
|
35898
|
-
{
|
|
35899
|
-
name: queryToolName,
|
|
35900
|
-
arguments: { [taskIdParam]: taskId }
|
|
35901
|
-
},
|
|
35902
|
-
void 0,
|
|
35903
|
-
{
|
|
35904
|
-
timeout: DEFAULT_BUILD_TIMEOUT_MS
|
|
35905
|
-
}
|
|
35906
|
-
);
|
|
35907
|
-
return normalizeAsyncBuildQueryResult(result);
|
|
35908
|
-
},
|
|
35909
|
-
close: async () => {
|
|
35910
|
-
await client.close().catch(() => {
|
|
35911
|
-
});
|
|
35912
|
-
}
|
|
35913
|
-
};
|
|
35914
|
-
}
|
|
35915
|
-
function normalizeAsyncBuildQueryResult(result) {
|
|
35916
|
-
const resultText = formatRemoteToolResult(result);
|
|
35917
|
-
const parsed = parseJsonObjectFromText(resultText);
|
|
35918
|
-
const status = normalizeAsyncBuildStatus((parsed == null ? void 0 : parsed.status) || (parsed == null ? void 0 : parsed.state) || (parsed == null ? void 0 : parsed.phase));
|
|
35919
|
-
if (status) {
|
|
35920
|
-
return {
|
|
35921
|
-
status,
|
|
35922
|
-
resultText,
|
|
35923
|
-
result: parsed,
|
|
35924
|
-
error: parsed == null ? void 0 : parsed.error
|
|
35925
|
-
};
|
|
35926
|
-
}
|
|
35927
|
-
return {
|
|
35928
|
-
status: isRemoteToolError(result) ? "failed" : "running",
|
|
35929
|
-
resultText,
|
|
35930
|
-
result: parsed || result,
|
|
35931
|
-
...isRemoteToolError(result) ? { error: resultText } : {}
|
|
35932
|
-
};
|
|
35933
|
-
}
|
|
35934
|
-
function normalizeAsyncBuildStatus(status) {
|
|
35935
|
-
if (typeof status !== "string") {
|
|
35936
|
-
return void 0;
|
|
35937
|
-
}
|
|
35938
|
-
const normalized = status.trim().toLowerCase();
|
|
35939
|
-
if (["queued", "pending", "created"].includes(normalized)) {
|
|
35940
|
-
return "queued";
|
|
35941
|
-
}
|
|
35942
|
-
if (["running", "building", "in_progress", "processing"].includes(normalized)) {
|
|
35943
|
-
return "running";
|
|
35944
|
-
}
|
|
35945
|
-
if (["succeeded", "success", "done", "completed", "finished"].includes(normalized)) {
|
|
35946
|
-
return "succeeded";
|
|
35947
|
-
}
|
|
35948
|
-
if (["failed", "failure", "error", "cancelled", "canceled"].includes(normalized)) {
|
|
35949
|
-
return "failed";
|
|
35950
|
-
}
|
|
35951
|
-
return void 0;
|
|
35952
|
-
}
|
|
35953
35719
|
async function attachBuildSuccessSideEffects(buildResult, options) {
|
|
35954
35720
|
if (isRemoteBuildFailureResult(buildResult)) {
|
|
35955
35721
|
throw new RemoteBuildFailedError(buildResult);
|
|
@@ -36089,311 +35855,6 @@ async function startRuntimeLogWatch(buildResult) {
|
|
|
36089
35855
|
fs14.closeSync(errFd);
|
|
36090
35856
|
}
|
|
36091
35857
|
}
|
|
36092
|
-
function startAsyncBuildResultWatcher(options) {
|
|
36093
|
-
const pollIntervalMs = options.pollIntervalMs || ASYNC_BUILD_POLL_INTERVAL_MS;
|
|
36094
|
-
const timeoutMs = options.timeoutMs || ASYNC_BUILD_TIMEOUT_MS;
|
|
36095
|
-
const paths = getAsyncBuildWatcherPaths(options.projectRoot, options.taskId);
|
|
36096
|
-
const previous = stopExistingAsyncBuildResultWatcher(
|
|
36097
|
-
options.projectRoot,
|
|
36098
|
-
"cancelled_by_new_build"
|
|
36099
|
-
);
|
|
36100
|
-
const now = /* @__PURE__ */ new Date();
|
|
36101
|
-
const state = {
|
|
36102
|
-
mode: "remote_build_async",
|
|
36103
|
-
taskId: options.taskId,
|
|
36104
|
-
reused: options.reused,
|
|
36105
|
-
projectId: options.projectId,
|
|
36106
|
-
projectPath: options.projectPath,
|
|
36107
|
-
projectRoot: options.projectRoot,
|
|
36108
|
-
serverUrl: options.serverUrl,
|
|
36109
|
-
env: options.env,
|
|
36110
|
-
status: "queued",
|
|
36111
|
-
startedAt: now.toISOString(),
|
|
36112
|
-
updatedAt: now.toISOString(),
|
|
36113
|
-
deadlineAt: new Date(now.getTime() + timeoutMs).toISOString(),
|
|
36114
|
-
pollIntervalMs
|
|
36115
|
-
};
|
|
36116
|
-
let completeWatcher = () => {
|
|
36117
|
-
};
|
|
36118
|
-
const completion = new Promise((resolve) => {
|
|
36119
|
-
completeWatcher = resolve;
|
|
36120
|
-
});
|
|
36121
|
-
const watcher = {
|
|
36122
|
-
state,
|
|
36123
|
-
sourceBuildResult: options.sourceBuildResult,
|
|
36124
|
-
activeFile: paths.activeFile,
|
|
36125
|
-
stateFile: paths.stateFile,
|
|
36126
|
-
onStop: options.onStop,
|
|
36127
|
-
completion,
|
|
36128
|
-
complete: completeWatcher
|
|
36129
|
-
};
|
|
36130
|
-
fs14.mkdirSync(path15.dirname(paths.activeFile), { recursive: true });
|
|
36131
|
-
writeJsonFile2(paths.stateFile, state);
|
|
36132
|
-
writeJsonFile2(paths.activeFile, {
|
|
36133
|
-
taskId: options.taskId,
|
|
36134
|
-
reused: options.reused,
|
|
36135
|
-
projectId: options.projectId,
|
|
36136
|
-
pid: process.pid,
|
|
36137
|
-
startedAt: state.startedAt,
|
|
36138
|
-
deadlineAt: state.deadlineAt,
|
|
36139
|
-
stateFile: paths.stateFile
|
|
36140
|
-
});
|
|
36141
|
-
activeAsyncBuildWatchers.set(paths.activeFile, watcher);
|
|
36142
|
-
const poll = async () => {
|
|
36143
|
-
var _a3, _b, _c;
|
|
36144
|
-
if (!activeAsyncBuildWatchers.has(paths.activeFile)) {
|
|
36145
|
-
return;
|
|
36146
|
-
}
|
|
36147
|
-
try {
|
|
36148
|
-
const result = await options.queryBuildResult();
|
|
36149
|
-
updateAsyncBuildWatcherState(watcher, {
|
|
36150
|
-
status: result.status,
|
|
36151
|
-
resultText: result.resultText,
|
|
36152
|
-
result: result.result,
|
|
36153
|
-
error: result.error,
|
|
36154
|
-
lastPollError: void 0
|
|
36155
|
-
});
|
|
36156
|
-
emitAsyncBuildPollProgress(watcher, result, options.onProgress);
|
|
36157
|
-
if (result.status === "succeeded" || result.status === "failed") {
|
|
36158
|
-
if (result.status === "succeeded") {
|
|
36159
|
-
await finishAsyncBuildSuccessSideEffects(watcher, options);
|
|
36160
|
-
}
|
|
36161
|
-
stopAsyncBuildWatcherRuntime(watcher);
|
|
36162
|
-
(_a3 = watcher.complete) == null ? void 0 : _a3.call(watcher, watcher.state);
|
|
36163
|
-
return;
|
|
36164
|
-
}
|
|
36165
|
-
} catch (error2) {
|
|
36166
|
-
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
36167
|
-
if (isAsyncBuildExpiredErrorMessage(message)) {
|
|
36168
|
-
updateAsyncBuildWatcherState(watcher, {
|
|
36169
|
-
status: "expired",
|
|
36170
|
-
error: message,
|
|
36171
|
-
lastPollError: message
|
|
36172
|
-
});
|
|
36173
|
-
stopAsyncBuildWatcherRuntime(watcher);
|
|
36174
|
-
(_b = watcher.complete) == null ? void 0 : _b.call(watcher, watcher.state);
|
|
36175
|
-
return;
|
|
36176
|
-
}
|
|
36177
|
-
const nextStatus = "running";
|
|
36178
|
-
updateAsyncBuildWatcherState(watcher, {
|
|
36179
|
-
status: nextStatus,
|
|
36180
|
-
lastPollError: message
|
|
36181
|
-
});
|
|
36182
|
-
emitAsyncBuildPollProgress(
|
|
36183
|
-
watcher,
|
|
36184
|
-
{ status: nextStatus, error: message },
|
|
36185
|
-
options.onProgress
|
|
36186
|
-
);
|
|
36187
|
-
}
|
|
36188
|
-
if (Date.now() >= Date.parse(watcher.state.deadlineAt)) {
|
|
36189
|
-
updateAsyncBuildWatcherState(watcher, { status: "timeout" });
|
|
36190
|
-
stopAsyncBuildWatcherRuntime(watcher);
|
|
36191
|
-
(_c = watcher.complete) == null ? void 0 : _c.call(watcher, watcher.state);
|
|
36192
|
-
return;
|
|
36193
|
-
}
|
|
36194
|
-
watcher.timer = setTimeout(() => {
|
|
36195
|
-
void poll();
|
|
36196
|
-
}, pollIntervalMs);
|
|
36197
|
-
};
|
|
36198
|
-
watcher.timer = setTimeout(() => {
|
|
36199
|
-
void poll();
|
|
36200
|
-
}, pollIntervalMs);
|
|
36201
|
-
return {
|
|
36202
|
-
started: true,
|
|
36203
|
-
taskId: options.taskId,
|
|
36204
|
-
reused: options.reused,
|
|
36205
|
-
activeFile: paths.activeFile,
|
|
36206
|
-
stateFile: paths.stateFile,
|
|
36207
|
-
pollIntervalMs,
|
|
36208
|
-
timeoutMs,
|
|
36209
|
-
previousTaskId: previous.previousTaskId,
|
|
36210
|
-
previousStopped: previous.previousStopped
|
|
36211
|
-
};
|
|
36212
|
-
}
|
|
36213
|
-
function stopAsyncBuildWatcherRuntime(watcher) {
|
|
36214
|
-
var _a3;
|
|
36215
|
-
if (watcher.stopped) {
|
|
36216
|
-
return;
|
|
36217
|
-
}
|
|
36218
|
-
watcher.stopped = true;
|
|
36219
|
-
if (watcher.timer) {
|
|
36220
|
-
clearTimeout(watcher.timer);
|
|
36221
|
-
watcher.timer = void 0;
|
|
36222
|
-
}
|
|
36223
|
-
activeAsyncBuildWatchers.delete(watcher.activeFile);
|
|
36224
|
-
fs14.rmSync(watcher.activeFile, { force: true });
|
|
36225
|
-
void Promise.resolve((_a3 = watcher.onStop) == null ? void 0 : _a3.call(watcher)).catch((error2) => {
|
|
36226
|
-
updateAsyncBuildWatcherState(watcher, {
|
|
36227
|
-
sideEffectError: `async query runner close failed: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
36228
|
-
});
|
|
36229
|
-
});
|
|
36230
|
-
}
|
|
36231
|
-
function isAsyncBuildExpiredErrorMessage(message) {
|
|
36232
|
-
const normalized = message.trim().toLowerCase();
|
|
36233
|
-
return [
|
|
36234
|
-
"not found",
|
|
36235
|
-
"not_found",
|
|
36236
|
-
"not exist",
|
|
36237
|
-
"unknown build",
|
|
36238
|
-
"unknown build_id",
|
|
36239
|
-
"expired",
|
|
36240
|
-
"restart",
|
|
36241
|
-
"restarted",
|
|
36242
|
-
"未找到",
|
|
36243
|
-
"不存在",
|
|
36244
|
-
"过期",
|
|
36245
|
-
"服务重启"
|
|
36246
|
-
].some((pattern) => normalized.includes(pattern));
|
|
36247
|
-
}
|
|
36248
|
-
function emitAsyncBuildPollProgress(watcher, result, onProgress) {
|
|
36249
|
-
if (!onProgress) {
|
|
36250
|
-
return;
|
|
36251
|
-
}
|
|
36252
|
-
const payload = result.result && typeof result.result === "object" && !Array.isArray(result.result) ? result.result : {};
|
|
36253
|
-
const remoteProgress = typeof payload.progress === "number" ? payload.progress : void 0;
|
|
36254
|
-
const remotePhase = typeof payload.phase === "string" && payload.phase.trim() ? payload.phase.trim() : void 0;
|
|
36255
|
-
const elapsedSeconds = typeof payload.elapsed_seconds === "number" ? payload.elapsed_seconds : void 0;
|
|
36256
|
-
onProgress({
|
|
36257
|
-
progress: remoteProgress,
|
|
36258
|
-
total: remoteProgress === void 0 ? void 0 : 100,
|
|
36259
|
-
phase: "async_build_poll",
|
|
36260
|
-
message: [
|
|
36261
|
-
`build_id=${watcher.state.taskId}`,
|
|
36262
|
-
`status=${result.status}`,
|
|
36263
|
-
remotePhase ? `phase=${remotePhase}` : "",
|
|
36264
|
-
elapsedSeconds !== void 0 ? `elapsed=${elapsedSeconds}s` : "",
|
|
36265
|
-
result.error ? `error=${formatAsyncBuildDiagnostic(result.error)}` : ""
|
|
36266
|
-
].filter(Boolean).join(" ")
|
|
36267
|
-
});
|
|
36268
|
-
}
|
|
36269
|
-
function stopExistingAsyncBuildResultWatcher(projectRoot, reason = "cancelled") {
|
|
36270
|
-
var _a3;
|
|
36271
|
-
const activeFile = getAsyncBuildWatcherPaths(projectRoot, "unused").activeFile;
|
|
36272
|
-
const active = readJsonFile2(activeFile);
|
|
36273
|
-
const watcher = activeAsyncBuildWatchers.get(activeFile);
|
|
36274
|
-
if (!active && !watcher) {
|
|
36275
|
-
return {};
|
|
36276
|
-
}
|
|
36277
|
-
const stateFile = (active == null ? void 0 : active.stateFile) || (watcher == null ? void 0 : watcher.stateFile);
|
|
36278
|
-
const taskId = (active == null ? void 0 : active.taskId) || (watcher == null ? void 0 : watcher.state.taskId);
|
|
36279
|
-
if (stateFile && fs14.existsSync(stateFile)) {
|
|
36280
|
-
const existing = readJsonFile2(stateFile) || {};
|
|
36281
|
-
writeJsonFile2(stateFile, {
|
|
36282
|
-
...existing,
|
|
36283
|
-
status: reason,
|
|
36284
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
36285
|
-
});
|
|
36286
|
-
}
|
|
36287
|
-
if (watcher) {
|
|
36288
|
-
updateAsyncBuildWatcherState(watcher, {
|
|
36289
|
-
status: reason,
|
|
36290
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
36291
|
-
});
|
|
36292
|
-
stopAsyncBuildWatcherRuntime(watcher);
|
|
36293
|
-
(_a3 = watcher.complete) == null ? void 0 : _a3.call(watcher, watcher.state);
|
|
36294
|
-
} else {
|
|
36295
|
-
fs14.rmSync(activeFile, { force: true });
|
|
36296
|
-
}
|
|
36297
|
-
return {
|
|
36298
|
-
previousTaskId: taskId,
|
|
36299
|
-
previousStopped: Boolean(taskId)
|
|
36300
|
-
};
|
|
36301
|
-
}
|
|
36302
|
-
async function finishAsyncBuildSuccessSideEffects(watcher, options) {
|
|
36303
|
-
const buildResult = asyncWatcherStateToRemoteBuildResult(
|
|
36304
|
-
watcher.state,
|
|
36305
|
-
watcher.sourceBuildResult
|
|
36306
|
-
);
|
|
36307
|
-
if (options.refreshPreview) {
|
|
36308
|
-
try {
|
|
36309
|
-
updateAsyncBuildWatcherState(watcher, {
|
|
36310
|
-
previewRefresh: await options.refreshPreview(buildResult)
|
|
36311
|
-
});
|
|
36312
|
-
} catch (error2) {
|
|
36313
|
-
updateAsyncBuildWatcherState(watcher, {
|
|
36314
|
-
previewRefresh: {
|
|
36315
|
-
ok: false,
|
|
36316
|
-
status: 0,
|
|
36317
|
-
url: "",
|
|
36318
|
-
error: error2 instanceof Error ? error2.message : String(error2)
|
|
36319
|
-
}
|
|
36320
|
-
});
|
|
36321
|
-
}
|
|
36322
|
-
}
|
|
36323
|
-
if (options.startRuntimeLogWatch) {
|
|
36324
|
-
try {
|
|
36325
|
-
updateAsyncBuildWatcherState(watcher, {
|
|
36326
|
-
runtimeLogWatch: await options.startRuntimeLogWatch(buildResult)
|
|
36327
|
-
});
|
|
36328
|
-
} catch (error2) {
|
|
36329
|
-
updateAsyncBuildWatcherState(watcher, {
|
|
36330
|
-
runtimeLogWatch: {
|
|
36331
|
-
started: false,
|
|
36332
|
-
command: "",
|
|
36333
|
-
runtimeLog: "",
|
|
36334
|
-
error: error2 instanceof Error ? error2.message : String(error2)
|
|
36335
|
-
}
|
|
36336
|
-
});
|
|
36337
|
-
}
|
|
36338
|
-
}
|
|
36339
|
-
}
|
|
36340
|
-
function asyncWatcherStateToRemoteBuildResult(state, originalBuildResult) {
|
|
36341
|
-
return {
|
|
36342
|
-
mode: "remote_build",
|
|
36343
|
-
projectRoot: state.projectRoot,
|
|
36344
|
-
projectId: state.projectId,
|
|
36345
|
-
projectPath: state.projectPath,
|
|
36346
|
-
serverUrl: state.serverUrl,
|
|
36347
|
-
env: state.env,
|
|
36348
|
-
makerUrl: formatMakerAppWebUrl(state.projectId, state.env),
|
|
36349
|
-
timeoutMs: (originalBuildResult == null ? void 0 : originalBuildResult.timeoutMs) || DEFAULT_BUILD_TIMEOUT_MS,
|
|
36350
|
-
buildArgs: (originalBuildResult == null ? void 0 : originalBuildResult.buildArgs) || {},
|
|
36351
|
-
resultText: state.resultText || "",
|
|
36352
|
-
previewRefresh: state.previewRefresh,
|
|
36353
|
-
runtimeLogWatch: state.runtimeLogWatch
|
|
36354
|
-
};
|
|
36355
|
-
}
|
|
36356
|
-
function updateAsyncBuildWatcherState(watcher, patch) {
|
|
36357
|
-
watcher.state = {
|
|
36358
|
-
...watcher.state,
|
|
36359
|
-
...patch,
|
|
36360
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
36361
|
-
};
|
|
36362
|
-
writeJsonFile2(watcher.stateFile, watcher.state);
|
|
36363
|
-
}
|
|
36364
|
-
function getAsyncBuildWatcherPaths(projectRoot, taskId) {
|
|
36365
|
-
const normalizedProjectRoot = normalizeExistingProjectPath(projectRoot);
|
|
36366
|
-
const buildDir = path15.join(normalizedProjectRoot, ".maker", "builds");
|
|
36367
|
-
return {
|
|
36368
|
-
activeFile: path15.join(buildDir, "active-build.json"),
|
|
36369
|
-
stateFile: path15.join(buildDir, `${sanitizeAsyncBuildTaskId(taskId)}.json`)
|
|
36370
|
-
};
|
|
36371
|
-
}
|
|
36372
|
-
function normalizeExistingProjectPath(projectRoot) {
|
|
36373
|
-
try {
|
|
36374
|
-
return fs14.realpathSync(projectRoot);
|
|
36375
|
-
} catch {
|
|
36376
|
-
return path15.resolve(projectRoot);
|
|
36377
|
-
}
|
|
36378
|
-
}
|
|
36379
|
-
function sanitizeAsyncBuildTaskId(taskId) {
|
|
36380
|
-
return taskId.replace(/[^A-Za-z0-9_.-]/g, "_") || "unknown-task";
|
|
36381
|
-
}
|
|
36382
|
-
function writeJsonFile2(filePath, value) {
|
|
36383
|
-
fs14.mkdirSync(path15.dirname(filePath), { recursive: true });
|
|
36384
|
-
fs14.writeFileSync(filePath, `${JSON.stringify(value, null, 2)}
|
|
36385
|
-
`, "utf8");
|
|
36386
|
-
}
|
|
36387
|
-
function readJsonFile2(filePath) {
|
|
36388
|
-
if (!fs14.existsSync(filePath)) {
|
|
36389
|
-
return void 0;
|
|
36390
|
-
}
|
|
36391
|
-
try {
|
|
36392
|
-
return JSON.parse(fs14.readFileSync(filePath, "utf8"));
|
|
36393
|
-
} catch {
|
|
36394
|
-
return void 0;
|
|
36395
|
-
}
|
|
36396
|
-
}
|
|
36397
35858
|
function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
36398
35859
|
if (!fs14.existsSync(pidFile)) {
|
|
36399
35860
|
return {};
|
|
@@ -36695,41 +36156,8 @@ function createBuildArgs(projectRoot, options) {
|
|
|
36695
36156
|
} else if (!fs14.existsSync(path15.join(projectRoot, ".project", "settings.json"))) {
|
|
36696
36157
|
buildArgs.multiplayer = { enabled: false };
|
|
36697
36158
|
}
|
|
36698
|
-
if (shouldForwardAsyncBuild(options.asyncBuild, options.clientIde)) {
|
|
36699
|
-
buildArgs[getRemoteAsyncBuildParamName()] = getRemoteAsyncBuildParamValue();
|
|
36700
|
-
}
|
|
36701
36159
|
return buildArgs;
|
|
36702
36160
|
}
|
|
36703
|
-
function shouldForwardAsyncBuild(asyncBuild, clientIde) {
|
|
36704
|
-
if (asyncBuild === true) {
|
|
36705
|
-
return true;
|
|
36706
|
-
}
|
|
36707
|
-
if (asyncBuild === false) {
|
|
36708
|
-
return false;
|
|
36709
|
-
}
|
|
36710
|
-
return normalizeClientIde(clientIde || process.env.TAPTAP_MCP_CLIENT_IDE) === "workbuddy";
|
|
36711
|
-
}
|
|
36712
|
-
function normalizeClientIde(clientIde) {
|
|
36713
|
-
return (clientIde || "").trim().toLowerCase();
|
|
36714
|
-
}
|
|
36715
|
-
function getRemoteAsyncBuildParamName() {
|
|
36716
|
-
var _a3;
|
|
36717
|
-
const paramName = (_a3 = process.env.TAPTAP_MAKER_REMOTE_ASYNC_BUILD_PARAM) == null ? void 0 : _a3.trim();
|
|
36718
|
-
return paramName || DEFAULT_REMOTE_ASYNC_BUILD_PARAM;
|
|
36719
|
-
}
|
|
36720
|
-
function getRemoteAsyncBuildParamValue() {
|
|
36721
|
-
const rawValue = process.env.TAPTAP_MAKER_REMOTE_ASYNC_BUILD_VALUE_JSON;
|
|
36722
|
-
if (!rawValue) {
|
|
36723
|
-
return true;
|
|
36724
|
-
}
|
|
36725
|
-
try {
|
|
36726
|
-
return JSON.parse(rawValue);
|
|
36727
|
-
} catch (error2) {
|
|
36728
|
-
throw new Error(
|
|
36729
|
-
`Invalid TAPTAP_MAKER_REMOTE_ASYNC_BUILD_VALUE_JSON: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
36730
|
-
);
|
|
36731
|
-
}
|
|
36732
|
-
}
|
|
36733
36161
|
function mergeStringEnv(...sources) {
|
|
36734
36162
|
const result = {};
|
|
36735
36163
|
for (const source of sources) {
|
|
@@ -36760,7 +36188,6 @@ function formatRemoteToolResult(result) {
|
|
|
36760
36188
|
}).join("\n");
|
|
36761
36189
|
}
|
|
36762
36190
|
function formatBuildResult(result, progressSummary) {
|
|
36763
|
-
var _a3, _b;
|
|
36764
36191
|
if (result.mode === "remote_build_failed") {
|
|
36765
36192
|
return [
|
|
36766
36193
|
"✗ Remote Maker build failed",
|
|
@@ -36823,35 +36250,6 @@ function formatBuildResult(result, progressSummary) {
|
|
|
36823
36250
|
...formatMakerBuildFailureLines(result.buildFailure)
|
|
36824
36251
|
].filter(Boolean).join("\n");
|
|
36825
36252
|
}
|
|
36826
|
-
if (result.mode === "remote_build_async_started") {
|
|
36827
|
-
return [
|
|
36828
|
-
result.submitResult ? "✓ Maker project submitted, then remote Maker async build started" : "✓ Remote Maker async build started",
|
|
36829
|
-
"",
|
|
36830
|
-
`- project_root: ${result.projectRoot}`,
|
|
36831
|
-
`- project_id: ${result.projectId}`,
|
|
36832
|
-
`- maker_url: ${result.makerUrl || formatMakerAppWebUrl(result.projectId, result.env)}`,
|
|
36833
|
-
`- project_path: ${result.projectPath}`,
|
|
36834
|
-
`- server_url: ${result.serverUrl}`,
|
|
36835
|
-
`- env: ${result.env}`,
|
|
36836
|
-
`- build_id: ${result.taskId}`,
|
|
36837
|
-
result.reused !== void 0 ? `- reused: ${result.reused ? "yes" : "no"}` : "",
|
|
36838
|
-
`- timeout_ms: ${result.timeoutMs}`,
|
|
36839
|
-
`- build_args: ${JSON.stringify(result.buildArgs)}`,
|
|
36840
|
-
result.asyncBuildWatch ? `- async_watch_started: ${result.asyncBuildWatch.started ? "yes" : "no"}` : "",
|
|
36841
|
-
result.asyncBuildWatch ? `- async_watch_state_file: ${result.asyncBuildWatch.stateFile}` : "",
|
|
36842
|
-
result.asyncBuildWatch ? `- async_watch_active_file: ${result.asyncBuildWatch.activeFile}` : "",
|
|
36843
|
-
result.asyncBuildWatch ? `- async_watch_poll_interval_ms: ${result.asyncBuildWatch.pollIntervalMs}` : "",
|
|
36844
|
-
result.asyncBuildWatch ? `- async_watch_timeout_ms: ${result.asyncBuildWatch.timeoutMs}` : "",
|
|
36845
|
-
((_a3 = result.asyncBuildWatch) == null ? void 0 : _a3.previousTaskId) ? `- previous_async_build_id: ${result.asyncBuildWatch.previousTaskId}` : "",
|
|
36846
|
-
((_b = result.asyncBuildWatch) == null ? void 0 : _b.previousStopped) !== void 0 ? `- previous_async_watch_stopped: ${result.asyncBuildWatch.previousStopped ? "yes" : "no"}` : "",
|
|
36847
|
-
...formatProgressSummary(progressSummary),
|
|
36848
|
-
"",
|
|
36849
|
-
"note: 远端异步构建已启动;本地每 5 秒查询一次结果,最多轮询 30 分钟。",
|
|
36850
|
-
"note: 如果同一 Maker 项目再次触发构建,上一轮异步轮询会被取消。",
|
|
36851
|
-
"remote_result:",
|
|
36852
|
-
indent2(result.resultText)
|
|
36853
|
-
].filter(Boolean).join("\n");
|
|
36854
|
-
}
|
|
36855
36253
|
const submitLines = result.submitResult ? [
|
|
36856
36254
|
"submit_result:",
|
|
36857
36255
|
` - branch: ${result.submitResult.branch}`,
|
|
@@ -37260,7 +36658,7 @@ function formatError2(error2) {
|
|
|
37260
36658
|
}
|
|
37261
36659
|
|
|
37262
36660
|
// src/maker/cli/commands.ts
|
|
37263
|
-
var VERSION2 = true ? "0.0.
|
|
36661
|
+
var VERSION2 = true ? "0.0.23-beta.1" : "dev";
|
|
37264
36662
|
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
37265
36663
|
var MAKER_NPM_PACKAGE = "@taptap/maker";
|
|
37266
36664
|
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp", "agents"]);
|
|
@@ -37510,6 +36908,7 @@ async function runDoctor(parsed, ctx) {
|
|
|
37510
36908
|
const mcpToolsAvailability = inspectMakerMcpToolsAvailability({
|
|
37511
36909
|
makerProjectDir: identify.projectRoot
|
|
37512
36910
|
});
|
|
36911
|
+
const workBuddyTrust = shouldShowWorkBuddyTrustInspection() ? inspectWorkBuddyTrustState(DEFAULT_MCP_NAME) : void 0;
|
|
37513
36912
|
if (ctx.json) {
|
|
37514
36913
|
writeJson({
|
|
37515
36914
|
env,
|
|
@@ -37526,6 +36925,7 @@ async function runDoctor(parsed, ctx) {
|
|
|
37526
36925
|
dev_kit_update: devKitUpdate,
|
|
37527
36926
|
package_update: packageUpdate,
|
|
37528
36927
|
mcp_tools_availability: mcpToolsAvailability,
|
|
36928
|
+
...workBuddyTrust ? { workbuddy_trust: workBuddyTrust } : {},
|
|
37529
36929
|
orphan_process_check: orphanProcessCheck
|
|
37530
36930
|
});
|
|
37531
36931
|
return;
|
|
@@ -37565,6 +36965,7 @@ async function runDoctor(parsed, ctx) {
|
|
|
37565
36965
|
"",
|
|
37566
36966
|
formatMakerMcpToolsAvailability(mcpToolsAvailability),
|
|
37567
36967
|
"",
|
|
36968
|
+
workBuddyTrust ? formatWorkBuddyTrustInspection(workBuddyTrust) : "",
|
|
37568
36969
|
formatMakerOrphanProcessStatus(orphanProcessCheck),
|
|
37569
36970
|
"",
|
|
37570
36971
|
formatMakerSkillStatus({ projectRoot }),
|
|
@@ -38549,15 +37950,24 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
38549
37950
|
return [result];
|
|
38550
37951
|
}
|
|
38551
37952
|
if (ide === "workbuddy") {
|
|
38552
|
-
|
|
37953
|
+
const results = installJsonMcpConfigTargets(
|
|
38553
37954
|
ide,
|
|
38554
37955
|
getWorkBuddyMcpInstallPaths({ createPrimary: true }),
|
|
38555
37956
|
"WorkBuddy",
|
|
38556
37957
|
{
|
|
38557
37958
|
...options,
|
|
38558
|
-
clientIde: "workbuddy"
|
|
37959
|
+
clientIde: "workbuddy",
|
|
37960
|
+
disabled: false
|
|
38559
37961
|
}
|
|
38560
37962
|
);
|
|
37963
|
+
const trust = inspectWorkBuddyTrustState(options.mcpName);
|
|
37964
|
+
return results.map(
|
|
37965
|
+
(result) => result.ok ? {
|
|
37966
|
+
...result,
|
|
37967
|
+
message: `${result.message}
|
|
37968
|
+
${formatWorkBuddyTrustInspection(trust)}`
|
|
37969
|
+
} : result
|
|
37970
|
+
);
|
|
38561
37971
|
}
|
|
38562
37972
|
return [{ ide, ok: false, message: `Skipped unknown IDE: ${ide}` }];
|
|
38563
37973
|
}
|
|
@@ -38669,17 +38079,105 @@ function getTraeUnverifiedMcpConfigPaths() {
|
|
|
38669
38079
|
function getOpenCodeMcpConfigPath() {
|
|
38670
38080
|
return path16.join(os4.homedir(), ".config", "opencode", "opencode.jsonc");
|
|
38671
38081
|
}
|
|
38082
|
+
function getWorkBuddyHome() {
|
|
38083
|
+
return path16.join(os4.homedir(), ".workbuddy");
|
|
38084
|
+
}
|
|
38085
|
+
function shouldShowWorkBuddyTrustInspection() {
|
|
38086
|
+
return fs15.existsSync(getWorkBuddyHome());
|
|
38087
|
+
}
|
|
38672
38088
|
function getWorkBuddyMcpInstallPaths(options = {}) {
|
|
38673
|
-
const primary = path16.join(
|
|
38089
|
+
const primary = path16.join(getWorkBuddyHome(), "mcp.json");
|
|
38674
38090
|
if (fs15.existsSync(primary) || options.createPrimary) {
|
|
38675
38091
|
return [primary];
|
|
38676
38092
|
}
|
|
38677
|
-
const legacy = path16.join(
|
|
38093
|
+
const legacy = path16.join(getWorkBuddyHome(), ".mcp.json");
|
|
38678
38094
|
if (fs15.existsSync(legacy)) {
|
|
38679
38095
|
return [legacy];
|
|
38680
38096
|
}
|
|
38681
38097
|
return [];
|
|
38682
38098
|
}
|
|
38099
|
+
function inspectWorkBuddyTrustState(mcpName) {
|
|
38100
|
+
const workbuddyHome = getWorkBuddyHome();
|
|
38101
|
+
const connectorsDir = path16.join(workbuddyHome, "connectors");
|
|
38102
|
+
const accounts = [];
|
|
38103
|
+
const stateFiles = [];
|
|
38104
|
+
if (!fs15.existsSync(connectorsDir)) {
|
|
38105
|
+
return {
|
|
38106
|
+
status: "not_found",
|
|
38107
|
+
mcp_name: mcpName,
|
|
38108
|
+
workbuddy_home: workbuddyHome,
|
|
38109
|
+
connectors_dir: connectorsDir,
|
|
38110
|
+
state_files: [],
|
|
38111
|
+
accounts
|
|
38112
|
+
};
|
|
38113
|
+
}
|
|
38114
|
+
for (const entry of fs15.readdirSync(connectorsDir, { withFileTypes: true })) {
|
|
38115
|
+
if (!entry.isDirectory()) {
|
|
38116
|
+
continue;
|
|
38117
|
+
}
|
|
38118
|
+
const statePath = path16.join(connectorsDir, entry.name, "connector-states.json");
|
|
38119
|
+
if (!fs15.existsSync(statePath)) {
|
|
38120
|
+
continue;
|
|
38121
|
+
}
|
|
38122
|
+
stateFiles.push(statePath);
|
|
38123
|
+
let state;
|
|
38124
|
+
try {
|
|
38125
|
+
state = readJsonObject(statePath);
|
|
38126
|
+
} catch {
|
|
38127
|
+
continue;
|
|
38128
|
+
}
|
|
38129
|
+
accounts.push({
|
|
38130
|
+
account_id: entry.name,
|
|
38131
|
+
path: statePath,
|
|
38132
|
+
enabled: asStringArray(state.enabled).includes(mcpName),
|
|
38133
|
+
ever_connected: asStringArray(state.everConnected).includes(mcpName),
|
|
38134
|
+
user_disabled: asStringArray(state.userDisabled).includes(mcpName)
|
|
38135
|
+
});
|
|
38136
|
+
}
|
|
38137
|
+
const trusted = accounts.some((account) => account.enabled && !account.user_disabled);
|
|
38138
|
+
return {
|
|
38139
|
+
status: trusted ? "trusted" : stateFiles.length > 0 ? "pending" : "not_found",
|
|
38140
|
+
mcp_name: mcpName,
|
|
38141
|
+
workbuddy_home: workbuddyHome,
|
|
38142
|
+
connectors_dir: connectorsDir,
|
|
38143
|
+
state_files: stateFiles,
|
|
38144
|
+
accounts
|
|
38145
|
+
};
|
|
38146
|
+
}
|
|
38147
|
+
function asStringArray(value) {
|
|
38148
|
+
return Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
|
|
38149
|
+
}
|
|
38150
|
+
function formatWorkBuddyTrustInspection(inspection) {
|
|
38151
|
+
const lines = [
|
|
38152
|
+
"WorkBuddy MCP trust",
|
|
38153
|
+
`- config_server: ${inspection.mcp_name}`,
|
|
38154
|
+
'- config_requirement: mcp.json mcpServers entry must include "disabled": false.',
|
|
38155
|
+
`- trust_storage: ${getReadableWorkBuddyTrustPath()}`
|
|
38156
|
+
];
|
|
38157
|
+
if (inspection.status === "trusted") {
|
|
38158
|
+
const trustedAccounts = inspection.accounts.filter((account) => account.enabled && !account.user_disabled).map((account) => account.account_id);
|
|
38159
|
+
lines.push(`- status: trusted (${trustedAccounts.join(", ")})`);
|
|
38160
|
+
lines.push("- next_action: none");
|
|
38161
|
+
return lines.join("\n");
|
|
38162
|
+
}
|
|
38163
|
+
if (inspection.status === "pending") {
|
|
38164
|
+
lines.push("- status: pending_user_trust");
|
|
38165
|
+
lines.push(`- state_files: ${inspection.state_files.join(", ")}`);
|
|
38166
|
+
} else {
|
|
38167
|
+
lines.push("- status: trust_state_not_found");
|
|
38168
|
+
lines.push(`- checked: ${inspection.connectors_dir}`);
|
|
38169
|
+
}
|
|
38170
|
+
lines.push(
|
|
38171
|
+
`- expected_state: enabled includes "${inspection.mcp_name}" and userDisabled does not include it.`
|
|
38172
|
+
);
|
|
38173
|
+
lines.push(
|
|
38174
|
+
`- next_action: Open WorkBuddy MCP settings, enable/trust ${inspection.mcp_name}, then reconnect or restart WorkBuddy.`
|
|
38175
|
+
);
|
|
38176
|
+
return lines.join("\n");
|
|
38177
|
+
}
|
|
38178
|
+
function getReadableWorkBuddyTrustPath() {
|
|
38179
|
+
return process.platform === "win32" ? "%USERPROFILE%\\.workbuddy\\connectors\\<account-id>\\connector-states.json" : "~/.workbuddy/connectors/<account-id>/connector-states.json";
|
|
38180
|
+
}
|
|
38683
38181
|
function mergeJsonMcpConfig(configPath, options) {
|
|
38684
38182
|
const existing = readJsonObject(configPath);
|
|
38685
38183
|
const mcpServers = asObject(existing.mcpServers);
|
|
@@ -38822,7 +38320,8 @@ function createJsonMcpServerConfig(options) {
|
|
|
38822
38320
|
command: launch.command,
|
|
38823
38321
|
args: launch.args,
|
|
38824
38322
|
...options.cwd ? { cwd: options.cwd } : {},
|
|
38825
|
-
...createOptionalMcpEnvironment(options.env, "env", options.clientIde)
|
|
38323
|
+
...createOptionalMcpEnvironment(options.env, "env", options.clientIde),
|
|
38324
|
+
...options.disabled !== void 0 ? { disabled: options.disabled } : {}
|
|
38826
38325
|
};
|
|
38827
38326
|
}
|
|
38828
38327
|
function createOpenCodeMcpServerConfig(options) {
|
|
@@ -41547,9 +41046,6 @@ var TapTapMCPProxy = class {
|
|
|
41547
41046
|
if (!(error2 instanceof Error)) return false;
|
|
41548
41047
|
const errorMsg = error2.message.toLowerCase();
|
|
41549
41048
|
const errorCode = error2.code;
|
|
41550
|
-
if (this.isMcpApplicationError(error2)) {
|
|
41551
|
-
return false;
|
|
41552
|
-
}
|
|
41553
41049
|
const networkErrorCodes = [
|
|
41554
41050
|
"ECONNREFUSED",
|
|
41555
41051
|
// 连接拒绝
|
|
@@ -41571,6 +41067,12 @@ var TapTapMCPProxy = class {
|
|
|
41571
41067
|
if (errorCode && networkErrorCodes.includes(errorCode)) {
|
|
41572
41068
|
return true;
|
|
41573
41069
|
}
|
|
41070
|
+
if (errorMsg.includes("not connected") || this.isSessionInvalidError(error2)) {
|
|
41071
|
+
return true;
|
|
41072
|
+
}
|
|
41073
|
+
if (this.isMcpApplicationError(error2)) {
|
|
41074
|
+
return false;
|
|
41075
|
+
}
|
|
41574
41076
|
const networkErrorKeywords = [
|
|
41575
41077
|
"fetch failed",
|
|
41576
41078
|
"socket hang up",
|
|
@@ -41578,9 +41080,7 @@ var TapTapMCPProxy = class {
|
|
|
41578
41080
|
"connection refused",
|
|
41579
41081
|
"connection reset",
|
|
41580
41082
|
"timeout",
|
|
41581
|
-
"dns"
|
|
41582
|
-
"not connected"
|
|
41583
|
-
// 连接断开
|
|
41083
|
+
"dns"
|
|
41584
41084
|
];
|
|
41585
41085
|
if (networkErrorKeywords.some((keyword) => errorMsg.includes(keyword))) {
|
|
41586
41086
|
return true;
|