@aibyzero/byz 0.1.2 → 0.1.4
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/CHANGELOG.md +16 -0
- package/README.md +31 -3
- package/dist/cli.js +37 -13
- package/dist/fast.js +67 -0
- package/dist/runtime/bundle/chunks/{chunk-Q4KIHSRR.js → chunk-QLXFMGH6.js} +7 -7
- package/dist/runtime/bundle/cli.js +1 -1
- package/dist/runtime/bundle/index.js +1 -1
- package/dist/runtime/bundle/rpc-entry.js +1 -1
- package/dist/runtime/core/agent-session.d.ts +4 -1
- package/dist/runtime/core/agent-session.d.ts.map +1 -1
- package/dist/runtime/core/agent-session.js +38 -11
- package/dist/runtime/core/agent-session.js.map +1 -1
- package/dist/runtime/core/extensions/runner.d.ts +11 -1
- package/dist/runtime/core/extensions/runner.d.ts.map +1 -1
- package/dist/runtime/core/extensions/runner.js +40 -9
- package/dist/runtime/core/extensions/runner.js.map +1 -1
- package/dist/runtime/core/extensions/types.d.ts +7 -0
- package/dist/runtime/core/extensions/types.d.ts.map +1 -1
- package/dist/runtime/core/extensions/types.js.map +1 -1
- package/dist/runtime/core/resource-loader.d.ts +17 -1
- package/dist/runtime/core/resource-loader.d.ts.map +1 -1
- package/dist/runtime/core/resource-loader.js +224 -5
- package/dist/runtime/core/resource-loader.js.map +1 -1
- package/dist/runtime/main.d.ts +2 -1
- package/dist/runtime/main.d.ts.map +1 -1
- package/dist/runtime/main.js +1 -0
- package/dist/runtime/main.js.map +1 -1
- package/dist/runtime/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/runtime/modes/interactive/interactive-mode.js +5 -0
- package/dist/runtime/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/workflow-switch.js +95 -0
- package/dist/workflows.js +23 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.1.4 - 2026-08-27
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added same-session `/workflow` hot switching between the bundled CM Workflow, CM Plugin Workflow, and no managed workflow while preserving conversation, model, thinking, Fast Mode, and unrelated host resources ([#18](https://github.com/kingxiaozhe/byz/pull/18)).
|
|
10
|
+
|
|
11
|
+
## 0.1.3 - 2026-08-27
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- Added opt-in Fast Mode with the complete selected workflow, `thinking=low` by default, optional `BYZ_FAST_MODEL`, and explicit model or thinking options taking precedence ([#15](https://github.com/kingxiaozhe/byz/pull/15)).
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- Made BYZ's bundled workflow skills and prompts win same-name host collisions while continuing to load unrelated host resources ([#16](https://github.com/kingxiaozhe/byz/pull/16)).
|
|
20
|
+
|
|
5
21
|
## 0.1.2 - 2026-08-27
|
|
6
22
|
|
|
7
23
|
### Added
|
package/README.md
CHANGED
|
@@ -34,6 +34,28 @@ Workflows do not have an end-user update or rollback command. Every BYZ release
|
|
|
34
34
|
selects one CM version and one compatible CM Plugin version; users run the
|
|
35
35
|
versions selected by their installed BYZ release.
|
|
36
36
|
|
|
37
|
+
## Fast mode
|
|
38
|
+
|
|
39
|
+
Use Fast mode for lower-latency, lower-token everyday work without removing the
|
|
40
|
+
selected workflow's skills, prompts, context, or quality gates:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
byz --fast
|
|
44
|
+
byz --fast --workflow cm-plugin
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Fast mode uses Pi's existing runtime controls and defaults thinking to `low`.
|
|
48
|
+
Set an optional model once when a separate fast model is available:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
export BYZ_FAST_MODEL="provider/model"
|
|
52
|
+
byz --fast
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
An explicit `--model` or `--thinking` option always wins. Continuing or resuming
|
|
56
|
+
an existing session keeps that session's model and applies the Fast thinking
|
|
57
|
+
default. Normal `byz` runs ignore `BYZ_FAST_MODEL` and remain unchanged.
|
|
58
|
+
|
|
37
59
|
## Workflows
|
|
38
60
|
|
|
39
61
|
```bash
|
|
@@ -45,9 +67,15 @@ byz --workflow cm-plugin
|
|
|
45
67
|
byz --workflow none
|
|
46
68
|
```
|
|
47
69
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
70
|
+
Inside an interactive session, `/workflow` shows the active workflow.
|
|
71
|
+
`/workflow cm`, `/workflow cm-plugin`, and `/workflow none` switch it in place
|
|
72
|
+
without starting a new conversation or calling the model. BYZ validates the
|
|
73
|
+
target before replacing its managed skills and prompts, does not reload
|
|
74
|
+
unrelated extensions, and rejects switching while the agent is running.
|
|
75
|
+
|
|
76
|
+
BYZ loads at most one workflow at a time. Users do not install, update, or roll
|
|
77
|
+
back either workflow separately. Local development can override package roots
|
|
78
|
+
with `BYZ_CM_WORKFLOW_ROOT` or
|
|
51
79
|
`BYZ_CM_PLUGIN_WORKFLOW_ROOT`; the two roots must remain distinct.
|
|
52
80
|
|
|
53
81
|
## Development
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import { prepareFastRuntimeArgs } from "./fast.js";
|
|
3
4
|
import { main } from "./runtime/bundle/index.js";
|
|
4
5
|
import { handleByzUpdate } from "./update.js";
|
|
5
|
-
import {
|
|
6
|
+
import { createWorkflowSwitchExtension, shouldEnableWorkflowSwitch, shouldLoadWorkflow } from "./workflow-switch.js";
|
|
7
|
+
import {
|
|
8
|
+
handleWorkflowCommand,
|
|
9
|
+
parseWorkflowOption,
|
|
10
|
+
prepareWorkflowRuntimeArgs,
|
|
11
|
+
resolveWorkflowRuntimeResources,
|
|
12
|
+
} from "./workflows.js";
|
|
6
13
|
|
|
7
14
|
process.title = "byz";
|
|
8
15
|
process.env.BYZ_CODING_AGENT = "true";
|
|
@@ -13,21 +20,14 @@ process.env.PI_TELEMETRY = "0";
|
|
|
13
20
|
|
|
14
21
|
const args = process.argv.slice(2);
|
|
15
22
|
|
|
16
|
-
function shouldLoadWorkflow(runtimeArgs) {
|
|
17
|
-
const terminatorIndex = runtimeArgs.indexOf("--");
|
|
18
|
-
const optionArgs = runtimeArgs.slice(0, terminatorIndex === -1 ? runtimeArgs.length : terminatorIndex);
|
|
19
|
-
if (optionArgs.some((arg) => ["--help", "-h", "--version", "-v", "--export", "--list-models"].includes(arg))) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
return !["auth", "config", "install", "list", "remove", "uninstall", "update"].includes(optionArgs[0]);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
23
|
try {
|
|
26
|
-
const
|
|
24
|
+
const fastRuntime = prepareFastRuntimeArgs(args);
|
|
25
|
+
const parsedWorkflow = parseWorkflowOption(fastRuntime.commandArgs);
|
|
27
26
|
const commandArgs = parsedWorkflow.forwardedArgs;
|
|
28
27
|
const isRootHelp = commandArgs.length === 1 && (commandArgs[0] === "--help" || commandArgs[0] === "-h");
|
|
29
28
|
if (isRootHelp) {
|
|
30
29
|
console.error("BYZ updates: byz update (npm-managed global installations only)");
|
|
30
|
+
console.error("BYZ Fast: --fast (thinking=low; optional model: BYZ_FAST_MODEL)");
|
|
31
31
|
console.error("BYZ workflows: --workflow <cm|cm-plugin|none> (default: BYZ_WORKFLOW or cm)");
|
|
32
32
|
console.error("Commands: byz workflow <list|status|check> [cm|cm-plugin]");
|
|
33
33
|
}
|
|
@@ -37,8 +37,32 @@ try {
|
|
|
37
37
|
} else if (await handleByzUpdate(commandArgs)) {
|
|
38
38
|
// BYZ release metadata and package target stay independent from Pi.
|
|
39
39
|
} else {
|
|
40
|
-
const
|
|
41
|
-
|
|
40
|
+
const loadWorkflow = shouldLoadWorkflow(commandArgs);
|
|
41
|
+
const runtimeArgs = loadWorkflow ? fastRuntime.args : fastRuntime.commandArgs;
|
|
42
|
+
const isInteractive = shouldEnableWorkflowSwitch(commandArgs, {
|
|
43
|
+
stdinIsTTY: process.stdin.isTTY,
|
|
44
|
+
stdoutIsTTY: process.stdout.isTTY,
|
|
45
|
+
});
|
|
46
|
+
if (fastRuntime.enabled && loadWorkflow && isInteractive) {
|
|
47
|
+
console.error(
|
|
48
|
+
`BYZ Fast: model=${fastRuntime.model}, thinking=${fastRuntime.thinking}, workflow=${parsedWorkflow.workflowId}`,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (loadWorkflow && isInteractive) {
|
|
53
|
+
const parsedRuntimeWorkflow = parseWorkflowOption(runtimeArgs);
|
|
54
|
+
const resolveResources = (workflowId) =>
|
|
55
|
+
resolveWorkflowRuntimeResources(workflowId, parsedRuntimeWorkflow.forwardedArgs);
|
|
56
|
+
const workflowExtension = createWorkflowSwitchExtension({
|
|
57
|
+
initialResources: await resolveResources(parsedRuntimeWorkflow.workflowId),
|
|
58
|
+
initialWorkflowId: parsedRuntimeWorkflow.workflowId,
|
|
59
|
+
resolveResources,
|
|
60
|
+
});
|
|
61
|
+
await main(parsedRuntimeWorkflow.forwardedArgs, { byzWorkflowExtensionFactory: workflowExtension });
|
|
62
|
+
} else {
|
|
63
|
+
const prepared = await prepareWorkflowRuntimeArgs(runtimeArgs, { load: loadWorkflow });
|
|
64
|
+
await main(prepared.args);
|
|
65
|
+
}
|
|
42
66
|
}
|
|
43
67
|
} catch (error) {
|
|
44
68
|
console.error(error instanceof Error ? error.message : String(error));
|
package/dist/fast.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { getActiveByzOptionIndexes } from "./workflow-switch.js";
|
|
2
|
+
|
|
3
|
+
const SESSION_OPTIONS = new Set(["--continue", "-c", "--resume", "-r", "--session", "--session-id", "--fork"]);
|
|
4
|
+
const THINKING_SUFFIX_PATTERN = /:(off|minimal|low|medium|high|xhigh|max)$/;
|
|
5
|
+
|
|
6
|
+
function getOptionArgs(args) {
|
|
7
|
+
const terminatorIndex = args.indexOf("--");
|
|
8
|
+
return args.slice(0, terminatorIndex === -1 ? args.length : terminatorIndex);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function findOptionValue(args, option) {
|
|
12
|
+
let value;
|
|
13
|
+
for (let index = 0; index < args.length; index++) {
|
|
14
|
+
if (args[index] === option) value = args[index + 1];
|
|
15
|
+
}
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function prepareFastRuntimeArgs(args, env = process.env) {
|
|
20
|
+
const forwardedArgs = [];
|
|
21
|
+
const activeFastOptions = getActiveByzOptionIndexes(args, "fast");
|
|
22
|
+
let enabled = false;
|
|
23
|
+
for (let index = 0; index < args.length; index++) {
|
|
24
|
+
const arg = args[index];
|
|
25
|
+
if (arg === "--") {
|
|
26
|
+
forwardedArgs.push(...args.slice(index));
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
if (arg === "--fast" && activeFastOptions.has(index)) {
|
|
30
|
+
if (enabled) throw new Error("--fast may only be specified once.");
|
|
31
|
+
enabled = true;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (arg.startsWith("--fast=") && activeFastOptions.has(index)) {
|
|
35
|
+
throw new Error("--fast does not accept a value.");
|
|
36
|
+
}
|
|
37
|
+
forwardedArgs.push(arg);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!enabled) {
|
|
41
|
+
return { args: forwardedArgs, commandArgs: forwardedArgs, enabled: false };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const optionArgs = getOptionArgs(forwardedArgs);
|
|
45
|
+
const hasModelOption = optionArgs.includes("--model");
|
|
46
|
+
const hasThinkingOption = optionArgs.includes("--thinking");
|
|
47
|
+
const resumesSession = optionArgs.some((arg) => SESSION_OPTIONS.has(arg));
|
|
48
|
+
const configuredModel = env.BYZ_FAST_MODEL?.trim();
|
|
49
|
+
const explicitModel = findOptionValue(optionArgs, "--model");
|
|
50
|
+
const modelThinking = explicitModel?.match(THINKING_SUFFIX_PATTERN)?.[1];
|
|
51
|
+
const presetArgs = [];
|
|
52
|
+
if (!hasModelOption && !resumesSession && configuredModel) {
|
|
53
|
+
presetArgs.push("--model", configuredModel);
|
|
54
|
+
}
|
|
55
|
+
if (!hasThinkingOption && !modelThinking) {
|
|
56
|
+
presetArgs.push("--thinking", "low");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const explicitThinking = findOptionValue(optionArgs, "--thinking");
|
|
60
|
+
return {
|
|
61
|
+
args: [...presetArgs, ...forwardedArgs],
|
|
62
|
+
commandArgs: forwardedArgs,
|
|
63
|
+
enabled: true,
|
|
64
|
+
model: explicitModel ?? (resumesSession ? "session" : configuredModel || "default"),
|
|
65
|
+
thinking: explicitThinking ?? modelThinking ?? "low",
|
|
66
|
+
};
|
|
67
|
+
}
|