@bakers-build/ui 0.12.1-next.2 → 0.12.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/ui.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { type BbCommandHost, type BbCommandPlugin, type BbConnectionConfig, createBbConnectionContext, type WorkspaceRecoveryOptions } from '@bakers-build/core';
2
+ import { type ToolClient } from '@dropsh/plugin-tool';
2
3
  import { type UiInitialRoute } from './route.js';
3
4
  import { type HomeConnection } from './ui-home.js';
4
5
  /** A dropsh program (only the `parseAsync` the launcher drives). */
@@ -52,6 +53,11 @@ export interface BuildWriteClientOptions {
52
53
  stateDir?: string;
53
54
  plugins: BbConnectionConfig['plugins'];
54
55
  }
56
+ /**
57
+ * Calls a site tool (`tool_api__<name>` on `/mcp`) signed in like the client
58
+ * and returns its structured result; a refusal throws with the site's text.
59
+ */
60
+ export declare function siteToolCaller(tools: Pick<ToolClient, 'call'>): (name: string, args: Record<string, unknown>) => Promise<Record<string, unknown>>;
55
61
  /**
56
62
  * Reads a run's stored log from the download route, signed in like the client
57
63
  * ('' for 204, no log). JSON:API returns `log`/`error_log` empty, so a
package/dist/src/ui.js CHANGED
@@ -4,6 +4,7 @@ import { join } from 'node:path';
4
4
  import { pathToFileURL } from 'node:url';
5
5
  import { workspacePlugin } from '@bakers-build/addon-workspace';
6
6
  import { CommandRunner, createBbConnectionContext, createLogger, exec, fetchUpdateNotice, loadReadyBbConnection, resolveCliVersion, setDefaultCommandRunner, } from '@bakers-build/core';
7
+ import { createToolClient } from '@dropsh/plugin-tool';
7
8
  import { buildProgram as buildDropshProgram } from 'dropsh';
8
9
  import { applyOpentuiLibc, reExecUnderBun, resolveBunBinary, shouldReExecUnderBun, } from './bun-runtime.js';
9
10
  import { parseTarget, resolveHere, UI_VIEW_MODES, } from './route.js';
@@ -32,7 +33,24 @@ async function buildWriteClientDefault(o) {
32
33
  site: { base_url: o.baseUrl, jsonapi_prefix: o.jsonapiPrefix },
33
34
  plugins: o.plugins,
34
35
  }, o.stateDir ? { stateDir: o.stateDir } : {});
35
- return { ...context.client, runLog: runLogReader(context) };
36
+ const tools = createToolClient({
37
+ auth: context.auth,
38
+ baseUrl: context.baseUrl,
39
+ endpoint: '/mcp',
40
+ });
41
+ return {
42
+ ...context.client,
43
+ runLog: runLogReader(context),
44
+ callTool: siteToolCaller(tools),
45
+ };
46
+ }
47
+ /**
48
+ * Calls a site tool (`tool_api__<name>` on `/mcp`) signed in like the client
49
+ * and returns its structured result; a refusal throws with the site's text.
50
+ */
51
+ export function siteToolCaller(tools) {
52
+ return async (name, args) => ((await tools.call(`tool_api__${name}`, args)).structuredContent ??
53
+ {});
36
54
  }
37
55
  /**
38
56
  * Reads a run's stored log from the download route, signed in like the client
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakers-build/ui",
3
- "version": "0.12.1-next.2",
3
+ "version": "0.12.1-next.3",
4
4
  "description": "bakers.build project-first cockpit: the `bakers ui` command plugin (renderer resolved dynamically).",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -26,13 +26,14 @@
26
26
  "directory": "bakers-cli/ui"
27
27
  },
28
28
  "dependencies": {
29
- "@bakers-build/core": "^0.12.1-next.2",
30
- "@bakers-build/addon-workspace": "^0.12.1-next.2",
29
+ "@bakers-build/core": "^0.12.1-next.3",
30
+ "@bakers-build/addon-workspace": "^0.12.1-next.3",
31
+ "@dropsh/plugin-tool": "^0.8.2",
31
32
  "commander": "^12.1.0",
32
33
  "dropsh": "^0.8.2"
33
34
  },
34
35
  "bakersBuild": {
35
- "commit": "916eaf86970041ef80bf1976a465e1fc9af1b033",
36
+ "commit": "44b684b677784841cc9111f737fc185759363485",
36
37
  "channel": "next"
37
38
  }
38
39
  }