@fenixforce/edition-pro 0.1.0
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/dist/api/approval-routes.d.ts +15 -0
- package/dist/api/fleet-routes.d.ts +23 -0
- package/dist/api/integration-routes.d.ts +17 -0
- package/dist/api/middleware.d.ts +37 -0
- package/dist/boot.d.ts +37 -0
- package/dist/business/approval-queue.d.ts +94 -0
- package/dist/business/arena.d.ts +71 -0
- package/dist/business/best-of-n.d.ts +68 -0
- package/dist/business/brainstorm.d.ts +42 -0
- package/dist/business/compile-checker.d.ts +50 -0
- package/dist/business/debate.d.ts +38 -0
- package/dist/business/fleet-budget.d.ts +69 -0
- package/dist/business/fleet-config.d.ts +125 -0
- package/dist/business/fleet.d.ts +85 -0
- package/dist/business/handoff.d.ts +56 -0
- package/dist/business/hat-system.d.ts +57 -0
- package/dist/business/index.d.ts +44 -0
- package/dist/business/integration-registry.d.ts +66 -0
- package/dist/business/node-pipeline.d.ts +62 -0
- package/dist/business/oracle.d.ts +64 -0
- package/dist/business/roles/index.d.ts +7 -0
- package/dist/business/roles/judge.d.ts +24 -0
- package/dist/business/roles/planner.d.ts +30 -0
- package/dist/business/roles/types.d.ts +37 -0
- package/dist/business/roles/worker.d.ts +25 -0
- package/dist/business/router.d.ts +75 -0
- package/dist/business/shared-memory.d.ts +85 -0
- package/dist/business/status-detector.d.ts +52 -0
- package/dist/business/swarm-registry.d.ts +63 -0
- package/dist/business/templates.d.ts +55 -0
- package/dist/business/workspace-manager.d.ts +105 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +638 -0
- package/dist/infrastructure/pty-agent.d.ts +74 -0
- package/dist/migrations/migrate.d.ts +7 -0
- package/dist/migrations/runner.d.ts +49 -0
- package/dist/workspace/worktree.d.ts +69 -0
- package/package.json +37 -0
- package/skills/builtin/academic-researcher/SKILL.md +51 -0
- package/skills/builtin/advanced-recon/SKILL.md +75 -0
- package/skills/builtin/agent-governance/SKILL.md +122 -0
- package/skills/builtin/algorithmic-art/SKILL.md +55 -0
- package/skills/builtin/api-attack-surface-mapper/SKILL.md +88 -0
- package/skills/builtin/api-development/SKILL.md +147 -0
- package/skills/builtin/api-exploit-prover/SKILL.md +74 -0
- package/skills/builtin/api-integration/SKILL.md +73 -0
- package/skills/builtin/api-security-tester/SKILL.md +82 -0
- package/skills/builtin/api-test-executor/SKILL.md +62 -0
- package/skills/builtin/app-store-optimization/SKILL.md +46 -0
- package/skills/builtin/audio-tour-guide/SKILL.md +18 -0
- package/skills/builtin/auth-flow-operator/SKILL.md +70 -0
- package/skills/builtin/autonomous-rag/SKILL.md +21 -0
- package/skills/builtin/backend-development/SKILL.md +265 -0
- package/skills/builtin/binary-analysis-analyst/SKILL.md +61 -0
- package/skills/builtin/binary-analysis-core/SKILL.md +65 -0
- package/skills/builtin/binary-recon/SKILL.md +64 -0
- package/skills/builtin/blackboard-coordination/SKILL.md +56 -0
- package/skills/builtin/blog-to-podcast/SKILL.md +18 -0
- package/skills/builtin/blog-writing/SKILL.md +36 -0
- package/skills/builtin/brainstorming/SKILL.md +69 -0
- package/skills/builtin/brand-design/SKILL.md +42 -0
- package/skills/builtin/ci-cd-pipelines/SKILL.md +210 -0
- package/skills/builtin/cloud-infrastructure/SKILL.md +140 -0
- package/skills/builtin/code-review/SKILL.md +88 -0
- package/skills/builtin/code-review-analyst/SKILL.md +96 -0
- package/skills/builtin/code-review-recon/SKILL.md +64 -0
- package/skills/builtin/code-review-verifier/SKILL.md +55 -0
- package/skills/builtin/coding-agent-team/SKILL.md +13 -0
- package/skills/builtin/competitor-intelligence/SKILL.md +39 -0
- package/skills/builtin/content-engine/SKILL.md +82 -0
- package/skills/builtin/context7-docs/SKILL.md +145 -0
- package/skills/builtin/copywriting/SKILL.md +38 -0
- package/skills/builtin/corrective-rag/SKILL.md +19 -0
- package/skills/builtin/cost-optimization/SKILL.md +131 -0
- package/skills/builtin/crypto-vulnerability-analyst/SKILL.md +64 -0
- package/skills/builtin/customer-support/SKILL.md +48 -0
- package/skills/builtin/customer-voice-support/SKILL.md +43 -0
- package/skills/builtin/data-analysis/SKILL.md +57 -0
- package/skills/builtin/data-visualization/SKILL.md +33 -0
- package/skills/builtin/database-design/SKILL.md +119 -0
- package/skills/builtin/decision-helper/SKILL.md +84 -0
- package/skills/builtin/deep-research/SKILL.md +68 -0
- package/skills/builtin/deepwiki-research/SKILL.md +115 -0
- package/skills/builtin/dependency-audit/SKILL.md +46 -0
- package/skills/builtin/doc-coauthoring/SKILL.md +48 -0
- package/skills/builtin/docker-deployment/SKILL.md +243 -0
- package/skills/builtin/docx-generation/SKILL.md +135 -0
- package/skills/builtin/dry-run-harness/SKILL.md +61 -0
- package/skills/builtin/editor/SKILL.md +44 -0
- package/skills/builtin/email-drafter/SKILL.md +42 -0
- package/skills/builtin/error-handling/SKILL.md +82 -0
- package/skills/builtin/eval-harness/SKILL.md +197 -0
- package/skills/builtin/evaluation-framework/SKILL.md +51 -0
- package/skills/builtin/exploit-writer/SKILL.md +63 -0
- package/skills/builtin/fact-checker/SKILL.md +51 -0
- package/skills/builtin/filesystem-context/SKILL.md +47 -0
- package/skills/builtin/financial-coach/SKILL.md +18 -0
- package/skills/builtin/finding-chain-correlator/SKILL.md +70 -0
- package/skills/builtin/finding-verifier/SKILL.md +65 -0
- package/skills/builtin/frontend-design/SKILL.md +104 -0
- package/skills/builtin/frontend-development/SKILL.md +227 -0
- package/skills/builtin/frontend-slides/SKILL.md +155 -0
- package/skills/builtin/fullstack-project/SKILL.md +286 -0
- package/skills/builtin/game-development/SKILL.md +60 -0
- package/skills/builtin/git-workflow/SKILL.md +44 -0
- package/skills/builtin/i18n-localization/SKILL.md +38 -0
- package/skills/builtin/image-prompt-engineering/SKILL.md +37 -0
- package/skills/builtin/investment-research/SKILL.md +33 -0
- package/skills/builtin/investor-materials/SKILL.md +90 -0
- package/skills/builtin/javascript-surface-analyzer/SKILL.md +66 -0
- package/skills/builtin/markdown-reports/SKILL.md +68 -0
- package/skills/builtin/market-research/SKILL.md +69 -0
- package/skills/builtin/mcp-builder/SKILL.md +86 -0
- package/skills/builtin/meeting-notes/SKILL.md +47 -0
- package/skills/builtin/memory-safety-analyst/SKILL.md +61 -0
- package/skills/builtin/meta-controller/SKILL.md +44 -0
- package/skills/builtin/mixture-of-agents/SKILL.md +53 -0
- package/skills/builtin/monitoring-observability/SKILL.md +169 -0
- package/skills/builtin/negotiation-simulator/SKILL.md +24 -0
- package/skills/builtin/nestjs-development/SKILL.md +56 -0
- package/skills/builtin/nextjs-development/SKILL.md +55 -0
- package/skills/builtin/parallel-dispatch/SKILL.md +83 -0
- package/skills/builtin/pdf-generation/SKILL.md +169 -0
- package/skills/builtin/personal-finance/SKILL.md +17 -0
- package/skills/builtin/pev-workflow/SKILL.md +62 -0
- package/skills/builtin/planning-with-files/SKILL.md +59 -0
- package/skills/builtin/pptx-generation/SKILL.md +117 -0
- package/skills/builtin/prisma-orm/SKILL.md +48 -0
- package/skills/builtin/rag-database-routing/SKILL.md +38 -0
- package/skills/builtin/rapid-prototyping/SKILL.md +152 -0
- package/skills/builtin/react-development/SKILL.md +244 -0
- package/skills/builtin/react-native-mobile/SKILL.md +113 -0
- package/skills/builtin/refactoring/SKILL.md +39 -0
- package/skills/builtin/reflexive-metacognition/SKILL.md +29 -0
- package/skills/builtin/riper-workflow/SKILL.md +214 -0
- package/skills/builtin/security-audit/SKILL.md +113 -0
- package/skills/builtin/security-self-audit/SKILL.md +311 -0
- package/skills/builtin/self-evolving-agent/SKILL.md +28 -0
- package/skills/builtin/self-improvement-loop/SKILL.md +58 -0
- package/skills/builtin/semantic-search/SKILL.md +93 -0
- package/skills/builtin/seo-audit-team/SKILL.md +27 -0
- package/skills/builtin/seo-optimization/SKILL.md +49 -0
- package/skills/builtin/server-management/SKILL.md +190 -0
- package/skills/builtin/social-media-content/SKILL.md +50 -0
- package/skills/builtin/sprint-planner/SKILL.md +49 -0
- package/skills/builtin/strategic-compact/SKILL.md +61 -0
- package/skills/builtin/strategy-advisor/SKILL.md +51 -0
- package/skills/builtin/structured-thinking/SKILL.md +70 -0
- package/skills/builtin/subagent-development/SKILL.md +105 -0
- package/skills/builtin/system-design/SKILL.md +66 -0
- package/skills/builtin/systematic-debugging/SKILL.md +87 -0
- package/skills/builtin/tailwind-css/SKILL.md +55 -0
- package/skills/builtin/taint-flow-tracer/SKILL.md +89 -0
- package/skills/builtin/teaching-agent-team/SKILL.md +32 -0
- package/skills/builtin/tech-debt-manager/SKILL.md +67 -0
- package/skills/builtin/technical-documentation/SKILL.md +47 -0
- package/skills/builtin/test-driven-development/SKILL.md +70 -0
- package/skills/builtin/theme-factory/SKILL.md +244 -0
- package/skills/builtin/threat-model-generator/SKILL.md +105 -0
- package/skills/builtin/trust-layer/SKILL.md +43 -0
- package/skills/builtin/typescript-patterns/SKILL.md +61 -0
- package/skills/builtin/ui-ux-design/SKILL.md +75 -0
- package/skills/builtin/verification-before-completion/SKILL.md +41 -0
- package/skills/builtin/verification-loop/SKILL.md +120 -0
- package/skills/builtin/waf-bypass-agent/SKILL.md +97 -0
- package/skills/builtin/web-artifacts-builder/SKILL.md +117 -0
- package/skills/builtin/web-assessment-executor/SKILL.md +66 -0
- package/skills/builtin/web-exploit-prover/SKILL.md +58 -0
- package/skills/builtin/web-scraping/SKILL.md +63 -0
- package/skills/builtin/webapp-testing/SKILL.md +86 -0
- package/skills/builtin/webhook-development/SKILL.md +62 -0
- package/skills/builtin/writing-skills/SKILL.md +67 -0
- package/skills/builtin/xlsx-generation/SKILL.md +116 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Approval API Routes — Task B3.2
|
|
3
|
+
*
|
|
4
|
+
* REST endpoints for the human-in-the-loop approval queue, plus an
|
|
5
|
+
* SSE stream for real-time approval notifications.
|
|
6
|
+
*/
|
|
7
|
+
import type { ApprovalQueue } from "../business/approval-queue.js";
|
|
8
|
+
import { type Route } from "./middleware.js";
|
|
9
|
+
export interface ApprovalRouteDeps {
|
|
10
|
+
/** The approval queue instance. */
|
|
11
|
+
approvalQueue: ApprovalQueue;
|
|
12
|
+
/** Bearer token for auth (optional — no auth if omitted). */
|
|
13
|
+
authToken?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function createApprovalRoutes(deps: ApprovalRouteDeps): Route[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fleet API Routes — Task B3.1
|
|
3
|
+
*
|
|
4
|
+
* REST endpoints for fleet management, workspace CRUD, templates,
|
|
5
|
+
* and budget tracking. Uses Bun.serve-compatible Route[] pattern.
|
|
6
|
+
*/
|
|
7
|
+
import type { FleetCoordinator } from "../business/fleet.js";
|
|
8
|
+
import type { FleetBudget } from "../business/fleet-budget.js";
|
|
9
|
+
import { type FleetConfig } from "../business/fleet-config.js";
|
|
10
|
+
import { type Route } from "./middleware.js";
|
|
11
|
+
export interface FleetRouteDeps {
|
|
12
|
+
/** The fleet coordinator managing workspaces and routing. */
|
|
13
|
+
coordinator: FleetCoordinator;
|
|
14
|
+
/** Fleet-level budget tracker (optional). */
|
|
15
|
+
fleetBudget?: FleetBudget;
|
|
16
|
+
/** Bearer token for auth (optional — no auth if omitted). */
|
|
17
|
+
authToken?: string;
|
|
18
|
+
/** Callback to update fleet config on PUT /fleet/config. */
|
|
19
|
+
onConfigUpdate?: (config: FleetConfig) => Promise<void>;
|
|
20
|
+
/** Callback to send a message directly to a workspace (bypasses router). */
|
|
21
|
+
onWorkspaceMessage?: (workspaceId: string, message: string, userId: string) => Promise<unknown>;
|
|
22
|
+
}
|
|
23
|
+
export declare function createFleetRoutes(deps: FleetRouteDeps): Route[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration API Routes — Task B3.1
|
|
3
|
+
*
|
|
4
|
+
* REST endpoints for managing external service integrations
|
|
5
|
+
* (connect, disconnect, grant/revoke workspace access).
|
|
6
|
+
*/
|
|
7
|
+
import type { IntegrationRegistry } from "../business/integration-registry.js";
|
|
8
|
+
import { type Route } from "./middleware.js";
|
|
9
|
+
export interface IntegrationRouteDeps {
|
|
10
|
+
/** Integration registry instance. */
|
|
11
|
+
registry: IntegrationRegistry;
|
|
12
|
+
/** Fleet ID scope for the authenticated customer. */
|
|
13
|
+
fleetId: string;
|
|
14
|
+
/** Bearer token for auth (optional — no auth if omitted). */
|
|
15
|
+
authToken?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function createIntegrationRoutes(deps: IntegrationRouteDeps): Route[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Middleware — Shared route matching, auth, and response helpers
|
|
3
|
+
* for the Pro edition HTTP API.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the kernel's api/middleware.ts patterns for consistency,
|
|
6
|
+
* kept local to avoid depending on unexported kernel internals.
|
|
7
|
+
*/
|
|
8
|
+
export type RouteHandler = (req: Request, params: Record<string, string>) => Promise<Response> | Response;
|
|
9
|
+
export interface Route {
|
|
10
|
+
method: string;
|
|
11
|
+
pattern: RegExp;
|
|
12
|
+
paramNames: string[];
|
|
13
|
+
handler: RouteHandler;
|
|
14
|
+
}
|
|
15
|
+
export interface ApiError {
|
|
16
|
+
error: string;
|
|
17
|
+
code?: string;
|
|
18
|
+
status: number;
|
|
19
|
+
}
|
|
20
|
+
export declare const CORS_HEADERS: Record<string, string>;
|
|
21
|
+
export declare function corsPreflightResponse(): Response;
|
|
22
|
+
export declare function jsonResponse(data: unknown, status?: number): Response;
|
|
23
|
+
export declare function errorResponse(status: number, error: string, code?: string): Response;
|
|
24
|
+
export declare class ApiException extends Error {
|
|
25
|
+
readonly status: number;
|
|
26
|
+
readonly code?: string | undefined;
|
|
27
|
+
constructor(status: number, message: string, code?: string | undefined);
|
|
28
|
+
}
|
|
29
|
+
export declare function withErrorHandling(handler: RouteHandler): RouteHandler;
|
|
30
|
+
export declare function validateAuth(req: Request, expectedToken?: string): string | null;
|
|
31
|
+
export declare function parseJsonBody<T = unknown>(req: Request): Promise<T>;
|
|
32
|
+
export declare function validateRequired(body: Record<string, unknown>, fields: string[]): void;
|
|
33
|
+
export declare function buildRoute(method: string, path: string, handler: RouteHandler): Route;
|
|
34
|
+
export declare function matchRoute(routes: Route[], method: string, pathname: string): {
|
|
35
|
+
route: Route;
|
|
36
|
+
params: Record<string, string>;
|
|
37
|
+
} | null;
|
package/dist/boot.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pro Edition Boot — Fleet/Single mode switcher (Task B1.1)
|
|
3
|
+
*
|
|
4
|
+
* If a fleet config is present, boots FleetCoordinator (multi-workspace).
|
|
5
|
+
* Otherwise, boots single workspace as before (backward compatible).
|
|
6
|
+
* Wires fleet events to kernel EventBus.
|
|
7
|
+
*/
|
|
8
|
+
import { type KernelConfig, type Kernel, type RunningKernel } from "@fenixforce/kernel";
|
|
9
|
+
import { type FleetCoordinator, type FleetCoordinatorDeps, type FleetStatusReport } from "./business/index.js";
|
|
10
|
+
export type ProBootMode = "single" | "fleet";
|
|
11
|
+
export interface ProInstance {
|
|
12
|
+
readonly mode: ProBootMode;
|
|
13
|
+
readonly kernel: Kernel;
|
|
14
|
+
/** Fully-wired kernel with agent loop, providers, tools (available after bootPro) */
|
|
15
|
+
readonly runningKernel: RunningKernel | null;
|
|
16
|
+
readonly fleet: FleetCoordinator | null;
|
|
17
|
+
health(): HealthStatus;
|
|
18
|
+
stop(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export interface HealthStatus {
|
|
21
|
+
status: "ok" | "degraded" | "error";
|
|
22
|
+
mode: ProBootMode;
|
|
23
|
+
version: string;
|
|
24
|
+
fleet?: FleetStatusReport;
|
|
25
|
+
}
|
|
26
|
+
export interface ProBootOptions {
|
|
27
|
+
kernelConfig?: Partial<KernelConfig>;
|
|
28
|
+
fleetDeps?: FleetCoordinatorDeps;
|
|
29
|
+
customerId?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Boot the Pro edition.
|
|
33
|
+
*
|
|
34
|
+
* @param fleetConfigRaw - Raw fleet config object (e.g. parsed from fleet.json).
|
|
35
|
+
* Pass null/undefined to boot in single mode.
|
|
36
|
+
*/
|
|
37
|
+
export declare function bootPro(fleetConfigRaw: unknown | null, options?: ProBootOptions): Promise<ProInstance>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Approval Queue — Task B2.2
|
|
3
|
+
*
|
|
4
|
+
* Manages human-in-the-loop approval workflow. Actions requiring
|
|
5
|
+
* approval are queued, and can be approved (executing the action),
|
|
6
|
+
* rejected, or edited (sent back for revision).
|
|
7
|
+
*/
|
|
8
|
+
export type ApprovalStatus = "pending" | "approved" | "rejected" | "edited" | "expired";
|
|
9
|
+
export interface ApprovalItem {
|
|
10
|
+
id: string;
|
|
11
|
+
workspaceId: string;
|
|
12
|
+
/** Human-readable summary of the action. */
|
|
13
|
+
content: string;
|
|
14
|
+
/** Serialized tool call: which tool + arguments to execute on approval. */
|
|
15
|
+
toolCall: {
|
|
16
|
+
tool: string;
|
|
17
|
+
args: Record<string, unknown>;
|
|
18
|
+
};
|
|
19
|
+
status: ApprovalStatus;
|
|
20
|
+
createdAt: Date;
|
|
21
|
+
expiresAt: Date;
|
|
22
|
+
resolvedAt: Date | null;
|
|
23
|
+
resolvedBy: string | null;
|
|
24
|
+
notes: string | null;
|
|
25
|
+
}
|
|
26
|
+
export interface ApprovalListFilters {
|
|
27
|
+
workspaceId?: string;
|
|
28
|
+
status?: ApprovalStatus;
|
|
29
|
+
limit?: number;
|
|
30
|
+
}
|
|
31
|
+
/** Minimal storage interface for approval persistence. */
|
|
32
|
+
export interface StorageAdapter {
|
|
33
|
+
insertApproval(item: ApprovalItem): Promise<void>;
|
|
34
|
+
getApproval(id: string): Promise<ApprovalItem | null>;
|
|
35
|
+
updateApproval(id: string, updates: Partial<ApprovalItem>): Promise<void>;
|
|
36
|
+
listApprovals(filters: ApprovalListFilters): Promise<ApprovalItem[]>;
|
|
37
|
+
/** Count consecutive approved items (no edits/rejects) for auto-approval check. */
|
|
38
|
+
countConsecutiveApprovals(workspaceId: string, actionType: string): Promise<number>;
|
|
39
|
+
}
|
|
40
|
+
/** Executes a tool call that was held for approval. */
|
|
41
|
+
export interface ToolExecutor {
|
|
42
|
+
execute(toolCall: {
|
|
43
|
+
tool: string;
|
|
44
|
+
args: Record<string, unknown>;
|
|
45
|
+
}): Promise<unknown>;
|
|
46
|
+
}
|
|
47
|
+
/** Sends notification when an approval item is pending. */
|
|
48
|
+
export interface NotificationDispatcher {
|
|
49
|
+
send(channel: string, message: string): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
export interface ApprovalQueueConfig {
|
|
52
|
+
/** Default expiration in days for new items. */
|
|
53
|
+
defaultExpirationDays?: number;
|
|
54
|
+
/** Notification channel (e.g., "telegram:12345"). Null disables notifications. */
|
|
55
|
+
notifyChannel?: string | null;
|
|
56
|
+
/** Number of consecutive approvals required before auto-approval kicks in. */
|
|
57
|
+
autoApprovalThreshold?: number;
|
|
58
|
+
}
|
|
59
|
+
export type ApprovalEventType = "approval:pending" | "approval:approved" | "approval:rejected" | "approval:edited" | "approval:expired";
|
|
60
|
+
export type ApprovalEventListener = (event: {
|
|
61
|
+
type: ApprovalEventType;
|
|
62
|
+
item: ApprovalItem;
|
|
63
|
+
}) => void;
|
|
64
|
+
export declare class ApprovalQueue {
|
|
65
|
+
private storage;
|
|
66
|
+
private executor;
|
|
67
|
+
private notifier;
|
|
68
|
+
private config;
|
|
69
|
+
private listeners;
|
|
70
|
+
constructor(storage: StorageAdapter, executor: ToolExecutor, notifier?: NotificationDispatcher | null, config?: ApprovalQueueConfig);
|
|
71
|
+
/** Subscribe to approval events. Returns unsubscribe function. */
|
|
72
|
+
on(listener: ApprovalEventListener): () => void;
|
|
73
|
+
private emit;
|
|
74
|
+
/** Submit a new item for approval. */
|
|
75
|
+
submit(submission: Omit<ApprovalItem, "id" | "status" | "createdAt" | "expiresAt" | "resolvedAt" | "resolvedBy" | "notes">): Promise<ApprovalItem>;
|
|
76
|
+
/** List approval items with optional filters. */
|
|
77
|
+
list(filters?: ApprovalListFilters): Promise<ApprovalItem[]>;
|
|
78
|
+
/** Approve an item — executes the pending action. */
|
|
79
|
+
approve(itemId: string, resolvedBy?: string): Promise<{
|
|
80
|
+
item: ApprovalItem;
|
|
81
|
+
result: unknown;
|
|
82
|
+
}>;
|
|
83
|
+
/** Reject an item — sends notes back to workspace. */
|
|
84
|
+
reject(itemId: string, notes?: string, resolvedBy?: string): Promise<ApprovalItem>;
|
|
85
|
+
/** Edit an item — sends notes back to workspace for revision. */
|
|
86
|
+
edit(itemId: string, notes: string, resolvedBy?: string): Promise<ApprovalItem>;
|
|
87
|
+
/** Mark items past their expiration as expired. */
|
|
88
|
+
expireStale(): Promise<ApprovalItem[]>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Check if a workspace/action pair qualifies for auto-approval.
|
|
92
|
+
* Returns true if N consecutive approvals exist with no edits/rejects.
|
|
93
|
+
*/
|
|
94
|
+
export declare function checkAutoApproval(storage: StorageAdapter, workspaceId: string, actionType: string, threshold?: number): Promise<boolean>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export interface ArenaConfig {
|
|
2
|
+
taskId: string;
|
|
3
|
+
/** Number of competing agents */
|
|
4
|
+
agentCount: number;
|
|
5
|
+
/** Weighted evaluation criteria (values 0–1) */
|
|
6
|
+
evaluationCriteria: {
|
|
7
|
+
correctness: number;
|
|
8
|
+
efficiency: number;
|
|
9
|
+
style: number;
|
|
10
|
+
};
|
|
11
|
+
/** Shared time limit in ms */
|
|
12
|
+
timeLimitMs?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare const DEFAULT_ARENA_CONFIG: Partial<ArenaConfig>;
|
|
15
|
+
export interface ArenaContestant {
|
|
16
|
+
agentId: string;
|
|
17
|
+
workspaceId: string;
|
|
18
|
+
output: unknown;
|
|
19
|
+
toolCallCount: number;
|
|
20
|
+
elapsedMs: number;
|
|
21
|
+
testsPass: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface ArenaScore {
|
|
24
|
+
agentId: string;
|
|
25
|
+
correctnessScore: number;
|
|
26
|
+
efficiencyScore: number;
|
|
27
|
+
styleScore: number;
|
|
28
|
+
weightedTotal: number;
|
|
29
|
+
reasoning: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ArenaDiff {
|
|
32
|
+
winnerId: string;
|
|
33
|
+
loserId: string;
|
|
34
|
+
diffSummary: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ArenaResult {
|
|
37
|
+
taskId: string;
|
|
38
|
+
winner: ArenaContestant;
|
|
39
|
+
scores: ArenaScore[];
|
|
40
|
+
diffs: ArenaDiff[];
|
|
41
|
+
allContestants: ArenaContestant[];
|
|
42
|
+
}
|
|
43
|
+
export type ContestantExecutorFn = (taskId: string, agentId: string) => Promise<ArenaContestant>;
|
|
44
|
+
export type ArenaJudgeFn = (contestants: ArenaContestant[], criteria: ArenaConfig["evaluationCriteria"]) => Promise<ArenaScore[]>;
|
|
45
|
+
export type DiffGeneratorFn = (winner: ArenaContestant, loser: ArenaContestant) => Promise<string>;
|
|
46
|
+
export type ArenaEventEmitter = (event: string, payload: Record<string, unknown>) => void;
|
|
47
|
+
export declare class ArenaEngine {
|
|
48
|
+
private execute;
|
|
49
|
+
private judge;
|
|
50
|
+
private generateDiff;
|
|
51
|
+
private emit;
|
|
52
|
+
constructor(deps: {
|
|
53
|
+
execute: ContestantExecutorFn;
|
|
54
|
+
judge: ArenaJudgeFn;
|
|
55
|
+
generateDiff?: DiffGeneratorFn;
|
|
56
|
+
emit?: ArenaEventEmitter;
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* Run an arena competition for a task.
|
|
60
|
+
*/
|
|
61
|
+
compete(config: ArenaConfig): Promise<ArenaResult>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Format arena result as an approval queue item for human review.
|
|
65
|
+
*/
|
|
66
|
+
export declare function formatArenaForApproval(result: ArenaResult): {
|
|
67
|
+
type: "arena-review";
|
|
68
|
+
taskId: string;
|
|
69
|
+
summary: string;
|
|
70
|
+
metadata: Record<string, unknown>;
|
|
71
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export interface BestOfNConfig {
|
|
2
|
+
/** Candidate count per subtask */
|
|
3
|
+
k: number;
|
|
4
|
+
/** Custom evaluation criteria for judge */
|
|
5
|
+
judgePrompt?: string;
|
|
6
|
+
/** Escalate if judge confidence below this */
|
|
7
|
+
minJudgeConfidence: number;
|
|
8
|
+
/** Max recursion depth */
|
|
9
|
+
maxDepth: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const DEFAULT_BEST_OF_N: BestOfNConfig;
|
|
12
|
+
export interface CandidateResult {
|
|
13
|
+
candidateId: string;
|
|
14
|
+
workspaceId: string;
|
|
15
|
+
output: unknown;
|
|
16
|
+
/** Automated signals */
|
|
17
|
+
signals: {
|
|
18
|
+
testsPass?: boolean;
|
|
19
|
+
lintErrors?: number;
|
|
20
|
+
outputDiffSize?: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface JudgeScore {
|
|
24
|
+
candidateId: string;
|
|
25
|
+
score: number;
|
|
26
|
+
confidence: number;
|
|
27
|
+
reasoning: string;
|
|
28
|
+
}
|
|
29
|
+
export interface BestOfNResult {
|
|
30
|
+
winner: CandidateResult;
|
|
31
|
+
scores: JudgeScore[];
|
|
32
|
+
depth: number;
|
|
33
|
+
reranAfterInvestigation: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface SubTask {
|
|
36
|
+
id: string;
|
|
37
|
+
description: string;
|
|
38
|
+
parentTaskId?: string;
|
|
39
|
+
}
|
|
40
|
+
export type CandidateExecutorFn = (task: SubTask, candidateId: string) => Promise<CandidateResult>;
|
|
41
|
+
export type JudgeFn = (candidates: CandidateResult[], judgePrompt?: string) => Promise<JudgeScore[]>;
|
|
42
|
+
export type InvestigatorFn = (task: SubTask, candidates: CandidateResult[], scores: JudgeScore[]) => Promise<string>;
|
|
43
|
+
export type BudgetCheckFn = (estimatedCost: number) => boolean;
|
|
44
|
+
export type BestOfNEventEmitter = (event: string, payload: Record<string, unknown>) => void;
|
|
45
|
+
export declare class BestOfNEngine {
|
|
46
|
+
private config;
|
|
47
|
+
private execute;
|
|
48
|
+
private judge;
|
|
49
|
+
private investigate;
|
|
50
|
+
private checkBudget;
|
|
51
|
+
private emit;
|
|
52
|
+
constructor(config: Partial<BestOfNConfig> | undefined, deps: {
|
|
53
|
+
execute: CandidateExecutorFn;
|
|
54
|
+
judge: JudgeFn;
|
|
55
|
+
investigate?: InvestigatorFn;
|
|
56
|
+
checkBudget?: BudgetCheckFn;
|
|
57
|
+
emit?: BestOfNEventEmitter;
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* Run best-of-N selection for a subtask.
|
|
61
|
+
*/
|
|
62
|
+
select(task: SubTask, depth?: number): Promise<BestOfNResult>;
|
|
63
|
+
}
|
|
64
|
+
export declare class BudgetExceededError extends Error {
|
|
65
|
+
taskId: string;
|
|
66
|
+
candidatesRequested: number;
|
|
67
|
+
constructor(taskId: string, candidatesRequested: number);
|
|
68
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface BrainstormConfig {
|
|
2
|
+
/** Parallel brainstorming agents */
|
|
3
|
+
agentCount: number;
|
|
4
|
+
/** Problem or creative brief */
|
|
5
|
+
prompt: string;
|
|
6
|
+
/** Optional per-agent perspective assignments */
|
|
7
|
+
perspectives?: string[];
|
|
8
|
+
/** Run synthesis pass after collection */
|
|
9
|
+
synthesize: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const DEFAULT_BRAINSTORM_CONFIG: Partial<BrainstormConfig>;
|
|
12
|
+
export interface BrainstormIdea {
|
|
13
|
+
title: string;
|
|
14
|
+
rationale: string;
|
|
15
|
+
implementationSketch: string;
|
|
16
|
+
/** Which agent generated it */
|
|
17
|
+
agentPerspective: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ThemeCluster {
|
|
20
|
+
theme: string;
|
|
21
|
+
ideas: BrainstormIdea[];
|
|
22
|
+
}
|
|
23
|
+
export interface BrainstormResult {
|
|
24
|
+
/** Top ideas ranked by cross-agent frequency */
|
|
25
|
+
topIdeas: ScoredIdea[];
|
|
26
|
+
/** All ideas from all agents */
|
|
27
|
+
allIdeas: BrainstormIdea[];
|
|
28
|
+
/** Ideas grouped by theme */
|
|
29
|
+
themes: ThemeCluster[];
|
|
30
|
+
agentCount: number;
|
|
31
|
+
}
|
|
32
|
+
export interface ScoredIdea extends BrainstormIdea {
|
|
33
|
+
/** How many agents proposed similar ideas */
|
|
34
|
+
crossAgentFrequency: number;
|
|
35
|
+
score: number;
|
|
36
|
+
}
|
|
37
|
+
export type BrainstormLLMCallFn = (agentId: string, prompt: string) => Promise<string>;
|
|
38
|
+
export type BrainstormEventEmitter = (event: string, payload: Record<string, unknown>) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Run a parallel brainstorming session.
|
|
41
|
+
*/
|
|
42
|
+
export declare function runBrainstorm(config: BrainstormConfig, llmCall: BrainstormLLMCallFn, emit?: BrainstormEventEmitter): Promise<BrainstormResult>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export interface CompileCheckJob {
|
|
2
|
+
workspaceId: string;
|
|
3
|
+
/** Files to verify */
|
|
4
|
+
changedFiles: string[];
|
|
5
|
+
/** Build command, e.g. 'bun run build', 'tsc --noEmit' */
|
|
6
|
+
command: string;
|
|
7
|
+
/** Timeout in ms */
|
|
8
|
+
timeout: number;
|
|
9
|
+
/** For monorepo: package paths to check in parallel */
|
|
10
|
+
packagePaths?: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare const DEFAULT_COMPILE_TIMEOUT = 30000;
|
|
13
|
+
export interface CompileError {
|
|
14
|
+
file: string;
|
|
15
|
+
line: number;
|
|
16
|
+
column: number;
|
|
17
|
+
message: string;
|
|
18
|
+
severity: "error" | "warning";
|
|
19
|
+
}
|
|
20
|
+
export interface CompileCheckResult {
|
|
21
|
+
workspaceId: string;
|
|
22
|
+
passed: boolean;
|
|
23
|
+
fileCount: number;
|
|
24
|
+
elapsedMs: number;
|
|
25
|
+
errors: CompileError[];
|
|
26
|
+
/** Per-package results for monorepo checks */
|
|
27
|
+
packageResults?: PackageCompileResult[];
|
|
28
|
+
}
|
|
29
|
+
export interface PackageCompileResult {
|
|
30
|
+
packagePath: string;
|
|
31
|
+
passed: boolean;
|
|
32
|
+
errors: CompileError[];
|
|
33
|
+
elapsedMs: number;
|
|
34
|
+
}
|
|
35
|
+
export type CompileEventEmitter = (event: string, payload: Record<string, unknown>) => void;
|
|
36
|
+
export type ArtifactStoreFn = (key: string, content: string) => Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Run a compilation check. Returns a concise error summary for LLM context;
|
|
39
|
+
* full build logs are stored as brain artifacts for human inspection.
|
|
40
|
+
*/
|
|
41
|
+
export declare function runCompileCheck(job: CompileCheckJob, emit?: CompileEventEmitter, storeArtifact?: ArtifactStoreFn): Promise<CompileCheckResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Format compile errors for injection into agent context.
|
|
44
|
+
*/
|
|
45
|
+
export declare function formatErrorSummary(result: CompileCheckResult): string;
|
|
46
|
+
/**
|
|
47
|
+
* Parse structured errors from compiler stderr.
|
|
48
|
+
* Supports TypeScript, ESLint, and generic file:line:col patterns.
|
|
49
|
+
*/
|
|
50
|
+
export declare function parseCompileErrors(stderr: string): CompileError[];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface DebateConfig {
|
|
2
|
+
/** Number of debate iterations */
|
|
3
|
+
rounds: number;
|
|
4
|
+
/** Decision or proposal to evaluate */
|
|
5
|
+
topic: string;
|
|
6
|
+
/** Shared background for both agents */
|
|
7
|
+
context: string;
|
|
8
|
+
/** Custom advocate system prompt */
|
|
9
|
+
advocatePrompt?: string;
|
|
10
|
+
/** Custom critic system prompt */
|
|
11
|
+
criticPrompt?: string;
|
|
12
|
+
/** Route result through approval queue */
|
|
13
|
+
requireApproval?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const DEFAULT_DEBATE_CONFIG: Partial<DebateConfig>;
|
|
16
|
+
export interface DebateRound {
|
|
17
|
+
roundNumber: number;
|
|
18
|
+
advocateArgument: string;
|
|
19
|
+
criticChallenge: string;
|
|
20
|
+
}
|
|
21
|
+
export interface DebateResult {
|
|
22
|
+
topic: string;
|
|
23
|
+
rounds: DebateRound[];
|
|
24
|
+
/** Synthesized recommendation */
|
|
25
|
+
recommendation: string;
|
|
26
|
+
/** Key risks identified by the critic */
|
|
27
|
+
keyRisks: string[];
|
|
28
|
+
/** Minority considerations */
|
|
29
|
+
minorityConsiderations: string[];
|
|
30
|
+
/** Total LLM calls made */
|
|
31
|
+
llmCallCount: number;
|
|
32
|
+
}
|
|
33
|
+
export type DebateLLMCallFn = (role: "advocate" | "critic" | "synthesizer", prompt: string) => Promise<string>;
|
|
34
|
+
export type DebateEventEmitter = (event: string, payload: Record<string, unknown>) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Run an adversarial debate between advocate and critic.
|
|
37
|
+
*/
|
|
38
|
+
export declare function runDebate(config: DebateConfig, llmCall: DebateLLMCallFn, emit?: DebateEventEmitter): Promise<DebateResult>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fleet Budget — Task B2.4
|
|
3
|
+
*
|
|
4
|
+
* Higher-level budget management for fleets. Wraps the kernel's cost
|
|
5
|
+
* tracking with fleet-level and per-workspace daily/monthly limits,
|
|
6
|
+
* budget-exceeded callbacks, and per-workspace cost breakdowns.
|
|
7
|
+
*/
|
|
8
|
+
export interface FleetBudgetConfig {
|
|
9
|
+
/** Fleet-wide daily spending limit in USD. 0 = unlimited. */
|
|
10
|
+
dailyLimit: number;
|
|
11
|
+
/** Fleet-wide monthly spending limit in USD. 0 = unlimited. */
|
|
12
|
+
monthlyLimit: number;
|
|
13
|
+
/** Per-workspace daily limit in USD. Undefined or 0 = no per-workspace limit. */
|
|
14
|
+
perWorkspaceDailyLimit?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface CostEntry {
|
|
17
|
+
workspaceId: string;
|
|
18
|
+
amount: number;
|
|
19
|
+
timestamp: number;
|
|
20
|
+
}
|
|
21
|
+
/** Dependency interface matching the kernel's CostTrackingProvider shape. */
|
|
22
|
+
export interface CostTrackerLike {
|
|
23
|
+
getRecords(): readonly {
|
|
24
|
+
estimatedCost: number;
|
|
25
|
+
timestamp: number;
|
|
26
|
+
}[];
|
|
27
|
+
getSummary(): {
|
|
28
|
+
totalEstimatedCost: number;
|
|
29
|
+
recordCount: number;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export type BudgetExceededType = "fleet_daily" | "fleet_monthly" | "workspace_daily";
|
|
33
|
+
export interface BudgetExceededInfo {
|
|
34
|
+
workspaceId: string;
|
|
35
|
+
type: BudgetExceededType;
|
|
36
|
+
current: number;
|
|
37
|
+
limit: number;
|
|
38
|
+
}
|
|
39
|
+
export type BudgetExceededHandler = (info: BudgetExceededInfo) => void;
|
|
40
|
+
export interface WorkspaceCostBreakdown {
|
|
41
|
+
daily: number;
|
|
42
|
+
monthly: number;
|
|
43
|
+
}
|
|
44
|
+
export declare class FleetBudget {
|
|
45
|
+
private readonly config;
|
|
46
|
+
private readonly costTracker?;
|
|
47
|
+
private readonly entries;
|
|
48
|
+
private readonly handlers;
|
|
49
|
+
constructor(config: FleetBudgetConfig, costTracker?: CostTrackerLike | undefined);
|
|
50
|
+
/** Record a cost against a workspace. */
|
|
51
|
+
recordCost(workspaceId: string, amount: number): void;
|
|
52
|
+
/** Get total fleet cost for today (all workspaces). */
|
|
53
|
+
getCostToday(): number;
|
|
54
|
+
/** Get total fleet cost for this month (all workspaces). */
|
|
55
|
+
getCostThisMonth(): number;
|
|
56
|
+
/** Get cost for a specific workspace in the given period. */
|
|
57
|
+
getWorkspaceCost(workspaceId: string, period: "day" | "month"): number;
|
|
58
|
+
/**
|
|
59
|
+
* Check if a workspace can spend the estimated amount without exceeding
|
|
60
|
+
* fleet-level or workspace-level budgets. Fires budget-exceeded callbacks
|
|
61
|
+
* if a limit would be breached.
|
|
62
|
+
*/
|
|
63
|
+
canSpend(workspaceId: string, estimatedCost: number): boolean;
|
|
64
|
+
/** Register a callback for budget breach events. Returns unsubscribe function. */
|
|
65
|
+
onBudgetExceeded(handler: BudgetExceededHandler): () => void;
|
|
66
|
+
/** Get per-workspace cost breakdown for the current period. */
|
|
67
|
+
getBreakdown(): Map<string, WorkspaceCostBreakdown>;
|
|
68
|
+
private notifyExceeded;
|
|
69
|
+
}
|