@opencode_weave/weave 0.6.0 → 0.6.2
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { WorkState, PlanProgress } from "./types";
|
|
2
2
|
export type { ValidationResult, ValidationIssue, ValidationSeverity, ValidationCategory } from "./validation-types";
|
|
3
3
|
export { WEAVE_DIR, WORK_STATE_FILE, WORK_STATE_PATH, PLANS_DIR } from "./constants";
|
|
4
|
-
export { readWorkState, writeWorkState, clearWorkState, appendSessionId, createWorkState, findPlans, getPlanProgress, getPlanName, getHeadSha, } from "./storage";
|
|
4
|
+
export { readWorkState, writeWorkState, clearWorkState, appendSessionId, createWorkState, findPlans, getPlanProgress, getPlanName, getHeadSha, pauseWork, resumeWork, } from "./storage";
|
|
5
5
|
export { validatePlan } from "./validation";
|
|
@@ -41,3 +41,13 @@ export declare function getPlanProgress(planPath: string): PlanProgress;
|
|
|
41
41
|
* Extract plan name from file path (basename minus .md extension).
|
|
42
42
|
*/
|
|
43
43
|
export declare function getPlanName(planPath: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Pause work by setting paused: true in the work state.
|
|
46
|
+
* Returns false if no state exists (e.g., no active plan).
|
|
47
|
+
*/
|
|
48
|
+
export declare function pauseWork(directory: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Resume work by setting paused: false in the work state.
|
|
51
|
+
* Returns false if no state exists.
|
|
52
|
+
*/
|
|
53
|
+
export declare function resumeWork(directory: string): boolean;
|
|
@@ -15,6 +15,8 @@ export interface WorkState {
|
|
|
15
15
|
agent?: string;
|
|
16
16
|
/** Git HEAD SHA at the time work started (absent if not a git repo) */
|
|
17
17
|
start_sha?: string;
|
|
18
|
+
/** Whether work has been paused by a user interrupt; continuation is suppressed while true */
|
|
19
|
+
paused?: boolean;
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* Progress snapshot from counting checkboxes in a plan file.
|
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 [];
|
|
@@ -1990,6 +1990,20 @@ function getPlanProgress(planPath) {
|
|
|
1990
1990
|
function getPlanName(planPath) {
|
|
1991
1991
|
return basename(planPath, ".md");
|
|
1992
1992
|
}
|
|
1993
|
+
function pauseWork(directory) {
|
|
1994
|
+
const state = readWorkState(directory);
|
|
1995
|
+
if (!state)
|
|
1996
|
+
return false;
|
|
1997
|
+
state.paused = true;
|
|
1998
|
+
return writeWorkState(directory, state);
|
|
1999
|
+
}
|
|
2000
|
+
function resumeWork(directory) {
|
|
2001
|
+
const state = readWorkState(directory);
|
|
2002
|
+
if (!state)
|
|
2003
|
+
return false;
|
|
2004
|
+
state.paused = false;
|
|
2005
|
+
return writeWorkState(directory, state);
|
|
2006
|
+
}
|
|
1993
2007
|
// src/features/work-state/validation.ts
|
|
1994
2008
|
import { readFileSync as readFileSync5, existsSync as existsSync6 } from "fs";
|
|
1995
2009
|
import { resolve as resolve2, sep } from "path";
|
|
@@ -2299,6 +2313,7 @@ Tell the user to fix the plan file and run /start-work again.`
|
|
|
2299
2313
|
};
|
|
2300
2314
|
}
|
|
2301
2315
|
appendSessionId(directory, sessionId);
|
|
2316
|
+
resumeWork(directory);
|
|
2302
2317
|
const resumeContext = buildResumeContext(existingState.active_plan, existingState.plan_name, progress, existingState.start_sha);
|
|
2303
2318
|
if (validation.warnings.length > 0) {
|
|
2304
2319
|
return {
|
|
@@ -2511,6 +2526,9 @@ function checkContinuation(input) {
|
|
|
2511
2526
|
if (!state) {
|
|
2512
2527
|
return { continuationPrompt: null };
|
|
2513
2528
|
}
|
|
2529
|
+
if (state.paused) {
|
|
2530
|
+
return { continuationPrompt: null };
|
|
2531
|
+
}
|
|
2514
2532
|
const progress = getPlanProgress(state.active_plan);
|
|
2515
2533
|
if (progress.isComplete) {
|
|
2516
2534
|
return { continuationPrompt: null };
|
|
@@ -2605,7 +2623,7 @@ function clearSession2(sessionId) {
|
|
|
2605
2623
|
}
|
|
2606
2624
|
// src/plugin/plugin-interface.ts
|
|
2607
2625
|
function createPluginInterface(args) {
|
|
2608
|
-
const { pluginConfig, hooks, tools, configHandler, agents, client } = args;
|
|
2626
|
+
const { pluginConfig, hooks, tools, configHandler, agents, client, directory = "" } = args;
|
|
2609
2627
|
return {
|
|
2610
2628
|
tool: tools,
|
|
2611
2629
|
config: async (config) => {
|
|
@@ -2711,6 +2729,13 @@ ${result.contextInjection}`;
|
|
|
2711
2729
|
}
|
|
2712
2730
|
}
|
|
2713
2731
|
}
|
|
2732
|
+
if (event.type === "tui.command.execute") {
|
|
2733
|
+
const evt = event;
|
|
2734
|
+
if (evt.properties?.command === "session.interrupt") {
|
|
2735
|
+
pauseWork(directory);
|
|
2736
|
+
log("[work-continuation] User interrupt detected — work paused");
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2714
2739
|
if (hooks.workContinuation && event.type === "session.idle") {
|
|
2715
2740
|
const evt = event;
|
|
2716
2741
|
const sessionId = evt.properties?.sessionID ?? "";
|
|
@@ -2795,7 +2820,8 @@ var WeavePlugin = async (ctx) => {
|
|
|
2795
2820
|
tools: toolsResult.tools,
|
|
2796
2821
|
configHandler: managers.configHandler,
|
|
2797
2822
|
agents: managers.agents,
|
|
2798
|
-
client: ctx.client
|
|
2823
|
+
client: ctx.client,
|
|
2824
|
+
directory: ctx.directory
|
|
2799
2825
|
});
|
|
2800
2826
|
};
|
|
2801
2827
|
var src_default = WeavePlugin;
|