/** * Which tools this process registers, and how the user chooses. * * The JSM Operations API is ~240 operations. Registering all of them would * hand every client a tool list it cannot select from accurately, so the * surface is cut into named toolsets and the user picks. The catalogue grows; * what any one install loads does not have to. * * Two kinds of name are accepted in the same namespace, because from the * user's side they are the same thing — a label that expands to some tools: * * toolsets one API family, mapping to exactly one scope family, so * JSM_TOOLSETS doubles as documentation of the grants the token * needs. * profiles a workflow-shaped bundle of toolsets, because the personas * genuinely differ: an incident responder never touches sync * actions, and someone configuring routing rules is not mid-page. * modes a profile that changes HOW its toolsets are reached rather than * which of them are. `code` is the only one: it registers five * dispatch tools instead of its toolsets' own ninety-odd, so an * install pays for four descriptions and can still reach * everything. It composes — JSM_TOOLSETS=code,alert-actions is the * dispatchers AND the eighteen classic alert tools, which is how an * install keeps per-tool approvals for the writes it cares about. * * Only implemented toolsets are listed. A family that has not shipped yet is * not a name you can type — an empty toolset would answer "enabled, 0 tools" * to jsm_list_capabilities, which reads as a broken install rather than an * absent feature. Adding a family adds its name here, in one place. */ import type { AnyToolDefinition } from "./tools/define.js"; /** Every toolset that ships tools today. */ export declare const TOOLSETS: readonly ["alerts", "alert-actions", "oncall", "schedules", "teams", "maintenance", "heartbeats", "routing", "attachments", "forwarding"]; export type ToolsetName = (typeof TOOLSETS)[number]; /** * Marks a tool that registers regardless of what the user selected. Not a name * anyone can type in JSM_TOOLSETS — it is how jsm_list_capabilities stays * present to explain a selection that would otherwise hide it. */ export declare const ALWAYS = "always"; /** What a tool declares: a real toolset, or ALWAYS. */ export type ToolGroup = ToolsetName | typeof ALWAYS; export interface ToolsetInfo { /** One line, shown by jsm_list_capabilities. */ summary: string; /** OAuth scopes every tool in this set needs. */ scopes: string[]; /** * Absent means every tool here has returned a real success against a live * tenant. Present says, in one sentence, why that could not be established — * and keeps the family out of every profile. * * The rule this enforces: a family reaches a profile only after it has been * seen to work. Everything else still ships, because the code is very likely * correct and a site on a different plan would use it, but it has to be * named explicitly in JSM_TOOLSETS. A test asserts no profile carries one. */ unverified?: string; } export declare const TOOLSET_INFO: Record; /** * The toolsets a profile is allowed to include: every one that has been seen to * work against a live tenant. * * Derived rather than listed, so marking a family `unverified` is the single * edit that removes it from `all` — there is no second place to forget. */ export declare const VERIFIED_TOOLSETS: ToolsetName[]; /** The toolsets that ship but no profile loads. Reported by jsm_list_capabilities. */ export declare const UNVERIFIED_TOOLSETS: ToolsetName[]; /** * The `core` profile: the tools that shipped before toolsets existed, plus * jsm_create_alert. Named individually rather than computed from toolsets. * * A computed default would silently grow every time a tool is added, and an * existing install would wake up to a changed tool list — and a changed * auto-approval surface — after a patch bump. Naming them freezes that: the * default moves only when someone edits this array and the snapshot test that * guards it, in a change that has to explain itself. * * It is no longer the default — `responder` is — but it stays as a named * profile so an install that wants exactly the old surface can ask for it by * name rather than by listing thirteen tools. */ export declare const CORE_TOOL_NAMES: readonly ["jsm_list_alerts", "jsm_get_alert", "jsm_list_alert_notes", "jsm_list_alert_logs", "jsm_get_request_status", "jsm_create_alert", "jsm_acknowledge_alert", "jsm_close_alert", "jsm_add_alert_note", "jsm_add_alert_responder", "jsm_list_schedules", "jsm_get_on_call", "jsm_get_next_on_call", "jsm_get_schedule_timeline"]; /** * Workflow bundles. `core` is by name and stays put; every other profile is by * toolset and grows with its families. * * `responder` and `core` hold the same tools today. They are not the same * thing: `responder` widens as the alert family is completed, `core` does not, * which is what makes it safe as the default. */ export declare const PROFILES: { readonly responder: { readonly toolsets: readonly ["alerts", "alert-actions", "oncall"]; }; readonly core: { readonly toolsets: readonly ["alerts", "alert-actions", "oncall"]; readonly only: readonly ["jsm_list_alerts", "jsm_get_alert", "jsm_list_alert_notes", "jsm_list_alert_logs", "jsm_get_request_status", "jsm_create_alert", "jsm_acknowledge_alert", "jsm_close_alert", "jsm_add_alert_note", "jsm_add_alert_responder", "jsm_list_schedules", "jsm_get_on_call", "jsm_get_next_on_call", "jsm_get_schedule_timeline"]; }; readonly admin: { readonly toolsets: readonly ["oncall", "schedules", "teams", "maintenance", "routing"]; }; readonly all: { readonly toolsets: ("alert-actions" | "alerts" | "attachments" | "forwarding" | "heartbeats" | "maintenance" | "oncall" | "routing" | "schedules" | "teams")[]; }; /** * Code mode: the dispatch tools, over every verified family. * * `codeOnly` says these toolsets are reached through the dispatch tools * rather than registered as tools of their own. Measured by * scripts/measure-context.mjs, that is a tools/list of 27,744 characters * instead of 74,494 for the `responder` default — while reaching 81 * operations rather than 27, because an operation nobody calls costs nothing. * * It applies to THIS name's toolsets only, exactly as `core`'s `only` does * and for the same reason resolveSelection spells out below: a restriction * that leaked across names turned `core,schedules` into every tool in both * families. So JSM_TOOLSETS=code,alert-actions registers the dispatchers over * everything AND the eighteen classic alert-action tools, each keeping its own * name and its own client approval. */ readonly code: { readonly toolsets: ("alert-actions" | "alerts" | "attachments" | "forwarding" | "heartbeats" | "maintenance" | "oncall" | "routing" | "schedules" | "teams")[]; readonly codeOnly: true; }; }; /** * What an unconfigured install registers. * * This was `core` while the alert family was half-built, so that upgrading * could not change anyone's tool list. Now that the family is complete, * defaulting to the thirteen-tool subset would mean most of this server is * invisible unless you already knew to look — and jsm_list_capabilities would * spend every conversation explaining that. `responder` is the whole * alert-and-on-call surface, which is what someone installing an alerts server * is asking for. * * This is a breaking change to an existing install's tool list and its * auto-approval surface, and ships as a major version. */ export declare const DEFAULT_PROFILE = "responder"; export type ProfileName = keyof typeof PROFILES; export declare const PROFILE_NAMES: ProfileName[]; /** Everything accepted in JSM_TOOLSETS / --toolsets. */ export declare const SELECTABLE_NAMES: string[]; /** Thrown for a selection that cannot be honoured. Fatal at startup. */ export declare class ToolsetSelectionError extends Error { } export interface Selection { /** The tools to register, in catalogue order. */ tools: AnyToolDefinition[]; /** Names the user asked for, verbatim, or [DEFAULT_PROFILE] when they asked for nothing. */ requested: string[]; /** Toolsets those names expanded to, however they are reached. */ toolsets: ToolsetName[]; /** * Toolsets reachable through the code-mode dispatchers. Empty when code mode * is off. * * Distinct from `toolsets` because the two answer different questions: this * one says what a script may call, and `toolsets` says what the user asked * for. A family can be in both — named by `code` and by its own name — and * then it is reachable twice, which is the composition that keeps per-tool * approvals available. */ codeToolsets: ToolsetName[]; readOnly: boolean; } export interface ResolveOptions { env?: NodeJS.ProcessEnv; argv?: string[]; } /** * Turns environment and argv into the exact tool list to register. * * Pure on purpose: no process.env read inside, no side effects, so the whole * mechanism is testable offline without spawning a server. CLI flags win over * environment, since a client's env block is configured once and a supervisor's * argv is the thing someone changes deliberately. */ export declare function resolveSelection(catalogue: AnyToolDefinition[], options?: ResolveOptions): Selection; //# sourceMappingURL=toolsets.d.ts.map