@comma-agents/core 2.0.0-rc.0 → 2.0.0-rc.1
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/agents/agent/agent.types.d.ts +2 -2
- package/dist/agents/loader/index.d.ts +2 -2
- package/dist/agents/loader/loader.d.ts +3 -5
- package/dist/agents/loader/loader.schema.d.ts +226 -13
- package/dist/agents/loader/loader.types.d.ts +9 -8
- package/dist/agents/registry/agent-registry.constants.d.ts +1 -0
- package/dist/agents/registry/agent-registry.d.ts +38 -0
- package/dist/agents/registry/agent-registry.types.d.ts +58 -0
- package/dist/agents/registry/index.d.ts +2 -0
- package/dist/credentials/backends/json-file.d.ts +1 -1
- package/dist/credentials/credentials.constants.d.ts +2 -0
- package/dist/credentials/credentials.utils.d.ts +0 -19
- package/dist/credentials/index.d.ts +1 -1
- package/dist/data-directory/data-directory.d.ts +11 -0
- package/dist/data-directory/index.d.ts +1 -0
- package/dist/defaults/defaults.d.ts +1 -1
- package/dist/flows/index.d.ts +2 -0
- package/dist/flows/loader/loader.schema.d.ts +2 -195
- package/dist/flows/loader/loader.utils.d.ts +5 -0
- package/dist/flows/registry/flow-registry.constants.d.ts +1 -0
- package/dist/flows/registry/flow-registry.d.ts +45 -0
- package/dist/flows/registry/flow-registry.types.d.ts +31 -0
- package/dist/flows/registry/index.d.ts +2 -0
- package/dist/hub/archive/archive.d.ts +2 -0
- package/dist/hub/archive/index.d.ts +1 -0
- package/dist/hub/comma-project.schema.json +171 -0
- package/dist/hub/hub.constants.d.ts +5 -0
- package/dist/hub/hub.d.ts +13 -0
- package/dist/hub/hub.schema.d.ts +1093 -0
- package/dist/hub/hub.types.d.ts +50 -0
- package/dist/hub/hub.utils.d.ts +3 -0
- package/dist/hub/index.d.ts +3 -0
- package/dist/hub/index.js +404 -0
- package/dist/hub/installed-packages/index.d.ts +2 -0
- package/dist/hub/installed-packages/installed-packages.d.ts +3 -0
- package/dist/hub/installed-packages/installed-packages.types.d.ts +14 -0
- package/dist/hub/package-installer/index.d.ts +2 -0
- package/dist/hub/package-installer/package-installer.d.ts +3 -0
- package/dist/hub/package-installer/package-installer.types.d.ts +11 -0
- package/dist/hub/registry-client/index.d.ts +2 -0
- package/dist/hub/registry-client/registry-client.d.ts +3 -0
- package/dist/hub/registry-client/registry-client.types.d.ts +10 -0
- package/dist/index.d.ts +13 -10
- package/dist/index.js +1386 -769
- package/dist/model/providers/catalog/catalog.utils.d.ts +2 -9
- package/dist/skills/skills.constants.d.ts +2 -2
- package/dist/skills/skills.types.d.ts +1 -1
- package/dist/skills/skills.utils.d.ts +0 -10
- package/dist/strategies/@comma/core-strategies/README.md +9 -0
- package/dist/strategies/@comma/core-strategies/build/build.json +69 -0
- package/dist/strategies/@comma/core-strategies/build/prompts/coder.md +56 -0
- package/dist/strategies/@comma/core-strategies/build/prompts/tester.md +39 -0
- package/dist/strategies/@comma/core-strategies/comma-project.json +49 -0
- package/dist/strategies/@comma/core-strategies/plan/plan.json +66 -0
- package/dist/strategies/@comma/core-strategies/plan/prompts/planner.md +59 -0
- package/dist/strategies/@comma/core-strategies/plan/prompts/reviewer.md +34 -0
- package/dist/strategies/@comma/core-strategies/qa.json +36 -0
- package/dist/strategies/@comma/core-strategies/reduce-complexity/reduce-complexity.jsonc +24 -0
- package/dist/strategies/@comma/core-strategies/standardize/manager.jsonc +54 -0
- package/dist/strategies/@comma/core-strategies/standardize/prompts/manager.md +278 -0
- package/dist/strategies/@comma/core-strategies/standardize/prompts/worker-auditor.md +131 -0
- package/dist/strategies/@comma/core-strategies/standardize/prompts/worker-reviewer.md +58 -0
- package/dist/strategies/@comma/core-strategies/standardize/worker.jsonc +69 -0
- package/dist/strategies/@comma/core-strategies/talk.json +42 -0
- package/dist/strategy/discover/discover.d.ts +10 -2
- package/dist/strategy/discover/discover.types.d.ts +6 -5
- package/dist/strategy/discover/discover.utils.d.ts +2 -13
- package/dist/strategy/discover/index.d.ts +1 -1
- package/dist/strategy/index.d.ts +3 -3
- package/dist/strategy/loader/loader.types.d.ts +2 -70
- package/dist/strategy/loader/loader.utils.d.ts +1 -8
- package/dist/strategy/loader/project-loader.d.ts +7 -1
- package/dist/strategy/schema.d.ts +154 -60
- package/dist/tools/built-in/list-strategy/list-strategy.d.ts +2 -2
- package/package.json +18 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AbortableAsyncGenerator, AbortablePromise } from "../../abortable";
|
|
2
1
|
import type { tool as aiTool, CallSettings, FlexibleSchema, LanguageModel, ModelMessage, StepResult, stepCountIs, streamText, ToolChoice } from "ai";
|
|
2
|
+
import type { AbortableAsyncGenerator, AbortablePromise } from "../../abortable";
|
|
3
3
|
import type { ContextUsage, ConversationContext, ConversationContextOptions, ConversationRetentionEvent, ResponseMessage } from "../../conversation-context";
|
|
4
4
|
import type { LanguageService } from "../../language";
|
|
5
5
|
import type { PromptTemplate, TemplateVariables } from "../../prompts";
|
|
@@ -73,7 +73,7 @@ export interface AgentConfig {
|
|
|
73
73
|
* Skill registry exposed to the `load_skill` tool when included in `tools`.
|
|
74
74
|
* When omitted, `load_skill` returns `skill_unavailable` for every call.
|
|
75
75
|
* Typically populated by the strategy loader from
|
|
76
|
-
*
|
|
76
|
+
* `~/.comma/skills/` plus `./.comma/skills/`.
|
|
77
77
|
*/
|
|
78
78
|
readonly skillRegistry?: SkillRegistry;
|
|
79
79
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { loadAgent, loadAgentFromString } from "./loader";
|
|
2
|
-
export type { AgentDescription } from "./loader.schema";
|
|
3
|
-
export { AgentDescriptionSchema } from "./loader.schema";
|
|
2
|
+
export type { AgentDescription, CustomAgentDescription, LLMAgentDescription, } from "./loader.schema";
|
|
3
|
+
export { AgentDescriptionSchema, CustomAgentDescriptionSchema, LLMAgentDescriptionSchema, } from "./loader.schema";
|
|
4
4
|
export type { LoadAgentOptions } from "./loader.types";
|
|
@@ -8,8 +8,7 @@ import type { LoadAgentOptions } from "./loader.types";
|
|
|
8
8
|
* live `Agent` ready to call.
|
|
9
9
|
*
|
|
10
10
|
* @param filePath - Absolute or relative path to the agent description file.
|
|
11
|
-
* @param options
|
|
12
|
-
* Optional — when omitted, global defaults are used for model resolution.
|
|
11
|
+
* @param options - Runtime services and optional model override.
|
|
13
12
|
* @returns A live Agent instance.
|
|
14
13
|
* @throws {StrategyValidationError} If the file is invalid or missing required fields.
|
|
15
14
|
*
|
|
@@ -31,8 +30,7 @@ export declare function loadAgent(filePath: string, options?: LoadAgentOptions):
|
|
|
31
30
|
*
|
|
32
31
|
* @param content - The raw agent description string.
|
|
33
32
|
* @param format - "json" or "yaml".
|
|
34
|
-
* @param options -
|
|
35
|
-
* Optional — when omitted, global defaults are used for model resolution.
|
|
33
|
+
* @param options - Runtime services and optional model override.
|
|
36
34
|
* @returns A live Agent instance.
|
|
37
35
|
* @throws {StrategyValidationError} If parsing or validation fails.
|
|
38
36
|
*
|
|
@@ -46,4 +44,4 @@ export declare function loadAgent(filePath: string, options?: LoadAgentOptions):
|
|
|
46
44
|
* const agent = await loadAgentFromString(yaml, "yaml");
|
|
47
45
|
* ```
|
|
48
46
|
*/
|
|
49
|
-
export declare function loadAgentFromString(content: string, format: "json" | "yaml",
|
|
47
|
+
export declare function loadAgentFromString(content: string, format: "json" | "yaml", options?: LoadAgentOptions): Promise<Agent>;
|
|
@@ -16,11 +16,9 @@ export declare const SystemPromptTemplateSchema: z.ZodObject<{
|
|
|
16
16
|
variables?: Record<string, string | number | boolean | string[] | Record<string, string>> | undefined;
|
|
17
17
|
}>;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* provider. Provider-specific features (extended thinking, reasoning
|
|
23
|
-
* effort) should use `providerOptions` instead.
|
|
19
|
+
* Provider-independent generation parameters applied to every model call.
|
|
20
|
+
* Provider-specific features such as extended thinking or reasoning effort
|
|
21
|
+
* belong in `providerOptions` instead.
|
|
24
22
|
*/
|
|
25
23
|
export declare const ModelOptionsSchema: z.ZodObject<{
|
|
26
24
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
@@ -89,7 +87,7 @@ export declare const ConversationContextSchema: z.ZodObject<{
|
|
|
89
87
|
} | undefined;
|
|
90
88
|
}>;
|
|
91
89
|
/**
|
|
92
|
-
*
|
|
90
|
+
* Standalone LLM-backed agent description.
|
|
93
91
|
*
|
|
94
92
|
* @example
|
|
95
93
|
* ```yaml
|
|
@@ -97,13 +95,15 @@ export declare const ConversationContextSchema: z.ZodObject<{
|
|
|
97
95
|
* model: openai/gpt-4o
|
|
98
96
|
* systemPrompt: You are a research assistant.
|
|
99
97
|
* tools:
|
|
100
|
-
* -
|
|
101
|
-
* -
|
|
98
|
+
* - read_file
|
|
99
|
+
* - search_files
|
|
102
100
|
* ```
|
|
103
101
|
*/
|
|
104
|
-
export declare const
|
|
102
|
+
export declare const LLMAgentDescriptionSchema: z.ZodObject<{
|
|
105
103
|
/** Unique name for this agent. */
|
|
106
104
|
name: z.ZodString;
|
|
105
|
+
/** Built-in LLM agent type. May be omitted. */
|
|
106
|
+
type: z.ZodOptional<z.ZodLiteral<"llm">>;
|
|
107
107
|
/** Optional human-readable description. */
|
|
108
108
|
description: z.ZodOptional<z.ZodString>;
|
|
109
109
|
/** Model string in "providerID/modelID" format (e.g., "openai/gpt-4o"). */
|
|
@@ -124,9 +124,8 @@ export declare const AgentDescriptionSchema: z.ZodObject<{
|
|
|
124
124
|
/** Tool names to make available to the agent. */
|
|
125
125
|
tools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
126
126
|
/**
|
|
127
|
-
* Per-call
|
|
128
|
-
*
|
|
129
|
-
* or OpenAI reasoning effort. Shape:
|
|
127
|
+
* Per-call options for provider-specific features such as extended
|
|
128
|
+
* thinking or reasoning effort. Shape:
|
|
130
129
|
* `{ <providerId>: { <option>: <value>, ... }, ... }`.
|
|
131
130
|
*/
|
|
132
131
|
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
@@ -205,13 +204,47 @@ export declare const AgentDescriptionSchema: z.ZodObject<{
|
|
|
205
204
|
}, "strict", z.ZodTypeAny, {
|
|
206
205
|
name: string;
|
|
207
206
|
model: string;
|
|
207
|
+
type?: "llm" | undefined;
|
|
208
208
|
description?: string | undefined;
|
|
209
|
+
tools?: string[] | undefined;
|
|
209
210
|
systemPrompt?: string | undefined;
|
|
210
211
|
systemPromptTemplate?: {
|
|
211
212
|
template: string;
|
|
212
213
|
variables?: Record<string, string | number | boolean | string[] | Record<string, string>> | undefined;
|
|
213
214
|
} | undefined;
|
|
215
|
+
providerOptions?: Record<string, Record<string, unknown>> | undefined;
|
|
216
|
+
modelOptions?: {
|
|
217
|
+
temperature?: number | undefined;
|
|
218
|
+
topP?: number | undefined;
|
|
219
|
+
topK?: number | undefined;
|
|
220
|
+
maxOutputTokens?: number | undefined;
|
|
221
|
+
maxRetries?: number | undefined;
|
|
222
|
+
frequencyPenalty?: number | undefined;
|
|
223
|
+
presencePenalty?: number | undefined;
|
|
224
|
+
seed?: number | undefined;
|
|
225
|
+
} | undefined;
|
|
226
|
+
outputSchema?: Record<string, unknown> | undefined;
|
|
227
|
+
context?: {
|
|
228
|
+
rollingWindow?: number | {
|
|
229
|
+
maxRecords: number;
|
|
230
|
+
} | undefined;
|
|
231
|
+
compaction?: boolean | {
|
|
232
|
+
keepRecent?: number | undefined;
|
|
233
|
+
threshold?: number | undefined;
|
|
234
|
+
} | undefined;
|
|
235
|
+
} | undefined;
|
|
236
|
+
maxSteps?: number | undefined;
|
|
237
|
+
}, {
|
|
238
|
+
name: string;
|
|
239
|
+
model: string;
|
|
240
|
+
type?: "llm" | undefined;
|
|
241
|
+
description?: string | undefined;
|
|
214
242
|
tools?: string[] | undefined;
|
|
243
|
+
systemPrompt?: string | undefined;
|
|
244
|
+
systemPromptTemplate?: {
|
|
245
|
+
template: string;
|
|
246
|
+
variables?: Record<string, string | number | boolean | string[] | Record<string, string>> | undefined;
|
|
247
|
+
} | undefined;
|
|
215
248
|
providerOptions?: Record<string, Record<string, unknown>> | undefined;
|
|
216
249
|
modelOptions?: {
|
|
217
250
|
temperature?: number | undefined;
|
|
@@ -234,16 +267,175 @@ export declare const AgentDescriptionSchema: z.ZodObject<{
|
|
|
234
267
|
} | undefined;
|
|
235
268
|
} | undefined;
|
|
236
269
|
maxSteps?: number | undefined;
|
|
270
|
+
}>;
|
|
271
|
+
/** Standalone registered agent description with implementation-specific configuration. */
|
|
272
|
+
export declare const CustomAgentDescriptionSchema: z.ZodObject<{
|
|
273
|
+
/** Unique name for this agent. */
|
|
274
|
+
name: z.ZodString;
|
|
275
|
+
/** Optional human-readable description. */
|
|
276
|
+
description: z.ZodOptional<z.ZodString>;
|
|
277
|
+
/** Name registered with `registerAgent`. */
|
|
278
|
+
type: z.ZodEffects<z.ZodString, string, string>;
|
|
279
|
+
/** Configuration validated by the registered agent type. */
|
|
280
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
281
|
+
}, "strict", z.ZodTypeAny, {
|
|
282
|
+
type: string;
|
|
283
|
+
name: string;
|
|
284
|
+
description?: string | undefined;
|
|
285
|
+
config?: Record<string, unknown> | undefined;
|
|
237
286
|
}, {
|
|
287
|
+
type: string;
|
|
288
|
+
name: string;
|
|
289
|
+
description?: string | undefined;
|
|
290
|
+
config?: Record<string, unknown> | undefined;
|
|
291
|
+
}>;
|
|
292
|
+
/** A standalone built-in LLM or registered custom agent description. */
|
|
293
|
+
export declare const AgentDescriptionSchema: z.ZodUnion<[z.ZodObject<{
|
|
294
|
+
/** Unique name for this agent. */
|
|
295
|
+
name: z.ZodString;
|
|
296
|
+
/** Built-in LLM agent type. May be omitted. */
|
|
297
|
+
type: z.ZodOptional<z.ZodLiteral<"llm">>;
|
|
298
|
+
/** Optional human-readable description. */
|
|
299
|
+
description: z.ZodOptional<z.ZodString>;
|
|
300
|
+
/** Model string in "providerID/modelID" format (e.g., "openai/gpt-4o"). */
|
|
301
|
+
model: z.ZodString;
|
|
302
|
+
/** Static system prompt sent to the model. Mutually exclusive with systemPromptTemplate. */
|
|
303
|
+
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
304
|
+
/** Dynamic system prompt using Liquid template syntax. */
|
|
305
|
+
systemPromptTemplate: z.ZodOptional<z.ZodObject<{
|
|
306
|
+
template: z.ZodString;
|
|
307
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">, z.ZodRecord<z.ZodString, z.ZodString>]>>>;
|
|
308
|
+
}, "strict", z.ZodTypeAny, {
|
|
309
|
+
template: string;
|
|
310
|
+
variables?: Record<string, string | number | boolean | string[] | Record<string, string>> | undefined;
|
|
311
|
+
}, {
|
|
312
|
+
template: string;
|
|
313
|
+
variables?: Record<string, string | number | boolean | string[] | Record<string, string>> | undefined;
|
|
314
|
+
}>>;
|
|
315
|
+
/** Tool names to make available to the agent. */
|
|
316
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
317
|
+
/**
|
|
318
|
+
* Per-call options for provider-specific features such as extended
|
|
319
|
+
* thinking or reasoning effort. Shape:
|
|
320
|
+
* `{ <providerId>: { <option>: <value>, ... }, ... }`.
|
|
321
|
+
*/
|
|
322
|
+
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
323
|
+
/** Model-level generation parameters (temperature, maxTokens, etc.). */
|
|
324
|
+
modelOptions: z.ZodOptional<z.ZodObject<{
|
|
325
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
326
|
+
topP: z.ZodOptional<z.ZodNumber>;
|
|
327
|
+
topK: z.ZodOptional<z.ZodNumber>;
|
|
328
|
+
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
329
|
+
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
330
|
+
frequencyPenalty: z.ZodOptional<z.ZodNumber>;
|
|
331
|
+
presencePenalty: z.ZodOptional<z.ZodNumber>;
|
|
332
|
+
seed: z.ZodOptional<z.ZodNumber>;
|
|
333
|
+
}, "strict", z.ZodTypeAny, {
|
|
334
|
+
temperature?: number | undefined;
|
|
335
|
+
topP?: number | undefined;
|
|
336
|
+
topK?: number | undefined;
|
|
337
|
+
maxOutputTokens?: number | undefined;
|
|
338
|
+
maxRetries?: number | undefined;
|
|
339
|
+
frequencyPenalty?: number | undefined;
|
|
340
|
+
presencePenalty?: number | undefined;
|
|
341
|
+
seed?: number | undefined;
|
|
342
|
+
}, {
|
|
343
|
+
temperature?: number | undefined;
|
|
344
|
+
topP?: number | undefined;
|
|
345
|
+
topK?: number | undefined;
|
|
346
|
+
maxOutputTokens?: number | undefined;
|
|
347
|
+
maxRetries?: number | undefined;
|
|
348
|
+
frequencyPenalty?: number | undefined;
|
|
349
|
+
presencePenalty?: number | undefined;
|
|
350
|
+
seed?: number | undefined;
|
|
351
|
+
}>>;
|
|
352
|
+
/** JSON Schema describing the agent's structured output. */
|
|
353
|
+
outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
354
|
+
/** Conversation context retention and compaction controls. */
|
|
355
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
356
|
+
rollingWindow: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodObject<{
|
|
357
|
+
maxRecords: z.ZodNumber;
|
|
358
|
+
}, "strict", z.ZodTypeAny, {
|
|
359
|
+
maxRecords: number;
|
|
360
|
+
}, {
|
|
361
|
+
maxRecords: number;
|
|
362
|
+
}>]>>;
|
|
363
|
+
compaction: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
|
|
364
|
+
keepRecent: z.ZodOptional<z.ZodNumber>;
|
|
365
|
+
threshold: z.ZodOptional<z.ZodNumber>;
|
|
366
|
+
}, "strict", z.ZodTypeAny, {
|
|
367
|
+
keepRecent?: number | undefined;
|
|
368
|
+
threshold?: number | undefined;
|
|
369
|
+
}, {
|
|
370
|
+
keepRecent?: number | undefined;
|
|
371
|
+
threshold?: number | undefined;
|
|
372
|
+
}>]>>;
|
|
373
|
+
}, "strict", z.ZodTypeAny, {
|
|
374
|
+
rollingWindow?: number | {
|
|
375
|
+
maxRecords: number;
|
|
376
|
+
} | undefined;
|
|
377
|
+
compaction?: boolean | {
|
|
378
|
+
keepRecent?: number | undefined;
|
|
379
|
+
threshold?: number | undefined;
|
|
380
|
+
} | undefined;
|
|
381
|
+
}, {
|
|
382
|
+
rollingWindow?: number | {
|
|
383
|
+
maxRecords: number;
|
|
384
|
+
} | undefined;
|
|
385
|
+
compaction?: boolean | {
|
|
386
|
+
keepRecent?: number | undefined;
|
|
387
|
+
threshold?: number | undefined;
|
|
388
|
+
} | undefined;
|
|
389
|
+
}>>;
|
|
390
|
+
/**
|
|
391
|
+
* Maximum number of LLM round-trips (steps) per call.
|
|
392
|
+
* Each tool-call + response counts as one step.
|
|
393
|
+
*/
|
|
394
|
+
maxSteps: z.ZodOptional<z.ZodNumber>;
|
|
395
|
+
}, "strict", z.ZodTypeAny, {
|
|
238
396
|
name: string;
|
|
239
397
|
model: string;
|
|
398
|
+
type?: "llm" | undefined;
|
|
240
399
|
description?: string | undefined;
|
|
400
|
+
tools?: string[] | undefined;
|
|
241
401
|
systemPrompt?: string | undefined;
|
|
242
402
|
systemPromptTemplate?: {
|
|
243
403
|
template: string;
|
|
244
404
|
variables?: Record<string, string | number | boolean | string[] | Record<string, string>> | undefined;
|
|
245
405
|
} | undefined;
|
|
406
|
+
providerOptions?: Record<string, Record<string, unknown>> | undefined;
|
|
407
|
+
modelOptions?: {
|
|
408
|
+
temperature?: number | undefined;
|
|
409
|
+
topP?: number | undefined;
|
|
410
|
+
topK?: number | undefined;
|
|
411
|
+
maxOutputTokens?: number | undefined;
|
|
412
|
+
maxRetries?: number | undefined;
|
|
413
|
+
frequencyPenalty?: number | undefined;
|
|
414
|
+
presencePenalty?: number | undefined;
|
|
415
|
+
seed?: number | undefined;
|
|
416
|
+
} | undefined;
|
|
417
|
+
outputSchema?: Record<string, unknown> | undefined;
|
|
418
|
+
context?: {
|
|
419
|
+
rollingWindow?: number | {
|
|
420
|
+
maxRecords: number;
|
|
421
|
+
} | undefined;
|
|
422
|
+
compaction?: boolean | {
|
|
423
|
+
keepRecent?: number | undefined;
|
|
424
|
+
threshold?: number | undefined;
|
|
425
|
+
} | undefined;
|
|
426
|
+
} | undefined;
|
|
427
|
+
maxSteps?: number | undefined;
|
|
428
|
+
}, {
|
|
429
|
+
name: string;
|
|
430
|
+
model: string;
|
|
431
|
+
type?: "llm" | undefined;
|
|
432
|
+
description?: string | undefined;
|
|
246
433
|
tools?: string[] | undefined;
|
|
434
|
+
systemPrompt?: string | undefined;
|
|
435
|
+
systemPromptTemplate?: {
|
|
436
|
+
template: string;
|
|
437
|
+
variables?: Record<string, string | number | boolean | string[] | Record<string, string>> | undefined;
|
|
438
|
+
} | undefined;
|
|
247
439
|
providerOptions?: Record<string, Record<string, unknown>> | undefined;
|
|
248
440
|
modelOptions?: {
|
|
249
441
|
temperature?: number | undefined;
|
|
@@ -266,5 +458,26 @@ export declare const AgentDescriptionSchema: z.ZodObject<{
|
|
|
266
458
|
} | undefined;
|
|
267
459
|
} | undefined;
|
|
268
460
|
maxSteps?: number | undefined;
|
|
269
|
-
}
|
|
461
|
+
}>, z.ZodObject<{
|
|
462
|
+
/** Unique name for this agent. */
|
|
463
|
+
name: z.ZodString;
|
|
464
|
+
/** Optional human-readable description. */
|
|
465
|
+
description: z.ZodOptional<z.ZodString>;
|
|
466
|
+
/** Name registered with `registerAgent`. */
|
|
467
|
+
type: z.ZodEffects<z.ZodString, string, string>;
|
|
468
|
+
/** Configuration validated by the registered agent type. */
|
|
469
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
470
|
+
}, "strict", z.ZodTypeAny, {
|
|
471
|
+
type: string;
|
|
472
|
+
name: string;
|
|
473
|
+
description?: string | undefined;
|
|
474
|
+
config?: Record<string, unknown> | undefined;
|
|
475
|
+
}, {
|
|
476
|
+
type: string;
|
|
477
|
+
name: string;
|
|
478
|
+
description?: string | undefined;
|
|
479
|
+
config?: Record<string, unknown> | undefined;
|
|
480
|
+
}>]>;
|
|
481
|
+
export type LLMAgentDescription = z.infer<typeof LLMAgentDescriptionSchema>;
|
|
482
|
+
export type CustomAgentDescription = z.infer<typeof CustomAgentDescriptionSchema>;
|
|
270
483
|
export type AgentDescription = z.infer<typeof AgentDescriptionSchema>;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import type { AgentTypeRuntime } from "../registry/agent-registry.types";
|
|
1
2
|
/**
|
|
2
|
-
* Options for loading
|
|
3
|
+
* Options for loading a built-in or registered custom agent.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* (`registerProvider()`), model registry (`registerModel()`), and
|
|
7
|
-
* tool registry (`registerTool()`).
|
|
5
|
+
* Runtime fields are forwarded to registered factories. Applicable fields are
|
|
6
|
+
* also passed to built-in LLM agents.
|
|
8
7
|
*
|
|
9
8
|
* @example
|
|
10
9
|
* ```ts
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* const agent = await loadAgent("./agents/researcher.yaml", {
|
|
11
|
+
* modelOverride: "openai/gpt-4o",
|
|
12
|
+
* });
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export interface LoadAgentOptions extends AgentTypeRuntime {
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BUILT_IN_AGENT_NAMES: readonly ["llm", "user"];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { AgentTypeDefinition, RegisteredAgentFactory } from "./agent-registry.types";
|
|
3
|
+
/**
|
|
4
|
+
* Preserve schema inference when declaring a reusable custom agent type.
|
|
5
|
+
*
|
|
6
|
+
* @param definition - Configuration schema and factory for the custom agent.
|
|
7
|
+
* @returns The unchanged agent definition with inferred configuration types.
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const echoAgent = defineAgentType({
|
|
11
|
+
* configSchema: z.object({ prefix: z.string() }),
|
|
12
|
+
* create: ({ name, config }) => createAgent({
|
|
13
|
+
* name,
|
|
14
|
+
* execute: async (message) => `${config.prefix}${message}`,
|
|
15
|
+
* }),
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function defineAgentType<ConfigSchema extends z.ZodTypeAny>(definition: AgentTypeDefinition<ConfigSchema>): AgentTypeDefinition<ConfigSchema>;
|
|
20
|
+
/**
|
|
21
|
+
* Register a custom agent type for use in strategy and standalone agent files.
|
|
22
|
+
*
|
|
23
|
+
* @param name - Value referenced by a declarative agent's `type` field.
|
|
24
|
+
* @param definition - Configuration schema and factory for the custom agent.
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* registerAgent("echo", echoAgent);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function registerAgent<ConfigSchema extends z.ZodTypeAny>(name: string, definition: AgentTypeDefinition<ConfigSchema>): void;
|
|
31
|
+
/** Remove a custom agent registration. Built-in agent types remain available. */
|
|
32
|
+
export declare function unregisterAgent(name: string): boolean;
|
|
33
|
+
/** Return the currently registered custom agent type names. */
|
|
34
|
+
export declare function getRegisteredAgentNames(): readonly string[];
|
|
35
|
+
/** @internal Resolve a custom agent factory by type name. */
|
|
36
|
+
export declare function resolveRegisteredAgent(name: string): RegisteredAgentFactory | undefined;
|
|
37
|
+
/** Reset custom agent registrations. Primarily intended for test isolation. */
|
|
38
|
+
export declare function resetAgentRegistry(): void;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { LanguageService } from "../../language";
|
|
3
|
+
import type { SkillRegistry } from "../../skills/skills.types";
|
|
4
|
+
import type { LaunchStrategyHandle } from "../../tools/launch-strategy.types";
|
|
5
|
+
import type { Agent } from "../agent/agent.types";
|
|
6
|
+
import type { InputCollector } from "../built-in/user/user-agent.types";
|
|
7
|
+
/** Loader-provided services available when constructing a registered agent type. */
|
|
8
|
+
export interface AgentTypeRuntime {
|
|
9
|
+
/**
|
|
10
|
+
* Input collector used by interactive agents and tools.
|
|
11
|
+
* Required when a factory creates a user agent that requests input.
|
|
12
|
+
*/
|
|
13
|
+
readonly inputCollector?: InputCollector;
|
|
14
|
+
/**
|
|
15
|
+
* Model override supplied for the current load operation.
|
|
16
|
+
* Custom factories decide whether and how to apply it.
|
|
17
|
+
*/
|
|
18
|
+
readonly modelOverride?: string;
|
|
19
|
+
/** Skill registry available to agents and skill-aware tools. */
|
|
20
|
+
readonly skillRegistry?: SkillRegistry;
|
|
21
|
+
/** Base directory for resolving paths referenced by the loaded definition. */
|
|
22
|
+
readonly strategyDir?: string;
|
|
23
|
+
/** Runtime handle for launching sub-strategies from tools or custom agents. */
|
|
24
|
+
readonly launchStrategy?: LaunchStrategyHandle;
|
|
25
|
+
/** Language service available to language-aware tools. */
|
|
26
|
+
readonly languageService?: LanguageService;
|
|
27
|
+
/**
|
|
28
|
+
* Identifier for the current strategy invocation.
|
|
29
|
+
* Factories can pass it to agents and tools that isolate state by run.
|
|
30
|
+
*/
|
|
31
|
+
readonly runId?: string;
|
|
32
|
+
}
|
|
33
|
+
/** Context passed to a registered custom agent factory. */
|
|
34
|
+
export interface AgentTypeContext<Config> {
|
|
35
|
+
/** Name declared for this agent instance. */
|
|
36
|
+
readonly name: string;
|
|
37
|
+
/** Custom configuration validated by the agent type's schema. */
|
|
38
|
+
readonly config: Config;
|
|
39
|
+
/** Loader-provided services for the current invocation. */
|
|
40
|
+
readonly runtime: AgentTypeRuntime;
|
|
41
|
+
}
|
|
42
|
+
/** Definition used to validate and construct a reusable declarative agent type. */
|
|
43
|
+
export interface AgentTypeDefinition<ConfigSchema extends z.ZodTypeAny> {
|
|
44
|
+
/** Schema for the agent definition's `config` object. */
|
|
45
|
+
readonly configSchema: ConfigSchema;
|
|
46
|
+
/** Create a runnable agent from validated configuration and runtime services. */
|
|
47
|
+
readonly create: (context: AgentTypeContext<z.output<ConfigSchema>>) => Agent | Promise<Agent>;
|
|
48
|
+
}
|
|
49
|
+
/** @internal Invalidated context used by declarative agent loaders. */
|
|
50
|
+
export interface RegisteredAgentContext {
|
|
51
|
+
readonly name: string;
|
|
52
|
+
readonly config: unknown;
|
|
53
|
+
readonly runtime: AgentTypeRuntime;
|
|
54
|
+
}
|
|
55
|
+
/** @internal Type-erased registered factory used after registration. */
|
|
56
|
+
export interface RegisteredAgentFactory {
|
|
57
|
+
readonly create: (context: RegisteredAgentContext) => Promise<Agent>;
|
|
58
|
+
}
|
|
@@ -14,7 +14,7 @@ export interface JsonFileBackendOptions {
|
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* ```ts
|
|
17
|
-
* const backend = createJsonFileBackend({ filePath: "/home/user/.
|
|
17
|
+
* const backend = createJsonFileBackend({ filePath: "/home/user/.comma/credentials.json" });
|
|
18
18
|
* const data = await backend.readAll();
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolve the platform-aware data directory for comma-agents.
|
|
3
|
-
*
|
|
4
|
-
* Respects platform conventions:
|
|
5
|
-
* - macOS: ~/Library/Application Support/comma-agents/
|
|
6
|
-
* - Windows: %LOCALAPPDATA%/comma-agents/ (fallback ~/AppData/Local)
|
|
7
|
-
* - Linux: $XDG_DATA_HOME/comma-agents/ (fallback ~/.local/share)
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* const dataDir = resolveDataDir();
|
|
12
|
-
* // macOS: "/Users/alice/Library/Application Support/comma-agents"
|
|
13
|
-
* // Linux: "/home/alice/.local/share/comma-agents"
|
|
14
|
-
* // Windows: "C:\\Users\\alice\\AppData\\Local\\comma-agents"
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export declare function resolveDataDir(): string;
|
|
18
|
-
/** Default name for the credentials JSON file. */
|
|
19
|
-
export declare const CREDENTIALS_FILENAME = "credentials.json";
|
|
20
1
|
/**
|
|
21
2
|
* Resolve the default path to the credentials JSON file.
|
|
22
3
|
*
|
|
@@ -3,4 +3,4 @@ export { createCredentialStore } from "./credentials";
|
|
|
3
3
|
export type { ApiCredential, Credential, CustomCredential, OAuthCredential, } from "./credentials.schema";
|
|
4
4
|
export { ApiCredentialSchema, CredentialSchema, CustomCredentialSchema, OAuthCredentialSchema, } from "./credentials.schema";
|
|
5
5
|
export type { AuthStatus, CreateCredentialStoreOptions, CredentialBackend, CredentialStore, CredentialStoreData, EnvVarMap, } from "./credentials.types";
|
|
6
|
-
export { resolveCredentialsPath
|
|
6
|
+
export { resolveCredentialsPath } from "./credentials.utils";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the shared CommaAgents directory in the current user's home directory.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* const dataDirectory = resolveDataDir();
|
|
7
|
+
* // Unix: "/home/alice/.comma"
|
|
8
|
+
* // Windows: "C:\\Users\\Alice\\.comma"
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveDataDir(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolveDataDir } from "./data-directory";
|
|
@@ -40,7 +40,7 @@ export declare function setGlobalCredentialStore(store: CredentialStore | undefi
|
|
|
40
40
|
*
|
|
41
41
|
* @example
|
|
42
42
|
* ```ts
|
|
43
|
-
* setProviderCacheDir("/Users/bot/.
|
|
43
|
+
* setProviderCacheDir("/Users/bot/.comma/providers");
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
46
|
export declare function setProviderCacheDir(dir: string | undefined): void;
|
package/dist/flows/index.d.ts
CHANGED
|
@@ -4,3 +4,5 @@ export { createSequentialFlow } from "./built-in/sequential/sequential-flow";
|
|
|
4
4
|
export { buildFlowAgent, createFlow } from "./flow/flow";
|
|
5
5
|
export type { BroadcastFlowConfig, CustomFlowConfig, CycleFlowConfig, CycleHooks, FlowConfig, FlowContext, FlowExecutor, FlowHooks, FlowResult, } from "./flow/flow.types";
|
|
6
6
|
export { hookIntoFlow } from "./hook-into-flow/hook-into-flow";
|
|
7
|
+
export type { FlowTypeContext, FlowTypeDefinition } from "./registry";
|
|
8
|
+
export { defineFlowType, getRegisteredFlowNames, registerFlow, resetFlowRegistry, unregisterFlow, } from "./registry";
|