@sema-agent/core
Version:
Stateless, task-oriented AI agent core
19 lines (18 loc) • 1.52 kB
TypeScript
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";
import type { CwdRef } from "./fs-shared.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, rootsSeat?: RootsSeat, denySeat?: ReadDenyMatcher, readFace?: ContainmentFace, cwdRef?: CwdRef, readAdmission?: (toolCallId: string | undefined, canonicalKey: string) => boolean): AgentTool;