@yorz/cli 0.4.1 → 0.4.2

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +13 -2
  2. package/package.json +2 -2
package/dist/cli/index.js CHANGED
@@ -21,7 +21,7 @@ import { Codex } from "@openai/codex-sdk";
21
21
  import { createOpencode } from "@opencode-ai/sdk";
22
22
  import { createInterface as createInterface$1 } from "node:readline/promises";
23
23
  import MarkdownIt from "markdown-it";
24
- const version = "0.4.1";
24
+ const version = "0.4.2";
25
25
  const pkg = {
26
26
  version
27
27
  };
@@ -4661,6 +4661,7 @@ class SpecWatcher {
4661
4661
  function blocksFrom(message) {
4662
4662
  if (!message || typeof message !== "object") return [];
4663
4663
  const content = message.content;
4664
+ if (typeof content === "string") return content ? [{ type: "text", text: content }] : [];
4664
4665
  return Array.isArray(content) ? content : [];
4665
4666
  }
4666
4667
  function toolResultText(content) {
@@ -5240,6 +5241,8 @@ class SessionManager {
5240
5241
  emitters = /* @__PURE__ */ new Map();
5241
5242
  /** Session ids with an in-flight turn. Drives the list spinner. */
5242
5243
  running = /* @__PURE__ */ new Set();
5244
+ /** Kind of sessions discovered via `listSessions()` but absent from the store. */
5245
+ discoveredKinds = /* @__PURE__ */ new Map();
5243
5246
  statusEmitter = new EventEmitter();
5244
5247
  emitterFor(sid) {
5245
5248
  let e = this.emitters.get(sid);
@@ -5290,6 +5293,7 @@ class SessionManager {
5290
5293
  if (!adapter.capabilities().listSessions) continue;
5291
5294
  try {
5292
5295
  for (const info of await adapter.listSessions()) {
5296
+ if (!nativeIds.has(info.id)) this.discoveredKinds.set(info.id, kind);
5293
5297
  nativeIds.add(info.id);
5294
5298
  const indexed2 = byId.get(info.id);
5295
5299
  if (!indexed2) {
@@ -5337,8 +5341,15 @@ class SessionManager {
5337
5341
  if (!title || isOpaqueTitle(title, sid)) return;
5338
5342
  await this.store.updateTitle(sid, title);
5339
5343
  }
5344
+ async resolveKind(sid) {
5345
+ const known = (await this.store.get(sid))?.kind ?? this.live.get(sid)?.kind ?? this.discoveredKinds.get(sid);
5346
+ if (known) return known;
5347
+ await this.listSessions().catch(() => {
5348
+ });
5349
+ return this.discoveredKinds.get(sid) ?? this.defaultKind;
5350
+ }
5340
5351
  async getMessages(sid) {
5341
- const kind = (await this.store.get(sid))?.kind ?? this.live.get(sid)?.kind ?? this.defaultKind;
5352
+ const kind = await this.resolveKind(sid);
5342
5353
  const adapter = this.adapters.get(kind);
5343
5354
  if (!adapter.capabilities().getMessages) return [];
5344
5355
  return adapter.getMessages(sid);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorz/cli",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "bin": {
@@ -37,7 +37,7 @@
37
37
  "build:cli": "vite build",
38
38
  "build:gui": "vite build --config vite.gui.config.ts",
39
39
  "dev": "pnpm run build && concurrently -k -n cli,gui,serve \"vite build --watch\" \"vite build --config vite.gui.config.ts --watch\" \"node dist/cli/index.js serve --foreground\"",
40
- "dev:cli": "node dist/cli/index.js serve --port 7424 --foreground",
40
+ "dev:cli": "pnpm run build:cli && node dist/cli/index.js serve --port 7424 --foreground",
41
41
  "dev:gui-build": "vite build --config vite.gui.config.ts --watch",
42
42
  "dev:gui": "vite --config vite.gui.config.ts",
43
43
  "typecheck": "tsc -b",