@thehammer/danx-dashboard-mcp 0.1.319 → 0.1.322

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.
@@ -9,7 +9,7 @@
9
9
  * - the rest is written to ONE local file the danxbot plugin's `PreCompact` gate reads: `~/.config/danxbot/compaction/<sessionId>.json`. The gate never
10
10
  * asks the network: Claude Code proposes a compaction before every model request.
11
11
  *
12
- * The file is `{v: 1, sessionId, control: {floorTokens, passAtTokens, windowTokens, releaseUntilMs, releaseId, agents} | null, askedAt: string | null}`.
12
+ * The file is `{v: 1, sessionId, control: {floorTokens, passAtTokens, windowTokens, releaseUntilMs, releaseId, agents, valves} | null, askedAt: string | null}`.
13
13
  * DX-5218: `agents` holds each SUB-AGENT's own control by agent id, `{passAtTokens, ask, releaseUntilMs, releaseId}`: the sub-agent's own safety-valve size, its own
14
14
  * request (the relay cannot show a sub-agent a request, so unlike the main agent's it stays in the file for the plugin to deliver to that agent) and its own
15
15
  * single-use release. `sessionId` is the
@@ -28,6 +28,11 @@ import { prefixedLine } from "./one-line.js";
28
28
  import { assertSessionIdSegment, pruneStaleSessionFiles } from "./session-connection.js";
29
29
  /** The longest request line relayed whole (the pacing line's bound): the dashboard's request is a few hundred characters. */
30
30
  export const COMPACTION_ASK_MAX_CODE_POINTS = 1000;
31
+ /**
32
+ * DX-5222: the model lines a valve table may name. A copy of the dashboard's `MODEL_LINES` (`src/agent/model-lines.ts`): this published package cannot import it.
33
+ * The dashboard-side test `operator-session.test.ts` pins the two equal.
34
+ */
35
+ export const MODEL_LINES = ["haiku", "sonnet", "opus", "fable"];
31
36
  const isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
32
37
  const isCount = (v) => typeof v === "number" && Number.isInteger(v) && v >= 0;
33
38
  const isTime = (v) => typeof v === "number" && Number.isFinite(v);
@@ -67,6 +72,15 @@ export function invalidCompactionReason(value) {
67
72
  return own;
68
73
  if (!isRecord(c.agents))
69
74
  return "agents must be an object keyed by agent id";
75
+ // DX-5222: no default for a missing table - a frame from a dashboard that predates it is refused, never read as "no valves"
76
+ if (!isRecord(c.valves))
77
+ return "valves must be an object keyed by model line";
78
+ for (const [line, size] of Object.entries(c.valves)) {
79
+ if (!MODEL_LINES.includes(line))
80
+ return `valves.${line} is not a model line`;
81
+ if (!isCount(size) || size === 0)
82
+ return `valves.${line} must be a positive whole number`;
83
+ }
70
84
  for (const [id, a] of Object.entries(c.agents)) {
71
85
  if (id === "")
72
86
  return "agents has an empty agent id";
@@ -105,6 +119,7 @@ export function fileOf(control, askedAt, sessionId) {
105
119
  releaseUntilMs: control.releaseUntilMs,
106
120
  releaseId: control.releaseId,
107
121
  agents: control.agents,
122
+ valves: control.valves,
108
123
  },
109
124
  askedAt,
110
125
  };
@@ -4,6 +4,16 @@ export const PLUGIN_PREVIEW_ROUTE = "/plugin-preview";
4
4
  export const PLUGIN_PREVIEW_FILES = "/__plugin-preview__/";
5
5
  export const PLUGIN_PREVIEW_ATTRIBUTE = "data-plugin-preview";
6
6
  export const PLUGIN_PREVIEW_MANIFEST_GLOBAL = "__DANX_PLUGIN_PREVIEW_MANIFEST__";
7
+ // Restated from `src/plugins/plugin-manifest.ts` (`CARD_VIEW_EXPORT`, `CARD_LIST_VIEW_EXPORT`): this package cannot import the app's source.
8
+ const CARD_VIEW_EXPORT = "CardView";
9
+ const CARD_LIST_VIEW_EXPORT = "CardListView";
10
+ export function previewModeOf(exports) {
11
+ if (exports.includes(CARD_VIEW_EXPORT))
12
+ return "card";
13
+ if (exports.includes(CARD_LIST_VIEW_EXPORT))
14
+ return "list";
15
+ throw new Error(`plugin preview: the revision exports neither ${CARD_VIEW_EXPORT} nor ${CARD_LIST_VIEW_EXPORT}, so there is no view to draw`);
16
+ }
7
17
  /** The ceiling on one render, from page load to the page saying `ready` or `failed`. A page that reports is waited on only as long as it takes. */
8
18
  export const RENDER_WAIT_MS = 30_000;
9
19
  /** The content types of the files a plugin may carry: restated from the server's `PLUGIN_FILE_TYPES` (`src/plugins/manifest-validation.ts`, minus its charset suffix); `src/dispatch/design-publish-restated-constants.test.ts` ties them. */
@@ -51,7 +61,7 @@ export async function capturePluginRender(built, dashboardUrl, where) {
51
61
  const origin = new URL(dashboardUrl).origin;
52
62
  const served = servedFiles(built);
53
63
  return captureWith(where, false, async (page) => {
54
- await page.addInitScript(`window[${JSON.stringify(PLUGIN_PREVIEW_MANIFEST_GLOBAL)}] = ${JSON.stringify({ entry: built.manifest.entry, styles: built.manifest.styles })};`);
64
+ await page.addInitScript(`window[${JSON.stringify(PLUGIN_PREVIEW_MANIFEST_GLOBAL)}] = ${JSON.stringify({ entry: built.manifest.entry, styles: built.manifest.styles, runtime: built.manifest.runtime, mode: previewModeOf(built.manifest.exports) })};`);
55
65
  await page.route(`${origin}${PLUGIN_PREVIEW_FILES}**`, (route) => answer(route, PLUGIN_PREVIEW_FILES, served));
56
66
  const response = await page.goto(`${origin}${PLUGIN_PREVIEW_ROUTE}`, { waitUntil: "load" });
57
67
  const status = response?.status();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thehammer/danx-dashboard-mcp",
3
- "version": "0.1.319",
3
+ "version": "0.1.322",
4
4
  "description": "Stdio MCP server fronting danxbot's dashboard API for agents (operator sessions and dispatched workers alike): the generic danxbot_api/danxbot_api_list/danxbot_api_spec tools reach any route the caller's credential may call, plus dedicated agent-specific tools (plan_connect, request_permission, attach_file, and danxbot_slack_reply) (DX-3465, PLN-11 R-25).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  "test:watch": "vitest"
32
32
  },
33
33
  "dependencies": {
34
- "@danxbot/plugin-sdk": "0.1.4",
34
+ "@danxbot/plugin-sdk": "0.2.1",
35
35
  "@modelcontextprotocol/sdk": "1.29.0",
36
36
  "@thehammer/danx-session-telemetry": "0.1.52",
37
37
  "zod": "^3.25.76"