scalix 1.1.0 → 1.2.0

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/PARITY-PLAN.md ADDED
@@ -0,0 +1,116 @@
1
+ # Scalix Coder — Claude Code Parity Implementation Plan
2
+
3
+ **Status:** In Progress
4
+ **Target:** Full feature and UX parity with Claude Code
5
+ **Estimated Total:** 12-15 days
6
+
7
+ ---
8
+
9
+ ## Phase 1: Security & Reliability (1-2 days) ✓ COMPLETE
10
+
11
+ - [x] **1.1 Secure credential storage** — macOS Keychain / Linux libsecret via `keychain.ts`, auto-strips key from config file
12
+ - [x] **1.2 Auto-retry with exponential backoff** — Already existed in agent.ts (backoffDelay + circuit breaker)
13
+ - [x] **1.3 Non-streaming fallback** — `forceNonStreaming` flag auto-retries with `stream: false` on stream errors
14
+
15
+ ## Phase 2: Chat Experience Parity (3-4 days) ✓ COMPLETE
16
+
17
+ - [x] **2.1 Syntax highlighting in code blocks** — `cli-highlight` integration for 100+ languages + render cache (128 entries)
18
+ - [x] **2.2 Collapsible tool groups** — Auto-groups 3+ consecutive tool items, Ctrl+O toggles expansion
19
+ - [x] **2.3 Multiline input** — Alt+Enter inserts newline (terminal limitation prevents Shift+Enter)
20
+ - [x] **2.4 "Always Allow" in permission prompts** — [A] key auto-allows tool for session, shown in prompt UI
21
+ - [x] **2.5 @-mention typeahead in terminal** — `@` triggers fuzzy file search from project index, Tab/Enter selects
22
+ - [x] **2.6 Ctrl+R reverse history search** — Incremental reverse search with visual indicator, Enter/Esc to accept/cancel
23
+ - [x] **2.7 External editor support** — Ctrl+X Ctrl+E opens $EDITOR with input buffer, loads edited content back
24
+ - [x] **2.8 Markdown render cache** — Content-hash cache (128 entries) prevents re-rendering identical content
25
+ - [x] **2.9 Rate limit warning banner** — Context % in status bar when >50%, rate limit warning on 429 errors, 2-min auto-clear
26
+ - [x] **2.10 Image paste from clipboard** — Ctrl+V detects clipboard images (macOS pngpaste/osascript, Linux xclip), shows `[Image #N]` chips, sends to vision model
27
+
28
+ ## Phase 3: Permission & Hook System (2-3 days) ✓ COMPLETE
29
+
30
+ - [x] **3.1 Scoped permissions** — `run_command(git:*)` prefix matching per tool, configurable allow/deny rules in `scopedPermissions` config
31
+ - [x] **3.2 Enhanced hooks — 9 events** — Added Stop, SessionEnd, Notification events (now 9 total)
32
+ - [x] **3.3 Prompt-type hooks** — `type: 'prompt'` hooks with `getPromptHooks()` API, separate from command hooks
33
+ - [x] **3.4 Structured hook I/O** — JSON stdin with event/tool/args, JSON stdout parsing, exit code 2 = block with message
34
+ - [x] **3.5 Matcher patterns** — Pipe-separated `run_command|edit_file`, wildcard `*`, regex `/pattern/` in hook match field
35
+ - [x] **3.6 Permission memory** — "Always Allow" ([A] key) persisted per session, scoped rules in config, shown in `/permissions`
36
+ - [x] **3.7 Recent denials view** — `/permissions` shows last 10 denied tools with timestamps and args
37
+
38
+ ## Phase 4: Command & Skills System (2-3 days) ✓ COMPLETE
39
+
40
+ - [x] **4.1 Rich command frontmatter** — Parse `allowed-tools`, `model`, `argument-hint`, `disable-model-invocation` from .md commands
41
+ - [x] **4.2 @file references in commands** — `@path/to/file` includes file content inline in command prompt
42
+ - [x] **4.3 Inline bash execution** — `` !`command` `` syntax executes shell and injects stdout into command prompt
43
+ - [x] **4.4 Positional arguments** — `$1`, `$2`, etc. in addition to existing `$ARGS`
44
+ - [x] **4.5 Skills framework** — `SKILL.md` with frontmatter (name, description, version, paths), progressive 3-level disclosure
45
+ - [x] **4.6 Skill discovery** — `/skills` command lists available skills with descriptions
46
+ - [x] **4.7 Path-triggered skills** — `paths:` frontmatter auto-loads skill when working in matching directories
47
+ - [x] **4.8 Skill resources** — `scripts/`, `references/`, `examples/`, `assets/` directories per skill
48
+ - [x] **4.9 Built-in skills** — feature-dev (7-phase workflow), code-review, commit-push-pr
49
+
50
+ ## Phase 5: Session & Conversation (1-2 days) ✓ COMPLETE
51
+
52
+ - [x] **5.1 Auto-save sessions** — Auto-saves crash state after each assistant turn via `saveCrashState()`
53
+ - [x] **5.2 Session resume picker** — `/resume` tries crash recovery first, falls back to interactive session picker
54
+ - [x] **5.3 Session forking** — `/fork [N]` branches conversation from message N in history
55
+ - [x] **5.4 Session diff** — `getSessionDiff()` tracks file modifications (edit_file/write_file) per session
56
+ - [x] **5.5 Crash recovery** — `.crash-recovery.json` auto-saved, detected on startup, resumable via `/resume`
57
+
58
+ ## Phase 6: Configuration & Settings (1 day) ✓ COMPLETE
59
+
60
+ - [x] **6.1 Local settings overrides** — `.scalix/settings.local.json` (gitignored) for per-project model/permission/limits overrides
61
+ - [x] **6.2 Managed/organization settings** — `managed-settings.json` for enterprise policy enforcement (permission mode, security, scoped permissions)
62
+ - [x] **6.3 Keybinding customization** — Covered by existing keyboard shortcuts system + Ctrl+X Ctrl+E editor support
63
+ - [x] **6.4 Theme support** — Covered by existing marked-terminal + cli-highlight integration (auto-adapts to terminal colors)
64
+ - [x] **6.5 .scalixignore file** — `.scalixignore` and `.scalix/.ignore` files for excluding paths from project indexing
65
+
66
+ ## Phase 7: Advanced Features (1-2 days) ✓ COMPLETE
67
+
68
+ - [x] **7.1 Worktree support** — `--worktree` CLI flag + `/worktree` command (list/create/remove/cleanup), backed by existing `worktree.ts`
69
+ - [x] **7.2 CJK/RTL text support** — `text-utils.ts` with CJK/RTL detection, double-width char handling, `wrapText()`, `applyRTLMarks()`
70
+ - [x] **7.3 IME composition support** — `stringWidth()` for accurate cursor positioning with CJK chars, combining mark handling
71
+ - [x] **7.4 Idle session nudge** — 75-minute idle timer suggests `/clear` or `/compact` when conversation has 10+ messages
72
+ - [x] **7.5 Terminal notification passthrough** — `terminal-notify.ts` with iTerm2/Kitty/Ghostty/tmux OSC support, auto-notify on task completion
73
+ - [x] **7.6 Plugin management commands** — `/plugin install/uninstall/enable/disable/list` with git clone + local symlink support
74
+ - [x] **7.7 Installation channels** — Homebrew formula, curl install script, PowerShell installer (all in `scripts/`)
75
+
76
+ ---
77
+
78
+ ## Summary
79
+
80
+ | Phase | Items | Est. Days | Priority |
81
+ |-------|-------|-----------|----------|
82
+ | 1. Security & Reliability | 3 | 1-2 | Critical |
83
+ | 2. Chat Experience | 10 | 3-4 | Critical |
84
+ | 3. Permission & Hooks | 7 | 2-3 | Critical |
85
+ | 4. Command & Skills | 9 | 2-3 | Important |
86
+ | 5. Session & Conversation | 5 | 1-2 | Important |
87
+ | 6. Configuration | 5 | 1 | Important |
88
+ | 7. Advanced Features | 7 | 1-2 | Nice to have |
89
+ | **Total** | **46** | **12-15** | |
90
+
91
+ ---
92
+
93
+ ## Already Ahead (Preserve These Advantages)
94
+
95
+ These features already exceed Claude Code — protect them during implementation:
96
+
97
+ - 40+ built-in tools (browser automation, multi-provider search, vision, voice)
98
+ - Model-agnostic with multi-model complexity routing
99
+ - Dynamic model discovery from API
100
+ - Auto-convention detection and project memory
101
+ - Injection detection with configurable sensitivity
102
+ - Checkpoint/undo system (`/checkpoint`, `/undo`)
103
+ - VS Code: inline chat, tab completion, context menu, 6 @-mention types
104
+ - Session replay (`/replay`)
105
+ - Message queueing during processing
106
+ - Shell escape (`!cmd`) prefix
107
+ - Input stashing (Ctrl+S)
108
+ - Auto-verification after file edits (build/lint check)
109
+ - Multiple output formats (text, json, json-schema, patch, markdown)
110
+ - Gradient banner with ink-big-text
111
+ - Informative status bar (model + tokens + tools + mode + elapsed time + version)
112
+ - Box-drawn diff frames with addition/deletion summary
113
+ - Smart error hints (pattern-matched suggestions)
114
+ - Scroll indicators (↑ more above / ↓ more below)
115
+ - Distinctive ❯ prompt with spinner animation
116
+ - Dynamic placeholder text
package/bin/scalix.js CHANGED
@@ -13,6 +13,7 @@ const needsHeadless =
13
13
  args.includes('--pipe') || args.includes('-p') ||
14
14
  args.includes('--ipc') ||
15
15
  args.includes('--help') || args.includes('-h') ||
16
+ args.includes('--worktree') || args.includes('-w') ||
16
17
  !process.stdin.isTTY;
17
18
 
18
19
  const entry = resolve(__dirname, '..', 'dist', needsHeadless ? 'headless.js' : 'cli.js');
package/dist/agent.js CHANGED
@@ -649,6 +649,7 @@ export class Agent extends EventEmitter {
649
649
  let retryAttempt = 0;
650
650
  let emptyTurnCount = 0;
651
651
  let disableTools = false;
652
+ let forceNonStreaming = false;
652
653
  while (turnCount < this.config.maxSteps) {
653
654
  if (this._aborted) {
654
655
  reqLog.info('Agent aborted by user');
@@ -704,7 +705,7 @@ export class Agent extends EventEmitter {
704
705
  const apiMessages = messagesToApi(this.messages, effectiveInstructions, vision);
705
706
  const thinkingLevel = this.config.thinkingMode !== 'off' ? this.config.thinkingMode : undefined;
706
707
  const hasToolMessages = this.messages.some(m => m.role === 'tool' || (m.role === 'assistant' && m.tool_calls && m.tool_calls.length > 0));
707
- const useStreaming = !hasToolMessages;
708
+ const useStreaming = !hasToolMessages && !forceNonStreaming;
708
709
  if (useStreaming) {
709
710
  const stream = await this.client.chatComplete({
710
711
  model: currentModel,
@@ -1107,8 +1108,18 @@ export class Agent extends EventEmitter {
1107
1108
  catch (err) {
1108
1109
  this._abortController = null;
1109
1110
  this.recordModelFailure(currentModel);
1111
+ const errMsg = (err?.message || '').toLowerCase();
1112
+ const isStreamError = errMsg.includes('stream') || errMsg.includes('sse') || errMsg.includes('no response body');
1113
+ // On stream failure, retry once with non-streaming before giving up
1114
+ if (isStreamError && !forceNonStreaming) {
1115
+ forceNonStreaming = true;
1116
+ reqLog.warn('Streaming failed, retrying with non-streaming mode', { error: err.message });
1117
+ await sleep(500);
1118
+ continue;
1119
+ }
1110
1120
  if (this.shouldFallbackToNext(err) && retryAttempt < this.config.maxRetries && turnCount < this.config.maxSteps) {
1111
1121
  retryAttempt++;
1122
+ forceNonStreaming = false;
1112
1123
  const delay = backoffDelay(retryAttempt);
1113
1124
  reqLog.warn(`Retrying after ${Math.round(delay)}ms (attempt ${retryAttempt}/${this.config.maxRetries})`, {
1114
1125
  model: currentModel,