@liberseek/boft-cli-win32-arm64 0.8.2 → 0.8.3

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/README.md CHANGED
@@ -7,7 +7,7 @@ BOFT CLI runs Pi and other external harnesses inside Codex Desktop.
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- npm install -g @liberseek/boft-cli@0.8.2
10
+ npm install -g @liberseek/boft-cli@0.8.3
11
11
  ```
12
12
 
13
13
  Do not install this package directly. npm selects it through the optional dependencies of `@liberseek/boft-cli`.
@@ -1 +1 @@
1
- {"schemaVersion":1,"version":"0.8.2","distribution":"npm","target":"windows-arm64"}
1
+ {"schemaVersion":1,"version":"0.8.3","distribution":"npm","target":"windows-arm64"}
@@ -21147,9 +21147,8 @@ function resolveGrokExecutable(input = {}) {
21147
21147
  }
21148
21148
  function grokInvocation(command, platform = process.platform, modelId) {
21149
21149
  const arguments_ = ["agent", "--no-leader"];
21150
- const trimmed = modelId?.trim();
21151
- if (trimmed)
21152
- arguments_.push("--model", trimmed);
21150
+ if (modelId?.trim())
21151
+ arguments_.push("--model", modelId);
21153
21152
  arguments_.push("stdio");
21154
21153
  return commandInvocation(command, arguments_, process.env, platform);
21155
21154
  }
@@ -24795,6 +24794,27 @@ function isRecord16(value) {
24795
24794
  function nonBlank(value) {
24796
24795
  return typeof value === "string" && value.trim().length > 0;
24797
24796
  }
24797
+ var ENCODED_MODEL_REF_PREFIX = "grok-model~";
24798
+ function encodeGrokModelRef(modelId) {
24799
+ if (!nonBlank(modelId) || modelId.length > HARNESS_MODEL_REF_MAX_LENGTH || new RegExp("\\p{Cc}", "u").test(modelId))
24800
+ return null;
24801
+ const direct = harnessModelRefSchema.safeParse({ id: modelId });
24802
+ if (direct.success && !modelId.startsWith(ENCODED_MODEL_REF_PREFIX))
24803
+ return direct.data;
24804
+ const encoded = harnessModelRefSchema.safeParse({
24805
+ id: `${ENCODED_MODEL_REF_PREFIX}${Buffer.from(modelId, "utf8").toString("base64url")}`
24806
+ });
24807
+ return encoded.success ? encoded.data : null;
24808
+ }
24809
+ function decodeGrokModelRef(ref) {
24810
+ const { id } = harnessModelRefSchema.parse(ref);
24811
+ if (!id.startsWith(ENCODED_MODEL_REF_PREFIX))
24812
+ return id;
24813
+ const modelId = Buffer.from(id.slice(ENCODED_MODEL_REF_PREFIX.length), "base64url").toString("utf8");
24814
+ if (encodeGrokModelRef(modelId)?.id !== id)
24815
+ throw new Error("Invalid Grok Model Ref");
24816
+ return modelId;
24817
+ }
24798
24818
  function thinkingOptions(value) {
24799
24819
  if (!Array.isArray(value))
24800
24820
  return [];
@@ -24815,8 +24835,8 @@ function parseGrokModelState(value) {
24815
24835
  if (!isRecord16(value) || !nonBlank(value.currentModelId) || !Array.isArray(value.availableModels)) {
24816
24836
  return null;
24817
24837
  }
24818
- const currentModel = harnessModelRefSchema.safeParse({ id: value.currentModelId });
24819
- if (!currentModel.success)
24838
+ const currentModel = encodeGrokModelRef(value.currentModelId);
24839
+ if (!currentModel)
24820
24840
  return null;
24821
24841
  const allThinking = /* @__PURE__ */ new Map();
24822
24842
  const contextWindowTokensByModel = /* @__PURE__ */ new Map();
@@ -24826,16 +24846,16 @@ function parseGrokModelState(value) {
24826
24846
  for (const candidate of value.availableModels) {
24827
24847
  if (!isRecord16(candidate) || !nonBlank(candidate.modelId) || !nonBlank(candidate.name))
24828
24848
  continue;
24829
- const ref = harnessModelRefSchema.safeParse({ id: candidate.modelId });
24830
- if (!ref.success)
24849
+ const ref = encodeGrokModelRef(candidate.modelId);
24850
+ if (!ref)
24831
24851
  continue;
24832
24852
  const metadata = isRecord16(candidate._meta) ? candidate._meta : {};
24833
24853
  const options2 = thinkingOptions(metadata.reasoningEfforts);
24834
24854
  if (Array.isArray(metadata.contextWindows) && metadata.contextWindows.includes(5e5)) {
24835
- defaultContextWindowTokensByModel.set(ref.data.id, 5e5);
24855
+ defaultContextWindowTokensByModel.set(ref.id, 5e5);
24836
24856
  }
24837
24857
  if (typeof metadata.totalContextTokens === "number" && Number.isSafeInteger(metadata.totalContextTokens) && metadata.totalContextTokens > 0) {
24838
- contextWindowTokensByModel.set(ref.data.id, metadata.totalContextTokens);
24858
+ contextWindowTokensByModel.set(ref.id, metadata.totalContextTokens);
24839
24859
  }
24840
24860
  for (const option of options2)
24841
24861
  allThinking.set(option.id, option);
@@ -24846,22 +24866,22 @@ function parseGrokModelState(value) {
24846
24866
  }
24847
24867
  }
24848
24868
  models.push({
24849
- ref: ref.data,
24869
+ ref,
24850
24870
  label: candidate.name,
24851
24871
  ...options2.length > 0 ? { supportedThinkingOptionIds: options2.map(({ id }) => id) } : {}
24852
24872
  });
24853
24873
  }
24854
- if (!models.some(({ ref }) => ref.id === currentModel.data.id))
24874
+ if (!models.some(({ ref }) => ref.id === currentModel.id))
24855
24875
  return null;
24856
24876
  const options = [...allThinking.values()];
24857
24877
  return {
24858
- currentModel: currentModel.data,
24878
+ currentModel,
24859
24879
  contextWindowTokensByModel,
24860
24880
  defaultContextWindowTokensByModel,
24861
24881
  ...currentThinkingOptionId ? { currentThinkingOptionId } : {},
24862
24882
  catalog: {
24863
24883
  models,
24864
- defaultModel: currentModel.data,
24884
+ defaultModel: currentModel,
24865
24885
  thinkingOptions: options,
24866
24886
  ...currentThinkingOptionId ? { defaultThinkingOptionId: currentThinkingOptionId } : {}
24867
24887
  }
@@ -25757,7 +25777,7 @@ var GrokHarnessSession = class {
25757
25777
  this.#configuring = true;
25758
25778
  try {
25759
25779
  const contextWindow = this.#modelState.defaultContextWindowTokensByModel.get(model2.id);
25760
- await this.#transport.setModel(model2.id, thinkingOptionId, contextWindow);
25780
+ await this.#transport.setModel(decodeGrokModelRef(model2), thinkingOptionId, contextWindow);
25761
25781
  if (contextWindow !== void 0) {
25762
25782
  this.#modelState.contextWindowTokensByModel = new Map([
25763
25783
  ...this.#modelState.contextWindowTokensByModel,
@@ -26723,7 +26743,7 @@ var GrokAdapter = class {
26723
26743
  } : {
26724
26744
  kind: "create",
26725
26745
  permissionModeId: requestedPermissionModeId,
26726
- ...input.kind === "create" && input.model ? { modelId: input.model.id } : {}
26746
+ ...input.kind === "create" && input.model ? { modelId: decodeGrokModelRef(input.model) } : {}
26727
26747
  });
26728
26748
  }
26729
26749
  if (!opened) {
@@ -26781,7 +26801,7 @@ var GrokAdapter = class {
26781
26801
  }
26782
26802
  const contextWindow = modelState.defaultContextWindowTokensByModel.get(modelState.currentModel.id);
26783
26803
  if (modelState.currentModel.id !== nativeModelId || modelState.currentThinkingOptionId !== nativeThinkingOptionId || contextWindow !== void 0 && modelState.contextWindowTokensByModel.get(modelState.currentModel.id) !== contextWindow) {
26784
- await transport.setModel(modelState.currentModel.id, modelState.currentThinkingOptionId, contextWindow);
26804
+ await transport.setModel(decodeGrokModelRef(modelState.currentModel), modelState.currentThinkingOptionId, contextWindow);
26785
26805
  if (contextWindow !== void 0) {
26786
26806
  modelState.contextWindowTokensByModel = new Map([
26787
26807
  ...modelState.contextWindowTokensByModel,
package/bin/boft.exe CHANGED
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liberseek/boft-cli-win32-arm64",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "description": "BOFT CLI runs Pi and other external harnesses inside Codex Desktop.",
5
5
  "type": "module",
6
6
  "files": [