tricu

A lazy functional language based on Tree Calculus
Log | Files | Refs | README | LICENSE

execution.js (1527B)


      1 // Execution has no application node/work/frame ceilings. Browser memory remains
      2 // finite. Pure evaluation stops by terminating the Worker; IO Stop drains its structured
      3 // session at scheduler boundaries. GC thresholds are not budgets.
      4 export const BROWSER_BUDGET = Object.freeze({ nodes: Infinity, fuel: Infinity, stack: Infinity });
      5 export const PACKAGE_LOAD_MS = 60_000;
      6 // Export is bounded transport/rendering, not program execution.
      7 export const EXPORT_ACTIVE_MS = 120_000;
      8 export const EXECUTION_COLLECTION = Object.freeze({ threshold: 250_000 });
      9 export const PACKAGE_COLLECTION = Object.freeze({ threshold: 100_000 });
     10 export function collectionPolicy(budget, threshold = EXECUTION_COLLECTION.threshold) {
     11     return budget.nodes < 2 ? undefined : { threshold: Math.min(threshold, budget.nodes) };
     12 }
     13 const operationLabels = {
     14     catalogue: 'Program catalogue loading', loading: 'Package loading',
     15     compiling: 'Draft compilation', running: 'Program execution',
     16     exporting: 'Definition export', downloading: 'Bundle download',
     17 };
     18 export function operationFailure(operation, message) {
     19     return operation ? `${operationLabels[operation]} failed: ${message}` : message;
     20 }
     21 export function operationTimeout(operation) {
     22     return operation === 'loading' || operation === 'downloading' || operation === 'catalogue'
     23         ? `${operationLabels[operation]} timed out. The deadline includes transfer and processing time; try again.`
     24         : `${operationLabels[operation]} stopped: active time limit exceeded.`;
     25 }