@alpaca-editor/core 1.0.4177 → 1.0.4180

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 (32) hide show
  1. package/dist/agents-view/AgentsView.d.ts +2 -2
  2. package/dist/agents-view/AgentsView.js +105 -62
  3. package/dist/agents-view/AgentsView.js.map +1 -1
  4. package/dist/editor/ai/Agents.js +15 -7
  5. package/dist/editor/ai/Agents.js.map +1 -1
  6. package/dist/editor/ai/useAgentStatus.js +6 -1
  7. package/dist/editor/ai/useAgentStatus.js.map +1 -1
  8. package/dist/editor/services/agentService.d.ts +24 -2
  9. package/dist/editor/services/agentService.js +25 -18
  10. package/dist/editor/services/agentService.js.map +1 -1
  11. package/dist/editor/services/aiService.d.ts +1 -0
  12. package/dist/editor/services/aiService.js +1 -1
  13. package/dist/editor/services/aiService.js.map +1 -1
  14. package/dist/page-wizard/steps/ContentStep.js +1 -0
  15. package/dist/page-wizard/steps/ContentStep.js.map +1 -1
  16. package/dist/page-wizard/steps/SelectStep.js +7 -3
  17. package/dist/page-wizard/steps/SelectStep.js.map +1 -1
  18. package/dist/page-wizard/steps/usePageCreator.js +5 -0
  19. package/dist/page-wizard/steps/usePageCreator.js.map +1 -1
  20. package/dist/revision.d.ts +2 -2
  21. package/dist/revision.js +2 -2
  22. package/dist/styles.css +12 -0
  23. package/package.json +1 -1
  24. package/src/agents-view/AgentsView.tsx +303 -208
  25. package/src/editor/ai/Agents.tsx +17 -7
  26. package/src/editor/ai/useAgentStatus.ts +6 -1
  27. package/src/editor/services/agentService.ts +54 -23
  28. package/src/editor/services/aiService.ts +5 -1
  29. package/src/page-wizard/steps/ContentStep.tsx +1 -0
  30. package/src/page-wizard/steps/SelectStep.tsx +8 -3
  31. package/src/page-wizard/steps/usePageCreator.ts +5 -0
  32. package/src/revision.ts +2 -2
@@ -75,9 +75,18 @@ export type AgentStatus =
75
75
  export type Agent = {
76
76
  id: string;
77
77
  name: string;
78
+ description?: string;
78
79
  userId: string;
79
80
  updatedDate: string;
80
81
  status: AgentStatus;
82
+ isShared?: boolean;
83
+ ownerName?: string;
84
+ profileId?: string;
85
+ profileName?: string;
86
+ profileSvgIcon?: string;
87
+ messageCount?: number;
88
+ totalCost?: number;
89
+ totalTokensUsed?: number;
81
90
  };
82
91
 
83
92
  export type AgentDetails = Agent & {
@@ -494,18 +503,43 @@ export async function getAgent(agentId: string): Promise<AgentDetails> {
494
503
  return result.data!;
495
504
  }
496
505
 
506
+ export interface GetAgentsParams {
507
+ skip?: number;
508
+ limit?: number;
509
+ includeShared?: boolean;
510
+ includeOwned?: boolean;
511
+ searchTerm?: string;
512
+ }
513
+
514
+ export interface GetAgentsResponse {
515
+ agents: Agent[];
516
+ totalCount: number;
517
+ hasMore: boolean;
518
+ }
519
+
497
520
  /**
498
- * Gets all agents for the current user
521
+ * Gets all agents for the current user with pagination and search support
499
522
  */
500
- export async function getActiveAgents(limit?: number): Promise<Agent[]> {
501
- const params = new URLSearchParams();
502
- if (limit) params.append("limit", limit.toString());
503
-
504
- const queryString = params.toString();
523
+ export async function getActiveAgents(
524
+ params?: GetAgentsParams,
525
+ ): Promise<GetAgentsResponse> {
526
+ const queryParams = new URLSearchParams();
527
+
528
+ if (params?.skip !== undefined)
529
+ queryParams.append("skip", params.skip.toString());
530
+ if (params?.limit !== undefined)
531
+ queryParams.append("limit", params.limit.toString());
532
+ if (params?.includeShared !== undefined)
533
+ queryParams.append("includeShared", params.includeShared.toString());
534
+ if (params?.includeOwned !== undefined)
535
+ queryParams.append("includeOwned", params.includeOwned.toString());
536
+ if (params?.searchTerm) queryParams.append("searchTerm", params.searchTerm);
537
+
538
+ const queryString = queryParams.toString();
505
539
  const url =
506
540
  AGENT_BASE_URL + "/getAgents" + (queryString ? `?${queryString}` : "");
507
541
 
508
- const result = await get<Agent[]>(url);
542
+ const result = await get<GetAgentsResponse>(url);
509
543
 
510
544
  if (result.type !== "success") {
511
545
  throw new Error(
@@ -513,30 +547,27 @@ export async function getActiveAgents(limit?: number): Promise<Agent[]> {
513
547
  );
514
548
  }
515
549
 
516
- return result.data || [];
550
+ return result.data || { agents: [], totalCount: 0, hasMore: false };
517
551
  }
518
552
 
519
553
  /**
520
554
  * Gets all closed agents for the current user
555
+ * @deprecated Use getActiveAgents() instead - the backend now returns all agents (including closed) by default
521
556
  */
522
557
  export async function getClosedAgents(limit?: number): Promise<Agent[]> {
523
- const params = new URLSearchParams();
524
- params.append("status", "closed");
525
- if (limit) params.append("limit", limit.toString());
526
-
527
- const queryString = params.toString();
528
- const url =
529
- AGENT_BASE_URL + "/getAgents" + (queryString ? `?${queryString}` : "");
530
-
531
- const result = await get<Agent[]>(url);
558
+ // Use the new endpoint format which returns all agents including closed ones
559
+ const response = await getActiveAgents({
560
+ limit: limit || 1000,
561
+ includeShared: false, // Only get user's own closed agents
562
+ includeOwned: true,
563
+ });
532
564
 
533
- if (result.type !== "success") {
534
- throw new Error(
535
- `Failed to get closed agents: ${result.summary || "Unknown error"} ${result.details || ""}`,
536
- );
537
- }
565
+ // Filter to only closed agents on the client side
566
+ const closedAgents = response.agents.filter(
567
+ (agent) => agent.status === "closed" || agent.status === 5, // 5 is the numeric value for Closed
568
+ );
538
569
 
539
- return result.data || [];
570
+ return closedAgents;
540
571
  }
541
572
 
542
573
  /**
@@ -444,9 +444,13 @@ export async function generateImage(
444
444
  prompt: string;
445
445
  sessionId: string;
446
446
  pageItem: ItemDescriptor;
447
+ wizardId: ItemDescriptor;
447
448
  },
448
449
  ): Promise<ExecutionResult<any>> {
449
- const response = await post("/alpaca/editor/agent/generateImage", options);
450
+ const response = await post(
451
+ "/alpaca/editor/page-wizard/generateImage",
452
+ options,
453
+ );
450
454
  return response;
451
455
  }
452
456
  export async function requestQuota() {
@@ -797,6 +797,7 @@ export function ContentStep({
797
797
  Generate a descriptive name for each component including the topic.
798
798
  Only use component types that are in the page schema.
799
799
  Keep existing components with their ids. Leave id field empty for new components.
800
+ To generate images write generate: <keywords> into the picture / image field value.
800
801
  ${(existingPageModel && `Existing page model: ${JSON.stringify(existingPageModel)}`) || ""}
801
802
  Fill empty fields of existing components before you insert new components. Page fields: ${JSON.stringify(
802
803
  schema.pageFields.map((f: SchemaField) => {
@@ -125,7 +125,7 @@ export function SelectStep({
125
125
 
126
126
  // Call the executePromptWithJsonResult function with the prompt
127
127
  const abortController = new AbortController();
128
- const options = await executePromptWithJsonResult<Option[]>(
128
+ const result = await executePromptWithJsonResult<Option[] | Response>(
129
129
  [
130
130
  {
131
131
  content: `You are a helpful assistant that generates options for a wizard select step.
@@ -150,11 +150,16 @@ Create ${step.fields.numberOfOptions || 5} relevant options.`,
150
150
  { signal: abortController.signal },
151
151
  );
152
152
 
153
+ // Handle both array and object responses
154
+ const optionsArray = Array.isArray(result)
155
+ ? result
156
+ : (result as Response)?.options || [];
157
+
153
158
  // Set the parsed options
154
- setOptions(options);
159
+ setOptions(optionsArray);
155
160
  setInternalState((state: any) => ({
156
161
  ...state,
157
- [step.id + "options"]: options,
162
+ [step.id + "options"]: optionsArray,
158
163
  }));
159
164
  } catch (err) {
160
165
  const errorMessage =
@@ -343,6 +343,11 @@ export function usePageCreator(
343
343
  prompt: rawValue,
344
344
  sessionId: editContext.sessionId,
345
345
  pageItem: getItemDescriptor(pageItem),
346
+ wizardId: {
347
+ id: wizard.id,
348
+ language: pageItem.language,
349
+ version: pageItem.version,
350
+ },
346
351
  });
347
352
  } else {
348
353
  if (rawValue.startsWith("id:")) {
package/src/revision.ts CHANGED
@@ -1,2 +1,2 @@
1
- export const version = "1.0.4177";
2
- export const buildDate = "2025-10-21 14:56:45";
1
+ export const version = "1.0.4180";
2
+ export const buildDate = "2025-10-22 02:00:13";