@bakers-build/conductor 0.15.1-next.1 → 0.15.1-next.3
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/src/core/site-tools.js +35 -9
- package/package.json +4 -4
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// The site's bakers tools, proxied on the `bakers` MCP server with the
|
|
2
2
|
// conductor's own credentials. Only the allowlist is served, under the plain
|
|
3
|
-
// name
|
|
3
|
+
// name. Reads go to any project; writes stay in the run ticket's project, except
|
|
4
|
+
// a create in another project and updates of the tickets the run created there.
|
|
4
5
|
/** The site tools a run may call. */
|
|
5
6
|
export const SITE_TOOLS = [
|
|
6
7
|
'bakers_ticket_read',
|
|
@@ -98,6 +99,13 @@ export function siteToolProxy(client, logger) {
|
|
|
98
99
|
.map((r) => ['ticket', arg, r])),
|
|
99
100
|
['project', 'project', scoped.project],
|
|
100
101
|
];
|
|
102
|
+
// A create may target another project; its parent and blockers come from there.
|
|
103
|
+
// An update may reach a ticket this run created there.
|
|
104
|
+
let home = project;
|
|
105
|
+
if (name === 'bakers_ticket_create' && !blank(scoped.project))
|
|
106
|
+
home = await ownerOf('project', String(scoped.project));
|
|
107
|
+
if (name === 'bakers_ticket_update')
|
|
108
|
+
home = owners.get(`created:${String(scoped.ticket)}`) ?? project;
|
|
101
109
|
for (const [kind, arg, value] of refs) {
|
|
102
110
|
if (value === undefined || value === null)
|
|
103
111
|
continue;
|
|
@@ -107,25 +115,43 @@ export function siteToolProxy(client, logger) {
|
|
|
107
115
|
continue;
|
|
108
116
|
throw new Error(`${name}: an empty ${arg} would mean every project; this run may only touch project ${project}`);
|
|
109
117
|
}
|
|
118
|
+
// the site decides who may read what
|
|
119
|
+
if (READS.includes(name))
|
|
120
|
+
continue;
|
|
110
121
|
const owner = await ownerOf(kind, String(value));
|
|
111
|
-
if (owner !==
|
|
112
|
-
throw new Error(`${name}: ${arg} ${String(value)} belongs to project ${owner}, this run may only touch project ${
|
|
122
|
+
if (owner !== home)
|
|
123
|
+
throw new Error(`${name}: ${arg} ${String(value)} belongs to project ${owner}, this run may only touch project ${home}`);
|
|
124
|
+
}
|
|
125
|
+
const result = await client.call(`${WIRE}${name}`, scoped);
|
|
126
|
+
if (name === 'bakers_ticket_create' && home !== project) {
|
|
127
|
+
// shortcut: kept in memory, so a conductor restart forgets it; persist it if runs need that.
|
|
128
|
+
const out = resultJson(result);
|
|
129
|
+
for (const ref of [out.id, out.identifier])
|
|
130
|
+
if (ref)
|
|
131
|
+
owners.set(`created:${String(ref)}`, home);
|
|
113
132
|
}
|
|
114
|
-
|
|
115
|
-
scoped.workspace !== ticket.workspaceId)
|
|
116
|
-
throw new Error(`${name}: workspace ${String(scoped.workspace)} is not the workspace ${ticket.workspaceId ?? '(none)'} of project ${project}`);
|
|
117
|
-
const { content } = await client.call(`${WIRE}${name}`, scoped);
|
|
118
|
-
return { content };
|
|
133
|
+
return { content: result.content };
|
|
119
134
|
},
|
|
120
135
|
};
|
|
121
136
|
}
|
|
137
|
+
/** Reads and lookups that may name any project or workspace. */
|
|
138
|
+
const READS = [
|
|
139
|
+
'bakers_ticket_read',
|
|
140
|
+
'bakers_comment_read',
|
|
141
|
+
'bakers_ticket_search',
|
|
142
|
+
'bakers_ticket_list',
|
|
143
|
+
'bakers_project_read',
|
|
144
|
+
'bakers_label_list',
|
|
145
|
+
'bakers_conductor_list',
|
|
146
|
+
];
|
|
122
147
|
/** Tools whose missing `project` means the run's project. */
|
|
123
148
|
const FILLS_PROJECT = [
|
|
124
149
|
'bakers_ticket_search',
|
|
125
150
|
'bakers_ticket_list',
|
|
126
151
|
'bakers_ticket_create',
|
|
127
152
|
];
|
|
128
|
-
/**
|
|
153
|
+
/** Per run token: resolved ticket and project refs (the run's own ticket is known),
|
|
154
|
+
* and `created:<ref>` → project of the tickets this run created in another project. */
|
|
129
155
|
const resolved = new WeakMap();
|
|
130
156
|
function ownersOf(binding, project) {
|
|
131
157
|
let owners = resolved.get(binding);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bakers-build/conductor",
|
|
3
|
-
"version": "0.15.1-next.
|
|
3
|
+
"version": "0.15.1-next.3",
|
|
4
4
|
"description": "bakers.build conductor engine + CLI: registers, claims tickets via JSON:API, dispatches agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@dropsh/plugin-jsonapi-schema": "^0.8.2",
|
|
34
34
|
"@dropsh/plugin-oauth2": "^0.8.2",
|
|
35
|
-
"@bakers-build/core": "^0.15.1-next.
|
|
36
|
-
"@bakers-build/message": "^0.15.1-next.
|
|
35
|
+
"@bakers-build/core": "^0.15.1-next.3",
|
|
36
|
+
"@bakers-build/message": "^0.15.1-next.3",
|
|
37
37
|
"@modelcontextprotocol/sdk": "1.32.1",
|
|
38
38
|
"commander": "^12.1.0",
|
|
39
39
|
"dropsh": "^0.8.2"
|
|
40
40
|
},
|
|
41
41
|
"bakersBuild": {
|
|
42
|
-
"commit": "
|
|
42
|
+
"commit": "b8e9088a6baedcf1d6799978323809f0eb463eed",
|
|
43
43
|
"channel": "next"
|
|
44
44
|
}
|
|
45
45
|
}
|