@oh-my-pi/pi-coding-agent 17.2.10 → 17.2.12
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/CHANGELOG.md +53 -0
- package/dist/{CHANGELOG-rhwzpexa.md → CHANGELOG-k9ghy5sn.md} +53 -0
- package/dist/cli.js +10775 -10762
- package/dist/types/advisor/runtime.d.ts +1 -1
- package/dist/types/capability/mcp.d.ts +11 -0
- package/dist/types/capability/skill.d.ts +6 -0
- package/dist/types/cli/command-help.d.ts +3 -0
- package/dist/types/commands/share.d.ts +25 -0
- package/dist/types/commit/agentic/index.d.ts +3 -1
- package/dist/types/commit/execute.d.ts +32 -0
- package/dist/types/commit/index.d.ts +2 -1
- package/dist/types/commit/pipeline.d.ts +7 -1
- package/dist/types/config/custom-models.d.ts +31 -0
- package/dist/types/config/model-config-values.d.ts +19 -0
- package/dist/types/config/model-patch.d.ts +93 -0
- package/dist/types/config/model-provider-discovery.d.ts +51 -0
- package/dist/types/config/model-registry.d.ts +9 -52
- package/dist/types/config/settings-schema.d.ts +1 -34
- package/dist/types/config/settings.d.ts +5 -3
- package/dist/types/debug/raw-sse-buffer.d.ts +9 -0
- package/dist/types/discovery/agent-plugin-format.d.ts +136 -0
- package/dist/types/discovery/agent-plugins.d.ts +1 -0
- package/dist/types/discovery/contained-path.d.ts +33 -0
- package/dist/types/discovery/index.d.ts +1 -0
- package/dist/types/eval/executor-base.d.ts +8 -2
- package/dist/types/eval/kernel-session-registry.d.ts +60 -0
- package/dist/types/export/share.d.ts +1 -1
- package/dist/types/extensibility/custom-tools/types.d.ts +2 -2
- package/dist/types/extensibility/extensions/loader.d.ts +7 -0
- package/dist/types/extensibility/extensions/types.d.ts +11 -0
- package/dist/types/extensibility/shared-events.d.ts +3 -2
- package/dist/types/extensibility/skills.d.ts +5 -0
- package/dist/types/lsp/diagnostics.d.ts +96 -0
- package/dist/types/lsp/index.d.ts +7 -128
- package/dist/types/lsp/servers.d.ts +72 -0
- package/dist/types/lsp/tool.d.ts +42 -0
- package/dist/types/lsp/workspace-diagnostics.d.ts +12 -0
- package/dist/types/lsp/writethrough.d.ts +33 -0
- package/dist/types/mcp/transports/header-policy.d.ts +46 -0
- package/dist/types/mcp/types.d.ts +15 -0
- package/dist/types/modes/components/agent-hub-projection.d.ts +2 -7
- package/dist/types/modes/components/agent-hub-renderer.d.ts +0 -7
- package/dist/types/modes/components/agent-hub.d.ts +2 -0
- package/dist/types/modes/components/agent-transcript-viewer.d.ts +2 -0
- package/dist/types/modes/components/chat-transcript-builder.d.ts +2 -0
- package/dist/types/modes/components/custom-editor.d.ts +1 -2
- package/dist/types/modes/components/status-line/types.d.ts +2 -0
- package/dist/types/modes/components/tool-execution.d.ts +2 -0
- package/dist/types/modes/theme/color.d.ts +19 -0
- package/dist/types/modes/theme/loader.d.ts +19 -0
- package/dist/types/modes/theme/schema.d.ts +175 -0
- package/dist/types/modes/theme/symbols.d.ts +28 -0
- package/dist/types/modes/theme/theme-class.d.ts +244 -0
- package/dist/types/modes/theme/theme.d.ts +9 -280
- package/dist/types/modes/theme/tui-adapters.d.ts +13 -0
- package/dist/types/modes/utils/transcript-render-helpers.d.ts +3 -2
- package/dist/types/registry/agent-registry.d.ts +1 -3
- package/dist/types/secrets/index.d.ts +26 -2
- package/dist/types/secrets/message-transform.d.ts +40 -0
- package/dist/types/secrets/obfuscator.d.ts +0 -108
- package/dist/types/secrets/placeholder-scan.d.ts +95 -0
- package/dist/types/secrets/placeholder.d.ts +94 -0
- package/dist/types/secrets/replacement.d.ts +82 -0
- package/dist/types/session/agent-session-events.d.ts +2 -2
- package/dist/types/session/agent-session-types.d.ts +6 -0
- package/dist/types/session/agent-session.d.ts +2 -2
- package/dist/types/session/messages.d.ts +1 -0
- package/dist/types/session/prewalk.d.ts +3 -1
- package/dist/types/session/session-handoff.d.ts +3 -3
- package/dist/types/session/session-manager.d.ts +32 -0
- package/dist/types/session/session-provider-boundary.d.ts +1 -1
- package/dist/types/session/session-tools.d.ts +8 -0
- package/dist/types/session/turn-recovery.d.ts +9 -4
- package/dist/types/slash-commands/builtin-collaboration.d.ts +2 -0
- package/dist/types/slash-commands/builtin-completions.d.ts +36 -0
- package/dist/types/slash-commands/builtin-control.d.ts +2 -0
- package/dist/types/slash-commands/builtin-lifecycle.d.ts +3 -0
- package/dist/types/slash-commands/builtin-marketplace.d.ts +11 -0
- package/dist/types/slash-commands/builtin-modes.d.ts +5 -0
- package/dist/types/slash-commands/builtin-registry.d.ts +1 -1
- package/dist/types/slash-commands/builtin-session.d.ts +2 -0
- package/dist/types/task/index.d.ts +2 -0
- package/dist/types/tools/gh-common.d.ts +69 -0
- package/dist/types/tools/gh-pr-checkout.d.ts +84 -0
- package/dist/types/tools/gh-pr-diff.d.ts +102 -0
- package/dist/types/tools/gh-run-watch.d.ts +78 -0
- package/dist/types/tools/gh-search.d.ts +61 -0
- package/dist/types/tools/gh-types.d.ts +340 -0
- package/dist/types/tools/gh-view.d.ts +88 -0
- package/dist/types/tools/gh.d.ts +4 -201
- package/dist/types/tools/read-archive.d.ts +16 -0
- package/dist/types/tools/read-format.d.ts +104 -0
- package/dist/types/tools/read-path-resolution.d.ts +19 -0
- package/dist/types/tools/read-pdf-images.d.ts +12 -0
- package/dist/types/tools/read-renderer.d.ts +24 -0
- package/dist/types/tools/read-selector.d.ts +27 -0
- package/dist/types/tools/read-sqlite.d.ts +16 -0
- package/dist/types/tools/read-summary.d.ts +19 -0
- package/dist/types/tools/read.d.ts +1 -23
- package/dist/types/tools/shell-tokenize.d.ts +18 -1
- package/dist/types/utils/changelog.d.ts +0 -5
- package/package.json +13 -13
- package/scripts/legacy-pi-virtual-module.ts +4 -1
- package/src/advisor/runtime.ts +12 -7
- package/src/capability/mcp.ts +11 -0
- package/src/capability/skill.ts +6 -0
- package/src/cli/command-help.ts +4 -0
- package/src/cli/gallery-cli.ts +1 -1
- package/src/cli-commands.ts +5 -0
- package/src/commands/commit.ts +16 -3
- package/src/commands/share.ts +71 -0
- package/src/commit/agentic/index.ts +39 -21
- package/src/commit/execute.ts +56 -0
- package/src/commit/index.ts +2 -1
- package/src/commit/pipeline.ts +20 -7
- package/src/config/custom-models.ts +188 -0
- package/src/config/model-config-values.ts +128 -0
- package/src/config/model-discovery.ts +1 -1
- package/src/config/model-patch.ts +252 -0
- package/src/config/model-provider-discovery.ts +132 -0
- package/src/config/model-registry.ts +84 -704
- package/src/config/settings-schema.ts +2 -33
- package/src/config/settings.ts +53 -3
- package/src/debug/raw-sse-buffer.ts +20 -0
- package/src/discovery/agent-plugin-format.ts +551 -0
- package/src/discovery/agent-plugins.ts +341 -0
- package/src/discovery/claude-plugins.ts +21 -5
- package/src/discovery/contained-path.ts +75 -0
- package/src/discovery/helpers.ts +23 -9
- package/src/discovery/index.ts +1 -0
- package/src/discovery/omp-plugins.ts +20 -7
- package/src/edit/hashline/diff.ts +5 -1
- package/src/eval/executor-base.ts +39 -6
- package/src/eval/jl/executor.ts +82 -371
- package/src/eval/kernel-session-registry.ts +398 -0
- package/src/eval/py/executor.ts +53 -261
- package/src/eval/rb/executor.ts +36 -279
- package/src/exec/non-interactive-env.ts +1 -0
- package/src/export/share.ts +2 -1
- package/src/extensibility/custom-tools/types.ts +2 -2
- package/src/extensibility/extensions/loader.ts +78 -14
- package/src/extensibility/extensions/runner.ts +6 -0
- package/src/extensibility/extensions/types.ts +12 -0
- package/src/extensibility/plugins/marketplace/manager.ts +2 -1
- package/src/extensibility/shared-events.ts +3 -2
- package/src/extensibility/skills.ts +9 -0
- package/src/internal-urls/skill-protocol.ts +14 -0
- package/src/internal-urls/vault-protocol.ts +2 -2
- package/src/launch/client.ts +11 -1
- package/src/launch/protocol.ts +7 -2
- package/src/lsp/diagnostics.ts +516 -0
- package/src/lsp/index.ts +20 -2819
- package/src/lsp/servers.ts +296 -0
- package/src/lsp/tool.ts +1352 -0
- package/src/lsp/workspace-diagnostics.ts +170 -0
- package/src/lsp/writethrough.ts +561 -0
- package/src/main.ts +3 -2
- package/src/mcp/config.ts +3 -0
- package/src/mcp/manager.ts +12 -9
- package/src/mcp/transports/header-policy.ts +95 -0
- package/src/mcp/transports/http.ts +35 -52
- package/src/mcp/transports/sse.ts +20 -27
- package/src/mcp/types.ts +15 -0
- package/src/modes/acp/acp-agent.ts +15 -4
- package/src/modes/components/agent-dashboard.ts +2 -0
- package/src/modes/components/agent-hub-projection.ts +2 -2
- package/src/modes/components/agent-hub-renderer.ts +3 -7
- package/src/modes/components/agent-hub.ts +5 -0
- package/src/modes/components/agent-transcript-viewer.ts +3 -0
- package/src/modes/components/chat-transcript-builder.ts +3 -0
- package/src/modes/components/custom-editor.ts +0 -9
- package/src/modes/components/status-line/component.ts +1 -0
- package/src/modes/components/status-line/segments.ts +6 -4
- package/src/modes/components/status-line/types.ts +2 -0
- package/src/modes/components/tool-execution.ts +13 -16
- package/src/modes/components/tree-selector.ts +62 -3
- package/src/modes/controllers/command-controller.ts +8 -2
- package/src/modes/controllers/event-controller.ts +15 -15
- package/src/modes/controllers/input-controller.ts +20 -2
- package/src/modes/controllers/selector-controller.ts +1 -0
- package/src/modes/theme/color.ts +133 -0
- package/src/modes/theme/loader.ts +178 -0
- package/src/modes/theme/schema.ts +263 -0
- package/src/modes/theme/symbols.ts +1000 -0
- package/src/modes/theme/theme-class.ts +611 -0
- package/src/modes/theme/theme.ts +27 -2453
- package/src/modes/theme/tui-adapters.ts +279 -0
- package/src/modes/utils/transcript-render-helpers.ts +4 -2
- package/src/modes/utils/ui-helpers.ts +1 -0
- package/src/registry/agent-registry.ts +2 -2
- package/src/sdk.ts +6 -49
- package/src/secrets/index.ts +51 -6
- package/src/secrets/message-transform.ts +287 -0
- package/src/secrets/obfuscator.ts +39 -1303
- package/src/secrets/placeholder-scan.ts +506 -0
- package/src/secrets/placeholder.ts +309 -0
- package/src/secrets/replacement.ts +216 -0
- package/src/session/agent-session-events.ts +2 -2
- package/src/session/agent-session-types.ts +6 -0
- package/src/session/agent-session.ts +146 -21
- package/src/session/indexed-session-storage.ts +7 -2
- package/src/session/messages.ts +1 -0
- package/src/session/prewalk.ts +57 -17
- package/src/session/session-advisors.ts +32 -34
- package/src/session/session-context.ts +3 -5
- package/src/session/session-handoff.ts +39 -16
- package/src/session/session-manager.ts +67 -3
- package/src/session/session-provider-boundary.ts +3 -6
- package/src/session/session-tools.ts +37 -3
- package/src/session/todo-tracker.ts +11 -1
- package/src/session/turn-recovery.ts +115 -84
- package/src/slash-commands/builtin-collaboration.ts +504 -0
- package/src/slash-commands/builtin-completions.ts +291 -0
- package/src/slash-commands/builtin-control.ts +78 -0
- package/src/slash-commands/builtin-lifecycle.ts +506 -0
- package/src/slash-commands/builtin-marketplace.ts +567 -0
- package/src/slash-commands/builtin-modes.ts +518 -0
- package/src/slash-commands/builtin-registry.ts +21 -2996
- package/src/slash-commands/builtin-session.ts +592 -0
- package/src/task/executor.ts +17 -14
- package/src/task/index.ts +21 -6
- package/src/tools/bash-skill-urls.ts +15 -0
- package/src/tools/bash.ts +10 -11
- package/src/tools/debug.ts +1 -1
- package/src/tools/gh-common.ts +288 -0
- package/src/tools/gh-pr-checkout.ts +679 -0
- package/src/tools/gh-pr-diff.ts +473 -0
- package/src/tools/gh-run-watch.ts +1015 -0
- package/src/tools/gh-search.ts +500 -0
- package/src/tools/gh-types.ts +379 -0
- package/src/tools/gh-view.ts +612 -0
- package/src/tools/gh.ts +109 -3821
- package/src/tools/jtd-to-json-schema.ts +123 -21
- package/src/tools/read-archive.ts +209 -0
- package/src/tools/read-format.ts +593 -0
- package/src/tools/read-path-resolution.ts +36 -0
- package/src/tools/read-pdf-images.ts +250 -0
- package/src/tools/read-renderer.ts +289 -0
- package/src/tools/read-selector.ts +84 -0
- package/src/tools/read-sqlite.ts +215 -0
- package/src/tools/read-summary.ts +199 -0
- package/src/tools/read.ts +82 -1824
- package/src/tools/shell-tokenize.ts +99 -1
- package/src/utils/changelog.ts +1 -1
- package/src/utils/title-generator.ts +3 -1
- package/src/web/search/providers/exa.ts +1 -1
- package/src/web/search/providers/zai.ts +12 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
|
|
2
2
|
import type { AssistantMessage } from "@oh-my-pi/pi-ai";
|
|
3
|
-
import {
|
|
3
|
+
import type { SecretObfuscator } from "../secrets/obfuscator.js";
|
|
4
4
|
/**
|
|
5
5
|
* Minimal slice of `Agent` the runtime drives — satisfied by pi-agent-core
|
|
6
6
|
* `Agent`. `state.error` mirrors `Agent.state.error`: provider/stream failures
|
|
@@ -24,12 +24,23 @@ export interface MCPServer {
|
|
|
24
24
|
args?: string[];
|
|
25
25
|
/** Environment variables */
|
|
26
26
|
env?: Record<string, string>;
|
|
27
|
+
/**
|
|
28
|
+
* `literal`: env values are opaque plugin package data (Agent Plugins
|
|
29
|
+
* §§4.1/9.2) — exempt from env-name lookup and `!command` resolution.
|
|
30
|
+
*/
|
|
31
|
+
envPolicy?: "literal";
|
|
27
32
|
/** Working directory for stdio transport */
|
|
28
33
|
cwd?: string;
|
|
29
34
|
/** URL (for HTTP/SSE transport) */
|
|
30
35
|
url?: string;
|
|
31
36
|
/** HTTP headers (for HTTP transport) */
|
|
32
37
|
headers?: Record<string, string>;
|
|
38
|
+
/**
|
|
39
|
+
* `origin-locked`: configured headers are literal package data pinned to the
|
|
40
|
+
* configured URL's origin (Agent Plugins §7.2.1) — never expanded, never
|
|
41
|
+
* forwarded cross-origin, and client-generated headers win case-insensitively.
|
|
42
|
+
*/
|
|
43
|
+
headerPolicy?: "origin-locked";
|
|
33
44
|
/** Authentication configuration */
|
|
34
45
|
auth?: {
|
|
35
46
|
type: "oauth" | "apikey";
|
|
@@ -35,6 +35,12 @@ export interface Skill {
|
|
|
35
35
|
content: string;
|
|
36
36
|
/** Parsed frontmatter */
|
|
37
37
|
frontmatter?: SkillFrontmatter;
|
|
38
|
+
/**
|
|
39
|
+
* Filesystem-resolved plugin root this skill was packaged in (Agent Plugins
|
|
40
|
+
* §4.1). When set, every `skill://` resource access must realpath-resolve
|
|
41
|
+
* within this directory; symlinks may target other files inside it.
|
|
42
|
+
*/
|
|
43
|
+
containRoot?: string;
|
|
38
44
|
/** Source level */
|
|
39
45
|
level: "user" | "project";
|
|
40
46
|
/** Source metadata */
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Share a saved session as an encrypted link without launching the agent.
|
|
3
|
+
*
|
|
4
|
+
* `omp share <session>` accepts a session id (prefix) or a path to a session
|
|
5
|
+
* `.jsonl` and uploads the sealed snapshot exactly like the `/share` slash
|
|
6
|
+
* command, honoring `share.serverUrl`, `share.store`, and
|
|
7
|
+
* `share.redactSecrets`.
|
|
8
|
+
*/
|
|
9
|
+
import { Command } from "@oh-my-pi/pi-utils/cli";
|
|
10
|
+
export default class Share extends Command {
|
|
11
|
+
static description: string;
|
|
12
|
+
static args: {
|
|
13
|
+
session: import("@oh-my-pi/pi-utils/cli").ArgDescriptor & {
|
|
14
|
+
description: string;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
static flags: {
|
|
19
|
+
gist: import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"boolean"> & {
|
|
20
|
+
description: string;
|
|
21
|
+
default: boolean;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
run(): Promise<void>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared commit-execution helpers for the agentic and legacy `omp commit`
|
|
3
|
+
* pipelines: readable failure reporting for refusing git hooks and a push
|
|
4
|
+
* wrapper that keeps a requested `--push` honest.
|
|
5
|
+
*/
|
|
6
|
+
import * as git from "../utils/git.js";
|
|
7
|
+
/**
|
|
8
|
+
* A commit or push failure that has already been reported to the user with a
|
|
9
|
+
* readable message. It is thrown so the CLI exits non-zero without the runtime
|
|
10
|
+
* dumping a stack trace — in a bundled build that trace is several kilobytes of
|
|
11
|
+
* minified source, which buries the one line the user needs (issue #7834).
|
|
12
|
+
*
|
|
13
|
+
* `runCommitCommand`'s caller (`commands/commit.ts`) maps this to exit code 1.
|
|
14
|
+
*/
|
|
15
|
+
export declare class CommitAbortedError extends Error {
|
|
16
|
+
constructor();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Print a git-command failure — most often a `pre-commit`/`commit-msg` hook
|
|
20
|
+
* that exited non-zero — as an indented message under `context`, then abort.
|
|
21
|
+
*
|
|
22
|
+
* @param context Label for the failed step, e.g. `"Commit 1 of 2 failed"`.
|
|
23
|
+
* @param error The failure to surface; its captured stderr/stdout is shown.
|
|
24
|
+
* @param note Optional trailing status line (split-plan progress, recovery).
|
|
25
|
+
*/
|
|
26
|
+
export declare function abortOnGitFailure(context: string, error: git.GitCommandError, note?: string): never;
|
|
27
|
+
/**
|
|
28
|
+
* Push the current branch, reporting a refused push (missing upstream, rejected
|
|
29
|
+
* ref) through {@link abortOnGitFailure} instead of letting the raw
|
|
30
|
+
* `GitCommandError` escape. Prints the success line on completion.
|
|
31
|
+
*/
|
|
32
|
+
export declare function pushOrAbort(cwd: string): Promise<void>;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { CommitCommandArgs } from "./types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Execute the omp commit pipeline for staged changes.
|
|
4
|
+
*
|
|
5
|
+
* Returns whether the commit was generated by the mechanical fallback rather
|
|
6
|
+
* than by the commit agent, so callers can signal a degraded outcome (issue
|
|
7
|
+
* #7835). The legacy pipeline has no fallback: model failures throw.
|
|
4
8
|
*/
|
|
5
|
-
export declare function runCommitCommand(args: CommitCommandArgs): Promise<
|
|
9
|
+
export declare function runCommitCommand(args: CommitCommandArgs): Promise<{
|
|
10
|
+
usedFallback: boolean;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Api, Model, ModelSpec, RemoteCompactionConfig } from "@oh-my-pi/pi-ai/types";
|
|
2
|
+
import { type HeaderSource } from "./model-config-values.js";
|
|
3
|
+
import { type ModelPatch } from "./model-patch.js";
|
|
4
|
+
import type { ModelOverride, ProviderAuthMode } from "./models-config-schema.js";
|
|
5
|
+
export interface CustomModelDefinitionLike extends ModelPatch {
|
|
6
|
+
id: string;
|
|
7
|
+
api?: Api;
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
cost?: Model<Api>["cost"];
|
|
10
|
+
}
|
|
11
|
+
export interface CustomModelBuildOptions {
|
|
12
|
+
useDefaults: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface CustomModelOverlay extends ModelPatch {
|
|
15
|
+
id: string;
|
|
16
|
+
provider: string;
|
|
17
|
+
api: Api;
|
|
18
|
+
baseUrl: string;
|
|
19
|
+
cost?: Model<Api>["cost"];
|
|
20
|
+
isOAuth?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function mergeAuthHeaderSources(sources: readonly HeaderSource[], authHeader: boolean | undefined, apiKeyConfig: string | undefined): Record<string, string> | undefined;
|
|
23
|
+
export declare function buildCustomModelOverlay(providerName: string, providerBaseUrl: string, providerApi: Api | undefined, providerHeaders: Record<string, string> | undefined, providerApiKey: string | undefined, authHeader: boolean | undefined, providerCompat: ModelSpec<Api>["compat"] | undefined, providerAuth: ProviderAuthMode | undefined, providerRemoteCompaction: RemoteCompactionConfig<Api> | undefined, modelDef: CustomModelDefinitionLike): CustomModelOverlay | undefined;
|
|
24
|
+
export declare function finalizeCustomModel(model: CustomModelOverlay, options: CustomModelBuildOptions): Model<Api>;
|
|
25
|
+
export declare function normalizeSuppressedSelector(selector: string, hasLiveModel?: (provider: string, id: string) => boolean): string;
|
|
26
|
+
/**
|
|
27
|
+
* Look up a model's override, falling back to entries keyed by retired
|
|
28
|
+
* effort-tier variant ids (models.yml authored before collapsing). A raw key
|
|
29
|
+
* only re-binds when no live model holds that id.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveModelOverrideWithAliases(overrides: Map<string, ModelOverride>, model: Model<Api>, hasLiveModel: (provider: string, id: string) => boolean): ModelOverride | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare function isCommandConfigValue(valueConfig: string | undefined): valueConfig is string;
|
|
2
|
+
export interface CommandApiKeyResolution {
|
|
3
|
+
configured: boolean;
|
|
4
|
+
value?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a models.yml/models.yaml secret/config value to an actual value.
|
|
8
|
+
* `!cmd` runs a shell command and returns trimmed stdout, otherwise env vars are
|
|
9
|
+
* checked first and the input falls back to a literal value.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveConfigValue(valueConfig: string): string | undefined;
|
|
12
|
+
export type HeaderSource = Record<string, string> | undefined;
|
|
13
|
+
interface HeaderResolutionOptions {
|
|
14
|
+
authHeader?: boolean;
|
|
15
|
+
apiKeyConfig?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function createLiveConfigHeaders(sources: readonly HeaderSource[], options?: HeaderResolutionOptions): Record<string, string> | undefined;
|
|
18
|
+
export declare function resolveConfigHeaders(headers: Record<string, string> | undefined): Record<string, string> | undefined;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { Api, Model, ModelSpec, RemoteCompactionConfig, ThinkingConfig } from "@oh-my-pi/pi-ai/types";
|
|
2
|
+
import type { ModelOverride } from "./models-config-schema.js";
|
|
3
|
+
/** Provider override config (baseUrl, headers, apiKey, compat, transport) without custom models */
|
|
4
|
+
export interface ProviderOverride {
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
headers?: Record<string, string>;
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
authHeader?: boolean;
|
|
9
|
+
compat?: ModelSpec<Api>["compat"];
|
|
10
|
+
remoteCompaction?: RemoteCompactionConfig<Api>;
|
|
11
|
+
transport?: Model<Api>["transport"];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Merge a freshly discovered model with the matching bundled/configured entry
|
|
15
|
+
* (or a runtime provider override when no bundled entry exists).
|
|
16
|
+
*
|
|
17
|
+
* `baseUrl` resolution priority:
|
|
18
|
+
* 1. User-set `providerOverride.baseUrl` (explicit override in models.json)
|
|
19
|
+
* 2. Discovered baseUrl (xiaomi `tp-` token-plan keys resolve to
|
|
20
|
+
* `token-plan-sgp.xiaomimimo.com` at discovery time)
|
|
21
|
+
* 3. Existing bundled baseUrl (the host baked into `models.json`)
|
|
22
|
+
*
|
|
23
|
+
* `transport` resolution priority:
|
|
24
|
+
* 1. `providerOverride.transport` (e.g. `pi-native` for auth-gateway users)
|
|
25
|
+
* 2. `existing.transport` (carried over from boot-time override application)
|
|
26
|
+
* 3. `model.transport` (rarely set — discovery defaults omit it)
|
|
27
|
+
*
|
|
28
|
+
* Without (1), the user's override would lose to discovery; without (2)
|
|
29
|
+
* preferred over (3), the bundled `api.xiaomimimo.com` would shadow the
|
|
30
|
+
* tp- token-plan host and produce 401s on the first stream call.
|
|
31
|
+
* Without explicit transport propagation, an openrouter (or any) entry
|
|
32
|
+
* marked `transport: pi-native` in models.yml silently reverts to the
|
|
33
|
+
* default openai-completions transport after the background catalog
|
|
34
|
+
* refresh — so the first `/model` switch after boot hits the raw OpenAI
|
|
35
|
+
* chat-completions URL instead of the gateway's `/v1/pi/stream` (#2555).
|
|
36
|
+
* See `xiaomi-tp-discovery-merge.test.ts` and the `refresh()` baseUrl-override
|
|
37
|
+
* regression in `model-registry.test.ts`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function mergeDiscoveredModel<TApi extends Api>(model: Model<TApi>, existing: Model<Api> | undefined, providerOverride?: Pick<ProviderOverride, "baseUrl" | "compat" | "headers" | "remoteCompaction" | "transport">): Model<TApi>;
|
|
40
|
+
export declare const AUTHORITATIVE_RUNTIME_CATALOG_PROVIDERS: Set<string>;
|
|
41
|
+
export declare function providersWithAuthoritativeProjectCatalog(models: readonly Model<Api>[]): Set<string>;
|
|
42
|
+
export declare function dropProviderModels(models: readonly Model<Api>[], providers: ReadonlySet<string>): Model<Api>[];
|
|
43
|
+
/**
|
|
44
|
+
* Merge `incoming` entries into a copy of `base`, keyed by `provider`+`id`.
|
|
45
|
+
* Matches are replaced with `combine(existing, entry)`; new entries are
|
|
46
|
+
* appended as `combine(undefined, entry)`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function mergeByModelKey<T extends {
|
|
49
|
+
provider: string;
|
|
50
|
+
id: string;
|
|
51
|
+
}>(base: readonly Model<Api>[], incoming: readonly T[], combine: (existing: Model<Api> | undefined, entry: T) => Model<Api>): Model<Api>[];
|
|
52
|
+
export declare function mergeCompat<TBase extends object, TOverride extends object>(baseCompat: TBase | null | undefined, overrideCompat: TOverride | null | undefined): (TBase & TOverride) | TBase | TOverride | undefined;
|
|
53
|
+
export declare function mergeRemoteCompactionConfig(baseConfig: RemoteCompactionConfig<Api> | undefined, overrideConfig: RemoteCompactionConfig<Api> | undefined): RemoteCompactionConfig<Api> | undefined;
|
|
54
|
+
export declare function mergeProviderRemoteCompactionConfig(modelConfig: RemoteCompactionConfig<Api> | undefined, providerConfig: RemoteCompactionConfig<Api> | undefined): RemoteCompactionConfig<Api> | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Project a built model back to spec shape for the model-manager/cache
|
|
57
|
+
* boundary: sparse compat comes from `compatConfig`, never from the resolved
|
|
58
|
+
* record.
|
|
59
|
+
*/
|
|
60
|
+
export declare function toModelSpec<TApi extends Api>(model: Model<TApi>): ModelSpec<TApi>;
|
|
61
|
+
/**
|
|
62
|
+
* The patchable subset of `Model` fields shared by `modelOverrides` entries,
|
|
63
|
+
* custom model definitions, and parsed custom-model overlays. `undefined`
|
|
64
|
+
* always means "leave the base value alone".
|
|
65
|
+
*/
|
|
66
|
+
export interface ModelPatch {
|
|
67
|
+
name?: string;
|
|
68
|
+
reasoning?: boolean;
|
|
69
|
+
thinking?: ThinkingConfig;
|
|
70
|
+
input?: ("text" | "image")[];
|
|
71
|
+
supportsTools?: boolean;
|
|
72
|
+
cost?: Partial<Model<Api>["cost"]>;
|
|
73
|
+
contextWindow?: number;
|
|
74
|
+
maxTokens?: number;
|
|
75
|
+
omitMaxOutputTokens?: boolean;
|
|
76
|
+
headers?: Record<string, string>;
|
|
77
|
+
compat?: ModelSpec<Api>["compat"];
|
|
78
|
+
contextPromotionTarget?: string;
|
|
79
|
+
compactionModel?: string;
|
|
80
|
+
remoteCompaction?: RemoteCompactionConfig<Api>;
|
|
81
|
+
premiumMultiplier?: number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* How a patch treats the base model's transport metadata (headers/compat):
|
|
85
|
+
* - `merge`: fold the patch into the base's (modelOverrides semantics).
|
|
86
|
+
* - `replace`: the patch owns transport wholesale — same-id custom definitions
|
|
87
|
+
* already folded provider-level headers/compat in during parsing, so bundled
|
|
88
|
+
* transport metadata must not be re-merged (see `#mergeCustomModels`).
|
|
89
|
+
*/
|
|
90
|
+
type ModelTransportPolicy = "merge" | "replace";
|
|
91
|
+
export declare function applyModelPatch(base: Model<Api>, patch: ModelPatch, transport: ModelTransportPolicy): Model<Api>;
|
|
92
|
+
export declare function applyModelOverride(model: Model<Api>, override: ModelOverride): Model<Api>;
|
|
93
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Api, Model } from "@oh-my-pi/pi-ai/types";
|
|
2
|
+
import { type OpenAICodexAccount } from "@oh-my-pi/pi-catalog/provider-models";
|
|
3
|
+
import type { AuthStorage, OAuthCredential } from "../session/auth-storage.js";
|
|
4
|
+
export declare const STARTUP_MODEL_CACHE_PROVIDER_IDS: readonly string[];
|
|
5
|
+
/**
|
|
6
|
+
* Hard bound for extension-provided fetchDynamicModels to prevent indefinite hangs
|
|
7
|
+
* during runtime provider discovery. Uses a cancellable manual timer (not AbortSignal.timeout)
|
|
8
|
+
* so a successful fast path does not leave an armed timeout signal for concurrent GC.
|
|
9
|
+
*/
|
|
10
|
+
export declare const RUNTIME_DYNAMIC_MODEL_FETCH_TIMEOUT_MS = 15000;
|
|
11
|
+
export declare const BUILT_IN_DISCOVERY_CACHE_TTL_MS: number;
|
|
12
|
+
export declare const BUILT_IN_DISCOVERY_NON_AUTHORITATIVE_RETRY_MS: number;
|
|
13
|
+
export declare const kNoAuth = "N/A";
|
|
14
|
+
export declare function isAuthenticated(apiKey: string | undefined | null): apiKey is string;
|
|
15
|
+
export declare function isDiscoveryBearerApiKey(apiKey: string | undefined | null): apiKey is string;
|
|
16
|
+
/**
|
|
17
|
+
* Wraps an extension-provided fetchDynamicModels call with a hard timeout.
|
|
18
|
+
* Uses a cancellable manual timer (not AbortSignal.timeout) so that a fast
|
|
19
|
+
* successful path does not leave an armed timeout signal for concurrent GC.
|
|
20
|
+
* The inner fetcher does not receive a signal (extension contract has none).
|
|
21
|
+
*/
|
|
22
|
+
export declare function withRuntimeDynamicModelsTimeout<T>(timeoutMs: number, run: () => Promise<T>): Promise<T>;
|
|
23
|
+
export interface BuiltInDiscoveryResult {
|
|
24
|
+
models: Model<Api>[];
|
|
25
|
+
authoritativeProviders: Set<string>;
|
|
26
|
+
}
|
|
27
|
+
export type ProviderDiscoveryStatus = "idle" | "ok" | "empty" | "cached" | "unavailable" | "unauthenticated";
|
|
28
|
+
export interface ProviderDiscoveryState {
|
|
29
|
+
provider: string;
|
|
30
|
+
status: ProviderDiscoveryStatus;
|
|
31
|
+
optional: boolean;
|
|
32
|
+
stale: boolean;
|
|
33
|
+
fetchedAt?: number;
|
|
34
|
+
models: string[];
|
|
35
|
+
error?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function extractGoogleOAuthToken(value: string | undefined): string | undefined;
|
|
38
|
+
export declare function getOAuthCredentialsForProvider(authStorage: AuthStorage, provider: string): OAuthCredential[];
|
|
39
|
+
/**
|
|
40
|
+
* Resolve every configured Codex OAuth account for catalog discovery, refreshing
|
|
41
|
+
* each credential exactly once. Codex `/models` is account-scoped, so discovery
|
|
42
|
+
* must fetch per account and union the results; resolving a single access token
|
|
43
|
+
* (as before) hid models available only through a sibling account (#6265).
|
|
44
|
+
*
|
|
45
|
+
* Returns `null` when any stored account fails to resolve (e.g. a transient
|
|
46
|
+
* refresh failure): the Codex manager is authoritative, so unioning only the
|
|
47
|
+
* accounts that resolved would cache a partial catalog and hide the failed
|
|
48
|
+
* account's models for the cache TTL. Aborting keeps the previous/bundled
|
|
49
|
+
* catalog instead.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveCodexDiscoveryAccounts(authStorage: AuthStorage, resolvedAccessToken: string): Promise<OpenAICodexAccount[] | null>;
|
|
@@ -1,60 +1,14 @@
|
|
|
1
|
+
import type { ApiKeyResolver, FetchImpl } from "@oh-my-pi/pi-ai";
|
|
2
|
+
import type { OAuthCredentials, OAuthLoginCallbacks } from "@oh-my-pi/pi-ai/oauth/types";
|
|
1
3
|
import type { Api, Context, Model, ModelSpec, RemoteCompactionConfig, SimpleStreamOptions, ThinkingConfig } from "@oh-my-pi/pi-ai/types";
|
|
2
4
|
import type { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream";
|
|
3
5
|
import { type ModelRefreshStrategy } from "@oh-my-pi/pi-catalog/model-manager";
|
|
4
|
-
import type { ApiKeyResolver, FetchImpl } from "@oh-my-pi/pi-ai";
|
|
5
|
-
import type { OAuthCredentials, OAuthLoginCallbacks } from "@oh-my-pi/pi-ai/oauth/types";
|
|
6
6
|
import type { AuthStorage } from "../session/auth-storage.js";
|
|
7
7
|
import { type ApiKeyResolverModel, type ApiKeyResolverOptions } from "./api-key-resolver.js";
|
|
8
8
|
import type { ConfigError } from "./config-file.js";
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
interface ProviderOverride {
|
|
13
|
-
baseUrl?: string;
|
|
14
|
-
headers?: Record<string, string>;
|
|
15
|
-
apiKey?: string;
|
|
16
|
-
authHeader?: boolean;
|
|
17
|
-
compat?: ModelSpec<Api>["compat"];
|
|
18
|
-
remoteCompaction?: RemoteCompactionConfig<Api>;
|
|
19
|
-
transport?: Model<Api>["transport"];
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Merge a freshly discovered model with the matching bundled/configured entry
|
|
23
|
-
* (or a runtime provider override when no bundled entry exists).
|
|
24
|
-
*
|
|
25
|
-
* `baseUrl` resolution priority:
|
|
26
|
-
* 1. User-set `providerOverride.baseUrl` (explicit override in models.json)
|
|
27
|
-
* 2. Discovered baseUrl (xiaomi `tp-` token-plan keys resolve to
|
|
28
|
-
* `token-plan-sgp.xiaomimimo.com` at discovery time)
|
|
29
|
-
* 3. Existing bundled baseUrl (the host baked into `models.json`)
|
|
30
|
-
*
|
|
31
|
-
* `transport` resolution priority:
|
|
32
|
-
* 1. `providerOverride.transport` (e.g. `pi-native` for auth-gateway users)
|
|
33
|
-
* 2. `existing.transport` (carried over from boot-time override application)
|
|
34
|
-
* 3. `model.transport` (rarely set — discovery defaults omit it)
|
|
35
|
-
*
|
|
36
|
-
* Without (1), the user's override would lose to discovery; without (2)
|
|
37
|
-
* preferred over (3), the bundled `api.xiaomimimo.com` would shadow the
|
|
38
|
-
* tp- token-plan host and produce 401s on the first stream call.
|
|
39
|
-
* Without explicit transport propagation, an openrouter (or any) entry
|
|
40
|
-
* marked `transport: pi-native` in models.yml silently reverts to the
|
|
41
|
-
* default openai-completions transport after the background catalog
|
|
42
|
-
* refresh — so the first `/model` switch after boot hits the raw OpenAI
|
|
43
|
-
* chat-completions URL instead of the gateway's `/v1/pi/stream` (#2555).
|
|
44
|
-
* See `xiaomi-tp-discovery-merge.test.ts` and the `refresh()` baseUrl-override
|
|
45
|
-
* regression in `model-registry.test.ts`.
|
|
46
|
-
*/
|
|
47
|
-
export declare function mergeDiscoveredModel<TApi extends Api>(model: Model<TApi>, existing: Model<Api> | undefined, providerOverride?: Pick<ProviderOverride, "baseUrl" | "compat" | "headers" | "remoteCompaction" | "transport">): Model<TApi>;
|
|
48
|
-
export type ProviderDiscoveryStatus = "idle" | "ok" | "empty" | "cached" | "unavailable" | "unauthenticated";
|
|
49
|
-
export interface ProviderDiscoveryState {
|
|
50
|
-
provider: string;
|
|
51
|
-
status: ProviderDiscoveryStatus;
|
|
52
|
-
optional: boolean;
|
|
53
|
-
stale: boolean;
|
|
54
|
-
fetchedAt?: number;
|
|
55
|
-
models: string[];
|
|
56
|
-
error?: string;
|
|
57
|
-
}
|
|
9
|
+
import { type ProviderDiscoveryState } from "./model-provider-discovery.js";
|
|
10
|
+
export { mergeDiscoveredModel } from "./model-patch.js";
|
|
11
|
+
export { isAuthenticated, kNoAuth, type ProviderDiscoveryState, type ProviderDiscoveryStatus, } from "./model-provider-discovery.js";
|
|
58
12
|
/** Authentication material returned to legacy extensions for one model request. */
|
|
59
13
|
export type ResolvedRequestAuth = {
|
|
60
14
|
ok: true;
|
|
@@ -227,6 +181,10 @@ export declare class ModelRegistry {
|
|
|
227
181
|
* Remove custom API/OAuth registrations for a specific extension source.
|
|
228
182
|
*/
|
|
229
183
|
clearSourceRegistrations(sourceId: string): void;
|
|
184
|
+
/**
|
|
185
|
+
* Remove one extension-registered provider and restore its static models.
|
|
186
|
+
*/
|
|
187
|
+
unregisterProvider(providerName: string): void;
|
|
230
188
|
/**
|
|
231
189
|
* Remove registrations for extension sources that are no longer active.
|
|
232
190
|
*/
|
|
@@ -311,4 +269,3 @@ export interface ProviderConfigInput {
|
|
|
311
269
|
premiumMultiplier?: number;
|
|
312
270
|
}>;
|
|
313
271
|
}
|
|
314
|
-
export {};
|
|
@@ -5981,17 +5981,7 @@ export declare const SETTINGS_SCHEMA: {
|
|
|
5981
5981
|
readonly tab: "providers";
|
|
5982
5982
|
readonly group: "Services";
|
|
5983
5983
|
readonly label: "Exa";
|
|
5984
|
-
readonly description: "
|
|
5985
|
-
};
|
|
5986
|
-
};
|
|
5987
|
-
readonly "exa.enableSearch": {
|
|
5988
|
-
readonly type: "boolean";
|
|
5989
|
-
readonly default: true;
|
|
5990
|
-
readonly ui: {
|
|
5991
|
-
readonly tab: "providers";
|
|
5992
|
-
readonly group: "Services";
|
|
5993
|
-
readonly label: "Exa Search";
|
|
5994
|
-
readonly description: "Enable Exa basic search, deep search, code search, and crawl tools";
|
|
5984
|
+
readonly description: "Enable the Exa web search provider";
|
|
5995
5985
|
};
|
|
5996
5986
|
};
|
|
5997
5987
|
readonly "exa.searchDelayMs": {
|
|
@@ -6004,26 +5994,6 @@ export declare const SETTINGS_SCHEMA: {
|
|
|
6004
5994
|
readonly description: "Minimum delay between Exa web search requests in milliseconds; set 0 to disable pacing";
|
|
6005
5995
|
};
|
|
6006
5996
|
};
|
|
6007
|
-
readonly "exa.enableResearcher": {
|
|
6008
|
-
readonly type: "boolean";
|
|
6009
|
-
readonly default: false;
|
|
6010
|
-
readonly ui: {
|
|
6011
|
-
readonly tab: "providers";
|
|
6012
|
-
readonly group: "Services";
|
|
6013
|
-
readonly label: "Exa Researcher";
|
|
6014
|
-
readonly description: "Enable the Exa researcher tool for AI-powered deep research";
|
|
6015
|
-
};
|
|
6016
|
-
};
|
|
6017
|
-
readonly "exa.enableWebsets": {
|
|
6018
|
-
readonly type: "boolean";
|
|
6019
|
-
readonly default: false;
|
|
6020
|
-
readonly ui: {
|
|
6021
|
-
readonly tab: "providers";
|
|
6022
|
-
readonly group: "Services";
|
|
6023
|
-
readonly label: "Exa Websets";
|
|
6024
|
-
readonly description: "Enable Exa webset management and enrichment tools";
|
|
6025
|
-
};
|
|
6026
|
-
};
|
|
6027
5997
|
readonly "searxng.endpoint": {
|
|
6028
5998
|
readonly type: "string";
|
|
6029
5999
|
readonly default: undefined;
|
|
@@ -6329,10 +6299,7 @@ export interface TtsrSettings {
|
|
|
6329
6299
|
}
|
|
6330
6300
|
export interface ExaSettings {
|
|
6331
6301
|
enabled: boolean;
|
|
6332
|
-
enableSearch: boolean;
|
|
6333
6302
|
searchDelayMs: number;
|
|
6334
|
-
enableResearcher: boolean;
|
|
6335
|
-
enableWebsets: boolean;
|
|
6336
6303
|
}
|
|
6337
6304
|
export interface StatusLineSettings {
|
|
6338
6305
|
preset: StatusLinePreset;
|
|
@@ -55,10 +55,12 @@ export declare class Settings {
|
|
|
55
55
|
*/
|
|
56
56
|
static loadIsolated(options?: SettingsOptions): Promise<Settings>;
|
|
57
57
|
/**
|
|
58
|
-
* Create an
|
|
59
|
-
*
|
|
58
|
+
* Create an in-memory settings instance without affecting the global singleton.
|
|
59
|
+
* A supplied storage handle remains shared for runtime data while setting overrides stay non-persistent.
|
|
60
60
|
*/
|
|
61
|
-
static isolated(overrides?: Partial<Record<SettingPath, unknown
|
|
61
|
+
static isolated(overrides?: Partial<Record<SettingPath, unknown>>, options?: {
|
|
62
|
+
storage?: AgentStorage | null;
|
|
63
|
+
}): Settings;
|
|
62
64
|
/**
|
|
63
65
|
* Get the global singleton.
|
|
64
66
|
* Throws if not initialized.
|
|
@@ -40,5 +40,14 @@ export declare class RawSseDebugBuffer {
|
|
|
40
40
|
recordEvent(event: RawSseEvent, model?: Model): void;
|
|
41
41
|
snapshot(): RawSseDebugSnapshot;
|
|
42
42
|
toRawText(): string;
|
|
43
|
+
/**
|
|
44
|
+
* Drop every retained record and reset accounting. Called from
|
|
45
|
+
* {@link AgentSession} teardown so a disposed (e.g. parked subagent) session
|
|
46
|
+
* stops pinning captured wire frames — each trimmed record holds a
|
|
47
|
+
* `slice()` of its parent SSE frame, which under JSC keeps the whole
|
|
48
|
+
* multi-MB frame alive. Notifies subscribers so a live debug viewer redraws
|
|
49
|
+
* empty.
|
|
50
|
+
*/
|
|
51
|
+
clear(): void;
|
|
43
52
|
}
|
|
44
53
|
export declare function resolveRawSseDebugBuffer(owner?: object): RawSseDebugBuffer;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/** Canonical `plugin.json` `$schema` identifier for Agent Plugins 1.0.0 (spec §5.2). */
|
|
2
|
+
export declare const AGENT_PLUGIN_MANIFEST_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json";
|
|
3
|
+
/** Canonical `mcp.json` `$schema` identifier for Agent Plugins 1.0.0 (spec §7.2.1). */
|
|
4
|
+
export declare const AGENT_PLUGIN_MCP_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json";
|
|
5
|
+
/** Validated portable manifest fields from a plugin's root `plugin.json` (spec §5). */
|
|
6
|
+
export interface AgentPluginManifest {
|
|
7
|
+
name: string;
|
|
8
|
+
version?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
author?: {
|
|
11
|
+
name?: string;
|
|
12
|
+
email?: string;
|
|
13
|
+
url?: string;
|
|
14
|
+
};
|
|
15
|
+
homepage?: string;
|
|
16
|
+
repository?: string;
|
|
17
|
+
license?: string;
|
|
18
|
+
keywords?: string[];
|
|
19
|
+
/**
|
|
20
|
+
* Client-owned data keyed by reverse-domain namespace. Member values are
|
|
21
|
+
* opaque: this client implements no namespace, and §8.1/§11.1 require
|
|
22
|
+
* ignoring unimplemented namespaces without validating their values.
|
|
23
|
+
*/
|
|
24
|
+
extensions?: Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Outcome of parsing a candidate `plugin.json`:
|
|
28
|
+
* - `none` — the document does not target Agent Plugins (no recognized `$schema`);
|
|
29
|
+
* legacy plugin conventions may still apply to the directory.
|
|
30
|
+
* - `valid` — a conformant manifest; `warnings` carries the non-fatal violations
|
|
31
|
+
* the spec requires reporting (unknown top-level fields, non-object `extensions`).
|
|
32
|
+
* - `invalid` — the document targets Agent Plugins but violates the closed schema
|
|
33
|
+
* fatally; the plugin must be rejected and none of its components loaded (spec §5.2).
|
|
34
|
+
*/
|
|
35
|
+
type AgentPluginManifestResult = {
|
|
36
|
+
status: "none";
|
|
37
|
+
} | {
|
|
38
|
+
status: "valid";
|
|
39
|
+
manifest: AgentPluginManifest;
|
|
40
|
+
warnings: string[];
|
|
41
|
+
} | {
|
|
42
|
+
status: "invalid";
|
|
43
|
+
reason: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Validate `SKILL.md` frontmatter against the Agent Skills specification
|
|
47
|
+
* (https://agentskills.io/specification), the source of truth for skill
|
|
48
|
+
* validity under Agent Plugins §7.1, mirroring the official skills-ref
|
|
49
|
+
* reference validator: the frontmatter schema is CLOSED to its six fields and
|
|
50
|
+
* any unexpected key rejects the skill. Returns the first violation, or `null`
|
|
51
|
+
* when the skill conforms. Frontmatter keys must be raw (unnormalized).
|
|
52
|
+
*/
|
|
53
|
+
export declare function validateAgentSkillFrontmatter(frontmatter: Record<string, unknown>, dirName: string): string | null;
|
|
54
|
+
/**
|
|
55
|
+
* Parse and validate a root `plugin.json` document against the closed
|
|
56
|
+
* Agent Plugins 1.0.0 manifest schema (spec §5.2–§5.5, §8.1).
|
|
57
|
+
*/
|
|
58
|
+
export declare function parseAgentPluginManifest(raw: string): AgentPluginManifestResult;
|
|
59
|
+
/** A validated `mcp.json` server entry, resolved to launch-ready values. */
|
|
60
|
+
interface AgentPluginMcpServer {
|
|
61
|
+
name: string;
|
|
62
|
+
transport: "stdio" | "http" | "sse";
|
|
63
|
+
/** Absolute path for `./`-relative commands; bare executable token otherwise. */
|
|
64
|
+
command?: string;
|
|
65
|
+
args?: string[];
|
|
66
|
+
/** Expanded configured env plus the client-supplied `PLUGIN_ROOT`/`PLUGIN_DATA`. */
|
|
67
|
+
env?: Record<string, string>;
|
|
68
|
+
/** Absolute working directory; defaults to the plugin root for stdio servers. */
|
|
69
|
+
cwd?: string;
|
|
70
|
+
url?: string;
|
|
71
|
+
headers?: Record<string, string>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Outcome of parsing a plugin's `mcp.json`:
|
|
75
|
+
* - `disabled` — the top-level document is invalid, so MCP is disabled for the
|
|
76
|
+
* plugin while other component types keep loading (spec §7.2.2 rule 2).
|
|
77
|
+
* - `ok` — the document is valid; individually invalid server entries are
|
|
78
|
+
* skipped with a warning (spec §7.2.2 rule 3).
|
|
79
|
+
*/
|
|
80
|
+
type AgentPluginMcpResult = {
|
|
81
|
+
status: "disabled";
|
|
82
|
+
reason: string;
|
|
83
|
+
} | {
|
|
84
|
+
status: "ok";
|
|
85
|
+
servers: AgentPluginMcpServer[];
|
|
86
|
+
warnings: string[];
|
|
87
|
+
};
|
|
88
|
+
interface AgentPluginMcpOptions {
|
|
89
|
+
/** Filesystem-resolved plugin root. */
|
|
90
|
+
pluginRoot: string;
|
|
91
|
+
/** Client-managed persistent data directory for this plugin (spec §9.1). */
|
|
92
|
+
pluginData: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Parse and validate a plugin's `mcp.json` against the closed Agent Plugins
|
|
96
|
+
* 1.0.0 MCP configuration (spec §7.2), resolving stdio commands and working
|
|
97
|
+
* directories against the plugin root and expanding plugin variables.
|
|
98
|
+
*/
|
|
99
|
+
export declare function parseAgentPluginMcp(raw: string, options: AgentPluginMcpOptions): Promise<AgentPluginMcpResult>;
|
|
100
|
+
/**
|
|
101
|
+
* Classification of a plugin root directory against the Agent Plugins standard:
|
|
102
|
+
* - `none` — no Agent Plugins manifest; legacy plugin conventions govern.
|
|
103
|
+
* - `standard` — a valid Agent Plugin; the standard governs its portable
|
|
104
|
+
* components (skills and MCP servers). `realRoot` is the filesystem-resolved
|
|
105
|
+
* plugin root every package path is contained within.
|
|
106
|
+
* - `invalid` — the root claims Agent Plugins conformance but its manifest is
|
|
107
|
+
* fatally invalid; no component may be discovered or executed (spec §11.3).
|
|
108
|
+
*/
|
|
109
|
+
type AgentPluginRootStatus = {
|
|
110
|
+
kind: "none";
|
|
111
|
+
} | {
|
|
112
|
+
kind: "standard";
|
|
113
|
+
manifest: AgentPluginManifest;
|
|
114
|
+
warnings: string[];
|
|
115
|
+
realRoot: string;
|
|
116
|
+
} | {
|
|
117
|
+
kind: "invalid";
|
|
118
|
+
reason: string;
|
|
119
|
+
};
|
|
120
|
+
/** Drop cached classifications (tests, or after plugin installs outside the shared registry flow). */
|
|
121
|
+
export declare function clearAgentPluginRootCache(): void;
|
|
122
|
+
/**
|
|
123
|
+
* Determine whether a plugin root is governed by the Agent Plugins standard.
|
|
124
|
+
* Results are cached per root path; the cache clears with the shared plugin
|
|
125
|
+
* roots cache and via {@link clearAgentPluginRootCache}.
|
|
126
|
+
*/
|
|
127
|
+
export declare function classifyAgentPluginRoot(rootPath: string): Promise<AgentPluginRootStatus>;
|
|
128
|
+
/**
|
|
129
|
+
* Whether a legacy plugin provider (claude-plugins, omp-plugins) may process a
|
|
130
|
+
* root for the given surface. Roots governed by the Agent Plugins standard keep
|
|
131
|
+
* their portable components (`skills`, `mcp`) exclusive to the standard loader,
|
|
132
|
+
* while client-specific surfaces (commands, hooks, tools, …) still load from
|
|
133
|
+
* hybrid packages. Fatally invalid Agent Plugins packages are rejected entirely.
|
|
134
|
+
*/
|
|
135
|
+
export declare function legacyProviderAllowed(rootPath: string, surface: "skills" | "mcp" | "other"): Promise<boolean>;
|
|
136
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|