@postonus/cli 0.1.10 → 0.1.12

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/index.js CHANGED
@@ -11983,7 +11983,7 @@ function formatTable(headers, rows) {
11983
11983
  }
11984
11984
 
11985
11985
  // src/version.ts
11986
- var CLI_VERSION = "0.1.10";
11986
+ var CLI_VERSION = "0.1.12";
11987
11987
 
11988
11988
  // src/client.ts
11989
11989
  var DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
@@ -12176,7 +12176,7 @@ function Table({ headers, rows }) {
12176
12176
  );
12177
12177
  return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
12178
12178
  /* @__PURE__ */ jsx(Box, { children: headers.map((header, index) => /* @__PURE__ */ jsx(Box, { width: (widths[index] ?? 0) + 2, children: /* @__PURE__ */ jsx(Text, { bold: true, dimColor: true, children: header }) }, header)) }),
12179
- rows.map((row, rowIndex) => /* @__PURE__ */ jsx(Box, { children: row.map((cell, index) => /* @__PURE__ */ jsx(Box, { width: (widths[index] ?? 0) + 2, children: /* @__PURE__ */ jsx(Text, { children: cell }) }, index)) }, rowIndex))
12179
+ rows.map((row, rowIndex) => ({ row, rowKey: `row-${rowIndex}` })).map(({ row, rowKey }) => /* @__PURE__ */ jsx(Box, { children: row.map((cell, index) => ({ cell, cellKey: `cell-${index}`, width: (widths[index] ?? 0) + 2 })).map(({ cell, cellKey, width }) => /* @__PURE__ */ jsx(Box, { width, children: /* @__PURE__ */ jsx(Text, { children: cell }) }, cellKey)) }, rowKey))
12180
12180
  ] });
12181
12181
  }
12182
12182
  function useExit() {
@@ -12579,16 +12579,27 @@ async function mcpServe() {
12579
12579
  const send = oauth ? createOAuthFetch(apiUrl, oauth, persistRefreshedTokens(apiUrl, oauth)) : (request, init) => fetch(request, init);
12580
12580
  let protocolVersion;
12581
12581
  let sessionId;
12582
- const headersFor = (currentAuth) => new Headers({
12583
- "content-type": "application/json",
12584
- // Both, because the endpoint may answer either way and refuses a request
12585
- // that accepts only one.
12586
- accept: "application/json, text/event-stream",
12587
- [CLI_VERSION_HEADER]: CLI_VERSION,
12588
- ...currentAuth.kind === "api-key" ? { "x-api-key": currentAuth.apiKey } : { authorization: `Bearer ${oauth?.accessToken}` },
12589
- ...protocolVersion ? { "mcp-protocol-version": protocolVersion } : {},
12590
- ...sessionId ? { "mcp-session-id": sessionId } : {}
12591
- });
12582
+ const headersFor = (currentAuth) => {
12583
+ const headers = new Headers({
12584
+ "content-type": "application/json",
12585
+ // Both, because the endpoint may answer either way and refuses a request
12586
+ // that accepts only one.
12587
+ accept: "application/json, text/event-stream",
12588
+ [CLI_VERSION_HEADER]: CLI_VERSION
12589
+ });
12590
+ if (currentAuth.kind === "api-key") {
12591
+ headers.set("x-api-key", currentAuth.apiKey);
12592
+ } else if (oauth?.accessToken) {
12593
+ headers.set("authorization", `Bearer ${oauth.accessToken}`);
12594
+ }
12595
+ if (protocolVersion) {
12596
+ headers.set("mcp-protocol-version", protocolVersion);
12597
+ }
12598
+ if (sessionId) {
12599
+ headers.set("mcp-session-id", sessionId);
12600
+ }
12601
+ return headers;
12602
+ };
12592
12603
  async function forward(message) {
12593
12604
  const response = await send(new Request(endpoint, { method: "POST", headers: headersFor(auth), body: message }), {});
12594
12605
  const returnedSession = response.headers.get("mcp-session-id");