newo 1.9.0 → 1.9.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/CHANGELOG.md +15 -0
- package/dist/api.d.ts +1 -2
- package/dist/api.js +0 -20
- package/dist/sync.js +3 -25
- package/dist/types.d.ts +0 -17
- package/package.json +1 -1
- package/src/api.ts +0 -20
- package/src/sync.ts +2 -29
- package/src/types.ts +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.9.1] - 2025-09-16
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **Clean Chat History Implementation**: Remove conversations acts API fallback entirely
|
|
12
|
+
- Eliminates all 403 "Invalid token or account_id field missing" errors
|
|
13
|
+
- Uses only `/api/v1/chat/history` endpoint which works with current API keys
|
|
14
|
+
- Removed unused `getConversationActs()` function and related types
|
|
15
|
+
- Clean implementation without permission-dependent fallbacks
|
|
16
|
+
|
|
17
|
+
### Removed
|
|
18
|
+
- **Obsolete Code Cleanup**: Remove unused conversation acts API components
|
|
19
|
+
- `getConversationActs()` function (unused after chat history integration)
|
|
20
|
+
- `ConversationActsParams` and `ConversationActsResponse` interfaces
|
|
21
|
+
- Fallback logic that caused 403 errors for personas without proper permissions
|
|
22
|
+
|
|
8
23
|
## [1.9.0] - 2025-09-16
|
|
9
24
|
|
|
10
25
|
### Added
|
package/dist/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AxiosInstance } from 'axios';
|
|
2
|
-
import type { ProjectMeta, Agent, Skill, FlowEvent, FlowState, AkbImportArticle, CustomerProfile, CustomerAttribute, CustomerAttributesResponse, UserPersonaResponse, UserPersona,
|
|
2
|
+
import type { ProjectMeta, Agent, Skill, FlowEvent, FlowState, AkbImportArticle, CustomerProfile, CustomerAttribute, CustomerAttributesResponse, UserPersonaResponse, UserPersona, ChatHistoryParams, ChatHistoryResponse } from './types.js';
|
|
3
3
|
export declare function makeClient(verbose?: boolean, token?: string): Promise<AxiosInstance>;
|
|
4
4
|
export declare function listProjects(client: AxiosInstance): Promise<ProjectMeta[]>;
|
|
5
5
|
export declare function listAgents(client: AxiosInstance, projectId: string): Promise<Agent[]>;
|
|
@@ -19,6 +19,5 @@ export declare function getAccount(client: AxiosInstance): Promise<{
|
|
|
19
19
|
id: string;
|
|
20
20
|
[key: string]: any;
|
|
21
21
|
}>;
|
|
22
|
-
export declare function getConversationActs(client: AxiosInstance, params: ConversationActsParams): Promise<ConversationActsResponse>;
|
|
23
22
|
export declare function getChatHistory(client: AxiosInstance, params: ChatHistoryParams): Promise<ChatHistoryResponse>;
|
|
24
23
|
//# sourceMappingURL=api.d.ts.map
|
package/dist/api.js
CHANGED
|
@@ -136,26 +136,6 @@ export async function getAccount(client) {
|
|
|
136
136
|
const response = await client.get('/api/v1/account');
|
|
137
137
|
return response.data;
|
|
138
138
|
}
|
|
139
|
-
export async function getConversationActs(client, params) {
|
|
140
|
-
const queryParams = {
|
|
141
|
-
user_persona_id: params.user_persona_id,
|
|
142
|
-
page: params.page || 1,
|
|
143
|
-
per: params.per || 50
|
|
144
|
-
};
|
|
145
|
-
// Only add optional parameters if explicitly provided
|
|
146
|
-
if (params.turn_type)
|
|
147
|
-
queryParams.turn_type = params.turn_type;
|
|
148
|
-
if (params.connectors)
|
|
149
|
-
queryParams.connectors = params.connectors;
|
|
150
|
-
if (params.from_date)
|
|
151
|
-
queryParams.from_date = params.from_date;
|
|
152
|
-
if (params.to_date)
|
|
153
|
-
queryParams.to_date = params.to_date;
|
|
154
|
-
const response = await client.get('/api/v1/bff/conversations/acts', {
|
|
155
|
-
params: queryParams
|
|
156
|
-
});
|
|
157
|
-
return response.data;
|
|
158
|
-
}
|
|
159
139
|
export async function getChatHistory(client, params) {
|
|
160
140
|
const queryParams = {
|
|
161
141
|
user_actor_id: params.user_actor_id,
|
package/dist/sync.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { listProjects, listAgents, listFlowSkills, updateSkill, listFlowEvents, listFlowStates, getProjectMeta, getCustomerAttributes, updateCustomerAttribute, listUserPersonas,
|
|
1
|
+
import { listProjects, listAgents, listFlowSkills, updateSkill, listFlowEvents, listFlowStates, getProjectMeta, getCustomerAttributes, updateCustomerAttribute, listUserPersonas, getChatHistory } from './api.js';
|
|
2
2
|
import { ensureState, skillPath, skillScriptPath, writeFileSafe, readIfExists, mapPath, projectMetadataPath, agentMetadataPath, flowMetadataPath, skillMetadataPath, flowsYamlPath, customerAttributesPath, customerAttributesMapPath, customerAttributesBackupPath } from './fsutil.js';
|
|
3
3
|
import fs from 'fs-extra';
|
|
4
4
|
import { sha256, loadHashes, saveHashes } from './hash.js';
|
|
@@ -1114,31 +1114,9 @@ export async function pullConversations(client, customer, options = {}, verbose
|
|
|
1114
1114
|
}
|
|
1115
1115
|
catch (chatError) {
|
|
1116
1116
|
if (verbose)
|
|
1117
|
-
console.log(` ⚠️ Chat history failed for ${persona.name}
|
|
1118
|
-
|
|
1119
|
-
// Fallback to original acts API
|
|
1120
|
-
const actsParams = {
|
|
1121
|
-
user_persona_id: persona.id,
|
|
1122
|
-
page: actPage,
|
|
1123
|
-
per: actsPerPage,
|
|
1124
|
-
turn_type: 'messages',
|
|
1125
|
-
connectors: options.connectors?.join(',') || 'newo_voice/*',
|
|
1126
|
-
...(options.fromDate && { from_date: options.fromDate }),
|
|
1127
|
-
...(options.toDate && { to_date: options.toDate })
|
|
1128
|
-
};
|
|
1129
|
-
const actsResponse = await getConversationActs(client, actsParams);
|
|
1130
|
-
allActs.push(...actsResponse.items);
|
|
1131
|
-
if (verbose && actsResponse.items.length > 0) {
|
|
1132
|
-
console.log(` 👤 ${persona.name}: Page ${actPage} - ${actsResponse.items.length} acts (${allActs.length}/${actsResponse.metadata.total} total)`);
|
|
1133
|
-
}
|
|
1134
|
-
hasMoreActs = actsResponse.items.length === actsPerPage && allActs.length < actsResponse.metadata.total;
|
|
1135
|
-
actPage++;
|
|
1136
|
-
// Apply per-persona act limit if specified
|
|
1137
|
-
if (options.maxActsPerPersona && allActs.length >= options.maxActsPerPersona) {
|
|
1138
|
-
allActs.splice(options.maxActsPerPersona);
|
|
1117
|
+
console.log(` ⚠️ Chat history failed for ${persona.name}: ${chatError instanceof Error ? chatError.message : String(chatError)}`);
|
|
1118
|
+
// No fallback - only use chat history API
|
|
1139
1119
|
hasMoreActs = false;
|
|
1140
|
-
if (verbose)
|
|
1141
|
-
console.log(` ⚠️ Limited to ${options.maxActsPerPersona} acts for ${persona.name}`);
|
|
1142
1120
|
}
|
|
1143
1121
|
}
|
|
1144
1122
|
// Sort acts by datetime ascending (chronological order)
|
package/dist/types.d.ts
CHANGED
|
@@ -337,23 +337,6 @@ export interface UserPersonaResponse {
|
|
|
337
337
|
readonly total: number;
|
|
338
338
|
};
|
|
339
339
|
}
|
|
340
|
-
export interface ConversationActsResponse {
|
|
341
|
-
readonly items: readonly ConversationAct[];
|
|
342
|
-
readonly metadata: {
|
|
343
|
-
readonly page: number;
|
|
344
|
-
readonly per: number;
|
|
345
|
-
readonly total: number;
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
export interface ConversationActsParams {
|
|
349
|
-
readonly turn_type?: string;
|
|
350
|
-
readonly connectors?: string;
|
|
351
|
-
readonly user_persona_id: string;
|
|
352
|
-
readonly page?: number;
|
|
353
|
-
readonly per?: number;
|
|
354
|
-
readonly from_date?: string;
|
|
355
|
-
readonly to_date?: string;
|
|
356
|
-
}
|
|
357
340
|
export interface ChatHistoryParams {
|
|
358
341
|
readonly user_actor_id: string;
|
|
359
342
|
readonly agent_actor_id?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "newo",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "NEWO CLI: comprehensive sync for AI Agent skills, customer attributes, conversations, and metadata between NEWO platform and local files. Multi-customer workspaces, conversation history extraction, complete change tracking, Git-first workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/api.ts
CHANGED
|
@@ -13,8 +13,6 @@ import type {
|
|
|
13
13
|
CustomerAttributesResponse,
|
|
14
14
|
UserPersonaResponse,
|
|
15
15
|
UserPersona,
|
|
16
|
-
ConversationActsResponse,
|
|
17
|
-
ConversationActsParams,
|
|
18
16
|
ChatHistoryParams,
|
|
19
17
|
ChatHistoryResponse
|
|
20
18
|
} from './types.js';
|
|
@@ -179,24 +177,6 @@ export async function getAccount(client: AxiosInstance): Promise<{ id: string; [
|
|
|
179
177
|
return response.data;
|
|
180
178
|
}
|
|
181
179
|
|
|
182
|
-
export async function getConversationActs(client: AxiosInstance, params: ConversationActsParams): Promise<ConversationActsResponse> {
|
|
183
|
-
const queryParams: Record<string, any> = {
|
|
184
|
-
user_persona_id: params.user_persona_id,
|
|
185
|
-
page: params.page || 1,
|
|
186
|
-
per: params.per || 50
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
// Only add optional parameters if explicitly provided
|
|
190
|
-
if (params.turn_type) queryParams.turn_type = params.turn_type;
|
|
191
|
-
if (params.connectors) queryParams.connectors = params.connectors;
|
|
192
|
-
if (params.from_date) queryParams.from_date = params.from_date;
|
|
193
|
-
if (params.to_date) queryParams.to_date = params.to_date;
|
|
194
|
-
|
|
195
|
-
const response = await client.get<ConversationActsResponse>('/api/v1/bff/conversations/acts', {
|
|
196
|
-
params: queryParams
|
|
197
|
-
});
|
|
198
|
-
return response.data;
|
|
199
|
-
}
|
|
200
180
|
|
|
201
181
|
export async function getChatHistory(client: AxiosInstance, params: ChatHistoryParams): Promise<ChatHistoryResponse> {
|
|
202
182
|
const queryParams: Record<string, any> = {
|
package/src/sync.ts
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
getCustomerAttributes,
|
|
10
10
|
updateCustomerAttribute,
|
|
11
11
|
listUserPersonas,
|
|
12
|
-
getConversationActs,
|
|
13
12
|
getChatHistory
|
|
14
13
|
} from './api.js';
|
|
15
14
|
import {
|
|
@@ -1297,35 +1296,9 @@ export async function pullConversations(
|
|
|
1297
1296
|
}
|
|
1298
1297
|
}
|
|
1299
1298
|
} catch (chatError) {
|
|
1300
|
-
if (verbose) console.log(` ⚠️ Chat history failed for ${persona.name}
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
// Fallback to original acts API
|
|
1304
|
-
const actsParams = {
|
|
1305
|
-
user_persona_id: persona.id,
|
|
1306
|
-
page: actPage,
|
|
1307
|
-
per: actsPerPage,
|
|
1308
|
-
turn_type: 'messages',
|
|
1309
|
-
connectors: options.connectors?.join(',') || 'newo_voice/*',
|
|
1310
|
-
...(options.fromDate && { from_date: options.fromDate }),
|
|
1311
|
-
...(options.toDate && { to_date: options.toDate })
|
|
1312
|
-
};
|
|
1313
|
-
|
|
1314
|
-
const actsResponse = await getConversationActs(client, actsParams);
|
|
1315
|
-
allActs.push(...actsResponse.items);
|
|
1316
|
-
|
|
1317
|
-
if (verbose && actsResponse.items.length > 0) {
|
|
1318
|
-
console.log(` 👤 ${persona.name}: Page ${actPage} - ${actsResponse.items.length} acts (${allActs.length}/${actsResponse.metadata.total} total)`);
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
hasMoreActs = actsResponse.items.length === actsPerPage && allActs.length < actsResponse.metadata.total;
|
|
1322
|
-
actPage++;
|
|
1323
|
-
|
|
1324
|
-
// Apply per-persona act limit if specified
|
|
1325
|
-
if (options.maxActsPerPersona && allActs.length >= options.maxActsPerPersona) {
|
|
1326
|
-
allActs.splice(options.maxActsPerPersona);
|
|
1299
|
+
if (verbose) console.log(` ⚠️ Chat history failed for ${persona.name}: ${chatError instanceof Error ? chatError.message : String(chatError)}`);
|
|
1300
|
+
// No fallback - only use chat history API
|
|
1327
1301
|
hasMoreActs = false;
|
|
1328
|
-
if (verbose) console.log(` ⚠️ Limited to ${options.maxActsPerPersona} acts for ${persona.name}`);
|
|
1329
1302
|
}
|
|
1330
1303
|
}
|
|
1331
1304
|
|
package/src/types.ts
CHANGED
|
@@ -399,24 +399,6 @@ export interface UserPersonaResponse {
|
|
|
399
399
|
};
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
-
export interface ConversationActsResponse {
|
|
403
|
-
readonly items: readonly ConversationAct[];
|
|
404
|
-
readonly metadata: {
|
|
405
|
-
readonly page: number;
|
|
406
|
-
readonly per: number;
|
|
407
|
-
readonly total: number;
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
export interface ConversationActsParams {
|
|
412
|
-
readonly turn_type?: string;
|
|
413
|
-
readonly connectors?: string;
|
|
414
|
-
readonly user_persona_id: string;
|
|
415
|
-
readonly page?: number;
|
|
416
|
-
readonly per?: number;
|
|
417
|
-
readonly from_date?: string;
|
|
418
|
-
readonly to_date?: string;
|
|
419
|
-
}
|
|
420
402
|
|
|
421
403
|
export interface ChatHistoryParams {
|
|
422
404
|
readonly user_actor_id: string;
|