@celljs/ta-harness 4.13.1 → 4.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.
@@ -7,7 +7,7 @@ export interface BugReportEnvironment {
7
7
  node: string;
8
8
  }
9
9
  export declare namespace BugReport {
10
- const ISSUES_URL = "https://github.com/cellbang/cell/issues/new";
10
+ const ISSUES_URL = "https://github.com/cellbang/ta/issues/new";
11
11
  /** A new issue on GitHub, filled in with the description and the environment. */
12
12
  function issueUrl(description: string, environment: BugReportEnvironment): string;
13
13
  function currentEnvironment(version: string, model?: {
@@ -1,13 +1,26 @@
1
1
  import { spawn } from 'node:child_process';
2
+ /**
3
+ * Resolves a language tag to one of the four supported languages.
4
+ * Rules: zh with -tw/-hk/-mo/-hant suffix → zh-TW; other zh → zh-CN; ja → ja-JP; others → en-US.
5
+ */
6
+ function ofLanguage(tag) {
7
+ if (/^zh/i.test(tag)) {
8
+ return /(?:tw|hk|mo|hant)/i.test(tag) ? 'zh-TW' : 'zh-CN';
9
+ }
10
+ if (/^ja/i.test(tag)) {
11
+ return 'ja-JP';
12
+ }
13
+ return 'en-US';
14
+ }
2
15
  export var BugReport;
3
16
  (function (BugReport) {
4
- BugReport.ISSUES_URL = 'https://github.com/cellbang/cell/issues/new';
17
+ BugReport.ISSUES_URL = 'https://github.com/cellbang/ta/issues/new';
5
18
  /** A new issue on GitHub, filled in with the description and the environment. */
6
19
  function issueUrl(description, environment) {
7
20
  var _a;
8
21
  const url = new URL(BugReport.ISSUES_URL);
9
- url.searchParams.set('title', `[Ta] ${description.trim() || 'Describe the bug'}`);
10
- url.searchParams.set('labels', 'ta');
22
+ url.searchParams.set('title', description.trim() || 'Describe the bug');
23
+ url.searchParams.set('labels', 'bug');
11
24
  url.searchParams.set('body', [
12
25
  '## What happened',
13
26
  '',
@@ -36,9 +49,14 @@ export var BugReport;
36
49
  BugReport.open = open;
37
50
  /** What `/bug` says, in the language of Ta's pages (`TA_LANGUAGE`) or the computer's. */
38
51
  function notice(url, env = process.env) {
39
- return /^zh/i.test(env.TA_LANGUAGE || env.LC_ALL || env.LANG || '')
52
+ const language = ofLanguage(env.TA_LANGUAGE || env.LC_ALL || env.LANG || '');
53
+ return language === 'zh-CN'
40
54
  ? `一个新的 Ta 问题(只带版本、模型和平台信息)会在浏览器里打开。如果没有打开:\n${url}`
41
- : `A new issue for Ta, with its version, the model and the platform and nothing else, opens in the browser. If it did not:\n${url}`;
55
+ : language === 'zh-TW'
56
+ ? `一個新的 Ta 問題(只帶版本、模型和平台資訊)會在瀏覽器裡開啟。如果沒有開啟:\n${url}`
57
+ : language === 'ja-JP'
58
+ ? `Ta の新しい問題(バージョン、モデル、プラットフォーム情報のみ)がブラウザで開きます。開かない場合:\n${url}`
59
+ : `A new issue for Ta, with its version, the model and the platform and nothing else, opens in the browser. If it did not:\n${url}`;
42
60
  }
43
61
  BugReport.notice = notice;
44
62
  })(BugReport || (BugReport = {}));
@@ -10,7 +10,8 @@ import { TaBrand } from './ta-brand.js';
10
10
  import { TaPackages } from './ta-packages.js';
11
11
  const SERVE_HELP = `Usage: ta serve [--host <host>] [--port <port>] [--web] [--exec <url>]
12
12
 
13
- Serves the sessions of Ta over WebSocket to any number of clients, and its web client. Stops on SIGINT or SIGTERM.
13
+ Serves the sessions of Ta over WebSocket to any number of clients, and its web client. Stops on SIGINT
14
+ or SIGTERM.
14
15
 
15
16
  --host Address to listen on. Default: 127.0.0.1
16
17
  --port Port to listen on. Default: the port of the last start if it is free, so that a web app
@@ -41,7 +42,8 @@ Set TA_EXEC_TOKEN to choose the token hosts must present; otherwise a random one
41
42
  const RELAY_HELP = `Usage: ta relay [--host <host>] [--port <port>] [--data <dir>]
42
43
 
43
44
  Runs a relay, through which paired devices reach a ta serve from anywhere (ta pair). It only forwards:
44
- what goes through is encrypted end to end. Put it behind HTTPS. Stops on SIGINT or SIGTERM.
45
+ what goes through is encrypted end to end. It also serves the page of Ta under /w/, for those let into a
46
+ Ta from a browser by a link that invites. Put it behind HTTPS. Stops on SIGINT or SIGTERM.
45
47
 
46
48
  --host Address to listen on. Default: 127.0.0.1
47
49
  --port Port to listen on. Default: 8080
@@ -71,7 +73,7 @@ export var TaCli;
71
73
  return;
72
74
  }
73
75
  if (argv[0] === 'relay') {
74
- await relay(argv.slice(1));
76
+ await relay(argv.slice(1), join(dirname(options.serveEntry), '..', 'public'));
75
77
  return;
76
78
  }
77
79
  if (argv[0] === 'pair') {
@@ -152,7 +154,8 @@ export var TaCli;
152
154
  await import(/* @vite-ignore */ entry);
153
155
  }
154
156
  /** Without Cell, as the exec server. */
155
- async function relay(argv) {
157
+ /** `web`: the files of Ta's web page, which the relay serves for those let in from a browser. */
158
+ async function relay(argv, web) {
156
159
  const { values } = parseArgs({
157
160
  args: argv,
158
161
  options: { host: { type: 'string' }, port: { type: 'string' }, data: { type: 'string' }, help: { type: 'boolean', short: 'h' } },
@@ -167,6 +170,8 @@ export var TaCli;
167
170
  host: values.host,
168
171
  port: values.port ? Number(values.port) : 8080,
169
172
  data: values.data ? resolve(values.data) : undefined,
173
+ // Ta's web page of ta serve, for those let into a Ta from a browser (a link that invites, docs/design/ta-team.md 8.3).
174
+ web,
170
175
  });
171
176
  console.log(`ta relay: ${await server.listen()}`);
172
177
  const stop = () => void server.close().then(() => process.exit(0));
@@ -7,7 +7,7 @@ export interface BugReportEnvironment {
7
7
  node: string;
8
8
  }
9
9
  export declare namespace BugReport {
10
- const ISSUES_URL = "https://github.com/cellbang/cell/issues/new";
10
+ const ISSUES_URL = "https://github.com/cellbang/ta/issues/new";
11
11
  /** A new issue on GitHub, filled in with the description and the environment. */
12
12
  function issueUrl(description: string, environment: BugReportEnvironment): string;
13
13
  function currentEnvironment(version: string, model?: {
@@ -2,15 +2,28 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BugReport = void 0;
4
4
  const node_child_process_1 = require("node:child_process");
5
+ /**
6
+ * Resolves a language tag to one of the four supported languages.
7
+ * Rules: zh with -tw/-hk/-mo/-hant suffix → zh-TW; other zh → zh-CN; ja → ja-JP; others → en-US.
8
+ */
9
+ function ofLanguage(tag) {
10
+ if (/^zh/i.test(tag)) {
11
+ return /(?:tw|hk|mo|hant)/i.test(tag) ? 'zh-TW' : 'zh-CN';
12
+ }
13
+ if (/^ja/i.test(tag)) {
14
+ return 'ja-JP';
15
+ }
16
+ return 'en-US';
17
+ }
5
18
  var BugReport;
6
19
  (function (BugReport) {
7
- BugReport.ISSUES_URL = 'https://github.com/cellbang/cell/issues/new';
20
+ BugReport.ISSUES_URL = 'https://github.com/cellbang/ta/issues/new';
8
21
  /** A new issue on GitHub, filled in with the description and the environment. */
9
22
  function issueUrl(description, environment) {
10
23
  var _a;
11
24
  const url = new URL(BugReport.ISSUES_URL);
12
- url.searchParams.set('title', `[Ta] ${description.trim() || 'Describe the bug'}`);
13
- url.searchParams.set('labels', 'ta');
25
+ url.searchParams.set('title', description.trim() || 'Describe the bug');
26
+ url.searchParams.set('labels', 'bug');
14
27
  url.searchParams.set('body', [
15
28
  '## What happened',
16
29
  '',
@@ -39,9 +52,14 @@ var BugReport;
39
52
  BugReport.open = open;
40
53
  /** What `/bug` says, in the language of Ta's pages (`TA_LANGUAGE`) or the computer's. */
41
54
  function notice(url, env = process.env) {
42
- return /^zh/i.test(env.TA_LANGUAGE || env.LC_ALL || env.LANG || '')
55
+ const language = ofLanguage(env.TA_LANGUAGE || env.LC_ALL || env.LANG || '');
56
+ return language === 'zh-CN'
43
57
  ? `一个新的 Ta 问题(只带版本、模型和平台信息)会在浏览器里打开。如果没有打开:\n${url}`
44
- : `A new issue for Ta, with its version, the model and the platform and nothing else, opens in the browser. If it did not:\n${url}`;
58
+ : language === 'zh-TW'
59
+ ? `一個新的 Ta 問題(只帶版本、模型和平台資訊)會在瀏覽器裡開啟。如果沒有開啟:\n${url}`
60
+ : language === 'ja-JP'
61
+ ? `Ta の新しい問題(バージョン、モデル、プラットフォーム情報のみ)がブラウザで開きます。開かない場合:\n${url}`
62
+ : `A new issue for Ta, with its version, the model and the platform and nothing else, opens in the browser. If it did not:\n${url}`;
45
63
  }
46
64
  BugReport.notice = notice;
47
65
  })(BugReport || (exports.BugReport = BugReport = {}));
@@ -13,7 +13,8 @@ const ta_brand_1 = require("./ta-brand");
13
13
  const ta_packages_1 = require("./ta-packages");
14
14
  const SERVE_HELP = `Usage: ta serve [--host <host>] [--port <port>] [--web] [--exec <url>]
15
15
 
16
- Serves the sessions of Ta over WebSocket to any number of clients, and its web client. Stops on SIGINT or SIGTERM.
16
+ Serves the sessions of Ta over WebSocket to any number of clients, and its web client. Stops on SIGINT
17
+ or SIGTERM.
17
18
 
18
19
  --host Address to listen on. Default: 127.0.0.1
19
20
  --port Port to listen on. Default: the port of the last start if it is free, so that a web app
@@ -44,7 +45,8 @@ Set TA_EXEC_TOKEN to choose the token hosts must present; otherwise a random one
44
45
  const RELAY_HELP = `Usage: ta relay [--host <host>] [--port <port>] [--data <dir>]
45
46
 
46
47
  Runs a relay, through which paired devices reach a ta serve from anywhere (ta pair). It only forwards:
47
- what goes through is encrypted end to end. Put it behind HTTPS. Stops on SIGINT or SIGTERM.
48
+ what goes through is encrypted end to end. It also serves the page of Ta under /w/, for those let into a
49
+ Ta from a browser by a link that invites. Put it behind HTTPS. Stops on SIGINT or SIGTERM.
48
50
 
49
51
  --host Address to listen on. Default: 127.0.0.1
50
52
  --port Port to listen on. Default: 8080
@@ -74,7 +76,7 @@ var TaCli;
74
76
  return;
75
77
  }
76
78
  if (argv[0] === 'relay') {
77
- await relay(argv.slice(1));
79
+ await relay(argv.slice(1), (0, node_path_1.join)((0, node_path_1.dirname)(options.serveEntry), '..', 'public'));
78
80
  return;
79
81
  }
80
82
  if (argv[0] === 'pair') {
@@ -155,7 +157,8 @@ var TaCli;
155
157
  await import(/* @vite-ignore */ entry);
156
158
  }
157
159
  /** Without Cell, as the exec server. */
158
- async function relay(argv) {
160
+ /** `web`: the files of Ta's web page, which the relay serves for those let in from a browser. */
161
+ async function relay(argv, web) {
159
162
  const { values } = (0, node_util_1.parseArgs)({
160
163
  args: argv,
161
164
  options: { host: { type: 'string' }, port: { type: 'string' }, data: { type: 'string' }, help: { type: 'boolean', short: 'h' } },
@@ -170,6 +173,8 @@ var TaCli;
170
173
  host: values.host,
171
174
  port: values.port ? Number(values.port) : 8080,
172
175
  data: values.data ? resolve(values.data) : undefined,
176
+ // Ta's web page of ta serve, for those let into a Ta from a browser (a link that invites, docs/design/ta-team.md 8.3).
177
+ web,
173
178
  });
174
179
  console.log(`ta relay: ${await server.listen()}`);
175
180
  const stop = () => void server.close().then(() => process.exit(0));
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@celljs/ta-harness",
3
- "version": "4.13.1",
3
+ "version": "4.15.0",
4
4
  "description": "The agent runtime of Ta on pi: branding, session locks and execution environment adapters",
5
- "homepage": "https://github.com/cellbang/cell",
5
+ "homepage": "https://github.com/cellbang/ta",
6
6
  "bugs": {
7
- "url": "https://github.com/cellbang/cell/issues"
7
+ "url": "https://github.com/cellbang/ta/issues"
8
8
  },
9
9
  "repository": {
10
10
  "type": "git",
@@ -29,9 +29,9 @@
29
29
  "watch": "tsc -b -w --preserveWatchOutput"
30
30
  },
31
31
  "dependencies": {
32
- "@celljs/ai-coding-agent": "4.13.1",
33
- "@celljs/ta-exec": "4.13.1",
34
- "@celljs/ta-relay": "4.13.1",
32
+ "@celljs/ai-coding-agent": "4.15.0",
33
+ "@celljs/ta-exec": "4.15.0",
34
+ "@celljs/ta-relay": "4.15.0",
35
35
  "@earendil-works/pi-coding-agent": "^1.5.2",
36
36
  "@earendil-works/pi-mcp": "^1.5.2"
37
37
  },