dev-flow-deepseek 0.8.8 → 0.9.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.
@@ -0,0 +1,118 @@
1
+ import { defineTool } from "@deepseek-ai/dsh-tools";
2
+
3
+ import {
4
+ WORKSPACE_COORDINATOR_TOOL,
5
+ authorizeWorkspaceExecution,
6
+ createWorkspaceCoordinator,
7
+ } from "./workspace-coordinator.mjs";
8
+
9
+ export function registerWorkspaceCoordinator(ctx, options) {
10
+ const coordinator = createWorkspaceCoordinator({
11
+ ...options,
12
+ readTask: options?.readTask ?? (async (request) => await readCoreTask(ctx, request)),
13
+ });
14
+ const disposeGuard = ctx.tools.guard((execution) => {
15
+ if (execution?.name !== WORKSPACE_COORDINATOR_TOOL) return undefined;
16
+ try {
17
+ authorizeWorkspaceExecution(execution);
18
+ return undefined;
19
+ } catch (error) {
20
+ return error.message;
21
+ }
22
+ });
23
+ const disposeTool = ctx.tools.register(defineTool({
24
+ name: WORKSPACE_COORDINATOR_TOOL,
25
+ description: "Provision, consume, or separately clean up a user-confirmed isolated Dev Flow worktree launch. Every mutation requires its exact current-turn confirmation.",
26
+ parameters: {
27
+ operation: { type: "string", required: true, enum: ["provision", "consume", "prepare_cleanup", "cleanup_worktree", "cleanup_branch"] },
28
+ request: { type: "string", description: "Exact admitted development request for a new provision operation." },
29
+ profile: { type: "string", description: "Current DSH Profile name." },
30
+ launch_id: { type: "string", description: "Provisioning launch identity returned by provision." },
31
+ task_id: { type: "string", description: "Fresh terminal Core Task identity for cleanup." },
32
+ revision: { type: "integer", description: "Fresh terminal Core Task revision for cleanup." },
33
+ repository_key: { type: "string", description: "Receipt-owned repository selected for cleanup." },
34
+ source_repository_path: { type: "string", description: "Current source checkout used only for separately authorized branch cleanup; never persisted." },
35
+ repositories: {
36
+ type: "array",
37
+ description: "Confirmed repositories in primary-first order.",
38
+ items: {
39
+ type: "object",
40
+ additionalProperties: false,
41
+ properties: {
42
+ repository_key: { type: "string", required: true },
43
+ source_repository_path: { type: "string", required: true },
44
+ remote_name: { type: "string", required: true },
45
+ base_branch: { type: "string", required: true },
46
+ target_branch: { type: "string", required: true },
47
+ },
48
+ },
49
+ },
50
+ },
51
+ output: {
52
+ schema: { type: "json" },
53
+ render(_arguments, value) {
54
+ return [{ type: "text", text: JSON.stringify(value) }];
55
+ },
56
+ },
57
+ timeoutMs: 10 * 60_000,
58
+ async execute(arguments_, execution) {
59
+ authorizeWorkspaceExecution({ ...execution, name: WORKSPACE_COORDINATOR_TOOL, arguments: arguments_ });
60
+ if (arguments_.operation === "provision") {
61
+ return await coordinator.provision({
62
+ request: arguments_.request,
63
+ profile: arguments_.profile,
64
+ repositories: arguments_.repositories,
65
+ signal: execution.signal,
66
+ });
67
+ }
68
+ if (arguments_.operation === "consume") return await coordinator.consume({ launchID: arguments_.launch_id, signal: execution.signal });
69
+ if (arguments_.operation === "prepare_cleanup") {
70
+ return await coordinator.prepareCleanup({
71
+ launchID: arguments_.launch_id, repositoryKey: arguments_.repository_key,
72
+ taskID: arguments_.task_id, revision: arguments_.revision,
73
+ sourceRepositoryPath: arguments_.source_repository_path,
74
+ signal: execution.signal, execution,
75
+ });
76
+ }
77
+ if (arguments_.operation === "cleanup_worktree") {
78
+ const result = await coordinator.cleanupWorktree({
79
+ launchID: arguments_.launch_id, repositoryKey: arguments_.repository_key,
80
+ taskID: arguments_.task_id, revision: arguments_.revision,
81
+ signal: execution.signal, execution,
82
+ });
83
+ execution.concludeTurn();
84
+ return result;
85
+ }
86
+ const result = await coordinator.cleanupBranch({
87
+ launchID: arguments_.launch_id, repositoryKey: arguments_.repository_key,
88
+ taskID: arguments_.task_id, revision: arguments_.revision,
89
+ sourceRepositoryPath: arguments_.source_repository_path,
90
+ signal: execution.signal, execution,
91
+ });
92
+ execution.concludeTurn();
93
+ return result;
94
+ },
95
+ }));
96
+ return () => {
97
+ disposeTool();
98
+ disposeGuard();
99
+ };
100
+ }
101
+
102
+ async function readCoreTask(ctx, { taskID, signal, execution }) {
103
+ const result = await ctx.tools.execute({
104
+ callId: `${execution.callId}:terminal-task`,
105
+ rootCallId: execution.rootCallId ?? execution.callId,
106
+ parent: execution.token,
107
+ name: "mcp__dev_flow__dev_flow_get_task",
108
+ arguments: { host: "deepseek", task_id: taskID },
109
+ agent: execution.agent,
110
+ signal,
111
+ });
112
+ const text = result.content.filter((block) => block.type === "text").map((block) => block.text).join("\n");
113
+ const start = text.indexOf("{");
114
+ if (result.isError || start < 0) throw new Error("terminal Core Task read failed");
115
+ const envelope = JSON.parse(text.slice(start));
116
+ if (envelope?.ok !== true || envelope.result?.task === undefined) throw new Error("terminal Core Task read failed");
117
+ return envelope.result.task;
118
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dev-flow-deepseek",
3
- "version": "0.8.8",
3
+ "version": "0.9.0",
4
4
  "private": false,
5
5
  "description": "Explicit DeepSeek Harness adapter for the Dev Flow process graph.",
6
6
  "license": "Apache-2.0",
@@ -20,8 +20,11 @@
20
20
  "lib/index.mjs",
21
21
  "lib/paths.mjs",
22
22
  "lib/platform.mjs",
23
+ "lib/provisioning-receipt.mjs",
23
24
  "lib/runtime.mjs",
24
25
  "lib/tool-names.mjs",
26
+ "lib/workspace-coordinator.mjs",
27
+ "lib/workspace-tool.mjs",
25
28
  "runtime/darwin-arm64/dev-flow",
26
29
  "runtime/win32-x64/dev-flow.exe",
27
30
  "skills/dev-flow/SKILL.md",
Binary file
Binary file