@bivy/bivy 0.10.1-staging.200 → 0.10.1-staging.201
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/server.js +28 -5
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -17,6 +17,8 @@ import { activeRulesetFor } from "./runtime/ruleset-store.js";
|
|
|
17
17
|
import { createRulesetController } from "./controllers/rulesets.js";
|
|
18
18
|
import { createWorkspaceController } from "./controllers/workspaces.js";
|
|
19
19
|
import { createModelController } from "./controllers/models.js";
|
|
20
|
+
import { Type } from "typebox";
|
|
21
|
+
import { validateInput } from "./protocol/command-spec.js";
|
|
20
22
|
import { collectDiscoveredSessions, planNativeAdoption } from "./runtime/native-session-discovery.js";
|
|
21
23
|
import { aggregateModelCatalog, mergeProviderCatalog } from "./runtime/model-catalog.js";
|
|
22
24
|
import { RuntimeHost, enforcementLevelFor, remoteRuntimeEnabled } from "./runtime/host.js";
|
|
@@ -1687,8 +1689,16 @@ const dedupeSessionNew = (requestId, create) => sessionNewDedupe.run(requestId,
|
|
|
1687
1689
|
const promptDedupe = createSessionNewDedupe();
|
|
1688
1690
|
const dedupePrompt = (clientMessageId, run) => promptDedupe.run(clientMessageId, run);
|
|
1689
1691
|
const RELAY_COMMANDS = {
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
+
// First command to adopt boundary validation (the spec form). `requestId` is
|
|
1693
|
+
// the only declared field; typebox permits additional properties by default,
|
|
1694
|
+
// so real pings always pass — this exercises the schema path end-to-end
|
|
1695
|
+
// without changing behavior. Other commands adopt schemas one at a time.
|
|
1696
|
+
ping: {
|
|
1697
|
+
since: 0,
|
|
1698
|
+
schema: Type.Object({ requestId: Type.Optional(Type.String()) }),
|
|
1699
|
+
handler(msg, ctx) {
|
|
1700
|
+
ctx.reply({ type: "pong", requestId: typeof msg.requestId === "string" ? msg.requestId : undefined });
|
|
1701
|
+
},
|
|
1692
1702
|
},
|
|
1693
1703
|
// Kick off `bivy update` on this node from the app's version-mismatch banner
|
|
1694
1704
|
// (see runBivyUpdate). The node restarts itself when the update lands, so the
|
|
@@ -2930,9 +2940,22 @@ const relayCtx = { reply: (event) => relay?.sendEvent(event), broadcast };
|
|
|
2930
2940
|
const RELAY_CLIENT_ID = "relay";
|
|
2931
2941
|
async function handleRelayMessage(msg) {
|
|
2932
2942
|
try {
|
|
2933
|
-
const
|
|
2934
|
-
if (
|
|
2935
|
-
|
|
2943
|
+
const entry = RELAY_COMMANDS[msg.kind];
|
|
2944
|
+
if (entry) {
|
|
2945
|
+
const handler = typeof entry === "function" ? entry : entry.handler;
|
|
2946
|
+
const schema = typeof entry === "function" ? undefined : entry.schema;
|
|
2947
|
+
if (schema) {
|
|
2948
|
+
const check = validateInput(schema, msg);
|
|
2949
|
+
if (!check.ok) {
|
|
2950
|
+
relayCtx.reply({
|
|
2951
|
+
type: `${msg.kind}.error`,
|
|
2952
|
+
requestId: typeof msg.requestId === "string" ? msg.requestId : undefined,
|
|
2953
|
+
error: `Invalid ${msg.kind}: ${check.errors.join("; ")}`,
|
|
2954
|
+
});
|
|
2955
|
+
return;
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
await handler(msg, relayCtx);
|
|
2936
2959
|
return;
|
|
2937
2960
|
}
|
|
2938
2961
|
// Fallthrough for kinds not in RELAY_COMMANDS: terminal.* frames go to the
|
package/package.json
CHANGED