@fieldwangai/agentflow 0.1.165 → 0.1.167
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 +131 -21
- package/bin/lib/ai-exploration.mjs +293 -0
- package/bin/lib/composer-agent.mjs +11 -0
- package/bin/lib/cursor-api-key-pool.mjs +246 -32
- package/bin/lib/cursor-model-catalog.mjs +152 -0
- package/bin/lib/repository-index-events.mjs +17 -0
- package/bin/lib/repository-index.mjs +522 -0
- package/bin/lib/ui-server.mjs +167 -0
- package/bin/lib/workspace-routes.mjs +947 -154
- package/bin/lib/workspace-server.mjs +3 -0
- package/builtin/web-ui/dist/assets/{WorkflowAssistantThread-pVdrZ-Rl.js → WorkflowAssistantThread-B0i4F0Ab.js} +1 -1
- package/builtin/web-ui/dist/assets/index-BLTi7FF5.js +877 -0
- package/builtin/web-ui/dist/assets/index-yplDmRpj.css +1 -0
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +2 -2
- package/skills/agentflow-ai-exploration/SKILL.md +127 -0
- package/skills/agentflow-ai-exploration/agents/openai.yaml +4 -0
- package/skills/agentflow-ai-exploration/references/protocol.md +120 -0
- package/skills/agentflow-ai-exploration/scripts/agentflow-ai-exploration.mjs +308 -0
- package/skills/agentflow-ai-exploration/scripts/auth-store.mjs +102 -0
- package/skills/agentflow-cli/runtime/bin/lib/skill-runtime.mjs +242 -137
- package/skills/agentflow-cli/runtime/package.json +1 -1
- package/builtin/web-ui/dist/assets/index-BQeq5tdj.css +0 -1
- package/builtin/web-ui/dist/assets/index-Czutb6ai.js +0 -873
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
function emptyStore() {
|
|
7
|
+
return { version: 1, profiles: {}, pending: {} };
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function authFile() {
|
|
11
|
+
const configured = String(process.env.AGENTFLOW_AUTH_FILE || "").trim();
|
|
12
|
+
return path.resolve(configured || path.join(os.homedir(), ".agentflow", "auth.json"));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function readStore() {
|
|
16
|
+
try {
|
|
17
|
+
const data = JSON.parse(fs.readFileSync(authFile(), "utf8"));
|
|
18
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) return emptyStore();
|
|
19
|
+
return {
|
|
20
|
+
version: 1,
|
|
21
|
+
profiles: data.profiles && typeof data.profiles === "object" && !Array.isArray(data.profiles) ? data.profiles : {},
|
|
22
|
+
pending: data.pending && typeof data.pending === "object" && !Array.isArray(data.pending) ? data.pending : {},
|
|
23
|
+
};
|
|
24
|
+
} catch {
|
|
25
|
+
return emptyStore();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function writeStore(store) {
|
|
30
|
+
const file = authFile();
|
|
31
|
+
fs.mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
|
|
32
|
+
const temporary = `${file}.${process.pid}.${crypto.randomBytes(6).toString("hex")}.tmp`;
|
|
33
|
+
fs.writeFileSync(temporary, `${JSON.stringify(store, null, 2)}\n`, { encoding: "utf8", mode: 0o600 });
|
|
34
|
+
fs.renameSync(temporary, file);
|
|
35
|
+
try { fs.chmodSync(file, 0o600); } catch {}
|
|
36
|
+
return file;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function key(baseUrl) {
|
|
40
|
+
return String(baseUrl || "").replace(/\/+$/, "");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function savedProfile(baseUrl) {
|
|
44
|
+
const profile = readStore().profiles[key(baseUrl)];
|
|
45
|
+
if (!profile || typeof profile !== "object") return null;
|
|
46
|
+
if (Number(profile.expiresAt) > 0 && Number(profile.expiresAt) <= Date.now()) return null;
|
|
47
|
+
return String(profile.token || "").trim() ? profile : null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function savedPending(baseUrl) {
|
|
51
|
+
const pending = readStore().pending[key(baseUrl)];
|
|
52
|
+
if (!pending || typeof pending !== "object") return null;
|
|
53
|
+
if (Number(pending.expiresAt) > 0 && Number(pending.expiresAt) <= Date.now()) return null;
|
|
54
|
+
return pending;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function savePending(baseUrl, input) {
|
|
58
|
+
const store = readStore();
|
|
59
|
+
store.pending[key(baseUrl)] = {
|
|
60
|
+
requestId: String(input.requestId || ""),
|
|
61
|
+
deviceCode: String(input.deviceCode || ""),
|
|
62
|
+
userCode: String(input.userCode || ""),
|
|
63
|
+
verificationUrl: String(input.verificationUrl || ""),
|
|
64
|
+
expiresAt: Number(input.expiresAt) || 0,
|
|
65
|
+
pollInterval: Number(input.pollInterval) || 3,
|
|
66
|
+
createdAt: Date.now(),
|
|
67
|
+
};
|
|
68
|
+
writeStore(store);
|
|
69
|
+
return { ...store.pending[key(baseUrl)], deviceCode: undefined };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function saveProfile(baseUrl, input) {
|
|
73
|
+
const store = readStore();
|
|
74
|
+
store.profiles[key(baseUrl)] = {
|
|
75
|
+
token: String(input.token || ""),
|
|
76
|
+
tokenType: String(input.tokenType || "Bearer"),
|
|
77
|
+
expiresAt: Number(input.expiresAt) || 0,
|
|
78
|
+
user: input.user && typeof input.user === "object" ? input.user : null,
|
|
79
|
+
scopes: Array.isArray(input.scopes) ? input.scopes.map(String) : [],
|
|
80
|
+
updatedAt: Date.now(),
|
|
81
|
+
};
|
|
82
|
+
delete store.pending[key(baseUrl)];
|
|
83
|
+
const file = writeStore(store);
|
|
84
|
+
return { file, profile: { ...store.profiles[key(baseUrl)], token: undefined } };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function clearPending(baseUrl) {
|
|
88
|
+
const store = readStore();
|
|
89
|
+
if (!store.pending[key(baseUrl)]) return false;
|
|
90
|
+
delete store.pending[key(baseUrl)];
|
|
91
|
+
writeStore(store);
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function clearProfile(baseUrl) {
|
|
96
|
+
const store = readStore();
|
|
97
|
+
const existed = Boolean(store.profiles[key(baseUrl)] || store.pending[key(baseUrl)]);
|
|
98
|
+
delete store.profiles[key(baseUrl)];
|
|
99
|
+
delete store.pending[key(baseUrl)];
|
|
100
|
+
if (existed) writeStore(store);
|
|
101
|
+
return existed;
|
|
102
|
+
}
|