@agent-commons/sdk 0.2.0 → 0.2.1

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/index.d.ts CHANGED
@@ -14,6 +14,8 @@ interface Agent {
14
14
  owner?: string;
15
15
  instructions?: string;
16
16
  persona?: string;
17
+ greeting?: string;
18
+ conversationStarters?: string[];
17
19
  avatar?: string;
18
20
  modelProvider: ModelProvider;
19
21
  modelId: string;
@@ -32,7 +34,12 @@ interface CreateAgentParams {
32
34
  name: string;
33
35
  instructions?: string;
34
36
  persona?: string;
37
+ greeting?: string;
38
+ conversationStarters?: string[];
35
39
  owner?: string;
40
+ ownerUserId?: string;
41
+ workspaceId?: string | null;
42
+ metadata?: Record<string, unknown>;
36
43
  modelProvider?: ModelProvider;
37
44
  modelId?: string;
38
45
  modelApiKey?: string;
@@ -102,11 +109,13 @@ interface Workflow {
102
109
  createdAt: string;
103
110
  }
104
111
  interface WorkflowDefinition {
112
+ startNodeId?: string;
113
+ endNodeId?: string;
105
114
  nodes: WorkflowNode[];
106
115
  edges: WorkflowEdge[];
107
116
  outputMapping?: Record<string, string>;
108
117
  }
109
- type WorkflowNodeType = 'tool' | 'input' | 'output' | 'condition' | 'transform' | 'loop' | 'agent_processor' | 'human_approval';
118
+ type WorkflowNodeType = 'tool' | 'input' | 'output' | 'condition' | 'transform' | 'loop' | 'agent_processor' | 'workflow' | 'human_approval';
110
119
  interface WorkflowNode {
111
120
  id: string;
112
121
  type: WorkflowNodeType | string;
@@ -198,10 +207,32 @@ interface CreateToolParams {
198
207
  displayName?: string;
199
208
  description?: string;
200
209
  schema: any;
210
+ apiSpec?: {
211
+ baseUrl: string;
212
+ path: string;
213
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | string;
214
+ headers?: Record<string, string>;
215
+ queryParams?: Record<string, string>;
216
+ bodyTemplate?: any;
217
+ authType?: 'none' | 'bearer' | 'api-key' | 'basic' | 'oauth2' | string;
218
+ authKeyName?: string;
219
+ oauthProviderKey?: string;
220
+ oauthScopes?: string[];
221
+ oauthTokenLocation?: 'header' | 'query' | 'body';
222
+ oauthTokenKey?: string;
223
+ oauthTokenPrefix?: string;
224
+ };
225
+ category?: string;
226
+ icon?: string;
227
+ inputSchema?: any;
228
+ outputSchema?: any;
201
229
  owner?: string;
202
230
  ownerType?: 'user' | 'agent';
203
231
  visibility?: 'private' | 'public' | 'platform';
204
232
  tags?: string[];
233
+ version?: string;
234
+ rateLimitPerMinute?: number;
235
+ rateLimitPerHour?: number;
205
236
  }
206
237
  interface ToolKey {
207
238
  keyId: string;
@@ -348,7 +379,8 @@ interface McpPrompt {
348
379
  }>;
349
380
  }
350
381
  interface CommonsClientConfig {
351
- baseUrl: string;
382
+ /** Defaults to the unified Commons API platform. */
383
+ baseUrl?: string;
352
384
  apiKey?: string;
353
385
  initiator?: string;
354
386
  /** Fetch implementation — defaults to global fetch */
@@ -469,6 +501,58 @@ interface UsageAggregation {
469
501
  callCount: number;
470
502
  events: UsageEvent[];
471
503
  }
504
+ type CreditDirection = 'grant' | 'debit' | 'adjustment' | 'refund' | 'expiration';
505
+ type CreditPlatform = 'agent_commons' | 'commonlab' | 'common_os' | 'system';
506
+ interface CreditLedgerEntry {
507
+ entryId: string;
508
+ principalId: string;
509
+ principalType: 'user' | 'agent' | 'service';
510
+ workspaceId?: string | null;
511
+ amount: number;
512
+ currency: 'credits';
513
+ direction: CreditDirection;
514
+ eventType: string;
515
+ sourcePlatform: CreditPlatform;
516
+ idempotencyKey: string;
517
+ description?: string | null;
518
+ relatedCourseId?: string | null;
519
+ relatedChallengeId?: string | null;
520
+ agentId?: string | null;
521
+ sessionId?: string | null;
522
+ taskId?: string | null;
523
+ workflowId?: string | null;
524
+ usageEventId?: string | null;
525
+ metadata?: Record<string, unknown>;
526
+ createdBy?: string | null;
527
+ createdByType?: string | null;
528
+ expiresAt?: string | null;
529
+ voidedAt?: string | null;
530
+ createdAt: string;
531
+ }
532
+ interface CreditBalance {
533
+ principalId: string;
534
+ workspaceId?: string | null;
535
+ balance: number;
536
+ currency: 'credits';
537
+ }
538
+ interface CreditWriteParams {
539
+ principalId: string;
540
+ principalType?: 'user' | 'agent' | 'service';
541
+ workspaceId?: string | null;
542
+ amount: number;
543
+ eventType: string;
544
+ sourcePlatform: CreditPlatform;
545
+ idempotencyKey: string;
546
+ description?: string;
547
+ relatedCourseId?: string;
548
+ relatedChallengeId?: string;
549
+ agentId?: string;
550
+ sessionId?: string;
551
+ taskId?: string;
552
+ workflowId?: string;
553
+ usageEventId?: string;
554
+ metadata?: Record<string, unknown>;
555
+ }
472
556
  type WalletType = 'eoa' | 'erc4337' | 'external';
473
557
  interface AgentWallet {
474
558
  id: string;
@@ -1038,6 +1122,27 @@ declare class CommonsClient {
1038
1122
  data: UsageAggregation;
1039
1123
  }>;
1040
1124
  };
1125
+ get credits(): {
1126
+ balance: (filter?: {
1127
+ principalId?: string;
1128
+ workspaceId?: string;
1129
+ }) => Promise<{
1130
+ data: CreditBalance;
1131
+ }>;
1132
+ ledger: (filter?: {
1133
+ principalId?: string;
1134
+ workspaceId?: string;
1135
+ limit?: number;
1136
+ }) => Promise<{
1137
+ data: CreditLedgerEntry[];
1138
+ }>;
1139
+ grant: (params: CreditWriteParams) => Promise<{
1140
+ data: CreditLedgerEntry;
1141
+ }>;
1142
+ debit: (params: CreditWriteParams) => Promise<{
1143
+ data: CreditLedgerEntry;
1144
+ }>;
1145
+ };
1041
1146
  }
1042
1147
  declare class CommonsError extends Error {
1043
1148
  readonly status: number;
@@ -1045,4 +1150,40 @@ declare class CommonsError extends Error {
1045
1150
  constructor(message: string, status: number, data?: unknown | undefined);
1046
1151
  }
1047
1152
 
1048
- export { type A2AArtifact, type A2ADataPart, type A2AFilePart, type A2AMessage, type A2AMessagePart, type A2ASendTaskParams, type A2ASkill, type A2ATask, type A2ATaskState, type A2ATextPart, type Agent, type AgentCard, type AgentMemory, type AgentWallet, type ApiKey, type ApiKeyPrincipalType, type ChatMessage, CommonsClient, type CommonsClientConfig, CommonsError, type CreateAgentParams, type CreateApiKeyParams, type CreateMemoryParams, type CreateSkillParams, type CreateTaskParams, type CreateToolKeyParams, type CreateToolParams, type CreateWalletParams, type CreatedApiKey, type McpConnectionType, type McpPrompt, type McpResource, type McpServer, type MemorySourceType, type MemoryStats, type MemoryType, type ModelConfig, type ModelProvider, type RunParams, type Session, type Skill, type SkillIndex, type StreamEvent, type StreamEventType, type Task, type Tool, type ToolKey, type ToolPermission, type UpdateMemoryParams, type UsageAggregation, type UsageEvent, type WalletBalance, type WalletType, type Workflow, type WorkflowDefinition, type WorkflowEdge, type WorkflowExecution, type WorkflowNode, type WorkflowNodeType };
1153
+ type WorkflowTemplateName = 'country-weather-brief' | 'agent-research-summary' | 'multi-agent-field-report' | 'workflow-invocation-smoke';
1154
+ interface WorkflowTemplateContext {
1155
+ ownerId: string;
1156
+ prefix: string;
1157
+ agentId?: string;
1158
+ reviewerAgentId?: string;
1159
+ childWorkflowId?: string;
1160
+ }
1161
+ interface WorkflowTemplateTool {
1162
+ key: string;
1163
+ payload: CreateToolParams;
1164
+ }
1165
+ interface WorkflowTemplateBuild {
1166
+ name: string;
1167
+ description: string;
1168
+ tags: string[];
1169
+ category: string;
1170
+ tools: WorkflowTemplateTool[];
1171
+ buildDefinition: (toolIds: Record<string, string>, ctx: WorkflowTemplateContext) => WorkflowDefinition;
1172
+ sampleInput: Record<string, any>;
1173
+ }
1174
+ declare function listWorkflowTemplates(): readonly [{
1175
+ readonly name: "country-weather-brief";
1176
+ readonly description: "Tool-only workflow using countries.dev and Open-Meteo.";
1177
+ }, {
1178
+ readonly name: "agent-research-summary";
1179
+ readonly description: "Multi-tool workflow with an agent_processor summarization step.";
1180
+ }, {
1181
+ readonly name: "multi-agent-field-report";
1182
+ readonly description: "Multi-tool workflow with two agent_processor nodes.";
1183
+ }, {
1184
+ readonly name: "workflow-invocation-smoke";
1185
+ readonly description: "Parent workflow that invokes another workflow as a workflow node.";
1186
+ }];
1187
+ declare function buildWorkflowTemplate(templateName: WorkflowTemplateName, ctx: WorkflowTemplateContext): WorkflowTemplateBuild;
1188
+
1189
+ export { type A2AArtifact, type A2ADataPart, type A2AFilePart, type A2AMessage, type A2AMessagePart, type A2ASendTaskParams, type A2ASkill, type A2ATask, type A2ATaskState, type A2ATextPart, type Agent, type AgentCard, type AgentMemory, type AgentWallet, type ApiKey, type ApiKeyPrincipalType, type ChatMessage, CommonsClient, type CommonsClientConfig, CommonsError, type CreateAgentParams, type CreateApiKeyParams, type CreateMemoryParams, type CreateSkillParams, type CreateTaskParams, type CreateToolKeyParams, type CreateToolParams, type CreateWalletParams, type CreatedApiKey, type McpConnectionType, type McpPrompt, type McpResource, type McpServer, type MemorySourceType, type MemoryStats, type MemoryType, type ModelConfig, type ModelProvider, type RunParams, type Session, type Skill, type SkillIndex, type StreamEvent, type StreamEventType, type Task, type Tool, type ToolKey, type ToolPermission, type UpdateMemoryParams, type UsageAggregation, type UsageEvent, type WalletBalance, type WalletType, type Workflow, type WorkflowDefinition, type WorkflowEdge, type WorkflowExecution, type WorkflowNode, type WorkflowNodeType, type WorkflowTemplateBuild, type WorkflowTemplateContext, type WorkflowTemplateName, type WorkflowTemplateTool, buildWorkflowTemplate, listWorkflowTemplates };
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/client.ts
2
2
  var CommonsClient = class {
3
3
  constructor(config) {
4
- this.baseUrl = config.baseUrl.replace(/\/$/, "");
4
+ this.baseUrl = (config.baseUrl ?? "https://api.agentcommons.io").replace(/\/$/, "");
5
5
  this.apiKey = config.apiKey;
6
6
  this.initiator = config.initiator;
7
7
  this._fetch = config.fetch ?? fetch;
@@ -430,6 +430,28 @@ var CommonsClient = class {
430
430
  getSessionUsage: (sessionId) => this.request("GET", `/v1/usage/sessions/${sessionId}`)
431
431
  };
432
432
  }
433
+ // ── Credits ──────────────────────────────────────────────────────────────
434
+ get credits() {
435
+ return {
436
+ balance: (filter) => {
437
+ const params = new URLSearchParams();
438
+ if (filter?.principalId) params.set("principalId", filter.principalId);
439
+ if (filter?.workspaceId) params.set("workspaceId", filter.workspaceId);
440
+ const qs = params.toString();
441
+ return this.request("GET", `/v1/credits/balance${qs ? `?${qs}` : ""}`);
442
+ },
443
+ ledger: (filter) => {
444
+ const params = new URLSearchParams();
445
+ if (filter?.principalId) params.set("principalId", filter.principalId);
446
+ if (filter?.workspaceId) params.set("workspaceId", filter.workspaceId);
447
+ if (filter?.limit) params.set("limit", String(filter.limit));
448
+ const qs = params.toString();
449
+ return this.request("GET", `/v1/credits/ledger${qs ? `?${qs}` : ""}`);
450
+ },
451
+ grant: (params) => this.request("POST", "/v1/credits/grants", params),
452
+ debit: (params) => this.request("POST", "/v1/credits/debits", params)
453
+ };
454
+ }
433
455
  };
434
456
  var CommonsError = class extends Error {
435
457
  constructor(message, status, data) {
@@ -439,8 +461,349 @@ var CommonsError = class extends Error {
439
461
  this.name = "CommonsError";
440
462
  }
441
463
  };
464
+
465
+ // src/workflow-templates.ts
466
+ function toolName(prefix, name) {
467
+ return `${prefix}_${name}`.replace(/[^a-zA-Z0-9_]/g, "_");
468
+ }
469
+ function functionTool(params) {
470
+ return {
471
+ name: params.name,
472
+ displayName: params.displayName,
473
+ description: params.description,
474
+ visibility: "private",
475
+ ownerType: "user",
476
+ category: "public-api",
477
+ tags: params.tags,
478
+ schema: {
479
+ type: "function",
480
+ function: {
481
+ name: params.name,
482
+ description: params.description,
483
+ parameters: {
484
+ type: "object",
485
+ properties: params.properties,
486
+ required: params.required ?? []
487
+ }
488
+ }
489
+ },
490
+ apiSpec: params.apiSpec
491
+ };
492
+ }
493
+ function listWorkflowTemplates() {
494
+ return [
495
+ {
496
+ name: "country-weather-brief",
497
+ description: "Tool-only workflow using countries.dev and Open-Meteo."
498
+ },
499
+ {
500
+ name: "agent-research-summary",
501
+ description: "Multi-tool workflow with an agent_processor summarization step."
502
+ },
503
+ {
504
+ name: "multi-agent-field-report",
505
+ description: "Multi-tool workflow with two agent_processor nodes."
506
+ },
507
+ {
508
+ name: "workflow-invocation-smoke",
509
+ description: "Parent workflow that invokes another workflow as a workflow node."
510
+ }
511
+ ];
512
+ }
513
+ function buildWorkflowTemplate(templateName, ctx) {
514
+ switch (templateName) {
515
+ case "country-weather-brief":
516
+ return countryWeatherBrief(ctx);
517
+ case "agent-research-summary":
518
+ return agentResearchSummary(ctx);
519
+ case "multi-agent-field-report":
520
+ return multiAgentFieldReport(ctx);
521
+ case "workflow-invocation-smoke":
522
+ return workflowInvocationSmoke(ctx);
523
+ }
524
+ }
525
+ function sharedTools(ctx) {
526
+ const countryLookup = functionTool({
527
+ name: toolName(ctx.prefix, "country_lookup"),
528
+ displayName: "countries.dev country search",
529
+ description: "Look up country metadata by country name using countries.dev.",
530
+ tags: ["template", "countries-dev", "public-api"],
531
+ properties: {
532
+ country: {
533
+ type: "string",
534
+ description: 'Country name, for example "Finland" or "Kenya".'
535
+ }
536
+ },
537
+ required: ["country"],
538
+ apiSpec: {
539
+ method: "GET",
540
+ baseUrl: "https://countries.dev",
541
+ path: "/name/{country}",
542
+ authType: "none"
543
+ }
544
+ });
545
+ const weatherForecast = functionTool({
546
+ name: toolName(ctx.prefix, "open_meteo_weather"),
547
+ displayName: "Open-Meteo current weather",
548
+ description: "Get current weather for latitude and longitude using Open-Meteo.",
549
+ tags: ["template", "open-meteo", "public-api", "weather"],
550
+ properties: {
551
+ latitude: { type: "number", description: "Latitude in decimal degrees." },
552
+ longitude: { type: "number", description: "Longitude in decimal degrees." }
553
+ },
554
+ required: ["latitude", "longitude"],
555
+ apiSpec: {
556
+ method: "GET",
557
+ baseUrl: "https://api.open-meteo.com",
558
+ path: "/v1/forecast",
559
+ queryParams: {
560
+ latitude: "{latitude}",
561
+ longitude: "{longitude}",
562
+ current: "temperature_2m,relative_humidity_2m,wind_speed_10m",
563
+ timezone: "auto"
564
+ },
565
+ authType: "none"
566
+ }
567
+ });
568
+ const openLibrarySearch = functionTool({
569
+ name: toolName(ctx.prefix, "open_library_search"),
570
+ displayName: "Open Library search",
571
+ description: "Search books and authors using Open Library.",
572
+ tags: ["template", "open-library", "public-api", "books"],
573
+ properties: {
574
+ query: { type: "string", description: "Book, author, or topic search query." },
575
+ limit: { type: "number", description: "Maximum result count." }
576
+ },
577
+ required: ["query"],
578
+ apiSpec: {
579
+ method: "GET",
580
+ baseUrl: "https://openlibrary.org",
581
+ path: "/search.json",
582
+ queryParams: {
583
+ q: "{query}",
584
+ limit: "{limit}",
585
+ fields: "key,title,author_name,first_publish_year"
586
+ },
587
+ authType: "none"
588
+ }
589
+ });
590
+ const exchangeRate = functionTool({
591
+ name: toolName(ctx.prefix, "frankfurter_exchange_rate"),
592
+ displayName: "Frankfurter exchange rate",
593
+ description: "Get a current exchange rate from USD to another currency using Frankfurter.",
594
+ tags: ["template", "frankfurter", "public-api", "exchange-rate"],
595
+ properties: {
596
+ to: { type: "string", description: 'Target ISO 4217 currency code, for example "JPY".' }
597
+ },
598
+ required: ["to"],
599
+ apiSpec: {
600
+ method: "GET",
601
+ baseUrl: "https://api.frankfurter.dev",
602
+ path: "/v2/rates",
603
+ queryParams: {
604
+ base: "USD",
605
+ quotes: "{to}"
606
+ },
607
+ authType: "none"
608
+ }
609
+ });
610
+ return { countryLookup, weatherForecast, openLibrarySearch, exchangeRate };
611
+ }
612
+ function countryWeatherDefinition(toolIds) {
613
+ return {
614
+ nodes: [
615
+ { id: "input", type: "input", position: { x: 0, y: 80 } },
616
+ { id: "country", type: "tool", toolId: toolIds.countryLookup, position: { x: 240, y: 20 } },
617
+ { id: "weather", type: "tool", toolId: toolIds.weatherForecast, position: { x: 520, y: 20 } },
618
+ { id: "output", type: "output", position: { x: 820, y: 80 } }
619
+ ],
620
+ edges: [
621
+ {
622
+ id: "input-country",
623
+ source: "input",
624
+ target: "country",
625
+ mapping: { country: "country" }
626
+ },
627
+ {
628
+ id: "country-weather",
629
+ source: "country",
630
+ target: "weather",
631
+ mapping: {
632
+ "0.latlng.0": "latitude",
633
+ "0.latlng.1": "longitude"
634
+ }
635
+ },
636
+ {
637
+ id: "country-output",
638
+ source: "country",
639
+ target: "output",
640
+ mapping: {
641
+ "0.name": "country",
642
+ "0.capital": "capital",
643
+ "0.region": "region",
644
+ "0.population": "population"
645
+ }
646
+ },
647
+ {
648
+ id: "weather-output",
649
+ source: "weather",
650
+ target: "output",
651
+ mapping: {
652
+ "current.temperature_2m": "temperatureC",
653
+ "current.relative_humidity_2m": "humidityPercent",
654
+ "current.wind_speed_10m": "windSpeedKph",
655
+ timezone: "timezone"
656
+ }
657
+ }
658
+ ],
659
+ startNodeId: "input",
660
+ endNodeId: "output"
661
+ };
662
+ }
663
+ function countryWeatherBrief(ctx) {
664
+ const tools = sharedTools(ctx);
665
+ return {
666
+ name: `${ctx.prefix} Country Weather Brief`,
667
+ description: "Tool-only workflow: country metadata plus current Open-Meteo weather.",
668
+ category: "template",
669
+ tags: ["template", "tool-workflow", "public-api"],
670
+ tools: [
671
+ { key: "countryLookup", payload: tools.countryLookup },
672
+ { key: "weatherForecast", payload: tools.weatherForecast }
673
+ ],
674
+ buildDefinition: (toolIds) => countryWeatherDefinition(toolIds),
675
+ sampleInput: { country: "Finland" }
676
+ };
677
+ }
678
+ function agentResearchSummary(ctx) {
679
+ const tools = sharedTools(ctx);
680
+ return {
681
+ name: `${ctx.prefix} Agent Research Summary`,
682
+ description: "Multi-tool workflow with an agent_processor that summarizes country and book-search data.",
683
+ category: "template",
684
+ tags: ["template", "agent-processor", "public-api"],
685
+ tools: [
686
+ { key: "countryLookup", payload: tools.countryLookup },
687
+ { key: "openLibrarySearch", payload: tools.openLibrarySearch }
688
+ ],
689
+ buildDefinition: (toolIds, buildCtx) => ({
690
+ nodes: [
691
+ { id: "input", type: "input", position: { x: 0, y: 100 } },
692
+ { id: "country", type: "tool", toolId: toolIds.countryLookup, position: { x: 240, y: 20 } },
693
+ { id: "books", type: "tool", toolId: toolIds.openLibrarySearch, position: { x: 240, y: 180 } },
694
+ {
695
+ id: "analyst",
696
+ type: "agent_processor",
697
+ position: { x: 560, y: 100 },
698
+ config: {
699
+ agentId: buildCtx.agentId,
700
+ prompt: "Create a concise research note from the country metadata and book search results. Include practical context and cite only the data available in the input."
701
+ }
702
+ },
703
+ { id: "output", type: "output", position: { x: 860, y: 100 } }
704
+ ],
705
+ edges: [
706
+ { id: "input-country", source: "input", target: "country", mapping: { country: "country" } },
707
+ { id: "input-books", source: "input", target: "books", mapping: { query: "query", limit: "limit" } },
708
+ { id: "country-analyst", source: "country", target: "analyst", mapping: { "0": "countryData" } },
709
+ { id: "books-analyst", source: "books", target: "analyst", mapping: { docs: "books" } },
710
+ { id: "analyst-output", source: "analyst", target: "output", mapping: { result: "summary" } }
711
+ ],
712
+ startNodeId: "input",
713
+ endNodeId: "output"
714
+ }),
715
+ sampleInput: { country: "Kenya", query: "Kenyan history", limit: 5 }
716
+ };
717
+ }
718
+ function multiAgentFieldReport(ctx) {
719
+ const tools = sharedTools(ctx);
720
+ return {
721
+ name: `${ctx.prefix} Multi-Agent Field Report`,
722
+ description: "Multi-agent, multi-tool workflow with a researcher agent and reviewer agent.",
723
+ category: "template",
724
+ tags: ["template", "multi-agent", "multi-tool", "public-api"],
725
+ tools: [
726
+ { key: "countryLookup", payload: tools.countryLookup },
727
+ { key: "weatherForecast", payload: tools.weatherForecast },
728
+ { key: "exchangeRate", payload: tools.exchangeRate }
729
+ ],
730
+ buildDefinition: (toolIds, buildCtx) => ({
731
+ nodes: [
732
+ { id: "input", type: "input", position: { x: 0, y: 120 } },
733
+ { id: "country", type: "tool", toolId: toolIds.countryLookup, position: { x: 230, y: 20 } },
734
+ { id: "weather", type: "tool", toolId: toolIds.weatherForecast, position: { x: 500, y: 20 } },
735
+ { id: "exchange-rate", type: "tool", toolId: toolIds.exchangeRate, position: { x: 230, y: 240 } },
736
+ {
737
+ id: "researcher",
738
+ type: "agent_processor",
739
+ position: { x: 760, y: 80 },
740
+ config: {
741
+ agentId: buildCtx.agentId,
742
+ prompt: "Draft a compact field report from the country, weather, and exchange-rate data. Use clear sections and do not invent facts."
743
+ }
744
+ },
745
+ {
746
+ id: "reviewer",
747
+ type: "agent_processor",
748
+ position: { x: 1060, y: 80 },
749
+ config: {
750
+ agentId: buildCtx.reviewerAgentId ?? buildCtx.agentId,
751
+ prompt: "Review the draft field report for clarity, unsupported claims, and operational usefulness. Return the improved final report."
752
+ }
753
+ },
754
+ { id: "output", type: "output", position: { x: 1360, y: 120 } }
755
+ ],
756
+ edges: [
757
+ { id: "input-country", source: "input", target: "country", mapping: { country: "country" } },
758
+ { id: "country-weather", source: "country", target: "weather", mapping: { "0.latlng.0": "latitude", "0.latlng.1": "longitude" } },
759
+ { id: "country-exchange-rate", source: "country", target: "exchange-rate", mapping: { "0.currencies.0.code": "to" } },
760
+ { id: "country-researcher", source: "country", target: "researcher", mapping: { "0": "countryData" } },
761
+ { id: "weather-researcher", source: "weather", target: "researcher", mapping: { current: "weather" } },
762
+ { id: "exchange-rate-researcher", source: "exchange-rate", target: "researcher", mapping: { "0": "exchangeRate" } },
763
+ { id: "researcher-reviewer", source: "researcher", target: "reviewer", mapping: { result: "draftReport" } },
764
+ { id: "reviewer-output", source: "reviewer", target: "output", mapping: { result: "finalReport" } }
765
+ ],
766
+ startNodeId: "input",
767
+ endNodeId: "output"
768
+ }),
769
+ sampleInput: { country: "Japan" }
770
+ };
771
+ }
772
+ function workflowInvocationSmoke(ctx) {
773
+ return {
774
+ name: `${ctx.prefix} Workflow Invocation Smoke`,
775
+ description: "Parent workflow template that expects a child workflowId and invokes it as a workflow node.",
776
+ category: "template",
777
+ tags: ["template", "workflow-invocation"],
778
+ tools: [],
779
+ buildDefinition: (_toolIds, buildCtx) => ({
780
+ nodes: [
781
+ { id: "input", type: "input", position: { x: 0, y: 80 } },
782
+ {
783
+ id: "child-workflow",
784
+ type: "workflow",
785
+ position: { x: 280, y: 80 },
786
+ config: {
787
+ workflowId: buildCtx.childWorkflowId,
788
+ timeoutMs: 9e4
789
+ }
790
+ },
791
+ { id: "output", type: "output", position: { x: 620, y: 80 } }
792
+ ],
793
+ edges: [
794
+ { id: "input-child", source: "input", target: "child-workflow" },
795
+ { id: "child-output", source: "child-workflow", target: "output", mapping: { result: "childResult", executionId: "childExecutionId" } }
796
+ ],
797
+ startNodeId: "input",
798
+ endNodeId: "output"
799
+ }),
800
+ sampleInput: { country: "Finland" }
801
+ };
802
+ }
442
803
  export {
443
804
  CommonsClient,
444
- CommonsError
805
+ CommonsError,
806
+ buildWorkflowTemplate,
807
+ listWorkflowTemplates
445
808
  };
446
809
  //# sourceMappingURL=index.mjs.map