@fro.bot/space-bus 0.2.1 → 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 +28 -2
- package/dist/config.d.ts +19 -0
- package/dist/config.js +90 -0
- package/dist/contract.d.ts +1814 -0
- package/dist/contract.js +100 -0
- package/dist/core.d.ts +29 -13
- package/dist/core.js +612 -0
- package/dist/format.d.ts +14 -0
- package/dist/format.js +63 -0
- package/dist/index.js +295 -135
- package/dist/mcp.js +349 -143
- package/package.json +18 -2
package/dist/contract.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// src/contract.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var sessionSchema = z.object({
|
|
4
|
+
id: z.string(),
|
|
5
|
+
directory: z.string().optional(),
|
|
6
|
+
title: z.string().optional()
|
|
7
|
+
}).passthrough();
|
|
8
|
+
var sessionListSchema = z.array(sessionSchema);
|
|
9
|
+
var sessionStatusMapSchema = z.record(z.string(), z.object({ type: z.string() }).passthrough());
|
|
10
|
+
var todoSchema = z.array(z.object({ content: z.string(), status: z.string(), priority: z.string() }).passthrough()).default([]);
|
|
11
|
+
var diffEntrySchema = z.object({
|
|
12
|
+
file: z.string().optional(),
|
|
13
|
+
additions: z.number(),
|
|
14
|
+
deletions: z.number(),
|
|
15
|
+
status: z.string().optional()
|
|
16
|
+
}).passthrough();
|
|
17
|
+
var diffSchema = z.array(diffEntrySchema).default([]);
|
|
18
|
+
var vcsStatusEntrySchema = z.object({
|
|
19
|
+
file: z.string(),
|
|
20
|
+
additions: z.number(),
|
|
21
|
+
deletions: z.number(),
|
|
22
|
+
status: z.string().optional()
|
|
23
|
+
}).passthrough();
|
|
24
|
+
var vcsStatusSchema = z.array(vcsStatusEntrySchema).default([]);
|
|
25
|
+
var turnDiffEntrySchema = diffEntrySchema;
|
|
26
|
+
var turnMessageSchema = z.object({
|
|
27
|
+
info: z.object({
|
|
28
|
+
role: z.string(),
|
|
29
|
+
summary: z.object({
|
|
30
|
+
diffs: z.array(turnDiffEntrySchema).optional()
|
|
31
|
+
}).passthrough().optional()
|
|
32
|
+
}).passthrough()
|
|
33
|
+
}).passthrough();
|
|
34
|
+
var turnMessageListSchema = z.array(turnMessageSchema);
|
|
35
|
+
var sessionSummarySchema = z.object({
|
|
36
|
+
summary: z.object({
|
|
37
|
+
diffs: z.array(turnDiffEntrySchema).optional()
|
|
38
|
+
}).passthrough().optional()
|
|
39
|
+
}).passthrough();
|
|
40
|
+
var messagePartSchema = z.object({ type: z.string(), text: z.string().optional() }).passthrough();
|
|
41
|
+
var messageEnvelopeSchema = z.object({
|
|
42
|
+
info: z.object({ role: z.string() }).passthrough(),
|
|
43
|
+
parts: z.array(messagePartSchema)
|
|
44
|
+
}).passthrough();
|
|
45
|
+
var messageListSchema = z.array(messageEnvelopeSchema);
|
|
46
|
+
var pendingQuestionEntrySchema = z.object({
|
|
47
|
+
id: z.string(),
|
|
48
|
+
sessionID: z.string(),
|
|
49
|
+
questions: z.array(z.object({
|
|
50
|
+
question: z.string().optional(),
|
|
51
|
+
options: z.array(z.object({ label: z.string().optional() }).passthrough()).optional()
|
|
52
|
+
}).passthrough()).optional()
|
|
53
|
+
}).passthrough();
|
|
54
|
+
var pendingQuestionListSchema = z.array(pendingQuestionEntrySchema);
|
|
55
|
+
var questionEntrySchema = z.object({ id: z.string(), sessionID: z.string() }).passthrough();
|
|
56
|
+
var questionListSchema = z.array(questionEntrySchema);
|
|
57
|
+
var projectSchema = z.object({
|
|
58
|
+
name: z.string(),
|
|
59
|
+
path: z.string(),
|
|
60
|
+
description: z.string(),
|
|
61
|
+
expandedPath: z.string(),
|
|
62
|
+
exists: z.boolean()
|
|
63
|
+
}).passthrough();
|
|
64
|
+
var rosterSchema = z.object({
|
|
65
|
+
server: z.object({ baseUrl: z.string().url() }),
|
|
66
|
+
projects: z.array(projectSchema)
|
|
67
|
+
});
|
|
68
|
+
var credentialsSchema = z.object({
|
|
69
|
+
username: z.string().optional(),
|
|
70
|
+
password: z.string().optional()
|
|
71
|
+
});
|
|
72
|
+
var busContextSchema = z.object({
|
|
73
|
+
roster: rosterSchema,
|
|
74
|
+
credentials: credentialsSchema.optional()
|
|
75
|
+
});
|
|
76
|
+
export {
|
|
77
|
+
vcsStatusSchema,
|
|
78
|
+
vcsStatusEntrySchema,
|
|
79
|
+
turnMessageSchema,
|
|
80
|
+
turnMessageListSchema,
|
|
81
|
+
turnDiffEntrySchema,
|
|
82
|
+
todoSchema,
|
|
83
|
+
sessionSummarySchema,
|
|
84
|
+
sessionStatusMapSchema,
|
|
85
|
+
sessionSchema,
|
|
86
|
+
sessionListSchema,
|
|
87
|
+
rosterSchema,
|
|
88
|
+
questionListSchema,
|
|
89
|
+
questionEntrySchema,
|
|
90
|
+
projectSchema,
|
|
91
|
+
pendingQuestionListSchema,
|
|
92
|
+
pendingQuestionEntrySchema,
|
|
93
|
+
messagePartSchema,
|
|
94
|
+
messageListSchema,
|
|
95
|
+
messageEnvelopeSchema,
|
|
96
|
+
diffSchema,
|
|
97
|
+
diffEntrySchema,
|
|
98
|
+
credentialsSchema,
|
|
99
|
+
busContextSchema
|
|
100
|
+
};
|
package/dist/core.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type BusContext } from "./contract";
|
|
1
2
|
type Ok<T> = {
|
|
2
3
|
ok: true;
|
|
3
4
|
} & T;
|
|
@@ -6,7 +7,10 @@ type Err = {
|
|
|
6
7
|
error: string;
|
|
7
8
|
};
|
|
8
9
|
export type Result<T> = Ok<T> | Err;
|
|
9
|
-
|
|
10
|
+
/** Options every exported core function takes: a per-call BusContext. */
|
|
11
|
+
export type CoreOpts = {
|
|
12
|
+
context: BusContext;
|
|
13
|
+
};
|
|
10
14
|
export type DiffSource = "session" | "turns" | "working-tree";
|
|
11
15
|
export type RosterProject = {
|
|
12
16
|
name: string;
|
|
@@ -18,9 +22,7 @@ export type RosterProject = {
|
|
|
18
22
|
sessionCountCapped?: boolean;
|
|
19
23
|
statusError?: string;
|
|
20
24
|
};
|
|
21
|
-
export declare function roster(opts
|
|
22
|
-
directory?: string;
|
|
23
|
-
}): Promise<Result<{
|
|
25
|
+
export declare function roster(opts: CoreOpts): Promise<Result<{
|
|
24
26
|
projects: RosterProject[];
|
|
25
27
|
}>>;
|
|
26
28
|
export type DispatchResult = {
|
|
@@ -35,7 +37,6 @@ export type DispatchResult = {
|
|
|
35
37
|
export type DispatchArgs = {
|
|
36
38
|
prompt: string;
|
|
37
39
|
title?: string;
|
|
38
|
-
directory?: string;
|
|
39
40
|
} & ({
|
|
40
41
|
project: string;
|
|
41
42
|
sessionId?: undefined;
|
|
@@ -48,9 +49,8 @@ export declare function toDispatchArgs(input: {
|
|
|
48
49
|
title?: string;
|
|
49
50
|
project?: string;
|
|
50
51
|
sessionId?: string;
|
|
51
|
-
directory?: string;
|
|
52
52
|
}): Result<DispatchArgs>;
|
|
53
|
-
export declare function dispatch(args: DispatchArgs): Promise<Result<DispatchResult>>;
|
|
53
|
+
export declare function dispatch(args: DispatchArgs, opts: CoreOpts): Promise<Result<DispatchResult>>;
|
|
54
54
|
export type SessionStatusResult = {
|
|
55
55
|
sessionId: string;
|
|
56
56
|
project: string;
|
|
@@ -72,9 +72,7 @@ export type SessionStatusResult = {
|
|
|
72
72
|
options: string[];
|
|
73
73
|
};
|
|
74
74
|
};
|
|
75
|
-
export declare function status(sessionId: string, opts
|
|
76
|
-
directory?: string;
|
|
77
|
-
}): Promise<Result<SessionStatusResult>>;
|
|
75
|
+
export declare function status(sessionId: string, opts: CoreOpts): Promise<Result<SessionStatusResult>>;
|
|
78
76
|
export type SessionResultResult = {
|
|
79
77
|
sessionId: string;
|
|
80
78
|
project: string;
|
|
@@ -87,7 +85,25 @@ export type SessionResultResult = {
|
|
|
87
85
|
}[];
|
|
88
86
|
diffSource: DiffSource;
|
|
89
87
|
};
|
|
90
|
-
export declare function result(sessionId: string, opts
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
export declare function result(sessionId: string, opts: CoreOpts): Promise<Result<SessionResultResult>>;
|
|
89
|
+
export type SnapshotProject = {
|
|
90
|
+
name: string;
|
|
91
|
+
path: string;
|
|
92
|
+
exists: boolean;
|
|
93
|
+
description?: string;
|
|
94
|
+
busyCount?: number;
|
|
95
|
+
sessionCount?: number;
|
|
96
|
+
sessionCountCapped?: boolean;
|
|
97
|
+
pendingQuestions?: {
|
|
98
|
+
sessionId: string;
|
|
99
|
+
preview: string;
|
|
100
|
+
options: string[];
|
|
101
|
+
}[];
|
|
102
|
+
error?: string;
|
|
103
|
+
};
|
|
104
|
+
export declare function snapshot(opts: CoreOpts & {
|
|
105
|
+
concurrency?: number;
|
|
106
|
+
}): Promise<Result<{
|
|
107
|
+
projects: SnapshotProject[];
|
|
108
|
+
}>>;
|
|
93
109
|
export {};
|