@fieldwangai/agentflow 0.1.60 → 0.1.62

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.
@@ -57,6 +57,7 @@ export function readPipelineListDescription(flowDir) {
57
57
  export function listFlowsJson(workspaceRoot, opts = {}) {
58
58
  const root = path.resolve(workspaceRoot);
59
59
  const out = [];
60
+ const includeWorkspaceFlows = opts.includeWorkspaceFlows === true || !opts.userId;
60
61
  const adminBuiltinConfig = readAdminBuiltinPipelineConfig();
61
62
  const hiddenBuiltins = new Set(adminBuiltinConfig.hiddenBuiltins);
62
63
  const fromBuiltin = collectPipelineNamesFromDir(PACKAGE_BUILTIN_PIPELINES_DIR);
@@ -93,39 +94,41 @@ export function listFlowsJson(workspaceRoot, opts = {}) {
93
94
  const description = readPipelineListDescription(dir);
94
95
  out.push({ id: name, path: dir, source: "user", archived: true, ...(description ? { description } : {}) });
95
96
  }
96
- const wsPrimary = path.join(root, PIPELINES_DIR);
97
- const fromWorkspace = collectPipelineNamesFromDir(wsPrimary);
98
- const workspaceIds = new Set(fromWorkspace);
99
- for (const name of fromWorkspace) {
100
- if (name === ARCHIVED_PIPELINES_DIR_NAME) continue;
101
- const dir = path.join(wsPrimary, name);
102
- const description = readPipelineListDescription(dir);
103
- out.push({ id: name, path: dir, source: "workspace", ...(description ? { description } : {}) });
104
- }
105
- const wsArchivedPrimary = path.join(wsPrimary, ARCHIVED_PIPELINES_DIR_NAME);
106
- const fromWsArchived = collectPipelineNamesFromDir(wsArchivedPrimary);
107
- const workspaceArchivedIds = new Set(fromWsArchived);
108
- for (const name of fromWsArchived) {
109
- const dir = path.join(wsArchivedPrimary, name);
110
- const description = readPipelineListDescription(dir);
111
- out.push({ id: name, path: dir, source: "workspace", archived: true, ...(description ? { description } : {}) });
112
- }
113
- const fromLegacyWs = collectPipelineNamesFromDir(path.join(root, LEGACY_PIPELINES_DIR));
114
- for (const name of fromLegacyWs) {
115
- if (name === ARCHIVED_PIPELINES_DIR_NAME) continue;
116
- if (workspaceIds.has(name)) continue;
117
- const legDir = path.join(root, LEGACY_PIPELINES_DIR, name);
118
- const description = readPipelineListDescription(legDir);
119
- out.push({ id: name, path: legDir, source: "workspace", ...(description ? { description } : {}) });
120
- }
121
- const legArchivedRoot = path.join(root, LEGACY_PIPELINES_DIR, ARCHIVED_PIPELINES_DIR_NAME);
122
- const fromLegArchived = collectPipelineNamesFromDir(legArchivedRoot);
123
- for (const name of fromLegArchived) {
124
- if (workspaceArchivedIds.has(name)) continue;
125
- const dir = path.join(legArchivedRoot, name);
126
- const description = readPipelineListDescription(dir);
127
- out.push({ id: name, path: dir, source: "workspace", archived: true, ...(description ? { description } : {}) });
128
- workspaceArchivedIds.add(name);
97
+ if (includeWorkspaceFlows) {
98
+ const wsPrimary = path.join(root, PIPELINES_DIR);
99
+ const fromWorkspace = collectPipelineNamesFromDir(wsPrimary);
100
+ const workspaceIds = new Set(fromWorkspace);
101
+ for (const name of fromWorkspace) {
102
+ if (name === ARCHIVED_PIPELINES_DIR_NAME) continue;
103
+ const dir = path.join(wsPrimary, name);
104
+ const description = readPipelineListDescription(dir);
105
+ out.push({ id: name, path: dir, source: "workspace", ...(description ? { description } : {}) });
106
+ }
107
+ const wsArchivedPrimary = path.join(wsPrimary, ARCHIVED_PIPELINES_DIR_NAME);
108
+ const fromWsArchived = collectPipelineNamesFromDir(wsArchivedPrimary);
109
+ const workspaceArchivedIds = new Set(fromWsArchived);
110
+ for (const name of fromWsArchived) {
111
+ const dir = path.join(wsArchivedPrimary, name);
112
+ const description = readPipelineListDescription(dir);
113
+ out.push({ id: name, path: dir, source: "workspace", archived: true, ...(description ? { description } : {}) });
114
+ }
115
+ const fromLegacyWs = collectPipelineNamesFromDir(path.join(root, LEGACY_PIPELINES_DIR));
116
+ for (const name of fromLegacyWs) {
117
+ if (name === ARCHIVED_PIPELINES_DIR_NAME) continue;
118
+ if (workspaceIds.has(name)) continue;
119
+ const legDir = path.join(root, LEGACY_PIPELINES_DIR, name);
120
+ const description = readPipelineListDescription(legDir);
121
+ out.push({ id: name, path: legDir, source: "workspace", ...(description ? { description } : {}) });
122
+ }
123
+ const legArchivedRoot = path.join(root, LEGACY_PIPELINES_DIR, ARCHIVED_PIPELINES_DIR_NAME);
124
+ const fromLegArchived = collectPipelineNamesFromDir(legArchivedRoot);
125
+ for (const name of fromLegArchived) {
126
+ if (workspaceArchivedIds.has(name)) continue;
127
+ const dir = path.join(legArchivedRoot, name);
128
+ const description = readPipelineListDescription(dir);
129
+ out.push({ id: name, path: dir, source: "workspace", archived: true, ...(description ? { description } : {}) });
130
+ workspaceArchivedIds.add(name);
131
+ }
129
132
  }
130
133
  const sourceRank = (s) => (s === "builtin" ? 0 : s === "admin" ? 1 : s === "user" ? 2 : 3);
131
134
  const archRank = (a) => (a.archived ? 1 : 0);