beatrina 0.8.7 → 0.9.43
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/NOTICES +1 -1
- package/README.md +6 -0
- package/beatrina_V0.9.43.html +1885 -0
- package/beatrina_V0.9.43.html.inputs.json +1 -0
- package/bin/beatrina.mjs +152 -24
- package/bin/browser.mjs +31 -0
- package/bin/cli.mjs +64 -5
- package/bin/doctor-rows.mjs +31 -0
- package/bin/failsafe.mjs +8 -3
- package/bin/finder.mjs +74 -0
- package/bin/lsquery.swift +55 -0
- package/bin/pages.mjs +81 -0
- package/bin/python-setup.mjs +207 -0
- package/bin/runtime-dirs.mjs +27 -0
- package/bin/sessions.mjs +30 -10
- package/bin/shortcut.mjs +250 -42
- package/bin/update-check.mjs +2 -2
- package/build-info.json +1 -1
- package/engines/js/worker.mjs +6 -3
- package/engines/python/adapter.py +14 -13
- package/engines/python/analyze.py +4 -2
- package/engines/python/bootstrap.py +32 -31
- package/engines/python/debugger.py +10 -6
- package/engines/python/engine.json +1 -1
- package/engines/python/handoff.py +4 -2
- package/engines/python/worker.py +39 -10
- package/engines/r/engine.json +1 -1
- package/engines/r/handoff.R +4 -3
- package/failsafe/ai-policy.R +16 -16
- package/failsafe/ai-store.R +6 -6
- package/failsafe/cite.R +11 -11
- package/failsafe/journal.R +11 -11
- package/failsafe/plugins.R +27 -27
- package/failsafe/serve.R +241 -241
- package/host/ai-authority.mjs +55 -0
- package/host/ai-policy.mjs +48 -26
- package/host/bundle.mjs +194 -0
- package/host/deployment.mjs +25 -18
- package/host/engine-js.mjs +12 -17
- package/host/engine-pool.mjs +48 -6
- package/host/engine-python.mjs +80 -31
- package/host/engine-r.mjs +20 -21
- package/host/engine-stdio.mjs +35 -10
- package/host/env-names.mjs +148 -0
- package/host/gateway-token.mjs +51 -0
- package/host/journal-store.mjs +10 -9
- package/host/main.mjs +193 -77
- package/host/payload.mjs +131 -0
- package/host/planes/README.md +1 -1
- package/host/planes/ai-store.mjs +6 -5
- package/host/planes/ai.mjs +49 -29
- package/host/planes/analyze.mjs +6 -5
- package/host/planes/bundle.mjs +344 -0
- package/host/planes/choose.mjs +404 -0
- package/host/planes/cite.mjs +18 -17
- package/host/planes/files.mjs +0 -0
- package/host/planes/jobs.mjs +43 -20
- package/host/planes/latex.mjs +15 -5
- package/host/planes/mcp.mjs +80 -91
- package/host/planes/pair.mjs +24 -24
- package/host/planes/pipe-term.mjs +2 -2
- package/host/planes/plugins.mjs +1 -1
- package/host/planes/recent-documents.mjs +170 -0
- package/host/planes/sessions.mjs +226 -82
- package/host/planes/settings.mjs +4 -4
- package/host/planes/terminal.mjs +13 -11
- package/host/planes/test-file.mjs +2 -2
- package/host/planes/update.mjs +6 -13
- package/host/plugin-store.mjs +35 -52
- package/host/recent-documents.mjs +124 -0
- package/host/runtime-dir.mjs +47 -0
- package/host/server.mjs +75 -18
- package/host/session-keep.mjs +1 -1
- package/host/settings.mjs +85 -37
- package/host/update-record.mjs +3 -2
- package/host/user-dirs.mjs +60 -18
- package/host/which.mjs +39 -0
- package/host/windows-runtime.mjs +6 -3
- package/host/worker-plane.mjs +34 -6
- package/host/ws.mjs +9 -2
- package/host/zip.mjs +237 -0
- package/kernel/analyze.R +1 -1
- package/{check → kernel/check}/acceptance.mjs +1 -1
- package/kernel/check/knit-file.mjs +19639 -0
- package/{check → kernel/check}/session.mjs +49 -8
- package/kernel/deployment.R +20 -20
- package/kernel/examples/NOTICE.md +1 -1
- package/kernel/fileio.R +6 -6
- package/kernel/index.html +2 -2
- package/kernel/job-run.R +83 -22
- package/kernel/jobs.R +28 -12
- package/kernel/kernel-version +1 -1
- package/kernel/kernel.R +18 -18
- package/kernel/knitr-run.R +50 -9
- package/kernel/latex.R +128 -30
- package/kernel/mcp/{carmar-mcp.mjs → beatrina-mcp.mjs} +249 -59
- package/kernel/notebook-page.R +7 -7
- package/kernel/project.R +10 -10
- package/kernel/settings.R +105 -56
- package/kernel/sniff.R +4 -4
- package/kernel/typst.R +121 -0
- package/kernel/worker.R +522 -119
- package/kernel/workspace-keep.R +3 -3
- package/lib/agent-authoring-contract.js +28 -19
- package/lib/cell-kinds.js +3 -3
- package/lib/engine-labels.js +4 -4
- package/menu/Beatrina Menu.app/Contents/Info.plist +14 -0
- package/menu/Beatrina Menu.app/Contents/MacOS/Beatrina Menu +0 -0
- package/menu/Beatrina Menu.app/Contents/_CodeSignature/CodeResources +115 -0
- package/package.json +4 -3
- package/carmar_V0.8.7.html +0 -1522
package/failsafe/plugins.R
CHANGED
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
#
|
|
17
17
|
# ── where plugins live: three layers, like .libPaths() ──────────────────────
|
|
18
18
|
#
|
|
19
|
-
# user R_user_dir("
|
|
20
|
-
# system $
|
|
19
|
+
# user R_user_dir("beatrina","data")/plugins/<kind>/<id>/ the person's own; the ONLY layer written
|
|
20
|
+
# system $BEATRINA_PLUGIN_DIR/<kind>/<id>/ an administrator's set, read-only
|
|
21
21
|
# shipped <kernel>/plugins/<kind>/<id>/ what the kernel came with, read-only
|
|
22
22
|
#
|
|
23
23
|
# Searched in that order; the first OK copy of an id wins ("active"), so a
|
|
@@ -48,18 +48,18 @@
|
|
|
48
48
|
#
|
|
49
49
|
# ── the administrator's policy ───────────────────────────────────────────────
|
|
50
50
|
#
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
#
|
|
54
|
-
#
|
|
55
|
-
#
|
|
51
|
+
# BEATRINA_PLUGIN_POLICY=/etc/beatrina/plugin-policy.json the file (wins where both are set)
|
|
52
|
+
# BEATRINA_PLUGIN_DIR=/opt/beatrina/plugins the system layer
|
|
53
|
+
# BEATRINA_PLUGIN_INSTALL=user|none may the person install? (default user)
|
|
54
|
+
# BEATRINA_PLUGIN_SOURCES=host,host|none hosts a URL/registry install may fetch from
|
|
55
|
+
# BEATRINA_PLUGIN_KINDS=csl,theme which kinds exist at all
|
|
56
56
|
#
|
|
57
57
|
# Same doctrine as ai-policy.R: the honest scope is the feature. The kernel
|
|
58
58
|
# owns every fetch and every write here, so unlike an AI policy this one is
|
|
59
59
|
# ENFORCEMENT — a host not on the list is never contacted, `install: none`
|
|
60
60
|
# means the user layer is neither written nor read. And the three-state rule
|
|
61
61
|
# holds: a policy that names nothing permits everything; one that names only
|
|
62
|
-
# junk is a startup error, never a silent "all". `
|
|
62
|
+
# junk is a startup error, never a silent "all". `beatrina_plugin_policy()` is
|
|
63
63
|
# pure; serve.R joins its `errors` to the startup gate.
|
|
64
64
|
#
|
|
65
65
|
# Nothing here runs at start. The kernel lists folders when asked; nothing is
|
|
@@ -72,8 +72,8 @@ PLUGIN_FILE_RE <- "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$"
|
|
|
72
72
|
PLUGIN_MANIFEST <- "plugin.json"
|
|
73
73
|
PLUGIN_MANIFEST_MAX_BYTES <- 65536L
|
|
74
74
|
PLUGIN_FETCH_TIMEOUT_S <- 20L
|
|
75
|
-
PLUGIN_POLICY_DEFAULT_FILE <- "/etc/
|
|
76
|
-
PLUGIN_SYSTEM_DEFAULT_DIR <- "/etc/
|
|
75
|
+
PLUGIN_POLICY_DEFAULT_FILE <- "/etc/beatrina/plugin-policy.json"
|
|
76
|
+
PLUGIN_SYSTEM_DEFAULT_DIR <- "/etc/beatrina/plugins"
|
|
77
77
|
|
|
78
78
|
# THIS LIST IS A CROSS-LANGUAGE CONTRACT with `EDITOR_TOKENS` in
|
|
79
79
|
# lib/editor-themes.js; test/plugins.test.mjs reads both and fails if they
|
|
@@ -114,7 +114,7 @@ LATEX_PREAMBLE_MAX_CHARS <- 400L
|
|
|
114
114
|
# WHY THIS ROW HAS A DENY-LIST AND THE OTHER TWO DO NOT.
|
|
115
115
|
#
|
|
116
116
|
# A CSL style is XML pandoc parses; it cannot call anything. A theme is a map
|
|
117
|
-
# of colours. A LaTeX preamble is CODE — not code
|
|
117
|
+
# of colours. A LaTeX preamble is CODE — not code Beatrina runs (the kernel
|
|
118
118
|
# never compiles a .tex; latex.js only writes one) but code the AUTHOR'S TeX
|
|
119
119
|
# engine runs when they build the paper. That is a weaker guarantee than the
|
|
120
120
|
# other two rows make, and it is written here rather than left to be inherited
|
|
@@ -319,8 +319,8 @@ plugin_default_hosts <- function() {
|
|
|
319
319
|
#' Read the administrator's plugin policy.
|
|
320
320
|
#'
|
|
321
321
|
#' @param env a getter with `Sys.getenv`'s signature; injected for tests.
|
|
322
|
-
#' @param default_file the file read when
|
|
323
|
-
#' @param default_dir the system layer when
|
|
322
|
+
#' @param default_file the file read when BEATRINA_PLUGIN_POLICY is unset, if it exists.
|
|
323
|
+
#' @param default_dir the system layer when BEATRINA_PLUGIN_DIR is unset, if it exists.
|
|
324
324
|
#' @return list(set, source, install, sources, network, kinds, unknown, note,
|
|
325
325
|
#' system_dir, errors). `kinds` is the permitted kinds — every kind when
|
|
326
326
|
#' unset. `sources` is the permitted hosts; `network` FALSE when none may
|
|
@@ -329,7 +329,7 @@ plugin_default_hosts <- function() {
|
|
|
329
329
|
#' Three states, as in ai-policy.R: names nothing → everything; names
|
|
330
330
|
#' something valid → exactly that; names ONLY junk → an error, because an
|
|
331
331
|
#' empty allow-list that fails open is the bug the AI policy suite caught.
|
|
332
|
-
|
|
332
|
+
beatrina_plugin_policy <- function(env = Sys.getenv, default_file = PLUGIN_POLICY_DEFAULT_FILE,
|
|
333
333
|
default_dir = PLUGIN_SYSTEM_DEFAULT_DIR) {
|
|
334
334
|
errors <- character(0)
|
|
335
335
|
source <- ""
|
|
@@ -337,19 +337,19 @@ carmar_plugin_policy <- function(env = Sys.getenv, default_file = PLUGIN_POLICY_
|
|
|
337
337
|
sources_raw <- NULL
|
|
338
338
|
kinds_raw <- NULL
|
|
339
339
|
note <- ""
|
|
340
|
-
system_dir <- trimws(env("
|
|
340
|
+
system_dir <- trimws(env("BEATRINA_PLUGIN_DIR", ""))
|
|
341
341
|
if (!nzchar(system_dir) && nzchar(default_dir) && dir.exists(default_dir)) system_dir <- default_dir
|
|
342
342
|
|
|
343
|
-
path <- trimws(env("
|
|
343
|
+
path <- trimws(env("BEATRINA_PLUGIN_POLICY", ""))
|
|
344
344
|
if (!nzchar(path) && nzchar(default_file) && file.exists(default_file)) path <- default_file
|
|
345
345
|
if (nzchar(path)) {
|
|
346
346
|
source <- path
|
|
347
347
|
if (!file.exists(path)) {
|
|
348
|
-
errors <- c(errors, paste0("
|
|
348
|
+
errors <- c(errors, paste0("BEATRINA_PLUGIN_POLICY names a file that does not exist: ", path))
|
|
349
349
|
} else {
|
|
350
350
|
doc <- tryCatch(jsonlite::fromJSON(path, simplifyVector = TRUE), error = function(e) e)
|
|
351
351
|
if (inherits(doc, "error")) {
|
|
352
|
-
errors <- c(errors, paste0("
|
|
352
|
+
errors <- c(errors, paste0("BEATRINA_PLUGIN_POLICY is not valid JSON: ", conditionMessage(doc)))
|
|
353
353
|
} else {
|
|
354
354
|
install <- trimws(as.character(doc$install %||% "")[1] %||% "")
|
|
355
355
|
if (!is.null(doc$sources)) sources_raw <- as.character(unlist(doc$sources))
|
|
@@ -362,9 +362,9 @@ carmar_plugin_policy <- function(env = Sys.getenv, default_file = PLUGIN_POLICY_
|
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
} else {
|
|
365
|
-
if (nzchar(env("
|
|
366
|
-
if (nzchar(env("
|
|
367
|
-
if (nzchar(env("
|
|
365
|
+
if (nzchar(env("BEATRINA_PLUGIN_INSTALL", ""))) { source <- "env"; install <- trimws(env("BEATRINA_PLUGIN_INSTALL", "")) }
|
|
366
|
+
if (nzchar(env("BEATRINA_PLUGIN_SOURCES", ""))) { source <- "env"; sources_raw <- policy_split(env("BEATRINA_PLUGIN_SOURCES", "")) }
|
|
367
|
+
if (nzchar(env("BEATRINA_PLUGIN_KINDS", ""))) { source <- "env"; kinds_raw <- policy_split(env("BEATRINA_PLUGIN_KINDS", "")) }
|
|
368
368
|
}
|
|
369
369
|
|
|
370
370
|
if (!nzchar(install)) install <- "user"
|
|
@@ -417,17 +417,17 @@ carmar_plugin_policy <- function(env = Sys.getenv, default_file = PLUGIN_POLICY_
|
|
|
417
417
|
#' The sentence shown when the policy refuses something.
|
|
418
418
|
plugin_policy_reason <- function(policy, what = "install") {
|
|
419
419
|
base <- switch(what,
|
|
420
|
-
install = "This
|
|
421
|
-
network = "This
|
|
422
|
-
host = sprintf("This
|
|
423
|
-
kind = "This
|
|
424
|
-
"This
|
|
420
|
+
install = "This Beatrina is configured so that plugins are not installed by users; the set is fixed by the deployment.",
|
|
421
|
+
network = "This Beatrina is configured to fetch no plugins from the network; a plugin arrives as a file.",
|
|
422
|
+
host = sprintf("This Beatrina is configured to fetch plugins only from: %s.", paste(policy$sources, collapse = ", ")),
|
|
423
|
+
kind = "This Beatrina is configured without that plugin kind.",
|
|
424
|
+
"This Beatrina's plugin policy refuses that.")
|
|
425
425
|
if (nzchar(policy$note)) paste(base, policy$note) else base
|
|
426
426
|
}
|
|
427
427
|
|
|
428
428
|
# ── layers and paths ─────────────────────────────────────────────────────────
|
|
429
429
|
|
|
430
|
-
plugin_user_dir <- function() file.path(tools::R_user_dir("
|
|
430
|
+
plugin_user_dir <- function() file.path(tools::R_user_dir("beatrina", "data"), "plugins")
|
|
431
431
|
|
|
432
432
|
#' The layers, in precedence order. The user layer is absent under
|
|
433
433
|
#' `install: none` — not read-only, ABSENT, because "the set is fixed by the
|