UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

18 lines (17 loc) • 1.38 kB
import type { AgentTool } from "../../internal/harness-types.js"; import type { ExecutionEnv } from "../../internal/harness-types.js"; import { type RootsSeat } from "./safety.js"; import type { ReadDenyMatcher } from "./read-deny.js"; import type { ContainmentFace } from "./containment-face.js"; /** Extract top-level symbol names (deduped, in first-seen order) from source text. A lightweight * comment/docstring state machine skips column-0 declaration-like lines that are really inside a * `/* … *​/` block comment or a Python `"""`/`'''` docstring — otherwise e.g. a module docstring * containing `def foo():` at column 0 produces a phantom symbol. Not a full parser: it tracks * whole-line block/docstring regions, the common false-positive source. * * ⚠️ **A heuristic, NOT a containment proof**: it is column-0 / source-only and skips indented lines, * so it CANNOT enumerate everything an artifact can call. The auto-promote tripwire * (src/core/auto-promote.ts) consumes it in ESCALATE-ONLY mode — a clean scan contributes nothing; * it can only ever raise an escalation, never clear one. */ export declare function extractSymbols(text: string): string[]; export declare function createRepoMapTool(env: ExecutionEnv, rootCanonical: string, additionalRoots?: RootsSeat, readDeny?: ReadDenyMatcher, readFace?: ContainmentFace): AgentTool;