@salsita-ai/sdk 0.50.0-develop.be40f0cee8 → 0.50.0-develop.bfba230ad7

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 (113) hide show
  1. package/dist/application-spec/generate-application/code/project-scaffolding.js +2 -2
  2. package/dist/application-spec/generate-application/code/templates/index.d.ts +1 -0
  3. package/dist/application-spec/generate-application/code/templates/index.js +1 -1
  4. package/dist/application-spec/generate-application/code/templates/skills/agents-md.js +1 -1
  5. package/dist/application-spec/generate-application/code/templates/skills/phoenix-cli-skill.js +1 -1
  6. package/dist/application-spec/generate-application/code/templates/skills/phoenix-create-configurator-skill.js +41 -13
  7. package/dist/application-spec/generate-application/code/templates/skills/phoenix-feedback-skill.js +1 -1
  8. package/dist/application-spec/generate-application/code/templates/skills/phoenix-review-skill.js +1 -1
  9. package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill.js +1 -1
  10. package/dist/application-spec/generate-application/code/templates/skills/phoenix-variants-skill.d.ts +1 -0
  11. package/dist/application-spec/generate-application/code/templates/skills/phoenix-variants-skill.js +6 -0
  12. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +28 -2
  13. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +19 -4
  14. package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.js +1 -1
  15. package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
  16. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +146 -13
  17. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
  18. package/dist/configurator/application-runtime/extensions/systems/assistant-system/change-recorder.d.ts +85 -0
  19. package/dist/configurator/application-runtime/extensions/systems/assistant-system/change-recorder.js +1 -0
  20. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +8 -3
  21. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
  22. package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.d.ts +4 -0
  23. package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.js +1 -1
  24. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +16 -1
  25. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
  26. package/dist/configurator/application-runtime/extensions/systems/graphql-system/side-effects.d.ts +9 -0
  27. package/dist/configurator/application-runtime/extensions/systems/graphql-system/side-effects.js +1 -0
  28. package/dist/configurator/application-runtime/extensions/systems/index.d.ts +1 -1
  29. package/dist/configurator/common/frontend-analytics.d.ts +21 -21
  30. package/dist/configurator/index.d.ts +0 -1
  31. package/dist/configurator/index.js +1 -1
  32. package/dist/configurator/pages/LoadedConfiguratorDetailPage.js +1 -1
  33. package/dist/configurator/scene/scene-analytics/scene-analytics.d.ts +2 -2
  34. package/dist/configurator/ui/assistant/AssistantComposer.d.ts +1 -6
  35. package/dist/configurator/ui/assistant/AssistantComposer.js +1 -1
  36. package/dist/configurator/ui/assistant/AssistantPanel.js +1 -1
  37. package/dist/configurator/ui/assistant/AssistantThread.d.ts +1 -6
  38. package/dist/configurator/ui/assistant/AssistantThread.js +1 -1
  39. package/dist/configurator/ui/assistant/index.d.ts +1 -1
  40. package/dist/configurator/ui/assistant/index.js +1 -1
  41. package/dist/configurator/ui/assistant/thread-items.d.ts +1 -1
  42. package/dist/configurator/ui/assistant/use-is-assistant-panel-open.d.ts +5 -0
  43. package/dist/configurator/ui/assistant/use-is-assistant-panel-open.js +1 -0
  44. package/dist/configurator/ui/configurator-layout/universal/DesktopLayout.js +2 -2
  45. package/dist/configurator/ui/configurator-layout/universal/Layout.js +1 -1
  46. package/dist/configurator/ui/configurator-layout/universal/MobileLayout.js +4 -4
  47. package/dist/configurator/ui/legacy/mobile-controls/MobileControls.d.ts +1 -1
  48. package/dist/configurator/ui/phoenix-layout-elements/AssistantToolbarButton.d.ts +2 -2
  49. package/dist/configurator/ui/phoenix-layout-elements/AssistantToolbarButton.js +1 -1
  50. package/dist/docs/index.json +1 -1
  51. package/dist/docs/layouts/toolbar.mdx +3 -1
  52. package/dist/docs/other-features/side-effects.mdx +26 -0
  53. package/dist/docs/phoenix/phoenix-cli.mdx +81 -2
  54. package/dist/docs/phoenix/project-structure.mdx +3 -2
  55. package/dist/docs/phoenix/sdk-builder-workflow.mdx +4 -3
  56. package/dist/domain/components/updates.d.ts +16 -0
  57. package/dist/domain/domain-context/index.d.ts +1 -1
  58. package/dist/domain/domain-context/store-system/store-system.js +1 -1
  59. package/dist/editor/Editor.js +1 -1
  60. package/dist/editor/graphql/GraphQLPanel.js +1 -1
  61. package/dist/editor/variants/VariantAnswerFooter.d.ts +17 -0
  62. package/dist/editor/variants/VariantAnswerFooter.js +1 -0
  63. package/dist/editor/variants/VariantPreviewHandler.d.ts +6 -0
  64. package/dist/editor/variants/VariantPreviewHandler.js +1 -0
  65. package/dist/editor/variants/variant-preview-styles.d.ts +49 -0
  66. package/dist/editor/variants/variant-preview-styles.js +1 -0
  67. package/dist/phoenix/application-spec/application-spec-builder.js +1 -1
  68. package/dist/phoenix/application-spec/generate-assistant-prompt.d.ts +3 -2
  69. package/dist/phoenix/application-spec/generate-assistant-prompt.js +1 -1
  70. package/dist/phoenix/cli.js +1 -1
  71. package/dist/phoenix/commands/deploy.js +2 -2
  72. package/dist/phoenix/commands/dev.js +5 -5
  73. package/dist/phoenix/commands/index.d.ts +1 -0
  74. package/dist/phoenix/commands/index.js +1 -1
  75. package/dist/phoenix/commands/story-dev.js +2 -2
  76. package/dist/phoenix/commands/variants.d.ts +35 -0
  77. package/dist/phoenix/commands/variants.js +1 -0
  78. package/dist/phoenix/editor-server/commands-router.d.ts +68 -1
  79. package/dist/phoenix/editor-server/commands-router.js +1 -1
  80. package/dist/phoenix/editor-server/editor-router.d.ts +65 -0
  81. package/dist/phoenix/editor-server/editor-server.d.ts +3 -3
  82. package/dist/phoenix/editor-server/editor-server.js +1 -1
  83. package/dist/phoenix/editor-server/protocol.d.ts +1 -0
  84. package/dist/phoenix/editor-server/spec-router.js +1 -1
  85. package/dist/phoenix/editor-server/trpc.d.ts +3 -0
  86. package/dist/phoenix/services/application-spec-project-watcher.d.ts +13 -2
  87. package/dist/phoenix/services/application-spec-project-watcher.js +3 -3
  88. package/dist/phoenix/services/index.d.ts +4 -0
  89. package/dist/phoenix/services/index.js +1 -1
  90. package/dist/phoenix/services/phoenix-application.d.ts +21 -0
  91. package/dist/phoenix/services/phoenix-application.js +1 -0
  92. package/dist/phoenix/services/phoenix-store.d.ts +48 -0
  93. package/dist/phoenix/services/phoenix-store.js +1 -0
  94. package/dist/phoenix/services/phx-variant-previews-plugin.d.ts +9 -0
  95. package/dist/phoenix/services/phx-variant-previews-plugin.js +1 -0
  96. package/dist/phoenix/services/variant-file-session.d.ts +36 -0
  97. package/dist/phoenix/services/variant-file-session.js +1 -0
  98. package/dist/phoenix/services/variant-preview-service.d.ts +80 -0
  99. package/dist/phoenix/services/variant-preview-service.js +1 -0
  100. package/dist/phoenix/services/vite-config.js +1 -1
  101. package/dist/react-sdk/application-runtime/common-services/analytics/analytics-service.d.ts +2 -2
  102. package/dist/react-sdk/application-runtime/common-services/analytics/domain-controls-analytics.d.ts +21 -21
  103. package/dist/react-sdk/application-runtime/hooks/data/use-published-data.d.ts +1 -1
  104. package/dist/ui-sdk/common/use-viewport-size.d.ts +4 -1
  105. package/dist/ui-sdk/common/use-viewport-size.js +1 -1
  106. package/dist/ui-sdk/components/mobile-controls/index.d.ts +1 -1
  107. package/package.json +4 -4
  108. package/dist/configurator/assistant/index.d.ts +0 -1
  109. package/dist/configurator/assistant/index.js +0 -1
  110. package/dist/configurator/assistant/use-assistant-chat.d.ts +0 -30
  111. package/dist/configurator/assistant/use-assistant-chat.js +0 -1
  112. package/dist/configurator/ui/assistant/AssistantPanelProvider.d.ts +0 -42
  113. package/dist/configurator/ui/assistant/AssistantPanelProvider.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salsita-ai/sdk",
3
- "version": "0.50.0-develop.be40f0cee8",
3
+ "version": "0.50.0-develop.bfba230ad7",
4
4
  "description": "TypeScript SDK and CLI for building, running, and deploying Phoenix configurator applications.",
5
5
  "keywords": [
6
6
  "salsita",
@@ -221,7 +221,7 @@
221
221
  "@swc/core": "1.15.40",
222
222
  "@swc/wasm-web": "1.15.40",
223
223
  "@tanstack/ai": "0.64.0",
224
- "@tanstack/ai-react": "0.29.4",
224
+ "@tanstack/ai-client": "0.36.1",
225
225
  "@trpc/client": "11.17.0",
226
226
  "@trpc/react-query": "11.17.0",
227
227
  "@trpc/server": "11.17.0",
@@ -292,8 +292,8 @@
292
292
  "yaml": "2.9.0",
293
293
  "yargs": "17.7.2",
294
294
  "zod": "3.25.76",
295
- "@salsita-ai/common": "0.50.0-develop.be40f0cee8",
296
- "@salsita-ai/contracts": "0.50.0-develop.be40f0cee8"
295
+ "@salsita-ai/common": "0.50.0-develop.bfba230ad7",
296
+ "@salsita-ai/contracts": "0.50.0-develop.bfba230ad7"
297
297
  },
298
298
  "devDependencies": {
299
299
  "@clerk/clerk-react": "5.61.8",
@@ -1 +0,0 @@
1
- export { useAssistantChat, type AssistantChatState } from './use-assistant-chat.js';
@@ -1 +0,0 @@
1
- export{useAssistantChat}from"./use-assistant-chat.js";
@@ -1,30 +0,0 @@
1
- import { type UIMessage } from '@tanstack/ai-react';
2
- /** Assistant chat state and actions of the current configuration. */
3
- export interface AssistantChatState {
4
- /** The thread as painted: hydrated from the server, then streamed. */
5
- readonly messages: ReadonlyArray<UIMessage>;
6
- /** True while a reply streams or a browser tool runs. */
7
- readonly isLoading: boolean;
8
- readonly error: Error | undefined;
9
- /**
10
- * HTTP status of the latest request the server answered with a failure, for telling a refusal from
11
- * a dropped connection when `error` is set. Nothing when the latest answered request succeeded or
12
- * the server was never reached.
13
- */
14
- readonly failedStatus: number | undefined;
15
- /** False when the server said this session may read the thread but not add to it. */
16
- readonly isContinuable: boolean;
17
- /** False until the first request of the chat, the thread read, was answered or failed. */
18
- readonly isLoaded: boolean;
19
- /** Sends a user message stamped with its send time. */
20
- readonly send: (content: string) => Promise<void>;
21
- /** Stops the current reply in the browser and on the server. */
22
- readonly stop: () => Promise<void>;
23
- }
24
- /**
25
- * The conversational assistant of the current configuration. The server owns the thread — the chat
26
- * hydrates from it on mount and rejoins a reply still streaming — so the hook keeps nothing in
27
- * browser storage. Each message carries its send time for the model. The model's `query` and
28
- * `apply` calls run here, in the browser, against the configurator this hook is rendered in.
29
- */
30
- export declare const useAssistantChat: () => AssistantChatState;
@@ -1 +0,0 @@
1
- import{fetchServerSentEvents as t,useChat as e}from"@tanstack/ai-react";import{useCallback as a,useMemo as n,useState as r}from"react";import{useApplicationRuntimeSelector as s,useAuthorizedClient as o,useConfigurationId as i,useLogger as c}from"#package/react-sdk";import{useConfigurator as l}from"../application-runtime/index.js";export const useAssistantChat=()=>{let u=i(),h=o(),d=c(),[p,m]=r(),[f,w]=r(!0),[y,g]=r(!1),C=a(()=>h.getAssistantChatConnection(u),[h,u]),k=n(()=>{let e=async(t,e)=>{let a=await fetch(t,e).finally(()=>g(!0)),n=a.headers.get("x-assistant-thread-continuable");return m(a.ok?void 0:a.status),null!=n&&w("false"!==n),a},a=async()=>({headers:await C().headers(),fetchClient:e}),n=t(()=>C().url,a),r=t(()=>`${C().url}/runs`,a);return{...n,joinRun:r.joinRun}},[C]),{assistantSystem:S}=l(),{messages:$,isLoading:j,error:x,sendMessage:A,stop:I,runId:R}=e({threadId:`assistant:${u}`,connection:k,persistence:!0,history:{pageSize:50},tools:s(S.getTools)}),v=a(async t=>{let e={sentAt:new Date().toISOString()};await A({content:t,metadata:e})},[A]),O=a(async()=>{if(I(),null!=R)try{let t=C();await fetch(`${t.url}/runs/${encodeURIComponent(R)}/cancel`,{method:"POST",headers:await t.headers()})}catch(t){d.warn("Could not cancel the assistant run on the server",{error:t})}},[C,d,R,I]);return n(()=>({messages:$,isLoading:j,error:x,failedStatus:p,isContinuable:f,isLoaded:y,send:v,stop:O}),[$,j,x,p,f,y,v,O])};
@@ -1,42 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import { type AssistantChatState } from '../../assistant/index.js';
3
- /**
4
- * The built-in assistant panel of a universal layout as the layout and the toolbar button see it:
5
- * whether it is open, and the few facts about it they render. It changes only when one of those does.
6
- */
7
- export interface AssistantPanelState {
8
- readonly open: boolean;
9
- readonly setOpen: (open: boolean) => void;
10
- /** True when a reply finished while the panel was closed and the panel was not opened since. */
11
- readonly hasUnreadReply: boolean;
12
- /** True while the message input has focus; a phone layout gives the panel the whole screen then. */
13
- readonly isInputFocused: boolean;
14
- readonly setInputFocused: (isInputFocused: boolean) => void;
15
- }
16
- /** The conversation of the assistant panel. It changes with every chunk of a streaming reply. */
17
- export interface AssistantPanelConversation {
18
- /** Nothing until the chat of the current attempt has mounted. */
19
- readonly chat: AssistantChatState | undefined;
20
- /**
21
- * Loads the thread from the server again, rejoining a reply that is still running there. It never
22
- * sends a message again, because the server may already hold it; a message that did not reach the
23
- * server is therefore gone from the thread and has to be written again.
24
- */
25
- readonly reloadThread: () => void;
26
- }
27
- /**
28
- * The assistant panel of the layout this is rendered in, or nothing when the application spec has no
29
- * `assistant` section or the layout does not carry the panel.
30
- */
31
- export declare const useAssistantPanel: () => AssistantPanelState | undefined;
32
- /** The conversation of the assistant panel, under the same conditions as {@link useAssistantPanel}. */
33
- export declare const useAssistantPanelConversation: () => AssistantPanelConversation | undefined;
34
- export interface AssistantPanelProviderProps {
35
- readonly children: ReactNode;
36
- }
37
- /**
38
- * Owns the open state of the assistant panel and the single chat of the layout below it. The chat
39
- * lives here and not in the panel, so a reply keeps streaming while the panel is closed. Without an
40
- * `assistant` section in the application spec no chat is mounted and no request reaches the server.
41
- */
42
- export declare const AssistantPanelProvider: ({ children }: AssistantPanelProviderProps) => import("react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- import{jsx as e,jsxs as r}from"react/jsx-runtime";import{createContext as t,useCallback as s,useContext as o,useEffect as n,useMemo as a,useRef as i,useState as l}from"react";import{useLogger as d,useSpecAssistant as u}from"#package/react-sdk";import{useAssistantChat as c}from"../../assistant/index.js";let v=t(void 0),m=t(void 0);export const useAssistantPanel=()=>o(v);export const useAssistantPanelConversation=()=>o(m);let p=({onChange:e})=>{let r=c();return n(()=>{e(r)},[r,e]),n(()=>()=>{e(void 0)},[e]),null};export const AssistantPanelProvider=({children:t})=>{let o=u(),[c,x]=l(),[f,P]=l(!1),[h,j]=l(!1),[g,A]=l(0),[k,C]=l(!1),q=d(),L=s(e=>{P(e),e?j(!1):C(!1)},[]),S=c?.isLoading??!1,T=i(!1),b=s(()=>{T.current=!1,A(e=>e+1)},[]);n(()=>{!T.current||S||f||null==c||j(!0),T.current=S},[c,S,f]);let w=c?.error,y=c?.failedStatus;n(()=>{w&&q.error("The assistant request failed",{status:y},w)},[w,y,q]);let z=a(()=>o?{open:f,setOpen:L,hasUnreadReply:h,isInputFocused:k,setInputFocused:C}:void 0,[o,f,L,h,k]),B=a(()=>o?{chat:c,reloadThread:b}:void 0,[o,c,b]);return e(v.Provider,{value:z,children:r(m.Provider,{value:B,children:[o&&e(p,{onChange:x},g),t]})})};