@tenonai/yew 1.5.0 → 1.6.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.
- package/CHANGELOG.md +27 -0
- package/README.md +23 -5
- package/THIRD-PARTY-NOTICES.md +6 -1
- package/dist/cli/serve.js +75 -3
- package/dist/server/agent/prompt.js +3 -2
- package/dist/server/agent/runner.js +40 -0
- package/dist/server/http/api.js +17 -1
- package/dist/server/http/app.js +10 -2
- package/dist/server/mail/envelope.js +11 -6
- package/dist/server/mcp-builtin.js +14 -1
- package/dist/server/mcp.js +70 -8
- package/dist/server/permissions/engine.js +23 -5
- package/dist/server/sandbox.js +447 -0
- package/dist/server/settings.js +34 -1
- package/dist/server/tools/jobs.js +3 -2
- package/dist/server/tools/mail.js +11 -1
- package/dist/server/tools/process.js +63 -12
- package/dist/server/tools/search.js +5 -2
- package/dist/server/tools/shell.js +70 -17
- package/dist/shared/policy.js +20 -20
- package/dist/shared/version.js +6 -0
- package/dist/sim/client.d.ts +17 -0
- package/dist/sim/client.js +41 -0
- package/dist/sim/index.d.ts +7 -0
- package/dist/sim/index.js +6 -0
- package/dist/sim/types.d.ts +161 -0
- package/dist/sim/types.js +5 -0
- package/dist/sim/world.d.ts +6 -0
- package/dist/sim/world.js +359 -0
- package/package.json +17 -3
- package/web/dist/assets/index-BQdFuM-f.css +1 -0
- package/web/dist/assets/index-Dh9QdEsc.js +70 -0
- package/web/dist/icons/apple-touch-icon.png +0 -0
- package/web/dist/index.html +2 -2
- package/web/dist/mascot/on-duty.webp +0 -0
- package/web/dist/mascot/permission.webp +0 -0
- package/web/dist/assets/index-B_NesKxw.js +0 -68
- package/web/dist/assets/index-BqTqnE18.css +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
-
import { appendFileSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { appendFileSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { newId } from "../ids.js";
|
|
5
|
+
import { activeSandbox, OUTSIDE_GIT, quote, sandboxed } from "../sandbox.js";
|
|
5
6
|
export const MAX_LINES = 2000;
|
|
6
7
|
export const MAX_BYTES = 50 * 1024;
|
|
7
8
|
/**
|
|
@@ -64,7 +65,8 @@ const KEY_VARIABLES = /^(ANTHROPIC|OPENAI|DEEPSEEK|GEMINI|GOOGLE|GROQ|MISTRAL|MO
|
|
|
64
65
|
export function commandEnvironment(sessionId) {
|
|
65
66
|
const env = {};
|
|
66
67
|
for (const [name, value] of Object.entries(process.env)) {
|
|
67
|
-
|
|
68
|
+
// Keys stay out, and so do an evaluation's switches (docs/sim.md, section 3).
|
|
69
|
+
if (!KEY_VARIABLES.test(name) && !name.startsWith("YEW_SIM"))
|
|
68
70
|
env[name] = value;
|
|
69
71
|
}
|
|
70
72
|
return {
|
|
@@ -76,19 +78,60 @@ export function commandEnvironment(sessionId) {
|
|
|
76
78
|
GIT_TERMINAL_PROMPT: "0",
|
|
77
79
|
};
|
|
78
80
|
}
|
|
81
|
+
/** Shells tried in order when SHELL is not set, or names a program that is not there. */
|
|
82
|
+
const SHELLS = ["/bin/zsh", "/usr/bin/zsh", "/bin/bash", "/usr/bin/bash", "/bin/sh"];
|
|
83
|
+
/**
|
|
84
|
+
* The shell commands run in: the person's SHELL when it is there; otherwise zsh, then bash, then sh,
|
|
85
|
+
* whichever this computer has. A service started at login or in a container often has no SHELL,
|
|
86
|
+
* and Linux often has no zsh.
|
|
87
|
+
*/
|
|
88
|
+
export function loginShell(env = process.env, exists = existsSync) {
|
|
89
|
+
if (env.SHELL && exists(env.SHELL))
|
|
90
|
+
return env.SHELL;
|
|
91
|
+
return SHELLS.find((shell) => exists(shell)) ?? "/bin/sh";
|
|
92
|
+
}
|
|
79
93
|
/**
|
|
80
94
|
* Runs a command with the user's login shell in its own process group, so stopping it ends every
|
|
81
|
-
* process it started.
|
|
82
|
-
*
|
|
95
|
+
* process it started. When the system sandbox is on (sandbox.ts) the command runs in it, able to
|
|
96
|
+
* write in its working folder, unless the person approved `outsideSandbox` for this one command;
|
|
97
|
+
* `ask` puts a site it wants to reach to the person. Stopping freezes the group first, so `a; b`
|
|
98
|
+
* cannot slip into `b` while it is being ended (pi's approach on macOS, prior-art 4.2), then sends
|
|
99
|
+
* SIGTERM and, 3 seconds later, SIGKILL.
|
|
83
100
|
*/
|
|
84
|
-
export function startCommand(options) {
|
|
85
|
-
const shell =
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
101
|
+
export async function startCommand(options) {
|
|
102
|
+
const shell = loginShell();
|
|
103
|
+
const env = commandEnvironment(options.sessionId);
|
|
104
|
+
const outside = options.outsideSandbox === true && activeSandbox() !== "none";
|
|
105
|
+
const box = outside
|
|
106
|
+
? null
|
|
107
|
+
: await sandboxed(`exec ${quote(shell)} -lc ${quote(options.command)}`, {
|
|
108
|
+
grant: { writable: [options.cwd] },
|
|
109
|
+
text: options.command,
|
|
110
|
+
label: {
|
|
111
|
+
kind: options.background ? "job" : "command",
|
|
112
|
+
text: options.command.slice(0, 300),
|
|
113
|
+
},
|
|
114
|
+
...(options.ask ? { ask: options.ask } : {}),
|
|
115
|
+
});
|
|
116
|
+
if (box) {
|
|
117
|
+
for (const name of box.unset)
|
|
118
|
+
delete env[name];
|
|
119
|
+
Object.assign(env, box.env);
|
|
120
|
+
}
|
|
121
|
+
const child = box
|
|
122
|
+
? spawn(box.line, {
|
|
123
|
+
shell: true,
|
|
124
|
+
cwd: options.cwd,
|
|
125
|
+
env,
|
|
126
|
+
detached: true,
|
|
127
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
128
|
+
})
|
|
129
|
+
: spawn(shell, ["-lc", options.command], {
|
|
130
|
+
cwd: options.cwd,
|
|
131
|
+
env: outside ? { ...env, ...OUTSIDE_GIT } : env,
|
|
132
|
+
detached: true,
|
|
133
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
134
|
+
});
|
|
92
135
|
const output = new OutputTail(options.logDir);
|
|
93
136
|
const onData = (data) => {
|
|
94
137
|
const chunk = data.toString("utf8");
|
|
@@ -103,6 +146,14 @@ export function startCommand(options) {
|
|
|
103
146
|
resolve({ exitCode: null, signal: null });
|
|
104
147
|
});
|
|
105
148
|
child.on("close", (exitCode, signal) => resolve({ exitCode, signal }));
|
|
149
|
+
}).then((result) => {
|
|
150
|
+
// When a command failed, what the sandbox kept from it goes after the output, so the session
|
|
151
|
+
// sees why.
|
|
152
|
+
const blocked = box?.finish() ?? [];
|
|
153
|
+
if (blocked.length > 0 && result.exitCode !== 0) {
|
|
154
|
+
output.push(`\n[Blocked by the sandbox: ${blocked.length} time(s). If the command needs this, run it again with outside_sandbox.]\n${blocked.slice(0, 10).join("\n")}\n`);
|
|
155
|
+
}
|
|
156
|
+
return result;
|
|
106
157
|
});
|
|
107
158
|
let stopping = false;
|
|
108
159
|
const stop = () => {
|
|
@@ -68,7 +68,7 @@ export const globTool = {
|
|
|
68
68
|
return errorResult(result.stderr.trim() || "The search failed.");
|
|
69
69
|
const files = result.stdout
|
|
70
70
|
.split("\n")
|
|
71
|
-
.filter(
|
|
71
|
+
.filter((file) => file && !ctx.offLimits?.(file))
|
|
72
72
|
.map((file) => display(file, ctx.session));
|
|
73
73
|
if (files.length === 0)
|
|
74
74
|
return { content: [text("No files matched.")] };
|
|
@@ -146,6 +146,10 @@ export const grepTool = {
|
|
|
146
146
|
}
|
|
147
147
|
if (event.type !== "match" && event.type !== "context")
|
|
148
148
|
continue;
|
|
149
|
+
const file = event.data.path?.text ?? "";
|
|
150
|
+
// What sessions may not read stays out, though the search reached it.
|
|
151
|
+
if (ctx.offLimits?.(file))
|
|
152
|
+
continue;
|
|
149
153
|
if (event.type === "match") {
|
|
150
154
|
if (matches >= MAX_MATCHES) {
|
|
151
155
|
matches++;
|
|
@@ -153,7 +157,6 @@ export const grepTool = {
|
|
|
153
157
|
}
|
|
154
158
|
matches++;
|
|
155
159
|
}
|
|
156
|
-
const file = event.data.path?.text ?? "";
|
|
157
160
|
if (file !== lastFile) {
|
|
158
161
|
if (lines.length > 0)
|
|
159
162
|
lines.push("");
|
|
@@ -1,30 +1,52 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
+
import { activeSandbox } from "../sandbox.js";
|
|
2
3
|
import { startCommand } from "./process.js";
|
|
3
4
|
import { bool, CONFIRM_ARGUMENT, errorResult, int, str, text, } from "./types.js";
|
|
4
5
|
const DEFAULT_TIMEOUT = 120;
|
|
5
6
|
const MAX_TIMEOUT = 600;
|
|
7
|
+
const DESCRIPTION = "Run a command with the user's login shell in the working folder. Standard input is closed, so commands must not wait for input. Output keeps the last 2000 lines or 50 KB; longer output is saved to a file named in the result. Times out after 120 seconds by default (timeout_seconds, up to 600). Set background to start a long-running command, such as a dev server, and check on it with shell_job.";
|
|
8
|
+
const PARAMETERS = {
|
|
9
|
+
command: { type: "string", description: "The command line to run." },
|
|
10
|
+
description: {
|
|
11
|
+
type: "string",
|
|
12
|
+
description: "What the command is for, in a few words in the language the person writes in. Yew shows it to the person when it asks for their permission.",
|
|
13
|
+
},
|
|
14
|
+
timeout_seconds: { type: "integer", minimum: 1, maximum: MAX_TIMEOUT },
|
|
15
|
+
background: { type: "boolean", description: "Start the command and return at once." },
|
|
16
|
+
};
|
|
17
|
+
/** Offered while the system sandbox is on (sandbox.ts). */
|
|
18
|
+
const OUTSIDE_SANDBOX = {
|
|
19
|
+
type: "boolean",
|
|
20
|
+
description: "Run it outside the sandbox, when it cannot work inside: it needs saved credentials (a git push), to create or clone a repository, to listen on a local port (a dev server), or to write outside the working folder. The person is asked every time.",
|
|
21
|
+
};
|
|
6
22
|
export const shellTool = {
|
|
7
23
|
name: "shell",
|
|
8
|
-
description
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
24
|
+
get description() {
|
|
25
|
+
return activeSandbox() === "none"
|
|
26
|
+
? DESCRIPTION
|
|
27
|
+
: `${DESCRIPTION} Commands run in a sandbox: they write only in the working folder and temporary folders, and reach package registries and code hosts; connecting to another site asks the person.`;
|
|
28
|
+
},
|
|
29
|
+
get parameters() {
|
|
30
|
+
return {
|
|
31
|
+
type: "object",
|
|
32
|
+
properties: {
|
|
33
|
+
...PARAMETERS,
|
|
34
|
+
...(activeSandbox() === "none" ? {} : { outside_sandbox: OUTSIDE_SANDBOX }),
|
|
35
|
+
confirm: CONFIRM_ARGUMENT,
|
|
16
36
|
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
required: ["command"],
|
|
22
|
-
additionalProperties: false,
|
|
37
|
+
required: ["command"],
|
|
38
|
+
additionalProperties: false,
|
|
39
|
+
};
|
|
23
40
|
},
|
|
24
41
|
readOnly: false,
|
|
25
42
|
needsFolder: true,
|
|
26
43
|
subject(args) {
|
|
27
|
-
return {
|
|
44
|
+
return {
|
|
45
|
+
kind: "command",
|
|
46
|
+
tool: "shell",
|
|
47
|
+
command: str(args, "command", true),
|
|
48
|
+
...(outsideSandbox(args) ? { outsideSandbox: true } : {}),
|
|
49
|
+
};
|
|
28
50
|
},
|
|
29
51
|
preview(args) {
|
|
30
52
|
const description = typeof args.description === "string" ? args.description.trim() : "";
|
|
@@ -32,13 +54,20 @@ export const shellTool = {
|
|
|
32
54
|
},
|
|
33
55
|
async run(args, ctx) {
|
|
34
56
|
const command = str(args, "command", true);
|
|
57
|
+
const outside = outsideSandbox(args);
|
|
35
58
|
const timeout = int(args, "timeout_seconds", 1, MAX_TIMEOUT) ?? DEFAULT_TIMEOUT;
|
|
36
59
|
const cwd = ctx.session.cwd;
|
|
37
60
|
if (!cwd)
|
|
38
61
|
return errorResult("This session has no working folder.");
|
|
39
62
|
const logDir = join(ctx.tmpDir, "output");
|
|
40
63
|
if (bool(args, "background")) {
|
|
41
|
-
const job = ctx.jobs.start({
|
|
64
|
+
const job = await ctx.jobs.start({
|
|
65
|
+
command,
|
|
66
|
+
cwd,
|
|
67
|
+
sessionId: ctx.session.id,
|
|
68
|
+
logDir,
|
|
69
|
+
outsideSandbox: outside,
|
|
70
|
+
});
|
|
42
71
|
return {
|
|
43
72
|
content: [
|
|
44
73
|
text(`Started in the background as ${job.id}. Use shell_job to read its output or stop it; Yew will tell you when it ends.`),
|
|
@@ -47,12 +76,31 @@ export const shellTool = {
|
|
|
47
76
|
};
|
|
48
77
|
}
|
|
49
78
|
const started = Date.now();
|
|
50
|
-
const
|
|
79
|
+
const permit = ctx.permit;
|
|
80
|
+
// A question still open when the command has ended is withdrawn.
|
|
81
|
+
const asking = new AbortController();
|
|
82
|
+
const running = await startCommand({
|
|
51
83
|
command,
|
|
52
84
|
cwd,
|
|
53
85
|
sessionId: ctx.session.id,
|
|
54
86
|
logDir,
|
|
55
87
|
onOutput: ctx.output,
|
|
88
|
+
outsideSandbox: outside,
|
|
89
|
+
// A site outside the sandbox's list is put to the person on this call's card.
|
|
90
|
+
...(permit
|
|
91
|
+
? {
|
|
92
|
+
ask: (question) => permit({
|
|
93
|
+
tool: "shell",
|
|
94
|
+
summary: question.port === undefined
|
|
95
|
+
? question.host
|
|
96
|
+
: `${question.host}:${question.port}`,
|
|
97
|
+
mustConfirm: false,
|
|
98
|
+
reasons: [question.unsure ? "connect-site-unsure" : "connect-site"],
|
|
99
|
+
description: command.slice(0, 300),
|
|
100
|
+
...(question.unsure ? { running: question.unsure } : {}),
|
|
101
|
+
}, asking.signal),
|
|
102
|
+
}
|
|
103
|
+
: {}),
|
|
56
104
|
});
|
|
57
105
|
let timedOut = false;
|
|
58
106
|
const timer = setTimeout(() => {
|
|
@@ -62,6 +110,7 @@ export const shellTool = {
|
|
|
62
110
|
const onAbort = () => running.stop();
|
|
63
111
|
ctx.signal.addEventListener("abort", onAbort, { once: true });
|
|
64
112
|
const { exitCode, signal } = await running.done;
|
|
113
|
+
asking.abort();
|
|
65
114
|
clearTimeout(timer);
|
|
66
115
|
ctx.signal.removeEventListener("abort", onAbort);
|
|
67
116
|
const output = running.output.render();
|
|
@@ -84,6 +133,10 @@ export const shellTool = {
|
|
|
84
133
|
};
|
|
85
134
|
},
|
|
86
135
|
};
|
|
136
|
+
/** Whether the call asks to run outside the sandbox; only while there is one. */
|
|
137
|
+
function outsideSandbox(args) {
|
|
138
|
+
return bool(args, "outside_sandbox") === true && activeSandbox() !== "none";
|
|
139
|
+
}
|
|
87
140
|
export const shellJobTool = {
|
|
88
141
|
name: "shell_job",
|
|
89
142
|
description: "Read the output of a command started with background, or stop it.",
|
package/dist/shared/policy.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Yew's privacy policy and terms of service (spec 11.1): one text for
|
|
2
|
+
* Yew Harness's privacy policy and terms of service (spec 11.1): one text for the Mac, iPhone and Android.
|
|
3
3
|
* The iPhone app carries the same paragraphs in its string catalog; test/ios.test.ts keeps them equal.
|
|
4
4
|
* A change raises the version and the date; earlier versions stay in Git.
|
|
5
5
|
*/
|
|
6
|
-
export const POLICY_VERSION = "2.
|
|
6
|
+
export const POLICY_VERSION = "2.6";
|
|
7
7
|
export const POLICY = {
|
|
8
8
|
zh: {
|
|
9
9
|
date: "2026 年 11 月 18 日",
|
|
10
10
|
privacy: [
|
|
11
|
-
"Yew 是在你自己的电脑上运行的软件,手机上的 Yew(iPhone 和安卓)只连接你自己电脑上的 Yew。榫卯 Tenon AI 不收集、不接收你在 Yew 里的内容,Yew 里没有统计、遥测或上报代码。",
|
|
12
|
-
"保存在你电脑上的数据:会话、消息、工具调用记录、操作授权、会话之间的信件、你在审批中心做的决定、定时任务和设置存在 Yew 的数据目录(默认 ~/.yew)里的数据库中;服务商的 API Key,以及你在浏览器里登录 MCP 服务得到的访问令牌、刷新令牌和 Yew 为它注册的客户端,存在系统钥匙串里;MCP 服务的配置写在数据目录的 mcp.json 里,包括你填的密钥和你自己建的 Google 客户端的 ID 和密钥;超长的命令输出存在数据目录的 tmp 文件夹里;会话存下的产物(文档、页面、数据和图表)的各个版本存在数据目录的 artifacts 文件夹里。Yew 自带浏览器的资料(你在这个浏览器里登录过的网站的 Cookie、缓存和浏览记录)存在数据目录的 browser 文件夹里。用 yew service 设了开机启动时,运行日志(启动、出错和连接中继的记录,不含对话内容)存在数据目录的 logs 文件夹里。这些数据一直保存,直到你删除。你在设置里指定了审批记录文件时,Yew 把每个决定追加到那个文件里。",
|
|
13
|
-
"手机访问:你在电脑上打开「允许手机访问」后,电脑上的 Yew 连接中继服务,手机上的 Yew 经中继和它通信。默认的中继由榫卯 Tenon AI 运行,你也可以自己部署。两端之间端到端加密,中继只转发密文,看不到也不保存内容。榫卯 Tenon AI 运行的中继为保障网络安全记录连接日志:时间、IP 地址、请求的路径(其中有你电脑的标识,是它公钥的哈希)和状态,不含内容,保存 184 天后自动删除。中继服务器位于中国境内。电脑上的 Yew 记下配对的手机:名称、公钥、配对时间和最近连接的时间。iPhone 上的 Yew 把配对信息和自己的密钥存在 iOS 钥匙串里,只存在这台设备上。打开通知后,iPhone 把 Apple 给它的推送令牌经加密通道交给你的电脑保存;电脑把通知的内容为这台 iPhone 加密,经中继交给 Apple 的推送服务。中继和 Apple 经手推送令牌和密文,看不到通知的内容。安卓上的 Yew 把配对信息和自己的密钥存在应用的私有文件里,用 Android 密钥库里的密钥加密,只存在这台设备上,不进系统备份和换机传输。安卓上的 Yew 不使用推送服务,也没有推送令牌:打开通知后,它用一个前台服务在后台保持到中继的连接,电脑经端到端加密的通道把通知的内容发给手机,中继只转发密文;系统会为这条连接显示一条常驻通知,系统停掉 Yew 时收不到通知。扫描配对二维码时用到相机,画面只在手机上识别,不保存也不发出。手机上另记着通知的开关和已经看到的待办的编号,不含内容。",
|
|
14
|
-
"发给第三方的数据:你为会话选的模型服务商会收到发给它的对话内容,包括会话读到的文件、命令输出、MCP 工具返回的内容(比如你连接的邮箱、日历和云端硬盘里的邮件、日程和文件),以及会话使用浏览器和电脑操控工具时取得的网页内容和屏幕截图;屏幕截图会拍下当时屏幕上显示的内容,包括其他应用的窗口,这部分适用该服务商的隐私政策。默认服务商 DeepSeek 由中国公司深度求索提供,内容怎样处理和存放以它的隐私政策为准;你选境外服务商时,这些内容会发往境外。会话抓取网页或用自带浏览器打开网页时,网站会收到请求;在自带浏览器里登录过的网站,会收到带着你登录状态的请求。你配了搜索服务的密钥后,会话联网搜索时,这家搜索服务会收到查询词,适用该搜索服务的隐私政策;选境外的搜索服务(Tavily、Brave)时,查询词会发往境外。Yew 默认启动两个开源的 MCP 服务:浏览器(微软的 Playwright MCP)和电脑操控(computer-use-mcp),它们在你的电脑上运行,可以在设置里停用。这两个服务,以及你一键添加的、要在本机运行的常用服务,Yew 第一次使用时从 npm 下载安装,npm 会收到下载请求。你添加的 MCP 服务(写在 mcp.json 里)会收到会话调用它的工具时传的内容;你在浏览器里登录过的服务,会收到以你的账号发出的请求。这些服务适用各自的隐私政策;选境外的服务(比如 Google、Linear、Vercel)时,传给它的内容会发往境外。这些工具每次调用都先问你,你对某个工具选了「总是允许」后不再问;电脑操控的点击、输入和按键,以及 Yew 认出会发送、发布或删除东西的 MCP 工具,不能选「总是允许」,每次都问。",
|
|
15
|
-
"查询、导出与删除:你可以直接查看数据目录里的文件。删除某个服务商的 Key:在设置里删除,或运行 yew key delete;删除配对的手机:在电脑上的「手机访问」里移除,或在手机上断开配对;退出 MCP 服务的登录:在「MCP 服务」里点「退出登录」,服务支持时 Yew 先请它作废令牌,再删除本机保存的令牌;要确认授权已经撤销,到该服务的账号设置里查看或移除;删除自带浏览器的登录状态:删除数据目录的 browser 文件夹;删除全部数据:停掉 yew serve 后删除数据目录。",
|
|
11
|
+
"Yew Harness 是在你自己的电脑上运行的软件,手机上的 Yew Harness(iPhone 和安卓)只连接你自己电脑上的 Yew Harness。榫卯 Tenon AI 不收集、不接收你在 Yew Harness 里的内容,Yew Harness 里没有统计、遥测或上报代码。",
|
|
12
|
+
"保存在你电脑上的数据:会话、消息、工具调用记录、操作授权、会话之间的信件、你在审批中心做的决定、定时任务和设置存在 Yew Harness 的数据目录(默认 ~/.yew)里的数据库中;服务商的 API Key,以及你在浏览器里登录 MCP 服务得到的访问令牌、刷新令牌和 Yew Harness 为它注册的客户端,存在系统钥匙串里;MCP 服务的配置写在数据目录的 mcp.json 里,包括你填的密钥和你自己建的 Google 客户端的 ID 和密钥;超长的命令输出存在数据目录的 tmp 文件夹里;会话存下的产物(文档、页面、数据和图表)的各个版本存在数据目录的 artifacts 文件夹里。Yew Harness 自带浏览器的资料(你在这个浏览器里登录过的网站的 Cookie、缓存和浏览记录)存在数据目录的 browser 文件夹里。用 yew service 设了开机启动时,运行日志(启动、出错和连接中继的记录,不含对话内容)存在数据目录的 logs 文件夹里。这些数据一直保存,直到你删除。你在设置里指定了审批记录文件时,Yew Harness 把每个决定追加到那个文件里。",
|
|
13
|
+
"手机访问:你在电脑上打开「允许手机访问」后,电脑上的 Yew Harness 连接中继服务,手机上的 Yew Harness 经中继和它通信。默认的中继由榫卯 Tenon AI 运行,你也可以自己部署。两端之间端到端加密,中继只转发密文,看不到也不保存内容。榫卯 Tenon AI 运行的中继为保障网络安全记录连接日志:时间、IP 地址、请求的路径(其中有你电脑的标识,是它公钥的哈希)和状态,不含内容,保存 184 天后自动删除。中继服务器位于中国境内。电脑上的 Yew Harness 记下配对的手机:名称、公钥、配对时间和最近连接的时间。iPhone 上的 Yew Harness 把配对信息和自己的密钥存在 iOS 钥匙串里,只存在这台设备上。打开通知后,iPhone 把 Apple 给它的推送令牌经加密通道交给你的电脑保存;电脑把通知的内容为这台 iPhone 加密,经中继交给 Apple 的推送服务。中继和 Apple 经手推送令牌和密文,看不到通知的内容。安卓上的 Yew Harness 把配对信息和自己的密钥存在应用的私有文件里,用 Android 密钥库里的密钥加密,只存在这台设备上,不进系统备份和换机传输。安卓上的 Yew Harness 不使用推送服务,也没有推送令牌:打开通知后,它用一个前台服务在后台保持到中继的连接,电脑经端到端加密的通道把通知的内容发给手机,中继只转发密文;系统会为这条连接显示一条常驻通知,系统停掉 Yew Harness 时收不到通知。扫描配对二维码时用到相机,画面只在手机上识别,不保存也不发出。手机上另记着通知的开关和已经看到的待办的编号,不含内容。",
|
|
14
|
+
"发给第三方的数据:你为会话选的模型服务商会收到发给它的对话内容,包括会话读到的文件、命令输出、MCP 工具返回的内容(比如你连接的邮箱、日历和云端硬盘里的邮件、日程和文件),以及会话使用浏览器和电脑操控工具时取得的网页内容和屏幕截图;屏幕截图会拍下当时屏幕上显示的内容,包括其他应用的窗口,这部分适用该服务商的隐私政策。默认服务商 DeepSeek 由中国公司深度求索提供,内容怎样处理和存放以它的隐私政策为准;你选境外服务商时,这些内容会发往境外。会话抓取网页或用自带浏览器打开网页时,网站会收到请求;在自带浏览器里登录过的网站,会收到带着你登录状态的请求。你配了搜索服务的密钥后,会话联网搜索时,这家搜索服务会收到查询词,适用该搜索服务的隐私政策;选境外的搜索服务(Tavily、Brave)时,查询词会发往境外。Yew Harness 默认启动两个开源的 MCP 服务:浏览器(微软的 Playwright MCP)和电脑操控(computer-use-mcp),它们在你的电脑上运行,可以在设置里停用。这两个服务,以及你一键添加的、要在本机运行的常用服务,Yew Harness 第一次使用时从 npm 下载安装,npm 会收到下载请求。你添加的 MCP 服务(写在 mcp.json 里)会收到会话调用它的工具时传的内容;你在浏览器里登录过的服务,会收到以你的账号发出的请求。这些服务适用各自的隐私政策;选境外的服务(比如 Google、Linear、Vercel)时,传给它的内容会发往境外。这些工具每次调用都先问你,你对某个工具选了「总是允许」后不再问;电脑操控的点击、输入和按键,以及 Yew Harness 认出会发送、发布或删除东西的 MCP 工具,不能选「总是允许」,每次都问。",
|
|
15
|
+
"查询、导出与删除:你可以直接查看数据目录里的文件。删除某个服务商的 Key:在设置里删除,或运行 yew key delete;删除配对的手机:在电脑上的「手机访问」里移除,或在手机上断开配对;退出 MCP 服务的登录:在「MCP 服务」里点「退出登录」,服务支持时 Yew Harness 先请它作废令牌,再删除本机保存的令牌;要确认授权已经撤销,到该服务的账号设置里查看或移除;删除自带浏览器的登录状态:删除数据目录的 browser 文件夹;删除全部数据:停掉 yew serve 后删除数据目录。",
|
|
16
16
|
"联系我们:support@tenonai.cn。",
|
|
17
17
|
],
|
|
18
18
|
terms: [
|
|
19
|
-
"Yew 以 MIT 许可证开源,许可证全文见代码仓库的 LICENSE 文件。按许可证,你可以使用、复制、修改和分发 Yew;Yew 按现状提供,不附带任何担保,在法律允许的范围内,我们不对使用 Yew 造成的损失承担责任。",
|
|
20
|
-
"Yew 会按你的授权读写文件、执行命令和访问网络。请为会话选择合适的工作区和权限规则;删除文件、推送、发布等操作每次都会先问你。浏览器、电脑操控工具和你登录过的 MCP 服务能以你已登录的身份在网页、其他应用和这些服务里操作,包括发送、提交、购买和删除;对这类工具选「总是允许」前请想清楚,并留意会话正在做什么。你选的模型服务商和你连接的 MCP 服务适用它们自己的条款。",
|
|
21
|
-
"默认的中继由榫卯 Tenon AI 免费提供,只用于 Yew 的手机访问,按现状提供,我们可能调整或停止;滥用的连接会被限制或断开。你也可以自己部署中继。",
|
|
22
|
-
"Yew 和榫卯 Tenon
|
|
19
|
+
"Yew Harness 以 MIT 许可证开源,许可证全文见代码仓库的 LICENSE 文件。按许可证,你可以使用、复制、修改和分发 Yew Harness;Yew Harness 按现状提供,不附带任何担保,在法律允许的范围内,我们不对使用 Yew Harness 造成的损失承担责任。",
|
|
20
|
+
"Yew Harness 会按你的授权读写文件、执行命令和访问网络。请为会话选择合适的工作区和权限规则;删除文件、推送、发布等操作每次都会先问你。浏览器、电脑操控工具和你登录过的 MCP 服务能以你已登录的身份在网页、其他应用和这些服务里操作,包括发送、提交、购买和删除;对这类工具选「总是允许」前请想清楚,并留意会话正在做什么。你选的模型服务商和你连接的 MCP 服务适用它们自己的条款。",
|
|
21
|
+
"默认的中继由榫卯 Tenon AI 免费提供,只用于 Yew Harness 的手机访问,按现状提供,我们可能调整或停止;滥用的连接会被限制或断开。你也可以自己部署中继。",
|
|
22
|
+
"Yew Harness、Yew 和榫卯 Tenon 的名称和标志,以及角色 Yew 的形象和图片,不在 MIT 许可证的授权范围内。",
|
|
23
23
|
],
|
|
24
24
|
},
|
|
25
25
|
en: {
|
|
26
26
|
date: "Nov 18, 2026",
|
|
27
27
|
privacy: [
|
|
28
|
-
"Yew runs on your own computer, and Yew on your phone (iPhone or Android) connects only to Yew on your own computer. Tenon AI does not collect or receive your content in Yew, and Yew contains no analytics, telemetry or reporting code.",
|
|
29
|
-
"Data kept on your computer: sessions, messages, tool call records, permissions you granted, letters between sessions, the decisions you make in the approval center, scheduled tasks and settings are stored in a database in Yew's data folder (~/.yew by default); provider API keys, and the access tokens, refresh tokens and client registrations Yew gets when you sign in to an MCP server in your browser, are stored in the system keychain; MCP server settings are kept in mcp.json in the data folder, including keys you enter and the ID and secret of a Google client you created yourself; very long command output is stored in the tmp folder of the data folder; every version of the artifacts sessions save (documents, pages, data and charts) is stored in its artifacts folder. The profile of Yew's built-in browser (cookies, cache and history of the sites you signed in to there) is stored in the browser folder of the data folder. When you set Yew to start at login with yew service, its service log (start-up, errors and relay connection lines, without conversation content) is stored in the logs folder of the data folder. This data stays until you delete it. If you set a decision log file in Settings, Yew adds each decision to that file.",
|
|
30
|
-
"Phone access: when you turn on phone access on your computer, Yew on the computer connects to a relay, and Yew on your phone talks to it through the relay. The default relay is run by Tenon AI; you can also run your own. The two ends are encrypted end to end: the relay only passes ciphertext along and can neither read nor keep the content. For network security, the relay run by Tenon AI keeps a connection log: the time, the IP address, the path requested (which carries your computer's identifier, a hash of its public key) and the status, without content, deleted automatically after 184 days. The relay server is in mainland China. Yew on the computer records each paired phone: its name, public key, when it was paired and when it last connected. Yew on iPhone keeps the pairing and its own key in the iOS keychain, on that device only. With notifications on, Yew on iPhone gives the push token it got from Apple to your computer over the encrypted channel, and the computer keeps it; the computer encrypts what a notification says for that iPhone and hands it to Apple's push service through the relay. The relay and Apple handle the push token and the ciphertext, and cannot read what the notification says. Yew on Android keeps the pairing and its own key in a private file of the app, encrypted with a key in the Android Keystore, on that device only; it is left out of system backups and device transfers. Yew on Android uses no push service and has no push token: with notifications on, a foreground service keeps a connection to the relay open in the background, and the computer sends what a notification says to the phone over the end-to-end encrypted channel; the relay only passes ciphertext along. Android shows a standing notification for this connection, and notifications do not arrive while the system has stopped Yew. Scanning the pairing QR code uses the camera; the picture is read on the phone and is neither kept nor sent. The phone also remembers whether notifications are on and the ids of the items it has already seen, without their content.",
|
|
31
|
-
"Data sent to third parties: the model provider you choose for a session receives the conversation sent to it, including files the session read, command output, what MCP tools return (such as the emails, events and files in a mailbox, calendar or drive you connected), and the page content and screenshots a session obtains when it uses the browser and computer control tools; a screenshot captures whatever is on the screen at that moment, including other apps' windows; that provider's privacy policy applies. The default provider, DeepSeek, is a service of the Chinese company DeepSeek; how it handles and stores this content is set out in its privacy policy. If you choose a provider outside mainland China, this content goes abroad. When a session fetches a web page or opens one in the built-in browser, that site receives the request; a site you signed in to in the built-in browser receives requests that carry your sign-in. Once you save a key for a search service, that service receives the query when a session searches the web, and its privacy policy applies; with a search service outside mainland China (Tavily, Brave), the query goes abroad. By default Yew starts two open-source MCP servers: a browser (Microsoft's Playwright MCP) and computer control (computer-use-mcp). They run on your computer, and you can turn them off in Settings. Yew downloads and installs these two, and the common servers you add with one click that run on your computer, from npm the first time it uses them; npm receives the download request. An MCP server you add (it is written in mcp.json) receives what a session passes to its tools, and a service you signed in to in your browser receives requests made with your account. These services' own privacy policies apply; with a service outside mainland China (such as Google, Linear or Vercel), what is passed to it goes abroad. These tools ask you before each call, until you choose Always allow for a tool; the clicks, typing and key presses of computer control, and MCP tools that Yew recognizes as sending, publishing or deleting something, cannot be set to Always allow and ask every time.",
|
|
32
|
-
"Access, export and deletion: you can look at the files in the data folder directly. To delete a provider's key, delete it in Settings or run yew key delete; to remove a paired phone, remove it under Phone access on the computer, or unpair on the phone; to sign out of an MCP server, choose Sign out under MCP servers: where the service supports it, Yew first asks it to cancel the tokens, then deletes the ones kept on this computer; to make sure the access you granted is revoked, check or remove it in that service's account settings; to clear the built-in browser's sign-ins, delete the browser folder in the data folder; to delete everything, stop yew serve and delete the data folder.",
|
|
28
|
+
"Yew Harness runs on your own computer, and Yew Harness on your phone (iPhone or Android) connects only to Yew Harness on your own computer. Tenon AI does not collect or receive your content in Yew Harness, and Yew Harness contains no analytics, telemetry or reporting code.",
|
|
29
|
+
"Data kept on your computer: sessions, messages, tool call records, permissions you granted, letters between sessions, the decisions you make in the approval center, scheduled tasks and settings are stored in a database in Yew Harness's data folder (~/.yew by default); provider API keys, and the access tokens, refresh tokens and client registrations Yew Harness gets when you sign in to an MCP server in your browser, are stored in the system keychain; MCP server settings are kept in mcp.json in the data folder, including keys you enter and the ID and secret of a Google client you created yourself; very long command output is stored in the tmp folder of the data folder; every version of the artifacts sessions save (documents, pages, data and charts) is stored in its artifacts folder. The profile of Yew Harness's built-in browser (cookies, cache and history of the sites you signed in to there) is stored in the browser folder of the data folder. When you set Yew Harness to start at login with yew service, its service log (start-up, errors and relay connection lines, without conversation content) is stored in the logs folder of the data folder. This data stays until you delete it. If you set a decision log file in Settings, Yew Harness adds each decision to that file.",
|
|
30
|
+
"Phone access: when you turn on phone access on your computer, Yew Harness on the computer connects to a relay, and Yew Harness on your phone talks to it through the relay. The default relay is run by Tenon AI; you can also run your own. The two ends are encrypted end to end: the relay only passes ciphertext along and can neither read nor keep the content. For network security, the relay run by Tenon AI keeps a connection log: the time, the IP address, the path requested (which carries your computer's identifier, a hash of its public key) and the status, without content, deleted automatically after 184 days. The relay server is in mainland China. Yew Harness on the computer records each paired phone: its name, public key, when it was paired and when it last connected. Yew Harness on iPhone keeps the pairing and its own key in the iOS keychain, on that device only. With notifications on, Yew Harness on iPhone gives the push token it got from Apple to your computer over the encrypted channel, and the computer keeps it; the computer encrypts what a notification says for that iPhone and hands it to Apple's push service through the relay. The relay and Apple handle the push token and the ciphertext, and cannot read what the notification says. Yew Harness on Android keeps the pairing and its own key in a private file of the app, encrypted with a key in the Android Keystore, on that device only; it is left out of system backups and device transfers. Yew Harness on Android uses no push service and has no push token: with notifications on, a foreground service keeps a connection to the relay open in the background, and the computer sends what a notification says to the phone over the end-to-end encrypted channel; the relay only passes ciphertext along. Android shows a standing notification for this connection, and notifications do not arrive while the system has stopped Yew Harness. Scanning the pairing QR code uses the camera; the picture is read on the phone and is neither kept nor sent. The phone also remembers whether notifications are on and the ids of the items it has already seen, without their content.",
|
|
31
|
+
"Data sent to third parties: the model provider you choose for a session receives the conversation sent to it, including files the session read, command output, what MCP tools return (such as the emails, events and files in a mailbox, calendar or drive you connected), and the page content and screenshots a session obtains when it uses the browser and computer control tools; a screenshot captures whatever is on the screen at that moment, including other apps' windows; that provider's privacy policy applies. The default provider, DeepSeek, is a service of the Chinese company DeepSeek; how it handles and stores this content is set out in its privacy policy. If you choose a provider outside mainland China, this content goes abroad. When a session fetches a web page or opens one in the built-in browser, that site receives the request; a site you signed in to in the built-in browser receives requests that carry your sign-in. Once you save a key for a search service, that service receives the query when a session searches the web, and its privacy policy applies; with a search service outside mainland China (Tavily, Brave), the query goes abroad. By default Yew Harness starts two open-source MCP servers: a browser (Microsoft's Playwright MCP) and computer control (computer-use-mcp). They run on your computer, and you can turn them off in Settings. Yew Harness downloads and installs these two, and the common servers you add with one click that run on your computer, from npm the first time it uses them; npm receives the download request. An MCP server you add (it is written in mcp.json) receives what a session passes to its tools, and a service you signed in to in your browser receives requests made with your account. These services' own privacy policies apply; with a service outside mainland China (such as Google, Linear or Vercel), what is passed to it goes abroad. These tools ask you before each call, until you choose Always allow for a tool; the clicks, typing and key presses of computer control, and MCP tools that Yew Harness recognizes as sending, publishing or deleting something, cannot be set to Always allow and ask every time.",
|
|
32
|
+
"Access, export and deletion: you can look at the files in the data folder directly. To delete a provider's key, delete it in Settings or run yew key delete; to remove a paired phone, remove it under Phone access on the computer, or unpair on the phone; to sign out of an MCP server, choose Sign out under MCP servers: where the service supports it, Yew Harness first asks it to cancel the tokens, then deletes the ones kept on this computer; to make sure the access you granted is revoked, check or remove it in that service's account settings; to clear the built-in browser's sign-ins, delete the browser folder in the data folder; to delete everything, stop yew serve and delete the data folder.",
|
|
33
33
|
"Contact: support@tenonai.cn.",
|
|
34
34
|
],
|
|
35
35
|
terms: [
|
|
36
|
-
"Yew is open source under the MIT License; see the LICENSE file in the code repository. Under that license you may use, copy, modify and distribute Yew. Yew is provided as is, without warranty of any kind, and to the extent the law allows we are not liable for losses arising from its use.",
|
|
37
|
-
"Yew reads and writes files, runs commands and goes online as you allow. Choose a suitable workspace and permission rules for each session; deleting files, pushing, publishing and similar operations always ask you first. The browser and computer control tools, and MCP servers you signed in to, can act with your sign-ins in web pages, other apps and those services, including sending, submitting, buying and deleting; think before you choose Always allow for them, and keep an eye on what the session is doing. The model provider you choose and the MCP servers you connect apply their own terms.",
|
|
38
|
-
"Tenon AI provides the default relay free of charge, only for Yew's phone access. It is provided as is, and we may change or stop it; connections that abuse it may be limited or closed. You can also run your own relay.",
|
|
39
|
-
"The Yew and Tenon AI names and logos are not licensed under the MIT License.",
|
|
36
|
+
"Yew Harness is open source under the MIT License; see the LICENSE file in the code repository. Under that license you may use, copy, modify and distribute Yew Harness. Yew Harness is provided as is, without warranty of any kind, and to the extent the law allows we are not liable for losses arising from its use.",
|
|
37
|
+
"Yew Harness reads and writes files, runs commands and goes online as you allow. Choose a suitable workspace and permission rules for each session; deleting files, pushing, publishing and similar operations always ask you first. The browser and computer control tools, and MCP servers you signed in to, can act with your sign-ins in web pages, other apps and those services, including sending, submitting, buying and deleting; think before you choose Always allow for them, and keep an eye on what the session is doing. The model provider you choose and the MCP servers you connect apply their own terms.",
|
|
38
|
+
"Tenon AI provides the default relay free of charge, only for Yew Harness's phone access. It is provided as is, and we may change or stop it; connections that abuse it may be limited or closed. You can also run your own relay.",
|
|
39
|
+
"The Yew Harness, Yew and Tenon AI names and logos, and the design and images of the character Yew, are not licensed under the MIT License.",
|
|
40
40
|
],
|
|
41
41
|
},
|
|
42
42
|
};
|
package/dist/shared/version.js
CHANGED
|
@@ -6,5 +6,11 @@ export const NAME = "yew";
|
|
|
6
6
|
/** The product's name where people read it (blueprint, section 12); `NAME` is the command's. */
|
|
7
7
|
export const PRODUCT = "Yew Harness";
|
|
8
8
|
export const VERSION = pkg.version;
|
|
9
|
+
/**
|
|
10
|
+
* The version of the protocol sessions speak: the fields of letters, decision cards, permission
|
|
11
|
+
* requests and finish_task. It goes up whenever one of them changes, so an evaluation can tell which
|
|
12
|
+
* protocol a run used (blueprint, section 11: working with the Yew model).
|
|
13
|
+
*/
|
|
14
|
+
export const PROTOCOL_VERSION = 1;
|
|
9
15
|
export const PUBLISHER = "Tenon AI";
|
|
10
16
|
export const WEBSITE = "https://tenonai.cn/";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Signs an evaluation's controller in to a running `yew serve`, as the person (docs/sim.md, section 1):
|
|
3
|
+
* the one-time link `yew serve` prints is traded for the browser cookie, which stays in the controller.
|
|
4
|
+
*/
|
|
5
|
+
export interface SimClient {
|
|
6
|
+
/** The service's address, such as http://127.0.0.1:4799. */
|
|
7
|
+
readonly origin: string;
|
|
8
|
+
/** A request to the local API as the person: the path starts with /api/, the body is sent as JSON. */
|
|
9
|
+
request(method: string, path: string, body?: unknown): Promise<Response>;
|
|
10
|
+
}
|
|
11
|
+
/** The one-time sign-in token in what `yew serve` printed, or null when it has not printed it yet. */
|
|
12
|
+
export declare function signInToken(output: string): {
|
|
13
|
+
port: number;
|
|
14
|
+
token: string;
|
|
15
|
+
} | null;
|
|
16
|
+
/** Trades the token in `output` (what `yew serve` printed) for the cookie, and returns a client. */
|
|
17
|
+
export declare function signIn(output: string): Promise<SimClient>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Signs an evaluation's controller in to a running `yew serve`, as the person (docs/sim.md, section 1):
|
|
3
|
+
* the one-time link `yew serve` prints is traded for the browser cookie, which stays in the controller.
|
|
4
|
+
*/
|
|
5
|
+
/** The one-time sign-in token in what `yew serve` printed, or null when it has not printed it yet. */
|
|
6
|
+
export function signInToken(output) {
|
|
7
|
+
const link = /http:\/\/127\.0\.0\.1:(\d+)\/#t=([\w-]+)/.exec(output);
|
|
8
|
+
return link ? { port: Number(link[1]), token: link[2] } : null;
|
|
9
|
+
}
|
|
10
|
+
/** Trades the token in `output` (what `yew serve` printed) for the cookie, and returns a client. */
|
|
11
|
+
export async function signIn(output) {
|
|
12
|
+
const found = signInToken(output);
|
|
13
|
+
if (!found)
|
|
14
|
+
throw new Error("No sign-in link in that output; wait until yew serve has printed it.");
|
|
15
|
+
const origin = `http://127.0.0.1:${found.port}`;
|
|
16
|
+
const exchange = await fetch(`${origin}/api/auth/exchange`, {
|
|
17
|
+
method: "POST",
|
|
18
|
+
headers: { "content-type": "application/json", origin },
|
|
19
|
+
body: JSON.stringify({ token: found.token }),
|
|
20
|
+
});
|
|
21
|
+
if (exchange.status !== 204) {
|
|
22
|
+
throw new Error(`Signing in failed (${exchange.status}): ${await exchange.text()}`);
|
|
23
|
+
}
|
|
24
|
+
const cookie = (exchange.headers.get("set-cookie") ?? "").split(";")[0];
|
|
25
|
+
if (!cookie)
|
|
26
|
+
throw new Error("Signing in gave no cookie.");
|
|
27
|
+
return {
|
|
28
|
+
origin,
|
|
29
|
+
request(method, path, body) {
|
|
30
|
+
return fetch(`${origin}${path}`, {
|
|
31
|
+
method,
|
|
32
|
+
headers: {
|
|
33
|
+
cookie,
|
|
34
|
+
origin,
|
|
35
|
+
...(body === undefined ? {} : { "content-type": "application/json" }),
|
|
36
|
+
},
|
|
37
|
+
...(body === undefined ? {} : { body: JSON.stringify(body) }),
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an evaluation's controller imports from `@tenonai/yew/sim` (docs/sim.md): loading a world into
|
|
3
|
+
* a data folder, and signing in to the `yew serve` that runs on it.
|
|
4
|
+
*/
|
|
5
|
+
export { type SimClient, signIn, signInToken } from "./client.js";
|
|
6
|
+
export type * from "./types.js";
|
|
7
|
+
export { loadWorld, WORLD_FORMAT } from "./world.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an evaluation's controller imports from `@tenonai/yew/sim` (docs/sim.md): loading a world into
|
|
3
|
+
* a data folder, and signing in to the `yew serve` that runs on it.
|
|
4
|
+
*/
|
|
5
|
+
export { signIn, signInToken } from "./client.js";
|
|
6
|
+
export { loadWorld, WORLD_FORMAT } from "./world.js";
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The world file and the loader's options (docs/sim.md, section 2). Plain types with no imports, so
|
|
3
|
+
* a controller can use them as they are.
|
|
4
|
+
*/
|
|
5
|
+
export type Thinking = "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
6
|
+
export interface WorldModel {
|
|
7
|
+
provider: string;
|
|
8
|
+
model: string;
|
|
9
|
+
thinking?: Thinking;
|
|
10
|
+
}
|
|
11
|
+
export type WorldTranscriptItem = {
|
|
12
|
+
role: "user";
|
|
13
|
+
text: string;
|
|
14
|
+
at?: string;
|
|
15
|
+
} | {
|
|
16
|
+
role: "assistant";
|
|
17
|
+
text?: string;
|
|
18
|
+
calls?: {
|
|
19
|
+
id: string;
|
|
20
|
+
tool: string;
|
|
21
|
+
args: Record<string, unknown>;
|
|
22
|
+
}[];
|
|
23
|
+
at?: string;
|
|
24
|
+
} | {
|
|
25
|
+
role: "toolResult";
|
|
26
|
+
callId: string;
|
|
27
|
+
tool: string;
|
|
28
|
+
text: string;
|
|
29
|
+
isError?: boolean;
|
|
30
|
+
at?: string;
|
|
31
|
+
} | {
|
|
32
|
+
role: "compaction";
|
|
33
|
+
summary: string;
|
|
34
|
+
at?: string;
|
|
35
|
+
};
|
|
36
|
+
export interface WorldSession {
|
|
37
|
+
name: string;
|
|
38
|
+
kind: "standing" | "task";
|
|
39
|
+
team?: string | null;
|
|
40
|
+
role?: string;
|
|
41
|
+
workspace?: string | null;
|
|
42
|
+
permissionMode?: "auto" | "manual" | "skip";
|
|
43
|
+
receive?: "accept" | "hold" | "refuse";
|
|
44
|
+
canOrganize?: boolean;
|
|
45
|
+
canPostCards?: boolean;
|
|
46
|
+
model: "under-test" | WorldModel;
|
|
47
|
+
/** The session that opened this task, by name. */
|
|
48
|
+
openedBy?: string | null;
|
|
49
|
+
status?: {
|
|
50
|
+
state: "idle";
|
|
51
|
+
} | {
|
|
52
|
+
state: "error";
|
|
53
|
+
error: string;
|
|
54
|
+
since?: string;
|
|
55
|
+
} | {
|
|
56
|
+
state: "archived";
|
|
57
|
+
};
|
|
58
|
+
transcript?: WorldTranscriptItem[];
|
|
59
|
+
}
|
|
60
|
+
export interface WorldLetter {
|
|
61
|
+
/** What scoring calls this letter; `replyTo` names another letter by it. */
|
|
62
|
+
key?: string;
|
|
63
|
+
/** A session's name, "@person" or "@cli". */
|
|
64
|
+
from: string;
|
|
65
|
+
to: string;
|
|
66
|
+
kind: "notice" | "request" | "decision" | "report";
|
|
67
|
+
summary: string;
|
|
68
|
+
body?: string;
|
|
69
|
+
status: "queued" | "held" | "delivered" | "done" | "refused" | "dropped";
|
|
70
|
+
at?: string;
|
|
71
|
+
replyTo?: string;
|
|
72
|
+
/** The number of the decision a decision letter relays. */
|
|
73
|
+
decision?: number;
|
|
74
|
+
}
|
|
75
|
+
export interface WorldCard {
|
|
76
|
+
number: number;
|
|
77
|
+
/** The session that put the card in the approval center, by name. */
|
|
78
|
+
by?: string | null;
|
|
79
|
+
requestedBy?: string | null;
|
|
80
|
+
title: string;
|
|
81
|
+
context?: string;
|
|
82
|
+
options?: {
|
|
83
|
+
label: string;
|
|
84
|
+
detail?: string;
|
|
85
|
+
}[];
|
|
86
|
+
/** An option's label. */
|
|
87
|
+
recommended?: string | null;
|
|
88
|
+
deadline?: string | null;
|
|
89
|
+
sessions?: string[];
|
|
90
|
+
undoable?: boolean;
|
|
91
|
+
reversible?: string;
|
|
92
|
+
after?: string;
|
|
93
|
+
status: "pending" | "decided" | "withdrawn";
|
|
94
|
+
/** The label of the option the person chose; leave it out for an answer that is only a note. */
|
|
95
|
+
choice?: string | null;
|
|
96
|
+
note?: string | null;
|
|
97
|
+
createdAt?: string;
|
|
98
|
+
decidedAt?: string;
|
|
99
|
+
withdrawnReason?: string;
|
|
100
|
+
/** Sessions the decision was already delivered to, by name. */
|
|
101
|
+
deliveredTo?: string[];
|
|
102
|
+
}
|
|
103
|
+
export interface WorldSchedule {
|
|
104
|
+
name: string;
|
|
105
|
+
cron: string;
|
|
106
|
+
session: string;
|
|
107
|
+
message: string;
|
|
108
|
+
enabled?: boolean;
|
|
109
|
+
permissionMode?: "auto" | "manual" | "skip";
|
|
110
|
+
catchUp?: boolean;
|
|
111
|
+
}
|
|
112
|
+
export interface World {
|
|
113
|
+
format: "yew-sim-world/1";
|
|
114
|
+
/** When the scenario starts, ISO 8601; the clock starts here when YEW_SIM_DATE is not set. */
|
|
115
|
+
date: string;
|
|
116
|
+
settings?: {
|
|
117
|
+
language?: "system" | "zh" | "en";
|
|
118
|
+
mainSession?: string;
|
|
119
|
+
defaultModel?: WorldModel;
|
|
120
|
+
};
|
|
121
|
+
teams?: {
|
|
122
|
+
name: string;
|
|
123
|
+
}[];
|
|
124
|
+
workspaces?: {
|
|
125
|
+
name: string;
|
|
126
|
+
path: string;
|
|
127
|
+
}[];
|
|
128
|
+
sessions: WorldSession[];
|
|
129
|
+
letters?: WorldLetter[];
|
|
130
|
+
cards?: WorldCard[];
|
|
131
|
+
schedules?: WorldSchedule[];
|
|
132
|
+
}
|
|
133
|
+
/** A provider of the controller's own: its scripted stand-ins, or a model on this computer. */
|
|
134
|
+
export interface SimProvider {
|
|
135
|
+
id: string;
|
|
136
|
+
name: string;
|
|
137
|
+
baseUrl: string;
|
|
138
|
+
keyRequired: boolean;
|
|
139
|
+
models: {
|
|
140
|
+
id: string;
|
|
141
|
+
name?: string;
|
|
142
|
+
contextWindow: number;
|
|
143
|
+
maxTokens: number;
|
|
144
|
+
reasoning?: boolean;
|
|
145
|
+
}[];
|
|
146
|
+
}
|
|
147
|
+
export interface LoadOptions {
|
|
148
|
+
/** The data folder to load into; it should be new. */
|
|
149
|
+
home: string;
|
|
150
|
+
/** The model for sessions whose model is "under-test". */
|
|
151
|
+
underTest?: WorldModel;
|
|
152
|
+
providers?: SimProvider[];
|
|
153
|
+
/** The global instruction file under test; an empty one when there is none. */
|
|
154
|
+
skill?: string;
|
|
155
|
+
}
|
|
156
|
+
/** The ids the world got, for scoring: sessions by name, letters by key, cards by number. */
|
|
157
|
+
export interface LoadedWorld {
|
|
158
|
+
sessions: Record<string, string>;
|
|
159
|
+
letters: Record<string, string>;
|
|
160
|
+
cards: Record<string, string>;
|
|
161
|
+
}
|