@yrpri/api 9.0.108 → 9.0.109

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.
@@ -0,0 +1,5 @@
1
+ declare module '@yrpri/api/active-citizen/controllers/activities.cjs' {
2
+ import { Router } from 'express';
3
+ const router: Router;
4
+ export default router;
5
+ }
@@ -0,0 +1,5 @@
1
+ declare module '@yrpri/api/active-citizen/controllers/notifications.cjs' {
2
+ import { Router } from 'express';
3
+ const router: Router;
4
+ export default router;
5
+ }
@@ -0,0 +1,156 @@
1
+
2
+ interface UnsubscribeResult {
3
+ success: boolean;
4
+ error?: string;
5
+ subscriptionId?: number;
6
+ }
7
+
8
+ interface SubscribeResult {
9
+ success: boolean;
10
+ error?: string;
11
+ plan?: YpSubscriptionPlanAttributes;
12
+ subscription?: YpSubscriptionAttributes;
13
+ }
14
+
15
+ interface AssistantAgent {
16
+ subscriptionId: number;
17
+ subscriptionPlanId: number;
18
+ name: string;
19
+ description: string;
20
+ imageUrl: string;
21
+ isRunning: boolean;
22
+ }
23
+
24
+ interface AssistantAgentRun {
25
+ runId: number;
26
+ agentProductId: number;
27
+ agentRunId: number;
28
+ status: string;
29
+ agentName: string;
30
+ workflow: any;
31
+ subscriptionId: number;
32
+ }
33
+
34
+ interface AssistantAgentSubscriptionStatus {
35
+ availableSubscriptions: Array<YpSubscriptionAttributes>;
36
+ runningAgents: Array<AssistantAgentRun>;
37
+ systemStatus: {
38
+ healthy: boolean;
39
+ lastUpdated: Date;
40
+ error?: string;
41
+ };
42
+ }
43
+
44
+ interface AssistantAgentBundle {
45
+ agentBundleId: number;
46
+ name: string;
47
+ description: string;
48
+ imageUrl: string;
49
+ }
50
+
51
+ interface AssistantAgentPlan {
52
+ subscriptionPlanId: number;
53
+ name: string;
54
+ type: YpSubscriptionPlanType;
55
+ description: string;
56
+ imageUrl: string;
57
+ price?: number;
58
+ currency?: string;
59
+ maxRunsPerCycle?: number;
60
+ }
61
+
62
+ interface AssistantAgentPlanStatus {
63
+ availablePlans: Array<AssistantAgentPlan>;
64
+ availableBundle: AssistantAgentBundle | string;
65
+ systemStatus: {
66
+ healthy: boolean;
67
+ lastUpdated: Date;
68
+ error?: string;
69
+ };
70
+ }
71
+
72
+ interface ToolClientEvent {
73
+ name: YpAssistantMessageType;
74
+ details: any;
75
+ }
76
+
77
+ interface ToolClientEventUiClick {
78
+ name: "ui_click";
79
+ details: YpAssistantUiClickTypes;
80
+ }
81
+
82
+ interface ToolExecutionResult<T = unknown> {
83
+ success: boolean;
84
+ data?: T;
85
+ html?: string;
86
+ uniqueToken?: string;
87
+ clientEvents?: ToolClientEvent[];
88
+ error?: string;
89
+ metadata?: Record<string, unknown>;
90
+ }
91
+
92
+ /**
93
+ * Enhanced AssistantChatbotTool interface with result type
94
+ */
95
+ interface AssistantChatbotTool {
96
+ name: string;
97
+ description: string;
98
+ type?: string;
99
+ parameters: ToolDefinition["parameters"];
100
+ handler: (params: any) => Promise<ToolExecutionResult>;
101
+ resultSchema?: ToolDefinition["parameters"];
102
+ }
103
+
104
+ /**
105
+ * Message format for tool results
106
+ */
107
+ interface ToolResponseMessage {
108
+ role: "tool";
109
+ content: string;
110
+ tool_call_id: string;
111
+ name: string;
112
+ }
113
+
114
+ interface ToolCall {
115
+ id: string;
116
+ name: string;
117
+ arguments: string;
118
+ startTime?: number; // For timeout tracking
119
+ }
120
+
121
+ interface AssistantChatbotMode {
122
+ name: YpAssistantMode;
123
+ description: string;
124
+ systemPrompt: string;
125
+ tools: AssistantChatbotTool[];
126
+ routingRules?: string[];
127
+ allowedTransitions?: YpAssistantMode[];
128
+ cleanup?: () => Promise<void>;
129
+ }
130
+
131
+ interface YpBaseAssistantMemoryData extends YpBaseChatBotMemoryData {
132
+ redisKey: string;
133
+ currentMode: YpAssistantMode;
134
+ currentUser?: YpUserData;
135
+ haveShownLoginWidget?: boolean;
136
+ haveShownConfigurationWidget?: boolean;
137
+ currentAgentStatus?: {
138
+ subscriptionPlanId: number;
139
+ activeAgentRunId?: number;
140
+ subscriptionId: number | null;
141
+ subscriptionState: YpAssistantAgentSubscriptionState;
142
+ configurationState: YpAssistantAgentConfigurationState;
143
+ };
144
+
145
+ allChatLogs?: YpSimpleChatLog[];
146
+
147
+ loginState?: YpAssistantLoginState;
148
+
149
+ modeData?: AssistantModeData;
150
+ modeHistory?: Array<{
151
+ mode: YpAssistantMode;
152
+ timestamp: number;
153
+ reason?: string;
154
+ }>;
155
+ }
156
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yrpri/api",
3
- "version": "9.0.108",
3
+ "version": "9.0.109",
4
4
  "license": "MIT",
5
5
  "author": "Robert Bjarnason & Citizens Foundation",
6
6
  "repository": {
@@ -133,7 +133,7 @@
133
133
  },
134
134
  "scripts": {
135
135
  "copyInLocalAgents": "cp -R ../../policy-synth/agents/ts-out/* ./node_modules/@policysynth/agents/;cp ../../policy-synth/agents/src/*.d.ts ./node_modules/@policysynth/agents/;",
136
- "publish_live": "npm run build:dev;copyfiles './controllers/**/*.d.ts' 'ts-out/';npm pack && node repack && node publish.js https://registry.npmjs.org/",
136
+ "publish_live": "npm run build:dev;copyfiles './utils/**/*.d.ts' './controllers/**/*.d.ts' './agents/**/*.d.ts' './models/**/*.d.ts' './active-citizen/controllers/**/*.d.ts' './active-citizen/models/**/*.d.ts' 'ts-out/';npm pack && node repack && node publish.js https://registry.npmjs.org/",
137
137
  "publish_local": "npm run build;npm pack && node repack && node publish.js http://localhost:4873",
138
138
  "start": "nodemon -e ts ts-out/server.js",
139
139
  "watch-start": "DEBUG=router:* tsc --project ./ --outDir ./ts-out -w & nodemon -q ./ts-out/server.js",
@@ -0,0 +1,4 @@
1
+ declare module "./copy_utils.cjs" {
2
+ export function copyGroup(): YpGroup;
3
+ export function copyCommunity(): YpCommunity;
4
+ }
@@ -0,0 +1,20 @@
1
+ import { Request, Response } from 'express';
2
+
3
+ // Define the module path based on convention from other .d.ts files
4
+ declare module '@yrpri/api/utils/manifest_generator.cjs' {
5
+
6
+ interface YpRequest extends Request {
7
+ ypCommunity?: YpCommunity;
8
+ ypDomain?: YpDomain;
9
+ }
10
+
11
+ /**
12
+ * Generates a web app manifest.
13
+ * The manifest content depends on the properties found on req.ypCommunity or req.ypDomain.
14
+ * @param req The Express request object, expected to be augmented with ypCommunity and/or ypDomain properties.
15
+ * @param res The Express response object used to send the generated manifest.
16
+ */
17
+ function generateManifest(req: YpRequest, res: Response): void;
18
+
19
+ export default generateManifest;
20
+ }