@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
34 lines • 2.15 kB
TypeScript
/**
* The wider "Allow always" a prompt may offer for a tool WITHOUT its own permission parser, where
* plain "Allow always" remembers only the exact argument (one URL, one input) and so asks again for
* the next one (senpi#3403):
* - a URL argument: that URL's DOMAIN (scheme + canonical host + non-default port), stored as one
* literal and matched by equality, never the whole tool: a tool-wide allow for a browser or
* fetch tool would mean "go anywhere", close to Full access for the web;
* - a free `input`/`pattern` argument: the tool itself, for this project;
* - a command or a path: nothing wider (that would grant a shell or file access wholesale).
* Built-in tools (bash, eval, edit, write, read, ...) have parsers and never reach this.
*/
export interface WiderAlwaysScope {
/** The option label, stating the scope in plain words. */
readonly label: string;
/** The patterns an answer with this option approves for the permission. */
readonly patterns: string[];
}
/**
* The one normalizer both sides of a domain grant go through (senpi#3403). A parser-less tool (an
* MCP server, a custom tool) parses the URL itself, and the permission layer cannot make it reuse
* this parse. So a domain origin is given only for raw text every parser reads as the same host:
* the strict shape above, no ambiguous character anywhere, and the same host and port as the WHATWG
* parser finds (#3416 review: `https://example.invalid\\@evil.test/` is example.invalid to WHATWG and
* evil.test to curl and Python). Anything else gets no alias and no domain option, so it asks.
*/
export declare function canonicalUrlOrigin(raw: string): string | undefined;
/**
* The match target a domain grant is written for: a literal that never contains a wildcard
* character, so the grant matches by equality. The `origin=` prefix keeps it from colliding with a
* user's own URL rules.
*/
export declare function urlOriginAlias(raw: string): string | undefined;
export declare function widerAlwaysScope(toolName: string, argKey: string, arg: string): WiderAlwaysScope | undefined;
//# sourceMappingURL=always-scope.d.ts.map