Files
boc/EOS/agent-runtime-v6.mjs
T
Bernt 05ed037fe8 pilot.landvex.com: HTTPS + Full Stack Verified
- DNS: pilot.landvex.com -> 16.170.83.169
- TLS: Let's Encrypt certificate (expires 2026-09-30)
- Nginx: reverse proxy with SSL termination
- API: https://pilot.landvex.com/api/v1/missions
- UI: https://pilot.landvex.com/
- Upload: POST /api/v1/missions/import (multipart/form-data)

Verified:
 https://pilot.landvex.com/health
 https://pilot.landvex.com/version
 https://pilot.landvex.com/api/v1/missions (list)
 https://pilot.landvex.com/api/v1/missions/:id (get)
 POST /api/v1/missions/import (video upload)
 UI loads with title 'LandveX Intelligence Lab'

Next: Pilot 001 — Break the system!
2026-07-02 17:34:19 +00:00

168 lines
5.1 KiB
JavaScript

#!/usr/bin/env node
// ═══════════════════════════════════════════════════════════════════════════
// Agent Runtime v6 — Med Decision Replay
// ═══════════════════════════════════════════════════════════════════════════
import { RuntimeTraceV2 } from './runtime-trace-v2.mjs';
import { canonicalizeOperation, checkOperationPolicy } from './operation-canonicalizer-v3.mjs';
import { getPolicy } from './policy-registry.mjs';
import { DecisionReplay } from './decision-replay.mjs';
class AgentRuntimeV6 {
constructor(task) {
this.task = task;
this.trace = new RuntimeTraceV2();
this.policies = [];
this.decisionReplay = new DecisionReplay();
}
async execute() {
// 1. PLANNER
await this.runPlanner();
// 2. CONTEXT
await this.runContext();
// 3. MEMORY
await this.runMemory();
// 4. KNOWLEDGE
await this.runKnowledge();
// 5. INTENT CLASSIFICATION
const canonicalResult = await this.runIntentClassification();
// 6. EOS — Policy Check
const eosResult = await this.runEOSCheck(canonicalResult);
// 7. RECORD DECISION
const decisionId = this.recordDecision(canonicalResult, eosResult);
if (!eosResult.passed) {
return {
status: 'blocked',
reason: eosResult.reason,
policy: eosResult.blockedBy,
evidence: eosResult.evidence,
decisionId
};
}
// 8. DEVELOPER
await this.runDeveloper();
// 9. REVIEWER
await this.runReviewer();
// 10. COMMIT
await this.runCommit();
// 11. OPERATOR
await this.runOperator();
return { status: 'completed', trace: this.trace.toJSON(), decisionId };
}
async runPlanner() {
const node = this.trace.addNode('PLANNER', { task: this.task.description });
this.trace.completeNode(node.id, { plan: { steps: [], estimatedTime: null, dependencies: [] } });
}
async runContext() {
const node = this.trace.addNode('CONTEXT', { task: this.task.description });
this.trace.completeNode(node.id, { confidence: 0.8, git: { branch: null, uncommitted: null, remote: null } });
}
async runMemory() {
const node = this.trace.addNode('MEMORY', { queries: [] });
this.trace.completeNode(node.id, { results: { relevantDecisions: [], similarTasks: [], lessonsLearned: [] } });
}
async runKnowledge() {
const node = this.trace.addNode('KNOWLEDGE', { queries: [] });
this.trace.completeNode(node.id, { results: { relatedCapabilities: [], dependencies: [], impact: [] } });
}
async runIntentClassification() {
const node = this.trace.addNode('INTENT', { task: this.task.description });
const result = canonicalizeOperation(this.task);
this.trace.completeNode(node.id, {
operation: result.operation.id,
confidence: result.confidence,
evidence: result.evidence
});
return result;
}
async runEOSCheck(canonicalResult) {
const node = this.trace.addNode('EOS', { operation: canonicalResult.operation.id });
const policyResult = checkOperationPolicy(canonicalResult);
if (!policyResult.passed) {
const policyInfo = getPolicy(policyResult.policyId);
this.trace.blockNode(node.id, policyResult.reason, {
policyId: policyResult.policyId,
policyName: policyInfo?.name || 'Unknown Policy',
evidence: policyResult.evidence,
riskClass: policyResult.severity,
requiredAction: `Använd godkänd process: ${policyInfo?.description || 'Kontakta EOS Team'}`
});
return {
passed: false,
blockedBy: policyResult.rule,
reason: policyResult.reason,
severity: policyResult.severity,
evidence: policyResult.evidence
};
}
this.trace.completeNode(node.id, { passed: true, operation: canonicalResult.operation.id });
return { passed: true };
}
recordDecision(canonicalResult, eosResult) {
return this.decisionReplay.recordDecision(
this.task,
canonicalResult,
eosResult,
this.trace
);
}
async runDeveloper() {
const node = this.trace.addNode('DEVELOPER', { task: this.task.description });
this.trace.completeNode(node.id, { status: 'completed' });
}
async runReviewer() {
const node = this.trace.addNode('REVIEWER', { task: this.task.description });
this.trace.completeNode(node.id, { status: 'completed' });
}
async runCommit() {
const node = this.trace.addNode('COMMIT', { task: this.task.description });
this.trace.completeNode(node.id, { status: 'completed' });
}
async runOperator() {
const node = this.trace.addNode('OPERATOR', { task: this.task.description });
this.trace.completeNode(node.id, { status: 'completed' });
}
getTrace() {
return this.trace;
}
getDecisionReplay() {
return this.decisionReplay;
}
}
export { AgentRuntimeV6 };