@joe-broadhead/opencode-plaud 0.0.0-stage → 0.0.1

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.
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: opencode-plaud-export
3
+ description: Save a Plaud recording's audio, transcript or note to a local file with plaud_export. Use when the user asks to download, export or save a Plaud recording, its audio, its transcript or its notes.
4
+ ---
5
+
6
+ # Export a Plaud recording
7
+
8
+ `plaud_export` (`tools.plaud.export(input)` in Code Mode) writes one
9
+ recording's audio, one transcript block, or its note tabs to a local file in
10
+ a single call. Transcripts and notes are written as Markdown.
11
+
12
+ ## Input
13
+
14
+ | Field | Required | Meaning |
15
+ | --- | --- | --- |
16
+ | `recordingId` | yes | The recording's id, from `list_files` or `get_file`. |
17
+ | `kind` | yes | `audio`, `transcript` or `note`. |
18
+ | `account` | no | The account; omit it for the default account. Another account is the name the user configured, such as `work`. |
19
+ | `block` | no | Only with `kind: "transcript"`: `transaction` (raw, the default), `transaction_polish` (cleaned up), `outline` or `mark_memo` (moments flagged on the device). |
20
+ | `destination` | no | An absolute file path inside an export root. The default is `<first export root>/<kind>/<recordingId>.<ext>`; for a transcript it is `<first export root>/transcript/<recordingId>.<block>.md`, so each block has its own file. |
21
+ | `overwrite` | no | `true` replaces an existing file. It is off by default. |
22
+
23
+ It returns `{ path, bytes, sha256 }`: the file's absolute path, its size in
24
+ bytes and its SHA-256. It never returns the content; read it with
25
+ `get_transcript` or `get_note` if the user wants to see it.
26
+
27
+ ## Rules
28
+
29
+ 1. **Find the id first** with `list_files` or `get_file`. Never guess one.
30
+ 2. **Stay inside the export roots.** The default root is `~/Plaud`;
31
+ `/plaud-status` lists the configured ones. Missing folders inside a root
32
+ are created. Omit `destination` unless the user named a file.
33
+ 3. **Never set `overwrite: true`** unless the user asked to replace that
34
+ file.
35
+ 4. **Each export asks the user**, showing the account, kind, recording and
36
+ destination. "Always allow" remembers only that account and kind, such
37
+ as `default:transcript`. If the user declines, stop: nothing was written.
38
+ Do not retry or try another way.
39
+ 5. **Runs where nobody can answer**, such as `opencode run`, cannot ask,
40
+ so an export there is refused unless the user's OpenCode config
41
+ allows it, for example `{ "action": "plaud_export", "resource": "*", "effect": "allow" }`
42
+ in `permissions`, or a narrower resource such as `default:transcript`.
43
+ Mention this only when the user wants unattended exports.
44
+ 6. **Audio can take minutes.** The export reports progress, and its time
45
+ limit is the `exportTimeoutMs` option (30 minutes by default).
46
+ 7. **Report** the path, the size and the SHA-256 when it is done.
47
+
48
+ ## Errors
49
+
50
+ Errors read `CODE: what happened. Next step: What to do.` Tell the user and follow the next
51
+ step; do not retry the same call unchanged.
52
+
53
+ | Code | Do |
54
+ | --- | --- |
55
+ | `AUTH_REQUIRED` | The account is not signed in. Tell the user to run `/connect` and choose Plaud (Plaud (<account>) for another account), then press `o` or Enter; or to run `opencode mcp auth plaud` (`plaud-<account>`), which opens the browser itself. |
56
+ | `PLAUD_READ_FAILED` | Plaud's server refused or failed the read. Report the message. |
57
+ | `PLAUD_UNREADABLE` | Plaud sent something the plugin cannot read. Report it; do not retry. |
58
+ | `CONTENT_UNAVAILABLE` | There is no audio yet, or no such transcript block. Offer another block or the note. |
59
+ | `EXPORT_OUTSIDE_ROOTS` | Choose a destination inside an export root, or omit `destination`. |
60
+ | `EXPORT_BAD_DESTINATION` | Pass a file path, not a folder or a root, or omit `destination`. |
61
+ | `EXPORT_EXISTS` | A file is already there. Ask the user before replacing it or choosing another path. |
62
+ | `EXPORT_TOO_LARGE` | Report the size and the limit (`maxAudioBytes` or `maxTextBytes`). Do not split or retry. |
63
+ | `EXPORT_TIMEOUT` | Report it. The user can raise `exportTimeoutMs`. |
64
+ | `EXPORT_FAILED` | The download or the local write failed. Report it and follow the next step. |
65
+
66
+ ## Code Mode
67
+
68
+ ~~~js
69
+ const file = await tools.plaud.export({ recordingId: "RECORDING_ID", kind: "transcript", block: "transaction_polish" })
70
+ return file // { path, bytes, sha256 }
71
+ ~~~
72
+
73
+ Do not catch a declined export inside `execute` to retry it.