@stackwright-pro/mcp 0.2.0-alpha.97 → 0.2.0-alpha.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/integrity.js +15 -15
- package/dist/integrity.js.map +1 -1
- package/dist/integrity.mjs +15 -15
- package/dist/integrity.mjs.map +1 -1
- package/dist/pipeline-constants.js +1 -0
- package/dist/pipeline-constants.js.map +1 -1
- package/dist/pipeline-constants.mjs +1 -0
- package/dist/pipeline-constants.mjs.map +1 -1
- package/dist/server.js +151 -18
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +151 -18
- package/dist/server.mjs.map +1 -1
- package/package.json +4 -3
package/dist/server.mjs
CHANGED
|
@@ -2909,6 +2909,7 @@ function loadPipelineGraph() {
|
|
|
2909
2909
|
}
|
|
2910
2910
|
|
|
2911
2911
|
// src/tools/pipeline.ts
|
|
2912
|
+
import { emit } from "@stackwright-pro/telemetry";
|
|
2912
2913
|
var PHASE_ORDER = [
|
|
2913
2914
|
"designer",
|
|
2914
2915
|
"theme",
|
|
@@ -3123,6 +3124,28 @@ function handleSetPipelineState(input) {
|
|
|
3123
3124
|
}
|
|
3124
3125
|
}
|
|
3125
3126
|
writeState(cwd, state);
|
|
3127
|
+
try {
|
|
3128
|
+
const completedPhases = Object.entries(state.phases).filter(([, ps]) => ps.artifactWritten).map(([p]) => p);
|
|
3129
|
+
emit(
|
|
3130
|
+
{
|
|
3131
|
+
type: "pipeline_state_change",
|
|
3132
|
+
state: state.status,
|
|
3133
|
+
phases: { ready: [], completed: completedPhases, blocked: [] }
|
|
3134
|
+
},
|
|
3135
|
+
{ cwd }
|
|
3136
|
+
);
|
|
3137
|
+
if (input.field === "artifactWritten" && input.value === true && input.phase) {
|
|
3138
|
+
emit({ type: "phase_complete", phase: input.phase }, { cwd });
|
|
3139
|
+
}
|
|
3140
|
+
if (input.updates) {
|
|
3141
|
+
for (const update of input.updates) {
|
|
3142
|
+
if (update.field === "artifactWritten" && update.value === true) {
|
|
3143
|
+
emit({ type: "phase_complete", phase: update.phase }, { cwd });
|
|
3144
|
+
}
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
} catch {
|
|
3148
|
+
}
|
|
3126
3149
|
return { text: JSON.stringify(state), isError: false };
|
|
3127
3150
|
} catch (err) {
|
|
3128
3151
|
return { text: JSON.stringify({ error: true, message: String(err) }), isError: true };
|
|
@@ -3828,7 +3851,7 @@ var PHASE_ARTIFACT_SCHEMA = {
|
|
|
3828
3851
|
2
|
|
3829
3852
|
)
|
|
3830
3853
|
};
|
|
3831
|
-
function
|
|
3854
|
+
function _validateArtifactInner(input) {
|
|
3832
3855
|
const cwd = input._cwd ?? process.cwd();
|
|
3833
3856
|
const { phase, responseText, artifact: directArtifact } = input;
|
|
3834
3857
|
if (!isValidPhase2(phase)) {
|
|
@@ -4050,6 +4073,32 @@ function handleValidateArtifact(input) {
|
|
|
4050
4073
|
return { text: JSON.stringify({ error: true, phase, message }), isError: true };
|
|
4051
4074
|
}
|
|
4052
4075
|
}
|
|
4076
|
+
function handleValidateArtifact(input) {
|
|
4077
|
+
const cwd = input._cwd ?? process.cwd();
|
|
4078
|
+
const { phase } = input;
|
|
4079
|
+
emit(
|
|
4080
|
+
{ type: "tool_call", toolName: "stackwright_pro_validate_artifact", args: { phase }, phase },
|
|
4081
|
+
{ cwd }
|
|
4082
|
+
);
|
|
4083
|
+
const result = _validateArtifactInner(input);
|
|
4084
|
+
try {
|
|
4085
|
+
const parsed = JSON.parse(result.text);
|
|
4086
|
+
if (parsed.valid === true && parsed.artifactPath) {
|
|
4087
|
+
emit({ type: "file_write", path: parsed.artifactPath, phase }, { cwd });
|
|
4088
|
+
}
|
|
4089
|
+
emit(
|
|
4090
|
+
{
|
|
4091
|
+
type: "tool_complete",
|
|
4092
|
+
toolName: "stackwright_pro_validate_artifact",
|
|
4093
|
+
success: parsed.valid === true,
|
|
4094
|
+
phase
|
|
4095
|
+
},
|
|
4096
|
+
{ cwd }
|
|
4097
|
+
);
|
|
4098
|
+
} catch {
|
|
4099
|
+
}
|
|
4100
|
+
return result;
|
|
4101
|
+
}
|
|
4053
4102
|
function registerPipelineTools(server2) {
|
|
4054
4103
|
const DESC = "Writes state to .stackwright/ \u2014 the filesystem is the state machine.";
|
|
4055
4104
|
const res = (r) => ({
|
|
@@ -4186,12 +4235,70 @@ function registerPipelineTools(server2) {
|
|
|
4186
4235
|
return res(handleValidateArtifact({ phase, responseText: responseText ?? "" }));
|
|
4187
4236
|
}
|
|
4188
4237
|
);
|
|
4238
|
+
server2.tool(
|
|
4239
|
+
"stackwright_pro_emit_event",
|
|
4240
|
+
`Emit a telemetry event to .stackwright/pipeline-events.ndjson. Foreman calls this at phase boundaries and agent-invoke boundaries. Best-effort: failures are silent and never block. ${DESC}`,
|
|
4241
|
+
{
|
|
4242
|
+
type: z13.enum(["phase_start", "phase_complete", "agent_invoke_start", "agent_invoke_complete"]).describe("Event type to emit"),
|
|
4243
|
+
phase: z13.string().optional().describe("Current phase name"),
|
|
4244
|
+
targetOtter: z13.string().optional().describe("For agent_invoke_* events: which otter is being invoked"),
|
|
4245
|
+
success: z13.boolean().optional().describe("For agent_invoke_complete: did the invocation succeed?"),
|
|
4246
|
+
otter: z13.string().optional().describe('Which otter is emitting (defaults to "foreman")'),
|
|
4247
|
+
durationSec: z13.number().optional().describe("Duration in seconds (for *_complete events)")
|
|
4248
|
+
},
|
|
4249
|
+
async ({ type, phase, targetOtter, success, otter, durationSec }) => {
|
|
4250
|
+
let emitted = false;
|
|
4251
|
+
try {
|
|
4252
|
+
if (type === "phase_start") {
|
|
4253
|
+
if (!phase) {
|
|
4254
|
+
return res({
|
|
4255
|
+
text: JSON.stringify({ emitted: false, reason: "phase required for phase_start" }),
|
|
4256
|
+
isError: false
|
|
4257
|
+
});
|
|
4258
|
+
}
|
|
4259
|
+
emitted = emit({ type: "phase_start", phase, otter: otter ?? "foreman" });
|
|
4260
|
+
} else if (type === "phase_complete") {
|
|
4261
|
+
if (!phase) {
|
|
4262
|
+
return res({
|
|
4263
|
+
text: JSON.stringify({ emitted: false, reason: "phase required for phase_complete" }),
|
|
4264
|
+
isError: false
|
|
4265
|
+
});
|
|
4266
|
+
}
|
|
4267
|
+
emitted = emit({
|
|
4268
|
+
type: "phase_complete",
|
|
4269
|
+
phase,
|
|
4270
|
+
otter: otter ?? "foreman",
|
|
4271
|
+
...durationSec != null ? { durationSec } : {}
|
|
4272
|
+
});
|
|
4273
|
+
} else if (type === "agent_invoke_start") {
|
|
4274
|
+
emitted = emit({
|
|
4275
|
+
type: "agent_invoke_start",
|
|
4276
|
+
targetOtter: targetOtter ?? "",
|
|
4277
|
+
phase,
|
|
4278
|
+
otter: otter ?? "foreman"
|
|
4279
|
+
});
|
|
4280
|
+
} else if (type === "agent_invoke_complete") {
|
|
4281
|
+
emitted = emit({
|
|
4282
|
+
type: "agent_invoke_complete",
|
|
4283
|
+
targetOtter: targetOtter ?? "",
|
|
4284
|
+
success: success ?? true,
|
|
4285
|
+
phase,
|
|
4286
|
+
otter: otter ?? "foreman",
|
|
4287
|
+
...durationSec != null ? { durationSec } : {}
|
|
4288
|
+
});
|
|
4289
|
+
}
|
|
4290
|
+
} catch {
|
|
4291
|
+
}
|
|
4292
|
+
return res({ text: JSON.stringify({ emitted }), isError: false });
|
|
4293
|
+
}
|
|
4294
|
+
);
|
|
4189
4295
|
}
|
|
4190
4296
|
|
|
4191
4297
|
// src/tools/safe-write.ts
|
|
4192
4298
|
import { z as z14 } from "zod";
|
|
4193
4299
|
import { writeFileSync as writeFileSync5, readFileSync as readFileSync6, existsSync as existsSync6, mkdirSync as mkdirSync5, lstatSync as lstatSync7 } from "fs";
|
|
4194
4300
|
import { normalize, isAbsolute, dirname, join as join6 } from "path";
|
|
4301
|
+
import { emit as emit2 } from "@stackwright-pro/telemetry";
|
|
4195
4302
|
var OTTER_WRITE_ALLOWLISTS = {
|
|
4196
4303
|
"stackwright-pro-designer-otter": [
|
|
4197
4304
|
{ prefix: ".stackwright/artifacts/", suffix: ".json", description: "Design language artifact" }
|
|
@@ -4519,7 +4626,7 @@ function validateContent(filePath, content) {
|
|
|
4519
4626
|
if (filePath === ".env" || filePath.startsWith(".env")) return validateEnvContent(content);
|
|
4520
4627
|
return null;
|
|
4521
4628
|
}
|
|
4522
|
-
function
|
|
4629
|
+
function _safeWriteInner(input) {
|
|
4523
4630
|
const cwd = input._cwd ?? process.cwd();
|
|
4524
4631
|
const { callerOtter, filePath, content, createDirectories = true } = input;
|
|
4525
4632
|
const check = checkPathAllowed(callerOtter, filePath);
|
|
@@ -4627,6 +4734,31 @@ function handleSafeWrite(input) {
|
|
|
4627
4734
|
return { text: JSON.stringify(result), isError: true };
|
|
4628
4735
|
}
|
|
4629
4736
|
}
|
|
4737
|
+
function handleSafeWrite(input) {
|
|
4738
|
+
const cwd = input._cwd ?? process.cwd();
|
|
4739
|
+
const { filePath, callerOtter } = input;
|
|
4740
|
+
emit2(
|
|
4741
|
+
{ type: "tool_call", toolName: "stackwright_pro_safe_write", args: { callerOtter, filePath } },
|
|
4742
|
+
{ cwd }
|
|
4743
|
+
);
|
|
4744
|
+
const result = _safeWriteInner(input);
|
|
4745
|
+
try {
|
|
4746
|
+
const parsed = JSON.parse(result.text);
|
|
4747
|
+
if (parsed.success === true && parsed.path) {
|
|
4748
|
+
emit2({ type: "file_write", path: parsed.path, bytes: parsed.bytesWritten }, { cwd });
|
|
4749
|
+
}
|
|
4750
|
+
emit2(
|
|
4751
|
+
{
|
|
4752
|
+
type: "tool_complete",
|
|
4753
|
+
toolName: "stackwright_pro_safe_write",
|
|
4754
|
+
success: parsed.success === true
|
|
4755
|
+
},
|
|
4756
|
+
{ cwd }
|
|
4757
|
+
);
|
|
4758
|
+
} catch {
|
|
4759
|
+
}
|
|
4760
|
+
return result;
|
|
4761
|
+
}
|
|
4630
4762
|
function registerSafeWriteTools(server2) {
|
|
4631
4763
|
const DESC = "Controlled file-write chokepoint. Every write from specialist otters goes through this tool with per-otter path allowlists. The LLM cannot write to arbitrary filesystem paths.";
|
|
4632
4764
|
server2.tool(
|
|
@@ -5568,63 +5700,63 @@ import { join as join8, basename } from "path";
|
|
|
5568
5700
|
var _checksums = /* @__PURE__ */ new Map([
|
|
5569
5701
|
[
|
|
5570
5702
|
"stackwright-pro-api-otter.json",
|
|
5571
|
-
"
|
|
5703
|
+
"b3ad28c4404af9fb3c2cfce258c707dadd37bc59ac236e1f46d6163cd8d5dc9b"
|
|
5572
5704
|
],
|
|
5573
5705
|
[
|
|
5574
5706
|
"stackwright-pro-auth-otter.json",
|
|
5575
|
-
"
|
|
5707
|
+
"1a21d9f23e250f23291124307e5a2a32af5a716566319a3290372dae3d02e637"
|
|
5576
5708
|
],
|
|
5577
5709
|
[
|
|
5578
5710
|
"stackwright-pro-dashboard-otter.json",
|
|
5579
|
-
"
|
|
5711
|
+
"d9277616db5680ce3d598908fa3a1b0d0f626e33948785a4c64703b85e463b31"
|
|
5580
5712
|
],
|
|
5581
5713
|
[
|
|
5582
5714
|
"stackwright-pro-data-otter.json",
|
|
5583
|
-
"
|
|
5715
|
+
"536cba95f32667e81ae4b6335378a095f91095598defff0de00af231ebdbc488"
|
|
5584
5716
|
],
|
|
5585
5717
|
[
|
|
5586
5718
|
"stackwright-pro-designer-otter.json",
|
|
5587
|
-
"
|
|
5719
|
+
"69a6c09fbb54f971c48eae7fd52faa63cf79be2923e435aca9ff802e8d541d0f"
|
|
5588
5720
|
],
|
|
5589
5721
|
[
|
|
5590
5722
|
"stackwright-pro-domain-expert-otter.json",
|
|
5591
|
-
"
|
|
5723
|
+
"14d77cade020f44d1b5a2b406e2599501f3466ee90ca4248500a441d419bc59c"
|
|
5592
5724
|
],
|
|
5593
5725
|
[
|
|
5594
5726
|
"stackwright-pro-foreman-otter.json",
|
|
5595
|
-
"
|
|
5727
|
+
"4db4639e618cdd008d86c416bbc88bd4b2a7965e4bfcf01ec54b828f04ccb816"
|
|
5596
5728
|
],
|
|
5597
5729
|
[
|
|
5598
5730
|
"stackwright-pro-form-wizard-otter.json",
|
|
5599
|
-
"
|
|
5731
|
+
"7f6f94192f26face57dc8b2e22e0a49d23ceeeb356ca4ebde05492f1b25e3c47"
|
|
5600
5732
|
],
|
|
5601
5733
|
[
|
|
5602
5734
|
"stackwright-pro-geo-otter.json",
|
|
5603
|
-
"
|
|
5735
|
+
"15f2327b69f75a9c772c2acad5a5d6d3daefb7b55a079aca3205ecd4f33ae349"
|
|
5604
5736
|
],
|
|
5605
5737
|
[
|
|
5606
5738
|
"stackwright-pro-page-otter.json",
|
|
5607
|
-
"
|
|
5739
|
+
"c467c5d03b69d87fb1efa9482674a25e2f63782189db74b65309928d47456176"
|
|
5608
5740
|
],
|
|
5609
5741
|
[
|
|
5610
5742
|
"stackwright-pro-polish-otter.json",
|
|
5611
|
-
"
|
|
5743
|
+
"1cfea28e121e30181b0a7c8bda0700ffc892a6f919a0ec64996a4cf3f7735b51"
|
|
5612
5744
|
],
|
|
5613
5745
|
[
|
|
5614
5746
|
"stackwright-pro-qa-otter.json",
|
|
5615
|
-
"
|
|
5747
|
+
"822075893bb4f8496f3dca7b0e68eda460a6fbde87480c13c194582eb7744318"
|
|
5616
5748
|
],
|
|
5617
5749
|
[
|
|
5618
5750
|
"stackwright-pro-scaffold-otter.json",
|
|
5619
|
-
"
|
|
5751
|
+
"341d74ff2be24893ed174e869dc40c090f82e25e11d412d63519944512c37f15"
|
|
5620
5752
|
],
|
|
5621
5753
|
[
|
|
5622
5754
|
"stackwright-pro-theme-otter.json",
|
|
5623
|
-
"
|
|
5755
|
+
"b0eccc1945e30b80a0f9a3209c5428e8e32cd09063bd9b2ef7ecb891343774f2"
|
|
5624
5756
|
],
|
|
5625
5757
|
[
|
|
5626
5758
|
"stackwright-services-otter.json",
|
|
5627
|
-
"
|
|
5759
|
+
"8997bdd9a6fd3e6e02563578a1649480bc21acf919534ae41f73e70ade7cf500"
|
|
5628
5760
|
]
|
|
5629
5761
|
]);
|
|
5630
5762
|
Object.freeze(_checksums);
|
|
@@ -7072,6 +7204,7 @@ var package_default = {
|
|
|
7072
7204
|
"@stackwright-pro/cli-data-explorer": "workspace:*",
|
|
7073
7205
|
"@stackwright-pro/openapi": "workspace:*",
|
|
7074
7206
|
"@stackwright-pro/pulse": "workspace:*",
|
|
7207
|
+
"@stackwright-pro/telemetry": "workspace:*",
|
|
7075
7208
|
"@stackwright-pro/types": "workspace:*",
|
|
7076
7209
|
"@stackwright/mcp": "0.6.0-alpha.1",
|
|
7077
7210
|
"@types/js-yaml": "^4.0.9",
|
|
@@ -7093,7 +7226,7 @@ var package_default = {
|
|
|
7093
7226
|
"test:coverage": "vitest run --coverage"
|
|
7094
7227
|
},
|
|
7095
7228
|
name: "@stackwright-pro/mcp",
|
|
7096
|
-
version: "0.2.0-alpha.
|
|
7229
|
+
version: "0.2.0-alpha.98",
|
|
7097
7230
|
description: "MCP tools for Stackwright Pro - Data Explorer, Security, ISR, and Dashboard generation",
|
|
7098
7231
|
license: "SEE LICENSE IN LICENSE",
|
|
7099
7232
|
main: "./dist/server.js",
|