@x-tech-laboratories/x-app 0.128.0 → 0.130.1
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/README.md +28 -4
- package/dist/agent/claude_stream.d.ts +1 -22
- package/dist/agent/claude_stream.js +2 -85
- package/dist/agent/client.d.ts +1 -35
- package/dist/agent/client.js +2 -169
- package/dist/agent/commands.d.ts +1 -22
- package/dist/agent/commands.js +2 -80
- package/dist/agent/desktop_notify.d.ts +1 -54
- package/dist/agent/desktop_notify.js +2 -229
- package/dist/agent/firefox_bookmarks.d.ts +1 -29
- package/dist/agent/firefox_bookmarks.js +2 -147
- package/dist/agent/git.d.ts +1 -37
- package/dist/agent/git.js +2 -121
- package/dist/agent/github.d.ts +1 -81
- package/dist/agent/github.js +2 -185
- package/dist/agent/inhibit.d.ts +1 -32
- package/dist/agent/inhibit.js +2 -141
- package/dist/agent/keys.d.ts +1 -26
- package/dist/agent/keys.js +2 -161
- package/dist/agent/local_socket.d.ts +1 -18
- package/dist/agent/local_socket.js +2 -106
- package/dist/agent/long_runs.d.ts +1 -45
- package/dist/agent/long_runs.js +2 -419
- package/dist/agent/programs.d.ts +1 -60
- package/dist/agent/programs.js +2 -237
- package/dist/agent/protocol.d.ts +1 -172
- package/dist/agent/protocol.js +2 -249
- package/dist/agent/scheduled_notices.d.ts +1 -21
- package/dist/agent/scheduled_notices.js +2 -38
- package/dist/agent/session.d.ts +1 -61
- package/dist/agent/session.js +2 -335
- package/dist/agent/ssh_config.d.ts +1 -12
- package/dist/agent/ssh_config.js +2 -72
- package/dist/agent/stalls.d.ts +1 -44
- package/dist/agent/stalls.js +2 -176
- package/dist/agent/tasks.d.ts +1 -17
- package/dist/agent/tasks.js +2 -15
- package/dist/agent/wake.d.ts +1 -14
- package/dist/agent/wake.js +2 -88
- package/dist/agent/worktree_files.d.ts +1 -20
- package/dist/agent/worktree_files.js +2 -69
- package/dist/app/define.d.ts +10 -1
- package/dist/app/define.js +1 -0
- package/dist/app/desktop.js +29 -9
- package/dist/app/outside_fetch.d.ts +40 -0
- package/dist/app/outside_fetch.js +94 -0
- package/dist/app/outside_route.d.ts +3 -0
- package/dist/app/outside_route.js +51 -0
- package/dist/app/preload.js +2 -0
- package/dist/app/protocol.d.ts +1 -0
- package/dist/app/server.js +3 -0
- package/dist/app/web/app_page.js +33 -4
- package/dist/app/web/hosts.d.ts +2 -2
- package/dist/app/web/hosts.js +12 -1
- package/dist/app/web/settings_page.d.ts +1 -0
- package/dist/config/capacitor.js +1 -1
- package/dist/daemon_link.d.ts +2 -1
- package/dist/daemon_link.js +4 -2
- package/dist/durations.d.ts +1 -15
- package/dist/durations.js +2 -52
- package/dist/site/build.d.ts +1 -1
- package/dist/site/build.js +28 -8
- package/dist/site/content.js +6 -8
- package/dist/site/links.d.ts +11 -0
- package/dist/site/links.js +55 -0
- package/dist/site/markdown.d.ts +5 -2
- package/dist/site/markdown.js +14 -11
- package/dist/site/model.d.ts +2 -1
- package/dist/site/model.js +12 -3
- package/dist/web/react/phone.js +2 -1
- package/package.json +5 -3
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Links a page writes relative to its own file, as on GitHub: a link to a Markdown file or to a folder becomes that
|
|
2
|
+
// page's address, and a picture or other file inside the content folder is served at its own path.
|
|
3
|
+
import { existsSync, statSync } from "node:fs";
|
|
4
|
+
import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
5
|
+
import { index_files, page_path } from "./model.js";
|
|
6
|
+
export function site_links(content_folder, pages) {
|
|
7
|
+
const indexes = index_files(pages.map((page) => page.id));
|
|
8
|
+
const links = { content_folder, pages: new Map(), folders: new Map(), files: new Set(), missing: new Set() };
|
|
9
|
+
for (const page of pages) {
|
|
10
|
+
const path = page_path(page.locale, page.slug);
|
|
11
|
+
links.pages.set(page.id, path);
|
|
12
|
+
if (indexes.has(page.id))
|
|
13
|
+
links.folders.set(page.id.slice(0, Math.max(page.id.lastIndexOf("/"), 0)), path);
|
|
14
|
+
}
|
|
15
|
+
return links;
|
|
16
|
+
}
|
|
17
|
+
// Folders that never hold pages or the files they show.
|
|
18
|
+
const skipped_folders = new Set(["node_modules", "dist", "public"]);
|
|
19
|
+
// A name the content scan skips: a package, build or public folder, or one that is hidden or starts with an underscore.
|
|
20
|
+
export function is_skipped(name) {
|
|
21
|
+
return skipped_folders.has(name) || name.startsWith(".") || name.startsWith("_");
|
|
22
|
+
}
|
|
23
|
+
// An address with a scheme, one from the site's root, or an anchor on the same page.
|
|
24
|
+
const not_relative = /^([a-z][a-z0-9+.-]*:|\/|#|\?)/i;
|
|
25
|
+
// Where a relative link from a file goes on the site, without the base: a page's address with the link's query and
|
|
26
|
+
// anchor kept, or a file's own path; anything else, such as a file outside the content folder, is left as written,
|
|
27
|
+
// and a link to a Markdown file that is not there is noted in `missing`.
|
|
28
|
+
export function site_link(links, source_file, href) {
|
|
29
|
+
if (href === "" || not_relative.test(href))
|
|
30
|
+
return href;
|
|
31
|
+
const [, path, rest] = /^([^?#]*)(.*)$/s.exec(href);
|
|
32
|
+
let decoded;
|
|
33
|
+
try {
|
|
34
|
+
decoded = decodeURIComponent(path);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return href;
|
|
38
|
+
}
|
|
39
|
+
const target = resolve(dirname(source_file), decoded);
|
|
40
|
+
const id = relative(links.content_folder, target).split(sep).join("/");
|
|
41
|
+
if (id === ".." || id.startsWith("../") || isAbsolute(id))
|
|
42
|
+
return href;
|
|
43
|
+
const page = links.pages.get(id) ?? links.folders.get(id);
|
|
44
|
+
if (page !== undefined)
|
|
45
|
+
return `${page}${rest}`;
|
|
46
|
+
if (/\.mdx?$/i.test(id)) {
|
|
47
|
+
if (!existsSync(target))
|
|
48
|
+
links.missing.add(`${relative(links.content_folder, source_file).split(sep).join("/")} links to ${href}, which is not a page of the site.`);
|
|
49
|
+
return href;
|
|
50
|
+
}
|
|
51
|
+
if (id === "" || id.split("/").some(is_skipped) || !existsSync(target) || !statSync(target).isFile())
|
|
52
|
+
return href;
|
|
53
|
+
links.files.add(id);
|
|
54
|
+
return `/${encodeURI(id)}${rest}`;
|
|
55
|
+
}
|
package/dist/site/markdown.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { Root } from "hast";
|
|
2
2
|
import type { Root as MarkdownRoot } from "mdast";
|
|
3
3
|
import type { Plugin } from "vite";
|
|
4
|
-
|
|
4
|
+
import { type SiteLinks } from "./links.ts";
|
|
5
|
+
export declare function rehype_base_links(base: string, links?: SiteLinks): (tree: Root, file: {
|
|
6
|
+
path?: string;
|
|
7
|
+
}) => void;
|
|
5
8
|
export declare function remark_github_alerts(): (tree: MarkdownRoot) => void;
|
|
6
9
|
export declare function remark_drop_title_heading(): (tree: MarkdownRoot) => void;
|
|
7
|
-
export declare function mdx_plugin(base: string): Plugin;
|
|
10
|
+
export declare function mdx_plugin(base: string, links?: SiteLinks): Plugin;
|
package/dist/site/markdown.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// How a site's Markdown and MDX become pages, on MDX's own compiler: GitHub's tables, task lists, autolinks, alerts
|
|
2
2
|
// and raw HTML, frontmatter and a leading title heading kept out of the page, an id and an anchor link on every heading, code coloured by Shiki through Halon's
|
|
3
|
-
// tokens, and links within the site moved under its base.
|
|
3
|
+
// tokens, relative links and pictures moved to where they are on the site, and links within the site moved under its base.
|
|
4
|
+
import { resolve } from "node:path";
|
|
4
5
|
import mdx from "@mdx-js/rollup";
|
|
5
6
|
import rehype_shiki from "@shikijs/rehype";
|
|
6
7
|
import rehype_autolink_headings from "rehype-autolink-headings";
|
|
@@ -10,28 +11,30 @@ import remark_frontmatter from "remark-frontmatter";
|
|
|
10
11
|
import remark_gfm from "remark-gfm";
|
|
11
12
|
import { createCssVariablesTheme } from "shiki";
|
|
12
13
|
import { visit } from "unist-util-visit";
|
|
14
|
+
import { site_link } from "./links.js";
|
|
13
15
|
import { with_base } from "./model.js";
|
|
14
16
|
// Colours each kind of code token with a --shiki-* variable that Halon's site sheet sets for the light and dark schemes.
|
|
15
17
|
const halon_code_theme = createCssVariablesTheme({ name: "halon", variablePrefix: "--shiki-", fontStyle: true });
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
// Moves each link and picture a page writes relative to its own file to where it is on the site, when `links` knows the
|
|
19
|
+
// site's pages, and puts the base in front of every link and picture that starts at the site's root, written in
|
|
20
|
+
// Markdown or as a component's href or src.
|
|
21
|
+
export function rehype_base_links(base, links) {
|
|
22
|
+
return (tree, file) => {
|
|
23
|
+
const source = links && file.path ? resolve(file.path) : undefined;
|
|
24
|
+
const rewrite = (value) => with_base(base, links && source ? site_link(links, source, value) : value);
|
|
22
25
|
visit(tree, (node) => {
|
|
23
26
|
if (node.type === "element") {
|
|
24
27
|
const element = node;
|
|
25
28
|
for (const attribute of ["href", "src"]) {
|
|
26
29
|
const value = element.properties[attribute];
|
|
27
30
|
if (typeof value === "string")
|
|
28
|
-
element.properties[attribute] =
|
|
31
|
+
element.properties[attribute] = rewrite(value);
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
else if (node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") {
|
|
32
35
|
for (const attribute of node.attributes) {
|
|
33
36
|
if (attribute.type === "mdxJsxAttribute" && (attribute.name === "href" || attribute.name === "src") && typeof attribute.value === "string") {
|
|
34
|
-
attribute.value =
|
|
37
|
+
attribute.value = rewrite(attribute.value);
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
}
|
|
@@ -78,7 +81,7 @@ export function remark_drop_title_heading() {
|
|
|
78
81
|
}
|
|
79
82
|
// MDX's own nodes, which raw HTML parsing must pass through untouched.
|
|
80
83
|
const mdx_node_types = ["mdxFlowExpression", "mdxJsxFlowElement", "mdxJsxTextElement", "mdxTextExpression", "mdxjsEsm"];
|
|
81
|
-
export function mdx_plugin(base) {
|
|
84
|
+
export function mdx_plugin(base, links) {
|
|
82
85
|
return mdx({
|
|
83
86
|
jsxImportSource: "react",
|
|
84
87
|
remarkPlugins: [remark_frontmatter, remark_drop_title_heading, remark_gfm, remark_github_alerts],
|
|
@@ -87,7 +90,7 @@ export function mdx_plugin(base) {
|
|
|
87
90
|
rehype_slug,
|
|
88
91
|
[rehype_autolink_headings, { behavior: "append", properties: { className: ["heading-anchor"], ariaHidden: "true", tabIndex: -1, dataPagefindIgnore: "" }, content: { type: "text", value: "#" } }],
|
|
89
92
|
[rehype_shiki, { theme: halon_code_theme, defaultLanguage: "text", fallbackLanguage: "text" }],
|
|
90
|
-
[rehype_base_links, base],
|
|
93
|
+
[rehype_base_links, base, links],
|
|
91
94
|
],
|
|
92
95
|
});
|
|
93
96
|
}
|
package/dist/site/model.d.ts
CHANGED
|
@@ -92,7 +92,8 @@ export interface SourcePage {
|
|
|
92
92
|
frontmatter: Frontmatter;
|
|
93
93
|
last_updated?: string;
|
|
94
94
|
}
|
|
95
|
-
export declare function
|
|
95
|
+
export declare function index_files(ids: readonly string[]): Set<string>;
|
|
96
|
+
export declare function place_of_file(id: string, locale_keys: readonly string[], is_index?: boolean): {
|
|
96
97
|
locale: string;
|
|
97
98
|
slug: string;
|
|
98
99
|
};
|
package/dist/site/model.js
CHANGED
|
@@ -8,11 +8,20 @@ const english_root = { [root_locale]: { label: "English", lang: "en" } };
|
|
|
8
8
|
export function site_locales(config) {
|
|
9
9
|
return config.locales ?? english_root;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const index_name = /(^|\/)index\.mdx?$/;
|
|
12
|
+
const readme_name = /(^|\/)readme\.mdx?$/i;
|
|
13
|
+
// The content files that are their folder's own page: each index file, and a README in a folder with no index file.
|
|
14
|
+
export function index_files(ids) {
|
|
15
|
+
const folder_of = (id) => id.slice(0, id.lastIndexOf("/") + 1);
|
|
16
|
+
const with_index = new Set(ids.filter((id) => index_name.test(id)).map(folder_of));
|
|
17
|
+
return new Set(ids.filter((id) => index_name.test(id) || (readme_name.test(id) && !with_index.has(folder_of(id)))));
|
|
18
|
+
}
|
|
19
|
+
// The locale and slug a content file serves, from its path under the content folder; an index file, or a README that
|
|
20
|
+
// stands for one, serves its folder.
|
|
21
|
+
export function place_of_file(id, locale_keys, is_index = index_name.test(id)) {
|
|
13
22
|
const parts = id.replace(/\.mdx?$/, "").split("/");
|
|
14
23
|
const locale = parts.length > 1 && parts[0] !== root_locale && locale_keys.includes(parts[0]) ? parts.shift() : root_locale;
|
|
15
|
-
if (
|
|
24
|
+
if (is_index)
|
|
16
25
|
parts.pop();
|
|
17
26
|
return { locale, slug: parts.join("/") };
|
|
18
27
|
}
|
package/dist/web/react/phone.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Whether the page is phone-sized, the width at which Halon draws widgets in their phone layouts.
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
const phone_query = "(max-width: 640px)";
|
|
4
|
-
|
|
4
|
+
// False where there is no window, as when a site's pages are drawn to HTML at build time.
|
|
5
|
+
const matches = (query) => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(query).matches;
|
|
5
6
|
// Whether a media query such as "(max-width: 700px)" matches, read again whenever it changes.
|
|
6
7
|
export function use_media_query(query) {
|
|
7
8
|
const [matched, set_matched] = useState(() => matches(query));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@x-tech-laboratories/x-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.130.1",
|
|
4
4
|
"description": "Code the X-apps share: agents and their long runs, passwords and sign-in, the Fastify server pieces, durations, and the web page's helpers and widgets",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"repository": {
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
"engines": {
|
|
12
12
|
"node": ">=24"
|
|
13
13
|
},
|
|
14
|
+
"workspaces": [
|
|
15
|
+
"packages/agent"
|
|
16
|
+
],
|
|
14
17
|
"files": [
|
|
15
18
|
"dist",
|
|
16
19
|
"config",
|
|
@@ -240,6 +243,7 @@
|
|
|
240
243
|
"@tiptap/pm": "^3.33.0",
|
|
241
244
|
"@tiptap/react": "^3.33.0",
|
|
242
245
|
"@tiptap/starter-kit": "^3.33.0",
|
|
246
|
+
"@x-tech-laboratories/x-app-agent": "0.130.0",
|
|
243
247
|
"bonjour-service": "^1.4.4",
|
|
244
248
|
"dayjs": "^1.11.23",
|
|
245
249
|
"diff": "^9.0.0",
|
|
@@ -255,7 +259,6 @@
|
|
|
255
259
|
"lucide-react": "^1.67.0",
|
|
256
260
|
"marked": "^18.1.3",
|
|
257
261
|
"parse-diff": "^0.12.0",
|
|
258
|
-
"parse-duration": "^2.1.11",
|
|
259
262
|
"pretty-bytes": "^7.2.0",
|
|
260
263
|
"react-error-boundary": "^6.1.6",
|
|
261
264
|
"react-grid-layout": "^2.3.0",
|
|
@@ -263,7 +266,6 @@
|
|
|
263
266
|
"selfsigned": "^5.5.0",
|
|
264
267
|
"semver": "^7.8.6",
|
|
265
268
|
"spdx-satisfies": "^6.0.1",
|
|
266
|
-
"sshpk": "^1.18.0",
|
|
267
269
|
"tweetnacl": "^1.0.3"
|
|
268
270
|
},
|
|
269
271
|
"capacitor": {
|