@50arms/platform-mcp 0.1.463 → 0.1.465

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.
Files changed (67) hide show
  1. package/dist/access-request.js +19 -6
  2. package/dist/agent-gate.js +19 -5
  3. package/dist/board-id.js +8 -2
  4. package/dist/checkout-docs-root.js +10 -2
  5. package/dist/clear-control.js +18 -4
  6. package/dist/compaction-control.js +30 -7
  7. package/dist/credential.js +10 -2
  8. package/dist/danxbot-api-examples.js +20 -3
  9. package/dist/design-screenshot.js +22 -5
  10. package/dist/digest-hold.js +14 -3
  11. package/dist/docs-tools.js +46 -12
  12. package/dist/durable-write.js +10 -2
  13. package/dist/forbidden-hint.js +13 -2
  14. package/dist/guarded-calls.js +7 -2
  15. package/dist/handlers.js +70 -15
  16. package/dist/heartbeat-reporter.js +8 -3
  17. package/dist/http-client.js +5 -3
  18. package/dist/index.js +252 -82
  19. package/dist/job-key.js +47 -0
  20. package/dist/json-body.js +3 -1
  21. package/dist/key-revoked-halt.js +2 -1
  22. package/dist/leftover-wire.js +17 -4
  23. package/dist/lifecycle.js +11 -3
  24. package/dist/listen.js +242 -64
  25. package/dist/listener-reminder.js +8 -2
  26. package/dist/machine-daemon/autostart.js +16 -4
  27. package/dist/machine-daemon/beat.js +18 -4
  28. package/dist/machine-daemon/cli.js +15 -4
  29. package/dist/machine-daemon/install.js +33 -9
  30. package/dist/machine-daemon/leftovers.js +134 -30
  31. package/dist/machine-daemon/state.js +9 -3
  32. package/dist/machine-daemon.js +531 -128
  33. package/dist/machine-registration.js +27 -6
  34. package/dist/machine-secret.js +8 -3
  35. package/dist/machine-toolkit.js +377 -81
  36. package/dist/mini-app-build.js +19 -5
  37. package/dist/mini-app-checkout.js +38 -10
  38. package/dist/mini-app-output.js +22 -5
  39. package/dist/mini-app-publish.js +34 -11
  40. package/dist/mini-app-restore.js +30 -9
  41. package/dist/one-line.js +3 -1
  42. package/dist/permission-request.js +14 -3
  43. package/dist/permission-watch.js +10 -3
  44. package/dist/plan-events-relay.js +96 -19
  45. package/dist/plan-events-tool.js +9 -2
  46. package/dist/plugin-publish.js +23 -6
  47. package/dist/plugin-screenshot.js +18 -6
  48. package/dist/restart-notice.js +47 -15
  49. package/dist/result-limit.js +6 -1
  50. package/dist/role-instruction-file.js +16 -4
  51. package/dist/route-board-scope.generated.js +5 -0
  52. package/dist/route-board-scope.js +6 -2
  53. package/dist/session-access.js +114 -33
  54. package/dist/session-connection.js +23 -7
  55. package/dist/session-control-file.js +1 -1
  56. package/dist/session-key.js +12 -4
  57. package/dist/session-options.js +6 -2
  58. package/dist/session-stats.js +2 -1
  59. package/dist/session-stream.js +81 -20
  60. package/dist/shutdown.js +3 -1
  61. package/dist/subagents-live.js +8 -2
  62. package/dist/terms-halt.js +4 -2
  63. package/dist/tool-access.js +17 -4
  64. package/dist/tool-surface.js +9 -2
  65. package/dist/transcript-lineage.js +5 -2
  66. package/dist/urgent-records.js +1 -0
  67. package/package.json +1 -1
package/dist/shutdown.js CHANGED
@@ -18,7 +18,9 @@ export function stopWhenSessionEnds(wiring) {
18
18
  wiring.stdin.once("end", wiring.stop);
19
19
  const exitAfterStop = () => {
20
20
  // A synchronous throw from `stop` takes the same "shutdown failed" path as a rejection.
21
- void Promise.resolve().then(wiring.stop).then(() => wiring.exit(0), (err) => {
21
+ void Promise.resolve()
22
+ .then(wiring.stop)
23
+ .then(() => wiring.exit(0), (err) => {
22
24
  process.stderr.write(`platform-mcp: shutdown failed: ${err instanceof Error ? err.message : String(err)}\n`);
23
25
  wiring.exit(1);
24
26
  });
@@ -39,7 +39,10 @@ const USAGE = `usage: platform-mcp ${SUBAGENTS_LIVE_SUBCOMMAND} <absolute path t
39
39
  /** The validated transcript path, or the reason it is refused. */
40
40
  export function parseSubagentsLiveArgs(args) {
41
41
  if (args.length !== 1)
42
- return { ok: false, reason: `expected exactly one argument, got ${args.length}` };
42
+ return {
43
+ ok: false,
44
+ reason: `expected exactly one argument, got ${args.length}`,
45
+ };
43
46
  const path = args[0];
44
47
  if (!isAbsolute(path))
45
48
  return { ok: false, reason: `"${path}" is not an absolute path` };
@@ -155,7 +158,10 @@ export async function loadDeclaredPrices(sessionId, io = {}) {
155
158
  if (sent.status !== 200)
156
159
  throw new Error(`GET /api/model-versions answered ${sent.status}`);
157
160
  const parsed = tryParseJsonBody(sent.text);
158
- const versions = parsed.ok ? parsed.body?.model_versions : undefined;
161
+ const versions = parsed.ok
162
+ ? parsed.body
163
+ ?.model_versions
164
+ : undefined;
159
165
  if (!Array.isArray(versions))
160
166
  throw new Error("GET /api/model-versions answered no model_versions");
161
167
  return priceLookupOfCards(priceCardsOfCatalog(versions));
@@ -8,11 +8,13 @@ const ACCEPT_SCREEN_PATH = "/terms/accept?return=%2F";
8
8
  /** Keep in step with `termsRefusalInstruction` in src/dashboard/route-policy.ts. */
9
9
  export function haltText(acceptUrl, owner) {
10
10
  return ("STOP ALL WORK NOW. The dashboard refuses your access until " +
11
- (owner === undefined ? "the person you act for" : `${owner}, the user you act for,`) +
11
+ (owner === undefined
12
+ ? "the person you act for"
13
+ : `${owner}, the user you act for,`) +
12
14
  " accepts the current Terms of Use.\n\n" +
13
15
  `Give the person this link to accept them: ${acceptUrl}\n\n` +
14
16
  "Do not retry, do not look for another route, and never accept the Terms yourself. " +
15
- "A dispatched agent ends with 50arms_api POST /api/dispatch-callbacks/complete {status: \"failed\", summary} " +
17
+ 'A dispatched agent ends with 50arms_api POST /api/dispatch-callbacks/complete {status: "failed", summary} ' +
16
18
  "naming this link (stop if that call is refused too), and never blocks the card.");
17
19
  }
18
20
  /** The halt text for a `403 terms_not_accepted` result, or null for any other result. */
@@ -26,9 +26,16 @@ export const CALLBACK_ENV = {
26
26
  slackReply: "DANXBOT_SLACK_REPLY_URL",
27
27
  };
28
28
  const BOOTSTRAP = { permission: null, callback: null };
29
- const needs = (permission) => ({ permission, callback: null });
29
+ const needs = (permission) => ({
30
+ permission,
31
+ callback: null,
32
+ });
30
33
  /** DX-4632: usable with no key (a session that has not signed in yet) and only on a person's session. */
31
- const OPERATOR_SESSION_BOOTSTRAP = { permission: null, callback: null, operatorSessionOnly: true };
34
+ const OPERATOR_SESSION_BOOTSTRAP = {
35
+ permission: null,
36
+ callback: null,
37
+ operatorSessionOnly: true,
38
+ };
32
39
  const needsAndPostsTo = (permission, callback) => ({ permission, callback });
33
40
  /**
34
41
  * Every tool this server registers, with what makes it usable. `index.ts` refuses to register a tool that is not
@@ -101,12 +108,18 @@ export function isUsable(access, grant) {
101
108
  }
102
109
  /** The ONE mapping from what a session holds to the tool names it advertises, sorted. */
103
110
  export function toolsFor(grant) {
104
- return Object.keys(TOOL_ACCESS).filter((name) => isUsable(TOOL_ACCESS[name], grant)).sort();
111
+ return Object.keys(TOOL_ACCESS)
112
+ .filter((name) => isUsable(TOOL_ACCESS[name], grant))
113
+ .sort();
105
114
  }
106
115
  /**
107
116
  * The bootstrap set a DISPATCH sees: usable with no key, no callback, and not operator-session-only. A signed-out PERSON's
108
117
  * session is shown this plus the operator-only bootstrap tools (`restart_notice`): see `bootstrapSurfaceTools()`.
109
118
  */
110
119
  export function bootstrapTools() {
111
- return toolsFor({ permissions: new Set(), callbacks: new Set(), operatorSession: false });
120
+ return toolsFor({
121
+ permissions: new Set(),
122
+ callbacks: new Set(),
123
+ operatorSession: false,
124
+ });
112
125
  }
@@ -19,7 +19,11 @@ export class ToolSurface {
19
19
  }
20
20
  /** Show exactly the tools `permissions` and this dispatch's callbacks allow. Returns the names whose visibility changed. */
21
21
  apply(permissions) {
22
- const wanted = new Set(toolsFor({ permissions, callbacks: this.callbacks, operatorSession: this.options.operatorSession }));
22
+ const wanted = new Set(toolsFor({
23
+ permissions,
24
+ callbacks: this.callbacks,
25
+ operatorSession: this.options.operatorSession,
26
+ }));
23
27
  const changed = [];
24
28
  for (const [name, tool] of this.tools) {
25
29
  const want = wanted.has(name);
@@ -34,7 +38,10 @@ export class ToolSurface {
34
38
  }
35
39
  /** The tool names currently shown. */
36
40
  advertised() {
37
- return [...this.tools].filter(([, tool]) => tool.enabled).map(([name]) => name).sort();
41
+ return [...this.tools]
42
+ .filter(([, tool]) => tool.enabled)
43
+ .map(([name]) => name)
44
+ .sort();
38
45
  }
39
46
  }
40
47
  /** Re-reads the key's permissions and applies them. Calls run one at a time, so two triggers never interleave. */
@@ -55,7 +55,9 @@ export async function readTranscriptLineage(path, ownSessionId, options = {}) {
55
55
  seen.nearest = id;
56
56
  return undefined;
57
57
  }
58
- return seen.nearest === null ? { kind: "not_fork" } : { kind: "fork", parent: seen.nearest };
58
+ return seen.nearest === null
59
+ ? { kind: "not_fork" }
60
+ : { kind: "fork", parent: seen.nearest };
59
61
  };
60
62
  try {
61
63
  for await (const chunk of source) {
@@ -87,7 +89,8 @@ export async function readTranscriptLineage(path, ownSessionId, options = {}) {
87
89
  catch (err) {
88
90
  if (options.signal?.aborted === true)
89
91
  throw new TranscriptReadAborted("the deadline passed");
90
- if (err instanceof TranscriptUnreadable || err instanceof TranscriptReadAborted)
92
+ if (err instanceof TranscriptUnreadable ||
93
+ err instanceof TranscriptReadAborted)
91
94
  throw err;
92
95
  throw new TranscriptUnreadable(`cannot read ${path}: ${err.message}`);
93
96
  }
@@ -38,6 +38,7 @@ export function isUrgent(record) {
38
38
  case "assignment":
39
39
  case "docs_land":
40
40
  case "docs_draft":
41
+ case "content_compaction":
41
42
  case "owed_comment":
42
43
  case "leftover_processes":
43
44
  case "digest":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@50arms/platform-mcp",
3
- "version": "0.1.463",
3
+ "version": "0.1.465",
4
4
  "description": "Stdio MCP server fronting the 50 Arms dashboard API for agents (operator sessions and dispatched workers alike): the generic 50arms_api/50arms_api_list/50arms_api_spec tools reach any route the caller's credential may call, plus dedicated agent-specific tools (session_connect, request_permission, attach_file, and 50arms_slack_reply) (DX-3465, PLN-11 R-25).",
5
5
  "license": "MIT",
6
6
  "type": "module",