@mono-agent/agent-runtime 0.3.0 → 0.4.1
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/ARCHITECTURE.md +75 -9
- package/MIGRATION.md +293 -0
- package/README.md +46 -20
- package/package.json +104 -10
- package/src/agent/allowlists.js +3 -0
- package/src/agent/approval.js +3 -0
- package/src/agent/compaction.js +231 -654
- package/src/agent/index.js +1 -1
- package/src/agent/prompt/skill-index.js +6 -0
- package/src/agent/sandbox-seam.js +227 -0
- package/src/agent/tool-bloat.js +8 -2
- package/src/agent/tools/bash.js +16 -8
- package/src/agent/tools/edit.js +7 -3
- package/src/agent/tools/glob.js +11 -5
- package/src/agent/tools/grep.js +11 -5
- package/src/agent/tools/pi-bridge.js +272 -54
- package/src/agent/tools/read.js +28 -3
- package/src/agent/tools/shared/output-truncation.js +8 -3
- package/src/agent/tools/shared/path-resolver.js +24 -18
- package/src/agent/tools/shared/ripgrep.js +33 -6
- package/src/agent/tools/shared/runtime-context.js +60 -50
- package/src/agent/tools/shared/tool-context.js +157 -0
- package/src/agent/tools/web-fetch.js +65 -18
- package/src/agent/tools/web-search.js +11 -4
- package/src/agent/tools/write.js +7 -3
- package/src/agent/transcript.js +16 -1
- package/src/ai/cost.js +128 -3
- package/src/ai/failure.js +96 -4
- package/src/ai/index.js +1 -0
- package/src/ai/live-input-prompt.js +11 -1
- package/src/ai/providers/claude-cli.js +6 -2
- package/src/ai/providers/claude-sdk.js +55 -12
- package/src/ai/providers/codex-app.js +36 -23
- package/src/ai/providers/opencode-app.js +2 -2
- package/src/ai/providers/opencode-discovery.js +2 -2
- package/src/ai/providers/pi-errors.js +65 -0
- package/src/ai/providers/pi-events.js +5 -0
- package/src/ai/providers/pi-models.js +21 -4
- package/src/ai/providers/pi-native/compaction-driver.js +394 -0
- package/src/ai/providers/pi-native/result-builder.js +312 -0
- package/src/ai/providers/pi-native/session-lifecycle.js +438 -0
- package/src/ai/providers/pi-native/stream-subscriber.js +148 -0
- package/src/ai/providers/pi-native/structured-output.js +130 -0
- package/src/ai/providers/pi-native/turn-runner.js +278 -0
- package/src/ai/providers/pi-native.js +754 -0
- package/src/ai/runtime/capabilities.js +3 -0
- package/src/ai/runtime/model-refs.js +30 -0
- package/src/ai/runtime/registry.js +33 -2
- package/src/ai/runtime/router.js +119 -19
- package/src/ai/runtime/session-liveness.js +110 -0
- package/src/ai/runtime/sessions.js +19 -2
- package/src/ai/types.js +252 -20
- package/src/index.js +1 -1
- package/src/pi-auth.js +147 -16
- package/src/runtime-brand.js +21 -1
- package/src/runtime.js +75 -10
- package/types/agent/allowlists.d.ts +25 -0
- package/types/agent/approval.d.ts +30 -0
- package/types/agent/compaction.d.ts +97 -0
- package/types/agent/index.d.ts +5 -0
- package/types/agent/prompt/skill-index.d.ts +19 -0
- package/types/agent/sandbox-seam.d.ts +148 -0
- package/types/agent/tool-bloat.d.ts +22 -0
- package/types/agent/tools/bash.d.ts +16 -0
- package/types/agent/tools/edit.d.ts +14 -0
- package/types/agent/tools/glob.d.ts +16 -0
- package/types/agent/tools/grep.d.ts +22 -0
- package/types/agent/tools/index.d.ts +10 -0
- package/types/agent/tools/pi-bridge.d.ts +144 -0
- package/types/agent/tools/read.d.ts +19 -0
- package/types/agent/tools/shared/constants.d.ts +13 -0
- package/types/agent/tools/shared/dedup.d.ts +8 -0
- package/types/agent/tools/shared/output-truncation.d.ts +22 -0
- package/types/agent/tools/shared/path-resolver.d.ts +6 -0
- package/types/agent/tools/shared/ripgrep.d.ts +38 -0
- package/types/agent/tools/shared/runtime-context.d.ts +27 -0
- package/types/agent/tools/shared/tool-context.d.ts +48 -0
- package/types/agent/tools/web-fetch.d.ts +13 -0
- package/types/agent/tools/web-search.d.ts +11 -0
- package/types/agent/tools/write.d.ts +12 -0
- package/types/agent/transcript.d.ts +45 -0
- package/types/ai/backend.d.ts +41 -0
- package/types/ai/cost.d.ts +96 -0
- package/types/ai/failure.d.ts +117 -0
- package/types/ai/file-change-stats.d.ts +75 -0
- package/types/ai/index.d.ts +7 -0
- package/types/ai/live-input-prompt.d.ts +6 -0
- package/types/ai/observer.d.ts +68 -0
- package/types/ai/providers/claude-cli.d.ts +211 -0
- package/types/ai/providers/claude-sdk.d.ts +66 -0
- package/types/ai/providers/claude-subagents.d.ts +2 -0
- package/types/ai/providers/codex-app.d.ts +151 -0
- package/types/ai/providers/opencode-app.d.ts +95 -0
- package/types/ai/providers/opencode-discovery.d.ts +4 -0
- package/types/ai/providers/pi-errors.d.ts +3 -0
- package/types/ai/providers/pi-events.d.ts +24 -0
- package/types/ai/providers/pi-messages.d.ts +5 -0
- package/types/ai/providers/pi-models.d.ts +57 -0
- package/types/ai/providers/pi-native/compaction-driver.d.ts +86 -0
- package/types/ai/providers/pi-native/result-builder.d.ts +168 -0
- package/types/ai/providers/pi-native/session-lifecycle.d.ts +62 -0
- package/types/ai/providers/pi-native/stream-subscriber.d.ts +50 -0
- package/types/ai/providers/pi-native/structured-output.d.ts +69 -0
- package/types/ai/providers/pi-native/turn-runner.d.ts +60 -0
- package/types/ai/providers/pi-native.d.ts +18 -0
- package/types/ai/registry.d.ts +1 -0
- package/types/ai/runtime/capabilities-used.d.ts +21 -0
- package/types/ai/runtime/capabilities.d.ts +33 -0
- package/types/ai/runtime/context-windows.d.ts +8 -0
- package/types/ai/runtime/fast-mode.d.ts +2 -0
- package/types/ai/runtime/model-refs.d.ts +35 -0
- package/types/ai/runtime/registry.d.ts +38 -0
- package/types/ai/runtime/router.d.ts +56 -0
- package/types/ai/runtime/session-liveness.d.ts +55 -0
- package/types/ai/runtime/sessions.d.ts +38 -0
- package/types/ai/streaming/codex-events.d.ts +30 -0
- package/types/ai/streaming/opencode-events.d.ts +41 -0
- package/types/ai/types.d.ts +702 -0
- package/types/index.d.ts +7 -0
- package/types/pi-auth.d.ts +28 -0
- package/types/runtime-brand.d.ts +30 -0
- package/types/runtime.d.ts +10 -0
- package/src/ai/providers/pi-sdk.js +0 -1310
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createRuntime } from "./runtime.js";
|
|
2
|
+
export { createPiOAuthApiKeyResolver } from "./pi-auth.js";
|
|
3
|
+
export { createRouterRuntime } from "./ai/runtime/router.js";
|
|
4
|
+
export * from "./ai/index.js";
|
|
5
|
+
export * from "./agent/index.js";
|
|
6
|
+
export { configureToolRuntime, readToolRuntime, readRuntimeBrand, resetToolRuntime } from "./agent/tools/shared/runtime-context.js";
|
|
7
|
+
export { DEFAULT_RUNTIME_BRAND, resolveRuntimeBrand } from "./runtime-brand.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Object} [options]
|
|
3
|
+
* @param {string} [options.path] Path to the pi auth.json credentials file.
|
|
4
|
+
* @returns {PiApiKeyResolver}
|
|
5
|
+
*/
|
|
6
|
+
export function createPiOAuthApiKeyResolver(options?: {
|
|
7
|
+
path?: string;
|
|
8
|
+
}): PiApiKeyResolver;
|
|
9
|
+
export type PiApiKeyCredential = {
|
|
10
|
+
type: "api_key";
|
|
11
|
+
key?: string;
|
|
12
|
+
env?: {
|
|
13
|
+
[x: string]: any;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export type PiOAuthCredential = {
|
|
17
|
+
type: "oauth";
|
|
18
|
+
access?: string;
|
|
19
|
+
refresh?: string;
|
|
20
|
+
expires: number;
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
};
|
|
23
|
+
export type PiCredential = PiApiKeyCredential | PiOAuthCredential;
|
|
24
|
+
export type PiApiKeyResolver = ((provider: string) => Promise<string | undefined>) & {
|
|
25
|
+
readCredential?: (provider: string) => Promise<PiCredential | undefined>;
|
|
26
|
+
modifyCredential?: (provider: string, fn: (current: PiCredential | undefined) => Promise<PiCredential | undefined>) => Promise<PiCredential | undefined>;
|
|
27
|
+
deleteCredential?: (provider: string) => Promise<void>;
|
|
28
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Partial<RuntimeBrand>} [input]
|
|
3
|
+
* @returns {RuntimeBrand}
|
|
4
|
+
*/
|
|
5
|
+
export function resolveRuntimeBrand(input?: Partial<RuntimeBrand>): RuntimeBrand;
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object} RuntimeBrand
|
|
8
|
+
* @property {string} schemaPrefix
|
|
9
|
+
* @property {string} mcpClientName
|
|
10
|
+
* @property {string} mcpClientVersion
|
|
11
|
+
* @property {string} tempdirPrefix
|
|
12
|
+
* @property {string} providerModelPrefix
|
|
13
|
+
* @property {string} doctorCommand
|
|
14
|
+
* @property {string} serviceName
|
|
15
|
+
* @property {string} clientInfoName
|
|
16
|
+
* @property {string} clientInfoTitle
|
|
17
|
+
*/
|
|
18
|
+
/** @type {RuntimeBrand} */
|
|
19
|
+
export const DEFAULT_RUNTIME_BRAND: RuntimeBrand;
|
|
20
|
+
export type RuntimeBrand = {
|
|
21
|
+
schemaPrefix: string;
|
|
22
|
+
mcpClientName: string;
|
|
23
|
+
mcpClientVersion: string;
|
|
24
|
+
tempdirPrefix: string;
|
|
25
|
+
providerModelPrefix: string;
|
|
26
|
+
doctorCommand: string;
|
|
27
|
+
serviceName: string;
|
|
28
|
+
clientInfoName: string;
|
|
29
|
+
clientInfoTitle: string;
|
|
30
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {AgentRuntimeHostOptions} [host]
|
|
3
|
+
* @returns {AgentRuntimeInstance}
|
|
4
|
+
*/
|
|
5
|
+
export function createRuntime(host?: AgentRuntimeHostOptions): AgentRuntimeInstance;
|
|
6
|
+
export type AgentRuntimeHostOptions = import("./ai/types.js").AgentRuntimeHostOptions;
|
|
7
|
+
export type AgentRuntimeToolOptions = import("./ai/types.js").AgentRuntimeToolOptions;
|
|
8
|
+
export type AgentRuntimeInstance = import("./ai/types.js").AgentRuntimeInstance;
|
|
9
|
+
export type RuntimeRunOptions = import("./ai/types.js").RuntimeRunOptions;
|
|
10
|
+
export type RuntimeResult = import("./ai/types.js").RuntimeResult;
|