@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,25 @@
|
|
|
1
|
+
import type { RoleTask, EscalationRequest, RoleEventEmitter } from "./types.js";
|
|
2
|
+
export interface WorkerContext {
|
|
3
|
+
workspaceId: string;
|
|
4
|
+
taskScope?: string;
|
|
5
|
+
loopWarningCount: number;
|
|
6
|
+
}
|
|
7
|
+
export type TaskExecutorFn = (task: RoleTask) => Promise<unknown>;
|
|
8
|
+
export interface WorkerResult {
|
|
9
|
+
task: RoleTask;
|
|
10
|
+
output: unknown;
|
|
11
|
+
escalated: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Execute a single task as a worker. Returns result or escalation.
|
|
15
|
+
*/
|
|
16
|
+
export declare function executeWorkerTask(ctx: WorkerContext, task: RoleTask, executor: TaskExecutorFn, emit?: RoleEventEmitter): Promise<WorkerResult>;
|
|
17
|
+
/**
|
|
18
|
+
* Claim the next eligible task from a task queue.
|
|
19
|
+
* Filters by worker's task scope if configured.
|
|
20
|
+
*/
|
|
21
|
+
export declare function claimNextTask(tasks: RoleTask[], ctx: WorkerContext): RoleTask | null;
|
|
22
|
+
/**
|
|
23
|
+
* Create an escalation request for the planner.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createEscalation(task: RoleTask, workerId: string, reason: string): EscalationRequest;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fleet Router — Task B1.2
|
|
3
|
+
*
|
|
4
|
+
* Three-strategy message routing: explicit mention, channel binding,
|
|
5
|
+
* intent classification via LLM. Executes strategies in priority order
|
|
6
|
+
* and falls back to the configured default workspace.
|
|
7
|
+
*/
|
|
8
|
+
import type { FleetRouterConfig, ChannelBinding } from "./fleet-config.js";
|
|
9
|
+
/** Inbound message envelope to be routed. */
|
|
10
|
+
export interface RouteEnvelope {
|
|
11
|
+
/** Raw message text. */
|
|
12
|
+
text: string;
|
|
13
|
+
/** Channel the message arrived on (e.g. "telegram", "discord"). */
|
|
14
|
+
channel: string;
|
|
15
|
+
/** Sender user ID. */
|
|
16
|
+
userId: string;
|
|
17
|
+
/** Optional metadata. */
|
|
18
|
+
metadata?: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
/** Result of routing a message to a workspace. */
|
|
21
|
+
export interface RouteResult {
|
|
22
|
+
/** Workspace ID to handle this message. */
|
|
23
|
+
workspaceId: string;
|
|
24
|
+
/** Which strategy matched. */
|
|
25
|
+
strategy: "mention" | "channel_binding" | "intent_classification" | "fallback";
|
|
26
|
+
/** Confidence (1.0 for deterministic strategies, 0.0–1.0 for classification). */
|
|
27
|
+
confidence: number;
|
|
28
|
+
/** Message text after stripping any mention prefix. */
|
|
29
|
+
cleanedText: string;
|
|
30
|
+
/** Optional reasoning from LLM classification. */
|
|
31
|
+
reasoning?: string;
|
|
32
|
+
}
|
|
33
|
+
/** Minimal LLM provider interface for intent classification. */
|
|
34
|
+
export interface ClassificationProviderLike {
|
|
35
|
+
complete(params: {
|
|
36
|
+
messages: Array<{
|
|
37
|
+
role: string;
|
|
38
|
+
content: string;
|
|
39
|
+
}>;
|
|
40
|
+
temperature?: number;
|
|
41
|
+
}): Promise<{
|
|
42
|
+
content: string;
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
45
|
+
/** Workspace summary used for intent classification prompt. */
|
|
46
|
+
export interface WorkspaceSummary {
|
|
47
|
+
id: string;
|
|
48
|
+
name: string;
|
|
49
|
+
description: string;
|
|
50
|
+
tools: string[];
|
|
51
|
+
}
|
|
52
|
+
export interface MentionResult {
|
|
53
|
+
workspaceName: string;
|
|
54
|
+
remainingText: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Extract a mention from the start of a message.
|
|
58
|
+
* Example: "@support how do I reset?" → { workspaceName: "support", remainingText: "how do I reset?" }
|
|
59
|
+
*/
|
|
60
|
+
export declare function extractMention(text: string, prefix: string): MentionResult | null;
|
|
61
|
+
/**
|
|
62
|
+
* Find the workspace bound to a specific channel.
|
|
63
|
+
*/
|
|
64
|
+
export declare function matchChannelBinding(channel: string, bindings: ChannelBinding[]): string | null;
|
|
65
|
+
export interface FleetRouter {
|
|
66
|
+
/** Route an envelope to the appropriate workspace. */
|
|
67
|
+
route(envelope: RouteEnvelope, workspaces: WorkspaceSummary[], channelBindings: ChannelBinding[]): Promise<RouteResult>;
|
|
68
|
+
/** Classify intent via LLM (exposed for testing). */
|
|
69
|
+
classifyIntent(text: string, workspaces: WorkspaceSummary[]): Promise<{
|
|
70
|
+
workspace: string;
|
|
71
|
+
confidence: number;
|
|
72
|
+
reasoning: string;
|
|
73
|
+
} | null>;
|
|
74
|
+
}
|
|
75
|
+
export declare function createFleetRouter(config: FleetRouterConfig, provider?: ClassificationProviderLike): FleetRouter;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Memory Bridge — Task B0.3
|
|
3
|
+
*
|
|
4
|
+
* Wraps the kernel MemoryEngine to provide fleet-wide MTM/LPM sharing
|
|
5
|
+
* with per-workspace STM isolation and source tagging.
|
|
6
|
+
*
|
|
7
|
+
* The bridge does NOT touch STM. Each workspace's STM is created and
|
|
8
|
+
* owned by the workspace manager. The bridge only mediates shared
|
|
9
|
+
* access to MTM (medium-term memory) and LPM (long-term/persistent memory).
|
|
10
|
+
*/
|
|
11
|
+
/** A memory fact with source workspace tagging. */
|
|
12
|
+
export interface SharedMemoryFact {
|
|
13
|
+
id: string;
|
|
14
|
+
userId: string;
|
|
15
|
+
content: string;
|
|
16
|
+
category: "fact" | "preference" | "experience" | "knowledge";
|
|
17
|
+
sourceWorkspace: string;
|
|
18
|
+
confidence: number;
|
|
19
|
+
createdAt: Date;
|
|
20
|
+
updatedAt: Date;
|
|
21
|
+
}
|
|
22
|
+
/** Search result from shared memory. */
|
|
23
|
+
export interface SharedMemorySearchResult {
|
|
24
|
+
fact: SharedMemoryFact;
|
|
25
|
+
score: number;
|
|
26
|
+
}
|
|
27
|
+
/** Minimal memory engine interface — mirrors kernel MemoryEngine/StorageAdapter. */
|
|
28
|
+
export interface MemoryEngineLike {
|
|
29
|
+
/** Save a memory segment. Returns the saved segment with its ID. */
|
|
30
|
+
saveMemorySegment(segment: {
|
|
31
|
+
userId: string;
|
|
32
|
+
content: string;
|
|
33
|
+
category: string;
|
|
34
|
+
embedding: number[] | null;
|
|
35
|
+
heat: number;
|
|
36
|
+
}): Promise<{
|
|
37
|
+
id: string;
|
|
38
|
+
userId: string;
|
|
39
|
+
content: string;
|
|
40
|
+
category: string;
|
|
41
|
+
createdAt: Date;
|
|
42
|
+
updatedAt: Date;
|
|
43
|
+
}>;
|
|
44
|
+
/** Search memory by embedding vector similarity. */
|
|
45
|
+
searchMemoryByEmbedding(userId: string, embedding: number[], limit?: number): Promise<Array<{
|
|
46
|
+
segment: {
|
|
47
|
+
id: string;
|
|
48
|
+
userId: string;
|
|
49
|
+
content: string;
|
|
50
|
+
category: string;
|
|
51
|
+
createdAt: Date;
|
|
52
|
+
updatedAt: Date;
|
|
53
|
+
};
|
|
54
|
+
score: number;
|
|
55
|
+
}>>;
|
|
56
|
+
}
|
|
57
|
+
/** Optional embedding provider for vector searches. */
|
|
58
|
+
export interface EmbedFn {
|
|
59
|
+
(text: string): Promise<number[]>;
|
|
60
|
+
}
|
|
61
|
+
export interface SharedMemoryBridgeConfig {
|
|
62
|
+
/** Fleet ID this bridge serves. */
|
|
63
|
+
fleetId: string;
|
|
64
|
+
/** Kernel memory engine for shared storage. */
|
|
65
|
+
memoryEngine: MemoryEngineLike;
|
|
66
|
+
/** Optional embedding function for semantic search. */
|
|
67
|
+
embed?: EmbedFn;
|
|
68
|
+
}
|
|
69
|
+
export interface SharedMemoryBridge {
|
|
70
|
+
/** Save a fact to shared memory with source workspace tagging. */
|
|
71
|
+
saveFact(userId: string, fact: {
|
|
72
|
+
content: string;
|
|
73
|
+
category: SharedMemoryFact["category"];
|
|
74
|
+
confidence?: number;
|
|
75
|
+
}, sourceWorkspace: string): Promise<SharedMemoryFact>;
|
|
76
|
+
/** Recall facts from shared memory pool, optionally filtered by source workspace. */
|
|
77
|
+
recallFacts(userId: string, query: string, limit?: number, fromWorkspace?: string): Promise<SharedMemorySearchResult[]>;
|
|
78
|
+
/** Get relevant context from shared pool for identity assembly injection. */
|
|
79
|
+
getRelevantContext(userId: string, workspaceId: string, limit?: number): Promise<SharedMemoryFact[]>;
|
|
80
|
+
/** The fleet ID this bridge serves. */
|
|
81
|
+
readonly fleetId: string;
|
|
82
|
+
/** Number of facts stored (across all workspaces). */
|
|
83
|
+
readonly factCount: number;
|
|
84
|
+
}
|
|
85
|
+
export declare function createSharedMemoryBridge(config: SharedMemoryBridgeConfig): SharedMemoryBridge;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export type AgentExecutionStatus = "idle" | "processing" | "awaiting-approval" | "awaiting-hil" | "error" | "unknown";
|
|
2
|
+
export interface StatusSignal {
|
|
3
|
+
type: string;
|
|
4
|
+
timestamp: number;
|
|
5
|
+
agentInstanceId: string;
|
|
6
|
+
data?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export interface AgentStatusRecord {
|
|
9
|
+
agentInstanceId: string;
|
|
10
|
+
status: AgentExecutionStatus;
|
|
11
|
+
lastSignalAt: number;
|
|
12
|
+
detail?: string;
|
|
13
|
+
}
|
|
14
|
+
export type StatusEventType = "worker:status:changed";
|
|
15
|
+
export interface StatusChangeEvent {
|
|
16
|
+
type: StatusEventType;
|
|
17
|
+
agentInstanceId: string;
|
|
18
|
+
previousStatus: AgentExecutionStatus;
|
|
19
|
+
newStatus: AgentExecutionStatus;
|
|
20
|
+
timestamp: number;
|
|
21
|
+
}
|
|
22
|
+
export type StatusChangeHandler = (event: StatusChangeEvent) => void;
|
|
23
|
+
export interface StatusDetectorConfig {
|
|
24
|
+
/** Seconds of no signal before "unknown". Default 30. */
|
|
25
|
+
unknownThresholdMs?: number;
|
|
26
|
+
/** Seconds of activity signals considered "recent". Default 5000. */
|
|
27
|
+
recentWindowMs?: number;
|
|
28
|
+
}
|
|
29
|
+
export declare class StatusDetector {
|
|
30
|
+
private statuses;
|
|
31
|
+
private pendingApprovals;
|
|
32
|
+
private pendingHIL;
|
|
33
|
+
private handlers;
|
|
34
|
+
private config;
|
|
35
|
+
constructor(config?: StatusDetectorConfig);
|
|
36
|
+
/** Ingest a signal from the event stream. */
|
|
37
|
+
ingest(signal: StatusSignal): void;
|
|
38
|
+
/** Get the current status of an agent instance. */
|
|
39
|
+
getStatus(agentInstanceId: string): AgentExecutionStatus;
|
|
40
|
+
/** Get full status record for an agent. */
|
|
41
|
+
getRecord(agentInstanceId: string): AgentStatusRecord | undefined;
|
|
42
|
+
/** List all tracked agents with their statuses. */
|
|
43
|
+
listAll(): AgentStatusRecord[];
|
|
44
|
+
/** Get agents available for new task assignment. */
|
|
45
|
+
getAvailable(): string[];
|
|
46
|
+
/** Subscribe to status change events. */
|
|
47
|
+
on(handler: StatusChangeHandler): () => void;
|
|
48
|
+
/** Clear all state. */
|
|
49
|
+
clear(): void;
|
|
50
|
+
private classify;
|
|
51
|
+
private emit;
|
|
52
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { FleetCoordinator, FleetCoordinatorDeps } from "./fleet.js";
|
|
2
|
+
import type { FleetConfig } from "./fleet-config.js";
|
|
3
|
+
import type { RouteEnvelope, RouteResult } from "./router.js";
|
|
4
|
+
export interface SwarmRegistration {
|
|
5
|
+
/** The child FleetCoordinator instance. */
|
|
6
|
+
coordinator: FleetCoordinator;
|
|
7
|
+
/** Human-readable description for routing. */
|
|
8
|
+
description: string;
|
|
9
|
+
/** Whether to maintain context across delegations. Default false. */
|
|
10
|
+
keepContext?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface SwarmRegistryEntry extends SwarmRegistration {
|
|
13
|
+
id: string;
|
|
14
|
+
/** Swarm hierarchy path for nested event tracking. */
|
|
15
|
+
hierarchy: string[];
|
|
16
|
+
started: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface SwarmFileConfig {
|
|
19
|
+
fleetConfig: FleetConfig;
|
|
20
|
+
deps?: FleetCoordinatorDeps;
|
|
21
|
+
description: string;
|
|
22
|
+
keepContext?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare class CircularSwarmDependencyError extends Error {
|
|
25
|
+
readonly cycle: string[];
|
|
26
|
+
constructor(cycle: string[]);
|
|
27
|
+
}
|
|
28
|
+
export type SwarmRegistryEventType = "swarm:registered" | "swarm:unregistered" | "swarm:delegation:start" | "swarm:delegation:complete" | "swarm:delegation:error";
|
|
29
|
+
export interface SwarmRegistryEvent {
|
|
30
|
+
type: SwarmRegistryEventType;
|
|
31
|
+
swarmId: string;
|
|
32
|
+
hierarchy: string[];
|
|
33
|
+
timestamp: number;
|
|
34
|
+
detail?: string;
|
|
35
|
+
}
|
|
36
|
+
export type SwarmRegistryEventHandler = (event: SwarmRegistryEvent) => void;
|
|
37
|
+
export declare class SwarmRegistry {
|
|
38
|
+
private entries;
|
|
39
|
+
private handlers;
|
|
40
|
+
private parentId;
|
|
41
|
+
constructor(parentSwarmId: string);
|
|
42
|
+
/** Register a sub-swarm by ID. */
|
|
43
|
+
register(id: string, registration: SwarmRegistration): void;
|
|
44
|
+
/** Unregister and stop a sub-swarm. */
|
|
45
|
+
unregister(id: string): Promise<void>;
|
|
46
|
+
/** Check if a swarm is registered. */
|
|
47
|
+
has(id: string): boolean;
|
|
48
|
+
/** Get a registered swarm entry. */
|
|
49
|
+
get(id: string): SwarmRegistryEntry | undefined;
|
|
50
|
+
/** List all registered swarm IDs. */
|
|
51
|
+
list(): string[];
|
|
52
|
+
/**
|
|
53
|
+
* Delegate a task to a registered sub-swarm.
|
|
54
|
+
* Starts the coordinator if not already running.
|
|
55
|
+
*/
|
|
56
|
+
delegate(id: string, envelope: RouteEnvelope): Promise<RouteResult>;
|
|
57
|
+
/** Subscribe to registry events. Returns unsubscribe function. */
|
|
58
|
+
on(handler: SwarmRegistryEventHandler): () => void;
|
|
59
|
+
/** Stop all registered sub-swarms. */
|
|
60
|
+
stopAll(): Promise<void>;
|
|
61
|
+
private detectCycles;
|
|
62
|
+
private emit;
|
|
63
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Templates — Task B2.1
|
|
3
|
+
*
|
|
4
|
+
* Provides 8 built-in workspace templates with well-crafted identity
|
|
5
|
+
* personas, domain knowledge, and tool scoping. Templates can be
|
|
6
|
+
* customized and applied to workspace directories.
|
|
7
|
+
*/
|
|
8
|
+
export interface WorkspaceTemplate {
|
|
9
|
+
/** Unique template identifier. */
|
|
10
|
+
id: string;
|
|
11
|
+
/** Human-readable display name. */
|
|
12
|
+
name: string;
|
|
13
|
+
/** Short description of the template. */
|
|
14
|
+
description: string;
|
|
15
|
+
/** Persona markdown content (identity text, 15–25 lines). */
|
|
16
|
+
persona: string;
|
|
17
|
+
/** Knowledge markdown content (domain expertise, 20–40 lines). */
|
|
18
|
+
knowledge: string;
|
|
19
|
+
/** Tools this template has access to. */
|
|
20
|
+
tools: string[];
|
|
21
|
+
/** Default channels. */
|
|
22
|
+
channels: string[];
|
|
23
|
+
/** Default domain layers. */
|
|
24
|
+
layers: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface TemplateCustomizations {
|
|
27
|
+
/** Override or append to persona text. */
|
|
28
|
+
personaAppend?: string;
|
|
29
|
+
/** Override or append to knowledge text. */
|
|
30
|
+
knowledgeAppend?: string;
|
|
31
|
+
/** Override tools list entirely. */
|
|
32
|
+
tools?: string[];
|
|
33
|
+
/** Override channels list entirely. */
|
|
34
|
+
channels?: string[];
|
|
35
|
+
/** Override layers list entirely. */
|
|
36
|
+
layers?: string[];
|
|
37
|
+
/** Additional metadata. */
|
|
38
|
+
metadata?: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
export declare const BUILTIN_TEMPLATES: WorkspaceTemplate[];
|
|
41
|
+
/** List all built-in templates. */
|
|
42
|
+
export declare function listTemplates(): WorkspaceTemplate[];
|
|
43
|
+
/** Get a single template by ID. Returns undefined if not found. */
|
|
44
|
+
export declare function getTemplate(id: string): WorkspaceTemplate | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Apply a template to a workspace directory, optionally merging customizations.
|
|
47
|
+
* Writes persona.md and knowledge.md to the target directory.
|
|
48
|
+
*/
|
|
49
|
+
export declare function applyTemplate(template: WorkspaceTemplate, targetDir: string, customizations?: TemplateCustomizations): {
|
|
50
|
+
personaPath: string;
|
|
51
|
+
knowledgePath: string;
|
|
52
|
+
tools: string[];
|
|
53
|
+
channels: string[];
|
|
54
|
+
layers: string[];
|
|
55
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Manager — Task B0.2
|
|
3
|
+
*
|
|
4
|
+
* Manages creation, startup, shutdown, and deletion of individual
|
|
5
|
+
* workspace instances within a fleet. Each workspace gets its own
|
|
6
|
+
* agent loop configuration, identity assembly, and STM.
|
|
7
|
+
*/
|
|
8
|
+
import type { WorkspaceConfig } from "./fleet-config.js";
|
|
9
|
+
export type WorkspaceStatus = "created" | "starting" | "running" | "stopping" | "stopped" | "error";
|
|
10
|
+
export interface WorkspaceInstance {
|
|
11
|
+
id: string;
|
|
12
|
+
fleetId: string;
|
|
13
|
+
name: string;
|
|
14
|
+
config: WorkspaceConfig;
|
|
15
|
+
status: WorkspaceStatus;
|
|
16
|
+
identityDir: string;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
startedAt: Date | null;
|
|
19
|
+
stoppedAt: Date | null;
|
|
20
|
+
}
|
|
21
|
+
/** Minimal identity assembler interface — mirrors kernel IdentityAssembler. */
|
|
22
|
+
export interface IdentityAssemblerLike {
|
|
23
|
+
assemble(workspaceId: string, options?: {
|
|
24
|
+
channel?: string;
|
|
25
|
+
}): Promise<{
|
|
26
|
+
name: string;
|
|
27
|
+
content: string;
|
|
28
|
+
tokenEstimate: number;
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
31
|
+
/** Minimal STM (short-term memory) interface for workspace-scoped memory. */
|
|
32
|
+
export interface STMLike {
|
|
33
|
+
/** Add a message to short-term memory. */
|
|
34
|
+
add(entry: {
|
|
35
|
+
role: string;
|
|
36
|
+
content: string;
|
|
37
|
+
timestamp: number;
|
|
38
|
+
}): void;
|
|
39
|
+
/** Get recent entries. */
|
|
40
|
+
recent(limit?: number): Array<{
|
|
41
|
+
role: string;
|
|
42
|
+
content: string;
|
|
43
|
+
timestamp: number;
|
|
44
|
+
}>;
|
|
45
|
+
/** Flush STM contents (e.g. for MTM promotion). */
|
|
46
|
+
flush(): Array<{
|
|
47
|
+
role: string;
|
|
48
|
+
content: string;
|
|
49
|
+
timestamp: number;
|
|
50
|
+
}>;
|
|
51
|
+
/** Current entry count. */
|
|
52
|
+
readonly size: number;
|
|
53
|
+
}
|
|
54
|
+
/** Minimal storage adapter interface for workspace registration. */
|
|
55
|
+
export interface WorkspaceStorageLike {
|
|
56
|
+
saveIdentityFile(file: {
|
|
57
|
+
workspaceId: string;
|
|
58
|
+
fileName: string;
|
|
59
|
+
content: string;
|
|
60
|
+
metadata: Record<string, unknown>;
|
|
61
|
+
}): Promise<{
|
|
62
|
+
id: string;
|
|
63
|
+
}>;
|
|
64
|
+
}
|
|
65
|
+
export interface WorkspaceManagerConfig {
|
|
66
|
+
/** Function to create a workspace-scoped STM instance. */
|
|
67
|
+
createSTM: () => STMLike;
|
|
68
|
+
/** Identity assembler instance (from kernel). */
|
|
69
|
+
identityAssembler?: IdentityAssemblerLike;
|
|
70
|
+
/** Storage adapter for workspace persistence. */
|
|
71
|
+
storage?: WorkspaceStorageLike;
|
|
72
|
+
/** Timeout in ms for draining in-flight messages on stop (default: 10000). */
|
|
73
|
+
drainTimeoutMs?: number;
|
|
74
|
+
}
|
|
75
|
+
export interface WorkspaceManagerEvents {
|
|
76
|
+
onCreated?: (workspace: WorkspaceInstance) => void;
|
|
77
|
+
onStarted?: (workspace: WorkspaceInstance) => void;
|
|
78
|
+
onStopped?: (workspace: WorkspaceInstance) => void;
|
|
79
|
+
onDeleted?: (workspaceId: string) => void;
|
|
80
|
+
onError?: (workspaceId: string, error: Error) => void;
|
|
81
|
+
}
|
|
82
|
+
export declare function createInMemorySTM(maxEntries?: number): STMLike;
|
|
83
|
+
export interface WorkspaceManager {
|
|
84
|
+
/** Create a new workspace and register it in the fleet. */
|
|
85
|
+
createWorkspace(fleetId: string, name: string, config: WorkspaceConfig, identityDir?: string): Promise<WorkspaceInstance>;
|
|
86
|
+
/** Start a workspace — load identity, create STM, set running. */
|
|
87
|
+
startWorkspace(workspaceId: string): Promise<WorkspaceInstance>;
|
|
88
|
+
/** Stop a workspace — drain STM, set stopped. */
|
|
89
|
+
stopWorkspace(workspaceId: string): Promise<WorkspaceInstance>;
|
|
90
|
+
/** Delete a workspace — stops if running, removes from registry. */
|
|
91
|
+
deleteWorkspace(workspaceId: string): Promise<void>;
|
|
92
|
+
/** Get a workspace by ID. */
|
|
93
|
+
getWorkspace(workspaceId: string): WorkspaceInstance | undefined;
|
|
94
|
+
/** List all workspaces for a fleet. */
|
|
95
|
+
listWorkspaces(fleetId: string): WorkspaceInstance[];
|
|
96
|
+
/** Get the STM for a workspace (only available while running). */
|
|
97
|
+
getSTM(workspaceId: string): STMLike | undefined;
|
|
98
|
+
/** Get the assembled identity for a workspace. */
|
|
99
|
+
getIdentity(workspaceId: string): Promise<{
|
|
100
|
+
name: string;
|
|
101
|
+
content: string;
|
|
102
|
+
tokenEstimate: number;
|
|
103
|
+
} | null>;
|
|
104
|
+
}
|
|
105
|
+
export declare function createWorkspaceManager(managerConfig: WorkspaceManagerConfig, events?: WorkspaceManagerEvents): WorkspaceManager;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fenix Pro Edition — Full-featured agent with all channels, tools,
|
|
3
|
+
* and domain layers. Intended for power users and server deployments.
|
|
4
|
+
*/
|
|
5
|
+
import { createKernel, KERNEL_VERSION, type KernelConfig, type Kernel, type EditionManifest } from "@fenixforce/kernel";
|
|
6
|
+
export declare const EDITION: "pro";
|
|
7
|
+
export declare const PRO_MANIFEST: EditionManifest;
|
|
8
|
+
export declare const PRO_KERNEL_CONFIG: KernelConfig;
|
|
9
|
+
export declare function startPro(overrides?: Partial<KernelConfig>): Kernel;
|
|
10
|
+
export { createKernel, KERNEL_VERSION };
|
|
11
|
+
export * from "./business/index.js";
|
|
12
|
+
export { bootPro } from "./boot.js";
|
|
13
|
+
export type { ProInstance, ProBootMode, HealthStatus, ProBootOptions } from "./boot.js";
|
|
14
|
+
export { createFleetRoutes } from "./api/fleet-routes.js";
|
|
15
|
+
export type { FleetRouteDeps } from "./api/fleet-routes.js";
|
|
16
|
+
export { createIntegrationRoutes } from "./api/integration-routes.js";
|
|
17
|
+
export type { IntegrationRouteDeps } from "./api/integration-routes.js";
|
|
18
|
+
export { createApprovalRoutes } from "./api/approval-routes.js";
|
|
19
|
+
export type { ApprovalRouteDeps } from "./api/approval-routes.js";
|
|
20
|
+
export { buildRoute, matchRoute, jsonResponse, errorResponse, validateAuth, parseJsonBody, validateRequired, ApiException, withErrorHandling, corsPreflightResponse, CORS_HEADERS, } from "./api/middleware.js";
|
|
21
|
+
export type { Route, RouteHandler } from "./api/middleware.js";
|