agent-afk 5.313.6 → 5.313.8
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/effect-ledger/hook.d.ts +4 -0
- package/dist/agent/effect-ledger/index.d.ts +1 -1
- package/dist/agent/effect-ledger/store.d.ts +1 -0
- package/dist/agent/effect-ledger/types.d.ts +4 -1
- package/dist/agent/hooks.d.ts +2 -0
- package/dist/agent/providers/xai/oauth-http.d.ts +7 -0
- package/dist/agent/tools/dispatcher.core-exec.d.ts +2 -2
- package/dist/agent/tools/subagent/child-config.d.ts +2 -1
- package/dist/agent/tools/subagent/child-config.helpers.d.ts +48 -0
- package/dist/cli.mjs +395 -395
- package/dist/index.mjs +176 -176
- package/dist/telegram.mjs +200 -200
- package/dist/utils/exec-file.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { EffectStore } from './store.js';
|
|
2
2
|
import type { HookHandler } from '../hooks.js';
|
|
3
|
+
export declare function createEffectLedgerHooks(store?: EffectStore): {
|
|
4
|
+
pre: HookHandler;
|
|
5
|
+
post: HookHandler;
|
|
6
|
+
};
|
|
3
7
|
export declare function createEffectLedgerPostHook(store?: EffectStore): HookHandler;
|
|
4
8
|
export declare function createEffectLedgerPreHook(pendingIds: Map<string, string>, store?: EffectStore): HookHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createEffectLedgerPostHook } from './hook.js';
|
|
1
|
+
export { createEffectLedgerHooks, createEffectLedgerPostHook } from './hook.js';
|
|
@@ -7,6 +7,7 @@ export declare class EffectStore {
|
|
|
7
7
|
private invalidateCache;
|
|
8
8
|
writePending(input: PendingEffectInput): EffectRecord;
|
|
9
9
|
updateStatus(input: ExecuteEffectInput): Promise<EffectRecord>;
|
|
10
|
+
acknowledgeRetry(id: string): Promise<EffectRecord>;
|
|
10
11
|
findByIdempotencyKey(key: string, sessionId?: string): Promise<EffectRecord | null>;
|
|
11
12
|
query(filters?: EffectQuery): Promise<EffectRecord[]>;
|
|
12
13
|
all(): Promise<EffectRecord[]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type EffectStatus = 'pending' | 'executed' | 'confirmed' | 'failed' | 'ambiguous';
|
|
1
|
+
export type EffectStatus = 'pending' | 'executed' | 'confirmed' | 'failed' | 'unknown' | 'ambiguous';
|
|
2
2
|
export interface EffectRecord {
|
|
3
3
|
v: 1;
|
|
4
4
|
id: string;
|
|
@@ -9,6 +9,8 @@ export interface EffectRecord {
|
|
|
9
9
|
sessionId?: string;
|
|
10
10
|
taskId?: string;
|
|
11
11
|
timestamp: number;
|
|
12
|
+
retryOf?: string;
|
|
13
|
+
retryAcknowledgedAt?: number;
|
|
12
14
|
result?: unknown;
|
|
13
15
|
reconciledAt?: number;
|
|
14
16
|
}
|
|
@@ -24,6 +26,7 @@ export interface PendingEffectInput {
|
|
|
24
26
|
args: unknown;
|
|
25
27
|
sessionId?: string;
|
|
26
28
|
taskId?: string;
|
|
29
|
+
retryOf?: string;
|
|
27
30
|
}
|
|
28
31
|
export interface ExecuteEffectInput {
|
|
29
32
|
id: string;
|
package/dist/agent/hooks.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export interface PreToolUseContext {
|
|
|
53
53
|
}
|
|
54
54
|
export interface PostToolUseContext {
|
|
55
55
|
event: 'PostToolUse';
|
|
56
|
+
toolUseId?: string;
|
|
56
57
|
sessionId?: string;
|
|
57
58
|
subagentId?: string;
|
|
58
59
|
parentSessionId?: string;
|
|
@@ -72,6 +73,7 @@ export interface PreCompactContext {
|
|
|
72
73
|
}
|
|
73
74
|
export interface PostToolUseFailureContext {
|
|
74
75
|
event: 'PostToolUseFailure';
|
|
76
|
+
toolUseId?: string;
|
|
75
77
|
sessionId?: string;
|
|
76
78
|
subagentId?: string;
|
|
77
79
|
parentSessionId?: string;
|
|
@@ -20,5 +20,12 @@ export declare function safeText(res: Response): Promise<string>;
|
|
|
20
20
|
export declare function clearOidcCache(): void;
|
|
21
21
|
export declare function discoverXaiOidc(deps?: OAuthHttpDeps): Promise<XaiOidcDiscovery>;
|
|
22
22
|
export declare function discoverXaiOidcCached(deps?: OAuthHttpDeps): Promise<XaiOidcDiscovery>;
|
|
23
|
+
export interface RawPostResult {
|
|
24
|
+
ok: boolean;
|
|
25
|
+
status: number;
|
|
26
|
+
json: Record<string, unknown>;
|
|
27
|
+
text: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function rawPostOAuthForm(url: string, params: Record<string, string>, fetchFn?: FetchFn): Promise<RawPostResult>;
|
|
23
30
|
export declare function postOAuthForm(url: string, params: Record<string, string>, errPrefix: string, fetchFn?: FetchFn): Promise<Record<string, unknown>>;
|
|
24
31
|
export declare function tokenResponseToBundle(json: Record<string, unknown>, nowSeconds?: () => number, fallbackRefresh?: string): XaiTokenBundle | null;
|
|
@@ -32,8 +32,8 @@ export interface CoreExecDeps {
|
|
|
32
32
|
export declare function isRegisteredTool(toolName: string, deps: CoreExecDeps): boolean;
|
|
33
33
|
export declare function unknownToolMessage(toolName: string, deps: CoreExecDeps): string;
|
|
34
34
|
export declare function denialReason(toolName: string, permissionReason: string | undefined, deps: CoreExecDeps): string;
|
|
35
|
-
export declare function firePostToolUse(toolName: string, output: string, signal: AbortSignal, deps: CoreExecDeps, input?: unknown, resultFlags?: Pick<ToolResult, 'incomplete' | 'incompleteReason' | 'isError'
|
|
36
|
-
export declare function firePostToolUseFailure(toolName: string, errorMessage: string, signal: AbortSignal, deps: CoreExecDeps, input?: unknown): void;
|
|
35
|
+
export declare function firePostToolUse(toolName: string, output: string, signal: AbortSignal, deps: CoreExecDeps, input?: unknown, resultFlags?: Pick<ToolResult, 'incomplete' | 'incompleteReason' | 'isError'>, toolUseId?: string): void;
|
|
36
|
+
export declare function firePostToolUseFailure(toolName: string, errorMessage: string, signal: AbortSignal, deps: CoreExecDeps, input?: unknown, toolUseId?: string): void;
|
|
37
37
|
export declare function applyOutputCap(result: ToolResult, deps: CoreExecDeps): ToolResult;
|
|
38
38
|
export declare function executeCompose(call: ToolCall, deps: CoreExecDeps): Promise<ToolResult>;
|
|
39
39
|
export declare function executeCoreInner(call: ToolCall, deps: CoreExecDeps): Promise<ToolResult>;
|
|
@@ -5,7 +5,7 @@ import type { AgentModelInput } from '../../types.js';
|
|
|
5
5
|
import type { AgentConfig } from '../../types/config-types.js';
|
|
6
6
|
import type { MessageJournal } from '../../journal/types.js';
|
|
7
7
|
import type { JournalParent } from '../../subagent/fork-types.js';
|
|
8
|
-
import { createStubParentSession
|
|
8
|
+
import { createStubParentSession } from '../nesting.js';
|
|
9
9
|
import type { RegisteredAgent } from '../../agents/index.js';
|
|
10
10
|
import type { AgentRegistry } from '../../agents/index.js';
|
|
11
11
|
import type { SkillExecutor } from '../skill-executor.js';
|
|
@@ -13,6 +13,7 @@ import type { Surface } from '../../awareness/types.js';
|
|
|
13
13
|
import type { TraceSink } from '../../trace/index.js';
|
|
14
14
|
import type { SubagentExecutor, SubagentExecutorContext } from '../subagent-executor.js';
|
|
15
15
|
import type { AgentInput } from './input-parse.js';
|
|
16
|
+
import type { ChildProviderFactoryArgs } from '../nesting.js';
|
|
16
17
|
export type ChildParentSession = ReturnType<typeof createStubParentSession> & {
|
|
17
18
|
sessionId: string | undefined;
|
|
18
19
|
messageJournal?: MessageJournal;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { resolveAgentToolAccess } from '../../agents/index.js';
|
|
2
|
+
import { SubagentManager } from '../../subagent.js';
|
|
3
|
+
import type { RegisteredAgent, AgentRegistry } from '../../agents/index.js';
|
|
4
|
+
import type { AgentModelInput } from '../../types.js';
|
|
5
|
+
import type { AgentConfig } from '../../types/config-types.js';
|
|
6
|
+
import type { SubagentExecutor, SubagentExecutorContext } from '../subagent-executor.js';
|
|
7
|
+
import type { AgentInput } from './input-parse.js';
|
|
8
|
+
import type { BuildChildConfigArgs, ChildParentSession } from './child-config.js';
|
|
9
|
+
export interface ResolvedChildModel {
|
|
10
|
+
childModel: string;
|
|
11
|
+
childIsOpenAI: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function resolveChildModelAndProvider(parsed: Pick<AgentInput, 'model'>, namedAgent: RegisteredAgent | undefined, defaultSubagentModel: AgentModelInput, parentModel: AgentModelInput | undefined): ResolvedChildModel;
|
|
14
|
+
export interface ResolvedChildToolAccess {
|
|
15
|
+
resolvedAccess: ReturnType<typeof resolveAgentToolAccess> | undefined;
|
|
16
|
+
effectiveAllowedTools: string[] | undefined;
|
|
17
|
+
effectiveReadOnlyBash: boolean;
|
|
18
|
+
childWriteCapable: boolean;
|
|
19
|
+
childSideEffectFree: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function resolveChildToolAccess(namedAgent: RegisteredAgent | undefined, cageAllowedTools: string[] | undefined, cageReadOnlyBash: boolean | undefined, agentRegistry: AgentRegistry | undefined): ResolvedChildToolAccess;
|
|
22
|
+
export interface ResolvedChildBudgets {
|
|
23
|
+
effectiveMaxTurns: number;
|
|
24
|
+
effectiveMaxToolUseIterations: number;
|
|
25
|
+
}
|
|
26
|
+
export declare function resolveChildBudgets(parsed: Pick<AgentInput, 'max_turns' | 'max_turns_explicit' | 'max_tool_use_iterations' | 'max_tool_use_iterations_explicit'>, namedAgent: RegisteredAgent | undefined): ResolvedChildBudgets;
|
|
27
|
+
export declare function resolveChildCredential(childModel: string, resolveApiKeyForModel: ((model: string) => string | undefined) | undefined, parentApiKey: string | undefined): string | undefined;
|
|
28
|
+
export declare function buildBaseChildConfig(parsed: Pick<AgentInput, 'cwd' | 'writeRoots' | 'readRoots'>, namedAgent: RegisteredAgent | undefined, defaultConfig: SubagentExecutorContext['defaultConfig'], childModel: string, childIsOpenAI: boolean, resolvedChildApiKey: string | undefined, effectiveMaxTurns: number, effectiveMaxToolUseIterations: number, depth: number, maxDepth: number): AgentConfig;
|
|
29
|
+
export interface WireChildNestingResult {
|
|
30
|
+
childParentSession: ChildParentSession | undefined;
|
|
31
|
+
childManager: SubagentManager | undefined;
|
|
32
|
+
}
|
|
33
|
+
interface WireChildNestingArgs {
|
|
34
|
+
args: BuildChildConfigArgs;
|
|
35
|
+
childConfig: AgentConfig;
|
|
36
|
+
effectiveAllowedTools: string[] | undefined;
|
|
37
|
+
effectiveReadOnlyBash: boolean;
|
|
38
|
+
resolvedAccess: ReturnType<typeof resolveAgentToolAccess> | undefined;
|
|
39
|
+
depth: number;
|
|
40
|
+
maxDepth: number;
|
|
41
|
+
signal: AbortSignal;
|
|
42
|
+
currentCwd: string | undefined;
|
|
43
|
+
createChildExecutor: (ctx: SubagentExecutorContext) => SubagentExecutor;
|
|
44
|
+
}
|
|
45
|
+
export declare function wireChildNesting(w: WireChildNestingArgs): WireChildNestingResult;
|
|
46
|
+
export declare function buildNestedChildManager(args: Pick<BuildChildConfigArgs, 'childInheritedReadRoots' | 'traceWriter' | 'surface' | 'workspaceStore' | 'parentRootSessionId' | 'hookRegistry'>, signal: AbortSignal, currentCwd: string | undefined): SubagentManager;
|
|
47
|
+
export declare function nestedExecutorInherits(args: Pick<BuildChildConfigArgs, 'traceWriter' | 'workspaceStore' | 'hookRegistry'>): Pick<SubagentExecutorContext, 'traceWriter' | 'workspaceStore' | 'hookRegistry'>;
|
|
48
|
+
export {};
|