@noya-app/noya-api-client-react 0.1.51 → 0.1.52

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/index.mjs CHANGED
@@ -33,11 +33,11 @@ var require_access = __commonJS({
33
33
  "../../node_modules/tree-visit/lib/access.js"(exports) {
34
34
  "use strict";
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.get = get4;
36
+ exports.get = get5;
37
37
  exports.ancestors = ancestors;
38
38
  exports.access = access;
39
39
  exports.accessPath = accessPath;
40
- function get4(node, indexPath, options) {
40
+ function get5(node, indexPath, options) {
41
41
  if (options.includeTraversalContext) {
42
42
  const accessed = _getPath(node, indexPath, options);
43
43
  return accessed[accessed.length - 1];
@@ -6064,11 +6064,11 @@ function handleValue(target, handledSet, options) {
6064
6064
  }
6065
6065
  });
6066
6066
  if (setMap) {
6067
- const set4 = target;
6068
- const values = Array.from(set4);
6069
- set4.clear();
6067
+ const set3 = target;
6068
+ const values = Array.from(set3);
6069
+ set3.clear();
6070
6070
  values.forEach((value) => {
6071
- set4.add(setMap.has(value) ? setMap.get(value) : value);
6071
+ set3.add(setMap.has(value) ? setMap.get(value) : value);
6072
6072
  });
6073
6073
  }
6074
6074
  }
@@ -7293,19 +7293,14 @@ function applyExtendedPatch(obj, patches) {
7293
7293
  // ../state-manager/src/diff.ts
7294
7294
  var import_fast_diff = __toESM(require_diff());
7295
7295
 
7296
- // ../state-manager/src/EvalManager.ts
7297
- import { uuid as uuid2 } from "@noya-app/noya-utils";
7298
-
7299
- // ../state-manager/src/FilePropertyManager.ts
7300
- import { uuid as uuid3 } from "@noya-app/noya-utils";
7301
- import { Observable as Observable5 } from "@noya-app/observable";
7302
-
7303
- // ../state-manager/src/multiplayer.ts
7304
- import { Cache, hash, isDeepEqual as isDeepEqual3, uuid as uuid5 } from "@noya-app/noya-utils";
7305
- import { Observable as Observable8, get as get2, set as set2 } from "@noya-app/observable";
7296
+ // ../state-manager/src/documentAITools.ts
7297
+ import { get as get2 } from "@noya-app/observable";
7306
7298
 
7307
- // ../state-manager/src/LogManager.ts
7308
- import { Observable as Observable6 } from "@noya-app/observable";
7299
+ // ../state-manager/src/stateManager.ts
7300
+ import {
7301
+ Observable as Observable5,
7302
+ get as getPath2
7303
+ } from "@noya-app/observable";
7309
7304
 
7310
7305
  // ../state-manager/src/historyEntries.ts
7311
7306
  var HistoryEntries;
@@ -7393,6 +7388,73 @@ var HistoryEntries;
7393
7388
  HistoryEntries2.pathsEqual = pathsEqual;
7394
7389
  })(HistoryEntries || (HistoryEntries = {}));
7395
7390
 
7391
+ // ../state-manager/src/documentAITools.ts
7392
+ var pathSchema = Type.Array(Type.Union([Type.String(), Type.Number()]), {
7393
+ description: "An exact path into the JSON document, expressed as string and number segments."
7394
+ });
7395
+ var documentOperationSchema = Type.Union([
7396
+ Type.Object({
7397
+ op: Type.Literal("set"),
7398
+ path: pathSchema,
7399
+ value: Type.Any()
7400
+ }),
7401
+ Type.Object({
7402
+ op: Type.Literal("add"),
7403
+ path: pathSchema,
7404
+ value: Type.Any()
7405
+ }),
7406
+ Type.Object({
7407
+ op: Type.Literal("remove"),
7408
+ path: pathSchema
7409
+ }),
7410
+ Type.Object({
7411
+ op: Type.Literal("move"),
7412
+ from: pathSchema,
7413
+ path: pathSchema
7414
+ })
7415
+ ]);
7416
+ var readDocumentParametersSchema = Type.Object({
7417
+ path: Type.Optional(pathSchema)
7418
+ });
7419
+ var applyDocumentOperationsParametersSchema = Type.Object({
7420
+ operations: Type.Array(documentOperationSchema, { minItems: 1 }),
7421
+ expectedHash: Type.Optional(
7422
+ Type.String({
7423
+ description: "The document hash returned by an earlier tool result. The edit is rejected if the document changed."
7424
+ })
7425
+ ),
7426
+ summary: Type.String({
7427
+ description: "A concise description of the requested document changes."
7428
+ })
7429
+ });
7430
+ var runDocumentScriptParametersSchema = Type.Object({
7431
+ sourceCode: Type.String({
7432
+ description: 'JavaScript defining a named function "updateState(state)" which mutates state in place.'
7433
+ }),
7434
+ expectedHash: Type.Optional(
7435
+ Type.String({
7436
+ description: "The document hash returned by an earlier tool result. The edit is rejected if the document changed."
7437
+ })
7438
+ ),
7439
+ summary: Type.String({
7440
+ description: "A concise description of the requested document changes."
7441
+ })
7442
+ });
7443
+
7444
+ // ../state-manager/src/EvalManager.ts
7445
+ import { uuid as uuid2 } from "@noya-app/noya-utils";
7446
+
7447
+ // ../state-manager/src/FilePropertyManager.ts
7448
+ import { uuid as uuid3 } from "@noya-app/noya-utils";
7449
+ import { Observable as Observable6 } from "@noya-app/observable";
7450
+
7451
+ // ../state-manager/src/multiplayer.ts
7452
+ import { Cache, hash, isDeepEqual as isDeepEqual3, uuid as uuid5 } from "@noya-app/noya-utils";
7453
+ import { Observable as Observable8, get as get3, set as set2 } from "@noya-app/observable";
7454
+
7455
+ // ../state-manager/src/LogManager.ts
7456
+ import { Observable as Observable7 } from "@noya-app/observable";
7457
+
7396
7458
  // ../../node_modules/@marcbachmann/cel-js/lib/errors.js
7397
7459
  var ParseError = class extends Error {
7398
7460
  #wasConstructedWithAst = false;
@@ -9541,10 +9603,10 @@ function registerOverloads(registry) {
9541
9603
  return true;
9542
9604
  }
9543
9605
  const arr = a instanceof Set ? b : a;
9544
- const set4 = a instanceof Set ? a : b;
9606
+ const set3 = a instanceof Set ? a : b;
9545
9607
  if (!Array.isArray(arr)) return false;
9546
- if (arr.length !== set4?.size) return false;
9547
- for (let i = 0; i < arr.length; i++) if (!set4.has(arr[i])) return false;
9608
+ if (arr.length !== set3?.size) return false;
9609
+ for (let i = 0; i < arr.length; i++) if (!set3.has(arr[i])) return false;
9548
9610
  return true;
9549
9611
  });
9550
9612
  binaryOverload2("map", `==`, "map", (a, b, ast, ev) => {
@@ -10410,12 +10472,6 @@ var READ_DENIED = Symbol("readDenied");
10410
10472
  // ../state-manager/src/serverScripts.ts
10411
10473
  import { uuid as createUuid, isDeepEqual as isDeepEqual2 } from "@noya-app/noya-utils";
10412
10474
 
10413
- // ../state-manager/src/stateManager.ts
10414
- import {
10415
- Observable as Observable7,
10416
- get as getPath2
10417
- } from "@noya-app/observable";
10418
-
10419
10475
  // ../state-manager/src/multiplayer.ts
10420
10476
  var createHash = (value, options) => hash(value, { ...options, ignoreUndefinedProperties: true });
10421
10477
 
@@ -10534,10 +10590,10 @@ import { Observable as Observable12 } from "@noya-app/observable";
10534
10590
 
10535
10591
  // ../state-manager/src/NoyaManager.ts
10536
10592
  import { uuid as uuid14 } from "@noya-app/noya-utils";
10537
- import { Observable as Observable23, set as set3 } from "@noya-app/observable";
10593
+ import { Observable as Observable23 } from "@noya-app/observable";
10538
10594
 
10539
10595
  // ../noya-pipeline/src/graphToTasks.ts
10540
- import { get as get3 } from "@noya-app/observable";
10596
+ import { get as get4 } from "@noya-app/observable";
10541
10597
 
10542
10598
  // ../noya-pipeline/src/state.ts
10543
10599
  import { uuid as uuid7 } from "@noya-app/noya-utils";
@@ -10907,16 +10963,6 @@ var MenuItemTree = (0, import_tree_visit3.defineTree)((node) => {
10907
10963
  return node.type === "submenu" ? node.items : [];
10908
10964
  });
10909
10965
 
10910
- // ../state-manager/src/NoyaManager.ts
10911
- var createMutatorParametersSchema = Type.Object({
10912
- sourceCode: Type.String({
10913
- description: "The source code of the mutator function."
10914
- }),
10915
- message: Type.String({
10916
- description: `A message that summarizes the changes made to the document state.`
10917
- })
10918
- });
10919
-
10920
10966
  // ../noya-multiplayer-react/src/ai.ts
10921
10967
  import { useEffect as useEffect18 } from "react";
10922
10968
 
@@ -12530,7 +12576,7 @@ var import_is_dom = __toESM2(require_is_dom());
12530
12576
  // ../noya-multiplayer-react/src/useObservable.ts
12531
12577
  import { useMemo as useMemo8, useSyncExternalStore } from "react";
12532
12578
  function useObservable2(observable, pathOrSelector, options) {
12533
- const { get: get4, listen } = useMemo8(() => {
12579
+ const { get: get5, listen } = useMemo8(() => {
12534
12580
  if (!observable) {
12535
12581
  return {
12536
12582
  get: () => void 0,
@@ -12548,10 +12594,10 @@ function useObservable2(observable, pathOrSelector, options) {
12548
12594
  };
12549
12595
  }
12550
12596
  const listen2 = pathOrSelector ? (callback) => observable.subscribe(pathOrSelector, callback) : observable.subscribe;
12551
- const get5 = pathOrSelector ? () => observable.get(pathOrSelector) : observable.get;
12552
- return { get: get5, listen: listen2 };
12597
+ const get6 = pathOrSelector ? () => observable.get(pathOrSelector) : observable.get;
12598
+ return { get: get6, listen: listen2 };
12553
12599
  }, [observable, pathOrSelector, options?.isEqual]);
12554
- return useSyncExternalStore(listen, get4, get4);
12600
+ return useSyncExternalStore(listen, get5, get5);
12555
12601
  }
12556
12602
 
12557
12603
  // ../noya-multiplayer-react/src/inspector/ColoredDot.tsx