@fro.bot/space-bus 0.3.0 → 0.4.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 CHANGED
@@ -63,7 +63,7 @@ Set `SPACE_BUS_CONFIG` to override roster discovery — it must be an absolute p
63
63
  ## Tools
64
64
 
65
65
  - `bus_roster` — List the space-bus manifest projects with live session status per project.
66
- - `bus_task` — Dispatch a prompt to an agent in the given space-bus manifest project, or steer an existing session by passing `sessionId` (answers its pending question, else sends a follow-up prompt). Returns immediately; does not wait for completion.
66
+ - `bus_task` — Dispatch a prompt to an agent in the given space-bus manifest project, or steer an existing session by passing `sessionId` (answers its pending question, else sends a follow-up prompt). Returns immediately; does not wait for completion. Alongside the formatted text, results carry structured `{sessionId, project, mode}` metadata — plugin `ToolResult.metadata` on the tool surface, MCP `structuredContent` on the stdio surface — for callers that want the dispatch outcome without parsing the string.
67
67
  - `bus_status` — Report a space-bus session's status plus a summary of its latest todo and diff. Also reports when the session is blocked on an interactive question awaiting a reply.
68
68
  - `bus_result` — Return a completed space-bus session's final assistant message and diff. Errors if the session is still running — use `bus_status` to check first.
69
69
 
package/dist/format.d.ts CHANGED
@@ -5,5 +5,15 @@
5
5
  import type { DispatchResult, RosterProject, SessionResultResult, SessionStatusResult } from "./core";
6
6
  export declare function formatRoster(projects: RosterProject[]): string;
7
7
  export declare function formatDispatch(r: DispatchResult): string;
8
+ /** Machine-readable dispatch metadata, shared verbatim by both surfaces
9
+ * (plugin ToolResult.metadata and MCP structuredContent) so the shapes
10
+ * can't drift. `sessionId` and `project` are always populated on
11
+ * DispatchResult (new sessions and both steering modes resolve a project). */
12
+ export type DispatchMetadata = {
13
+ sessionId: string;
14
+ project: string;
15
+ mode: DispatchResult["mode"];
16
+ };
17
+ export declare function dispatchMetadata(r: DispatchResult): DispatchMetadata;
8
18
  export declare function formatStatus(r: SessionStatusResult): string;
9
19
  export declare function formatResult(r: SessionResultResult): string;
package/dist/format.js CHANGED
@@ -20,6 +20,9 @@ function formatDispatch(r) {
20
20
  return `Follow-up prompt sent to session ${r.sessionId} (${r.project}).`;
21
21
  }
22
22
  }
23
+ function dispatchMetadata(r) {
24
+ return { sessionId: r.sessionId, project: r.project, mode: r.mode };
25
+ }
23
26
  function formatStatus(r) {
24
27
  const todoLines = r.todos.length ? r.todos.map((t) => ` - [${t.status}] ${t.content} (${t.priority})`).join(`
25
28
  `) : " (none)";
@@ -55,5 +58,6 @@ export {
55
58
  formatStatus,
56
59
  formatRoster,
57
60
  formatResult,
58
- formatDispatch
61
+ formatDispatch,
62
+ dispatchMetadata
59
63
  };
package/dist/index.js CHANGED
@@ -707,6 +707,9 @@ function formatDispatch(r) {
707
707
  return `Follow-up prompt sent to session ${r.sessionId} (${r.project}).`;
708
708
  }
709
709
  }
710
+ function dispatchMetadata(r) {
711
+ return { sessionId: r.sessionId, project: r.project, mode: r.mode };
712
+ }
710
713
  function formatStatus(r) {
711
714
  const todoLines = r.todos.length ? r.todos.map((t) => ` - [${t.status}] ${t.content} (${t.priority})`).join(`
712
715
  `) : " (none)";
@@ -838,7 +841,7 @@ function makeBusTask(defaultDirectory) {
838
841
  const r = await dispatch(dispatchArgs, { context });
839
842
  if (!r.ok)
840
843
  throw new Error(r.error);
841
- return formatDispatch(r);
844
+ return { output: formatDispatch(r), metadata: dispatchMetadata(r) };
842
845
  }
843
846
  });
844
847
  }
package/dist/mcp.js CHANGED
@@ -708,6 +708,9 @@ function formatDispatch(r) {
708
708
  return `Follow-up prompt sent to session ${r.sessionId} (${r.project}).`;
709
709
  }
710
710
  }
711
+ function dispatchMetadata(r) {
712
+ return { sessionId: r.sessionId, project: r.project, mode: r.mode };
713
+ }
711
714
  function formatStatus(r) {
712
715
  const todoLines = r.todos.length ? r.todos.map((t) => ` - [${t.status}] ${t.content} (${t.priority})`).join(`
713
716
  `) : " (none)";
@@ -844,13 +847,13 @@ function makeBusTask(defaultDirectory) {
844
847
  const r = await dispatch(dispatchArgs, { context });
845
848
  if (!r.ok)
846
849
  throw new Error(r.error);
847
- return formatDispatch(r);
850
+ return { output: formatDispatch(r), metadata: dispatchMetadata(r) };
848
851
  }
849
852
  });
850
853
  }
851
854
 
852
855
  // src/mcp.ts
853
- var version = "0.3.0";
856
+ var version = "0.4.0";
854
857
  var server = new McpServer({
855
858
  name: "space-bus",
856
859
  version
@@ -880,6 +883,11 @@ server.registerTool("bus_task", {
880
883
  prompt: z3.string().describe("The prompt to send to the delegated agent"),
881
884
  title: z3.string().optional().describe("Optional session title (only used when starting a new session)"),
882
885
  sessionId: z3.string().optional().describe("Existing session ID to steer instead of starting a new session")
886
+ },
887
+ outputSchema: {
888
+ sessionId: z3.string().describe("The dispatched or steered session ID"),
889
+ project: z3.string().describe("Manifest project name that owns the session"),
890
+ mode: z3.enum(["new", "question-reply", "follow-up"]).describe("How the prompt was delivered")
883
891
  }
884
892
  }, async (args) => {
885
893
  const dispatchArgs = toDispatchArgs(args);
@@ -900,7 +908,10 @@ server.registerTool("bus_task", {
900
908
  const r = await dispatch(dispatchArgs, { context });
901
909
  if (!r.ok)
902
910
  return { content: [{ type: "text", text: r.error }], isError: true };
903
- return { content: [{ type: "text", text: formatDispatch(r) }] };
911
+ return {
912
+ content: [{ type: "text", text: formatDispatch(r) }],
913
+ structuredContent: dispatchMetadata(r)
914
+ };
904
915
  });
905
916
  server.registerTool("bus_status", {
906
917
  description: BUS_STATUS_DESCRIPTION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fro.bot/space-bus",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Space Bus — workspace agent bus for OpenCode. One control agent tasking per-project agents over the OpenCode server API, with an MCP facade for Claude Desktop.",
5
5
  "type": "module",
6
6
  "license": "MIT",