stageflow 0.42.0 → 0.46.0
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 +12 -3
- package/dist/agent/activity.d.ts +18 -0
- package/dist/agent/claudeAdapter.js +7 -0
- package/dist/agent/claudeTools.d.ts +27 -18
- package/dist/agent/claudeTools.js +54 -15
- package/dist/agent/compactionEvents.d.ts +34 -0
- package/dist/agent/compactionEvents.js +37 -0
- package/dist/agent/openRouterRouting.d.ts +7 -0
- package/dist/agent/openRouterRouting.js +23 -0
- package/dist/agent/piAdapter.d.ts +6 -0
- package/dist/agent/piAdapter.js +128 -27
- package/dist/agent/piSettings.d.ts +7 -0
- package/dist/agent/piSettings.js +9 -0
- package/dist/agent/sandboxPiTools.d.ts +3 -1
- package/dist/agent/sandboxPiTools.js +8 -2
- package/dist/agent/stageTurnDriver.d.ts +11 -2
- package/dist/agent/stageTurnDriver.js +45 -4
- package/dist/agent/toolOutputBudget.d.ts +15 -1
- package/dist/agent/toolOutputBudget.js +18 -0
- package/dist/agent/toolOutputBudgetExtension.d.ts +2 -0
- package/dist/agent/toolOutputBudgetExtension.js +40 -3
- package/dist/agents/authorChat.d.ts +1 -0
- package/dist/agents/authorChat.js +7 -0
- package/dist/agents/authorSessionStore.d.ts +3 -0
- package/dist/agents/authorSessionStore.js +17 -2
- package/dist/agents/evalGate.js +1 -0
- package/dist/agents/hostContext.d.ts +1 -1
- package/dist/agents/runtime/piRuntime.d.ts +5 -1
- package/dist/agents/runtime/piRuntime.js +46 -12
- package/dist/agents/service.js +3 -2
- package/dist/agents/sessions.js +3 -1
- package/dist/cli/evalCommand.d.ts +1 -1
- package/dist/cli/evalCommand.js +39 -2
- package/dist/cli/hostClient.d.ts +6 -0
- package/dist/cli/hostClient.js +4 -0
- package/dist/compaction/directives.d.ts +18 -0
- package/dist/compaction/directives.js +119 -0
- package/dist/compaction/extension.d.ts +20 -0
- package/dist/compaction/extension.js +78 -0
- package/dist/compaction/mask.d.ts +18 -0
- package/dist/compaction/mask.js +155 -0
- package/dist/compaction/pin.d.ts +21 -0
- package/dist/compaction/pin.js +270 -0
- package/dist/compaction/scrub.d.ts +7 -0
- package/dist/compaction/scrub.js +26 -0
- package/dist/compaction/sessionWiring.d.ts +22 -0
- package/dist/compaction/sessionWiring.js +26 -0
- package/dist/compaction/summarize.d.ts +79 -0
- package/dist/compaction/summarize.js +171 -0
- package/dist/compaction/toolPolicy.d.ts +3 -0
- package/dist/compaction/toolPolicy.js +33 -0
- package/dist/compaction/types.d.ts +45 -0
- package/dist/compaction/types.js +7 -0
- package/dist/compaction/workingState.d.ts +56 -0
- package/dist/compaction/workingState.js +198 -0
- package/dist/config/createPipeline.js +2 -0
- package/dist/config/createTrigger.js +7 -1
- package/dist/config/ensureCatalogScanRoot.d.ts +2 -0
- package/dist/config/ensureCatalogScanRoot.js +6 -0
- package/dist/config/evalCatalog.js +30 -2
- package/dist/config/githubTriggerAction.d.ts +8 -0
- package/dist/config/githubTriggerAction.js +29 -0
- package/dist/config/hostConfig.js +2 -0
- package/dist/config/loadEval.d.ts +3 -1
- package/dist/config/loadEval.js +96 -10
- package/dist/config/pipelineNeeds.d.ts +2 -0
- package/dist/config/pipelineNeeds.js +16 -3
- package/dist/config/pipelineRoute.js +5 -4
- package/dist/config/validateCatalog.d.ts +1 -1
- package/dist/config/validateCatalog.js +12 -0
- package/dist/config/validateEval.js +60 -3
- package/dist/config/writeEval.js +2 -2
- package/dist/envelope/assertEmittedArtifacts.d.ts +12 -0
- package/dist/envelope/assertEmittedArtifacts.js +43 -0
- package/dist/envelope/preEmitChecks.d.ts +3 -0
- package/dist/evals/calibration.d.ts +21 -0
- package/dist/evals/calibration.js +69 -0
- package/dist/evals/calibrationSuggest.d.ts +29 -0
- package/dist/evals/calibrationSuggest.js +72 -0
- package/dist/evals/calibrator.d.ts +46 -0
- package/dist/evals/calibrator.js +148 -0
- package/dist/evals/compare.d.ts +1 -1
- package/dist/evals/compare.js +3 -0
- package/dist/evals/constants.d.ts +7 -3
- package/dist/evals/constants.js +7 -1
- package/dist/evals/engine/FakeEngine.d.ts +2 -1
- package/dist/evals/engine/FakeEngine.js +9 -3
- package/dist/evals/engine/promptfoo/PromptfooEngine.d.ts +1 -1
- package/dist/evals/engine/promptfoo/PromptfooEngine.js +4 -2
- package/dist/evals/engine/promptfoo/generate.d.ts +3 -1
- package/dist/evals/engine/promptfoo/generate.js +43 -23
- package/dist/evals/engine/promptfoo/judgeProviders.js +2 -1
- package/dist/evals/engine/promptfoo/normalize.d.ts +4 -1
- package/dist/evals/engine/promptfoo/normalize.js +16 -3
- package/dist/evals/engine/promptfoo/rubricPrompt.d.ts +3 -1
- package/dist/evals/engine/promptfoo/rubricPrompt.js +15 -5
- package/dist/evals/errors.d.ts +7 -0
- package/dist/evals/errors.js +10 -0
- package/dist/evals/judgeProviders.d.ts +6 -0
- package/dist/evals/judgeProviders.js +14 -0
- package/dist/evals/judged.d.ts +7 -0
- package/dist/evals/judged.js +7 -0
- package/dist/evals/manager.d.ts +27 -8
- package/dist/evals/manager.js +73 -12
- package/dist/evals/plan.d.ts +10 -1
- package/dist/evals/plan.js +33 -13
- package/dist/evals/planInternalAgent.d.ts +19 -0
- package/dist/evals/planInternalAgent.js +201 -0
- package/dist/evals/read/api.d.ts +18 -0
- package/dist/evals/read/api.js +10 -1
- package/dist/evals/read/labelQueue.d.ts +45 -0
- package/dist/evals/read/labelQueue.js +83 -0
- package/dist/evals/read/list.js +10 -1
- package/dist/evals/read/runs.d.ts +5 -0
- package/dist/evals/read/runs.js +7 -1
- package/dist/evals/runner/caseRunner.d.ts +2 -1
- package/dist/evals/runner/caseRunner.js +16 -5
- package/dist/evals/runner/internalAgentCaseRunner.d.ts +6 -0
- package/dist/evals/runner/internalAgentCaseRunner.js +250 -0
- package/dist/evals/snapshot.d.ts +10 -2
- package/dist/evals/snapshot.js +8 -3
- package/dist/evals/stats.d.ts +40 -0
- package/dist/evals/stats.js +69 -0
- package/dist/evals/storeTypes.d.ts +42 -0
- package/dist/evals/types.d.ts +25 -2
- package/dist/evals/types.js +4 -1
- package/dist/evals/votes.d.ts +10 -0
- package/dist/evals/votes.js +60 -0
- package/dist/guide/cardContract.d.ts +133 -0
- package/dist/guide/cardContract.js +156 -0
- package/dist/guide/chat.d.ts +45 -0
- package/dist/guide/chat.js +378 -0
- package/dist/guide/knowledge/index.d.ts +14 -0
- package/dist/guide/knowledge/index.js +109 -0
- package/dist/guide/knowledge/topics/agents.d.ts +2 -0
- package/dist/guide/knowledge/topics/agents.js +58 -0
- package/dist/guide/knowledge/topics/bestPractices.d.ts +2 -0
- package/dist/guide/knowledge/topics/bestPractices.js +67 -0
- package/dist/guide/knowledge/topics/connections.d.ts +2 -0
- package/dist/guide/knowledge/topics/connections.js +66 -0
- package/dist/guide/knowledge/topics/consoleMap.d.ts +2 -0
- package/dist/guide/knowledge/topics/consoleMap.js +55 -0
- package/dist/guide/knowledge/topics/evals.d.ts +2 -0
- package/dist/guide/knowledge/topics/evals.js +72 -0
- package/dist/guide/knowledge/topics/limitations.d.ts +2 -0
- package/dist/guide/knowledge/topics/limitations.js +84 -0
- package/dist/guide/knowledge/topics/mcpSkillsBrowser.d.ts +2 -0
- package/dist/guide/knowledge/topics/mcpSkillsBrowser.js +57 -0
- package/dist/guide/knowledge/topics/memories.d.ts +2 -0
- package/dist/guide/knowledge/topics/memories.js +63 -0
- package/dist/guide/knowledge/topics/modelsAndProviders.d.ts +2 -0
- package/dist/guide/knowledge/topics/modelsAndProviders.js +56 -0
- package/dist/guide/knowledge/topics/overview.d.ts +2 -0
- package/dist/guide/knowledge/topics/overview.js +56 -0
- package/dist/guide/knowledge/topics/pipelines.d.ts +2 -0
- package/dist/guide/knowledge/topics/pipelines.js +93 -0
- package/dist/guide/knowledge/topics/stages.d.ts +2 -0
- package/dist/guide/knowledge/topics/stages.js +54 -0
- package/dist/guide/knowledge/topics/tasks.d.ts +2 -0
- package/dist/guide/knowledge/topics/tasks.js +52 -0
- package/dist/guide/knowledge/topics/triggers.d.ts +2 -0
- package/dist/guide/knowledge/topics/triggers.js +68 -0
- package/dist/guide/knowledge/topics/troubleshooting.d.ts +2 -0
- package/dist/guide/knowledge/topics/troubleshooting.js +85 -0
- package/dist/guide/knowledgeTools.d.ts +2 -0
- package/dist/guide/knowledgeTools.js +56 -0
- package/dist/guide/showUi.d.ts +6 -0
- package/dist/guide/showUi.js +546 -0
- package/dist/guide/threadStore.d.ts +48 -0
- package/dist/guide/threadStore.js +189 -0
- package/dist/guide/writeRoot.d.ts +11 -0
- package/dist/guide/writeRoot.js +70 -0
- package/dist/hosted/translate.js +2 -0
- package/dist/mcp/agentTools.js +12 -0
- package/dist/mcp/catalogTools.js +18 -20
- package/dist/mcp/catalogWriteTools.d.ts +8 -0
- package/dist/mcp/catalogWriteTools.js +225 -0
- package/dist/mcp/connectionTools.d.ts +3 -0
- package/dist/mcp/connectionTools.js +85 -0
- package/dist/mcp/controlTools.js +34 -1
- package/dist/mcp/deps.d.ts +9 -0
- package/dist/mcp/evalTools.js +723 -21
- package/dist/mcp/memoryHostTools.d.ts +3 -0
- package/dist/mcp/memoryHostTools.js +72 -0
- package/dist/mcp/pipelineAuthorTools.js +14 -1
- package/dist/mcp/server.js +5 -0
- package/dist/mcp/tools.js +6 -0
- package/dist/mcp/triggerTools.js +77 -31
- package/dist/operatorAgent/evalGate.d.ts +22 -0
- package/dist/operatorAgent/evalGate.js +77 -0
- package/dist/operatorAgent/fakeHost.js +10 -2
- package/dist/operatorAgent/host.js +18 -2
- package/dist/operatorAgent/index.d.ts +1 -0
- package/dist/operatorAgent/index.js +1 -0
- package/dist/operatorAgent/internalAgents.d.ts +11 -0
- package/dist/operatorAgent/internalAgents.js +13 -0
- package/dist/operatorAgent/piModel.d.ts +5 -1
- package/dist/operatorAgent/piModel.js +15 -10
- package/dist/operatorAgent/profiles/agentAuthor.js +66 -22
- package/dist/operatorAgent/profiles/agentAuthorPlaybook.d.ts +1 -1
- package/dist/operatorAgent/profiles/agentAuthorPlaybook.js +1 -1
- package/dist/operatorAgent/profiles/guideConfirm.d.ts +21 -0
- package/dist/operatorAgent/profiles/guideConfirm.js +100 -0
- package/dist/operatorAgent/profiles/guideTools.d.ts +7 -0
- package/dist/operatorAgent/profiles/guideTools.js +123 -0
- package/dist/operatorAgent/profiles/stageflowGuide.d.ts +7 -0
- package/dist/operatorAgent/profiles/stageflowGuide.js +133 -0
- package/dist/operatorAgent/profiles/workshopAuthor.js +23 -0
- package/dist/operatorAgent/profiles/workshopAuthorPlaybook.d.ts +1 -1
- package/dist/operatorAgent/profiles/workshopAuthorPlaybook.js +9 -1
- package/dist/operatorAgent/profiles/workshopAuthorTools.d.ts +2 -0
- package/dist/operatorAgent/profiles/workshopAuthorTools.js +197 -9
- package/dist/operatorAgent/types.d.ts +23 -0
- package/dist/package-meta.d.ts +1 -1
- package/dist/package-meta.js +1 -1
- package/dist/runstore/port.d.ts +13 -1
- package/dist/runstore/retention.d.ts +2 -1
- package/dist/runstore/retention.js +3 -7
- package/dist/runstore/runStatusClock.d.ts +17 -0
- package/dist/runstore/runStatusClock.js +19 -0
- package/dist/runstore/sqlite/SqliteRunStore.d.ts +11 -1
- package/dist/runstore/sqlite/SqliteRunStore.js +70 -45
- package/dist/runstore/sqlite/calibrationStore.d.ts +10 -0
- package/dist/runstore/sqlite/calibrationStore.js +106 -0
- package/dist/runstore/sqlite/evalStore.d.ts +5 -0
- package/dist/runstore/sqlite/evalStore.js +7 -0
- package/dist/runstore/sqlite/migrations/018-eval-grader-labels.d.ts +11 -0
- package/dist/runstore/sqlite/migrations/018-eval-grader-labels.js +43 -0
- package/dist/runstore/sqlite/migrations/index.js +2 -0
- package/dist/runstore/workspaceLayout.js +6 -1
- package/dist/runtime/artifactDiskInspect.d.ts +14 -0
- package/dist/runtime/artifactDiskInspect.js +52 -0
- package/dist/runtime/artifactPath.d.ts +24 -0
- package/dist/runtime/artifactPath.js +84 -0
- package/dist/runtime/completionCheckRunner.js +15 -43
- package/dist/runtime/githubPollSource.d.ts +22 -4
- package/dist/runtime/githubPollSource.js +93 -8
- package/dist/runtime/priorArtifactGrants.d.ts +8 -0
- package/dist/runtime/priorArtifactGrants.js +105 -0
- package/dist/runtime/runActionEligibility.d.ts +46 -0
- package/dist/runtime/runActionEligibility.js +123 -0
- package/dist/runtime/runManager.d.ts +4 -1
- package/dist/runtime/runManager.js +52 -10
- package/dist/runtime/runRetryCoordinator.d.ts +2 -14
- package/dist/runtime/runRetryCoordinator.js +3 -67
- package/dist/runtime/sandboxContainer.d.ts +7 -0
- package/dist/runtime/sandboxContainer.js +48 -6
- package/dist/runtime/sandboxDesk.d.ts +2 -1
- package/dist/runtime/sandboxDesk.js +11 -12
- package/dist/runtime/stageEnvironment.js +1 -0
- package/dist/runtime/stageRoots.d.ts +12 -0
- package/dist/runtime/stageSandbox.d.ts +2 -1
- package/dist/runtime/stageSandbox.js +18 -2
- package/dist/runtime/stageWorker.js +20 -0
- package/dist/server/agentAuthorRoutes.js +12 -3
- package/dist/server/bootstrap.d.ts +5 -0
- package/dist/server/bootstrap.js +14 -1
- package/dist/server/evalRoutes.js +251 -12
- package/dist/server/guideRoutes.d.ts +5 -0
- package/dist/server/guideRoutes.js +166 -0
- package/dist/server/http.d.ts +10 -0
- package/dist/server/http.js +35 -1
- package/dist/server/internalAgentRoutes.d.ts +6 -0
- package/dist/server/internalAgentRoutes.js +12 -0
- package/dist/server/mcpHost.js +2 -0
- package/dist/toolkit/meta.d.ts +1 -1
- package/dist/toolkit/meta.js +41 -1
- package/dist/toolkit/profiles.d.ts +5 -0
- package/dist/toolkit/profiles.js +12 -0
- package/dist/tools/askOperator.js +2 -1
- package/dist/tools/emitStageEnvelope.d.ts +17 -16
- package/dist/tools/emitStageEnvelope.js +46 -32
- package/dist/tools/stageToolNames.d.ts +4 -0
- package/dist/tools/stageToolNames.js +4 -0
- package/dist/tools/workingState.d.ts +40 -0
- package/dist/tools/workingState.js +108 -0
- package/dist/tools/writeStageArtifact.d.ts +0 -9
- package/dist/tools/writeStageArtifact.js +2 -1
- package/dist/ui/assets/{MarkdownText-BTrOqu5J.js → MarkdownText-BS2BBbCx.js} +2 -2
- package/dist/ui/assets/adapters-DPD-cAsy.js +17 -0
- package/dist/ui/assets/chat-BD1-VTT6.js +2 -0
- package/dist/ui/assets/chat-DXnQv9st.css +2 -0
- package/dist/ui/assets/main-AX5XNLtX.js +278 -0
- package/dist/ui/assets/{main-CHlmTNJe.css → main-CFX0_n8J.css} +1 -1
- package/dist/ui/chat.html +3 -4
- package/dist/ui/index.html +3 -4
- package/dist/workshop/chatTurn.js +1 -1
- package/dist/workshop/workshopPin.d.ts +3 -3
- package/dist/workshop/workshopPin.js +16 -15
- package/examples/compaction-stress/README.md +30 -0
- package/examples/compaction-stress/check-run.mjs +53 -0
- package/examples/compaction-stress/collect-evidence.yaml +60 -0
- package/examples/compaction-stress/compaction-stress.pipeline.yaml +141 -0
- package/examples/compaction-stress/compaction-stress.task.yaml +15 -0
- package/examples/compaction-stress/generate-evidence.mjs +110 -0
- package/examples/compaction-stress/root-cause.yaml +26 -0
- package/examples/compaction-stress/stageflow.yaml +9 -0
- package/examples/compaction-stress/write-postmortem.yaml +40 -0
- package/examples/evals/README.md +18 -0
- package/examples/evals/guide-behavior.dataset.jsonl +15 -0
- package/examples/evals/guide-behavior.eval.yaml +35 -0
- package/examples/evals/guide-depth.dataset.jsonl +35 -0
- package/examples/evals/guide-depth.eval.yaml +169 -0
- package/examples/memory/evals/guide-behavior.dataset.jsonl +15 -0
- package/examples/memory/evals/guide-behavior.eval.yaml +35 -0
- package/examples/memory/evals/guide-depth.dataset.jsonl +35 -0
- package/examples/memory/evals/guide-depth.eval.yaml +169 -0
- package/package.json +1 -1
- package/skills/stageflow/references/control-surface.md +1 -1
- package/skills/stageflow/references/evals.md +1 -0
- package/dist/ui/assets/AssistantRuntimeProvider-qIX1xNoH.js +0 -9
- package/dist/ui/assets/ReadonlyStore-BfXqHykm.js +0 -6
- package/dist/ui/assets/chat-Df_wCpak.js +0 -5
- package/dist/ui/assets/chat-P7KQznHm.css +0 -2
- package/dist/ui/assets/main-CvVfxmMd.js +0 -271
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ChannelError } from "../channels/errors.js";
|
|
3
|
+
import { textResult } from "./toolResults.js";
|
|
4
|
+
const secretValues = z
|
|
5
|
+
.record(z.string(), z.string())
|
|
6
|
+
.describe("Provider field name to secret value. Values are stored and never returned.");
|
|
7
|
+
const configValues = z.record(z.string(), z.unknown()).describe("Non-secret provider settings.");
|
|
8
|
+
const credentialInput = z.union([
|
|
9
|
+
z.string().describe("Id of a credential that already exists."),
|
|
10
|
+
z.object({
|
|
11
|
+
id: z.string().optional().describe("Id for a new credential. The host chooses one when omitted."),
|
|
12
|
+
secrets: secretValues,
|
|
13
|
+
}),
|
|
14
|
+
]).describe("Credential id, or a new credential to store with this connection.");
|
|
15
|
+
const createSchema = z.object({
|
|
16
|
+
provider: z.string().describe("Provider id."),
|
|
17
|
+
id: z.string().optional().describe("Connection id. The host chooses one when omitted."),
|
|
18
|
+
displayName: z.string().optional().describe("Label shown for the connection."),
|
|
19
|
+
config: configValues.optional(),
|
|
20
|
+
secrets: secretValues.optional(),
|
|
21
|
+
credential: credentialInput.optional(),
|
|
22
|
+
}).strict();
|
|
23
|
+
const updateSchema = z.object({
|
|
24
|
+
id: z.string().describe("Connection id."),
|
|
25
|
+
enabled: z.boolean().optional().describe("Whether stages may use this connection."),
|
|
26
|
+
displayName: z.string().nullable().optional().describe("Replacement label, or null to clear it."),
|
|
27
|
+
config: configValues.optional(),
|
|
28
|
+
secrets: secretValues.optional().describe("Secret fields to replace. Omitted fields are left unchanged."),
|
|
29
|
+
}).strict();
|
|
30
|
+
const targetValue = z.union([z.string(), z.number().int()]);
|
|
31
|
+
const validateSchema = z.object({
|
|
32
|
+
id: z.string().describe("Connection id."),
|
|
33
|
+
to: z.union([targetValue, z.array(targetValue).min(1)]).describe("Pinned recipient."),
|
|
34
|
+
cc: z.array(targetValue).min(1).optional().describe("Copied recipients, when the provider allows them."),
|
|
35
|
+
template: z.record(z.string(), z.unknown()).optional().describe("Provider template fields, when required."),
|
|
36
|
+
}).strict();
|
|
37
|
+
function jsonBody(value) {
|
|
38
|
+
return Object.fromEntries(Object.entries(value).filter((entry) => entry[1] !== undefined));
|
|
39
|
+
}
|
|
40
|
+
export function registerConnectionTools(server, deps) {
|
|
41
|
+
const run = async (work) => {
|
|
42
|
+
const channels = deps.channels;
|
|
43
|
+
if (channels === undefined)
|
|
44
|
+
return textResult({ error: "CHANNELS_UNAVAILABLE" }, true);
|
|
45
|
+
try {
|
|
46
|
+
return textResult(await work(channels));
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
const code = error instanceof ChannelError ? error.code : "CHANNEL_STORAGE_FAILED";
|
|
50
|
+
return textResult({ error: code }, true);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
server.registerTool("list_connections", {
|
|
54
|
+
description: "List host connections, same as GET /api/connections. Read-only. Each secret field is \"env\" or \"store\", never the secret value.",
|
|
55
|
+
inputSchema: z.object({}),
|
|
56
|
+
annotations: { readOnlyHint: true },
|
|
57
|
+
}, async () => run((service) => service.list()));
|
|
58
|
+
server.registerTool("create_connection", {
|
|
59
|
+
description: "Create a host connection, same as POST /api/connections. Returns { id, health }. Secret values are stored and are not in the result.",
|
|
60
|
+
inputSchema: createSchema,
|
|
61
|
+
}, async (input) => run((service) => service.create(jsonBody(input))));
|
|
62
|
+
server.registerTool("update_connection", {
|
|
63
|
+
description: "Update one connection, same as PATCH /api/connections/:id. Changes enabled, displayName, config, or replaces secrets. Returns { health } when the connection stays enabled, otherwise {}. Secret values are not in the result.",
|
|
64
|
+
inputSchema: updateSchema,
|
|
65
|
+
}, async ({ id, ...patch }) => run((service) => service.update(id, jsonBody(patch))));
|
|
66
|
+
server.registerTool("remove_connection", {
|
|
67
|
+
description: "Remove one connection and its stored secrets, same as DELETE /api/connections/:id. Returns { removed: true }.",
|
|
68
|
+
inputSchema: z.object({
|
|
69
|
+
id: z.string().describe("Connection id."),
|
|
70
|
+
}).strict(),
|
|
71
|
+
}, async ({ id }) => run(async (service) => {
|
|
72
|
+
await service.remove(id);
|
|
73
|
+
return { removed: true };
|
|
74
|
+
}));
|
|
75
|
+
server.registerTool("test_connection", {
|
|
76
|
+
description: "Check connection values without saving them, same as POST /api/connections/test. Does not write the connection or its secrets. Returns the health check.",
|
|
77
|
+
inputSchema: createSchema,
|
|
78
|
+
annotations: { readOnlyHint: true },
|
|
79
|
+
}, async (input) => run((service) => service.test(jsonBody(input))));
|
|
80
|
+
server.registerTool("validate_connection_target", {
|
|
81
|
+
description: "Check a pinned recipient for a saved connection, same as POST /api/connections/:id/validate-target. No network and no secret read. Returns { ok: true } or { ok: false, issues }.",
|
|
82
|
+
inputSchema: validateSchema,
|
|
83
|
+
annotations: { readOnlyHint: true },
|
|
84
|
+
}, async ({ id, ...target }) => run((service) => service.validateTarget(id, jsonBody(target))));
|
|
85
|
+
}
|
package/dist/mcp/controlTools.js
CHANGED
|
@@ -12,6 +12,39 @@ import { textResult } from "./toolResults.js";
|
|
|
12
12
|
import { projectWaitingGates } from "./waitingGates.js";
|
|
13
13
|
import { readStageVerificationHistory } from "../runstore/verificationHistory.js";
|
|
14
14
|
const auditLog = rootLogger.child({ component: "audit" });
|
|
15
|
+
const decisionAnswer = z.enum(["accept", "reject"]);
|
|
16
|
+
const freeTextOrConfirmAnswer = z.discriminatedUnion("kind", [
|
|
17
|
+
z.object({ kind: z.literal("free_text"), text: z.string() }),
|
|
18
|
+
z.object({
|
|
19
|
+
kind: z.literal("confirm"),
|
|
20
|
+
decision: decisionAnswer,
|
|
21
|
+
text: z.string().optional(),
|
|
22
|
+
}),
|
|
23
|
+
]);
|
|
24
|
+
const askOperatorAnswerInput = z.discriminatedUnion("kind", [
|
|
25
|
+
z.object({
|
|
26
|
+
promptId: z.string().min(1),
|
|
27
|
+
kind: z.literal("free_text"),
|
|
28
|
+
text: z.string(),
|
|
29
|
+
}),
|
|
30
|
+
z.object({
|
|
31
|
+
promptId: z.string().min(1),
|
|
32
|
+
kind: z.literal("confirm"),
|
|
33
|
+
decision: decisionAnswer,
|
|
34
|
+
text: z.string().optional(),
|
|
35
|
+
}),
|
|
36
|
+
z.object({
|
|
37
|
+
promptId: z.string().min(1),
|
|
38
|
+
kind: z.literal("artifact_backed"),
|
|
39
|
+
decision: decisionAnswer,
|
|
40
|
+
text: z.string().optional(),
|
|
41
|
+
}),
|
|
42
|
+
z.object({
|
|
43
|
+
promptId: z.string().min(1),
|
|
44
|
+
kind: z.literal("multi_question"),
|
|
45
|
+
answers: z.record(z.string(), freeTextOrConfirmAnswer),
|
|
46
|
+
}),
|
|
47
|
+
]);
|
|
15
48
|
export function registerControlTools(server, deps) {
|
|
16
49
|
const { manager, store, cwd } = deps;
|
|
17
50
|
server.registerTool("list_waiting", {
|
|
@@ -46,7 +79,7 @@ export function registerControlTools(server, deps) {
|
|
|
46
79
|
inputSchema: z.object({
|
|
47
80
|
runId: z.string(),
|
|
48
81
|
stageId: z.string(),
|
|
49
|
-
answer:
|
|
82
|
+
answer: askOperatorAnswerInput,
|
|
50
83
|
}),
|
|
51
84
|
}, async ({ runId, stageId, answer }) => {
|
|
52
85
|
let parsed;
|
package/dist/mcp/deps.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ import type { RunChangeBus } from "../runtime/runChangeBus.js";
|
|
|
8
8
|
import type { EngineStatus } from "../evals/engine/promptfoo/status.js";
|
|
9
9
|
import type { EvalRunManager } from "../evals/manager.js";
|
|
10
10
|
import type { TriageDeps } from "../evals/triage/service.js";
|
|
11
|
+
import type { ChannelService } from "../channels/service.js";
|
|
12
|
+
import type { IssueFetch } from "../config/importTask.js";
|
|
13
|
+
import type { MemoryHost } from "../memory/host.js";
|
|
11
14
|
import type { RunManager } from "../runtime/runManager.js";
|
|
12
15
|
export type McpToolDeps = {
|
|
13
16
|
manager: RunManager;
|
|
@@ -24,6 +27,12 @@ export type McpToolDeps = {
|
|
|
24
27
|
evalEngineStatus?: () => EngineStatus;
|
|
25
28
|
/** Failure sorting seams: key lookup, fetch and base URL for the Jev classifier, or a judge model (tests). */
|
|
26
29
|
triage?: Omit<TriageDeps, "store">;
|
|
30
|
+
/** Host connections. Absent when the process has no channel service. */
|
|
31
|
+
channels?: ChannelService;
|
|
32
|
+
/** Host memories under $STAGEFLOW_HOME. Absent when memory is not configured. */
|
|
33
|
+
memories?: MemoryHost;
|
|
34
|
+
/** GitHub issue fetch for `import_task_file`. Tests inject this. Production uses the default client. */
|
|
35
|
+
issueFetch?: IssueFetch;
|
|
27
36
|
};
|
|
28
37
|
export type McpHttpDeps = McpToolDeps & {
|
|
29
38
|
runChangeBus: RunChangeBus;
|