@schoolai/shipyard-mcp 0.2.2-next.482 → 0.2.2-next.483
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/apps/server/dist/index.js +35 -8
- package/package.json +1 -1
|
@@ -5075,6 +5075,7 @@ return { planId: plan.planId, snapshotUrl: result.snapshotUrl };
|
|
|
5075
5075
|
var ExecuteCodeInput = z12.object({
|
|
5076
5076
|
code: z12.string().describe("TypeScript code to execute")
|
|
5077
5077
|
});
|
|
5078
|
+
var scriptTracker = [];
|
|
5078
5079
|
async function createPlan(opts) {
|
|
5079
5080
|
const result = await createPlanTool.handler(opts);
|
|
5080
5081
|
const text = result.content[0]?.text || "";
|
|
@@ -5086,6 +5087,9 @@ async function createPlan(opts) {
|
|
|
5086
5087
|
deliverables = allDeliverables.map((d) => ({ id: d.id, text: d.text }));
|
|
5087
5088
|
}
|
|
5088
5089
|
const { script: monitoringScript } = await setupReviewNotification(planId, 30);
|
|
5090
|
+
scriptTracker.push(`Plan "${planId}" created.
|
|
5091
|
+
|
|
5092
|
+
${monitoringScript}`);
|
|
5089
5093
|
return {
|
|
5090
5094
|
planId,
|
|
5091
5095
|
sessionToken: text.match(/Session Token: (\S+)/)?.[1] || "",
|
|
@@ -5122,6 +5126,9 @@ async function readPlan(planId, sessionToken, opts) {
|
|
|
5122
5126
|
async function updatePlan(planId, sessionToken, updates) {
|
|
5123
5127
|
await updatePlanTool.handler({ planId, sessionToken, ...updates });
|
|
5124
5128
|
const { script: monitoringScript } = await setupReviewNotification(planId, 30);
|
|
5129
|
+
scriptTracker.push(`Plan "${planId}" updated.
|
|
5130
|
+
|
|
5131
|
+
${monitoringScript}`);
|
|
5125
5132
|
return {
|
|
5126
5133
|
success: true,
|
|
5127
5134
|
monitoringScript
|
|
@@ -5312,6 +5319,7 @@ var executeCodeTool = {
|
|
|
5312
5319
|
handler: async (args) => {
|
|
5313
5320
|
const { code } = ExecuteCodeInput.parse(args);
|
|
5314
5321
|
logger.info({ codeLength: code.length }, "Executing code");
|
|
5322
|
+
scriptTracker.length = 0;
|
|
5315
5323
|
try {
|
|
5316
5324
|
async function encodeVideo(opts) {
|
|
5317
5325
|
const fps = opts.fps || 6;
|
|
@@ -5376,14 +5384,33 @@ var executeCodeTool = {
|
|
|
5376
5384
|
const script = new vm.Script(wrappedCode);
|
|
5377
5385
|
const result = await script.runInContext(context, { timeout: 12e4 });
|
|
5378
5386
|
logger.info({ result }, "Code execution complete");
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
+
const content = [
|
|
5388
|
+
{
|
|
5389
|
+
type: "text",
|
|
5390
|
+
text: typeof result === "object" ? JSON.stringify(result, null, 2) : String(result ?? "Done")
|
|
5391
|
+
}
|
|
5392
|
+
];
|
|
5393
|
+
const latestScript = scriptTracker[scriptTracker.length - 1];
|
|
5394
|
+
if (latestScript) {
|
|
5395
|
+
const [planAction, ...scriptParts] = latestScript.split("\n\n");
|
|
5396
|
+
content.push({
|
|
5397
|
+
type: "text",
|
|
5398
|
+
text: `
|
|
5399
|
+
|
|
5400
|
+
---
|
|
5401
|
+
**\u26A0\uFE0F IMPORTANT FOR NON-HOOK AGENTS (Cursor, Devin, Windsurf, etc.):**
|
|
5402
|
+
|
|
5403
|
+
${planAction} To wait for human approval before proceeding, run this monitoring script in background:
|
|
5404
|
+
|
|
5405
|
+
\`\`\`bash
|
|
5406
|
+
${scriptParts.join("\n\n")}
|
|
5407
|
+
\`\`\`
|
|
5408
|
+
|
|
5409
|
+
Save the script to a file and run: \`bash script.sh &\`
|
|
5410
|
+
The script will exit when the human approves or requests changes.`
|
|
5411
|
+
});
|
|
5412
|
+
}
|
|
5413
|
+
return { content };
|
|
5387
5414
|
} catch (error) {
|
|
5388
5415
|
logger.error({ error, code }, "Code execution failed");
|
|
5389
5416
|
const message = error instanceof Error ? error.message : "Unknown error";
|