@myagentroam/agent 0.10.21 → 0.10.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-core/error.d.ts +1 -0
- package/dist/agent-core/error.js +2 -0
- package/dist/agent-core/model/catalog-file.d.ts +2 -0
- package/dist/agent-core/model/configuration.d.ts +3 -1
- package/dist/agent-core/model/configuration.js +1 -0
- package/dist/agent-core/sdk/model-runtime.js +6 -3
- package/dist/agent-core/sdk/session.js +7 -2
- package/dist/agent-core/subagent/session-controller.d.ts +1 -0
- package/dist/agent-core/subagent/session-controller.js +1 -1
- package/dist/cli/main.js +4 -2
- package/package.json +1 -1
package/dist/agent-core/error.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export class MarAgentError extends Error {
|
|
2
2
|
code;
|
|
3
|
+
publicMessage;
|
|
3
4
|
details;
|
|
4
5
|
retryable;
|
|
5
6
|
constructor(code, message, options = {}) {
|
|
6
7
|
super(`${code}: ${message}`, { cause: options.cause });
|
|
7
8
|
this.name = 'MarAgentError';
|
|
8
9
|
this.code = code;
|
|
10
|
+
this.publicMessage = message;
|
|
9
11
|
this.details = options.details;
|
|
10
12
|
this.retryable = options.retryable ?? false;
|
|
11
13
|
}
|
|
@@ -11,6 +11,7 @@ export declare function readModelCatalog(home: string): Promise<CliModelCatalog>
|
|
|
11
11
|
export declare function writeModelCatalog(home: string, catalog: CliModelCatalog): Promise<void>;
|
|
12
12
|
export declare function serializeModel(model: CliModelConfiguration): {
|
|
13
13
|
apiKey: string;
|
|
14
|
+
conversationModel?: boolean;
|
|
14
15
|
responsesConfigurationUpdates?: boolean;
|
|
15
16
|
codexCredential?: boolean;
|
|
16
17
|
responsesTransport?: import("./configuration.js").ResponsesTransport;
|
|
@@ -44,6 +45,7 @@ export declare function serializeModel(model: CliModelConfiguration): {
|
|
|
44
45
|
credential: {
|
|
45
46
|
type: "CODEX_AUTH_FILE";
|
|
46
47
|
};
|
|
48
|
+
conversationModel?: boolean;
|
|
47
49
|
responsesConfigurationUpdates?: boolean;
|
|
48
50
|
codexCredential?: boolean;
|
|
49
51
|
responsesTransport?: import("./configuration.js").ResponsesTransport;
|
|
@@ -67,6 +67,7 @@ declare const rawModelSchema: z.ZodObject<{
|
|
|
67
67
|
max: "max";
|
|
68
68
|
ultra: "ultra";
|
|
69
69
|
}>>;
|
|
70
|
+
conversationModel: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
70
71
|
titleGeneration: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
71
72
|
codeMode: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
72
73
|
fastMode: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -99,7 +100,8 @@ declare const rawModelSchema: z.ZodObject<{
|
|
|
99
100
|
}, z.core.$strict>>;
|
|
100
101
|
enabled: z.ZodBoolean;
|
|
101
102
|
}, z.core.$strict>;
|
|
102
|
-
export interface MarAgentModelConfiguration extends Omit<z.infer<typeof rawModelSchema>, 'apiKey' | 'responsesPreviousResponseId' | 'responsesTransport'> {
|
|
103
|
+
export interface MarAgentModelConfiguration extends Omit<z.infer<typeof rawModelSchema>, 'apiKey' | 'responsesPreviousResponseId' | 'responsesTransport' | 'conversationModel'> {
|
|
104
|
+
conversationModel?: boolean;
|
|
103
105
|
apiKey?: SecretValue;
|
|
104
106
|
credentialProvider?: ModelCredentialProvider;
|
|
105
107
|
/** Whether this Responses endpoint accepts native configuration_update input items. */
|
|
@@ -47,6 +47,7 @@ const rawModelSchema = z
|
|
|
47
47
|
outputCapabilities: z.tuple([z.literal('TEXT')]),
|
|
48
48
|
reasoningEfforts: z.array(marAgentReasoningEffortSchema),
|
|
49
49
|
defaultReasoningEffort: marAgentReasoningEffortSchema.optional(),
|
|
50
|
+
conversationModel: z.boolean().optional().default(true),
|
|
50
51
|
titleGeneration: z.boolean().optional().default(false),
|
|
51
52
|
codeMode: z.boolean().optional().default(false),
|
|
52
53
|
fastMode: z.boolean().optional(),
|
|
@@ -21,9 +21,12 @@ export function resolveAgentModels(configurations, requestedDefaultModelId) {
|
|
|
21
21
|
const models = new Map(configuredModels.filter((model) => model.enabled).map((model) => [model.id, model]));
|
|
22
22
|
if (models.size === 0)
|
|
23
23
|
throw new MarAgentError('MAR_AGENT_MODEL_CONFIG_INVALID', 'At least one enabled model is required.');
|
|
24
|
-
const defaultModelId = requestedDefaultModelId ??
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const defaultModelId = requestedDefaultModelId ??
|
|
25
|
+
[...models.values()].find((model) => model.conversationModel !== false)?.id;
|
|
26
|
+
if (!defaultModelId ||
|
|
27
|
+
!models.has(defaultModelId) ||
|
|
28
|
+
models.get(defaultModelId).conversationModel === false)
|
|
29
|
+
throw new MarAgentError('MAR_AGENT_MODEL_CONFIG_INVALID', 'Default conversation model is unavailable.');
|
|
27
30
|
return { models, defaultModelId, credentialProviders };
|
|
28
31
|
}
|
|
29
32
|
export function createModelTurnSession(adapter) {
|
|
@@ -190,6 +190,10 @@ export function createSessionOpener(services) {
|
|
|
190
190
|
services.assertCanStart();
|
|
191
191
|
if ([...active.keys()].some((key) => key.startsWith(`${sessionId}:`)))
|
|
192
192
|
throw new MarAgentError('MAR_AGENT_EXECUTION_ACTIVE', 'Session already has an active execution.');
|
|
193
|
+
const { models: executionModels, defaultModelId: executionDefaultModelId, generation: executionModelGeneration } = services.modelState();
|
|
194
|
+
if (mode !== 'compact' &&
|
|
195
|
+
executionModels.get(input.modelId ?? executionDefaultModelId)?.conversationModel === false)
|
|
196
|
+
throw new MarAgentError('MAR_AGENT_MODEL_DISABLED', 'The selected model is not a conversation model.');
|
|
193
197
|
const executionId = randomUUID(), turnId = internal.turnId ?? randomUUID(), queue = new AsyncQueue(), controller = new AbortController();
|
|
194
198
|
const abortSource = () => controller.abort(internal.signal?.reason);
|
|
195
199
|
internal.signal?.addEventListener('abort', abortSource, { once: true });
|
|
@@ -199,7 +203,6 @@ export function createSessionOpener(services) {
|
|
|
199
203
|
...currentEnvironment,
|
|
200
204
|
...currentLocalTimeContext()
|
|
201
205
|
};
|
|
202
|
-
const { models: executionModels, defaultModelId: executionDefaultModelId, generation: executionModelGeneration } = services.modelState();
|
|
203
206
|
const executionSystemInstruction = settings.systemInstruction;
|
|
204
207
|
promptDefaults = {
|
|
205
208
|
executionId,
|
|
@@ -610,7 +613,9 @@ export function createSessionOpener(services) {
|
|
|
610
613
|
throw new MarAgentError('MAR_AGENT_TOOL_INPUT_INVALID', 'Host tools cannot use the MCP namespace.');
|
|
611
614
|
const selectedModelForTools = executionModels.get(input.modelId ?? executionDefaultModelId);
|
|
612
615
|
const builtinTools = BUILTIN_TOOL_DEFINITIONS.map((tool) => tool.name === 'agent_start'
|
|
613
|
-
? agentStartToolDefinitionWithModels([...executionModels.values()]
|
|
616
|
+
? agentStartToolDefinitionWithModels([...executionModels.values()]
|
|
617
|
+
.filter((configuration) => configuration.conversationModel !== false)
|
|
618
|
+
.map((configuration) => ({
|
|
614
619
|
id: configuration.id,
|
|
615
620
|
name: configuration.name,
|
|
616
621
|
reasoningEfforts: configuration.reasoningEfforts
|
|
@@ -7,6 +7,7 @@ import type { SubagentController, SubagentMessageOptions, SubagentOutputOptions,
|
|
|
7
7
|
export interface SubagentModelOption {
|
|
8
8
|
readonly id: string;
|
|
9
9
|
readonly name: string;
|
|
10
|
+
readonly conversationModel?: boolean;
|
|
10
11
|
readonly reasoningEfforts: readonly MarAgentReasoningEffort[];
|
|
11
12
|
readonly defaultReasoningEffort: MarAgentReasoningEffort;
|
|
12
13
|
}
|
|
@@ -938,7 +938,7 @@ function validateTaskInput(input, native = false) {
|
|
|
938
938
|
function resolveModel(execution, input) {
|
|
939
939
|
const modelId = input.modelId ?? execution.modelId;
|
|
940
940
|
const model = execution.models.get(modelId);
|
|
941
|
-
if (!model)
|
|
941
|
+
if (!model || model.conversationModel === false)
|
|
942
942
|
throw new MarAgentError('MAR_AGENT_SUBAGENT_MODEL_UNAVAILABLE', 'Selected model is unavailable for subagents.');
|
|
943
943
|
if (input.reasoningEffort !== undefined &&
|
|
944
944
|
!model.reasoningEfforts.includes(input.reasoningEffort))
|
package/dist/cli/main.js
CHANGED
|
@@ -180,6 +180,7 @@ async function modelsCommand(home, arguments_, codexAuthFile) {
|
|
|
180
180
|
defaultReasoningEffort: existing?.defaultReasoningEffort
|
|
181
181
|
})
|
|
182
182
|
: parseReasoningEffort(defaultReasoningEffortOption, '--default-reasoning-effort'),
|
|
183
|
+
conversationModel: existing?.conversationModel ?? true,
|
|
183
184
|
titleGeneration: existing?.titleGeneration ?? false,
|
|
184
185
|
codeMode: booleanFlag(arguments_, '--code-mode', '--no-code-mode', existing?.codeMode ?? false),
|
|
185
186
|
...(credential === 'codex-auth-file' && fastMode ? { fastMode: true } : {}),
|
|
@@ -252,7 +253,7 @@ async function main() {
|
|
|
252
253
|
throw new MarAgentError('MAR_AGENT_CLI_ARGUMENT_INVALID', 'The deprecated --access option only accepts full-access.');
|
|
253
254
|
const format = takeOption(arguments_, '--format') ?? 'text';
|
|
254
255
|
const command = arguments_[0];
|
|
255
|
-
const selectedModel = catalog.models.find((model) => model.id === modelId && model.enabled);
|
|
256
|
+
const selectedModel = catalog.models.find((model) => model.id === modelId && model.enabled && model.conversationModel !== false);
|
|
256
257
|
if (selectedModel !== undefined)
|
|
257
258
|
assertExternalCredentialAvailable(selectedModel, codexAuthFile);
|
|
258
259
|
if (reasoningEffort && selectedModel && !selectedModel.reasoningEfforts.includes(reasoningEffort))
|
|
@@ -360,7 +361,8 @@ async function main() {
|
|
|
360
361
|
models: runtime.models,
|
|
361
362
|
currentModelId: modelId ??
|
|
362
363
|
catalog.defaultModelId ??
|
|
363
|
-
runtime.models.find((model) => model.enabled)
|
|
364
|
+
runtime.models.find((model) => model.enabled && model.conversationModel !== false)
|
|
365
|
+
.id,
|
|
364
366
|
prompt: invocation.prompt,
|
|
365
367
|
signal: titleController.signal
|
|
366
368
|
}).catch(() => undefined);
|