@lowdefy/blocks-antd-x 6.1.0 → 7.0.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.
@@ -0,0 +1,62 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ // When the two leading intents are this close and neither is committed, offer both.
16
+ const CHOICE_MARGIN = 0.15;
17
+ // Classifier scores jump around while the user is mid-word, so the shown intent
18
+ // only changes when a challenger leads two rounds in a row or reaches the
19
+ // `switch` confidence. The block re-runs a round with unchanged scores after a
20
+ // pause, so a challenger that holds the lead while the user stops typing also wins.
21
+ // `intent: null` is "nothing recognised"; `challenger: undefined` is "no challenger",
22
+ // so a null challenger can still take the intent back to idle.
23
+ function nextIntentState({ state, scores, confidence }) {
24
+ const ranked = Object.entries(scores).filter(([, p])=>Number.isFinite(p)).sort((a, b)=>b[1] - a[1]);
25
+ const top = ranked[0];
26
+ const candidate = top && top[1] >= confidence.preview ? top[0] : null;
27
+ let { intent, challenger } = state;
28
+ if (candidate === intent) {
29
+ challenger = undefined;
30
+ } else if (challenger === candidate || (top?.[1] ?? 0) >= confidence.switch) {
31
+ intent = candidate;
32
+ challenger = undefined;
33
+ } else {
34
+ challenger = candidate;
35
+ }
36
+ if (intent === null) return {
37
+ intent,
38
+ challenger,
39
+ mode: 'idle',
40
+ choices: []
41
+ };
42
+ const p = scores[intent] ?? 0;
43
+ const rival = ranked.find(([key])=>key !== intent);
44
+ if (p < confidence.show && rival && rival[1] >= confidence.preview && Math.abs(p - rival[1]) < CHOICE_MARGIN) {
45
+ return {
46
+ intent,
47
+ challenger,
48
+ mode: 'choose',
49
+ choices: [
50
+ intent,
51
+ rival[0]
52
+ ]
53
+ };
54
+ }
55
+ return {
56
+ intent,
57
+ challenger,
58
+ mode: p >= confidence.show ? 'committed' : 'preview',
59
+ choices: []
60
+ };
61
+ }
62
+ export default nextIntentState;
package/dist/blocks.js CHANGED
@@ -14,3 +14,4 @@
14
14
  limitations under the License.
15
15
  */ export { default as AgentChat } from './blocks/AgentChat/AgentChat.js';
16
16
  export { default as AgentConversations } from './blocks/AgentConversations/AgentConversations.js';
17
+ export { default as IntentInput } from './blocks/IntentInput/IntentInput.js';
package/dist/metas.js CHANGED
@@ -14,3 +14,4 @@
14
14
  limitations under the License.
15
15
  */ export { default as AgentChat } from './blocks/AgentChat/meta.js';
16
16
  export { default as AgentConversations } from './blocks/AgentConversations/meta.js';
17
+ export { default as IntentInput } from './blocks/IntentInput/meta.js';
package/dist/types.js CHANGED
@@ -12,21 +12,6 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ export default {
16
- blocks: [
17
- 'AgentChat',
18
- 'AgentConversations'
19
- ],
20
- icons: {
21
- AgentChat: [],
22
- AgentConversations: []
23
- },
24
- blockMetas: {
25
- AgentChat: {
26
- category: 'display'
27
- },
28
- AgentConversations: {
29
- category: 'display'
30
- }
31
- }
32
- };
15
+ */ import { extractBlockTypes } from '@lowdefy/block-utils';
16
+ import * as metas from './metas.js';
17
+ export default extractBlockTypes(metas);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-antd-x",
3
- "version": "6.1.0",
3
+ "version": "7.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Lowdefy Ant Design X Blocks",
6
6
  "homepage": "https://lowdefy.com",
@@ -29,6 +29,9 @@
29
29
  "url": "https://github.com/lowdefy/lowdefy.git"
30
30
  },
31
31
  "type": "module",
32
+ "sideEffects": [
33
+ "**/*.css"
34
+ ],
32
35
  "exports": {
33
36
  "./blocks": "./dist/blocks.js",
34
37
  "./types": "./dist/types.js"
@@ -37,18 +40,17 @@
37
40
  "dist/*"
38
41
  ],
39
42
  "dependencies": {
40
- "@ai-sdk/react": "3.0.178",
41
- "@ant-design/icons": "6.1.0",
42
- "@ant-design/x": "2.7.0",
43
- "@ant-design/x-markdown": "2.7.0",
44
- "@lowdefy/block-utils": "6.1.0",
45
- "@lowdefy/blocks-files": "6.1.0",
46
- "@lowdefy/helpers": "6.1.0",
47
- "ai": "6.0.176"
43
+ "@ai-sdk/react": "4.0.119",
44
+ "@ant-design/x": "2.9.0",
45
+ "@ant-design/x-markdown": "2.9.0",
46
+ "@lowdefy/block-utils": "7.0.0",
47
+ "@lowdefy/blocks-files": "7.0.0",
48
+ "@lowdefy/helpers": "7.0.0",
49
+ "ai": "7.0.116"
48
50
  },
49
51
  "devDependencies": {
50
- "@lowdefy/block-dev-e2e": "6.1.0",
51
- "@lowdefy/e2e-utils": "6.1.0",
52
+ "@lowdefy/block-dev-e2e": "7.0.0",
53
+ "@lowdefy/e2e-utils": "7.0.0",
52
54
  "@playwright/test": "1.59.1",
53
55
  "@swc/cli": "0.8.1",
54
56
  "@swc/core": "1.15.32",
@@ -56,7 +58,7 @@
56
58
  "react-dom": "18.2.0"
57
59
  },
58
60
  "peerDependencies": {
59
- "antd": "6.3.1",
61
+ "antd": "6.6.5",
60
62
  "react": "18.2.0"
61
63
  },
62
64
  "publishConfig": {