cowork-flow 0.0.25 → 0.0.26
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/package.json +1 -1
- package/template/.cowork-flow/.version +1 -1
- package/template/.cowork-flow/scripts/common/active_task.py +8 -0
- package/template/.cowork-flow/scripts/subagent.py +1 -0
- package/template/.cowork-flow/scripts/task.py +2 -2
- package/template/.opencode/plugins/cowork-flow.js +36 -1
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.26
|
|
@@ -66,6 +66,10 @@ def resolve_context_key(values: Mapping[str, object] | None = None) -> str | Non
|
|
|
66
66
|
if claude_session and claude_session.strip():
|
|
67
67
|
return f"claude_{_sanitize(claude_session)}"
|
|
68
68
|
|
|
69
|
+
claude_code_session = os.environ.get("CLAUDE_CODE_SESSION_ID")
|
|
70
|
+
if claude_code_session and claude_code_session.strip():
|
|
71
|
+
return f"claude_{_sanitize(claude_code_session)}"
|
|
72
|
+
|
|
69
73
|
codex_session = os.environ.get("CODEX_SESSION_ID")
|
|
70
74
|
if codex_session and codex_session.strip():
|
|
71
75
|
return f"codex_{_sanitize(codex_session)}"
|
|
@@ -90,6 +94,8 @@ def resolve_context_key(values: Mapping[str, object] | None = None) -> str | Non
|
|
|
90
94
|
(
|
|
91
95
|
"OPENCODE_SESSION_ID",
|
|
92
96
|
"opencode_session_id",
|
|
97
|
+
"sessionID",
|
|
98
|
+
"sessionId",
|
|
93
99
|
),
|
|
94
100
|
)
|
|
95
101
|
if input_opencode_session:
|
|
@@ -100,6 +106,8 @@ def resolve_context_key(values: Mapping[str, object] | None = None) -> str | Non
|
|
|
100
106
|
(
|
|
101
107
|
"CLAUDE_SESSION_ID",
|
|
102
108
|
"claude_session_id",
|
|
109
|
+
"CLAUDE_CODE_SESSION_ID",
|
|
110
|
+
"claude_code_session_id",
|
|
103
111
|
),
|
|
104
112
|
)
|
|
105
113
|
if input_claude_session:
|
|
@@ -253,6 +253,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
253
253
|
init.add_argument("--title", required=True)
|
|
254
254
|
init.add_argument("--role", default="subagent")
|
|
255
255
|
init.add_argument("--agent-type")
|
|
256
|
+
init.add_argument("--execution-task-dir", default=argparse.SUPPRESS)
|
|
256
257
|
init.add_argument("--source", default="auto")
|
|
257
258
|
init.add_argument("--goal")
|
|
258
259
|
init.add_argument("--expected-output", default="Files changed, validation commands, and blockers.")
|
|
@@ -931,7 +931,7 @@ def cmd_start(args: argparse.Namespace) -> int:
|
|
|
931
931
|
if active is None:
|
|
932
932
|
print(
|
|
933
933
|
colored(
|
|
934
|
-
"Error: Missing session context. Set COWORK_FLOW_CONTEXT_ID or run inside
|
|
934
|
+
"Error: Missing session context. Set COWORK_FLOW_CONTEXT_ID or run inside a supported host session.",
|
|
935
935
|
Colors.RED,
|
|
936
936
|
),
|
|
937
937
|
file=sys.stderr,
|
|
@@ -1011,7 +1011,7 @@ def cmd_current(args: argparse.Namespace) -> int:
|
|
|
1011
1011
|
if not active.context_key:
|
|
1012
1012
|
print(
|
|
1013
1013
|
colored(
|
|
1014
|
-
"Error: Missing session context. Set COWORK_FLOW_CONTEXT_ID or run inside
|
|
1014
|
+
"Error: Missing session context. Set COWORK_FLOW_CONTEXT_ID or run inside a supported host session.",
|
|
1015
1015
|
Colors.RED,
|
|
1016
1016
|
),
|
|
1017
1017
|
file=sys.stderr,
|
|
@@ -202,15 +202,47 @@ function resolveRuntimeContextId(input) {
|
|
|
202
202
|
return match ? sanitize(match[1]) : null
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
+
function resolveOpenCodeSessionId(input) {
|
|
206
|
+
const direct = firstString(input, [
|
|
207
|
+
"OPENCODE_SESSION_ID",
|
|
208
|
+
"opencode_session_id",
|
|
209
|
+
"sessionID",
|
|
210
|
+
"sessionId",
|
|
211
|
+
"session_id",
|
|
212
|
+
])
|
|
213
|
+
if (direct) {
|
|
214
|
+
return sanitize(direct)
|
|
215
|
+
}
|
|
216
|
+
const nested = firstString(input?.session, ["id", "sessionID", "sessionId", "session_id"])
|
|
217
|
+
return nested ? sanitize(nested) : null
|
|
218
|
+
}
|
|
219
|
+
|
|
205
220
|
function resolveContextKey(input) {
|
|
206
221
|
const explicit = firstString(input, ["COWORK_FLOW_CONTEXT_ID", "cowork_flow_context_id", "context_id"])
|
|
207
222
|
if (explicit) {
|
|
208
223
|
return sanitize(explicit)
|
|
209
224
|
}
|
|
210
|
-
const opencodeSession =
|
|
225
|
+
const opencodeSession = resolveOpenCodeSessionId(input)
|
|
211
226
|
return opencodeSession ? `opencode_${sanitize(opencodeSession)}` : null
|
|
212
227
|
}
|
|
213
228
|
|
|
229
|
+
function injectShellEnv(input, output) {
|
|
230
|
+
const contextKey = resolveContextKey(input)
|
|
231
|
+
if (!contextKey) {
|
|
232
|
+
return
|
|
233
|
+
}
|
|
234
|
+
if (!output.env || typeof output.env !== "object") {
|
|
235
|
+
output.env = {}
|
|
236
|
+
}
|
|
237
|
+
if (!output.env.COWORK_FLOW_CONTEXT_ID) {
|
|
238
|
+
output.env.COWORK_FLOW_CONTEXT_ID = contextKey
|
|
239
|
+
}
|
|
240
|
+
const opencodeSession = resolveOpenCodeSessionId(input)
|
|
241
|
+
if (opencodeSession && !output.env.OPENCODE_SESSION_ID) {
|
|
242
|
+
output.env.OPENCODE_SESSION_ID = opencodeSession
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
214
246
|
function resolveHostContextKey(input) {
|
|
215
247
|
const direct = firstString(input, ["cowork_host_context_key", "host_context_key", "COWORK_FLOW_HOST_CONTEXT_KEY"])
|
|
216
248
|
if (direct) {
|
|
@@ -310,6 +342,9 @@ function buildRuntimeWorkflowState(input) {
|
|
|
310
342
|
|
|
311
343
|
export const CoworkFlowPlugin = async () => {
|
|
312
344
|
return {
|
|
345
|
+
"shell.env": async (input, output) => {
|
|
346
|
+
injectShellEnv(input, output)
|
|
347
|
+
},
|
|
313
348
|
"experimental.chat.system.transform": async (input, output) => {
|
|
314
349
|
output.system.push([buildContractDigest(input), buildRuntimeWorkflowState(input)].filter(Boolean).join("\n\n"))
|
|
315
350
|
},
|