larkin 0.3.3 → 0.4.2
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 +72 -33
- package/assets/readme/larkin-hero.svg +111 -0
- package/dist/agent/agent-state-store.cjs +321 -22
- package/dist/agent/agent-state-store.mjs +320 -22
- package/dist/agent/agent-transport.cjs +6 -4
- package/dist/agent/agent-transport.mjs +6 -4
- package/dist/agent/host-reminder-orchestrator.cjs +9 -3
- package/dist/agent/host-reminder-orchestrator.mjs +9 -3
- package/dist/agent/inbox-projection.cjs +114 -23
- package/dist/agent/inbox-projection.mjs +112 -23
- package/dist/app/cli.mjs +3 -1
- package/dist/app/local-control.mjs +108 -2
- package/dist/app/runtime-process.mjs +4 -0
- package/dist/app/session-cli.mjs +55 -20
- package/dist/feishu/document-comment.cjs +2 -1
- package/dist/feishu/document-comment.mjs +2 -1
- package/dist/feishu/host-business-state.cjs +7 -2
- package/dist/feishu/host-business-state.mjs +7 -2
- package/dist/feishu/host-shell.cjs +138 -32
- package/dist/feishu/host-shell.mjs +138 -32
- package/dist/runtime/pi-compaction-recovery.cjs +623 -0
- package/dist/runtime/pi-compaction-recovery.mjs +602 -0
- package/dist/runtime/pi-provider-config.cjs +2 -2
- package/dist/runtime/pi-provider-config.mjs +2 -2
- package/dist/runtime/pi-rpc-client.cjs +39 -22
- package/dist/runtime/pi-rpc-client.mjs +39 -22
- package/dist/runtime/provider-error-classifier.cjs +39 -0
- package/dist/runtime/provider-error-classifier.mjs +34 -0
- package/dist/runtime/runtime-adapters.mjs +82 -19
- package/dist/runtime/runtime-host.cjs +663 -12
- package/dist/runtime/runtime-host.mjs +661 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./assets/readme/larkin-hero.svg" 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
|
-
|
|
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
|
-
|
|
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,24 @@ Standalone binaries for macOS, Linux, and Windows (x64) are attached to every [G
|
|
|
26
79
|
|
|
27
80
|
## Usage
|
|
28
81
|
|
|
29
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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.
|
|
52
93
|
|
|
53
|
-
|
|
94
|
+
<details>
|
|
95
|
+
<summary>Windows support and optional autostart</summary>
|
|
54
96
|
|
|
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.
|
|
97
|
+
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
98
|
|
|
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:
|
|
99
|
+
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
100
|
|
|
63
101
|
```powershell
|
|
64
102
|
$Exe = 'C:\Tools\Larkin\larkin.exe'
|
|
@@ -69,13 +107,13 @@ Register-ScheduledTask -TaskName 'Larkin Runtime Host' -Action $Action -Trigger
|
|
|
69
107
|
-Description 'Start Larkin for this Administrator account at logon' -RunLevel Highest
|
|
70
108
|
```
|
|
71
109
|
|
|
72
|
-
This is an optional per-user Administrator-logon task, not SYSTEM boot support or a Windows service. Keep the
|
|
73
|
-
|
|
74
|
-
normal Windows security policy and SmartScreen decisions still apply.
|
|
110
|
+
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.
|
|
111
|
+
</details>
|
|
75
112
|
|
|
76
|
-
|
|
113
|
+
## Details
|
|
77
114
|
|
|
78
|
-
|
|
115
|
+
<details>
|
|
116
|
+
<summary>OpenTelemetry traces</summary>
|
|
79
117
|
|
|
80
118
|
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
119
|
|
|
@@ -136,6 +174,7 @@ larkin.message.process
|
|
|
136
174
|
```
|
|
137
175
|
|
|
138
176
|
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.
|
|
177
|
+
</details>
|
|
139
178
|
|
|
140
179
|
## Development
|
|
141
180
|
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="400" viewBox="0 0 1200 400" role="img" aria-labelledby="title desc">
|
|
2
|
+
<title id="title">Larkin local runtime host</title>
|
|
3
|
+
<desc id="desc">A project-native hero showing Codex, Claude Code, and Pi connecting through Larkin to Feishu, reminders, interactive messages, and a local dashboard.</desc>
|
|
4
|
+
<defs>
|
|
5
|
+
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
|
|
6
|
+
<stop offset="0%" stop-color="#07111f"/>
|
|
7
|
+
<stop offset="100%" stop-color="#0c1730"/>
|
|
8
|
+
</linearGradient>
|
|
9
|
+
<radialGradient id="glow-cyan" cx="0" cy="0" r="1">
|
|
10
|
+
<stop offset="0%" stop-color="#00b8d9" stop-opacity="0.34"/>
|
|
11
|
+
<stop offset="100%" stop-color="#00b8d9" stop-opacity="0"/>
|
|
12
|
+
</radialGradient>
|
|
13
|
+
<radialGradient id="glow-blue" cx="0" cy="0" r="1">
|
|
14
|
+
<stop offset="0%" stop-color="#1456f0" stop-opacity="0.28"/>
|
|
15
|
+
<stop offset="100%" stop-color="#1456f0" stop-opacity="0"/>
|
|
16
|
+
</radialGradient>
|
|
17
|
+
<linearGradient id="core" x1="0" y1="0" x2="1" y2="1">
|
|
18
|
+
<stop offset="0%" stop-color="#11284f"/>
|
|
19
|
+
<stop offset="100%" stop-color="#0e1f3f"/>
|
|
20
|
+
</linearGradient>
|
|
21
|
+
<linearGradient id="pill" x1="0" y1="0" x2="1" y2="1">
|
|
22
|
+
<stop offset="0%" stop-color="#11203f"/>
|
|
23
|
+
<stop offset="100%" stop-color="#0b1528"/>
|
|
24
|
+
</linearGradient>
|
|
25
|
+
<pattern id="grid" width="36" height="36" patternUnits="userSpaceOnUse">
|
|
26
|
+
<path d="M 36 0 L 0 0 0 36" fill="none" stroke="#ffffff" stroke-opacity="0.04" stroke-width="1"/>
|
|
27
|
+
</pattern>
|
|
28
|
+
</defs>
|
|
29
|
+
|
|
30
|
+
<rect width="1200" height="400" rx="28" fill="url(#bg)"/>
|
|
31
|
+
<rect width="1200" height="400" rx="28" fill="url(#grid)"/>
|
|
32
|
+
<circle cx="140" cy="60" r="230" fill="url(#glow-cyan)"/>
|
|
33
|
+
<circle cx="1080" cy="52" r="260" fill="url(#glow-blue)"/>
|
|
34
|
+
<circle cx="1010" cy="340" r="220" fill="url(#glow-cyan)" opacity="0.45"/>
|
|
35
|
+
|
|
36
|
+
<g id="title-block" transform="translate(56 56)" fill="#f7fbff" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif">
|
|
37
|
+
<text x="0" y="0" font-size="16" font-weight="700" letter-spacing="3.4" fill="#8fb7d8">LOCAL RUNTIME HOST</text>
|
|
38
|
+
<text x="0" y="80" font-size="76" font-weight="800" letter-spacing="-1.8">Larkin</text>
|
|
39
|
+
<text x="0" y="128" font-size="30" font-weight="600" fill="#d9e8ff">Connect Codex, Claude Code, and Pi</text>
|
|
40
|
+
<text x="0" y="166" font-size="30" font-weight="600" fill="#d9e8ff">to Feishu with one local host.</text>
|
|
41
|
+
<text x="0" y="210" font-size="20" font-weight="500" fill="#9cb4cf">Persistent sessions · reminders · interactive messages · local dashboard</text>
|
|
42
|
+
|
|
43
|
+
<g transform="translate(0 238)" font-size="18" font-weight="700" fill="#ecf4ff">
|
|
44
|
+
<rect x="0" y="0" width="138" height="38" rx="19" fill="#0f1b33" stroke="#223556"/>
|
|
45
|
+
<text x="69" y="24" text-anchor="middle">npm package</text>
|
|
46
|
+
<rect x="150" y="0" width="176" height="38" rx="19" fill="#0f1b33" stroke="#223556"/>
|
|
47
|
+
<text x="238" y="24" text-anchor="middle">standalone binaries</text>
|
|
48
|
+
<rect x="338" y="0" width="150" height="38" rx="19" fill="#0f1b33" stroke="#223556"/>
|
|
49
|
+
<text x="413" y="24" text-anchor="middle">Bun 1.3.14</text>
|
|
50
|
+
</g>
|
|
51
|
+
|
|
52
|
+
<g transform="translate(0 292)">
|
|
53
|
+
<rect x="0" y="0" width="408" height="48" rx="14" fill="#07111f" stroke="#244068"/>
|
|
54
|
+
<text x="18" y="31" font-size="18" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" fill="#8ff0ff">npx larkin@latest setup</text>
|
|
55
|
+
<text x="240" y="31" font-size="18" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" fill="#8fb7d8">→ start → status</text>
|
|
56
|
+
</g>
|
|
57
|
+
</g>
|
|
58
|
+
|
|
59
|
+
<g id="project-proof" transform="translate(706 50)" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, sans-serif">
|
|
60
|
+
<rect x="0" y="0" width="444" height="300" rx="26" fill="#0b162b" fill-opacity="0.92" stroke="#2a3f63"/>
|
|
61
|
+
<text x="24" y="34" font-size="16" font-weight="700" letter-spacing="2.6" fill="#8fb7d8">RUNTIME GRAPH</text>
|
|
62
|
+
|
|
63
|
+
<g fill="#eff6ff" font-size="17" font-weight="700">
|
|
64
|
+
<rect x="24" y="74" width="120" height="44" rx="22" fill="url(#pill)" stroke="#264267"/>
|
|
65
|
+
<text x="84" y="101" text-anchor="middle">Codex</text>
|
|
66
|
+
|
|
67
|
+
<rect x="24" y="136" width="120" height="44" rx="22" fill="url(#pill)" stroke="#264267"/>
|
|
68
|
+
<text x="84" y="163" text-anchor="middle">Claude Code</text>
|
|
69
|
+
|
|
70
|
+
<rect x="24" y="198" width="120" height="44" rx="22" fill="url(#pill)" stroke="#264267"/>
|
|
71
|
+
<text x="84" y="225" text-anchor="middle">Pi</text>
|
|
72
|
+
</g>
|
|
73
|
+
|
|
74
|
+
<g stroke-linecap="round" fill="#eff6ff">
|
|
75
|
+
<path d="M144 96 C 196 96, 220 118, 252 132" stroke="#00b8d9" stroke-opacity="0.76" stroke-width="3"/>
|
|
76
|
+
<path d="M144 158 C 196 158, 220 154, 252 150" stroke="#1456f0" stroke-opacity="0.76" stroke-width="3"/>
|
|
77
|
+
<path d="M144 220 C 196 220, 220 186, 252 168" stroke="#a3402c" stroke-opacity="0.72" stroke-width="3"/>
|
|
78
|
+
<path d="M322 150 C 338 150, 352 122, 328 108" stroke="#00b8d9" stroke-opacity="0.42" stroke-width="3"/>
|
|
79
|
+
<path d="M322 150 C 338 150, 352 156, 328 156" stroke="#1456f0" stroke-opacity="0.42" stroke-width="3"/>
|
|
80
|
+
<path d="M322 150 C 338 150, 352 192, 328 214" stroke="#a3402c" stroke-opacity="0.42" stroke-width="3"/>
|
|
81
|
+
<path d="M322 150 C 338 150, 352 232, 328 266" stroke="#8fb7d8" stroke-opacity="0.42" stroke-width="3"/>
|
|
82
|
+
</g>
|
|
83
|
+
|
|
84
|
+
<g>
|
|
85
|
+
<rect x="252" y="92" width="70" height="116" rx="26" fill="url(#core)" stroke="#00b8d9" stroke-opacity="0.7"/>
|
|
86
|
+
<rect x="266" y="108" width="42" height="18" rx="9" fill="#0b162b" stroke="#27456f"/>
|
|
87
|
+
<text x="287" y="122" text-anchor="middle" font-size="10" font-weight="800" fill="#8fb7d8" letter-spacing="1.6">CORE</text>
|
|
88
|
+
<text x="287" y="158" text-anchor="middle" font-size="24" font-weight="800" fill="#f7fbff">LARKIN</text>
|
|
89
|
+
<text x="287" y="181" text-anchor="middle" font-size="12" font-weight="600" fill="#9cb4cf">local host</text>
|
|
90
|
+
</g>
|
|
91
|
+
|
|
92
|
+
<g fill="#eff6ff" font-size="15" font-weight="700">
|
|
93
|
+
<rect x="328" y="92" width="92" height="34" rx="17" fill="#0f1b33" stroke="#264267"/>
|
|
94
|
+
<text x="374" y="113" text-anchor="middle">Feishu</text>
|
|
95
|
+
|
|
96
|
+
<rect x="328" y="144" width="92" height="34" rx="17" fill="#0f1b33" stroke="#264267"/>
|
|
97
|
+
<text x="374" y="165" text-anchor="middle">Cards</text>
|
|
98
|
+
|
|
99
|
+
<rect x="328" y="196" width="92" height="34" rx="17" fill="#0f1b33" stroke="#264267"/>
|
|
100
|
+
<text x="374" y="217" text-anchor="middle">Reminders</text>
|
|
101
|
+
|
|
102
|
+
<rect x="328" y="248" width="92" height="34" rx="17" fill="#0f1b33" stroke="#264267"/>
|
|
103
|
+
<text x="374" y="269" text-anchor="middle">Dashboard</text>
|
|
104
|
+
</g>
|
|
105
|
+
|
|
106
|
+
<g>
|
|
107
|
+
<rect x="24" y="254" width="214" height="26" rx="13" fill="#07111f" stroke="#244068"/>
|
|
108
|
+
<text x="38" y="272" font-size="12" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" fill="#8fb7d8">sessions + traces + local config</text>
|
|
109
|
+
</g>
|
|
110
|
+
</g>
|
|
111
|
+
</svg>
|