@bakers-build/ui 0.6.1-next.5 → 0.6.1-next.6
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/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/ui-home.d.ts +4 -14
- package/dist/src/ui-home.js +6 -23
- package/dist/src/ui.d.ts +2 -34
- package/dist/src/ui.js +3 -33
- package/package.json +4 -5
package/dist/src/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { type HereContext, isTicketIdentifier, isUuid, normalizeRepoUrl, type ParsedTarget, parseTarget, parseTicketIdentifierFromBranch, resolveHere, type TargetInputs, UI_VIEW_MODES, type UiInitialRoute, type UiViewMode, } from './route.js';
|
|
2
2
|
export { cmdUi, default, type RunBbUiOptions, type UiDeps } from './ui.js';
|
|
3
|
-
export { type HomeConnection, type ProjectRooting,
|
|
3
|
+
export { type HomeConnection, type ProjectRooting, resolveProjectRooting, } from './ui-home.js';
|
package/dist/src/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
// BB-223: the deep-link grammar (the pure CLI seam).
|
|
8
8
|
export { isTicketIdentifier, isUuid, normalizeRepoUrl, parseTarget, parseTicketIdentifierFromBranch, resolveHere, UI_VIEW_MODES, } from './route.js';
|
|
9
9
|
export { cmdUi, default } from './ui.js';
|
|
10
|
-
export {
|
|
10
|
+
export { resolveProjectRooting, } from './ui-home.js';
|
package/dist/src/ui-home.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type MachineContext } from '@bakers-build/core';
|
|
2
1
|
/**
|
|
3
2
|
* The resolved control-plane connection passed to the renderer launcher.
|
|
4
3
|
* A structural mirror of `@bakers-build/addon-bakers-ui`'s `HomeConnection` — kept
|
|
@@ -11,16 +10,7 @@ export interface HomeConnection {
|
|
|
11
10
|
authPlugins: unknown[];
|
|
12
11
|
configPath?: string | undefined;
|
|
13
12
|
}
|
|
14
|
-
/**
|
|
15
|
-
* Resolve the agent-launch command builder from the home config. Turns a TUI
|
|
16
|
-
* prompt into the shell command herdr runs. Defaults to `claude` (an empty
|
|
17
|
-
* prompt yields the bare launch command). A machine context may name a
|
|
18
|
-
* different `agent_command` binary.
|
|
19
|
-
*/
|
|
20
|
-
export declare function resolveAgentCommand(machine: Partial<MachineContext> & {
|
|
21
|
-
agent_command?: string;
|
|
22
|
-
}): (prompt: string) => string;
|
|
23
|
-
/** Where `bakers ui` roots the agents it launches, and which project they belong to. */
|
|
13
|
+
/** Where `bakers ui` was started, and which project that is. */
|
|
24
14
|
export interface ProjectRooting {
|
|
25
15
|
cwd: string;
|
|
26
16
|
/**
|
|
@@ -34,16 +24,16 @@ export interface ProjectRooting {
|
|
|
34
24
|
bakersDir?: string | undefined;
|
|
35
25
|
}
|
|
36
26
|
/**
|
|
37
|
-
* Decide the
|
|
27
|
+
* Decide the cockpit's working directory (BB-219 AC-9).
|
|
38
28
|
*
|
|
39
29
|
* The trigger is the **cwd**, deliberately not the winning connection config:
|
|
40
30
|
* "which connection did we resolve" and "which project am I standing in" are
|
|
41
31
|
* different questions, and binding them would let an explicit `--config`
|
|
42
|
-
* silently relocate the
|
|
32
|
+
* silently relocate the cockpit's working directory.
|
|
43
33
|
*
|
|
44
34
|
* Standing **in** a project (core's walk-up finds a `.bakers/` project dir that
|
|
45
35
|
* is not the user's own `~/.bakers`), the cwd is that repo's **root**. Otherwise
|
|
46
|
-
*
|
|
36
|
+
* it roots at the home dir and the cockpit opens with no default group —
|
|
47
37
|
* an honest empty cockpit rather than a guess.
|
|
48
38
|
*
|
|
49
39
|
* The project name and this machine's conductor id used to come from a local
|
package/dist/src/ui-home.js
CHANGED
|
@@ -1,37 +1,20 @@
|
|
|
1
1
|
// BB-201 (was BB-194), BB-219: bootstrap builders for `bakers ui`. Pure
|
|
2
|
-
// functions that turn the
|
|
3
|
-
//
|
|
4
|
-
// built here — `ui.ts` asks core's `loadBbConfig` for it, so this package
|
|
2
|
+
// functions that turn the cwd into what `runBbUi` needs. The CONNECTION itself
|
|
3
|
+
// is not built here — `ui.ts` asks core's `loadBbConfig` for it, so this package
|
|
5
4
|
// holds no connection-precedence rule of its own (AC-6).
|
|
6
5
|
import { dirname, resolve } from 'node:path';
|
|
7
|
-
import { findProjectBbDir, homeBbDir
|
|
8
|
-
// BB-391: the two read/write auth-profile members are gone. A connection used
|
|
9
|
-
// to declare two dropsh auth profiles that differed only by OAuth scope, and the
|
|
10
|
-
// cockpit had to name one for reads and one for writes; BB-359 moved capability
|
|
11
|
-
// onto OG ranks, so both resolved to the same role. The connection now declares
|
|
12
|
-
// ONE default provider and nothing has to choose. AC2's grep over
|
|
13
|
-
// `bakers-cli/*/src` is the guard, so the retired names are not spelled here.
|
|
6
|
+
import { findProjectBbDir, homeBbDir } from '@bakers-build/core';
|
|
14
7
|
/**
|
|
15
|
-
*
|
|
16
|
-
* prompt into the shell command herdr runs. Defaults to `claude` (an empty
|
|
17
|
-
* prompt yields the bare launch command). A machine context may name a
|
|
18
|
-
* different `agent_command` binary.
|
|
19
|
-
*/
|
|
20
|
-
export function resolveAgentCommand(machine) {
|
|
21
|
-
const bin = (machine.agent_command ?? '').trim() || 'claude';
|
|
22
|
-
return (prompt) => prompt.trim() === '' ? bin : `${bin} ${shellQuote(prompt)}`;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Decide the agents' working directory (BB-219 AC-9).
|
|
8
|
+
* Decide the cockpit's working directory (BB-219 AC-9).
|
|
26
9
|
*
|
|
27
10
|
* The trigger is the **cwd**, deliberately not the winning connection config:
|
|
28
11
|
* "which connection did we resolve" and "which project am I standing in" are
|
|
29
12
|
* different questions, and binding them would let an explicit `--config`
|
|
30
|
-
* silently relocate the
|
|
13
|
+
* silently relocate the cockpit's working directory.
|
|
31
14
|
*
|
|
32
15
|
* Standing **in** a project (core's walk-up finds a `.bakers/` project dir that
|
|
33
16
|
* is not the user's own `~/.bakers`), the cwd is that repo's **root**. Otherwise
|
|
34
|
-
*
|
|
17
|
+
* it roots at the home dir and the cockpit opens with no default group —
|
|
35
18
|
* an honest empty cockpit rather than a guess.
|
|
36
19
|
*
|
|
37
20
|
* The project name and this machine's conductor id used to come from a local
|
package/dist/src/ui.d.ts
CHANGED
|
@@ -1,30 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type BbCommandHost, type BbCommandPlugin, type BbConnectionConfig, type MachineContext, type WorkspaceRecoveryOptions } from '@bakers-build/core';
|
|
1
|
+
import { type BbCommandHost, type BbCommandPlugin, type BbConnectionConfig, type WorkspaceRecoveryOptions } from '@bakers-build/core';
|
|
3
2
|
import { type UiInitialRoute } from './route.js';
|
|
4
3
|
import { type HomeConnection } from './ui-home.js';
|
|
5
|
-
/** Prompt-level agent service the renderer consumes (mirror of bakers-ui's `TuiAgentService`). */
|
|
6
|
-
interface TuiAgentService {
|
|
7
|
-
launch(o: {
|
|
8
|
-
group: string;
|
|
9
|
-
cwd: string;
|
|
10
|
-
prompt: string;
|
|
11
|
-
env: Record<string, string | undefined>;
|
|
12
|
-
isNew?: boolean | undefined;
|
|
13
|
-
label?: string | undefined;
|
|
14
|
-
}): Promise<{
|
|
15
|
-
id: string;
|
|
16
|
-
group: string;
|
|
17
|
-
label: string;
|
|
18
|
-
}>;
|
|
19
|
-
list(group: string): Promise<{
|
|
20
|
-
id: string;
|
|
21
|
-
group: string;
|
|
22
|
-
label: string;
|
|
23
|
-
}[]>;
|
|
24
|
-
focus(id: string): Promise<void>;
|
|
25
|
-
hide(group: string): Promise<void>;
|
|
26
|
-
kill(id: string): Promise<void>;
|
|
27
|
-
}
|
|
28
4
|
/** A dropsh program (only the `parseAsync` the launcher drives). */
|
|
29
5
|
interface DropshProgram {
|
|
30
6
|
parseAsync(argv: string[], opts: {
|
|
@@ -36,7 +12,6 @@ export interface RunBbUiOptions {
|
|
|
36
12
|
connection: HomeConnection;
|
|
37
13
|
cwd: string;
|
|
38
14
|
project?: string | undefined;
|
|
39
|
-
agents?: TuiAgentService | undefined;
|
|
40
15
|
currentUser?: string | undefined;
|
|
41
16
|
/**
|
|
42
17
|
* The `.bakers` dir of the project the ui was started in, when there is one.
|
|
@@ -58,7 +33,6 @@ export interface RunBbUiOptions {
|
|
|
58
33
|
restartProcess?: (() => void) | undefined;
|
|
59
34
|
/** Persist a product-workspace name through the conductor-owned contract. */
|
|
60
35
|
selectWorkspace?: ((name: string) => Promise<void>) | undefined;
|
|
61
|
-
createPrompt?: string | undefined;
|
|
62
36
|
buildProgram: (opts: {
|
|
63
37
|
plugins: unknown[];
|
|
64
38
|
}) => DropshProgram;
|
|
@@ -82,11 +56,7 @@ export interface BuildWriteClientOptions {
|
|
|
82
56
|
}
|
|
83
57
|
/** Test/composition seams for `bakers ui`. */
|
|
84
58
|
export interface UiDeps {
|
|
85
|
-
/** Local operator identity; default: read the host context from disk. */
|
|
86
|
-
machine?: Partial<MachineContext>;
|
|
87
59
|
workspaceRecovery?: WorkspaceRecoveryOptions;
|
|
88
|
-
/** herdr-backed agent host; default: `herdrAgentHost(exec herdr)`. */
|
|
89
|
-
agentHost?: AgentLaunchHost;
|
|
90
60
|
/** The renderer launcher; default: the dynamically-resolved `runBbUi`. */
|
|
91
61
|
runUi?: (opts: RunBbUiOptions) => Promise<void>;
|
|
92
62
|
/** Host contract (resolveBases) for renderer resolution; default: cwd + this install. */
|
|
@@ -142,9 +112,7 @@ export interface UiDeps {
|
|
|
142
112
|
}
|
|
143
113
|
/**
|
|
144
114
|
* `bakers ui` — launch the interactive terminal UI. Resolves the connection
|
|
145
|
-
* through core's shared ready loader (explicit → project → global)
|
|
146
|
-
* machine context for identity + the agent binary, adapts a herdr-backed agent
|
|
147
|
-
* host to the renderer's prompt-level service, and delegates to
|
|
115
|
+
* through core's shared ready loader (explicit → project → global) and delegates to
|
|
148
116
|
* `@bakers-build/addon-bakers-ui`'s `runBbUi`. `--print-config` reports the
|
|
149
117
|
* resolution and exits without launching. `$BB_UI_PLUGIN` overrides the
|
|
150
118
|
* renderer module (dev).
|
package/dist/src/ui.js
CHANGED
|
@@ -2,13 +2,12 @@ import { createRequire } from 'node:module';
|
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
|
-
import { herdrAgentHost, } from '@bakers-build/addon-herdr';
|
|
6
5
|
import { workspacePlugin } from '@bakers-build/addon-workspace';
|
|
7
|
-
import { CommandRunner, createBbConnectionClient, createBbConnectionContext, createLogger, exec, fetchUpdateNotice, loadReadyBbConnection,
|
|
6
|
+
import { CommandRunner, createBbConnectionClient, createBbConnectionContext, createLogger, exec, fetchUpdateNotice, loadReadyBbConnection, resolveCliVersion, setDefaultCommandRunner, } from '@bakers-build/core';
|
|
8
7
|
import { buildProgram as buildDropshProgram } from 'dropsh';
|
|
9
8
|
import { applyOpentuiLibc, reExecUnderBun, resolveBunBinary, shouldReExecUnderBun, } from './bun-runtime.js';
|
|
10
9
|
import { parseTarget, resolveHere, UI_VIEW_MODES, } from './route.js';
|
|
11
|
-
import {
|
|
10
|
+
import { resolveProjectRooting } from './ui-home.js';
|
|
12
11
|
/**
|
|
13
12
|
* Build the write-side JSON:API client from the plugins core already
|
|
14
13
|
* constructed, resolving the connection's DEFAULT auth provider.
|
|
@@ -153,9 +152,7 @@ async function loadBbUiModule(logger, bases) {
|
|
|
153
152
|
}
|
|
154
153
|
/**
|
|
155
154
|
* `bakers ui` — launch the interactive terminal UI. Resolves the connection
|
|
156
|
-
* through core's shared ready loader (explicit → project → global)
|
|
157
|
-
* machine context for identity + the agent binary, adapts a herdr-backed agent
|
|
158
|
-
* host to the renderer's prompt-level service, and delegates to
|
|
155
|
+
* through core's shared ready loader (explicit → project → global) and delegates to
|
|
159
156
|
* `@bakers-build/addon-bakers-ui`'s `runBbUi`. `--print-config` reports the
|
|
160
157
|
* resolution and exits without launching. `$BB_UI_PLUGIN` overrides the
|
|
161
158
|
* renderer module (dev).
|
|
@@ -235,17 +232,6 @@ export async function cmdUi(deps = {}) {
|
|
|
235
232
|
fail(err instanceof Error ? err.message : String(err));
|
|
236
233
|
return;
|
|
237
234
|
}
|
|
238
|
-
const mcPath = machineContextPath();
|
|
239
|
-
// The machine context supplies the agent binary; it is NOT the connection
|
|
240
|
-
// any more — core resolves that. A stale file stops here, naming bakers init.
|
|
241
|
-
let machine;
|
|
242
|
-
try {
|
|
243
|
-
machine = deps.machine ?? (await readMachineContext(mcPath));
|
|
244
|
-
}
|
|
245
|
-
catch (err) {
|
|
246
|
-
fail(err instanceof Error ? err.message : String(err));
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
235
|
const rooting = resolveProjectRooting(cwd, homedir());
|
|
250
236
|
const conductorPath = rooting.bakersDir
|
|
251
237
|
? (host.projectContext?.resolveConfigPath(cwd) ??
|
|
@@ -392,21 +378,6 @@ export async function cmdUi(deps = {}) {
|
|
|
392
378
|
write(formatConnectionReport(resolved, rooting, project));
|
|
393
379
|
return;
|
|
394
380
|
}
|
|
395
|
-
const agentCommand = resolveAgentCommand(machine);
|
|
396
|
-
const agentHost = deps.agentHost ?? herdrAgentHost((args) => exec('herdr', args));
|
|
397
|
-
const agents = {
|
|
398
|
-
launch: (o) => agentHost.launch({
|
|
399
|
-
group: o.group,
|
|
400
|
-
cwd: o.cwd,
|
|
401
|
-
command: agentCommand(o.prompt),
|
|
402
|
-
env: o.env,
|
|
403
|
-
...(o.label !== undefined ? { label: o.label } : {}),
|
|
404
|
-
}),
|
|
405
|
-
list: (group) => agentHost.list(group),
|
|
406
|
-
focus: (id) => agentHost.focus(id),
|
|
407
|
-
hide: (group) => agentHost.hide(group),
|
|
408
|
-
kill: (id) => agentHost.kill(id),
|
|
409
|
-
};
|
|
410
381
|
let renderer;
|
|
411
382
|
const override = process.env.BB_UI_PLUGIN;
|
|
412
383
|
if (override) {
|
|
@@ -442,7 +413,6 @@ export async function cmdUi(deps = {}) {
|
|
|
442
413
|
connection,
|
|
443
414
|
cwd: rooting.cwd,
|
|
444
415
|
...(project !== undefined ? { project } : {}),
|
|
445
|
-
agents,
|
|
446
416
|
...(currentUser ? { currentUser } : {}),
|
|
447
417
|
...(rooting.bakersDir ? { bakersDir: rooting.bakersDir } : {}),
|
|
448
418
|
...(resolved.workspace_id ? { workspaceId: resolved.workspace_id } : {}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bakers-build/ui",
|
|
3
|
-
"version": "0.6.1-next.
|
|
3
|
+
"version": "0.6.1-next.6",
|
|
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,14 +26,13 @@
|
|
|
26
26
|
"directory": "bakers-cli/ui"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@bakers-build/core": "^0.6.1-next.
|
|
30
|
-
"@bakers-build/addon-
|
|
31
|
-
"@bakers-build/addon-workspace": "^0.6.1-next.5",
|
|
29
|
+
"@bakers-build/core": "^0.6.1-next.6",
|
|
30
|
+
"@bakers-build/addon-workspace": "^0.6.1-next.6",
|
|
32
31
|
"commander": "^12.1.0",
|
|
33
32
|
"dropsh": "^0.8.2"
|
|
34
33
|
},
|
|
35
34
|
"bakersBuild": {
|
|
36
|
-
"commit": "
|
|
35
|
+
"commit": "12b97ff4aa2422d69dab286141f3234609f32351",
|
|
37
36
|
"channel": "next"
|
|
38
37
|
}
|
|
39
38
|
}
|