@ghostpaw/questlog 0.9.2 → 0.11.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 +144 -4
- package/SKILL.md +95 -40
- package/dist/chunk-7KTRNXTU.js +21 -0
- package/dist/chunk-D6EGZCT7.js +23 -0
- package/dist/chunk-GVD6A3RR.js +108 -0
- package/dist/{chunk-6KTQK3ZE.js → chunk-I2AMIXGP.js} +8 -0
- package/dist/{chunk-3B6FMHZU.js → chunk-IA2GVCZS.js} +35 -2
- package/dist/{chunk-DKH623HU.js → chunk-IL2QRKZL.js} +1 -4
- package/dist/{chunk-UTUQPSGO.js → chunk-KOWIVBG6.js} +68 -588
- package/dist/chunk-NBCCA6AX.js +31 -0
- package/dist/chunk-QK3H2AL5.js +36 -0
- package/dist/chunk-RBGQK5WP.js +949 -0
- package/dist/cli.js +1 -1
- package/dist/{cli_main-XNZP4TY2.js → cli_main-TEG3QTDP.js} +147 -128
- package/dist/index.cjs +1152 -627
- package/dist/index.d.cts +142 -11
- package/dist/index.d.ts +142 -11
- package/dist/index.js +1152 -628
- package/dist/list_deliveries-WJEJUZIQ.js +2 -0
- package/dist/list_hooks-C5CAA2C7.js +2 -0
- package/dist/mcp-server.js +840 -389
- package/dist/mcp.cjs +709 -322
- package/dist/mcp.js +711 -324
- package/dist/open_questlog_db-6NS6BVBC.js +2 -0
- package/dist/{questlog_skill_spec-EM6DGGVN.js → questlog_skill_spec-ILTCTRYS.js} +16 -8
- package/dist/run_hook_command-BOENYNDT.js +155 -0
- package/dist/{serve_questlog_mcp-KFUYJB2P.js → serve_questlog_mcp-X524X34F.js} +6 -3
- package/dist/{skill_markdown-HXYQ3K6U.js → skill_markdown-EGKYZ3W2.js} +4 -20
- package/dist/text_output-X7F3K23Q.js +2 -0
- package/package.json +1 -1
- package/skills/questlog/SKILL.md +95 -40
- package/skills/questlog/references/webhooks.md +94 -0
- package/dist/open_questlog_db-SH3DAU4C.js +0 -2
package/README.md
CHANGED
|
@@ -88,10 +88,14 @@ Lists show local due dates, overdue markers, and recorded outcomes. Plain JSON
|
|
|
88
88
|
adds ISO UTC siblings for numeric timestamp fields ending in `At`.
|
|
89
89
|
`done` stores `--outcome` with the finished quest; without it the command asks for one and exits 3.
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
Commands print text by default, including hooks, delivery views and each watch tick; `call` and direct tool commands return the raw tool result as JSON. Use `--json` for the full tool result
|
|
92
92
|
and `--compact` for compact JSON. `--db path` works before or after the command.
|
|
93
93
|
Each command accepts `--help`. Exit codes are 0 for success, 1 for invalid input
|
|
94
|
-
or a tool error, 2 for usage errors, and 3 when clarification is needed.
|
|
94
|
+
or a tool error, 2 for usage errors, and 3 when clarification is needed or `hook remove`/`hook test` addresses a missing target.
|
|
95
|
+
Missing quests and deliveries exit 1. `hook label` names the database, not an individual target.
|
|
96
|
+
|
|
97
|
+
`questlog skill --short` prints the compact cheat sheet; `questlog skill --list` lists guides.
|
|
98
|
+
ISO date-times without a zone (for example `2026-10-29T09:00`) use the local time zone.
|
|
95
99
|
|
|
96
100
|
The `call` command and the per-tool form still reach every tool and parameter:
|
|
97
101
|
|
|
@@ -124,6 +128,8 @@ ghostpaw-questlog skill > SKILL.md
|
|
|
124
128
|
|
|
125
129
|
Each line downloads the latest release asset, checks it against the release’s SHA256SUMS and installs it on the PATH (~/.local/bin on Linux/macOS; the Windows script adds its folder to the user PATH).
|
|
126
130
|
|
|
131
|
+
These lines never edit ~/.profile or other shell startup files: `export PATH` applies to the current shell only. To keep it in new shells, use the `~/.profile` line below.
|
|
132
|
+
|
|
127
133
|
linux-x64:
|
|
128
134
|
|
|
129
135
|
```sh
|
|
@@ -148,17 +154,37 @@ darwin-x64:
|
|
|
148
154
|
curl -fsSL https://raw.githubusercontent.com/GhostPawJS/questlog/main/install.sh | sh -s -- --target darwin-x64 && export PATH="$HOME/.local/bin:$PATH"
|
|
149
155
|
```
|
|
150
156
|
|
|
151
|
-
windows-x64 (PowerShell):
|
|
157
|
+
windows-x64 (PowerShell; persistently adds its folder to the user PATH):
|
|
152
158
|
|
|
153
159
|
```powershell
|
|
154
160
|
irm https://raw.githubusercontent.com/GhostPawJS/questlog/main/install.ps1 | iex
|
|
155
161
|
```
|
|
156
162
|
|
|
163
|
+
Pinned to a release:
|
|
164
|
+
|
|
165
|
+
```sh
|
|
166
|
+
curl -fsSL https://raw.githubusercontent.com/GhostPawJS/questlog/main/install.sh | sh -s -- --target linux-x64 --version 0.11.0 && export PATH="$HOME/.local/bin:$PATH"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Also adding ~/.local/bin to ~/.profile (edits ~/.profile once; skipped if it already mentions ~/.local/bin; zsh login shells read ~/.zprofile instead, so use that file name there):
|
|
170
|
+
|
|
171
|
+
```sh
|
|
172
|
+
curl -fsSL https://raw.githubusercontent.com/GhostPawJS/questlog/main/install.sh | sh -s -- --target linux-x64 && { grep -qs '.local/bin' ~/.profile || echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.profile; } && export PATH="$HOME/.local/bin:$PATH"
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
To skip the persistent Windows user PATH edit (the installer still installs and prints the folder to add):
|
|
176
|
+
|
|
177
|
+
```powershell
|
|
178
|
+
$env:GHOSTPAW_NO_MODIFY_PATH=1; irm https://raw.githubusercontent.com/GhostPawJS/questlog/main/install.ps1 | iex
|
|
179
|
+
```
|
|
180
|
+
|
|
157
181
|
```text
|
|
158
182
|
$ ghostpaw-questlog --version
|
|
159
|
-
questlog 0.
|
|
183
|
+
questlog 0.11.0 (binary, linux-x64)
|
|
160
184
|
```
|
|
161
185
|
|
|
186
|
+
Scripts that compare versions should use `--version --short` or `--version --json`.
|
|
187
|
+
|
|
162
188
|
Standalone binaries are available from [GitHub Releases](https://github.com/GhostPawJS/questlog/releases).
|
|
163
189
|
|
|
164
190
|
A session with the 0.9.1 linux-x64 binary against a fresh database:
|
|
@@ -498,3 +524,117 @@ If this package helps your project, consider sponsoring its maintenance:
|
|
|
498
524
|
---
|
|
499
525
|
|
|
500
526
|
**[Anonyfox](https://anonyfox.com) • [MIT License](LICENSE)**
|
|
527
|
+
|
|
528
|
+
## Webhooks
|
|
529
|
+
|
|
530
|
+
Configure opt-in outbound wakes with the release binary. No server or scheduler is started.
|
|
531
|
+
With no targets, tick makes no network calls. Targets and retry state live in the database.
|
|
532
|
+
|
|
533
|
+
```sh
|
|
534
|
+
questlog hook add https://example.org/wake --min-gap 60
|
|
535
|
+
questlog hook add https://example.org/team --tag work --events quest.due,quest.overdue --secret-stdin
|
|
536
|
+
questlog hook label work
|
|
537
|
+
questlog hook list
|
|
538
|
+
questlog tick --dry-run
|
|
539
|
+
questlog tick
|
|
540
|
+
questlog watch --interval 60
|
|
541
|
+
questlog hook test 1
|
|
542
|
+
questlog review deliveries
|
|
543
|
+
questlog show 12
|
|
544
|
+
questlog hook remove 1
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
Save the signing secret printed once by `hook add` (including its `--json` result).
|
|
548
|
+
`--secret-stdin` reads a supplied secret from standard input; there is no secret flag.
|
|
549
|
+
Secrets and custom header values are stored in the database. On POSIX, new database files
|
|
550
|
+
and their WAL/SHM siblings use mode 0600, and directories created for them use 0700.
|
|
551
|
+
Existing database permissions are preserved; Windows uses its existing access controls.
|
|
552
|
+
|
|
553
|
+
Add repeatable custom headers with `--header "Authorization: Bearer value"` or
|
|
554
|
+
`--header-stdin` (one `Name: value` line per header, keeping values out of shell history).
|
|
555
|
+
For example: `questlog hook add https://example.org/wake --header "X-Key: value"`.
|
|
556
|
+
Headers accompany every delivery and test. Header names are shown with values replaced by
|
|
557
|
+
`***`; values are never included in list, show, test, tick, watch, or tool output.
|
|
558
|
+
Names must be HTTP tokens; `host`, `content-length`, `content-type`, and `x-questlog-*`
|
|
559
|
+
are reserved (case insensitive). To change headers, remove the hook and add it again.
|
|
560
|
+
Use separate invocations for `--header-stdin` and `--secret-stdin`.
|
|
561
|
+
URL userinfo is rejected; use a custom header or query key instead.
|
|
562
|
+
`questlog show d_…` prints delivery status, attempts, HTTP status, next attempt,
|
|
563
|
+
redacted target URL, and event ids; add `--json` for JSON.
|
|
564
|
+
|
|
565
|
+
List output redacts URL userinfo and query strings. Removal deletes the target and its deliveries.
|
|
566
|
+
A target covers the database unless `--tag` restricts it to quests with that tag;
|
|
567
|
+
rumors have no tags and reach database targets only. `--events` defaults to all five events.
|
|
568
|
+
The label defaults to the database filename without directory or extension (`questlog` for memory).
|
|
569
|
+
Only use labels suitable for disclosure to the receiver.
|
|
570
|
+
|
|
571
|
+
For cron:
|
|
572
|
+
|
|
573
|
+
```cron
|
|
574
|
+
* * * * * questlog tick
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
Cron's PATH may need `$HOME/.local/bin/questlog tick --db /path/to/quests.db`.
|
|
578
|
+
`watch` repeats tick (default 60 seconds, minimum 5), finishing its current tick on SIGINT/SIGTERM.
|
|
579
|
+
Tick exits 0 after running even when deliveries need retrying. Dry runs roll back all changes,
|
|
580
|
+
including repeatable materialization, and make no network calls.
|
|
581
|
+
|
|
582
|
+
Events are detected from the model at tick time:
|
|
583
|
+
|
|
584
|
+
- `quest.due`: an unresolved, undeleted quest reaches its effective due time (own `due_at`, otherwise its undeleted questline's due time).
|
|
585
|
+
- `quest.overdue`: that effective deadline is strictly earlier than now and the quest remains unresolved.
|
|
586
|
+
- `quest.unblocked`: an unresolved quest is available, all active prerequisites have succeeded or been deleted, and at least one prerequisite succeeded after its unlock was installed. Occurrence time is the latest active prerequisite success or not-before time, whichever is later.
|
|
587
|
+
- `repeatable.spawned`: a concrete repeatable instance was created; occurrence time is its creation time. Tick first materializes due anchors through the existing spawn operation.
|
|
588
|
+
- `rumor.captured`: an undeleted rumor was created; occurrence time is its creation time, even if subsequently settled or dismissed.
|
|
589
|
+
|
|
590
|
+
Each type, entity and occurrence timestamp has a persistent unique event key. Repeated ticks
|
|
591
|
+
and restarts do not create another occurrence. Changes removed before any tick cannot be
|
|
592
|
+
reconstructed. Occurrences earlier than target creation are excluded, preventing backlog floods.
|
|
593
|
+
Tags are evaluated when assigning an event. Already assigned events retain their batch membership.
|
|
594
|
+
|
|
595
|
+
One POST batch per target per tick contains only identifiers, types, timestamps, and the DB label:
|
|
596
|
+
|
|
597
|
+
```json
|
|
598
|
+
{"type":"questlog.events","db":"work","deliveryId":"d_…","sentAt":"2026-10-28T10:00:00.000Z","events":[{"id":"e_…","type":"quest.due","questId":12,"occurredAt":"2026-10-28T09:59:00.000Z"}]}
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
Headers are `content-type: application/json`, `user-agent: questlog/<version>`,
|
|
602
|
+
`x-questlog-delivery: <deliveryId>`, `x-questlog-timestamp: <unix seconds>`, and
|
|
603
|
+
`x-questlog-signature: sha256=<hex HMAC-SHA256(secret, timestamp + "." + rawBody)>`.
|
|
604
|
+
No titles, objectives, details, or tag text are sent. `hook test` sends a logged `hook.test`
|
|
605
|
+
event immediately, ignoring the min gap. Add and test are CLI-only in the tool facade;
|
|
606
|
+
`manage_hooks` supports list, remove, tick (with `dry_run`), and deliveries.
|
|
607
|
+
|
|
608
|
+
2xx delivers the batch. Requests time out after 5 seconds. Other responses, timeouts, and
|
|
609
|
+
network errors retry after 30 seconds, 1 minute, 2 minutes, 4 minutes, and so on, capped
|
|
610
|
+
at 1 hour, plus less than 1 second jitter. The target's min gap also applies to retries.
|
|
611
|
+
Eight unsuccessful attempts mark a delivery failed. Retries retain the delivery id and events.
|
|
612
|
+
Pending batches wait behind retries. Only the last 500 delivered entries per target are kept;
|
|
613
|
+
pending and failed entries are retained. Transactions and two-minute leases prevent overlapping
|
|
614
|
+
ticks from claiming the same delivery. A crash after receipt but before recording success can
|
|
615
|
+
cause another request: receivers must dedupe by delivery id.
|
|
616
|
+
|
|
617
|
+
### Verifying a delivery
|
|
618
|
+
|
|
619
|
+
Compute HMAC-SHA256 over `timestamp + "." + rawBody` with the secret and compare in constant
|
|
620
|
+
time. Reject timestamps older than 5 minutes (and timestamps too far in the future), then
|
|
621
|
+
dedupe on `x-questlog-delivery`. Use durable deduplication storage in a production receiver.
|
|
622
|
+
This 15-line Node example uses an in-memory set:
|
|
623
|
+
|
|
624
|
+
```js
|
|
625
|
+
import { createHmac, timingSafeEqual } from 'node:crypto';
|
|
626
|
+
import { createServer } from 'node:http';
|
|
627
|
+
const secret = process.env.WEBHOOK_SECRET, seen = new Set();
|
|
628
|
+
createServer(async (req, res) => {
|
|
629
|
+
const chunks = []; for await (const chunk of req) chunks.push(chunk);
|
|
630
|
+
const rawBody = Buffer.concat(chunks), h = req.headers;
|
|
631
|
+
const timestamp = h['x-questlog-timestamp'], id = h['x-questlog-delivery'];
|
|
632
|
+
const age = Date.now() / 1000 - Number(timestamp);
|
|
633
|
+
const expected = createHmac('sha256', secret).update(timestamp + '.').update(rawBody).digest();
|
|
634
|
+
const signature = String(h['x-questlog-signature'] || '');
|
|
635
|
+
const actual = Buffer.from(signature.slice(7), 'hex');
|
|
636
|
+
if (!id || !/^\d+$/.test(timestamp) || age > 300 || age < -300 || !/^sha256=[a-f0-9]{64}$/.test(signature) || actual.length !== expected.length || !timingSafeEqual(actual, expected)) { res.writeHead(401).end(); return; }
|
|
637
|
+
if (!seen.has(id)) { seen.add(id); console.log(JSON.parse(rawBody)); }
|
|
638
|
+
res.writeHead(204).end();
|
|
639
|
+
}).listen(8080, '127.0.0.1');
|
|
640
|
+
```
|
package/SKILL.md
CHANGED
|
@@ -28,15 +28,20 @@ Run tools as `ghostpaw-questlog ...`; use `~/.local/bin/ghostpaw-questlog` if it
|
|
|
28
28
|
`questlog` and `ghostpaw-questlog` are the same binary.
|
|
29
29
|
|
|
30
30
|
- `questlog search <words>` before `add` to avoid duplicates.
|
|
31
|
-
- `ghostpaw-questlog add "
|
|
32
|
-
- `questlog list [--view <view>]`: questlines, quests.active, quests.available, quests.blocked, quests.deferred, quests.due_soon, quests.in_progress, quests.missed_scheduled, quests.open, quests.overdue, quests.resolved, quests.scheduled_for_day, quests.scheduled_now, repeatables.due_anchors, rumors.
|
|
33
|
-
- `questlog done
|
|
34
|
-
- `questlog search
|
|
35
|
-
- `questlog show
|
|
31
|
+
- `ghostpaw-questlog add "Write the report" --tag work --due tomorrow`
|
|
32
|
+
- `questlog list [--view <view>]`: deliveries, questlines, quests.active, quests.available, quests.blocked, quests.deferred, quests.due_soon, quests.in_progress, quests.missed_scheduled, quests.open, quests.overdue, quests.resolved, quests.scheduled_for_day, quests.scheduled_now, repeatables.due_anchors, rumors.
|
|
33
|
+
- `questlog done 12 --outcome "Report sent"`
|
|
34
|
+
- `questlog search "release"`
|
|
35
|
+
- `questlog show 12`
|
|
36
|
+
- `questlog list --view quests.available`
|
|
36
37
|
- Use `--json` on any plain command.
|
|
37
|
-
- Exit codes: 0 ok / 1 error / 2 usage / 3 needs input.
|
|
38
|
+
- Exit codes: 0 ok / 1 error / 2 usage / 3 needs input or hook target not found.
|
|
38
39
|
- Database: `~/.ghostpaw/questlog.db`; override with `--db` or `GHOSTPAW_QUESTLOG_DB`.
|
|
39
|
-
- Use one database per
|
|
40
|
+
- Use one database per project.
|
|
41
|
+
- `questlog --version` prints the installed version.
|
|
42
|
+
- `questlog skill --short` prints this compact cheat sheet.
|
|
43
|
+
- `questlog skill --list` lists guides; `questlog skill webhooks` reads one.
|
|
44
|
+
- Webhooks: `questlog hook add <url>`, `questlog tick --dry-run`, `questlog watch`. Read `questlog skill webhooks` for events, signing, verification, and cron setup.
|
|
40
45
|
|
|
41
46
|
## Appendix: MCP and tool calls
|
|
42
47
|
|
|
@@ -50,6 +55,28 @@ CLI: `ghostpaw-questlog call <tool> '<JSON object>'` or `ghostpaw-questlog <tool
|
|
|
50
55
|
|
|
51
56
|
Inspect schemas with `ghostpaw-questlog describe <tool>`. Use `--db <path>` to select a database.
|
|
52
57
|
|
|
58
|
+
### manage_hooks
|
|
59
|
+
|
|
60
|
+
List or remove outbound webhook targets, run a tick, or inspect pending and failed deliveries.
|
|
61
|
+
|
|
62
|
+
Use when: Use to operate configured outbound webhooks. Add and test targets with the CLI.
|
|
63
|
+
|
|
64
|
+
Not for: Use quest tools to change work itself.
|
|
65
|
+
|
|
66
|
+
Writes: writes_state.
|
|
67
|
+
|
|
68
|
+
| Parameter | Type | Required | Values / description |
|
|
69
|
+
| --- | --- | --- | --- |
|
|
70
|
+
| action | string | yes | list, remove, tick, deliveries. Operation. |
|
|
71
|
+
| id | integer | no | Target id. |
|
|
72
|
+
| dry_run | boolean | no | Preview only. |
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
ghostpaw-questlog call manage_hooks '{"action":"list"}'
|
|
76
|
+
ghostpaw-questlog call manage_hooks '{"action":"remove","id":1}'
|
|
77
|
+
ghostpaw-questlog call manage_hooks '{"action":"tick"}'
|
|
78
|
+
```
|
|
79
|
+
|
|
53
80
|
### search_questlog
|
|
54
81
|
|
|
55
82
|
Search quests and rumors by text when you need to find an existing item before inspecting or changing it.
|
|
@@ -83,7 +110,7 @@ Read-only.
|
|
|
83
110
|
|
|
84
111
|
| Parameter | Type | Required | Values / description |
|
|
85
112
|
| --- | --- | --- | --- |
|
|
86
|
-
| view | string | yes | questlines, quests.active, quests.available, quests.blocked, quests.deferred, quests.due_soon, quests.in_progress, quests.missed_scheduled, quests.open, quests.overdue, quests.resolved, quests.scheduled_for_day, quests.scheduled_now, repeatables.due_anchors, rumors. Which operational review surface to return. |
|
|
113
|
+
| view | string | yes | deliveries, questlines, quests.active, quests.available, quests.blocked, quests.deferred, quests.due_soon, quests.in_progress, quests.missed_scheduled, quests.open, quests.overdue, quests.resolved, quests.scheduled_for_day, quests.scheduled_now, repeatables.due_anchors, rumors. Which operational review surface to return. |
|
|
87
114
|
| filters | object | no | Optional filters for supported review surfaces. |
|
|
88
115
|
| filters.questlineId | integer | no | Optional questline id used by quest views. |
|
|
89
116
|
| filters.tagNames | array | no | Optional tag names used by quest views. |
|
|
@@ -92,7 +119,7 @@ Read-only.
|
|
|
92
119
|
| now | integer | no | Optional evaluation timestamp for time-sensitive views. |
|
|
93
120
|
|
|
94
121
|
```sh
|
|
95
|
-
ghostpaw-questlog call review_questlog '{"view":"
|
|
122
|
+
ghostpaw-questlog call review_questlog '{"view":"deliveries"}'
|
|
96
123
|
```
|
|
97
124
|
|
|
98
125
|
### inspect_questlog_item
|
|
@@ -152,16 +179,39 @@ Writes: writes_state.
|
|
|
152
179
|
| action | string | yes | attach_quest_to_questline, create_quest, create_questline, detach_quest_from_questline, dismiss_rumor, reopen_rumor, settle_rumor, update_rumor. Action to perform. |
|
|
153
180
|
| questId | integer | no | Quest to attach or detach. |
|
|
154
181
|
| questlineId | integer | no | Questline that should receive the quest. |
|
|
155
|
-
| quest | object | no |
|
|
182
|
+
| quest | object | no | Object: title (required), objective (required), questlineId, tags, rewards, dueAt, notBeforeAt, scheduledStartAt, scheduledEndAt, allDay, estimateSeconds |
|
|
156
183
|
| quest.title | string | yes | Title for the new quest. |
|
|
157
184
|
| quest.objective | string | yes | Objective for the new quest. |
|
|
158
|
-
|
|
|
185
|
+
| quest.questlineId | integer | no | Optional questline to place the quest in. |
|
|
186
|
+
| quest.tags | array | no | Optional tags to apply at creation. |
|
|
187
|
+
| quest.rewards | array | no | Optional rewards to attach at creation. |
|
|
188
|
+
| quest.rewards[].kind | string | yes | Reward kind. |
|
|
189
|
+
| quest.rewards[].name | string | yes | Reward name. |
|
|
190
|
+
| quest.dueAt | integer | no | Optional latest acceptable completion timestamp. |
|
|
191
|
+
| quest.notBeforeAt | integer | no | Optional earliest actionable timestamp. |
|
|
192
|
+
| quest.scheduledStartAt | integer | no | Optional planned schedule window start. |
|
|
193
|
+
| quest.scheduledEndAt | integer | no | Optional planned schedule window end. |
|
|
194
|
+
| quest.allDay | boolean | no | Whether the scheduled window is all-day. |
|
|
195
|
+
| quest.estimateSeconds | integer | no | Optional active-effort estimate in seconds. |
|
|
196
|
+
| questline | object | no | Object: title (required), description |
|
|
159
197
|
| questline.title | string | yes | Questline title. |
|
|
160
198
|
| questline.description | string | no | Optional questline description. |
|
|
161
199
|
| rumorId | integer | no | Rumor to settle, dismiss, or reopen. |
|
|
162
200
|
| dismissedAt | integer | no | Optional dismissal timestamp. |
|
|
163
201
|
| settledAt | integer | no | Optional settlement timestamp. |
|
|
164
202
|
| quests | array | no | Quests to create during rumor settlement. Include timing and tags directly. |
|
|
203
|
+
| quests[].title | string | yes | Title for a created quest. |
|
|
204
|
+
| quests[].objective | string | yes | Objective for a created quest. |
|
|
205
|
+
| quests[].tags | array | no | Optional tags to apply at creation. |
|
|
206
|
+
| quests[].rewards | array | no | Optional rewards to attach at creation. |
|
|
207
|
+
| quests[].rewards[].kind | string | yes | Reward kind. |
|
|
208
|
+
| quests[].rewards[].name | string | yes | Reward name. |
|
|
209
|
+
| quests[].dueAt | integer | no | Optional latest acceptable completion timestamp. |
|
|
210
|
+
| quests[].notBeforeAt | integer | no | Optional earliest actionable timestamp. |
|
|
211
|
+
| quests[].scheduledStartAt | integer | no | Optional planned schedule window start. |
|
|
212
|
+
| quests[].scheduledEndAt | integer | no | Optional planned schedule window end. |
|
|
213
|
+
| quests[].allDay | boolean | no | Whether the scheduled window is all-day. |
|
|
214
|
+
| quests[].estimateSeconds | integer | no | Optional active-effort estimate in seconds. |
|
|
165
215
|
| now | integer | no | Optional timestamp for membership, reopen, or rumor update. |
|
|
166
216
|
| title | string | no | New title for the update_rumor action. |
|
|
167
217
|
| details | string | no | New or enriched context text for the update_rumor action. |
|
|
@@ -221,6 +271,8 @@ Writes: writes_state.
|
|
|
221
271
|
| outcome | string | no | Terminal outcome text. Required for finish, abandon, and abandon_and_spawn_followups. |
|
|
222
272
|
| resolvedAt | integer | no | Optional resolved timestamp for finish or abandon actions. |
|
|
223
273
|
| followups | array | no | Follow-up quests to create atomically. Required for abandon_and_spawn_followups. |
|
|
274
|
+
| followups[].title | string | yes | Title for a follow-up quest. |
|
|
275
|
+
| followups[].objective | string | yes | Objective for a follow-up quest. |
|
|
224
276
|
|
|
225
277
|
```sh
|
|
226
278
|
ghostpaw-questlog call run_quest '{"action":"start","questId":1}'
|
|
@@ -272,7 +324,7 @@ Writes: writes_state.
|
|
|
272
324
|
| --- | --- | --- | --- |
|
|
273
325
|
| action | string | yes | archive, create, preview_due, spawn_due, update. Action to perform. |
|
|
274
326
|
| repeatableQuestId | integer | no | Repeatable quest to archive or update. |
|
|
275
|
-
| repeatableQuest | object | no |
|
|
327
|
+
| repeatableQuest | object | no | Object: title (required), objective (required), rrule (required), anchorAt (required) |
|
|
276
328
|
| repeatableQuest.title | string | yes | Title for the new repeatable quest. |
|
|
277
329
|
| repeatableQuest.objective | string | yes | Objective for the new repeatable quest. |
|
|
278
330
|
| repeatableQuest.rrule | string | yes | RRULE describing recurrence. |
|
|
@@ -310,7 +362,7 @@ Writes: writes_state.
|
|
|
310
362
|
| Parameter | Type | Required | Values / description |
|
|
311
363
|
| --- | --- | --- | --- |
|
|
312
364
|
| action | string | yes | add, remove, replace. Action to perform. |
|
|
313
|
-
| target | object | yes |
|
|
365
|
+
| target | object | yes | Object: id (required), kind (required) |
|
|
314
366
|
| target.id | integer | yes | Target entity id. |
|
|
315
367
|
| target.kind | string | yes | quest, repeatable_quest. Target kind. |
|
|
316
368
|
| tagNames | array | yes | Tag names to add, remove, or replace. |
|
|
@@ -335,14 +387,16 @@ Writes: writes_state.
|
|
|
335
387
|
| Parameter | Type | Required | Values / description |
|
|
336
388
|
| --- | --- | --- | --- |
|
|
337
389
|
| action | string | yes | add, claim, remove, replace_repeatable_template, update. Action to perform. |
|
|
338
|
-
| target | object | yes |
|
|
390
|
+
| target | object | yes | Object: id (required), kind (required) |
|
|
339
391
|
| target.id | integer | yes | Target entity id. |
|
|
340
392
|
| target.kind | string | yes | quest, reward, repeatable_quest. Target kind. |
|
|
341
|
-
| reward | object | no |
|
|
393
|
+
| reward | object | no | Object: kind (required), name (required), now |
|
|
342
394
|
| reward.kind | string | yes | Reward kind. |
|
|
343
395
|
| reward.name | string | yes | Reward name. |
|
|
344
396
|
| reward.now | integer | no | Optional update timestamp for the update action. |
|
|
345
397
|
| rewards | array | no | Full future reward template set. Required for replace_repeatable_template. |
|
|
398
|
+
| rewards[].kind | string | yes | Reward kind. |
|
|
399
|
+
| rewards[].name | string | yes | Reward name. |
|
|
346
400
|
| claimedAt | integer | no | Optional claim timestamp. |
|
|
347
401
|
| now | integer | no | Optional timestamp for removal or template replacement. |
|
|
348
402
|
|
|
@@ -376,31 +430,32 @@ ghostpaw-questlog call retire_work '{"action":"hide","target":{"kind":"quest","i
|
|
|
376
430
|
|
|
377
431
|
### Workflow guides
|
|
378
432
|
|
|
379
|
-
- `ghostpaw-questlog skill
|
|
380
|
-
- `ghostpaw-questlog skill
|
|
381
|
-
- `ghostpaw-questlog skill
|
|
382
|
-
- `ghostpaw-questlog skill
|
|
383
|
-
- `ghostpaw-questlog skill
|
|
384
|
-
- `ghostpaw-questlog skill
|
|
385
|
-
- `ghostpaw-questlog skill
|
|
386
|
-
- `ghostpaw-questlog skill
|
|
387
|
-
- `ghostpaw-questlog skill
|
|
388
|
-
- `ghostpaw-questlog skill
|
|
389
|
-
- `ghostpaw-questlog skill
|
|
390
|
-
- `ghostpaw-questlog skill
|
|
391
|
-
- `ghostpaw-questlog skill
|
|
392
|
-
- `ghostpaw-questlog skill plan-
|
|
393
|
-
- `ghostpaw-questlog skill
|
|
394
|
-
- `ghostpaw-questlog skill
|
|
395
|
-
- `ghostpaw-questlog skill
|
|
396
|
-
- `ghostpaw-questlog skill
|
|
397
|
-
- `ghostpaw-questlog skill
|
|
398
|
-
- `ghostpaw-questlog skill
|
|
399
|
-
- `ghostpaw-questlog skill run-
|
|
400
|
-
- `ghostpaw-questlog skill
|
|
401
|
-
- `ghostpaw-questlog skill
|
|
402
|
-
- `ghostpaw-questlog skill
|
|
403
|
-
- `ghostpaw-questlog skill
|
|
433
|
+
- `ghostpaw-questlog skill webhooks`: Configure signed outbound event webhooks and verify deliveries.
|
|
434
|
+
- `ghostpaw-questlog skill archive-delete-and-prune`: Choose the right retirement action for each kind of work so history stays honest and hiding does not get confused with archival or terminal execution truth.
|
|
435
|
+
- `ghostpaw-questlog skill choose-work-shape`: Choose the right structure for new work by separating uncertainty, one-shot execution, multi-step arcs, and recurring patterns.
|
|
436
|
+
- `ghostpaw-questlog skill clarify-ambiguous-requests`: Treat ambiguity as a real state, capture uncertainty honestly, and only commit work structure once the next executable shape is clear.
|
|
437
|
+
- `ghostpaw-questlog skill close-work-and-claim-outcomes`: Close work with the correct terminal lifecycle action, then handle any concrete reward claim as a separate explicit step.
|
|
438
|
+
- `ghostpaw-questlog skill create-concrete-quest`: Create real, bounded executable quests only when the objective is concrete enough to execute without interpretive guesswork.
|
|
439
|
+
- `ghostpaw-questlog skill detect-slips-and-staleness`: Detect work that is slipping or going stale by reading overdue, deferred, in-progress, and related operational views before choosing one recovery move.
|
|
440
|
+
- `ghostpaw-questlog skill escalate-and-unblock`: Diagnose blockers honestly, then remove or realign hard gates when the model is wrong instead of treating every delay as generic escalation theater.
|
|
441
|
+
- `ghostpaw-questlog skill frame-initiative-questline`: Use questlines for shared initiative context, then attach concrete quests and maintain the structure without confusing one quest with one arc.
|
|
442
|
+
- `ghostpaw-questlog skill handle-exceptions-and-weird-cases`: Handle weird cases by diagnosing the actual tool outcome, routing into clarification or recovery when needed, and refusing to fake a clean normal-state story.
|
|
443
|
+
- `ghostpaw-questlog skill intake-triage`: Triage new asks, ideas, and vague incoming work into the right next step without prematurely committing execution structure.
|
|
444
|
+
- `ghostpaw-questlog skill maintain-clear-ownership`: Keep ownership explicit through quest content and classification because Questlog does not provide a separate assignee field or ownership tool.
|
|
445
|
+
- `ghostpaw-questlog skill manage-approvals-and-promises`: Treat approvals and commitments as modeled work with timing and dependencies instead of burying them as vague narrative promises.
|
|
446
|
+
- `ghostpaw-questlog skill plan-successor-work`: Create explicit successor work after closure by spawning follow-ups or shaping new work, while keeping uncertain next steps in intake instead of faking certainty.
|
|
447
|
+
- `ghostpaw-questlog skill plan-time-correctly`: Use quest planning fields honestly so availability, due pressure, and schedule intent stay meaningful instead of getting collapsed into one generic date.
|
|
448
|
+
- `ghostpaw-questlog skill prioritize-across-streams`: Prioritize across competing work streams by reading real candidate sets, distinguishing available from blocked work, and then reflecting the choice in planning.
|
|
449
|
+
- `ghostpaw-questlog skill protect-capacity-and-focus`: Protect capacity and focus by reading the real in-progress and scheduled-now load, then using planning to rebalance instead of silently overcommitting.
|
|
450
|
+
- `ghostpaw-questlog skill recover-from-modeling-mistakes`: Recover from modeling mistakes by diagnosing the exact current state first, then applying the smallest honest corrective tool instead of rewriting history blindly.
|
|
451
|
+
- `ghostpaw-questlog skill report-status-and-manage-expectations`: Build status reporting from the real questlog state, separating available, blocked, in-progress, slipping, and resolved work without relying on memory.
|
|
452
|
+
- `ghostpaw-questlog skill revise-or-reshape-commitment`: Revise a quest objective before execution starts, but reshape commitments honestly with lifecycle tools once real execution history exists.
|
|
453
|
+
- `ghostpaw-questlog skill run-operational-review`: Drive daily or weekly operational review from structured list views, then move from diagnosis into actual planning or execution changes.
|
|
454
|
+
- `ghostpaw-questlog skill run-recurring-rhythms`: Model recurring work as repeatable definitions that spawn fresh concrete quests over time instead of living forever as one immortal task.
|
|
455
|
+
- `ghostpaw-questlog skill search-and-retrieve-context`: Find relevant questlog context quickly, then switch from discovery to exact inspection without confusing free-text search with structured review surfaces.
|
|
456
|
+
- `ghostpaw-questlog skill sequence-with-unlocks`: Model hard sequencing with unlocks between concrete quests so blocked and available work stay truthful and reviewable.
|
|
457
|
+
- `ghostpaw-questlog skill settle-rumor-into-structure`: Turn a ready rumor into committed quest or questline structure without losing provenance or pretending vague intake is settled.
|
|
458
|
+
- `ghostpaw-questlog skill tag-and-filter-portfolios`: Use tags for cross-cutting classification and portfolio filtering without confusing tags for status, timing, or dependency modeling.
|
|
404
459
|
|
|
405
460
|
### Principles
|
|
406
461
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// src/surfaces/schema_rows.ts
|
|
3
|
+
function schemaRows(schema, prefix = "") {
|
|
4
|
+
const properties = { ...schema.properties };
|
|
5
|
+
const required = new Set(schema.required);
|
|
6
|
+
for (const branch of schema.oneOf ?? []) {
|
|
7
|
+
Object.assign(properties, branch.properties);
|
|
8
|
+
for (const key of branch.required ?? []) required.add(key);
|
|
9
|
+
}
|
|
10
|
+
return Object.entries(properties).flatMap(([key, property]) => {
|
|
11
|
+
const nested = property.items ?? property;
|
|
12
|
+
const children = nested.properties ?? Object.assign({}, ...(nested.oneOf ?? []).map((b) => b.properties));
|
|
13
|
+
const description = property.description || (Object.keys(children).length ? `Object: ${Object.keys(children).map((name) => `${name}${nested.required?.includes(name) ? " (required)" : ""}`).join(", ")}` : property.type === "array" ? `Array of ${property.items?.type ?? "values"}` : `Value for ${key}`);
|
|
14
|
+
return [
|
|
15
|
+
`${prefix}${key} | ${property.type ?? "oneOf"} | ${required.has(key) ? "yes" : "no"} | ${(property.enum ? `${property.enum.join(", ")}. ` : "") + description.replaceAll("|", "\\|").replaceAll("\n", " ")}`,
|
|
16
|
+
...schemaRows(nested, `${prefix}${key}${property.items ? "[]" : ""}.`)
|
|
17
|
+
];
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { schemaRows };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// src/hooks/list_deliveries.ts
|
|
3
|
+
function listDeliveries(db, options = {}) {
|
|
4
|
+
return db.prepare(
|
|
5
|
+
`SELECT * FROM hook_deliveries ${options.includeDelivered ? "" : "WHERE status <> 'delivered'"} ORDER BY target_id, next_attempt_at, id`
|
|
6
|
+
).all().map(
|
|
7
|
+
(row) => ({
|
|
8
|
+
id: String(row.id),
|
|
9
|
+
targetId: Number(row.target_id),
|
|
10
|
+
events: JSON.parse(String(row.events)),
|
|
11
|
+
status: row.status,
|
|
12
|
+
attempts: Number(row.attempts),
|
|
13
|
+
lastAttemptAt: row.last_attempt_at == null ? null : Number(row.last_attempt_at),
|
|
14
|
+
httpStatus: row.http_status == null ? null : Number(row.http_status),
|
|
15
|
+
errorClass: row.error_class == null ? null : String(row.error_class),
|
|
16
|
+
nextAttemptAt: Number(row.next_attempt_at)
|
|
17
|
+
})
|
|
18
|
+
).filter(
|
|
19
|
+
(d) => options.questId === void 0 || d.events.some((e) => e.questId === options.questId)
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { listDeliveries };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
|
|
4
|
+
var CliUsageError = class extends Error {
|
|
5
|
+
exitCode = 2;
|
|
6
|
+
};
|
|
7
|
+
var keyOf = (name) => name.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
8
|
+
function parseCliArgs(argv, spec) {
|
|
9
|
+
const values = {};
|
|
10
|
+
const positions = [];
|
|
11
|
+
const flags = spec.flags ?? [];
|
|
12
|
+
const convert = (raw, arg) => {
|
|
13
|
+
let value = raw;
|
|
14
|
+
if (raw.startsWith("@")) {
|
|
15
|
+
try {
|
|
16
|
+
value = readFileSync(raw.slice(1), "utf8");
|
|
17
|
+
} catch {
|
|
18
|
+
throw new CliUsageError(`Cannot read value file: ${raw.slice(1)}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
let result = value;
|
|
22
|
+
if (arg.type === "number" || arg.type === "integer") {
|
|
23
|
+
result = Number(value);
|
|
24
|
+
if (!value.trim() || !Number.isFinite(result) || arg.type === "integer" && !Number.isInteger(result))
|
|
25
|
+
throw new CliUsageError(`Expected ${arg.type} for ${arg.name}: ${value}`);
|
|
26
|
+
} else if (arg.type === "boolean") {
|
|
27
|
+
if (!["true", "false"].includes(value))
|
|
28
|
+
throw new CliUsageError(`Expected boolean for ${arg.name}`);
|
|
29
|
+
result = value === "true";
|
|
30
|
+
} else if (arg.type === "json") {
|
|
31
|
+
try {
|
|
32
|
+
result = JSON.parse(value);
|
|
33
|
+
} catch {
|
|
34
|
+
throw new CliUsageError(`Invalid JSON for ${arg.name}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (arg.enum && !arg.enum.includes(result))
|
|
38
|
+
throw new CliUsageError(`${arg.name} must be one of: ${arg.enum.join(", ")}`);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
let ended = false;
|
|
42
|
+
for (let i = 0; i < argv.length; i++) {
|
|
43
|
+
const token = argv[i];
|
|
44
|
+
if (!ended && token === "--") {
|
|
45
|
+
ended = true;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (ended || token === "-" || !token.startsWith("-")) {
|
|
49
|
+
positions.push(token);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
const [flag, inline] = token.split(/=(.*)/s);
|
|
53
|
+
const negative = flag?.startsWith("--no-");
|
|
54
|
+
const name = flag?.replace(/^--?/, "").replace(/^no-/, "");
|
|
55
|
+
const arg = flags.find(
|
|
56
|
+
(entry) => entry.name === name || keyOf(entry.name) === name || entry.short === name
|
|
57
|
+
);
|
|
58
|
+
if (!arg) {
|
|
59
|
+
const prefix = (name ?? "").slice(0, 3);
|
|
60
|
+
const suggestion = prefix ? flags.find((entry) => entry.name.startsWith(prefix)) : void 0;
|
|
61
|
+
throw new CliUsageError(
|
|
62
|
+
`Unknown flag: ${flag}${suggestion ? `; did you mean --${suggestion.name}?` : ""}`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
if (negative && arg.type !== "boolean")
|
|
66
|
+
throw new CliUsageError(`--no-${arg.name} requires a boolean flag`);
|
|
67
|
+
let raw = inline;
|
|
68
|
+
if (arg.type === "boolean" && raw === void 0) raw = negative ? "false" : "true";
|
|
69
|
+
if (raw === void 0) {
|
|
70
|
+
const next = argv[i + 1];
|
|
71
|
+
if (next === void 0 || /^--[a-z]/i.test(next))
|
|
72
|
+
throw new CliUsageError(`Missing value: --${arg.name}`);
|
|
73
|
+
raw = next;
|
|
74
|
+
i++;
|
|
75
|
+
}
|
|
76
|
+
const key = keyOf(arg.name);
|
|
77
|
+
if (arg.type === "array") {
|
|
78
|
+
const item = convert(raw, { ...arg, type: arg.itemType ?? "string" });
|
|
79
|
+
values[key] = [...values[key] ?? [], item];
|
|
80
|
+
} else values[key] = convert(raw, arg);
|
|
81
|
+
}
|
|
82
|
+
let index = 0;
|
|
83
|
+
for (const arg of spec.positionals ?? []) {
|
|
84
|
+
if (index >= positions.length) continue;
|
|
85
|
+
values[keyOf(arg.name)] = arg.variadic ? positions.slice(index).map((value) => convert(value, { ...arg, type: arg.itemType ?? arg.type })) : convert(positions[index], arg);
|
|
86
|
+
index = arg.variadic ? positions.length : index + 1;
|
|
87
|
+
}
|
|
88
|
+
if (index < positions.length)
|
|
89
|
+
throw new CliUsageError(`Unexpected positional: ${positions[index]}`);
|
|
90
|
+
for (const arg of [...flags, ...spec.positionals ?? []]) {
|
|
91
|
+
if (arg.required && values[keyOf(arg.name)] === void 0)
|
|
92
|
+
throw new CliUsageError(`Missing required argument: ${arg.name}`);
|
|
93
|
+
}
|
|
94
|
+
return values;
|
|
95
|
+
}
|
|
96
|
+
function renderCliHelp(spec) {
|
|
97
|
+
const describe = (arg) => `${arg.type}${arg.enum ? ` (${arg.enum.join("|")})` : ""}${arg.required ? " required" : ""} ${arg.description ?? ""}`;
|
|
98
|
+
return `Usage: ${spec.command} ${(spec.positionals ?? []).map((arg) => `<${arg.name}${arg.variadic ? "..." : ""}>`).join(" ")} [flags]
|
|
99
|
+
${spec.description ?? ""}
|
|
100
|
+
|
|
101
|
+
Positionals:
|
|
102
|
+
${(spec.positionals ?? []).map((arg) => ` ${arg.name} ${describe(arg)}`).join("\n")}
|
|
103
|
+
Flags:
|
|
104
|
+
${(spec.flags ?? []).map((arg) => ` --${arg.name}${arg.short ? `, -${arg.short}` : ""} ${describe(arg)}`).join("\n")}
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export { CliUsageError, parseCliArgs, renderCliHelp };
|
|
@@ -724,8 +724,16 @@ Failure handling:
|
|
|
724
724
|
- Do not filter by tags and assume that is the same as a schedule or dependency review.`
|
|
725
725
|
});
|
|
726
726
|
|
|
727
|
+
// src/skills/webhooks.ts
|
|
728
|
+
var webhooksSkill = defineQuestlogSkill({
|
|
729
|
+
name: "webhooks",
|
|
730
|
+
description: "Configure signed outbound event webhooks and verify deliveries.",
|
|
731
|
+
content: '# Webhooks\n\nUse `questlog` to configure opt-in outbound automation. No server or scheduler is added.\nNo targets means no network calls. `manage_hooks` supports list, remove, tick with\n`dry_run`, and deliveries; add/test are CLI-only. `review_questlog` view `deliveries`\nand `questlog show <id>` expose pending/failed deliveries.\n\n```sh\nquestlog hook add https://example.org/wake --min-gap 60\nquestlog hook add https://example.org/team --tag work --events quest.due,quest.overdue --secret-stdin\nquestlog hook label work\nquestlog hook list\nquestlog tick --dry-run\nquestlog tick\nquestlog watch --interval 60\nquestlog hook test 1\nquestlog review deliveries\nquestlog show 12\nquestlog hook remove 1\n```\n\n`hook add` prints its random 32-byte signing secret once, also as `secret` in `--json`.\nSave it securely. `--secret-stdin` supplies one via stdin; there is no secret flag.\nSecrets and custom header values are stored in the DB. New POSIX DB/WAL/SHM files use 0600 and created directories use 0700; existing DB modes are preserved. Windows uses existing access controls.\nUse repeatable `--header "Name: value"` or `--header-stdin` (one line per header, avoiding shell history). Headers are sent on every delivery and test; output shows names with `***` values. HTTP token names are required; host, content-length, content-type, and x-questlog-* are reserved. Change headers by removing and adding the hook again. Use --header-stdin and --secret-stdin separately. URL userinfo is rejected; use a custom header or query key.\n`questlog show d_\u2026` displays delivery status, attempts, HTTP status, next attempt, redacted target URL and event ids. Text is the default; --json prints JSON. Missing hook remove/test targets exit 3; missing quests/deliveries exit 1. hook label names the database.\nList output redacts userinfo/query strings. Removal deletes the target and deliveries.\nDefault scope is the database; `--tag` matches quest tags, never rumors.\n`--events` defaults to all types. The DB label defaults to the filename without its\npath/extension (`questlog` in memory); set it to a name suitable for disclosure.\n\n```cron\n* * * * * questlog tick\n```\n\nCron\'s PATH may need `$HOME/.local/bin/questlog tick --db /path/to/quests.db`.\nWatch defaults to 60 seconds (minimum 5); SIGINT/SIGTERM finishes the current tick.\nTick exits 0 even when deliveries need retries. Dry-run records nothing and sends nothing.\n\nEvents are detected from the model at tick time:\n\n- `quest.due`: an unresolved, undeleted quest reaches its effective due time (own `due_at`, otherwise its undeleted questline\'s due time).\n- `quest.overdue`: that effective deadline is strictly earlier than now and the quest remains unresolved.\n- `quest.unblocked`: an unresolved quest is available, all active prerequisites have succeeded or been deleted, and at least one prerequisite succeeded after its unlock was installed. Occurrence time is the latest active prerequisite success or not-before time, whichever is later.\n- `repeatable.spawned`: a concrete repeatable instance was created; occurrence time is its creation time. Tick first materializes due anchors through the existing spawn operation.\n- `rumor.captured`: an undeleted rumor was created; occurrence time is its creation time, even if subsequently settled or dismissed.\n\nPersistent event keys contain type, entity ids, and occurrence time. Restarts and repeated\nticks do not repeat occurrences. Removed transitions between ticks cannot be reconstructed.\nOnly occurrences at/after target creation are assigned; tags are evaluated at assignment.\nTick materializes due repeatables using the existing spawn path, including during preview\nwith rollback. Batches contain only ids, event types, timestamps, and the DB label:\n\n```json\n{"type":"questlog.events","db":"work","deliveryId":"d_\u2026","sentAt":"2026-10-28T10:00:00.000Z","events":[{"id":"e_\u2026","type":"quest.due","questId":12,"occurredAt":"2026-10-28T09:59:00.000Z"}]}\n```\n\nHeaders are `content-type: application/json`, `user-agent: questlog/<version>`,\n`x-questlog-delivery: <deliveryId>`, `x-questlog-timestamp: <unix seconds>`, and\n`x-questlog-signature: sha256=<hex HMAC-SHA256(secret, timestamp + "." + rawBody)>`.\nNo titles, objectives, details, or tag text are sent. `hook test` sends a logged `hook.test`\nevent immediately, ignoring the min gap. Add and test are CLI-only in the tool facade;\n`manage_hooks` supports list, remove, tick (with `dry_run`), and deliveries.\n\n2xx delivers. Timeout is 5 seconds. Failures retry after 30 s, 1 m, 2 m, 4 m, doubling\nto 1 h plus <1 s jitter, subject to the target\'s min gap. Eight failures mark failed.\nRetries keep the delivery id/events; new events queue behind them. Keep the last 500\ndelivered log entries per target and all pending/failed entries. Transactional claims\nlease work for two minutes. A crash after receipt may retry: dedupe at the receiver.\n\n### Verifying a delivery\n\nCompute HMAC-SHA256 over `timestamp + "." + rawBody` with the secret and compare in constant\ntime. Reject timestamps older than 5 minutes (and timestamps too far in the future), then\ndedupe on `x-questlog-delivery`. Use durable deduplication storage in a production receiver.\nThis 15-line Node example uses an in-memory set:\n\n```js\nimport { createHmac, timingSafeEqual } from \'node:crypto\';\nimport { createServer } from \'node:http\';\nconst secret = process.env.WEBHOOK_SECRET, seen = new Set();\ncreateServer(async (req, res) => {\n const chunks = []; for await (const chunk of req) chunks.push(chunk);\n const rawBody = Buffer.concat(chunks), h = req.headers;\n const timestamp = h[\'x-questlog-timestamp\'], id = h[\'x-questlog-delivery\'];\n const age = Date.now() / 1000 - Number(timestamp);\n const expected = createHmac(\'sha256\', secret).update(timestamp + \'.\').update(rawBody).digest();\n const signature = String(h[\'x-questlog-signature\'] || \'\');\n const actual = Buffer.from(signature.slice(7), \'hex\');\n if (!id || !/^\\d+$/.test(timestamp) || age > 300 || age < -300 || !/^sha256=[a-f0-9]{64}$/.test(signature) || actual.length !== expected.length || !timingSafeEqual(actual, expected)) { res.writeHead(401).end(); return; }\n if (!seen.has(id)) { seen.add(id); console.log(JSON.parse(rawBody)); }\n res.writeHead(204).end();\n}).listen(8080, \'127.0.0.1\');\n```\n'
|
|
732
|
+
});
|
|
733
|
+
|
|
727
734
|
// src/skills/skill_registry.ts
|
|
728
735
|
var questlogSkills = [
|
|
736
|
+
webhooksSkill,
|
|
729
737
|
archiveDeleteAndPruneSkill,
|
|
730
738
|
chooseWorkShapeSkill,
|
|
731
739
|
clarifyAmbiguousRequestsSkill,
|