Deno Runtime Signals & Policy Contract (v0.1-DRAFT)

Purpose

Define deterministic runtime evidence records and policy signals for Deno analyzer phase II (tasks DENO-26-009/010/011). The contract is offline-friendly, append-only, and compatible with Surface/Signals stores.

Scope

Event model

Event types

{
  "type": "deno.module.load",          // required
  "ts": "2025-11-17T12:00:00.123Z",    // required
  "module": {
    "specifier": "file:///src/app/main.ts", // original
    "normalized": "app/main.ts",
    "path_sha256": "..."
  },
  "reason": "dynamic-import",          // static-import | dynamic-import | npm | cache | bundle
  "permissions": ["fs", "net"],        // granted at time of load
  "origin": "https://deno.land/x/std@0.208.0/http/server.ts" // optional for remote/npm
}
{
  "type": "deno.permission.use",
  "ts": "2025-11-17T12:00:01.234Z",
  "permission": "ffi",                  // fs|net|env|ffi|process|crypto|worker
  "module": {
    "normalized": "native/mod.ts",
    "path_sha256": "..."
  },
  "details": "Deno.dlopen"             // short reason code
}
{
  "type": "deno.npm.resolution",
  "ts": "2025-11-17T12:00:02.100Z",
  "specifier": "npm:chalk@5",
  "package": "chalk",
  "version": "5.3.0",
  "resolved": "file:///cache/npm/registry.npmjs.org/chalk/5.3.0",
  "exists": true
}
{
  "type": "deno.wasm.load",
  "ts": "2025-11-17T12:00:03.000Z",
  "module": {
    "normalized": "pkg/module.wasm",
    "path_sha256": "..."
  },
  "importer": "app/main.ts",
  "reason": "dynamic-import"
}

Observation envelope (AnalysisStore)

Key: ScanAnalysisKeys.DenoObservationPayload Payload fields:

Policy signal keys

Emit into Surface/Signals (namespaced surface.lang.deno.*) derived from observation digest + static analyzer outputs:

CLI / Worker contracts

Determinism and safety

Open follow-ups (to track in sprint)