@neta-art/cohub-cli 10.14.0 → 10.15.0

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.
@@ -1,6 +1,6 @@
1
+ import { isModelThinkingLevel, MODEL_THINKING_LEVELS as thinkingLevels, RUNTIME_MAX_SERVICE_TIERS, runtimeServiceTierSchema, thinkingLevelMapFor } from "@neta-art/cohub";
1
2
  import { record } from "./json-rpc.js";
2
- const thinkingLevels = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
3
- const thinkingLevel = (value) => thinkingLevels.includes(value) ? value : undefined;
3
+ const thinkingLevel = (value) => isModelThinkingLevel(value) ? value : undefined;
4
4
  /**
5
5
  * Publish only picker metadata, never provider credentials or request configuration.
6
6
  * `state` is a fresh Pi's `get_state`: its model is what Pi runs when Cohub requests
@@ -16,7 +16,7 @@ export function piModelCatalog(entries, state) {
16
16
  if (typeof model.id !== "string" || !model.id || typeof model.provider !== "string" || !model.provider)
17
17
  return [];
18
18
  const map = record(model.thinkingLevelMap);
19
- const thinkingLevelMap = Object.fromEntries(thinkingLevels.flatMap((level) => map[level] === null || typeof map[level] === "string" ? [[level, map[level]]] : []));
19
+ const thinkingLevelMap = thinkingLevelMapFor((level) => map[level] === null || typeof map[level] === "string" ? map[level] : undefined);
20
20
  const isDefault = current.provider === model.provider && current.id === model.id;
21
21
  return [{
22
22
  harness: "pi", id: model.id, provider: model.provider, name: typeof model.name === "string" ? model.name : model.id,
@@ -31,10 +31,10 @@ function codexThinking(model, configuredEffort) {
31
31
  if (!Array.isArray(model.supportedReasoningEfforts))
32
32
  return {};
33
33
  const efforts = new Set(model.supportedReasoningEfforts.map((entry) => record(entry).reasoningEffort));
34
- const thinkingLevelMap = Object.fromEntries(thinkingLevels.map((level) => {
34
+ const thinkingLevelMap = thinkingLevelMapFor((level) => {
35
35
  const effort = level === "off" ? "none" : level;
36
- return [level, efforts.has(effort) ? effort : null];
37
- }));
36
+ return efforts.has(effort) ? effort : null;
37
+ });
38
38
  const normalize = (value) => thinkingLevel(value === "none" ? "off" : value);
39
39
  const configured = normalize(configuredEffort);
40
40
  const fallback = normalize(model.defaultReasoningEffort);
@@ -45,6 +45,22 @@ function codexThinking(model, configuredEffort) {
45
45
  ...(defaultThinkingLevel ? { defaultThinkingLevel } : {}),
46
46
  };
47
47
  }
48
+ /** `serviceTiers` supersedes the deprecated `additionalSpeedTiers`, which only names tier ids. */
49
+ function codexServiceTiers(model) {
50
+ const candidates = Array.isArray(model.serviceTiers)
51
+ ? model.serviceTiers.map((entry) => {
52
+ const tier = record(entry);
53
+ return { id: tier.id, name: tier.name, ...(typeof tier.description === "string" && tier.description ? { description: tier.description } : {}) };
54
+ })
55
+ : Array.isArray(model.additionalSpeedTiers) ? model.additionalSpeedTiers.map((id) => ({ id, name: id })) : [];
56
+ // An entry outside the protocol's bounds is dropped rather than invalidating the whole catalog.
57
+ const tiers = candidates.flatMap((tier) => {
58
+ const parsed = runtimeServiceTierSchema.safeParse(tier);
59
+ return parsed.success ? [parsed.data] : [];
60
+ }).slice(0, RUNTIME_MAX_SERVICE_TIERS);
61
+ const defaultServiceTier = typeof model.defaultServiceTier === "string" && tiers.some((tier) => tier.id === model.defaultServiceTier) ? model.defaultServiceTier : undefined;
62
+ return { ...(tiers.length ? { serviceTiers: tiers } : {}), ...(defaultServiceTier ? { defaultServiceTier } : {}) };
63
+ }
48
64
  /** Use Codex's picker-visible model/list for every provider, including custom providers. */
49
65
  export function codexModelCatalog(configResponse, entries) {
50
66
  const config = record(configResponse.config);
@@ -57,7 +73,7 @@ export function codexModelCatalog(configResponse, entries) {
57
73
  return [];
58
74
  // A configured model replaces the catalog's own default.
59
75
  const isDefault = configuredModel ? id === configuredModel : model.isDefault === true;
60
- return [{ harness: "codex", provider, id, name: typeof model.displayName === "string" ? model.displayName : id, ...(isDefault ? { isDefault } : {}), ...codexThinking(model, config.model_reasoning_effort) }];
76
+ return [{ harness: "codex", provider, id, name: typeof model.displayName === "string" ? model.displayName : id, ...(isDefault ? { isDefault } : {}), ...codexThinking(model, config.model_reasoning_effort), ...codexServiceTiers(model) }];
61
77
  });
62
78
  if (configuredModel && !models.some((model) => model.id === configuredModel))
63
79
  models.unshift({ harness: "codex", provider, id: configuredModel, name: configuredModel, isDefault: true });
@@ -10,7 +10,7 @@ import { createClient } from "../client.js";
10
10
  import { currentIdentityKey } from "../space.js";
11
11
  import { ensureSandboxdBinary } from "../commands/sandboxd-binary.js";
12
12
  import { serveRuntime } from "./connection.js";
13
- import { discoverHarnesses } from "./harnesses/index.js";
13
+ import { discoverHarnesses, refreshHarnesses } from "./harnesses/index.js";
14
14
  import { RuntimeDiagnostics, serializeDiagnosticError } from "./diagnostics.js";
15
15
  import { ownRuntimeInstance, runtimeInstanceDirectory } from "./instance.js";
16
16
  import { createDiagnosticConsole } from "./presentation.js";
@@ -310,6 +310,7 @@ export async function runRuntime(config, onState, externalSignal, onDiagnostic)
310
310
  let importRequested = Boolean(config.importHistory);
311
311
  await serveRuntime({
312
312
  spaceId: config.spaceId, cwd: config.root, url: url.toString(), capabilities,
313
+ refreshCapabilities: (current) => refreshHarnesses(current, config.executables, config.root, (harness, error) => diagnostics.log("warn", "runtime.harness_catalog_failed", { harness, error: serializeDiagnosticError(error) })),
313
314
  runtimeId: status.runtimeId, diagnostics, token, signal, executor: native.executor,
314
315
  onReady: () => { update({ harnessConnected: true }); retryDisconnectedBridge?.(); },
315
316
  onDisconnected: () => { native.connect(null); update({ harnessConnected: false }); retryDisconnectedBridge?.(); },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/cohub-cli",
3
- "version": "10.14.0",
3
+ "version": "10.15.0",
4
4
  "description": "CLI for Cohub — spaces, sessions, and agent collaboration.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -18,8 +18,8 @@
18
18
  "NOTICE"
19
19
  ],
20
20
  "dependencies": {
21
- "@neta-art/cohub": "13.3.0",
22
- "@neta-art/generation": "^0.1.41",
21
+ "@neta-art/cohub": "13.5.0",
22
+ "@neta-art/generation": "0.2.8",
23
23
  "commander": "^15.0.0",
24
24
  "sharp": "^0.35.4",
25
25
  "ws": "^8.21.3"