larkin 0.4.1 → 0.4.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 (42) hide show
  1. package/README.md +76 -33
  2. package/artifacts/release/THIRD_PARTY_NOTICES.txt +218 -228
  3. package/assets/readme/larkin-github-cover.png +0 -0
  4. package/assets/readme/larkin-hero.svg +111 -0
  5. package/dist/agent/agent-state-store.cjs +193 -1
  6. package/dist/agent/agent-state-store.mjs +191 -0
  7. package/dist/app/agent-config.mjs +73 -6
  8. package/dist/app/agent-readiness.cjs +22 -2
  9. package/dist/app/agent-readiness.mjs +20 -2
  10. package/dist/app/binary-entry.mjs +6 -0
  11. package/dist/app/cli.mjs +7 -1
  12. package/dist/app/local-control.mjs +108 -2
  13. package/dist/app/run.mjs +8 -0
  14. package/dist/app/runtime-process.mjs +17 -1
  15. package/dist/app/session-cli.mjs +55 -20
  16. package/dist/dashboard/dashboard-view-model.mjs +12 -3
  17. package/dist/feishu/host-shell.cjs +104 -9
  18. package/dist/feishu/host-shell.mjs +105 -10
  19. package/dist/platform/config.cjs +406 -33
  20. package/dist/platform/config.mjs +405 -33
  21. package/dist/platform/process-boundary-trace.cjs +108 -0
  22. package/dist/platform/process-boundary-trace.mjs +102 -0
  23. package/dist/runtime/pi-artifact-provenance.cjs +147 -0
  24. package/dist/runtime/pi-artifact-provenance.mjs +139 -0
  25. package/dist/runtime/pi-compaction-recovery.cjs +703 -0
  26. package/dist/runtime/pi-compaction-recovery.mjs +679 -0
  27. package/dist/runtime/pi-model-catalog.cjs +2 -2
  28. package/dist/runtime/pi-model-catalog.mjs +2 -2
  29. package/dist/runtime/pi-profile-migration.cjs +556 -0
  30. package/dist/runtime/pi-profile-migration.mjs +515 -0
  31. package/dist/runtime/pi-provider-config.cjs +3 -3
  32. package/dist/runtime/pi-provider-config.mjs +3 -3
  33. package/dist/runtime/pi-rpc-client.cjs +39 -22
  34. package/dist/runtime/pi-rpc-client.mjs +39 -22
  35. package/dist/runtime/provider-error-classifier.cjs +39 -0
  36. package/dist/runtime/provider-error-classifier.mjs +34 -0
  37. package/dist/runtime/runtime-adapters.mjs +176 -27
  38. package/dist/runtime/runtime-host.cjs +630 -19
  39. package/dist/runtime/runtime-host.mjs +628 -18
  40. package/dist/runtime/runtime-readiness.cjs +6 -4
  41. package/dist/runtime/runtime-readiness.mjs +6 -4
  42. package/package.json +3 -3
package/README.md CHANGED
@@ -1,6 +1,12 @@
1
- # Larkin
1
+ <p align="center">
2
+ <img src="./assets/readme/larkin-github-cover.png" width="100%" alt="Larkin connecting Codex, Claude Code, and Pi agent runtimes to Feishu with a local dashboard and message surfaces.">
3
+ </p>
2
4
 
3
- Larkin connects Codex, Claude Code, and Pi agent runtimes to Feishu (Lark). It provides a local runtime host, persistent sessions, reminders, interactive messages, and a local dashboard.
5
+ <p align="center">
6
+ <a href="#quick-start">Quick start</a> · <a href="#requirements">Requirements</a> · <a href="#what-it-does">What it does</a> · <a href="#installation">Installation</a> · <a href="#usage">Usage</a> · <a href="#setup-and-configuration">Setup and configuration</a> · <a href="#details">Details</a> · <a href="#development">Development</a>
7
+ </p>
8
+
9
+ Larkin is a local Runtime Host that connects Codex, Claude Code, and Pi agent runtimes to Feishu (Lark). It keeps sessions, reminders, interactive messages, and a local dashboard close to the machine that runs them.
4
10
 
5
11
  ## Requirements
6
12
 
@@ -9,9 +15,56 @@ Larkin connects Codex, Claude Code, and Pi agent runtimes to Feishu (Lark). It p
9
15
  - At least one supported agent runtime and its authentication
10
16
  - Bun 1.3.14 when running the npm package or building from source (standalone binaries bundle their own runtime)
11
17
 
18
+ ## Quick start
19
+
20
+ ```bash
21
+ npx larkin@latest setup
22
+ npx larkin@latest start
23
+ npx larkin@latest status
24
+ ```
25
+
26
+ ## What it does
27
+
28
+ <table>
29
+ <tr>
30
+ <td valign="top">
31
+
32
+ **Runtime host**
33
+
34
+ Connect supported coding-agent runtimes to Feishu from one local process.
35
+
36
+ </td>
37
+ <td valign="top">
38
+
39
+ **Persistent workflow**
40
+
41
+ Keep sessions and reminders available across runs.
42
+
43
+ </td>
44
+ </tr>
45
+ <tr>
46
+ <td valign="top">
47
+
48
+ **Message surfaces**
49
+
50
+ Work with Feishu messages, interactive cards, and related automation.
51
+
52
+ </td>
53
+ <td valign="top">
54
+
55
+ **Local visibility**
56
+
57
+ Inspect the host through the embedded dashboard and OpenTelemetry traces.
58
+
59
+ </td>
60
+ </tr>
61
+ </table>
62
+
63
+ The rest of this document uses the short `larkin` form; it works as-is after `npm install -g larkin`, or prefix any command with `npx larkin@latest` to run it without installing.
64
+
12
65
  ## Installation
13
66
 
14
- Larkin is published to the npm registry and also distributed as standalone binaries. Prefer npm:
67
+ Prefer npm:
15
68
 
16
69
  ```bash
17
70
  # Run the latest version directly with npx — no install step, always the newest release
@@ -26,39 +79,28 @@ Standalone binaries for macOS, Linux, and Windows (x64) are attached to every [G
26
79
 
27
80
  ## Usage
28
81
 
29
- ```bash
30
- npx larkin@latest setup
31
- npx larkin@latest start
32
- npx larkin@latest status
33
- ```
34
-
35
- The rest of this document uses the short `larkin` form; it works as-is after `npm install -g larkin`, or prefix any command with `npx larkin@latest` to run it without installing.
36
-
37
- Run `larkin --help` or `larkin config --help` for the available commands and configuration options. Local configuration is stored under `~/.larkin` by default; set `LARKIN_CONFIG_DIR` to use another directory.
82
+ Run `larkin --help` or `larkin config --help` for the available commands and configuration options. `larkin agents` reports event readiness, reply-scope readiness, subscription mode/status/dimension, arrivals, and read failures. Local configuration is stored under `~/.larkin` by default; set `LARKIN_CONFIG_DIR` to use another directory.
38
83
 
39
84
  ### Feishu message links
40
85
 
41
86
  Feishu clients do not reliably render Markdown links such as `[label](URL)` as clickable in text or Markdown messages. When a recipient must be able to open a link, keep the complete bare HTTPS URL visible, for example: Issue 115 — https://github.com/eddiearc/larkin/issues/115. A label may accompany it, but must not replace the bare URL. Larkin does not rewrite exact, verbatim, or user-authored message bodies to enforce this guidance.
42
87
 
43
- During setup, a new Agent is offered Pi first, followed by Codex and Claude Code. Pi can use an existing
44
- official `pi` installation or the official Pi runtime bundled in Larkin. The bundled option supports
45
- DeepSeek, Kimi/Moonshot, MiniMax, Zhipu/BigModel, and a custom OpenAI-compatible Base URL. Provider keys
46
- are stored only in the selected Agent's private provider directory, not in the ordinary Agent config. Setup
47
- also discovers every API-key and OAuth/subscription login exposed by the pinned official Pi registry and
48
- delegates those flows to Pi. Use `larkin pi-auth status` or `larkin pi-auth logout <provider>` to manage them.
49
- The builtin Pi runtime loads Larkin's two supported extensions inline: background subagents and the 60-second
50
- foreground bash timeout guard are enabled without writing extension files or arguments. A compatible external
51
- Pi installation keeps the existing explicit `-e` extension path.
88
+ ## Setup and configuration
89
+
90
+ During setup, a new Agent is offered Pi first, followed by Codex and Claude Code. Provider keys are stored only in the selected Agent's private provider directory, not in the ordinary Agent config. Setup also discovers every API-key and OAuth/subscription login exposed by the pinned official Pi registry and delegates those flows to Pi.
91
+
92
+ Use `larkin pi-auth status` or `larkin pi-auth logout <provider>` to manage Pi auth. The builtin Pi runtime loads Larkin's two supported extensions inline: background subagents and the 60-second foreground bash timeout guard are enabled without writing extension files or arguments. A compatible external Pi installation keeps the existing explicit `-e` extension path.
93
+
94
+ The bundled Pi identity is pinned to `@earendil-works/pi-coding-agent@0.84.2` in both `package.json` and `bun.lock`. Larkin launches it through the official RPC entrypoint and verifies the real RPC state/event handshake, compaction capability contract, and persisted session file before claiming readiness. The integration smoke test completes a provider turn, closes the process, and resumes the same session file; missing resume data fails closed instead of creating a fresh session.
95
+
96
+ For a controlled per-Agent switch, use `larkin pi-distribution show --agent <App ID>`, then provide a private snapshot destination for the atomic mutation: `larkin pi-distribution builtin --agent <App ID> --snapshot <private-file>`. Existing external Pi users can explicitly migrate the pinned 0.84.2 profile with `--import-external-profile`; this imports only `auth.json`, `models.json`, and `settings.json` into a new private per-Agent directory, preserves provider/model/auth bytes, and owns compaction at 40800/20000. Without that flag, builtin selection fails closed unless provider state is already configured. Roll back only when the snapshot CAS still matches with `larkin pi-distribution rollback --snapshot <private-file>`. Import and config changes are journaled together; source/target tampering refuses rollback, and sessions, Inbox data, unrelated provider files, and other Agents remain untouched.
52
97
 
53
- ### Windows support boundary and optional autostart
98
+ <details>
99
+ <summary>Windows support and optional autostart</summary>
54
100
 
55
- Windows 11 x64 core support covers the standalone CLI, local Runtime Host startup, builtin Pi RPC with the
56
- inline extensions above, and the embedded Dashboard. Provider authentication, the official `lark-cli`, and
57
- external Codex, Claude Code, or Pi executables remain separately installed dependencies; secret-bearing live
58
- channel/provider tests are intentionally outside the hosted Windows CI gate.
101
+ Windows 11 x64 core support covers the standalone CLI, local Runtime Host startup, builtin Pi RPC with the inline extensions above, and the embedded Dashboard. Provider authentication, the official `lark-cli`, and external Codex, Claude Code, or Pi executables remain separately installed dependencies; secret-bearing live channel/provider tests are intentionally outside the hosted Windows CI gate.
59
102
 
60
- An Administrator account can optionally start Larkin at that account's interactive logon with Task Scheduler.
61
- From an elevated PowerShell prompt, adjust the executable and working-directory paths first:
103
+ An Administrator account can optionally start Larkin at that account's interactive logon with Task Scheduler. From an elevated PowerShell prompt, adjust the executable and working-directory paths first:
62
104
 
63
105
  ```powershell
64
106
  $Exe = 'C:\Tools\Larkin\larkin.exe'
@@ -69,13 +111,13 @@ Register-ScheduledTask -TaskName 'Larkin Runtime Host' -Action $Action -Trigger
69
111
  -Description 'Start Larkin for this Administrator account at logon' -RunLevel Highest
70
112
  ```
71
113
 
72
- This is an optional per-user Administrator-logon task, not SYSTEM boot support or a Windows service. Keep the
73
- account profile available because Larkin stores its state there. Release executables are currently unsigned;
74
- normal Windows security policy and SmartScreen decisions still apply.
114
+ This is an optional per-user Administrator-logon task, not SYSTEM boot support or a Windows service. Keep the account profile available because Larkin stores its state there. Release executables are currently unsigned; normal Windows security policy and SmartScreen decisions still apply.
115
+ </details>
75
116
 
76
- For supported Feishu cloud-document comments (`doc`, `docx`, `sheet`, and `file`), the safe default accepts only comments or replies that @ the Bot. Document comments never reuse IM `require`/`free` settings. An explicit platform-verified application-dimension Bot subscription accepts every supported comment event that Feishu actually delivers, whether or not it mentions the Bot. Larkin stores accepted comments as `kind=document_comment` canonical Inbox events and wakes the Bot's persistent Agent. Replies are bound back to the exact comment; whole-document comments use Feishu's top-level fallback. `larkin setup --comment-subscription application` makes the broad trigger surface explicit, creates the Bot subscription through the official `lark-cli` structured API, and then verifies it with the read-only platform status API. `--comment-subscription none` explicitly removes that application subscription and verifies removal. Until positive status verification, only @Bot comments enter the Inbox. Setup requests `docs:document.comment:create` for both in-thread replies and whole-document `create_v2` fallback, while retaining `drive:drive` for event/read support. `larkin agents` reports event readiness, reply-scope readiness, subscription mode/status/dimension, arrivals, and read failures.
117
+ ## Details
77
118
 
78
- ## OpenTelemetry traces
119
+ <details>
120
+ <summary>OpenTelemetry traces</summary>
79
121
 
80
122
  Larkin records a privacy-safe timing waterfall for each woken Feishu message. Tracing is always enabled, and ended spans first enter a durable local OTLP/HTTP JSON spool. Message processing therefore does not depend on an observability backend being reachable.
81
123
 
@@ -136,6 +178,7 @@ larkin.message.process
136
178
  ```
137
179
 
138
180
  The compose stack binds Grafana, Tempo, and OTLP only to `127.0.0.1` and persists `/data`. It is intended for development, demos, and testing. Do not expose its default credentials or plaintext OTLP port publicly; use a deployment-owned TLS/authenticated endpoint or private network for remote automatic upload.
181
+ </details>
139
182
 
140
183
  ## Development
141
184