@1agents/session-reader 0.5.1 → 0.6.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 +61 -12
- package/dist/bin/1session.js +4 -3
- package/dist/src/parsers/dsh.d.ts +2 -0
- package/dist/src/parsers/dsh.js +298 -0
- package/dist/src/parsers/grok.d.ts +7 -0
- package/dist/src/parsers/grok.js +554 -0
- package/dist/src/parsers/provider.d.ts +7 -0
- package/dist/src/resolver.js +19 -6
- package/dist/src/serve/http.js +13 -1
- package/dist/src/serve/node.js +14 -6
- package/dist/src/skill.d.ts +3 -3
- package/dist/src/skill.js +12 -2
- package/dist/src/store/nul.d.ts +12 -0
- package/dist/src/store/nul.js +52 -0
- package/dist/src/store/read.js +4 -3
- package/dist/src/store/schema.d.ts +3 -3
- package/dist/src/store/schema.js +3 -3
- package/dist/src/store/write.js +3 -2
- package/dist/src/types.d.ts +1 -1
- package/dist/src/util/text.js +3 -0
- package/dist/src/util/zstd.d.ts +14 -0
- package/dist/src/util/zstd.js +129 -0
- package/dist/src/writes.js +19 -2
- package/package.json +5 -3
- package/skills/1session/SKILL.md +48 -9
- package/skills/1session/evals/evals.json +43 -1
- package/skills/1session/references/cli.md +1 -1
- package/skills/1session/references/install.md +195 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Installing and spreading 1session
|
|
2
|
+
|
|
3
|
+
Read this when the probe in SKILL.md fails in a way the two-line fallback does
|
|
4
|
+
not cover, or when the user asks how to get this onto another machine or into
|
|
5
|
+
another agent.
|
|
6
|
+
|
|
7
|
+
- [What it needs](#what-it-needs)
|
|
8
|
+
- [Three ways to run it](#three-ways-to-run-it)
|
|
9
|
+
- [Spreading the skill to every agent](#spreading-the-skill-to-every-agent)
|
|
10
|
+
- [Upgrading](#upgrading)
|
|
11
|
+
- [Uninstalling](#uninstalling)
|
|
12
|
+
- [Handing it to someone else](#handing-it-to-someone-else)
|
|
13
|
+
- [Troubleshooting](#troubleshooting)
|
|
14
|
+
|
|
15
|
+
## What it needs
|
|
16
|
+
|
|
17
|
+
**Node.js >= 22.15**, and nothing else. The version floor is real, not
|
|
18
|
+
defensive: the index is `node:sqlite` and dsh's sessions are zstd-compressed,
|
|
19
|
+
which only landed in `node:zlib` in 22.15. On an older runtime the package
|
|
20
|
+
installs and then fails at the first call, so check first:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
node -v
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
If it is below 22.15, say so and stop. `npx` runs the same code on the same
|
|
27
|
+
runtime and will fail identically — there is no way around it except upgrading
|
|
28
|
+
Node (`nvm install 22`, `brew upgrade node`, or whatever that machine uses).
|
|
29
|
+
|
|
30
|
+
Everything else is already on the machine. The only runtime dependency is
|
|
31
|
+
`@1agents/dreammate-network` (12 kB, zero dependencies of its own), which npm
|
|
32
|
+
pulls in automatically. There is no daemon, no service to start, no config file,
|
|
33
|
+
and no account. The reader opens session files the agents already wrote and
|
|
34
|
+
never writes back to them.
|
|
35
|
+
|
|
36
|
+
macOS, Linux and WSL all work. On native Windows the paths it reads
|
|
37
|
+
(`~/.claude`, `~/.codex`, …) resolve through `os.homedir()`, but it is the least
|
|
38
|
+
exercised platform — if something looks wrong there, check that the agent in
|
|
39
|
+
question actually stores sessions under the Windows home directory before
|
|
40
|
+
assuming the reader is broken.
|
|
41
|
+
|
|
42
|
+
## Three ways to run it
|
|
43
|
+
|
|
44
|
+
**Zero install (`npx`).** Correct for a one-off answer, for a machine you are
|
|
45
|
+
only visiting, and for the first call before anyone has agreed to install
|
|
46
|
+
anything:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx -y @1agents/session-reader@latest list --global --limit 10
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Every command in SKILL.md works with this prefix substituted for `1session`.
|
|
53
|
+
The cost is a few seconds of download per invocation and a cache directory npm
|
|
54
|
+
cleans up on its own schedule — fine for answering, wrong as a permanent setup
|
|
55
|
+
(see the warning under [spreading](#spreading-the-skill-to-every-agent)).
|
|
56
|
+
|
|
57
|
+
**Global install.** The normal choice for a machine the user works on daily:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm i -g @1agents/session-reader
|
|
61
|
+
1session help # verify: prints the command list
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**As a library.** The parsers and ledgers are exported, so a script can consume
|
|
65
|
+
sessions without shelling out:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm i @1agents/session-reader
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
import { listSessions } from '@1agents/session-reader';
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Reach for this only when the user is building something on top of session data.
|
|
76
|
+
For answering questions about the past, the CLI is both cheaper and denser.
|
|
77
|
+
|
|
78
|
+
## Spreading the skill to every agent
|
|
79
|
+
|
|
80
|
+
The package ships this skill inside it, and the CLI installs it into every
|
|
81
|
+
agent's skills directory in one call:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
1session skill install # all agents found on this machine
|
|
85
|
+
1session skill status # what is installed where, and whether it is current
|
|
86
|
+
1session skill uninstall # remove it again
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
| Agent | Where it lands |
|
|
90
|
+
| --- | --- |
|
|
91
|
+
| claude | `~/.claude/skills/1session` |
|
|
92
|
+
| codex | `~/.codex/skills/1session` |
|
|
93
|
+
| antigravity | `~/.gemini/antigravity/skills/1session` (**not** `~/.gemini/skills`, which is gemini-cli's) |
|
|
94
|
+
| grok | `~/.grok/skills/1session` |
|
|
95
|
+
| dsh | `~/.dsh/skills/1session` |
|
|
96
|
+
|
|
97
|
+
All five load `<dir>/<name>/SKILL.md` with the same YAML frontmatter, so it is
|
|
98
|
+
genuinely one file serving five agents, not five ports of it.
|
|
99
|
+
|
|
100
|
+
**Do not run `skill install` through `npx`.** In link mode — the default — the
|
|
101
|
+
installed entry is a symlink back to wherever the package lives, and under npx
|
|
102
|
+
that is a cache directory like `~/.npm/_npx/<hash>/node_modules/…` which npm
|
|
103
|
+
garbage-collects. The skill works right up until the day the cache is pruned and
|
|
104
|
+
then silently disappears from all five agents. Install the package globally
|
|
105
|
+
first and then run `skill install`; if you truly must bootstrap through npx, use
|
|
106
|
+
`--copy` so the bytes are owned by the agent rather than borrowed from a cache.
|
|
107
|
+
|
|
108
|
+
Link mode is otherwise the better default: after `npm i -g …@latest`, every
|
|
109
|
+
agent is already looking at the new skill with nothing to re-run. Use `--copy`
|
|
110
|
+
when an agent's loader does not follow symlinks — the symptom is `skill status`
|
|
111
|
+
reporting a healthy link while the agent itself never mentions the skill. The
|
|
112
|
+
cost of a copy is that upgrades no longer propagate; `skill status` marks a copy
|
|
113
|
+
that has drifted from the installed package, so the drift is visible rather than
|
|
114
|
+
silent.
|
|
115
|
+
|
|
116
|
+
Other flags:
|
|
117
|
+
|
|
118
|
+
| Flag | Why |
|
|
119
|
+
| --- | --- |
|
|
120
|
+
| `--agent claude,codex` | Only these. Named agents get their skills directory created even if the agent is not installed yet, which is how you set a machine up before installing the agent. |
|
|
121
|
+
| `--copy` | Copy instead of symlink. |
|
|
122
|
+
| `--force` | Overwrite a same-named entry that this installer did not create, or convert an existing copy into a link. Without it, both cases are refused rather than clobbered. |
|
|
123
|
+
| `--dry-run` | Print the plan and touch nothing. Worth doing first on someone else's machine. |
|
|
124
|
+
| `--json` | Machine-readable result. |
|
|
125
|
+
|
|
126
|
+
Agents that are not installed are skipped rather than failed, so a machine with
|
|
127
|
+
only Claude Code reports three skips and one install, and that is success.
|
|
128
|
+
|
|
129
|
+
## Upgrading
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
npm i -g @1agents/session-reader@latest
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Linked skills are current the moment that finishes. Copied ones need
|
|
136
|
+
`1session skill install --copy --force` afterwards; `1session skill status` is
|
|
137
|
+
what tells you which case you are in.
|
|
138
|
+
|
|
139
|
+
The index rebuilds itself when the parser version moves, so an upgrade that
|
|
140
|
+
changes how sessions are read costs one slower call and needs no manual
|
|
141
|
+
clearing. To force it: `1session index --all --global`.
|
|
142
|
+
|
|
143
|
+
## Uninstalling
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
1session skill uninstall # remove the skill from the agents
|
|
147
|
+
npm rm -g @1agents/session-reader
|
|
148
|
+
rm -rf ~/.1agents/session-reader # the index; sessions themselves are untouched
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`skill uninstall` only removes entries it could have created (its own links and
|
|
152
|
+
copies); anything else needs `--force`, which exists so a hand-written skill of
|
|
153
|
+
the same name is never deleted by accident. Nothing here touches the agents'
|
|
154
|
+
session files — the reader has never written to them.
|
|
155
|
+
|
|
156
|
+
## Handing it to someone else
|
|
157
|
+
|
|
158
|
+
The whole thing is one npm package, so the shortest correct instruction is two
|
|
159
|
+
lines:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
npm i -g @1agents/session-reader
|
|
163
|
+
1session skill install
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
That is the version to paste into a chat or a README. It gets them the CLI and
|
|
167
|
+
puts the skill into every agent they have, which is the part people forget: a
|
|
168
|
+
colleague who installs only the CLI has to remember it exists, while one who ran
|
|
169
|
+
both lines has their agent remember for them.
|
|
170
|
+
|
|
171
|
+
If they cannot install globally (locked-down machine, shared box), the npx form
|
|
172
|
+
plus `skill install --copy` gets them to the same place with the package living
|
|
173
|
+
in a cache instead of `/usr/local`.
|
|
174
|
+
|
|
175
|
+
If they want to read the source or file a bug:
|
|
176
|
+
<https://github.com/scottzx/session-reader>.
|
|
177
|
+
|
|
178
|
+
When you are the one setting this up on a user's machine, prefer offering these
|
|
179
|
+
commands over running them unasked — a global npm install changes their system.
|
|
180
|
+
Running the read-only CLI to answer a question is not the same kind of act as
|
|
181
|
+
installing software, and the difference is worth respecting.
|
|
182
|
+
|
|
183
|
+
## Troubleshooting
|
|
184
|
+
|
|
185
|
+
| Symptom | What is actually wrong |
|
|
186
|
+
| --- | --- |
|
|
187
|
+
| `1session: command not found` right after `npm i -g` | npm's global bin directory is not on `PATH`. It is `$(npm prefix -g)/bin` — `npm bin -g` was removed in npm 9, so use the prefix form — and it goes in the shell profile. Meanwhile `npx -y @1agents/session-reader@latest …` works unchanged. |
|
|
188
|
+
| `EACCES` / permission denied during `npm i -g` | The global prefix is root-owned. Do not reach for `sudo npm` — repoint the prefix (`npm config set prefix ~/.npm-global`, then put `~/.npm-global/bin` on `PATH`) or use a Node version manager, both of which leave the system directories alone. |
|
|
189
|
+
| Installs fine, then throws on the first real command | Almost always Node < 22.15 — `node:sqlite` or zstd missing. Check `node -v`. |
|
|
190
|
+
| `skill status` shows a healthy link, but the agent never uses the skill | That agent's loader does not follow symlinks. `1session skill install --copy --force`. |
|
|
191
|
+
| The skill vanished from every agent at once | It was installed in link mode from an npx cache that npm has since pruned. Install the package globally, then `1session skill install --force`. |
|
|
192
|
+
| `skill install` reports `blocked` | Something else already owns that name — a hand-written skill, or a copy where a link is wanted. Look at it before passing `--force`. |
|
|
193
|
+
| The first call takes ~10s | That is the initial index build over every session on the machine, not a hang. Subsequent calls are sub-second. |
|
|
194
|
+
| Results look stale or wrong | `1session index --all --global` rebuilds, and `--no-index` on any command reads the raw files directly — if those two disagree, that is a real bug worth reporting. |
|
|
195
|
+
| `list` returns nothing in a directory that definitely had sessions | Scope, not installation. `list` defaults to the pwd subtree; add `--global`. |
|