agent-afk 5.322.15 → 5.322.17
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/agent/providers/index.d.ts +1 -0
- package/dist/agent/providers/openai-compatible/query/wind-down-final.d.ts +3 -0
- package/dist/agent/session/agent-session.d.ts +2 -0
- package/dist/agent/session/agent-session.lifecycle.d.ts +58 -0
- package/dist/agent/session/agent-session.mcp.d.ts +9 -0
- package/dist/agent/session/provider-lifecycle.d.ts +6 -1
- package/dist/agent/tools/readonly-git-surface.d.ts +2 -0
- package/dist/agent/trace/otlp-export.d.ts +56 -0
- package/dist/cli.mjs +434 -416
- package/dist/config/env.d.ts +7 -0
- package/dist/config/env.misc.d.ts +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +1101 -1073
- package/dist/telegram.mjs +253 -241
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ export declare function resolveProvider(model: string | undefined, hints?: Provi
|
|
|
12
12
|
customTools?: import('../tools/custom-tool.js').CustomToolDef[];
|
|
13
13
|
canUseTool?: import('../types/sdk-types.js').CanUseTool;
|
|
14
14
|
executors?: import('../session/session-executors.js').ProviderExecutorOpts;
|
|
15
|
+
mcpManager?: import('../mcp/index.js').McpManager;
|
|
15
16
|
}): ModelProvider;
|
|
16
17
|
export { anthropicDirectProvider };
|
|
17
18
|
export { AnthropicDirectProvider } from './anthropic-direct/index.js';
|
|
@@ -11,6 +11,8 @@ export declare class AgentSession implements IAgentSession {
|
|
|
11
11
|
private readonly ownedTraceWriter;
|
|
12
12
|
private config;
|
|
13
13
|
private stopWiring;
|
|
14
|
+
private ownedMcpManager;
|
|
15
|
+
private mcpInitPromise;
|
|
14
16
|
private readonly planExit;
|
|
15
17
|
private currentState;
|
|
16
18
|
private providerQuery;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { TurnStreamRunner } from './turn-stream-runner.js';
|
|
2
|
+
import type { AgentConfig } from '../types.js';
|
|
3
|
+
import type { AccountingAccumulator } from './accounting-accumulator.js';
|
|
4
|
+
import type { SessionShutdown } from './session-shutdown.js';
|
|
5
|
+
import type { SessionStateManager } from './session-state.js';
|
|
6
|
+
import type { HookRegistry } from '../hooks.js';
|
|
7
|
+
import type { ProviderQuery, ProviderEvent } from '../provider.js';
|
|
8
|
+
import type { QueryInputStream } from './input-iterable.js';
|
|
9
|
+
export interface SessionRunnerSlots {
|
|
10
|
+
getConfig: () => AgentConfig;
|
|
11
|
+
getAbortController: () => AbortController;
|
|
12
|
+
getProviderIterator: () => AsyncIterator<ProviderEvent>;
|
|
13
|
+
stateManager: SessionStateManager;
|
|
14
|
+
accounting: AccountingAccumulator;
|
|
15
|
+
ledger: import('./ledger-lifecycle.js').LedgerLifecycle;
|
|
16
|
+
outputBroadcast: import('./output-broadcast.js').OutputBroadcast;
|
|
17
|
+
conversationHistory: import('../types.js').Message[];
|
|
18
|
+
getInitPromise: () => Promise<void> | null;
|
|
19
|
+
getSessionId: () => string | undefined;
|
|
20
|
+
getState: () => import('../types.js').SessionState;
|
|
21
|
+
setState: (s: import('../types.js').SessionState) => void;
|
|
22
|
+
getLastResponseMetadata: () => import('../types.js').ResponseMetadata | null;
|
|
23
|
+
setLastResponseMetadata: (m: import('../types.js').ResponseMetadata | null) => void;
|
|
24
|
+
getPendingFrameworkContext: () => string[];
|
|
25
|
+
setPendingFrameworkContext: (v: string[]) => void;
|
|
26
|
+
getInboundMessageCount: () => number;
|
|
27
|
+
incInboundMessageCount: () => number;
|
|
28
|
+
getTurnCount: () => number;
|
|
29
|
+
incTurnCount: () => void;
|
|
30
|
+
getProviderQuery: () => ProviderQuery;
|
|
31
|
+
getStopWiring: () => import('../types/session-types.js').StopWiring | undefined;
|
|
32
|
+
observeProviderEvent: (e: ProviderEvent) => void;
|
|
33
|
+
}
|
|
34
|
+
export declare function buildSessionRunner(slots: SessionRunnerSlots): TurnStreamRunner;
|
|
35
|
+
export interface LifecycleWriteSlots {
|
|
36
|
+
setStateManager: (v: SessionStateManager) => void;
|
|
37
|
+
setInputStream: (v: import('./input-iterable.js').QueryInputStream) => void;
|
|
38
|
+
setProviderQuery: (v: ProviderQuery) => void;
|
|
39
|
+
setProviderIterator: (v: AsyncIterator<ProviderEvent>) => void;
|
|
40
|
+
}
|
|
41
|
+
export declare function applyLifecycle(config: AgentConfig, slots: LifecycleWriteSlots): SessionStateManager;
|
|
42
|
+
export interface BuildInitPromiseOptions {
|
|
43
|
+
mcpInitPromise: Promise<void>;
|
|
44
|
+
getConfig: () => AgentConfig;
|
|
45
|
+
setProviderQuery: (q: ProviderQuery) => void;
|
|
46
|
+
setProviderIterator: (i: AsyncIterator<ProviderEvent>) => void;
|
|
47
|
+
getProviderIterator: () => AsyncIterator<ProviderEvent>;
|
|
48
|
+
getInputStream: () => QueryInputStream;
|
|
49
|
+
isClosed: () => boolean;
|
|
50
|
+
abortSignal: AbortSignal;
|
|
51
|
+
accounting: AccountingAccumulator;
|
|
52
|
+
shutdown: SessionShutdown;
|
|
53
|
+
hookRegistry: HookRegistry | undefined;
|
|
54
|
+
queueFrameworkContext: (text: string) => void;
|
|
55
|
+
getRunner: () => TurnStreamRunner;
|
|
56
|
+
stateManager: SessionStateManager;
|
|
57
|
+
}
|
|
58
|
+
export declare function buildSessionInitPromise(opts: BuildInitPromiseOptions): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { McpManager } from '../mcp/manager.js';
|
|
2
|
+
import type { AgentConfig } from '../types.js';
|
|
3
|
+
export interface SdkMcpResult {
|
|
4
|
+
ownedManager: McpManager | undefined;
|
|
5
|
+
resolvedManager: McpManager | undefined;
|
|
6
|
+
}
|
|
7
|
+
export declare function disconnectOwnedManager(manager: McpManager | undefined): Promise<void>;
|
|
8
|
+
export declare function startMcpInit(config: AgentConfig, setOwnedManager: (m: McpManager) => void, patchConfig: (m: McpManager) => void, isClosed: () => boolean): Promise<void>;
|
|
9
|
+
export declare function initSdkOwnedMcpManager(config: AgentConfig): Promise<SdkMcpResult>;
|
|
@@ -3,7 +3,7 @@ import { QueryInputStream } from './input-iterable.js';
|
|
|
3
3
|
import type { AccountingAccumulator } from './accounting-accumulator.js';
|
|
4
4
|
import type { SessionShutdown } from './session-shutdown.js';
|
|
5
5
|
import type { AgentConfig } from '../types.js';
|
|
6
|
-
import type { ProviderQuery, ProviderEvent } from '../provider.js';
|
|
6
|
+
import type { ProviderQuery, ProviderEvent, ProviderUserTurn } from '../provider.js';
|
|
7
7
|
import type { HookRegistry } from '../hooks.js';
|
|
8
8
|
import type { TransformDeps } from './stream-consumer.js';
|
|
9
9
|
export interface ProviderLifecycleResult {
|
|
@@ -12,6 +12,11 @@ export interface ProviderLifecycleResult {
|
|
|
12
12
|
providerQuery: ProviderQuery;
|
|
13
13
|
providerIterator: AsyncIterator<ProviderEvent>;
|
|
14
14
|
}
|
|
15
|
+
export interface ProviderQueryResult {
|
|
16
|
+
providerQuery: ProviderQuery;
|
|
17
|
+
providerIterator: AsyncIterator<ProviderEvent>;
|
|
18
|
+
}
|
|
19
|
+
export declare function rebuildProviderQuery(config: AgentConfig, promptIterable: AsyncIterable<ProviderUserTurn>): ProviderQueryResult;
|
|
15
20
|
export declare function buildProviderLifecycle(config: AgentConfig): ProviderLifecycleResult;
|
|
16
21
|
export declare class ProviderInitializer {
|
|
17
22
|
private readonly config;
|
|
@@ -5,4 +5,6 @@ export declare function isReadOnlyGitToolEnabled(): boolean;
|
|
|
5
5
|
export declare function swapBashForGitRead(tools: readonly string[]): string[];
|
|
6
6
|
export declare function applyReadOnlyGitPermissions(permissions: ToolPermissionConfig | undefined, readOnlyBash: boolean | undefined): ToolPermissionConfig | undefined;
|
|
7
7
|
export declare const READONLY_BASH_DISABLED_REASON: string;
|
|
8
|
+
export declare function readOnlyBashDenialOverride(toolName: string, readOnlyBash: boolean): string | undefined;
|
|
9
|
+
export declare function withGitReadSubstitution(body: string): string;
|
|
8
10
|
export declare function readOnlyGitSchemas(): AnthropicToolDef[];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { TraceEvent } from './types.js';
|
|
2
|
+
type AnyValue = {
|
|
3
|
+
stringValue: string;
|
|
4
|
+
} | {
|
|
5
|
+
intValue: string;
|
|
6
|
+
} | {
|
|
7
|
+
boolValue: boolean;
|
|
8
|
+
} | {
|
|
9
|
+
doubleValue: number;
|
|
10
|
+
};
|
|
11
|
+
interface KeyValue {
|
|
12
|
+
key: string;
|
|
13
|
+
value: AnyValue;
|
|
14
|
+
}
|
|
15
|
+
interface SpanEvent {
|
|
16
|
+
timeUnixNano: string;
|
|
17
|
+
name: string;
|
|
18
|
+
attributes?: KeyValue[];
|
|
19
|
+
}
|
|
20
|
+
interface SpanStatus {
|
|
21
|
+
code: 0 | 1 | 2;
|
|
22
|
+
message?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface OtlpSpan {
|
|
25
|
+
traceId: string;
|
|
26
|
+
spanId: string;
|
|
27
|
+
parentSpanId?: string;
|
|
28
|
+
name: string;
|
|
29
|
+
kind: number;
|
|
30
|
+
startTimeUnixNano: string;
|
|
31
|
+
endTimeUnixNano: string;
|
|
32
|
+
attributes: KeyValue[];
|
|
33
|
+
events?: SpanEvent[];
|
|
34
|
+
status: SpanStatus;
|
|
35
|
+
}
|
|
36
|
+
export interface OtlpResourceSpans {
|
|
37
|
+
resource: {
|
|
38
|
+
attributes: KeyValue[];
|
|
39
|
+
};
|
|
40
|
+
scopeSpans: Array<{
|
|
41
|
+
scope: {
|
|
42
|
+
name: string;
|
|
43
|
+
version: string;
|
|
44
|
+
};
|
|
45
|
+
spans: OtlpSpan[];
|
|
46
|
+
}>;
|
|
47
|
+
}
|
|
48
|
+
export interface OtlpExportRequest {
|
|
49
|
+
resourceSpans: OtlpResourceSpans[];
|
|
50
|
+
}
|
|
51
|
+
export interface TraceToOtlpOptions {
|
|
52
|
+
sessionId: string;
|
|
53
|
+
malformed?: number;
|
|
54
|
+
}
|
|
55
|
+
export declare function traceToOtlp(events: readonly TraceEvent[], opts: TraceToOtlpOptions): OtlpExportRequest;
|
|
56
|
+
export {};
|