@fro.bot/space-bus 0.11.0 → 0.12.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/attach.js CHANGED
@@ -118,13 +118,44 @@ var managedSpawnConfigSchema = z.object({
118
118
  cwd: z.string().optional(),
119
119
  port: z.number().int().nonnegative().optional()
120
120
  });
121
+ var registryEntrySchema = z.object({
122
+ name: z.string().regex(/^[a-z0-9-]{1,64}$/, "roster name must be 1-64 lowercase letters, digits, or hyphens"),
123
+ path: z.string().min(1, "roster path must not be empty")
124
+ });
125
+ var registryFileSchema = z.object({
126
+ version: z.literal(1),
127
+ default: z.string().optional(),
128
+ rosters: z.array(registryEntrySchema)
129
+ }).superRefine((val, ctx) => {
130
+ const seen = new Set;
131
+ for (const entry of val.rosters) {
132
+ const key = entry.name.toLowerCase();
133
+ if (seen.has(key)) {
134
+ ctx.addIssue({
135
+ code: "custom",
136
+ message: `space-bus: duplicate roster name "${entry.name}" (case-insensitive) in registry`
137
+ });
138
+ }
139
+ seen.add(key);
140
+ }
141
+ if (val.default !== undefined) {
142
+ const matches = val.rosters.filter((entry) => entry.name === val.default);
143
+ if (matches.length !== 1) {
144
+ ctx.addIssue({
145
+ code: "custom",
146
+ message: `space-bus: registry's default "${val.default}" must match exactly one roster entry's name (matched ${matches.length})`
147
+ });
148
+ }
149
+ }
150
+ });
121
151
  var discoveryFileSchema = z.object({
122
152
  port: z.number().int().nonnegative(),
123
153
  pid: z.number().int().min(2),
124
154
  identity: z.string(),
125
155
  password: z.string(),
126
156
  spawnConfig: managedSpawnConfigSchema,
127
- baseUrl: z.url()
157
+ baseUrl: z.url(),
158
+ rosterPath: z.string().optional()
128
159
  });
129
160
 
130
161
  // src/attach.ts
package/dist/cli.js CHANGED
@@ -128,13 +128,44 @@ var managedSpawnConfigSchema = z.object({
128
128
  cwd: z.string().optional(),
129
129
  port: z.number().int().nonnegative().optional()
130
130
  });
131
+ var registryEntrySchema = z.object({
132
+ name: z.string().regex(/^[a-z0-9-]{1,64}$/, "roster name must be 1-64 lowercase letters, digits, or hyphens"),
133
+ path: z.string().min(1, "roster path must not be empty")
134
+ });
135
+ var registryFileSchema = z.object({
136
+ version: z.literal(1),
137
+ default: z.string().optional(),
138
+ rosters: z.array(registryEntrySchema)
139
+ }).superRefine((val, ctx) => {
140
+ const seen = new Set;
141
+ for (const entry of val.rosters) {
142
+ const key = entry.name.toLowerCase();
143
+ if (seen.has(key)) {
144
+ ctx.addIssue({
145
+ code: "custom",
146
+ message: `space-bus: duplicate roster name "${entry.name}" (case-insensitive) in registry`
147
+ });
148
+ }
149
+ seen.add(key);
150
+ }
151
+ if (val.default !== undefined) {
152
+ const matches = val.rosters.filter((entry) => entry.name === val.default);
153
+ if (matches.length !== 1) {
154
+ ctx.addIssue({
155
+ code: "custom",
156
+ message: `space-bus: registry's default "${val.default}" must match exactly one roster entry's name (matched ${matches.length})`
157
+ });
158
+ }
159
+ }
160
+ });
131
161
  var discoveryFileSchema = z.object({
132
162
  port: z.number().int().nonnegative(),
133
163
  pid: z.number().int().min(2),
134
164
  identity: z.string(),
135
165
  password: z.string(),
136
166
  spawnConfig: managedSpawnConfigSchema,
137
- baseUrl: z.url()
167
+ baseUrl: z.url(),
168
+ rosterPath: z.string().optional()
138
169
  });
139
170
 
140
171
  // src/discovery.ts
@@ -523,7 +554,7 @@ function isManagedRoster(directory) {
523
554
  // src/server.ts
524
555
  import { spawn } from "node:child_process";
525
556
  import { randomBytes as randomBytes2 } from "node:crypto";
526
- import { openSync as openSync2, readFileSync as readFileSync3 } from "node:fs";
557
+ import { existsSync as existsSync2, openSync as openSync2, readFileSync as readFileSync3, realpathSync as realpathSync2 } from "node:fs";
527
558
  import { dirname } from "node:path";
528
559
  var DEFAULT_READINESS_BUDGET_MS = 15000;
529
560
  var DEFAULT_LOCK_WAIT_BUDGET_MS = 15000;
@@ -777,7 +808,8 @@ async function spawnAndWaitReady(rosterPath, managedConfig, readinessBudgetMs) {
777
808
  identity: finalIdentity,
778
809
  password,
779
810
  spawnConfig: { command, cwd, port: requestedPort },
780
- baseUrl
811
+ baseUrl,
812
+ rosterPath
781
813
  });
782
814
  return {
783
815
  baseUrl,
@@ -787,6 +819,9 @@ async function spawnAndWaitReady(rosterPath, managedConfig, readinessBudgetMs) {
787
819
  };
788
820
  }
789
821
  async function ensureServer(rosterPath, options = {}) {
822
+ if (existsSync2(rosterPath)) {
823
+ rosterPath = realpathSync2(rosterPath);
824
+ }
790
825
  const readinessBudgetMs = options.readinessBudgetMs ?? DEFAULT_READINESS_BUDGET_MS;
791
826
  const lockWaitBudgetMs = options.lockWaitBudgetMs ?? DEFAULT_LOCK_WAIT_BUDGET_MS;
792
827
  const fastPath = attachServer(rosterPath);
@@ -1010,7 +1045,7 @@ import { fileURLToPath } from "node:url";
1010
1045
  import {
1011
1046
  chmodSync as chmodSync3,
1012
1047
  closeSync as closeSync3,
1013
- existsSync as existsSync2,
1048
+ existsSync as existsSync3,
1014
1049
  fchmodSync,
1015
1050
  constants as fsConstants3,
1016
1051
  mkdirSync as mkdirSync2,
@@ -1563,7 +1598,7 @@ async function serviceStatus(rosterPath, deps = {}) {
1563
1598
  if (!gate.ok)
1564
1599
  return { ok: false, error: gate.error };
1565
1600
  const { label, plistFilePath } = identityFor(rosterPath, resolved.launchAgentsDir);
1566
- const installed = existsSync2(plistFilePath);
1601
+ const installed = existsSync3(plistFilePath);
1567
1602
  const job = await probeJob(resolved, label);
1568
1603
  if (!job.ok) {
1569
1604
  return { ok: false, error: `failed to probe job: ${job.error}` };
@@ -1603,7 +1638,7 @@ async function startService(rosterPath, deps = {}) {
1603
1638
  if (!gate.ok)
1604
1639
  return { ok: false, error: gate.error };
1605
1640
  const { label, plistFilePath, stateDir } = identityFor(rosterPath, resolved.launchAgentsDir);
1606
- if (!existsSync2(plistFilePath)) {
1641
+ if (!existsSync3(plistFilePath)) {
1607
1642
  return {
1608
1643
  ok: false,
1609
1644
  error: `space-bus service is not installed for this roster — run \`space-bus service install\``
package/dist/config.js CHANGED
@@ -127,13 +127,44 @@ var managedSpawnConfigSchema = z.object({
127
127
  cwd: z.string().optional(),
128
128
  port: z.number().int().nonnegative().optional()
129
129
  });
130
+ var registryEntrySchema = z.object({
131
+ name: z.string().regex(/^[a-z0-9-]{1,64}$/, "roster name must be 1-64 lowercase letters, digits, or hyphens"),
132
+ path: z.string().min(1, "roster path must not be empty")
133
+ });
134
+ var registryFileSchema = z.object({
135
+ version: z.literal(1),
136
+ default: z.string().optional(),
137
+ rosters: z.array(registryEntrySchema)
138
+ }).superRefine((val, ctx) => {
139
+ const seen = new Set;
140
+ for (const entry of val.rosters) {
141
+ const key = entry.name.toLowerCase();
142
+ if (seen.has(key)) {
143
+ ctx.addIssue({
144
+ code: "custom",
145
+ message: `space-bus: duplicate roster name "${entry.name}" (case-insensitive) in registry`
146
+ });
147
+ }
148
+ seen.add(key);
149
+ }
150
+ if (val.default !== undefined) {
151
+ const matches = val.rosters.filter((entry) => entry.name === val.default);
152
+ if (matches.length !== 1) {
153
+ ctx.addIssue({
154
+ code: "custom",
155
+ message: `space-bus: registry's default "${val.default}" must match exactly one roster entry's name (matched ${matches.length})`
156
+ });
157
+ }
158
+ }
159
+ });
130
160
  var discoveryFileSchema = z.object({
131
161
  port: z.number().int().nonnegative(),
132
162
  pid: z.number().int().min(2),
133
163
  identity: z.string(),
134
164
  password: z.string(),
135
165
  spawnConfig: managedSpawnConfigSchema,
136
- baseUrl: z.url()
166
+ baseUrl: z.url(),
167
+ rosterPath: z.string().optional()
137
168
  });
138
169
 
139
170
  // src/discovery.ts
@@ -250,6 +250,20 @@ export declare const managedSpawnConfigSchema: z.ZodObject<{
250
250
  cwd: z.ZodOptional<z.ZodString>;
251
251
  port: z.ZodOptional<z.ZodNumber>;
252
252
  }, z.core.$strip>;
253
+ export declare const registryEntrySchema: z.ZodObject<{
254
+ name: z.ZodString;
255
+ path: z.ZodString;
256
+ }, z.core.$strip>;
257
+ export type RegistryEntry = z.infer<typeof registryEntrySchema>;
258
+ export declare const registryFileSchema: z.ZodObject<{
259
+ version: z.ZodLiteral<1>;
260
+ default: z.ZodOptional<z.ZodString>;
261
+ rosters: z.ZodArray<z.ZodObject<{
262
+ name: z.ZodString;
263
+ path: z.ZodString;
264
+ }, z.core.$strip>>;
265
+ }, z.core.$strip>;
266
+ export type RegistryFile = z.infer<typeof registryFileSchema>;
253
267
  export declare const discoveryFileSchema: z.ZodObject<{
254
268
  port: z.ZodNumber;
255
269
  pid: z.ZodNumber;
@@ -261,4 +275,5 @@ export declare const discoveryFileSchema: z.ZodObject<{
261
275
  port: z.ZodOptional<z.ZodNumber>;
262
276
  }, z.core.$strip>;
263
277
  baseUrl: z.ZodURL;
278
+ rosterPath: z.ZodOptional<z.ZodString>;
264
279
  }, z.core.$strip>;
package/dist/contract.js CHANGED
@@ -118,13 +118,44 @@ var managedSpawnConfigSchema = z.object({
118
118
  cwd: z.string().optional(),
119
119
  port: z.number().int().nonnegative().optional()
120
120
  });
121
+ var registryEntrySchema = z.object({
122
+ name: z.string().regex(/^[a-z0-9-]{1,64}$/, "roster name must be 1-64 lowercase letters, digits, or hyphens"),
123
+ path: z.string().min(1, "roster path must not be empty")
124
+ });
125
+ var registryFileSchema = z.object({
126
+ version: z.literal(1),
127
+ default: z.string().optional(),
128
+ rosters: z.array(registryEntrySchema)
129
+ }).superRefine((val, ctx) => {
130
+ const seen = new Set;
131
+ for (const entry of val.rosters) {
132
+ const key = entry.name.toLowerCase();
133
+ if (seen.has(key)) {
134
+ ctx.addIssue({
135
+ code: "custom",
136
+ message: `space-bus: duplicate roster name "${entry.name}" (case-insensitive) in registry`
137
+ });
138
+ }
139
+ seen.add(key);
140
+ }
141
+ if (val.default !== undefined) {
142
+ const matches = val.rosters.filter((entry) => entry.name === val.default);
143
+ if (matches.length !== 1) {
144
+ ctx.addIssue({
145
+ code: "custom",
146
+ message: `space-bus: registry's default "${val.default}" must match exactly one roster entry's name (matched ${matches.length})`
147
+ });
148
+ }
149
+ }
150
+ });
121
151
  var discoveryFileSchema = z.object({
122
152
  port: z.number().int().nonnegative(),
123
153
  pid: z.number().int().min(2),
124
154
  identity: z.string(),
125
155
  password: z.string(),
126
156
  spawnConfig: managedSpawnConfigSchema,
127
- baseUrl: z.url()
157
+ baseUrl: z.url(),
158
+ rosterPath: z.string().optional()
128
159
  });
129
160
  export {
130
161
  vcsStatusSchema,
@@ -140,6 +171,8 @@ export {
140
171
  sessionSchema,
141
172
  sessionListSchema,
142
173
  rosterSchema,
174
+ registryFileSchema,
175
+ registryEntrySchema,
143
176
  questionListSchema,
144
177
  questionEntrySchema,
145
178
  projectSchema,
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/index.js CHANGED
@@ -127,13 +127,44 @@ var managedSpawnConfigSchema = z.object({
127
127
  cwd: z.string().optional(),
128
128
  port: z.number().int().nonnegative().optional()
129
129
  });
130
+ var registryEntrySchema = z.object({
131
+ name: z.string().regex(/^[a-z0-9-]{1,64}$/, "roster name must be 1-64 lowercase letters, digits, or hyphens"),
132
+ path: z.string().min(1, "roster path must not be empty")
133
+ });
134
+ var registryFileSchema = z.object({
135
+ version: z.literal(1),
136
+ default: z.string().optional(),
137
+ rosters: z.array(registryEntrySchema)
138
+ }).superRefine((val, ctx) => {
139
+ const seen = new Set;
140
+ for (const entry of val.rosters) {
141
+ const key = entry.name.toLowerCase();
142
+ if (seen.has(key)) {
143
+ ctx.addIssue({
144
+ code: "custom",
145
+ message: `space-bus: duplicate roster name "${entry.name}" (case-insensitive) in registry`
146
+ });
147
+ }
148
+ seen.add(key);
149
+ }
150
+ if (val.default !== undefined) {
151
+ const matches = val.rosters.filter((entry) => entry.name === val.default);
152
+ if (matches.length !== 1) {
153
+ ctx.addIssue({
154
+ code: "custom",
155
+ message: `space-bus: registry's default "${val.default}" must match exactly one roster entry's name (matched ${matches.length})`
156
+ });
157
+ }
158
+ }
159
+ });
130
160
  var discoveryFileSchema = z.object({
131
161
  port: z.number().int().nonnegative(),
132
162
  pid: z.number().int().min(2),
133
163
  identity: z.string(),
134
164
  password: z.string(),
135
165
  spawnConfig: managedSpawnConfigSchema,
136
- baseUrl: z.url()
166
+ baseUrl: z.url(),
167
+ rosterPath: z.string().optional()
137
168
  });
138
169
 
139
170
  // src/discovery.ts
@@ -522,7 +553,7 @@ function isManagedRoster(directory) {
522
553
  // src/server.ts
523
554
  import { spawn } from "node:child_process";
524
555
  import { randomBytes as randomBytes2 } from "node:crypto";
525
- import { openSync as openSync2, readFileSync as readFileSync3 } from "node:fs";
556
+ import { existsSync as existsSync2, openSync as openSync2, readFileSync as readFileSync3, realpathSync as realpathSync2 } from "node:fs";
526
557
  import { dirname } from "node:path";
527
558
  var DEFAULT_READINESS_BUDGET_MS = 15000;
528
559
  var DEFAULT_LOCK_WAIT_BUDGET_MS = 15000;
@@ -776,7 +807,8 @@ async function spawnAndWaitReady(rosterPath, managedConfig, readinessBudgetMs) {
776
807
  identity: finalIdentity,
777
808
  password,
778
809
  spawnConfig: { command, cwd, port: requestedPort },
779
- baseUrl
810
+ baseUrl,
811
+ rosterPath
780
812
  });
781
813
  return {
782
814
  baseUrl,
@@ -786,6 +818,9 @@ async function spawnAndWaitReady(rosterPath, managedConfig, readinessBudgetMs) {
786
818
  };
787
819
  }
788
820
  async function ensureServer(rosterPath, options = {}) {
821
+ if (existsSync2(rosterPath)) {
822
+ rosterPath = realpathSync2(rosterPath);
823
+ }
789
824
  const readinessBudgetMs = options.readinessBudgetMs ?? DEFAULT_READINESS_BUDGET_MS;
790
825
  const lockWaitBudgetMs = options.lockWaitBudgetMs ?? DEFAULT_LOCK_WAIT_BUDGET_MS;
791
826
  const fastPath = attachServer(rosterPath);
package/dist/mcp.js CHANGED
@@ -128,13 +128,44 @@ var managedSpawnConfigSchema = z.object({
128
128
  cwd: z.string().optional(),
129
129
  port: z.number().int().nonnegative().optional()
130
130
  });
131
+ var registryEntrySchema = z.object({
132
+ name: z.string().regex(/^[a-z0-9-]{1,64}$/, "roster name must be 1-64 lowercase letters, digits, or hyphens"),
133
+ path: z.string().min(1, "roster path must not be empty")
134
+ });
135
+ var registryFileSchema = z.object({
136
+ version: z.literal(1),
137
+ default: z.string().optional(),
138
+ rosters: z.array(registryEntrySchema)
139
+ }).superRefine((val, ctx) => {
140
+ const seen = new Set;
141
+ for (const entry of val.rosters) {
142
+ const key = entry.name.toLowerCase();
143
+ if (seen.has(key)) {
144
+ ctx.addIssue({
145
+ code: "custom",
146
+ message: `space-bus: duplicate roster name "${entry.name}" (case-insensitive) in registry`
147
+ });
148
+ }
149
+ seen.add(key);
150
+ }
151
+ if (val.default !== undefined) {
152
+ const matches = val.rosters.filter((entry) => entry.name === val.default);
153
+ if (matches.length !== 1) {
154
+ ctx.addIssue({
155
+ code: "custom",
156
+ message: `space-bus: registry's default "${val.default}" must match exactly one roster entry's name (matched ${matches.length})`
157
+ });
158
+ }
159
+ }
160
+ });
131
161
  var discoveryFileSchema = z.object({
132
162
  port: z.number().int().nonnegative(),
133
163
  pid: z.number().int().min(2),
134
164
  identity: z.string(),
135
165
  password: z.string(),
136
166
  spawnConfig: managedSpawnConfigSchema,
137
- baseUrl: z.url()
167
+ baseUrl: z.url(),
168
+ rosterPath: z.string().optional()
138
169
  });
139
170
 
140
171
  // src/discovery.ts
@@ -523,7 +554,7 @@ function isManagedRoster(directory) {
523
554
  // src/server.ts
524
555
  import { spawn } from "node:child_process";
525
556
  import { randomBytes as randomBytes2 } from "node:crypto";
526
- import { openSync as openSync2, readFileSync as readFileSync3 } from "node:fs";
557
+ import { existsSync as existsSync2, openSync as openSync2, readFileSync as readFileSync3, realpathSync as realpathSync2 } from "node:fs";
527
558
  import { dirname } from "node:path";
528
559
  var DEFAULT_READINESS_BUDGET_MS = 15000;
529
560
  var DEFAULT_LOCK_WAIT_BUDGET_MS = 15000;
@@ -777,7 +808,8 @@ async function spawnAndWaitReady(rosterPath, managedConfig, readinessBudgetMs) {
777
808
  identity: finalIdentity,
778
809
  password,
779
810
  spawnConfig: { command, cwd, port: requestedPort },
780
- baseUrl
811
+ baseUrl,
812
+ rosterPath
781
813
  });
782
814
  return {
783
815
  baseUrl,
@@ -787,6 +819,9 @@ async function spawnAndWaitReady(rosterPath, managedConfig, readinessBudgetMs) {
787
819
  };
788
820
  }
789
821
  async function ensureServer(rosterPath, options = {}) {
822
+ if (existsSync2(rosterPath)) {
823
+ rosterPath = realpathSync2(rosterPath);
824
+ }
790
825
  const readinessBudgetMs = options.readinessBudgetMs ?? DEFAULT_READINESS_BUDGET_MS;
791
826
  const lockWaitBudgetMs = options.lockWaitBudgetMs ?? DEFAULT_LOCK_WAIT_BUDGET_MS;
792
827
  const fastPath = attachServer(rosterPath);
@@ -1828,7 +1863,7 @@ async function mcpLoadContext() {
1828
1863
  }
1829
1864
  return loadContext();
1830
1865
  }
1831
- var version = "0.11.0";
1866
+ var version = "0.12.0";
1832
1867
  var server = new McpServer({
1833
1868
  name: "space-bus",
1834
1869
  version
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @experimental
3
+ * Experimental — shapes may change in minor releases.
4
+ *
5
+ * `/registry` library subpath barrel: re-exports the registry
6
+ * (list/register/unregister/set-default/resolve-name) and roster-edit
7
+ * (createRoster/add/remove/update project, edit server block) modules for
8
+ * external consumers (e.g. a Mothership webview or CLI) that want the
9
+ * mutation substrate without pulling in the tool/plugin/MCP surfaces.
10
+ * Node-only — joins config.ts's/discovery.ts's/server.ts's lane; MUST NOT
11
+ * be imported by core.ts, contract.ts, format.ts, or attach.ts.
12
+ *
13
+ * Both source modules independently declare a same-shaped `Result` type
14
+ * (`{ ok: true } | { ok: false; error: string }`); re-exporting both under
15
+ * one barrel would be an ambiguous-export collision, so each is re-exported
16
+ * here under a module-qualified alias instead of colliding on `Result`.
17
+ */
18
+ export type { Result as RegistryResult } from "./registry";
19
+ export { readRegistry, registerRoster, registryPath, resolveRosterByName, setDefaultRoster, unregisterRoster, } from "./registry";
20
+ export type { CreateRosterOpts, ProjectPatch, Result as RosterEditResult, RosterProjectInput, } from "./roster-edit";
21
+ export { addProject, createRoster, editServer, removeProject, updateProject, } from "./roster-edit";