@object-ui/plugin-chatbot 17.2.0 → 17.5.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.
@@ -58,7 +58,36 @@ export interface AiQuotaError {
58
58
  * The ai-sdk chat transport throws a plain Error whose `message` is the response
59
59
  * body text (no HTTP status is preserved), so the only signal is the JSON body:
60
60
  * strip the same retry/format prefixes summarizeChatError handles, locate the
61
- * JSON object, and match its `error` code. Returns null for anything else.
61
+ * JSON object, and find the code in it. Returns null for anything else.
62
+ *
63
+ * ## Three dialects, one code set
64
+ *
65
+ * The two cloud 429 producers fill the same `error` key in OPPOSITE ways, and
66
+ * ADR-0112 declares a third shape they are converging on (objectui#3491,
67
+ * cloud#944). All three are read here so the consumer is ready BEFORE the
68
+ * producers move (cloud#1168) — the alternative is a silent misfit at the
69
+ * moment they converge:
70
+ *
71
+ * | dialect | shape |
72
+ * |------------------------------|------------------------------------------------|
73
+ * | declared envelope (ADR-0112) | `{ success: false, error: { code, message } }` |
74
+ * | flat guardrail | `{ error: CODE, message, upgrade, topUp }` |
75
+ * | service-ai sibling key | `{ error: PROSE, code: CODE }` |
76
+ *
77
+ * Only the code's LOCATION widens; the recognized code set is unchanged, so an
78
+ * unknown shape still degrades to today's behavior (null). Note that a
79
+ * spec-conformant `error.code` must be an `ErrorCode` ledger member
80
+ * (SCREAMING_SNAKE) and none of these three codes is registered today, so the
81
+ * nested branch matches the legacy vocabulary only — aligning the vocabulary is
82
+ * cloud#1168's call and needs a follow-up here, not a guess now.
83
+ *
84
+ * ## Parse priority (a total order, deliberately)
85
+ *
86
+ * `declared envelope > flat guardrail > sibling code key`. A payload that
87
+ * satisfies two dialects at once — a transitional producer double-emitting the
88
+ * new envelope alongside the legacy top-level keys is the realistic case — must
89
+ * have ONE defined outcome, so the most-declared position wins, and the legacy
90
+ * limbs remain reachable when the nested code is absent or unrecognized.
62
91
  */
63
92
  export declare function parseAiQuotaError(err: unknown): AiQuotaError | null;
64
93
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"tool-display.d.ts","sourceRoot":"","sources":["../src/tool-display.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAeH;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAoBxE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAqCxD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAiCA;AAED,8EAA8E;AAC9E,MAAM,MAAM,WAAW,GACnB,2BAA2B,GAC3B,8BAA8B,GAC9B,wBAAwB,CAAC;AAE7B,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,WAAW,CAAC;IAClB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,KAAK,EAAE,OAAO,CAAC;CAChB;AAQD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CA0BnE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAIvD;AAED,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAIhE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAItD"}
1
+ {"version":3,"file":"tool-display.d.ts","sourceRoot":"","sources":["../src/tool-display.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAeH;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAoBxE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAqCxD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAiCA;AAED,8EAA8E;AAC9E,MAAM,MAAM,WAAW,GACnB,2BAA2B,GAC3B,8BAA8B,GAC9B,wBAAwB,CAAC;AAE7B,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,WAAW,CAAC;IAClB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,KAAK,EAAE,OAAO,CAAC;CAChB;AAwBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CA8CnE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAIvD;AAED,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAIhE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAItD"}
@@ -19,6 +19,19 @@ export interface UseHitlInChatOptions {
19
19
  * Optional callback fired after a decision completes (regardless of
20
20
  * success/failure). Useful for refreshing the inbox view if it is also
21
21
  * mounted on the same page.
22
+ *
23
+ * `outcome` is the spec decision response as the endpoint returned it, so
24
+ * read it by side: `result` / `error` on approve, `id` on reject
25
+ * (objectui#3783 — the previous local types promised `id` on BOTH, and the
26
+ * approve response has never carried one). `pendingActionId` is available
27
+ * from `ContinueContext` and from the row you decided on; do not fish it out
28
+ * of an approve outcome.
29
+ *
30
+ * One honest caveat: on a transport error or non-2xx there IS no decision
31
+ * response, and this callback is still invoked — with an envelope the hook
32
+ * synthesizes locally (`{ status: 'failed', error }`). That case is not
33
+ * modelled by this parameter's type; narrowing it is a public-contract
34
+ * decision tracked in objectui#3790.
22
35
  */
23
36
  onDecided?: (toolCallId: string, outcome: ApproveOutcome | RejectOutcome) => void;
24
37
  /**
@@ -39,7 +52,12 @@ export interface ContinueContext {
39
52
  toolCallId: string;
40
53
  pendingActionId: string;
41
54
  decision: 'approved' | 'rejected';
42
- /** Raw REST payload — `{ status, result?, error?, … }`. */
55
+ /**
56
+ * Raw REST payload — the spec decision response: `{ status: 'executed' |
57
+ * 'failed', result?, error? }` on approve, `{ status: 'rejected', id }` on
58
+ * reject (objectui#3783). Note `id` is on the REJECT side only; use
59
+ * `pendingActionId` above, which is populated for both decisions.
60
+ */
43
61
  outcome: ApproveOutcome | RejectOutcome;
44
62
  /** Tool name as it appeared in the message part (e.g. `action_delete_task`). */
45
63
  toolName?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"useHitlInChat.d.ts","sourceRoot":"","sources":["../src/useHitlInChat.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzE,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE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;IACH,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,aAAa,KAAK,IAAI,CAAC;IAClF;;;;;;;;;;OAUG;IACH,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;CAC3E;AAED,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,UAAU,GAAG,UAAU,CAAC;IAClC;;;;;OAKG;IACH,OAAO,EAAE,cAAc,GAAG,aAAa,CAAC;IACxC,gFAAgF;IAChF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC7C;;;;OAIG;IACH,MAAM,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClF;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB;AA0BD,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,mBAAmB,CAyJhF"}
@@ -1,4 +1,46 @@
1
1
  import { ChatMessage as OuiChatMessage } from '@object-ui/types';
2
+ import { SeamChatMessage } from './chatMessageAdapter';
3
+ /**
4
+ * What `useObjectChat` actually emits — from `messages` and from the
5
+ * `onSend(content, messages)` callback fed from it (objectui#4424).
6
+ *
7
+ * The hook used to declare both as the `@object-ui/types` AUTHORING contract.
8
+ * In local mode that was true; in API mode it was a cast over values produced
9
+ * by the RUNTIME mapper, so the declared type was narrower than the values in
10
+ * exactly the direction that hides capability: anyone rebuilding a message
11
+ * field-by-field from its declared type deleted the HITL approval card, the
12
+ * "Review N changes" affordance, the proposed-plan card, the build panel and
13
+ * the inline charts, with the compiler agreeing.
14
+ *
15
+ * This type is what the survey found to be true of BOTH modes — neither the
16
+ * authoring type nor the runtime type, but the shape that admits both:
17
+ *
18
+ * - **wide where local mode is wide.** An authored `'tool'` role and the
19
+ * legacy `'partial-call'`/`'call'`/`'result'` tool states reach this
20
+ * surface unchanged and are folded only at the render seam, which is the
21
+ * decision `chatMessageAdapter.ts` records. So the runtime type would have
22
+ * been a lie about local mode.
23
+ * - **narrow where BOTH modes are narrow.** `timestamp` is `string`, never
24
+ * `Date`: API mode never produces one and local mode absorbs it in
25
+ * `normalizeMessages` before it is ever handed out. Declaring `Date` here
26
+ * asks every consumer to handle a value that cannot arrive.
27
+ * - **plus the render-only keys API mode really carries** —
28
+ * `buildProgress`, `blueprintProgress`, `charts`, and the HITL /
29
+ * draft-review / proposed-plan / builder-handoff extensions on each tool
30
+ * invocation.
31
+ *
32
+ * It is a SUBTYPE of `@object-ui/types`' `ChatMessage`, which is what makes the
33
+ * change invisible to correct consumers: anything that accepted the authoring
34
+ * type still accepts these values, including a host `onSend` callback that
35
+ * declares its parameter as `ChatMessage[]`.
36
+ */
37
+ export type ObjectChatMessage = Omit<SeamChatMessage, 'timestamp'> & {
38
+ /**
39
+ * Always a string here (or absent). Both modes absorb an authored `Date`
40
+ * via `toRuntimeTimestamp` before emitting — see `chatMessageAdapter.ts`.
41
+ */
42
+ timestamp?: string;
43
+ };
2
44
  /**
3
45
  * Window event the AI usage indicator (ADR-0057 #8) listens for to refetch its
4
46
  * quota headroom. A completed turn consumes tokens and a rejected send (429) means
@@ -146,15 +188,24 @@ export interface UseObjectChatOptions {
146
188
  autoResponseDelay?: number;
147
189
  /**
148
190
  * External send callback (fires for both modes).
149
- */
150
- onSend?: (content: string, messages: OuiChatMessage[]) => void;
191
+ *
192
+ * `messages` is the thread as it will be after this send, in the same shape
193
+ * the hook's own `messages` uses — see {@link ObjectChatMessage}. A callback
194
+ * that declares the parameter as `@object-ui/types`' `ChatMessage[]` still
195
+ * type-checks (the emitted shape is a subtype); declaring it as
196
+ * `ObjectChatMessage[]` is what lets you READ the render-only keys.
197
+ */
198
+ onSend?: (content: string, messages: ObjectChatMessage[]) => void;
151
199
  }
152
200
  /**
153
201
  * Return type of useObjectChat.
154
202
  */
155
203
  export interface UseObjectChatReturn {
156
- /** Current chat messages */
157
- messages: OuiChatMessage[];
204
+ /**
205
+ * Current chat messages — see {@link ObjectChatMessage} for why this is
206
+ * neither the authoring nor the runtime `ChatMessage` (objectui#4424).
207
+ */
208
+ messages: ObjectChatMessage[];
158
209
  /** Whether the assistant is currently generating a response */
159
210
  isLoading: boolean;
160
211
  /** Current error, if any */
@@ -1 +1 @@
1
- {"version":3,"file":"useObjectChat.d.ts","sourceRoot":"","sources":["../src/useObjectChat.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMtE;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,8BAA8B,CAAC;AAElE,6EAA6E;AAC7E,wBAAgB,kBAAkB,IAAI,IAAI,CAOzC;AAED,mFAAmF;AACnF,MAAM,WAAW,WAAY,SAAQ,KAAK;IACxC,qFAAqF;IACrF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,WAAW,GAAG,GAAG,EACxB,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,QAAQ,CAAC,CA2BnB;AAED;;;;;;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I,CAAC;CAC3F;AA+BD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,mBAAmB,CAqWrF"}
@@ -1,3 +1,4 @@
1
+ import { ApproveAiPendingActionResponse, RejectAiPendingActionResponse } from '@objectstack/spec/api';
1
2
  import { PendingActionRow, PendingActionStatus } from '@objectstack/spec/contracts';
2
3
  /**
3
4
  * Lifecycle of a pending action proposal, and the row `GET
@@ -27,25 +28,46 @@ import { PendingActionRow, PendingActionStatus } from '@objectstack/spec/contrac
27
28
  */
28
29
  export type { PendingActionRow, PendingActionStatus };
29
30
  /**
30
- * Successful approval outcome returned by
31
- * `POST /api/v1/ai/pending-actions/:id/approve`.
31
+ * The two decision responses —
32
+ * `POST /api/v1/ai/pending-actions/:id/approve` and `…/reject` — THE spec
33
+ * types, re-exported under this package's published names (objectui#3783).
32
34
  *
33
- * The HTTP status is 200 when `status === 'executed'` and 500 when the
34
- * downstream dispatcher failed (`status === 'failed'`). The hook surfaces
35
- * both as a normal resolved value so the UI can show the error inline
36
- * without throwing.
35
+ * `@objectstack/spec/api` declares both (`ApproveAiPendingActionResponseSchema`
36
+ * / `RejectAiPendingActionResponseSchema` in `api/protocol.zod.ts`), and those
37
+ * are the same schemas `@objectstack/client`'s `ai.pendingActions.approve()` /
38
+ * `.reject()` type their return values with — so what is re-exported here IS
39
+ * the wire, not a second reading of it. The local names stay `ApproveOutcome` /
40
+ * `RejectOutcome` because they are this package's public API surface
41
+ * (`src/index.tsx`); only the shapes change.
42
+ *
43
+ * `status: 'failed'` is an HTTP **200** carrying a reason, not a 5xx: the
44
+ * approval succeeded, the execution did not (see the doc comment on
45
+ * `ApproveAiPendingActionResponseSchema`). The comment that used to sit here
46
+ * claimed 500, which contradicted both the spec and this hook's own design —
47
+ * `call()` throws on `!res.ok`, so a 500 could never reach the resolved-value
48
+ * path `AiPendingActionsInbox` reads `out.error` from.
49
+ *
50
+ * The copies this replaces were hand transcriptions and had drifted three ways.
51
+ * Because the local names are NOT the spec's names,
52
+ * `scripts/check-spec-symbol-derivation.mjs` — which fires when a local
53
+ * declaration OCCUPIES a spec export name — had no handle on them at all;
54
+ * renaming a hand copy is invisible to a name-based guard:
55
+ *
56
+ * - `ApproveOutcome.id: string`, REQUIRED here and absent from the approve
57
+ * response — `id` is on the REJECT side. This drift was not dormant: the
58
+ * public `onDecided` callback (`useHitlInChat`) promised consumers a
59
+ * `string` and handed them `undefined` at runtime, with no compiler
60
+ * complaint anywhere;
61
+ * - `status: 'executed' | 'failed' | string` — a union with `string` ABSORBS
62
+ * the literals, so the annotation carried no information at all. The same
63
+ * drift #3220 removed from the row above;
64
+ * - `[k: string]: unknown` — the objectstack#4075 mechanism: an index
65
+ * signature makes any structural comparison against the spec answer
66
+ * "identical" however far the copy has drifted, so a parity test bolted onto
67
+ * the copy would have been green from its first day.
37
68
  */
38
- export interface ApproveOutcome {
39
- id: string;
40
- status: 'executed' | 'failed' | string;
41
- result?: unknown;
42
- error?: string;
43
- [k: string]: unknown;
44
- }
45
- export interface RejectOutcome {
46
- id: string;
47
- status: 'rejected' | string;
48
- }
69
+ export type ApproveOutcome = ApproveAiPendingActionResponse;
70
+ export type RejectOutcome = RejectAiPendingActionResponse;
49
71
  export interface UsePendingActionsOptions {
50
72
  /**
51
73
  * Base URL of the AI service, e.g. `http://localhost:3000/api/v1/ai`.
@@ -1 +1 @@
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,Q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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": "17.2.0",
3
+ "version": "17.5.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Chatbot interface plugin for Object UI",
@@ -24,38 +24,38 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "@ai-sdk/react": "^4.0.40",
27
+ "@ai-sdk/react": "^4.0.59",
28
28
  "@radix-ui/react-slot": "^1.3.3",
29
- "@objectstack/spec": "^17.0.0-rc.1",
29
+ "@objectstack/spec": "^17.0.0-rc.6",
30
30
  "@radix-ui/react-use-controllable-state": "^1.2.6",
31
- "ai": "^7.0.37",
31
+ "ai": "^7.0.56",
32
32
  "class-variance-authority": "^0.7.1",
33
- "lucide-react": "^1.25.0",
34
- "motion": "^12.42.2",
35
- "nanoid": "^6.0.0",
33
+ "lucide-react": "^1.29.0",
34
+ "motion": "^12.43.0",
35
+ "nanoid": "^6.0.1",
36
36
  "react-markdown": "^10.1.0",
37
37
  "react-syntax-highlighter": "^16.1.1",
38
38
  "remark-gfm": "^4.0.1",
39
- "shiki": "^4.3.1",
39
+ "shiki": "^4.4.2",
40
40
  "streamdown": "^2.5.0",
41
41
  "use-stick-to-bottom": "^1.1.6",
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"
42
+ "@object-ui/components": "17.5.0",
43
+ "@object-ui/core": "17.5.0",
44
+ "@object-ui/i18n": "17.5.0",
45
+ "@object-ui/react": "17.5.0",
46
+ "@object-ui/types": "17.5.0"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "react": "^18.0.0 || ^19.0.0",
50
50
  "react-dom": "^18.0.0 || ^19.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@types/react": "19.2.17",
54
- "@types/react-dom": "19.2.3",
53
+ "@types/react": "19.2.18",
54
+ "@types/react-dom": "19.2.4",
55
55
  "@types/react-syntax-highlighter": "^15.5.13",
56
- "@vitejs/plugin-react": "^6.0.4",
56
+ "@vitejs/plugin-react": "^6.0.5",
57
57
  "typescript": "^6.0.3",
58
- "vite": "^8.1.5",
58
+ "vite": "^8.2.1",
59
59
  "vite-plugin-dts": "^5.0.3"
60
60
  },
61
61
  "keywords": [
@@ -86,7 +86,7 @@
86
86
  "build": "vite build",
87
87
  "test": "vitest run",
88
88
  "test:watch": "vitest",
89
- "type-check": "tsc --noEmit && tsc -p tsconfig.typetests.json",
89
+ "type-check": "tsc --noEmit && tsc -p tsconfig.test.json",
90
90
  "lint": "eslint ."
91
91
  }
92
92
  }