@comfanion/usethis_todo 0.1.13 → 0.1.15-dev.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/index.ts +11 -28
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -13,10 +13,15 @@ const pruneStates = new Map<string, TodoPruneState>()
|
|
|
13
13
|
const UsethisTodoPlugin: Plugin = async ({ directory, client }) => {
|
|
14
14
|
// Resolve the authoritative state path from OpenCode server (non-blocking).
|
|
15
15
|
// Must NOT await — server may block until plugin init completes → deadlock.
|
|
16
|
-
client.path
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
// Wrapped in try-catch because client.path may not exist (sync TypeError).
|
|
17
|
+
try {
|
|
18
|
+
client?.path?.get()?.then((pathInfo: any) => {
|
|
19
|
+
const state = pathInfo?.data?.state
|
|
20
|
+
if (state) setNativeStorageBase(state)
|
|
21
|
+
}).catch(() => {})
|
|
22
|
+
} catch {
|
|
23
|
+
// client.path not available in this SDK version — fall back to guessed paths
|
|
24
|
+
}
|
|
20
25
|
|
|
21
26
|
// Ensure enhanced storage directory exists on init
|
|
22
27
|
try {
|
|
@@ -136,30 +141,8 @@ const UsethisTodoPlugin: Plugin = async ({ directory, client }) => {
|
|
|
136
141
|
output.title = "📋 Task details"
|
|
137
142
|
}
|
|
138
143
|
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
"usethis_todo_write",
|
|
142
|
-
"usethis_todo_update",
|
|
143
|
-
"usethis_todo_read",
|
|
144
|
-
"usethis_todo_read_five",
|
|
145
|
-
"usethis_todo_read_by_id",
|
|
146
|
-
])
|
|
147
|
-
|
|
148
|
-
if (!publishTools.has(input.tool)) return
|
|
149
|
-
|
|
150
|
-
const text = ["## TODO", "", out].join("\n")
|
|
151
|
-
|
|
152
|
-
try {
|
|
153
|
-
await client?.session?.prompt?.({
|
|
154
|
-
path: { id: input.sessionID },
|
|
155
|
-
body: {
|
|
156
|
-
noReply: true,
|
|
157
|
-
parts: [{ type: "text", text }],
|
|
158
|
-
},
|
|
159
|
-
})
|
|
160
|
-
} catch {
|
|
161
|
-
// non-fatal
|
|
162
|
-
}
|
|
144
|
+
// Native storage write handles sidebar updates now (via client.path.get()).
|
|
145
|
+
// The old session.prompt snapshot was causing "table chunks not found" errors.
|
|
163
146
|
},
|
|
164
147
|
}
|
|
165
148
|
}
|