@cuylabs/agent-core 0.4.0 → 0.6.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/README.md +81 -323
- package/dist/builder-BKkipazh.d.ts +34 -0
- package/dist/capabilities/index.d.ts +97 -0
- package/dist/capabilities/index.js +46 -0
- package/dist/chunk-3C4VKG4P.js +2149 -0
- package/dist/chunk-6TDTQJ4P.js +116 -0
- package/dist/chunk-7MUFEN4K.js +559 -0
- package/dist/chunk-BDBZ3SLK.js +745 -0
- package/dist/chunk-DWYX7ASF.js +26 -0
- package/dist/chunk-FG4MD5MU.js +54 -0
- package/dist/chunk-IVUJDISU.js +556 -0
- package/dist/chunk-LRHOS4ZN.js +584 -0
- package/dist/chunk-O2ZCFQL6.js +764 -0
- package/dist/chunk-P6YF7USR.js +182 -0
- package/dist/chunk-QAQADS4X.js +258 -0
- package/dist/chunk-QWFMX226.js +879 -0
- package/dist/{chunk-6VKLWNRE.js → chunk-SDSBEQXG.js} +1 -132
- package/dist/chunk-VBWWUHWI.js +724 -0
- package/dist/chunk-VEKUXUVF.js +41 -0
- package/dist/chunk-X635CM2F.js +305 -0
- package/dist/chunk-YUUJK53A.js +91 -0
- package/dist/chunk-ZXAKHMWH.js +283 -0
- package/dist/config-D2xeGEHK.d.ts +52 -0
- package/dist/context/index.d.ts +259 -0
- package/dist/context/index.js +26 -0
- package/dist/identifiers-BLUxFqV_.d.ts +12 -0
- package/dist/index-DZQJD_hp.d.ts +1067 -0
- package/dist/index-ipP3_ztp.d.ts +198 -0
- package/dist/index.d.ts +210 -5736
- package/dist/index.js +2132 -7767
- package/dist/mcp/index.d.ts +26 -0
- package/dist/mcp/index.js +14 -0
- package/dist/messages-BYWGn8TY.d.ts +110 -0
- package/dist/middleware/index.d.ts +8 -0
- package/dist/middleware/index.js +12 -0
- package/dist/models/index.d.ts +33 -0
- package/dist/models/index.js +12 -0
- package/dist/network-D76DS5ot.d.ts +5 -0
- package/dist/prompt/index.d.ts +225 -0
- package/dist/prompt/index.js +45 -0
- package/dist/reasoning/index.d.ts +71 -0
- package/dist/reasoning/index.js +47 -0
- package/dist/registry-CuRWWtcT.d.ts +164 -0
- package/dist/resolver-DOfZ-xuk.d.ts +254 -0
- package/dist/runner-G1wxEgac.d.ts +852 -0
- package/dist/runtime/index.d.ts +357 -0
- package/dist/runtime/index.js +64 -0
- package/dist/session-manager-Uawm2Le7.d.ts +274 -0
- package/dist/skill/index.d.ts +103 -0
- package/dist/skill/index.js +39 -0
- package/dist/storage/index.d.ts +167 -0
- package/dist/storage/index.js +50 -0
- package/dist/sub-agent/index.d.ts +14 -0
- package/dist/sub-agent/index.js +15 -0
- package/dist/tool/index.d.ts +174 -1
- package/dist/tool/index.js +12 -3
- package/dist/tool-DYp6-cC3.d.ts +239 -0
- package/dist/tool-pFAnJc5Y.d.ts +419 -0
- package/dist/tracker-DClqYqTj.d.ts +96 -0
- package/dist/tracking/index.d.ts +109 -0
- package/dist/tracking/index.js +20 -0
- package/dist/types-BWo810L_.d.ts +648 -0
- package/dist/types-CQaXbRsS.d.ts +47 -0
- package/dist/types-VQgymC1N.d.ts +156 -0
- package/package.json +89 -5
- package/dist/index-BlSTfS-W.d.ts +0 -470
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { M as MCPConfig, a as MCPManager, d as MCPServerConfig, H as HttpTransportConfig, S as SseTransportConfig, f as StdioTransportConfig } from '../types-VQgymC1N.js';
|
|
2
|
+
export { b as MCPPrompt, c as MCPResource, e as MCPServerStatus } from '../types-VQgymC1N.js';
|
|
3
|
+
import 'ai';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Create an MCP manager for connecting to multiple MCP servers.
|
|
7
|
+
*/
|
|
8
|
+
declare function createMCPManager(config: MCPConfig): MCPManager;
|
|
9
|
+
/**
|
|
10
|
+
* Helper to define a single MCP server config.
|
|
11
|
+
*/
|
|
12
|
+
declare function defineServer(config: MCPServerConfig): MCPServerConfig;
|
|
13
|
+
/**
|
|
14
|
+
* Helper to create a stdio server config.
|
|
15
|
+
*/
|
|
16
|
+
declare function stdioServer(command: string, args?: string[], options?: Omit<StdioTransportConfig, "transport" | "command" | "args">): StdioTransportConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Helper to create an HTTP server config.
|
|
19
|
+
*/
|
|
20
|
+
declare function httpServer(url: string, options?: Omit<HttpTransportConfig, "transport" | "url">): HttpTransportConfig;
|
|
21
|
+
/**
|
|
22
|
+
* Helper to create an SSE server config.
|
|
23
|
+
*/
|
|
24
|
+
declare function sseServer(url: string, options?: Omit<SseTransportConfig, "transport" | "url">): SseTransportConfig;
|
|
25
|
+
|
|
26
|
+
export { HttpTransportConfig, MCPConfig, MCPManager, MCPServerConfig, SseTransportConfig, StdioTransportConfig, createMCPManager, defineServer, httpServer, sseServer, stdioServer };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message and token types for @cuylabs/agent-core
|
|
3
|
+
*
|
|
4
|
+
* Defines the message model used across conversations,
|
|
5
|
+
* including all role variants and token usage tracking.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Message roles
|
|
9
|
+
*/
|
|
10
|
+
type MessageRole = "user" | "assistant" | "tool" | "system";
|
|
11
|
+
/**
|
|
12
|
+
* Base message interface
|
|
13
|
+
*/
|
|
14
|
+
interface MessageBase {
|
|
15
|
+
id: string;
|
|
16
|
+
role: MessageRole;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* User message
|
|
21
|
+
*/
|
|
22
|
+
interface UserMessage extends MessageBase {
|
|
23
|
+
role: "user";
|
|
24
|
+
content: string;
|
|
25
|
+
/** Optional custom system prompt for this message */
|
|
26
|
+
system?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Assistant message
|
|
30
|
+
*/
|
|
31
|
+
interface AssistantMessage extends MessageBase {
|
|
32
|
+
role: "assistant";
|
|
33
|
+
content: string;
|
|
34
|
+
/** Finish reason */
|
|
35
|
+
finish?: "stop" | "length" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
36
|
+
/** Token usage for this response */
|
|
37
|
+
tokens?: TokenUsage;
|
|
38
|
+
/** Cost in USD */
|
|
39
|
+
cost?: number;
|
|
40
|
+
/** Error if any */
|
|
41
|
+
error?: MessageError;
|
|
42
|
+
/** Tool calls made by the assistant (when finish === "tool-calls") */
|
|
43
|
+
toolCalls?: Array<{
|
|
44
|
+
toolCallId: string;
|
|
45
|
+
toolName: string;
|
|
46
|
+
args: unknown;
|
|
47
|
+
}>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Tool result message
|
|
51
|
+
*/
|
|
52
|
+
interface ToolMessage extends MessageBase {
|
|
53
|
+
role: "tool";
|
|
54
|
+
content: string;
|
|
55
|
+
toolCallId: string;
|
|
56
|
+
toolName: string;
|
|
57
|
+
result: unknown;
|
|
58
|
+
/**
|
|
59
|
+
* Timestamp when this tool result was compacted/pruned.
|
|
60
|
+
* Once set, this message won't be pruned again.
|
|
61
|
+
*/
|
|
62
|
+
compactedAt?: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* System message
|
|
66
|
+
*/
|
|
67
|
+
interface SystemMessage extends MessageBase {
|
|
68
|
+
role: "system";
|
|
69
|
+
content: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Union of all message types
|
|
73
|
+
*/
|
|
74
|
+
type Message = UserMessage | AssistantMessage | ToolMessage | SystemMessage;
|
|
75
|
+
/**
|
|
76
|
+
* Error in a message
|
|
77
|
+
*/
|
|
78
|
+
interface MessageError {
|
|
79
|
+
name: string;
|
|
80
|
+
message: string;
|
|
81
|
+
code?: string;
|
|
82
|
+
status?: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Token usage statistics
|
|
86
|
+
*/
|
|
87
|
+
interface TokenUsage {
|
|
88
|
+
inputTokens?: number;
|
|
89
|
+
outputTokens?: number;
|
|
90
|
+
totalTokens?: number;
|
|
91
|
+
/** Cache read tokens (if supported) */
|
|
92
|
+
cacheReadTokens?: number;
|
|
93
|
+
/** Cache write tokens (if supported) */
|
|
94
|
+
cacheWriteTokens?: number;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Session state
|
|
98
|
+
*/
|
|
99
|
+
interface Session {
|
|
100
|
+
id: string;
|
|
101
|
+
messages: Message[];
|
|
102
|
+
createdAt: Date;
|
|
103
|
+
updatedAt: Date;
|
|
104
|
+
/** Optional title */
|
|
105
|
+
title?: string;
|
|
106
|
+
/** Parent session ID for forking */
|
|
107
|
+
parentID?: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export type { AssistantMessage as A, Message as M, Session as S, TokenUsage as T, UserMessage as U, MessageBase as a, MessageError as b, MessageRole as c, SystemMessage as d, ToolMessage as e };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { h as AgentMiddleware, i as AgentModelHooks, B as BlockedModelCall, M as MiddlewareRunner, m as ModelCallContext, f as ModelCallInput, n as ModelCallOutput, T as ToolCallDecision } from '../runner-G1wxEgac.js';
|
|
2
|
+
export { c as ApprovalMiddlewareConfig, O as OtelMiddlewareConfig, T as TelemetryConfig, e as TelemetryConfigResult, f as approvalMiddleware, g as createTelemetryConfig, o as otelMiddleware } from '../index-ipP3_ztp.js';
|
|
3
|
+
import 'ai';
|
|
4
|
+
import '../messages-BYWGn8TY.js';
|
|
5
|
+
import '../tool-pFAnJc5Y.js';
|
|
6
|
+
import 'zod';
|
|
7
|
+
import '../tool-DYp6-cC3.js';
|
|
8
|
+
import '../types-CQaXbRsS.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { g as getModelId, a as getProviderId } from '../identifiers-BLUxFqV_.js';
|
|
2
|
+
import { LanguageModel } from 'ai';
|
|
3
|
+
|
|
4
|
+
type AdapterKind = "openai" | "anthropic" | "google" | "openai-compatible";
|
|
5
|
+
type AdapterSettings = {
|
|
6
|
+
apiKey?: string;
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
extra?: Record<string, unknown>;
|
|
10
|
+
};
|
|
11
|
+
type EngineSpec = {
|
|
12
|
+
adapter: AdapterKind | string;
|
|
13
|
+
settings?: AdapterSettings;
|
|
14
|
+
build?: (modelId: string, settings: AdapterSettings) => LanguageModel;
|
|
15
|
+
};
|
|
16
|
+
type ModelSpec = {
|
|
17
|
+
engine: string;
|
|
18
|
+
id: string;
|
|
19
|
+
settings?: AdapterSettings;
|
|
20
|
+
};
|
|
21
|
+
type Directory = {
|
|
22
|
+
engines: Record<string, EngineSpec>;
|
|
23
|
+
entries?: Record<string, ModelSpec>;
|
|
24
|
+
};
|
|
25
|
+
type Resolver = (key: string) => Promise<LanguageModel>;
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Use `Resolver` (async) instead. Kept for backwards compatibility
|
|
28
|
+
* with custom `build` functions that return synchronously.
|
|
29
|
+
*/
|
|
30
|
+
type SyncResolver = (key: string) => LanguageModel;
|
|
31
|
+
declare function createResolver(directory: Directory): Resolver;
|
|
32
|
+
|
|
33
|
+
export { type AdapterSettings, type Directory, type EngineSpec, type ModelSpec, type Resolver, type SyncResolver, createResolver };
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { c as ModelFamily, l as EnvironmentInfo, I as InstructionFile } from '../runner-G1wxEgac.js';
|
|
2
|
+
export { a as PromptBuildContext, P as PromptConfig, b as PromptSection } from '../runner-G1wxEgac.js';
|
|
3
|
+
import { LanguageModel } from 'ai';
|
|
4
|
+
export { P as PromptBuilder, c as createPromptBuilder } from '../builder-BKkipazh.js';
|
|
5
|
+
export { d as SkillConfig } from '../tool-pFAnJc5Y.js';
|
|
6
|
+
import '../messages-BYWGn8TY.js';
|
|
7
|
+
import '../tool-DYp6-cC3.js';
|
|
8
|
+
import '../types-CQaXbRsS.js';
|
|
9
|
+
import '../registry-CuRWWtcT.js';
|
|
10
|
+
import 'zod';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Prompt Templates — Base system prompts per model family
|
|
14
|
+
*
|
|
15
|
+
* agent-core provides **generic, domain-agnostic** templates.
|
|
16
|
+
* These establish the agent's general approach and tool-use discipline
|
|
17
|
+
* without assuming a specific domain (coding, browsing, etc.).
|
|
18
|
+
*
|
|
19
|
+
* Domain-specific templates belong in consumer packages:
|
|
20
|
+
* - agent-code → coding templates ("read files before editing", etc.)
|
|
21
|
+
* - computer-agent → computer-use templates
|
|
22
|
+
* - your-custom-agent → whatever you need
|
|
23
|
+
*
|
|
24
|
+
* Consumer packages inject their templates via:
|
|
25
|
+
* createPromptBuilder({ baseTemplate: MY_CODING_TEMPLATE })
|
|
26
|
+
* builder.addSection({ id: "coding", ... })
|
|
27
|
+
*
|
|
28
|
+
* This file also contains model family detection, which IS infrastructure
|
|
29
|
+
* and belongs here — any consumer benefits from knowing the model family
|
|
30
|
+
* to optimize prompt formatting.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Detect which model family a LanguageModel belongs to.
|
|
35
|
+
*
|
|
36
|
+
* Uses the provider string first (most reliable), then falls back
|
|
37
|
+
* to pattern matching on the model ID.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import { anthropic } from "@ai-sdk/anthropic";
|
|
42
|
+
* detectModelFamily(anthropic("claude-sonnet-4-20250514")); // "anthropic"
|
|
43
|
+
*
|
|
44
|
+
* import { openai } from "@ai-sdk/openai";
|
|
45
|
+
* detectModelFamily(openai("gpt-4o")); // "openai"
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
declare function detectModelFamily(model: LanguageModel): ModelFamily;
|
|
49
|
+
/**
|
|
50
|
+
* Get the base template for a model family.
|
|
51
|
+
*
|
|
52
|
+
* @param family - Model family identifier
|
|
53
|
+
* @returns The generic system prompt template
|
|
54
|
+
*/
|
|
55
|
+
declare function getTemplate(family: ModelFamily): string;
|
|
56
|
+
/**
|
|
57
|
+
* Get all available template families.
|
|
58
|
+
* Useful for debugging or letting users choose.
|
|
59
|
+
*/
|
|
60
|
+
declare function getAvailableFamilies(): ModelFamily[];
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Environment Block — Runtime context for the system prompt
|
|
64
|
+
*
|
|
65
|
+
* Gathers information about the working environment (cwd, platform,
|
|
66
|
+
* git status, date, shell) and formats it as a structured block
|
|
67
|
+
* that gets injected into the prompt at priority 20.
|
|
68
|
+
*
|
|
69
|
+
* This gives the model awareness of:
|
|
70
|
+
* - Where it's working (directory, project)
|
|
71
|
+
* - What platform it's on (affects path separators, commands)
|
|
72
|
+
* - Current time (useful for time-sensitive tasks)
|
|
73
|
+
* - Git state (branch, clean/dirty)
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Gather runtime environment information.
|
|
78
|
+
*
|
|
79
|
+
* Collects cwd, platform, git status, date, and shell.
|
|
80
|
+
* Git commands use a short timeout to avoid hanging on slow repos.
|
|
81
|
+
*
|
|
82
|
+
* @param cwd - Working directory to gather info for
|
|
83
|
+
* @returns Environment info object
|
|
84
|
+
*/
|
|
85
|
+
declare function gatherEnvironment(cwd: string): EnvironmentInfo;
|
|
86
|
+
/**
|
|
87
|
+
* Format environment info as a prompt-friendly block.
|
|
88
|
+
*
|
|
89
|
+
* Output example:
|
|
90
|
+
* ```
|
|
91
|
+
* <workspace>
|
|
92
|
+
* Directory: /Users/dev/my-project
|
|
93
|
+
* Project: my-project
|
|
94
|
+
* Platform: macOS (darwin arm64)
|
|
95
|
+
* Date: Saturday, February 8, 2026
|
|
96
|
+
* Shell: /bin/zsh
|
|
97
|
+
* Git: main (clean)
|
|
98
|
+
* </workspace>
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
declare function formatEnvironment(info: EnvironmentInfo): string;
|
|
102
|
+
/**
|
|
103
|
+
* Create a short one-line summary of the environment.
|
|
104
|
+
* Useful for compact contexts or logging.
|
|
105
|
+
*/
|
|
106
|
+
declare function summarizeEnvironment(info: EnvironmentInfo): string;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Instruction File Discovery — Project rules from the filesystem
|
|
110
|
+
*
|
|
111
|
+
* Discovers instruction files (AGENTS.md, CLAUDE.md, COPILOT.md, etc.)
|
|
112
|
+
* by walking up the directory tree from cwd. These files provide
|
|
113
|
+
* project-specific or workspace-level guidance to the agent.
|
|
114
|
+
*
|
|
115
|
+
* Discovery order (general → specific):
|
|
116
|
+
* 1. Global instruction files (from config)
|
|
117
|
+
* 2. Workspace-level files (found near git root or higher directories)
|
|
118
|
+
* 3. Project-level files (found in or near cwd)
|
|
119
|
+
*
|
|
120
|
+
* All discovered files are included, ordered from most general to most
|
|
121
|
+
* specific. This means project-level instructions appear last and
|
|
122
|
+
* effectively take precedence in case of conflicting guidance.
|
|
123
|
+
*
|
|
124
|
+
* Compatible with:
|
|
125
|
+
* - AGENTS.md convention
|
|
126
|
+
* - CLAUDE.md convention
|
|
127
|
+
* - COPILOT.md convention
|
|
128
|
+
* - CuyLabs' own .cuylabs/instructions.md
|
|
129
|
+
*/
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Default file patterns to search for.
|
|
133
|
+
* Checked in each directory when walking up from cwd.
|
|
134
|
+
*/
|
|
135
|
+
declare const DEFAULT_INSTRUCTION_PATTERNS: string[];
|
|
136
|
+
/**
|
|
137
|
+
* Maximum file size for instruction files (50KB).
|
|
138
|
+
* Files larger than this are skipped to prevent prompt bloat.
|
|
139
|
+
*/
|
|
140
|
+
declare const DEFAULT_MAX_FILE_SIZE = 51200;
|
|
141
|
+
/**
|
|
142
|
+
* Maximum directories to walk up from cwd.
|
|
143
|
+
*/
|
|
144
|
+
declare const DEFAULT_MAX_DEPTH = 10;
|
|
145
|
+
/**
|
|
146
|
+
* Discover instruction files by walking up the directory tree from cwd.
|
|
147
|
+
*
|
|
148
|
+
* Searches for files matching the given patterns in each directory,
|
|
149
|
+
* starting from `cwd` and walking up to the filesystem root (or until
|
|
150
|
+
* `maxDepth` is reached).
|
|
151
|
+
*
|
|
152
|
+
* Results are ordered from **most general** (shallowest/root-level) to
|
|
153
|
+
* **most specific** (deepest/cwd-level), so that specific project rules
|
|
154
|
+
* appear last and take natural precedence.
|
|
155
|
+
*
|
|
156
|
+
* @param cwd - Starting directory for the search
|
|
157
|
+
* @param patterns - File name patterns to look for (e.g. ["AGENTS.md"])
|
|
158
|
+
* @param options - Discovery options
|
|
159
|
+
* @returns Array of discovered instruction files, general → specific
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* const files = await discoverInstructions("/Users/dev/project/src", [
|
|
164
|
+
* "AGENTS.md",
|
|
165
|
+
* "CLAUDE.md",
|
|
166
|
+
* ]);
|
|
167
|
+
*
|
|
168
|
+
* // Might find:
|
|
169
|
+
* // 1. /Users/dev/project/AGENTS.md (depth: 1, workspace)
|
|
170
|
+
* // 2. /Users/dev/project/src/AGENTS.md (depth: 0, project)
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
declare function discoverInstructions(cwd: string, patterns?: string[], options?: {
|
|
174
|
+
maxDepth?: number;
|
|
175
|
+
maxFileSize?: number;
|
|
176
|
+
stopAtGitRoot?: boolean;
|
|
177
|
+
}): Promise<InstructionFile[]>;
|
|
178
|
+
/**
|
|
179
|
+
* Load global instruction files from explicit paths.
|
|
180
|
+
*
|
|
181
|
+
* Global instructions are always included regardless of cwd.
|
|
182
|
+
* Useful for organization-wide coding standards or team rules.
|
|
183
|
+
*
|
|
184
|
+
* @param paths - Absolute paths to global instruction files
|
|
185
|
+
* @param maxSize - Maximum file size in bytes
|
|
186
|
+
* @returns Array of loaded instruction files
|
|
187
|
+
*/
|
|
188
|
+
declare function loadGlobalInstructions(paths: string[], maxSize?: number): Promise<InstructionFile[]>;
|
|
189
|
+
/**
|
|
190
|
+
* Format discovered instruction files into a prompt block.
|
|
191
|
+
*
|
|
192
|
+
* Each file is wrapped in a tagged block with its source path
|
|
193
|
+
* for transparency. Files are already ordered general → specific.
|
|
194
|
+
*
|
|
195
|
+
* Output example:
|
|
196
|
+
* ```
|
|
197
|
+
* <project-instructions>
|
|
198
|
+
*
|
|
199
|
+
* <instructions source="AGENTS.md" scope="workspace">
|
|
200
|
+
* ... workspace-level content ...
|
|
201
|
+
* </instructions>
|
|
202
|
+
*
|
|
203
|
+
* <instructions source="src/AGENTS.md" scope="project">
|
|
204
|
+
* ... project-specific content ...
|
|
205
|
+
* </instructions>
|
|
206
|
+
*
|
|
207
|
+
* </project-instructions>
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
declare function formatInstructions(files: InstructionFile[], basePath?: string): string;
|
|
211
|
+
|
|
212
|
+
/** Priority for the base template section. */
|
|
213
|
+
declare const PRIORITY_BASE = 10;
|
|
214
|
+
/** Priority for the environment block section. */
|
|
215
|
+
declare const PRIORITY_ENVIRONMENT = 20;
|
|
216
|
+
/** Priority for instruction files. */
|
|
217
|
+
declare const PRIORITY_INSTRUCTIONS = 30;
|
|
218
|
+
/** Priority for custom user-defined sections. */
|
|
219
|
+
declare const PRIORITY_CUSTOM = 50;
|
|
220
|
+
/** Priority for skill summary injection. */
|
|
221
|
+
declare const PRIORITY_SKILLS = 70;
|
|
222
|
+
/** Priority for per-turn override content. */
|
|
223
|
+
declare const PRIORITY_OVERRIDE = 90;
|
|
224
|
+
|
|
225
|
+
export { DEFAULT_INSTRUCTION_PATTERNS, DEFAULT_MAX_DEPTH, DEFAULT_MAX_FILE_SIZE, EnvironmentInfo, InstructionFile, ModelFamily, PRIORITY_BASE, PRIORITY_CUSTOM, PRIORITY_ENVIRONMENT, PRIORITY_INSTRUCTIONS, PRIORITY_OVERRIDE, PRIORITY_SKILLS, detectModelFamily, discoverInstructions, formatEnvironment, formatInstructions, gatherEnvironment, getAvailableFamilies, getTemplate, loadGlobalInstructions, summarizeEnvironment };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_INSTRUCTION_PATTERNS,
|
|
3
|
+
DEFAULT_MAX_DEPTH,
|
|
4
|
+
DEFAULT_MAX_FILE_SIZE,
|
|
5
|
+
PRIORITY_BASE,
|
|
6
|
+
PRIORITY_CUSTOM,
|
|
7
|
+
PRIORITY_ENVIRONMENT,
|
|
8
|
+
PRIORITY_INSTRUCTIONS,
|
|
9
|
+
PRIORITY_OVERRIDE,
|
|
10
|
+
PRIORITY_SKILLS,
|
|
11
|
+
PromptBuilder,
|
|
12
|
+
createPromptBuilder,
|
|
13
|
+
detectModelFamily,
|
|
14
|
+
discoverInstructions,
|
|
15
|
+
formatEnvironment,
|
|
16
|
+
formatInstructions,
|
|
17
|
+
gatherEnvironment,
|
|
18
|
+
getAvailableFamilies,
|
|
19
|
+
getTemplate,
|
|
20
|
+
loadGlobalInstructions,
|
|
21
|
+
summarizeEnvironment
|
|
22
|
+
} from "../chunk-IVUJDISU.js";
|
|
23
|
+
import "../chunk-LRHOS4ZN.js";
|
|
24
|
+
export {
|
|
25
|
+
DEFAULT_INSTRUCTION_PATTERNS,
|
|
26
|
+
DEFAULT_MAX_DEPTH,
|
|
27
|
+
DEFAULT_MAX_FILE_SIZE,
|
|
28
|
+
PRIORITY_BASE,
|
|
29
|
+
PRIORITY_CUSTOM,
|
|
30
|
+
PRIORITY_ENVIRONMENT,
|
|
31
|
+
PRIORITY_INSTRUCTIONS,
|
|
32
|
+
PRIORITY_OVERRIDE,
|
|
33
|
+
PRIORITY_SKILLS,
|
|
34
|
+
PromptBuilder,
|
|
35
|
+
createPromptBuilder,
|
|
36
|
+
detectModelFamily,
|
|
37
|
+
discoverInstructions,
|
|
38
|
+
formatEnvironment,
|
|
39
|
+
formatInstructions,
|
|
40
|
+
gatherEnvironment,
|
|
41
|
+
getAvailableFamilies,
|
|
42
|
+
getTemplate,
|
|
43
|
+
loadGlobalInstructions,
|
|
44
|
+
summarizeEnvironment
|
|
45
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { R as ReasoningLevel } from '../types-CQaXbRsS.js';
|
|
2
|
+
export { E as EXTENDED_LEVELS, F as FIXED_LEVELS, a as ReasoningConfig, S as STANDARD_LEVELS, s as shouldIncludeReasoningSummary } from '../types-CQaXbRsS.js';
|
|
3
|
+
import { P as ProviderCompatibility } from '../resolver-DOfZ-xuk.js';
|
|
4
|
+
export { e as extractModelId, a as extractProvider } from '../resolver-DOfZ-xuk.js';
|
|
5
|
+
export { b as buildReasoningOptions, a as buildReasoningOptionsSync, g as getReasoningConfig, c as getReasoningConfigSync, s as supportsReasoning, d as supportsReasoningSync } from '../config-D2xeGEHK.js';
|
|
6
|
+
import 'ai';
|
|
7
|
+
import '@ai-sdk/provider-utils';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Provider-Specific Reasoning Option Builders
|
|
11
|
+
*
|
|
12
|
+
* Each function takes a {@link ReasoningLevel} and returns the
|
|
13
|
+
* provider-options object expected by the Vercel AI SDK's
|
|
14
|
+
* `providerOptions` parameter.
|
|
15
|
+
*
|
|
16
|
+
* Provider key mapping (`getProviderOptionsKey`) is also defined
|
|
17
|
+
* here so that callers can wrap the raw options correctly.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Build OpenAI reasoning options.
|
|
22
|
+
*
|
|
23
|
+
* OpenAI reasoning models use:
|
|
24
|
+
* - `reasoningEffort` — controls depth
|
|
25
|
+
* - `reasoningSummary` — controls whether reasoning is streamed
|
|
26
|
+
* (`"auto"` = condensed summary, `"detailed"` = full)
|
|
27
|
+
*
|
|
28
|
+
* `reasoningSummary` requires a verified OpenAI organisation.
|
|
29
|
+
* Set `CODE_AGENT_DISABLE_REASONING_SUMMARY=true` to skip it.
|
|
30
|
+
*/
|
|
31
|
+
declare function buildOpenAIOptions(level: ReasoningLevel, compat?: ProviderCompatibility): Record<string, unknown> | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Build Anthropic thinking options.
|
|
34
|
+
*
|
|
35
|
+
* Uses `thinking.type: "enabled"` with `budgetTokens`.
|
|
36
|
+
*/
|
|
37
|
+
declare function buildAnthropicOptions(level: ReasoningLevel): Record<string, unknown> | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Build Google / Gemini reasoning options.
|
|
40
|
+
*
|
|
41
|
+
* - **Gemini 3+** uses `thinkingLevel` (`"low"` / `"high"`)
|
|
42
|
+
* - **Gemini 2.5 and earlier** uses `thinkingBudget` (token count)
|
|
43
|
+
*/
|
|
44
|
+
declare function buildGoogleOptions(level: ReasoningLevel, modelId?: string): Record<string, unknown> | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Build xAI / Grok reasoning options.
|
|
47
|
+
*/
|
|
48
|
+
declare function buildXAIOptions(level: ReasoningLevel): Record<string, unknown> | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Build Groq reasoning options.
|
|
51
|
+
*/
|
|
52
|
+
declare function buildGroqOptions(level: ReasoningLevel): Record<string, unknown> | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Build Amazon Bedrock reasoning options.
|
|
55
|
+
*
|
|
56
|
+
* - Anthropic / Claude models use `budgetTokens`
|
|
57
|
+
* - Amazon Nova models use `maxReasoningEffort`
|
|
58
|
+
*/
|
|
59
|
+
declare function buildBedrockOptions(level: ReasoningLevel, modelId?: string): Record<string, unknown> | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Build OpenRouter reasoning options.
|
|
62
|
+
*/
|
|
63
|
+
declare function buildOpenRouterOptions(level: ReasoningLevel): Record<string, unknown> | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Resolve the `providerOptions` key for a given SDK provider string.
|
|
66
|
+
*
|
|
67
|
+
* Falls back to the first dot-segment (e.g. `"foo.bar"` → `"foo"`).
|
|
68
|
+
*/
|
|
69
|
+
declare function getProviderOptionsKey(provider: string): string;
|
|
70
|
+
|
|
71
|
+
export { ReasoningLevel, buildAnthropicOptions, buildBedrockOptions, buildGoogleOptions, buildGroqOptions, buildOpenAIOptions, buildOpenRouterOptions, buildXAIOptions, getProviderOptionsKey };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EXTENDED_LEVELS,
|
|
3
|
+
FIXED_LEVELS,
|
|
4
|
+
STANDARD_LEVELS,
|
|
5
|
+
buildAnthropicOptions,
|
|
6
|
+
buildBedrockOptions,
|
|
7
|
+
buildGoogleOptions,
|
|
8
|
+
buildGroqOptions,
|
|
9
|
+
buildOpenAIOptions,
|
|
10
|
+
buildOpenRouterOptions,
|
|
11
|
+
buildReasoningOptions,
|
|
12
|
+
buildReasoningOptionsSync,
|
|
13
|
+
buildXAIOptions,
|
|
14
|
+
getProviderOptionsKey,
|
|
15
|
+
getReasoningConfig,
|
|
16
|
+
getReasoningConfigSync,
|
|
17
|
+
shouldIncludeReasoningSummary,
|
|
18
|
+
supportsReasoning,
|
|
19
|
+
supportsReasoningSync
|
|
20
|
+
} from "../chunk-X635CM2F.js";
|
|
21
|
+
import {
|
|
22
|
+
extractModelId,
|
|
23
|
+
extractProvider
|
|
24
|
+
} from "../chunk-QWFMX226.js";
|
|
25
|
+
import "../chunk-DWYX7ASF.js";
|
|
26
|
+
export {
|
|
27
|
+
EXTENDED_LEVELS,
|
|
28
|
+
FIXED_LEVELS,
|
|
29
|
+
STANDARD_LEVELS,
|
|
30
|
+
buildAnthropicOptions,
|
|
31
|
+
buildBedrockOptions,
|
|
32
|
+
buildGoogleOptions,
|
|
33
|
+
buildGroqOptions,
|
|
34
|
+
buildOpenAIOptions,
|
|
35
|
+
buildOpenRouterOptions,
|
|
36
|
+
buildReasoningOptions,
|
|
37
|
+
buildReasoningOptionsSync,
|
|
38
|
+
buildXAIOptions,
|
|
39
|
+
extractModelId,
|
|
40
|
+
extractProvider,
|
|
41
|
+
getProviderOptionsKey,
|
|
42
|
+
getReasoningConfig,
|
|
43
|
+
getReasoningConfigSync,
|
|
44
|
+
shouldIncludeReasoningSummary,
|
|
45
|
+
supportsReasoning,
|
|
46
|
+
supportsReasoningSync
|
|
47
|
+
};
|