pico-engine 1.9.3 → 1.9.5

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 (86) hide show
  1. package/README.md +2 -0
  2. package/demos/bootstrap/README.md +12 -0
  3. package/demos/bootstrap/com.example.visitors.bootstrap.krl +97 -0
  4. package/demos/bootstrap/com.example.visitors.format.krl +25 -0
  5. package/demos/bootstrap/com.example.visitors.krl +228 -0
  6. package/demos/bootstrap/try-it.md +5 -0
  7. package/demos/child_tasks/README.md +12 -0
  8. package/demos/child_tasks/com.example.task_runner.bootstrap.krl +85 -0
  9. package/demos/child_tasks/com.example.task_runner.krl +139 -0
  10. package/demos/child_tasks/com.example.task_worker.krl +45 -0
  11. package/demos/child_tasks/try-it.md +5 -0
  12. package/demos/collection/README.md +13 -0
  13. package/demos/collection/com.example.collection.bootstrap.krl +148 -0
  14. package/demos/collection/com.example.collection.krl +95 -0
  15. package/demos/collection/com.example.collection.report.krl +93 -0
  16. package/demos/collection/com.example.collection.room.krl +101 -0
  17. package/demos/collection/try-it.md +6 -0
  18. package/demos/echo/README.md +11 -0
  19. package/demos/echo/com.example.echo.bootstrap.krl +81 -0
  20. package/demos/echo/com.example.echo.krl +73 -0
  21. package/demos/echo/try-it.md +5 -0
  22. package/demos/guard_rules/README.md +12 -0
  23. package/demos/guard_rules/com.example.archive.bootstrap.krl +95 -0
  24. package/demos/guard_rules/com.example.archive.krl +213 -0
  25. package/demos/guard_rules/com.example.archive_store.krl +36 -0
  26. package/demos/guard_rules/try-it.md +5 -0
  27. package/demos/kblog/README.md +14 -0
  28. package/demos/kblog/com.example.kblog.bootstrap.krl +132 -0
  29. package/demos/kblog/com.example.kblog.config.krl +50 -0
  30. package/demos/kblog/com.example.kblog.data.krl +75 -0
  31. package/demos/kblog/com.example.kblog.krl +184 -0
  32. package/demos/kblog/com.example.kblog.posting.krl +109 -0
  33. package/demos/kblog/try-it.md +6 -0
  34. package/demos/layered_rulesets/README.md +13 -0
  35. package/demos/layered_rulesets/com.example.invitations.bootstrap.krl +84 -0
  36. package/demos/layered_rulesets/com.example.invitations.krl +164 -0
  37. package/demos/layered_rulesets/com.example.invitations.short_links.krl +45 -0
  38. package/demos/layered_rulesets/com.example.invitations.welcome.krl +39 -0
  39. package/demos/layered_rulesets/try-it.md +5 -0
  40. package/demos/moving_picos/README.md +15 -0
  41. package/demos/moving_picos/io.picolabs.club_gear_demo.krl +650 -0
  42. package/demos/moving_picos/io.picolabs.ride_coordinator_demo.krl +331 -0
  43. package/demos/score_tracker/README.md +11 -0
  44. package/demos/score_tracker/com.example.score_tracker.bootstrap.krl +104 -0
  45. package/demos/score_tracker/com.example.score_tracker.krl +162 -0
  46. package/demos/score_tracker/try-it.md +5 -0
  47. package/demos/secrets/README.md +12 -0
  48. package/demos/secrets/com.example.hook_service.krl +120 -0
  49. package/demos/secrets/com.example.notifier.bootstrap.krl +127 -0
  50. package/demos/secrets/com.example.notifier.krl +138 -0
  51. package/demos/secrets/try-it.md +5 -0
  52. package/demos/try-it-order.json +1 -0
  53. package/demos/two_picos/README.md +12 -0
  54. package/demos/two_picos/com.example.two_picos.answerer.krl +125 -0
  55. package/demos/two_picos/com.example.two_picos.asker.krl +124 -0
  56. package/demos/two_picos/com.example.two_picos.bootstrap.krl +131 -0
  57. package/demos/two_picos/try-it.md +5 -0
  58. package/demos/xmlui/README.md +17 -0
  59. package/demos/xmlui/com.example.contacts.krl +132 -0
  60. package/demos/xmlui/com.example.fav_color.krl +39 -0
  61. package/demos/xmlui/com.example.guestbook.krl +61 -0
  62. package/demos/xmlui/com.example.hello.krl +19 -0
  63. package/demos/xmlui/com.example.temperature_sensors_view.krl +105 -0
  64. package/demos/xmlui/com.example.thermostat.bootstrap.krl +92 -0
  65. package/demos/xmlui/com.example.thermostat.krl +124 -0
  66. package/demos/xmlui/temperature_sensors.krl +56 -0
  67. package/demos/xmlui/try-it.md +5 -0
  68. package/dist/bundledKrl.js +97 -12
  69. package/dist/cli.js +2 -0
  70. package/dist/engineConfig.js +19 -0
  71. package/dist/index.js +1 -0
  72. package/dist/server.js +18 -4
  73. package/dist/xmluiRuntime.js +28 -9
  74. package/krl/io.picolabs.xmlui.krl +149 -1
  75. package/mcp/docs/CLAUDE.md +3 -2
  76. package/mcp/docs/pico-engine.md +3 -0
  77. package/package.json +9 -6
  78. package/public/.DS_Store +0 -0
  79. package/public/pico-engine-ui.css +1 -1
  80. package/public/pico-engine-ui.js +23 -22
  81. package/src/bundledKrl.ts +118 -12
  82. package/src/cli.ts +2 -0
  83. package/src/engineConfig.ts +28 -0
  84. package/src/index.ts +8 -0
  85. package/src/server.ts +20 -5
  86. package/src/xmluiRuntime.ts +32 -9
@@ -28,7 +28,7 @@ Engine and wrangler stay **domain-agnostic**. If a change needs the words "owner
28
28
  | `docs/design/` | Design docs (schemas, identity, move, relationships, harness) |
29
29
  | `docs/release/` | Per-release plans (`1.8.md`) and notes (`1.7.0.md`) |
30
30
  | `MEMORY.md` | Long-running working log: roadmap, decisions, gotchas. Source of truth for *why*; skim the TOC |
31
- | `test-rulesets/`, `demos/` | KRL used by tests and demos |
31
+ | `test-rulesets/`, `demos/` | KRL used by tests and demos. Each `demos/<name>/` has a README; its overview and instructions are in `docs/cookbook/<name>/` |
32
32
 
33
33
  Sibling repos (same org, not in this tree): `manifold-api` (Manifold KRL), `sensor-network`, `MCPforEXP`, `pico-framework` (lifecycle/channels/LevelDB; engine depends on `^0.8.2` for 1.8 policy ceiling).
34
34
 
@@ -72,7 +72,7 @@ rule name {
72
72
  | `raise wrangler event "child_deletion_request" attributes {"eci": picoId}` | legacy `wrangler child_deletion` with `{"id": …}` (never runs) |
73
73
  | `wrangler:picoQuery` (works over family channels) | `wrangler:skyQuery` (deprecated; HTTP blocked on family channels) |
74
74
 
75
- Also: `if X then noop(); fired { … }` runs `fired` when X is **true**. Rules in one ruleset selecting the same event run in **rule-name lexicographic order**; across rulesets the order is undefined. A stray character after `meta { }` silently prevents registration — if a ruleset never seems to run, check it actually loaded.
75
+ Also: `if X then noop(); fired { … }` runs `fired` when X is **true**. Rules in one ruleset selecting the same event run in **source order** (the order they're written), and `last` stops only the rest of that ruleset; across rulesets the order is undefined. A stray character after `meta { }` silently prevents registration — if a ruleset never seems to run, check it actually loaded.
76
76
 
77
77
  Terminology: **relationships** (1.6.2+; "subscriptions" in older code and docs). Channels have **ECIs** and **policies**; policy is the authorization gate. Every pico has a `discovery` channel.
78
78
 
@@ -80,6 +80,7 @@ Terminology: **relationships** (1.6.2+; "subscriptions" in older code and docs).
80
80
 
81
81
  - Design before code for anything touching identity, policy, schema, or the Sky API: add or update a doc in `docs/design/` and link it from `MEMORY.md`.
82
82
  - Keep `MEMORY.md` current when you learn an engine behavior the hard way; it is what future sessions read.
83
+ - View markup in KRL heredocs: put `<Component …>` on its own line after `<<`, not `<<<Component`. XMLUI accepts the leading newline.
83
84
  - Don't commit or publish; leave that to the maintainer. `npm run publish` builds and publishes every package — never run it.
84
85
  - Tests are ava, serial for engine suites (`--serial`, 2–3 min timeouts). Add a focused `test:*` script when you add a suite.
85
86
  - UI changes need `npm run build` (repo root) or `npm run dev` in `pico-engine-ui` or they won't appear in `public/`.
@@ -81,6 +81,7 @@ Example templates: [`config.example.json`](../../config.example.json), [`config.
81
81
  | `logToStdout` | boolean | Log to stdout instead of a file. Use on Fargate (set `logToStdout: true` in config). |
82
82
  | `logFile` | string | Absolute log path when `logToStdout` is false. Values `stdout`, `-`, or `0` force stdout. |
83
83
  | `logMirror` | boolean | When **`logToStdout`** is true: also write structured JSON lines to **`$PICO_ENGINE_HOME/pico-engine.log`** for operators. Default **`true`**. Set **`false`** on EFS + Fargate to avoid mirror-file churn (then use CloudWatch from stdout, or set **`logFile`** to a writable path). The Developer UI **Logging** tab reads an in-memory ring and does not need this file. **Env:** `PICO_ENGINE_LOG_MIRROR` (`true`/`1` / `false`/`0`). |
84
+ | `show_tryit_menu` | string | Where the Developer UI shows the **Try It!** tab: **`off`** (nowhere, and `/api/try-it` lists no demos), **`root_only`** (the root pico only), or **`all`** (every pico). Default **`root_only`**. **Env:** `PICO_ENGINE_SHOW_TRYIT_MENU`. |
84
85
  | `defaultRootPolicyCeiling` | object | Max channel policy for new root picos (`eventPolicy` / `queryPolicy`). See policy example file. |
85
86
  | `globalEventDeny` | array | Extra deny rules applied on **every** ECI before channel policy (e.g. block `engine:secret_ping`). |
86
87
  | `globalQueryDeny` | array | Same for queries. |
@@ -105,6 +106,8 @@ These env overrides cover config path, data dir, port, public URL, and a few log
105
106
  | `PICO_ENGINE_LOG_FILE` | Log file path, or `stdout` / `-` / `0` / empty for stdout-only |
106
107
  | `PICO_ENGINE_LOG_MIRROR` | When stdout-only: `false` / `0` disables writing `$PICO_ENGINE_HOME/pico-engine.log` (config: **`logMirror`**). The Logging tab does not read that file |
107
108
  | `PICO_ENGINE_LOG_RING` | How many recent transactions per pico the Logging tab keeps in memory. Default **200**. A restart clears the ring |
109
+ | `PICO_ENGINE_SHOW_TRYIT_MENU` | `off`, `root_only` (default), or `all`: where the Developer UI shows the **Try It!** tab (config: **`show_tryit_menu`**) |
110
+ | `PICO_ENGINE_DEMOS_DIR` | A directory to serve as `demos/` (at `/krl/demos/`) instead of the copy shipped with the engine, such as the `demos/` folder of a pico-engine checkout you're editing |
108
111
 
109
112
  ---
110
113
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pico-engine",
3
- "version": "1.9.3",
3
+ "version": "1.9.5",
4
4
  "description": "Node.js runtime for picos: persistent actors with their own identity, state, and channels that communicate by events and queries. Behavior is written in KRL. Includes an MCP server so AI coding assistants can inspect and drive a running engine.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,6 +30,7 @@
30
30
  ],
31
31
  "files": [
32
32
  "bin",
33
+ "demos",
33
34
  "public",
34
35
  "src",
35
36
  "krl",
@@ -45,7 +46,8 @@
45
46
  },
46
47
  "scripts": {
47
48
  "build": "rm -rf dist && tsc",
48
- "prepack": "node scripts/bundle-docs.js",
49
+ "prepack": "node scripts/bundle-docs.js && node scripts/bundle-demos.js",
50
+ "postpack": "node scripts/bundle-demos.js --clean",
49
51
  "start": "npm run dev -s",
50
52
  "dev": "scriptsp -r dev:tsc dev:api",
51
53
  "dev:tsc": "tsc -w --preserveWatchOutput",
@@ -77,7 +79,8 @@
77
79
  "test:relationship-lifecycle": "ava reset-cache && ava --serial ./test/relationshipLifecycle.ts --timeout=2m",
78
80
  "test:epic9": "ava reset-cache && ava --serial ./test/epic9Matrix.ts --timeout=3m",
79
81
  "test:peer-did4": "ava reset-cache && ava --serial ./test/peerDid4.ts --timeout=2m",
80
- "test:views": "ava reset-cache && ava --serial ./test/xmluiSpike.ts ./test/xmluiRoutes.ts ./test/xmluiLauncher.ts ./test/xmluiConfig.ts ./test/xmluiViewSchema.ts ./test/xmluiViewPolicy.ts ./test/xmluiViewsOAuth.ts ./test/xmluiS2Demos.ts --timeout=2m",
82
+ "test:views": "ava reset-cache && ava --serial ./test/xmluiSpike.ts ./test/xmluiRoutes.ts ./test/xmluiLauncher.ts ./test/xmluiConfig.ts ./test/xmluiViewSchema.ts ./test/xmluiViewPolicy.ts ./test/xmluiViewsOAuth.ts ./test/xmluiS2Demos.ts ./test/xmluiComponents.ts --timeout=2m",
83
+ "test:try-it": "ava reset-cache && ava --serial ./test/tryIt.ts ./test/tryItDemos.ts --timeout=2m",
81
84
  "vendor:xmlui": "node scripts/copy-xmlui-runtime.mjs"
82
85
  },
83
86
  "dependencies": {
@@ -103,13 +106,13 @@
103
106
  "express": "^4.16.4",
104
107
  "helmet": "^7.1.0",
105
108
  "home-dir": "^1.0.0",
106
- "krl-compiler": "^1.9.0",
109
+ "krl-compiler": "^1.9.4",
107
110
  "krl-stdlib": "^1.9.0",
108
111
  "level-json-coerce-null": "^1.0.1",
109
112
  "lodash": "^4.17.11",
110
113
  "make-dir": "^4.0.0",
111
114
  "minimist": "^1.2.5",
112
- "pico-engine-core": "^1.9.0",
115
+ "pico-engine-core": "^1.9.4",
113
116
  "pico-framework": "^0.8.2",
114
117
  "rotating-file-stream": "^1.4.1",
115
118
  "zod": "^3.25.76"
@@ -140,5 +143,5 @@
140
143
  "!test/helpers/**/*"
141
144
  ]
142
145
  },
143
- "gitHead": "e7b5699ce223e802b8d2b68f78f3a87bd369b273"
146
+ "gitHead": "86e860664bb60d22c76656bc7c93b14d878405e1"
144
147
  }
Binary file