oc-transcript-save 0.0.3 → 0.0.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.
- package/README.md +4 -4
- package/package.json +4 -7
- package/transcript-save.ts +11 -20
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# oc-transcript-save
|
|
2
2
|
|
|
3
|
-
An [OpenCode](https://github.com/
|
|
3
|
+
An [OpenCode](https://github.com/sst/opencode) plugin that automatically saves full session transcripts to markdown files.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -27,10 +27,10 @@ bun install
|
|
|
27
27
|
|
|
28
28
|
### Environment Variables
|
|
29
29
|
|
|
30
|
-
| Variable
|
|
31
|
-
|
|
|
30
|
+
| Variable | Description | Default |
|
|
31
|
+
| -------------------------- | ---------------------------------------- | -------------------------------- |
|
|
32
32
|
| `OC_TRANSCRIPT_SAVE_PATH` | Directory where markdown files are saved | `os.tmpdir()/oc-transcript-save` |
|
|
33
|
-
| `OC_TRANSCRIPT_SAVE_DEBUG` | Enable debug logging (`1` or `true`) | `false`
|
|
33
|
+
| `OC_TRANSCRIPT_SAVE_DEBUG` | Enable debug logging (`1` or `true`) | `false` |
|
|
34
34
|
|
|
35
35
|
### Output File Format
|
|
36
36
|
|
package/package.json
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oc-transcript-save",
|
|
3
3
|
"description": "OpenCode plugin that autosaves full transcript in specified directory",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"main": "./transcript-save.ts",
|
|
6
7
|
"module": "./transcript-save.ts",
|
|
7
8
|
"types": "./transcript-save.ts",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
10
11
|
"types": "./transcript-save.ts",
|
|
11
12
|
"import": "./transcript-save.ts"
|
|
12
|
-
},
|
|
13
|
-
"./server": {
|
|
14
|
-
"types": "./transcript-save.ts",
|
|
15
|
-
"import": "./transcript-save.ts"
|
|
16
13
|
}
|
|
17
14
|
},
|
|
18
|
-
"author": "Umar Alfarouk",
|
|
15
|
+
"author": "Umar Alfarouk <medrivia@gmail.com>",
|
|
19
16
|
"scripts": {
|
|
20
17
|
"prepublishOnly": "bun run check",
|
|
21
18
|
"check": "bun tsc --noEmit",
|
|
@@ -38,7 +35,7 @@
|
|
|
38
35
|
},
|
|
39
36
|
"homepage": "https://github.com/mdrv/oc-transcript-save",
|
|
40
37
|
"dependencies": {
|
|
41
|
-
"@opencode-ai/plugin": "1.
|
|
38
|
+
"@opencode-ai/plugin": "1.17.11"
|
|
42
39
|
},
|
|
43
40
|
"devDependencies": {
|
|
44
41
|
"@types/bun": "latest"
|
package/transcript-save.ts
CHANGED
|
@@ -674,18 +674,18 @@ async function logEvent(
|
|
|
674
674
|
message: string,
|
|
675
675
|
extra: UnknownRecord = {},
|
|
676
676
|
): Promise<void> {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
if (typeof logger === 'function') {
|
|
680
|
-
await logger({
|
|
677
|
+
try {
|
|
678
|
+
await ctx.client.app.log({
|
|
681
679
|
body: {
|
|
682
680
|
service: SERVICE_NAME,
|
|
683
681
|
level,
|
|
684
682
|
message,
|
|
685
683
|
extra,
|
|
686
684
|
},
|
|
687
|
-
})
|
|
685
|
+
})
|
|
688
686
|
return
|
|
687
|
+
} catch {
|
|
688
|
+
// fall back to console below
|
|
689
689
|
}
|
|
690
690
|
|
|
691
691
|
if (
|
|
@@ -862,28 +862,22 @@ export const TranscriptSavePlugin: Plugin = async (ctx) => {
|
|
|
862
862
|
}
|
|
863
863
|
if (!sessionID) return
|
|
864
864
|
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
service: SERVICE_NAME,
|
|
869
|
-
level: 'info',
|
|
870
|
-
message: sessionID,
|
|
871
|
-
extra: { event },
|
|
872
|
-
},
|
|
873
|
-
})
|
|
865
|
+
if (debug) {
|
|
866
|
+
void logEvent(ctx, 'debug', 'event.observed', { type, sessionID })
|
|
867
|
+
}
|
|
874
868
|
|
|
875
869
|
if (type === 'session.status') {
|
|
876
870
|
if (firstBoot) {
|
|
877
871
|
firstBoot = false
|
|
878
872
|
const snapshot = await fetchSessionSnapshot(ctx, sessionID)
|
|
879
|
-
ctx.client.tui.showToast({
|
|
873
|
+
void ctx.client.tui.showToast({
|
|
880
874
|
body: {
|
|
881
875
|
title: SERVICE_NAME,
|
|
882
876
|
message: `Saved to:\n${resolveOutputPath(snapshot)}`,
|
|
883
877
|
variant: 'info',
|
|
884
878
|
duration: 3000,
|
|
885
879
|
},
|
|
886
|
-
})
|
|
880
|
+
}).catch(() => undefined)
|
|
887
881
|
}
|
|
888
882
|
const status = asObject(asObject(event.properties).status)
|
|
889
883
|
if (debug) {
|
|
@@ -921,7 +915,4 @@ export const TranscriptSavePlugin: Plugin = async (ctx) => {
|
|
|
921
915
|
}
|
|
922
916
|
}
|
|
923
917
|
|
|
924
|
-
export default
|
|
925
|
-
id: 'oc-transcript-save',
|
|
926
|
-
server: TranscriptSavePlugin,
|
|
927
|
-
}
|
|
918
|
+
export default TranscriptSavePlugin
|