@kalphq/cli 0.0.0-dev-20260416091527 → 0.0.0-dev-20260420023057
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/add-5NOYFTJV.js +133 -0
- package/dist/add-5NOYFTJV.js.map +1 -0
- package/dist/build-SUIPVJO6.js +80 -0
- package/dist/build-SUIPVJO6.js.map +1 -0
- package/dist/chunk-6LLXGS2P.js +25 -0
- package/dist/chunk-6LLXGS2P.js.map +1 -0
- package/dist/chunk-CJCIZDCF.js +298 -0
- package/dist/chunk-CJCIZDCF.js.map +1 -0
- package/dist/{chunk-GFEVTHUW.js → chunk-HD5FT7T6.js} +98 -65
- package/dist/chunk-HD5FT7T6.js.map +1 -0
- package/dist/{create-XJURMQC4.js → create-RSQEKCI6.js} +6 -5
- package/dist/{create-XJURMQC4.js.map → create-RSQEKCI6.js.map} +1 -1
- package/dist/delete-ZJB2JGAL.js +136 -0
- package/dist/delete-ZJB2JGAL.js.map +1 -0
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/{init-K7EASUMM.js → init-CUBJEWPE.js} +3 -5
- package/dist/init-CUBJEWPE.js.map +1 -0
- package/dist/list-BOE33VSI.js +120 -0
- package/dist/list-BOE33VSI.js.map +1 -0
- package/dist/push-L3BXB6OC.js +79 -0
- package/dist/push-L3BXB6OC.js.map +1 -0
- package/dist/secrets-3SKCSAGD.js +33 -0
- package/dist/secrets-3SKCSAGD.js.map +1 -0
- package/package.json +2 -2
- package/templates/project/meta/manifest-registry.json +1 -0
- package/dist/chunk-GFEVTHUW.js.map +0 -1
- package/dist/init-K7EASUMM.js.map +0 -1
- package/dist/push-YFHHNITO.js +0 -174
- package/dist/push-YFHHNITO.js.map +0 -1
- package/templates/agents/b2b-sales/index.ts +0 -57
- package/templates/agents/b2b-sales/signals/deal-won.ts +0 -31
- package/templates/agents/b2b-sales/signals/hot-lead-alert.ts +0 -29
- package/templates/agents/b2b-sales/steps/qualify-prospect.ts +0 -50
- package/templates/agents/b2b-sales/steps/score-lead.ts +0 -24
- package/templates/agents/b2b-sales/tools/enrich-company.ts +0 -17
- package/templates/agents/b2b-sales/tools/send-slack-notification.ts +0 -26
- package/templates/agents/b2b-sales/webhooks/crm-inbound.ts +0 -27
- package/templates/agents/b2b-sales/webhooks/stripe-payment.ts +0 -27
- package/templates/agents/customer-support/index.ts +0 -60
- package/templates/agents/customer-support/signals/escalation-needed.ts +0 -28
- package/templates/agents/customer-support/signals/ticket-resolved.ts +0 -29
- package/templates/agents/customer-support/steps/classify-ticket.ts +0 -22
- package/templates/agents/customer-support/steps/escalate-ticket.ts +0 -53
- package/templates/agents/customer-support/tools/create-jira-issue.ts +0 -30
- package/templates/agents/customer-support/tools/search-kb.ts +0 -13
- package/templates/agents/customer-support/webhooks/slack-escalation.ts +0 -27
- package/templates/agents/customer-support/webhooks/zendesk-ticket.ts +0 -29
- package/templates/agents/financial-agent/index.ts +0 -50
- package/templates/agents/financial-agent/signals/market-alert.ts +0 -31
- package/templates/agents/financial-agent/signals/portfolio-rebalance.ts +0 -27
- package/templates/agents/financial-agent/steps/analyze-signal.ts +0 -26
- package/templates/agents/financial-agent/steps/rebalance-check.ts +0 -55
- package/templates/agents/financial-agent/tools/fetch-market-data.ts +0 -13
- package/templates/agents/financial-agent/tools/send-email-alert.ts +0 -31
- package/templates/agents/financial-agent/webhooks/exchange-webhook.ts +0 -33
- package/templates/agents/financial-agent/webhooks/tradingview-alert.ts +0 -30
- package/templates/agents/minimal/index.ts +0 -24
- package/templates/agents/minimal/signals/error-alert.ts +0 -26
- package/templates/agents/minimal/signals/task-complete.ts +0 -25
- package/templates/agents/minimal/steps/example-step.ts +0 -13
- package/templates/agents/minimal/steps/transform-data.ts +0 -32
- package/templates/agents/minimal/tools/example-tool.ts +0 -13
- package/templates/agents/minimal/tools/http-request.ts +0 -26
- package/templates/agents/minimal/webhooks/generic-inbound.ts +0 -25
- package/templates/agents/minimal/webhooks/health-check.ts +0 -23
- package/templates/project/agents/.gitkeep +0 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-2H7UOFLK.js";
|
|
5
5
|
|
|
6
6
|
// src/scaffold.ts
|
|
7
|
-
import { writeFile, readFile as readFile2, readdir, cp } from "fs/promises";
|
|
7
|
+
import { writeFile, readFile as readFile2, readdir, cp, mkdir } from "fs/promises";
|
|
8
8
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
9
9
|
import { join as join4, dirname as dirname3 } from "path";
|
|
10
10
|
|
|
@@ -19658,37 +19658,6 @@ var debugApis = {
|
|
|
19658
19658
|
mockable
|
|
19659
19659
|
};
|
|
19660
19660
|
|
|
19661
|
-
// src/templates/index.ts
|
|
19662
|
-
var TEMPLATES = [
|
|
19663
|
-
{
|
|
19664
|
-
id: "customer-support",
|
|
19665
|
-
label: "Customer Support",
|
|
19666
|
-
hint: "ticket routing, escalation, knowledge base",
|
|
19667
|
-
secrets: ["OPENAI_API_KEY"]
|
|
19668
|
-
},
|
|
19669
|
-
{
|
|
19670
|
-
id: "b2b-sales",
|
|
19671
|
-
label: "B2B Sales Outreach",
|
|
19672
|
-
hint: "CRM enrichment, lead scoring",
|
|
19673
|
-
secrets: ["OPENAI_API_KEY", "CRM_API_KEY"]
|
|
19674
|
-
},
|
|
19675
|
-
{
|
|
19676
|
-
id: "financial-agent",
|
|
19677
|
-
label: "Financial Agent",
|
|
19678
|
-
hint: "market signals, portfolio analysis",
|
|
19679
|
-
secrets: ["OPENAI_API_KEY", "MARKET_DATA_API_KEY"]
|
|
19680
|
-
},
|
|
19681
|
-
{
|
|
19682
|
-
id: "minimal",
|
|
19683
|
-
label: "Minimal Skeleton",
|
|
19684
|
-
hint: "bare structure, start from scratch",
|
|
19685
|
-
secrets: []
|
|
19686
|
-
}
|
|
19687
|
-
];
|
|
19688
|
-
function getTemplateMeta(id) {
|
|
19689
|
-
return TEMPLATES.find((t) => t.id === id);
|
|
19690
|
-
}
|
|
19691
|
-
|
|
19692
19661
|
// src/scaffold.ts
|
|
19693
19662
|
var __filename2 = fileURLToPath6(import.meta.url);
|
|
19694
19663
|
var __dirname2 = dirname3(__filename2);
|
|
@@ -19743,7 +19712,6 @@ async function scaffoldProject(opts) {
|
|
|
19743
19712
|
const kalpConfig = `import { defineConfig } from "@kalphq/sdk";
|
|
19744
19713
|
|
|
19745
19714
|
export default defineConfig({
|
|
19746
|
-
projectId: "${projectName}",
|
|
19747
19715
|
secrets: [],
|
|
19748
19716
|
});
|
|
19749
19717
|
`;
|
|
@@ -19751,32 +19719,106 @@ export default defineConfig({
|
|
|
19751
19719
|
await replacePlaceholders(targetDir, { __PROJECT_NAME__: projectName });
|
|
19752
19720
|
}
|
|
19753
19721
|
async function scaffoldAgent(opts) {
|
|
19754
|
-
const { agentName,
|
|
19755
|
-
const meta = getTemplateMeta(templateId);
|
|
19722
|
+
const { agentName, cwd } = opts;
|
|
19756
19723
|
const agentDir = join4(cwd, "agents", agentName);
|
|
19757
|
-
await
|
|
19758
|
-
|
|
19759
|
-
|
|
19760
|
-
});
|
|
19761
|
-
|
|
19762
|
-
|
|
19763
|
-
|
|
19764
|
-
|
|
19765
|
-
|
|
19766
|
-
|
|
19767
|
-
|
|
19768
|
-
|
|
19769
|
-
|
|
19770
|
-
|
|
19771
|
-
|
|
19772
|
-
|
|
19773
|
-
|
|
19774
|
-
|
|
19724
|
+
await mkdir(join4(agentDir, "steps"), { recursive: true });
|
|
19725
|
+
await mkdir(join4(agentDir, "tools"), { recursive: true });
|
|
19726
|
+
await mkdir(join4(agentDir, "routes"), { recursive: true });
|
|
19727
|
+
await mkdir(join4(agentDir, "flows"), { recursive: true });
|
|
19728
|
+
const agentIndex = `import { asAgentId, defineAgent } from "@kalphq/sdk";
|
|
19729
|
+
import { exampleStep } from "./steps/example-step.js";
|
|
19730
|
+
import { exampleTool } from "./tools/example-tool.js";
|
|
19731
|
+
import { exampleRoute } from "./routes/example-route.js";
|
|
19732
|
+
import { exampleFlow } from "./flows/example-flow.js";
|
|
19733
|
+
|
|
19734
|
+
export default defineAgent({
|
|
19735
|
+
id: asAgentId("${agentName}"),
|
|
19736
|
+
name: "${agentName}",
|
|
19737
|
+
steps: [exampleStep],
|
|
19738
|
+
tools: [exampleTool],
|
|
19739
|
+
routes: [exampleRoute],
|
|
19740
|
+
flows: [exampleFlow],
|
|
19741
|
+
|
|
19742
|
+
async onMessage(message, context) {
|
|
19743
|
+
const stepped = await context.actions.runStep(exampleStep, {
|
|
19744
|
+
message: message.text,
|
|
19745
|
+
});
|
|
19746
|
+
const tooled = await context.actions.callTool(exampleTool, {
|
|
19747
|
+
query: message.text,
|
|
19748
|
+
});
|
|
19749
|
+
return { text: stepped.result + " | " + tooled.output };
|
|
19750
|
+
},
|
|
19751
|
+
});
|
|
19752
|
+
`;
|
|
19753
|
+
const stepFile = `import { createStep } from "@kalphq/sdk";
|
|
19754
|
+
import { z } from "zod";
|
|
19755
|
+
|
|
19756
|
+
export const exampleStep = createStep({
|
|
19757
|
+
id: "example_step",
|
|
19758
|
+
description: "A starter step for your agent.",
|
|
19759
|
+
input: z.object({ message: z.string() }),
|
|
19760
|
+
output: z.object({ result: z.string() }),
|
|
19761
|
+
async run({ message }) {
|
|
19762
|
+
return { result: "Processed: " + message };
|
|
19763
|
+
},
|
|
19764
|
+
});
|
|
19765
|
+
`;
|
|
19766
|
+
const toolFile = `import { createTool } from "@kalphq/sdk";
|
|
19767
|
+
import { z } from "zod";
|
|
19768
|
+
|
|
19769
|
+
export const exampleTool = createTool({
|
|
19770
|
+
id: "example_tool",
|
|
19771
|
+
description: "A starter tool for your agent.",
|
|
19772
|
+
input: z.object({ query: z.string() }),
|
|
19773
|
+
async execute({ query }) {
|
|
19774
|
+
return { output: "Tool result for: " + query };
|
|
19775
|
+
},
|
|
19776
|
+
});
|
|
19777
|
+
`;
|
|
19778
|
+
const routeFile = `import { defineRoute } from "@kalphq/sdk";
|
|
19779
|
+
|
|
19780
|
+
export const exampleRoute = defineRoute({
|
|
19781
|
+
id: "example_route",
|
|
19782
|
+
method: "GET",
|
|
19783
|
+
path: "/example",
|
|
19784
|
+
handler: async () => {
|
|
19785
|
+
return { message: "Hello from Kalp" };
|
|
19786
|
+
},
|
|
19787
|
+
});
|
|
19788
|
+
`;
|
|
19789
|
+
const flowFile = `import { defineFlow } from "@kalphq/sdk";
|
|
19790
|
+
|
|
19791
|
+
export const exampleFlow = defineFlow({
|
|
19792
|
+
id: "example_flow",
|
|
19793
|
+
description: "A starter flow for your agent.",
|
|
19794
|
+
steps: [],
|
|
19795
|
+
});
|
|
19796
|
+
`;
|
|
19797
|
+
await writeFile(join4(agentDir, "index.ts"), agentIndex, "utf-8");
|
|
19798
|
+
await writeFile(
|
|
19799
|
+
join4(agentDir, "steps", "example-step.ts"),
|
|
19800
|
+
stepFile,
|
|
19801
|
+
"utf-8"
|
|
19802
|
+
);
|
|
19803
|
+
await writeFile(
|
|
19804
|
+
join4(agentDir, "tools", "example-tool.ts"),
|
|
19805
|
+
toolFile,
|
|
19806
|
+
"utf-8"
|
|
19807
|
+
);
|
|
19808
|
+
await writeFile(
|
|
19809
|
+
join4(agentDir, "routes", "example-route.ts"),
|
|
19810
|
+
routeFile,
|
|
19811
|
+
"utf-8"
|
|
19812
|
+
);
|
|
19813
|
+
await writeFile(
|
|
19814
|
+
join4(agentDir, "flows", "example-flow.ts"),
|
|
19815
|
+
flowFile,
|
|
19816
|
+
"utf-8"
|
|
19817
|
+
);
|
|
19775
19818
|
}
|
|
19776
19819
|
|
|
19777
19820
|
// src/utils/ui.ts
|
|
19778
19821
|
import * as p from "@clack/prompts";
|
|
19779
|
-
import pc from "picocolors";
|
|
19780
19822
|
async function promptProjectName(opts) {
|
|
19781
19823
|
const message = opts?.message ?? "Project name?";
|
|
19782
19824
|
const placeholder = opts?.placeholder ?? "my-project";
|
|
@@ -19811,14 +19853,6 @@ async function promptAgentDetails() {
|
|
|
19811
19853
|
return "Use lowercase letters, numbers, and dashes only.";
|
|
19812
19854
|
}
|
|
19813
19855
|
}
|
|
19814
|
-
}),
|
|
19815
|
-
template: () => p.select({
|
|
19816
|
-
message: "Choose a template",
|
|
19817
|
-
options: TEMPLATES.map((t) => ({
|
|
19818
|
-
value: t.id,
|
|
19819
|
-
label: t.label,
|
|
19820
|
-
hint: pc.dim(t.hint)
|
|
19821
|
-
}))
|
|
19822
19856
|
})
|
|
19823
19857
|
},
|
|
19824
19858
|
{
|
|
@@ -19829,8 +19863,7 @@ async function promptAgentDetails() {
|
|
|
19829
19863
|
}
|
|
19830
19864
|
);
|
|
19831
19865
|
return {
|
|
19832
|
-
name: answers.name
|
|
19833
|
-
templateId: answers.template
|
|
19866
|
+
name: answers.name
|
|
19834
19867
|
};
|
|
19835
19868
|
}
|
|
19836
19869
|
|
|
@@ -19840,4 +19873,4 @@ export {
|
|
|
19840
19873
|
promptProjectName,
|
|
19841
19874
|
promptAgentDetails
|
|
19842
19875
|
};
|
|
19843
|
-
//# sourceMappingURL=chunk-
|
|
19876
|
+
//# sourceMappingURL=chunk-HD5FT7T6.js.map
|