@salsita-ai/sdk 0.50.0-develop.da56a0c6c3 → 0.50.0-develop.ea458ea381
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/dist/application-spec/errors/diagnostic-codes.d.ts +6 -0
- package/dist/application-spec/errors/diagnostic-codes.js +1 -1
- package/dist/application-spec/errors/diagnostic-messages.d.ts +6 -0
- package/dist/application-spec/errors/diagnostic-messages.js +1 -1
- package/dist/application-spec/generate-application/code/domain-runtime-files.js +1 -1
- package/dist/application-spec/generate-application/code/templates/application-types.js +6 -6
- package/dist/application-spec/generate-application/code/templates/configurator-domain-code.d.ts +1 -0
- package/dist/application-spec/generate-application/code/templates/configurator-domain-code.js +11 -8
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-domain-block.d.ts +3 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-domain-block.js +70 -66
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-phx-globals.js +3 -0
- package/dist/application-spec/generate-application/code/templates/domain-spec.js +5 -5
- package/dist/application-spec/generate-application/code/templates/domain.js +2 -2
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-action-types.d.ts +11 -0
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-action-types.js +8 -0
- package/dist/application-spec/generate-application/code/templates/global-definition/index.d.ts +1 -0
- package/dist/application-spec/generate-application/code/templates/global-definition/index.js +1 -1
- package/dist/application-spec/generate-application/code/templates/globals.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-review-skill.js +4 -2
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +3 -1
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +2 -2
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.d.ts +2 -0
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/actions-runtime.d.ts +14 -0
- package/dist/application-spec/generate-application/runtime/sections/actions-runtime.js +1 -0
- package/dist/application-spec/generate-application/runtime/sections/index.d.ts +1 -0
- package/dist/application-spec/generate-application/runtime/sections/index.js +1 -1
- package/dist/application-spec/parse-application-files/categorize/categorize-files.d.ts +3 -1
- package/dist/application-spec/parse-application-files/categorize/categorize-files.js +1 -1
- package/dist/application-spec/parse-application-files/merge/index.d.ts +1 -0
- package/dist/application-spec/parse-application-files/merge/index.js +1 -1
- package/dist/application-spec/parse-application-files/merge/merged-actions.d.ts +11 -0
- package/dist/application-spec/parse-application-files/merge/merged-actions.js +1 -0
- package/dist/application-spec/parse-application-files/merge/merged-spec.d.ts +2 -0
- package/dist/application-spec/parse-application-files/merge/merged-spec.js +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/index.d.ts +1 -0
- package/dist/application-spec/parse-application-files/raw-spec/index.js +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/raw-actions.d.ts +18 -0
- package/dist/application-spec/parse-application-files/raw-spec/raw-actions.js +1 -0
- package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.d.ts +14 -2
- package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.js +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/raw-spec-file.d.ts +2 -0
- package/dist/application-spec/parse-application-files/raw-spec/raw-spec-file.js +1 -1
- package/dist/application-spec/parse-application-files/resolve/resolve-import-modules.js +1 -1
- package/dist/application-spec/parse-application-files/spec/application/application-spec.js +1 -1
- package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.d.ts +4 -2
- package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.js +1 -1
- package/dist/application-spec/parse-application-files/spec/common/index.d.ts +1 -0
- package/dist/application-spec/parse-application-files/spec/common/index.js +1 -1
- package/dist/application-spec/parse-application-files/spec/common/schema-ref-resolver.d.ts +23 -0
- package/dist/application-spec/parse-application-files/spec/common/schema-ref-resolver.js +1 -0
- package/dist/application-spec/parse-application-files/spec/model/names/action-name.d.ts +10 -0
- package/dist/application-spec/parse-application-files/spec/model/names/action-name.js +1 -0
- package/dist/application-spec/parse-application-files/spec/model/names/index.d.ts +1 -0
- package/dist/application-spec/parse-application-files/spec/model/names/index.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/actions.d.ts +35 -0
- package/dist/application-spec/parse-application-files/spec/sections/actions.js +1 -0
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-field-type.d.ts +3 -14
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-field-type.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.d.ts +12 -3
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant.d.ts +5 -3
- package/dist/application-spec/parse-application-files/spec/sections/index.d.ts +1 -0
- package/dist/application-spec/parse-application-files/spec/sections/index.js +1 -1
- package/dist/configurator/application-runtime/extensions/configurator-extension-systems.d.ts +2 -1
- package/dist/configurator/application-runtime/extensions/configurator-extension-systems.js +1 -1
- package/dist/configurator/application-runtime/extensions/selectors.d.ts +2 -1
- package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +35 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -0
- package/dist/configurator/{assistant → application-runtime/extensions/systems/assistant-system}/browser-details.d.ts +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/browser-details.js +1 -0
- package/dist/configurator/{assistant → application-runtime/extensions/systems/assistant-system}/graphql-tools.d.ts +13 -14
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/index.d.ts +1 -0
- package/dist/configurator/application-runtime/extensions/systems/index.js +1 -1
- package/dist/configurator/assistant/use-assistant-chat.js +1 -1
- package/dist/docs/index.json +12 -2
- package/dist/docs/other-features/domain-actions.mdx +418 -0
- package/dist/docs/phoenix/best-practices.mdx +1 -0
- package/dist/docs/phoenix/phoenix-cli.mdx +4 -2
- package/dist/docs/phoenix/project-structure.mdx +3 -0
- package/dist/docs/phoenix/sdk-builder-workflow.mdx +2 -2
- package/dist/domain/actions/action-factory.d.ts +10 -0
- package/dist/domain/actions/action-factory.js +1 -0
- package/dist/domain/actions/prepare-action-implementations.d.ts +15 -0
- package/dist/domain/actions/prepare-action-implementations.js +5 -0
- package/dist/domain/application/application-config.d.ts +3 -1
- package/dist/domain/application/assistant-mutations.d.ts +15 -14
- package/dist/domain/application/assistant-mutations.js +1 -1
- package/dist/domain/core/action.d.ts +67 -0
- package/dist/domain/core/action.js +1 -0
- package/dist/domain/core/domain-factory.d.ts +4 -0
- package/dist/domain/core/index.d.ts +1 -0
- package/dist/domain/domain-builder.d.ts +7 -0
- package/dist/domain/domain-builder.js +1 -1
- package/dist/domain/domain-context/action-system/action-system.d.ts +40 -0
- package/dist/domain/domain-context/action-system/action-system.js +1 -0
- package/dist/domain/domain-context/domain-context-systems.d.ts +5 -2
- package/dist/domain/domain-context/index.d.ts +1 -0
- package/dist/domain/domain-context/index.js +1 -1
- package/dist/domain/domain-runtime/domain-context/domain-context.js +1 -1
- package/dist/domain/domain-runtime/domain-context/selectors.d.ts +4 -0
- package/dist/domain/domain-runtime/domain-context/selectors.js +1 -1
- package/dist/domain/domain-runtime/domain-runtime.d.ts +12 -0
- package/dist/domain/domain-runtime/spec/initialize.js +1 -1
- package/dist/domain/domain-runtime/spec/types.d.ts +15 -1
- package/dist/domain/index.d.ts +2 -0
- package/dist/domain/index.js +1 -1
- package/dist/domain/mocks/create-mock-domain-runtime.d.ts +6 -0
- package/dist/editor/domain-editors/DomainSpecContext.js +1 -1
- package/dist/editor/domain-editors/apply-spec-update.js +1 -1
- package/dist/editor/domain-editors/use-implementation-files.d.ts +7 -3
- package/dist/editor/domain-editors/use-implementation-files.js +1 -1
- package/dist/phoenix/application-spec/generate-assistant-prompt.d.ts +2 -2
- package/dist/phoenix/application-spec/generate-assistant-prompt.js +1 -1
- package/dist/phoenix/commands/login.d.ts +24 -6
- package/dist/phoenix/commands/login.js +2 -2
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +12 -0
- package/dist/react-sdk/domain-context/common-hooks/use-domain-context.d.ts +3 -0
- package/package.json +3 -3
- package/dist/configurator/assistant/browser-details.js +0 -1
- package/dist/configurator/assistant/graphql-tools.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveImportedTransformers as e}from"#package/domain";import{getPhoenixThemes as t}from"#package/ui-sdk";import{getCustomComponentOptics as n}from"./use-implementation-files.js";let s=s=>{var o;let a,
|
|
1
|
+
import{resolveImportedTransformers as e}from"#package/domain";import{getPhoenixThemes as t}from"#package/ui-sdk";import{getCustomComponentOptics as n}from"./use-implementation-files.js";let s=s=>{var o;let i,a,{runtime:r,implementationFiles:m,previousSpec:c}=s,p=r.configurator,l=c.configurator,u=m.handlers?.handlers??l.handlers,f=m.handlers?((e,t,n)=>{let s={};for(let o of e)s[o.name]=t?.[o.name]??n?.[o.name]??o.name;return s})(u,m.handlers.nameHashes,l.handlerHashes):l.handlerHashes,d=m.elements?.elements??l.elements,h=m.elements?((e,t,n)=>{let s={},o=0;for(let i of e)if("entity"===i.type||"layout"===i.type)s[i.name]=t?.[i.name]??n?.[i.name]??i.name;else{let e=`icon:${o}`;s[e]=t?.[e]??n?.[e]??`${e}:${i.elements.length}`,o+=1}return s})(d,m.elements.nameHashes,l.elementHashes):l.elementHashes,g=null!==m.customComponentOptics,R=p.componentOptics.changed||g?[...p.componentOptics.optics.map(e=>e.optic),...m.customComponentOptics??n(l.componentOptics)]:l.componentOptics,x=p.transformersRuntime.changed?t=>e(p.transformersRuntime.importedTransformers,p.transformersRuntime.specTransformers,t):l.createTransformers;return{presets:p.presetRuntime.changed?p.presetRuntime.presets:l.presets,theme:p.themeRuntime.changed?(o=p.themeRuntime,i=t(),a=Object.entries(i).find(([e])=>e===o.preset)?.[1]??{},Object.keys(o.options).length>0?{...a,...o.options}:a):l.theme,assistant:p.assistantRuntime.changed?p.assistantRuntime.assistant:l.assistant,navigationStates:p.statesRuntime.changed?p.statesRuntime.navigationStates:l.navigationStates,viewStates:p.statesRuntime.changed?p.statesRuntime.viewStates:l.viewStates,toolStates:p.statesRuntime.changed?p.statesRuntime.toolStates:l.toolStates,exportStates:p.statesRuntime.changed?p.statesRuntime.exportStates:l.exportStates,componentOptics:R,createTransformers:x,handlers:u,handlerHashes:f,elements:d,elementHashes:h}};export const prepareRuntimeRefresh=e=>{let{runtime:t,previousSpec:n}=e,o=n.configurator,i=s(e),a=t.configurator.expressionRuntime.changed?t.configurator.expressionRuntime.merged:o.expressions,r=t.configurator.actionsRuntime.changed?t.configurator.actionsRuntime.definitions:o.actions,m=e.implementationFiles.actionImplementations??o.actionImplementations;return{nextSpec:{...n,configurator:{...o,...i,expressions:a,actions:r,actionImplementations:m}}}};export const prepareRuntimeReset=e=>{let{runtime:t,previousSpec:n}=e,o=n.configurator,i=s(e),a=t.configurator.expressionRuntime.merged,r=t.configurator.actionsRuntime.definitions,m=e.implementationFiles.actionImplementations??o.actionImplementations,c=t.configurator.modelRuntime.domainBuilder.withExpressions(a).withActions(Object.values(r)).withActionImplementations(m).build(),p=i.presets[0];if(void 0===p)throw Error("Cannot reset the configurator after a model change because the application spec has no presets.");return{firstPreset:p,nextSpec:{...n,configurator:{...o,...i,modelVersion:c.context.modelVersion,factory:c,aliasMap:c.context.aliasMap,entityReflections:c.context.entityReflections,$entityReflections:c.context.$entityReflections,expressions:a,actions:r,actionImplementations:m,allowedRootEntityTypes:c.context.allowedRootEntityTypes,migrate:c.context.migrate}}}};let o=(e,t)=>{e.actions.spec.updateSpec(t)};export const applyRuntimeRefresh=(e,t)=>o(e,t.nextSpec);export const applyRuntimeReset=(e,t,n)=>{o(e,t.nextSpec),e.actions.loadedData.completeConfiguratorLoad({initialRevisionId:n,initialEntities:t.firstPreset.initialDomainEntities,modelVersion:t.nextSpec.configurator.modelVersion,rootEntityType:t.firstPreset.rootEntityType,schemaIdentity:t.nextSpec.configurator.factory})};export const applySpecUpdate=(e,t)=>o(e,t.nextSpec);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Application, ExpressionImplementations, InvariantImplementations } from '#package/application-spec';
|
|
2
|
-
import { type DomainComponentOptic, type DomainEntity, type ElementRegistration, type HandlerRegistration, type ImportedTransformer, type SystemComponentTypeConstraint } from '#package/domain';
|
|
2
|
+
import { type AnyActionImplementations, type DomainComponentOptic, type DomainEntity, type ElementRegistration, type HandlerRegistration, type ImportedTransformer, type SystemComponentTypeConstraint } from '#package/domain';
|
|
3
3
|
type AnyImportedTransformer = ImportedTransformer<any, any, any, any, any, any, any>;
|
|
4
4
|
type RuntimeData = Record<string, unknown>;
|
|
5
5
|
type RuntimeEntity = DomainEntity<string>;
|
|
@@ -23,11 +23,13 @@ export interface ReloadError {
|
|
|
23
23
|
* The freshly reloaded (or cached) implementation files needed to build an `ApplicationRuntime`.
|
|
24
24
|
*
|
|
25
25
|
* `implementations`, `adminImplementations`, `invariantImplementations`, `importedTransformers` and `customComponentOptics` always contain the latest
|
|
26
|
-
* successfully loaded values.
|
|
26
|
+
* successfully loaded values. So does `actionImplementations`, which is `null` only until the first successful load: a round
|
|
27
|
+
* that loaded them may be dropped before it is applied, and the next round must still carry them.
|
|
27
28
|
* `handlers`/`elements` are `null` when their category did not change this round.
|
|
28
29
|
*/
|
|
29
30
|
export interface ImplementationFiles {
|
|
30
31
|
readonly implementations: ExpressionImplementations;
|
|
32
|
+
readonly actionImplementations: AnyActionImplementations | null;
|
|
31
33
|
readonly adminImplementations?: ExpressionImplementations;
|
|
32
34
|
readonly invariantImplementations: InvariantImplementations;
|
|
33
35
|
readonly importedTransformers: readonly AnyImportedTransformer[];
|
|
@@ -40,6 +42,8 @@ export interface GetImplementationFilesProps {
|
|
|
40
42
|
readonly application: Application;
|
|
41
43
|
readonly projectRoot: string;
|
|
42
44
|
}
|
|
45
|
+
/** Merges the default exports of the `src/actions/` modules by action name, as the generated barrel does. */
|
|
46
|
+
export declare const resolveActionModules: (modules: readonly AnyActionImplementations[]) => AnyActionImplementations;
|
|
43
47
|
type ExpressionModules = ReadonlyArray<Record<string, Record<string, unknown>>>;
|
|
44
48
|
type ResolvedExpressions = ExpressionImplementations;
|
|
45
49
|
export declare const resolveExpressionModules: (modules: ExpressionModules, aliasMap: Record<string, readonly string[]>) => ResolvedExpressions;
|
|
@@ -50,7 +54,7 @@ export declare const getCustomComponentOptics: <ComponentOptic extends {
|
|
|
50
54
|
}>(componentOptics: readonly ComponentOptic[]) => readonly ComponentOptic[];
|
|
51
55
|
/**
|
|
52
56
|
* Owns the should-reload gating and cross-update caching for project implementation files
|
|
53
|
-
* (expressions, invariants, components, transformers, handlers, elements). Returns `getImplementationFiles`,
|
|
57
|
+
* (expressions, actions, invariants, components, transformers, handlers, elements). Returns `getImplementationFiles`,
|
|
54
58
|
* which reloads changed categories and returns the merged set with per-category reload errors.
|
|
55
59
|
* Invariants also retry failed imports and refresh when their generated declarations change.
|
|
56
60
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as e,useRef as n}from"react";import{expandAlias as t}from"#package/domain";import{importImplementationFile as r}from"./import-implementation-file.js";let a=e=>e instanceof Error?e.message:String(e),o=async(e,n)=>{let t=Date.now();return Promise.all(e.map(async e=>{let a=await r(`/@fs/${n}/${e}?t=${t}`);return{filePath:e,module:a}}))};export const resolveExpressionModules=(e,n)=>{let r={};for(let n of e)for(let[e,t]of Object.entries(n))r[e]={...r[e],...t};let a={};for(let[e,o]of Object.entries(r))for(let r of t(n,e)){let n=a[r]??{};for(let[t,r]of Object.entries(o))n[t]={...r,origin:{name:t,typeOrAlias:e}};a[r]=n}return a};export const resolveComponentModules=e=>e.flatMap(e=>Array.isArray(e)?e:[e]);export const mergeComponentOptics=(e,n)=>e.concat(n);export const getCustomComponentOptics=e=>e.filter(e=>!0!==e.generated);let
|
|
1
|
+
import{useCallback as e,useRef as n}from"react";import{expandAlias as t}from"#package/domain";import{importImplementationFile as r}from"./import-implementation-file.js";let a=e=>e instanceof Error?e.message:String(e),o=async(e,n)=>{let t=Date.now();return Promise.all(e.map(async e=>{let a=await r(`/@fs/${n}/${e}?t=${t}`);return{filePath:e,module:a}}))};export const resolveActionModules=e=>e.reduce((e,n)=>({...e,...n}),{});let s=async(e,n)=>{let t=await o(e,n);return resolveActionModules(t.map(({module:e})=>e))};export const resolveExpressionModules=(e,n)=>{let r={};for(let n of e)for(let[e,t]of Object.entries(n))r[e]={...r[e],...t};let a={};for(let[e,o]of Object.entries(r))for(let r of t(n,e)){let n=a[r]??{};for(let[t,r]of Object.entries(o))n[t]={...r,origin:{name:t,typeOrAlias:e}};a[r]=n}return a};export const resolveComponentModules=e=>e.flatMap(e=>Array.isArray(e)?e:[e]);export const mergeComponentOptics=(e,n)=>e.concat(n);export const getCustomComponentOptics=e=>e.filter(e=>!0!==e.generated);let i=async(e,n,t)=>{let r=await o(e,t);return resolveExpressionModules(r.map(e=>e.module),n)},l=async(e,n)=>{let t=await o(e,n);return resolveComponentModules(t.map(e=>e.module))},m=async(e,n)=>{let t=await o(e,n),r={};for(let{module:e}of t)for(let[n,t]of Object.entries(e))r[n]=[...r[n]??[],...t];return r},c=async(e,n)=>(await o(e,n)).map(({filePath:e,module:n})=>({name:e.replace(/^.*\//,"").replace(/\.tsx?$/,""),transformer:n})),p=async(e,n)=>(await o(e,n)).map(({filePath:e,module:n})=>({filePath:e,registrations:Array.isArray(n)?n:[n]})),u=async(e,n)=>(await o(e,n)).map(({filePath:e,module:n})=>({filePath:e,registrations:Array.isArray(n)?n:[n]}));export const useImplementationFiles=()=>{let t=n({}),r=n(null),o=n({}),f=n(0),d=n(null),h=n({}),g=n(null),E=n(null),F=n(null),w=n([]),y=n(null),I=n(null),A=n(new Map),O=n(new Map);return{getImplementationFiles:e(async e=>{let{application:n,projectRoot:M}=e,R=++f.current,{applicationSpec:C,categorizedFiles:v}=n,x=[],D=t.current,L=o.current,S=h.current,_=F.current,$=w.current,b=v.expressionsChanged,N=v.actionsChanged,j=v.componentsChanged,P=v.transformersChanged,H=v.handlersChanged,T=v.elementsChanged,k=Object.fromEntries(v.invariants.map(e=>[e.file.name,e.depHash])),J=g.current,X=JSON.stringify(C.configurator.invariants.entries),V=null===J||E.current!==X||Object.keys(J).length!==v.invariants.length||v.invariants.some(e=>J[e.file.name]!==e.depHash);if(console.info(`[useImplementationFiles] Changed: spec=${v.specChanged}, expressions=${v.expressionsChanged}, actions=${v.actionsChanged}, adminExpressions=${v.adminExpressionsChanged}, transformers=${v.transformersChanged}, handlers=${v.handlersChanged}, elements=${v.elementsChanged}`),b){console.info("[useImplementationFiles] Reloading expression implementations");try{let e=Object.fromEntries(C.configurator.latestModel.aliases);t.current=D=await i(v.expressions.map(e=>e.file.name),e,M)}catch(e){console.warn("[useImplementationFiles] Failed to reload expressions:",e),x.push({code:"RELOAD_EXPRESSIONS_FAILED",message:a(e)})}}let q=r.current;if(N){console.info("[useImplementationFiles] Reloading action implementations");try{r.current=q=await s(v.actions.map(e=>e.file.name),M)}catch(e){console.warn("[useImplementationFiles] Failed to reload actions:",e),x.push({code:"RELOAD_ACTIONS_FAILED",message:a(e)})}}let z=JSON.stringify({projectRoot:M,files:v.adminExpressions.map(e=>[e.file.name,e.depHash]),aliases:[...C.admin.latestModel.aliases]});if(R===f.current&&d.current!==z)try{L=await i(v.adminExpressions.map(e=>e.file.name),Object.fromEntries(C.admin.latestModel.aliases),M),R===f.current&&(o.current=L,d.current=z)}catch(e){x.push({code:"RELOAD_ADMIN_EXPRESSIONS_FAILED",message:a(e)})}if(j){console.info("[useImplementationFiles] Reloading component optics");try{F.current=_=await l(v.components.map(e=>e.file.name),M)}catch(e){console.warn("[useImplementationFiles] Failed to reload components:",e),x.push({code:"RELOAD_COMPONENTS_FAILED",message:a(e)})}}if(V){console.info("[useImplementationFiles] Reloading invariant implementations");try{h.current=S=await m(v.invariants.map(e=>e.file.name),M),g.current=k,E.current=X}catch(e){console.warn("[useImplementationFiles] Failed to reload invariants:",e),x.push({code:"RELOAD_INVARIANTS_FAILED",message:a(e)})}}if(P){console.info("[useImplementationFiles] Reloading transformer implementations");try{w.current=$=await c(v.transformers.map(e=>e.file.name),M)}catch(e){console.warn("[useImplementationFiles] Failed to reload transformers:",e),x.push({code:"RELOAD_TRANSFORMERS_FAILED",message:a(e)})}}let B=null;if(H){console.info("[useImplementationFiles] Reloading handler implementations");try{let e=Object.fromEntries(v.handlers.map(e=>[e.file.name,e.depHash])),n=y.current,t=t=>null===n||n[t]!==e[t],r=O.current,a=v.handlers.map(e=>e.file.name),o=a.filter(e=>t(e)||!r.has(e)),s=await p(o,M),i=new Map(s.map(e=>[e.filePath,e])),l=a.map(e=>{let n=i.get(e)??r.get(e);if(!n)throw Error(`Handler file "${e}" was neither re-imported nor cached from a previous round. This is a hot-reload bookkeeping bug — reload the editor page to recover.`);return n}),m=l.flatMap(e=>e.registrations),c={};for(let{filePath:n,registrations:r}of l){let a=t(n)?e[n]:void 0;if(a)for(let e of r)c[e.name]=a}console.info(`[useImplementationFiles] Staged handlers for registry (${m.length} total)`),B={handlers:m,nameHashes:c},O.current=new Map(l.map(e=>[e.filePath,e])),y.current=e}catch(e){console.warn("[useImplementationFiles] Failed to reload handlers:",e),x.push({code:"RELOAD_HANDLERS_FAILED",message:a(e)})}}let G=null;if(T){console.info("[useImplementationFiles] Reloading element implementations");try{let e=Object.fromEntries(v.elements.map(e=>[e.file.name,e.depHash])),n=I.current,t=t=>null===n||n[t]!==e[t],r=A.current,a=v.elements.map(e=>e.file.name),o=a.filter(e=>t(e)||!r.has(e)),s=await u(o,M),i=new Map(s.map(e=>[e.filePath,e])),l=a.map(e=>{let n=i.get(e)??r.get(e);if(!n)throw Error(`Element file "${e}" was neither re-imported nor cached from a previous round. This is a hot-reload bookkeeping bug — reload the editor page to recover.`);return n}),m=l.flatMap(e=>e.registrations),c={},p=0;for(let{filePath:n,registrations:r}of l){let a=t(n)?e[n]:void 0;for(let e of r){if("entity"===e.type||"layout"===e.type){a&&(c[e.name]=a);continue}a&&(c[`icon:${p}`]=a),p+=1}}console.info(`[useImplementationFiles] Staged elements for registry (${m.length} total)`),G={elements:m,nameHashes:c},A.current=new Map(l.map(e=>[e.filePath,e])),I.current=e}catch(e){console.warn("[useImplementationFiles] Failed to reload elements:",e),x.push({code:"RELOAD_ELEMENTS_FAILED",message:a(e)})}}return{implementations:D,actionImplementations:q,adminImplementations:L,invariantImplementations:S,importedTransformers:$,customComponentOptics:_,handlers:B,elements:G,errors:x}},[])}};
|
|
@@ -5,8 +5,8 @@ import type { AssistantSpec } from '#package/application-spec';
|
|
|
5
5
|
* because the conventions it describes belong to this SDK version and not to the server. The part
|
|
6
6
|
* about changes is left out when the schema has no `Mutation` type, the part about adding
|
|
7
7
|
* entities when it has no `addChild` mutation, the part about replacing them when it has no
|
|
8
|
-
* `replaceEntity` mutation,
|
|
9
|
-
* no options edge. The last section explains the
|
|
8
|
+
* `replaceEntity` mutation, the part about the choices of a field when it has
|
|
9
|
+
* no options edge, and the part about custom changes when the manifest exposes no action. The last section explains the
|
|
10
10
|
* `query` and `apply` tools, which every run registers whatever the schema holds.
|
|
11
11
|
*/
|
|
12
12
|
export declare const generateAssistantPrompt: (assistant: NonNullable<AssistantSpec>) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let e=["How to read the GraphQL schema of this configurator:","- A configuration is a set of entities. `root` is the root entity, `entities` lists every entity or the ones with the given ids, and `selectedEntity` is the entity the user has selected, or the root entity when nothing is selected.","- Every entity has an `id` of the form `<Type>-<number>`, for example `Table-1`, and a `type` with its entity type name. Ids are assigned by the configurator: read them from the configuration and never make one up.","- A field whose name starts with `_` is computed by the configurator from other values. It can be read like any other field and never written.","- Numbers are in the units the configuration stores them in. A field description names the unit when the product defines one.",'- A text field that only takes fixed values lists them in its description as "One of: ...". Use exactly those values.',"- A field typed as another entity type or as a list of one is a relation: select fields on it to read the related entities.","- Field and type descriptions come from the team that built the configurator and say what a value means for the product."],t=["How changes work:","- Every field of the `Mutation` type is one change. Its description says what it changes and what it returns.","- The configurator checks the whole configuration after each change. A change that would leave it invalid fails with an error that names the entities at fault, and it is not applied. Later changes of the same request are then not run.","- The configurator may adjust other values in response to a change, so read what a mutation returns instead of assuming the values you sent."],
|
|
1
|
+
let e=["How to read the GraphQL schema of this configurator:","- A configuration is a set of entities. `root` is the root entity, `entities` lists every entity or the ones with the given ids, and `selectedEntity` is the entity the user has selected, or the root entity when nothing is selected.","- Every entity has an `id` of the form `<Type>-<number>`, for example `Table-1`, and a `type` with its entity type name. Ids are assigned by the configurator: read them from the configuration and never make one up.","- A field whose name starts with `_` is computed by the configurator from other values. It can be read like any other field and never written.","- Numbers are in the units the configuration stores them in. A field description names the unit when the product defines one.",'- A text field that only takes fixed values lists them in its description as "One of: ...". Use exactly those values.',"- A field typed as another entity type or as a list of one is a relation: select fields on it to read the related entities.","- Field and type descriptions come from the team that built the configurator and say what a value means for the product."],t=["How changes work:","- Every field of the `Mutation` type is one change. Its description says what it changes and what it returns.","- The configurator checks the whole configuration after each change. A change that would leave it invalid fails with an error that names the entities at fault, and it is not applied. Later changes of the same request are then not run.","- The configurator may adjust other values in response to a change, so read what a mutation returns instead of assuming the values you sent."],a=["How to add entities:","- Entities are added from recipes, the same ones the configurator offers the user. An entity type that can take children has a `meta` field; `meta { childRecipes }` lists its recipe groups and their recipes.","- List the recipes of the group first, pick one by its `key`, then call `addChild` with the id of the parent, the `groupId` and the `key`. Keys change with the configuration and the language, so never reuse one from memory.","- `dryRun` on a recipe shows what adding it would do without adding it: whether it is `ok`, the `changedEntities` it would add or modify, the `deletedEntityIds` it would remove, and the `errors` when it cannot be added. An entity whose id the configuration does not have yet is new. It is costly, so select it only on the recipes you are deciding between.","- Put each `addChild` in its own operation. The recipes of a group and what they add depend on the configuration before them, so after adding something, list the group again before adding from it once more."],n=["How to replace entities:","- An entity is replaced from recipes, the same ones the configurator offers the user. An entity type that can be replaced has a `meta` field; `meta { replaceRecipes }` lists its replace recipe groups and what the entity can be replaced with.","- List the recipes of the group first, pick one by its `key`, then call `replaceEntity` with the id of the entity, the `groupId` and the `key`. `dryRun` on a replace recipe shows what replacing would do without doing it: the replacement and everything else that changes are under `changedEntities`, and the replaced entity is among the `deletedEntityIds`.","- The replacement is a new entity with a new id, and its field values come from the recipe, so they can differ from those of the entity it replaces. Read the ids and values `replaceEntity` returns, and never use the old id again.","- Put each `replaceEntity` in its own operation. The recipes of a group and what they do depend on the configuration before them, so after replacing something, list the group of the replacement again before replacing once more."],i=["How to find the values a field can take:","- Some fields store a key whose choices the configurator holds elsewhere. Such a field has an edge under `meta` named after it: `meta { <field>Options }` lists its choices, each with the `value` to write and the `name` the user sees.","- Read the choices before you write such a field or name a choice to the user, and write the `value`, not the `name`. A value outside the list is rejected unless the edge description says the field is not checked.","- `dryRun` on an option shows what writing its value would do without writing it: whether it is `ok`, the `changedEntities` it would add or modify, the `deletedEntityIds` it would remove, and the `errors` when the value cannot be written. It is costly, so select it only on the options you are deciding between. It is null when the edge description says the options cannot be dry-run.","- The choices can depend on the entity and on its current state. Read them again after a change, unless the edge description says they are the same for all instances or do not change."],o=["How the custom changes of this configurator work:","- Besides the generic changes, the `Mutation` type has fields the team built for this product. Each runs one domain operation the configurator itself uses, so prefer it over composing the same change from generic mutations. Its description says what it does and what its arguments mean.","- Its arguments are checked against what the operation declares; an argument that does not fit, or a change the product does not allow, fails the field with a message that says what to send instead.","- It returns an object whose fields the description names; a field typed as an entity reads that entity after the change."],s=["How to use the `query` and `apply` tools:","- Both take `operations`, a list of GraphQL documents that run in order. Each document holds exactly one operation. To do several things, send several items in one call instead of several calls.","- Write values into the document as literals. Use `variables` only for a value that cannot be written as a literal.","- Select only the fields you need: results are returned whole.","- The result has one GraphQL result per operation, in the order sent. When an operation fails, its `errors` say why and the operations after it are not run.","- `query` reads the configuration the user has open and never changes it. Call it before you say anything about the configuration."],r=["- This configurator exposes no changes, so there is nothing for `apply` to run. Say so when the user asks you to change the configuration."],h=['- Mutations inside `query` answer "what if" questions. Each operation sees the changes of the ones before it, so a mutation followed by a query shows the configuration as it would be. Nothing is kept and the user sees no change.',"- `apply` makes the changes the user asked for. It is all or nothing: when any operation fails, nothing is changed; when all succeed, the user gets them as one undo step.","- `committed` in the result says whether the changes were kept. When it is false although no operation failed, `message` says why: the changes may be waiting for the approval of the user, the user may have changed the configuration meanwhile, or this session may not change the configuration at all. Without a `message`, the operations changed nothing. Never tell the user a change was made unless `committed` is true."];export const generateAssistantPrompt=d=>{let c=/^type Mutation\b/m.test(d.sdl);return[e,...c?[t]:[],.../^\s+addChild\(/m.test(d.sdl)?[a]:[],.../^\s+replaceEntity\(/m.test(d.sdl)?[n]:[],.../^type FieldOption\b/m.test(d.sdl)?[i]:[],...Object.keys(d.actions).length>0?[o]:[],[...s,...c?h:r]].map(e=>e.join("\n")).join("\n\n")};
|
|
@@ -5,19 +5,37 @@ export interface LoginCommandProps {
|
|
|
5
5
|
readonly studioUrl: string;
|
|
6
6
|
readonly open: boolean;
|
|
7
7
|
}
|
|
8
|
+
type LoginOutcome = {
|
|
9
|
+
readonly signedIn: true;
|
|
10
|
+
} | {
|
|
11
|
+
readonly signedIn: false;
|
|
12
|
+
readonly message: string;
|
|
13
|
+
};
|
|
14
|
+
interface LoginCallback {
|
|
15
|
+
readonly code: string;
|
|
16
|
+
readonly tokenName: string | null;
|
|
17
|
+
readonly finish: (outcome: LoginOutcome) => Promise<void>;
|
|
18
|
+
}
|
|
8
19
|
interface LoginCallbackListener {
|
|
9
20
|
readonly port: number;
|
|
10
|
-
readonly
|
|
21
|
+
readonly callback: Promise<LoginCallback>;
|
|
11
22
|
readonly close: () => void;
|
|
12
23
|
}
|
|
24
|
+
interface LoginCallbackListenerProps {
|
|
25
|
+
readonly state: string;
|
|
26
|
+
readonly studioUrl: string;
|
|
27
|
+
readonly customer: string;
|
|
28
|
+
}
|
|
13
29
|
/**
|
|
14
|
-
* Receives the one-time code
|
|
15
|
-
* so another page cannot feed the CLI a code of its own.
|
|
30
|
+
* Receives Studio's answer on 127.0.0.1: the one-time code of an approval, or a denial. Only a callback carrying
|
|
31
|
+
* this session's state is accepted, so another page cannot feed the CLI a code of its own. The browser ends on a
|
|
32
|
+
* Studio page; its address is built from the CLI's own Studio URL, never from the request.
|
|
16
33
|
*/
|
|
17
|
-
export declare const startLoginCallbackListener: (
|
|
34
|
+
export declare const startLoginCallbackListener: (props: LoginCallbackListenerProps) => Promise<LoginCallbackListener>;
|
|
18
35
|
/**
|
|
19
|
-
* Signs the CLI in to an SDK-builder workspace: the user approves in Studio, Studio returns a
|
|
20
|
-
* CLI's loopback listener, and the CLI exchanges it with its PKCE verifier for an API token.
|
|
36
|
+
* Signs the CLI in to an SDK-builder workspace: the user names the token and approves in Studio, Studio returns a
|
|
37
|
+
* one-time code to this CLI's loopback listener, and the CLI exchanges it with its PKCE verifier for an API token.
|
|
38
|
+
* The browser waits on the callback meanwhile and ends on Studio's page for the outcome.
|
|
21
39
|
*/
|
|
22
40
|
export declare const runLoginCommand: (props: LoginCommandProps, { logger }: CommandContext) => Promise<void>;
|
|
23
41
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{spawn as e}from"node:child_process";import{createHash as t,randomBytes as r}from"node:crypto";import{createServer as o}from"node:http";import{hostname as n}from"node:os";import{createApiBaseClient as
|
|
1
|
+
import{spawn as e}from"node:child_process";import{createHash as t,randomBytes as r}from"node:crypto";import{createServer as o}from"node:http";import{hostname as n}from"node:os";import{createApiBaseClient as s}from"#package/client";import{getServerCredentials as i,saveServerCredentials as a}from"../services/index.js";let l={"&":"&","<":"<",">":">",'"':""","'":"'"},c=(e,t)=>`<!doctype html><html><head><meta charset="utf-8"><title>${e}</title></head><body style="font-family:system-ui,sans-serif;display:grid;place-items:center;height:100vh;margin:0"><main style="text-align:center"><h1>${e}</h1><p>${t.replace(/[&<>"']/g,e=>l[e]??e)}</p></main></body></html>`,d=(e,t,r,o)=>new Promise(n=>{e.destroyed?n():(e.once("close",n),e.writeHead(t,{...r,connection:"close"}).end(o))});export const startLoginCallbackListener=async e=>{let{state:t,studioUrl:r,customer:n}=e,s=(e,t)=>{let o=new URL(e,r);return o.searchParams.set("customer",n),t&&o.searchParams.set("name",t),o.toString()},i=null,a=!1,l=new Promise((e,t)=>{i={resolve:e,reject:t}}),m=o((e,r)=>{let o=new URL(e.url??"/","http://127.0.0.1"),n=o.searchParams.get("code"),l="access_denied"===o.searchParams.get("error");if("/callback"!==o.pathname)return void r.writeHead(404).end();if(o.searchParams.get("state")!==t||a||!n&&!l){d(r,400,{"content-type":"text/html"},c("Sign-in failed","This response does not belong to the waiting CLI. Run phoenix login again.")),a||i?.reject(Error("The sign-in response did not match this CLI session. Run `phoenix login` again."));return}if(a=!0,l||!n)return void d(r,302,{location:s("/builder/cli-login/denied",null)}).then(()=>{i?.reject(Error("The sign-in was denied in Studio. Run `phoenix login` again to sign in."))});let m=o.searchParams.get("name");i?.resolve({code:n,tokenName:m,finish:e=>e.signedIn?d(r,302,{location:s("/builder/cli-login/done",m)}):d(r,200,{"content-type":"text/html"},c("Sign-in failed",e.message))})}),h=await new Promise((e,t)=>{m.once("error",t),m.listen(0,"127.0.0.1",()=>{let r=m.address();null===r||"string"==typeof r?t(Error("The login callback listener did not get a port. Run `phoenix login` again.")):e(r.port)})}),u=setTimeout(()=>{i?.reject(Error("Nobody approved the sign-in within 5 minutes. Run `phoenix login` again."))},3e5);return{port:h,callback:l,close:()=>{clearTimeout(u),m.close()}}};let m=async(e,t)=>{try{let{error:r,response:o}=await s(e).DELETE("/auth/token",{headers:{authorization:`Bearer ${t}`,"content-type":null}});return r&&401!==o.status?r.message:null}catch(e){return e instanceof Error?e.message:String(e)}},h=async(e,t)=>{let{data:r,error:o}=await s(e.serverUrl).POST("/auth/token",{body:t});if(o||!r)throw Error(`The server did not accept the sign-in: ${o?.message??"no response"}`);if(r.customer.slug!==e.customer)throw await m(e.serverUrl,r.token),Error(`The sign-in was approved in workspace "${r.customer.slug}", not "${e.customer}". Check --region or --studioUrl and run \`phoenix login ${e.customer}\` again.`);let n=await i(e.serverUrl),l=await a(e.serverUrl,{token:r.token,userId:r.userId,customerSlug:r.customer.slug,customerName:r.customer.name,studioUrl:e.studioUrl,createdAt:new Date().toISOString()}),c=n?await m(e.serverUrl,n.token):null;return{customerName:r.customer.name,path:l,revokeError:c}};export const runLoginCommand=async(o,{logger:s})=>{let i=r(32).toString("base64url"),a=t("sha256").update(i).digest("base64url"),l=r(16).toString("base64url"),c=n(),d=`phoenix CLI on ${c}`,m=await startLoginCallbackListener({state:l,studioUrl:o.studioUrl,customer:o.customer});try{let t=new URL("/builder/cli-login",o.studioUrl);t.searchParams.set("customer",o.customer),t.searchParams.set("port",String(m.port)),t.searchParams.set("state",l),t.searchParams.set("challenge",a),t.searchParams.set("name",d),t.searchParams.set("host",c),t.searchParams.set("started",String(Date.now())),s.step(`Signing in to workspace "${o.customer}" on ${o.serverUrl}`),s.info(`Approve the CLI in your browser:
|
|
2
2
|
|
|
3
3
|
${t.toString()}
|
|
4
|
-
`),o.open&&(t=>{let[r,o]="darwin"===process.platform?["open",[t]]:"win32"===process.platform?["rundll32",["url.dll,FileProtocolHandler",t]]:["xdg-open",[t]];e(r,o,{stdio:"ignore",detached:!0}).on("error",()=>void 0).unref()})(t.toString());let r=await m.
|
|
4
|
+
`),o.open&&(t=>{let[r,o]="darwin"===process.platform?["open",[t]]:"win32"===process.platform?["rundll32",["url.dll,FileProtocolHandler",t]]:["xdg-open",[t]];e(r,o,{stdio:"ignore",detached:!0}).on("error",()=>void 0).unref()})(t.toString());let r=await m.callback;try{let e=await h(o,{code:r.code,codeVerifier:i,port:m.port,name:d});e.revokeError&&s.warn(`The server did not revoke the token this sign-in replaces (${e.revokeError}). It stays valid on the server. Contact Phoenix support to revoke it.`),await r.finish({signedIn:!0}),s.success(`Signed in to ${e.customerName}. The token is stored in ${e.path}; revoke it with phoenix logout.`)}catch(e){throw await r.finish({signedIn:!1,message:e instanceof Error?e.message:String(e)}),e}}finally{m.close()}};
|
|
@@ -404,6 +404,8 @@ export declare function createApplicationRuntimeSlices<State extends Application
|
|
|
404
404
|
getActiveConfigurationId: () => string;
|
|
405
405
|
getFactory: () => import("#package/domain").AnyDomainFactory;
|
|
406
406
|
getDomainExpressions: () => import("#package/domain").AnyExpressions;
|
|
407
|
+
getActionDefinitions: () => Readonly<Record<string, import("#package/domain").ActionDefinition>>;
|
|
408
|
+
getActionImplementations: () => Readonly<Record<string, import("#package/domain").AnyActionImplementation>>;
|
|
407
409
|
getModelVersion: () => number;
|
|
408
410
|
getAliasMap: () => import("#package/domain").AnyAliasMap;
|
|
409
411
|
getAllowedRootEntityTypes: () => import("#package/domain").AnyAllowedRootEntityTypes;
|
|
@@ -444,6 +446,7 @@ export declare function createApplicationRuntimeSlices<State extends Application
|
|
|
444
446
|
getNavigationSystem: () => import("../../../domain/domain-context/navigation-system/navigation-system.js").AnyNavigationSystem;
|
|
445
447
|
getUndoSystem: () => import("../../../domain/domain-context/undo-system.js").AnyUndoSystem;
|
|
446
448
|
getRecipeCookerSystem: () => import("#package/domain").AnyRecipeCookerSystem;
|
|
449
|
+
getActionSystem: () => import("#package/domain").AnyActionSystem;
|
|
447
450
|
getBlenderProjections: () => import("#package/domain").AnyBlenderProjections;
|
|
448
451
|
getExpressionContext: () => import("#package/domain").AnyExpressionContext;
|
|
449
452
|
getDomainSystems: () => import("#package/domain").AnyDomainContextSystems;
|
|
@@ -510,6 +513,8 @@ export declare function createApplicationRuntimeSlices<State extends Application
|
|
|
510
513
|
getActiveConfigurationId: () => string;
|
|
511
514
|
getFactory: () => import("#package/domain").AnyDomainFactory;
|
|
512
515
|
getDomainExpressions: () => import("#package/domain").AnyExpressions;
|
|
516
|
+
getActionDefinitions: () => Readonly<Record<string, import("#package/domain").ActionDefinition>>;
|
|
517
|
+
getActionImplementations: () => Readonly<Record<string, import("#package/domain").AnyActionImplementation>>;
|
|
513
518
|
getModelVersion: () => number;
|
|
514
519
|
getAliasMap: () => import("#package/domain").AnyAliasMap;
|
|
515
520
|
getAllowedRootEntityTypes: () => import("#package/domain").AnyAllowedRootEntityTypes;
|
|
@@ -550,6 +555,7 @@ export declare function createApplicationRuntimeSlices<State extends Application
|
|
|
550
555
|
getNavigationSystem: () => import("../../../domain/domain-context/navigation-system/navigation-system.js").AnyNavigationSystem;
|
|
551
556
|
getUndoSystem: () => import("../../../domain/domain-context/undo-system.js").AnyUndoSystem;
|
|
552
557
|
getRecipeCookerSystem: () => import("#package/domain").AnyRecipeCookerSystem;
|
|
558
|
+
getActionSystem: () => import("#package/domain").AnyActionSystem;
|
|
553
559
|
getBlenderProjections: () => import("#package/domain").AnyBlenderProjections;
|
|
554
560
|
getExpressionContext: () => import("#package/domain").AnyExpressionContext;
|
|
555
561
|
getDomainSystems: () => import("#package/domain").AnyDomainContextSystems;
|
|
@@ -1058,6 +1064,8 @@ declare const createApplicationRuntimeImpl: <EXTENSIONS extends readonly AnyAppl
|
|
|
1058
1064
|
getActiveConfigurationId: () => string;
|
|
1059
1065
|
getFactory: () => import("#package/domain").AnyDomainFactory;
|
|
1060
1066
|
getDomainExpressions: () => import("#package/domain").AnyExpressions;
|
|
1067
|
+
getActionDefinitions: () => Readonly<Record<string, import("#package/domain").ActionDefinition>>;
|
|
1068
|
+
getActionImplementations: () => Readonly<Record<string, import("#package/domain").AnyActionImplementation>>;
|
|
1061
1069
|
getModelVersion: () => number;
|
|
1062
1070
|
getAliasMap: () => import("#package/domain").AnyAliasMap;
|
|
1063
1071
|
getAllowedRootEntityTypes: () => import("#package/domain").AnyAllowedRootEntityTypes;
|
|
@@ -1098,6 +1106,7 @@ declare const createApplicationRuntimeImpl: <EXTENSIONS extends readonly AnyAppl
|
|
|
1098
1106
|
getNavigationSystem: () => import("../../../domain/domain-context/navigation-system/navigation-system.js").AnyNavigationSystem;
|
|
1099
1107
|
getUndoSystem: () => import("../../../domain/domain-context/undo-system.js").AnyUndoSystem;
|
|
1100
1108
|
getRecipeCookerSystem: () => import("#package/domain").AnyRecipeCookerSystem;
|
|
1109
|
+
getActionSystem: () => import("#package/domain").AnyActionSystem;
|
|
1101
1110
|
getBlenderProjections: () => import("#package/domain").AnyBlenderProjections;
|
|
1102
1111
|
getExpressionContext: () => import("#package/domain").AnyExpressionContext;
|
|
1103
1112
|
getDomainSystems: () => import("#package/domain").AnyDomainContextSystems;
|
|
@@ -1164,6 +1173,8 @@ declare const createApplicationRuntimeImpl: <EXTENSIONS extends readonly AnyAppl
|
|
|
1164
1173
|
getActiveConfigurationId: () => string;
|
|
1165
1174
|
getFactory: () => import("#package/domain").AnyDomainFactory;
|
|
1166
1175
|
getDomainExpressions: () => import("#package/domain").AnyExpressions;
|
|
1176
|
+
getActionDefinitions: () => Readonly<Record<string, import("#package/domain").ActionDefinition>>;
|
|
1177
|
+
getActionImplementations: () => Readonly<Record<string, import("#package/domain").AnyActionImplementation>>;
|
|
1167
1178
|
getModelVersion: () => number;
|
|
1168
1179
|
getAliasMap: () => import("#package/domain").AnyAliasMap;
|
|
1169
1180
|
getAllowedRootEntityTypes: () => import("#package/domain").AnyAllowedRootEntityTypes;
|
|
@@ -1204,6 +1215,7 @@ declare const createApplicationRuntimeImpl: <EXTENSIONS extends readonly AnyAppl
|
|
|
1204
1215
|
getNavigationSystem: () => import("../../../domain/domain-context/navigation-system/navigation-system.js").AnyNavigationSystem;
|
|
1205
1216
|
getUndoSystem: () => import("../../../domain/domain-context/undo-system.js").AnyUndoSystem;
|
|
1206
1217
|
getRecipeCookerSystem: () => import("#package/domain").AnyRecipeCookerSystem;
|
|
1218
|
+
getActionSystem: () => import("#package/domain").AnyActionSystem;
|
|
1207
1219
|
getBlenderProjections: () => import("#package/domain").AnyBlenderProjections;
|
|
1208
1220
|
getExpressionContext: () => import("#package/domain").AnyExpressionContext;
|
|
1209
1221
|
getDomainSystems: () => import("#package/domain").AnyDomainContextSystems;
|
|
@@ -60,6 +60,8 @@ export declare const useDomainContextSelectors: () => {
|
|
|
60
60
|
getActiveConfigurationId: () => string;
|
|
61
61
|
getFactory: () => import("#package/domain").AnyDomainFactory;
|
|
62
62
|
getDomainExpressions: () => import("#package/domain").AnyExpressions;
|
|
63
|
+
getActionDefinitions: () => Readonly<Record<string, import("#package/domain").ActionDefinition>>;
|
|
64
|
+
getActionImplementations: () => Readonly<Record<string, import("#package/domain").AnyActionImplementation>>;
|
|
63
65
|
getModelVersion: () => number;
|
|
64
66
|
getAliasMap: () => import("#package/domain").AnyAliasMap;
|
|
65
67
|
getAllowedRootEntityTypes: () => import("#package/domain").AnyAllowedRootEntityTypes;
|
|
@@ -100,6 +102,7 @@ export declare const useDomainContextSelectors: () => {
|
|
|
100
102
|
getNavigationSystem: () => import("../../../domain/domain-context/navigation-system/navigation-system.js").AnyNavigationSystem;
|
|
101
103
|
getUndoSystem: () => import("../../../domain/domain-context/undo-system.js").AnyUndoSystem;
|
|
102
104
|
getRecipeCookerSystem: () => import("#package/domain").AnyRecipeCookerSystem;
|
|
105
|
+
getActionSystem: () => import("#package/domain").AnyActionSystem;
|
|
103
106
|
getBlenderProjections: () => import("#package/domain").AnyBlenderProjections;
|
|
104
107
|
getExpressionContext: () => import("#package/domain").AnyExpressionContext;
|
|
105
108
|
getDomainSystems: () => import("#package/domain").AnyDomainContextSystems;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salsita-ai/sdk",
|
|
3
|
-
"version": "0.50.0-develop.
|
|
3
|
+
"version": "0.50.0-develop.ea458ea381",
|
|
4
4
|
"description": "TypeScript SDK and CLI for building, running, and deploying Phoenix configurator applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"salsita",
|
|
@@ -295,8 +295,8 @@
|
|
|
295
295
|
"yaml": "2.9.0",
|
|
296
296
|
"yargs": "17.7.2",
|
|
297
297
|
"zod": "3.25.76",
|
|
298
|
-
"@salsita-ai/common": "0.50.0-develop.
|
|
299
|
-
"@salsita-ai/contracts": "0.50.0-develop.
|
|
298
|
+
"@salsita-ai/common": "0.50.0-develop.ea458ea381",
|
|
299
|
+
"@salsita-ai/contracts": "0.50.0-develop.ea458ea381"
|
|
300
300
|
},
|
|
301
301
|
"devDependencies": {
|
|
302
302
|
"@clerk/clerk-react": "5.61.8",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{browserDetailsTool as e}from"@salsita-ai/contracts/assistant";let t=e=>{let t=[];for(let i=0;i<e.length;i+=64)t.push(e.slice(i,i+64));return t};export const browserDetailsClientTool=e.client(()=>{let e=(()=>{let e=[`User agent: ${navigator.userAgent}`,`Viewport: ${window.innerWidth} x ${window.innerHeight} px`,`Screen: ${window.screen.width} x ${window.screen.height} px`,`Device pixel ratio: ${window.devicePixelRatio}`,`Language: ${navigator.language}`,`Time zone: ${Intl.DateTimeFormat().resolvedOptions().timeZone}`].flatMap(t),i=document.createElement("canvas");i.width=720,i.height=48+26*e.length;let n=i.getContext("2d");if(!n)throw Error("The browser details capture failed because the canvas has no 2D context. Retry in another browser.");return n.fillStyle="#ffffff",n.fillRect(0,0,i.width,i.height),n.fillStyle="#111111",n.font="16px monospace",n.textBaseline="top",e.forEach((e,t)=>n.fillText(e,24,24+26*t)),i.toDataURL("image/png")})();return[{type:"image",source:{type:"data",value:e.slice(e.indexOf(",")+1),mimeType:"image/png"}}]});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{AssistantGraphQLToolInput as e,applyTool as t,queryTool as o}from"@salsita-ai/contracts/assistant";let a=e=>({results:[],committed:!1,message:e}),s=e=>JSON.parse(JSON.stringify(e)),i=t=>{let o=e.safeParse(t);if(!o.success){let e=o.error.issues.map(e=>`${e.path.join(".")}: ${e.message}`).join("; ");return{ok:!1,refusal:a(`Nothing was run, because the tool input is not a list of operations (${e}). Send { "operations": [{ "query": "<one GraphQL operation>" }] } with at least one item.`)}}return{ok:!0,operations:o.data.operations.map(({query:e,variables:t,operationName:o})=>({document:e,variables:t??void 0,operationName:o??void 0}))}};export const queryClientTool=o.client(async(e,{context:t})=>{let o=i(e);return o.ok?t.storeSystem.isInitialized?s({results:(await t.graphQLSystem.prepare(t.storeSystem.stateSlices.committed.value.state,o.operations)).map(({result:e})=>e),committed:!1}):a("Nothing was run, because the configuration is not loaded yet, so there is no state to query. Call the tool again once the configurator has finished loading."):o.refusal});export const applyClientTool=t.client(async(e,{context:t})=>{if("owner"!==t.getActiveMode())return a("Nothing was run, because changes cannot be applied in this session: the user may view this configuration but not change it. The query tool still works here, including mutations, to show what a change would do without keeping it.");let o=i(e);return o.ok?s(await t.graphQLSystem.execute(o.operations)):o.refusal});
|