@deepintel-ltd/farmpro-contracts 1.3.1 → 1.3.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.
Files changed (43) hide show
  1. package/dist/index.d.ts +5 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +7 -1
  4. package/dist/routes/admin.routes.d.ts +747 -0
  5. package/dist/routes/admin.routes.d.ts.map +1 -0
  6. package/dist/routes/admin.routes.js +26 -0
  7. package/dist/routes/agent-workflows.routes.d.ts +2900 -0
  8. package/dist/routes/agent-workflows.routes.d.ts.map +1 -0
  9. package/dist/routes/agent-workflows.routes.js +160 -0
  10. package/dist/routes/field-monitoring.routes.d.ts +568 -23
  11. package/dist/routes/field-monitoring.routes.d.ts.map +1 -1
  12. package/dist/routes/field-monitoring.routes.js +64 -0
  13. package/dist/routes/field-observations.routes.d.ts +130 -58
  14. package/dist/routes/field-observations.routes.d.ts.map +1 -1
  15. package/dist/routes/index.d.ts +6 -0
  16. package/dist/routes/index.d.ts.map +1 -1
  17. package/dist/routes/index.js +4 -0
  18. package/dist/routes/tasks.routes.d.ts +408 -0
  19. package/dist/routes/tasks.routes.d.ts.map +1 -1
  20. package/dist/routes/weather.routes.d.ts +264 -17
  21. package/dist/routes/weather.routes.d.ts.map +1 -1
  22. package/dist/schemas/admin.schemas.d.ts +1063 -0
  23. package/dist/schemas/admin.schemas.d.ts.map +1 -0
  24. package/dist/schemas/admin.schemas.js +63 -0
  25. package/dist/schemas/agent-workflows.schemas.d.ts +2399 -0
  26. package/dist/schemas/agent-workflows.schemas.d.ts.map +1 -0
  27. package/dist/schemas/agent-workflows.schemas.js +70 -0
  28. package/dist/schemas/field-monitoring.schemas.d.ts +215 -9
  29. package/dist/schemas/field-monitoring.schemas.d.ts.map +1 -1
  30. package/dist/schemas/field-monitoring.schemas.js +26 -2
  31. package/dist/schemas/field-observations.schemas.d.ts +100 -40
  32. package/dist/schemas/field-observations.schemas.d.ts.map +1 -1
  33. package/dist/schemas/field-observations.schemas.js +2 -24
  34. package/dist/schemas/recommendations.schemas.d.ts +112 -0
  35. package/dist/schemas/recommendations.schemas.d.ts.map +1 -0
  36. package/dist/schemas/recommendations.schemas.js +32 -0
  37. package/dist/schemas/tasks.schemas.d.ts +344 -0
  38. package/dist/schemas/tasks.schemas.d.ts.map +1 -1
  39. package/dist/schemas/tasks.schemas.js +9 -0
  40. package/dist/schemas/weather.schemas.d.ts +780 -44
  41. package/dist/schemas/weather.schemas.d.ts.map +1 -1
  42. package/dist/schemas/weather.schemas.js +2 -1
  43. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-workflows.routes.d.ts","sourceRoot":"","sources":["../../src/routes/agent-workflows.routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+J/B,CAAC"}
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.agentWorkflowsRouter = void 0;
4
+ const core_1 = require("@ts-rest/core");
5
+ const zod_1 = require("zod");
6
+ const agent_workflows_schemas_1 = require("../schemas/agent-workflows.schemas");
7
+ const c = (0, core_1.initContract)();
8
+ /**
9
+ * Agent Workflows Routes
10
+ *
11
+ * API endpoints for querying and monitoring autonomous agent workflows.
12
+ * These workflows track the system's automated decision-making process
13
+ * for converting recommendations into tasks.
14
+ */
15
+ exports.agentWorkflowsRouter = c.router({
16
+ /**
17
+ * List agent workflows with filters
18
+ */
19
+ listWorkflows: {
20
+ method: 'GET',
21
+ path: '/agent-workflows',
22
+ query: zod_1.z.object({
23
+ farmId: zod_1.z.string().uuid().optional(),
24
+ fieldId: zod_1.z.string().uuid().optional(),
25
+ status: agent_workflows_schemas_1.agentWorkflowStatusSchema.optional(),
26
+ triggerEvent: zod_1.z.string().optional(), // e.g., 'observation.analysis.completed'
27
+ startDate: zod_1.z.string().datetime().optional(),
28
+ endDate: zod_1.z.string().datetime().optional(),
29
+ limit: zod_1.z.number().int().min(1).max(100).default(20),
30
+ offset: zod_1.z.number().int().min(0).default(0),
31
+ }),
32
+ responses: {
33
+ 200: agent_workflows_schemas_1.agentWorkflowListResponseSchema,
34
+ 400: zod_1.z.object({
35
+ errors: zod_1.z.array(zod_1.z.object({
36
+ status: zod_1.z.string(),
37
+ code: zod_1.z.string(),
38
+ title: zod_1.z.string(),
39
+ detail: zod_1.z.string(),
40
+ })),
41
+ }),
42
+ },
43
+ summary: 'List agent workflows with filters',
44
+ },
45
+ /**
46
+ * Get a specific workflow by ID
47
+ */
48
+ getWorkflow: {
49
+ method: 'GET',
50
+ path: '/agent-workflows/:id',
51
+ responses: {
52
+ 200: agent_workflows_schemas_1.agentWorkflowResponseSchema,
53
+ 404: zod_1.z.object({
54
+ errors: zod_1.z.array(zod_1.z.object({
55
+ status: zod_1.z.literal('404'),
56
+ code: zod_1.z.string(),
57
+ title: zod_1.z.string(),
58
+ detail: zod_1.z.string(),
59
+ })),
60
+ }),
61
+ },
62
+ summary: 'Get agent workflow details',
63
+ },
64
+ /**
65
+ * Get workflows for a specific farm
66
+ */
67
+ getWorkflowsByFarm: {
68
+ method: 'GET',
69
+ path: '/farms/:farmId/agent-workflows',
70
+ query: zod_1.z.object({
71
+ status: agent_workflows_schemas_1.agentWorkflowStatusSchema.optional(),
72
+ limit: zod_1.z.number().int().min(1).max(100).default(20),
73
+ offset: zod_1.z.number().int().min(0).default(0),
74
+ }),
75
+ responses: {
76
+ 200: agent_workflows_schemas_1.agentWorkflowListResponseSchema,
77
+ 404: zod_1.z.object({
78
+ errors: zod_1.z.array(zod_1.z.object({
79
+ status: zod_1.z.literal('404'),
80
+ code: zod_1.z.string(),
81
+ title: zod_1.z.string(),
82
+ detail: zod_1.z.string(),
83
+ })),
84
+ }),
85
+ },
86
+ summary: 'Get all workflows for a farm',
87
+ },
88
+ /**
89
+ * Get workflows for a specific field
90
+ */
91
+ getWorkflowsByField: {
92
+ method: 'GET',
93
+ path: '/fields/:fieldId/agent-workflows',
94
+ query: zod_1.z.object({
95
+ status: agent_workflows_schemas_1.agentWorkflowStatusSchema.optional(),
96
+ limit: zod_1.z.number().int().min(1).max(100).default(20),
97
+ offset: zod_1.z.number().int().min(0).default(0),
98
+ }),
99
+ responses: {
100
+ 200: agent_workflows_schemas_1.agentWorkflowListResponseSchema,
101
+ 404: zod_1.z.object({
102
+ errors: zod_1.z.array(zod_1.z.object({
103
+ status: zod_1.z.literal('404'),
104
+ code: zod_1.z.string(),
105
+ title: zod_1.z.string(),
106
+ detail: zod_1.z.string(),
107
+ })),
108
+ }),
109
+ },
110
+ summary: 'Get all workflows for a field',
111
+ },
112
+ /**
113
+ * Get workflow statistics
114
+ */
115
+ getWorkflowStats: {
116
+ method: 'GET',
117
+ path: '/agent-workflows/stats',
118
+ query: zod_1.z.object({
119
+ farmId: zod_1.z.string().uuid().optional(),
120
+ startDate: zod_1.z.string().datetime().optional(),
121
+ endDate: zod_1.z.string().datetime().optional(),
122
+ }),
123
+ responses: {
124
+ 200: zod_1.z.object({
125
+ data: zod_1.z.object({
126
+ overall: zod_1.z.object({
127
+ totalWorkflows: zod_1.z.number().int(),
128
+ successRate: zod_1.z.number(),
129
+ avgProcessingTime: zod_1.z.number(),
130
+ tasksCreated: zod_1.z.number().int(),
131
+ tasksUpdated: zod_1.z.number().int(),
132
+ skipped: zod_1.z.number().int(),
133
+ }),
134
+ bySource: zod_1.z.record(zod_1.z.object({
135
+ workflows: zod_1.z.number().int(),
136
+ tasksCreated: zod_1.z.number().int(),
137
+ tasksUpdated: zod_1.z.number().int(),
138
+ skipped: zod_1.z.number().int(),
139
+ skipRate: zod_1.z.number(),
140
+ avgConfidence: zod_1.z.number().optional(),
141
+ })),
142
+ deduplication: zod_1.z.object({
143
+ exactMatches: zod_1.z.number().int(),
144
+ semanticMatches: zod_1.z.number().int(),
145
+ categoryMatches: zod_1.z.number().int(),
146
+ crossSourceMatches: zod_1.z.number().int(),
147
+ avgSimilarityScore: zod_1.z.number(),
148
+ }),
149
+ outcomes: zod_1.z.object({
150
+ tasksCompleted: zod_1.z.number().int(),
151
+ tasksPending: zod_1.z.number().int(),
152
+ tasksInProgress: zod_1.z.number().int(),
153
+ completionRate: zod_1.z.number(),
154
+ }),
155
+ }),
156
+ }),
157
+ },
158
+ summary: 'Get agent workflow statistics and analytics',
159
+ },
160
+ });