@fieldwangai/agentflow 0.1.106 → 0.1.107
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/bin/lib/agent-runners.mjs +5 -0
- package/bin/lib/composer-agent.mjs +3 -0
- package/bin/lib/prd-workflow-collaboration.mjs +69 -0
- package/bin/lib/ui-server.mjs +612 -52
- package/bin/lib/workflow-report.mjs +431 -0
- package/builtin/web-ui/dist/assets/index-BZMWrBdo.css +1 -0
- package/builtin/web-ui/dist/assets/index-Ds1YW25U.js +348 -0
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +1 -1
- package/skills/agentflow-cli/SKILL.md +72 -1
- package/skills/agentflow-cli/agents/openai.yaml +2 -2
- package/skills/agentflow-cli/scripts/agentflow-cli.mjs +83 -0
- package/builtin/web-ui/dist/assets/index-CC1ceU6X.css +0 -1
- package/builtin/web-ui/dist/assets/index-CkfM-0Xz.js +0 -348
|
@@ -1667,6 +1667,10 @@ export function runClaudeCodeAgentWithPrompt(cliWorkspace, promptText, options =
|
|
|
1667
1667
|
process.env.AGENTFLOW_CLAUDE_CODE_BYPASS_PERMISSIONS !== "0" &&
|
|
1668
1668
|
process.env.AGENTFLOW_CLAUDE_CODE_BYPASS_PERMISSIONS !== "false";
|
|
1669
1669
|
const args = ["-p", "--output-format", "stream-json", "--verbose", "--add-dir", ws];
|
|
1670
|
+
for (const dir of Array.isArray(options.addDirs) ? options.addDirs : []) {
|
|
1671
|
+
const abs = path.resolve(dir);
|
|
1672
|
+
if (abs && abs !== ws) args.push("--add-dir", abs);
|
|
1673
|
+
}
|
|
1670
1674
|
if (bypassPermissions) args.push("--dangerously-skip-permissions");
|
|
1671
1675
|
if (model) args.push("--model", model);
|
|
1672
1676
|
args.push(promptText);
|
|
@@ -1848,6 +1852,7 @@ export function runCodexAgentWithPrompt(cliWorkspace, promptText, options = {})
|
|
|
1848
1852
|
const outputLastMessagePath = path.join(tmpDir, `codex-last-message-${process.pid}-${Date.now()}.txt`);
|
|
1849
1853
|
const args = buildCodexExecArgs({
|
|
1850
1854
|
workspace: ws,
|
|
1855
|
+
addDirs: options.addDirs,
|
|
1851
1856
|
model,
|
|
1852
1857
|
outputLastMessagePath,
|
|
1853
1858
|
promptText,
|
|
@@ -421,6 +421,9 @@ export function startComposerAgent(opts) {
|
|
|
421
421
|
detached: Boolean(opts.detached),
|
|
422
422
|
force: Boolean(opts.force),
|
|
423
423
|
env,
|
|
424
|
+
addDirs: Array.isArray(opts.writableDirs)
|
|
425
|
+
? opts.writableDirs.map((dir) => String(dir || "").trim()).filter(Boolean)
|
|
426
|
+
: [],
|
|
424
427
|
};
|
|
425
428
|
|
|
426
429
|
if (cli === "opencode") {
|
|
@@ -44,6 +44,10 @@ function normalizeTapdId(value) {
|
|
|
44
44
|
return String(value || "").trim();
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
function normalizeShareToken(value) {
|
|
48
|
+
return String(value || "").trim();
|
|
49
|
+
}
|
|
50
|
+
|
|
47
51
|
function publicWorkflow(record, userId = "") {
|
|
48
52
|
if (!record) return null;
|
|
49
53
|
const actorId = normalizeUserId(userId);
|
|
@@ -55,6 +59,8 @@ function publicWorkflow(record, userId = "") {
|
|
|
55
59
|
role: actorId === record.ownerId ? "owner" : String(members[actorId] || ""),
|
|
56
60
|
memberCount: Object.keys(members).length,
|
|
57
61
|
members: Object.entries(members).map(([id, role]) => ({ userId: id, role })),
|
|
62
|
+
shareActive: Boolean(record.shareToken),
|
|
63
|
+
shareCreatedAt: record.shareCreatedAt || "",
|
|
58
64
|
createdAt: record.createdAt || "",
|
|
59
65
|
updatedAt: record.updatedAt || "",
|
|
60
66
|
};
|
|
@@ -75,6 +81,17 @@ export function getPrdWorkflowCollaborationById(workflowId) {
|
|
|
75
81
|
return readRegistry().workflows[String(workflowId || "").trim()] || null;
|
|
76
82
|
}
|
|
77
83
|
|
|
84
|
+
export function getPrdWorkflowCollaborationByShareToken(shareToken) {
|
|
85
|
+
const token = normalizeShareToken(shareToken);
|
|
86
|
+
if (!token) return null;
|
|
87
|
+
const incoming = Buffer.from(token);
|
|
88
|
+
return Object.values(readRegistry().workflows).find((record) => {
|
|
89
|
+
if (!record?.shareToken) return false;
|
|
90
|
+
const stored = Buffer.from(String(record.shareToken));
|
|
91
|
+
return stored.length === incoming.length && crypto.timingSafeEqual(stored, incoming);
|
|
92
|
+
}) || null;
|
|
93
|
+
}
|
|
94
|
+
|
|
78
95
|
export function getPrdWorkflowCollaborationForUser(tapdId, userId) {
|
|
79
96
|
const normalizedTapdId = normalizeTapdId(tapdId);
|
|
80
97
|
const actorId = normalizeUserId(userId);
|
|
@@ -117,6 +134,58 @@ export function prdWorkflowCollaborationSummary(record, userId) {
|
|
|
117
134
|
return publicWorkflow(record, userId);
|
|
118
135
|
}
|
|
119
136
|
|
|
137
|
+
export function ensurePrdWorkflowShareLink({ tapdId, userId }) {
|
|
138
|
+
const ensured = ensurePrdWorkflowCollaboration({ tapdId, userId });
|
|
139
|
+
if (ensured.error) return ensured;
|
|
140
|
+
const actorId = normalizeUserId(userId);
|
|
141
|
+
if (prdWorkflowCollaborationAccess(ensured.record, actorId).role !== "owner") {
|
|
142
|
+
return { error: "Only the Workflow owner can create a share link", status: 403 };
|
|
143
|
+
}
|
|
144
|
+
if (ensured.record.shareToken) {
|
|
145
|
+
return {
|
|
146
|
+
record: ensured.record,
|
|
147
|
+
workflow: publicWorkflow(ensured.record, actorId),
|
|
148
|
+
shareToken: ensured.record.shareToken,
|
|
149
|
+
created: false,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
const registry = readRegistry();
|
|
153
|
+
const record = registry.workflows[ensured.record.id];
|
|
154
|
+
if (!record) return { error: "PRD Workflow collaboration not found", status: 404 };
|
|
155
|
+
const now = new Date().toISOString();
|
|
156
|
+
record.shareToken = crypto.randomBytes(24).toString("base64url");
|
|
157
|
+
record.shareCreatedAt = now;
|
|
158
|
+
record.updatedAt = now;
|
|
159
|
+
writeRegistry(registry);
|
|
160
|
+
return {
|
|
161
|
+
record,
|
|
162
|
+
workflow: publicWorkflow(record, actorId),
|
|
163
|
+
shareToken: record.shareToken,
|
|
164
|
+
created: true,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function revokePrdWorkflowShareLink({ tapdId, userId }) {
|
|
169
|
+
const record = getPrdWorkflowCollaborationForUser(tapdId, userId);
|
|
170
|
+
if (!record) return { error: "PRD Workflow collaboration not found", status: 404 };
|
|
171
|
+
const actorId = normalizeUserId(userId);
|
|
172
|
+
if (prdWorkflowCollaborationAccess(record, actorId).role !== "owner") {
|
|
173
|
+
return { error: "Only the Workflow owner can revoke a share link", status: 403 };
|
|
174
|
+
}
|
|
175
|
+
const registry = readRegistry();
|
|
176
|
+
const stored = registry.workflows[record.id];
|
|
177
|
+
if (!stored) return { error: "PRD Workflow collaboration not found", status: 404 };
|
|
178
|
+
const revoked = Boolean(stored.shareToken);
|
|
179
|
+
delete stored.shareToken;
|
|
180
|
+
delete stored.shareCreatedAt;
|
|
181
|
+
stored.updatedAt = new Date().toISOString();
|
|
182
|
+
writeRegistry(registry);
|
|
183
|
+
return {
|
|
184
|
+
workflow: publicWorkflow(stored, actorId),
|
|
185
|
+
revoked,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
120
189
|
export function addPrdWorkflowCollaborationMember({
|
|
121
190
|
workflowId,
|
|
122
191
|
userId,
|