@inkeep/agents-cli 0.0.0-dev-20260123083643 → 0.0.0-dev-20260123091222
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.
|
@@ -58,9 +58,60 @@ function formatOutputTransform(transform, style, indentLevel) {
|
|
|
58
58
|
return lines.join("\n");
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
+
* Format signature verification configuration
|
|
62
|
+
* Generates code for signatureVerification object with all nested structures
|
|
63
|
+
*/
|
|
64
|
+
function formatSignatureVerification(config, style, indentLevel) {
|
|
65
|
+
if (!config) return "";
|
|
66
|
+
const { indentation, quotes } = style;
|
|
67
|
+
const q = quotes === "single" ? "'" : "\"";
|
|
68
|
+
const indent = indentation.repeat(indentLevel);
|
|
69
|
+
const lines = [];
|
|
70
|
+
lines.push(`${indent}signatureVerification: {`);
|
|
71
|
+
const algorithmIndent = indentation.repeat(indentLevel + 1);
|
|
72
|
+
lines.push(`${algorithmIndent}algorithm: ${formatString(config.algorithm, q)},`);
|
|
73
|
+
lines.push(`${algorithmIndent}encoding: ${formatString(config.encoding, q)},`);
|
|
74
|
+
lines.push(`${algorithmIndent}signature: {`);
|
|
75
|
+
const sigIndent = indentation.repeat(indentLevel + 2);
|
|
76
|
+
lines.push(`${sigIndent}source: ${formatString(config.signature.source, q)},`);
|
|
77
|
+
lines.push(`${sigIndent}key: ${formatString(config.signature.key, q)},`);
|
|
78
|
+
if (config.signature.prefix !== void 0 && config.signature.prefix !== null) lines.push(`${sigIndent}prefix: ${formatString(config.signature.prefix, q)},`);
|
|
79
|
+
if (config.signature.regex !== void 0 && config.signature.regex !== null) lines.push(`${sigIndent}regex: ${formatString(config.signature.regex, q)},`);
|
|
80
|
+
if (lines[lines.length - 1].endsWith(",")) lines[lines.length - 1] = lines[lines.length - 1].slice(0, -1);
|
|
81
|
+
lines.push(`${algorithmIndent}},`);
|
|
82
|
+
lines.push(`${algorithmIndent}signedComponents: [`);
|
|
83
|
+
for (const component of config.signedComponents) {
|
|
84
|
+
lines.push(`${sigIndent}{`);
|
|
85
|
+
const compIndent = indentation.repeat(indentLevel + 3);
|
|
86
|
+
lines.push(`${compIndent}source: ${formatString(component.source, q)},`);
|
|
87
|
+
if (component.key !== void 0 && component.key !== null) lines.push(`${compIndent}key: ${formatString(component.key, q)},`);
|
|
88
|
+
if (component.value !== void 0 && component.value !== null) lines.push(`${compIndent}value: ${formatString(component.value, q)},`);
|
|
89
|
+
if (component.regex !== void 0 && component.regex !== null) lines.push(`${compIndent}regex: ${formatString(component.regex, q)},`);
|
|
90
|
+
if (component.required !== void 0 && component.required !== null) lines.push(`${compIndent}required: ${component.required},`);
|
|
91
|
+
if (lines[lines.length - 1].endsWith(",")) lines[lines.length - 1] = lines[lines.length - 1].slice(0, -1);
|
|
92
|
+
lines.push(`${sigIndent}},`);
|
|
93
|
+
}
|
|
94
|
+
lines.push(`${algorithmIndent}],`);
|
|
95
|
+
lines.push(`${algorithmIndent}componentJoin: {`);
|
|
96
|
+
lines.push(`${sigIndent}strategy: ${formatString(config.componentJoin.strategy, q)},`);
|
|
97
|
+
lines.push(`${sigIndent}separator: ${formatString(config.componentJoin.separator, q)}`);
|
|
98
|
+
lines.push(`${algorithmIndent}},`);
|
|
99
|
+
if (config.validation) {
|
|
100
|
+
lines.push(`${algorithmIndent}validation: {`);
|
|
101
|
+
if (config.validation.headerCaseSensitive !== void 0) lines.push(`${sigIndent}headerCaseSensitive: ${config.validation.headerCaseSensitive},`);
|
|
102
|
+
if (config.validation.allowEmptyBody !== void 0) lines.push(`${sigIndent}allowEmptyBody: ${config.validation.allowEmptyBody},`);
|
|
103
|
+
if (config.validation.normalizeUnicode !== void 0) lines.push(`${sigIndent}normalizeUnicode: ${config.validation.normalizeUnicode},`);
|
|
104
|
+
if (lines[lines.length - 1].endsWith(",")) lines[lines.length - 1] = lines[lines.length - 1].slice(0, -1);
|
|
105
|
+
lines.push(`${algorithmIndent}},`);
|
|
106
|
+
}
|
|
107
|
+
if (lines[lines.length - 1].endsWith(",")) lines[lines.length - 1] = lines[lines.length - 1].slice(0, -1);
|
|
108
|
+
lines.push(`${indent}},`);
|
|
109
|
+
return lines.join("\n");
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
61
112
|
* Generate Trigger Definition using Trigger class
|
|
62
113
|
*/
|
|
63
|
-
function generateTriggerDefinition(triggerId, triggerData, style = DEFAULT_STYLE) {
|
|
114
|
+
function generateTriggerDefinition(triggerId, triggerData, style = DEFAULT_STYLE, registry) {
|
|
64
115
|
if (!triggerId || typeof triggerId !== "string") throw new Error("triggerId is required and must be a string");
|
|
65
116
|
if (!triggerData || typeof triggerData !== "object") throw new Error(`triggerData is required for trigger '${triggerId}'`);
|
|
66
117
|
const missingFields = ["name", "messageTemplate"].filter((field) => !triggerData[field] || triggerData[field] === null || triggerData[field] === void 0);
|
|
@@ -91,6 +142,16 @@ function generateTriggerDefinition(triggerId, triggerData, style = DEFAULT_STYLE
|
|
|
91
142
|
const authFormatted = formatAuthentication(triggerData.authentication, style, 1);
|
|
92
143
|
if (authFormatted) lines.push(authFormatted);
|
|
93
144
|
}
|
|
145
|
+
if (triggerData.signatureVerification) {
|
|
146
|
+
const sigVerificationFormatted = formatSignatureVerification(triggerData.signatureVerification, style, 1);
|
|
147
|
+
if (sigVerificationFormatted) lines.push(sigVerificationFormatted);
|
|
148
|
+
}
|
|
149
|
+
if (triggerData.signingSecretCredentialReferenceId) {
|
|
150
|
+
if (!registry) throw new Error("Registry is required for signingSecretCredentialReferenceId generation");
|
|
151
|
+
const credentialVar = registry.getVariableName(triggerData.signingSecretCredentialReferenceId, "credentials");
|
|
152
|
+
if (!credentialVar) throw new Error(`Failed to resolve variable name for credential reference: ${triggerData.signingSecretCredentialReferenceId}`);
|
|
153
|
+
lines.push(`${indentation}signingSecretCredentialReference: ${credentialVar},`);
|
|
154
|
+
}
|
|
94
155
|
if (lines.length > 0 && lines[lines.length - 1].endsWith(",")) lines[lines.length - 1] = lines[lines.length - 1].slice(0, -1);
|
|
95
156
|
lines.push(`})${semi}`);
|
|
96
157
|
return lines.join("\n");
|
|
@@ -98,16 +159,26 @@ function generateTriggerDefinition(triggerId, triggerData, style = DEFAULT_STYLE
|
|
|
98
159
|
/**
|
|
99
160
|
* Generate imports needed for a trigger file
|
|
100
161
|
*/
|
|
101
|
-
function generateTriggerImports(style = DEFAULT_STYLE) {
|
|
162
|
+
function generateTriggerImports(triggerId, triggerData, style = DEFAULT_STYLE, registry) {
|
|
102
163
|
const imports = [];
|
|
103
164
|
imports.push(generateImport(["Trigger"], "@inkeep/agents-sdk", style));
|
|
165
|
+
if (triggerData.signingSecretCredentialReferenceId && typeof triggerData.signingSecretCredentialReferenceId === "string") {
|
|
166
|
+
if (!registry) throw new Error("Registry is required for credential reference imports");
|
|
167
|
+
const currentFilePath = `agents/triggers/${triggerId}.ts`;
|
|
168
|
+
const credentialRefs = [{
|
|
169
|
+
id: triggerData.signingSecretCredentialReferenceId,
|
|
170
|
+
type: "credentials"
|
|
171
|
+
}];
|
|
172
|
+
const componentImports = registry.getImportsForFile(currentFilePath, credentialRefs);
|
|
173
|
+
imports.push(...componentImports);
|
|
174
|
+
}
|
|
104
175
|
return imports;
|
|
105
176
|
}
|
|
106
177
|
/**
|
|
107
178
|
* Generate complete trigger file (imports + definition)
|
|
108
179
|
*/
|
|
109
|
-
function generateTriggerFile(triggerId, triggerData, style = DEFAULT_STYLE) {
|
|
110
|
-
return generateFileContent(generateTriggerImports(style), [generateTriggerDefinition(triggerId, triggerData, style)]);
|
|
180
|
+
function generateTriggerFile(triggerId, triggerData, style = DEFAULT_STYLE, registry) {
|
|
181
|
+
return generateFileContent(generateTriggerImports(triggerId, triggerData, style, registry), [generateTriggerDefinition(triggerId, triggerData, style, registry)]);
|
|
111
182
|
}
|
|
112
183
|
|
|
113
184
|
//#endregion
|
|
@@ -222,7 +222,7 @@ async function introspectGenerate(project, paths, environment, debug, options =
|
|
|
222
222
|
generatedFiles.push(agentFile);
|
|
223
223
|
if (agentData.triggers && Object.keys(agentData.triggers).length > 0) for (const [triggerId, triggerData] of Object.entries(agentData.triggers)) {
|
|
224
224
|
const triggerFile = join(paths.agentsDir, "triggers", `${triggerId}.ts`);
|
|
225
|
-
const triggerContent = generateTriggerFile(triggerId, triggerData, style);
|
|
225
|
+
const triggerContent = generateTriggerFile(triggerId, triggerData, style, registry);
|
|
226
226
|
ensureDir(triggerFile);
|
|
227
227
|
writeFileSync(triggerFile, triggerContent, "utf-8");
|
|
228
228
|
generatedFiles.push(triggerFile);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-cli",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260123091222",
|
|
4
4
|
"description": "Inkeep CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"tsx": "^4.20.5",
|
|
41
41
|
"yaml": "^2.7.0",
|
|
42
42
|
"zod": "^4.1.11",
|
|
43
|
-
"@inkeep/agents-core": "^0.0.0-dev-
|
|
44
|
-
"@inkeep/agents-sdk": "^0.0.0-dev-
|
|
43
|
+
"@inkeep/agents-core": "^0.0.0-dev-20260123091222",
|
|
44
|
+
"@inkeep/agents-sdk": "^0.0.0-dev-20260123091222"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/degit": "^2.8.6",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"vitest": "^3.2.4"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@inkeep/agents-manage-ui": "0.0.0-dev-
|
|
55
|
+
"@inkeep/agents-manage-ui": "0.0.0-dev-20260123091222"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public",
|