@cleocode/caamp 2026.4.5 → 2026.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -8
- package/dist/{chunk-43GULI6J.js → chunk-HEAGCHKU.js} +978 -358
- package/dist/chunk-HEAGCHKU.js.map +1 -0
- package/dist/cli.js +1170 -71
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +811 -57
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
- package/dist/chunk-43GULI6J.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1733,6 +1733,49 @@ declare function removeSkill(skillName: string, providers: Provider[], isGlobal:
|
|
|
1733
1733
|
*/
|
|
1734
1734
|
declare function listCanonicalSkills(): Promise<string[]>;
|
|
1735
1735
|
|
|
1736
|
+
/**
|
|
1737
|
+
* Three-tier scope helper for Pi harness operations.
|
|
1738
|
+
*
|
|
1739
|
+
* @remarks
|
|
1740
|
+
* Per ADR-035 §D1, CAAMP wraps Pi's native two-tier extension model
|
|
1741
|
+
* (project-local `.pi/extensions/` → global `~/.pi/agent/extensions/`)
|
|
1742
|
+
* with a third tier for the CleoOS-managed cross-project hub. The
|
|
1743
|
+
* resulting hierarchy, in precedence order on reads:
|
|
1744
|
+
*
|
|
1745
|
+
* | Tier | Path | Who owns it |
|
|
1746
|
+
* | --------- | ---------------------------------------------- | ------------------------ |
|
|
1747
|
+
* | `project` | `<cwd>/.pi/<asset>/` | repository |
|
|
1748
|
+
* | `user` | `$PI_CODING_AGENT_DIR` or `~/.pi/agent/<asset>`| Pi itself |
|
|
1749
|
+
* | `global` | `$CLEO_HOME/pi-<asset>/` | CleoOS (this wrapper) |
|
|
1750
|
+
*
|
|
1751
|
+
* Pi's own discovery loader is NOT modified. The `global` tier is either
|
|
1752
|
+
* copied or symlinked into the `user` tier on first use (lazy
|
|
1753
|
+
* materialization), so Pi's native two-tier loader picks extensions up
|
|
1754
|
+
* from the familiar location without needing a patch.
|
|
1755
|
+
*
|
|
1756
|
+
* This helper intentionally lives next to {@link ../harness/pi.ts} rather
|
|
1757
|
+
* than being exported at a higher level — three-tier scope is a Pi
|
|
1758
|
+
* concept today, and other harnesses (if any ever land) will want their
|
|
1759
|
+
* own mapping.
|
|
1760
|
+
*
|
|
1761
|
+
* @see ADR-035 §D1 (Three-tier scope hierarchy with explicit precedence)
|
|
1762
|
+
*
|
|
1763
|
+
* @packageDocumentation
|
|
1764
|
+
*/
|
|
1765
|
+
/**
|
|
1766
|
+
* Three-tier scope identifier for Pi harness operations.
|
|
1767
|
+
*
|
|
1768
|
+
* @remarks
|
|
1769
|
+
* Each tier maps to a distinct root directory; see the module overview
|
|
1770
|
+
* for the precedence and resolution rules. This is distinct from (and
|
|
1771
|
+
* coexists with) the legacy {@link HarnessScope} discriminated union,
|
|
1772
|
+
* which only supports two tiers (`global`/`project`) and is preserved
|
|
1773
|
+
* for back-compat with existing skill/instruction installers.
|
|
1774
|
+
*
|
|
1775
|
+
* @public
|
|
1776
|
+
*/
|
|
1777
|
+
type HarnessTier = 'project' | 'user' | 'global';
|
|
1778
|
+
|
|
1736
1779
|
/**
|
|
1737
1780
|
* Harness layer type definitions.
|
|
1738
1781
|
*
|
|
@@ -1759,6 +1802,12 @@ declare function listCanonicalSkills(): Promise<string[]>;
|
|
|
1759
1802
|
* the caller to provide the absolute project directory path — the harness
|
|
1760
1803
|
* does not infer cwd.
|
|
1761
1804
|
*
|
|
1805
|
+
* This two-tier scope is the legacy shape used by the skill and
|
|
1806
|
+
* instructions install paths. Pi-specific Wave-1 verbs (extensions,
|
|
1807
|
+
* sessions, models, prompts, themes) use the three-tier
|
|
1808
|
+
* {@link HarnessTier} hierarchy introduced in ADR-035 §D1 alongside this
|
|
1809
|
+
* type — the two coexist and neither replaces the other.
|
|
1810
|
+
*
|
|
1762
1811
|
* @public
|
|
1763
1812
|
*/
|
|
1764
1813
|
type HarnessScope = {
|
|
@@ -1768,48 +1817,237 @@ type HarnessScope = {
|
|
|
1768
1817
|
projectDir: string;
|
|
1769
1818
|
};
|
|
1770
1819
|
/**
|
|
1771
|
-
*
|
|
1772
|
-
* harness's native extension mechanism.
|
|
1820
|
+
* Metadata describing a Pi extension discovered on disk.
|
|
1773
1821
|
*
|
|
1774
1822
|
* @remarks
|
|
1775
|
-
*
|
|
1776
|
-
*
|
|
1777
|
-
*
|
|
1778
|
-
* transports may carry environment variables via {@link env}.
|
|
1823
|
+
* Returned by {@link Harness.listExtensions}. The `tier` records which
|
|
1824
|
+
* tier the extension lives at so that callers can surface the
|
|
1825
|
+
* precedence story in their output.
|
|
1779
1826
|
*
|
|
1780
|
-
*
|
|
1781
|
-
|
|
1827
|
+
* @public
|
|
1828
|
+
*/
|
|
1829
|
+
interface ExtensionEntry {
|
|
1830
|
+
/** Extension name (file basename without the `.ts` extension). */
|
|
1831
|
+
name: string;
|
|
1832
|
+
/** Tier at which this entry lives. */
|
|
1833
|
+
tier: HarnessTier;
|
|
1834
|
+
/** Absolute on-disk path to the extension file. */
|
|
1835
|
+
path: string;
|
|
1836
|
+
/**
|
|
1837
|
+
* When `true`, this entry is shadowed by a higher-precedence entry
|
|
1838
|
+
* with the same name. Exposed so list output can warn about
|
|
1839
|
+
* cross-tier name collisions per ADR-035 §D1.
|
|
1840
|
+
* @defaultValue false
|
|
1841
|
+
*/
|
|
1842
|
+
shadowed?: boolean;
|
|
1843
|
+
}
|
|
1844
|
+
/**
|
|
1845
|
+
* Metadata describing a Pi prompt directory discovered on disk.
|
|
1846
|
+
*
|
|
1847
|
+
* @remarks
|
|
1848
|
+
* Returned by {@link Harness.listPrompts}. Prompts are directories
|
|
1849
|
+
* containing a `prompt.md` plus optional metadata. The list operation
|
|
1850
|
+
* reads only the directory listing — never the prompt bodies — to keep
|
|
1851
|
+
* token usage minimal per ADR-035 §D1.
|
|
1852
|
+
*
|
|
1853
|
+
* @public
|
|
1854
|
+
*/
|
|
1855
|
+
interface PromptEntry {
|
|
1856
|
+
/** Prompt name (directory basename). */
|
|
1857
|
+
name: string;
|
|
1858
|
+
/** Tier at which this entry lives. */
|
|
1859
|
+
tier: HarnessTier;
|
|
1860
|
+
/** Absolute on-disk path to the prompt directory. */
|
|
1861
|
+
path: string;
|
|
1862
|
+
/** See {@link ExtensionEntry.shadowed}. @defaultValue false */
|
|
1863
|
+
shadowed?: boolean;
|
|
1864
|
+
}
|
|
1865
|
+
/**
|
|
1866
|
+
* Metadata describing a Pi theme discovered on disk.
|
|
1867
|
+
*
|
|
1868
|
+
* @remarks
|
|
1869
|
+
* Returned by {@link Harness.listThemes}. Themes are single `.ts` or
|
|
1870
|
+
* `.json` files matching Pi's native theme module shape.
|
|
1782
1871
|
*
|
|
1783
1872
|
* @public
|
|
1784
1873
|
*/
|
|
1785
|
-
interface
|
|
1786
|
-
/**
|
|
1874
|
+
interface ThemeEntry {
|
|
1875
|
+
/** Theme name (file basename without the extension). */
|
|
1876
|
+
name: string;
|
|
1877
|
+
/** Tier at which this entry lives. */
|
|
1878
|
+
tier: HarnessTier;
|
|
1879
|
+
/** Absolute on-disk path to the theme file. */
|
|
1880
|
+
path: string;
|
|
1881
|
+
/** File extension of the theme file (e.g. `".ts"`, `".json"`). */
|
|
1882
|
+
fileExt: string;
|
|
1883
|
+
/** See {@link ExtensionEntry.shadowed}. @defaultValue false */
|
|
1884
|
+
shadowed?: boolean;
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* Options accepted by the Pi install verbs (extensions, prompts, themes).
|
|
1888
|
+
*
|
|
1889
|
+
* @public
|
|
1890
|
+
*/
|
|
1891
|
+
interface HarnessInstallOptions {
|
|
1892
|
+
/**
|
|
1893
|
+
* When `true`, overwrite an existing file at the target tier. When
|
|
1894
|
+
* `false` (the default) the install verb throws if the target exists.
|
|
1895
|
+
* @defaultValue false
|
|
1896
|
+
*/
|
|
1897
|
+
force?: boolean;
|
|
1898
|
+
}
|
|
1899
|
+
/**
|
|
1900
|
+
* Summary header extracted from the first line of a Pi session JSONL file.
|
|
1901
|
+
*
|
|
1902
|
+
* @remarks
|
|
1903
|
+
* Per ADR-035 §D2, `list`-style session operations read only line 1 of
|
|
1904
|
+
* each `*.jsonl` file — never the full body — so this shape is what
|
|
1905
|
+
* callers consume when enumerating sessions. The full session loader
|
|
1906
|
+
* returns raw JSONL line strings as a separate type
|
|
1907
|
+
* ({@link SessionDocument}).
|
|
1908
|
+
*
|
|
1909
|
+
* @public
|
|
1910
|
+
*/
|
|
1911
|
+
interface SessionSummary {
|
|
1912
|
+
/** Session identifier as recorded in the line-1 header. */
|
|
1913
|
+
id: string;
|
|
1914
|
+
/** Session version as recorded in the line-1 header (e.g. `3`). */
|
|
1915
|
+
version: number;
|
|
1916
|
+
/** ISO-8601 timestamp from the line-1 header, or `null` when absent. */
|
|
1917
|
+
timestamp: string | null;
|
|
1918
|
+
/** Working directory recorded when the session was created. */
|
|
1919
|
+
cwd: string | null;
|
|
1920
|
+
/** Parent session id, if this session was forked from another. */
|
|
1921
|
+
parentSession: string | null;
|
|
1922
|
+
/** Absolute path to the session JSONL file on disk. */
|
|
1923
|
+
filePath: string;
|
|
1924
|
+
/** File modification time in milliseconds since the epoch. */
|
|
1925
|
+
mtimeMs: number;
|
|
1926
|
+
}
|
|
1927
|
+
/**
|
|
1928
|
+
* Raw content of a Pi session JSONL file, preserved line-by-line.
|
|
1929
|
+
*
|
|
1930
|
+
* @remarks
|
|
1931
|
+
* Returned by {@link Harness.showSession} when a caller needs the full
|
|
1932
|
+
* body. Each element is one JSONL line as a string (empty trailing
|
|
1933
|
+
* lines are stripped). Callers that need typed entries parse each line
|
|
1934
|
+
* themselves; the harness does not impose a type on entry bodies
|
|
1935
|
+
* because Pi's own entry schema is open-ended (`message`, `thinking`,
|
|
1936
|
+
* `custom`, etc.) and we do not want to fall behind Pi's schema
|
|
1937
|
+
* evolution.
|
|
1938
|
+
*
|
|
1939
|
+
* @public
|
|
1940
|
+
*/
|
|
1941
|
+
interface SessionDocument {
|
|
1942
|
+
/** Header summary (same shape as {@link SessionSummary}). */
|
|
1943
|
+
summary: SessionSummary;
|
|
1944
|
+
/** Raw JSONL lines in file order, excluding the line-1 header. */
|
|
1945
|
+
entries: string[];
|
|
1946
|
+
}
|
|
1947
|
+
/**
|
|
1948
|
+
* Pi model definition as recorded under `models.json:providers[].models`.
|
|
1949
|
+
*
|
|
1950
|
+
* @remarks
|
|
1951
|
+
* Mirrors the `ModelDefinition` schema in
|
|
1952
|
+
* `@mariozechner/pi-coding-agent`'s model-registry. Fields are typed
|
|
1953
|
+
* loosely because Pi's schema is evolving (see ADR-035 §D3); the keys
|
|
1954
|
+
* captured here are the minimum a CAAMP verb needs to reason about.
|
|
1955
|
+
*
|
|
1956
|
+
* @public
|
|
1957
|
+
*/
|
|
1958
|
+
interface PiModelDefinition {
|
|
1959
|
+
/** Model id within the provider (e.g. `"claude-opus-4-20250514"`). */
|
|
1960
|
+
id: string;
|
|
1961
|
+
/** Human-readable model name. */
|
|
1787
1962
|
name: string;
|
|
1788
1963
|
/**
|
|
1789
|
-
*
|
|
1964
|
+
* Whether the model supports reasoning/thinking tokens.
|
|
1790
1965
|
* @defaultValue undefined
|
|
1791
1966
|
*/
|
|
1792
|
-
|
|
1967
|
+
reasoning?: boolean;
|
|
1793
1968
|
/**
|
|
1794
|
-
*
|
|
1969
|
+
* Allowed input modalities (e.g. `["text"]`, `["text", "image"]`).
|
|
1795
1970
|
* @defaultValue undefined
|
|
1796
1971
|
*/
|
|
1797
|
-
|
|
1972
|
+
input?: Array<'text' | 'image'>;
|
|
1798
1973
|
/**
|
|
1799
|
-
*
|
|
1974
|
+
* Context window size in tokens.
|
|
1800
1975
|
* @defaultValue undefined
|
|
1801
1976
|
*/
|
|
1802
|
-
|
|
1977
|
+
contextWindow?: number;
|
|
1803
1978
|
/**
|
|
1804
|
-
*
|
|
1979
|
+
* Maximum output tokens.
|
|
1805
1980
|
* @defaultValue undefined
|
|
1806
1981
|
*/
|
|
1807
|
-
|
|
1982
|
+
maxTokens?: number;
|
|
1983
|
+
}
|
|
1984
|
+
/**
|
|
1985
|
+
* Pi provider block as recorded under `models.json:providers[id]`.
|
|
1986
|
+
*
|
|
1987
|
+
* @remarks
|
|
1988
|
+
* Mirrors the `ProviderConfig` schema in Pi's model-registry.
|
|
1989
|
+
*
|
|
1990
|
+
* @public
|
|
1991
|
+
*/
|
|
1992
|
+
interface PiModelProvider {
|
|
1808
1993
|
/**
|
|
1809
|
-
*
|
|
1994
|
+
* Custom base URL for the provider (overrides default).
|
|
1810
1995
|
* @defaultValue undefined
|
|
1811
1996
|
*/
|
|
1812
|
-
|
|
1997
|
+
baseUrl?: string;
|
|
1998
|
+
/**
|
|
1999
|
+
* API key or `$ENV_VAR` reference.
|
|
2000
|
+
* @defaultValue undefined
|
|
2001
|
+
*/
|
|
2002
|
+
apiKey?: string;
|
|
2003
|
+
/**
|
|
2004
|
+
* Custom model definitions declared by the user.
|
|
2005
|
+
* @defaultValue undefined
|
|
2006
|
+
*/
|
|
2007
|
+
models?: PiModelDefinition[];
|
|
2008
|
+
}
|
|
2009
|
+
/**
|
|
2010
|
+
* Entire `models.json` document shape used by Pi.
|
|
2011
|
+
*
|
|
2012
|
+
* @remarks
|
|
2013
|
+
* Mirrors the `ModelsConfig` schema in Pi's model-registry. CAAMP reads
|
|
2014
|
+
* and writes this file through {@link Harness.readModelsConfig} /
|
|
2015
|
+
* {@link Harness.writeModelsConfig}.
|
|
2016
|
+
*
|
|
2017
|
+
* @public
|
|
2018
|
+
*/
|
|
2019
|
+
interface PiModelsConfig {
|
|
2020
|
+
/** Map of provider id → provider block. */
|
|
2021
|
+
providers: Record<string, PiModelProvider>;
|
|
2022
|
+
}
|
|
2023
|
+
/**
|
|
2024
|
+
* A model entry as surfaced by {@link Harness.listModels}.
|
|
2025
|
+
*
|
|
2026
|
+
* @remarks
|
|
2027
|
+
* Models are reported as a union of `models.json`-defined custom models
|
|
2028
|
+
* and `settings.json:enabledModels` selections, with flags that record
|
|
2029
|
+
* whether each entry is currently enabled and whether it is the
|
|
2030
|
+
* configured default.
|
|
2031
|
+
*
|
|
2032
|
+
* @public
|
|
2033
|
+
*/
|
|
2034
|
+
interface ModelListEntry {
|
|
2035
|
+
/** Provider id (e.g. `"anthropic"`). */
|
|
2036
|
+
provider: string;
|
|
2037
|
+
/** Model id within the provider. */
|
|
2038
|
+
id: string;
|
|
2039
|
+
/** Human-readable name, from `models.json` when available. */
|
|
2040
|
+
name: string | null;
|
|
2041
|
+
/** `true` when the model is present in `settings.json:enabledModels`. */
|
|
2042
|
+
enabled: boolean;
|
|
2043
|
+
/** `true` when the model is the configured default. */
|
|
2044
|
+
isDefault: boolean;
|
|
2045
|
+
/**
|
|
2046
|
+
* `true` when this model is defined in `models.json` (custom). When
|
|
2047
|
+
* `false`, the entry originates from `settings.json:enabledModels`
|
|
2048
|
+
* only and is assumed to resolve against Pi's built-in registry.
|
|
2049
|
+
*/
|
|
2050
|
+
custom: boolean;
|
|
1813
2051
|
}
|
|
1814
2052
|
/**
|
|
1815
2053
|
* Description of a subagent task to be spawned under a harness.
|
|
@@ -1895,9 +2133,9 @@ interface SubagentHandle {
|
|
|
1895
2133
|
* harness; the interface is shaped so future harnesses (Goose, OpenCode, ...)
|
|
1896
2134
|
* can be added without changing any caller code.
|
|
1897
2135
|
*
|
|
1898
|
-
* Optional methods ({@link
|
|
1899
|
-
*
|
|
1900
|
-
*
|
|
2136
|
+
* Optional methods ({@link spawnSubagent}, {@link configureModels}) may be
|
|
2137
|
+
* omitted by harnesses that cannot support them. Callers MUST feature-check
|
|
2138
|
+
* before invoking.
|
|
1901
2139
|
*
|
|
1902
2140
|
* @public
|
|
1903
2141
|
*/
|
|
@@ -1965,22 +2203,6 @@ interface Harness {
|
|
|
1965
2203
|
* @param scope - Instruction file scope.
|
|
1966
2204
|
*/
|
|
1967
2205
|
removeInstructions(scope: HarnessScope): Promise<void>;
|
|
1968
|
-
/**
|
|
1969
|
-
* Install an MCP server as a harness extension.
|
|
1970
|
-
*
|
|
1971
|
-
* @remarks
|
|
1972
|
-
* For legacy providers with a native MCP config file, this is a
|
|
1973
|
-
* passthrough. For Pi it generates a TypeScript extension file under
|
|
1974
|
-
* `extensions/` that wraps the MCP server as a Pi tool via
|
|
1975
|
-
* `pi.registerTool()`.
|
|
1976
|
-
*
|
|
1977
|
-
* Optional — harnesses that cannot host MCP bridges should omit this
|
|
1978
|
-
* method. Callers MUST feature-check before invoking.
|
|
1979
|
-
*
|
|
1980
|
-
* @param server - Server spec to bridge.
|
|
1981
|
-
* @param scope - Install scope.
|
|
1982
|
-
*/
|
|
1983
|
-
installMcpAsExtension?(server: McpServerSpec, scope: HarnessScope): Promise<void>;
|
|
1984
2206
|
/**
|
|
1985
2207
|
* Spawn a subagent under this harness's control.
|
|
1986
2208
|
*
|
|
@@ -2031,6 +2253,145 @@ interface Harness {
|
|
|
2031
2253
|
* @param scope - Settings scope.
|
|
2032
2254
|
*/
|
|
2033
2255
|
writeSettings(patch: Record<string, unknown>, scope: HarnessScope): Promise<void>;
|
|
2256
|
+
/**
|
|
2257
|
+
* Install a Pi extension TypeScript file from a local source path into
|
|
2258
|
+
* the given tier.
|
|
2259
|
+
*
|
|
2260
|
+
* @remarks
|
|
2261
|
+
* Per ADR-035 §D1 and the spec hook for T263, install verbs:
|
|
2262
|
+
* - Validate that the source is a `.ts` file with an `export default`.
|
|
2263
|
+
* - Copy (not symlink) the file into the target tier's extensions dir.
|
|
2264
|
+
* - Error by default when the target already exists; the caller may
|
|
2265
|
+
* pass `opts.force = true` to enable overwrite.
|
|
2266
|
+
*
|
|
2267
|
+
* Optional on the interface because only first-class harnesses with a
|
|
2268
|
+
* native extension mechanism support this verb.
|
|
2269
|
+
*
|
|
2270
|
+
* @param sourcePath - Absolute path to the source `.ts` file on disk.
|
|
2271
|
+
* @param name - Extension name (used as the target file basename).
|
|
2272
|
+
* @param tier - Target tier (`project`/`user`/`global`).
|
|
2273
|
+
* @param projectDir - Project directory (required when `tier='project'`).
|
|
2274
|
+
* @param opts - Install options (see {@link HarnessInstallOptions}).
|
|
2275
|
+
*/
|
|
2276
|
+
installExtension?(sourcePath: string, name: string, tier: HarnessTier, projectDir?: string, opts?: HarnessInstallOptions): Promise<{
|
|
2277
|
+
targetPath: string;
|
|
2278
|
+
tier: HarnessTier;
|
|
2279
|
+
}>;
|
|
2280
|
+
/**
|
|
2281
|
+
* Remove a Pi extension by name from the given tier.
|
|
2282
|
+
*
|
|
2283
|
+
* @remarks
|
|
2284
|
+
* Missing files are tolerated silently so the verb is usable as an
|
|
2285
|
+
* idempotent "ensure absent" operation.
|
|
2286
|
+
*
|
|
2287
|
+
* @param name - Extension name (basename without `.ts`).
|
|
2288
|
+
* @param tier - Target tier to remove from.
|
|
2289
|
+
* @param projectDir - Project directory (required when `tier='project'`).
|
|
2290
|
+
* @returns `true` when a file was removed, `false` when none existed.
|
|
2291
|
+
*/
|
|
2292
|
+
removeExtension?(name: string, tier: HarnessTier, projectDir?: string): Promise<boolean>;
|
|
2293
|
+
/**
|
|
2294
|
+
* List Pi extensions across all tiers, precedence-ordered.
|
|
2295
|
+
*
|
|
2296
|
+
* @remarks
|
|
2297
|
+
* Entries are returned in precedence order (project → user → global).
|
|
2298
|
+
* Higher-precedence tiers shadow lower-precedence entries with the
|
|
2299
|
+
* same name; the returned {@link ExtensionEntry.shadowed} flag
|
|
2300
|
+
* indicates shadowed copies so the caller can surface cross-tier name
|
|
2301
|
+
* collisions per ADR-035 §D1.
|
|
2302
|
+
*
|
|
2303
|
+
* @param projectDir - Project directory for the `project` tier. When
|
|
2304
|
+
* omitted the `project` tier is skipped rather than failing.
|
|
2305
|
+
*/
|
|
2306
|
+
listExtensions?(projectDir?: string): Promise<ExtensionEntry[]>;
|
|
2307
|
+
/**
|
|
2308
|
+
* List Pi sessions from the user-tier sessions directory.
|
|
2309
|
+
*
|
|
2310
|
+
* @remarks
|
|
2311
|
+
* Per ADR-035 §D2, MUST read only line 1 of each `*.jsonl` file. The
|
|
2312
|
+
* result is sorted by `mtimeMs` descending so the most recent
|
|
2313
|
+
* sessions appear first.
|
|
2314
|
+
*
|
|
2315
|
+
* @param opts - Options controlling which directories to scan.
|
|
2316
|
+
*/
|
|
2317
|
+
listSessions?(opts?: {
|
|
2318
|
+
includeSubagents?: boolean;
|
|
2319
|
+
}): Promise<SessionSummary[]>;
|
|
2320
|
+
/**
|
|
2321
|
+
* Load a Pi session's full body by id.
|
|
2322
|
+
*
|
|
2323
|
+
* @remarks
|
|
2324
|
+
* Reads the entire file as-is. The caller is responsible for
|
|
2325
|
+
* formatting / filtering; the harness only guarantees that the
|
|
2326
|
+
* returned `entries` are the raw JSONL lines in file order.
|
|
2327
|
+
*
|
|
2328
|
+
* @param id - Session id as recorded in the line-1 header.
|
|
2329
|
+
*/
|
|
2330
|
+
showSession?(id: string): Promise<SessionDocument>;
|
|
2331
|
+
/**
|
|
2332
|
+
* List every model known to Pi — both custom (`models.json`) and
|
|
2333
|
+
* enabled selections (`settings.json:enabledModels`).
|
|
2334
|
+
*
|
|
2335
|
+
* @remarks
|
|
2336
|
+
* Per ADR-035 §D3, this is a read-only union with per-entry flags.
|
|
2337
|
+
* Mutation verbs (`add`, `remove`, `enable`, `disable`, `default`)
|
|
2338
|
+
* are separate methods to preserve the dual-file authority model.
|
|
2339
|
+
*
|
|
2340
|
+
* @param scope - Legacy two-tier scope (global/project) that
|
|
2341
|
+
* determines which `models.json` and `settings.json` files to read.
|
|
2342
|
+
*/
|
|
2343
|
+
listModels?(scope: HarnessScope): Promise<ModelListEntry[]>;
|
|
2344
|
+
/**
|
|
2345
|
+
* Read `models.json` for the given scope.
|
|
2346
|
+
*
|
|
2347
|
+
* @remarks
|
|
2348
|
+
* Missing files resolve to `{ providers: {} }`. Malformed JSON also
|
|
2349
|
+
* resolves to the empty config rather than throwing, matching
|
|
2350
|
+
* {@link Harness.readSettings}'s tolerant contract.
|
|
2351
|
+
*/
|
|
2352
|
+
readModelsConfig?(scope: HarnessScope): Promise<PiModelsConfig>;
|
|
2353
|
+
/**
|
|
2354
|
+
* Write `models.json` for the given scope atomically.
|
|
2355
|
+
*
|
|
2356
|
+
* @remarks
|
|
2357
|
+
* The full config is written, not merged. Callers should read, patch,
|
|
2358
|
+
* then write. Uses an atomic tmp-then-rename sequence so a crash
|
|
2359
|
+
* mid-write cannot corrupt the file.
|
|
2360
|
+
*/
|
|
2361
|
+
writeModelsConfig?(config: PiModelsConfig, scope: HarnessScope): Promise<void>;
|
|
2362
|
+
/**
|
|
2363
|
+
* Install a Pi prompt from a source directory into the given tier.
|
|
2364
|
+
*
|
|
2365
|
+
* @remarks
|
|
2366
|
+
* Per ADR-035 §D1 and the spec hook for T266, the source is a
|
|
2367
|
+
* directory containing `prompt.md` plus optional metadata. The
|
|
2368
|
+
* directory is copied recursively into the target tier. Conflict
|
|
2369
|
+
* handling mirrors {@link installExtension}.
|
|
2370
|
+
*/
|
|
2371
|
+
installPrompt?(sourceDir: string, name: string, tier: HarnessTier, projectDir?: string, opts?: HarnessInstallOptions): Promise<{
|
|
2372
|
+
targetPath: string;
|
|
2373
|
+
tier: HarnessTier;
|
|
2374
|
+
}>;
|
|
2375
|
+
/** List Pi prompts across all tiers. */
|
|
2376
|
+
listPrompts?(projectDir?: string): Promise<PromptEntry[]>;
|
|
2377
|
+
/** Remove a Pi prompt by name from the given tier. */
|
|
2378
|
+
removePrompt?(name: string, tier: HarnessTier, projectDir?: string): Promise<boolean>;
|
|
2379
|
+
/**
|
|
2380
|
+
* Install a Pi theme from a source file into the given tier.
|
|
2381
|
+
*
|
|
2382
|
+
* @remarks
|
|
2383
|
+
* Per ADR-035 §D1 and the spec hook for T267. The source may be a
|
|
2384
|
+
* `.ts` TypeScript theme module or a `.json` theme file; the file
|
|
2385
|
+
* extension is preserved so Pi picks the right loader.
|
|
2386
|
+
*/
|
|
2387
|
+
installTheme?(sourceFile: string, name: string, tier: HarnessTier, projectDir?: string, opts?: HarnessInstallOptions): Promise<{
|
|
2388
|
+
targetPath: string;
|
|
2389
|
+
tier: HarnessTier;
|
|
2390
|
+
}>;
|
|
2391
|
+
/** List Pi themes across all tiers. */
|
|
2392
|
+
listThemes?(projectDir?: string): Promise<ThemeEntry[]>;
|
|
2393
|
+
/** Remove a Pi theme by name from the given tier. */
|
|
2394
|
+
removeTheme?(name: string, tier: HarnessTier, projectDir?: string): Promise<boolean>;
|
|
2034
2395
|
}
|
|
2035
2396
|
|
|
2036
2397
|
/**
|
|
@@ -2085,10 +2446,6 @@ declare class PiHarness implements Harness {
|
|
|
2085
2446
|
* Resolve the skills directory for a given scope.
|
|
2086
2447
|
*/
|
|
2087
2448
|
private skillsDir;
|
|
2088
|
-
/**
|
|
2089
|
-
* Resolve the extensions directory for a given scope.
|
|
2090
|
-
*/
|
|
2091
|
-
private extensionsDir;
|
|
2092
2449
|
/**
|
|
2093
2450
|
* Resolve the settings.json path for a given scope.
|
|
2094
2451
|
*/
|
|
@@ -2112,19 +2469,6 @@ declare class PiHarness implements Harness {
|
|
|
2112
2469
|
injectInstructions(content: string, scope: HarnessScope): Promise<void>;
|
|
2113
2470
|
/** {@inheritDoc Harness.removeInstructions} */
|
|
2114
2471
|
removeInstructions(scope: HarnessScope): Promise<void>;
|
|
2115
|
-
/**
|
|
2116
|
-
* {@inheritDoc Harness.installMcpAsExtension}
|
|
2117
|
-
*
|
|
2118
|
-
* @remarks
|
|
2119
|
-
* Emits a SCAFFOLD Pi extension file under `extensions/mcp-<name>.ts`.
|
|
2120
|
-
* The scaffold registers a Pi tool whose `execute` function currently
|
|
2121
|
-
* returns an "isError" payload explaining that the MCP bridge runtime
|
|
2122
|
-
* is not yet implemented. This preserves the public lifecycle surface
|
|
2123
|
-
* (install/list/remove) so orchestration code can treat the bridge as
|
|
2124
|
-
* a first-class asset while the concrete JSON-RPC runtime is built out
|
|
2125
|
-
* in a later wave.
|
|
2126
|
-
*/
|
|
2127
|
-
installMcpAsExtension(server: McpServerSpec, scope: HarnessScope): Promise<void>;
|
|
2128
2472
|
/**
|
|
2129
2473
|
* {@inheritDoc Harness.spawnSubagent}
|
|
2130
2474
|
*
|
|
@@ -2145,6 +2489,60 @@ declare class PiHarness implements Harness {
|
|
|
2145
2489
|
writeSettings(patch: Record<string, unknown>, scope: HarnessScope): Promise<void>;
|
|
2146
2490
|
/** {@inheritDoc Harness.configureModels} */
|
|
2147
2491
|
configureModels(modelPatterns: string[], scope: HarnessScope): Promise<void>;
|
|
2492
|
+
/**
|
|
2493
|
+
* Resolve the `models.json` path for a given legacy two-tier scope.
|
|
2494
|
+
*
|
|
2495
|
+
* @remarks
|
|
2496
|
+
* Lives next to `settings.json`. Global scope uses the Pi state root,
|
|
2497
|
+
* project scope uses the project's `.pi/` directory, matching the
|
|
2498
|
+
* dual-file authority model documented in ADR-035 §D3.
|
|
2499
|
+
*/
|
|
2500
|
+
private modelsConfigPath;
|
|
2501
|
+
/**
|
|
2502
|
+
* Resolve the sessions directory — always user-tier because Pi owns
|
|
2503
|
+
* session storage and the three-tier model folds session listings to
|
|
2504
|
+
* the single authoritative location per ADR-035 §D2.
|
|
2505
|
+
*/
|
|
2506
|
+
private sessionsDir;
|
|
2507
|
+
/** {@inheritDoc Harness.installExtension} */
|
|
2508
|
+
installExtension(sourcePath: string, name: string, tier: HarnessTier, projectDir?: string, opts?: HarnessInstallOptions): Promise<{
|
|
2509
|
+
targetPath: string;
|
|
2510
|
+
tier: HarnessTier;
|
|
2511
|
+
}>;
|
|
2512
|
+
/** {@inheritDoc Harness.removeExtension} */
|
|
2513
|
+
removeExtension(name: string, tier: HarnessTier, projectDir?: string): Promise<boolean>;
|
|
2514
|
+
/** {@inheritDoc Harness.listExtensions} */
|
|
2515
|
+
listExtensions(projectDir?: string): Promise<ExtensionEntry[]>;
|
|
2516
|
+
/** {@inheritDoc Harness.listSessions} */
|
|
2517
|
+
listSessions(opts?: {
|
|
2518
|
+
includeSubagents?: boolean;
|
|
2519
|
+
}): Promise<SessionSummary[]>;
|
|
2520
|
+
/** {@inheritDoc Harness.showSession} */
|
|
2521
|
+
showSession(id: string): Promise<SessionDocument>;
|
|
2522
|
+
/** {@inheritDoc Harness.readModelsConfig} */
|
|
2523
|
+
readModelsConfig(scope: HarnessScope): Promise<PiModelsConfig>;
|
|
2524
|
+
/** {@inheritDoc Harness.writeModelsConfig} */
|
|
2525
|
+
writeModelsConfig(config: PiModelsConfig, scope: HarnessScope): Promise<void>;
|
|
2526
|
+
/** {@inheritDoc Harness.listModels} */
|
|
2527
|
+
listModels(scope: HarnessScope): Promise<ModelListEntry[]>;
|
|
2528
|
+
/** {@inheritDoc Harness.installPrompt} */
|
|
2529
|
+
installPrompt(sourceDir: string, name: string, tier: HarnessTier, projectDir?: string, opts?: HarnessInstallOptions): Promise<{
|
|
2530
|
+
targetPath: string;
|
|
2531
|
+
tier: HarnessTier;
|
|
2532
|
+
}>;
|
|
2533
|
+
/** {@inheritDoc Harness.listPrompts} */
|
|
2534
|
+
listPrompts(projectDir?: string): Promise<PromptEntry[]>;
|
|
2535
|
+
/** {@inheritDoc Harness.removePrompt} */
|
|
2536
|
+
removePrompt(name: string, tier: HarnessTier, projectDir?: string): Promise<boolean>;
|
|
2537
|
+
/** {@inheritDoc Harness.installTheme} */
|
|
2538
|
+
installTheme(sourceFile: string, name: string, tier: HarnessTier, projectDir?: string, opts?: HarnessInstallOptions): Promise<{
|
|
2539
|
+
targetPath: string;
|
|
2540
|
+
tier: HarnessTier;
|
|
2541
|
+
}>;
|
|
2542
|
+
/** {@inheritDoc Harness.listThemes} */
|
|
2543
|
+
listThemes(projectDir?: string): Promise<ThemeEntry[]>;
|
|
2544
|
+
/** {@inheritDoc Harness.removeTheme} */
|
|
2545
|
+
removeTheme(name: string, tier: HarnessTier, projectDir?: string): Promise<boolean>;
|
|
2148
2546
|
}
|
|
2149
2547
|
|
|
2150
2548
|
/**
|
|
@@ -3572,6 +3970,362 @@ declare class MarketplaceClient {
|
|
|
3572
3970
|
getSkill(scopedName: string): Promise<MarketplaceResult | null>;
|
|
3573
3971
|
}
|
|
3574
3972
|
|
|
3973
|
+
/**
|
|
3974
|
+
* MCP server config reader.
|
|
3975
|
+
*
|
|
3976
|
+
* @remarks
|
|
3977
|
+
* Reads MCP server entries from a provider's per-agent config file using
|
|
3978
|
+
* the format-agnostic {@link readConfig} substrate from `core/formats`.
|
|
3979
|
+
* The provider's `capabilities.mcp` block is the single source of truth
|
|
3980
|
+
* for the file path, format, and dot-notation key — this module never
|
|
3981
|
+
* hard-codes provider-specific layout.
|
|
3982
|
+
*
|
|
3983
|
+
* Three operations are exported:
|
|
3984
|
+
*
|
|
3985
|
+
* - {@link listMcpServers} — enumerate every server entry on a single
|
|
3986
|
+
* provider's config file at a given scope.
|
|
3987
|
+
* - {@link listAllMcpServers} — fan out across every MCP-capable
|
|
3988
|
+
* provider in the registry, returning a map keyed by provider id.
|
|
3989
|
+
* - {@link detectMcpInstallations} — lighter-weight scan that just
|
|
3990
|
+
* reports which providers currently have any MCP config files on
|
|
3991
|
+
* disk (used by `caamp mcp detect`).
|
|
3992
|
+
*
|
|
3993
|
+
* @packageDocumentation
|
|
3994
|
+
*/
|
|
3995
|
+
|
|
3996
|
+
/**
|
|
3997
|
+
* Scope identifier for MCP config file resolution.
|
|
3998
|
+
*
|
|
3999
|
+
* @remarks
|
|
4000
|
+
* Mirrors the two-tier scope model the underlying provider config files
|
|
4001
|
+
* already use: `project` reads `<projectDir>/<provider.configPathProject>`
|
|
4002
|
+
* and `global` reads the absolute `provider.configPathGlobal` path. The
|
|
4003
|
+
* three-tier {@link HarnessTier} model used by the Pi extensions
|
|
4004
|
+
* verbs is intentionally not adopted here — MCP config files are owned
|
|
4005
|
+
* by individual tools and live on those tools' two-tier hierarchy, not
|
|
4006
|
+
* on a CleoOS-managed hub.
|
|
4007
|
+
*
|
|
4008
|
+
* @public
|
|
4009
|
+
*/
|
|
4010
|
+
type McpScope = 'project' | 'global';
|
|
4011
|
+
/**
|
|
4012
|
+
* Result of a single provider's MCP installation probe.
|
|
4013
|
+
*
|
|
4014
|
+
* @remarks
|
|
4015
|
+
* Returned by {@link detectMcpInstallations} for each provider that
|
|
4016
|
+
* declares an MCP capability in the registry. The `configPath` field
|
|
4017
|
+
* is the resolved file path the probe inspected; `exists` indicates
|
|
4018
|
+
* whether the file is present on disk; `serverCount` is `null` when
|
|
4019
|
+
* the file is missing or unparseable, otherwise the number of server
|
|
4020
|
+
* entries found at the dot-notation key.
|
|
4021
|
+
*
|
|
4022
|
+
* @public
|
|
4023
|
+
*/
|
|
4024
|
+
interface McpDetectionEntry {
|
|
4025
|
+
/** Provider id (e.g. `"claude-code"`). */
|
|
4026
|
+
providerId: string;
|
|
4027
|
+
/** Human-readable provider name. */
|
|
4028
|
+
providerName: string;
|
|
4029
|
+
/** Resolved scope of the probed config file. */
|
|
4030
|
+
scope: McpScope;
|
|
4031
|
+
/** Absolute path to the provider's MCP config file. */
|
|
4032
|
+
configPath: string;
|
|
4033
|
+
/** Whether the config file exists on disk. */
|
|
4034
|
+
exists: boolean;
|
|
4035
|
+
/** Number of server entries found, or `null` when the file is missing/unparseable. */
|
|
4036
|
+
serverCount: number | null;
|
|
4037
|
+
/** ISO 8601 timestamp of the file's last modification, or `null` when the file is missing. */
|
|
4038
|
+
lastModified: string | null;
|
|
4039
|
+
}
|
|
4040
|
+
/**
|
|
4041
|
+
* Resolve a provider's MCP config file path for the given scope, or
|
|
4042
|
+
* `null` if the provider does not declare an MCP capability or the
|
|
4043
|
+
* scope is unsupported.
|
|
4044
|
+
*
|
|
4045
|
+
* @remarks
|
|
4046
|
+
* Thin wrapper over {@link resolveProviderConfigPath} that filters out
|
|
4047
|
+
* providers without an MCP capability up front so callers can use a
|
|
4048
|
+
* single null check rather than two.
|
|
4049
|
+
*
|
|
4050
|
+
* @param provider - Provider to resolve a config path for.
|
|
4051
|
+
* @param scope - Scope to resolve.
|
|
4052
|
+
* @param projectDir - Project directory used for the `project` scope.
|
|
4053
|
+
* @returns The absolute config file path, or `null` when unavailable.
|
|
4054
|
+
*
|
|
4055
|
+
* @public
|
|
4056
|
+
*/
|
|
4057
|
+
declare function resolveMcpConfigPath(provider: Provider, scope: McpScope, projectDir?: string): string | null;
|
|
4058
|
+
/**
|
|
4059
|
+
* List MCP server entries declared in a single provider's config file.
|
|
4060
|
+
*
|
|
4061
|
+
* @remarks
|
|
4062
|
+
* Reads the provider's MCP config file using the format-agnostic
|
|
4063
|
+
* {@link readConfig} substrate, walks the dot-notation
|
|
4064
|
+
* `provider.capabilities.mcp.configKey` to find the servers section,
|
|
4065
|
+
* and returns one {@link McpServerEntry} per child key.
|
|
4066
|
+
*
|
|
4067
|
+
* Returns an empty array (not an error) when:
|
|
4068
|
+
*
|
|
4069
|
+
* - the provider does not declare an MCP capability,
|
|
4070
|
+
* - the resolved config path is unavailable for the requested scope,
|
|
4071
|
+
* - the config file does not exist on disk,
|
|
4072
|
+
* - the config file is empty or unparseable,
|
|
4073
|
+
* - the config file exists but has no MCP servers section.
|
|
4074
|
+
*
|
|
4075
|
+
* "No file" is a normal state for an uninstalled tool, so callers
|
|
4076
|
+
* should treat the empty array as success and only escalate to an
|
|
4077
|
+
* error envelope when the user explicitly asked about a missing
|
|
4078
|
+
* provider.
|
|
4079
|
+
*
|
|
4080
|
+
* @param provider - Provider whose config file to read.
|
|
4081
|
+
* @param scope - Scope to resolve (project|global).
|
|
4082
|
+
* @param projectDir - Project directory used for the `project` scope
|
|
4083
|
+
* (defaults to `process.cwd()`).
|
|
4084
|
+
* @returns Array of MCP server entries, or `[]` when nothing was found.
|
|
4085
|
+
*
|
|
4086
|
+
* @public
|
|
4087
|
+
*/
|
|
4088
|
+
declare function listMcpServers(provider: Provider, scope: McpScope, projectDir?: string): Promise<McpServerEntry[]>;
|
|
4089
|
+
/**
|
|
4090
|
+
* Map of provider id → MCP server entries for that provider.
|
|
4091
|
+
*
|
|
4092
|
+
* @remarks
|
|
4093
|
+
* Return shape of {@link listAllMcpServers}. Providers without an MCP
|
|
4094
|
+
* capability are intentionally absent from the map (rather than mapped
|
|
4095
|
+
* to an empty array) so callers can iterate the result and immediately
|
|
4096
|
+
* know which providers were probed.
|
|
4097
|
+
*
|
|
4098
|
+
* @public
|
|
4099
|
+
*/
|
|
4100
|
+
type McpServerEntriesByProvider = Map<string, McpServerEntry[]>;
|
|
4101
|
+
/**
|
|
4102
|
+
* List MCP server entries for every MCP-capable provider in the
|
|
4103
|
+
* registry at the given scope.
|
|
4104
|
+
*
|
|
4105
|
+
* @remarks
|
|
4106
|
+
* Iterates {@link getAllProviders}, filters to those with a
|
|
4107
|
+
* `capabilities.mcp` block, calls {@link listMcpServers} on each, and
|
|
4108
|
+
* collects the results into a map keyed by provider id.
|
|
4109
|
+
*
|
|
4110
|
+
* Each provider is probed independently — a parse failure on one
|
|
4111
|
+
* provider will not affect the others. The result map only contains
|
|
4112
|
+
* entries for providers that were actually probed (i.e. had an MCP
|
|
4113
|
+
* capability), so consumers can iterate `result.entries()` without
|
|
4114
|
+
* skipping non-MCP providers.
|
|
4115
|
+
*
|
|
4116
|
+
* @param scope - Scope to resolve for every provider.
|
|
4117
|
+
* @param projectDir - Project directory used for the `project` scope.
|
|
4118
|
+
* @returns Map of provider id → server entries.
|
|
4119
|
+
*
|
|
4120
|
+
* @public
|
|
4121
|
+
*/
|
|
4122
|
+
declare function listAllMcpServers(scope: McpScope, projectDir?: string): Promise<McpServerEntriesByProvider>;
|
|
4123
|
+
/**
|
|
4124
|
+
* Probe every MCP-capable provider in the registry to determine which
|
|
4125
|
+
* ones have a config file on disk and how many servers are configured.
|
|
4126
|
+
*
|
|
4127
|
+
* @remarks
|
|
4128
|
+
* Lightweight detection used by `caamp mcp detect`. Unlike
|
|
4129
|
+
* {@link listAllMcpServers} this does not return individual server
|
|
4130
|
+
* entries — it just reports a count plus the file mtime so callers can
|
|
4131
|
+
* answer "which tools on my machine already have MCP configured?"
|
|
4132
|
+
* without paying the cost of materialising every server entry.
|
|
4133
|
+
*
|
|
4134
|
+
* @param scope - Scope to probe.
|
|
4135
|
+
* @param projectDir - Project directory used for the `project` scope.
|
|
4136
|
+
* @returns Array of detection entries, one per MCP-capable provider.
|
|
4137
|
+
*
|
|
4138
|
+
* @public
|
|
4139
|
+
*/
|
|
4140
|
+
declare function detectMcpInstallations(scope: McpScope, projectDir?: string): Promise<McpDetectionEntry[]>;
|
|
4141
|
+
|
|
4142
|
+
/**
|
|
4143
|
+
* MCP server config installer.
|
|
4144
|
+
*
|
|
4145
|
+
* @remarks
|
|
4146
|
+
* Writes a single MCP server entry into a provider's config file using
|
|
4147
|
+
* the format-agnostic {@link writeConfig} substrate from `core/formats`.
|
|
4148
|
+
* The provider's `capabilities.mcp` block is the single source of
|
|
4149
|
+
* truth for the file path, format, and dot-notation key.
|
|
4150
|
+
*
|
|
4151
|
+
* Conflict-on-write semantics:
|
|
4152
|
+
*
|
|
4153
|
+
* - When the target server name does not yet exist in the file, the
|
|
4154
|
+
* write succeeds and {@link InstallMcpServerResult.conflicted} is
|
|
4155
|
+
* `false`.
|
|
4156
|
+
* - When the target server name already exists in the file and `force`
|
|
4157
|
+
* is `false`, the installer DOES NOT write — it returns
|
|
4158
|
+
* `installed: false, conflicted: true` so the caller can emit a
|
|
4159
|
+
* typed conflict error envelope.
|
|
4160
|
+
* - When `force` is `true`, an existing entry is overwritten and the
|
|
4161
|
+
* result reports `installed: true, conflicted: true` so the caller
|
|
4162
|
+
* can surface the overwrite in its envelope.
|
|
4163
|
+
*
|
|
4164
|
+
* Parent directories of the resolved config path are created lazily on
|
|
4165
|
+
* write — see {@link writeConfig} for the per-format details.
|
|
4166
|
+
*
|
|
4167
|
+
* @packageDocumentation
|
|
4168
|
+
*/
|
|
4169
|
+
|
|
4170
|
+
/**
|
|
4171
|
+
* Options accepted by {@link installMcpServer}.
|
|
4172
|
+
*
|
|
4173
|
+
* @public
|
|
4174
|
+
*/
|
|
4175
|
+
interface InstallMcpServerOptions {
|
|
4176
|
+
/** Scope to write to (project|global). */
|
|
4177
|
+
scope: McpScope;
|
|
4178
|
+
/** When `true`, overwrite an existing server entry instead of failing. */
|
|
4179
|
+
force?: boolean;
|
|
4180
|
+
/** Project directory used for the `project` scope. */
|
|
4181
|
+
projectDir?: string;
|
|
4182
|
+
}
|
|
4183
|
+
/**
|
|
4184
|
+
* Result of an {@link installMcpServer} call.
|
|
4185
|
+
*
|
|
4186
|
+
* @remarks
|
|
4187
|
+
* `installed` is `true` only when the file was actually written.
|
|
4188
|
+
* `conflicted` is `true` whenever the target server name was already
|
|
4189
|
+
* present, regardless of whether the write went through (force was
|
|
4190
|
+
* supplied) or was suppressed (force was withheld).
|
|
4191
|
+
*
|
|
4192
|
+
* @public
|
|
4193
|
+
*/
|
|
4194
|
+
interface InstallMcpServerResult {
|
|
4195
|
+
/** Whether the entry was written to the config file. */
|
|
4196
|
+
installed: boolean;
|
|
4197
|
+
/** Whether the target server name already existed before the call. */
|
|
4198
|
+
conflicted: boolean;
|
|
4199
|
+
/** Absolute path to the config file that was (or would have been) written. */
|
|
4200
|
+
sourcePath: string;
|
|
4201
|
+
/** Provider id the entry was written for. */
|
|
4202
|
+
providerId: string;
|
|
4203
|
+
/** Server name that was written. */
|
|
4204
|
+
serverName: string;
|
|
4205
|
+
}
|
|
4206
|
+
/**
|
|
4207
|
+
* Install an MCP server entry into a single provider's config file.
|
|
4208
|
+
*
|
|
4209
|
+
* @remarks
|
|
4210
|
+
* Resolves the provider's MCP config path for the requested scope,
|
|
4211
|
+
* checks for an existing entry with the same server name, and either
|
|
4212
|
+
* writes the new config (when no conflict, or when `force` is set) or
|
|
4213
|
+
* returns a non-installed conflict result.
|
|
4214
|
+
*
|
|
4215
|
+
* Throws a plain `Error` (not a `LAFSCommandError`) when the provider
|
|
4216
|
+
* has no MCP capability or no config path for the requested scope —
|
|
4217
|
+
* those are caller-side validation failures and should be caught and
|
|
4218
|
+
* re-thrown as typed `LAFSCommandError`s in the command layer.
|
|
4219
|
+
*
|
|
4220
|
+
* @param provider - Target provider.
|
|
4221
|
+
* @param serverName - Name/key for the new server entry.
|
|
4222
|
+
* @param config - Canonical {@link McpServerConfig} payload to write.
|
|
4223
|
+
* @param opts - Install options (scope, force, projectDir).
|
|
4224
|
+
* @returns Structured install result describing what happened.
|
|
4225
|
+
* @throws `Error` when the provider has no MCP capability or no
|
|
4226
|
+
* project-scoped config path is available.
|
|
4227
|
+
*
|
|
4228
|
+
* @public
|
|
4229
|
+
*/
|
|
4230
|
+
declare function installMcpServer(provider: Provider, serverName: string, config: McpServerConfig, opts: InstallMcpServerOptions): Promise<InstallMcpServerResult>;
|
|
4231
|
+
|
|
4232
|
+
/**
|
|
4233
|
+
* MCP server config remover.
|
|
4234
|
+
*
|
|
4235
|
+
* @remarks
|
|
4236
|
+
* Removes a single MCP server entry from a provider's config file
|
|
4237
|
+
* using the format-agnostic {@link removeConfig} substrate from
|
|
4238
|
+
* `core/formats`. The provider's `capabilities.mcp` block is the
|
|
4239
|
+
* single source of truth for the file path, format, and dot-notation
|
|
4240
|
+
* key.
|
|
4241
|
+
*
|
|
4242
|
+
* Both single-provider and all-providers variants are exported. Both
|
|
4243
|
+
* are idempotent: removing a server that does not exist returns
|
|
4244
|
+
* `removed: false` rather than throwing.
|
|
4245
|
+
*
|
|
4246
|
+
* @packageDocumentation
|
|
4247
|
+
*/
|
|
4248
|
+
|
|
4249
|
+
/**
|
|
4250
|
+
* Options accepted by {@link removeMcpServer} and
|
|
4251
|
+
* {@link removeMcpServerFromAll}.
|
|
4252
|
+
*
|
|
4253
|
+
* @public
|
|
4254
|
+
*/
|
|
4255
|
+
interface RemoveMcpServerOptions {
|
|
4256
|
+
/** Scope to target (project|global). */
|
|
4257
|
+
scope: McpScope;
|
|
4258
|
+
/** Project directory used for the `project` scope. */
|
|
4259
|
+
projectDir?: string;
|
|
4260
|
+
}
|
|
4261
|
+
/**
|
|
4262
|
+
* Result of a single-provider {@link removeMcpServer} call.
|
|
4263
|
+
*
|
|
4264
|
+
* @remarks
|
|
4265
|
+
* `removed` is `true` only when an entry was actually deleted from
|
|
4266
|
+
* the file. The `reason` field carries an optional discriminator when
|
|
4267
|
+
* the call was a no-op so the command layer can surface a precise
|
|
4268
|
+
* envelope (e.g. "no config file" vs "entry not present").
|
|
4269
|
+
*
|
|
4270
|
+
* @public
|
|
4271
|
+
*/
|
|
4272
|
+
interface RemoveMcpServerResult {
|
|
4273
|
+
/** Provider id the call targeted. */
|
|
4274
|
+
providerId: string;
|
|
4275
|
+
/** Server name the call targeted. */
|
|
4276
|
+
serverName: string;
|
|
4277
|
+
/** Resolved config file path, or `null` when the provider had no MCP capability. */
|
|
4278
|
+
sourcePath: string | null;
|
|
4279
|
+
/** Whether an entry was actually deleted. */
|
|
4280
|
+
removed: boolean;
|
|
4281
|
+
/**
|
|
4282
|
+
* Diagnostic discriminator when `removed` is `false`.
|
|
4283
|
+
*
|
|
4284
|
+
* - `"no-mcp-capability"` — provider does not consume MCP servers
|
|
4285
|
+
* - `"no-config-path"` — provider has no config path for the scope
|
|
4286
|
+
* - `"file-missing"` — config file does not exist on disk
|
|
4287
|
+
* - `"entry-missing"` — config file exists but had no matching entry
|
|
4288
|
+
*
|
|
4289
|
+
* Set to `null` when `removed` is `true`.
|
|
4290
|
+
*/
|
|
4291
|
+
reason: 'no-mcp-capability' | 'no-config-path' | 'file-missing' | 'entry-missing' | null;
|
|
4292
|
+
}
|
|
4293
|
+
/**
|
|
4294
|
+
* Remove an MCP server entry from a single provider's config file.
|
|
4295
|
+
*
|
|
4296
|
+
* @remarks
|
|
4297
|
+
* Idempotent: when the entry is not present (or the file is missing
|
|
4298
|
+
* entirely) the call returns `removed: false` with a structured
|
|
4299
|
+
* `reason` rather than throwing.
|
|
4300
|
+
*
|
|
4301
|
+
* @param provider - Provider whose config file to modify.
|
|
4302
|
+
* @param serverName - Server name/key to remove.
|
|
4303
|
+
* @param opts - Removal options.
|
|
4304
|
+
* @returns Structured result describing whether the entry was removed.
|
|
4305
|
+
*
|
|
4306
|
+
* @public
|
|
4307
|
+
*/
|
|
4308
|
+
declare function removeMcpServer(provider: Provider, serverName: string, opts: RemoveMcpServerOptions): Promise<RemoveMcpServerResult>;
|
|
4309
|
+
/**
|
|
4310
|
+
* Remove an MCP server entry from every MCP-capable provider in the
|
|
4311
|
+
* registry that currently has it configured.
|
|
4312
|
+
*
|
|
4313
|
+
* @remarks
|
|
4314
|
+
* Iterates {@link getAllProviders}, calls {@link removeMcpServer} on
|
|
4315
|
+
* each MCP-capable provider, and collects the per-provider results.
|
|
4316
|
+
* Each provider is processed independently — a failure on one does
|
|
4317
|
+
* not abort the others. The result array contains one entry per
|
|
4318
|
+
* MCP-capable provider, even when the entry was not present (so
|
|
4319
|
+
* callers can render a complete report).
|
|
4320
|
+
*
|
|
4321
|
+
* @param serverName - Server name/key to remove from every provider.
|
|
4322
|
+
* @param opts - Removal options applied uniformly to every provider.
|
|
4323
|
+
* @returns Array of per-provider removal results.
|
|
4324
|
+
*
|
|
4325
|
+
* @public
|
|
4326
|
+
*/
|
|
4327
|
+
declare function removeMcpServerFromAll(serverName: string, opts: RemoveMcpServerOptions): Promise<RemoveMcpServerResult[]>;
|
|
4328
|
+
|
|
3575
4329
|
/**
|
|
3576
4330
|
* Scope for path resolution, either global (user home) or project-local.
|
|
3577
4331
|
*
|
|
@@ -6345,4 +7099,4 @@ declare function parseSource(input: string): ParsedSource;
|
|
|
6345
7099
|
*/
|
|
6346
7100
|
declare function isMarketplaceScoped(input: string): boolean;
|
|
6347
7101
|
|
|
6348
|
-
export { type AuditFinding, type AuditResult, type AuditRule, type AuditSeverity, type BatchInstallOptions, type BatchInstallResult, CANONICAL_HOOK_EVENTS, type CaampLockFile, type CanonicalEventDefinition, type CanonicalHookEvent, type ConfigFormat, type CrossProviderMatrix, type CtDispatchMatrix, type CtManifest, type CtManifestSkill, type CtProfileDefinition, type CtSkillEntry, type CtValidationIssue, type CtValidationResult, type DetectionCacheOptions, type DetectionResult, type EnsureProviderInstructionFileOptions, type EnsureProviderInstructionFileResult, type GlobalOptions, HOOK_CATEGORIES, type Harness, type HarnessScope, type HookCategory, type HookEvent, type HookHandlerType, type HookMapping, type HookSupportResult, type HookSystemType, type InjectionCheckResult, type InjectionStatus, type InjectionTemplate, type InstructionUpdateSummary, type LockEntry, MarketplaceClient, type MarketplaceResult, type MarketplaceSearchResult, type MarketplaceSkill, type McpConfigFormat, type McpServerConfig, type
|
|
7102
|
+
export { type AuditFinding, type AuditResult, type AuditRule, type AuditSeverity, type BatchInstallOptions, type BatchInstallResult, CANONICAL_HOOK_EVENTS, type CaampLockFile, type CanonicalEventDefinition, type CanonicalHookEvent, type ConfigFormat, type CrossProviderMatrix, type CtDispatchMatrix, type CtManifest, type CtManifestSkill, type CtProfileDefinition, type CtSkillEntry, type CtValidationIssue, type CtValidationResult, type DetectionCacheOptions, type DetectionResult, type EnsureProviderInstructionFileOptions, type EnsureProviderInstructionFileResult, type GlobalOptions, HOOK_CATEGORIES, type Harness, type HarnessScope, type HookCategory, type HookEvent, type HookHandlerType, type HookMapping, type HookSupportResult, type HookSystemType, type InjectionCheckResult, type InjectionStatus, type InjectionTemplate, type InstallMcpServerOptions, type InstallMcpServerResult, type InstructionUpdateSummary, type LockEntry, MarketplaceClient, type MarketplaceResult, type MarketplaceSearchResult, type MarketplaceSkill, type McpConfigFormat, type McpDetectionEntry, type McpScope, type McpServerConfig, type McpServerEntriesByProvider, type McpServerEntry, type McpTransportType, type NormalizedHookEvent, type NormalizedRecommendationCriteria, type ParsedSource, PiHarness, type PlatformPaths, type Provider, type ProviderCapabilities, type ProviderHarnessCapability, type ProviderHookProfile, type ProviderHookSummary, type ProviderHooksCapability, type ProviderMcpCapability, type ProviderPriority, type ProviderSkillsCapability, type ProviderSpawnCapability, type ProviderStatus, RECOMMENDATION_ERROR_CODES, type RankedSkillRecommendation, type RecommendSkillsResult, type RecommendationCriteriaInput, type RecommendationErrorCode, type RecommendationOptions, type RecommendationReason, type RecommendationReasonCode, type RecommendationScoreBreakdown, type RecommendationValidationIssue, type RecommendationValidationResult, type RecommendationWeights, type RegistryHarnessKind, type RegistryHookCatalog, type RegistryHookFormat, type RemoveMcpServerOptions, type RemoveMcpServerResult, type SkillBatchOperation, type SkillEntry, type SkillInstallResult, type SkillIntegrityResult, type SkillIntegrityStatus, type SkillLibrary, type SkillLibraryDispatchMatrix, type SkillLibraryEntry, type SkillLibraryManifest, type SkillLibraryManifestSkill, type SkillLibraryProfile, type SkillLibraryValidationIssue, type SkillLibraryValidationResult, type SkillMetadata, type SkillsPrecedence, type SourceType, type SpawnAdapter, type SpawnMechanism, type SpawnOptions, type SpawnResult, type SubagentHandle, type SubagentResult, type SubagentTask, type SystemInfo, type TransportType, type ValidationIssue, type ValidationResult, _resetPlatformPathsCache, buildHookMatrix, buildInjectionContent, buildLibraryFromFiles, buildSkillsMap, catalog, checkAllInjections, checkAllSkillIntegrity, checkAllSkillUpdates, checkInjection, checkSkillIntegrity, checkSkillUpdate, clearRegisteredLibrary, deepMerge, detectAllProviders, detectMcpInstallations, detectProjectProviders, detectProvider, discoverSkill, discoverSkills, ensureAllProviderInstructionFiles, ensureDir, ensureProviderInstructionFile, formatSkillRecommendations, generateInjectionContent, generateSkillsSection, getAgentsConfigPath, getAgentsHome, getAgentsInstructFile, getAgentsLinksDir, getAgentsMcpDir, getAgentsMcpServersPath, getAgentsSpecDir, getAgentsWikiDir, getAllCanonicalEvents, getAllHarnesses, getAllProviders, getCanonicalEvent, getCanonicalEventsByCategory, getCanonicalSkillsDir, getCommonEvents, getCommonHookEvents, getEffectiveSkillsPaths, getHarnessFor, getHookConfigPath, getHookMappingsVersion, getHookSupport, getHookSystemType, getInstalledProviders, getInstructionFiles, getLockFilePath, getMappedProviderIds, getNestedValue, getPlatformLocations, getPlatformPaths, getPrimaryHarness, getPrimaryProvider, getProjectAgentsDir, getProvider, getProviderCapabilities, getProviderCount, getProviderHookProfile, getProviderOnlyEvents, getProviderSummary, getProvidersByHookEvent, getProvidersByInstructFile, getProvidersByPriority, getProvidersBySkillsPrecedence, getProvidersBySpawnCapability, getProvidersByStatus, getProvidersForEvent, getRegistryVersion, getSpawnCapableProviders, getSupportedEvents, getSystemInfo, getTrackedSkills, getUnsupportedEvents, groupByInstructFile, inject, injectAll, installBatchWithRollback, installMcpServer, installSkill, isCaampOwnedSkill, isMarketplaceScoped, isQuiet, isVerbose, listAllMcpServers, listCanonicalSkills, listMcpServers, loadLibraryFromModule, normalizeRecommendationCriteria, parseInjectionContent, parseSkillFile, parseSource, providerSupports, providerSupportsById, rankSkills, readConfig, recommendSkills, recordSkillInstall, registerSkillLibrary, registerSkillLibraryFromPath, removeConfig, removeInjection, removeMcpServer, removeMcpServerFromAll, removeSkill, removeSkillFromLock, resetDetectionCache, resolveAlias, resolveDefaultTargetProviders, resolveMcpConfigPath, resolveNativeEvent, resolveProviderSkillsDirs, resolveRegistryTemplatePath, scanDirectory, scanFile, scoreSkillRecommendation, searchSkills, selectProvidersByMinimumPriority, setQuiet, setVerbose, shouldOverrideSkill, supportsHook, toCanonical, toNative, toNativeBatch, toSarif, tokenizeCriteriaValue, translateToAll, updateInstructionsSingleOperation, validateInstructionIntegrity, validateRecommendationCriteria, validateSkill, writeConfig };
|