@opencode_weave/weave 0.6.0 → 0.6.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.
- package/dist/index.js +31 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1450,7 +1450,7 @@ async function fetchSkillsFromOpenCode(serverUrl, directory) {
|
|
|
1450
1450
|
const url = `${base}/skill?directory=${encodeURIComponent(directory)}`;
|
|
1451
1451
|
let response;
|
|
1452
1452
|
try {
|
|
1453
|
-
response = await fetch(url);
|
|
1453
|
+
response = await fetch(url, { signal: AbortSignal.timeout(3000) });
|
|
1454
1454
|
} catch (err) {
|
|
1455
1455
|
log("Failed to fetch skills from OpenCode — skills will not be loaded", { url, error: String(err) });
|
|
1456
1456
|
return [];
|
|
@@ -2606,6 +2606,7 @@ function clearSession2(sessionId) {
|
|
|
2606
2606
|
// src/plugin/plugin-interface.ts
|
|
2607
2607
|
function createPluginInterface(args) {
|
|
2608
2608
|
const { pluginConfig, hooks, tools, configHandler, agents, client } = args;
|
|
2609
|
+
let pendingInterrupt = false;
|
|
2609
2610
|
return {
|
|
2610
2611
|
tool: tools,
|
|
2611
2612
|
config: async (config) => {
|
|
@@ -2711,25 +2712,37 @@ ${result.contextInjection}`;
|
|
|
2711
2712
|
}
|
|
2712
2713
|
}
|
|
2713
2714
|
}
|
|
2714
|
-
if (
|
|
2715
|
+
if (event.type === "tui.command.execute") {
|
|
2715
2716
|
const evt = event;
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2717
|
+
if (evt.properties?.command === "session.interrupt") {
|
|
2718
|
+
pendingInterrupt = true;
|
|
2719
|
+
log("[work-continuation] User interrupt detected — will suppress next continuation");
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2722
|
+
if (hooks.workContinuation && event.type === "session.idle") {
|
|
2723
|
+
if (pendingInterrupt) {
|
|
2724
|
+
pendingInterrupt = false;
|
|
2725
|
+
log("[work-continuation] Skipping continuation — session was interrupted by user");
|
|
2726
|
+
} else {
|
|
2727
|
+
const evt = event;
|
|
2728
|
+
const sessionId = evt.properties?.sessionID ?? "";
|
|
2729
|
+
if (sessionId) {
|
|
2730
|
+
const result = hooks.workContinuation(sessionId);
|
|
2731
|
+
if (result.continuationPrompt && client) {
|
|
2732
|
+
try {
|
|
2733
|
+
await client.session.promptAsync({
|
|
2734
|
+
path: { id: sessionId },
|
|
2735
|
+
body: {
|
|
2736
|
+
parts: [{ type: "text", text: result.continuationPrompt }]
|
|
2737
|
+
}
|
|
2738
|
+
});
|
|
2739
|
+
log("[work-continuation] Injected continuation prompt", { sessionId });
|
|
2740
|
+
} catch (err) {
|
|
2741
|
+
log("[work-continuation] Failed to inject continuation", { sessionId, error: String(err) });
|
|
2742
|
+
}
|
|
2743
|
+
} else if (result.continuationPrompt) {
|
|
2744
|
+
log("[work-continuation] continuationPrompt available but no client", { sessionId });
|
|
2730
2745
|
}
|
|
2731
|
-
} else if (result.continuationPrompt) {
|
|
2732
|
-
log("[work-continuation] continuationPrompt available but no client", { sessionId });
|
|
2733
2746
|
}
|
|
2734
2747
|
}
|
|
2735
2748
|
}
|