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.
Files changed (111) hide show
  1. package/NOTICES +1 -1
  2. package/README.md +6 -0
  3. package/beatrina_V0.9.43.html +1885 -0
  4. package/beatrina_V0.9.43.html.inputs.json +1 -0
  5. package/bin/beatrina.mjs +152 -24
  6. package/bin/browser.mjs +31 -0
  7. package/bin/cli.mjs +64 -5
  8. package/bin/doctor-rows.mjs +31 -0
  9. package/bin/failsafe.mjs +8 -3
  10. package/bin/finder.mjs +74 -0
  11. package/bin/lsquery.swift +55 -0
  12. package/bin/pages.mjs +81 -0
  13. package/bin/python-setup.mjs +207 -0
  14. package/bin/runtime-dirs.mjs +27 -0
  15. package/bin/sessions.mjs +30 -10
  16. package/bin/shortcut.mjs +250 -42
  17. package/bin/update-check.mjs +2 -2
  18. package/build-info.json +1 -1
  19. package/engines/js/worker.mjs +6 -3
  20. package/engines/python/adapter.py +14 -13
  21. package/engines/python/analyze.py +4 -2
  22. package/engines/python/bootstrap.py +32 -31
  23. package/engines/python/debugger.py +10 -6
  24. package/engines/python/engine.json +1 -1
  25. package/engines/python/handoff.py +4 -2
  26. package/engines/python/worker.py +39 -10
  27. package/engines/r/engine.json +1 -1
  28. package/engines/r/handoff.R +4 -3
  29. package/failsafe/ai-policy.R +16 -16
  30. package/failsafe/ai-store.R +6 -6
  31. package/failsafe/cite.R +11 -11
  32. package/failsafe/journal.R +11 -11
  33. package/failsafe/plugins.R +27 -27
  34. package/failsafe/serve.R +241 -241
  35. package/host/ai-authority.mjs +55 -0
  36. package/host/ai-policy.mjs +48 -26
  37. package/host/bundle.mjs +194 -0
  38. package/host/deployment.mjs +25 -18
  39. package/host/engine-js.mjs +12 -17
  40. package/host/engine-pool.mjs +48 -6
  41. package/host/engine-python.mjs +80 -31
  42. package/host/engine-r.mjs +20 -21
  43. package/host/engine-stdio.mjs +35 -10
  44. package/host/env-names.mjs +148 -0
  45. package/host/gateway-token.mjs +51 -0
  46. package/host/journal-store.mjs +10 -9
  47. package/host/main.mjs +193 -77
  48. package/host/payload.mjs +131 -0
  49. package/host/planes/README.md +1 -1
  50. package/host/planes/ai-store.mjs +6 -5
  51. package/host/planes/ai.mjs +49 -29
  52. package/host/planes/analyze.mjs +6 -5
  53. package/host/planes/bundle.mjs +344 -0
  54. package/host/planes/choose.mjs +404 -0
  55. package/host/planes/cite.mjs +18 -17
  56. package/host/planes/files.mjs +0 -0
  57. package/host/planes/jobs.mjs +43 -20
  58. package/host/planes/latex.mjs +15 -5
  59. package/host/planes/mcp.mjs +80 -91
  60. package/host/planes/pair.mjs +24 -24
  61. package/host/planes/pipe-term.mjs +2 -2
  62. package/host/planes/plugins.mjs +1 -1
  63. package/host/planes/recent-documents.mjs +170 -0
  64. package/host/planes/sessions.mjs +226 -82
  65. package/host/planes/settings.mjs +4 -4
  66. package/host/planes/terminal.mjs +13 -11
  67. package/host/planes/test-file.mjs +2 -2
  68. package/host/planes/update.mjs +6 -13
  69. package/host/plugin-store.mjs +35 -52
  70. package/host/recent-documents.mjs +124 -0
  71. package/host/runtime-dir.mjs +47 -0
  72. package/host/server.mjs +75 -18
  73. package/host/session-keep.mjs +1 -1
  74. package/host/settings.mjs +85 -37
  75. package/host/update-record.mjs +3 -2
  76. package/host/user-dirs.mjs +60 -18
  77. package/host/which.mjs +39 -0
  78. package/host/windows-runtime.mjs +6 -3
  79. package/host/worker-plane.mjs +34 -6
  80. package/host/ws.mjs +9 -2
  81. package/host/zip.mjs +237 -0
  82. package/kernel/analyze.R +1 -1
  83. package/{check → kernel/check}/acceptance.mjs +1 -1
  84. package/kernel/check/knit-file.mjs +19639 -0
  85. package/{check → kernel/check}/session.mjs +49 -8
  86. package/kernel/deployment.R +20 -20
  87. package/kernel/examples/NOTICE.md +1 -1
  88. package/kernel/fileio.R +6 -6
  89. package/kernel/index.html +2 -2
  90. package/kernel/job-run.R +83 -22
  91. package/kernel/jobs.R +28 -12
  92. package/kernel/kernel-version +1 -1
  93. package/kernel/kernel.R +18 -18
  94. package/kernel/knitr-run.R +50 -9
  95. package/kernel/latex.R +128 -30
  96. package/kernel/mcp/{carmar-mcp.mjs → beatrina-mcp.mjs} +249 -59
  97. package/kernel/notebook-page.R +7 -7
  98. package/kernel/project.R +10 -10
  99. package/kernel/settings.R +105 -56
  100. package/kernel/sniff.R +4 -4
  101. package/kernel/typst.R +121 -0
  102. package/kernel/worker.R +522 -119
  103. package/kernel/workspace-keep.R +3 -3
  104. package/lib/agent-authoring-contract.js +28 -19
  105. package/lib/cell-kinds.js +3 -3
  106. package/lib/engine-labels.js +4 -4
  107. package/menu/Beatrina Menu.app/Contents/Info.plist +14 -0
  108. package/menu/Beatrina Menu.app/Contents/MacOS/Beatrina Menu +0 -0
  109. package/menu/Beatrina Menu.app/Contents/_CodeSignature/CodeResources +115 -0
  110. package/package.json +4 -3
  111. package/carmar_V0.8.7.html +0 -1522
@@ -16,8 +16,8 @@
16
16
  #
17
17
  # ── where plugins live: three layers, like .libPaths() ──────────────────────
18
18
  #
19
- # user R_user_dir("carmar","data")/plugins/<kind>/<id>/ the person's own; the ONLY layer written
20
- # system $CARMAR_PLUGIN_DIR/<kind>/<id>/ an administrator's set, read-only
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
- # CARMAR_PLUGIN_POLICY=/etc/carmar/plugin-policy.json the file (wins where both are set)
52
- # CARMAR_PLUGIN_DIR=/opt/carmar/plugins the system layer
53
- # CARMAR_PLUGIN_INSTALL=user|none may the person install? (default user)
54
- # CARMAR_PLUGIN_SOURCES=host,host|none hosts a URL/registry install may fetch from
55
- # CARMAR_PLUGIN_KINDS=csl,theme which kinds exist at all
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". `carmar_plugin_policy()` is
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/carmar/plugin-policy.json"
76
- PLUGIN_SYSTEM_DEFAULT_DIR <- "/etc/carmar/plugins"
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 CarmaR runs (the kernel
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 CARMAR_PLUGIN_POLICY is unset, if it exists.
323
- #' @param default_dir the system layer when CARMAR_PLUGIN_DIR is unset, if it exists.
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
- carmar_plugin_policy <- function(env = Sys.getenv, default_file = PLUGIN_POLICY_DEFAULT_FILE,
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("CARMAR_PLUGIN_DIR", ""))
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("CARMAR_PLUGIN_POLICY", ""))
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("CARMAR_PLUGIN_POLICY names a file that does not exist: ", path))
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("CARMAR_PLUGIN_POLICY is not valid JSON: ", conditionMessage(doc)))
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("CARMAR_PLUGIN_INSTALL", ""))) { source <- "env"; install <- trimws(env("CARMAR_PLUGIN_INSTALL", "")) }
366
- if (nzchar(env("CARMAR_PLUGIN_SOURCES", ""))) { source <- "env"; sources_raw <- policy_split(env("CARMAR_PLUGIN_SOURCES", "")) }
367
- if (nzchar(env("CARMAR_PLUGIN_KINDS", ""))) { source <- "env"; kinds_raw <- policy_split(env("CARMAR_PLUGIN_KINDS", "")) }
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 CarmaR is configured so that plugins are not installed by users; the set is fixed by the deployment.",
421
- network = "This CarmaR is configured to fetch no plugins from the network; a plugin arrives as a file.",
422
- host = sprintf("This CarmaR is configured to fetch plugins only from: %s.", paste(policy$sources, collapse = ", ")),
423
- kind = "This CarmaR is configured without that plugin kind.",
424
- "This CarmaR's plugin policy refuses that.")
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("carmar", "data"), "plugins")
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