@tenonai/yew 0.0.0-stage → 1.4.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 +296 -0
- package/LICENSE +21 -0
- package/README.md +55 -2
- package/THIRD-PARTY-NOTICES.md +122 -0
- package/bin/yew.js +9 -0
- package/dist/cli/app.js +198 -0
- package/dist/cli/export.js +57 -0
- package/dist/cli/io.js +65 -0
- package/dist/cli/key.js +113 -0
- package/dist/cli/main.js +44 -0
- package/dist/cli/mcp.js +76 -0
- package/dist/cli/remote.js +116 -0
- package/dist/cli/run.js +72 -0
- package/dist/cli/schedule.js +123 -0
- package/dist/cli/send.js +126 -0
- package/dist/cli/serve.js +301 -0
- package/dist/cli/service.js +241 -0
- package/dist/cli/system.js +44 -0
- package/dist/remote/access.js +107 -0
- package/dist/remote/connector.js +278 -0
- package/dist/remote/identity.js +71 -0
- package/dist/remote/noise.js +287 -0
- package/dist/remote/protocol.js +51 -0
- package/dist/remote/push.js +37 -0
- package/dist/server/agent/compaction.js +242 -0
- package/dist/server/agent/context.js +119 -0
- package/dist/server/agent/held.js +48 -0
- package/dist/server/agent/helper.js +122 -0
- package/dist/server/agent/mailroom.js +510 -0
- package/dist/server/agent/prompt.js +268 -0
- package/dist/server/agent/runner.js +1159 -0
- package/dist/server/artifacts.js +216 -0
- package/dist/server/budget.js +88 -0
- package/dist/server/data-export.js +105 -0
- package/dist/server/data-usage.js +143 -0
- package/dist/server/db/database.js +49 -0
- package/dist/server/db/migrations.js +347 -0
- package/dist/server/errors.js +16 -0
- package/dist/server/events.js +17 -0
- package/dist/server/export.js +378 -0
- package/dist/server/folder-picker.js +32 -0
- package/dist/server/from-jig.js +98 -0
- package/dist/server/http/agents.js +78 -0
- package/dist/server/http/api.js +468 -0
- package/dist/server/http/app.js +111 -0
- package/dist/server/http/artifacts.js +53 -0
- package/dist/server/http/data.js +54 -0
- package/dist/server/http/devices.js +47 -0
- package/dist/server/http/events.js +134 -0
- package/dist/server/http/idempotency.js +53 -0
- package/dist/server/http/input.js +106 -0
- package/dist/server/http/mail.js +52 -0
- package/dist/server/http/mcp.js +134 -0
- package/dist/server/http/notes.js +91 -0
- package/dist/server/http/problem.js +55 -0
- package/dist/server/http/providers.js +131 -0
- package/dist/server/http/schedules.js +58 -0
- package/dist/server/http/search.js +42 -0
- package/dist/server/http/security.js +168 -0
- package/dist/server/http/skills.js +53 -0
- package/dist/server/http/system.js +26 -0
- package/dist/server/ids.js +30 -0
- package/dist/server/keys.js +51 -0
- package/dist/server/mail/envelope.js +152 -0
- package/dist/server/mail/post.js +603 -0
- package/dist/server/mail/store.js +279 -0
- package/dist/server/manage.js +601 -0
- package/dist/server/mcp-builtin.js +179 -0
- package/dist/server/mcp-config.js +305 -0
- package/dist/server/mcp-oauth.js +448 -0
- package/dist/server/mcp.js +668 -0
- package/dist/server/model/gateway.js +410 -0
- package/dist/server/paths.js +34 -0
- package/dist/server/permissions/engine.js +249 -0
- package/dist/server/permissions/paths.js +93 -0
- package/dist/server/permissions/shell.js +635 -0
- package/dist/server/push.js +345 -0
- package/dist/server/reveal.js +36 -0
- package/dist/server/runtime.js +17 -0
- package/dist/server/schedules.js +356 -0
- package/dist/server/settings.js +80 -0
- package/dist/server/skills.js +262 -0
- package/dist/server/store.js +1077 -0
- package/dist/server/tools/files.js +318 -0
- package/dist/server/tools/html.js +221 -0
- package/dist/server/tools/jobs.js +38 -0
- package/dist/server/tools/mail.js +680 -0
- package/dist/server/tools/match.js +81 -0
- package/dist/server/tools/misc.js +253 -0
- package/dist/server/tools/process.js +128 -0
- package/dist/server/tools/read-state.js +40 -0
- package/dist/server/tools/registry.js +43 -0
- package/dist/server/tools/search.js +175 -0
- package/dist/server/tools/shell.js +124 -0
- package/dist/server/tools/types.js +43 -0
- package/dist/server/tools/web-search.js +198 -0
- package/dist/server/tools/web.js +240 -0
- package/dist/shared/cron.js +105 -0
- package/dist/shared/mcp-presets.js +170 -0
- package/dist/shared/messages.js +45 -0
- package/dist/shared/policy.js +42 -0
- package/dist/shared/types.js +34 -0
- package/dist/shared/version.js +8 -0
- package/mcp-builtin/package-lock.json +3398 -0
- package/mcp-builtin/package.json +14 -0
- package/mcp-builtin/presets/gitee/package-lock.json +105 -0
- package/mcp-builtin/presets/gitee/package.json +10 -0
- package/mcp-builtin/presets/notion/package-lock.json +2243 -0
- package/mcp-builtin/presets/notion/package.json +10 -0
- package/mcp-builtin/presets/sentry/package-lock.json +28 -0
- package/mcp-builtin/presets/sentry/package.json +10 -0
- package/package.json +75 -5
- package/web/dist/THIRD-PARTY-NOTICES.txt +1944 -0
- package/web/dist/assets/index-B9oWPSod.css +1 -0
- package/web/dist/assets/index-C5qBMzFX.js +68 -0
- package/web/dist/icons/app-icon.png +0 -0
- package/web/dist/icons/apple-touch-icon.png +0 -0
- package/web/dist/icons/favicon-16.png +0 -0
- package/web/dist/icons/favicon-32.png +0 -0
- package/web/dist/icons/favicon-64.png +0 -0
- package/web/dist/icons/tenon-mark.svg +1 -0
- package/web/dist/icons/yew-mark.svg +1 -0
- package/web/dist/index.html +18 -0
- package/web/dist/mascot/gift.webp +0 -0
- package/web/dist/mascot/greeting.webp +0 -0
- package/web/dist/mascot/happy.webp +0 -0
- package/web/dist/mascot/lost.webp +0 -0
- package/web/dist/mascot/shush.webp +0 -0
- package/web/dist/mascot/sleepy.webp +0 -0
- package/web/dist/mascot/sorry.webp +0 -0
- package/web/dist/mascot/thinking.webp +0 -0
- package/web/dist/mascot/waking.webp +0 -0
- package/web/dist/mascot/writing.webp +0 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
4
|
+
/** Expands `~` and resolves against the working folder. Returns null for a relative path without one. */
|
|
5
|
+
export function resolvePath(input, cwd) {
|
|
6
|
+
const expanded = input === "~" ? homedir() : input.startsWith("~/") ? join(homedir(), input.slice(2)) : input;
|
|
7
|
+
if (isAbsolute(expanded))
|
|
8
|
+
return canonical(resolve(expanded));
|
|
9
|
+
if (!cwd)
|
|
10
|
+
return null;
|
|
11
|
+
return canonical(resolve(cwd, expanded));
|
|
12
|
+
}
|
|
13
|
+
/** Resolves symlinks in the longest existing part of the path, so a link cannot lead out of a folder unnoticed. */
|
|
14
|
+
export function canonical(path) {
|
|
15
|
+
let existing = path;
|
|
16
|
+
const missing = [];
|
|
17
|
+
while (!existsSync(existing)) {
|
|
18
|
+
const parent = dirname(existing);
|
|
19
|
+
if (parent === existing)
|
|
20
|
+
return path;
|
|
21
|
+
missing.unshift(basename(existing));
|
|
22
|
+
existing = parent;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
return join(realpathSync(existing), ...missing);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return path;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function isInside(path, folder) {
|
|
32
|
+
if (path === folder)
|
|
33
|
+
return true;
|
|
34
|
+
const rel = relative(folder, path);
|
|
35
|
+
return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
|
|
36
|
+
}
|
|
37
|
+
/** Places that hold credentials. Sessions never read or write them through file tools (M1 plan, section 7). */
|
|
38
|
+
export function secretLocations(yewHome) {
|
|
39
|
+
const home = homedir();
|
|
40
|
+
return [
|
|
41
|
+
yewHome,
|
|
42
|
+
join(home, ".ssh"),
|
|
43
|
+
join(home, ".gnupg"),
|
|
44
|
+
join(home, ".aws"),
|
|
45
|
+
join(home, ".azure"),
|
|
46
|
+
join(home, ".kube"),
|
|
47
|
+
join(home, ".docker"),
|
|
48
|
+
join(home, ".config", "gcloud"),
|
|
49
|
+
join(home, ".config", "gh"),
|
|
50
|
+
join(home, ".netrc"),
|
|
51
|
+
join(home, ".npmrc"),
|
|
52
|
+
join(home, ".pypirc"),
|
|
53
|
+
join(home, ".git-credentials"),
|
|
54
|
+
join(home, "Library", "Keychains"),
|
|
55
|
+
].map(canonical);
|
|
56
|
+
}
|
|
57
|
+
export function isSecretPath(path, secrets) {
|
|
58
|
+
return secrets.some((secret) => isInside(path, secret));
|
|
59
|
+
}
|
|
60
|
+
/** Converts a path glob (`*`, `**`, `?`) to a regular expression over absolute paths. */
|
|
61
|
+
export function globToRegExp(glob) {
|
|
62
|
+
let pattern = "";
|
|
63
|
+
for (let i = 0; i < glob.length; i++) {
|
|
64
|
+
const c = glob[i];
|
|
65
|
+
if (c === "*") {
|
|
66
|
+
if (glob[i + 1] === "*") {
|
|
67
|
+
const slash = glob[i + 2] === "/";
|
|
68
|
+
pattern += slash ? "(?:.*/)?" : ".*";
|
|
69
|
+
i += slash ? 2 : 1;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
pattern += "[^/]*";
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else if (c === "?") {
|
|
76
|
+
pattern += "[^/]";
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
pattern += c.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return new RegExp(`^${pattern}$`);
|
|
83
|
+
}
|
|
84
|
+
/** Matches a rule's path pattern; relative patterns are relative to the working folder. */
|
|
85
|
+
export function pathMatches(path, pattern, cwd) {
|
|
86
|
+
const absolute = resolvePath(pattern, cwd);
|
|
87
|
+
if (!absolute)
|
|
88
|
+
return false;
|
|
89
|
+
if (!/[*?]/.test(pattern))
|
|
90
|
+
return isInside(path, absolute);
|
|
91
|
+
const base = pattern.startsWith("~") || isAbsolute(pattern) ? absolute : join(cwd ?? "", pattern);
|
|
92
|
+
return globToRegExp(base.split(sep).join("/")).test(path.split(sep).join("/"));
|
|
93
|
+
}
|