Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/gateway-descriptor-v4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"grok-bot-cli": patch
---

Read version 4 Grok Bot gateway descriptors using the existing encrypted-entry format. Continue rejecting empty or ambiguous entries and unknown descriptor versions.
2 changes: 1 addition & 1 deletion artifact/agent-bundle.compile-evidence.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion artifact/agent-bundle.manifest.json

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions artifact/bin/gbot-flight.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25867,11 +25867,20 @@ var __webpack_modules__ = {
}
}
function encryptedPayload(wrapped) {
if (wrapped.version != null && wrapped.version !== 1 && wrapped.version !== 2 && wrapped.version !== 3) {
if (wrapped.version != null && ![
1,
2,
3,
4
].includes(wrapped.version)) {
throw new GrokBotGatewaySessionError("UNSUPPORTED_VERSION", `Unsupported Grok Bot gateway descriptor version ${wrapped.version}.`);
}
let encrypted;
if (wrapped.version === 2 || wrapped.version === 3) {
if ([
2,
3,
4
].includes(wrapped.version)) {
const entries = Object.values(wrapped.entries ?? {});
if (entries.length === 0) {
throw new GrokBotGatewaySessionError("EMPTY_ENTRIES", "Grok Bot gateway descriptor has no saved gateway entries.");
Expand Down
13 changes: 11 additions & 2 deletions artifact/bin/gbot.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44296,11 +44296,20 @@ var __webpack_modules__ = {
}
}
function encryptedPayload(wrapped) {
if (wrapped.version != null && wrapped.version !== 1 && wrapped.version !== 2 && wrapped.version !== 3) {
if (wrapped.version != null && ![
1,
2,
3,
4
].includes(wrapped.version)) {
throw new GrokBotGatewaySessionError("UNSUPPORTED_VERSION", `Unsupported Grok Bot gateway descriptor version ${wrapped.version}.`);
}
let encrypted;
if (wrapped.version === 2 || wrapped.version === 3) {
if ([
2,
3,
4
].includes(wrapped.version)) {
const entries = Object.values(wrapped.entries ?? {});
if (entries.length === 0) {
throw new GrokBotGatewaySessionError("EMPTY_ENTRIES", "Grok Bot gateway descriptor has no saved gateway entries.");
Expand Down
13 changes: 11 additions & 2 deletions artifact/mcp/mcp-grok-bot-b8c2461e-flight.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24573,11 +24573,20 @@ var __webpack_modules__ = {
}
}
function encryptedPayload(wrapped) {
if (wrapped.version != null && wrapped.version !== 1 && wrapped.version !== 2 && wrapped.version !== 3) {
if (wrapped.version != null && ![
1,
2,
3,
4
].includes(wrapped.version)) {
throw new GrokBotGatewaySessionError("UNSUPPORTED_VERSION", `Unsupported Grok Bot gateway descriptor version ${wrapped.version}.`);
}
let encrypted;
if (wrapped.version === 2 || wrapped.version === 3) {
if ([
2,
3,
4
].includes(wrapped.version)) {
const entries = Object.values(wrapped.entries ?? {});
if (entries.length === 0) {
throw new GrokBotGatewaySessionError("EMPTY_ENTRIES", "Grok Bot gateway descriptor has no saved gateway entries.");
Expand Down
13 changes: 11 additions & 2 deletions artifact/mcp/mcp-grok-bot-b8c2461e.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -61788,11 +61788,20 @@ var __webpack_modules__ = {
}
}
function encryptedPayload(wrapped) {
if (wrapped.version != null && wrapped.version !== 1 && wrapped.version !== 2 && wrapped.version !== 3) {
if (wrapped.version != null && ![
1,
2,
3,
4
].includes(wrapped.version)) {
throw new GrokBotGatewaySessionError("UNSUPPORTED_VERSION", `Unsupported Grok Bot gateway descriptor version ${wrapped.version}.`);
}
let encrypted;
if (wrapped.version === 2 || wrapped.version === 3) {
if ([
2,
3,
4
].includes(wrapped.version)) {
const entries = Object.values(wrapped.entries ?? {});
if (entries.length === 0) {
throw new GrokBotGatewaySessionError("EMPTY_ENTRIES", "Grok Bot gateway descriptor has no saved gateway entries.");
Expand Down
13 changes: 11 additions & 2 deletions artifact/scripts/gbot-relay.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21988,11 +21988,20 @@ var __webpack_modules__ = {
}
}
function encryptedPayload(wrapped) {
if (wrapped.version != null && wrapped.version !== 1 && wrapped.version !== 2 && wrapped.version !== 3) {
if (wrapped.version != null && ![
1,
2,
3,
4
].includes(wrapped.version)) {
throw new GrokBotGatewaySessionError("UNSUPPORTED_VERSION", `Unsupported Grok Bot gateway descriptor version ${wrapped.version}.`);
}
let encrypted;
if (wrapped.version === 2 || wrapped.version === 3) {
if ([
2,
3,
4
].includes(wrapped.version)) {
const entries = Object.values(wrapped.entries ?? {});
if (entries.length === 0) {
throw new GrokBotGatewaySessionError("EMPTY_ENTRIES", "Grok Bot gateway descriptor has no saved gateway entries.");
Expand Down
4 changes: 2 additions & 2 deletions src/core/app-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ class GrokBotGatewaySessionError extends Error {
}

function encryptedPayload(wrapped) {
if (wrapped.version != null && wrapped.version !== 1 && wrapped.version !== 2 && wrapped.version !== 3) {
if (wrapped.version != null && ![1, 2, 3, 4].includes(wrapped.version)) {
throw new GrokBotGatewaySessionError(
"UNSUPPORTED_VERSION",
`Unsupported Grok Bot gateway descriptor version ${wrapped.version}.`,
);
}
let encrypted;
if (wrapped.version === 2 || wrapped.version === 3) {
if ([2, 3, 4].includes(wrapped.version)) {
const entries = Object.values(wrapped.entries ?? {});
if (entries.length === 0) {
throw new GrokBotGatewaySessionError(
Expand Down
6 changes: 3 additions & 3 deletions test/app-session.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ test("loads the signed-in Grok Bot gateway without manual tokens", () => {
});
});

for (const version of [2, 3]) {
for (const version of [2, 3, 4]) {
test(`loads a version ${version} Grok Bot gateway entry`, () => {
const home = writeWrappedDescriptor({
version,
Expand Down Expand Up @@ -193,7 +193,7 @@ for (const version of [2, 3]) {

test("rejects an unsupported gateway descriptor version", () => {
const home = writeWrappedDescriptor({
version: 4,
version: 5,
encrypted: ENCRYPTED_DESCRIPTOR,
});

Expand All @@ -206,7 +206,7 @@ test("rejects an unsupported gateway descriptor version", () => {
(error) => {
assert.equal(error.name, "GrokBotGatewaySessionError");
assert.equal(error.code, "UNSUPPORTED_VERSION");
assert.match(error.message, /unsupported .*gateway descriptor version 4/i);
assert.match(error.message, /unsupported .*gateway descriptor version 5/i);
return true;
},
);
Expand Down