@fro.bot/space-bus 0.13.1 → 0.15.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 +5 -1
- package/dist/attach.js +12 -2
- package/dist/cli.js +28 -15
- package/dist/config.d.ts +9 -4
- package/dist/config.js +27 -11
- package/dist/contract.d.ts +16 -0
- package/dist/contract.js +12 -2
- package/dist/core.d.ts +116 -1
- package/dist/core.js +326 -42
- package/dist/format.d.ts +1 -0
- package/dist/format.js +9 -1
- package/dist/index.js +162 -51
- package/dist/mcp.js +166 -53
- package/dist/registry-entry.js +27 -11
- package/dist/server.js +27 -11
- package/package.json +3 -3
package/dist/mcp.js
CHANGED
|
@@ -73,7 +73,11 @@ var messagePartSchema = z.looseObject({
|
|
|
73
73
|
text: z.string().optional()
|
|
74
74
|
});
|
|
75
75
|
var messageEnvelopeSchema = z.looseObject({
|
|
76
|
-
info: z.looseObject({
|
|
76
|
+
info: z.looseObject({
|
|
77
|
+
id: z.string().optional(),
|
|
78
|
+
role: z.string(),
|
|
79
|
+
time: z.looseObject({ created: z.number().optional() }).optional()
|
|
80
|
+
}),
|
|
77
81
|
parts: z.array(messagePartSchema)
|
|
78
82
|
});
|
|
79
83
|
var messageListSchema = z.array(messageEnvelopeSchema);
|
|
@@ -82,7 +86,13 @@ var pendingQuestionEntrySchema = z.looseObject({
|
|
|
82
86
|
sessionID: z.string(),
|
|
83
87
|
questions: z.array(z.looseObject({
|
|
84
88
|
question: z.string().optional(),
|
|
85
|
-
|
|
89
|
+
header: z.string().optional(),
|
|
90
|
+
multiple: z.boolean().optional(),
|
|
91
|
+
custom: z.boolean().optional(),
|
|
92
|
+
options: z.array(z.looseObject({
|
|
93
|
+
label: z.string().optional(),
|
|
94
|
+
description: z.string().optional()
|
|
95
|
+
})).optional()
|
|
86
96
|
})).optional()
|
|
87
97
|
});
|
|
88
98
|
var pendingQuestionListSchema = z.array(pendingQuestionEntrySchema);
|
|
@@ -843,17 +853,23 @@ var manifestSchema = z3.object({
|
|
|
843
853
|
function expandHome(path) {
|
|
844
854
|
return path.startsWith("~") ? join3(homedir3(), path.slice(1)) : path;
|
|
845
855
|
}
|
|
846
|
-
function
|
|
856
|
+
function resolveExplicitOverride(override, sourceLabel) {
|
|
857
|
+
if (override.includes("://")) {
|
|
858
|
+
throw new Error(`space-bus: ${sourceLabel} must be an absolute path or start with ~ (got a URL: ${override})`);
|
|
859
|
+
}
|
|
860
|
+
const expanded = expandHome(override);
|
|
861
|
+
if (!expanded.startsWith("/")) {
|
|
862
|
+
throw new Error(`space-bus: ${sourceLabel} must be an absolute path or start with ~ (got: ${override})`);
|
|
863
|
+
}
|
|
864
|
+
return existsSync(expanded) ? realpathSync2(expanded) : expanded;
|
|
865
|
+
}
|
|
866
|
+
function resolveRosterPath(directory, explicitOverride) {
|
|
867
|
+
if (explicitOverride) {
|
|
868
|
+
return resolveExplicitOverride(explicitOverride, "--config");
|
|
869
|
+
}
|
|
847
870
|
const override = process.env["SPACE_BUS_CONFIG"];
|
|
848
871
|
if (override) {
|
|
849
|
-
|
|
850
|
-
throw new Error(`space-bus: SPACE_BUS_CONFIG must be an absolute path or start with ~ (got a URL: ${override})`);
|
|
851
|
-
}
|
|
852
|
-
const expanded = expandHome(override);
|
|
853
|
-
if (!expanded.startsWith("/")) {
|
|
854
|
-
throw new Error(`space-bus: SPACE_BUS_CONFIG must be an absolute path or start with ~ (got: ${override})`);
|
|
855
|
-
}
|
|
856
|
-
return existsSync(expanded) ? realpathSync2(expanded) : expanded;
|
|
872
|
+
return resolveExplicitOverride(override, "SPACE_BUS_CONFIG");
|
|
857
873
|
}
|
|
858
874
|
if (directory) {
|
|
859
875
|
const candidate = join3(directory, "spacebus.json");
|
|
@@ -1448,6 +1464,15 @@ function findProject(projects, name) {
|
|
|
1448
1464
|
function err(error) {
|
|
1449
1465
|
return { ok: false, error };
|
|
1450
1466
|
}
|
|
1467
|
+
function dispatchErr(error, failure) {
|
|
1468
|
+
const dispatchFailure = {
|
|
1469
|
+
phase: failure.phase,
|
|
1470
|
+
project: failure.project,
|
|
1471
|
+
...failure.sessionId !== undefined ? { sessionId: failure.sessionId } : {},
|
|
1472
|
+
...failure.messageId !== undefined ? { messageId: failure.messageId } : {}
|
|
1473
|
+
};
|
|
1474
|
+
return { ok: false, error, dispatchFailure };
|
|
1475
|
+
}
|
|
1451
1476
|
function toBase64(s) {
|
|
1452
1477
|
const bytes = new TextEncoder().encode(s);
|
|
1453
1478
|
let bin = "";
|
|
@@ -1647,7 +1672,7 @@ async function roster(opts) {
|
|
|
1647
1672
|
}));
|
|
1648
1673
|
return { ok: true, projects: results };
|
|
1649
1674
|
}
|
|
1650
|
-
async function dispatchNew(baseUrl, credentials, projects, project, prompt, title) {
|
|
1675
|
+
async function dispatchNew(baseUrl, credentials, projects, project, prompt, title, messageId) {
|
|
1651
1676
|
const resolved = resolveProjectOrErr(projects, project);
|
|
1652
1677
|
if (!resolved.ok)
|
|
1653
1678
|
return resolved;
|
|
@@ -1658,27 +1683,54 @@ async function dispatchNew(baseUrl, credentials, projects, project, prompt, titl
|
|
|
1658
1683
|
body: JSON.stringify({ title: sessionTitle })
|
|
1659
1684
|
});
|
|
1660
1685
|
if (!createRes.res.ok) {
|
|
1661
|
-
return
|
|
1686
|
+
return dispatchErr(`space-bus: failed to create session in "${project}" (${createRes.res.status}): ${createRes.bodyText}`, { phase: "indeterminate", project, messageId });
|
|
1662
1687
|
}
|
|
1663
1688
|
let session;
|
|
1664
1689
|
try {
|
|
1665
1690
|
session = sessionSchema.parse(JSON.parse(createRes.bodyText));
|
|
1666
1691
|
} catch (e) {
|
|
1667
|
-
return
|
|
1692
|
+
return dispatchErr(`space-bus: unexpected /session response shape: ${e.message}`, { phase: "indeterminate", project, messageId });
|
|
1668
1693
|
}
|
|
1669
1694
|
const promptRes = await api(baseUrl, credentials, directory, `/session/${encodeURIComponent(session.id)}/prompt_async`, {
|
|
1670
1695
|
method: "POST",
|
|
1671
|
-
body: JSON.stringify({
|
|
1696
|
+
body: JSON.stringify({
|
|
1697
|
+
parts: [{ type: "text", text: prompt }],
|
|
1698
|
+
...messageId !== undefined ? { messageID: messageId } : {}
|
|
1699
|
+
})
|
|
1672
1700
|
});
|
|
1673
1701
|
if (promptRes.res.status !== 204) {
|
|
1674
|
-
return
|
|
1702
|
+
return dispatchErr(`space-bus: dispatch to "${project}" failed sending prompt (${promptRes.res.status}): ${promptRes.bodyText}`, { phase: "indeterminate", project, sessionId: session.id, messageId });
|
|
1703
|
+
}
|
|
1704
|
+
return {
|
|
1705
|
+
ok: true,
|
|
1706
|
+
sessionId: session.id,
|
|
1707
|
+
project,
|
|
1708
|
+
directory,
|
|
1709
|
+
...messageId !== undefined ? { messageId } : {}
|
|
1710
|
+
};
|
|
1711
|
+
}
|
|
1712
|
+
var MESSAGE_ID_PATTERN = /^msg_[0-9a-f]{12}[0-9A-Za-z]{14}$/;
|
|
1713
|
+
var INVALID_MESSAGE_ID_ERROR = "space-bus: messageId must be msg_ followed by exactly 12 hex characters and 14 alphanumeric characters";
|
|
1714
|
+
function validateMessageId(messageId) {
|
|
1715
|
+
if (!MESSAGE_ID_PATTERN.test(messageId)) {
|
|
1716
|
+
return err(INVALID_MESSAGE_ID_ERROR);
|
|
1675
1717
|
}
|
|
1676
|
-
return { ok: true,
|
|
1718
|
+
return { ok: true, messageId };
|
|
1677
1719
|
}
|
|
1678
1720
|
function toDispatchArgs(input) {
|
|
1721
|
+
if (input.onPendingQuestion !== undefined && input.onPendingQuestion !== "question-reply" && input.onPendingQuestion !== "blocked") {
|
|
1722
|
+
return err(`space-bus: onPendingQuestion must be "question-reply" or "blocked", got ${JSON.stringify(input.onPendingQuestion)}`);
|
|
1723
|
+
}
|
|
1679
1724
|
if (input.sessionId !== undefined && input.sessionId === "") {
|
|
1680
1725
|
return err("space-bus: sessionId must be a non-empty string");
|
|
1681
1726
|
}
|
|
1727
|
+
let messageId;
|
|
1728
|
+
if (input.messageId !== undefined) {
|
|
1729
|
+
const validated = validateMessageId(input.messageId);
|
|
1730
|
+
if (!validated.ok)
|
|
1731
|
+
return validated;
|
|
1732
|
+
messageId = validated.messageId;
|
|
1733
|
+
}
|
|
1682
1734
|
if (!input.sessionId) {
|
|
1683
1735
|
if (!input.project) {
|
|
1684
1736
|
return err("space-bus: project is required when starting a new session");
|
|
@@ -1687,7 +1739,9 @@ function toDispatchArgs(input) {
|
|
|
1687
1739
|
ok: true,
|
|
1688
1740
|
prompt: input.prompt,
|
|
1689
1741
|
title: input.title,
|
|
1690
|
-
project: input.project
|
|
1742
|
+
project: input.project,
|
|
1743
|
+
onPendingQuestion: input.onPendingQuestion,
|
|
1744
|
+
...messageId !== undefined ? { messageId } : {}
|
|
1691
1745
|
};
|
|
1692
1746
|
}
|
|
1693
1747
|
return {
|
|
@@ -1695,7 +1749,22 @@ function toDispatchArgs(input) {
|
|
|
1695
1749
|
prompt: input.prompt,
|
|
1696
1750
|
title: input.title,
|
|
1697
1751
|
sessionId: input.sessionId,
|
|
1698
|
-
project: input.project
|
|
1752
|
+
project: input.project,
|
|
1753
|
+
onPendingQuestion: input.onPendingQuestion,
|
|
1754
|
+
...messageId !== undefined ? { messageId } : {}
|
|
1755
|
+
};
|
|
1756
|
+
}
|
|
1757
|
+
async function dispatchNewBranch(baseUrl, credentials, projects, args) {
|
|
1758
|
+
const r = await dispatchNew(baseUrl, credentials, projects, args.project, args.prompt, args.title, args.messageId);
|
|
1759
|
+
if (!r.ok)
|
|
1760
|
+
return r;
|
|
1761
|
+
return {
|
|
1762
|
+
ok: true,
|
|
1763
|
+
sessionId: r.sessionId,
|
|
1764
|
+
project: r.project,
|
|
1765
|
+
mode: "new",
|
|
1766
|
+
directory: r.directory,
|
|
1767
|
+
...r.messageId !== undefined ? { messageId: r.messageId } : {}
|
|
1699
1768
|
};
|
|
1700
1769
|
}
|
|
1701
1770
|
async function dispatch(args, opts) {
|
|
@@ -1703,6 +1772,11 @@ async function dispatch(args, opts) {
|
|
|
1703
1772
|
if (!ctx.ok)
|
|
1704
1773
|
return ctx;
|
|
1705
1774
|
const { baseUrl, projects, credentials } = ctx;
|
|
1775
|
+
if (args.messageId !== undefined) {
|
|
1776
|
+
const validated = validateMessageId(args.messageId);
|
|
1777
|
+
if (!validated.ok)
|
|
1778
|
+
return validated;
|
|
1779
|
+
}
|
|
1706
1780
|
if (args.sessionId !== undefined && args.sessionId === "") {
|
|
1707
1781
|
return err("space-bus: sessionId must be a non-empty string");
|
|
1708
1782
|
}
|
|
@@ -1710,16 +1784,10 @@ async function dispatch(args, opts) {
|
|
|
1710
1784
|
if (!args.project) {
|
|
1711
1785
|
return err("space-bus: project is required when starting a new session");
|
|
1712
1786
|
}
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
ok: true,
|
|
1718
|
-
sessionId: r.sessionId,
|
|
1719
|
-
project: r.project,
|
|
1720
|
-
mode: "new",
|
|
1721
|
-
directory: r.directory
|
|
1722
|
-
};
|
|
1787
|
+
return dispatchNewBranch(baseUrl, credentials, projects, {
|
|
1788
|
+
...args,
|
|
1789
|
+
project: args.project
|
|
1790
|
+
});
|
|
1723
1791
|
}
|
|
1724
1792
|
const loc = await findSessionDirectory(baseUrl, credentials, projects, args.sessionId);
|
|
1725
1793
|
if (!loc.ok)
|
|
@@ -1728,7 +1796,7 @@ async function dispatch(args, opts) {
|
|
|
1728
1796
|
if (args.project && args.project !== project) {
|
|
1729
1797
|
return err(`space-bus: session ${args.sessionId} belongs to project "${project}", not "${args.project}" — refusing to steer the wrong session`);
|
|
1730
1798
|
}
|
|
1731
|
-
return steerSession(baseUrl, credentials, args.sessionId, args.prompt, directory, project);
|
|
1799
|
+
return steerSession(baseUrl, credentials, args.sessionId, args.prompt, directory, project, args.onPendingQuestion ?? "question-reply", args.messageId);
|
|
1732
1800
|
}
|
|
1733
1801
|
async function findSessionDirectory(baseUrl, credentials, projects, sessionId) {
|
|
1734
1802
|
for (const p of projects) {
|
|
@@ -1833,35 +1901,69 @@ async function status(sessionId, opts) {
|
|
|
1833
1901
|
resultAvailable: state === "complete"
|
|
1834
1902
|
};
|
|
1835
1903
|
}
|
|
1836
|
-
async function
|
|
1904
|
+
async function resolvePendingQuestionForSteer(baseUrl, credentials, directory, sessionId, project, onPendingQuestion) {
|
|
1837
1905
|
const questionsRes = await api(baseUrl, credentials, directory, "/question");
|
|
1838
|
-
if (questionsRes.res.ok) {
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
questions = questionListSchema.parse(JSON.parse(questionsRes.bodyText));
|
|
1842
|
-
} catch {
|
|
1843
|
-
questions = [];
|
|
1906
|
+
if (!questionsRes.res.ok) {
|
|
1907
|
+
if (onPendingQuestion === "blocked") {
|
|
1908
|
+
return dispatchErr(`space-bus: could not verify pending-question state for session ${sessionId} (/question ${questionsRes.res.status}) — refusing to dispatch under the blocked policy`, { phase: "not_sent", project, sessionId });
|
|
1844
1909
|
}
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1910
|
+
return { ok: true, pending: undefined };
|
|
1911
|
+
}
|
|
1912
|
+
let pendingList;
|
|
1913
|
+
try {
|
|
1914
|
+
pendingList = questionListSchema.parse(JSON.parse(questionsRes.bodyText));
|
|
1915
|
+
} catch (e) {
|
|
1916
|
+
if (onPendingQuestion === "blocked") {
|
|
1917
|
+
return dispatchErr(`space-bus: could not parse pending-question state for session ${sessionId}: ${e.message} — refusing to dispatch under the blocked policy`, { phase: "not_sent", project, sessionId });
|
|
1918
|
+
}
|
|
1919
|
+
return { ok: true, pending: undefined };
|
|
1920
|
+
}
|
|
1921
|
+
return {
|
|
1922
|
+
ok: true,
|
|
1923
|
+
pending: pendingList.find((q) => q.sessionID === sessionId)
|
|
1924
|
+
};
|
|
1925
|
+
}
|
|
1926
|
+
async function steerSession(baseUrl, credentials, sessionId, message, directory, project, onPendingQuestion, messageId) {
|
|
1927
|
+
const pendingRes = await resolvePendingQuestionForSteer(baseUrl, credentials, directory, sessionId, project, onPendingQuestion);
|
|
1928
|
+
if (!pendingRes.ok)
|
|
1929
|
+
return pendingRes;
|
|
1930
|
+
const { pending } = pendingRes;
|
|
1931
|
+
if (pending && onPendingQuestion === "blocked") {
|
|
1932
|
+
return {
|
|
1933
|
+
ok: true,
|
|
1934
|
+
sessionId,
|
|
1935
|
+
project,
|
|
1936
|
+
mode: "blocked",
|
|
1937
|
+
requestId: pending.id
|
|
1938
|
+
};
|
|
1939
|
+
}
|
|
1940
|
+
if (pending) {
|
|
1941
|
+
const replyRes = await api(baseUrl, credentials, directory, `/question/${encodeURIComponent(pending.id)}/reply`, {
|
|
1942
|
+
method: "POST",
|
|
1943
|
+
body: JSON.stringify({ answers: [[message]] })
|
|
1944
|
+
});
|
|
1945
|
+
if (!replyRes.res.ok) {
|
|
1946
|
+
return dispatchErr(`space-bus: failed to reply to question ${pending.id} for session ${sessionId} (${replyRes.res.status}): ${replyRes.bodyText}`, { phase: "indeterminate", project, sessionId });
|
|
1855
1947
|
}
|
|
1948
|
+
return { ok: true, sessionId, project, mode: "question-reply" };
|
|
1856
1949
|
}
|
|
1857
1950
|
const promptRes = await api(baseUrl, credentials, directory, `/session/${encodeURIComponent(sessionId)}/prompt_async`, {
|
|
1858
1951
|
method: "POST",
|
|
1859
|
-
body: JSON.stringify({
|
|
1952
|
+
body: JSON.stringify({
|
|
1953
|
+
parts: [{ type: "text", text: message }],
|
|
1954
|
+
...messageId !== undefined ? { messageID: messageId } : {}
|
|
1955
|
+
})
|
|
1860
1956
|
});
|
|
1861
1957
|
if (promptRes.res.status !== 204) {
|
|
1862
|
-
return
|
|
1958
|
+
return dispatchErr(`space-bus: follow-up prompt to session ${sessionId} failed (${promptRes.res.status}): ${promptRes.bodyText}`, { phase: "indeterminate", project, sessionId, messageId });
|
|
1863
1959
|
}
|
|
1864
|
-
return {
|
|
1960
|
+
return {
|
|
1961
|
+
ok: true,
|
|
1962
|
+
sessionId,
|
|
1963
|
+
project,
|
|
1964
|
+
mode: "follow-up",
|
|
1965
|
+
...messageId !== undefined ? { messageId } : {}
|
|
1966
|
+
};
|
|
1865
1967
|
}
|
|
1866
1968
|
async function result(sessionId, opts) {
|
|
1867
1969
|
const ctx = validateContext(opts.context);
|
|
@@ -2054,10 +2156,18 @@ function formatDispatch(r) {
|
|
|
2054
2156
|
return `Replied to pending question in session ${r.sessionId} (${r.project}).`;
|
|
2055
2157
|
case "follow-up":
|
|
2056
2158
|
return `Follow-up prompt sent to session ${r.sessionId} (${r.project}).`;
|
|
2159
|
+
case "blocked":
|
|
2160
|
+
return `Blocked: session ${r.sessionId} (${r.project}) has a pending question (${r.requestId}) — no reply or prompt sent.`;
|
|
2057
2161
|
}
|
|
2058
2162
|
}
|
|
2059
2163
|
function dispatchMetadata(r) {
|
|
2060
|
-
|
|
2164
|
+
const messageId = (r.mode === "new" || r.mode === "follow-up") && r.messageId !== undefined ? r.messageId : undefined;
|
|
2165
|
+
return {
|
|
2166
|
+
sessionId: r.sessionId,
|
|
2167
|
+
project: r.project,
|
|
2168
|
+
mode: r.mode,
|
|
2169
|
+
...messageId !== undefined ? { messageId } : {}
|
|
2170
|
+
};
|
|
2061
2171
|
}
|
|
2062
2172
|
function formatStatus(r) {
|
|
2063
2173
|
const todoLines = r.todos.length ? r.todos.map((t) => ` - [${t.status}] ${t.content} (${t.priority})`).join(`
|
|
@@ -2795,6 +2905,7 @@ function makeBusTask(defaultDirectory) {
|
|
|
2795
2905
|
prompt: tool5.schema.string().describe("The prompt to send to the delegated agent"),
|
|
2796
2906
|
title: tool5.schema.string().optional().describe("Optional session title (only used when starting a new session)"),
|
|
2797
2907
|
sessionId: tool5.schema.string().optional().describe("Existing session ID to steer instead of starting a new session"),
|
|
2908
|
+
messageId: tool5.schema.string().optional().describe("Optional caller-supplied id to correlate this prompt with the message OpenCode creates for it (msg_ + 12 hex + 14 alphanumeric chars). Omit to dispatch without correlation."),
|
|
2798
2909
|
roster: tool5.schema.string().optional().describe("Registry roster name to target. Resolution precedence: this param > workspace directory (see bus_registry to list)")
|
|
2799
2910
|
},
|
|
2800
2911
|
async execute(args, ctx) {
|
|
@@ -2904,7 +3015,7 @@ async function mcpLoadContext(rosterName, ensure = ensureServer) {
|
|
|
2904
3015
|
}
|
|
2905
3016
|
throw ambientError;
|
|
2906
3017
|
}
|
|
2907
|
-
var version = "0.
|
|
3018
|
+
var version = "0.15.0";
|
|
2908
3019
|
var server = new McpServer({
|
|
2909
3020
|
name: "space-bus",
|
|
2910
3021
|
version
|
|
@@ -2944,12 +3055,14 @@ server.registerTool("bus_task", {
|
|
|
2944
3055
|
prompt: z5.string().describe("The prompt to send to the delegated agent"),
|
|
2945
3056
|
title: z5.string().optional().describe("Optional session title (only used when starting a new session)"),
|
|
2946
3057
|
sessionId: z5.string().optional().describe("Existing session ID to steer instead of starting a new session"),
|
|
3058
|
+
messageId: z5.string().optional().describe("Optional caller-supplied id to correlate this prompt with the message OpenCode creates for it (msg_ + 12 hex + 14 alphanumeric chars). Omit to dispatch without correlation."),
|
|
2947
3059
|
roster: ROSTER_PARAM_SCHEMA
|
|
2948
3060
|
},
|
|
2949
3061
|
outputSchema: {
|
|
2950
3062
|
sessionId: z5.string().describe("The dispatched or steered session ID"),
|
|
2951
3063
|
project: z5.string().describe("Manifest project name that owns the session"),
|
|
2952
|
-
mode: z5.enum(["new", "question-reply", "follow-up"]).describe("How the prompt was delivered")
|
|
3064
|
+
mode: z5.enum(["new", "question-reply", "follow-up"]).describe("How the prompt was delivered"),
|
|
3065
|
+
messageId: z5.string().optional().describe("Echoes the supplied messageId for new/follow-up dispatches; omitted otherwise")
|
|
2953
3066
|
}
|
|
2954
3067
|
}, async (args) => {
|
|
2955
3068
|
const dispatchArgs = toDispatchArgs(args);
|
package/dist/registry-entry.js
CHANGED
|
@@ -72,7 +72,11 @@ var messagePartSchema = z.looseObject({
|
|
|
72
72
|
text: z.string().optional()
|
|
73
73
|
});
|
|
74
74
|
var messageEnvelopeSchema = z.looseObject({
|
|
75
|
-
info: z.looseObject({
|
|
75
|
+
info: z.looseObject({
|
|
76
|
+
id: z.string().optional(),
|
|
77
|
+
role: z.string(),
|
|
78
|
+
time: z.looseObject({ created: z.number().optional() }).optional()
|
|
79
|
+
}),
|
|
76
80
|
parts: z.array(messagePartSchema)
|
|
77
81
|
});
|
|
78
82
|
var messageListSchema = z.array(messageEnvelopeSchema);
|
|
@@ -81,7 +85,13 @@ var pendingQuestionEntrySchema = z.looseObject({
|
|
|
81
85
|
sessionID: z.string(),
|
|
82
86
|
questions: z.array(z.looseObject({
|
|
83
87
|
question: z.string().optional(),
|
|
84
|
-
|
|
88
|
+
header: z.string().optional(),
|
|
89
|
+
multiple: z.boolean().optional(),
|
|
90
|
+
custom: z.boolean().optional(),
|
|
91
|
+
options: z.array(z.looseObject({
|
|
92
|
+
label: z.string().optional(),
|
|
93
|
+
description: z.string().optional()
|
|
94
|
+
})).optional()
|
|
85
95
|
})).optional()
|
|
86
96
|
});
|
|
87
97
|
var pendingQuestionListSchema = z.array(pendingQuestionEntrySchema);
|
|
@@ -842,17 +852,23 @@ var manifestSchema = z3.object({
|
|
|
842
852
|
function expandHome(path) {
|
|
843
853
|
return path.startsWith("~") ? join3(homedir3(), path.slice(1)) : path;
|
|
844
854
|
}
|
|
845
|
-
function
|
|
855
|
+
function resolveExplicitOverride(override, sourceLabel) {
|
|
856
|
+
if (override.includes("://")) {
|
|
857
|
+
throw new Error(`space-bus: ${sourceLabel} must be an absolute path or start with ~ (got a URL: ${override})`);
|
|
858
|
+
}
|
|
859
|
+
const expanded = expandHome(override);
|
|
860
|
+
if (!expanded.startsWith("/")) {
|
|
861
|
+
throw new Error(`space-bus: ${sourceLabel} must be an absolute path or start with ~ (got: ${override})`);
|
|
862
|
+
}
|
|
863
|
+
return existsSync(expanded) ? realpathSync2(expanded) : expanded;
|
|
864
|
+
}
|
|
865
|
+
function resolveRosterPath(directory, explicitOverride) {
|
|
866
|
+
if (explicitOverride) {
|
|
867
|
+
return resolveExplicitOverride(explicitOverride, "--config");
|
|
868
|
+
}
|
|
846
869
|
const override = process.env["SPACE_BUS_CONFIG"];
|
|
847
870
|
if (override) {
|
|
848
|
-
|
|
849
|
-
throw new Error(`space-bus: SPACE_BUS_CONFIG must be an absolute path or start with ~ (got a URL: ${override})`);
|
|
850
|
-
}
|
|
851
|
-
const expanded = expandHome(override);
|
|
852
|
-
if (!expanded.startsWith("/")) {
|
|
853
|
-
throw new Error(`space-bus: SPACE_BUS_CONFIG must be an absolute path or start with ~ (got: ${override})`);
|
|
854
|
-
}
|
|
855
|
-
return existsSync(expanded) ? realpathSync2(expanded) : expanded;
|
|
871
|
+
return resolveExplicitOverride(override, "SPACE_BUS_CONFIG");
|
|
856
872
|
}
|
|
857
873
|
if (directory) {
|
|
858
874
|
const candidate = join3(directory, "spacebus.json");
|
package/dist/server.js
CHANGED
|
@@ -72,7 +72,11 @@ var messagePartSchema = z.looseObject({
|
|
|
72
72
|
text: z.string().optional()
|
|
73
73
|
});
|
|
74
74
|
var messageEnvelopeSchema = z.looseObject({
|
|
75
|
-
info: z.looseObject({
|
|
75
|
+
info: z.looseObject({
|
|
76
|
+
id: z.string().optional(),
|
|
77
|
+
role: z.string(),
|
|
78
|
+
time: z.looseObject({ created: z.number().optional() }).optional()
|
|
79
|
+
}),
|
|
76
80
|
parts: z.array(messagePartSchema)
|
|
77
81
|
});
|
|
78
82
|
var messageListSchema = z.array(messageEnvelopeSchema);
|
|
@@ -81,7 +85,13 @@ var pendingQuestionEntrySchema = z.looseObject({
|
|
|
81
85
|
sessionID: z.string(),
|
|
82
86
|
questions: z.array(z.looseObject({
|
|
83
87
|
question: z.string().optional(),
|
|
84
|
-
|
|
88
|
+
header: z.string().optional(),
|
|
89
|
+
multiple: z.boolean().optional(),
|
|
90
|
+
custom: z.boolean().optional(),
|
|
91
|
+
options: z.array(z.looseObject({
|
|
92
|
+
label: z.string().optional(),
|
|
93
|
+
description: z.string().optional()
|
|
94
|
+
})).optional()
|
|
85
95
|
})).optional()
|
|
86
96
|
});
|
|
87
97
|
var pendingQuestionListSchema = z.array(pendingQuestionEntrySchema);
|
|
@@ -842,17 +852,23 @@ var manifestSchema = z3.object({
|
|
|
842
852
|
function expandHome(path) {
|
|
843
853
|
return path.startsWith("~") ? join3(homedir3(), path.slice(1)) : path;
|
|
844
854
|
}
|
|
845
|
-
function
|
|
855
|
+
function resolveExplicitOverride(override, sourceLabel) {
|
|
856
|
+
if (override.includes("://")) {
|
|
857
|
+
throw new Error(`space-bus: ${sourceLabel} must be an absolute path or start with ~ (got a URL: ${override})`);
|
|
858
|
+
}
|
|
859
|
+
const expanded = expandHome(override);
|
|
860
|
+
if (!expanded.startsWith("/")) {
|
|
861
|
+
throw new Error(`space-bus: ${sourceLabel} must be an absolute path or start with ~ (got: ${override})`);
|
|
862
|
+
}
|
|
863
|
+
return existsSync(expanded) ? realpathSync2(expanded) : expanded;
|
|
864
|
+
}
|
|
865
|
+
function resolveRosterPath(directory, explicitOverride) {
|
|
866
|
+
if (explicitOverride) {
|
|
867
|
+
return resolveExplicitOverride(explicitOverride, "--config");
|
|
868
|
+
}
|
|
846
869
|
const override = process.env["SPACE_BUS_CONFIG"];
|
|
847
870
|
if (override) {
|
|
848
|
-
|
|
849
|
-
throw new Error(`space-bus: SPACE_BUS_CONFIG must be an absolute path or start with ~ (got a URL: ${override})`);
|
|
850
|
-
}
|
|
851
|
-
const expanded = expandHome(override);
|
|
852
|
-
if (!expanded.startsWith("/")) {
|
|
853
|
-
throw new Error(`space-bus: SPACE_BUS_CONFIG must be an absolute path or start with ~ (got: ${override})`);
|
|
854
|
-
}
|
|
855
|
-
return existsSync(expanded) ? realpathSync2(expanded) : expanded;
|
|
871
|
+
return resolveExplicitOverride(override, "SPACE_BUS_CONFIG");
|
|
856
872
|
}
|
|
857
873
|
if (directory) {
|
|
858
874
|
const candidate = join3(directory, "spacebus.json");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fro.bot/space-bus",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.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",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@biomejs/biome": "2.5.2",
|
|
84
|
-
"@changesets/cli": "2.31.
|
|
85
|
-
"@opencode-ai/plugin": "1.
|
|
84
|
+
"@changesets/cli": "2.31.1",
|
|
85
|
+
"@opencode-ai/plugin": "1.18.2",
|
|
86
86
|
"@types/bun": "1.3.14",
|
|
87
87
|
"typescript": "5.9.3"
|
|
88
88
|
}
|