struere 0.4.6 → 0.4.7
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 +172 -38
- package/dist/cli/index.js +172 -38
- package/dist/cli/templates/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/bin/struere.js
CHANGED
|
@@ -19821,6 +19821,9 @@ export default defineEntityType({
|
|
|
19821
19821
|
required: ["name"],
|
|
19822
19822
|
},
|
|
19823
19823
|
searchFields: ["name", "email"],
|
|
19824
|
+
displayConfig: {
|
|
19825
|
+
listFields: ["name", "email", "status"],
|
|
19826
|
+
},
|
|
19824
19827
|
})
|
|
19825
19828
|
`;
|
|
19826
19829
|
}
|
|
@@ -19849,13 +19852,13 @@ export default defineAgent({
|
|
|
19849
19852
|
description: "${displayName} Agent",
|
|
19850
19853
|
model: {
|
|
19851
19854
|
provider: "anthropic",
|
|
19852
|
-
name: "claude-
|
|
19855
|
+
name: "claude-haiku-4-5",
|
|
19853
19856
|
temperature: 0.7,
|
|
19854
19857
|
maxTokens: 4096,
|
|
19855
19858
|
},
|
|
19856
|
-
systemPrompt: \`You are
|
|
19859
|
+
systemPrompt: \`You are {{agentName}}, an AI assistant for {{organizationName}}.
|
|
19857
19860
|
|
|
19858
|
-
Current time: {{
|
|
19861
|
+
Current time: {{currentTime}}
|
|
19859
19862
|
|
|
19860
19863
|
Your capabilities:
|
|
19861
19864
|
- Answer questions accurately and helpfully
|
|
@@ -20075,19 +20078,15 @@ export default defineAgent({
|
|
|
20075
20078
|
version: "0.1.0",
|
|
20076
20079
|
model: {
|
|
20077
20080
|
provider: "anthropic", // or "openai", "google"
|
|
20078
|
-
name: "claude-
|
|
20081
|
+
name: "claude-haiku-4-5", // Best cost/intelligence ratio
|
|
20079
20082
|
temperature: 0.7,
|
|
20080
20083
|
maxTokens: 4096,
|
|
20081
20084
|
},
|
|
20082
|
-
systemPrompt: \\\`You are a support agent for {{organizationName}}.
|
|
20085
|
+
systemPrompt: \\\`You are {{agentName}}, a support agent for {{organizationName}}.
|
|
20083
20086
|
Current time: {{currentTime}}
|
|
20084
20087
|
|
|
20085
|
-
|
|
20086
|
-
{{
|
|
20087
|
-
- {{this.name}}: {{this.description}}
|
|
20088
|
-
{{/each}}
|
|
20089
|
-
|
|
20090
|
-
Use entity.query to look up customer info before responding.\\\`,
|
|
20088
|
+
Use entity.query to look up customer info before responding.
|
|
20089
|
+
Available entity types: {{entityTypes}}\\\`,
|
|
20091
20090
|
tools: [
|
|
20092
20091
|
"entity.query",
|
|
20093
20092
|
"entity.get",
|
|
@@ -20098,15 +20097,45 @@ Use entity.query to look up customer info before responding.\\\`,
|
|
|
20098
20097
|
})
|
|
20099
20098
|
\`\`\`
|
|
20100
20099
|
|
|
20101
|
-
###
|
|
20100
|
+
### Model Selection Guide
|
|
20101
|
+
|
|
20102
|
+
| Model | Cost (Input/Output) | Best For |
|
|
20103
|
+
|-------|---------------------|----------|
|
|
20104
|
+
| \`claude-haiku-4-5\` | $1/$5 per MTok | **Default** - Best cost/intelligence ratio |
|
|
20105
|
+
| \`claude-sonnet-4\` | $3/$15 per MTok | Complex reasoning, nuanced tasks |
|
|
20106
|
+
| \`claude-opus-4-5\` | $5/$25 per MTok | Most capable, research-grade tasks |
|
|
20107
|
+
|
|
20108
|
+
Start with Haiku 4.5 for most agents. Upgrade to Sonnet only if you need better reasoning.
|
|
20109
|
+
|
|
20110
|
+
### System Prompt Template Variables
|
|
20111
|
+
|
|
20112
|
+
The template engine supports \`{{variable}}\` syntax for simple variable resolution and \`{{function(args)}}\` syntax for function calls.
|
|
20113
|
+
|
|
20114
|
+
**Available Variables:**
|
|
20102
20115
|
|
|
20103
|
-
| Variable |
|
|
20104
|
-
|
|
20105
|
-
| \`{{currentTime}}\` | ISO 8601 timestamp |
|
|
20106
|
-
| \`{{
|
|
20107
|
-
| \`{{
|
|
20108
|
-
| \`{{
|
|
20109
|
-
| \`{{
|
|
20116
|
+
| Variable | Type | Description |
|
|
20117
|
+
|----------|------|-------------|
|
|
20118
|
+
| \`{{currentTime}}\` | string | ISO 8601 timestamp |
|
|
20119
|
+
| \`{{datetime}}\` | string | ISO 8601 timestamp (alias) |
|
|
20120
|
+
| \`{{timestamp}}\` | number | Unix timestamp in milliseconds |
|
|
20121
|
+
| \`{{organizationName}}\` | string | Your organization name |
|
|
20122
|
+
| \`{{organizationId}}\` | string | Organization ID |
|
|
20123
|
+
| \`{{agentName}}\` | string | This agent's display name |
|
|
20124
|
+
| \`{{agent.name}}\` | string | Agent name |
|
|
20125
|
+
| \`{{agent.slug}}\` | string | Agent slug |
|
|
20126
|
+
| \`{{message}}\` | string | Current user message |
|
|
20127
|
+
| \`{{thread.metadata.X}}\` | any | Thread metadata field X |
|
|
20128
|
+
| \`{{entityTypes}}\` | array | JSON array of all entity types |
|
|
20129
|
+
| \`{{roles}}\` | array | JSON array of all roles |
|
|
20130
|
+
|
|
20131
|
+
**Function Calls (embedded queries):**
|
|
20132
|
+
|
|
20133
|
+
\`\`\`
|
|
20134
|
+
{{entity.query({"type": "customer", "limit": 5})}}
|
|
20135
|
+
{{entity.get({"id": "ent_123"})}}
|
|
20136
|
+
\`\`\`
|
|
20137
|
+
|
|
20138
|
+
**Note:** Handlebars block helpers (\`{{#each}}\`, \`{{#if}}\`) are NOT supported. Use function calls instead.
|
|
20110
20139
|
|
|
20111
20140
|
## Defining Entity Types
|
|
20112
20141
|
|
|
@@ -20362,7 +20391,7 @@ export default defineAgent({
|
|
|
20362
20391
|
|
|
20363
20392
|
When a customer asks about an order, use entity.query to find it first.
|
|
20364
20393
|
Always be polite and helpful. If you can't help, offer to escalate.\\\`,
|
|
20365
|
-
model: { provider: "anthropic", name: "claude-
|
|
20394
|
+
model: { provider: "anthropic", name: "claude-haiku-4-5" },
|
|
20366
20395
|
tools: ["entity.query", "entity.get", "entity.update", "event.emit"],
|
|
20367
20396
|
})
|
|
20368
20397
|
\`\`\`
|
|
@@ -20378,7 +20407,7 @@ export default defineAgent({
|
|
|
20378
20407
|
|
|
20379
20408
|
Check teacher availability before booking. Create session entities for confirmed bookings.
|
|
20380
20409
|
Send confirmation via the send_notification custom tool.\\\`,
|
|
20381
|
-
model: { provider: "anthropic", name: "claude-
|
|
20410
|
+
model: { provider: "anthropic", name: "claude-haiku-4-5" },
|
|
20382
20411
|
tools: ["entity.create", "entity.query", "job.enqueue", "send_notification"],
|
|
20383
20412
|
})
|
|
20384
20413
|
\`\`\`
|
|
@@ -20394,7 +20423,7 @@ export default defineAgent({
|
|
|
20394
20423
|
|
|
20395
20424
|
When creating entities, validate the data matches the schema.
|
|
20396
20425
|
Always confirm what was created/updated.\\\`,
|
|
20397
|
-
model: { provider: "anthropic", name: "claude-
|
|
20426
|
+
model: { provider: "anthropic", name: "claude-haiku-4-5" },
|
|
20398
20427
|
tools: ["entity.create", "entity.update", "entity.query"],
|
|
20399
20428
|
})
|
|
20400
20429
|
\`\`\`
|
|
@@ -20744,7 +20773,7 @@ async function loadCustomTools(dir) {
|
|
|
20744
20773
|
return [];
|
|
20745
20774
|
}
|
|
20746
20775
|
try {
|
|
20747
|
-
const module = await import(indexPath);
|
|
20776
|
+
const module = await import(`${indexPath}?update=${Date.now()}`);
|
|
20748
20777
|
if (Array.isArray(module.default)) {
|
|
20749
20778
|
return module.default;
|
|
20750
20779
|
}
|
|
@@ -20758,7 +20787,7 @@ async function loadCustomTools(dir) {
|
|
|
20758
20787
|
}
|
|
20759
20788
|
async function loadFromIndex(indexPath) {
|
|
20760
20789
|
try {
|
|
20761
|
-
const module = await import(indexPath);
|
|
20790
|
+
const module = await import(`${indexPath}?update=${Date.now()}`);
|
|
20762
20791
|
if (Array.isArray(module.default)) {
|
|
20763
20792
|
return module.default;
|
|
20764
20793
|
}
|
|
@@ -20782,7 +20811,7 @@ async function loadFromDirectory(dir) {
|
|
|
20782
20811
|
for (const file of files) {
|
|
20783
20812
|
const filePath = join4(dir, file);
|
|
20784
20813
|
try {
|
|
20785
|
-
const module = await import(filePath);
|
|
20814
|
+
const module = await import(`${filePath}?update=${Date.now()}`);
|
|
20786
20815
|
if (module.default) {
|
|
20787
20816
|
items.push(module.default);
|
|
20788
20817
|
}
|
|
@@ -20869,7 +20898,7 @@ function extractAgentPayload(agent, customToolsMap) {
|
|
|
20869
20898
|
return {
|
|
20870
20899
|
name: toolName,
|
|
20871
20900
|
description: getBuiltinToolDescription(toolName),
|
|
20872
|
-
parameters:
|
|
20901
|
+
parameters: getBuiltinToolParameters(toolName),
|
|
20873
20902
|
isBuiltin: true
|
|
20874
20903
|
};
|
|
20875
20904
|
}
|
|
@@ -20902,20 +20931,125 @@ function extractAgentPayload(agent, customToolsMap) {
|
|
|
20902
20931
|
}
|
|
20903
20932
|
function getBuiltinToolDescription(name) {
|
|
20904
20933
|
const descriptions = {
|
|
20905
|
-
"entity.create": "Create a new entity",
|
|
20906
|
-
"entity.get": "Get an entity by ID",
|
|
20907
|
-
"entity.query": "Query entities by type
|
|
20908
|
-
"entity.update": "Update an entity",
|
|
20909
|
-
"entity.delete": "Delete an entity",
|
|
20910
|
-
"entity.link": "
|
|
20911
|
-
"entity.unlink": "
|
|
20912
|
-
"event.emit": "Emit
|
|
20913
|
-
"event.query": "Query events",
|
|
20914
|
-
"job.enqueue": "Schedule a background job",
|
|
20915
|
-
"job.status": "Get
|
|
20934
|
+
"entity.create": "Create a new entity of a specified type",
|
|
20935
|
+
"entity.get": "Get an entity by its ID",
|
|
20936
|
+
"entity.query": "Query entities by type with optional filters",
|
|
20937
|
+
"entity.update": "Update an existing entity by ID",
|
|
20938
|
+
"entity.delete": "Delete an entity by ID",
|
|
20939
|
+
"entity.link": "Create a relation between two entities",
|
|
20940
|
+
"entity.unlink": "Remove a relation between two entities",
|
|
20941
|
+
"event.emit": "Emit a custom event for audit logging",
|
|
20942
|
+
"event.query": "Query historical events with optional filters",
|
|
20943
|
+
"job.enqueue": "Schedule a background job to run later",
|
|
20944
|
+
"job.status": "Get the status of a scheduled job"
|
|
20916
20945
|
};
|
|
20917
20946
|
return descriptions[name] || name;
|
|
20918
20947
|
}
|
|
20948
|
+
function getBuiltinToolParameters(name) {
|
|
20949
|
+
const schemas = {
|
|
20950
|
+
"entity.create": {
|
|
20951
|
+
type: "object",
|
|
20952
|
+
properties: {
|
|
20953
|
+
type: { type: "string", description: 'The entity type slug (e.g., "customer", "order")' },
|
|
20954
|
+
data: { type: "object", description: "The entity data matching the entity type schema" },
|
|
20955
|
+
status: { type: "string", description: 'Optional status (defaults to "active")' }
|
|
20956
|
+
},
|
|
20957
|
+
required: ["type", "data"]
|
|
20958
|
+
},
|
|
20959
|
+
"entity.get": {
|
|
20960
|
+
type: "object",
|
|
20961
|
+
properties: {
|
|
20962
|
+
id: { type: "string", description: "The entity ID to retrieve" }
|
|
20963
|
+
},
|
|
20964
|
+
required: ["id"]
|
|
20965
|
+
},
|
|
20966
|
+
"entity.query": {
|
|
20967
|
+
type: "object",
|
|
20968
|
+
properties: {
|
|
20969
|
+
type: { type: "string", description: 'The entity type slug to query (e.g., "customer", "order")' },
|
|
20970
|
+
filters: { type: "object", description: 'Optional filters to apply (e.g., {"data.status": "active"})' },
|
|
20971
|
+
status: { type: "string", description: "Filter by entity status" },
|
|
20972
|
+
limit: { type: "number", description: "Maximum number of results (default 100)" }
|
|
20973
|
+
},
|
|
20974
|
+
required: ["type"]
|
|
20975
|
+
},
|
|
20976
|
+
"entity.update": {
|
|
20977
|
+
type: "object",
|
|
20978
|
+
properties: {
|
|
20979
|
+
id: { type: "string", description: "The entity ID to update" },
|
|
20980
|
+
data: { type: "object", description: "The fields to update (merged with existing data)" },
|
|
20981
|
+
status: { type: "string", description: "Optional new status" }
|
|
20982
|
+
},
|
|
20983
|
+
required: ["id", "data"]
|
|
20984
|
+
},
|
|
20985
|
+
"entity.delete": {
|
|
20986
|
+
type: "object",
|
|
20987
|
+
properties: {
|
|
20988
|
+
id: { type: "string", description: "The entity ID to delete" }
|
|
20989
|
+
},
|
|
20990
|
+
required: ["id"]
|
|
20991
|
+
},
|
|
20992
|
+
"entity.link": {
|
|
20993
|
+
type: "object",
|
|
20994
|
+
properties: {
|
|
20995
|
+
fromId: { type: "string", description: "Source entity ID" },
|
|
20996
|
+
toId: { type: "string", description: "Target entity ID" },
|
|
20997
|
+
relationType: { type: "string", description: 'Type of relation (e.g., "assigned_to", "belongs_to")' },
|
|
20998
|
+
metadata: { type: "object", description: "Optional metadata for the relation" }
|
|
20999
|
+
},
|
|
21000
|
+
required: ["fromId", "toId", "relationType"]
|
|
21001
|
+
},
|
|
21002
|
+
"entity.unlink": {
|
|
21003
|
+
type: "object",
|
|
21004
|
+
properties: {
|
|
21005
|
+
fromId: { type: "string", description: "Source entity ID" },
|
|
21006
|
+
toId: { type: "string", description: "Target entity ID" },
|
|
21007
|
+
relationType: { type: "string", description: "Type of relation to remove" }
|
|
21008
|
+
},
|
|
21009
|
+
required: ["fromId", "toId", "relationType"]
|
|
21010
|
+
},
|
|
21011
|
+
"event.emit": {
|
|
21012
|
+
type: "object",
|
|
21013
|
+
properties: {
|
|
21014
|
+
eventType: { type: "string", description: 'Event type (e.g., "order.placed", "user.signup")' },
|
|
21015
|
+
entityId: { type: "string", description: "Optional entity ID this event relates to" },
|
|
21016
|
+
entityTypeSlug: { type: "string", description: "Optional entity type slug" },
|
|
21017
|
+
payload: { type: "object", description: "Optional event payload data" }
|
|
21018
|
+
},
|
|
21019
|
+
required: ["eventType"]
|
|
21020
|
+
},
|
|
21021
|
+
"event.query": {
|
|
21022
|
+
type: "object",
|
|
21023
|
+
properties: {
|
|
21024
|
+
eventType: { type: "string", description: "Filter by event type" },
|
|
21025
|
+
entityId: { type: "string", description: "Filter by entity ID" },
|
|
21026
|
+
since: { type: "number", description: "Unix timestamp to filter events after" },
|
|
21027
|
+
limit: { type: "number", description: "Maximum number of results" }
|
|
21028
|
+
}
|
|
21029
|
+
},
|
|
21030
|
+
"job.enqueue": {
|
|
21031
|
+
type: "object",
|
|
21032
|
+
properties: {
|
|
21033
|
+
jobType: { type: "string", description: "The type of job to schedule" },
|
|
21034
|
+
payload: { type: "object", description: "Job payload data" },
|
|
21035
|
+
scheduledFor: { type: "number", description: "Unix timestamp when job should run (optional, runs immediately if omitted)" },
|
|
21036
|
+
priority: { type: "number", description: "Job priority (higher runs first)" },
|
|
21037
|
+
maxAttempts: { type: "number", description: "Maximum retry attempts" },
|
|
21038
|
+
idempotencyKey: { type: "string", description: "Unique key to prevent duplicate jobs" },
|
|
21039
|
+
entityId: { type: "string", description: "Optional entity ID this job relates to" }
|
|
21040
|
+
},
|
|
21041
|
+
required: ["jobType"]
|
|
21042
|
+
},
|
|
21043
|
+
"job.status": {
|
|
21044
|
+
type: "object",
|
|
21045
|
+
properties: {
|
|
21046
|
+
id: { type: "string", description: "The job ID to check" }
|
|
21047
|
+
},
|
|
21048
|
+
required: ["id"]
|
|
21049
|
+
}
|
|
21050
|
+
};
|
|
21051
|
+
return schemas[name] || { type: "object", properties: {} };
|
|
21052
|
+
}
|
|
20919
21053
|
function extractHandlerCode(handler) {
|
|
20920
21054
|
const code = handler.toString();
|
|
20921
21055
|
const arrowMatch = code.match(/(?:async\s*)?\([^)]*\)\s*=>\s*\{?([\s\S]*)\}?$/);
|
|
@@ -22209,7 +22343,7 @@ var statusCommand = new Command("status").description("Compare local vs remote s
|
|
|
22209
22343
|
// package.json
|
|
22210
22344
|
var package_default = {
|
|
22211
22345
|
name: "struere",
|
|
22212
|
-
version: "0.4.
|
|
22346
|
+
version: "0.4.7",
|
|
22213
22347
|
description: "Build, test, and deploy AI agents",
|
|
22214
22348
|
keywords: [
|
|
22215
22349
|
"ai",
|
package/dist/cli/index.js
CHANGED
|
@@ -614,6 +614,9 @@ export default defineEntityType({
|
|
|
614
614
|
required: ["name"],
|
|
615
615
|
},
|
|
616
616
|
searchFields: ["name", "email"],
|
|
617
|
+
displayConfig: {
|
|
618
|
+
listFields: ["name", "email", "status"],
|
|
619
|
+
},
|
|
617
620
|
})
|
|
618
621
|
`;
|
|
619
622
|
}
|
|
@@ -642,13 +645,13 @@ export default defineAgent({
|
|
|
642
645
|
description: "${displayName} Agent",
|
|
643
646
|
model: {
|
|
644
647
|
provider: "anthropic",
|
|
645
|
-
name: "claude-
|
|
648
|
+
name: "claude-haiku-4-5",
|
|
646
649
|
temperature: 0.7,
|
|
647
650
|
maxTokens: 4096,
|
|
648
651
|
},
|
|
649
|
-
systemPrompt: \`You are
|
|
652
|
+
systemPrompt: \`You are {{agentName}}, an AI assistant for {{organizationName}}.
|
|
650
653
|
|
|
651
|
-
Current time: {{
|
|
654
|
+
Current time: {{currentTime}}
|
|
652
655
|
|
|
653
656
|
Your capabilities:
|
|
654
657
|
- Answer questions accurately and helpfully
|
|
@@ -868,19 +871,15 @@ export default defineAgent({
|
|
|
868
871
|
version: "0.1.0",
|
|
869
872
|
model: {
|
|
870
873
|
provider: "anthropic", // or "openai", "google"
|
|
871
|
-
name: "claude-
|
|
874
|
+
name: "claude-haiku-4-5", // Best cost/intelligence ratio
|
|
872
875
|
temperature: 0.7,
|
|
873
876
|
maxTokens: 4096,
|
|
874
877
|
},
|
|
875
|
-
systemPrompt: \\\`You are a support agent for {{organizationName}}.
|
|
878
|
+
systemPrompt: \\\`You are {{agentName}}, a support agent for {{organizationName}}.
|
|
876
879
|
Current time: {{currentTime}}
|
|
877
880
|
|
|
878
|
-
|
|
879
|
-
{{
|
|
880
|
-
- {{this.name}}: {{this.description}}
|
|
881
|
-
{{/each}}
|
|
882
|
-
|
|
883
|
-
Use entity.query to look up customer info before responding.\\\`,
|
|
881
|
+
Use entity.query to look up customer info before responding.
|
|
882
|
+
Available entity types: {{entityTypes}}\\\`,
|
|
884
883
|
tools: [
|
|
885
884
|
"entity.query",
|
|
886
885
|
"entity.get",
|
|
@@ -891,15 +890,45 @@ Use entity.query to look up customer info before responding.\\\`,
|
|
|
891
890
|
})
|
|
892
891
|
\`\`\`
|
|
893
892
|
|
|
894
|
-
###
|
|
893
|
+
### Model Selection Guide
|
|
894
|
+
|
|
895
|
+
| Model | Cost (Input/Output) | Best For |
|
|
896
|
+
|-------|---------------------|----------|
|
|
897
|
+
| \`claude-haiku-4-5\` | $1/$5 per MTok | **Default** - Best cost/intelligence ratio |
|
|
898
|
+
| \`claude-sonnet-4\` | $3/$15 per MTok | Complex reasoning, nuanced tasks |
|
|
899
|
+
| \`claude-opus-4-5\` | $5/$25 per MTok | Most capable, research-grade tasks |
|
|
900
|
+
|
|
901
|
+
Start with Haiku 4.5 for most agents. Upgrade to Sonnet only if you need better reasoning.
|
|
902
|
+
|
|
903
|
+
### System Prompt Template Variables
|
|
904
|
+
|
|
905
|
+
The template engine supports \`{{variable}}\` syntax for simple variable resolution and \`{{function(args)}}\` syntax for function calls.
|
|
906
|
+
|
|
907
|
+
**Available Variables:**
|
|
895
908
|
|
|
896
|
-
| Variable |
|
|
897
|
-
|
|
898
|
-
| \`{{currentTime}}\` | ISO 8601 timestamp |
|
|
899
|
-
| \`{{
|
|
900
|
-
| \`{{
|
|
901
|
-
| \`{{
|
|
902
|
-
| \`{{
|
|
909
|
+
| Variable | Type | Description |
|
|
910
|
+
|----------|------|-------------|
|
|
911
|
+
| \`{{currentTime}}\` | string | ISO 8601 timestamp |
|
|
912
|
+
| \`{{datetime}}\` | string | ISO 8601 timestamp (alias) |
|
|
913
|
+
| \`{{timestamp}}\` | number | Unix timestamp in milliseconds |
|
|
914
|
+
| \`{{organizationName}}\` | string | Your organization name |
|
|
915
|
+
| \`{{organizationId}}\` | string | Organization ID |
|
|
916
|
+
| \`{{agentName}}\` | string | This agent's display name |
|
|
917
|
+
| \`{{agent.name}}\` | string | Agent name |
|
|
918
|
+
| \`{{agent.slug}}\` | string | Agent slug |
|
|
919
|
+
| \`{{message}}\` | string | Current user message |
|
|
920
|
+
| \`{{thread.metadata.X}}\` | any | Thread metadata field X |
|
|
921
|
+
| \`{{entityTypes}}\` | array | JSON array of all entity types |
|
|
922
|
+
| \`{{roles}}\` | array | JSON array of all roles |
|
|
923
|
+
|
|
924
|
+
**Function Calls (embedded queries):**
|
|
925
|
+
|
|
926
|
+
\`\`\`
|
|
927
|
+
{{entity.query({"type": "customer", "limit": 5})}}
|
|
928
|
+
{{entity.get({"id": "ent_123"})}}
|
|
929
|
+
\`\`\`
|
|
930
|
+
|
|
931
|
+
**Note:** Handlebars block helpers (\`{{#each}}\`, \`{{#if}}\`) are NOT supported. Use function calls instead.
|
|
903
932
|
|
|
904
933
|
## Defining Entity Types
|
|
905
934
|
|
|
@@ -1155,7 +1184,7 @@ export default defineAgent({
|
|
|
1155
1184
|
|
|
1156
1185
|
When a customer asks about an order, use entity.query to find it first.
|
|
1157
1186
|
Always be polite and helpful. If you can't help, offer to escalate.\\\`,
|
|
1158
|
-
model: { provider: "anthropic", name: "claude-
|
|
1187
|
+
model: { provider: "anthropic", name: "claude-haiku-4-5" },
|
|
1159
1188
|
tools: ["entity.query", "entity.get", "entity.update", "event.emit"],
|
|
1160
1189
|
})
|
|
1161
1190
|
\`\`\`
|
|
@@ -1171,7 +1200,7 @@ export default defineAgent({
|
|
|
1171
1200
|
|
|
1172
1201
|
Check teacher availability before booking. Create session entities for confirmed bookings.
|
|
1173
1202
|
Send confirmation via the send_notification custom tool.\\\`,
|
|
1174
|
-
model: { provider: "anthropic", name: "claude-
|
|
1203
|
+
model: { provider: "anthropic", name: "claude-haiku-4-5" },
|
|
1175
1204
|
tools: ["entity.create", "entity.query", "job.enqueue", "send_notification"],
|
|
1176
1205
|
})
|
|
1177
1206
|
\`\`\`
|
|
@@ -1187,7 +1216,7 @@ export default defineAgent({
|
|
|
1187
1216
|
|
|
1188
1217
|
When creating entities, validate the data matches the schema.
|
|
1189
1218
|
Always confirm what was created/updated.\\\`,
|
|
1190
|
-
model: { provider: "anthropic", name: "claude-
|
|
1219
|
+
model: { provider: "anthropic", name: "claude-haiku-4-5" },
|
|
1191
1220
|
tools: ["entity.create", "entity.update", "entity.query"],
|
|
1192
1221
|
})
|
|
1193
1222
|
\`\`\`
|
|
@@ -1540,7 +1569,7 @@ async function loadCustomTools(dir) {
|
|
|
1540
1569
|
return [];
|
|
1541
1570
|
}
|
|
1542
1571
|
try {
|
|
1543
|
-
const module = await import(indexPath);
|
|
1572
|
+
const module = await import(`${indexPath}?update=${Date.now()}`);
|
|
1544
1573
|
if (Array.isArray(module.default)) {
|
|
1545
1574
|
return module.default;
|
|
1546
1575
|
}
|
|
@@ -1554,7 +1583,7 @@ async function loadCustomTools(dir) {
|
|
|
1554
1583
|
}
|
|
1555
1584
|
async function loadFromIndex(indexPath) {
|
|
1556
1585
|
try {
|
|
1557
|
-
const module = await import(indexPath);
|
|
1586
|
+
const module = await import(`${indexPath}?update=${Date.now()}`);
|
|
1558
1587
|
if (Array.isArray(module.default)) {
|
|
1559
1588
|
return module.default;
|
|
1560
1589
|
}
|
|
@@ -1578,7 +1607,7 @@ async function loadFromDirectory(dir) {
|
|
|
1578
1607
|
for (const file of files) {
|
|
1579
1608
|
const filePath = join4(dir, file);
|
|
1580
1609
|
try {
|
|
1581
|
-
const module = await import(filePath);
|
|
1610
|
+
const module = await import(`${filePath}?update=${Date.now()}`);
|
|
1582
1611
|
if (module.default) {
|
|
1583
1612
|
items.push(module.default);
|
|
1584
1613
|
}
|
|
@@ -1665,7 +1694,7 @@ function extractAgentPayload(agent, customToolsMap) {
|
|
|
1665
1694
|
return {
|
|
1666
1695
|
name: toolName,
|
|
1667
1696
|
description: getBuiltinToolDescription(toolName),
|
|
1668
|
-
parameters:
|
|
1697
|
+
parameters: getBuiltinToolParameters(toolName),
|
|
1669
1698
|
isBuiltin: true
|
|
1670
1699
|
};
|
|
1671
1700
|
}
|
|
@@ -1698,20 +1727,125 @@ function extractAgentPayload(agent, customToolsMap) {
|
|
|
1698
1727
|
}
|
|
1699
1728
|
function getBuiltinToolDescription(name) {
|
|
1700
1729
|
const descriptions = {
|
|
1701
|
-
"entity.create": "Create a new entity",
|
|
1702
|
-
"entity.get": "Get an entity by ID",
|
|
1703
|
-
"entity.query": "Query entities by type
|
|
1704
|
-
"entity.update": "Update an entity",
|
|
1705
|
-
"entity.delete": "Delete an entity",
|
|
1706
|
-
"entity.link": "
|
|
1707
|
-
"entity.unlink": "
|
|
1708
|
-
"event.emit": "Emit
|
|
1709
|
-
"event.query": "Query events",
|
|
1710
|
-
"job.enqueue": "Schedule a background job",
|
|
1711
|
-
"job.status": "Get
|
|
1730
|
+
"entity.create": "Create a new entity of a specified type",
|
|
1731
|
+
"entity.get": "Get an entity by its ID",
|
|
1732
|
+
"entity.query": "Query entities by type with optional filters",
|
|
1733
|
+
"entity.update": "Update an existing entity by ID",
|
|
1734
|
+
"entity.delete": "Delete an entity by ID",
|
|
1735
|
+
"entity.link": "Create a relation between two entities",
|
|
1736
|
+
"entity.unlink": "Remove a relation between two entities",
|
|
1737
|
+
"event.emit": "Emit a custom event for audit logging",
|
|
1738
|
+
"event.query": "Query historical events with optional filters",
|
|
1739
|
+
"job.enqueue": "Schedule a background job to run later",
|
|
1740
|
+
"job.status": "Get the status of a scheduled job"
|
|
1712
1741
|
};
|
|
1713
1742
|
return descriptions[name] || name;
|
|
1714
1743
|
}
|
|
1744
|
+
function getBuiltinToolParameters(name) {
|
|
1745
|
+
const schemas = {
|
|
1746
|
+
"entity.create": {
|
|
1747
|
+
type: "object",
|
|
1748
|
+
properties: {
|
|
1749
|
+
type: { type: "string", description: 'The entity type slug (e.g., "customer", "order")' },
|
|
1750
|
+
data: { type: "object", description: "The entity data matching the entity type schema" },
|
|
1751
|
+
status: { type: "string", description: 'Optional status (defaults to "active")' }
|
|
1752
|
+
},
|
|
1753
|
+
required: ["type", "data"]
|
|
1754
|
+
},
|
|
1755
|
+
"entity.get": {
|
|
1756
|
+
type: "object",
|
|
1757
|
+
properties: {
|
|
1758
|
+
id: { type: "string", description: "The entity ID to retrieve" }
|
|
1759
|
+
},
|
|
1760
|
+
required: ["id"]
|
|
1761
|
+
},
|
|
1762
|
+
"entity.query": {
|
|
1763
|
+
type: "object",
|
|
1764
|
+
properties: {
|
|
1765
|
+
type: { type: "string", description: 'The entity type slug to query (e.g., "customer", "order")' },
|
|
1766
|
+
filters: { type: "object", description: 'Optional filters to apply (e.g., {"data.status": "active"})' },
|
|
1767
|
+
status: { type: "string", description: "Filter by entity status" },
|
|
1768
|
+
limit: { type: "number", description: "Maximum number of results (default 100)" }
|
|
1769
|
+
},
|
|
1770
|
+
required: ["type"]
|
|
1771
|
+
},
|
|
1772
|
+
"entity.update": {
|
|
1773
|
+
type: "object",
|
|
1774
|
+
properties: {
|
|
1775
|
+
id: { type: "string", description: "The entity ID to update" },
|
|
1776
|
+
data: { type: "object", description: "The fields to update (merged with existing data)" },
|
|
1777
|
+
status: { type: "string", description: "Optional new status" }
|
|
1778
|
+
},
|
|
1779
|
+
required: ["id", "data"]
|
|
1780
|
+
},
|
|
1781
|
+
"entity.delete": {
|
|
1782
|
+
type: "object",
|
|
1783
|
+
properties: {
|
|
1784
|
+
id: { type: "string", description: "The entity ID to delete" }
|
|
1785
|
+
},
|
|
1786
|
+
required: ["id"]
|
|
1787
|
+
},
|
|
1788
|
+
"entity.link": {
|
|
1789
|
+
type: "object",
|
|
1790
|
+
properties: {
|
|
1791
|
+
fromId: { type: "string", description: "Source entity ID" },
|
|
1792
|
+
toId: { type: "string", description: "Target entity ID" },
|
|
1793
|
+
relationType: { type: "string", description: 'Type of relation (e.g., "assigned_to", "belongs_to")' },
|
|
1794
|
+
metadata: { type: "object", description: "Optional metadata for the relation" }
|
|
1795
|
+
},
|
|
1796
|
+
required: ["fromId", "toId", "relationType"]
|
|
1797
|
+
},
|
|
1798
|
+
"entity.unlink": {
|
|
1799
|
+
type: "object",
|
|
1800
|
+
properties: {
|
|
1801
|
+
fromId: { type: "string", description: "Source entity ID" },
|
|
1802
|
+
toId: { type: "string", description: "Target entity ID" },
|
|
1803
|
+
relationType: { type: "string", description: "Type of relation to remove" }
|
|
1804
|
+
},
|
|
1805
|
+
required: ["fromId", "toId", "relationType"]
|
|
1806
|
+
},
|
|
1807
|
+
"event.emit": {
|
|
1808
|
+
type: "object",
|
|
1809
|
+
properties: {
|
|
1810
|
+
eventType: { type: "string", description: 'Event type (e.g., "order.placed", "user.signup")' },
|
|
1811
|
+
entityId: { type: "string", description: "Optional entity ID this event relates to" },
|
|
1812
|
+
entityTypeSlug: { type: "string", description: "Optional entity type slug" },
|
|
1813
|
+
payload: { type: "object", description: "Optional event payload data" }
|
|
1814
|
+
},
|
|
1815
|
+
required: ["eventType"]
|
|
1816
|
+
},
|
|
1817
|
+
"event.query": {
|
|
1818
|
+
type: "object",
|
|
1819
|
+
properties: {
|
|
1820
|
+
eventType: { type: "string", description: "Filter by event type" },
|
|
1821
|
+
entityId: { type: "string", description: "Filter by entity ID" },
|
|
1822
|
+
since: { type: "number", description: "Unix timestamp to filter events after" },
|
|
1823
|
+
limit: { type: "number", description: "Maximum number of results" }
|
|
1824
|
+
}
|
|
1825
|
+
},
|
|
1826
|
+
"job.enqueue": {
|
|
1827
|
+
type: "object",
|
|
1828
|
+
properties: {
|
|
1829
|
+
jobType: { type: "string", description: "The type of job to schedule" },
|
|
1830
|
+
payload: { type: "object", description: "Job payload data" },
|
|
1831
|
+
scheduledFor: { type: "number", description: "Unix timestamp when job should run (optional, runs immediately if omitted)" },
|
|
1832
|
+
priority: { type: "number", description: "Job priority (higher runs first)" },
|
|
1833
|
+
maxAttempts: { type: "number", description: "Maximum retry attempts" },
|
|
1834
|
+
idempotencyKey: { type: "string", description: "Unique key to prevent duplicate jobs" },
|
|
1835
|
+
entityId: { type: "string", description: "Optional entity ID this job relates to" }
|
|
1836
|
+
},
|
|
1837
|
+
required: ["jobType"]
|
|
1838
|
+
},
|
|
1839
|
+
"job.status": {
|
|
1840
|
+
type: "object",
|
|
1841
|
+
properties: {
|
|
1842
|
+
id: { type: "string", description: "The job ID to check" }
|
|
1843
|
+
},
|
|
1844
|
+
required: ["id"]
|
|
1845
|
+
}
|
|
1846
|
+
};
|
|
1847
|
+
return schemas[name] || { type: "object", properties: {} };
|
|
1848
|
+
}
|
|
1715
1849
|
function extractHandlerCode(handler) {
|
|
1716
1850
|
const code = handler.toString();
|
|
1717
1851
|
const arrowMatch = code.match(/(?:async\s*)?\([^)]*\)\s*=>\s*\{?([\s\S]*)\}?$/);
|
|
@@ -3033,7 +3167,7 @@ var statusCommand = new Command13("status").description("Compare local vs remote
|
|
|
3033
3167
|
// package.json
|
|
3034
3168
|
var package_default = {
|
|
3035
3169
|
name: "struere",
|
|
3036
|
-
version: "0.4.
|
|
3170
|
+
version: "0.4.7",
|
|
3037
3171
|
description: "Build, test, and deploy AI agents",
|
|
3038
3172
|
keywords: [
|
|
3039
3173
|
"ai",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/templates/index.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAuBnD;AAED,wBAAgB,WAAW,IAAI,MAAM,CAsBpC;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAgBzC;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgC/C;AAED,wBAAgB,UAAU,IAAI,MAAM,CAoDnC;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAmBzC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAatC;AAED,wBAAgB,YAAY,IAAI,MAAM,CAgBrC;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAahG;AAED,wBAAgB,WAAW,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/templates/index.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAuBnD;AAED,wBAAgB,WAAW,IAAI,MAAM,CAsBpC;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAgBzC;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgC/C;AAED,wBAAgB,UAAU,IAAI,MAAM,CAoDnC;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAmBzC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAatC;AAED,wBAAgB,YAAY,IAAI,MAAM,CAgBrC;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAahG;AAED,wBAAgB,WAAW,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CA0BlE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAa9C;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAgC/D;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,cAAc,GAAG,OAAO,GAAG,MAAM,CAI5E;AAED,wBAAgB,eAAe,IAAI,MAAM,CAsExC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAaxF;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAuBrD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAocrD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA4ShD"}
|