@taptap/maker 0.0.27 → 0.0.28-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 +402 -120
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/maker.js
CHANGED
|
@@ -36304,7 +36304,7 @@ function applyDefaults(config2) {
|
|
|
36304
36304
|
var MAKER_MCP_TRACKING_ACTION = "tapmaker_mcp_call";
|
|
36305
36305
|
var MAKER_MCP_TRACKING_SOURCE = "local_mcp";
|
|
36306
36306
|
var MAKER_MCP_TRACKING_TIMEOUT_MS = 1500;
|
|
36307
|
-
var MAKER_MCP_VERSION = "0.0.
|
|
36307
|
+
var MAKER_MCP_VERSION = "0.0.28-beta.1".trim() ? "0.0.28-beta.1".trim() : "dev";
|
|
36308
36308
|
var TRACKING_ERROR_MAX_LENGTH = 500;
|
|
36309
36309
|
function buildMakerMcpTrackingPayload(event) {
|
|
36310
36310
|
var _a3, _b, _c;
|
|
@@ -36406,8 +36406,218 @@ Do not build automatically just because local project configs are missing. Use
|
|
|
36406
36406
|
maker_build_current_directory only when the user explicitly requests build, submit, or preview.`;
|
|
36407
36407
|
}
|
|
36408
36408
|
|
|
36409
|
+
// src/maker/server/remoteProxyManager.ts
|
|
36410
|
+
import { createHash } from "node:crypto";
|
|
36411
|
+
function createContextKey(context) {
|
|
36412
|
+
const identity = JSON.stringify({
|
|
36413
|
+
projectRoot: context.projectRoot,
|
|
36414
|
+
serverUrl: context.serverUrl,
|
|
36415
|
+
env: context.env,
|
|
36416
|
+
userId: context.userId,
|
|
36417
|
+
projectId: context.projectId,
|
|
36418
|
+
projectPath: context.projectPath,
|
|
36419
|
+
command: context.command,
|
|
36420
|
+
args: context.args,
|
|
36421
|
+
proxyConfigJson: context.proxyConfigJson
|
|
36422
|
+
});
|
|
36423
|
+
return createHash("sha256").update(identity).digest("hex");
|
|
36424
|
+
}
|
|
36425
|
+
function mergeStringEnv(...sources) {
|
|
36426
|
+
const result = {};
|
|
36427
|
+
for (const source of sources) {
|
|
36428
|
+
for (const [key, value] of Object.entries(source || {})) {
|
|
36429
|
+
if (typeof value === "string") {
|
|
36430
|
+
result[key] = value;
|
|
36431
|
+
}
|
|
36432
|
+
}
|
|
36433
|
+
}
|
|
36434
|
+
return result;
|
|
36435
|
+
}
|
|
36436
|
+
function isConnectionClosedError(error2) {
|
|
36437
|
+
return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === ErrorCode.ConnectionClosed;
|
|
36438
|
+
}
|
|
36439
|
+
function createDefaultTransport(context) {
|
|
36440
|
+
return trackMakerChildTransport(
|
|
36441
|
+
new StdioClientTransport({
|
|
36442
|
+
command: context.command,
|
|
36443
|
+
args: context.args,
|
|
36444
|
+
env: mergeStringEnv(process.env, context.envVars),
|
|
36445
|
+
stderr: "pipe"
|
|
36446
|
+
})
|
|
36447
|
+
);
|
|
36448
|
+
}
|
|
36449
|
+
function createDefaultClient(_context, handlers) {
|
|
36450
|
+
return new Client(
|
|
36451
|
+
{ name: "taptap-maker-persistent-proxy", version: "dev" },
|
|
36452
|
+
{
|
|
36453
|
+
capabilities: {},
|
|
36454
|
+
listChanged: {
|
|
36455
|
+
tools: {
|
|
36456
|
+
onChanged: (error2, tools2) => {
|
|
36457
|
+
void handlers.onToolsChanged(error2, tools2);
|
|
36458
|
+
}
|
|
36459
|
+
}
|
|
36460
|
+
}
|
|
36461
|
+
}
|
|
36462
|
+
);
|
|
36463
|
+
}
|
|
36464
|
+
function createMakerRemoteProxyManager(options = {}) {
|
|
36465
|
+
const connections = /* @__PURE__ */ new Map();
|
|
36466
|
+
const retiredEntries = /* @__PURE__ */ new Set();
|
|
36467
|
+
const cachedTools = /* @__PURE__ */ new Map();
|
|
36468
|
+
const createClient = options.createClient || createDefaultClient;
|
|
36469
|
+
const createTransport = options.createTransport || createDefaultTransport;
|
|
36470
|
+
let closed = false;
|
|
36471
|
+
let closePromise;
|
|
36472
|
+
const closeEntry = (entry) => {
|
|
36473
|
+
if (connections.get(entry.key) === entry) {
|
|
36474
|
+
connections.delete(entry.key);
|
|
36475
|
+
}
|
|
36476
|
+
entry.retiring = true;
|
|
36477
|
+
if (entry.closePromise) {
|
|
36478
|
+
return entry.closePromise;
|
|
36479
|
+
}
|
|
36480
|
+
retiredEntries.add(entry);
|
|
36481
|
+
entry.closing = true;
|
|
36482
|
+
entry.closePromise = Promise.resolve().then(async () => await entry.client.close()).catch(() => {
|
|
36483
|
+
}).finally(() => {
|
|
36484
|
+
retiredEntries.delete(entry);
|
|
36485
|
+
});
|
|
36486
|
+
return entry.closePromise;
|
|
36487
|
+
};
|
|
36488
|
+
const retireEntry = (entry) => {
|
|
36489
|
+
if (connections.get(entry.key) === entry) {
|
|
36490
|
+
connections.delete(entry.key);
|
|
36491
|
+
}
|
|
36492
|
+
entry.retiring = true;
|
|
36493
|
+
retiredEntries.add(entry);
|
|
36494
|
+
if (entry.activeOperations > 0) {
|
|
36495
|
+
return;
|
|
36496
|
+
}
|
|
36497
|
+
void closeEntry(entry);
|
|
36498
|
+
};
|
|
36499
|
+
const releaseEntry = async (entry) => {
|
|
36500
|
+
entry.activeOperations = Math.max(0, entry.activeOperations - 1);
|
|
36501
|
+
if (entry.retiring && entry.activeOperations === 0) {
|
|
36502
|
+
await closeEntry(entry);
|
|
36503
|
+
}
|
|
36504
|
+
};
|
|
36505
|
+
const acquire = async (context) => {
|
|
36506
|
+
if (closed) {
|
|
36507
|
+
throw new Error("Maker remote proxy manager is closed.");
|
|
36508
|
+
}
|
|
36509
|
+
const key = createContextKey(context);
|
|
36510
|
+
const existing = connections.get(key);
|
|
36511
|
+
if (existing) {
|
|
36512
|
+
existing.lastUsedAt = Date.now();
|
|
36513
|
+
existing.activeOperations += 1;
|
|
36514
|
+
try {
|
|
36515
|
+
await existing.connectPromise;
|
|
36516
|
+
return existing;
|
|
36517
|
+
} catch (error2) {
|
|
36518
|
+
await releaseEntry(existing);
|
|
36519
|
+
throw error2;
|
|
36520
|
+
}
|
|
36521
|
+
}
|
|
36522
|
+
const staleProjectEntries = [...connections.entries()].filter(
|
|
36523
|
+
([entryKey, entry2]) => entryKey !== key && entry2.projectRoot === context.projectRoot
|
|
36524
|
+
);
|
|
36525
|
+
for (const [entryKey, entry2] of staleProjectEntries) {
|
|
36526
|
+
cachedTools.delete(entryKey);
|
|
36527
|
+
retireEntry(entry2);
|
|
36528
|
+
}
|
|
36529
|
+
const transport = createTransport(context);
|
|
36530
|
+
const handlers = {
|
|
36531
|
+
async onToolsChanged(error2, tools2) {
|
|
36532
|
+
var _a3, _b;
|
|
36533
|
+
if (error2 || !tools2 || ((_a3 = connections.get(key)) == null ? void 0 : _a3.client) !== client) {
|
|
36534
|
+
return;
|
|
36535
|
+
}
|
|
36536
|
+
const definitions = tools2;
|
|
36537
|
+
cachedTools.set(key, definitions);
|
|
36538
|
+
try {
|
|
36539
|
+
await ((_b = options.onToolsChanged) == null ? void 0 : _b.call(options, context, definitions));
|
|
36540
|
+
} catch {
|
|
36541
|
+
}
|
|
36542
|
+
}
|
|
36543
|
+
};
|
|
36544
|
+
const client = createClient(context, handlers);
|
|
36545
|
+
const entry = {
|
|
36546
|
+
key,
|
|
36547
|
+
projectRoot: context.projectRoot,
|
|
36548
|
+
client,
|
|
36549
|
+
transport,
|
|
36550
|
+
connectPromise: Promise.resolve(client),
|
|
36551
|
+
lastUsedAt: Date.now(),
|
|
36552
|
+
activeOperations: 1,
|
|
36553
|
+
retiring: false,
|
|
36554
|
+
closing: false
|
|
36555
|
+
};
|
|
36556
|
+
connections.set(key, entry);
|
|
36557
|
+
client.onclose = () => {
|
|
36558
|
+
if (!entry.closing && connections.get(key) === entry) {
|
|
36559
|
+
connections.delete(key);
|
|
36560
|
+
}
|
|
36561
|
+
};
|
|
36562
|
+
entry.connectPromise = client.connect(transport).then(() => client);
|
|
36563
|
+
try {
|
|
36564
|
+
await entry.connectPromise;
|
|
36565
|
+
return entry;
|
|
36566
|
+
} catch (error2) {
|
|
36567
|
+
entry.activeOperations -= 1;
|
|
36568
|
+
await closeEntry(entry);
|
|
36569
|
+
throw error2;
|
|
36570
|
+
}
|
|
36571
|
+
};
|
|
36572
|
+
const run = async (context, operation) => {
|
|
36573
|
+
const entry = await acquire(context);
|
|
36574
|
+
entry.lastUsedAt = Date.now();
|
|
36575
|
+
try {
|
|
36576
|
+
return await operation(entry.client);
|
|
36577
|
+
} catch (error2) {
|
|
36578
|
+
if (isConnectionClosedError(error2)) {
|
|
36579
|
+
await closeEntry(entry);
|
|
36580
|
+
}
|
|
36581
|
+
throw error2;
|
|
36582
|
+
} finally {
|
|
36583
|
+
await releaseEntry(entry);
|
|
36584
|
+
}
|
|
36585
|
+
};
|
|
36586
|
+
return {
|
|
36587
|
+
async listTools(context) {
|
|
36588
|
+
const key = createContextKey(context);
|
|
36589
|
+
const result = await run(context, async (client) => await client.listTools());
|
|
36590
|
+
const tools2 = result.tools;
|
|
36591
|
+
cachedTools.set(key, tools2);
|
|
36592
|
+
return tools2;
|
|
36593
|
+
},
|
|
36594
|
+
async callTool(context, request, requestOptions) {
|
|
36595
|
+
return await run(
|
|
36596
|
+
context,
|
|
36597
|
+
async (client) => await client.callTool(request, void 0, requestOptions)
|
|
36598
|
+
);
|
|
36599
|
+
},
|
|
36600
|
+
getCachedTools(context) {
|
|
36601
|
+
return cachedTools.get(createContextKey(context));
|
|
36602
|
+
},
|
|
36603
|
+
async closeAll() {
|
|
36604
|
+
if (closePromise) {
|
|
36605
|
+
return await closePromise;
|
|
36606
|
+
}
|
|
36607
|
+
closed = true;
|
|
36608
|
+
const entries = /* @__PURE__ */ new Set([...connections.values(), ...retiredEntries]);
|
|
36609
|
+
connections.clear();
|
|
36610
|
+
retiredEntries.clear();
|
|
36611
|
+
closePromise = Promise.allSettled(
|
|
36612
|
+
[...entries].map(async (entry) => await closeEntry(entry))
|
|
36613
|
+
).then(() => void 0);
|
|
36614
|
+
return await closePromise;
|
|
36615
|
+
}
|
|
36616
|
+
};
|
|
36617
|
+
}
|
|
36618
|
+
|
|
36409
36619
|
// src/maker/server/mcp.ts
|
|
36410
|
-
var VERSION = true ? "0.0.
|
|
36620
|
+
var VERSION = true ? "0.0.28-beta.1" : "dev";
|
|
36411
36621
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
36412
36622
|
var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
36413
36623
|
var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
@@ -36580,6 +36790,7 @@ var resources = [
|
|
|
36580
36790
|
}
|
|
36581
36791
|
];
|
|
36582
36792
|
async function listMakerTools(options) {
|
|
36793
|
+
var _a3;
|
|
36583
36794
|
let remoteTools = [];
|
|
36584
36795
|
try {
|
|
36585
36796
|
const context = await resolveMakerProjectContext({
|
|
@@ -36592,9 +36803,19 @@ async function listMakerTools(options) {
|
|
|
36592
36803
|
serverUrl: options.serverUrl,
|
|
36593
36804
|
env: options.env
|
|
36594
36805
|
}));
|
|
36595
|
-
|
|
36596
|
-
|
|
36597
|
-
|
|
36806
|
+
try {
|
|
36807
|
+
remoteTools = filterExposedRemoteProxyTools(await listedRemoteTools()).map(
|
|
36808
|
+
decorateRemoteProxyToolDefinition
|
|
36809
|
+
);
|
|
36810
|
+
} catch (error2) {
|
|
36811
|
+
const cachedTools = (_a3 = options.getCachedRemoteTools) == null ? void 0 : _a3.call(options);
|
|
36812
|
+
if (!cachedTools) {
|
|
36813
|
+
throw error2;
|
|
36814
|
+
}
|
|
36815
|
+
remoteTools = filterExposedRemoteProxyTools(cachedTools).map(
|
|
36816
|
+
decorateRemoteProxyToolDefinition
|
|
36817
|
+
);
|
|
36818
|
+
}
|
|
36598
36819
|
} catch (error2) {
|
|
36599
36820
|
if (isMakerProjectContextAmbiguousError(error2)) {
|
|
36600
36821
|
logLifecycleEvent("maker-tools-list-roots-ambiguous", String(error2));
|
|
@@ -36818,7 +37039,7 @@ async function listRemoteProxyTools(options) {
|
|
|
36818
37039
|
new StdioClientTransport({
|
|
36819
37040
|
command: proxy.command,
|
|
36820
37041
|
args: proxy.args,
|
|
36821
|
-
env:
|
|
37042
|
+
env: mergeStringEnv2(process.env, proxy.envVars),
|
|
36822
37043
|
stderr: "pipe"
|
|
36823
37044
|
})
|
|
36824
37045
|
);
|
|
@@ -36841,66 +37062,73 @@ async function listRemoteProxyTools(options) {
|
|
|
36841
37062
|
}
|
|
36842
37063
|
}
|
|
36843
37064
|
async function callRemoteProxyTool(options) {
|
|
36844
|
-
const
|
|
37065
|
+
const createProxy = () => createRemoteProxyContext({
|
|
36845
37066
|
targetDir: options.targetDir,
|
|
36846
37067
|
exposedTools: MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES
|
|
36847
37068
|
});
|
|
37069
|
+
let proxy = createProxy();
|
|
36848
37070
|
const finalArgs = await prepareRemoteProxyToolArgsAsync({
|
|
36849
37071
|
toolName: options.name,
|
|
36850
37072
|
targetDir: proxy.projectRoot,
|
|
36851
37073
|
args: options.args
|
|
36852
37074
|
});
|
|
36853
|
-
const
|
|
36854
|
-
|
|
36855
|
-
|
|
36856
|
-
|
|
36857
|
-
|
|
36858
|
-
|
|
36859
|
-
|
|
36860
|
-
|
|
36861
|
-
|
|
36862
|
-
|
|
36863
|
-
|
|
37075
|
+
const requestOptions = createRemoteProxyCallToolOptions(options.progressToken, options.extra);
|
|
37076
|
+
const callTool = options.manager ? async () => {
|
|
37077
|
+
proxy = createProxy();
|
|
37078
|
+
return await options.manager.callTool(
|
|
37079
|
+
proxy,
|
|
37080
|
+
{ name: options.name, arguments: finalArgs },
|
|
37081
|
+
requestOptions
|
|
37082
|
+
);
|
|
37083
|
+
} : async () => {
|
|
37084
|
+
const transport = trackMakerChildTransport(
|
|
37085
|
+
new StdioClientTransport({
|
|
37086
|
+
command: proxy.command,
|
|
37087
|
+
args: proxy.args,
|
|
37088
|
+
env: mergeStringEnv2(process.env, proxy.envVars),
|
|
37089
|
+
stderr: "pipe"
|
|
37090
|
+
})
|
|
37091
|
+
);
|
|
37092
|
+
const client = new Client(
|
|
37093
|
+
{
|
|
37094
|
+
name: "taptap-maker-tool-call-forwarder",
|
|
37095
|
+
version: VERSION
|
|
37096
|
+
},
|
|
37097
|
+
{
|
|
37098
|
+
capabilities: {}
|
|
37099
|
+
}
|
|
37100
|
+
);
|
|
37101
|
+
try {
|
|
37102
|
+
await client.connect(transport);
|
|
37103
|
+
return await client.callTool(
|
|
36864
37104
|
{
|
|
36865
|
-
name:
|
|
36866
|
-
|
|
37105
|
+
name: options.name,
|
|
37106
|
+
arguments: finalArgs
|
|
36867
37107
|
},
|
|
37108
|
+
void 0,
|
|
36868
37109
|
{
|
|
36869
|
-
|
|
37110
|
+
...requestOptions
|
|
36870
37111
|
}
|
|
36871
37112
|
);
|
|
36872
|
-
|
|
36873
|
-
|
|
36874
|
-
|
|
36875
|
-
{
|
|
36876
|
-
name: options.name,
|
|
36877
|
-
arguments: finalArgs
|
|
36878
|
-
},
|
|
36879
|
-
void 0,
|
|
36880
|
-
{
|
|
36881
|
-
...createRemoteProxyCallToolOptions(options.progressToken, options.extra)
|
|
36882
|
-
}
|
|
36883
|
-
);
|
|
36884
|
-
} finally {
|
|
36885
|
-
await client.close().catch(() => {
|
|
36886
|
-
});
|
|
36887
|
-
}
|
|
36888
|
-
},
|
|
36889
|
-
{
|
|
36890
|
-
onRetry: options.progressToken ? (event) => {
|
|
36891
|
-
options.extra.sendNotification({
|
|
36892
|
-
method: "notifications/progress",
|
|
36893
|
-
params: {
|
|
36894
|
-
progressToken: options.progressToken,
|
|
36895
|
-
progress: event.attempt,
|
|
36896
|
-
total: event.attempts,
|
|
36897
|
-
message: event.message
|
|
36898
|
-
}
|
|
36899
|
-
}).catch(() => {
|
|
36900
|
-
});
|
|
36901
|
-
} : void 0
|
|
37113
|
+
} finally {
|
|
37114
|
+
await client.close().catch(() => {
|
|
37115
|
+
});
|
|
36902
37116
|
}
|
|
36903
|
-
|
|
37117
|
+
};
|
|
37118
|
+
const result = await retryMakerProxyOperation(callTool, {
|
|
37119
|
+
onRetry: options.progressToken ? (event) => {
|
|
37120
|
+
options.extra.sendNotification({
|
|
37121
|
+
method: "notifications/progress",
|
|
37122
|
+
params: {
|
|
37123
|
+
progressToken: options.progressToken,
|
|
37124
|
+
progress: event.attempt,
|
|
37125
|
+
total: event.attempts,
|
|
37126
|
+
message: event.message
|
|
37127
|
+
}
|
|
37128
|
+
}).catch(() => {
|
|
37129
|
+
});
|
|
37130
|
+
} : void 0
|
|
37131
|
+
});
|
|
36904
37132
|
return await materializeRemoteProxyToolAssets({
|
|
36905
37133
|
toolName: options.name,
|
|
36906
37134
|
targetDir: proxy.projectRoot,
|
|
@@ -36954,18 +37182,46 @@ async function startMakerMcpServer() {
|
|
|
36954
37182
|
},
|
|
36955
37183
|
{
|
|
36956
37184
|
capabilities: {
|
|
36957
|
-
tools: {},
|
|
37185
|
+
tools: { listChanged: true },
|
|
36958
37186
|
resources: {}
|
|
36959
37187
|
},
|
|
36960
37188
|
instructions: MAKER_CAPABILITY_ROUTING_INDEX
|
|
36961
37189
|
}
|
|
36962
37190
|
);
|
|
36963
37191
|
const listClientRoots = createServerClientRootsProvider(server);
|
|
37192
|
+
const remoteProxyManager = createMakerRemoteProxyManager({
|
|
37193
|
+
onToolsChanged: async (_context, _definitions) => {
|
|
37194
|
+
try {
|
|
37195
|
+
await server.notification({
|
|
37196
|
+
method: "notifications/tools/list_changed",
|
|
37197
|
+
params: {}
|
|
37198
|
+
});
|
|
37199
|
+
} catch (error2) {
|
|
37200
|
+
logLifecycleEvent("maker-tools-list-changed-notification-failed", String(error2));
|
|
37201
|
+
}
|
|
37202
|
+
}
|
|
37203
|
+
});
|
|
36964
37204
|
const startupReportedProjects = /* @__PURE__ */ new Set();
|
|
36965
37205
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
36966
37206
|
const contextPromise = resolveMakerMcpTrackingContext({ listClientRoots });
|
|
36967
37207
|
void reportMakerMcpStartupFromPromise(contextPromise, startupReportedProjects);
|
|
36968
|
-
|
|
37208
|
+
let context;
|
|
37209
|
+
try {
|
|
37210
|
+
const resolved = await resolveMakerProjectContext({
|
|
37211
|
+
listClientRoots,
|
|
37212
|
+
allowFallbackOnAmbiguousRoots: false
|
|
37213
|
+
});
|
|
37214
|
+
context = createRemoteProxyContext({
|
|
37215
|
+
targetDir: resolved.targetDir,
|
|
37216
|
+
exposedTools: MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES
|
|
37217
|
+
});
|
|
37218
|
+
} catch {
|
|
37219
|
+
}
|
|
37220
|
+
return listMakerTools({
|
|
37221
|
+
listClientRoots,
|
|
37222
|
+
listRemoteTools: context ? () => remoteProxyManager.listTools(context) : void 0,
|
|
37223
|
+
getCachedRemoteTools: context ? () => remoteProxyManager.getCachedTools(context) : void 0
|
|
37224
|
+
});
|
|
36969
37225
|
});
|
|
36970
37226
|
server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
36971
37227
|
const contextPromise = resolveMakerMcpTrackingContext({ listClientRoots });
|
|
@@ -36986,7 +37242,7 @@ async function startMakerMcpServer() {
|
|
|
36986
37242
|
{
|
|
36987
37243
|
uri,
|
|
36988
37244
|
mimeType: "text/plain",
|
|
36989
|
-
text: uri === MAKER_ADS_INTEGRATION_GUIDE_URI ? formatMakerAdsIntegrationGuide() : await formatStatus({ listClientRoots })
|
|
37245
|
+
text: uri === MAKER_ADS_INTEGRATION_GUIDE_URI ? formatMakerAdsIntegrationGuide() : await formatStatus({ listClientRoots, remoteProxyManager })
|
|
36990
37246
|
}
|
|
36991
37247
|
]
|
|
36992
37248
|
};
|
|
@@ -37028,7 +37284,8 @@ async function startMakerMcpServer() {
|
|
|
37028
37284
|
text: await formatStatus({
|
|
37029
37285
|
targetDir: args.target_dir,
|
|
37030
37286
|
skipRemoteSync: args.skip_remote_sync,
|
|
37031
|
-
listClientRoots
|
|
37287
|
+
listClientRoots,
|
|
37288
|
+
remoteProxyManager
|
|
37032
37289
|
})
|
|
37033
37290
|
}
|
|
37034
37291
|
]
|
|
@@ -37067,6 +37324,7 @@ async function startMakerMcpServer() {
|
|
|
37067
37324
|
message: args.message,
|
|
37068
37325
|
files: args.files,
|
|
37069
37326
|
confirmRemoteBuildWithoutSubmit: args.confirm_remote_build_without_submit,
|
|
37327
|
+
remoteProxyManager,
|
|
37070
37328
|
onProgress: progressReporter.report
|
|
37071
37329
|
});
|
|
37072
37330
|
progressSummary = progressReporter.finish();
|
|
@@ -37142,7 +37400,8 @@ async function startMakerMcpServer() {
|
|
|
37142
37400
|
name,
|
|
37143
37401
|
args: remoteArgs,
|
|
37144
37402
|
progressToken: (_b = request.params._meta) == null ? void 0 : _b.progressToken,
|
|
37145
|
-
extra
|
|
37403
|
+
extra,
|
|
37404
|
+
manager: remoteProxyManager
|
|
37146
37405
|
});
|
|
37147
37406
|
void reportMakerMcpActivityFromPromise(contextPromise, {
|
|
37148
37407
|
toolName: name,
|
|
@@ -37175,7 +37434,7 @@ async function startMakerMcpServer() {
|
|
|
37175
37434
|
});
|
|
37176
37435
|
const transport = new StdioServerTransport();
|
|
37177
37436
|
await server.connect(transport);
|
|
37178
|
-
installMakerServerExitHandlers();
|
|
37437
|
+
installMakerServerExitHandlers(remoteProxyManager);
|
|
37179
37438
|
}
|
|
37180
37439
|
async function resolveMakerMcpTrackingContext(options) {
|
|
37181
37440
|
var _a3, _b;
|
|
@@ -37227,7 +37486,7 @@ async function reportMakerMcpStartupFromPromise(contextPromise, reportedProjects
|
|
|
37227
37486
|
}
|
|
37228
37487
|
}
|
|
37229
37488
|
var MAKER_SERVER_SHUTDOWN_TIMEOUT_MS = 3e3;
|
|
37230
|
-
function installMakerServerExitHandlers() {
|
|
37489
|
+
function installMakerServerExitHandlers(remoteProxyManager) {
|
|
37231
37490
|
let exiting = false;
|
|
37232
37491
|
const shutdown = async (source) => {
|
|
37233
37492
|
if (exiting) {
|
|
@@ -37240,7 +37499,13 @@ function installMakerServerExitHandlers() {
|
|
|
37240
37499
|
const timer = setTimeout(resolve, MAKER_SERVER_SHUTDOWN_TIMEOUT_MS);
|
|
37241
37500
|
(_a3 = timer.unref) == null ? void 0 : _a3.call(timer);
|
|
37242
37501
|
});
|
|
37243
|
-
await Promise.race([
|
|
37502
|
+
await Promise.race([
|
|
37503
|
+
Promise.allSettled([
|
|
37504
|
+
(remoteProxyManager == null ? void 0 : remoteProxyManager.closeAll()) || Promise.resolve(),
|
|
37505
|
+
closeTrackedMakerChildTransports()
|
|
37506
|
+
]).then(() => void 0),
|
|
37507
|
+
timeout
|
|
37508
|
+
]);
|
|
37244
37509
|
process.exit(0);
|
|
37245
37510
|
};
|
|
37246
37511
|
process.stdin.once("end", () => {
|
|
@@ -37346,7 +37611,10 @@ async function formatStatus(options = {}) {
|
|
|
37346
37611
|
"",
|
|
37347
37612
|
remoteSyncText,
|
|
37348
37613
|
"",
|
|
37349
|
-
identify.projectRoot ? await formatMakerProxyToolsStatusSafely({
|
|
37614
|
+
identify.projectRoot ? await formatMakerProxyToolsStatusSafely({
|
|
37615
|
+
targetDir: identify.projectRoot,
|
|
37616
|
+
remoteProxyManager: options.remoteProxyManager
|
|
37617
|
+
}) : "",
|
|
37350
37618
|
"",
|
|
37351
37619
|
formatAuthNextStep({ hasPat: Boolean(pat), isProjectBound: Boolean(identify.projectRoot) }),
|
|
37352
37620
|
"",
|
|
@@ -37426,7 +37694,12 @@ function formatMakerToolRegistrationCwdStatus(options) {
|
|
|
37426
37694
|
}
|
|
37427
37695
|
async function formatMakerProxyToolsStatusSafely(options) {
|
|
37428
37696
|
try {
|
|
37429
|
-
const listedRemoteTools = options.listRemoteTools ?? (() =>
|
|
37697
|
+
const listedRemoteTools = options.listRemoteTools ?? (options.remoteProxyManager ? async () => options.remoteProxyManager.listTools(
|
|
37698
|
+
createRemoteProxyContext({
|
|
37699
|
+
targetDir: options.targetDir,
|
|
37700
|
+
exposedTools: MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES
|
|
37701
|
+
})
|
|
37702
|
+
) : () => listRemoteProxyTools({
|
|
37430
37703
|
targetDir: options.targetDir
|
|
37431
37704
|
}));
|
|
37432
37705
|
const availableTools = filterExposedRemoteProxyTools(await listedRemoteTools()).map(
|
|
@@ -38193,71 +38466,80 @@ async function runRemoteBuildCurrentDirectory(options, targetDir) {
|
|
|
38193
38466
|
startRuntimeLogWatch: options.startRuntimeLogWatch
|
|
38194
38467
|
});
|
|
38195
38468
|
}
|
|
38196
|
-
const
|
|
38469
|
+
const createProxy = () => createRemoteProxyContext({
|
|
38197
38470
|
targetDir,
|
|
38198
38471
|
serverUrl: options.serverUrl,
|
|
38199
38472
|
env: options.env
|
|
38200
38473
|
});
|
|
38474
|
+
let proxy = createProxy();
|
|
38201
38475
|
const buildArgs = createBuildArgs(proxy.projectRoot, options);
|
|
38202
38476
|
const timeoutMs = options.timeoutMs || DEFAULT_BUILD_TIMEOUT_MS;
|
|
38203
|
-
const
|
|
38204
|
-
|
|
38205
|
-
|
|
38206
|
-
|
|
38207
|
-
|
|
38208
|
-
|
|
38209
|
-
|
|
38210
|
-
|
|
38211
|
-
|
|
38212
|
-
|
|
38213
|
-
|
|
38477
|
+
const requestOptions = {
|
|
38478
|
+
timeout: timeoutMs,
|
|
38479
|
+
resetTimeoutOnProgress: true,
|
|
38480
|
+
onprogress: (progress) => {
|
|
38481
|
+
var _a3;
|
|
38482
|
+
(_a3 = options.onProgress) == null ? void 0 : _a3.call(options, {
|
|
38483
|
+
progress: progress.progress,
|
|
38484
|
+
total: progress.total,
|
|
38485
|
+
phase: "remote_build",
|
|
38486
|
+
message: progress.message || "Remote Maker build progress"
|
|
38487
|
+
});
|
|
38488
|
+
}
|
|
38489
|
+
};
|
|
38490
|
+
const callBuild = options.remoteProxyManager ? async () => {
|
|
38491
|
+
proxy = createProxy();
|
|
38492
|
+
return await options.remoteProxyManager.callTool(
|
|
38493
|
+
proxy,
|
|
38494
|
+
{ name: "build", arguments: buildArgs },
|
|
38495
|
+
requestOptions
|
|
38496
|
+
);
|
|
38497
|
+
} : async () => {
|
|
38498
|
+
const transport = trackMakerChildTransport(
|
|
38499
|
+
new StdioClientTransport({
|
|
38500
|
+
command: proxy.command,
|
|
38501
|
+
args: proxy.args,
|
|
38502
|
+
env: mergeStringEnv2(process.env, proxy.envVars),
|
|
38503
|
+
stderr: "pipe"
|
|
38504
|
+
})
|
|
38505
|
+
);
|
|
38506
|
+
const client = new Client(
|
|
38507
|
+
{
|
|
38508
|
+
name: "taptap-maker-build-forwarder",
|
|
38509
|
+
version: VERSION
|
|
38510
|
+
},
|
|
38511
|
+
{
|
|
38512
|
+
capabilities: {}
|
|
38513
|
+
}
|
|
38514
|
+
);
|
|
38515
|
+
try {
|
|
38516
|
+
await client.connect(transport);
|
|
38517
|
+
return await client.callTool(
|
|
38214
38518
|
{
|
|
38215
|
-
name: "
|
|
38216
|
-
|
|
38519
|
+
name: "build",
|
|
38520
|
+
arguments: buildArgs
|
|
38217
38521
|
},
|
|
38522
|
+
void 0,
|
|
38218
38523
|
{
|
|
38219
|
-
|
|
38524
|
+
...requestOptions
|
|
38220
38525
|
}
|
|
38221
38526
|
);
|
|
38222
|
-
|
|
38223
|
-
|
|
38224
|
-
|
|
38225
|
-
{
|
|
38226
|
-
name: "build",
|
|
38227
|
-
arguments: buildArgs
|
|
38228
|
-
},
|
|
38229
|
-
void 0,
|
|
38230
|
-
{
|
|
38231
|
-
timeout: timeoutMs,
|
|
38232
|
-
resetTimeoutOnProgress: true,
|
|
38233
|
-
onprogress: (progress) => {
|
|
38234
|
-
var _a3;
|
|
38235
|
-
(_a3 = options.onProgress) == null ? void 0 : _a3.call(options, {
|
|
38236
|
-
progress: progress.progress,
|
|
38237
|
-
total: progress.total,
|
|
38238
|
-
phase: "remote_build",
|
|
38239
|
-
message: progress.message || "Remote Maker build progress"
|
|
38240
|
-
});
|
|
38241
|
-
}
|
|
38242
|
-
}
|
|
38243
|
-
);
|
|
38244
|
-
} finally {
|
|
38245
|
-
await client.close().catch(() => {
|
|
38246
|
-
});
|
|
38247
|
-
}
|
|
38248
|
-
},
|
|
38249
|
-
{
|
|
38250
|
-
onRetry: (event) => {
|
|
38251
|
-
var _a3;
|
|
38252
|
-
(_a3 = options.onProgress) == null ? void 0 : _a3.call(options, {
|
|
38253
|
-
progress: event.attempt,
|
|
38254
|
-
total: event.attempts,
|
|
38255
|
-
phase: "remote_build",
|
|
38256
|
-
message: event.message
|
|
38257
|
-
});
|
|
38258
|
-
}
|
|
38527
|
+
} finally {
|
|
38528
|
+
await client.close().catch(() => {
|
|
38529
|
+
});
|
|
38259
38530
|
}
|
|
38260
|
-
|
|
38531
|
+
};
|
|
38532
|
+
const result = await retryMakerProxyOperation(callBuild, {
|
|
38533
|
+
onRetry: (event) => {
|
|
38534
|
+
var _a3;
|
|
38535
|
+
(_a3 = options.onProgress) == null ? void 0 : _a3.call(options, {
|
|
38536
|
+
progress: event.attempt,
|
|
38537
|
+
total: event.attempts,
|
|
38538
|
+
phase: "remote_build",
|
|
38539
|
+
message: event.message
|
|
38540
|
+
});
|
|
38541
|
+
}
|
|
38542
|
+
});
|
|
38261
38543
|
if (isRemoteToolError(result)) {
|
|
38262
38544
|
throw new Error(formatRemoteToolResult(result));
|
|
38263
38545
|
}
|
|
@@ -38379,7 +38661,7 @@ async function startRuntimeLogWatch(buildResult) {
|
|
|
38379
38661
|
const child = spawn4(command.command, command.args, {
|
|
38380
38662
|
cwd: buildResult.projectRoot,
|
|
38381
38663
|
detached: true,
|
|
38382
|
-
env:
|
|
38664
|
+
env: mergeStringEnv2(process.env, { TAPTAP_MCP_ENV: buildResult.env }),
|
|
38383
38665
|
stdio: ["ignore", outFd, errFd],
|
|
38384
38666
|
windowsHide: true
|
|
38385
38667
|
});
|
|
@@ -38637,7 +38919,7 @@ function createRemoteRuntimeLogClient(proxy, timeoutMs = DEFAULT_TOOL_CALL_TIMEO
|
|
|
38637
38919
|
new HiddenStdioClientTransport({
|
|
38638
38920
|
command: proxy.command,
|
|
38639
38921
|
args: proxy.args,
|
|
38640
|
-
env:
|
|
38922
|
+
env: mergeStringEnv2(process.env, proxy.envVars),
|
|
38641
38923
|
stderr: "pipe"
|
|
38642
38924
|
})
|
|
38643
38925
|
));
|
|
@@ -38731,7 +39013,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
38731
39013
|
}
|
|
38732
39014
|
return buildArgs;
|
|
38733
39015
|
}
|
|
38734
|
-
function
|
|
39016
|
+
function mergeStringEnv2(...sources) {
|
|
38735
39017
|
const result = {};
|
|
38736
39018
|
for (const source of sources) {
|
|
38737
39019
|
if (!source) {
|
|
@@ -39472,7 +39754,7 @@ function uniqueStrings(values) {
|
|
|
39472
39754
|
}
|
|
39473
39755
|
|
|
39474
39756
|
// src/maker/cli/commands.ts
|
|
39475
|
-
var VERSION2 = true ? "0.0.
|
|
39757
|
+
var VERSION2 = true ? "0.0.28-beta.1" : "dev";
|
|
39476
39758
|
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
39477
39759
|
var MAKER_NPM_PACKAGE = "@taptap/maker";
|
|
39478
39760
|
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp", "agents"]);
|
|
@@ -43554,7 +43836,7 @@ var TapTapMCPProxy = class {
|
|
|
43554
43836
|
this.client = this.createClient();
|
|
43555
43837
|
this.server = new Server(
|
|
43556
43838
|
{ name: "taptap-proxy", version: "1.0.0" },
|
|
43557
|
-
{ capabilities: { tools: {}, resources: {} } }
|
|
43839
|
+
{ capabilities: { tools: { listChanged: true }, resources: {} } }
|
|
43558
43840
|
);
|
|
43559
43841
|
}
|
|
43560
43842
|
createClient() {
|