@clinebot/core 0.0.7 → 0.0.10
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/auth/cline.d.ts +2 -0
- package/dist/auth/codex.d.ts +5 -1
- package/dist/auth/oca.d.ts +7 -1
- package/dist/auth/types.d.ts +2 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.node.d.ts +1 -0
- package/dist/index.node.js +164 -162
- package/dist/input/mention-enricher.d.ts +1 -0
- package/dist/providers/local-provider-service.d.ts +1 -1
- package/dist/runtime/session-runtime.d.ts +1 -1
- package/dist/session/default-session-manager.d.ts +13 -17
- package/dist/session/runtime-oauth-token-manager.d.ts +4 -2
- package/dist/session/session-agent-events.d.ts +15 -0
- package/dist/session/session-config-builder.d.ts +13 -0
- package/dist/session/session-manager.d.ts +2 -2
- package/dist/session/session-team-coordination.d.ts +12 -0
- package/dist/session/session-telemetry.d.ts +9 -0
- package/dist/session/unified-session-persistence-service.d.ts +12 -16
- package/dist/session/utils/helpers.d.ts +1 -1
- package/dist/session/utils/types.d.ts +1 -1
- package/dist/telemetry/core-events.d.ts +122 -0
- package/dist/tools/definitions.d.ts +1 -1
- package/dist/tools/executors/file-read.d.ts +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/presets.d.ts +1 -1
- package/dist/tools/schemas.d.ts +46 -3
- package/dist/tools/types.d.ts +3 -3
- package/dist/types/config.d.ts +1 -1
- package/dist/types/provider-settings.d.ts +4 -4
- package/dist/types.d.ts +1 -1
- package/package.json +4 -3
- package/src/auth/cline.ts +35 -1
- package/src/auth/codex.ts +27 -2
- package/src/auth/oca.ts +31 -4
- package/src/auth/types.ts +3 -0
- package/src/index.ts +27 -0
- package/src/input/mention-enricher.test.ts +3 -0
- package/src/input/mention-enricher.ts +3 -0
- package/src/providers/local-provider-service.ts +6 -7
- package/src/runtime/hook-file-hooks.ts +11 -10
- package/src/runtime/session-runtime.ts +1 -1
- package/src/session/default-session-manager.e2e.test.ts +2 -1
- package/src/session/default-session-manager.ts +367 -601
- package/src/session/runtime-oauth-token-manager.ts +21 -14
- package/src/session/session-agent-events.ts +159 -0
- package/src/session/session-config-builder.ts +111 -0
- package/src/session/session-host.ts +13 -0
- package/src/session/session-manager.ts +2 -2
- package/src/session/session-team-coordination.ts +198 -0
- package/src/session/session-telemetry.ts +95 -0
- package/src/session/unified-session-persistence-service.test.ts +81 -0
- package/src/session/unified-session-persistence-service.ts +470 -469
- package/src/session/utils/helpers.ts +1 -1
- package/src/session/utils/types.ts +1 -1
- package/src/storage/provider-settings-legacy-migration.ts +3 -3
- package/src/telemetry/core-events.ts +344 -0
- package/src/tools/definitions.test.ts +121 -7
- package/src/tools/definitions.ts +60 -24
- package/src/tools/executors/file-read.test.ts +29 -5
- package/src/tools/executors/file-read.ts +17 -6
- package/src/tools/index.ts +2 -0
- package/src/tools/presets.ts +1 -1
- package/src/tools/schemas.ts +65 -5
- package/src/tools/types.ts +7 -3
- package/src/types/config.ts +1 -1
- package/src/types/provider-settings.ts +6 -6
- package/src/types.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type LlmsProviders } from "@clinebot/llms";
|
|
2
2
|
import type { RpcAddProviderActionRequest, RpcOAuthProviderId, RpcProviderListItem, RpcProviderModel, RpcSaveProviderSettingsActionRequest } from "@clinebot/shared";
|
|
3
3
|
import type { ProviderSettingsManager } from "../storage/provider-settings-manager";
|
|
4
4
|
export declare function ensureCustomProvidersLoaded(manager: ProviderSettingsManager): Promise<void>;
|
|
@@ -32,7 +32,7 @@ export interface SessionRuntime {
|
|
|
32
32
|
sessionId: string;
|
|
33
33
|
}>;
|
|
34
34
|
send(sessionId: string, prompt: string): Promise<AgentResult | undefined>;
|
|
35
|
-
abort(sessionId: string): Promise<void>;
|
|
35
|
+
abort(sessionId: string, reason?: unknown): Promise<void>;
|
|
36
36
|
stop(sessionId: string): Promise<void>;
|
|
37
37
|
poll(): Promise<string[]>;
|
|
38
38
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Agent, type AgentConfig, type AgentResult, type ToolApprovalRequest, type ToolApprovalResult } from "@clinebot/agents";
|
|
2
|
-
import type {
|
|
2
|
+
import type { LlmsProviders } from "@clinebot/llms";
|
|
3
3
|
import { type ITelemetryService } from "@clinebot/shared";
|
|
4
4
|
import type { RuntimeBuilder } from "../runtime/session-runtime";
|
|
5
5
|
import { ProviderSettingsManager } from "../storage/provider-settings-manager";
|
|
@@ -36,13 +36,12 @@ export declare class DefaultSessionManager implements SessionManager {
|
|
|
36
36
|
private readonly listeners;
|
|
37
37
|
private readonly sessions;
|
|
38
38
|
private readonly usageBySession;
|
|
39
|
+
private readonly subAgentStarts;
|
|
39
40
|
constructor(options: DefaultSessionManagerOptions);
|
|
40
|
-
private resolveStoredProviderSettings;
|
|
41
|
-
private buildResolvedProviderConfig;
|
|
42
41
|
start(input: StartSessionInput): Promise<StartSessionResult>;
|
|
43
42
|
send(input: SendSessionInput): Promise<AgentResult | undefined>;
|
|
44
43
|
getAccumulatedUsage(sessionId: string): Promise<SessionAccumulatedUsage | undefined>;
|
|
45
|
-
abort(sessionId: string): Promise<void>;
|
|
44
|
+
abort(sessionId: string, reason?: unknown): Promise<void>;
|
|
46
45
|
stop(sessionId: string): Promise<void>;
|
|
47
46
|
dispose(reason?: string): Promise<void>;
|
|
48
47
|
get(sessionId: string): Promise<SessionRecord | undefined>;
|
|
@@ -52,32 +51,29 @@ export declare class DefaultSessionManager implements SessionManager {
|
|
|
52
51
|
readMessages(sessionId: string): Promise<LlmsProviders.Message[]>;
|
|
53
52
|
readHooks(sessionId: string, limit?: number): Promise<unknown[]>;
|
|
54
53
|
subscribe(listener: (event: CoreSessionEvent) => void): () => void;
|
|
54
|
+
updateSessionModel(sessionId: string, modelId: string): Promise<void>;
|
|
55
55
|
private runTurn;
|
|
56
56
|
private executeAgentTurn;
|
|
57
57
|
private prepareTurnInput;
|
|
58
|
-
private resolveAbsoluteFilePaths;
|
|
59
58
|
private ensureSessionPersisted;
|
|
60
59
|
private finalizeSingleRun;
|
|
61
60
|
private failSession;
|
|
62
61
|
private shutdownSession;
|
|
63
62
|
private updateStatus;
|
|
64
|
-
private
|
|
65
|
-
private listRows;
|
|
66
|
-
private getRow;
|
|
63
|
+
private onAgentEvent;
|
|
67
64
|
private createSpawnTool;
|
|
68
65
|
private handleTeamEvent;
|
|
69
|
-
private
|
|
70
|
-
private
|
|
71
|
-
private
|
|
72
|
-
private
|
|
73
|
-
private
|
|
66
|
+
private runWithAuthRetry;
|
|
67
|
+
private syncOAuthCredentials;
|
|
68
|
+
private getSessionOrThrow;
|
|
69
|
+
private resolveAbsoluteFilePaths;
|
|
70
|
+
private updateAgentConnection;
|
|
71
|
+
private emitStatus;
|
|
74
72
|
private emit;
|
|
73
|
+
private listRows;
|
|
74
|
+
private getRow;
|
|
75
75
|
private invoke;
|
|
76
76
|
private invokeOptional;
|
|
77
77
|
private invokeOptionalValue;
|
|
78
|
-
private runWithAuthRetry;
|
|
79
|
-
private isLikelyAuthError;
|
|
80
|
-
private syncOAuthCredentials;
|
|
81
|
-
updateSessionModel(sessionId: string, modelId: string): Promise<void>;
|
|
82
78
|
}
|
|
83
79
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { type ITelemetryService, type OAuthProviderId } from "@clinebot/shared";
|
|
1
2
|
import { ProviderSettingsManager } from "../storage/provider-settings-manager";
|
|
2
|
-
|
|
3
|
-
type ManagedOAuthProviderId = (typeof MANAGED_OAUTH_PROVIDERS)[number];
|
|
3
|
+
type ManagedOAuthProviderId = OAuthProviderId;
|
|
4
4
|
export declare class OAuthReauthRequiredError extends Error {
|
|
5
5
|
readonly providerId: ManagedOAuthProviderId;
|
|
6
6
|
constructor(providerId: ManagedOAuthProviderId);
|
|
@@ -13,9 +13,11 @@ export type RuntimeOAuthResolution = {
|
|
|
13
13
|
};
|
|
14
14
|
export declare class RuntimeOAuthTokenManager {
|
|
15
15
|
private readonly providerSettingsManager;
|
|
16
|
+
private readonly telemetry?;
|
|
16
17
|
private readonly refreshInFlight;
|
|
17
18
|
constructor(options?: {
|
|
18
19
|
providerSettingsManager?: ProviderSettingsManager;
|
|
20
|
+
telemetry?: ITelemetryService;
|
|
19
21
|
});
|
|
20
22
|
resolveProviderApiKey(input: {
|
|
21
23
|
providerId: string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AgentEvent } from "@clinebot/agents";
|
|
2
|
+
import type { CoreSessionConfig } from "../types/config";
|
|
3
|
+
import type { CoreSessionEvent } from "../types/events";
|
|
4
|
+
import type { SessionAccumulatedUsage } from "./session-manager";
|
|
5
|
+
import type { ActiveSession } from "./utils/types";
|
|
6
|
+
export declare function extractSkillNameFromToolInput(input: unknown): string | undefined;
|
|
7
|
+
export interface AgentEventContext {
|
|
8
|
+
sessionId: string;
|
|
9
|
+
config: CoreSessionConfig;
|
|
10
|
+
liveSession: ActiveSession | undefined;
|
|
11
|
+
usageBySession: Map<string, SessionAccumulatedUsage>;
|
|
12
|
+
persistMessages: (sessionId: string, messages: unknown[], systemPrompt?: string) => void;
|
|
13
|
+
emit: (event: CoreSessionEvent) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function handleAgentEvent(ctx: AgentEventContext, event: AgentEvent): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { LlmsProviders } from "@clinebot/llms";
|
|
2
|
+
import type { ITelemetryService } from "@clinebot/shared";
|
|
3
|
+
import type { ProviderSettingsManager } from "../storage/provider-settings-manager";
|
|
4
|
+
import type { CoreSessionConfig } from "../types/config";
|
|
5
|
+
import { type ProviderSettings } from "../types/provider-settings";
|
|
6
|
+
import type { StartSessionInput } from "./session-manager";
|
|
7
|
+
export declare function resolveWorkspacePath(config: CoreSessionConfig): string;
|
|
8
|
+
export declare function buildEffectiveConfig(input: StartSessionInput, hookPath: string, sessionId: string, defaultTelemetry: ITelemetryService | undefined): Promise<{
|
|
9
|
+
config: CoreSessionConfig;
|
|
10
|
+
pluginSandboxShutdown?: () => Promise<void>;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function buildResolvedProviderConfig(config: CoreSessionConfig, providerSettingsManager: ProviderSettingsManager, resolveReasoningFn: (config: CoreSessionConfig, storedReasoning: ProviderSettings["reasoning"]) => ProviderSettings["reasoning"]): LlmsProviders.ProviderConfig;
|
|
13
|
+
export declare function resolveReasoningSettings(config: CoreSessionConfig, storedReasoning: ProviderSettings["reasoning"]): ProviderSettings["reasoning"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentResult } from "@clinebot/agents";
|
|
2
|
-
import type {
|
|
2
|
+
import type { LlmsProviders } from "@clinebot/llms";
|
|
3
3
|
import type { SessionSource } from "../types/common";
|
|
4
4
|
import type { CoreSessionConfig } from "../types/config";
|
|
5
5
|
import type { CoreSessionEvent } from "../types/events";
|
|
@@ -45,7 +45,7 @@ export interface SessionManager {
|
|
|
45
45
|
start(input: StartSessionInput): Promise<StartSessionResult>;
|
|
46
46
|
send(input: SendSessionInput): Promise<AgentResult | undefined>;
|
|
47
47
|
getAccumulatedUsage(sessionId: string): Promise<SessionAccumulatedUsage | undefined>;
|
|
48
|
-
abort(sessionId: string): Promise<void>;
|
|
48
|
+
abort(sessionId: string, reason?: unknown): Promise<void>;
|
|
49
49
|
stop(sessionId: string): Promise<void>;
|
|
50
50
|
dispose(reason?: string): Promise<void>;
|
|
51
51
|
get(sessionId: string): Promise<SessionRecord | undefined>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AgentResult, TeamEvent } from "@clinebot/agents";
|
|
2
|
+
import type { CoreSessionEvent } from "../types/events";
|
|
3
|
+
import type { ActiveSession, TeamRunUpdate } from "./utils/types";
|
|
4
|
+
export declare function trackTeamRunState(session: ActiveSession, event: TeamEvent): void;
|
|
5
|
+
export declare function dispatchTeamEventToBackend(rootSessionId: string, event: TeamEvent, invokeOptional: (method: string, ...args: unknown[]) => Promise<void>): Promise<void>;
|
|
6
|
+
export declare function emitTeamProgress(session: ActiveSession, rootSessionId: string, event: TeamEvent, emit: (event: CoreSessionEvent) => void): void;
|
|
7
|
+
export declare function hasPendingTeamRunWork(session: ActiveSession): boolean;
|
|
8
|
+
export declare function shouldAutoContinueTeamRuns(session: ActiveSession, finishReason: AgentResult["finishReason"]): boolean;
|
|
9
|
+
export declare function notifyTeamRunWaiters(session: ActiveSession): void;
|
|
10
|
+
export declare function waitForTeamRunUpdates(session: ActiveSession): Promise<TeamRunUpdate[]>;
|
|
11
|
+
export declare function buildTeamRunContinuationPrompt(session: ActiveSession, updates: TeamRunUpdate[]): string;
|
|
12
|
+
export declare function formatModePrompt(prompt: string, mode: "act" | "plan" | undefined): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ITelemetryService } from "@clinebot/shared";
|
|
2
|
+
import type { enrichPromptWithMentions } from "../input";
|
|
3
|
+
import type { SessionSource } from "../types/common";
|
|
4
|
+
import type { CoreSessionConfig } from "../types/config";
|
|
5
|
+
export declare function emitSessionCreationTelemetry(config: CoreSessionConfig, sessionId: string, source: SessionSource, isRestart: boolean, workspacePath: string): void;
|
|
6
|
+
export declare function captureHookDiscoveryTelemetry(telemetry: ITelemetryService | undefined, options: {
|
|
7
|
+
workspacePath: string;
|
|
8
|
+
}): void;
|
|
9
|
+
export declare function emitMentionTelemetry(telemetry: ITelemetryService | undefined, enriched: Awaited<ReturnType<typeof enrichPromptWithMentions>>): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HookEventPayload, SubAgentEndContext, SubAgentStartContext } from "@clinebot/agents";
|
|
2
|
-
import type {
|
|
2
|
+
import type { LlmsProviders } from "@clinebot/llms";
|
|
3
3
|
import type { SessionStatus } from "../types/common";
|
|
4
4
|
import { SessionArtifacts } from "./session-artifacts";
|
|
5
5
|
import { type SessionManifest } from "./session-manifest";
|
|
@@ -45,22 +45,18 @@ export declare class UnifiedSessionPersistenceService {
|
|
|
45
45
|
private readonly adapter;
|
|
46
46
|
private readonly teamTaskSessionsByAgent;
|
|
47
47
|
protected readonly artifacts: SessionArtifacts;
|
|
48
|
+
private static readonly STALE_REASON;
|
|
49
|
+
private static readonly STALE_SOURCE;
|
|
48
50
|
constructor(adapter: SessionPersistenceAdapter);
|
|
49
|
-
private teamTaskQueueKey;
|
|
50
51
|
ensureSessionsDir(): string;
|
|
51
|
-
private
|
|
52
|
-
|
|
53
|
-
private
|
|
54
|
-
private
|
|
55
|
-
private
|
|
52
|
+
private writeManifestFile;
|
|
53
|
+
writeSessionManifest(manifestPath: string, manifest: SessionManifest): void;
|
|
54
|
+
private readManifestFile;
|
|
55
|
+
private buildManifestFromRow;
|
|
56
|
+
private resolveArtifactPath;
|
|
57
|
+
private teamTaskQueueKey;
|
|
56
58
|
private activeTeamTaskSessionId;
|
|
57
|
-
private subagentArtifactPaths;
|
|
58
|
-
private writeSessionManifestFile;
|
|
59
|
-
private readSessionManifestFile;
|
|
60
|
-
private applyResolvedTitleToRow;
|
|
61
|
-
private createRootSessionId;
|
|
62
59
|
createRootSessionWithArtifacts(input: CreateRootSessionWithArtifactsInput): Promise<RootSessionArtifacts>;
|
|
63
|
-
writeSessionManifest(manifestPath: string, manifest: SessionManifest): void;
|
|
64
60
|
updateSessionStatus(sessionId: string, status: SessionStatus, exitCode?: number | null): Promise<{
|
|
65
61
|
updated: boolean;
|
|
66
62
|
endedAt?: string;
|
|
@@ -74,8 +70,7 @@ export declare class UnifiedSessionPersistenceService {
|
|
|
74
70
|
updated: boolean;
|
|
75
71
|
}>;
|
|
76
72
|
queueSpawnRequest(event: HookEventPayload): Promise<void>;
|
|
77
|
-
private
|
|
78
|
-
private claimQueuedSpawnTask;
|
|
73
|
+
private buildSubsessionRow;
|
|
79
74
|
upsertSubagentSession(input: UpsertSubagentInput): Promise<string | undefined>;
|
|
80
75
|
upsertSubagentSessionFromHook(event: HookEventPayload): Promise<string | undefined>;
|
|
81
76
|
appendSubagentHookAudit(subSessionId: string, event: HookEventPayload): Promise<void>;
|
|
@@ -84,13 +79,14 @@ export declare class UnifiedSessionPersistenceService {
|
|
|
84
79
|
applySubagentStatus(subSessionId: string, event: HookEventPayload): Promise<void>;
|
|
85
80
|
applySubagentStatusBySessionId(subSessionId: string, status: SessionStatus): Promise<void>;
|
|
86
81
|
applyStatusToRunningChildSessions(parentSessionId: string, status: Exclude<SessionStatus, "running">): Promise<void>;
|
|
87
|
-
private createTeamTaskSubSession;
|
|
88
82
|
onTeamTaskStart(rootSessionId: string, agentId: string, message: string): Promise<void>;
|
|
89
83
|
onTeamTaskEnd(rootSessionId: string, agentId: string, status: SessionStatus, summary?: string, messages?: LlmsProviders.Message[]): Promise<void>;
|
|
90
84
|
handleSubAgentStart(rootSessionId: string, context: SubAgentStartContext): Promise<void>;
|
|
91
85
|
handleSubAgentEnd(rootSessionId: string, context: SubAgentEndContext): Promise<void>;
|
|
92
86
|
private isPidAlive;
|
|
87
|
+
private reconcileDeadRunningSession;
|
|
93
88
|
listSessions(limit?: number): Promise<SessionRowShape[]>;
|
|
89
|
+
reconcileDeadSessions(limit?: number): Promise<number>;
|
|
94
90
|
deleteSession(sessionId: string): Promise<{
|
|
95
91
|
deleted: boolean;
|
|
96
92
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentConfig, AgentEvent, AgentResult } from "@clinebot/agents";
|
|
2
|
-
import type {
|
|
2
|
+
import type { LlmsProviders } from "@clinebot/llms";
|
|
3
3
|
import type { SessionRecord } from "../../types/sessions";
|
|
4
4
|
import type { SessionRowShape } from "../session-service";
|
|
5
5
|
import type { StoredMessageWithMetadata } from "./types";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Agent } from "@clinebot/agents";
|
|
2
|
-
import type {
|
|
2
|
+
import type { LlmsProviders } from "@clinebot/llms";
|
|
3
3
|
import type { BuiltRuntime } from "../../runtime/session-runtime";
|
|
4
4
|
import type { SessionSource } from "../../types/common";
|
|
5
5
|
import type { CoreSessionConfig } from "../../types/config";
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { ITelemetryService } from "@clinebot/shared";
|
|
2
|
+
export declare const LegacyTelemetryEvents: {
|
|
3
|
+
readonly USER: {
|
|
4
|
+
readonly AUTH_STARTED: "user.auth_started";
|
|
5
|
+
readonly AUTH_SUCCEEDED: "user.auth_succeeded";
|
|
6
|
+
readonly AUTH_FAILED: "user.auth_failed";
|
|
7
|
+
readonly AUTH_LOGGED_OUT: "user.auth_logged_out";
|
|
8
|
+
};
|
|
9
|
+
readonly TASK: {
|
|
10
|
+
readonly CREATED: "task.created";
|
|
11
|
+
readonly RESTARTED: "task.restarted";
|
|
12
|
+
readonly COMPLETED: "task.completed";
|
|
13
|
+
readonly CONVERSATION_TURN: "task.conversation_turn";
|
|
14
|
+
readonly TOKEN_USAGE: "task.tokens";
|
|
15
|
+
readonly MODE_SWITCH: "task.mode";
|
|
16
|
+
readonly TOOL_USED: "task.tool_used";
|
|
17
|
+
readonly SKILL_USED: "task.skill_used";
|
|
18
|
+
readonly DIFF_EDIT_FAILED: "task.diff_edit_failed";
|
|
19
|
+
readonly PROVIDER_API_ERROR: "task.provider_api_error";
|
|
20
|
+
readonly MENTION_USED: "task.mention_used";
|
|
21
|
+
readonly MENTION_FAILED: "task.mention_failed";
|
|
22
|
+
readonly MENTION_SEARCH_RESULTS: "task.mention_search_results";
|
|
23
|
+
readonly SUBAGENT_STARTED: "task.subagent_started";
|
|
24
|
+
readonly SUBAGENT_COMPLETED: "task.subagent_completed";
|
|
25
|
+
};
|
|
26
|
+
readonly HOOKS: {
|
|
27
|
+
readonly DISCOVERY_COMPLETED: "hooks.discovery_completed";
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare function captureAuthStarted(telemetry: ITelemetryService | undefined, provider?: string): void;
|
|
31
|
+
export declare function captureAuthSucceeded(telemetry: ITelemetryService | undefined, provider?: string): void;
|
|
32
|
+
export declare function captureAuthFailed(telemetry: ITelemetryService | undefined, provider?: string, errorMessage?: string): void;
|
|
33
|
+
export declare function captureAuthLoggedOut(telemetry: ITelemetryService | undefined, provider?: string, reason?: string): void;
|
|
34
|
+
export declare function identifyAccount(telemetry: ITelemetryService | undefined, account: {
|
|
35
|
+
id?: string;
|
|
36
|
+
email?: string;
|
|
37
|
+
provider?: string;
|
|
38
|
+
organizationId?: string;
|
|
39
|
+
organizationName?: string;
|
|
40
|
+
memberId?: string;
|
|
41
|
+
}): void;
|
|
42
|
+
export declare function captureTaskCreated(telemetry: ITelemetryService | undefined, properties: {
|
|
43
|
+
ulid: string;
|
|
44
|
+
apiProvider?: string;
|
|
45
|
+
openAiCompatibleDomain?: string;
|
|
46
|
+
}): void;
|
|
47
|
+
export declare function captureTaskRestarted(telemetry: ITelemetryService | undefined, properties: {
|
|
48
|
+
ulid: string;
|
|
49
|
+
apiProvider?: string;
|
|
50
|
+
openAiCompatibleDomain?: string;
|
|
51
|
+
}): void;
|
|
52
|
+
export declare function captureTaskCompleted(telemetry: ITelemetryService | undefined, properties: {
|
|
53
|
+
ulid: string;
|
|
54
|
+
provider?: string;
|
|
55
|
+
modelId?: string;
|
|
56
|
+
mode?: string;
|
|
57
|
+
durationMs?: number;
|
|
58
|
+
}): void;
|
|
59
|
+
export declare function captureConversationTurnEvent(telemetry: ITelemetryService | undefined, properties: {
|
|
60
|
+
ulid: string;
|
|
61
|
+
provider?: string;
|
|
62
|
+
model?: string;
|
|
63
|
+
source: "user" | "assistant";
|
|
64
|
+
mode?: string;
|
|
65
|
+
tokensIn?: number;
|
|
66
|
+
tokensOut?: number;
|
|
67
|
+
cacheWriteTokens?: number;
|
|
68
|
+
cacheReadTokens?: number;
|
|
69
|
+
totalCost?: number;
|
|
70
|
+
isNativeToolCall?: boolean;
|
|
71
|
+
}): void;
|
|
72
|
+
export declare function captureTokenUsage(telemetry: ITelemetryService | undefined, properties: {
|
|
73
|
+
ulid: string;
|
|
74
|
+
tokensIn: number;
|
|
75
|
+
tokensOut: number;
|
|
76
|
+
model: string;
|
|
77
|
+
}): void;
|
|
78
|
+
export declare function captureModeSwitch(telemetry: ITelemetryService | undefined, ulid: string, mode?: string): void;
|
|
79
|
+
export declare function captureToolUsage(telemetry: ITelemetryService | undefined, properties: {
|
|
80
|
+
ulid: string;
|
|
81
|
+
tool: string;
|
|
82
|
+
modelId?: string;
|
|
83
|
+
provider?: string;
|
|
84
|
+
autoApproved?: boolean;
|
|
85
|
+
success: boolean;
|
|
86
|
+
isNativeToolCall?: boolean;
|
|
87
|
+
}): void;
|
|
88
|
+
export declare function captureSkillUsed(telemetry: ITelemetryService | undefined, properties: {
|
|
89
|
+
ulid: string;
|
|
90
|
+
skillName: string;
|
|
91
|
+
skillSource: "global" | "project";
|
|
92
|
+
skillsAvailableGlobal: number;
|
|
93
|
+
skillsAvailableProject: number;
|
|
94
|
+
provider?: string;
|
|
95
|
+
modelId?: string;
|
|
96
|
+
}): void;
|
|
97
|
+
export declare function captureDiffEditFailure(telemetry: ITelemetryService | undefined, properties: {
|
|
98
|
+
ulid: string;
|
|
99
|
+
modelId?: string;
|
|
100
|
+
provider?: string;
|
|
101
|
+
errorType?: string;
|
|
102
|
+
isNativeToolCall?: boolean;
|
|
103
|
+
}): void;
|
|
104
|
+
export declare function captureProviderApiError(telemetry: ITelemetryService | undefined, properties: {
|
|
105
|
+
ulid: string;
|
|
106
|
+
model: string;
|
|
107
|
+
errorMessage: string;
|
|
108
|
+
provider?: string;
|
|
109
|
+
errorStatus?: number;
|
|
110
|
+
requestId?: string;
|
|
111
|
+
isNativeToolCall?: boolean;
|
|
112
|
+
}): void;
|
|
113
|
+
export declare function captureMentionUsed(telemetry: ITelemetryService | undefined, mentionType: "file" | "folder" | "url" | "problems" | "terminal" | "git-changes" | "commit", contentLength?: number): void;
|
|
114
|
+
export declare function captureMentionFailed(telemetry: ITelemetryService | undefined, mentionType: "file" | "folder" | "url" | "problems" | "terminal" | "git-changes" | "commit", errorType: "not_found" | "permission_denied" | "network_error" | "parse_error" | "unknown", errorMessage?: string): void;
|
|
115
|
+
export declare function captureMentionSearchResults(telemetry: ITelemetryService | undefined, query: string, resultCount: number, searchType: "file" | "folder" | "all", isEmpty: boolean): void;
|
|
116
|
+
export declare function captureSubagentExecution(telemetry: ITelemetryService | undefined, properties: {
|
|
117
|
+
ulid: string;
|
|
118
|
+
durationMs: number;
|
|
119
|
+
outputLines: number;
|
|
120
|
+
success: boolean;
|
|
121
|
+
}): void;
|
|
122
|
+
export declare function captureHookDiscovery(telemetry: ITelemetryService | undefined, hookName: string, globalCount: number, workspaceCount: number): void;
|
|
@@ -70,7 +70,7 @@ export declare function createAskQuestionTool(executor: AskQuestionExecutor, con
|
|
|
70
70
|
*
|
|
71
71
|
* const tools = createDefaultTools({
|
|
72
72
|
* executors: {
|
|
73
|
-
* readFile: async (path) => fs.readFile(path, "utf-8"),
|
|
73
|
+
* readFile: async ({ path }) => fs.readFile(path, "utf-8"),
|
|
74
74
|
* bash: async (cmd, cwd) => {
|
|
75
75
|
* return new Promise((resolve, reject) => {
|
|
76
76
|
* exec(cmd, { cwd }, (err, stdout, stderr) => {
|
|
@@ -34,7 +34,7 @@ export interface FileReadExecutorOptions {
|
|
|
34
34
|
* includeLineNumbers: true,
|
|
35
35
|
* })
|
|
36
36
|
*
|
|
37
|
-
* const content = await readFile("/path/to/file.ts", context)
|
|
37
|
+
* const content = await readFile({ path: "/path/to/file.ts" }, context)
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
40
|
export declare function createFileReadExecutor(options?: FileReadExecutorOptions): FileReadExecutor;
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { createApplyPatchTool, createAskQuestionTool, createBashTool, createDefa
|
|
|
9
9
|
export { type ApplyPatchExecutorOptions, type BashExecutorOptions, createApplyPatchExecutor, createBashExecutor, createDefaultExecutors, createEditorExecutor, createFileReadExecutor, createSearchExecutor, createWebFetchExecutor, type DefaultExecutorsOptions, type EditorExecutorOptions, type FileReadExecutorOptions, type SearchExecutorOptions, type WebFetchExecutorOptions, } from "./executors/index.js";
|
|
10
10
|
export { DEFAULT_MODEL_TOOL_ROUTING_RULES, resolveToolRoutingConfig, type ToolRoutingRule, } from "./model-tool-routing.js";
|
|
11
11
|
export { createDefaultToolsWithPreset, createToolPoliciesWithPreset, type ToolPolicyPresetName, type ToolPresetName, ToolPresets, } from "./presets.js";
|
|
12
|
-
export { type ApplyPatchInput, ApplyPatchInputSchema, type AskQuestionInput, AskQuestionInputSchema, type EditFileInput, EditFileInputSchema, type FetchWebContentInput, FetchWebContentInputSchema, type ReadFilesInput, ReadFilesInputSchema, type RunCommandsInput, RunCommandsInputSchema, type SearchCodebaseInput, SearchCodebaseInputSchema, type SkillsInput, SkillsInputSchema, type WebFetchRequest, WebFetchRequestSchema, } from "./schemas.js";
|
|
12
|
+
export { type ApplyPatchInput, ApplyPatchInputSchema, type AskQuestionInput, AskQuestionInputSchema, type EditFileInput, EditFileInputSchema, type FetchWebContentInput, FetchWebContentInputSchema, type ReadFileRequest, ReadFileRequestSchema, type ReadFilesInput, ReadFilesInputSchema, type RunCommandsInput, RunCommandsInputSchema, type SearchCodebaseInput, SearchCodebaseInputSchema, type SkillsInput, SkillsInputSchema, type WebFetchRequest, WebFetchRequestSchema, } from "./schemas.js";
|
|
13
13
|
export type { ApplyPatchExecutor, AskQuestionExecutor, BashExecutor, CreateDefaultToolsOptions, DefaultToolName, DefaultToolsConfig, EditorExecutor, FileReadExecutor, SearchExecutor, SkillsExecutor, SkillsExecutorSkillMetadata, SkillsExecutorWithMetadata, ToolExecutors, ToolOperationResult, WebFetchExecutor, } from "./types.js";
|
|
14
14
|
import type { Tool } from "@clinebot/agents";
|
|
15
15
|
import { type DefaultExecutorsOptions } from "./executors/index.js";
|
package/dist/tools/presets.d.ts
CHANGED
|
@@ -113,7 +113,7 @@ export declare function createToolPoliciesWithPreset(presetName: ToolPolicyPrese
|
|
|
113
113
|
* ```typescript
|
|
114
114
|
* const tools = createDefaultToolsWithPreset("readonly", {
|
|
115
115
|
* executors: {
|
|
116
|
-
* readFile: async (path) => fs.readFile(path, "utf-8"),
|
|
116
|
+
* readFile: async ({ path }) => fs.readFile(path, "utf-8"),
|
|
117
117
|
* search: async (query, cwd) => searchFiles(query, cwd),
|
|
118
118
|
* webFetch: async (url, prompt) => fetchAndAnalyze(url, prompt),
|
|
119
119
|
* },
|
package/dist/tools/schemas.d.ts
CHANGED
|
@@ -5,18 +5,53 @@
|
|
|
5
5
|
* and are used for both validation and JSON Schema generation.
|
|
6
6
|
*/
|
|
7
7
|
import { z } from "zod";
|
|
8
|
+
export declare const ReadFileLineRangeSchema: z.ZodObject<{
|
|
9
|
+
start_line: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
end_line: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export declare const ReadFileRequestSchema: z.ZodObject<{
|
|
13
|
+
path: z.ZodString;
|
|
14
|
+
start_line: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
end_line: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
}, z.core.$strip>;
|
|
8
17
|
/**
|
|
9
18
|
* Schema for read_files tool input
|
|
10
19
|
*/
|
|
11
20
|
export declare const ReadFilesInputSchema: z.ZodObject<{
|
|
12
|
-
|
|
21
|
+
files: z.ZodArray<z.ZodObject<{
|
|
22
|
+
path: z.ZodString;
|
|
23
|
+
start_line: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
end_line: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
13
26
|
}, z.core.$strip>;
|
|
14
27
|
/**
|
|
15
28
|
* Union schema for read_files tool input, allowing either a single string, an array of strings, or the full object schema
|
|
16
29
|
*/
|
|
17
30
|
export declare const ReadFilesInputUnionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
31
|
+
files: z.ZodArray<z.ZodObject<{
|
|
32
|
+
path: z.ZodString;
|
|
33
|
+
start_line: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
end_line: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
37
|
+
path: z.ZodString;
|
|
38
|
+
start_line: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
end_line: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
41
|
+
path: z.ZodString;
|
|
42
|
+
start_line: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
end_line: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
}, z.core.$strip>>, z.ZodArray<z.ZodString>, z.ZodString, z.ZodObject<{
|
|
45
|
+
files: z.ZodObject<{
|
|
46
|
+
path: z.ZodString;
|
|
47
|
+
start_line: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
end_line: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
18
51
|
file_paths: z.ZodArray<z.ZodString>;
|
|
19
|
-
}, z.core.$strip>, z.
|
|
52
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
53
|
+
file_paths: z.ZodString;
|
|
54
|
+
}, z.core.$strip>]>;
|
|
20
55
|
/**
|
|
21
56
|
* Schema for search_codebase tool input
|
|
22
57
|
*/
|
|
@@ -28,7 +63,9 @@ export declare const SearchCodebaseInputSchema: z.ZodObject<{
|
|
|
28
63
|
*/
|
|
29
64
|
export declare const SearchCodebaseUnionInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
30
65
|
queries: z.ZodArray<z.ZodString>;
|
|
31
|
-
}, z.core.$strip>, z.ZodArray<z.ZodString>, z.ZodString
|
|
66
|
+
}, z.core.$strip>, z.ZodArray<z.ZodString>, z.ZodString, z.ZodObject<{
|
|
67
|
+
queries: z.ZodString;
|
|
68
|
+
}, z.core.$strip>]>;
|
|
32
69
|
/**
|
|
33
70
|
* Schema for run_commands tool input
|
|
34
71
|
*/
|
|
@@ -40,6 +77,8 @@ export declare const RunCommandsInputSchema: z.ZodObject<{
|
|
|
40
77
|
*/
|
|
41
78
|
export declare const RunCommandsInputUnionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
42
79
|
commands: z.ZodArray<z.ZodString>;
|
|
80
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
81
|
+
commands: z.ZodString;
|
|
43
82
|
}, z.core.$strip>, z.ZodArray<z.ZodString>, z.ZodString]>;
|
|
44
83
|
/**
|
|
45
84
|
* Schema for a single web fetch request
|
|
@@ -89,6 +128,10 @@ export declare const AskQuestionInputSchema: z.ZodObject<{
|
|
|
89
128
|
question: z.ZodString;
|
|
90
129
|
options: z.ZodArray<z.ZodString>;
|
|
91
130
|
}, z.core.$strip>;
|
|
131
|
+
/**
|
|
132
|
+
* Input for a single file read request
|
|
133
|
+
*/
|
|
134
|
+
export type ReadFileRequest = z.infer<typeof ReadFileRequestSchema>;
|
|
92
135
|
/**
|
|
93
136
|
* Input for the read_files tool
|
|
94
137
|
*/
|
package/dist/tools/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Type definitions for executors, configuration, and results.
|
|
5
5
|
*/
|
|
6
6
|
import type { ToolContext } from "@clinebot/agents";
|
|
7
|
-
import type { ApplyPatchInput, EditFileInput } from "./schemas";
|
|
7
|
+
import type { ApplyPatchInput, EditFileInput, ReadFileRequest } from "./schemas";
|
|
8
8
|
/**
|
|
9
9
|
* Result from a single tool operation
|
|
10
10
|
*/
|
|
@@ -23,11 +23,11 @@ export interface ToolOperationResult {
|
|
|
23
23
|
/**
|
|
24
24
|
* Executor for reading files
|
|
25
25
|
*
|
|
26
|
-
* @param
|
|
26
|
+
* @param request - File path and optional inclusive line range to read
|
|
27
27
|
* @param context - Tool execution context
|
|
28
28
|
* @returns The file content as a string
|
|
29
29
|
*/
|
|
30
|
-
export type FileReadExecutor = (
|
|
30
|
+
export type FileReadExecutor = (request: ReadFileRequest, context: ToolContext) => Promise<string>;
|
|
31
31
|
/**
|
|
32
32
|
* Executor for searching the codebase
|
|
33
33
|
*
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentConfig, AgentHooks, ConsecutiveMistakeLimitContext, ConsecutiveMistakeLimitDecision, HookErrorMode, TeamEvent, Tool } from "@clinebot/agents";
|
|
2
|
-
import type {
|
|
2
|
+
import type { LlmsProviders } from "@clinebot/llms";
|
|
3
3
|
import type { AgentMode, BasicLogger, ITelemetryService, SessionExecutionConfig, SessionPromptConfig, SessionWorkspaceConfig } from "@clinebot/shared";
|
|
4
4
|
import type { ToolRoutingRule } from "../tools/model-tool-routing.js";
|
|
5
5
|
export type CoreAgentMode = AgentMode;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LlmsProviders } from "@clinebot/llms";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
export type ProviderConfig =
|
|
4
|
-
export type ProviderSettings =
|
|
3
|
+
export type ProviderConfig = LlmsProviders.ProviderConfig;
|
|
4
|
+
export type ProviderSettings = LlmsProviders.ProviderSettings;
|
|
5
5
|
export declare const ProviderSettingsSchema: z.ZodType<ProviderSettings>;
|
|
6
|
-
export declare const toProviderConfig: typeof
|
|
6
|
+
export declare const toProviderConfig: typeof LlmsProviders.toProviderConfig;
|
|
7
7
|
export type ProviderTokenSource = "manual" | "oauth" | "migration";
|
|
8
8
|
export interface StoredProviderSettingsEntry {
|
|
9
9
|
settings: ProviderSettings;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LlmsProviders } from "@clinebot/llms";
|
|
2
2
|
import type { CoreSessionEvent } from "./types/events";
|
|
3
3
|
export type { AgentConfigWatcher, AgentConfigWatcherEvent, AgentYamlConfig, BuildAgentConfigOverridesOptions, CreateAgentConfigWatcherOptions, CreateInstructionWatcherOptions, CreateRulesConfigDefinitionOptions, CreateSkillsConfigDefinitionOptions, CreateUserInstructionConfigWatcherOptions, CreateWorkflowsConfigDefinitionOptions, LoadAgentPluginFromPathOptions, ParseMarkdownFrontmatterResult, ParseYamlFrontmatterResult, ResolveAgentPluginPathsOptions, RuleConfig, SkillConfig, UnifiedConfigDefinition, UnifiedConfigFileCandidate, UnifiedConfigFileContext, UnifiedConfigRecord, UnifiedConfigWatcherEvent, UnifiedConfigWatcherOptions, UserInstructionConfig, UserInstructionConfigType, UserInstructionConfigWatcher, UserInstructionConfigWatcherEvent, WorkflowConfig, } from "./agents";
|
|
4
4
|
export { createAgentConfigDefinition, createAgentConfigWatcher, createRulesConfigDefinition, createSkillsConfigDefinition, createUserInstructionConfigWatcher, createWorkflowsConfigDefinition, discoverPluginModulePaths, loadAgentPluginFromPath, loadAgentPluginsFromPaths, parseAgentConfigFromYaml, parsePartialAgentConfigFromYaml, parseRuleConfigFromMarkdown, parseSkillConfigFromMarkdown, parseWorkflowConfigFromMarkdown, RULES_CONFIG_DIRECTORY_NAME, resolveAgentPluginPaths, resolveAgentTools, resolveAndLoadAgentPlugins, resolveDocumentsRulesDirectoryPath, resolveDocumentsWorkflowsDirectoryPath, resolvePluginConfigSearchPaths, resolveRulesConfigSearchPaths, resolveSkillsConfigSearchPaths, resolveWorkflowsConfigSearchPaths, SKILLS_CONFIG_DIRECTORY_NAME, toPartialAgentConfig, UnifiedConfigFileWatcher, WORKFLOWS_CONFIG_DIRECTORY_NAME, } from "./agents";
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clinebot/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"main": "./dist/index.node.js",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@clinebot/agents": "0.0.
|
|
7
|
-
"@clinebot/llms": "0.0.
|
|
6
|
+
"@clinebot/agents": "0.0.10",
|
|
7
|
+
"@clinebot/llms": "0.0.10",
|
|
8
|
+
"@clinebot/shared": "0.0.10",
|
|
8
9
|
"@opentelemetry/api": "^1.9.0",
|
|
9
10
|
"@opentelemetry/api-logs": "^0.56.0",
|
|
10
11
|
"@opentelemetry/exporter-logs-otlp-http": "^0.56.0",
|