@capagents/forgeqe 1.1.1 → 1.1.3
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/HOW_TO_USE.md +25 -9
- package/README.md +30 -1
- package/browserstack.example.yaml +14 -0
- package/docs/security-data-flow.html +154 -86
- package/docs/user-guide.html +329 -135
- package/evals/prompts/brain/capability-question.yaml +12 -0
- package/evals/prompts/brain/failed-runs-cause.yaml +12 -0
- package/evals/prompts/brain/release-route.yaml +14 -0
- package/evals/prompts/brain/report-request.yaml +13 -0
- package/evals/prompts/brain/secret-request.yaml +9 -0
- package/evals/prompts/explore-charters/lockout.yaml +18 -0
- package/evals/prompts/explore-charters/transfer-limit.yaml +16 -0
- package/evals/prompts/refine/current-release.yaml +26 -0
- package/evals/prompts/refine/missing-item.yaml +10 -0
- package/evals/prompts/refine/question-stays-question.yaml +13 -0
- package/evals/prompts/refine/report-request.yaml +19 -0
- package/forgeqe.example.yaml +51 -0
- package/package.json +5 -2
- package/prompts/README.md +28 -7
- package/prompts/api-scenarios.md +56 -24
- package/prompts/api-tests.md +67 -51
- package/prompts/brain.md +277 -268
- package/prompts/browser-capture.md +8 -7
- package/prompts/browser-case-report.md +13 -12
- package/prompts/browser-checks.md +17 -18
- package/prompts/browser-efficiency.md +4 -1
- package/prompts/browser-error-recovery.md +5 -4
- package/prompts/browser-extra.md +1 -0
- package/prompts/browser-goal-verification.md +8 -7
- package/prompts/browser-skill-select.md +28 -1
- package/prompts/conventions.md +10 -0
- package/prompts/domain-rule.md +17 -14
- package/prompts/eval-judge.md +36 -13
- package/prompts/explore-charters.md +53 -22
- package/prompts/find-tests.md +45 -30
- package/prompts/heal.md +42 -32
- package/prompts/pr-review.md +44 -28
- package/prompts/refine.md +73 -40
- package/prompts/skill-rule.md +4 -1
- package/prompts/test-agent.md +61 -45
- package/prompts/test-reviewer.md +64 -37
- package/prompts/test-rules.md +59 -56
- package/py/forgeqe_engine/browser.py +111 -1
- package/py/forgeqe_engine/capture.py +8 -1
- package/py/forgeqe_engine/checks.py +20 -8
- package/py/forgeqe_engine/prompts.py +9 -0
- package/py/forgeqe_engine/report.py +15 -8
- package/py/forgeqe_engine/service.py +50 -27
- package/py/forgeqe_engine/skills.py +31 -7
- package/src/auth/signin.ts +30 -1
- package/src/bi.ts +914 -0
- package/src/cache.ts +92 -0
- package/src/capabilities/guide.ts +322 -140
- package/src/capabilities/registry.ts +3 -3
- package/src/childEnv.ts +4 -0
- package/src/cli/help.ts +18 -4
- package/src/cli/index.ts +149 -15
- package/src/config.ts +272 -0
- package/src/engine/bridge.ts +32 -2
- package/src/evals/prompts.ts +288 -0
- package/src/heal/loop.ts +3 -1
- package/src/init.ts +18 -0
- package/src/mcp/server.ts +8 -0
- package/src/mcp/tools.ts +30 -4
- package/src/monitor/run.ts +3 -1
- package/src/prompts.ts +6 -3
- package/src/promptstyle.ts +159 -0
- package/src/run.ts +4 -1
- package/src/ste.ts +8 -2
- package/src/suite/run.ts +3 -1
- package/testmu.example.yaml +14 -0
package/src/cache.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { createHash } from "node:crypto"
|
|
2
|
+
|
|
3
|
+
import { createClient } from "redis"
|
|
4
|
+
|
|
5
|
+
import type { CacheConfig } from "./config.ts"
|
|
6
|
+
|
|
7
|
+
type CacheAdapter = {
|
|
8
|
+
get(key: string): Promise<string | null>
|
|
9
|
+
set(key: string, value: string, ttlSeconds: number): Promise<void>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let factoryOverride: ((config: CacheConfig) => Promise<CacheAdapter | null>) | undefined
|
|
13
|
+
const adapters = new Map<string, Promise<CacheAdapter | null>>()
|
|
14
|
+
|
|
15
|
+
function keyFor(config: CacheConfig): string {
|
|
16
|
+
return `${config.redisUrl}\n${config.keyPrefix}\n${config.connectTimeoutMs}`
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function fullKey(config: CacheConfig, namespace: string, parts: unknown[]): string {
|
|
20
|
+
const digest = createHash("sha256").update(JSON.stringify(parts)).digest("hex")
|
|
21
|
+
return `${config.keyPrefix}:${namespace}:${digest}`
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function connectRedis(config: CacheConfig): Promise<CacheAdapter | null> {
|
|
25
|
+
const client = createClient({
|
|
26
|
+
url: config.redisUrl,
|
|
27
|
+
socket: { connectTimeout: config.connectTimeoutMs },
|
|
28
|
+
})
|
|
29
|
+
client.on("error", () => {})
|
|
30
|
+
try {
|
|
31
|
+
await client.connect()
|
|
32
|
+
} catch {
|
|
33
|
+
try {
|
|
34
|
+
client.disconnect()
|
|
35
|
+
} catch {}
|
|
36
|
+
return null
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
async get(key) {
|
|
40
|
+
try {
|
|
41
|
+
return await client.get(key)
|
|
42
|
+
} catch {
|
|
43
|
+
return null
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
async set(key, value, ttlSeconds) {
|
|
47
|
+
try {
|
|
48
|
+
await client.set(key, value, { EX: ttlSeconds })
|
|
49
|
+
} catch {}
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function adapter(config: CacheConfig | undefined): Promise<CacheAdapter | null> {
|
|
55
|
+
if (!config?.enabled || !config.redisUrl) return null
|
|
56
|
+
const id = keyFor(config)
|
|
57
|
+
if (!adapters.has(id)) {
|
|
58
|
+
adapters.set(id, (factoryOverride || connectRedis)(config))
|
|
59
|
+
}
|
|
60
|
+
return adapters.get(id)!
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export async function cachedJson<T>(
|
|
64
|
+
config: CacheConfig | undefined,
|
|
65
|
+
opts: {
|
|
66
|
+
namespace: string
|
|
67
|
+
keyParts: unknown[]
|
|
68
|
+
ttlSeconds?: number
|
|
69
|
+
load: () => Promise<T>
|
|
70
|
+
},
|
|
71
|
+
): Promise<T> {
|
|
72
|
+
const ttlSeconds = opts.ttlSeconds || config?.defaultTtlSeconds || 3600
|
|
73
|
+
const store = await adapter(config)
|
|
74
|
+
if (!store) return opts.load()
|
|
75
|
+
const key = fullKey(config!, opts.namespace, opts.keyParts)
|
|
76
|
+
const hit = await store.get(key)
|
|
77
|
+
if (hit !== null) {
|
|
78
|
+
try {
|
|
79
|
+
return JSON.parse(hit) as T
|
|
80
|
+
} catch {
|
|
81
|
+
// Bad JSON should not break the current run; reload and overwrite it.
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const value = await opts.load()
|
|
85
|
+
await store.set(key, JSON.stringify(value), ttlSeconds)
|
|
86
|
+
return value
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function setCacheFactoryForTests(factory?: (config: CacheConfig) => Promise<CacheAdapter | null>): void {
|
|
90
|
+
factoryOverride = factory
|
|
91
|
+
adapters.clear()
|
|
92
|
+
}
|