@chanlerdev/scorel 0.0.4 → 0.0.6

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.
@@ -0,0 +1,112 @@
1
+ # S0107: System Reminder Unification
2
+
3
+ ## Goal
4
+
5
+ Unify how Scorel represents, persists, projects, and displays system reminders.
6
+
7
+ The business value is prompt and transcript hygiene: runtime guidance should reach the model through one stable contract, without ad-hoc `<system-reminder>` string construction scattered across daemon, session replay, tool-result merge paths, or future context-control features. UI should consistently hide or display reminder evidence based on explicit visibility, not by parsing model-facing text.
8
+
9
+ ## Scope
10
+
11
+ ### Reminder Source Model
12
+
13
+ Define one internal reminder representation for model-facing non-user guidance.
14
+
15
+ Current sources include:
16
+
17
+ - `harness_item` events such as memory, channel context, skill listing, skill delta, and steer.
18
+ - Compact summary messages.
19
+ - Model-only metadata attached to a specific `user_message`, such as `snip.userMessageId`.
20
+ - Future runtime guidance that should be visible to the model but not necessarily displayed as transcript text.
21
+
22
+ The new contract must preserve the existing product distinction:
23
+
24
+ - Some reminders are standalone session events (`harness_item`).
25
+ - Some reminders are attached to a specific message to preserve prompt-cache prefix stability.
26
+ - Some reminders can merge into a previous `tool_result`.
27
+
28
+ ### Single Renderer
29
+
30
+ Move `<system-reminder>` wrapping behind a single public core helper or equivalent abstraction. Callers should provide reminder content and placement intent, not hand-write:
31
+
32
+ ```text
33
+ <system-reminder>
34
+ ...
35
+ </system-reminder>
36
+ ```
37
+
38
+ The renderer must keep the existing prompt contract:
39
+
40
+ ```text
41
+ <system-reminder>
42
+ content
43
+ </system-reminder>
44
+ ```
45
+
46
+ Any future format change must happen in one place.
47
+
48
+ ### Visibility And Projection
49
+
50
+ Clarify and consolidate visibility semantics:
51
+
52
+ - `harness_item.visibility` controls whether the harness event is displayed as transcript evidence.
53
+ - Message-level model-only blocks are included in LLM context but hidden from WebUI and GUI transcript projection.
54
+ - Display projectors must not parse `<system-reminder>` text to decide visibility.
55
+ - Provider adapters should receive already-rendered model-facing text or a normalized reminder block from core, not duplicate reminder formatting.
56
+
57
+ ### Prompt Cache Stability
58
+
59
+ Reminder placement must not rewrite older model context on later turns.
60
+
61
+ For reminders attached to a specific persisted message, the model-facing block must be created when that message is persisted. Later `buildContext()` calls may clone or filter it, but must not mutate historical messages based on later session state.
62
+
63
+ ## Not In Scope
64
+
65
+ - Changing snip semantics from S0106.
66
+ - Replacing `harness_item` with a new event type unless the implementation proves the existing event cannot express the contract.
67
+ - Changing provider-level system prompt assembly.
68
+ - UI controls for browsing hidden reminders.
69
+ - Backfilling or migrating old session JSONL files.
70
+ - Renaming `<system-reminder>` in the model-facing prompt.
71
+
72
+ ## Acceptance Criteria
73
+
74
+ - No daemon or feature code hand-writes `<system-reminder>` strings.
75
+ - `buildContext()` uses the shared reminder renderer for `harness_item` and compact summaries.
76
+ - Snip's model-only user-message id block uses the shared reminder renderer or normalized reminder block.
77
+ - WebUI and GUI hide model-only message blocks without parsing reminder text.
78
+ - Existing harness visibility behavior stays intact:
79
+ - hidden harness items do not render as visible turns;
80
+ - display harness items still render as lightweight transcript evidence.
81
+ - Prompt-cache stability is preserved for message-attached reminders: replaying the same persisted user message in later provider calls produces the same content.
82
+ - Provider adapters do not own system-reminder formatting rules.
83
+ - `pnpm typecheck && pnpm test` passes.
84
+
85
+ ## Testing Requirements
86
+
87
+ - Core session tests for the shared reminder renderer and `buildContext()` conversion.
88
+ - Daemon embedded test proving snip's message-attached reminder remains stable across later turns.
89
+ - WebUI and GUI projector tests proving model-only blocks are hidden while display harness items remain visible.
90
+ - Regression test or static check that common runtime paths no longer hand-write `<system-reminder>` literals outside the shared renderer and tests/docs.
91
+
92
+ ## Impacted Files
93
+
94
+ - `packages/core/src/session/index.ts`
95
+ - `packages/core/src/session/session.test.ts`
96
+ - `packages/core/src/tools/index.ts` or a new core reminder module
97
+ - `packages/daemon/src/index.ts`
98
+ - `packages/daemon/src/embedded/embedded.test.ts`
99
+ - `apps/webui/lib/events/projector.ts`
100
+ - `apps/webui/lib/events/projector.test.ts`
101
+ - `apps/gui/src/renderer/chatbox/projector.ts`
102
+ - `apps/gui/src/renderer/chatbox/projector.test.ts`
103
+ - `docs/spec/events.md`
104
+ - `docs/spec/session.md`
105
+ - `README.md`
106
+
107
+ ## Risks And Boundaries
108
+
109
+ - Reminder placement affects prompt-cache behavior. A cleanup that moves snip ids from persisted user messages into later dynamic `buildContext()` injection would regress S0106.
110
+ - Tool-result merge behavior is easy to break. The implementation must preserve valid assistant tool-call / tool-result replay.
111
+ - UI should use explicit visibility metadata, not text parsing. Parsing `<system-reminder>` in UI would make display behavior depend on prompt formatting.
112
+ - A broader content-block redesign may be attractive, but S0107 should stay focused on unifying reminder construction and projection.
@@ -0,0 +1,108 @@
1
+ # S0108: GUI Bundled CLI Runtime
2
+
3
+ ## Goal
4
+
5
+ Make the packaged desktop GUI self-contained for local Host startup.
6
+
7
+ The business value is that installing `Scorel.app` is enough to use the local GUI path. Users must not need a terminal-launched environment, a global `node`, a global `scorel`, or the source repository layout for GUI Settings and local Project workflows to work.
8
+
9
+ ## Scope
10
+
11
+ - Vendor the same-version public `scorel` CLI release artifact into the macOS GUI bundle.
12
+ - Make packaged GUI startup resolve the local Host launcher from the app bundle, not from `PATH`.
13
+ - Keep development startup convenient through the existing source CLI path.
14
+ - Remove the packaged-build requirement for `SCOREL_CLI_ENTRYPOINT`.
15
+ - Add release/package tests proving the GUI bundle contract references `Contents/Resources/scorel`.
16
+ - Add a regression test for Finder/Dock-like startup where `PATH` does not contain Node.
17
+
18
+ ## Not In Scope
19
+
20
+ - Publishing the GUI through npm.
21
+ - Replacing the CLI with a separate `scorel-host` binary.
22
+ - Changing `scorel host start` daemon lifecycle semantics.
23
+ - Changing the public CLI command surface.
24
+ - Adding LaunchAgent/login-item restart supervision.
25
+ - Supporting Windows/Linux GUI packaging in this spec.
26
+
27
+ ## Contract
28
+
29
+ The packaged macOS app contains:
30
+
31
+ ```text
32
+ Scorel.app
33
+ Contents/Resources/
34
+ scorel # launcher script
35
+ scorel.js # bundled CLI artifact
36
+ app.asar
37
+ ```
38
+
39
+ Packaged GUI starts the local singleton Host with the bundle-owned executable:
40
+
41
+ ```text
42
+ Contents/Resources/scorel host start --port 0 --cwd <bootstrap-project> --idle-timeout-ms <ms> --no-relay
43
+ ```
44
+
45
+ Development GUI may continue to use the source entrypoint:
46
+
47
+ ```text
48
+ node --import tsx apps/cli/src/index.ts host start ...
49
+ ```
50
+
51
+ The packaged path must not depend on:
52
+
53
+ - `node` being discoverable in `PATH`;
54
+ - `scorel` being globally installed;
55
+ - `SCOREL_NODE_PATH`;
56
+ - `SCOREL_CLI_ENTRYPOINT`;
57
+ - `apps/cli/src/index.ts` existing inside the app bundle.
58
+
59
+ ## Acceptance Criteria
60
+
61
+ - `apps/gui` Electron Builder config includes a generated `.runtime` directory containing `scorel` and `scorel.js` in `Contents/Resources`.
62
+ - The bundled `scorel` launcher uses the app's own Electron executable with `ELECTRON_RUN_AS_NODE=1` to run the built CLI artifact as `scorel.js`.
63
+ - Packaged GUI resolves the Host launcher to `process.resourcesPath/scorel`.
64
+ - Packaged GUI spawns `scorel` directly and does not prepend `node`, `tsx`, or source entrypoint args.
65
+ - Development GUI still supports `SCOREL_CLI_ENTRYPOINT` and `SCOREL_NODE_PATH` for local debugging.
66
+ - A unit test proves packaged Host startup uses the bundle CLI even with an empty/minimal `PATH`.
67
+ - Release tests prove the GUI package depends on the built CLI artifact and bundle destination.
68
+ - `docs/SHIP.md`, `docs/ROADMAP.md`, and `README.md` describe that GUI release assets include a bundled same-version CLI runtime.
69
+
70
+ ## Test Requirements
71
+
72
+ ```bash
73
+ pnpm --filter @scorel/app-gui test -- src/main/host-launcher.test.ts
74
+ node --test scripts/release-gui.test.mjs
75
+ pnpm --filter @scorel/app-gui build
76
+ pnpm build:package
77
+ git diff --check
78
+ ```
79
+
80
+ Full release readiness still uses:
81
+
82
+ ```bash
83
+ pnpm typecheck && pnpm test
84
+ pnpm release patch --dry-run
85
+ ```
86
+
87
+ ## Impacted Files
88
+
89
+ - `apps/gui/package.json`
90
+ - `apps/gui/src/main.ts`
91
+ - `apps/gui/src/main/host-launcher.ts`
92
+ - `apps/gui/src/main/host-launcher.test.ts`
93
+ - `apps/gui/scripts/build-runtime.mjs`
94
+ - `apps/gui/scripts/build-runtime.node-test.mjs`
95
+ - `scripts/release-gui.test.mjs`
96
+ - `docs/SHIP.md`
97
+ - `docs/ROADMAP.md`
98
+ - `README.md`
99
+
100
+ ## Risks And Boundaries
101
+
102
+ - The vendored CLI must be built before `electron-builder` runs. Release flow already runs `pnpm build:package`; local `dist:mac` must do the same or fail clearly.
103
+ - The bundled CLI runs under Electron's Node mode. A fully native/self-contained CLI binary remains a possible future hardening step, but the packaged GUI no longer depends on user `PATH` for Node.
104
+ - The GUI must never call the user's global `scorel`, because that can drift from the GUI version and mutate the local Host contract.
105
+
106
+ ## Status
107
+
108
+ Active.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chanlerdev/scorel",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Replayable, recoverable, remotely controllable AI Agent workspace.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@11.1.2",