@ilivemylife/graph-sdk 1.0.7 → 1.0.9

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/README.md CHANGED
@@ -233,6 +233,22 @@ const { count } = await graph.subItemCount(nodeId);
233
233
  // Get node settings
234
234
  const settings = await graph.itemSettings(nodeId);
235
235
 
236
+ // Edit node settings (AI provider, notifications, etc)
237
+ import { AI_PROVIDER_TYPES, TOGGLE_VALUES } from '@ilivemylife/graph-sdk';
238
+
239
+ await graph.editItemSettings({
240
+ itemId: nodeId,
241
+ artificialIntelligenceProvider: AI_PROVIDER_TYPES.openai, // switch AI to OpenAI
242
+ intelligence: TOGGLE_VALUES.enabled // use smart model
243
+ });
244
+
245
+ // Reset to app defaults (user's global settings)
246
+ await graph.editItemSettings({
247
+ itemId: nodeId,
248
+ artificialIntelligenceProvider: null, // null = use user's app default
249
+ intelligence: null
250
+ });
251
+
236
252
  // Search messages
237
253
  const found = await graph.searchMessages(nodeId, 'keyword');
238
254
  ```
@@ -485,6 +501,7 @@ import {
485
501
  // Access and settings
486
502
  ITEM_ACCESS_TYPES, // human, bot, request
487
503
  AI_PROVIDER_TYPES, // openai, claude, gemini
504
+ TOGGLE_VALUES, // enabled, disabled (for intelligence, lifebotRootAccess)
488
505
  NODE_SPECIAL_TYPES // user_settings, user_system, non_drop
489
506
  } from '@ilivemylife/graph-sdk';
490
507
 
@@ -682,6 +699,7 @@ Restart your AI tool after adding the config.
682
699
  **Write Operations** (require confirmation):
683
700
  - `graph_add_item` — Create new node
684
701
  - `graph_edit_item` — Edit node (title, description, tags)
702
+ - `graph_edit_settings` — Edit node settings (AI provider, notifications)
685
703
  - `graph_archive_item` / `graph_unarchive_item` — Archive/restore
686
704
  - `graph_move_item` — Move to different parent
687
705
  - `graph_reorder_child` / `graph_set_position` — Reorder
@@ -695,6 +713,8 @@ Restart your AI tool after adding the config.
695
713
  "Create a task called 'Review PR' under node xyz789"
696
714
  "What messages are in my root node?"
697
715
  "Ask Lifebot to summarize this project"
716
+ "Switch AI to OpenAI for node xyz789"
717
+ "Use cheaper AI model for this node to save costs"
698
718
  ```
699
719
 
700
720
  ---
@@ -710,7 +730,7 @@ import type {
710
730
 
711
731
  // Client types
712
732
  GraphClient, GraphClientOptions,
713
- AddItemOptions, EditItemInput, AddMessageOptions,
733
+ AddItemOptions, EditItemInput, EditItemSettingsInput, AddMessageOptions,
714
734
 
715
735
  // Subscription change types (for type-safe comparisons)
716
736
  MessageChangeType, // '+1' | 'edit' | '-1'
package/dist/cli.mjs CHANGED
@@ -294,6 +294,21 @@ var ARCHIVE_MESSAGE = gql`
294
294
  }
295
295
  }
296
296
  `;
297
+ var EDIT_ITEM_SETTINGS = gql`
298
+ mutation EditItemSettings($itemId: String!, $push: Boolean, $inApp: Boolean, $lifebotRootAccess: String, $artificialIntelligenceProvider: String, $intelligence: String) {
299
+ editItemSettings(itemId: $itemId, push: $push, inApp: $inApp, lifebotRootAccess: $lifebotRootAccess, artificialIntelligenceProvider: $artificialIntelligenceProvider, intelligence: $intelligence) {
300
+ ok
301
+ itemSettingsResponse {
302
+ itemId
303
+ push
304
+ inApp
305
+ lifebotRootAccess
306
+ artificialIntelligenceProvider
307
+ intelligence
308
+ }
309
+ }
310
+ }
311
+ `;
297
312
  var MESSAGE_CHANGED = gql`
298
313
  subscription($itemId: String!) {
299
314
  messageChanged(itemId: $itemId) {
@@ -523,7 +538,7 @@ function createApolloClient(options) {
523
538
  const { token, httpUrl, wsUrl, enableSubscriptions, webSocketImpl } = options;
524
539
  const requestHeaders = {
525
540
  "access-token": token,
526
- "x-client": `sdk/${"1.0.7"}`
541
+ "x-client": `sdk/${"1.0.9"}`
527
542
  };
528
543
  const httpLink = createHttpLink({
529
544
  uri: httpUrl,
@@ -536,7 +551,7 @@ function createApolloClient(options) {
536
551
  if (enableSubscriptions) {
537
552
  const wsClientOptions = {
538
553
  url: wsUrl,
539
- connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.7"}` }
554
+ connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.9"}` }
540
555
  };
541
556
  if (webSocketImpl) {
542
557
  wsClientOptions.webSocketImpl = webSocketImpl;
@@ -666,6 +681,24 @@ function createGraphClient(options) {
666
681
  });
667
682
  return response.data.itemSettings || null;
668
683
  },
684
+ async editItemSettings(settingsInput) {
685
+ logger.debug(`editItemSettings(${JSON.stringify(settingsInput)})`);
686
+ const response = await apolloClient.mutate({
687
+ mutation: EDIT_ITEM_SETTINGS,
688
+ variables: {
689
+ itemId: settingsInput.itemId,
690
+ push: settingsInput.push,
691
+ inApp: settingsInput.inApp,
692
+ lifebotRootAccess: settingsInput.lifebotRootAccess,
693
+ artificialIntelligenceProvider: settingsInput.artificialIntelligenceProvider,
694
+ intelligence: settingsInput.intelligence
695
+ }
696
+ });
697
+ if (!response.data?.editItemSettings?.ok) {
698
+ throw new GraphError("Failed to edit item settings", { code: GraphErrorCodes.MUTATION_FAILED });
699
+ }
700
+ return response.data.editItemSettings.itemSettingsResponse;
701
+ },
669
702
  async searchMessages(nodeId, searchText) {
670
703
  logger.debug(`searchMessages(${nodeId}, ${searchText})`);
671
704
  const response = await apolloClient.query({
@@ -2383,7 +2416,7 @@ async function cmdUpdate() {
2383
2416
  const { execSync } = await import("child_process");
2384
2417
  console.log("Checking for updates...");
2385
2418
  try {
2386
- const currentVersion = "1.0.7";
2419
+ const currentVersion = "1.0.9";
2387
2420
  let latestVersion;
2388
2421
  try {
2389
2422
  const result = execSync("npm view @ilivemylife/graph-sdk version", { encoding: "utf-8" }).trim();
@@ -2413,7 +2446,7 @@ async function cmdDoctor() {
2413
2446
  console.log("\u2550".repeat(60));
2414
2447
  let issues = 0;
2415
2448
  console.log(`
2416
- [Version] ${"1.0.7"}`);
2449
+ [Version] ${"1.0.9"}`);
2417
2450
  const localConfigPath = findLocalConfigFile();
2418
2451
  const globalExists = existsSync2(GLOBAL_CONFIG_FILE);
2419
2452
  console.log("\n[Config Files]");
@@ -2604,11 +2637,11 @@ async function cmdUninstall() {
2604
2637
  console.log("\u2550".repeat(60));
2605
2638
  }
2606
2639
  function showVersion() {
2607
- console.log(`@ilivemylife/graph-sdk v${"1.0.7"}`);
2640
+ console.log(`@ilivemylife/graph-sdk v${"1.0.9"}`);
2608
2641
  }
2609
2642
  function showHelp() {
2610
2643
  console.log(`
2611
- @ilivemylife/graph-sdk v${"1.0.7"}
2644
+ @ilivemylife/graph-sdk v${"1.0.9"}
2612
2645
  CLI for iLiveMyLife Knowledge Graph
2613
2646
 
2614
2647
  USAGE
package/dist/client.cjs CHANGED
@@ -36,6 +36,7 @@ __export(client_exports, {
36
36
  ARCHIVE_ITEM: () => ARCHIVE_ITEM,
37
37
  ARCHIVE_MESSAGE: () => ARCHIVE_MESSAGE,
38
38
  EDIT_ITEM: () => EDIT_ITEM,
39
+ EDIT_ITEM_SETTINGS: () => EDIT_ITEM_SETTINGS,
39
40
  EDIT_MESSAGE: () => EDIT_MESSAGE,
40
41
  GraphAuthError: () => GraphAuthError,
41
42
  GraphError: () => GraphError,
@@ -64,6 +65,7 @@ __export(client_exports, {
64
65
  SDK_SUPPORT_NODE: () => SDK_SUPPORT_NODE,
65
66
  SEARCH_MESSAGES: () => SEARCH_MESSAGES,
66
67
  SUB_ITEM_COUNT: () => SUB_ITEM_COUNT,
68
+ TOGGLE_VALUES: () => TOGGLE_VALUES,
67
69
  UNARCHIVE_ITEM: () => UNARCHIVE_ITEM,
68
70
  createGraphClient: () => createGraphClient,
69
71
  isValidNodeId: () => isValidNodeId,
@@ -105,6 +107,10 @@ var AI_PROVIDER_TYPES = {
105
107
  claude: "claude",
106
108
  gemini: "gemini"
107
109
  };
110
+ var TOGGLE_VALUES = {
111
+ enabled: "enabled",
112
+ disabled: "disabled"
113
+ };
108
114
  var NODE_SPECIAL_TYPES = {
109
115
  user_settings: "user_settings",
110
116
  user_system: "user_system",
@@ -382,6 +388,21 @@ var ARCHIVE_MESSAGE = gql`
382
388
  }
383
389
  }
384
390
  `;
391
+ var EDIT_ITEM_SETTINGS = gql`
392
+ mutation EditItemSettings($itemId: String!, $push: Boolean, $inApp: Boolean, $lifebotRootAccess: String, $artificialIntelligenceProvider: String, $intelligence: String) {
393
+ editItemSettings(itemId: $itemId, push: $push, inApp: $inApp, lifebotRootAccess: $lifebotRootAccess, artificialIntelligenceProvider: $artificialIntelligenceProvider, intelligence: $intelligence) {
394
+ ok
395
+ itemSettingsResponse {
396
+ itemId
397
+ push
398
+ inApp
399
+ lifebotRootAccess
400
+ artificialIntelligenceProvider
401
+ intelligence
402
+ }
403
+ }
404
+ }
405
+ `;
385
406
  var MESSAGE_CHANGED = gql`
386
407
  subscription($itemId: String!) {
387
408
  messageChanged(itemId: $itemId) {
@@ -623,7 +644,7 @@ function createApolloClient(options) {
623
644
  const { token, httpUrl, wsUrl, enableSubscriptions, webSocketImpl } = options;
624
645
  const requestHeaders = {
625
646
  "access-token": token,
626
- "x-client": `sdk/${"1.0.7"}`
647
+ "x-client": `sdk/${"1.0.9"}`
627
648
  };
628
649
  const httpLink = createHttpLink({
629
650
  uri: httpUrl,
@@ -636,7 +657,7 @@ function createApolloClient(options) {
636
657
  if (enableSubscriptions) {
637
658
  const wsClientOptions = {
638
659
  url: wsUrl,
639
- connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.7"}` }
660
+ connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.9"}` }
640
661
  };
641
662
  if (webSocketImpl) {
642
663
  wsClientOptions.webSocketImpl = webSocketImpl;
@@ -766,6 +787,24 @@ function createGraphClient(options) {
766
787
  });
767
788
  return response.data.itemSettings || null;
768
789
  },
790
+ async editItemSettings(settingsInput) {
791
+ logger.debug(`editItemSettings(${JSON.stringify(settingsInput)})`);
792
+ const response = await apolloClient.mutate({
793
+ mutation: EDIT_ITEM_SETTINGS,
794
+ variables: {
795
+ itemId: settingsInput.itemId,
796
+ push: settingsInput.push,
797
+ inApp: settingsInput.inApp,
798
+ lifebotRootAccess: settingsInput.lifebotRootAccess,
799
+ artificialIntelligenceProvider: settingsInput.artificialIntelligenceProvider,
800
+ intelligence: settingsInput.intelligence
801
+ }
802
+ });
803
+ if (!response.data?.editItemSettings?.ok) {
804
+ throw new GraphError("Failed to edit item settings", { code: GraphErrorCodes.MUTATION_FAILED });
805
+ }
806
+ return response.data.editItemSettings.itemSettingsResponse;
807
+ },
769
808
  async searchMessages(nodeId, searchText) {
770
809
  logger.debug(`searchMessages(${nodeId}, ${searchText})`);
771
810
  const response = await apolloClient.query({
@@ -1174,6 +1213,7 @@ function createGraphClient(options) {
1174
1213
  ARCHIVE_ITEM,
1175
1214
  ARCHIVE_MESSAGE,
1176
1215
  EDIT_ITEM,
1216
+ EDIT_ITEM_SETTINGS,
1177
1217
  EDIT_MESSAGE,
1178
1218
  GraphAuthError,
1179
1219
  GraphError,
@@ -1202,6 +1242,7 @@ function createGraphClient(options) {
1202
1242
  SDK_SUPPORT_NODE,
1203
1243
  SEARCH_MESSAGES,
1204
1244
  SUB_ITEM_COUNT,
1245
+ TOGGLE_VALUES,
1205
1246
  UNARCHIVE_ITEM,
1206
1247
  createGraphClient,
1207
1248
  isValidNodeId,