@aibyzero/byz 0.1.3 → 0.1.5
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 +12 -0
- package/README.md +9 -3
- package/dist/cli.js +31 -22
- package/dist/fast.js +5 -2
- package/dist/runtime/bundle/chunks/{chunk-QY7DJQRI.js → chunk-WMLOZBQV.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 +16 -1
- package/dist/runtime/core/resource-loader.d.ts.map +1 -1
- package/dist/runtime/core/resource-loader.js +216 -2
- 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 +31 -16
- package/package.json +1 -1
|
@@ -945,7 +945,7 @@ export class AgentSession {
|
|
|
945
945
|
if (!command)
|
|
946
946
|
return false;
|
|
947
947
|
// Get command context from extension runner (includes session control methods)
|
|
948
|
-
const ctx = this._extensionRunner.createCommandContext();
|
|
948
|
+
const ctx = this._extensionRunner.createCommandContext(command.ownerId, command.sourceInfo.path, command.byzWorkflowOwner);
|
|
949
949
|
try {
|
|
950
950
|
await command.handler(args, ctx);
|
|
951
951
|
return true;
|
|
@@ -1201,6 +1201,24 @@ export class AgentSession {
|
|
|
1201
1201
|
get resourceLoader() {
|
|
1202
1202
|
return this._resourceLoader;
|
|
1203
1203
|
}
|
|
1204
|
+
async replaceByzWorkflowResources(extensionOwner, extensionPath, resources) {
|
|
1205
|
+
if (!this.isIdle || this.isCompacting) {
|
|
1206
|
+
throw new Error("Extension resources cannot be updated while the agent is running.");
|
|
1207
|
+
}
|
|
1208
|
+
if (extensionPath !== "<inline:byz-workflow>") {
|
|
1209
|
+
throw new Error("BYZ workflow resources can only be replaced by the built-in workflow extension.");
|
|
1210
|
+
}
|
|
1211
|
+
if (!this._resourceLoader.replaceByzWorkflowResources) {
|
|
1212
|
+
throw new Error("The active resource loader does not support BYZ workflow resource updates.");
|
|
1213
|
+
}
|
|
1214
|
+
this._resourceLoader.replaceByzWorkflowResources(extensionOwner, {
|
|
1215
|
+
promptPaths: this.buildExtensionResourcePaths((resources.promptPaths ?? []).map((path) => ({ path, extensionOwner, extensionPath }))),
|
|
1216
|
+
skillPaths: this.buildExtensionResourcePaths((resources.skillPaths ?? []).map((path) => ({ path, extensionOwner, extensionPath }))),
|
|
1217
|
+
});
|
|
1218
|
+
this._baseSystemPrompt = this._rebuildSystemPrompt(this.getActiveToolNames());
|
|
1219
|
+
this.agent.state.systemPrompt = this._baseSystemPrompt;
|
|
1220
|
+
this._emit({ type: "resources_changed" });
|
|
1221
|
+
}
|
|
1204
1222
|
/**
|
|
1205
1223
|
* Abort current operation and wait for agent to become idle.
|
|
1206
1224
|
*/
|
|
@@ -1908,16 +1926,23 @@ export class AgentSession {
|
|
|
1908
1926
|
if (!this._extensionRunner.hasHandlers("resources_discover")) {
|
|
1909
1927
|
return;
|
|
1910
1928
|
}
|
|
1911
|
-
const { skillPaths, promptPaths, themePaths } = await this._extensionRunner.emitResourcesDiscover(this._cwd, reason);
|
|
1912
|
-
|
|
1913
|
-
|
|
1929
|
+
const { skillPaths, promptPaths, themePaths, extensionOwners } = await this._extensionRunner.emitResourcesDiscover(this._cwd, reason);
|
|
1930
|
+
for (const entry of extensionOwners) {
|
|
1931
|
+
if (entry.byzWorkflowOwner) {
|
|
1932
|
+
this._resourceLoader.registerByzWorkflowResourceOwner?.(entry.extensionOwner);
|
|
1933
|
+
}
|
|
1914
1934
|
}
|
|
1915
|
-
const
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1935
|
+
const hasResources = skillPaths.length > 0 || promptPaths.length > 0 || themePaths.length > 0;
|
|
1936
|
+
if (hasResources) {
|
|
1937
|
+
const extensionPaths = {
|
|
1938
|
+
skillPaths: this.buildExtensionResourcePaths(skillPaths),
|
|
1939
|
+
promptPaths: this.buildExtensionResourcePaths(promptPaths),
|
|
1940
|
+
themePaths: this.buildExtensionResourcePaths(themePaths),
|
|
1941
|
+
};
|
|
1942
|
+
this._resourceLoader.extendResources(extensionPaths);
|
|
1943
|
+
}
|
|
1944
|
+
if (!hasResources)
|
|
1945
|
+
return;
|
|
1921
1946
|
this._baseSystemPrompt = this._rebuildSystemPrompt(this.getActiveToolNames());
|
|
1922
1947
|
this.agent.state.systemPrompt = this._baseSystemPrompt;
|
|
1923
1948
|
}
|
|
@@ -1927,6 +1952,7 @@ export class AgentSession {
|
|
|
1927
1952
|
const baseDir = entry.extensionPath.startsWith("<") ? undefined : dirname(entry.extensionPath);
|
|
1928
1953
|
return {
|
|
1929
1954
|
path: entry.path,
|
|
1955
|
+
owner: entry.extensionOwner,
|
|
1930
1956
|
metadata: {
|
|
1931
1957
|
source,
|
|
1932
1958
|
scope: "temporary",
|
|
@@ -2036,7 +2062,7 @@ export class AgentSession {
|
|
|
2036
2062
|
}, {
|
|
2037
2063
|
getModel: () => this.model,
|
|
2038
2064
|
getScopedModels: () => this._scopedModels,
|
|
2039
|
-
isIdle: () => this.isIdle,
|
|
2065
|
+
isIdle: () => this.isIdle && !this.isCompacting,
|
|
2040
2066
|
isProjectTrusted: () => this.settingsManager.isProjectTrusted(),
|
|
2041
2067
|
getSignal: () => this.agent.signal,
|
|
2042
2068
|
abort: () => {
|
|
@@ -2065,6 +2091,7 @@ export class AgentSession {
|
|
|
2065
2091
|
},
|
|
2066
2092
|
getSystemPrompt: () => this.systemPrompt,
|
|
2067
2093
|
getSystemPromptOptions: () => this._baseSystemPromptOptions,
|
|
2094
|
+
replaceByzWorkflowResources: (extensionOwner, extensionPath, resources) => this.replaceByzWorkflowResources(extensionOwner, extensionPath, resources),
|
|
2068
2095
|
}, {
|
|
2069
2096
|
registerProvider: (name, config) => {
|
|
2070
2097
|
this._modelRuntime.registerProvider(name, config);
|