@agentrix/shared 2.2.3 → 2.2.5
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/errors-myQvpVrM.cjs +95 -0
- package/dist/errors-vTk-66-R.d.cts +2602 -0
- package/dist/index.cjs +266 -556
- package/dist/index.d.cts +2065 -4636
- package/dist/node.cjs +254 -0
- package/dist/node.d.cts +52 -0
- package/package.json +7 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var zod = require('zod');
|
|
4
|
+
|
|
5
|
+
let agentContext = null;
|
|
6
|
+
function setAgentContext(context) {
|
|
7
|
+
agentContext = context;
|
|
8
|
+
}
|
|
9
|
+
function getAgentContext() {
|
|
10
|
+
if (!agentContext) {
|
|
11
|
+
throw new Error("Agent context not initialized. Call setAgentContext() first.");
|
|
12
|
+
}
|
|
13
|
+
return agentContext;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const FRAMEWORK_TYPES = ["claude", "codex"];
|
|
17
|
+
|
|
18
|
+
const AgentMetadataSchema = zod.z.object({
|
|
19
|
+
name: zod.z.string(),
|
|
20
|
+
version: zod.z.string(),
|
|
21
|
+
description: zod.z.string().optional()
|
|
22
|
+
});
|
|
23
|
+
const ClaudeConfigSchema = zod.z.object({
|
|
24
|
+
// SDK native model configuration
|
|
25
|
+
model: zod.z.string().optional(),
|
|
26
|
+
fallbackModel: zod.z.string().optional(),
|
|
27
|
+
maxTurns: zod.z.number().int().positive().optional(),
|
|
28
|
+
// SDK native extra arguments
|
|
29
|
+
extraArgs: zod.z.record(zod.z.string(), zod.z.string().nullable()).optional(),
|
|
30
|
+
systemPrompt: zod.z.object({
|
|
31
|
+
path: zod.z.string(),
|
|
32
|
+
mode: zod.z.enum(["append", "replace"]).optional().default("append")
|
|
33
|
+
}).optional(),
|
|
34
|
+
settings: zod.z.object({
|
|
35
|
+
permissionMode: zod.z.enum(["default", "acceptEdits", "bypassPermissions", "plan"]).optional(),
|
|
36
|
+
allowedTools: zod.z.array(zod.z.string()).optional()
|
|
37
|
+
}).optional(),
|
|
38
|
+
pullRequestPrompt: zod.z.object({
|
|
39
|
+
path: zod.z.string(),
|
|
40
|
+
mode: zod.z.enum(["append", "replace"]).optional().default("append")
|
|
41
|
+
}).optional(),
|
|
42
|
+
// SDK MCP Tools - scripts that export createSdkMcpServer()
|
|
43
|
+
sdkMcpTools: zod.z.array(zod.z.string()).optional()
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
class AgentError extends Error {
|
|
47
|
+
constructor(message) {
|
|
48
|
+
super(message);
|
|
49
|
+
this.name = "AgentError";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
class AgentNotFoundError extends AgentError {
|
|
53
|
+
constructor(agentId) {
|
|
54
|
+
super(`Agent not found: ${agentId}`);
|
|
55
|
+
this.name = "AgentNotFoundError";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
class AgentConfigValidationError extends AgentError {
|
|
59
|
+
constructor(message, errors) {
|
|
60
|
+
super(message);
|
|
61
|
+
this.errors = errors;
|
|
62
|
+
this.name = "AgentConfigValidationError";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
class FrameworkNotSupportedError extends AgentError {
|
|
66
|
+
constructor(agentId, framework) {
|
|
67
|
+
super(`Agent "${agentId}" does not support framework: ${framework}`);
|
|
68
|
+
this.name = "FrameworkNotSupportedError";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
class AgentLoadError extends AgentError {
|
|
72
|
+
constructor(message, cause) {
|
|
73
|
+
super(message);
|
|
74
|
+
this.cause = cause;
|
|
75
|
+
this.name = "AgentLoadError";
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
class MissingAgentFileError extends AgentError {
|
|
79
|
+
constructor(filePath) {
|
|
80
|
+
super(`Required agent file missing: ${filePath}`);
|
|
81
|
+
this.name = "MissingAgentFileError";
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
exports.AgentConfigValidationError = AgentConfigValidationError;
|
|
86
|
+
exports.AgentError = AgentError;
|
|
87
|
+
exports.AgentLoadError = AgentLoadError;
|
|
88
|
+
exports.AgentMetadataSchema = AgentMetadataSchema;
|
|
89
|
+
exports.AgentNotFoundError = AgentNotFoundError;
|
|
90
|
+
exports.ClaudeConfigSchema = ClaudeConfigSchema;
|
|
91
|
+
exports.FRAMEWORK_TYPES = FRAMEWORK_TYPES;
|
|
92
|
+
exports.FrameworkNotSupportedError = FrameworkNotSupportedError;
|
|
93
|
+
exports.MissingAgentFileError = MissingAgentFileError;
|
|
94
|
+
exports.getAgentContext = getAgentContext;
|
|
95
|
+
exports.setAgentContext = setAgentContext;
|