newo 2.0.6 → 3.1.0

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 (63) hide show
  1. package/CHANGELOG.md +338 -224
  2. package/README.md +257 -0
  3. package/dist/api.d.ts +23 -1
  4. package/dist/api.js +114 -0
  5. package/dist/auth.js +4 -0
  6. package/dist/cli/commands/create-agent.d.ts +3 -0
  7. package/dist/cli/commands/create-agent.js +75 -0
  8. package/dist/cli/commands/create-attribute.d.ts +3 -0
  9. package/dist/cli/commands/create-attribute.js +63 -0
  10. package/dist/cli/commands/create-event.d.ts +3 -0
  11. package/dist/cli/commands/create-event.js +66 -0
  12. package/dist/cli/commands/create-flow.d.ts +3 -0
  13. package/dist/cli/commands/create-flow.js +100 -0
  14. package/dist/cli/commands/create-parameter.d.ts +3 -0
  15. package/dist/cli/commands/create-parameter.js +47 -0
  16. package/dist/cli/commands/create-persona.d.ts +3 -0
  17. package/dist/cli/commands/create-persona.js +43 -0
  18. package/dist/cli/commands/create-project.d.ts +3 -0
  19. package/dist/cli/commands/create-project.js +55 -0
  20. package/dist/cli/commands/create-skill.d.ts +3 -0
  21. package/dist/cli/commands/create-skill.js +115 -0
  22. package/dist/cli/commands/create-state.d.ts +3 -0
  23. package/dist/cli/commands/create-state.js +58 -0
  24. package/dist/cli/commands/delete-agent.d.ts +3 -0
  25. package/dist/cli/commands/delete-agent.js +70 -0
  26. package/dist/cli/commands/delete-flow.d.ts +3 -0
  27. package/dist/cli/commands/delete-flow.js +83 -0
  28. package/dist/cli/commands/delete-skill.d.ts +3 -0
  29. package/dist/cli/commands/delete-skill.js +87 -0
  30. package/dist/cli/commands/help.js +114 -22
  31. package/dist/cli/commands/push.js +4 -3
  32. package/dist/cli/commands/sandbox.d.ts +14 -0
  33. package/dist/cli/commands/sandbox.js +306 -0
  34. package/dist/cli.js +57 -0
  35. package/dist/sandbox/chat.d.ts +40 -0
  36. package/dist/sandbox/chat.js +280 -0
  37. package/dist/sync/push.d.ts +1 -1
  38. package/dist/sync/push.js +372 -4
  39. package/dist/sync/status.js +178 -1
  40. package/dist/types.d.ts +181 -1
  41. package/package.json +6 -3
  42. package/src/api.ts +172 -1
  43. package/src/auth.ts +7 -2
  44. package/src/cli/commands/create-agent.ts +96 -0
  45. package/src/cli/commands/create-attribute.ts +75 -0
  46. package/src/cli/commands/create-event.ts +79 -0
  47. package/src/cli/commands/create-flow.ts +124 -0
  48. package/src/cli/commands/create-parameter.ts +59 -0
  49. package/src/cli/commands/create-persona.ts +54 -0
  50. package/src/cli/commands/create-project.ts +66 -0
  51. package/src/cli/commands/create-skill.ts +144 -0
  52. package/src/cli/commands/create-state.ts +71 -0
  53. package/src/cli/commands/delete-agent.ts +90 -0
  54. package/src/cli/commands/delete-flow.ts +105 -0
  55. package/src/cli/commands/delete-skill.ts +110 -0
  56. package/src/cli/commands/help.ts +114 -22
  57. package/src/cli/commands/push.ts +5 -3
  58. package/src/cli/commands/sandbox.ts +365 -0
  59. package/src/cli.ts +71 -0
  60. package/src/sandbox/chat.ts +339 -0
  61. package/src/sync/push.ts +413 -5
  62. package/src/sync/status.ts +183 -1
  63. package/src/types.ts +220 -2
package/README.md CHANGED
@@ -8,6 +8,7 @@
8
8
  **NEWO CLI** - Professional command-line tool for NEWO AI Agent development. Features **modular architecture**, **IDN-based file management**, and **comprehensive multi-customer support**.
9
9
 
10
10
  Sync NEWO "Project → Agent → Flow → Skills" structure to local files with:
11
+ - 🏗️ **Complete entity management** - Create, edit, and delete agents, flows, skills, events, and states (NEW v2.0+)
11
12
  - 🔄 **Intelligent synchronization** - Pull projects, attributes, and conversations automatically
12
13
  - 🎯 **IDN-based naming** - Skills named as `{skillIdn}.jinja/.guidance` for better organization
13
14
  - 📊 **Real-time progress** - Live progress tracking during large operations (966+ skills)
@@ -19,6 +20,7 @@ Sync NEWO "Project → Agent → Flow → Skills" structure to local files with:
19
20
  - 🧠 **AI skill formats** - Support for `.guidance` (AI prompts) and `.jinja` (NSL templates)
20
21
  - 📊 **Knowledge base import** - Bulk import AKB articles from structured text files
21
22
  - 💬 **Conversation history** - Extract and sync user conversations and personas
23
+ - 🧪 **Sandbox testing** - Interactive agent testing with conversation continuation (NEW v3.1.0)
22
24
  - 🔧 **CI/CD ready** - GitHub Actions integration for automated deployments
23
25
 
24
26
  ---
@@ -59,6 +61,13 @@ npm install && npm run build
59
61
  newo status # See what's modified
60
62
  ```
61
63
 
64
+ 4. **Create entities** (NEW v2.0+):
65
+ ```bash
66
+ newo create-agent MyBot --project <project-idn> # Create agent locally
67
+ newo create-flow MainFlow --agent MyBot --project <project-idn> # Create flow
68
+ newo push && newo pull # Sync to platform
69
+ ```
70
+
62
71
  ---
63
72
 
64
73
  ## Configuration
@@ -134,11 +143,43 @@ NEWO_REFRESH_URL=custom_refresh_endpoint # Custom refresh endpoint
134
143
  | `newo pull` | Download projects + attributes + metadata | • Real-time progress tracking (966+ skills)<br>• IDN-based file naming<br>• Automatic attributes.yaml generation<br>• `--force` for silent overwrite |
135
144
  | `newo push` | Upload local changes to NEWO | • Smart file validation<br>• Multiple file detection<br>• Hash-based change detection<br>• Safe error handling |
136
145
  | `newo status` | Show modified files with details | • Multiple file warnings<br>• Detailed change analysis<br>• Clean state validation<br>• Per-customer status |
146
+ | `newo sandbox` | Test agents in sandbox chat mode | • Single-command mode for automation<br>• Multi-turn conversation support<br>• Debug info for agent development<br>• Conversation continuation |
137
147
  | `newo conversations` | Pull conversation history | • User personas and chat history<br>• YAML format output<br>• Pagination support |
138
148
  | `newo list-customers` | List configured customers | • Shows default customer<br>• Multi-customer discovery |
139
149
  | `newo import-akb` | Import knowledge base articles | • Structured text parsing<br>• Bulk article import<br>• Validation and error reporting |
140
150
  | `newo meta` | Get project metadata (debug) | • Project structure analysis<br>• Metadata validation |
141
151
 
152
+ ### Entity Management Commands
153
+
154
+ **Complete lifecycle management for NEWO entities with local-first workflow:**
155
+
156
+ | Command | Description | Features |
157
+ |---------|-------------|----------|
158
+ | **Project Management** |||
159
+ | `newo create-project <idn>` | Create new project on platform | • Automatic project initialization<br>• Metadata configuration<br>• Version control support |
160
+ | **Agent Management** |||
161
+ | `newo create-agent <idn> --project <pid>` | Create agent locally | • Local folder structure<br>• Metadata generation<br>• Persona assignment support |
162
+ | `newo delete-agent <aid> --project <pid> --confirm` | Delete agent locally | • Safety confirmation required<br>• Local-only deletion<br>• Push to sync platform |
163
+ | **Flow Management** |||
164
+ | `newo create-flow <idn> --agent <aid> --project <pid>` | Create flow locally | • Guidance/NSL runner selection<br>• Automatic metadata<br>• Push to platform |
165
+ | `newo delete-flow <fid> --agent <aid> --project <pid> --confirm` | Delete flow locally | • Safety confirmation required<br>• Local-only deletion<br>• Push to sync platform |
166
+ | **Skill Management** |||
167
+ | `newo create-skill <idn> --flow <fid> --agent <aid> --project <pid>` | Create skill locally | • Script content initialization<br>• Runner type selection<br>• Parameter support |
168
+ | `newo delete-skill <sid> --flow <fid> --agent <aid> --project <pid> --confirm` | Delete skill locally | • Safety confirmation required<br>• Local-only deletion<br>• Push to sync platform |
169
+ | **Advanced Components (NSL)** |||
170
+ | `newo create-event <idn> --flow <fid>` | Create flow event | • Integration point setup<br>• Skill selector config<br>• Interrupt mode control |
171
+ | `newo create-state <idn> --flow <fid>` | Create flow state field | • User/flow/global scope<br>• Default value config<br>• State persistence |
172
+ | `newo create-parameter <name> --skill <sid>` | Create skill parameter | • Default value support<br>• Type configuration<br>• Parameter metadata |
173
+ | **Identity & Configuration** |||
174
+ | `newo create-persona <name>` | Create agent persona | • Persona configuration<br>• Title and description<br>• Agent assignment |
175
+ | `newo create-attribute <idn> --value <val>` | Create customer attribute | • Enum types support<br>• Group organization<br>• Hidden attributes |
176
+
177
+ **Workflow:**
178
+ 1. **Create locally** → Entities created as folder structures with metadata.yaml
179
+ 2. **Edit content** → Modify scripts, metadata, and configuration files
180
+ 3. **Push to platform** → `newo push` automatically detects and creates entities on NEWO
181
+ 4. **Sync complete** → `newo pull` retrieves IDs and platform-generated data
182
+
142
183
  ### Multi-Customer Commands
143
184
 
144
185
  ```bash
@@ -246,6 +287,16 @@ newo_customers/ # Root folder for all customers
246
287
  - **Project structure export** - `flows.yaml` for external tooling integration
247
288
  - **Cross-project operations** - Commands work across entire workspace
248
289
 
290
+ ### 🏗️ Complete Entity Management (NEW v2.0+)
291
+ - **Local-first workflow** - Create entities locally, push to platform when ready
292
+ - **Full lifecycle support** - Create, edit, delete agents, flows, skills, events, states
293
+ - **Automatic detection** - Push command auto-detects local-only entities
294
+ - **Safe deletion** - Confirmation flags prevent accidental deletions
295
+ - **Hierarchical creation** - Maintains proper agent → flow → skill relationships
296
+ - **NSL component support** - Create events, states, and parameters for NSL flows
297
+ - **Identity management** - Persona and attribute creation and configuration
298
+ - **Project scaffolding** - Complete project initialization from CLI
299
+
249
300
  ### 🔄 Intelligent Synchronization
250
301
  - **Two-way sync** - Pull from NEWO platform, push local changes back
251
302
  - **Change detection** - SHA256 hashing prevents unnecessary uploads
@@ -427,6 +478,107 @@ Add these secrets to your repository:
427
478
  node ./dist/cli.js push
428
479
  ```
429
480
 
481
+ ## Sandbox Testing (NEW v3.1.0)
482
+
483
+ Test your NEWO agents in real-time with sandbox chat mode. Perfect for development, debugging, and automated testing workflows.
484
+
485
+ ### Features
486
+ - **Single-command mode** - Send a message and get a response (ideal for automation)
487
+ - **Multi-turn conversations** - Continue chats with conversation context preserved
488
+ - **Debug information** - View flow execution, skill invocation, and session tracking
489
+ - **Unique sessions** - Each test creates a fresh persona for isolation
490
+
491
+ ### Usage
492
+
493
+ **Start a new conversation:**
494
+ ```bash
495
+ newo sandbox "Hello, I want to order a pizza"
496
+ ```
497
+
498
+ **Continue an existing conversation:**
499
+ ```bash
500
+ newo sandbox --actor <chat-id> "I want 2 large pepperoni pizzas"
501
+ ```
502
+
503
+ **With verbose debugging:**
504
+ ```bash
505
+ newo sandbox "Test message" --verbose
506
+ ```
507
+
508
+ ### Example: Multi-Turn Conversation
509
+
510
+ ```bash
511
+ # Turn 1: Start conversation
512
+ $ newo sandbox "I want to order delivery"
513
+
514
+ 📋 Chat Session Created:
515
+ Chat ID (actor_id): abc123...
516
+ Persona ID: xyz789...
517
+ Connector: convo_agent_sandbox
518
+ External ID: 2f99f7
519
+
520
+ 📤 You: I want to order delivery
521
+
522
+ 🤖 Agent:
523
+ Awesome! We can definitely get a delivery order started for you! What's your zip code, please?
524
+
525
+ 📊 Debug Summary:
526
+ Flow: CAMainFlow
527
+ Skill: _userMessageFastReplySkill
528
+ Session: 816c769a-8e1c-43e7-b22d-766c7bf63c33
529
+ Acts Processed: 1 (1 agent, 0 system)
530
+
531
+ 💡 To continue this conversation:
532
+ npx newo sandbox --actor abc123... "your next message"
533
+
534
+
535
+ # Turn 2: Continue conversation
536
+ $ newo sandbox --actor abc123... "90210"
537
+
538
+ 📤 You: 90210
539
+
540
+ 🤖 Agent:
541
+ Perfect! Now, could you please provide your delivery address?
542
+
543
+ 📊 Debug Summary:
544
+ Flow: CAMainFlow
545
+ Skill: CollectAddressSkill
546
+ Session: 816c769a-8e1c-43e7-b22d-766c7bf63c33
547
+ Acts Processed: 1 (1 agent, 0 user)
548
+ ```
549
+
550
+ ### Debug Information
551
+
552
+ **Standard Mode** shows:
553
+ - Flow execution path
554
+ - Skill invocation
555
+ - Session ID
556
+ - Act counts (agent vs. system messages)
557
+
558
+ **Verbose Mode** (`--verbose`) shows:
559
+ - All API requests and responses
560
+ - Complete act structure with arguments
561
+ - Runtime context IDs
562
+ - Detailed polling progress
563
+
564
+ ### Automated Testing Integration
565
+
566
+ Perfect for CI/CD workflows:
567
+
568
+ ```bash
569
+ # Test agent responses
570
+ RESPONSE=$(newo sandbox "test query" | grep "Agent:" | cut -d: -f2-)
571
+
572
+ # Validate response contains expected content
573
+ echo "$RESPONSE" | grep -q "expected text" && echo "✓ Test passed"
574
+
575
+ # Multi-turn testing
576
+ ACTOR_ID=$(newo sandbox "start conversation" | grep "Chat ID" | awk '{print $NF}')
577
+ newo sandbox --actor "$ACTOR_ID" "follow up message"
578
+ ```
579
+
580
+ ---
581
+
430
582
  ## AKB Import
431
583
 
432
584
  Import knowledge base articles from structured text files into NEWO personas:
@@ -502,6 +654,80 @@ newo import-akb articles.txt da4550db-2b95-4500-91ff-fb4b60fe7be9
502
654
  newo import-akb articles.txt persona_id --verbose
503
655
  ```
504
656
 
657
+ ### Entity Creation Workflows
658
+
659
+ **Complete Weather System Example (End-to-End):**
660
+
661
+ ```bash
662
+ # Step 1: Create project infrastructure
663
+ newo create-project weather_system --title "Weather System" --description "Comprehensive weather service"
664
+ newo pull # Sync new project locally
665
+
666
+ # Step 2: Create persona and configuration
667
+ newo create-persona weather_persona --title "Weather Assistant" --description "Professional weather guidance"
668
+ newo create-attribute weather_api_key --value "your_api_key" --group "Weather Config"
669
+
670
+ # Step 3: Create agent structure
671
+ newo create-agent WeatherBot --project weather_system --title "Weather Bot" --persona-id <persona-id>
672
+ newo push && newo pull # Push to platform, sync IDs
673
+
674
+ # Step 4: Create flow and skills
675
+ newo create-flow MainFlow --agent WeatherBot --project weather_system --title "Main Flow" --runner nsl
676
+ newo push && newo pull # Sync flow ID
677
+
678
+ newo create-skill WeatherSkill --flow MainFlow --agent WeatherBot --project weather_system \
679
+ --title "Weather NSL Skill" --runner nsl --script "Welcome to weather service!"
680
+
681
+ # Step 5: Add NSL components
682
+ newo create-event user_message --flow <flow-id> --skill WeatherSkill --integration api --connector webhook
683
+ newo create-state user_location --flow <flow-id> --title "User Location" --scope user
684
+ newo create-state request_count --flow <flow-id> --title "Request Count" --scope flow
685
+
686
+ # Step 6: Final sync
687
+ newo push # Creates complete system
688
+ newo status # Should show: Clean
689
+ ```
690
+
691
+ **Quick Agent Creation:**
692
+
693
+ ```bash
694
+ # Create complete agent structure
695
+ newo pull # Ensure local projects are synced
696
+ newo create-agent SupportBot --project my_project --title "Support Bot"
697
+ newo create-flow HelpFlow --agent SupportBot --project my_project --title "Help Flow"
698
+ newo push && newo pull # Sync to platform
699
+
700
+ newo create-skill Greeting --flow HelpFlow --agent SupportBot --project my_project \
701
+ --title "Greeting Skill" --runner guidance
702
+ newo push # Deploy to platform
703
+ ```
704
+
705
+ **Local Development & Testing:**
706
+
707
+ ```bash
708
+ # Create locally, test before pushing
709
+ newo create-agent TestBot --project my_project
710
+ newo create-flow TestFlow --agent TestBot --project my_project
711
+
712
+ # Edit metadata and scripts locally in your IDE
713
+ # newo_customers/CUSTOMER_IDN/projects/my_project/TestBot/TestFlow/
714
+
715
+ newo status # Check changes
716
+ newo push # Deploy when ready
717
+ ```
718
+
719
+ **Entity Deletion:**
720
+
721
+ ```bash
722
+ # Delete with safety confirmation
723
+ newo delete-skill OldSkill --flow MainFlow --agent SupportBot --project my_project --confirm
724
+ newo delete-flow OldFlow --agent SupportBot --project my_project --confirm
725
+ newo delete-agent OldBot --project my_project --confirm
726
+
727
+ # Push to sync deletions to platform
728
+ newo push
729
+ ```
730
+
505
731
  ---
506
732
 
507
733
  ## Development
@@ -951,6 +1177,37 @@ NEWO CLI integrates with these NEWO platform endpoints:
951
1177
  - `GET /api/v1/designer/flows/{flowId}/events` - List flow events
952
1178
  - `GET /api/v1/designer/flows/{flowId}/states` - List flow states
953
1179
 
1180
+ ### Entity Creation & Deletion (NEW v2.0+)
1181
+ - `POST /api/v2/designer/{projectId}/agents` - Create new agent
1182
+ - `DELETE /api/v1/designer/agents/{agentId}` - Delete agent
1183
+ - `POST /api/v1/designer/{agentId}/flows/empty` - Create new flow
1184
+ - `DELETE /api/v1/designer/flows/{flowId}` - Delete flow
1185
+ - `POST /api/v1/designer/flows/{flowId}/skills` - Create new skill
1186
+ - `DELETE /api/v1/designer/flows/skills/{skillId}` - Delete skill
1187
+ - `POST /api/v1/designer/flows/{flowId}/events` - Create flow event
1188
+ - `DELETE /api/v1/designer/flows/events/{eventId}` - Delete flow event
1189
+ - `POST /api/v1/designer/flows/{flowId}/states` - Create flow state
1190
+ - `POST /api/v1/designer/flows/skills/{skillId}/parameters` - Create skill parameter
1191
+ - `POST /api/v1/customer/attributes` - Create customer attribute
1192
+ - `POST /api/v1/designer/personas` - Create agent persona
1193
+ - `POST /api/v1/designer/projects` - Create project
1194
+ - `POST /api/v1/designer/flows/{flowId}/publish` - Publish flow
1195
+
1196
+ ### Conversations & Attributes
1197
+ - `GET /api/v1/bff/conversations/user-personas` - List user personas
1198
+ - `GET /api/v1/chat/history` - Get conversation history
1199
+ - `GET /api/v1/bff/conversations/acts` - Get conversation acts (fallback)
1200
+ - `GET /api/v1/bff/customer/attributes?include_hidden=true` - Get customer attributes
1201
+ - `PUT /api/v1/customer/attributes/{attributeId}` - Update customer attribute
1202
+
1203
+ ### Sandbox Testing (NEW v3.1.0)
1204
+ - `GET /api/v1/integrations` - List available integrations
1205
+ - `GET /api/v1/integrations/{id}/connectors` - List integration connectors
1206
+ - `POST /api/v1/customer/personas` - Create user persona for chat
1207
+ - `POST /api/v1/customer/personas/{id}/actors` - Create actor (chat session)
1208
+ - `POST /api/v1/chat/user/{actorId}` - Send chat message
1209
+ - `GET /api/v1/chat/history` - Poll for agent responses
1210
+
954
1211
  ### Knowledge Base
955
1212
  - `POST /api/v1/akb/append-manual` - Import AKB articles to persona
956
1213
 
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, ChatHistoryParams, ChatHistoryResponse } from './types.js';
2
+ import type { ProjectMeta, Agent, Skill, FlowEvent, FlowState, AkbImportArticle, CustomerProfile, CustomerAttribute, CustomerAttributesResponse, UserPersonaResponse, UserPersona, ChatHistoryParams, ChatHistoryResponse, CreateAgentRequest, CreateAgentResponse, CreateFlowRequest, CreateFlowResponse, CreateSkillRequest, CreateSkillResponse, CreateFlowEventRequest, CreateFlowEventResponse, CreateFlowStateRequest, CreateFlowStateResponse, CreateSkillParameterRequest, CreateSkillParameterResponse, CreateCustomerAttributeRequest, CreateCustomerAttributeResponse, CreatePersonaRequest, CreatePersonaResponse, CreateProjectRequest, CreateProjectResponse, PublishFlowRequest, PublishFlowResponse, Integration, Connector, CreateSandboxPersonaRequest, CreateSandboxPersonaResponse, CreateActorRequest, CreateActorResponse, SendChatMessageRequest, ConversationActsParams, ConversationActsResponse } 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[]>;
@@ -20,4 +20,26 @@ export declare function getAccount(client: AxiosInstance): Promise<{
20
20
  [key: string]: any;
21
21
  }>;
22
22
  export declare function getChatHistory(client: AxiosInstance, params: ChatHistoryParams): Promise<ChatHistoryResponse>;
23
+ export declare function createAgent(client: AxiosInstance, projectId: string, agentData: CreateAgentRequest): Promise<CreateAgentResponse>;
24
+ export declare function deleteAgent(client: AxiosInstance, agentId: string): Promise<void>;
25
+ export declare function createFlow(client: AxiosInstance, agentId: string, flowData: CreateFlowRequest): Promise<CreateFlowResponse>;
26
+ export declare function deleteFlow(client: AxiosInstance, flowId: string): Promise<void>;
27
+ export declare function createSkill(client: AxiosInstance, flowId: string, skillData: CreateSkillRequest): Promise<CreateSkillResponse>;
28
+ export declare function deleteSkill(client: AxiosInstance, skillId: string): Promise<void>;
29
+ export declare function deleteSkillById(client: AxiosInstance, skillId: string): Promise<void>;
30
+ export declare function createFlowEvent(client: AxiosInstance, flowId: string, eventData: CreateFlowEventRequest): Promise<CreateFlowEventResponse>;
31
+ export declare function deleteFlowEvent(client: AxiosInstance, eventId: string): Promise<void>;
32
+ export declare function createFlowState(client: AxiosInstance, flowId: string, stateData: CreateFlowStateRequest): Promise<CreateFlowStateResponse>;
33
+ export declare function createSkillParameter(client: AxiosInstance, skillId: string, paramData: CreateSkillParameterRequest): Promise<CreateSkillParameterResponse>;
34
+ export declare function createCustomerAttribute(client: AxiosInstance, attributeData: CreateCustomerAttributeRequest): Promise<CreateCustomerAttributeResponse>;
35
+ export declare function createProject(client: AxiosInstance, projectData: CreateProjectRequest): Promise<CreateProjectResponse>;
36
+ export declare function deleteProject(client: AxiosInstance, projectId: string): Promise<void>;
37
+ export declare function createPersona(client: AxiosInstance, personaData: CreatePersonaRequest): Promise<CreatePersonaResponse>;
38
+ export declare function publishFlow(client: AxiosInstance, flowId: string, publishData: PublishFlowRequest): Promise<PublishFlowResponse>;
39
+ export declare function listIntegrations(client: AxiosInstance): Promise<Integration[]>;
40
+ export declare function listConnectors(client: AxiosInstance, integrationId: string): Promise<Connector[]>;
41
+ export declare function createSandboxPersona(client: AxiosInstance, personaData: CreateSandboxPersonaRequest): Promise<CreateSandboxPersonaResponse>;
42
+ export declare function createActor(client: AxiosInstance, personaId: string, actorData: CreateActorRequest): Promise<CreateActorResponse>;
43
+ export declare function sendChatMessage(client: AxiosInstance, actorId: string, messageData: SendChatMessageRequest): Promise<void>;
44
+ export declare function getConversationActs(client: AxiosInstance, params: ConversationActsParams): Promise<ConversationActsResponse>;
23
45
  //# sourceMappingURL=api.d.ts.map
package/dist/api.js CHANGED
@@ -151,4 +151,118 @@ export async function getChatHistory(client, params) {
151
151
  });
152
152
  return response.data;
153
153
  }
154
+ // Entity Creation/Deletion API Functions
155
+ export async function createAgent(client, projectId, agentData) {
156
+ // Use project-specific v2 endpoint for proper project association
157
+ const response = await client.post(`/api/v2/designer/${projectId}/agents`, agentData);
158
+ return response.data;
159
+ }
160
+ export async function deleteAgent(client, agentId) {
161
+ await client.delete(`/api/v1/designer/agents/${agentId}`);
162
+ }
163
+ export async function createFlow(client, agentId, flowData) {
164
+ // Use the correct NEWO endpoint pattern for flow creation
165
+ const response = await client.post(`/api/v1/designer/${agentId}/flows/empty`, flowData);
166
+ // The NEWO flow creation API returns empty response body with 201 status
167
+ // The flow is created successfully, but we need to get the ID through agent listing
168
+ if (response.status === 201) {
169
+ // Flow created successfully, but ID will be retrieved during pull operation
170
+ return { id: 'pending-sync' };
171
+ }
172
+ throw new Error(`Flow creation failed with status: ${response.status}`);
173
+ }
174
+ export async function deleteFlow(client, flowId) {
175
+ await client.delete(`/api/v1/designer/flows/${flowId}`);
176
+ }
177
+ export async function createSkill(client, flowId, skillData) {
178
+ const response = await client.post(`/api/v1/designer/flows/${flowId}/skills`, skillData);
179
+ return response.data;
180
+ }
181
+ export async function deleteSkill(client, skillId) {
182
+ await client.delete(`/api/v1/designer/flows/skills/${skillId}`);
183
+ }
184
+ export async function deleteSkillById(client, skillId) {
185
+ console.log(`🗑️ Deleting skill from platform: ${skillId}`);
186
+ await client.delete(`/api/v1/designer/flows/skills/${skillId}`);
187
+ console.log(`✅ Skill deleted from platform: ${skillId}`);
188
+ }
189
+ export async function createFlowEvent(client, flowId, eventData) {
190
+ const response = await client.post(`/api/v1/designer/flows/${flowId}/events`, eventData);
191
+ return response.data;
192
+ }
193
+ export async function deleteFlowEvent(client, eventId) {
194
+ await client.delete(`/api/v1/designer/flows/events/${eventId}`);
195
+ }
196
+ export async function createFlowState(client, flowId, stateData) {
197
+ const response = await client.post(`/api/v1/designer/flows/${flowId}/states`, stateData);
198
+ return response.data;
199
+ }
200
+ export async function createSkillParameter(client, skillId, paramData) {
201
+ // Debug the parameter creation request
202
+ console.log('Creating parameter for skill:', skillId);
203
+ console.log('Parameter data:', JSON.stringify(paramData, null, 2));
204
+ try {
205
+ const response = await client.post(`/api/v1/designer/flows/skills/${skillId}/parameters`, paramData);
206
+ return response.data;
207
+ }
208
+ catch (error) {
209
+ console.error('Parameter creation error details:', error.response?.data);
210
+ throw error;
211
+ }
212
+ }
213
+ export async function createCustomerAttribute(client, attributeData) {
214
+ const response = await client.post('/api/v1/customer/attributes', attributeData);
215
+ return response.data;
216
+ }
217
+ export async function createProject(client, projectData) {
218
+ const response = await client.post('/api/v1/designer/projects', projectData);
219
+ return response.data;
220
+ }
221
+ export async function deleteProject(client, projectId) {
222
+ await client.delete(`/api/v1/designer/projects/${projectId}`);
223
+ }
224
+ export async function createPersona(client, personaData) {
225
+ const response = await client.post('/api/v1/customer/personas', personaData);
226
+ return response.data;
227
+ }
228
+ export async function publishFlow(client, flowId, publishData) {
229
+ const response = await client.post(`/api/v1/designer/flows/${flowId}/publish`, publishData);
230
+ return response.data;
231
+ }
232
+ // Sandbox Chat API Functions
233
+ export async function listIntegrations(client) {
234
+ const response = await client.get('/api/v1/integrations');
235
+ return response.data;
236
+ }
237
+ export async function listConnectors(client, integrationId) {
238
+ const response = await client.get(`/api/v1/integrations/${integrationId}/connectors`);
239
+ return response.data;
240
+ }
241
+ export async function createSandboxPersona(client, personaData) {
242
+ const response = await client.post('/api/v1/customer/personas', personaData);
243
+ return response.data;
244
+ }
245
+ export async function createActor(client, personaId, actorData) {
246
+ const response = await client.post(`/api/v1/customer/personas/${personaId}/actors`, actorData);
247
+ return response.data;
248
+ }
249
+ export async function sendChatMessage(client, actorId, messageData) {
250
+ await client.post(`/api/v1/chat/user/${actorId}`, messageData);
251
+ }
252
+ export async function getConversationActs(client, params) {
253
+ const queryParams = {
254
+ user_persona_id: params.user_persona_id,
255
+ user_actor_id: params.user_actor_id,
256
+ per: params.per || 100,
257
+ page: params.page || 1
258
+ };
259
+ // Only add agent_persona_id if provided
260
+ if (params.agent_persona_id) {
261
+ queryParams.agent_persona_id = params.agent_persona_id;
262
+ }
263
+ const response = await client.get('/api/v1/bff/conversations/acts', {
264
+ params: queryParams
265
+ });
266
+ return response.data;
267
+ }
154
268
  //# sourceMappingURL=api.js.map
package/dist/auth.js CHANGED
@@ -48,6 +48,10 @@ function validateUrl(url, name) {
48
48
  }
49
49
  // Enhanced logging function
50
50
  function logAuthEvent(level, message, meta) {
51
+ // Skip all logging if in quiet mode
52
+ if (process.env.NEWO_QUIET_MODE === 'true') {
53
+ return;
54
+ }
51
55
  const timestamp = new Date().toISOString();
52
56
  const logEntry = {
53
57
  timestamp,
@@ -0,0 +1,3 @@
1
+ import type { MultiCustomerConfig, CliArgs } from '../../types.js';
2
+ export declare function handleCreateAgentCommand(customerConfig: MultiCustomerConfig, args: CliArgs, verbose?: boolean): Promise<void>;
3
+ //# sourceMappingURL=create-agent.d.ts.map
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Create Agent Command Handler - Creates local folder structure
3
+ */
4
+ import { requireSingleCustomer } from '../customer-selection.js';
5
+ import { ensureState, agentMetadataPath, writeFileSafe, projectDir } from '../../fsutil.js';
6
+ import fs from 'fs-extra';
7
+ import yaml from 'js-yaml';
8
+ export async function handleCreateAgentCommand(customerConfig, args, verbose = false) {
9
+ try {
10
+ const selectedCustomer = requireSingleCustomer(customerConfig, args.customer);
11
+ // Parse arguments
12
+ const idn = args._[1];
13
+ const title = args.title || idn;
14
+ const description = args.description || '';
15
+ const projectIdn = args.project;
16
+ const personaId = args['persona-id'];
17
+ if (!idn) {
18
+ console.error('Error: Agent IDN is required');
19
+ console.error('Usage: newo create-agent <idn> --project <project-idn> [--title <title>] [--description <description>] [--persona-id <persona-id>]');
20
+ process.exit(1);
21
+ }
22
+ if (!projectIdn) {
23
+ console.error('Error: Project IDN is required');
24
+ console.error('Usage: newo create-agent <idn> --project <project-idn> [--title <title>] [--description <description>] [--persona-id <persona-id>]');
25
+ process.exit(1);
26
+ }
27
+ // Ensure state directory exists
28
+ await ensureState(selectedCustomer.idn);
29
+ // Check if project exists locally
30
+ const projDir = projectDir(selectedCustomer.idn, projectIdn);
31
+ if (!(await fs.pathExists(projDir))) {
32
+ console.error(`❌ Project '${projectIdn}' not found locally. Run 'newo pull' first or check project IDN.`);
33
+ process.exit(1);
34
+ }
35
+ // Check if agent already exists
36
+ const agentDir = `${projDir}/${idn}`;
37
+ if (await fs.pathExists(agentDir)) {
38
+ console.error(`❌ Agent '${idn}' already exists in project '${projectIdn}'`);
39
+ process.exit(1);
40
+ }
41
+ if (verbose) {
42
+ console.log(`📝 Creating agent locally: ${idn}`);
43
+ console.log(` Project: ${projectIdn}`);
44
+ console.log(` Title: ${title}`);
45
+ console.log(` Description: ${description}`);
46
+ console.log(` Persona ID: ${personaId || 'none'}`);
47
+ }
48
+ // Create agent directory
49
+ await fs.ensureDir(agentDir);
50
+ // Create agent metadata
51
+ const agentMetadata = {
52
+ id: '', // Will be set during push
53
+ idn,
54
+ title,
55
+ description,
56
+ persona_id: personaId || null,
57
+ created_at: new Date().toISOString(),
58
+ updated_at: new Date().toISOString()
59
+ };
60
+ // Save agent metadata
61
+ const metadataPath = agentMetadataPath(selectedCustomer.idn, projectIdn, idn);
62
+ const metadataYaml = yaml.dump(agentMetadata, { indent: 2, quotingType: '"', forceQuotes: false });
63
+ await writeFileSafe(metadataPath, metadataYaml);
64
+ console.log(`✅ Agent created locally`);
65
+ console.log(` IDN: ${idn}`);
66
+ console.log(` Title: ${title}`);
67
+ console.log(` Path: ${agentDir}`);
68
+ console.log(` Run 'newo push' to create on NEWO platform`);
69
+ }
70
+ catch (error) {
71
+ console.error('❌ Failed to create agent locally:', error instanceof Error ? error.message : String(error));
72
+ process.exit(1);
73
+ }
74
+ }
75
+ //# sourceMappingURL=create-agent.js.map
@@ -0,0 +1,3 @@
1
+ import type { MultiCustomerConfig, CliArgs } from '../../types.js';
2
+ export declare function handleCreateAttributeCommand(customerConfig: MultiCustomerConfig, args: CliArgs, verbose?: boolean): Promise<void>;
3
+ //# sourceMappingURL=create-attribute.d.ts.map
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Create Customer Attribute Command Handler
3
+ */
4
+ import { makeClient, createCustomerAttribute } from '../../api.js';
5
+ import { getValidAccessToken } from '../../auth.js';
6
+ import { requireSingleCustomer } from '../customer-selection.js';
7
+ export async function handleCreateAttributeCommand(customerConfig, args, verbose = false) {
8
+ try {
9
+ const selectedCustomer = requireSingleCustomer(customerConfig, args.customer);
10
+ // Parse arguments
11
+ const idn = args._[1];
12
+ const value = args.value || '';
13
+ const title = args.title || idn;
14
+ const description = args.description || '';
15
+ const group = args.group || 'General';
16
+ const isHidden = Boolean(args.hidden);
17
+ const valueType = args['value-type'] || 'string';
18
+ const possibleValues = args['possible-values'] ?
19
+ args['possible-values'].split(',').map(v => v.trim()) : [];
20
+ if (!idn) {
21
+ console.error('Error: Attribute IDN is required');
22
+ console.error('Usage: newo create-attribute <idn> --value <value> [--title <title>] [--description <desc>] [--group <group>] [--hidden] [--value-type <type>] [--possible-values <val1,val2>]');
23
+ process.exit(1);
24
+ }
25
+ if (!value) {
26
+ console.error('Error: Attribute value is required');
27
+ console.error('Usage: newo create-attribute <idn> --value <value> [options]');
28
+ process.exit(1);
29
+ }
30
+ if (verbose) {
31
+ console.log(`📝 Creating customer attribute: ${idn}`);
32
+ console.log(` Title: ${title}`);
33
+ console.log(` Value: ${value}`);
34
+ console.log(` Group: ${group}`);
35
+ console.log(` Type: ${valueType}`);
36
+ console.log(` Hidden: ${isHidden}`);
37
+ }
38
+ // Get access token and create client
39
+ const accessToken = await getValidAccessToken(selectedCustomer);
40
+ const client = await makeClient(verbose, accessToken);
41
+ // Create attribute on NEWO platform
42
+ const createAttributeRequest = {
43
+ idn,
44
+ value,
45
+ title,
46
+ description,
47
+ group,
48
+ is_hidden: isHidden,
49
+ possible_values: possibleValues,
50
+ value_type: valueType
51
+ };
52
+ const createResponse = await createCustomerAttribute(client, createAttributeRequest);
53
+ console.log(`✅ Customer attribute created: ${idn} (ID: ${createResponse.id})`);
54
+ console.log(` Title: ${title}`);
55
+ console.log(` Value: ${value}`);
56
+ console.log(` Group: ${group}`);
57
+ }
58
+ catch (error) {
59
+ console.error('❌ Failed to create customer attribute:', error instanceof Error ? error.message : String(error));
60
+ process.exit(1);
61
+ }
62
+ }
63
+ //# sourceMappingURL=create-attribute.js.map
@@ -0,0 +1,3 @@
1
+ import type { MultiCustomerConfig, CliArgs } from '../../types.js';
2
+ export declare function handleCreateEventCommand(customerConfig: MultiCustomerConfig, args: CliArgs, verbose?: boolean): Promise<void>;
3
+ //# sourceMappingURL=create-event.d.ts.map