@object-ui/plugin-chatbot 16.1.0 → 17.2.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.
- package/CHANGELOG.md +378 -0
- package/dist/ChatbotEnhanced.d.ts +30 -0
- package/dist/ChatbotEnhanced.d.ts.map +1 -1
- package/dist/index.js +1228 -1221
- package/dist/index.umd.cjs +2 -2
- package/dist/useAgents.d.ts +44 -0
- package/dist/useAgents.d.ts.map +1 -1
- package/dist/usePendingActions.d.ts +25 -32
- package/dist/usePendingActions.d.ts.map +1 -1
- package/package.json +13 -11
package/dist/useAgents.d.ts
CHANGED
|
@@ -59,6 +59,15 @@ export interface UseAgentsReturn {
|
|
|
59
59
|
error: Error | undefined;
|
|
60
60
|
refetch: () => void;
|
|
61
61
|
}
|
|
62
|
+
interface RawAgent {
|
|
63
|
+
name?: string;
|
|
64
|
+
label?: string;
|
|
65
|
+
description?: string;
|
|
66
|
+
role?: string;
|
|
67
|
+
active?: boolean;
|
|
68
|
+
capabilities?: Partial<Record<keyof AgentCapabilities, unknown>>;
|
|
69
|
+
[key: string]: unknown;
|
|
70
|
+
}
|
|
62
71
|
/**
|
|
63
72
|
* Whether `name`'s agent declares `cap` (cloud#816). Falls back to the legacy
|
|
64
73
|
* `isBuildAgent(name)` name check when the catalog entry carries no
|
|
@@ -95,6 +104,40 @@ export declare const PLATFORM_DEFAULT_AGENT = "ask";
|
|
|
95
104
|
* Returns `undefined` only when the catalog is empty.
|
|
96
105
|
*/
|
|
97
106
|
export declare function resolveDefaultAgentName(agents: AgentDescriptor[], preferred?: string): string | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Pull the agent list out of whatever `GET /api/v1/ai/agents` answered.
|
|
109
|
+
*
|
|
110
|
+
* This route is served by more than one producer, and the conversion onto the
|
|
111
|
+
* platform's declared `{ success: true, data }` envelope (objectstack#4053) has
|
|
112
|
+
* now landed on BOTH — the framework's degraded fallback in objectstack#4124,
|
|
113
|
+
* cloud's `service-ai` in cloud#929. Four shapes still read the same:
|
|
114
|
+
*
|
|
115
|
+
* { success: true, data: { agents } } what both producers serve today
|
|
116
|
+
* { success: true, data: [ … ] } the envelope flattened — no producer
|
|
117
|
+
* emits it; read so that one doing so
|
|
118
|
+
* fails loudly upstream, not here
|
|
119
|
+
* { agents: [ … ] } pre-conversion servers
|
|
120
|
+
* [ … ] a bare array
|
|
121
|
+
*
|
|
122
|
+
* The last two are back-compat, not the current wire: a console release is not
|
|
123
|
+
* pinned to the server it runs against, so a deployment from before the
|
|
124
|
+
* conversion is ordinary. Do not read them as evidence the servers are
|
|
125
|
+
* unenveloped — they are not, and a "cleanup" that re-narrows this to the bare
|
|
126
|
+
* shape would break exactly the deployments it looks like it is following.
|
|
127
|
+
*
|
|
128
|
+
* The envelope is detected the way `ObjectStackClient.unwrapResponse` detects
|
|
129
|
+
* it — a **boolean** `success` — so the two agree on what counts as one.
|
|
130
|
+
*
|
|
131
|
+
* Why tolerance here rather than one shape and a parse error: an unrecognised
|
|
132
|
+
* shape does not throw or warn. It yields an empty list, and `useAiSurfaceEnabled`
|
|
133
|
+
* turns an empty list into "hide the entire AI surface". That is also the CORRECT
|
|
134
|
+
* behaviour for a seat-less user or a Community-Edition deployment with no
|
|
135
|
+
* `service-ai` — so a parse miss is indistinguishable from the legitimate hidden
|
|
136
|
+
* state, with no error, no 403 and no log to notice it by. Reading every shape
|
|
137
|
+
* this route has ever answered in is what kept the server conversions from having
|
|
138
|
+
* to land in lockstep with a console release.
|
|
139
|
+
*/
|
|
140
|
+
export declare function extractAgentList(payload: unknown): RawAgent[];
|
|
98
141
|
/**
|
|
99
142
|
* Fetches the active agent catalog from the backend.
|
|
100
143
|
*
|
|
@@ -102,4 +145,5 @@ export declare function resolveDefaultAgentName(agents: AgentDescriptor[], prefe
|
|
|
102
145
|
* const { agents } = useAgents({ apiBase: '/api/v1/ai' });
|
|
103
146
|
*/
|
|
104
147
|
export declare function useAgents(options?: UseAgentsOptions): UseAgentsReturn;
|
|
148
|
+
export {};
|
|
105
149
|
//# sourceMappingURL=useAgents.d.ts.map
|
package/dist/useAgents.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAgents.d.ts","sourceRoot":"","sources":["../src/useAgents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,SAAS,EAAE,OAAO,CAAC;IACnB,kDAAkD;IAClD,MAAM,EAAE,OAAO,CAAC;IAChB,6CAA6C;IAC7C,KAAK,EAAE,OAAO,CAAC;IACf,4CAA4C;IAC5C,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kEAAkE;IAClE,YAAY,CAAC,EAAE,iBAAiB,CAAC;CAClC;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;
|
|
1
|
+
{"version":3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MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,iBAAiB,EAAE,OAAO,CAAC,CAAC,CAAC;IACjE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAaD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,eAAe,EAAE,EAClC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,GAAG,EAAE,MAAM,iBAAiB,GAC3B,OAAO,CAKT;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,QAAQ,CAAC;AAE5C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,eAAe,EAAE,EACzB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,GAAG,SAAS,CAUpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,EAAE,CAU7D;AAgED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,eAAe,CA0CzE"}
|
|
@@ -1,38 +1,31 @@
|
|
|
1
|
+
import { PendingActionRow, PendingActionStatus } from '@objectstack/spec/contracts';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
3
|
+
* Lifecycle of a pending action proposal, and the row `GET
|
|
4
|
+
* /api/v1/ai/pending-actions` returns — THE spec types, re-exported
|
|
5
|
+
* (objectui#3160, objectstack#4115 ledger batch 6).
|
|
4
6
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
* `
|
|
12
|
-
*
|
|
13
|
-
*
|
|
7
|
+
* `@objectstack/spec/contracts` declares both as the contract of
|
|
8
|
+
* `IAIService.proposePendingAction` / `.listPendingActions`, which is exactly
|
|
9
|
+
* what the REST route serialises; the copies that used to live here were a
|
|
10
|
+
* hand transcription of the same rows and had drifted in three ways, each of
|
|
11
|
+
* which silently disabled a compile-time check:
|
|
12
|
+
*
|
|
13
|
+
* - `status: PendingActionStatus | string` — a union with `string` ABSORBS the
|
|
14
|
+
* literals, so the type conveyed nothing at all and `statusesForTab` could
|
|
15
|
+
* have returned a status the server has never heard of;
|
|
16
|
+
* - `[k: string]: unknown` — the objectstack#4075 mechanism: an index
|
|
17
|
+
* signature makes any structural comparison against the spec answer
|
|
18
|
+
* "identical" no matter how far the copy drifts;
|
|
19
|
+
* - `created_at` / `updated_at`, which the contract does not carry and no
|
|
20
|
+
* consumer in this repo reads. If the inbox ever needs them, the fix is to
|
|
21
|
+
* model them in the spec, not to re-widen the row here.
|
|
22
|
+
*
|
|
23
|
+
* `| null` was dropped with the copy for the same reason: it described what a
|
|
24
|
+
* nullable SQL column might serialise to, not what the contract promises, and
|
|
25
|
+
* every reader here (`formatRelative`, `safeParseJson`) already accepts
|
|
26
|
+
* `null | undefined` on its own parameter.
|
|
14
27
|
*/
|
|
15
|
-
export
|
|
16
|
-
id: string;
|
|
17
|
-
conversation_id?: string | null;
|
|
18
|
-
message_id?: string | null;
|
|
19
|
-
object_name: string;
|
|
20
|
-
action_name: string;
|
|
21
|
-
tool_name: string;
|
|
22
|
-
/** JSON-encoded string. Consumers typically `JSON.parse` to render. */
|
|
23
|
-
tool_input: string;
|
|
24
|
-
status: PendingActionStatus | string;
|
|
25
|
-
result?: string | null;
|
|
26
|
-
error?: string | null;
|
|
27
|
-
rejection_reason?: string | null;
|
|
28
|
-
proposed_by?: string | null;
|
|
29
|
-
decided_by?: string | null;
|
|
30
|
-
proposed_at?: string;
|
|
31
|
-
decided_at?: string | null;
|
|
32
|
-
created_at?: string;
|
|
33
|
-
updated_at?: string;
|
|
34
|
-
[k: string]: unknown;
|
|
35
|
-
}
|
|
28
|
+
export type { PendingActionRow, PendingActionStatus };
|
|
36
29
|
/**
|
|
37
30
|
* Successful approval outcome returned by
|
|
38
31
|
* `POST /api/v1/ai/pending-actions/:id/approve`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePendingActions.d.ts","sourceRoot":"","sources":["../src/usePendingActions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAoBH,
|
|
1
|
+
{"version":3,"file":"usePendingActions.d.ts","sourceRoot":"","sources":["../src/usePendingActions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAoBH,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,CAAC;AAEtD;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,mBAAmB,GAAG,KAAK,CAAC;IACrC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,oCAAoC;IACpC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B;;;;OAIG;IACH,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACjD;;;OAGG;IACH,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;CACjE;AAgDD;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,wBAA6B,GACrC,uBAAuB,CAiFzB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/plugin-chatbot",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Chatbot interface plugin for Object UI",
|
|
@@ -24,10 +24,11 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@ai-sdk/react": "^4.0.
|
|
28
|
-
"@radix-ui/react-slot": "^1.3.
|
|
29
|
-
"@
|
|
30
|
-
"
|
|
27
|
+
"@ai-sdk/react": "^4.0.40",
|
|
28
|
+
"@radix-ui/react-slot": "^1.3.3",
|
|
29
|
+
"@objectstack/spec": "^17.0.0-rc.1",
|
|
30
|
+
"@radix-ui/react-use-controllable-state": "^1.2.6",
|
|
31
|
+
"ai": "^7.0.37",
|
|
31
32
|
"class-variance-authority": "^0.7.1",
|
|
32
33
|
"lucide-react": "^1.25.0",
|
|
33
34
|
"motion": "^12.42.2",
|
|
@@ -38,10 +39,11 @@
|
|
|
38
39
|
"shiki": "^4.3.1",
|
|
39
40
|
"streamdown": "^2.5.0",
|
|
40
41
|
"use-stick-to-bottom": "^1.1.6",
|
|
41
|
-
"@object-ui/components": "
|
|
42
|
-
"@object-ui/core": "
|
|
43
|
-
"@object-ui/
|
|
44
|
-
"@object-ui/
|
|
42
|
+
"@object-ui/components": "17.2.0",
|
|
43
|
+
"@object-ui/core": "17.2.0",
|
|
44
|
+
"@object-ui/i18n": "17.2.0",
|
|
45
|
+
"@object-ui/react": "17.2.0",
|
|
46
|
+
"@object-ui/types": "17.2.0"
|
|
45
47
|
},
|
|
46
48
|
"peerDependencies": {
|
|
47
49
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -51,7 +53,7 @@
|
|
|
51
53
|
"@types/react": "19.2.17",
|
|
52
54
|
"@types/react-dom": "19.2.3",
|
|
53
55
|
"@types/react-syntax-highlighter": "^15.5.13",
|
|
54
|
-
"@vitejs/plugin-react": "^6.0.
|
|
56
|
+
"@vitejs/plugin-react": "^6.0.4",
|
|
55
57
|
"typescript": "^6.0.3",
|
|
56
58
|
"vite": "^8.1.5",
|
|
57
59
|
"vite-plugin-dts": "^5.0.3"
|
|
@@ -84,7 +86,7 @@
|
|
|
84
86
|
"build": "vite build",
|
|
85
87
|
"test": "vitest run",
|
|
86
88
|
"test:watch": "vitest",
|
|
87
|
-
"type-check": "tsc --noEmit",
|
|
89
|
+
"type-check": "tsc --noEmit && tsc -p tsconfig.typetests.json",
|
|
88
90
|
"lint": "eslint ."
|
|
89
91
|
}
|
|
90
92
|
}
|