neko-harness 0.2.7 → 0.2.8

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.
@@ -9,7 +9,7 @@
9
9
  href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Crect width='100' height='100' rx='26' fill='%23ffb7c5'/%3E%3Ctext x='50' y='70' font-size='58' text-anchor='middle' fill='%23ffffff' font-family='sans-serif' font-weight='bold'%3En%3C/text%3E%3C/svg%3E"
10
10
  />
11
11
  <title>neko harness</title>
12
- <script type="module" crossorigin src="/assets/index-B-Vl0yXY.js"></script>
12
+ <script type="module" crossorigin src="/assets/index-BJ4XDkf5.js"></script>
13
13
  <link rel="stylesheet" crossorigin href="/assets/index-BwqDUlvt.css">
14
14
  </head>
15
15
  <body>
package/dist/gateway.js CHANGED
@@ -2707,7 +2707,7 @@ import { dirname as dirname5, join as join7 } from "path";
2707
2707
  import { fileURLToPath as fileURLToPath2 } from "url";
2708
2708
 
2709
2709
  // packages/core/src/application-version.ts
2710
- var RUNNING_VERSION = "0.2.7";
2710
+ var RUNNING_VERSION = "0.2.8";
2711
2711
  var APPLICATION_PROTOCOL = 1;
2712
2712
  function stableVersion(value) {
2713
2713
  return typeof value === "string" && /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(value) && value.split(".").every((n) => Number.isSafeInteger(Number(n)));
package/dist/neko.js CHANGED
@@ -46,6 +46,9 @@ var __esm = (fn, res, err) => () => {
46
46
  };
47
47
 
48
48
  // packages/core/src/application-version.ts
49
+ function upgradeCommand(platform) {
50
+ return platform === "win32" ? "bun add --global neko-harness@latest" : "neko update";
51
+ }
49
52
  function stableVersion(value) {
50
53
  return typeof value === "string" && /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(value) && value.split(".").every((n) => Number.isSafeInteger(Number(n)));
51
54
  }
@@ -76,7 +79,7 @@ function updateAction(input) {
76
79
  return "install";
77
80
  return "none";
78
81
  }
79
- var RUNNING_VERSION = "0.2.7", APPLICATION_PROTOCOL = 1, ApplicationProtocolError;
82
+ var RUNNING_VERSION = "0.2.8", APPLICATION_PROTOCOL = 1, ApplicationProtocolError;
80
83
  var init_application_version = __esm(() => {
81
84
  ApplicationProtocolError = class ApplicationProtocolError extends Error {
82
85
  constructor() {
@@ -329,6 +332,10 @@ async function acquireUpdateLock(path) {
329
332
  };
330
333
  }
331
334
  async function updateCommand(options) {
335
+ if ((options.platform ?? process.platform) === "win32")
336
+ return `\u8BF7\u5148\u9000\u51FA neko\uFF0C\u7136\u540E\u8FD0\u884C\uFF1A
337
+ ${upgradeCommand("win32")}
338
+ \u5B8C\u6210\u540E\u91CD\u65B0\u542F\u52A8 neko\u3002`;
332
339
  if (!stableVersion(options.runningVersion))
333
340
  throw new Error("\u5F53\u524D\u5B89\u88C5\u65B9\u5F0F\u4E0D\u652F\u6301\u81EA\u5347\u7EA7\uFF0C\u8BF7\u6309\u539F\u65B9\u5F0F\u66F4\u65B0\u3002");
334
341
  const run = options.run ?? runBun;
@@ -17077,17 +17084,69 @@ var init_skill_market_ui = __esm(() => {
17077
17084
 
17078
17085
  // packages/tui/src/version-ui.ts
17079
17086
  import { matchesKey as matchesKey6, Text as Text6 } from "@earendil-works/pi-tui";
17080
- function versionNotice(state, installed) {
17081
- const action = updateAction({ gateway: state, frontend: RUNNING_VERSION, installed });
17087
+ function actionFor(state, installed, runningVersion) {
17088
+ const action = updateAction({ gateway: state, frontend: runningVersion, installed });
17089
+ return action === "install" && !newer(state?.latestVersion, runningVersion) ? "none" : action;
17090
+ }
17091
+ function versionNotice(state, installed, options = {}) {
17092
+ const action = actionFor(state, installed, options.runningVersion ?? RUNNING_VERSION);
17082
17093
  return {
17083
17094
  none: "",
17084
- install: "Update available \xB7 Run neko update",
17095
+ install: `Update available \xB7 Run ${upgradeCommand(options.platform ?? process.platform)} \xB7 /version`,
17085
17096
  "restart-service": "Updated \xB7 Restart neko \xB7 /version",
17086
17097
  "restart-tui": "Updated \xB7 Restart neko tui",
17087
17098
  "refresh-page": "",
17088
- incompatible: "Protocol incompatible \xB7 Update and restart neko"
17099
+ incompatible: "Protocol incompatible \xB7 Update and restart neko \xB7 /version"
17089
17100
  }[action];
17090
17101
  }
17102
+ function versionOverview(state, installed, options = {}) {
17103
+ const running = options.runningVersion ?? RUNNING_VERSION;
17104
+ const command = upgradeCommand(options.platform ?? process.platform);
17105
+ const current = `Current: ${stableVersion(running) ? `v${running}` : running}`;
17106
+ const action = actionFor(state, installed, running);
17107
+ let status;
17108
+ switch (action) {
17109
+ case "incompatible":
17110
+ status = `Protocol incompatible
17111
+ Exit neko, run ${command}, then restart neko.`;
17112
+ break;
17113
+ case "restart-service":
17114
+ status = `Restart neko
17115
+ Finish tasks and close TUI/Web and any neko serve sharing this gateway. Then run neko tui or neko web.`;
17116
+ break;
17117
+ case "restart-tui":
17118
+ status = `Restart neko tui
17119
+ Finish tasks, exit this TUI, then run neko tui.`;
17120
+ break;
17121
+ case "install":
17122
+ status = `Update available
17123
+ Latest: v${state.latestVersion}
17124
+ Exit neko, then run:
17125
+ ${command}
17126
+ Restart neko after updating.`;
17127
+ break;
17128
+ default:
17129
+ if (!stableVersion(running) || state?.checkState === "development")
17130
+ status = "Development build";
17131
+ else if (!state)
17132
+ status = "Check not available";
17133
+ else if (state.checkState === "checking")
17134
+ status = "Checking for updates...";
17135
+ else if (state.checkState === "failed")
17136
+ status = "Check failed \xB7 Retry";
17137
+ else if (state.checkState === "unknown")
17138
+ status = "Not checked";
17139
+ else if (!stableVersion(installed) || !stableVersion(state.installedVersion) || !stableVersion(state.runningVersion) || !stableVersion(state.latestVersion) || state.checkedAt === null)
17140
+ status = "Check not available";
17141
+ else
17142
+ status = "Up to date";
17143
+ }
17144
+ if (state?.checkState === "failed" && !status.includes("Check failed"))
17145
+ status += `
17146
+ Check failed \xB7 Retry`;
17147
+ return `${current}
17148
+ ${status}`;
17149
+ }
17091
17150
 
17092
17151
  class VersionDetail {
17093
17152
  help = "Up/Down Scroll \xB7 Esc Back";
@@ -17111,31 +17170,34 @@ class VersionDetail {
17111
17170
  return true;
17112
17171
  }
17113
17172
  }
17114
- function openVersion(panel, read, check) {
17173
+ function openVersion(panel, read, check, options = {}) {
17115
17174
  return panel.show("Version", async () => [
17116
- { value: "info", label: "Versions and next step" },
17117
- { value: "check", label: "Check for updates" }
17175
+ { value: "info", label: "Version" },
17176
+ { value: "check", label: "Check for updates" },
17177
+ { value: "details", label: "Version details" }
17118
17178
  ], async (value) => {
17179
+ let checked;
17119
17180
  let failed = false;
17120
17181
  if (value === "check") {
17121
17182
  try {
17122
- const checked = await check();
17123
- failed = checked.checkState === "failed";
17183
+ checked = await check();
17124
17184
  } catch {
17125
17185
  failed = true;
17126
17186
  }
17127
17187
  }
17128
17188
  const { state, installed } = await read();
17129
- return new VersionDetail(`TUI: ${RUNNING_VERSION}
17189
+ if (value === "details")
17190
+ return new VersionDetail(`TUI: ${options.runningVersion ?? RUNNING_VERSION}
17130
17191
  Installed: ${installed ?? "unknown"}
17131
17192
  Gateway: ${state?.runningVersion ?? "unknown"}
17132
17193
  Gateway installed: ${state?.installedVersion ?? "unknown"}
17133
- Latest: ${state?.latestVersion ?? "unknown"}
17134
-
17135
- ${failed ? "Check failed \xB7 Retry" : versionNotice(state, installed) || (state?.checkState === "ok" && installed ? "Up to date" : "Check not available")}
17136
-
17137
- Run neko update in a terminal.
17138
- To restart the gateway: finish your tasks, close TUI/Web and any neko serve using this data directory, then run neko tui or neko web.`);
17194
+ Latest: ${state?.latestVersion ?? "unknown"}`);
17195
+ const result = failed && state ? { ...state, checkState: "failed" } : checked ?? state;
17196
+ let body = versionOverview(result, installed, options);
17197
+ if (failed && !body.includes("Check failed"))
17198
+ body += `
17199
+ Check failed \xB7 Retry`;
17200
+ return new VersionDetail(body);
17139
17201
  });
17140
17202
  }
17141
17203
  var init_version_ui = __esm(() => {
@@ -18908,7 +18970,7 @@ var USAGE3 = `\u7528\u6CD5: neko <command> [options]
18908
18970
  \u547D\u4EE4:
18909
18971
  tui \u542F\u52A8\u7EC8\u7AEF\u4EA4\u4E92\u754C\u9762\uFF08\u81EA\u52A8\u62C9\u8D77 gateway\uFF09
18910
18972
  web \u542F\u52A8 Web UI \u9759\u6001\u6258\u7BA1\uFF08\u81EA\u52A8\u62C9\u8D77 gateway\uFF09
18911
- update \u5347\u7EA7\u5F53\u524D Bun \u5168\u5C40\u5B89\u88C5
18973
+ update \u5347\u7EA7\u5F53\u524D Bun \u5168\u5C40\u5B89\u88C5\uFF08Windows \u663E\u793A\u624B\u52A8\u5347\u7EA7\u547D\u4EE4\uFF09
18912
18974
  serve \u4EC5\u542F\u52A8 gateway\uFF08WebSocket\uFF1BPOSIX \u53E6\u6709 Unix socket\uFF09
18913
18975
 
18914
18976
  \u5404\u547D\u4EE4\u7684\u9009\u9879\u900F\u4F20\uFF0C\u8BE6\u89C1 neko <command> --help\u3002
@@ -18920,6 +18982,7 @@ switch (command2) {
18920
18982
  if (rest.length === 1 && (rest[0] === "--help" || rest[0] === "-h"))
18921
18983
  console.log(`\u7528\u6CD5: neko update
18922
18984
  \u5347\u7EA7\u5F53\u524D Bun \u5168\u5C40\u5B89\u88C5\uFF1B\u5B8C\u6210\u540E\u91CD\u65B0\u542F\u52A8 neko\u3002
18985
+ Windows\uFF1A\u5148\u9000\u51FA neko\uFF0C\u518D\u8FD0\u884C bun add --global neko-harness@latest\u3002
18923
18986
  -h, --help \u663E\u793A\u5E2E\u52A9`);
18924
18987
  else {
18925
18988
  console.error("\u7528\u6CD5: neko update");
package/package.json CHANGED
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "packageManager": "bun@1.4.2",
26
26
  "trustedDependencies": [],
27
- "version": "0.2.7",
27
+ "version": "0.2.8",
28
28
  "description": "A local AI coding assistant with terminal and web interfaces, powered by Pi and Bun.",
29
29
  "keywords": [
30
30
  "ai",