@fro.bot/space-bus 0.11.0 → 0.13.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/dist/core.js CHANGED
@@ -111,13 +111,44 @@ var managedSpawnConfigSchema = z.object({
111
111
  cwd: z.string().optional(),
112
112
  port: z.number().int().nonnegative().optional()
113
113
  });
114
+ var registryEntrySchema = z.object({
115
+ name: z.string().regex(/^[a-z0-9-]{1,64}$/, "roster name must be 1-64 lowercase letters, digits, or hyphens"),
116
+ path: z.string().min(1, "roster path must not be empty")
117
+ });
118
+ var registryFileSchema = z.object({
119
+ version: z.literal(1),
120
+ default: z.string().optional(),
121
+ rosters: z.array(registryEntrySchema)
122
+ }).superRefine((val, ctx) => {
123
+ const seen = new Set;
124
+ for (const entry of val.rosters) {
125
+ const key = entry.name.toLowerCase();
126
+ if (seen.has(key)) {
127
+ ctx.addIssue({
128
+ code: "custom",
129
+ message: `space-bus: duplicate roster name "${entry.name}" (case-insensitive) in registry`
130
+ });
131
+ }
132
+ seen.add(key);
133
+ }
134
+ if (val.default !== undefined) {
135
+ const matches = val.rosters.filter((entry) => entry.name === val.default);
136
+ if (matches.length !== 1) {
137
+ ctx.addIssue({
138
+ code: "custom",
139
+ message: `space-bus: registry's default "${val.default}" must match exactly one roster entry's name (matched ${matches.length})`
140
+ });
141
+ }
142
+ }
143
+ });
114
144
  var discoveryFileSchema = z.object({
115
145
  port: z.number().int().nonnegative(),
116
146
  pid: z.number().int().min(2),
117
147
  identity: z.string(),
118
148
  password: z.string(),
119
149
  spawnConfig: managedSpawnConfigSchema,
120
- baseUrl: z.url()
150
+ baseUrl: z.url(),
151
+ rosterPath: z.string().optional()
121
152
  });
122
153
 
123
154
  // src/core.ts
package/dist/format.d.ts CHANGED
@@ -3,6 +3,19 @@
3
3
  * Experimental — shapes may change in minor releases.
4
4
  */
5
5
  import type { DispatchResult, RosterProject, SessionResultResult, SessionStatusResult, WaitResult } from "./core";
6
+ /**
7
+ * Shared roster-echo header (R9): every bus tool result names the roster
8
+ * it resolved against — the split-brain/confused-deputy mitigation from
9
+ * document review. `source.name` is the registry name when the call
10
+ * resolved via a registry name (`roster: personal`); otherwise `source.path`
11
+ * (the ambient spacebus.json path) is used (`roster: /path/to/spacebus.json`).
12
+ * Both surfaces (plugin tools, MCP) prepend this line to result TEXT only —
13
+ * structured metadata (e.g. bus_task's sessionId/project/mode) is untouched.
14
+ */
15
+ export declare function formatRosterHeader(source: {
16
+ name?: string;
17
+ path: string;
18
+ }): string;
6
19
  export declare function formatRoster(projects: RosterProject[]): string;
7
20
  export declare function formatDispatch(r: DispatchResult): string;
8
21
  /** Machine-readable dispatch metadata, shared verbatim by both surfaces
package/dist/format.js CHANGED
@@ -1,4 +1,7 @@
1
1
  // src/format.ts
2
+ function formatRosterHeader(source) {
3
+ return `roster: ${source.name ?? source.path}`;
4
+ }
2
5
  function formatRoster(projects) {
3
6
  return projects.map((p) => {
4
7
  if (!p.pathExists)
@@ -76,6 +79,7 @@ function formatResult(r) {
76
79
  export {
77
80
  formatWait,
78
81
  formatStatus,
82
+ formatRosterHeader,
79
83
  formatRoster,
80
84
  formatResult,
81
85
  formatDispatch,