@oh-my-pi/pi-coding-agent 17.2.9 → 17.2.11
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 +83 -0
- package/dist/{CHANGELOG-8yy8h3bc.md → CHANGELOG-d9xenpn9.md} +83 -0
- package/dist/cli.js +10208 -12596
- package/dist/types/capability/mcp.d.ts +11 -0
- package/dist/types/capability/skill.d.ts +6 -0
- package/dist/types/cli/args.d.ts +1 -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/model-registry.d.ts +4 -0
- package/dist/types/config/model-resolver.d.ts +13 -0
- package/dist/types/config/settings-schema.d.ts +1 -34
- package/dist/types/discovery/agent-plugin-format.d.ts +143 -0
- package/dist/types/discovery/agent-plugins.d.ts +1 -0
- package/dist/types/discovery/contained-path.d.ts +34 -0
- package/dist/types/discovery/index.d.ts +1 -0
- package/dist/types/extensibility/custom-commands/types.d.ts +5 -5
- package/dist/types/extensibility/custom-tools/types.d.ts +3 -3
- package/dist/types/extensibility/extensions/loader.d.ts +9 -2
- package/dist/types/extensibility/extensions/types.d.ts +45 -8
- package/dist/types/extensibility/hooks/types.d.ts +5 -5
- package/dist/types/extensibility/shared-events.d.ts +3 -2
- package/dist/types/extensibility/skills.d.ts +5 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/main.d.ts +1 -1
- package/dist/types/mcp/transports/header-policy.d.ts +45 -0
- package/dist/types/mcp/types.d.ts +15 -0
- package/dist/types/modes/acp/acp-agent.d.ts +1 -1
- package/dist/types/modes/acp/acp-client-bridge.d.ts +1 -1
- package/dist/types/modes/acp/acp-event-mapper.d.ts +1 -1
- package/dist/types/modes/acp/acp-mode.d.ts +1 -1
- package/dist/types/modes/components/agent-hub-projection.d.ts +38 -0
- package/dist/types/modes/components/agent-hub-renderer.d.ts +41 -0
- package/dist/types/modes/components/agent-hub.d.ts +14 -5
- 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/model-browser.d.ts +9 -1
- 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/interactive-mode.d.ts +8 -1
- package/dist/types/modes/utils/transcript-render-helpers.d.ts +3 -2
- package/dist/types/registry/agent-registry.d.ts +47 -0
- package/dist/types/registry/persisted-agents.d.ts +3 -1
- package/dist/types/secrets/index.d.ts +23 -1
- package/dist/types/session/agent-session-events.d.ts +2 -2
- package/dist/types/session/agent-session.d.ts +4 -2
- package/dist/types/session/messages.d.ts +1 -0
- package/dist/types/session/prewalk.d.ts +3 -1
- package/dist/types/session/session-entries.d.ts +10 -0
- package/dist/types/session/session-loader.d.ts +11 -1
- package/dist/types/session/session-manager.d.ts +9 -1
- package/dist/types/session/session-tools.d.ts +18 -1
- package/dist/types/session/turn-recovery.d.ts +7 -2
- package/dist/types/slash-commands/acp-builtins.d.ts +1 -1
- package/dist/types/slash-commands/available-commands.d.ts +1 -1
- package/dist/types/task/executor.d.ts +6 -0
- package/dist/types/task/index.d.ts +4 -3
- package/dist/types/task/read-only-policy.d.ts +3 -0
- package/dist/types/task/structured-subagent.d.ts +2 -0
- package/dist/types/task/types.d.ts +4 -0
- package/dist/types/tools/bash.d.ts +3 -3
- package/dist/types/tools/browser/launch.d.ts +2 -1
- package/dist/types/tools/browser/tab-worker.d.ts +2 -2
- package/dist/types/tools/path-utils.d.ts +1 -0
- package/dist/types/tools/read.d.ts +1 -5
- package/dist/types/tools/run-scope.d.ts +27 -1
- package/dist/types/tools/shell-tokenize.d.ts +16 -0
- package/dist/types/tools/terminal-output.d.ts +1 -1
- package/dist/types/utils/turndown.d.ts +1 -1
- package/dist/types/vibe/runtime.d.ts +2 -3
- package/dist/types/web/scrapers/readthedocs.d.ts +0 -3
- package/dist/types/web/search/providers/browser-headers.d.ts +2 -3
- package/examples/custom-tools/README.md +1 -1
- package/examples/extensions/README.md +1 -1
- package/examples/extensions/api-demo.ts +5 -6
- package/examples/extensions/chalk-logger.ts +1 -1
- package/examples/extensions/hello.ts +2 -2
- package/examples/extensions/reload-runtime.ts +1 -1
- package/examples/extensions/tools.ts +2 -2
- package/examples/extensions/with-deps/index.ts +1 -1
- package/examples/sdk/06-extensions.ts +1 -1
- package/package.json +15 -31
- package/scripts/bundle-dist.ts +1 -11
- package/scripts/legacy-pi-virtual-module.ts +4 -1
- package/src/advisor/runtime.ts +54 -0
- package/src/capability/mcp.ts +11 -0
- package/src/capability/skill.ts +6 -0
- package/src/cli/agents-cli.ts +1 -1
- package/src/cli/args.ts +24 -2
- package/src/cli/auth-broker-cli.ts +1 -1
- package/src/cli/auth-gateway-cli.ts +1 -1
- package/src/cli/bench-cli.ts +1 -1
- package/src/cli/claude-trace-cli.ts +1 -1
- package/src/cli/command-help.ts +4 -0
- package/src/cli/config-cli.ts +1 -1
- package/src/cli/dry-balance-cli.ts +1 -1
- package/src/cli/file-processor.ts +1 -1
- package/src/cli/flag-tables.ts +4 -0
- package/src/cli/gallery-cli.ts +1 -1
- package/src/cli/grep-cli.ts +1 -1
- package/src/cli/grievances-cli.ts +1 -1
- package/src/cli/help-extra.ts +1 -1
- package/src/cli/models-cli.ts +1 -1
- package/src/cli/plugin-cli.ts +1 -1
- package/src/cli/read-cli.ts +1 -1
- package/src/cli/setup-cli.ts +1 -1
- package/src/cli/shell-cli.ts +1 -1
- package/src/cli/ssh-cli.ts +1 -1
- package/src/cli/stats-cli.ts +1 -1
- package/src/cli/tiny-models-cli.ts +1 -1
- package/src/cli/ttsr-cli.ts +1 -1
- package/src/cli/update-cli.ts +1 -1
- package/src/cli/usage-cli.ts +1 -1
- package/src/cli/web-search-cli.ts +1 -1
- package/src/cli/worktree-cli.ts +1 -1
- package/src/cli-commands.ts +5 -0
- package/src/commands/commit.ts +16 -3
- package/src/commands/say.ts +1 -1
- package/src/commands/share.ts +71 -0
- package/src/commands/token.ts +1 -1
- package/src/commit/agentic/agent.ts +1 -1
- package/src/commit/agentic/index.ts +39 -21
- package/src/commit/cli.ts +1 -1
- package/src/commit/execute.ts +56 -0
- package/src/commit/index.ts +2 -1
- package/src/commit/pipeline.ts +20 -7
- package/src/config/model-discovery.ts +1 -1
- package/src/config/model-registry.ts +21 -1
- package/src/config/model-resolver.ts +54 -7
- package/src/config/settings-schema.ts +2 -33
- package/src/config/settings.ts +46 -0
- package/src/discovery/agent-plugin-format.ts +551 -0
- package/src/discovery/agent-plugins.ts +341 -0
- package/src/discovery/agents.ts +4 -2
- package/src/discovery/builtin-rules/ts-no-inline-cast-access.md +5 -4
- package/src/discovery/builtin-rules/ts-no-tiny-functions.md +1 -1
- package/src/discovery/claude-plugins.ts +21 -5
- package/src/discovery/contained-path.ts +78 -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/eval/py/runner.py +38 -1
- package/src/exec/non-interactive-env.ts +1 -0
- package/src/extensibility/custom-commands/loader.ts +4 -4
- package/src/extensibility/custom-commands/types.ts +5 -5
- package/src/extensibility/custom-tools/loader.ts +4 -4
- package/src/extensibility/custom-tools/types.ts +3 -3
- package/src/extensibility/extensions/loader.ts +85 -20
- package/src/extensibility/extensions/runner.ts +6 -0
- package/src/extensibility/extensions/types.ts +51 -8
- package/src/extensibility/hooks/loader.ts +4 -5
- package/src/extensibility/hooks/types.ts +5 -5
- package/src/extensibility/plugins/legacy-pi-compat.ts +53 -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/index.ts +2 -2
- package/src/internal-urls/memory-protocol.ts +5 -1
- 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/launch/terminal-output.ts +1 -1
- package/src/main.ts +88 -23
- package/src/markit/converters/docx.ts +1 -1
- package/src/markit/converters/epub.ts +1 -1
- package/src/markit/converters/pptx.ts +1 -1
- package/src/markit/converters/xlsx.ts +1 -1
- 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 +20 -9
- package/src/modes/acp/acp-client-bridge.ts +1 -1
- package/src/modes/acp/acp-event-mapper.ts +1 -1
- package/src/modes/acp/acp-mode.ts +1 -1
- package/src/modes/components/agent-dashboard.ts +2 -0
- package/src/modes/components/agent-hub-projection.ts +248 -0
- package/src/modes/components/agent-hub-renderer.ts +194 -0
- package/src/modes/components/agent-hub.ts +674 -207
- package/src/modes/components/agent-transcript-viewer.ts +3 -0
- package/src/modes/components/assistant-message.ts +1 -1
- package/src/modes/components/chat-transcript-builder.ts +3 -0
- package/src/modes/components/custom-editor.ts +0 -9
- package/src/modes/components/extensions/inspector-panel.ts +11 -6
- package/src/modes/components/footer.ts +1 -3
- package/src/modes/components/model-browser.ts +11 -3
- package/src/modes/components/model-hub.ts +4 -1
- package/src/modes/components/status-line/component.ts +1 -0
- package/src/modes/components/status-line/segments.ts +10 -7
- 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 +4 -1
- package/src/modes/controllers/event-controller.ts +44 -20
- package/src/modes/controllers/extension-ui-controller.ts +2 -2
- package/src/modes/controllers/input-controller.ts +20 -2
- package/src/modes/controllers/mcp-command-controller.ts +81 -20
- package/src/modes/controllers/selector-controller.ts +41 -49
- package/src/modes/controllers/streaming-reveal.ts +1 -1
- package/src/modes/interactive-mode.ts +13 -2
- package/src/modes/rpc/rpc-mode.ts +2 -2
- package/src/modes/runtime-init.ts +1 -1
- package/src/modes/theme/theme.ts +2 -2
- package/src/modes/utils/transcript-render-helpers.ts +4 -2
- package/src/modes/utils/ui-helpers.ts +1 -0
- package/src/prompts/tools/computer.md +1 -1
- package/src/registry/agent-lifecycle.ts +14 -7
- package/src/registry/agent-registry.ts +65 -2
- package/src/registry/persisted-agents.ts +341 -16
- package/src/sdk.ts +6 -49
- package/src/secrets/index.ts +52 -1
- package/src/session/agent-session-events.ts +2 -2
- package/src/session/agent-session.ts +54 -16
- package/src/session/messages.ts +1 -0
- package/src/session/prewalk.ts +57 -17
- package/src/session/session-context.ts +3 -5
- package/src/session/session-entries.ts +10 -0
- package/src/session/session-handoff.ts +5 -1
- package/src/session/session-listing.ts +1 -1
- package/src/session/session-loader.ts +74 -8
- package/src/session/session-manager.ts +22 -2
- package/src/session/session-paths.ts +57 -9
- package/src/session/session-tools.ts +65 -4
- package/src/session/todo-tracker.ts +11 -1
- package/src/session/turn-recovery.ts +96 -74
- package/src/slash-commands/acp-builtins.ts +1 -1
- package/src/slash-commands/available-commands.ts +1 -1
- package/src/slash-commands/builtin-registry.ts +12 -8
- package/src/task/executor.ts +70 -20
- package/src/task/index.ts +30 -34
- package/src/task/isolation-runner.ts +24 -11
- package/src/task/persisted-revive.ts +12 -5
- package/src/task/read-only-policy.ts +27 -0
- package/src/task/structured-subagent.ts +14 -4
- package/src/task/types.ts +4 -0
- package/src/tools/auto-generated-guard.ts +1 -1
- package/src/tools/bash-interactive.ts +4 -4
- package/src/tools/bash-skill-urls.ts +15 -0
- package/src/tools/bash.ts +16 -17
- package/src/tools/browser/cmux/cmux-tab.ts +66 -18
- package/src/tools/browser/launch.ts +41 -12
- package/src/tools/browser/readable.ts +9 -9
- package/src/tools/browser/tab-supervisor.ts +12 -3
- package/src/tools/browser/tab-worker-entry.ts +1 -1
- package/src/tools/browser/tab-worker.ts +101 -12
- package/src/tools/debug.ts +1 -1
- package/src/tools/fetch.ts +1 -1
- package/src/tools/jtd-to-json-schema.ts +123 -21
- package/src/tools/path-utils.ts +9 -2
- package/src/tools/read.ts +21 -9
- package/src/tools/run-scope.ts +290 -4
- package/src/tools/shell-tokenize.ts +98 -0
- package/src/tools/terminal-output.ts +1 -1
- package/src/tools/todo.ts +1 -1
- package/src/utils/clipboard.ts +10 -2
- package/src/utils/external-editor.ts +4 -2
- package/src/utils/jj.ts +1 -1
- package/src/utils/turndown.ts +1 -2
- package/src/vibe/runtime.ts +5 -5
- package/src/web/scrapers/arxiv.ts +1 -1
- package/src/web/scrapers/go-pkg.ts +1 -1
- package/src/web/scrapers/iacr.ts +1 -1
- package/src/web/scrapers/readthedocs.ts +2 -1
- package/src/web/scrapers/twitter.ts +2 -2
- package/src/web/scrapers/types.ts +1 -1
- package/src/web/scrapers/wikipedia.ts +1 -1
- package/src/web/search/providers/browser-headers.ts +12 -39
- package/src/web/search/providers/codex.ts +3 -26
- package/src/web/search/providers/ecosia.ts +1 -1
- package/src/web/search/providers/exa.ts +1 -1
- package/src/web/search/providers/google.ts +1 -1
- package/src/web/search/providers/mojeek.ts +1 -1
- package/src/web/search/providers/startpage.ts +1 -1
- package/src/markit/converters/mammoth.d.ts +0 -24
|
@@ -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 */
|
package/dist/types/cli/args.d.ts
CHANGED
|
@@ -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
|
+
}>;
|
|
@@ -227,6 +227,10 @@ export declare class ModelRegistry {
|
|
|
227
227
|
* Remove custom API/OAuth registrations for a specific extension source.
|
|
228
228
|
*/
|
|
229
229
|
clearSourceRegistrations(sourceId: string): void;
|
|
230
|
+
/**
|
|
231
|
+
* Remove one extension-registered provider and restore its static models.
|
|
232
|
+
*/
|
|
233
|
+
unregisterProvider(providerName: string): void;
|
|
230
234
|
/**
|
|
231
235
|
* Remove registrations for extension sources that are no longer active.
|
|
232
236
|
*/
|
|
@@ -97,18 +97,31 @@ export declare function parseModelPattern(pattern: string, availableModels: Mode
|
|
|
97
97
|
export interface ModelRoleLookup {
|
|
98
98
|
getModelRole(role: ModelRole | string): string | undefined;
|
|
99
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Extract the first explicit model-role alias from a raw model selection.
|
|
102
|
+
*
|
|
103
|
+
* This intentionally runs before role expansion so callers can retain the
|
|
104
|
+
* source identity (`@smol`, `pi/slow`, or `*`) even when it resolves to a
|
|
105
|
+
* concrete provider/model or inherited fallback. Bare role names and explicit
|
|
106
|
+
* provider/model selectors are not role aliases.
|
|
107
|
+
*/
|
|
108
|
+
export declare function resolveExplicitModelRole(value: string | string[] | undefined, settings?: ModelRoleLookup): string | undefined;
|
|
100
109
|
/**
|
|
101
110
|
* Expand a role alias like "@smol" to the configured model string.
|
|
102
111
|
*/
|
|
103
112
|
export declare function expandRoleAlias(value: string, settings?: ModelRoleLookup): string;
|
|
104
113
|
export declare function resolveConfiguredModelPatterns(value: string | string[] | undefined, settings?: ModelRoleLookup): string[];
|
|
105
114
|
export interface AgentModelPatternResolutionOptions {
|
|
115
|
+
/** Highest-priority request selector, when supplied by a caller. */
|
|
116
|
+
requestModel?: string | string[];
|
|
106
117
|
settingsOverride?: string | string[];
|
|
107
118
|
agentModel?: string | string[];
|
|
108
119
|
settings?: Settings;
|
|
109
120
|
activeModelPattern?: string;
|
|
110
121
|
fallbackModelPattern?: string;
|
|
111
122
|
}
|
|
123
|
+
/** Return the raw selector source that supplies the effective agent patterns. */
|
|
124
|
+
export declare function resolveAgentModelSource(options: AgentModelPatternResolutionOptions): string | string[] | undefined;
|
|
112
125
|
export declare function resolveAgentModelPatterns(options: AgentModelPatternResolutionOptions): string[];
|
|
113
126
|
/** Default prewalk hand-off target when no explicit target is configured. */
|
|
114
127
|
export declare const DEFAULT_PREWALK_TARGET = "@smol";
|
|
@@ -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;
|
|
@@ -0,0 +1,143 @@
|
|
|
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
|
+
export type AgentPluginManifestResult = {
|
|
36
|
+
status: "none";
|
|
37
|
+
} | {
|
|
38
|
+
status: "valid";
|
|
39
|
+
manifest: AgentPluginManifest;
|
|
40
|
+
warnings: string[];
|
|
41
|
+
} | {
|
|
42
|
+
status: "invalid";
|
|
43
|
+
reason: string;
|
|
44
|
+
};
|
|
45
|
+
/** Enforce the plugin `name` constraints from spec §5.5. */
|
|
46
|
+
export declare function isValidAgentPluginName(name: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Validate `SKILL.md` frontmatter against the Agent Skills specification
|
|
49
|
+
* (https://agentskills.io/specification), the source of truth for skill
|
|
50
|
+
* validity under Agent Plugins §7.1, mirroring the official skills-ref
|
|
51
|
+
* reference validator: the frontmatter schema is CLOSED to its six fields and
|
|
52
|
+
* any unexpected key rejects the skill. Returns the first violation, or `null`
|
|
53
|
+
* when the skill conforms. Frontmatter keys must be raw (unnormalized).
|
|
54
|
+
*/
|
|
55
|
+
export declare function validateAgentSkillFrontmatter(frontmatter: Record<string, unknown>, dirName: string): string | null;
|
|
56
|
+
/**
|
|
57
|
+
* Parse and validate a root `plugin.json` document against the closed
|
|
58
|
+
* Agent Plugins 1.0.0 manifest schema (spec §5.2–§5.5, §8.1).
|
|
59
|
+
*/
|
|
60
|
+
export declare function parseAgentPluginManifest(raw: string): AgentPluginManifestResult;
|
|
61
|
+
/**
|
|
62
|
+
* Expand `${PLUGIN_ROOT}` and `${PLUGIN_DATA}` in a configuration value
|
|
63
|
+
* (spec §9.2). Single non-recursive pass; replacement text is never rescanned,
|
|
64
|
+
* and no other placeholder or environment-variable expansion is performed.
|
|
65
|
+
*/
|
|
66
|
+
export declare function expandAgentPluginPlaceholders(value: string, pluginRoot: string, pluginData: string): string;
|
|
67
|
+
/** A validated `mcp.json` server entry, resolved to launch-ready values. */
|
|
68
|
+
export interface AgentPluginMcpServer {
|
|
69
|
+
name: string;
|
|
70
|
+
transport: "stdio" | "http" | "sse";
|
|
71
|
+
/** Absolute path for `./`-relative commands; bare executable token otherwise. */
|
|
72
|
+
command?: string;
|
|
73
|
+
args?: string[];
|
|
74
|
+
/** Expanded configured env plus the client-supplied `PLUGIN_ROOT`/`PLUGIN_DATA`. */
|
|
75
|
+
env?: Record<string, string>;
|
|
76
|
+
/** Absolute working directory; defaults to the plugin root for stdio servers. */
|
|
77
|
+
cwd?: string;
|
|
78
|
+
url?: string;
|
|
79
|
+
headers?: Record<string, string>;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Outcome of parsing a plugin's `mcp.json`:
|
|
83
|
+
* - `disabled` — the top-level document is invalid, so MCP is disabled for the
|
|
84
|
+
* plugin while other component types keep loading (spec §7.2.2 rule 2).
|
|
85
|
+
* - `ok` — the document is valid; individually invalid server entries are
|
|
86
|
+
* skipped with a warning (spec §7.2.2 rule 3).
|
|
87
|
+
*/
|
|
88
|
+
export type AgentPluginMcpResult = {
|
|
89
|
+
status: "disabled";
|
|
90
|
+
reason: string;
|
|
91
|
+
} | {
|
|
92
|
+
status: "ok";
|
|
93
|
+
servers: AgentPluginMcpServer[];
|
|
94
|
+
warnings: string[];
|
|
95
|
+
};
|
|
96
|
+
export interface AgentPluginMcpOptions {
|
|
97
|
+
/** Filesystem-resolved plugin root. */
|
|
98
|
+
pluginRoot: string;
|
|
99
|
+
/** Client-managed persistent data directory for this plugin (spec §9.1). */
|
|
100
|
+
pluginData: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Parse and validate a plugin's `mcp.json` against the closed Agent Plugins
|
|
104
|
+
* 1.0.0 MCP configuration (spec §7.2), resolving stdio commands and working
|
|
105
|
+
* directories against the plugin root and expanding plugin variables.
|
|
106
|
+
*/
|
|
107
|
+
export declare function parseAgentPluginMcp(raw: string, options: AgentPluginMcpOptions): Promise<AgentPluginMcpResult>;
|
|
108
|
+
/**
|
|
109
|
+
* Classification of a plugin root directory against the Agent Plugins standard:
|
|
110
|
+
* - `none` — no Agent Plugins manifest; legacy plugin conventions govern.
|
|
111
|
+
* - `standard` — a valid Agent Plugin; the standard governs its portable
|
|
112
|
+
* components (skills and MCP servers). `realRoot` is the filesystem-resolved
|
|
113
|
+
* plugin root every package path is contained within.
|
|
114
|
+
* - `invalid` — the root claims Agent Plugins conformance but its manifest is
|
|
115
|
+
* fatally invalid; no component may be discovered or executed (spec §11.3).
|
|
116
|
+
*/
|
|
117
|
+
export type AgentPluginRootStatus = {
|
|
118
|
+
kind: "none";
|
|
119
|
+
} | {
|
|
120
|
+
kind: "standard";
|
|
121
|
+
manifest: AgentPluginManifest;
|
|
122
|
+
warnings: string[];
|
|
123
|
+
realRoot: string;
|
|
124
|
+
} | {
|
|
125
|
+
kind: "invalid";
|
|
126
|
+
reason: string;
|
|
127
|
+
};
|
|
128
|
+
/** Drop cached classifications (tests, or after plugin installs outside the shared registry flow). */
|
|
129
|
+
export declare function clearAgentPluginRootCache(): void;
|
|
130
|
+
/**
|
|
131
|
+
* Determine whether a plugin root is governed by the Agent Plugins standard.
|
|
132
|
+
* Results are cached per root path; the cache clears with the shared plugin
|
|
133
|
+
* roots cache and via {@link clearAgentPluginRootCache}.
|
|
134
|
+
*/
|
|
135
|
+
export declare function classifyAgentPluginRoot(rootPath: string): Promise<AgentPluginRootStatus>;
|
|
136
|
+
/**
|
|
137
|
+
* Whether a legacy plugin provider (claude-plugins, omp-plugins) may process a
|
|
138
|
+
* root for the given surface. Roots governed by the Agent Plugins standard keep
|
|
139
|
+
* their portable components (`skills`, `mcp`) exclusive to the standard loader,
|
|
140
|
+
* while client-specific surfaces (commands, hooks, tools, …) still load from
|
|
141
|
+
* hybrid packages. Fatally invalid Agent Plugins packages are rejected entirely.
|
|
142
|
+
*/
|
|
143
|
+
export declare function legacyProviderAllowed(rootPath: string, surface: "skills" | "mcp" | "other"): Promise<boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Lexical containment: `target` is `base` itself or a descendant of it. */
|
|
2
|
+
export declare function isContained(base: string, target: string): boolean;
|
|
3
|
+
/** Resolve symlinks and equivalents; `null` when the path is missing or unresolvable. */
|
|
4
|
+
export declare function realpathIfExists(p: string): Promise<string | null>;
|
|
5
|
+
/** Outcome of resolving a fixed package path without reading it. */
|
|
6
|
+
export type ContainedPathResolution = {
|
|
7
|
+
status: "missing";
|
|
8
|
+
} | {
|
|
9
|
+
status: "outside";
|
|
10
|
+
} | {
|
|
11
|
+
status: "ok";
|
|
12
|
+
realPath: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Resolve a fixed package path WITHOUT reading it: symlinks and equivalent
|
|
16
|
+
* mechanisms are resolved first, and a path escaping the filesystem-resolved
|
|
17
|
+
* plugin root is rejected before any I/O could consume outside content.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveContainedPath(realBase: string, target: string): Promise<ContainedPathResolution>;
|
|
20
|
+
/**
|
|
21
|
+
* Verify a package path stays within the filesystem-resolved plugin root:
|
|
22
|
+
* lexically, and — when the target exists — after resolving symlinks. Unlike
|
|
23
|
+
* {@link resolveContainedPath}, a missing target passes. ONLY for configured
|
|
24
|
+
* paths that are validated but never read or executed at load time (stdio
|
|
25
|
+
* `command`, `cwd` — including `${PLUGIN_DATA}` paths created after
|
|
26
|
+
* validation); access paths MUST use {@link resolveContainedPath} instead,
|
|
27
|
+
* which fails closed on unresolvable targets.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isContainedResolved(realBase: string, target: string): Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* Sync variant of {@link resolveContainedPath} for synchronous callsites
|
|
32
|
+
* (bash `skill://` expansion).
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveContainedPathSync(realBase: string, target: string): ContainedPathResolution;
|
|
@@ -18,6 +18,7 @@ import "../capability/slash-command.js";
|
|
|
18
18
|
import "../capability/ssh.js";
|
|
19
19
|
import "../capability/system-prompt.js";
|
|
20
20
|
import "../capability/tool.js";
|
|
21
|
+
import "./agent-plugins.js";
|
|
21
22
|
import "./agents-md.js";
|
|
22
23
|
import "./builtin.js";
|
|
23
24
|
import "./builtin-defaults.js";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Unlike markdown commands which expand to prompts, custom commands can execute
|
|
6
6
|
* arbitrary logic with full access to the hook context.
|
|
7
7
|
*/
|
|
8
|
-
import type
|
|
8
|
+
import type { type as ArkType } from "@oh-my-pi/omptype";
|
|
9
9
|
import type * as TypeBox from "@oh-my-pi/omptype/typebox";
|
|
10
10
|
import type * as zod from "@oh-my-pi/omptype/zod";
|
|
11
11
|
import type { ExecOptions, ExecResult, HookCommandContext } from "../../extensibility/hooks/types.js";
|
|
@@ -20,11 +20,11 @@ export interface CustomCommandAPI {
|
|
|
20
20
|
cwd: string;
|
|
21
21
|
/** Execute a shell command */
|
|
22
22
|
exec(command: string, args: string[], options?: ExecOptions): Promise<ExecResult>;
|
|
23
|
-
/** Injected
|
|
23
|
+
/** Injected TypeBox shim (legacy/compat). */
|
|
24
24
|
typebox: typeof TypeBox;
|
|
25
|
-
/** Injected
|
|
26
|
-
arktype: typeof
|
|
27
|
-
/** Injected
|
|
25
|
+
/** Injected omptype schema builder for custom commands. */
|
|
26
|
+
arktype: typeof ArkType;
|
|
27
|
+
/** Injected Zod-compatible omptype builder for custom commands. */
|
|
28
28
|
zod: typeof zod;
|
|
29
29
|
/** Injected pi-coding-agent exports */
|
|
30
30
|
pi: typeof PiCodingAgent;
|
|
@@ -22,7 +22,7 @@ import type { LocalProtocolOptions } from "../../internal-urls/local-protocol.js
|
|
|
22
22
|
import type { Theme } from "../../modes/theme/theme.js";
|
|
23
23
|
import type { ReadonlySessionManager } from "../../session/session-manager.js";
|
|
24
24
|
import type { TodoItem } from "../../tools/todo.js";
|
|
25
|
-
import type {
|
|
25
|
+
import type { RetryErrorUpdate } from "../shared-events.js";
|
|
26
26
|
/** Alias for clarity */
|
|
27
27
|
export type CustomToolUIContext = HookUIContext;
|
|
28
28
|
export type { ExecOptions, ExecResult } from "../../exec/exec.js";
|
|
@@ -57,7 +57,7 @@ export interface CustomToolAPI {
|
|
|
57
57
|
typebox: typeof TypeBox;
|
|
58
58
|
/** Injected arktype module for arktype-authored custom tools. */
|
|
59
59
|
arktype: typeof ArkType;
|
|
60
|
-
/** Injected
|
|
60
|
+
/** Injected Zod-compatible omptype builder for custom tools. */
|
|
61
61
|
zod: typeof zod;
|
|
62
62
|
/** Injected pi-coding-agent exports */
|
|
63
63
|
pi: typeof PiCodingAgent;
|
|
@@ -119,7 +119,7 @@ export type CustomToolSessionEvent = {
|
|
|
119
119
|
success: boolean;
|
|
120
120
|
attempt: number;
|
|
121
121
|
finalError?: string;
|
|
122
|
-
|
|
122
|
+
retryErrors?: RetryErrorUpdate[];
|
|
123
123
|
} | {
|
|
124
124
|
reason: "ttsr_triggered";
|
|
125
125
|
rules: Rule[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
|
2
2
|
import type { ServiceTierByFamily } from "@oh-my-pi/pi-ai";
|
|
3
3
|
import { EventBus } from "../../utils/event-bus.js";
|
|
4
|
-
import type { Extension, ExtensionFactory, ExtensionRuntime as IExtensionRuntime, LoadExtensionsResult, ProviderConfig } from "./types.js";
|
|
4
|
+
import type { Extension, ExtensionFactory, ExtensionRuntime as IExtensionRuntime, LoadExtensionsResult, ProviderConfig, ToolInfo } from "./types.js";
|
|
5
5
|
export declare class ExtensionRuntimeNotInitializedError extends Error {
|
|
6
6
|
constructor();
|
|
7
7
|
}
|
|
@@ -16,12 +16,14 @@ export declare class ExtensionRuntime implements IExtensionRuntime {
|
|
|
16
16
|
config: ProviderConfig;
|
|
17
17
|
sourceId: string;
|
|
18
18
|
}>;
|
|
19
|
+
registerProvider(name: string, config: ProviderConfig, sourceId: string): void;
|
|
20
|
+
unregisterProvider(name: string): void;
|
|
19
21
|
sendMessage(): void;
|
|
20
22
|
sendUserMessage(): void;
|
|
21
23
|
appendEntry(): void;
|
|
22
24
|
setLabel(): void;
|
|
23
25
|
getActiveTools(): string[];
|
|
24
|
-
getAllTools():
|
|
26
|
+
getAllTools(): ToolInfo[];
|
|
25
27
|
setActiveTools(): Promise<void>;
|
|
26
28
|
getCommands(): never;
|
|
27
29
|
setModel(): Promise<boolean>;
|
|
@@ -38,6 +40,11 @@ export declare class ExtensionRuntime implements IExtensionRuntime {
|
|
|
38
40
|
export declare function loadExtensionFromFactory(factory: ExtensionFactory, cwd: string, eventBus: EventBus, runtime: IExtensionRuntime, name?: string): Promise<Extension>;
|
|
39
41
|
/**
|
|
40
42
|
* Load extensions from paths.
|
|
43
|
+
*
|
|
44
|
+
* Module import (the dominant cold-start cost — file I/O plus module
|
|
45
|
+
* evaluation) runs concurrently across extensions; factory binding then runs
|
|
46
|
+
* sequentially in the original path order, so registration semantics
|
|
47
|
+
* (last-wins collisions, shared runtime flag defaults) stay deterministic.
|
|
41
48
|
*/
|
|
42
49
|
export declare function loadExtensions(paths: string[], cwd: string, eventBus?: EventBus): Promise<LoadExtensionsResult>;
|
|
43
50
|
/**
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - Register commands, keyboard shortcuts, and CLI flags
|
|
8
8
|
* - Interact with the user via UI primitives
|
|
9
9
|
*/
|
|
10
|
-
import type {
|
|
10
|
+
import type { type as ArkType } from "@oh-my-pi/omptype";
|
|
11
11
|
import type * as TypeBox from "@oh-my-pi/omptype/typebox";
|
|
12
12
|
import type * as zod from "@oh-my-pi/omptype/zod";
|
|
13
13
|
import type { AgentMessage, AgentToolResult, AgentToolUpdateCallback, ThinkingLevel, ToolApproval, ToolLoadMode } from "@oh-my-pi/pi-agent-core";
|
|
@@ -432,6 +432,32 @@ export interface ToolDefinition<TParams extends TSchema = TSchema, TDetails = un
|
|
|
432
432
|
/** Custom rendering for tool result display */
|
|
433
433
|
renderResult?: (result: AgentToolResult<TDetails>, options: ToolRenderResultOptions, theme: Theme, args?: Static<TParams>) => Component;
|
|
434
434
|
}
|
|
435
|
+
/** Whether a tool's source is scoped to the user, the project, or a transient runtime session. */
|
|
436
|
+
export type SourceScope = "user" | "project" | "temporary";
|
|
437
|
+
/** Whether a tool's source came from an installed package or a top-level (loose) file. */
|
|
438
|
+
export type SourceOrigin = "package" | "top-level";
|
|
439
|
+
/**
|
|
440
|
+
* Provenance metadata describing where a registered tool came from. Mirrors the
|
|
441
|
+
* `@earendil-works/pi-coding-agent` `SourceInfo` contract so extensions authored
|
|
442
|
+
* against upstream pi (e.g. gentle-pi) can read `sourceInfo.source` unchanged.
|
|
443
|
+
*/
|
|
444
|
+
export interface SourceInfo {
|
|
445
|
+
/** Synthetic or on-disk identifier for the tool's origin (e.g. `<builtin:read>`). */
|
|
446
|
+
path: string;
|
|
447
|
+
/** Origin class: `"builtin"`, `"sdk"`, `"mcp"`, or `"extension"`. */
|
|
448
|
+
source: string;
|
|
449
|
+
scope: SourceScope;
|
|
450
|
+
origin: SourceOrigin;
|
|
451
|
+
baseDir?: string;
|
|
452
|
+
}
|
|
453
|
+
/** Tool metadata returned by {@link ExtensionAPI.getAllTools}: identity, schema, and source provenance. */
|
|
454
|
+
export interface ToolInfo {
|
|
455
|
+
name: string;
|
|
456
|
+
description: string;
|
|
457
|
+
parameters: TSchema;
|
|
458
|
+
promptGuidelines?: string[];
|
|
459
|
+
sourceInfo: SourceInfo;
|
|
460
|
+
}
|
|
435
461
|
/** Fired after session_start to allow extensions to provide additional resource paths. */
|
|
436
462
|
export interface ResourcesDiscoverEvent {
|
|
437
463
|
type: "resources_discover";
|
|
@@ -736,11 +762,11 @@ export type ExtensionServiceTier<Family extends ServiceTierFamily> = Family exte
|
|
|
736
762
|
export interface ExtensionAPI {
|
|
737
763
|
/** File logger for error/warning/debug messages */
|
|
738
764
|
logger: typeof PiLogger;
|
|
739
|
-
/** Injected
|
|
765
|
+
/** Injected TypeBox shim for legacy `Type.Object(...)` parameter authoring. */
|
|
740
766
|
typebox: typeof TypeBox;
|
|
741
|
-
/** Injected
|
|
742
|
-
arktype: typeof
|
|
743
|
-
/** Injected
|
|
767
|
+
/** Injected omptype schema builder for extension tools. */
|
|
768
|
+
arktype: typeof ArkType;
|
|
769
|
+
/** Injected Zod-compatible omptype builder for extension tools. */
|
|
744
770
|
zod: typeof zod;
|
|
745
771
|
/** Injected pi-coding-agent exports for accessing SDK utilities */
|
|
746
772
|
pi: typeof PiCodingAgent;
|
|
@@ -835,8 +861,8 @@ export interface ExtensionAPI {
|
|
|
835
861
|
exec(command: string, args: string[], options?: ExecOptions): Promise<ExecResult>;
|
|
836
862
|
/** Get the list of currently active tool names. */
|
|
837
863
|
getActiveTools(): string[];
|
|
838
|
-
/** Get all configured tools (built-in + extension tools). */
|
|
839
|
-
getAllTools():
|
|
864
|
+
/** Get all configured tools (built-in + extension tools) with schema and source metadata. */
|
|
865
|
+
getAllTools(): ToolInfo[];
|
|
840
866
|
/** Set the active tools by name. */
|
|
841
867
|
setActiveTools(toolNames: string[]): Promise<void>;
|
|
842
868
|
/** Get available slash commands in the current session. */
|
|
@@ -892,6 +918,13 @@ export interface ExtensionAPI {
|
|
|
892
918
|
* });
|
|
893
919
|
*/
|
|
894
920
|
registerProvider(name: string, config: ProviderConfig): void;
|
|
921
|
+
/**
|
|
922
|
+
* Unregister a provider previously registered by an extension.
|
|
923
|
+
*
|
|
924
|
+
* Removes extension-provided models and restores overridden built-in models.
|
|
925
|
+
* Has no effect when the provider is not registered.
|
|
926
|
+
*/
|
|
927
|
+
unregisterProvider(name: string): void;
|
|
895
928
|
/** Shared event bus for extension communication. */
|
|
896
929
|
events: EventBus;
|
|
897
930
|
}
|
|
@@ -999,7 +1032,7 @@ export type SendUserMessageHandler = (content: string | (TextContent | ImageCont
|
|
|
999
1032
|
}) => void;
|
|
1000
1033
|
export type AppendEntryHandler = <T = unknown>(customType: string, data?: T) => void;
|
|
1001
1034
|
export type GetActiveToolsHandler = () => string[];
|
|
1002
|
-
export type GetAllToolsHandler = () =>
|
|
1035
|
+
export type GetAllToolsHandler = () => ToolInfo[];
|
|
1003
1036
|
export type GetCommandsHandler = () => SlashCommandInfo[];
|
|
1004
1037
|
export type SetActiveToolsHandler = (toolNames: string[]) => Promise<void>;
|
|
1005
1038
|
export type SetModelHandler = (model: Model) => Promise<boolean>;
|
|
@@ -1016,6 +1049,10 @@ export interface ExtensionRuntimeState {
|
|
|
1016
1049
|
config: ProviderConfig;
|
|
1017
1050
|
sourceId: string;
|
|
1018
1051
|
}>;
|
|
1052
|
+
/** Queue a provider registration until initialization, then apply it immediately. */
|
|
1053
|
+
registerProvider(name: string, config: ProviderConfig, sourceId: string): void;
|
|
1054
|
+
/** Remove a queued or initialized provider registration. */
|
|
1055
|
+
unregisterProvider(name: string, sourceId: string): void;
|
|
1019
1056
|
}
|
|
1020
1057
|
/** Action implementations for ExtensionAPI methods. */
|
|
1021
1058
|
export interface ExtensionActions {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { type as ArkType } from "@oh-my-pi/omptype";
|
|
2
2
|
import type * as TypeBox from "@oh-my-pi/omptype/typebox";
|
|
3
3
|
import type * as zod from "@oh-my-pi/omptype/zod";
|
|
4
4
|
import type { ImageContent, Message, Model, TextContent } from "@oh-my-pi/pi-ai";
|
|
@@ -418,11 +418,11 @@ export interface HookAPI {
|
|
|
418
418
|
exec(command: string, args: string[], options?: ExecOptions): Promise<ExecResult>;
|
|
419
419
|
/** File logger for error/warning/debug messages */
|
|
420
420
|
logger: typeof PiLogger;
|
|
421
|
-
/** Injected
|
|
421
|
+
/** Injected TypeBox shim (legacy/compat — prefer `arktype`). */
|
|
422
422
|
typebox: typeof TypeBox;
|
|
423
|
-
/** Injected
|
|
424
|
-
arktype: typeof
|
|
425
|
-
/** Injected
|
|
423
|
+
/** Injected omptype schema builder for hooks. */
|
|
424
|
+
arktype: typeof ArkType;
|
|
425
|
+
/** Injected Zod-compatible omptype builder for hooks. */
|
|
426
426
|
zod: typeof zod;
|
|
427
427
|
/** Injected pi-coding-agent exports */
|
|
428
428
|
pi: typeof PiCodingAgent;
|