struere 0.16.0 → 0.16.3
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/bin/struere.js +283 -7
- package/dist/cli/commands/threads.d.ts.map +1 -1
- package/dist/cli/index.js +283 -7
- package/dist/cli/utils/threads.d.ts +37 -0
- package/dist/cli/utils/threads.d.ts.map +1 -1
- package/dist/cli/utils/workflows.d.ts +1 -1
- package/dist/cli/utils/workflows.d.ts.map +1 -1
- package/dist/define/workflow.d.ts +1 -1
- package/dist/define/workflow.d.ts.map +1 -1
- package/dist/index.js +1 -24
- package/package.json +2 -6
- package/dist/bin/fsevents-hj42pnne.node +0 -0
- package/dist/bin/test-cli-import.js +0 -10
- package/dist/cli/commands/build.d.ts +0 -3
- package/dist/cli/commands/build.d.ts.map +0 -1
- package/dist/cli/commands/state.d.ts +0 -3
- package/dist/cli/commands/state.d.ts.map +0 -1
- package/dist/cli/commands/test.d.ts +0 -3
- package/dist/cli/commands/test.d.ts.map +0 -1
- package/dist/cli/commands/validate.d.ts +0 -3
- package/dist/cli/commands/validate.d.ts.map +0 -1
- package/dist/cli/utils/agent.d.ts +0 -3
- package/dist/cli/utils/agent.d.ts.map +0 -1
- package/dist/cli/utils/validate.d.ts +0 -3
- package/dist/cli/utils/validate.d.ts.map +0 -1
- package/dist/define/config.d.ts +0 -3
- package/dist/define/config.d.ts.map +0 -1
- package/dist/fsevents-hj42pnne.node +0 -0
- package/dist/workflow-core/catalog.d.ts +0 -23
- package/dist/workflow-core/catalog.d.ts.map +0 -1
- package/dist/workflow-core/expression.d.ts +0 -3
- package/dist/workflow-core/expression.d.ts.map +0 -1
- package/dist/workflow-core/index.d.ts +0 -6
- package/dist/workflow-core/index.d.ts.map +0 -1
- package/dist/workflow-core/index.js +0 -168
- package/dist/workflow-core/status.d.ts +0 -5
- package/dist/workflow-core/status.d.ts.map +0 -1
package/dist/bin/struere.js
CHANGED
|
@@ -73596,6 +73596,144 @@ async function findThreadByPhone(options) {
|
|
|
73596
73596
|
return false;
|
|
73597
73597
|
}) ?? null;
|
|
73598
73598
|
}
|
|
73599
|
+
async function replyToThread(options) {
|
|
73600
|
+
const apiKey = getApiKey();
|
|
73601
|
+
const credentials = loadCredentials();
|
|
73602
|
+
if (apiKey && !credentials?.token) {
|
|
73603
|
+
return threadsApiCall("/v1/threads/reply", {
|
|
73604
|
+
threadId: options.threadId,
|
|
73605
|
+
message: options.message
|
|
73606
|
+
});
|
|
73607
|
+
}
|
|
73608
|
+
const token = getToken5();
|
|
73609
|
+
const response = await fetch(`${CONVEX_URL}/api/action`, {
|
|
73610
|
+
method: "POST",
|
|
73611
|
+
headers: {
|
|
73612
|
+
"Content-Type": "application/json",
|
|
73613
|
+
Authorization: `Bearer ${token}`
|
|
73614
|
+
},
|
|
73615
|
+
body: JSON.stringify({
|
|
73616
|
+
path: "chat:replyToThreadCli",
|
|
73617
|
+
args: { threadId: options.threadId, message: options.message }
|
|
73618
|
+
}),
|
|
73619
|
+
signal: AbortSignal.timeout(30000)
|
|
73620
|
+
});
|
|
73621
|
+
const text = await response.text();
|
|
73622
|
+
let json;
|
|
73623
|
+
try {
|
|
73624
|
+
json = JSON.parse(text);
|
|
73625
|
+
} catch {
|
|
73626
|
+
throw new Error(text || `HTTP ${response.status}`);
|
|
73627
|
+
}
|
|
73628
|
+
if (!response.ok) {
|
|
73629
|
+
throw new Error(json.errorData?.message || json.errorMessage || text);
|
|
73630
|
+
}
|
|
73631
|
+
if (json.status === "error") {
|
|
73632
|
+
throw new Error(json.errorData?.message || json.errorMessage || "Unknown error from Convex");
|
|
73633
|
+
}
|
|
73634
|
+
return json.value;
|
|
73635
|
+
}
|
|
73636
|
+
async function pauseThread(options) {
|
|
73637
|
+
const apiKey = getApiKey();
|
|
73638
|
+
const credentials = loadCredentials();
|
|
73639
|
+
if (apiKey && !credentials?.token) {
|
|
73640
|
+
return threadsApiCall("/v1/threads/pause", {
|
|
73641
|
+
threadId: options.threadId
|
|
73642
|
+
});
|
|
73643
|
+
}
|
|
73644
|
+
const token = getToken5();
|
|
73645
|
+
const response = await fetch(`${CONVEX_URL}/api/mutation`, {
|
|
73646
|
+
method: "POST",
|
|
73647
|
+
headers: {
|
|
73648
|
+
"Content-Type": "application/json",
|
|
73649
|
+
Authorization: `Bearer ${token}`
|
|
73650
|
+
},
|
|
73651
|
+
body: JSON.stringify({
|
|
73652
|
+
path: "threads:setAgentPaused",
|
|
73653
|
+
args: { threadId: options.threadId, paused: true }
|
|
73654
|
+
}),
|
|
73655
|
+
signal: AbortSignal.timeout(30000)
|
|
73656
|
+
});
|
|
73657
|
+
const text = await response.text();
|
|
73658
|
+
let json;
|
|
73659
|
+
try {
|
|
73660
|
+
json = JSON.parse(text);
|
|
73661
|
+
} catch {
|
|
73662
|
+
throw new Error(text || `HTTP ${response.status}`);
|
|
73663
|
+
}
|
|
73664
|
+
if (!response.ok) {
|
|
73665
|
+
throw new Error(json.errorData?.message || json.errorMessage || text);
|
|
73666
|
+
}
|
|
73667
|
+
if (json.status === "error") {
|
|
73668
|
+
throw new Error(json.errorData?.message || json.errorMessage || "Unknown error from Convex");
|
|
73669
|
+
}
|
|
73670
|
+
return { success: true, paused: true };
|
|
73671
|
+
}
|
|
73672
|
+
async function resumeThread(options) {
|
|
73673
|
+
const apiKey = getApiKey();
|
|
73674
|
+
const credentials = loadCredentials();
|
|
73675
|
+
if (apiKey && !credentials?.token) {
|
|
73676
|
+
return threadsApiCall("/v1/threads/resume", {
|
|
73677
|
+
threadId: options.threadId
|
|
73678
|
+
});
|
|
73679
|
+
}
|
|
73680
|
+
const token = getToken5();
|
|
73681
|
+
const response = await fetch(`${CONVEX_URL}/api/mutation`, {
|
|
73682
|
+
method: "POST",
|
|
73683
|
+
headers: {
|
|
73684
|
+
"Content-Type": "application/json",
|
|
73685
|
+
Authorization: `Bearer ${token}`
|
|
73686
|
+
},
|
|
73687
|
+
body: JSON.stringify({
|
|
73688
|
+
path: "threads:setAgentPaused",
|
|
73689
|
+
args: { threadId: options.threadId, paused: false }
|
|
73690
|
+
}),
|
|
73691
|
+
signal: AbortSignal.timeout(30000)
|
|
73692
|
+
});
|
|
73693
|
+
const text = await response.text();
|
|
73694
|
+
let json;
|
|
73695
|
+
try {
|
|
73696
|
+
json = JSON.parse(text);
|
|
73697
|
+
} catch {
|
|
73698
|
+
throw new Error(text || `HTTP ${response.status}`);
|
|
73699
|
+
}
|
|
73700
|
+
if (!response.ok) {
|
|
73701
|
+
throw new Error(json.errorData?.message || json.errorMessage || text);
|
|
73702
|
+
}
|
|
73703
|
+
if (json.status === "error") {
|
|
73704
|
+
throw new Error(json.errorData?.message || json.errorMessage || "Unknown error from Convex");
|
|
73705
|
+
}
|
|
73706
|
+
return { success: true, paused: false };
|
|
73707
|
+
}
|
|
73708
|
+
async function resolveActiveWhatsAppThread(options) {
|
|
73709
|
+
const threads = await listThreads({
|
|
73710
|
+
environment: options.environment,
|
|
73711
|
+
organizationId: options.organizationId,
|
|
73712
|
+
limit: 100
|
|
73713
|
+
});
|
|
73714
|
+
const isPhone = options.target.startsWith("+") || /^\d+$/.test(options.target);
|
|
73715
|
+
let matches;
|
|
73716
|
+
if (isPhone) {
|
|
73717
|
+
const normalize = (p) => p.replace(/\D/g, "");
|
|
73718
|
+
const normalizedInput = normalize(options.target);
|
|
73719
|
+
matches = threads.filter((t2) => {
|
|
73720
|
+
const phoneNumber = t2.channelParams?.phoneNumber;
|
|
73721
|
+
if (phoneNumber && normalize(phoneNumber) === normalizedInput)
|
|
73722
|
+
return true;
|
|
73723
|
+
if (t2.externalId && t2.externalId.includes(normalizedInput))
|
|
73724
|
+
return true;
|
|
73725
|
+
return false;
|
|
73726
|
+
});
|
|
73727
|
+
} else {
|
|
73728
|
+
matches = threads.filter((t2) => t2._id === options.target);
|
|
73729
|
+
}
|
|
73730
|
+
const active = matches.filter((t2) => !t2.externalId?.includes(":archived:"));
|
|
73731
|
+
if (active.length === 0)
|
|
73732
|
+
return { kind: "none" };
|
|
73733
|
+
if (active.length === 1)
|
|
73734
|
+
return { kind: "ok", thread: active[0] };
|
|
73735
|
+
return { kind: "multiple", candidates: active };
|
|
73736
|
+
}
|
|
73599
73737
|
|
|
73600
73738
|
// src/cli/commands/threads.ts
|
|
73601
73739
|
async function ensureAuth7() {
|
|
@@ -73676,6 +73814,16 @@ function roleColor(role) {
|
|
|
73676
73814
|
return chalk22.gray(role);
|
|
73677
73815
|
}
|
|
73678
73816
|
}
|
|
73817
|
+
function threadPhone(thread) {
|
|
73818
|
+
const phoneNumber = thread.channelParams?.phoneNumber;
|
|
73819
|
+
if (phoneNumber)
|
|
73820
|
+
return phoneNumber;
|
|
73821
|
+
if (thread.externalId) {
|
|
73822
|
+
const parts = thread.externalId.split(":");
|
|
73823
|
+
return parts[parts.length - 1];
|
|
73824
|
+
}
|
|
73825
|
+
return "unknown";
|
|
73826
|
+
}
|
|
73679
73827
|
var threadsCommand = new Command20("threads").description("Manage conversation threads");
|
|
73680
73828
|
threadsCommand.command("list", { isDefault: true }).description("List conversation threads").option("--env <environment>", "Environment (development|production|eval)", "development").option("--channel <channel>", "Filter by channel (whatsapp|api|widget|dashboard|voice)").option("--limit <n>", "Maximum results", "25").option("--json", "Output raw JSON").action(async (opts) => {
|
|
73681
73829
|
await ensureAuth7();
|
|
@@ -73703,7 +73851,7 @@ threadsCommand.command("list", { isDefault: true }).description("List conversati
|
|
|
73703
73851
|
], threads.map((t2) => ({
|
|
73704
73852
|
id: t2._id,
|
|
73705
73853
|
channel: channelColor(t2.channel),
|
|
73706
|
-
participant: t2.participantName ?? "Unknown",
|
|
73854
|
+
participant: t2.agentPaused ? `${t2.participantName ?? "Unknown"} ${chalk22.yellow("PAUSED")}` : t2.participantName ?? "Unknown",
|
|
73707
73855
|
agent: t2.agentName ?? "Unknown",
|
|
73708
73856
|
lastMessage: t2.lastMessage ? t2.lastMessage.content.slice(0, 40) : chalk22.gray("-"),
|
|
73709
73857
|
time: relativeTime4(t2.updatedAt ?? t2.createdAt)
|
|
@@ -73859,6 +74007,138 @@ threadsCommand.command("reset").description("Archive a thread by phone number").
|
|
|
73859
74007
|
process.exit(1);
|
|
73860
74008
|
}
|
|
73861
74009
|
});
|
|
74010
|
+
async function resolveOrExit(target, environment, json, spinner) {
|
|
74011
|
+
const project = loadProject(process.cwd());
|
|
74012
|
+
const resolution = await resolveActiveWhatsAppThread({
|
|
74013
|
+
target,
|
|
74014
|
+
environment,
|
|
74015
|
+
organizationId: project?.organization.id
|
|
74016
|
+
});
|
|
74017
|
+
if (resolution.kind === "none") {
|
|
74018
|
+
const error = `No active WhatsApp thread found for "${target}" in ${environment}. Did you mean --env production?`;
|
|
74019
|
+
spinner?.fail(error);
|
|
74020
|
+
if (json) {
|
|
74021
|
+
console.log(JSON.stringify({ success: false, error }));
|
|
74022
|
+
} else {
|
|
74023
|
+
console.log(chalk22.red("Error:"), error);
|
|
74024
|
+
}
|
|
74025
|
+
process.exit(1);
|
|
74026
|
+
}
|
|
74027
|
+
if (resolution.kind === "multiple") {
|
|
74028
|
+
spinner?.stop();
|
|
74029
|
+
if (json) {
|
|
74030
|
+
console.log(JSON.stringify({ success: false, error: `Multiple active threads match ${target}` }));
|
|
74031
|
+
} else {
|
|
74032
|
+
console.log(chalk22.yellow(`Multiple active threads match ${target}:`));
|
|
74033
|
+
for (const candidate of resolution.candidates) {
|
|
74034
|
+
console.log(` ${chalk22.cyan(candidate._id)} ${candidate.agentName ?? "Unknown"} ${threadPhone(candidate)}`);
|
|
74035
|
+
}
|
|
74036
|
+
console.log(chalk22.gray("Re-run with an explicit thread id."));
|
|
74037
|
+
}
|
|
74038
|
+
process.exit(1);
|
|
74039
|
+
}
|
|
74040
|
+
const thread = resolution.thread;
|
|
74041
|
+
if (!thread.externalId?.startsWith("whatsapp:")) {
|
|
74042
|
+
const error = `Thread ${thread._id} is not a WhatsApp conversation (reply/pause/resume only support WhatsApp).`;
|
|
74043
|
+
spinner?.fail(error);
|
|
74044
|
+
if (json) {
|
|
74045
|
+
console.log(JSON.stringify({ success: false, error }));
|
|
74046
|
+
} else {
|
|
74047
|
+
console.log(chalk22.red("Error:"), error);
|
|
74048
|
+
}
|
|
74049
|
+
process.exit(1);
|
|
74050
|
+
}
|
|
74051
|
+
return thread;
|
|
74052
|
+
}
|
|
74053
|
+
threadsCommand.command("reply").description("Send a WhatsApp message directly to a user as a human operator (does not pause the agent)").argument("<target>", "Thread id or phone number").requiredOption("-m, --message <text>", "Message to send to the user").option("--env <environment>", "Environment: development | production | eval", "development").option("--json", "Output raw JSON").action(async (target, opts) => {
|
|
74054
|
+
await ensureAuth7();
|
|
74055
|
+
const spinner = opts.json ? null : ora16();
|
|
74056
|
+
const environment = opts.env;
|
|
74057
|
+
try {
|
|
74058
|
+
spinner?.start(`Resolving thread for ${target}...`);
|
|
74059
|
+
const thread = await resolveOrExit(target, environment, !!opts.json, spinner);
|
|
74060
|
+
const phone = threadPhone(thread);
|
|
74061
|
+
if (spinner)
|
|
74062
|
+
spinner.text = `Sending to ${phone}...`;
|
|
74063
|
+
const result = await replyToThread({
|
|
74064
|
+
threadId: thread._id,
|
|
74065
|
+
message: opts.message,
|
|
74066
|
+
environment
|
|
74067
|
+
});
|
|
74068
|
+
if (result.whatsappStatus === "failed") {
|
|
74069
|
+
spinner?.fail(`Failed to send to ${phone} (env: ${environment})`);
|
|
74070
|
+
if (opts.json) {
|
|
74071
|
+
console.log(JSON.stringify({ success: false, threadId: thread._id, whatsappStatus: result.whatsappStatus, environment }));
|
|
74072
|
+
} else {
|
|
74073
|
+
console.log(chalk22.gray(`Tip: the 24h window may be closed or the connection is not connected. Re-open with a template: struere run-tool whatsapp.sendTemplate --args '{"to":"${phone}","templateName":"...","language":"..."}'`));
|
|
74074
|
+
}
|
|
74075
|
+
process.exit(1);
|
|
74076
|
+
}
|
|
74077
|
+
spinner?.succeed(chalk22.green(`Sent to ${phone} (env: ${environment})`));
|
|
74078
|
+
if (opts.json) {
|
|
74079
|
+
console.log(JSON.stringify({ success: true, threadId: thread._id, whatsappStatus: result.whatsappStatus, environment }));
|
|
74080
|
+
}
|
|
74081
|
+
} catch (err) {
|
|
74082
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
74083
|
+
spinner?.fail("Failed to reply to thread");
|
|
74084
|
+
if (opts.json) {
|
|
74085
|
+
console.log(JSON.stringify({ success: false, error: message }));
|
|
74086
|
+
} else {
|
|
74087
|
+
console.log(chalk22.red("Error:"), message);
|
|
74088
|
+
}
|
|
74089
|
+
process.exit(1);
|
|
74090
|
+
}
|
|
74091
|
+
});
|
|
74092
|
+
threadsCommand.command("pause").description("Pause the agent on a conversation so it stops auto-responding").argument("<target>", "Thread id or phone number").option("--env <environment>", "Environment: development | production | eval", "development").option("--json", "Output raw JSON").action(async (target, opts) => {
|
|
74093
|
+
await ensureAuth7();
|
|
74094
|
+
const spinner = opts.json ? null : ora16();
|
|
74095
|
+
const environment = opts.env;
|
|
74096
|
+
try {
|
|
74097
|
+
spinner?.start(`Resolving thread for ${target}...`);
|
|
74098
|
+
const thread = await resolveOrExit(target, environment, !!opts.json, spinner);
|
|
74099
|
+
if (spinner)
|
|
74100
|
+
spinner.text = `Pausing agent for thread ${thread._id}...`;
|
|
74101
|
+
await pauseThread({ threadId: thread._id, environment });
|
|
74102
|
+
spinner?.succeed(chalk22.green(`Agent paused for thread ${thread._id} (env: ${environment})`));
|
|
74103
|
+
if (opts.json) {
|
|
74104
|
+
console.log(JSON.stringify({ success: true, threadId: thread._id, paused: true, environment }));
|
|
74105
|
+
}
|
|
74106
|
+
} catch (err) {
|
|
74107
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
74108
|
+
spinner?.fail("Failed to pause thread");
|
|
74109
|
+
if (opts.json) {
|
|
74110
|
+
console.log(JSON.stringify({ success: false, error: message }));
|
|
74111
|
+
} else {
|
|
74112
|
+
console.log(chalk22.red("Error:"), message);
|
|
74113
|
+
}
|
|
74114
|
+
process.exit(1);
|
|
74115
|
+
}
|
|
74116
|
+
});
|
|
74117
|
+
threadsCommand.command("resume").description("Resume the agent on a paused conversation").argument("<target>", "Thread id or phone number").option("--env <environment>", "Environment: development | production | eval", "development").option("--json", "Output raw JSON").action(async (target, opts) => {
|
|
74118
|
+
await ensureAuth7();
|
|
74119
|
+
const spinner = opts.json ? null : ora16();
|
|
74120
|
+
const environment = opts.env;
|
|
74121
|
+
try {
|
|
74122
|
+
spinner?.start(`Resolving thread for ${target}...`);
|
|
74123
|
+
const thread = await resolveOrExit(target, environment, !!opts.json, spinner);
|
|
74124
|
+
if (spinner)
|
|
74125
|
+
spinner.text = `Resuming agent for thread ${thread._id}...`;
|
|
74126
|
+
await resumeThread({ threadId: thread._id, environment });
|
|
74127
|
+
spinner?.succeed(chalk22.green(`Agent resumed for thread ${thread._id} (env: ${environment})`));
|
|
74128
|
+
if (opts.json) {
|
|
74129
|
+
console.log(JSON.stringify({ success: true, threadId: thread._id, paused: false, environment }));
|
|
74130
|
+
}
|
|
74131
|
+
} catch (err) {
|
|
74132
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
74133
|
+
spinner?.fail("Failed to resume thread");
|
|
74134
|
+
if (opts.json) {
|
|
74135
|
+
console.log(JSON.stringify({ success: false, error: message }));
|
|
74136
|
+
} else {
|
|
74137
|
+
console.log(chalk22.red("Error:"), message);
|
|
74138
|
+
}
|
|
74139
|
+
process.exit(1);
|
|
74140
|
+
}
|
|
74141
|
+
});
|
|
73862
74142
|
|
|
73863
74143
|
// src/cli/commands/compile-prompt.ts
|
|
73864
74144
|
init_credentials();
|
|
@@ -75914,7 +76194,7 @@ keysCommand.command("revoke <id-or-prefix>").description("Revoke an API key (del
|
|
|
75914
76194
|
// package.json
|
|
75915
76195
|
var package_default = {
|
|
75916
76196
|
name: "struere",
|
|
75917
|
-
version: "0.16.
|
|
76197
|
+
version: "0.16.3",
|
|
75918
76198
|
description: "Build, test, and deploy AI agents",
|
|
75919
76199
|
keywords: [
|
|
75920
76200
|
"ai",
|
|
@@ -75953,17 +76233,13 @@ var package_default = {
|
|
|
75953
76233
|
"./client": {
|
|
75954
76234
|
import: "./dist/client/index.js",
|
|
75955
76235
|
types: "./dist/client/index.d.ts"
|
|
75956
|
-
},
|
|
75957
|
-
"./workflow-core": {
|
|
75958
|
-
import: "./dist/workflow-core/index.js",
|
|
75959
|
-
types: "./dist/workflow-core/index.d.ts"
|
|
75960
76236
|
}
|
|
75961
76237
|
},
|
|
75962
76238
|
files: [
|
|
75963
76239
|
"dist"
|
|
75964
76240
|
],
|
|
75965
76241
|
scripts: {
|
|
75966
|
-
build: "bun build ./src/cli/index.ts --outdir ./dist/cli --target node --external commander --external chalk --external ora --external chokidar --external yaml --external @inquirer/prompts --external jiti && bun build ./src/index.ts --outdir ./dist --target node && bun build ./src/client/index.ts --outdir ./dist/client --target browser && bun build ./src/
|
|
76242
|
+
build: "bun build ./src/cli/index.ts --outdir ./dist/cli --target node --external commander --external chalk --external ora --external chokidar --external yaml --external @inquirer/prompts --external jiti && bun build ./src/index.ts --outdir ./dist --target node && bun build ./src/client/index.ts --outdir ./dist/client --target browser && bun build ./src/bin/struere.ts --outdir ./dist/bin --target node --external commander --external chalk --external ora --external chokidar --external yaml --external @inquirer/prompts --external jiti && tsc --emitDeclarationOnly && chmod +x ./dist/bin/struere.js",
|
|
75967
76243
|
dev: "tsc --watch",
|
|
75968
76244
|
test: "bun test",
|
|
75969
76245
|
prepublishOnly: "bun run build"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"threads.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/threads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"threads.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/threads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AA0GnC,eAAO,MAAM,cAAc,SACkB,CAAA"}
|
package/dist/cli/index.js
CHANGED
|
@@ -74586,6 +74586,144 @@ async function findThreadByPhone(options) {
|
|
|
74586
74586
|
return false;
|
|
74587
74587
|
}) ?? null;
|
|
74588
74588
|
}
|
|
74589
|
+
async function replyToThread(options) {
|
|
74590
|
+
const apiKey = getApiKey();
|
|
74591
|
+
const credentials = loadCredentials();
|
|
74592
|
+
if (apiKey && !credentials?.token) {
|
|
74593
|
+
return threadsApiCall("/v1/threads/reply", {
|
|
74594
|
+
threadId: options.threadId,
|
|
74595
|
+
message: options.message
|
|
74596
|
+
});
|
|
74597
|
+
}
|
|
74598
|
+
const token = getToken5();
|
|
74599
|
+
const response = await fetch(`${CONVEX_URL}/api/action`, {
|
|
74600
|
+
method: "POST",
|
|
74601
|
+
headers: {
|
|
74602
|
+
"Content-Type": "application/json",
|
|
74603
|
+
Authorization: `Bearer ${token}`
|
|
74604
|
+
},
|
|
74605
|
+
body: JSON.stringify({
|
|
74606
|
+
path: "chat:replyToThreadCli",
|
|
74607
|
+
args: { threadId: options.threadId, message: options.message }
|
|
74608
|
+
}),
|
|
74609
|
+
signal: AbortSignal.timeout(30000)
|
|
74610
|
+
});
|
|
74611
|
+
const text = await response.text();
|
|
74612
|
+
let json;
|
|
74613
|
+
try {
|
|
74614
|
+
json = JSON.parse(text);
|
|
74615
|
+
} catch {
|
|
74616
|
+
throw new Error(text || `HTTP ${response.status}`);
|
|
74617
|
+
}
|
|
74618
|
+
if (!response.ok) {
|
|
74619
|
+
throw new Error(json.errorData?.message || json.errorMessage || text);
|
|
74620
|
+
}
|
|
74621
|
+
if (json.status === "error") {
|
|
74622
|
+
throw new Error(json.errorData?.message || json.errorMessage || "Unknown error from Convex");
|
|
74623
|
+
}
|
|
74624
|
+
return json.value;
|
|
74625
|
+
}
|
|
74626
|
+
async function pauseThread(options) {
|
|
74627
|
+
const apiKey = getApiKey();
|
|
74628
|
+
const credentials = loadCredentials();
|
|
74629
|
+
if (apiKey && !credentials?.token) {
|
|
74630
|
+
return threadsApiCall("/v1/threads/pause", {
|
|
74631
|
+
threadId: options.threadId
|
|
74632
|
+
});
|
|
74633
|
+
}
|
|
74634
|
+
const token = getToken5();
|
|
74635
|
+
const response = await fetch(`${CONVEX_URL}/api/mutation`, {
|
|
74636
|
+
method: "POST",
|
|
74637
|
+
headers: {
|
|
74638
|
+
"Content-Type": "application/json",
|
|
74639
|
+
Authorization: `Bearer ${token}`
|
|
74640
|
+
},
|
|
74641
|
+
body: JSON.stringify({
|
|
74642
|
+
path: "threads:setAgentPaused",
|
|
74643
|
+
args: { threadId: options.threadId, paused: true }
|
|
74644
|
+
}),
|
|
74645
|
+
signal: AbortSignal.timeout(30000)
|
|
74646
|
+
});
|
|
74647
|
+
const text = await response.text();
|
|
74648
|
+
let json;
|
|
74649
|
+
try {
|
|
74650
|
+
json = JSON.parse(text);
|
|
74651
|
+
} catch {
|
|
74652
|
+
throw new Error(text || `HTTP ${response.status}`);
|
|
74653
|
+
}
|
|
74654
|
+
if (!response.ok) {
|
|
74655
|
+
throw new Error(json.errorData?.message || json.errorMessage || text);
|
|
74656
|
+
}
|
|
74657
|
+
if (json.status === "error") {
|
|
74658
|
+
throw new Error(json.errorData?.message || json.errorMessage || "Unknown error from Convex");
|
|
74659
|
+
}
|
|
74660
|
+
return { success: true, paused: true };
|
|
74661
|
+
}
|
|
74662
|
+
async function resumeThread(options) {
|
|
74663
|
+
const apiKey = getApiKey();
|
|
74664
|
+
const credentials = loadCredentials();
|
|
74665
|
+
if (apiKey && !credentials?.token) {
|
|
74666
|
+
return threadsApiCall("/v1/threads/resume", {
|
|
74667
|
+
threadId: options.threadId
|
|
74668
|
+
});
|
|
74669
|
+
}
|
|
74670
|
+
const token = getToken5();
|
|
74671
|
+
const response = await fetch(`${CONVEX_URL}/api/mutation`, {
|
|
74672
|
+
method: "POST",
|
|
74673
|
+
headers: {
|
|
74674
|
+
"Content-Type": "application/json",
|
|
74675
|
+
Authorization: `Bearer ${token}`
|
|
74676
|
+
},
|
|
74677
|
+
body: JSON.stringify({
|
|
74678
|
+
path: "threads:setAgentPaused",
|
|
74679
|
+
args: { threadId: options.threadId, paused: false }
|
|
74680
|
+
}),
|
|
74681
|
+
signal: AbortSignal.timeout(30000)
|
|
74682
|
+
});
|
|
74683
|
+
const text = await response.text();
|
|
74684
|
+
let json;
|
|
74685
|
+
try {
|
|
74686
|
+
json = JSON.parse(text);
|
|
74687
|
+
} catch {
|
|
74688
|
+
throw new Error(text || `HTTP ${response.status}`);
|
|
74689
|
+
}
|
|
74690
|
+
if (!response.ok) {
|
|
74691
|
+
throw new Error(json.errorData?.message || json.errorMessage || text);
|
|
74692
|
+
}
|
|
74693
|
+
if (json.status === "error") {
|
|
74694
|
+
throw new Error(json.errorData?.message || json.errorMessage || "Unknown error from Convex");
|
|
74695
|
+
}
|
|
74696
|
+
return { success: true, paused: false };
|
|
74697
|
+
}
|
|
74698
|
+
async function resolveActiveWhatsAppThread(options) {
|
|
74699
|
+
const threads = await listThreads({
|
|
74700
|
+
environment: options.environment,
|
|
74701
|
+
organizationId: options.organizationId,
|
|
74702
|
+
limit: 100
|
|
74703
|
+
});
|
|
74704
|
+
const isPhone = options.target.startsWith("+") || /^\d+$/.test(options.target);
|
|
74705
|
+
let matches;
|
|
74706
|
+
if (isPhone) {
|
|
74707
|
+
const normalize = (p) => p.replace(/\D/g, "");
|
|
74708
|
+
const normalizedInput = normalize(options.target);
|
|
74709
|
+
matches = threads.filter((t2) => {
|
|
74710
|
+
const phoneNumber = t2.channelParams?.phoneNumber;
|
|
74711
|
+
if (phoneNumber && normalize(phoneNumber) === normalizedInput)
|
|
74712
|
+
return true;
|
|
74713
|
+
if (t2.externalId && t2.externalId.includes(normalizedInput))
|
|
74714
|
+
return true;
|
|
74715
|
+
return false;
|
|
74716
|
+
});
|
|
74717
|
+
} else {
|
|
74718
|
+
matches = threads.filter((t2) => t2._id === options.target);
|
|
74719
|
+
}
|
|
74720
|
+
const active = matches.filter((t2) => !t2.externalId?.includes(":archived:"));
|
|
74721
|
+
if (active.length === 0)
|
|
74722
|
+
return { kind: "none" };
|
|
74723
|
+
if (active.length === 1)
|
|
74724
|
+
return { kind: "ok", thread: active[0] };
|
|
74725
|
+
return { kind: "multiple", candidates: active };
|
|
74726
|
+
}
|
|
74589
74727
|
|
|
74590
74728
|
// src/cli/commands/threads.ts
|
|
74591
74729
|
async function ensureAuth7() {
|
|
@@ -74666,6 +74804,16 @@ function roleColor(role) {
|
|
|
74666
74804
|
return chalk27.gray(role);
|
|
74667
74805
|
}
|
|
74668
74806
|
}
|
|
74807
|
+
function threadPhone(thread) {
|
|
74808
|
+
const phoneNumber = thread.channelParams?.phoneNumber;
|
|
74809
|
+
if (phoneNumber)
|
|
74810
|
+
return phoneNumber;
|
|
74811
|
+
if (thread.externalId) {
|
|
74812
|
+
const parts = thread.externalId.split(":");
|
|
74813
|
+
return parts[parts.length - 1];
|
|
74814
|
+
}
|
|
74815
|
+
return "unknown";
|
|
74816
|
+
}
|
|
74669
74817
|
var threadsCommand = new Command25("threads").description("Manage conversation threads");
|
|
74670
74818
|
threadsCommand.command("list", { isDefault: true }).description("List conversation threads").option("--env <environment>", "Environment (development|production|eval)", "development").option("--channel <channel>", "Filter by channel (whatsapp|api|widget|dashboard|voice)").option("--limit <n>", "Maximum results", "25").option("--json", "Output raw JSON").action(async (opts) => {
|
|
74671
74819
|
await ensureAuth7();
|
|
@@ -74693,7 +74841,7 @@ threadsCommand.command("list", { isDefault: true }).description("List conversati
|
|
|
74693
74841
|
], threads.map((t2) => ({
|
|
74694
74842
|
id: t2._id,
|
|
74695
74843
|
channel: channelColor(t2.channel),
|
|
74696
|
-
participant: t2.participantName ?? "Unknown",
|
|
74844
|
+
participant: t2.agentPaused ? `${t2.participantName ?? "Unknown"} ${chalk27.yellow("PAUSED")}` : t2.participantName ?? "Unknown",
|
|
74697
74845
|
agent: t2.agentName ?? "Unknown",
|
|
74698
74846
|
lastMessage: t2.lastMessage ? t2.lastMessage.content.slice(0, 40) : chalk27.gray("-"),
|
|
74699
74847
|
time: relativeTime4(t2.updatedAt ?? t2.createdAt)
|
|
@@ -74849,6 +74997,138 @@ threadsCommand.command("reset").description("Archive a thread by phone number").
|
|
|
74849
74997
|
process.exit(1);
|
|
74850
74998
|
}
|
|
74851
74999
|
});
|
|
75000
|
+
async function resolveOrExit(target, environment, json, spinner) {
|
|
75001
|
+
const project = loadProject(process.cwd());
|
|
75002
|
+
const resolution = await resolveActiveWhatsAppThread({
|
|
75003
|
+
target,
|
|
75004
|
+
environment,
|
|
75005
|
+
organizationId: project?.organization.id
|
|
75006
|
+
});
|
|
75007
|
+
if (resolution.kind === "none") {
|
|
75008
|
+
const error = `No active WhatsApp thread found for "${target}" in ${environment}. Did you mean --env production?`;
|
|
75009
|
+
spinner?.fail(error);
|
|
75010
|
+
if (json) {
|
|
75011
|
+
console.log(JSON.stringify({ success: false, error }));
|
|
75012
|
+
} else {
|
|
75013
|
+
console.log(chalk27.red("Error:"), error);
|
|
75014
|
+
}
|
|
75015
|
+
process.exit(1);
|
|
75016
|
+
}
|
|
75017
|
+
if (resolution.kind === "multiple") {
|
|
75018
|
+
spinner?.stop();
|
|
75019
|
+
if (json) {
|
|
75020
|
+
console.log(JSON.stringify({ success: false, error: `Multiple active threads match ${target}` }));
|
|
75021
|
+
} else {
|
|
75022
|
+
console.log(chalk27.yellow(`Multiple active threads match ${target}:`));
|
|
75023
|
+
for (const candidate of resolution.candidates) {
|
|
75024
|
+
console.log(` ${chalk27.cyan(candidate._id)} ${candidate.agentName ?? "Unknown"} ${threadPhone(candidate)}`);
|
|
75025
|
+
}
|
|
75026
|
+
console.log(chalk27.gray("Re-run with an explicit thread id."));
|
|
75027
|
+
}
|
|
75028
|
+
process.exit(1);
|
|
75029
|
+
}
|
|
75030
|
+
const thread = resolution.thread;
|
|
75031
|
+
if (!thread.externalId?.startsWith("whatsapp:")) {
|
|
75032
|
+
const error = `Thread ${thread._id} is not a WhatsApp conversation (reply/pause/resume only support WhatsApp).`;
|
|
75033
|
+
spinner?.fail(error);
|
|
75034
|
+
if (json) {
|
|
75035
|
+
console.log(JSON.stringify({ success: false, error }));
|
|
75036
|
+
} else {
|
|
75037
|
+
console.log(chalk27.red("Error:"), error);
|
|
75038
|
+
}
|
|
75039
|
+
process.exit(1);
|
|
75040
|
+
}
|
|
75041
|
+
return thread;
|
|
75042
|
+
}
|
|
75043
|
+
threadsCommand.command("reply").description("Send a WhatsApp message directly to a user as a human operator (does not pause the agent)").argument("<target>", "Thread id or phone number").requiredOption("-m, --message <text>", "Message to send to the user").option("--env <environment>", "Environment: development | production | eval", "development").option("--json", "Output raw JSON").action(async (target, opts) => {
|
|
75044
|
+
await ensureAuth7();
|
|
75045
|
+
const spinner = opts.json ? null : ora20();
|
|
75046
|
+
const environment = opts.env;
|
|
75047
|
+
try {
|
|
75048
|
+
spinner?.start(`Resolving thread for ${target}...`);
|
|
75049
|
+
const thread = await resolveOrExit(target, environment, !!opts.json, spinner);
|
|
75050
|
+
const phone = threadPhone(thread);
|
|
75051
|
+
if (spinner)
|
|
75052
|
+
spinner.text = `Sending to ${phone}...`;
|
|
75053
|
+
const result = await replyToThread({
|
|
75054
|
+
threadId: thread._id,
|
|
75055
|
+
message: opts.message,
|
|
75056
|
+
environment
|
|
75057
|
+
});
|
|
75058
|
+
if (result.whatsappStatus === "failed") {
|
|
75059
|
+
spinner?.fail(`Failed to send to ${phone} (env: ${environment})`);
|
|
75060
|
+
if (opts.json) {
|
|
75061
|
+
console.log(JSON.stringify({ success: false, threadId: thread._id, whatsappStatus: result.whatsappStatus, environment }));
|
|
75062
|
+
} else {
|
|
75063
|
+
console.log(chalk27.gray(`Tip: the 24h window may be closed or the connection is not connected. Re-open with a template: struere run-tool whatsapp.sendTemplate --args '{"to":"${phone}","templateName":"...","language":"..."}'`));
|
|
75064
|
+
}
|
|
75065
|
+
process.exit(1);
|
|
75066
|
+
}
|
|
75067
|
+
spinner?.succeed(chalk27.green(`Sent to ${phone} (env: ${environment})`));
|
|
75068
|
+
if (opts.json) {
|
|
75069
|
+
console.log(JSON.stringify({ success: true, threadId: thread._id, whatsappStatus: result.whatsappStatus, environment }));
|
|
75070
|
+
}
|
|
75071
|
+
} catch (err) {
|
|
75072
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
75073
|
+
spinner?.fail("Failed to reply to thread");
|
|
75074
|
+
if (opts.json) {
|
|
75075
|
+
console.log(JSON.stringify({ success: false, error: message }));
|
|
75076
|
+
} else {
|
|
75077
|
+
console.log(chalk27.red("Error:"), message);
|
|
75078
|
+
}
|
|
75079
|
+
process.exit(1);
|
|
75080
|
+
}
|
|
75081
|
+
});
|
|
75082
|
+
threadsCommand.command("pause").description("Pause the agent on a conversation so it stops auto-responding").argument("<target>", "Thread id or phone number").option("--env <environment>", "Environment: development | production | eval", "development").option("--json", "Output raw JSON").action(async (target, opts) => {
|
|
75083
|
+
await ensureAuth7();
|
|
75084
|
+
const spinner = opts.json ? null : ora20();
|
|
75085
|
+
const environment = opts.env;
|
|
75086
|
+
try {
|
|
75087
|
+
spinner?.start(`Resolving thread for ${target}...`);
|
|
75088
|
+
const thread = await resolveOrExit(target, environment, !!opts.json, spinner);
|
|
75089
|
+
if (spinner)
|
|
75090
|
+
spinner.text = `Pausing agent for thread ${thread._id}...`;
|
|
75091
|
+
await pauseThread({ threadId: thread._id, environment });
|
|
75092
|
+
spinner?.succeed(chalk27.green(`Agent paused for thread ${thread._id} (env: ${environment})`));
|
|
75093
|
+
if (opts.json) {
|
|
75094
|
+
console.log(JSON.stringify({ success: true, threadId: thread._id, paused: true, environment }));
|
|
75095
|
+
}
|
|
75096
|
+
} catch (err) {
|
|
75097
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
75098
|
+
spinner?.fail("Failed to pause thread");
|
|
75099
|
+
if (opts.json) {
|
|
75100
|
+
console.log(JSON.stringify({ success: false, error: message }));
|
|
75101
|
+
} else {
|
|
75102
|
+
console.log(chalk27.red("Error:"), message);
|
|
75103
|
+
}
|
|
75104
|
+
process.exit(1);
|
|
75105
|
+
}
|
|
75106
|
+
});
|
|
75107
|
+
threadsCommand.command("resume").description("Resume the agent on a paused conversation").argument("<target>", "Thread id or phone number").option("--env <environment>", "Environment: development | production | eval", "development").option("--json", "Output raw JSON").action(async (target, opts) => {
|
|
75108
|
+
await ensureAuth7();
|
|
75109
|
+
const spinner = opts.json ? null : ora20();
|
|
75110
|
+
const environment = opts.env;
|
|
75111
|
+
try {
|
|
75112
|
+
spinner?.start(`Resolving thread for ${target}...`);
|
|
75113
|
+
const thread = await resolveOrExit(target, environment, !!opts.json, spinner);
|
|
75114
|
+
if (spinner)
|
|
75115
|
+
spinner.text = `Resuming agent for thread ${thread._id}...`;
|
|
75116
|
+
await resumeThread({ threadId: thread._id, environment });
|
|
75117
|
+
spinner?.succeed(chalk27.green(`Agent resumed for thread ${thread._id} (env: ${environment})`));
|
|
75118
|
+
if (opts.json) {
|
|
75119
|
+
console.log(JSON.stringify({ success: true, threadId: thread._id, paused: false, environment }));
|
|
75120
|
+
}
|
|
75121
|
+
} catch (err) {
|
|
75122
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
75123
|
+
spinner?.fail("Failed to resume thread");
|
|
75124
|
+
if (opts.json) {
|
|
75125
|
+
console.log(JSON.stringify({ success: false, error: message }));
|
|
75126
|
+
} else {
|
|
75127
|
+
console.log(chalk27.red("Error:"), message);
|
|
75128
|
+
}
|
|
75129
|
+
process.exit(1);
|
|
75130
|
+
}
|
|
75131
|
+
});
|
|
74852
75132
|
|
|
74853
75133
|
// src/cli/commands/compile-prompt.ts
|
|
74854
75134
|
init_credentials();
|
|
@@ -76904,7 +77184,7 @@ keysCommand.command("revoke <id-or-prefix>").description("Revoke an API key (del
|
|
|
76904
77184
|
// package.json
|
|
76905
77185
|
var package_default = {
|
|
76906
77186
|
name: "struere",
|
|
76907
|
-
version: "0.16.
|
|
77187
|
+
version: "0.16.3",
|
|
76908
77188
|
description: "Build, test, and deploy AI agents",
|
|
76909
77189
|
keywords: [
|
|
76910
77190
|
"ai",
|
|
@@ -76943,17 +77223,13 @@ var package_default = {
|
|
|
76943
77223
|
"./client": {
|
|
76944
77224
|
import: "./dist/client/index.js",
|
|
76945
77225
|
types: "./dist/client/index.d.ts"
|
|
76946
|
-
},
|
|
76947
|
-
"./workflow-core": {
|
|
76948
|
-
import: "./dist/workflow-core/index.js",
|
|
76949
|
-
types: "./dist/workflow-core/index.d.ts"
|
|
76950
77226
|
}
|
|
76951
77227
|
},
|
|
76952
77228
|
files: [
|
|
76953
77229
|
"dist"
|
|
76954
77230
|
],
|
|
76955
77231
|
scripts: {
|
|
76956
|
-
build: "bun build ./src/cli/index.ts --outdir ./dist/cli --target node --external commander --external chalk --external ora --external chokidar --external yaml --external @inquirer/prompts --external jiti && bun build ./src/index.ts --outdir ./dist --target node && bun build ./src/client/index.ts --outdir ./dist/client --target browser && bun build ./src/
|
|
77232
|
+
build: "bun build ./src/cli/index.ts --outdir ./dist/cli --target node --external commander --external chalk --external ora --external chokidar --external yaml --external @inquirer/prompts --external jiti && bun build ./src/index.ts --outdir ./dist --target node && bun build ./src/client/index.ts --outdir ./dist/client --target browser && bun build ./src/bin/struere.ts --outdir ./dist/bin --target node --external commander --external chalk --external ora --external chokidar --external yaml --external @inquirer/prompts --external jiti && tsc --emitDeclarationOnly && chmod +x ./dist/bin/struere.js",
|
|
76957
77233
|
dev: "tsc --watch",
|
|
76958
77234
|
test: "bun test",
|
|
76959
77235
|
prepublishOnly: "bun run build"
|
|
@@ -12,6 +12,7 @@ export interface ThreadPreview {
|
|
|
12
12
|
} | null;
|
|
13
13
|
participantName: string;
|
|
14
14
|
messageCount: number;
|
|
15
|
+
agentPaused?: boolean;
|
|
15
16
|
createdAt: number;
|
|
16
17
|
updatedAt: number;
|
|
17
18
|
}
|
|
@@ -58,4 +59,40 @@ export declare function findThreadByPhone(options: {
|
|
|
58
59
|
environment: string;
|
|
59
60
|
organizationId?: string;
|
|
60
61
|
}): Promise<ThreadPreview | null>;
|
|
62
|
+
export declare function replyToThread(options: {
|
|
63
|
+
threadId: string;
|
|
64
|
+
message: string;
|
|
65
|
+
environment: string;
|
|
66
|
+
}): Promise<{
|
|
67
|
+
success: boolean;
|
|
68
|
+
whatsappStatus: 'sent' | 'failed' | 'skipped';
|
|
69
|
+
}>;
|
|
70
|
+
export declare function pauseThread(options: {
|
|
71
|
+
threadId: string;
|
|
72
|
+
environment: string;
|
|
73
|
+
}): Promise<{
|
|
74
|
+
success: boolean;
|
|
75
|
+
paused: boolean;
|
|
76
|
+
}>;
|
|
77
|
+
export declare function resumeThread(options: {
|
|
78
|
+
threadId: string;
|
|
79
|
+
environment: string;
|
|
80
|
+
}): Promise<{
|
|
81
|
+
success: boolean;
|
|
82
|
+
paused: boolean;
|
|
83
|
+
}>;
|
|
84
|
+
export type ResolveResult = {
|
|
85
|
+
kind: 'ok';
|
|
86
|
+
thread: ThreadPreview;
|
|
87
|
+
} | {
|
|
88
|
+
kind: 'none';
|
|
89
|
+
} | {
|
|
90
|
+
kind: 'multiple';
|
|
91
|
+
candidates: ThreadPreview[];
|
|
92
|
+
};
|
|
93
|
+
export declare function resolveActiveWhatsAppThread(options: {
|
|
94
|
+
target: string;
|
|
95
|
+
environment: string;
|
|
96
|
+
organizationId?: string;
|
|
97
|
+
}): Promise<ResolveResult>;
|
|
61
98
|
//# sourceMappingURL=threads.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"threads.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/threads.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACvC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,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AE;IAC3C,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;CACpB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,cAAc,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAA;CAAE,CAAC,CA0C/E;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE;IACzC,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;CACpB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,CAyCjD;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE;IAC1C,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;CACpB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,CAyCjD;AAED,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,aAAa,EAAE,CAAA;CAAE,CAAA;AAErD,wBAAsB,2BAA2B,CAAC,OAAO,EAAE;IACzD,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,GAAG,OAAO,CAAC,aAAa,CAAC,CA4BzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/workflows.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/workflows.ts"],"names":[],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,CAAA;CAC7E;AA+CD,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAkD7E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JSONSchema, WorkflowConfig, WorkflowConnections, WorkflowNodeConfig } from '../types';
|
|
2
|
-
|
|
2
|
+
type ManyOutputToolName = 'entity.query' | 'event.query' | 'web.search' | 'calendar.list' | 'calendar.freeBusy' | 'airtable.listRecords' | 'whatsapp.listTemplates';
|
|
3
3
|
export type ManyTool = ManyOutputToolName;
|
|
4
4
|
export type OneTool = string & {
|
|
5
5
|
__notMany?: never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/define/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AACnG,
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/define/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AACnG,KAAK,kBAAkB,GACnB,cAAc,GACd,aAAa,GACb,YAAY,GACZ,eAAe,GACf,mBAAmB,GACnB,sBAAsB,GACtB,wBAAwB,CAAA;AAQ5B,MAAM,MAAM,QAAQ,GAAG,kBAAkB,CAAA;AACzC,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAAE,SAAS,CAAC,EAAE,KAAK,CAAA;CAAE,CAAA;AAEpD,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,eAAe,GAAG,gBAAgB,CAAA;AAE7E,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAA;IACzC,KAAK,CAAC,EAAE,MAAM,CAA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AAW,CAAC,EAAE,MAAM,CAAA;KAAE;IAatE,OAAO,CAAC,UAAU;IASlB,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS;IAevC,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS;IAUnC,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,SAAS;IASxC,KAAK,IAAI,cAAc;CAYxB;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,eAAe,CAEpG;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAgBrE"}
|
package/dist/index.js
CHANGED
|
@@ -331,29 +331,7 @@ function defineView(config) {
|
|
|
331
331
|
});
|
|
332
332
|
return config;
|
|
333
333
|
}
|
|
334
|
-
// src/workflow
|
|
335
|
-
var MANY_OUTPUT_TOOL_NAMES = [
|
|
336
|
-
"entity.query",
|
|
337
|
-
"event.query",
|
|
338
|
-
"web.search",
|
|
339
|
-
"calendar.list",
|
|
340
|
-
"calendar.freeBusy",
|
|
341
|
-
"airtable.listRecords",
|
|
342
|
-
"whatsapp.listTemplates"
|
|
343
|
-
];
|
|
344
|
-
var MANY_OUTPUT_TOOLS = new Set(MANY_OUTPUT_TOOL_NAMES);
|
|
345
|
-
var SIDE_EFFECTING_TOOLS = new Set([
|
|
346
|
-
"payment.create",
|
|
347
|
-
"payment.getStatus",
|
|
348
|
-
"whatsapp.send",
|
|
349
|
-
"whatsapp.sendTemplate",
|
|
350
|
-
"whatsapp.sendInteractive",
|
|
351
|
-
"whatsapp.sendMedia",
|
|
352
|
-
"email.send",
|
|
353
|
-
"entity.create",
|
|
354
|
-
"entity.update",
|
|
355
|
-
"entity.delete"
|
|
356
|
-
]);
|
|
334
|
+
// src/define/workflow.ts
|
|
357
335
|
function nodeKind(type) {
|
|
358
336
|
if (type.startsWith("trigger."))
|
|
359
337
|
return "trigger";
|
|
@@ -361,7 +339,6 @@ function nodeKind(type) {
|
|
|
361
339
|
return "flow";
|
|
362
340
|
return "action";
|
|
363
341
|
}
|
|
364
|
-
// src/define/workflow.ts
|
|
365
342
|
function nextId(state, type) {
|
|
366
343
|
state.idCounter.n += 1;
|
|
367
344
|
const short = type.replace(/[^a-z0-9]+/gi, "_");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "struere",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.3",
|
|
4
4
|
"description": "Build, test, and deploy AI agents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -39,17 +39,13 @@
|
|
|
39
39
|
"./client": {
|
|
40
40
|
"import": "./dist/client/index.js",
|
|
41
41
|
"types": "./dist/client/index.d.ts"
|
|
42
|
-
},
|
|
43
|
-
"./workflow-core": {
|
|
44
|
-
"import": "./dist/workflow-core/index.js",
|
|
45
|
-
"types": "./dist/workflow-core/index.d.ts"
|
|
46
42
|
}
|
|
47
43
|
},
|
|
48
44
|
"files": [
|
|
49
45
|
"dist"
|
|
50
46
|
],
|
|
51
47
|
"scripts": {
|
|
52
|
-
"build": "bun build ./src/cli/index.ts --outdir ./dist/cli --target node --external commander --external chalk --external ora --external chokidar --external yaml --external @inquirer/prompts --external jiti && bun build ./src/index.ts --outdir ./dist --target node && bun build ./src/client/index.ts --outdir ./dist/client --target browser && bun build ./src/
|
|
48
|
+
"build": "bun build ./src/cli/index.ts --outdir ./dist/cli --target node --external commander --external chalk --external ora --external chokidar --external yaml --external @inquirer/prompts --external jiti && bun build ./src/index.ts --outdir ./dist --target node && bun build ./src/client/index.ts --outdir ./dist/client --target browser && bun build ./src/bin/struere.ts --outdir ./dist/bin --target node --external commander --external chalk --external ora --external chokidar --external yaml --external @inquirer/prompts --external jiti && tsc --emitDeclarationOnly && chmod +x ./dist/bin/struere.js",
|
|
53
49
|
"dev": "tsc --watch",
|
|
54
50
|
"test": "bun test",
|
|
55
51
|
"prepublishOnly": "bun run build"
|
|
Binary file
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var __require = import.meta.require;
|
|
3
|
-
|
|
4
|
-
// ../../../private/tmp/test-cli-import.ts
|
|
5
|
-
try {
|
|
6
|
-
const m = await import("/Users/kueks/struere-dev-agents/mathland/tools/index.ts?update=999");
|
|
7
|
-
console.log("OK:", Object.keys(m));
|
|
8
|
-
} catch (e) {
|
|
9
|
-
console.log("ERROR:", e.message);
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAQnC,eAAO,MAAM,YAAY,SA+DrB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAKnC,eAAO,MAAM,YAAY,SAyDrB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAwCnC,eAAO,MAAM,WAAW,SAsGpB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC,eAAO,MAAM,eAAe,SA8DxB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA0BjE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,aAAa,CAAA;AAE7D,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,EAAE,CA+D1D"}
|
package/dist/define/config.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/define/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAkB/C,wBAAgB,YAAY,CAAC,MAAM,GAAE,OAAO,CAAC,eAAe,CAAM,GAAG,eAAe,CAcnF"}
|
|
Binary file
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export type NodeKind = "trigger" | "action" | "flow";
|
|
2
|
-
export type Cardinality = "one" | "many";
|
|
3
|
-
export interface OutputPort {
|
|
4
|
-
index: number;
|
|
5
|
-
name: string;
|
|
6
|
-
cardinality: Cardinality;
|
|
7
|
-
}
|
|
8
|
-
export interface CatalogNode {
|
|
9
|
-
type: string;
|
|
10
|
-
params?: Record<string, unknown>;
|
|
11
|
-
}
|
|
12
|
-
export declare const MANY_OUTPUT_TOOL_NAMES: readonly ["entity.query", "event.query", "web.search", "calendar.list", "calendar.freeBusy", "airtable.listRecords", "whatsapp.listTemplates"];
|
|
13
|
-
export type ManyOutputToolName = (typeof MANY_OUTPUT_TOOL_NAMES)[number];
|
|
14
|
-
export declare const MANY_OUTPUT_TOOLS: Set<string>;
|
|
15
|
-
export declare const SIDE_EFFECTING_TOOLS: Set<string>;
|
|
16
|
-
export declare const FOREACH_SOURCE_PORT = 2;
|
|
17
|
-
export declare function nodeKind(type: string): NodeKind;
|
|
18
|
-
export declare function toolName(type: string): string;
|
|
19
|
-
export declare function isManyOutput(toolName: string): boolean;
|
|
20
|
-
export declare function isSideEffecting(toolName: string): boolean;
|
|
21
|
-
export declare function outputPortsFor(node: CatalogNode): OutputPort[];
|
|
22
|
-
export declare function isManyPort(node: CatalogNode, outputPort: number): boolean;
|
|
23
|
-
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/workflow-core/catalog.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAA;AAEpD,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM,CAAA;AAExC,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACjC;AAED,eAAO,MAAM,sBAAsB,gJAQzB,CAAA;AAEV,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA;AAExE,eAAO,MAAM,iBAAiB,aAA0C,CAAA;AAExE,eAAO,MAAM,oBAAoB,aAW/B,CAAA;AAEF,eAAO,MAAM,mBAAmB,IAAI,CAAA;AAEpC,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAI/C;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAKzD;AAOD,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,EAAE,CAgD9D;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAMzE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["../../src/workflow-core/expression.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAWnD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAUlF"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { nodeKind, toolName, isManyOutput, isSideEffecting, isManyPort, outputPortsFor, MANY_OUTPUT_TOOLS, MANY_OUTPUT_TOOL_NAMES, SIDE_EFFECTING_TOOLS, FOREACH_SOURCE_PORT, } from "./catalog";
|
|
2
|
-
export type { NodeKind, Cardinality, OutputPort, CatalogNode, ManyOutputToolName, } from "./catalog";
|
|
3
|
-
export { RUN_STATUSES, NODE_STATUSES } from "./status";
|
|
4
|
-
export type { RunStatus, NodeStatus } from "./status";
|
|
5
|
-
export { tokenizePath, getNestedValue } from "./expression";
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workflow-core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,WAAW,CAAA;AAClB,YAAY,EACV,QAAQ,EACR,WAAW,EACX,UAAU,EACV,WAAW,EACX,kBAAkB,GACnB,MAAM,WAAW,CAAA;AAElB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACtD,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
// src/workflow-core/catalog.ts
|
|
2
|
-
var MANY_OUTPUT_TOOL_NAMES = [
|
|
3
|
-
"entity.query",
|
|
4
|
-
"event.query",
|
|
5
|
-
"web.search",
|
|
6
|
-
"calendar.list",
|
|
7
|
-
"calendar.freeBusy",
|
|
8
|
-
"airtable.listRecords",
|
|
9
|
-
"whatsapp.listTemplates"
|
|
10
|
-
];
|
|
11
|
-
var MANY_OUTPUT_TOOLS = new Set(MANY_OUTPUT_TOOL_NAMES);
|
|
12
|
-
var SIDE_EFFECTING_TOOLS = new Set([
|
|
13
|
-
"payment.create",
|
|
14
|
-
"payment.getStatus",
|
|
15
|
-
"whatsapp.send",
|
|
16
|
-
"whatsapp.sendTemplate",
|
|
17
|
-
"whatsapp.sendInteractive",
|
|
18
|
-
"whatsapp.sendMedia",
|
|
19
|
-
"email.send",
|
|
20
|
-
"entity.create",
|
|
21
|
-
"entity.update",
|
|
22
|
-
"entity.delete"
|
|
23
|
-
]);
|
|
24
|
-
var FOREACH_SOURCE_PORT = 2;
|
|
25
|
-
function nodeKind(type) {
|
|
26
|
-
if (type.startsWith("trigger."))
|
|
27
|
-
return "trigger";
|
|
28
|
-
if (type.startsWith("flow."))
|
|
29
|
-
return "flow";
|
|
30
|
-
return "action";
|
|
31
|
-
}
|
|
32
|
-
function toolName(type) {
|
|
33
|
-
return type.startsWith("tool.") ? type.slice("tool.".length) : type;
|
|
34
|
-
}
|
|
35
|
-
function isManyOutput(toolName2) {
|
|
36
|
-
return MANY_OUTPUT_TOOLS.has(toolName2);
|
|
37
|
-
}
|
|
38
|
-
function isSideEffecting(toolName2) {
|
|
39
|
-
if (SIDE_EFFECTING_TOOLS.has(toolName2))
|
|
40
|
-
return true;
|
|
41
|
-
if (toolName2.startsWith("payment."))
|
|
42
|
-
return true;
|
|
43
|
-
if (toolName2.startsWith("whatsapp."))
|
|
44
|
-
return true;
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
function formatCaseValue(value) {
|
|
48
|
-
if (typeof value === "string")
|
|
49
|
-
return value;
|
|
50
|
-
return JSON.stringify(value);
|
|
51
|
-
}
|
|
52
|
-
function outputPortsFor(node) {
|
|
53
|
-
const kind = nodeKind(node.type);
|
|
54
|
-
if (kind === "trigger") {
|
|
55
|
-
return [{ index: 0, name: "out", cardinality: "one" }];
|
|
56
|
-
}
|
|
57
|
-
if (kind === "action") {
|
|
58
|
-
const name = toolName(node.type);
|
|
59
|
-
return [{ index: 0, name: "out", cardinality: isManyOutput(name) ? "many" : "one" }];
|
|
60
|
-
}
|
|
61
|
-
switch (node.type) {
|
|
62
|
-
case "flow.if":
|
|
63
|
-
return [
|
|
64
|
-
{ index: 0, name: "true", cardinality: "one" },
|
|
65
|
-
{ index: 1, name: "false", cardinality: "one" }
|
|
66
|
-
];
|
|
67
|
-
case "flow.foreach":
|
|
68
|
-
return [
|
|
69
|
-
{ index: 0, name: "loop", cardinality: "one" },
|
|
70
|
-
{ index: 1, name: "done", cardinality: "many" }
|
|
71
|
-
];
|
|
72
|
-
case "flow.splitout":
|
|
73
|
-
return [{ index: 0, name: "out", cardinality: "many" }];
|
|
74
|
-
case "flow.aggregate":
|
|
75
|
-
return [{ index: 0, name: "out", cardinality: "one" }];
|
|
76
|
-
case "flow.switch": {
|
|
77
|
-
const cases = node.params?.cases ?? [];
|
|
78
|
-
const ports = cases.map((c, i) => ({
|
|
79
|
-
index: typeof c.output === "number" ? c.output : i,
|
|
80
|
-
name: `case ${formatCaseValue(c.value)}`,
|
|
81
|
-
cardinality: "one"
|
|
82
|
-
}));
|
|
83
|
-
const fallback = Number(node.params?.fallbackOutput ?? cases.length);
|
|
84
|
-
ports.push({ index: fallback, name: "default", cardinality: "one" });
|
|
85
|
-
const seen = new Set;
|
|
86
|
-
const deduped = [];
|
|
87
|
-
for (const p of ports.sort((a, b) => a.index - b.index)) {
|
|
88
|
-
if (seen.has(p.index))
|
|
89
|
-
continue;
|
|
90
|
-
seen.add(p.index);
|
|
91
|
-
deduped.push(p);
|
|
92
|
-
}
|
|
93
|
-
return deduped;
|
|
94
|
-
}
|
|
95
|
-
default:
|
|
96
|
-
return [{ index: 0, name: "out", cardinality: "one" }];
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function isManyPort(node, outputPort) {
|
|
100
|
-
const kind = nodeKind(node.type);
|
|
101
|
-
if (kind === "action")
|
|
102
|
-
return isManyOutput(toolName(node.type));
|
|
103
|
-
if (node.type === "flow.splitout")
|
|
104
|
-
return outputPort === 0;
|
|
105
|
-
if (node.type === "flow.foreach")
|
|
106
|
-
return outputPort === 1;
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
// src/workflow-core/status.ts
|
|
110
|
-
var RUN_STATUSES = [
|
|
111
|
-
"pending",
|
|
112
|
-
"running",
|
|
113
|
-
"completed",
|
|
114
|
-
"completed_with_errors",
|
|
115
|
-
"failed",
|
|
116
|
-
"dead"
|
|
117
|
-
];
|
|
118
|
-
var NODE_STATUSES = [
|
|
119
|
-
"running",
|
|
120
|
-
"success",
|
|
121
|
-
"error",
|
|
122
|
-
"dead",
|
|
123
|
-
"skipped"
|
|
124
|
-
];
|
|
125
|
-
// src/workflow-core/expression.ts
|
|
126
|
-
function tokenizePath(path) {
|
|
127
|
-
const tokens = [];
|
|
128
|
-
const pattern = /\[\s*"([^"]*)"\s*\]|\[\s*'([^']*)'\s*\]|\[\s*(\d+)\s*\]|([^.[\]]+)/g;
|
|
129
|
-
let match;
|
|
130
|
-
while ((match = pattern.exec(path)) !== null) {
|
|
131
|
-
if (match[1] !== undefined)
|
|
132
|
-
tokens.push(match[1]);
|
|
133
|
-
else if (match[2] !== undefined)
|
|
134
|
-
tokens.push(match[2]);
|
|
135
|
-
else if (match[3] !== undefined)
|
|
136
|
-
tokens.push(match[3]);
|
|
137
|
-
else if (match[4] !== undefined)
|
|
138
|
-
tokens.push(match[4]);
|
|
139
|
-
}
|
|
140
|
-
return tokens;
|
|
141
|
-
}
|
|
142
|
-
function getNestedValue(obj, path) {
|
|
143
|
-
const parts = tokenizePath(path);
|
|
144
|
-
let current = obj;
|
|
145
|
-
for (const part of parts) {
|
|
146
|
-
if (current === null || current === undefined || typeof current !== "object") {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
current = current[part];
|
|
150
|
-
}
|
|
151
|
-
return current;
|
|
152
|
-
}
|
|
153
|
-
export {
|
|
154
|
-
toolName,
|
|
155
|
-
tokenizePath,
|
|
156
|
-
outputPortsFor,
|
|
157
|
-
nodeKind,
|
|
158
|
-
isSideEffecting,
|
|
159
|
-
isManyPort,
|
|
160
|
-
isManyOutput,
|
|
161
|
-
getNestedValue,
|
|
162
|
-
SIDE_EFFECTING_TOOLS,
|
|
163
|
-
RUN_STATUSES,
|
|
164
|
-
NODE_STATUSES,
|
|
165
|
-
MANY_OUTPUT_TOOL_NAMES,
|
|
166
|
-
MANY_OUTPUT_TOOLS,
|
|
167
|
-
FOREACH_SOURCE_PORT
|
|
168
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const RUN_STATUSES: readonly ["pending", "running", "completed", "completed_with_errors", "failed", "dead"];
|
|
2
|
-
export type RunStatus = (typeof RUN_STATUSES)[number];
|
|
3
|
-
export declare const NODE_STATUSES: readonly ["running", "success", "error", "dead", "skipped"];
|
|
4
|
-
export type NodeStatus = (typeof NODE_STATUSES)[number];
|
|
5
|
-
//# sourceMappingURL=status.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/workflow-core/status.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,yFAOf,CAAA;AAEV,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAErD,eAAO,MAAM,aAAa,6DAMhB,CAAA;AAEV,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAA"}
|