@felan-ai/felan 0.12.11 → 0.13.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/README.md CHANGED
@@ -7,380 +7,96 @@ Pi's interactive TUI.
7
7
  npx @felan-ai/felan
8
8
  ```
9
9
 
10
- The package exposes the `felan` binary. It stores model credentials, settings,
11
- sessions, agents, and runtime state under `~/.felan` by default; set
12
- `FELAN_AGENT_DIR` to select another directory. Use `/login` inside the TUI to
13
- configure provider-owned model credentials without a Felan account. Felan reads
14
- global settings from `~/.felan/settings.json` and does not load Pi project
15
- settings. Pi project trust does not apply to Felan's fixed resource policy, so
16
- Felan starts without a project trust prompt.
10
+ The package exposes the `felan` binary. It owns local credentials, settings,
11
+ session and agent storage paths, built-in extension selection, dependency
12
+ onboarding, lifecycle, and TUI presentation. Portable feature behavior remains
13
+ in the `@felan-ai/ext-*` packages.
17
14
 
18
- Local memory is enabled by default and works without a Felan account or cloud
19
- connection. It consolidates settled root-session evidence into an inspectable
20
- Markdown wiki. The canonical project store is outside the customer repository:
15
+ > [!IMPORTANT]
16
+ > The local host uses the current user's filesystem and process permissions. It
17
+ > is not a sandbox.
21
18
 
22
- ```text
23
- $FELAN_AGENT_DIR/memory/v1/projects/<project-hash>/
24
- state.json
25
- current/summary.md
26
- current/index.md
27
- current/pages/...
28
- ```
29
-
30
- The project hash is derived from the canonical Git root, or the canonical cwd
31
- when no repository exists. Root-session storage receives a non-authoritative
32
- copy at `storage/sessions/<root-id>/.memory`; child sessions can read that copy
33
- but ordinary edits never publish it. Felan does not create `<repository>/.memory`
34
- and does not synchronize local memory with cloud team memory.
35
- Each session receives one hidden persisted memory-context entry at startup;
36
- provider calls reuse it, and compaction or tree navigation restores it only if
37
- it is no longer on the active branch. That entry is excluded from memory
38
- evidence processing. Once it loads successfully, the welcome screen's
39
- `[Context]` section lists the projected `.memory/summary.md` path alongside
40
- project instructions so the loaded summary can be opened directly. The summary
41
- is orientation only: substantive memory-backed answers should follow the
42
- projected absolute `index.md` links to relevant pages and cite page paths and
43
- their `Sources` session IDs.
44
-
45
- Use `/memory status`, `/memory run`, `/memory enable`, `/memory disable`, or
46
- `/memory open` to inspect and control local processing. A missing local model
47
- credential never prevents startup or recall of existing memory; processing
48
- remains pending until a configured model is available. Processing is idle
49
- batched while Felan runs and catches up on the next launch after shutdown. The
50
- enable/disable commands persist `felanTui.memoryProcessing` and do not remove
51
- the memory recall extension.
52
-
53
- After checkpoints are recorded, the TUI coordinator owns idle batching,
54
- startup recovery, retries, and shutdown cancellation. Each batch runs one
55
- disposable headless Pi memory-dreamer session against staging. It reads the
56
- immutable `.dreaming/input` manifest and transcripts, edits staged `.memory`
57
- files in place, and returns only a concise completion summary. The worker has
58
- no normal Felan extensions, skills, repository context, credentials, or
59
- process execution; its active tools are limited to `read`, `ls`, `edit`, and
60
- `write`. The worker has no separate turn, tool-call, or per-file I/O budgets;
61
- the only execution failsafe is a one-hour wall-clock timeout. The coordinator
62
- validates and publishes the staged filesystem output, so model, validation,
63
- cancellation, timeout, or publication failures leave evidence pending for
64
- retry. The worker uses the active root-session model when it is authenticated;
65
- if that model is unavailable, it falls back to another authenticated available
66
- model. With no authenticated model, evidence remains pending. The portable
67
- `@felan-ai/ext-memory` extension only recalls memory and records root
68
- checkpoints; it does not schedule dreaming.
69
-
70
- Evidence ingestion is separate from the worker's file-tool policy. The host
71
- opens each checkpoint's append-only JSONL session with a bounded snapshot and
72
- streams only the visible active-branch delta; abandoned branches, hidden
73
- memory-context entries, and unrelated large tool output are not staged. Source
74
- files may be much larger than the evidence sent to the model. After redaction,
75
- each staged transcript is capped at 256 KiB. A changed, missing, or malformed
76
- checkpoint source remains pending without blocking valid checkpoints in the
77
- same batch; it is retried by `/memory run`, a newer cursor, or a later launch.
78
- The dreamer updates affected pages and cross-links, preserves valid historical
79
- source entries, marks superseded or conflicting claims, and performs a bounded
80
- semantic maintenance pass before publication. Root-index links in each session
81
- projection are rebased to that projection's absolute `.memory` path; canonical
82
- memory remains unchanged.
83
-
84
- Felan suppresses Pi's version notification, bundled changelog, package update
85
- notifications, and install/update telemetry. Update behavior is owned by the
86
- Felan application.
87
-
88
- Each session uses a `HostAgentRuntime` with host path access. Its cwd resolves
89
- relative paths, while file operations and process working directories can use
90
- any path available to the current user. Pi's session runtime recreates the host
91
- runtime, filtered settings, resources, and session composition for new, resume,
92
- fork, clone, and import flows, then rebinds the active interactive UI. Host mode
93
- is not an isolation boundary.
94
-
95
- Root sessions store extension state under
96
- `$FELAN_AGENT_DIR/storage/sessions/<encoded-root-session-id>`. Every nested
97
- subagent shares its root session's storage path. Longer-retention agent state
98
- uses `$FELAN_AGENT_DIR/storage/agent`. Storage handles remain scoped to their
99
- declared roots, while ordinary runtime file operations can access these and
100
- other host paths directly.
101
-
102
- Only source-controlled built-in Felan extensions can be imported. External
103
- packages, extensions, configured skill paths, prompts, themes, and Pi context
104
- files remain filtered. Agent Core separately loads one instruction file from
105
- the session cwd, preferring `AGENTS.md` over `CLAUDE.md`. Agent Skills are
106
- loaded from `~/.agents/skills` and `<workspace>/.agents/skills` and are shared
107
- with local subagents.
108
- The built-in powerline reads `~/.felan/powerline.json` (or
109
- `$FELAN_AGENT_DIR/powerline.json`) once when it initializes. Its subscription
110
- segment obtains the active Codex or Claude OAuth token through Felan's
111
- `ModelRuntime` and requests usage from that provider's fixed endpoint.
112
-
113
- All built-in extensions are enabled by default. Toggle them in
114
- `~/.felan/settings.json`:
115
-
116
- ```json
117
- {
118
- "builtinExtensions": {
119
- "subagents": true,
120
- "askUser": true,
121
- "tasks": true,
122
- "prewalk": true,
123
- "context": true,
124
- "markitdown": true,
125
- "mcp": true,
126
- "webAccess": true,
127
- "browser": true,
128
- "backgroundBash": true,
129
- "codex": true,
130
- "rtkOptimizer": true,
131
- "memory": true,
132
- "powerline": false,
133
- "outputStyle": true
134
- }
135
- }
136
- ```
137
-
138
- The built-in output-style extension adds a bounded `## Output Style` section
139
- to the system prompt for root and child sessions. Select its instructions with
140
- the global `outputStyle` setting:
141
-
142
- ```json
143
- {
144
- "outputStyle": "explanatory"
145
- }
146
- ```
147
-
148
- Supported values are `concise` and `explanatory`. `concise` is the default.
149
- Invalid values stop session construction with a settings error. Styles are
150
- built into Felan; this setting cannot load prompt text or ambient files. The
151
- selection is captured when a session runtime is created, so restart Felan after
152
- changing it.
153
-
154
- On the first interactive startup with a missing external runtime dependency,
155
- Felan opens a dependency wizard before the first prompt. MarkItDown can be
156
- installed into Felan's managed Python environment or disabled. RTK can be
157
- installed with its pinned official installer or skipped while its
158
- binary-independent output compaction remains active. Background Bash is
159
- disabled when required POSIX process utilities are unavailable. The reviewed
160
- `agent-browser` CLI can be installed into Felan's managed agent storage or the
161
- Browser extension can be disabled. Choices are stored in global settings,
162
- never prompt in non-interactive sessions, and can be revisited with
163
- `/dependencies`. Install actions always require explicit confirmation.
164
-
165
- The local transcript groups adjacent tool calls by default, with one concise
166
- action row per call beneath each group title. Press `Ctrl+O` to show bounded
167
- result previews. Use `/tools` or `Alt+T` to inspect the complete arguments and
168
- result for one root-session call. Selected subagent transcripts use the same
169
- grouped or full tool rendering and `Ctrl+O` previews. Subagent completion
170
- notices stay on one summary line by default; `Ctrl+O` shows a bounded preview
171
- and `Alt+A` opens full agent details. Grouped reads from projected or canonical
172
- local memory appear as `Memory Recall`; conservative read-only Codex commands
173
- receive the same label without hiding mutating or arbitrary shell commands.
174
- To restore Pi's original ungrouped rendering, set:
175
-
176
- ```json
177
- {
178
- "felanTui": {
179
- "toolDisplay": "full"
180
- }
181
- }
182
- ```
183
-
184
- Supported values are `grouped` and `full`; `grouped` is the default.
185
-
186
- `askUser` provides the sequential `ask_user` tool. The local host presents
187
- single questions or 1-4 question wizards as searchable overlays or inline
188
- dialogs, with multi-select, freeform answers, and optional comments.
19
+ ## Requirements and quick start
189
20
 
190
- `mcp` provides one OAuth-only remote MCP gateway. It merges
191
- `$FELAN_AGENT_DIR/mcp.json` with `<cwd>/.mcp.json`; the project file has higher
192
- precedence for same-name servers. It does not discover `.pi/mcp.json`, Cursor,
193
- Claude, Codex, or other ambient host configuration. A minimal Felan-owned
194
- config is:
21
+ Felan supports Node.js 22.19.0 or newer. Repository development and CI use
22
+ Node.js 22.20.0 with pnpm 9.15.5.
195
23
 
196
- ```json
197
- {
198
- "mcpServers": {
199
- "notion": {
200
- "url": "https://mcp.notion.com/mcp",
201
- "auth": "oauth"
202
- }
203
- }
204
- }
24
+ ```sh
25
+ felan
26
+ /login
205
27
  ```
206
28
 
207
- Servers in the Felan-owned file must explicitly use `auth: "oauth"`. Standard
208
- project entries with `type: "http"` and a URL may omit `auth`; Felan treats
209
- those entries as OAuth. The initial port supports remote HTTP MCP servers
210
- through Streamable HTTP with classified SSE fallback. Unsupported project
211
- entries such as stdio, sockets, bearer tokens, and custom headers are skipped
212
- with a warning rather than executed. Direct tools and MCP Apps are not loaded.
213
- Optional per-server `oauth` fields are `clientId`, `clientSecret`,
214
- `clientSecretEnv`, `scope`, `redirectUri`, `clientName`, `clientUri`, and
215
- `authorizationParams`. Dynamic client registration is used when no client ID
216
- is configured. A client secret or `clientSecretEnv` requires `clientId`;
217
- prefer the environment reference over storing a client secret in the file.
218
- The default callback is `http://127.0.0.1:3118/callback`; set `redirectUri` to
219
- the exact pre-registered loopback callback when using a configured client.
220
-
221
- Run `/mcp` to inspect configured servers, list tools, reconnect, authenticate,
222
- or log out. `/mcp auth [server]` opens a server picker when its argument is
223
- omitted. Configuration is loaded at startup;
224
- run `/reload` after editing either file. The model uses the `mcp` gateway tool
225
- for status, explicit reconnects, search, describe, and remote tool calls. A
226
- `disconnected` status only means that the current session has no live transport;
227
- model discovery and call actions reconnect lazily with stored credentials. The
228
- local host follows the upstream adapter's browser + PKCE loopback flow and
229
- stores tokens and dynamic-client
230
- credentials in the OS credential store, bound to the Felan agent directory,
231
- server name, server URL, OAuth client/redirect/scope profile, and
232
- authorization-server issuer. It fails closed when that store is unavailable.
233
- Print-mode subagents never open a browser or callback listener; they can reuse
234
- credentials established by a root TUI session. MCP metadata and results are
235
- bounded and explicitly marked as untrusted remote content.
236
-
237
- `tasks` provides `TaskCreate`, `TaskUpdate`, `TaskList`, and `TaskGet` over one
238
- dependency-aware graph shared by the root session and every nested subagent.
239
- Task state lives under
240
- `$FELAN_AGENT_DIR/storage/sessions/<encoded-root-session-id>/tasks`. Use `/tasks`
241
- or `Ctrl+Shift+T` to inspect list, detail, and graph views.
242
-
243
- `webAccess` provides bounded web search, source verification, readable URL
244
- fetching, and stored-content retrieval. Search supports OpenAI/Codex, Exa,
245
- Brave, and self-hosted SearXNG. Configure providers in
246
- `$FELAN_AGENT_DIR/web-search.json`. Model-facing web content is explicitly
247
- encoded as untrusted external data; private and reserved network targets are
248
- blocked by default.
249
-
250
- `browser` registers one browser tool backed by the reviewed `agent-browser`
251
- CLI. Ask the tool for the version-matched `core` or specialized skill before
252
- browser actions, then pass literal CLI arguments for navigation, snapshots,
253
- interactions, and screenshots. Bare screenshots are attached directly when the
254
- selected model accepts image input; browser pages, skill text, and CLI output
255
- remain untrusted data.
256
-
257
- `markitdown` extends ordinary `read` calls for DOC/DOCX, PPT/PPTX, XLS/XLSX,
258
- RTF, EPUB, and Outlook MSG files. It intentionally leaves PDFs, images, audio,
259
- and generic archives to their existing or explicit workflows. Input,
260
- conversion time, and output are
261
- bounded; a content-hash Markdown cache preserves normal offset/limit reads, and
262
- every result marks extracted document text as untrusted. The extension never
263
- downloads Python packages automatically. Run `/markitdown` for status or
264
- `/markitdown install` to explicitly install the managed converter. If the
265
- converter is absent, conversion interception remains disabled.
266
-
267
- `backgroundBash` augments `bash` with detached processes for models outside the
268
- `openai` and `openai-codex` providers. Logs and process metadata live under
269
- `$FELAN_AGENT_DIR/storage/sessions/<encoded-root-session-id>/background-bash/<workspace-key>/jobs`.
270
- Use `/background-bash` or `Ctrl+Shift+J` to inspect them. Required POSIX process
271
- utilities are probed through the active runtime; the tools remain inactive on
272
- incompatible runtimes.
273
-
274
- `codex` activates `exec_command`, `write_stdin`, `apply_patch`, and
275
- `view_image` for GPT models on the exact `openai` and `openai-codex` providers.
276
- `view_image` is included only for models with image input. It restores the
277
- ordinary coding tools when another model is selected. Root and nested sessions
278
- load the same optional request controls from `$FELAN_AGENT_DIR/codex.json`; see
279
- the extension package README for the three supported fields.
280
-
281
- `rtkOptimizer` delegates command rewrites to a managed or `PATH` `rtk`
282
- executable available in the active runtime and compacts noisy command, read,
283
- and grep results. It
284
- supports both ordinary `bash` calls and Codex `exec_command` / `write_stdin`
285
- calls; Codex result envelopes remain intact while only their `Output:` payloads
286
- are compacted. Configuration is shared by root and nested sessions at
287
- `$FELAN_AGENT_DIR/storage/agent/rtk-optimizer/config.json`. Use `/rtk` for
288
- interactive settings, runtime verification, explicit installation, and session
289
- savings metrics. Missing RTK bypasses rewriting without disabling output
290
- compaction.
291
-
292
- ## System prompt append
293
-
294
- The TUI reads one optional `$FELAN_AGENT_DIR/APPEND_SYSTEM.md` file when each
295
- session is constructed (`~/.felan/APPEND_SYSTEM.md` by default). Missing and
296
- blank files add nothing; other read failures stop session construction with the
297
- filesystem error. The file extends Agent Core's Felan prompt after enabled
298
- extension capabilities.
299
-
300
- Agent Core also reads at most one instruction file from each session's cwd
301
- through the active `AgentRuntime`, with `AGENTS.md` taking precedence over
302
- `CLAUDE.md`. Missing, unreadable, and blank instruction files are nonfatal.
303
- Child persona instructions follow the application append, root project
304
- instructions follow those consumer appends using Pi's path-labeled context-file
305
- format, and explicit Agent Skills and the current working directory are added
306
- last. The progressive-context extension remains responsible only for instruction
307
- files below the session cwd.
29
+ Run an initial prompt or continue the most recent session for the current
30
+ directory:
308
31
 
309
- System prompt inputs are limited to Agent Core, enabled capabilities, the
310
- single application append above, the selected cwd instruction file, explicit
311
- Agent Skills, and the current working directory. Pi `SYSTEM.md`, project
312
- `APPEND_SYSTEM.md`, and other Pi-discovered prompt/context files stay outside
313
- local composition.
314
-
315
- When enabled, `@felan-ai/ext-subagents` uses the session-bound local host and
316
- provides `Agent`, `list_subagents`,
317
- `get_subagent_result`, `steer_subagent`, and `cancel_subagent`. A root-scoped
318
- local host queues every run asynchronously, persists the latest child session
319
- metadata, delivers completion notices, supports bounded nesting, and uses the
320
- application's current workspace. The TUI shows each queued or running direct
321
- child in a full-width interactive rail beneath the powerline status rows, or
322
- beneath the editor when powerline is disabled. Press Down at the editor's newest
323
- prompt to enter the rail, use Up/Down to select a child, press Up on the first
324
- child to return to the editor, and press Enter to open that child in the agent
325
- navigator. Each child row and the selected-child header show the resolved
326
- provider/model when available. Use `/agents` or `Alt+A` to open the navigator
327
- directly, follow live transcripts with the same tool presentation as the main
328
- agent, send steering messages, or stop active work.
329
- Runtime shutdown awaits active-child cancellation before Pi teardown.
330
- Completed-child continuation uses the same child ID and Pi session file while
331
- replacing the latest result. The default list also
332
- includes `@felan-ai/ext-powerline` for an ANSI-aware footer with subscription
333
- usage; it is a direct TUI dependency and is not part of cloud composition.
334
-
335
- Local agent definitions are loaded only from bundled Felan definitions,
336
- `~/.agents/agents/*.md`, `~/.felan/agents/*.md` (or
337
- `$FELAN_AGENT_DIR/agents/*.md`), `<workspace>/.agents/agents/*.md`, and
338
- `<workspace>/.felan/agents/*.md`. Project definitions override user and
339
- bundled definitions; within one scope the Felan-specific directory overrides
340
- the shared `.agents` directory. Pi ambient agent discovery remains disabled.
341
-
342
- The bundled definitions have role-specific model settings: `general` inherits the
343
- parent model and thinking for implementation or investigation, `explore` uses the
344
- `low` model tier with thinking `off` for cheap read-only exploration, and `reviewer`
345
- inherits the parent model and thinking for quality-sensitive review. A definition's
346
- `model` and `thinking` settings take precedence over `Agent` arguments. When a
347
- definition omits either setting, the corresponding argument is used; if both omit
348
- it, the parent setting is inherited. A custom definition with id `explore` replaces
349
- the bundled definition and can choose its own settings.
350
-
351
- Each definition is a Markdown file with flat `key: value` frontmatter and a
352
- required prompt body. `description` is required; `id` defaults to the filename.
353
- Optional fields are `model`, `thinking`, `max_turns`, `timeout_seconds`, and
354
- `allow_nesting`. Definitions do not change tool access: custom children receive
355
- the normal enabled Felan tools.
356
-
357
- ```md
358
- ---
359
- description: Review changes for correctness and regressions
360
- model: high
361
- thinking: high
362
- max_turns: 20
363
- timeout_seconds: 600
364
- allow_nesting: false
365
- ---
366
-
367
- Review the requested changes and report findings with file and line references.
32
+ ```sh
33
+ felan "inspect this project"
34
+ felan --continue
368
35
  ```
369
36
 
370
- Local subagent concurrency defaults to four and depth defaults to three; set
371
- `felanSubagents.concurrency` and `felanSubagents.maxDepth` in the Felan settings
372
- file to configure those bounded values.
373
-
374
- Local model selectors are deterministic and support explicit inheritance or an
375
- exact authenticated `provider/model`; exact selectors never fall back. Requested
376
- thinking levels are checked against that resolved model and unsupported levels
377
- return `unsupported_thinking` instead of being silently clamped.
37
+ ## CLI
378
38
 
379
- ```sh
380
- felan --diagnostics
39
+ ```text
40
+ felan [options] [message]
41
+
42
+ -c, --continue Continue the most recent session for this directory
43
+ --diagnostics Print runtime versions and configuration mode
44
+ update Update a global npm installation of Felan
45
+ -h, --help Show help
46
+ -v, --version Print the Felan version
47
+ --verbose Show verbose startup details
381
48
  ```
382
49
 
383
- Diagnostics include the Felan, Agent Core, Pi, and Node.js versions.
50
+ Run `felan update` to check the stable npm release. It updates only a verified
51
+ global npm installation, reports when the installation is current, and tells
52
+ you to restart after a successful update. `npx`, local/source, and other
53
+ package-manager installations are not changed; update those with the command
54
+ that installed them.
55
+
56
+ Invocations that start or continue an agent session launch the interactive TUI.
57
+ `felan update` and informational flags exit without starting a session. Internal
58
+ headless modes used by subagents and extension adapters are not public CLI entry
59
+ points.
60
+
61
+ `felan --diagnostics` reports Felan, Agent Core, Pi, and Node.js versions plus
62
+ runtime and credential modes.
63
+
64
+ ## Local state and policy
65
+
66
+ The default agent directory is `~/.felan`; set `FELAN_AGENT_DIR` to change it.
67
+ It contains local credentials, settings, sessions, agents, extension storage,
68
+ and project memory. Root-session storage is scoped under
69
+ `$FELAN_AGENT_DIR/storage/sessions/<encoded-root-session-id>` and longer-lived
70
+ extension state under `$FELAN_AGENT_DIR/storage/agent`.
71
+
72
+ The local host loads only source-controlled Felan built-ins, Felan-owned
73
+ settings and prompt appends, explicit Felan agents and Agent Skills, and the
74
+ Agent Core-selected cwd instruction file. Ambient Pi extensions, packages,
75
+ prompts, themes, project settings, and package resources are filtered.
76
+
77
+ All built-ins are enabled by default, including the Powerline footer in TUI
78
+ sessions. Binary-backed features can remain inactive until their dependency is
79
+ installed or the feature is disabled through `/dependencies`.
80
+
81
+ Model responses use the built-in `concise` output style by default. Set the
82
+ global `outputStyle` setting to `explanatory` for more reasoning and context;
83
+ the [configuration guide](../../docs/user-guide/configuration.md#output-style)
84
+ documents validation and session-lifecycle behavior.
85
+
86
+ ## Canonical user documentation
87
+
88
+ The package README intentionally stays short. Use these guides for operational
89
+ details:
90
+
91
+ - [Getting started](../../docs/getting-started.md)
92
+ - [Local CLI and storage](../../docs/user-guide/local-cli.md)
93
+ - [Configuration](../../docs/user-guide/configuration.md)
94
+ - [Commands and shortcuts](../../docs/user-guide/commands-and-shortcuts.md)
95
+ - [Agents, tasks, and Prewalk](../../docs/user-guide/agents-tasks-and-prewalk.md)
96
+ - [Context and memory](../../docs/user-guide/context-and-memory.md)
97
+ - [Web, MCP, browser, and documents](../../docs/user-guide/web-mcp-and-browser.md)
98
+ - [Runtime and security](../../docs/concepts/runtime-and-security.md)
99
+ - [Extension catalog](../../docs/reference/extension-catalog.md)
384
100
 
385
101
  ## Development
386
102
 
@@ -390,5 +106,9 @@ Source: `apps/tui` in <https://github.com/felan-ai/felan>.
390
106
  corepack enable
391
107
  pnpm install --frozen-lockfile
392
108
  pnpm --filter @felan-ai/felan build
109
+ pnpm --filter @felan-ai/felan type-check
393
110
  pnpm --filter @felan-ai/felan test
394
111
  ```
112
+
113
+ Run `pnpm verify` from the repository root for cross-package and packed-binary
114
+ coverage.
@@ -1,8 +1,9 @@
1
- import { type RunLocalFelanOptions } from './application.js';
1
+ import type { RunLocalFelanOptions } from './application.js';
2
2
  export interface CliDependencies {
3
3
  readonly writeOutput?: (line: string) => void;
4
4
  readonly writeError?: (line: string) => void;
5
5
  readonly launch?: (options: RunLocalFelanOptions) => Promise<void>;
6
+ readonly update?: () => Promise<number>;
6
7
  }
7
8
  export declare function runCli(args: readonly string[], dependencies?: CliDependencies): Promise<number>;
8
9
  //# sourceMappingURL=cli-main.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-main.d.ts","sourceRoot":"","sources":["../src/cli-main.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG5E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpE;AAWD,wBAAsB,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,YAAY,GAAE,eAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgDzG"}
1
+ {"version":3,"file":"cli-main.d.ts","sourceRoot":"","sources":["../src/cli-main.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAI7D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CACzC;AAYD,wBAAsB,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,YAAY,GAAE,eAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CA+DzG"}
package/dist/cli-main.js CHANGED
@@ -1,19 +1,24 @@
1
- import { AGENT_CORE_VERSION } from '@felan-ai/agent-core';
2
- import { VERSION as PI_VERSION } from '@earendil-works/pi-coding-agent';
3
- import { runLocalFelan } from './application.js';
1
+ import { runFelanUpdate } from './update.js';
4
2
  import { FELAN_VERSION } from './version.js';
5
3
  const help = `Usage: felan [options] [message]
6
4
 
7
5
  Options:
8
6
  -c, --continue Continue the most recent session for this directory
9
7
  --diagnostics Print local runtime versions and configuration mode
8
+ update Update a global npm installation of Felan
10
9
  -h, --help Show this help
11
10
  -v, --version Print the Felan version
12
11
  --verbose Show verbose startup details`;
13
12
  export async function runCli(args, dependencies = {}) {
14
13
  const writeOutput = dependencies.writeOutput ?? ((line) => console.log(line));
15
14
  const writeError = dependencies.writeError ?? ((line) => console.error(line));
16
- const launch = dependencies.launch ?? runLocalFelan;
15
+ if (args[0] === 'update') {
16
+ if (args.length !== 1) {
17
+ writeError('Usage: felan update');
18
+ return 1;
19
+ }
20
+ return dependencies.update?.() ?? runFelanUpdate({ writeOutput, writeError });
21
+ }
17
22
  let continueRecent = false;
18
23
  let verbose = false;
19
24
  const messageParts = [];
@@ -41,6 +46,10 @@ export async function runCli(args, dependencies = {}) {
41
46
  return 0;
42
47
  }
43
48
  else if (argument === '--diagnostics') {
49
+ const [{ AGENT_CORE_VERSION }, { VERSION: PI_VERSION }] = await Promise.all([
50
+ import('@felan-ai/agent-core'),
51
+ import('@earendil-works/pi-coding-agent'),
52
+ ]);
44
53
  writeOutput(`Felan version: ${FELAN_VERSION}`);
45
54
  writeOutput(`Agent Core version: ${AGENT_CORE_VERSION}`);
46
55
  writeOutput(`Pi version: ${PI_VERSION}`);
@@ -57,6 +66,10 @@ export async function runCli(args, dependencies = {}) {
57
66
  messageParts.push(argument);
58
67
  }
59
68
  }
69
+ const launch = dependencies.launch ?? (async (options) => {
70
+ const { runLocalFelan } = await import('./application.js');
71
+ await runLocalFelan(options);
72
+ });
60
73
  await launch({
61
74
  continueRecent,
62
75
  verbose,
@@ -1 +1 @@
1
- {"version":3,"file":"cli-main.js","sourceRoot":"","sources":["../src/cli-main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,aAAa,EAA6B,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAQ7C,MAAM,IAAI,GAAG;;;;;;;kDAOqC,CAAC;AAEnD,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAuB,EAAE,eAAgC,EAAE;IACtF,MAAM,WAAW,GAAG,YAAY,CAAC,WAAW,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9E,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9E,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,IAAI,aAAa,CAAC;IACpD,IAAI,cAAc,GAAG,KAAK,CAAC;IAC3B,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,IAAI,cAAc,GAAG,KAAK,CAAC;IAE3B,KAAK,MAAM,QAAQ,IAAI,IAAI,EAAE,CAAC;QAC5B,IAAI,cAAc,EAAE,CAAC;YACnB,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC5B,SAAS;QACX,CAAC;QACD,IA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C,OAAO,CAAC,CAAC;QACX,CAAC;aAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,UAAU,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;YAC1C,OAAO,CAAC,CAAC;QACX,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,OAA6B,EAAE,EAAE;QAC7E,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAC3D,MAAM,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IACH,MAAM,MAAM,CAAC;QACX,cAAc;QACd,OAAO;QACP,GAAG,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;KACjF,CAAC,CAAC;IACH,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,14 @@
1
+ export interface NpmResult {
2
+ readonly status: number;
3
+ readonly stdout: string;
4
+ readonly stderr: string;
5
+ }
6
+ export interface RunFelanUpdateOptions {
7
+ readonly packageDirectory?: string;
8
+ readonly currentVersion?: string;
9
+ readonly runNpm?: (args: readonly string[], cwd: string) => Promise<NpmResult>;
10
+ readonly writeOutput?: (line: string) => void;
11
+ readonly writeError?: (line: string) => void;
12
+ }
13
+ export declare function runFelanUpdate(options?: RunFelanUpdateOptions): Promise<number>;
14
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../src/update.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/E,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAED,wBAAsB,cAAc,CAAC,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,CAgEzF"}
package/dist/update.js ADDED
@@ -0,0 +1,152 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { existsSync, lstatSync, readFileSync, realpathSync } from 'node:fs';
3
+ import { basename, delimiter, dirname, join, resolve } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { FELAN_VERSION } from './version.js';
6
+ const PACKAGE_NAME = '@felan-ai/felan';
7
+ const PACKAGE_DIRECTORY = ['@felan-ai', 'felan'];
8
+ export async function runFelanUpdate(options = {}) {
9
+ const writeOutput = options.writeOutput ?? ((line) => console.log(line));
10
+ const writeError = options.writeError ?? ((line) => console.error(line));
11
+ const packageDirectory = options.packageDirectory ?? dirname(dirname(fileURLToPath(import.meta.url)));
12
+ const currentVersion = options.currentVersion ?? FELAN_VERSION;
13
+ const runNpm = options.runNpm ?? runNpmCommand;
14
+ const globalRootResult = await runNpm(['root', '--global'], packageDirectory);
15
+ if (globalRootResult.status !== 0) {
16
+ writeError(`Could not find npm's global installation: ${commandError(globalRootResult)}`);
17
+ return 1;
18
+ }
19
+ const globalRoot = globalRootResult.stdout.trim();
20
+ const expectedPackageDirectory = join(globalRoot, ...PACKAGE_DIRECTORY);
21
+ if (!globalRoot || !samePath(packageDirectory, expectedPackageDirectory) || isSymbolicLink(expectedPackageDirectory)) {
22
+ writeError('Felan update only supports a verified global npm installation. '
23
+ + 'Run `npm install --global @felan-ai/felan` to update this installation manually.');
24
+ return 1;
25
+ }
26
+ const packageManifest = readPackageManifest(packageDirectory);
27
+ if (!packageManifest || packageManifest.name !== PACKAGE_NAME || packageManifest.version !== currentVersion) {
28
+ writeError('The running Felan package could not be verified. Update it manually with npm.');
29
+ return 1;
30
+ }
31
+ const latestResult = await runNpm(['view', `${PACKAGE_NAME}@latest`, 'version'], packageDirectory);
32
+ if (latestResult.status !== 0) {
33
+ writeError(`Could not check for a newer Felan release: ${commandError(latestResult)}`);
34
+ return 1;
35
+ }
36
+ const latestVersion = latestResult.stdout.trim();
37
+ if (!isStableVersion(latestVersion) || !isStableVersion(currentVersion)) {
38
+ writeError('npm returned an invalid stable Felan version. Update Felan manually.');
39
+ return 1;
40
+ }
41
+ const comparison = compareVersions(latestVersion, currentVersion);
42
+ if (comparison <= 0) {
43
+ writeOutput(`Felan ${currentVersion} is already up to date.`);
44
+ return 0;
45
+ }
46
+ const installResult = await runNpm(['install', '--global', `${PACKAGE_NAME}@${latestVersion}`], packageDirectory);
47
+ if (installResult.status !== 0) {
48
+ writeError(`Felan update failed: ${commandError(installResult)}`);
49
+ return 1;
50
+ }
51
+ const installedManifest = readPackageManifest(packageDirectory);
52
+ if (installedManifest?.name !== PACKAGE_NAME || installedManifest.version !== latestVersion) {
53
+ writeError(`Felan update could not verify version ${latestVersion}. Update Felan manually.`);
54
+ return 1;
55
+ }
56
+ writeOutput(`Updated Felan from ${currentVersion} to ${latestVersion}. Restart Felan to use the new version.`);
57
+ return 0;
58
+ }
59
+ async function runNpmCommand(args, cwd) {
60
+ const npmCommand = resolveNpmCommand();
61
+ if (!npmCommand) {
62
+ return { status: 1, stdout: '', stderr: 'npm was not found' };
63
+ }
64
+ return new Promise((resolveResult) => {
65
+ execFile(npmCommand.command, [...npmCommand.arguments, ...args], {
66
+ cwd,
67
+ encoding: 'utf8',
68
+ windowsHide: true,
69
+ }, (error, stdout, stderr) => {
70
+ resolveResult({
71
+ status: error ? (typeof error.code === 'number' ? error.code : 1) : 0,
72
+ stdout,
73
+ stderr,
74
+ });
75
+ });
76
+ });
77
+ }
78
+ function resolveNpmCommand() {
79
+ const npmCliCandidates = [
80
+ join(dirname(process.execPath), 'node_modules', 'npm', 'bin', 'npm-cli.js'),
81
+ join(dirname(process.execPath), '..', 'lib', 'node_modules', 'npm', 'bin', 'npm-cli.js'),
82
+ join(dirname(process.execPath), '..', 'share', 'nodejs', 'npm', 'bin', 'npm-cli.js'),
83
+ ];
84
+ for (const candidate of npmCliCandidates) {
85
+ if (candidate && basename(candidate).toLowerCase() === 'npm-cli.js' && existsSync(candidate)) {
86
+ return { command: process.execPath, arguments: [candidate] };
87
+ }
88
+ }
89
+ for (const directory of (process.env.PATH ?? '').split(delimiter)) {
90
+ if (!directory || directory.toLowerCase().includes('node_modules'))
91
+ continue;
92
+ const executable = join(directory, process.platform === 'win32' ? 'npm.cmd' : 'npm');
93
+ if (!existsSync(executable))
94
+ continue;
95
+ if (process.platform === 'win32') {
96
+ const adjacentCli = join(directory, 'node_modules', 'npm', 'bin', 'npm-cli.js');
97
+ if (existsSync(adjacentCli))
98
+ return { command: process.execPath, arguments: [adjacentCli] };
99
+ continue;
100
+ }
101
+ return { command: executable, arguments: [] };
102
+ }
103
+ return undefined;
104
+ }
105
+ function readPackageManifest(packageDirectory) {
106
+ try {
107
+ return JSON.parse(readFileSync(join(packageDirectory, 'package.json'), 'utf8'));
108
+ }
109
+ catch {
110
+ return undefined;
111
+ }
112
+ }
113
+ function isSymbolicLink(path) {
114
+ try {
115
+ return lstatSync(path).isSymbolicLink();
116
+ }
117
+ catch {
118
+ return false;
119
+ }
120
+ }
121
+ function samePath(left, right) {
122
+ const canonicalLeft = canonicalPath(left);
123
+ const canonicalRight = canonicalPath(right);
124
+ const normalizedLeft = process.platform === 'win32' ? canonicalLeft.toLowerCase() : canonicalLeft;
125
+ const normalizedRight = process.platform === 'win32' ? canonicalRight.toLowerCase() : canonicalRight;
126
+ return normalizedLeft === normalizedRight;
127
+ }
128
+ function canonicalPath(path) {
129
+ const resolved = resolve(path);
130
+ try {
131
+ return realpathSync(resolved);
132
+ }
133
+ catch {
134
+ return resolved;
135
+ }
136
+ }
137
+ function isStableVersion(version) {
138
+ return /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/u.test(version);
139
+ }
140
+ function compareVersions(left, right) {
141
+ const leftParts = left.split('.').map(Number);
142
+ const rightParts = right.split('.').map(Number);
143
+ for (let index = 0; index < leftParts.length; index += 1) {
144
+ if (leftParts[index] !== rightParts[index])
145
+ return leftParts[index] > rightParts[index] ? 1 : -1;
146
+ }
147
+ return 0;
148
+ }
149
+ function commandError(result) {
150
+ return result.stderr.trim() || result.stdout.trim() || `npm exited with status ${result.status}`;
151
+ }
152
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../src/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,YAAY,GAAG,iBAAiB,CAAC;AACvC,MAAM,iBAAiB,GAAG,CAAC,WAAW,EAAE,OAAO,C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,CAAC;IAC/B,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,OAAe;IACtC,OAAO,mDAAmD,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,eAAe,CAAC,IAAY,EAAE,KAAa;IAClD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAChD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACzD,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,UAAU,CAAC,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC,KAAK,CAAE,GAAG,UAAU,CAAC,KAAK,CAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrG,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,YAAY,CAAC,MAAiB;IACrC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,0BAA0B,MAAM,CAAC,MAAM,EAAE,CAAC;AACnG,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@felan-ai/felan",
3
- "version": "0.12.11",
3
+ "version": "0.13.0",
4
4
  "description": "Local Felan terminal agent",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,19 +35,19 @@
35
35
  "open": "11.0.0",
36
36
  "proper-lockfile": "4.1.2",
37
37
  "@felan-ai/agent-core": "0.4.9",
38
- "@felan-ai/ext-background-bash": "0.3.6",
39
- "@felan-ai/ext-browser": "0.1.0",
40
38
  "@felan-ai/ext-ask-user": "0.1.3",
41
- "@felan-ai/ext-codex": "0.1.5",
39
+ "@felan-ai/ext-browser": "0.1.0",
40
+ "@felan-ai/ext-background-bash": "0.3.6",
42
41
  "@felan-ai/ext-mcp": "0.1.2",
42
+ "@felan-ai/ext-codex": "0.1.5",
43
43
  "@felan-ai/ext-subagents": "0.4.0",
44
44
  "@felan-ai/ext-context": "0.3.1",
45
- "@felan-ai/ext-tasks": "0.1.3",
46
- "@felan-ai/ext-memory": "0.1.0",
47
45
  "@felan-ai/ext-output-style": "0.1.0",
48
46
  "@felan-ai/ext-markitdown": "0.1.0",
49
- "@felan-ai/ext-prewalk": "0.3.3",
47
+ "@felan-ai/ext-memory": "0.1.0",
48
+ "@felan-ai/ext-tasks": "0.1.3",
50
49
  "@felan-ai/ext-powerline": "0.4.2",
50
+ "@felan-ai/ext-prewalk": "0.3.3",
51
51
  "@felan-ai/ext-rtk-optimizer": "0.1.1",
52
52
  "@felan-ai/ext-web-access": "0.2.0"
53
53
  },