@tenonai/yew 1.4.0 → 1.5.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +21 -5
  2. package/README.md +9 -9
  3. package/dist/cli/app.js +22 -12
  4. package/dist/cli/export.js +5 -5
  5. package/dist/cli/mcp.js +7 -7
  6. package/dist/cli/remote.js +6 -6
  7. package/dist/cli/run.js +3 -3
  8. package/dist/cli/schedule.js +3 -3
  9. package/dist/cli/send.js +4 -4
  10. package/dist/cli/serve.js +13 -11
  11. package/dist/cli/service.js +13 -13
  12. package/dist/server/agent/runner.js +1 -1
  13. package/dist/server/data-usage.js +1 -1
  14. package/dist/server/db/database.js +1 -1
  15. package/dist/server/export.js +2 -2
  16. package/dist/server/folder-picker.js +1 -1
  17. package/dist/server/http/app.js +3 -3
  18. package/dist/server/http/data.js +1 -1
  19. package/dist/server/http/mcp.js +2 -2
  20. package/dist/server/http/problem.js +1 -1
  21. package/dist/server/http/security.js +5 -5
  22. package/dist/server/mail/post.js +2 -2
  23. package/dist/server/mcp-builtin.js +1 -1
  24. package/dist/server/mcp-config.js +4 -4
  25. package/dist/server/mcp-oauth.js +6 -6
  26. package/dist/server/store.js +2 -2
  27. package/dist/shared/version.js +2 -0
  28. package/package.json +2 -2
  29. package/web/dist/THIRD-PARTY-NOTICES.txt +1 -1
  30. package/web/dist/assets/{index-C5qBMzFX.js → index-B_NesKxw.js} +18 -18
  31. package/web/dist/assets/index-BqTqnE18.css +1 -0
  32. package/web/dist/index.html +3 -3
  33. package/web/dist/mascot/alarm.webp +0 -0
  34. package/web/dist/mascot/books.webp +0 -0
  35. package/web/dist/mascot/bow.webp +0 -0
  36. package/web/dist/mascot/branch.webp +0 -0
  37. package/web/dist/mascot/clipboard.webp +0 -0
  38. package/web/dist/mascot/dozing.webp +0 -0
  39. package/web/dist/mascot/fired-up.webp +0 -0
  40. package/web/dist/mascot/giftbox.webp +0 -0
  41. package/web/dist/mascot/halt.webp +0 -0
  42. package/web/dist/mascot/jump.webp +0 -0
  43. package/web/dist/mascot/letter-run.webp +0 -0
  44. package/web/dist/mascot/magnifier.webp +0 -0
  45. package/web/dist/mascot/mini.webp +0 -0
  46. package/web/dist/mascot/nap.webp +0 -0
  47. package/web/dist/mascot/pajamas.webp +0 -0
  48. package/web/dist/mascot/paper-plane.webp +0 -0
  49. package/web/dist/mascot/peek.webp +0 -0
  50. package/web/dist/mascot/phone.webp +0 -0
  51. package/web/dist/mascot/pointing.webp +0 -0
  52. package/web/dist/mascot/portrait.webp +0 -0
  53. package/web/dist/mascot/pout.webp +0 -0
  54. package/web/dist/mascot/proud.webp +0 -0
  55. package/web/dist/mascot/reading.webp +0 -0
  56. package/web/dist/mascot/stamp.webp +0 -0
  57. package/web/dist/mascot/stretch.webp +0 -0
  58. package/web/dist/mascot/surprised.webp +0 -0
  59. package/web/dist/mascot/tea.webp +0 -0
  60. package/web/dist/mascot/teary.webp +0 -0
  61. package/web/dist/mascot/typing.webp +0 -0
  62. package/dist/server/from-jig.js +0 -98
  63. package/web/dist/assets/index-B9oWPSod.css +0 -1
@@ -33,7 +33,7 @@ export function localOnly(port) {
33
33
  return next();
34
34
  const host = c.req.header("Host") ?? "";
35
35
  if (!hosts.has(host)) {
36
- return problemResponse(c, 421, "wrong-host", titleFor(421), "Yew only answers on 127.0.0.1 and localhost.");
36
+ return problemResponse(c, 421, "wrong-host", titleFor(421), "Yew Harness only answers on 127.0.0.1 and localhost.");
37
37
  }
38
38
  for (const header of [
39
39
  "Forwarded",
@@ -52,12 +52,12 @@ export function localOnly(port) {
52
52
  }
53
53
  const dest = c.req.header("Sec-Fetch-Dest");
54
54
  if (dest === "iframe" || dest === "frame" || dest === "embed" || dest === "object") {
55
- return problemResponse(c, 403, "embedded", titleFor(403), "Yew cannot be embedded.");
55
+ return problemResponse(c, 403, "embedded", titleFor(403), "Yew Harness cannot be embedded.");
56
56
  }
57
57
  if (c.req.method !== "GET" && c.req.method !== "HEAD") {
58
58
  const origin = c.req.header("Origin");
59
59
  if (origin !== `http://${host}`) {
60
- return problemResponse(c, 403, "bad-origin", titleFor(403), "This request did not come from Yew's own page.");
60
+ return problemResponse(c, 403, "bad-origin", titleFor(403), "This request did not come from Yew Harness's own page.");
61
61
  }
62
62
  }
63
63
  }
@@ -96,7 +96,7 @@ export function requireBrowser(store, port) {
96
96
  return next();
97
97
  const token = getCookie(c, cookieName(port));
98
98
  if (!token || !store.touchBrowserToken(hashToken(token), Date.now() + BROWSER_TTL_MS)) {
99
- return problemResponse(c, 401, "sign-in-required", titleFor(401), "Open Yew with the link from `yew serve` or `yew open`.");
99
+ return problemResponse(c, 401, "sign-in-required", titleFor(401), "Open Yew Harness with the link from `yew serve` or `yew open`.");
100
100
  }
101
101
  await next();
102
102
  };
@@ -161,7 +161,7 @@ export function deviceLimits() {
161
161
  // Artifacts are looked at on the phone and managed on the Mac.
162
162
  (path.startsWith("/api/artifacts/") && write) ||
163
163
  path.startsWith("/api/auth/")) {
164
- return problemResponse(c, 403, "mac-only", titleFor(403), "Only Yew on the Mac can do this: API keys, devices and remote access stay there.");
164
+ return problemResponse(c, 403, "mac-only", titleFor(403), "Only Yew Harness on the Mac can do this: API keys, devices and remote access stay there.");
165
165
  }
166
166
  await next();
167
167
  };
@@ -473,7 +473,7 @@ export class PostOffice {
473
473
  `Chosen: ${chosen ?? "(note only)"}`,
474
474
  ...(card.note ? [`Note: ${oneLine(card.note)}`] : []),
475
475
  ...(requester ? [`Requested by: ${requester}`] : []),
476
- "Decided by the person in Yew",
476
+ "Decided by the person in Yew Harness",
477
477
  ]
478
478
  : [
479
479
  stamp,
@@ -482,7 +482,7 @@ export class PostOffice {
482
482
  `选择:${chosen ?? "(只写了备注)"}`,
483
483
  ...(card.note ? [`备注:${oneLine(card.note)}`] : []),
484
484
  ...(requester ? [`提出:${requester}`] : []),
485
- "本人在 Yew 里决定",
485
+ "本人在 Yew Harness 里决定",
486
486
  ];
487
487
  try {
488
488
  const header = existsSync(path) ? "" : english ? "# Approval log\n\n" : "# 审批记录\n\n";
@@ -125,7 +125,7 @@ function lockedInstaller(options, source, folder, what) {
125
125
  }
126
126
  /** Makes sure Yew's own two servers are installed as the lock file that ships with this Yew says. */
127
127
  export function builtinInstaller(options) {
128
- return lockedInstaller(options, options.source ?? SOURCE, installDir(options.yewHome), "Yew's own servers (browser, computer control)");
128
+ return lockedInstaller(options, options.source ?? SOURCE, installDir(options.yewHome), "Yew Harness's own servers (browser, computer control)");
129
129
  }
130
130
  /**
131
131
  * What the hub calls before it starts a server Yew runs from its data folder: installs Yew's own
@@ -34,7 +34,7 @@ function readFile(yewHome) {
34
34
  }
35
35
  if (!isObject(doc)) {
36
36
  // Not overwritten: the person may have servers in it that a typo is hiding.
37
- throw conflict("mcp.json in Yew's data folder is not valid JSON. Correct it by hand first.", undefined, "mcp-unreadable");
37
+ throw conflict("mcp.json in Yew Harness's data folder is not valid JSON. Correct it by hand first.", undefined, "mcp-unreadable");
38
38
  }
39
39
  const key = doc.mcpServers === undefined && doc.servers !== undefined ? "servers" : "mcpServers";
40
40
  if (doc[key] !== undefined && !isObject(doc[key])) {
@@ -192,7 +192,7 @@ export function addMcpEntry(yewHome, input) {
192
192
  let entry;
193
193
  if (preset) {
194
194
  if (!presetPackage(preset))
195
- throw invalid(`Yew has no preset named ${preset}.`, "preset");
195
+ throw invalid(`Yew Harness has no preset named ${preset}.`, "preset");
196
196
  const env = input.env ?? {};
197
197
  checkValues(env, ENV_NAME, "env");
198
198
  entry = { preset, ...(Object.keys(env).length > 0 ? { env } : {}) };
@@ -248,7 +248,7 @@ export function patchMcpEntry(yewHome, name, patch, builtin = {}) {
248
248
  if (builtin[name] && (!Object.hasOwn(servers, name) || turnsOff(servers[name]))) {
249
249
  // One of Yew's own: the file only records that it is off.
250
250
  if (patch.env || patch.headers) {
251
- throw invalid("A server Yew sets up by itself has no variables to set.", "env");
251
+ throw invalid("A server Yew Harness sets up by itself has no variables to set.", "env");
252
252
  }
253
253
  if (patch.disabled === true)
254
254
  servers[name] = { disabled: true };
@@ -297,7 +297,7 @@ export function patchMcpEntry(yewHome, name, patch, builtin = {}) {
297
297
  export function removeMcpEntry(yewHome, name, builtin = {}) {
298
298
  const { doc, servers } = readFile(yewHome);
299
299
  if (builtin[name] && (!Object.hasOwn(servers, name) || turnsOff(servers[name]))) {
300
- throw conflict(`${name} is set up by Yew itself. It can be turned off, not removed.`, undefined, "mcp-builtin");
300
+ throw conflict(`${name} is set up by Yew Harness itself. It can be turned off, not removed.`, undefined, "mcp-builtin");
301
301
  }
302
302
  entryOf(servers, name);
303
303
  delete servers[name];
@@ -220,13 +220,13 @@ export class McpAuth {
220
220
  const pending = this.#pending.get(state);
221
221
  this.#pending.delete(state);
222
222
  if (!pending || this.#now() - pending.createdAt > PENDING_MS) {
223
- throw new Error("This sign-in is not valid any more. Start it again from Yew.");
223
+ throw new Error("This sign-in is not valid any more. Start it again from Yew Harness.");
224
224
  }
225
225
  const { saved } = pending;
226
226
  // RFC 9207: a return that names a sign-in server, or that should and does not, comes from the
227
227
  // one the browser was sent to, or it is not used.
228
228
  if (iss !== null ? !same(iss, saved.endpoints.issuer) : saved.endpoints.namesItself) {
229
- throw new Error("The sign-in came back from another server than the one Yew sent you to.");
229
+ throw new Error("The sign-in came back from another server than the one Yew Harness sent you to.");
230
230
  }
231
231
  if (error || !code)
232
232
  throw new Error(`The sign-in was not completed (${error ?? "no code"}).`);
@@ -242,7 +242,7 @@ export class McpAuth {
242
242
  body.set("client_secret", saved.client.secret);
243
243
  const answer = await this.#post(saved.endpoints.token, body);
244
244
  if (!answer || typeof answer.access_token !== "string") {
245
- throw new Error("The server did not give Yew a token.");
245
+ throw new Error("The server did not give Yew Harness a token.");
246
246
  }
247
247
  await this.#save(pending.server, { ...saved, tokens: tokensFrom(answer, this.#now()) });
248
248
  return pending.server;
@@ -337,7 +337,7 @@ export class McpAuth {
337
337
  const at = new URL(resource);
338
338
  const local = at.protocol === "http:" && LOOPBACK.has(at.hostname);
339
339
  if (!usable(resource, local)) {
340
- throw new Error("Yew signs in only to servers at https addresses.");
340
+ throw new Error("Yew Harness signs in only to servers at https addresses.");
341
341
  }
342
342
  const named = param(challenge, "resource_metadata");
343
343
  if (named !== null && !usable(named, local)) {
@@ -428,7 +428,7 @@ export class McpAuth {
428
428
  throw new Error("This server only accepts clients registered in advance. Add its client ID and secret to its entry in mcp.json.");
429
429
  }
430
430
  const answer = await this.#post(endpoints.registration, JSON.stringify({
431
- client_name: "Yew",
431
+ client_name: "Yew Harness",
432
432
  redirect_uris: [this.#redirect],
433
433
  grant_types: ["authorization_code", "refresh_token"],
434
434
  response_types: ["code"],
@@ -436,7 +436,7 @@ export class McpAuth {
436
436
  software_version: this.#version,
437
437
  }));
438
438
  if (!answer || typeof answer.client_id !== "string") {
439
- throw new Error("The server did not let Yew register to sign in.");
439
+ throw new Error("The server did not let Yew Harness register to sign in.");
440
440
  }
441
441
  return {
442
442
  id: answer.client_id,
@@ -1052,12 +1052,12 @@ export class Store {
1052
1052
  for (const approval of pending)
1053
1053
  this.cancelApproval(approval.id);
1054
1054
  for (const session of affected) {
1055
- this.#q("UPDATE sessions SET status = 'needs_review', status_detail = ?, updated_at = ? WHERE id = ?").run("Yew restarted while this session was working.", now, session.id);
1055
+ this.#q("UPDATE sessions SET status = 'needs_review', status_detail = ?, updated_at = ? WHERE id = ?").run("Yew Harness restarted while this session was working.", now, session.id);
1056
1056
  this.appendEntry(session.id, {
1057
1057
  role: "notice",
1058
1058
  notice: {
1059
1059
  kind: "restarted",
1060
- text: "Yew restarted while this session was working.",
1060
+ text: "Yew Harness restarted while this session was working.",
1061
1061
  timestamp: now,
1062
1062
  },
1063
1063
  });
@@ -3,6 +3,8 @@ import { readFileSync } from "node:fs";
3
3
  // do: two folders up from this file, in both layouts.
4
4
  const pkg = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8"));
5
5
  export const NAME = "yew";
6
+ /** The product's name where people read it (blueprint, section 12); `NAME` is the command's. */
7
+ export const PRODUCT = "Yew Harness";
6
8
  export const VERSION = pkg.version;
7
9
  export const PUBLISHER = "Tenon AI";
8
10
  export const WEBSITE = "https://tenonai.cn/";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenonai/yew",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "An AI-native multi-agent workbench",
5
5
  "keywords": [
6
6
  "agent",
@@ -44,7 +44,7 @@
44
44
  "build:web": "vite build --config web/vite.config.ts",
45
45
  "watch:web": "vite build --config web/vite.config.ts --watch",
46
46
  "relay:publish": "bash deploy/relay/publish.sh",
47
- "build": "tsc -p tsconfig.build.json && npm run build:web && node scripts/notices.mjs",
47
+ "build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.build.json && npm run build:web && node scripts/notices.mjs",
48
48
  "prepack": "npm run build"
49
49
  },
50
50
  "devDependencies": {
@@ -1,4 +1,4 @@
1
- Yew's web interface is built from these packages. Each stays under its own license.
1
+ Yew Harness's web interface is built from these packages. Each stays under its own license.
2
2
 
3
3
  ========================================================================
4
4
  @ungap/structured-clone 1.4.0 (ISC)