opencode-work-context 0.11.1 → 0.11.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.
- package/README.md +1 -1
- package/commands/wc.md +1 -0
- package/package.json +1 -1
- package/src/core.js +2 -1
- package/src/errors.js +1 -0
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ Workspace: Add CSV export to analytics report
|
|
|
33
33
|
|
|
34
34
|
- **Workspace** is one concrete task, such as adding CSV export.
|
|
35
35
|
- **Stage** is one step in that task.
|
|
36
|
-
- **Planning** is normally the first stage.
|
|
36
|
+
- **Planning** is normally the first stage and remains a continuously available coordination surface. Working stages must never depend on it; add dependencies only between working stages with a genuine ordering requirement.
|
|
37
37
|
- **Resume** starts a new session at a selected stage.
|
|
38
38
|
- **Handoff** preserves the context when moving work to another session.
|
|
39
39
|
|
package/commands/wc.md
CHANGED
|
@@ -124,6 +124,7 @@ Supported syntax:
|
|
|
124
124
|
- explicit workspace and stage positions accept canonical padded IDs or unpadded positive integers (`1..999999` and `1..99`); results and generated commands remain padded
|
|
125
125
|
- zero, signs, decimals, whitespace, overlong values, and other non-digit identifier forms are invalid; a lone unpadded workspace ID is not reinterpreted under the one-identifier rule
|
|
126
126
|
- `stage update-result` replaces an existing result and does not create a result for an unfinished stage
|
|
127
|
+
- Planning stage 01 is a continuously available coordination surface, not a prerequisite gate; implementation, research, review, and other working stages must never depend on it
|
|
127
128
|
- execution recommendations have two independent portable fields: capability (`routine`, `implementation`, `architecture`, `security`, `review`) and depth (`light`, `standard`, `deep`)
|
|
128
129
|
- when stage creation does not explicitly name capability and depth, infer both from title, description, prompt, dependencies, active workspace knowledge, and current execution state; pass `classification: inferred`; explicit user values pass `classification: explicit`
|
|
129
130
|
- core and read-only UI never infer classifications; do not use keyword heuristics, mutate during resume, or invent values when the stage prompt is not actionable
|
package/package.json
CHANGED
package/src/core.js
CHANGED
|
@@ -240,7 +240,7 @@ export class WorkContext {
|
|
|
240
240
|
fs.mkdirSync(path.join(this.storage.workspaceDir(workspace), "stages"), { recursive: true });
|
|
241
241
|
this.storage.writeMarkdown(this.storage.workspaceFile(workspace), { schema: 1, workspace, title: title.trim(), status: "in_progress", mode, created_at: now, updated_at: now, tracker_links: [] }, body(title));
|
|
242
242
|
const planningGoal = "Clarify the work goal and constraints";
|
|
243
|
-
const planningPrompt = "Diagnose and plan the task without functional changes. Discuss possible solutions, record durable workspace-wide facts, decisions, constraints, important files, and risks through explicit knowledge operations, and decompose the work into the following stages. For each new implementation stage, write a separate detailed prompt with local context, concrete actions, constraints, completion criteria, and the expected result; do not duplicate shared knowledge that every stage receives in resume.context.workspace_knowledge. Ask clarifying questions only when genuinely blocked. Stages must remain in progress until the user explicitly requests stage finish. If the user explicitly agrees to automatic completion for this workspace, add the exact standalone line AUTO_STAGE_FINISH: allowed to this Planning-stage prompt.";
|
|
243
|
+
const planningPrompt = "Diagnose and plan the task without functional changes. Planning stage 01 is a continuously available coordination surface, never a prerequisite gate: do not make implementation, research, review, or other working stages depend on it. Discuss possible solutions, record durable workspace-wide facts, decisions, constraints, important files, and risks through explicit knowledge operations, and decompose the work into the following stages. For each new implementation stage, write a separate detailed prompt with local context, concrete actions, constraints, completion criteria, and the expected result; do not duplicate shared knowledge that every stage receives in resume.context.workspace_knowledge. Ask clarifying questions only when genuinely blocked. Stages must remain in progress until the user explicitly requests stage finish. If the user explicitly agrees to automatic completion for this workspace, add the exact standalone line AUTO_STAGE_FINISH: allowed to this Planning-stage prompt.";
|
|
244
244
|
this.storage.writeMarkdown(this.storage.stageFile(workspace, "01"), { schema: 1, workspace, stage: "01", title: "Planning", status: "in_progress", goal: planningGoal, prompt: planningPrompt, depends_on: [], owner: actor(this.options), created_at: now, updated_at: now, tracker_links: [] }, body("Planning", planningGoal, planningPrompt));
|
|
245
245
|
const sessionId = options.sessionId || randomUUID();
|
|
246
246
|
const workflowPolicy = mode === "startup" && options.opencodeSessionId ? startupWorkflowPolicy() : null;
|
|
@@ -471,6 +471,7 @@ export class WorkContext {
|
|
|
471
471
|
if (!Array.isArray(options.dependsOn || [])) fail(ERROR_CODES.INVALID_ARGUMENT, "dependsOn must contain unique stage IDs");
|
|
472
472
|
const dependsOn = (options.dependsOn || []).map(normalizeStageId);
|
|
473
473
|
if (new Set(dependsOn).size !== dependsOn.length) fail(ERROR_CODES.INVALID_ARGUMENT, "dependsOn must contain unique stage IDs");
|
|
474
|
+
if (dependsOn.includes("01")) fail(ERROR_CODES.PLANNING_DEPENDENCY_FORBIDDEN, "Working stages cannot depend on Planning stage 01");
|
|
474
475
|
assertCapabilityProfile(options.executionProfile, "executionProfile");
|
|
475
476
|
assertCapabilityDepth(options.executionDepth, "executionDepth");
|
|
476
477
|
assertCapabilityClassification(options.classification);
|
package/src/errors.js
CHANGED
|
@@ -17,6 +17,7 @@ export const ERROR_CODES = Object.freeze({
|
|
|
17
17
|
DELIVERY_INVALID_RANGE: "DELIVERY_INVALID_RANGE", DELIVERY_RANGE_TOO_LARGE: "DELIVERY_RANGE_TOO_LARGE",
|
|
18
18
|
DELIVERY_INVALID_FINDINGS: "DELIVERY_INVALID_FINDINGS", DELIVERY_DIAGNOSTIC_TOO_LARGE: "DELIVERY_DIAGNOSTIC_TOO_LARGE",
|
|
19
19
|
DELIVERY_COMMAND_PROTOCOL_MISMATCH: "DELIVERY_COMMAND_PROTOCOL_MISMATCH",
|
|
20
|
+
PLANNING_DEPENDENCY_FORBIDDEN: "PLANNING_DEPENDENCY_FORBIDDEN",
|
|
20
21
|
});
|
|
21
22
|
|
|
22
23
|
export class WorkContextError extends Error {
|