typeclaw 0.50.0 → 0.52.0
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/dist/types/agent/bash-sandbox-env.d.ts +17 -0
- package/dist/types/agent/bash-sandbox-proc.d.ts +8 -0
- package/dist/types/agent/bash-sandbox.d.ts +98 -0
- package/dist/types/agent/compaction.d.ts +4 -4
- package/dist/types/agent/idle-compaction.d.ts +1 -0
- package/dist/types/agent/index.d.ts +10 -17
- package/dist/types/agent/multimodal/look-at.d.ts +1 -1
- package/dist/types/agent/output-allowance.d.ts +4 -0
- package/dist/types/agent/plugin-tools.d.ts +8 -75
- package/dist/types/agent/prompt-cache-key.d.ts +1 -0
- package/dist/types/agent/session-tail.d.ts +12 -0
- package/dist/types/agent/subagents.d.ts +5 -0
- package/dist/types/agent/system-prompt-composition.d.ts +18 -0
- package/dist/types/agent/system-prompt.d.ts +2 -0
- package/dist/types/agent/tools/channel-disengage.d.ts +1 -1
- package/dist/types/agent/tools/channel-edit.d.ts +1 -1
- package/dist/types/agent/tools/channel-fetch-attachment.d.ts +1 -1
- package/dist/types/agent/tools/channel-handoff.d.ts +1 -1
- package/dist/types/agent/tools/channel-history.d.ts +1 -1
- package/dist/types/agent/tools/channel-react.d.ts +1 -1
- package/dist/types/agent/tools/channel-read.d.ts +10 -2
- package/dist/types/agent/tools/channel-reply.d.ts +1 -1
- package/dist/types/agent/tools/channel-send.d.ts +1 -1
- package/dist/types/agent/tools/channel-session-search.d.ts +1 -1
- package/dist/types/agent/tools/ddg.d.ts +9 -0
- package/dist/types/agent/tools/grant-role.d.ts +1 -1
- package/dist/types/agent/tools/post-github-review.d.ts +1 -1
- package/dist/types/agent/tools/restart.d.ts +1 -1
- package/dist/types/agent/tools/skip-response.d.ts +1 -1
- package/dist/types/agent/tools/spawn-subagent.d.ts +2 -1
- package/dist/types/agent/tools/stream-snapshot.d.ts +2 -2
- package/dist/types/agent/tools/subagent-cancel.d.ts +1 -1
- package/dist/types/agent/tools/subagent-output.d.ts +1 -1
- package/dist/types/agent/tools/todo/index.d.ts +1 -1
- package/dist/types/agent/tools/webfetch/adaptive-html.d.ts +3 -3
- package/dist/types/agent/tools/webfetch/strategies/readability-process.d.ts +48 -0
- package/dist/types/agent/tools/webfetch/tool.d.ts +2 -2
- package/dist/types/agent/tools/websearch.d.ts +1 -1
- package/dist/types/channels/adapters/github/auth-app.d.ts +25 -0
- package/dist/types/channels/adapters/github/auth-pat.d.ts +17 -0
- package/dist/types/channels/adapters/github/auth.d.ts +24 -0
- package/dist/types/channels/github-review-check.d.ts +1 -1
- package/dist/types/channels/github-token-bridge.d.ts +4 -0
- package/dist/types/channels/lost-background-context.d.ts +2 -0
- package/dist/types/channels/persistence.d.ts +1 -0
- package/dist/types/channels/router.d.ts +16 -50
- package/dist/types/channels/types.d.ts +1 -0
- package/dist/types/coding-agent/tool.d.ts +1 -1
- package/dist/types/config/config.d.ts +22 -0
- package/dist/types/config/providers.d.ts +50 -1
- package/dist/types/container/start.d.ts +1 -0
- package/dist/types/eval/cell.d.ts +26 -0
- package/dist/types/eval/config.d.ts +19 -0
- package/dist/types/eval/dispatch.d.ts +7 -0
- package/dist/types/eval/kernel.d.ts +28 -0
- package/dist/types/eval/process.d.ts +23 -0
- package/dist/types/eval/protocol.d.ts +34 -0
- package/dist/types/eval/sandbox.d.ts +12 -0
- package/dist/types/eval/tool.d.ts +17 -0
- package/dist/types/eval/wire.d.ts +33 -0
- package/dist/types/git/resolve-identity.d.ts +2 -0
- package/dist/types/init/dockerfile.d.ts +1 -0
- package/dist/types/init/gitignore.d.ts +1 -1
- package/dist/types/permissions/builtins.d.ts +1 -0
- package/dist/types/plugin/types.d.ts +3 -0
- package/dist/types/sandbox/canonical-secrets.d.ts +2 -2
- package/dist/types/sandbox/coding-agent.d.ts +1 -1
- package/dist/types/sandbox/dependency-bins.d.ts +1 -0
- package/dist/types/sandbox/dev-source.d.ts +2 -2
- package/dist/types/sandbox/env-exposure.d.ts +2 -0
- package/dist/types/sandbox/hidden-paths.d.ts +1 -0
- package/dist/types/sandbox/index.d.ts +1 -1
- package/dist/types/sandbox/policy.d.ts +3 -0
- package/dist/types/typevault/cli-path.d.ts +2 -0
- package/dist/types/typevault/envelope-store.d.ts +11 -0
- package/dist/types/typevault/lifecycle.d.ts +13 -0
- package/dist/types/typevault/vault.d.ts +27 -0
- package/package.json +8 -7
- package/scripts/test.ts +252 -0
- package/src/agent/bash-sandbox-env.ts +136 -0
- package/src/agent/bash-sandbox-proc.ts +70 -0
- package/src/agent/bash-sandbox.ts +239 -0
- package/src/agent/compaction.ts +22 -10
- package/src/agent/idle-compaction.ts +7 -3
- package/src/agent/index.ts +185 -187
- package/src/agent/multimodal/look-at.ts +1 -1
- package/src/agent/output-allowance.ts +7 -0
- package/src/agent/plugin-tools.ts +64 -380
- package/src/agent/prompt-cache-key.ts +26 -3
- package/src/agent/session-origin.ts +41 -19
- package/src/agent/session-tail.ts +28 -0
- package/src/agent/subagent-completion-reminder.ts +2 -2
- package/src/agent/subagents.ts +21 -2
- package/src/agent/system-prompt-composition.ts +159 -0
- package/src/agent/system-prompt.ts +43 -5
- package/src/agent/todo/scope.ts +1 -1
- package/src/agent/tool-error-remediation.ts +18 -3
- package/src/agent/tools/channel-disengage.ts +1 -1
- package/src/agent/tools/channel-edit.ts +1 -1
- package/src/agent/tools/channel-fetch-attachment.ts +1 -1
- package/src/agent/tools/channel-handoff.ts +3 -2
- package/src/agent/tools/channel-history.ts +2 -1
- package/src/agent/tools/channel-react.ts +1 -1
- package/src/agent/tools/channel-read.ts +36 -3
- package/src/agent/tools/channel-reply.ts +1 -1
- package/src/agent/tools/channel-send.ts +4 -3
- package/src/agent/tools/channel-session-search.ts +13 -4
- package/src/agent/tools/ddg.ts +71 -11
- package/src/agent/tools/grant-role.ts +1 -1
- package/src/agent/tools/post-github-review.ts +1 -1
- package/src/agent/tools/restart.ts +1 -1
- package/src/agent/tools/skip-response.ts +1 -1
- package/src/agent/tools/spawn-subagent.ts +15 -1
- package/src/agent/tools/stream-snapshot.ts +1 -1
- package/src/agent/tools/subagent-cancel.ts +1 -1
- package/src/agent/tools/subagent-output.ts +1 -1
- package/src/agent/tools/todo/index.ts +1 -1
- package/src/agent/tools/webfetch/adaptive-html.ts +6 -4
- package/src/agent/tools/webfetch/strategies/readability-child.ts +25 -0
- package/src/agent/tools/webfetch/strategies/readability-process.ts +185 -0
- package/src/agent/tools/webfetch/tool.ts +6 -5
- package/src/agent/tools/websearch.ts +1 -1
- package/src/agent/tools-without-local-file-operands.ts +4 -0
- package/src/browser/dockerfile.ts +1 -1
- package/src/browser/fill-secret.ts +364 -0
- package/src/browser/registry.ts +6 -6
- package/src/bundled-plugins/agent-messenger-cli-auth/command.ts +211 -0
- package/src/bundled-plugins/agent-messenger-cli-auth/index.ts +186 -0
- package/src/bundled-plugins/backup/index.ts +17 -2
- package/src/bundled-plugins/backup/runner.ts +37 -2
- package/src/bundled-plugins/browser-agent/browser-agent.ts +51 -14
- package/src/bundled-plugins/browser-agent/index.ts +12 -5
- package/src/bundled-plugins/explorer/explorer.ts +1 -1
- package/src/bundled-plugins/github-cli-auth/gh-review-detect.ts +40 -16
- package/src/bundled-plugins/github-cli-auth/graphql-auth-nudge.ts +12 -7
- package/src/bundled-plugins/github-cli-auth/index.ts +10 -1
- package/src/bundled-plugins/managed-browser/index.ts +130 -2
- package/src/bundled-plugins/managed-browser/skills/browserskill/browserskill/SKILL.md +13 -5
- package/src/bundled-plugins/managed-browser/skills/omowright/omowright/SKILL.md +56 -5
- package/src/bundled-plugins/memory/README.md +23 -2
- package/src/bundled-plugins/memory/append-fragment.ts +133 -0
- package/src/bundled-plugins/memory/append-tool.ts +80 -149
- package/src/bundled-plugins/memory/dreaming.ts +6 -1
- package/src/bundled-plugins/memory/index.ts +33 -6
- package/src/bundled-plugins/memory/load-memory.ts +2 -4
- package/src/bundled-plugins/memory/memory-logger.ts +200 -6
- package/src/bundled-plugins/memory/references/store-reference-tool.ts +56 -32
- package/src/bundled-plugins/memory/remember-tool.ts +81 -0
- package/src/bundled-plugins/memory/search-tool-hybrid.ts +91 -0
- package/src/bundled-plugins/memory/search-tool.ts +58 -12
- package/src/bundled-plugins/memory/stream-events.ts +2 -0
- package/src/bundled-plugins/memory/transcript-cursor.ts +30 -0
- package/src/bundled-plugins/memory/transcript-preload.ts +208 -0
- package/src/bundled-plugins/memory/transcript-view.ts +36 -0
- package/src/bundled-plugins/memory/vector/hybrid.ts +25 -14
- package/src/bundled-plugins/memory/watermark.ts +19 -10
- package/src/bundled-plugins/reviewer/reviewer.ts +20 -0
- package/src/bundled-plugins/security/policies/outbound-secret-scan.ts +3 -6
- package/src/bundled-plugins/security/policies/outbound-text.ts +20 -0
- package/src/bundled-plugins/security/policies/private-surface-read.ts +166 -201
- package/src/bundled-plugins/security/policies/system-prompt-leak.ts +2 -7
- package/src/bundled-plugins/typevault/grants.ts +119 -0
- package/src/bundled-plugins/typevault/index.ts +152 -0
- package/src/bundled-plugins/typevault/request.ts +87 -0
- package/src/bundled-plugins/typevault/runtime.ts +45 -0
- package/src/bundled-plugins/typevault/skills/typevault/SKILL.md +65 -0
- package/src/channels/adapter-halt.ts +17 -0
- package/src/channels/adapters/discord-bot-reference.ts +5 -4
- package/src/channels/adapters/discord-bot.ts +1 -0
- package/src/channels/adapters/discord-classify.ts +8 -3
- package/src/channels/adapters/discord.ts +29 -0
- package/src/channels/adapters/github/history.ts +23 -2
- package/src/channels/adapters/github/inbound.ts +60 -1
- package/src/channels/adapters/github/index.ts +27 -5
- package/src/channels/adapters/github/reconcile-open-prs.ts +7 -1
- package/src/channels/adapters/kakaotalk-author-resolver.ts +7 -5
- package/src/channels/adapters/kakaotalk-channel-resolver.ts +45 -15
- package/src/channels/adapters/kakaotalk-classify.ts +7 -9
- package/src/channels/adapters/kakaotalk-list.ts +62 -0
- package/src/channels/adapters/kakaotalk-member-cache.ts +67 -0
- package/src/channels/adapters/kakaotalk-membership.ts +27 -10
- package/src/channels/adapters/kakaotalk-mention.ts +61 -0
- package/src/channels/adapters/kakaotalk.ts +159 -125
- package/src/channels/adapters/teams-classify.ts +18 -8
- package/src/channels/github-review-check.ts +5 -1
- package/src/channels/github-review-verdict-coordinator.ts +68 -2
- package/src/channels/github-token-bridge.ts +13 -0
- package/src/channels/lost-background-context.ts +46 -0
- package/src/channels/manager.ts +52 -3
- package/src/channels/persistence.ts +5 -0
- package/src/channels/router.ts +208 -128
- package/src/channels/schema.ts +1 -1
- package/src/channels/subagent-completion-bridge.ts +3 -2
- package/src/channels/types.ts +3 -0
- package/src/cli/hostd.ts +3 -0
- package/src/coding-agent/tool.ts +1 -1
- package/src/config/config.ts +35 -1
- package/src/config/providers.ts +75 -4
- package/src/container/start.ts +52 -3
- package/src/doctor/channel-checks.ts +33 -0
- package/src/doctor/checks.ts +37 -18
- package/src/doctor/index.ts +48 -12
- package/src/doctor/operational-incidents.ts +16 -1
- package/src/doctor/plugin-bridge.ts +14 -1
- package/src/doctor/stage.ts +14 -0
- package/src/doctor/types.ts +6 -0
- package/src/eval/cell.ts +93 -0
- package/src/eval/config.ts +32 -0
- package/src/eval/dispatch.ts +67 -0
- package/src/eval/entry.ts +261 -0
- package/src/eval/kernel.ts +154 -0
- package/src/eval/process.ts +113 -0
- package/src/eval/protocol.ts +26 -0
- package/src/eval/redeclare.ts +174 -0
- package/src/eval/sandbox.ts +117 -0
- package/src/eval/tool.ts +99 -0
- package/src/eval/wire.ts +93 -0
- package/src/git/resolve-identity.ts +67 -2
- package/src/git/system-commit.ts +7 -0
- package/src/init/dockerfile.ts +5 -1
- package/src/init/gitignore.ts +3 -3
- package/src/init/index.ts +1 -0
- package/src/init/models-dev.ts +2 -0
- package/src/init/validate-api-key.ts +5 -0
- package/src/migrations/secrets-v1-to-v2.ts +2 -0
- package/src/operations/classify-tool-outcome.ts +1 -1
- package/src/permissions/builtins.ts +8 -0
- package/src/plugin/core-tool-names.ts +6 -1
- package/src/plugin/types.ts +6 -0
- package/src/run/bundled-plugins.ts +12 -0
- package/src/run/channel-session-factory.ts +3 -0
- package/src/run/index.ts +13 -2
- package/src/sandbox/build.ts +1 -0
- package/src/sandbox/canonical-secrets.ts +6 -0
- package/src/sandbox/dependency-bins.ts +13 -1
- package/src/sandbox/dev-source.ts +21 -12
- package/src/sandbox/env-exposure.ts +20 -0
- package/src/sandbox/hidden-paths.ts +1 -1
- package/src/sandbox/index.ts +1 -0
- package/src/sandbox/policy.ts +5 -0
- package/src/secrets/hydrate.ts +4 -1
- package/src/secrets/storage.ts +10 -1
- package/src/server/command-runner.ts +4 -0
- package/src/server/index.ts +54 -12
- package/src/skills/typeclaw-config/SKILL.md +36 -2
- package/src/skills/typeclaw-memory/SKILL.md +3 -1
- package/src/skills/typeclaw-permissions/SKILL.md +8 -8
- package/src/skills/typeclaw-troubleshooting/SKILL.md +18 -1
- package/src/tunnels/active.ts +14 -0
- package/src/typevault/bash-cli.ts +18 -0
- package/src/typevault/cli-path.ts +11 -0
- package/src/typevault/envelope-helper.ts +17 -0
- package/src/typevault/envelope-store.ts +98 -0
- package/src/typevault/lifecycle.ts +132 -0
- package/src/typevault/prompt-tunnel.ts +33 -0
- package/src/typevault/redaction.ts +37 -0
- package/src/typevault/vault.ts +283 -0
- package/typeclaw.schema.json +92 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ReadabilityDetailedResult } from "./strategies/readability.js";
|
|
2
2
|
import type { HtmlExtractionAttempt } from "./types.js";
|
|
3
3
|
export type AdaptiveHtmlResult = {
|
|
4
4
|
kind: 'success';
|
|
@@ -10,14 +10,14 @@ export type AdaptiveHtmlResult = {
|
|
|
10
10
|
attempts: HtmlExtractionAttempt[];
|
|
11
11
|
};
|
|
12
12
|
type AdaptiveHtmlDependencies = {
|
|
13
|
-
applyReadabilityDetailed:
|
|
13
|
+
applyReadabilityDetailed: (html: string, url: string, signal?: AbortSignal) => Promise<ReadabilityDetailedResult>;
|
|
14
14
|
};
|
|
15
15
|
export declare const MAX_ADAPTIVE_HTML_SCAN_BYTES: number;
|
|
16
16
|
export declare const MAX_ADAPTIVE_HTML_TAG_COUNT = 20000;
|
|
17
17
|
export declare const MAX_ADAPTIVE_HTML_NESTING_DEPTH = 256;
|
|
18
18
|
export declare const MAX_ADAPTIVE_HTML_ATTRIBUTES_PER_TAG = 1024;
|
|
19
19
|
export declare const MAX_ADAPTIVE_HTML_START_TAG_CHARS: number;
|
|
20
|
-
export declare function extractAdaptiveHtml(html: string, url: string, dependencies?: AdaptiveHtmlDependencies): Promise<AdaptiveHtmlResult>;
|
|
20
|
+
export declare function extractAdaptiveHtml(html: string, url: string, dependencies?: AdaptiveHtmlDependencies, signal?: AbortSignal): Promise<AdaptiveHtmlResult>;
|
|
21
21
|
export type AdaptiveHtmlComplexityResult = {
|
|
22
22
|
valid: true;
|
|
23
23
|
} | {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ReadabilityDetailedResult } from "./readability.js";
|
|
2
|
+
export type ReadabilityChildRequest = {
|
|
3
|
+
html: string;
|
|
4
|
+
url: string;
|
|
5
|
+
};
|
|
6
|
+
export type ReadabilityChildResponse = {
|
|
7
|
+
ok: true;
|
|
8
|
+
result: ReadabilityDetailedResult;
|
|
9
|
+
} | {
|
|
10
|
+
ok: false;
|
|
11
|
+
message: string;
|
|
12
|
+
};
|
|
13
|
+
export type ReadabilityChildOutcome = {
|
|
14
|
+
kind: 'ok';
|
|
15
|
+
result: ReadabilityDetailedResult;
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'error';
|
|
18
|
+
message: string;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'memory';
|
|
21
|
+
childRssBytes: number | null;
|
|
22
|
+
availableBytes: number | null;
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'aborted';
|
|
25
|
+
} | {
|
|
26
|
+
kind: 'crashed';
|
|
27
|
+
exitCode: number | null;
|
|
28
|
+
signalCode: string | null;
|
|
29
|
+
};
|
|
30
|
+
export type MemoryProbe = {
|
|
31
|
+
readChildRssBytes: (pid: number) => number | null;
|
|
32
|
+
readAvailableBytes: () => number | null;
|
|
33
|
+
};
|
|
34
|
+
export type ReadabilityChildOptions = {
|
|
35
|
+
signal?: AbortSignal;
|
|
36
|
+
probe?: MemoryProbe;
|
|
37
|
+
onSpawn?: (pid: number) => void;
|
|
38
|
+
};
|
|
39
|
+
export declare const MEMORY_RESERVE_BYTES: number;
|
|
40
|
+
export declare const MIN_KILLABLE_CHILD_RSS_BYTES: number;
|
|
41
|
+
export declare const READABILITY_MEMORY_MESSAGE = "Readability extraction stopped: parsing this page would exhaust the memory available to the agent. Browser retrieval may be needed for this page.";
|
|
42
|
+
export declare const READABILITY_CRASH_MESSAGE = "Readability extraction failed: the page parser exited unexpectedly.";
|
|
43
|
+
export declare const READABILITY_ABORT_MESSAGE = "Readability extraction was aborted.";
|
|
44
|
+
export declare function applyReadabilityIsolated(html: string, url: string, signal?: AbortSignal): Promise<ReadabilityDetailedResult>;
|
|
45
|
+
export declare function runReadabilityChild(request: ReadabilityChildRequest, options?: ReadabilityChildOptions): Promise<ReadabilityChildOutcome>;
|
|
46
|
+
export declare function shouldStopChild(childRssBytes: number | null, availableBytes: number | null): boolean;
|
|
47
|
+
export declare const defaultMemoryProbe: MemoryProbe;
|
|
48
|
+
export declare function readLinuxAvailableBytes(root?: string): number | null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Type } from '
|
|
1
|
+
import { Type } from 'typebox';
|
|
2
2
|
import { type WebFetchDetails } from "./types.js";
|
|
3
3
|
export declare const webFetchTool: import("@earendil-works/pi-coding-agent").ToolDefinition<Type.TObject<{
|
|
4
4
|
url: Type.TString;
|
|
5
|
-
strategy: Type.TOptional<Type.TUnion<Type.TLiteral<"
|
|
5
|
+
strategy: Type.TOptional<Type.TUnion<Type.TLiteral<"raw" | "grep" | "jq" | "selector" | "snapshot" | "readability">[]>>;
|
|
6
6
|
query: Type.TOptional<Type.TString>;
|
|
7
7
|
selector: Type.TOptional<Type.TString>;
|
|
8
8
|
pattern: Type.TOptional<Type.TString>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Secret } from "../../../secrets/resolve.js";
|
|
2
|
+
import type { GithubAuthContext, GithubAuthStrategy, GithubInstallationGrants, GithubSelfUser } from "./auth.js";
|
|
3
|
+
export declare class AppAuthStrategy implements GithubAuthStrategy {
|
|
4
|
+
private readonly appId;
|
|
5
|
+
private readonly privateKeyPem;
|
|
6
|
+
private readonly fetchImpl;
|
|
7
|
+
private readonly tokenCache;
|
|
8
|
+
private readonly repoInstallationCache;
|
|
9
|
+
private soleInstallationId;
|
|
10
|
+
private _selfUser;
|
|
11
|
+
constructor(options: {
|
|
12
|
+
appId: number;
|
|
13
|
+
privateKey: Secret;
|
|
14
|
+
fetchImpl?: typeof fetch;
|
|
15
|
+
});
|
|
16
|
+
token(context?: GithubAuthContext): Promise<string>;
|
|
17
|
+
authHeaders(context?: GithubAuthContext): Promise<HeadersInit>;
|
|
18
|
+
private installationToken;
|
|
19
|
+
getSelf(): Promise<GithubSelfUser>;
|
|
20
|
+
getInstallationGrants(context?: GithubAuthContext): Promise<GithubInstallationGrants>;
|
|
21
|
+
dispose(): Promise<void>;
|
|
22
|
+
private mintJwt;
|
|
23
|
+
private resolveInstallationId;
|
|
24
|
+
private resolveInstallationByEndpoint;
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Secret } from "../../../secrets/resolve.js";
|
|
2
|
+
import type { GithubAuthContext, GithubAuthStrategy, GithubSelfUser } from "./auth.js";
|
|
3
|
+
export declare const GITHUB_API_BASE = "https://api.github.com";
|
|
4
|
+
export declare class PatAuthStrategy implements GithubAuthStrategy {
|
|
5
|
+
private readonly _token;
|
|
6
|
+
private readonly fetchImpl;
|
|
7
|
+
constructor(options: {
|
|
8
|
+
token: Secret;
|
|
9
|
+
fetchImpl?: typeof fetch;
|
|
10
|
+
});
|
|
11
|
+
token(_context?: GithubAuthContext): Promise<string>;
|
|
12
|
+
authHeaders(_context?: GithubAuthContext): Promise<HeadersInit>;
|
|
13
|
+
getSelf(): Promise<GithubSelfUser>;
|
|
14
|
+
dispose(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export declare function githubJsonHeaders(token: string): HeadersInit;
|
|
17
|
+
export declare function githubPublicHeaders(): HeadersInit;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { GithubAppAuthBlock, GithubPatAuthBlock } from "../../../secrets/schema.js";
|
|
2
|
+
export type GithubAuthContext = {
|
|
3
|
+
repoSlug?: string;
|
|
4
|
+
owner?: string;
|
|
5
|
+
};
|
|
6
|
+
export type GithubAuthStrategy = {
|
|
7
|
+
token: (context?: GithubAuthContext) => Promise<string>;
|
|
8
|
+
authHeaders: (context?: GithubAuthContext) => Promise<HeadersInit>;
|
|
9
|
+
getSelf: () => Promise<GithubSelfUser>;
|
|
10
|
+
getInstallationGrants?: (context?: GithubAuthContext) => Promise<GithubInstallationGrants>;
|
|
11
|
+
dispose: () => Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
export type GithubInstallationGrants = {
|
|
14
|
+
permissions: Readonly<Record<string, 'read' | 'write' | 'admin'>>;
|
|
15
|
+
events: readonly string[];
|
|
16
|
+
};
|
|
17
|
+
export type GithubSelfUser = {
|
|
18
|
+
login: string;
|
|
19
|
+
id: number;
|
|
20
|
+
};
|
|
21
|
+
export declare function buildAuthStrategy(options: {
|
|
22
|
+
auth: GithubPatAuthBlock | GithubAppAuthBlock;
|
|
23
|
+
fetchImpl?: typeof fetch;
|
|
24
|
+
}): GithubAuthStrategy;
|
|
@@ -112,7 +112,7 @@ export declare class GithubReviewCheckTracker {
|
|
|
112
112
|
reviewerSettled(taskId: string, settlement: ReviewerSettlement): Promise<void>;
|
|
113
113
|
reportActivity(taskId: string, activity: ReviewerActivity): void;
|
|
114
114
|
reviewPosted(key: ReviewCheckKey, state: 'APPROVED' | 'CHANGES_REQUESTED' | 'COMMENTED', details?: ReviewCheckVerdictDetails): Promise<void>;
|
|
115
|
-
completePostingReviews(repo: string, pullRequest: number, state: 'APPROVED' | 'CHANGES_REQUESTED' | 'COMMENTED'): Promise<void>;
|
|
115
|
+
completePostingReviews(repo: string, pullRequest: number, state: 'APPROVED' | 'CHANGES_REQUESTED' | 'COMMENTED', headSha?: string): Promise<void>;
|
|
116
116
|
cancelPullRequest(repo: string, pullRequest: number, reason: string): Promise<void>;
|
|
117
117
|
sweep(): Promise<void>;
|
|
118
118
|
private createLease;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GithubSelfUser } from "./adapters/github/auth.js";
|
|
1
2
|
export type GithubTokenCredential = {
|
|
2
3
|
token: string;
|
|
3
4
|
accountIdentity?: string;
|
|
@@ -9,7 +10,10 @@ export type GithubTokenResolveResult = ({
|
|
|
9
10
|
reason: string;
|
|
10
11
|
};
|
|
11
12
|
export type ResolveGithubTokenForRepo = (repoSlug: string) => Promise<GithubTokenResolveResult>;
|
|
13
|
+
export type GetGithubSelf = () => GithubSelfUser | null;
|
|
12
14
|
export type GithubTokenBridge = {
|
|
15
|
+
getSelf: GetGithubSelf;
|
|
16
|
+
registerSelf: (self: GithubSelfUser) => () => void;
|
|
13
17
|
resolveTokenForRepo: ResolveGithubTokenForRepo;
|
|
14
18
|
hasAppTokenResolver: () => boolean;
|
|
15
19
|
getAppSelfLogin: () => string | null;
|
|
@@ -10,6 +10,7 @@ export type ChannelSessionRecord = {
|
|
|
10
10
|
sessionFile?: string;
|
|
11
11
|
lastInboundAt?: number;
|
|
12
12
|
participants: ChannelParticipant[];
|
|
13
|
+
botParticipated?: true;
|
|
13
14
|
githubReviewRound?: GithubReviewFollowupRound & {
|
|
14
15
|
status: 'pending' | 'completed';
|
|
15
16
|
createdAt: number;
|
|
@@ -44,6 +44,7 @@ type PendingProviderError = {
|
|
|
44
44
|
turnSeq: number;
|
|
45
45
|
safeMessage: string;
|
|
46
46
|
retryAndSee: boolean;
|
|
47
|
+
unclassified: boolean;
|
|
47
48
|
};
|
|
48
49
|
type SilentAckReason = 'github_review_output' | 'awaiting_background_child';
|
|
49
50
|
export declare const RESTART_RESUME_WAKE_REMINDER: string;
|
|
@@ -66,37 +67,16 @@ export declare const SEND_RATE_WINDOW_MS = 5000;
|
|
|
66
67
|
export declare const SEND_RATE_WARN_THRESHOLD = 3;
|
|
67
68
|
export declare const OUTBOUND_FLOOD_ERROR = "outbound message denied: content looks like a repeated-character flood";
|
|
68
69
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* WITHIN this window is guaranteed a cache hit on the provider side.
|
|
70
|
+
* Roll over only after more than 60 minutes without an engaged inbound.
|
|
71
|
+
* Continuity of an active conversation outweighs one cold prefix resend;
|
|
72
|
+
* compaction bounds the transcript carried by that resend.
|
|
73
73
|
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* context) still costs more to rebuild than its accumulated transcript is
|
|
79
|
-
* reused for one more turn rather than torn down. This targets the common
|
|
80
|
-
* channel shape — a human replying a few minutes past the cache TTL — where a
|
|
81
|
-
* full cold-start rebuild of a large memory/index-mode base context dominates
|
|
82
|
-
* the cost of carrying a modest transcript forward.
|
|
83
|
-
*
|
|
84
|
-
* Unlike SESSION_IDLE_MS (which evicts the in-memory entry without rollover), a
|
|
85
|
-
* rollover triggers a full tearDownLive + recreate on the next engaged inbound.
|
|
86
|
-
* The old session's transcript is preserved on disk; only the in-memory live
|
|
87
|
-
* entry and sessions.json pointer are replaced.
|
|
74
|
+
* SESSION_IDLE_MS (30 minutes) only evicts the in-memory entry: the next inbound
|
|
75
|
+
* within this freshness window rehydrates the same session file without rollover.
|
|
76
|
+
* A rollover tears down the live entry and replaces the sessions.json pointer;
|
|
77
|
+
* the old transcript remains on disk.
|
|
88
78
|
*/
|
|
89
79
|
export declare const SESSION_FRESHNESS_TTL_MS: number;
|
|
90
|
-
/**
|
|
91
|
-
* Hard ceiling on the cost-aware grace window. Past this age the live session is
|
|
92
|
-
* rolled over unconditionally regardless of base-vs-transcript cost: the grace
|
|
93
|
-
* decision only defers rollover, it never makes the session immortal. Bounding
|
|
94
|
-
* grace at 2x the soft TTL keeps a never-quite-idle session from accumulating an
|
|
95
|
-
* ever-growing, fully-uncached prefix (every turn past the soft boundary re-sends
|
|
96
|
-
* the whole prefix at no provider-cache discount) and prevents grace from
|
|
97
|
-
* silently becoming an unbounded TTL increase.
|
|
98
|
-
*/
|
|
99
|
-
export declare const SESSION_GRACE_HARD_TTL_MS: number;
|
|
100
80
|
/**
|
|
101
81
|
* Leak guard — NOT a freshness cap. A running background subagent pins its parent
|
|
102
82
|
* channel session against idle GC and stale-rollover for as long as the child is
|
|
@@ -118,25 +98,6 @@ export declare const SESSION_GRACE_HARD_TTL_MS: number;
|
|
|
118
98
|
* "this child is wedged," not "this child is busy".
|
|
119
99
|
*/
|
|
120
100
|
export declare const SESSION_CHILD_STUCK_BACKSTOP_MS: number;
|
|
121
|
-
/**
|
|
122
|
-
* Cost-aware grace decision for the soft→hard TTL band. Returns true when reusing
|
|
123
|
-
* the (now cache-cold) live session is cheaper than a fresh cold-start.
|
|
124
|
-
*
|
|
125
|
-
* After the soft TTL the provider prefix is cold either way, so the choice is:
|
|
126
|
-
* - rollover: pay to rebuild the fixed base context (system prompt + memory +
|
|
127
|
-
* prefetched context) plus a fresh first model call, OR
|
|
128
|
-
* - reuse: re-send the cold base context PLUS the accumulated transcript.
|
|
129
|
-
*
|
|
130
|
-
* Rollover only wins once the transcript a reused session would carry forward
|
|
131
|
-
* exceeds the base context a rollover would rebuild. We approximate both with the
|
|
132
|
-
* session transcript file: `baseContextBytes` is its size captured right after
|
|
133
|
-
* cold-start (the rendered prompt before any user turn), and the live delta is
|
|
134
|
-
* the growth since. While `baseContextBytes > transcriptDeltaBytes`, the fixed
|
|
135
|
-
* rebuild is the larger cost and grace is worth it. A `baseContextBytes` of 0
|
|
136
|
-
* (no transcript path available) disables grace — fail closed to the prior
|
|
137
|
-
* roll-over-at-soft-TTL behavior.
|
|
138
|
-
*/
|
|
139
|
-
export declare function isGraceWorthReusing(baseContextBytes: number, transcriptDeltaBytes: number): boolean;
|
|
140
101
|
export declare const ENSURE_LIVE_TIMEOUT_MS = 30000;
|
|
141
102
|
export declare class StaleLiveSessionError extends Error {
|
|
142
103
|
constructor(keyId: string);
|
|
@@ -213,6 +174,7 @@ type TimedAttachment = {
|
|
|
213
174
|
};
|
|
214
175
|
type ChannelAgentSession = AgentSession & {
|
|
215
176
|
getAbortReason?: () => string | undefined;
|
|
177
|
+
resetLoopGuard?: () => void;
|
|
216
178
|
};
|
|
217
179
|
type PendingSystemReminder = {
|
|
218
180
|
text: string;
|
|
@@ -260,6 +222,10 @@ type LiveSession = {
|
|
|
260
222
|
deferred: boolean;
|
|
261
223
|
}) | null;
|
|
262
224
|
githubReviewThreadCloseoutDecisionTurn: number | null;
|
|
225
|
+
githubReviewThreadResolvedAt: {
|
|
226
|
+
rootCommentId: string;
|
|
227
|
+
at: number;
|
|
228
|
+
} | null;
|
|
263
229
|
pendingGithubReviewRoundCloseout: string | null;
|
|
264
230
|
promptQueue: QueuedInbound[];
|
|
265
231
|
contextBuffer: ObservedInbound[];
|
|
@@ -276,7 +242,6 @@ type LiveSession = {
|
|
|
276
242
|
promptInFlight: boolean;
|
|
277
243
|
lastInboundAt: number;
|
|
278
244
|
recentMessages: SessionActivity[];
|
|
279
|
-
baseContextBytes: number;
|
|
280
245
|
firstUnprocessedAt: number;
|
|
281
246
|
currentTurnAuthorId: string | null;
|
|
282
247
|
currentTurnAuthorAdapter: AdapterId;
|
|
@@ -301,6 +266,7 @@ type LiveSession = {
|
|
|
301
266
|
lastTurnHandoff: boolean;
|
|
302
267
|
consecutiveAborts: number;
|
|
303
268
|
pendingSystemReminders: PendingSystemReminder[];
|
|
269
|
+
restoredBackgroundContextPending: boolean;
|
|
304
270
|
backgroundCoverage: string[];
|
|
305
271
|
inboundCoverage: string[];
|
|
306
272
|
turnAccountIdentity?: string;
|
|
@@ -313,6 +279,7 @@ type LiveSession = {
|
|
|
313
279
|
lastSendLeafId: string | null;
|
|
314
280
|
sendTimestamps: Map<string, number[]>;
|
|
315
281
|
successfulChannelSends: number;
|
|
282
|
+
botParticipated: boolean;
|
|
316
283
|
turnSeq: number;
|
|
317
284
|
logicalTurnStartedAt: number;
|
|
318
285
|
coverageDeferredSince: number | null;
|
|
@@ -357,7 +324,7 @@ type LiveSession = {
|
|
|
357
324
|
githubReviewOutputTurn: number | null;
|
|
358
325
|
toolExecutionThisLogicalTurn: boolean;
|
|
359
326
|
backgroundWakeLogicalTurn: boolean;
|
|
360
|
-
providerErrorSilencedThisLogicalTurn:
|
|
327
|
+
providerErrorSilencedThisLogicalTurn: 'tool-activity' | 'unclassified-failure' | null;
|
|
361
328
|
qualifyingWorkThisLogicalTurn: boolean;
|
|
362
329
|
promisedWorkOutstandingThisLogicalTurn: boolean;
|
|
363
330
|
statusOutputOutstandingThisLogicalTurn: boolean;
|
|
@@ -656,7 +623,6 @@ export type CreateChannelRouterOptions = {
|
|
|
656
623
|
now?: () => number;
|
|
657
624
|
retryRandom?: () => number;
|
|
658
625
|
onRetryBackoffStart?: () => void;
|
|
659
|
-
measureTranscriptBytes?: (path: string) => number;
|
|
660
626
|
runIdleContinuation?: typeof runIdleContinuation;
|
|
661
627
|
recordTurnOutcome?: typeof recordTurnOutcome;
|
|
662
628
|
ensureLiveTimeoutMs?: number;
|
|
@@ -93,6 +93,11 @@ export declare const githubCliSchema: z.ZodDefault<z.ZodObject<{
|
|
|
93
93
|
importHostAuth: z.ZodDefault<z.ZodBoolean>;
|
|
94
94
|
}, z.core.$strip>>;
|
|
95
95
|
export type GithubCliConfig = z.infer<typeof githubCliSchema>;
|
|
96
|
+
export declare const typevaultSchema: z.ZodDefault<z.ZodObject<{
|
|
97
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
98
|
+
promptPort: z.ZodDefault<z.ZodNumber>;
|
|
99
|
+
}, z.core.$strict>>;
|
|
100
|
+
export type TypevaultConfig = z.infer<typeof typevaultSchema>;
|
|
96
101
|
export declare const DEFAULT_LOG_RETENTION_DAYS = 14;
|
|
97
102
|
export declare const MAX_LOG_RETENTION_DAYS = 3650;
|
|
98
103
|
export declare const logsSchema: z.ZodDefault<z.ZodObject<{
|
|
@@ -668,6 +673,16 @@ export declare const configSchema: z.ZodObject<{
|
|
|
668
673
|
to: z.ZodString;
|
|
669
674
|
}, z.core.$strip>>>;
|
|
670
675
|
}, z.core.$strip>>;
|
|
676
|
+
eval: z.ZodDefault<z.ZodObject<{
|
|
677
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
678
|
+
origins: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
679
|
+
channel: "channel";
|
|
680
|
+
tui: "tui";
|
|
681
|
+
cron: "cron";
|
|
682
|
+
subagent: "subagent";
|
|
683
|
+
system: "system";
|
|
684
|
+
}>>>;
|
|
685
|
+
}, z.core.$strict>>;
|
|
671
686
|
docker: z.ZodDefault<z.ZodObject<{
|
|
672
687
|
file: z.ZodDefault<z.ZodObject<{
|
|
673
688
|
ffmpeg: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
@@ -701,6 +716,10 @@ export declare const configSchema: z.ZodObject<{
|
|
|
701
716
|
githubCli: z.ZodDefault<z.ZodObject<{
|
|
702
717
|
importHostAuth: z.ZodDefault<z.ZodBoolean>;
|
|
703
718
|
}, z.core.$strip>>;
|
|
719
|
+
typevault: z.ZodDefault<z.ZodObject<{
|
|
720
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
721
|
+
promptPort: z.ZodDefault<z.ZodNumber>;
|
|
722
|
+
}, z.core.$strict>>;
|
|
704
723
|
logs: z.ZodDefault<z.ZodObject<{
|
|
705
724
|
retentionDays: z.ZodDefault<z.ZodNumber>;
|
|
706
725
|
}, z.core.$strip>>;
|
|
@@ -727,6 +746,9 @@ export declare const configSchema: z.ZodObject<{
|
|
|
727
746
|
tokenEnv: z.ZodOptional<z.ZodString>;
|
|
728
747
|
}, z.core.$strip>>>;
|
|
729
748
|
branding: z.ZodDefault<z.ZodBoolean>;
|
|
749
|
+
compaction: z.ZodDefault<z.ZodObject<{
|
|
750
|
+
maxTriggerTokens: z.ZodOptional<z.ZodNumber>;
|
|
751
|
+
}, z.core.$strict>>;
|
|
730
752
|
}, z.core.$catchall<z.ZodUnknown>>;
|
|
731
753
|
export type Config = z.infer<typeof configSchema>;
|
|
732
754
|
export declare function resolveModel(ref: KnownModelRef | ModelRef | string): Model<KnownApi>;
|
|
@@ -108,6 +108,7 @@ export declare const KNOWN_PROVIDERS: {
|
|
|
108
108
|
readonly supportsAdditionalTools: true;
|
|
109
109
|
readonly supportsToolSearch: true;
|
|
110
110
|
readonly supportsMidConvoSystemMessages: true;
|
|
111
|
+
readonly supportsMidConvoEffort: true;
|
|
111
112
|
readonly supportsExplicitPromptCacheMode: true;
|
|
112
113
|
};
|
|
113
114
|
};
|
|
@@ -142,6 +143,7 @@ export declare const KNOWN_PROVIDERS: {
|
|
|
142
143
|
readonly supportsAdditionalTools: true;
|
|
143
144
|
readonly supportsToolSearch: true;
|
|
144
145
|
readonly supportsMidConvoSystemMessages: true;
|
|
146
|
+
readonly supportsMidConvoEffort: true;
|
|
145
147
|
readonly supportsExplicitPromptCacheMode: true;
|
|
146
148
|
};
|
|
147
149
|
};
|
|
@@ -735,7 +737,7 @@ export declare const KNOWN_PROVIDERS: {
|
|
|
735
737
|
readonly low: "low";
|
|
736
738
|
readonly medium: "medium";
|
|
737
739
|
readonly high: "high";
|
|
738
|
-
readonly xhigh:
|
|
740
|
+
readonly xhigh: "xhigh";
|
|
739
741
|
readonly max: null;
|
|
740
742
|
};
|
|
741
743
|
readonly compat: {
|
|
@@ -1340,6 +1342,48 @@ export declare const KNOWN_PROVIDERS: {
|
|
|
1340
1342
|
};
|
|
1341
1343
|
};
|
|
1342
1344
|
};
|
|
1345
|
+
readonly exaone: {
|
|
1346
|
+
readonly id: "exaone";
|
|
1347
|
+
readonly name: "LG EXAONE";
|
|
1348
|
+
readonly baseUrl: "https://api.exaone.ai/v1";
|
|
1349
|
+
readonly auth: readonly ["api-key"];
|
|
1350
|
+
readonly apiKeyEnv: "EXAONE_API_KEY";
|
|
1351
|
+
readonly oauthProviderId: null;
|
|
1352
|
+
readonly models: {
|
|
1353
|
+
readonly 'k-exaone_v2.5': {
|
|
1354
|
+
readonly id: "k-exaone_v2.5";
|
|
1355
|
+
readonly name: "K-EXAONE 2.5";
|
|
1356
|
+
readonly api: "openai-completions";
|
|
1357
|
+
readonly provider: "exaone";
|
|
1358
|
+
readonly baseUrl: "https://api.exaone.ai/v1";
|
|
1359
|
+
readonly reasoning: true;
|
|
1360
|
+
readonly thinkingLevelMap: {
|
|
1361
|
+
readonly off: "low";
|
|
1362
|
+
readonly minimal: "low";
|
|
1363
|
+
readonly low: "low";
|
|
1364
|
+
readonly medium: "high";
|
|
1365
|
+
readonly high: "high";
|
|
1366
|
+
readonly xhigh: "max";
|
|
1367
|
+
};
|
|
1368
|
+
readonly input: ["text"];
|
|
1369
|
+
readonly cost: {
|
|
1370
|
+
readonly input: 0;
|
|
1371
|
+
readonly output: 0;
|
|
1372
|
+
readonly cacheRead: 0;
|
|
1373
|
+
readonly cacheWrite: 0;
|
|
1374
|
+
};
|
|
1375
|
+
readonly contextWindow: 524288;
|
|
1376
|
+
readonly maxTokens: 524288;
|
|
1377
|
+
readonly compat: {
|
|
1378
|
+
readonly supportsStore: false;
|
|
1379
|
+
readonly supportsDeveloperRole: false;
|
|
1380
|
+
readonly supportsReasoningEffort: true;
|
|
1381
|
+
readonly supportsStrictMode: false;
|
|
1382
|
+
readonly maxTokensField: "max_tokens";
|
|
1383
|
+
};
|
|
1384
|
+
};
|
|
1385
|
+
};
|
|
1386
|
+
};
|
|
1343
1387
|
};
|
|
1344
1388
|
export type KnownProviderId = keyof typeof KNOWN_PROVIDERS;
|
|
1345
1389
|
export declare const KNOWN_PROVIDER_VENDORS: {
|
|
@@ -1423,6 +1467,11 @@ export declare const KNOWN_PROVIDER_VENDORS: {
|
|
|
1423
1467
|
readonly name: "Inception (Mercury)";
|
|
1424
1468
|
readonly providers: readonly ["inception"];
|
|
1425
1469
|
};
|
|
1470
|
+
readonly exaone: {
|
|
1471
|
+
readonly id: "exaone";
|
|
1472
|
+
readonly name: "LG EXAONE";
|
|
1473
|
+
readonly providers: readonly ["exaone"];
|
|
1474
|
+
};
|
|
1426
1475
|
readonly opengateway: {
|
|
1427
1476
|
readonly id: "opengateway";
|
|
1428
1477
|
readonly name: "OpenGateway";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CellOutput, type HostFrame, type KernelFrame } from "./protocol.js";
|
|
2
|
+
export type EvalDispatch = (request: {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly args: Extract<KernelFrame, {
|
|
5
|
+
type: 'tool-call';
|
|
6
|
+
}>['args'];
|
|
7
|
+
readonly callId: string;
|
|
8
|
+
}, signal: AbortSignal) => Promise<unknown>;
|
|
9
|
+
export declare class EvalCell {
|
|
10
|
+
private readonly dispatch;
|
|
11
|
+
private readonly signal;
|
|
12
|
+
readonly id: `${string}-${string}-${string}-${string}-${string}`;
|
|
13
|
+
readonly output: CellOutput;
|
|
14
|
+
readonly completed: {
|
|
15
|
+
promise: Promise<void>;
|
|
16
|
+
resolve: (value?: void | PromiseLike<void> | undefined) => void;
|
|
17
|
+
reject: (reason?: any) => void;
|
|
18
|
+
};
|
|
19
|
+
private readonly ids;
|
|
20
|
+
private readonly pending;
|
|
21
|
+
private finished;
|
|
22
|
+
constructor(dispatch: EvalDispatch, signal: AbortSignal);
|
|
23
|
+
receive(frame: KernelFrame, send: (frame: HostFrame) => void): void;
|
|
24
|
+
private assertActive;
|
|
25
|
+
private invoke;
|
|
26
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { WrapSystemToolOptions } from "../agent/plugin-tools.js";
|
|
3
|
+
import type { SessionOrigin } from "../agent/session-origin.js";
|
|
4
|
+
export declare const evalConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
5
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
6
|
+
origins: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
7
|
+
channel: "channel";
|
|
8
|
+
tui: "tui";
|
|
9
|
+
cron: "cron";
|
|
10
|
+
subagent: "subagent";
|
|
11
|
+
system: "system";
|
|
12
|
+
}>>>;
|
|
13
|
+
}, z.core.$strict>>;
|
|
14
|
+
export declare function evalEnabledForSession(options: {
|
|
15
|
+
readonly settings: z.infer<typeof evalConfigSchema>;
|
|
16
|
+
readonly origin: SessionOrigin | undefined;
|
|
17
|
+
readonly tools: readonly string[];
|
|
18
|
+
readonly bashPolicy?: WrapSystemToolOptions['bashPolicy'];
|
|
19
|
+
}): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ToolDefinition } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
import type { EvalDispatch } from "./cell.js";
|
|
3
|
+
export declare function createEvalDispatch(options: {
|
|
4
|
+
readonly tools: readonly ToolDefinition[];
|
|
5
|
+
readonly getActiveNames: () => readonly string[];
|
|
6
|
+
readonly context: Parameters<ToolDefinition['execute']>[4];
|
|
7
|
+
}): EvalDispatch;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type EvalDispatch } from "./cell.js";
|
|
2
|
+
import { type KernelLaunch } from "./process.js";
|
|
3
|
+
export type EvalResult = {
|
|
4
|
+
readonly text: string;
|
|
5
|
+
readonly isError: boolean;
|
|
6
|
+
readonly truncated: boolean;
|
|
7
|
+
readonly restarted: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare class EvalKernel {
|
|
10
|
+
private readonly prepare;
|
|
11
|
+
private readonly idleMs;
|
|
12
|
+
private worker;
|
|
13
|
+
private active;
|
|
14
|
+
private controller;
|
|
15
|
+
private idle;
|
|
16
|
+
private closed;
|
|
17
|
+
private used;
|
|
18
|
+
private stopping;
|
|
19
|
+
private disposal;
|
|
20
|
+
constructor(prepare: () => Promise<KernelLaunch>, idleMs?: number);
|
|
21
|
+
run(code: string, options: {
|
|
22
|
+
readonly dispatch: EvalDispatch;
|
|
23
|
+
readonly signal?: AbortSignal;
|
|
24
|
+
readonly timeoutMs?: number;
|
|
25
|
+
}): Promise<EvalResult>;
|
|
26
|
+
dispose(): Promise<void>;
|
|
27
|
+
private stopWorker;
|
|
28
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type HostFrame, type KernelFrame } from "./protocol.js";
|
|
2
|
+
export type KernelLaunch = {
|
|
3
|
+
readonly command: string;
|
|
4
|
+
readonly cwd: string;
|
|
5
|
+
readonly env: Record<string, string>;
|
|
6
|
+
readonly fingerprint: string;
|
|
7
|
+
readonly cleanup: () => Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
export declare class KernelProcess {
|
|
10
|
+
readonly ready: Promise<void>;
|
|
11
|
+
readonly exited: Promise<void>;
|
|
12
|
+
onFrame: (frame: KernelFrame) => void;
|
|
13
|
+
onOutput: (text: string) => void;
|
|
14
|
+
alive: boolean;
|
|
15
|
+
private readonly child;
|
|
16
|
+
constructor(launch: KernelLaunch, callbacks: {
|
|
17
|
+
readonly frame: (frame: KernelFrame) => void;
|
|
18
|
+
readonly output: (text: string) => void;
|
|
19
|
+
readonly failure: (error: Error) => void;
|
|
20
|
+
});
|
|
21
|
+
send(frame: HostFrame): void;
|
|
22
|
+
stop(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export { EVAL_LIMITS, FRAME_PREFIX, EvalError, encodeFrame, FrameLines, CellOutput } from "./wire.js";
|
|
3
|
+
export declare const kernelFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4
|
+
type: z.ZodLiteral<"ready">;
|
|
5
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
6
|
+
type: z.ZodLiteral<"output">;
|
|
7
|
+
cellId: z.ZodString;
|
|
8
|
+
text: z.ZodString;
|
|
9
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
10
|
+
type: z.ZodLiteral<"tool-call">;
|
|
11
|
+
cellId: z.ZodString;
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
name: z.ZodString;
|
|
14
|
+
args: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
15
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
16
|
+
type: z.ZodLiteral<"done">;
|
|
17
|
+
cellId: z.ZodString;
|
|
18
|
+
error: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strict>], "type">;
|
|
20
|
+
export type KernelFrame = z.infer<typeof kernelFrameSchema>;
|
|
21
|
+
export declare const hostFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
22
|
+
type: z.ZodLiteral<"run">;
|
|
23
|
+
cellId: z.ZodString;
|
|
24
|
+
code: z.ZodString;
|
|
25
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
26
|
+
type: z.ZodLiteral<"tool-result">;
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
value: z.ZodUnknown;
|
|
29
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
30
|
+
type: z.ZodLiteral<"tool-error">;
|
|
31
|
+
id: z.ZodString;
|
|
32
|
+
error: z.ZodString;
|
|
33
|
+
}, z.core.$strict>], "type">;
|
|
34
|
+
export type HostFrame = z.infer<typeof hostFrameSchema>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SessionOrigin } from "../agent/session-origin.js";
|
|
2
|
+
import type { GetGithubSelf } from "../channels/github-token-bridge.js";
|
|
3
|
+
import type { PermissionService } from "../permissions/permissions.js";
|
|
4
|
+
import { EvalKernel } from "./kernel.js";
|
|
5
|
+
export declare function authorityOrigin(origin: SessionOrigin | undefined): unknown;
|
|
6
|
+
export declare function createSandboxedEvalKernel(options: {
|
|
7
|
+
readonly getGithubSelf?: GetGithubSelf;
|
|
8
|
+
readonly agentDir: string;
|
|
9
|
+
readonly sessionId: string;
|
|
10
|
+
readonly permissions: PermissionService;
|
|
11
|
+
readonly getOrigin: () => SessionOrigin | undefined;
|
|
12
|
+
}): EvalKernel;
|