@mokuhub/mokutab-shared 2.1.0 → 2.4.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/dist/index.d.mts CHANGED
@@ -29,7 +29,17 @@ declare enum NativeMessageType {
29
29
  WATCH_PROBE = "watch_probe",
30
30
  MODULES_GET = "modules_get",
31
31
  MODULES_SET = "modules_set",
32
- MODULES_STATE = "modules_state"
32
+ MODULES_STATE = "modules_state",
33
+ NS_COOKIES_READ = "ns_cookies_read",
34
+ NS_COOKIES_WRITE = "ns_cookies_write",
35
+ NS_TAB_IDENTITY = "ns_tab_identity",
36
+ NS_SESSION_PROBE = "ns_session_probe",
37
+ NS_SESSION_CHANGED = "ns_session_changed",
38
+ NS_LOGIN_LANDING = "ns_login_landing",
39
+ NS_ACTIVITY = "ns_activity",
40
+ NS_SESSION_ENDING = "ns_session_ending",
41
+ NS_POPUP_LIST = "ns_popup_list",
42
+ NS_POPUP_OPEN = "ns_popup_open"
33
43
  }
34
44
  /** One installed module and whether it is on, as the bridge reports it. */
35
45
  interface ModuleStateEntry {
@@ -475,6 +485,40 @@ declare const WORKATO_MODULE_ID = "workato";
475
485
  declare const WORKATO_MODULE_TITLE = "Workato";
476
486
  declare const WORKATO_MODULE: ToolModule;
477
487
 
488
+ /**
489
+ * NetSuite module tool names: the session store client (see the bridge module).
490
+ */
491
+ declare const NETSUITE_TOOL_NAMES: {
492
+ readonly NETSUITE_SESSION: {
493
+ readonly STATUS: "netsuite_session_status";
494
+ readonly ENSURE: "netsuite_session_ensure";
495
+ readonly PUBLISH: "netsuite_session_publish";
496
+ readonly LOCK: "netsuite_session_lock";
497
+ readonly UNLOCK: "netsuite_session_unlock";
498
+ };
499
+ };
500
+ /** Tools that change nothing (served with readOnlyHint). */
501
+ declare const NETSUITE_READ_ONLY_TOOL_NAMES: readonly string[];
502
+ /** Tools whose whole job is to remove something. */
503
+ declare const NETSUITE_DESTRUCTIVE_TOOL_NAMES: readonly string[];
504
+ /** The tools a browser function's tool step may call (they run in the bridge, not in the page). */
505
+ declare const NETSUITE_FN_TOOL_NAMES: readonly string[];
506
+
507
+ /**
508
+ * NetSuite module tool schemas. Every result is metadata only: names, hosts,
509
+ * states and an 8-char fingerprint, never a cookie value.
510
+ */
511
+
512
+ declare const NETSUITE_TOOL_SCHEMAS: Tool[];
513
+
514
+ /** The NetSuite part of the server instructions, sent while the module is on. */
515
+ declare const NETSUITE_INSTRUCTIONS: string;
516
+
517
+ /** The id and title on their own, for code that needs no schemas (the extension). */
518
+ declare const NETSUITE_MODULE_ID = "netsuite";
519
+ declare const NETSUITE_MODULE_TITLE = "NetSuite";
520
+ declare const NETSUITE_MODULE: ToolModule;
521
+
478
522
  /**
479
523
  * Installed modules, and the full catalogue assembled from core plus every
480
524
  * module.
@@ -664,6 +708,13 @@ declare const TOOL_NAMES: {
664
708
  WHOAMI: string;
665
709
  SESSION_CONTEXT: string;
666
710
  };
711
+ NETSUITE_SESSION: {
712
+ readonly STATUS: "netsuite_session_status";
713
+ readonly ENSURE: "netsuite_session_ensure";
714
+ readonly PUBLISH: "netsuite_session_publish";
715
+ readonly LOCK: "netsuite_session_lock";
716
+ readonly UNLOCK: "netsuite_session_unlock";
717
+ };
667
718
  };
668
719
  /**
669
720
  * Every tool schema: core first, then each module's.
@@ -730,4 +781,4 @@ declare function sanitizeText(text: string): {
730
781
  */
731
782
  declare function isSensitiveKey(key: string): boolean;
732
783
 
733
- export { CORE_DESTRUCTIVE_TOOL_NAMES, CORE_READ_ONLY_TOOL_NAMES, CORE_TOOL_NAMES, CORE_TOOL_SCHEMAS, DEFAULT_MAX_OUTPUT_BYTES, DEFAULT_SERVER_PORT, type ElementPickerRequest, type ElementPickerResult, type ElementPickerResultItem, HOST_NAME, MODULES, type ModuleStateEntry, type ModulesStatePayload, type NativeMessage, NativeMessageType, type OutputSanitizerOptions, type PickedElement, type PickedElementPoint, type PickedElementRect, RAW_MAX_OUTPUT_BYTES, type SanitizedOutput, TOOL_NAMES, TOOL_SCHEMAS, type ToolModule, WORKATO_DESTRUCTIVE_TOOL_NAMES, WORKATO_INSTRUCTIONS, WORKATO_MODULE, WORKATO_MODULE_ID, WORKATO_MODULE_TITLE, WORKATO_READ_ONLY_TOOL_NAMES, WORKATO_TAB_SHARED_TOOL_NAMES, WORKATO_TOOL_ALIASES, WORKATO_TOOL_NAMES, WORKATO_TOOL_SCHEMAS, aliasDescription, aliasOffMessage, formatRawOutput, isSensitiveKey, moduleOfTool, moduleOffMessage, sanitizeAndLimitOutput, sanitizeText };
784
+ export { CORE_DESTRUCTIVE_TOOL_NAMES, CORE_READ_ONLY_TOOL_NAMES, CORE_TOOL_NAMES, CORE_TOOL_SCHEMAS, DEFAULT_MAX_OUTPUT_BYTES, DEFAULT_SERVER_PORT, type ElementPickerRequest, type ElementPickerResult, type ElementPickerResultItem, HOST_NAME, MODULES, type ModuleStateEntry, type ModulesStatePayload, NETSUITE_DESTRUCTIVE_TOOL_NAMES, NETSUITE_FN_TOOL_NAMES, NETSUITE_INSTRUCTIONS, NETSUITE_MODULE, NETSUITE_MODULE_ID, NETSUITE_MODULE_TITLE, NETSUITE_READ_ONLY_TOOL_NAMES, NETSUITE_TOOL_NAMES, NETSUITE_TOOL_SCHEMAS, type NativeMessage, NativeMessageType, type OutputSanitizerOptions, type PickedElement, type PickedElementPoint, type PickedElementRect, RAW_MAX_OUTPUT_BYTES, type SanitizedOutput, TOOL_NAMES, TOOL_SCHEMAS, type ToolModule, WORKATO_DESTRUCTIVE_TOOL_NAMES, WORKATO_INSTRUCTIONS, WORKATO_MODULE, WORKATO_MODULE_ID, WORKATO_MODULE_TITLE, WORKATO_READ_ONLY_TOOL_NAMES, WORKATO_TAB_SHARED_TOOL_NAMES, WORKATO_TOOL_ALIASES, WORKATO_TOOL_NAMES, WORKATO_TOOL_SCHEMAS, aliasDescription, aliasOffMessage, formatRawOutput, isSensitiveKey, moduleOfTool, moduleOffMessage, sanitizeAndLimitOutput, sanitizeText };
package/dist/index.d.ts CHANGED
@@ -29,7 +29,17 @@ declare enum NativeMessageType {
29
29
  WATCH_PROBE = "watch_probe",
30
30
  MODULES_GET = "modules_get",
31
31
  MODULES_SET = "modules_set",
32
- MODULES_STATE = "modules_state"
32
+ MODULES_STATE = "modules_state",
33
+ NS_COOKIES_READ = "ns_cookies_read",
34
+ NS_COOKIES_WRITE = "ns_cookies_write",
35
+ NS_TAB_IDENTITY = "ns_tab_identity",
36
+ NS_SESSION_PROBE = "ns_session_probe",
37
+ NS_SESSION_CHANGED = "ns_session_changed",
38
+ NS_LOGIN_LANDING = "ns_login_landing",
39
+ NS_ACTIVITY = "ns_activity",
40
+ NS_SESSION_ENDING = "ns_session_ending",
41
+ NS_POPUP_LIST = "ns_popup_list",
42
+ NS_POPUP_OPEN = "ns_popup_open"
33
43
  }
34
44
  /** One installed module and whether it is on, as the bridge reports it. */
35
45
  interface ModuleStateEntry {
@@ -475,6 +485,40 @@ declare const WORKATO_MODULE_ID = "workato";
475
485
  declare const WORKATO_MODULE_TITLE = "Workato";
476
486
  declare const WORKATO_MODULE: ToolModule;
477
487
 
488
+ /**
489
+ * NetSuite module tool names: the session store client (see the bridge module).
490
+ */
491
+ declare const NETSUITE_TOOL_NAMES: {
492
+ readonly NETSUITE_SESSION: {
493
+ readonly STATUS: "netsuite_session_status";
494
+ readonly ENSURE: "netsuite_session_ensure";
495
+ readonly PUBLISH: "netsuite_session_publish";
496
+ readonly LOCK: "netsuite_session_lock";
497
+ readonly UNLOCK: "netsuite_session_unlock";
498
+ };
499
+ };
500
+ /** Tools that change nothing (served with readOnlyHint). */
501
+ declare const NETSUITE_READ_ONLY_TOOL_NAMES: readonly string[];
502
+ /** Tools whose whole job is to remove something. */
503
+ declare const NETSUITE_DESTRUCTIVE_TOOL_NAMES: readonly string[];
504
+ /** The tools a browser function's tool step may call (they run in the bridge, not in the page). */
505
+ declare const NETSUITE_FN_TOOL_NAMES: readonly string[];
506
+
507
+ /**
508
+ * NetSuite module tool schemas. Every result is metadata only: names, hosts,
509
+ * states and an 8-char fingerprint, never a cookie value.
510
+ */
511
+
512
+ declare const NETSUITE_TOOL_SCHEMAS: Tool[];
513
+
514
+ /** The NetSuite part of the server instructions, sent while the module is on. */
515
+ declare const NETSUITE_INSTRUCTIONS: string;
516
+
517
+ /** The id and title on their own, for code that needs no schemas (the extension). */
518
+ declare const NETSUITE_MODULE_ID = "netsuite";
519
+ declare const NETSUITE_MODULE_TITLE = "NetSuite";
520
+ declare const NETSUITE_MODULE: ToolModule;
521
+
478
522
  /**
479
523
  * Installed modules, and the full catalogue assembled from core plus every
480
524
  * module.
@@ -664,6 +708,13 @@ declare const TOOL_NAMES: {
664
708
  WHOAMI: string;
665
709
  SESSION_CONTEXT: string;
666
710
  };
711
+ NETSUITE_SESSION: {
712
+ readonly STATUS: "netsuite_session_status";
713
+ readonly ENSURE: "netsuite_session_ensure";
714
+ readonly PUBLISH: "netsuite_session_publish";
715
+ readonly LOCK: "netsuite_session_lock";
716
+ readonly UNLOCK: "netsuite_session_unlock";
717
+ };
667
718
  };
668
719
  /**
669
720
  * Every tool schema: core first, then each module's.
@@ -730,4 +781,4 @@ declare function sanitizeText(text: string): {
730
781
  */
731
782
  declare function isSensitiveKey(key: string): boolean;
732
783
 
733
- export { CORE_DESTRUCTIVE_TOOL_NAMES, CORE_READ_ONLY_TOOL_NAMES, CORE_TOOL_NAMES, CORE_TOOL_SCHEMAS, DEFAULT_MAX_OUTPUT_BYTES, DEFAULT_SERVER_PORT, type ElementPickerRequest, type ElementPickerResult, type ElementPickerResultItem, HOST_NAME, MODULES, type ModuleStateEntry, type ModulesStatePayload, type NativeMessage, NativeMessageType, type OutputSanitizerOptions, type PickedElement, type PickedElementPoint, type PickedElementRect, RAW_MAX_OUTPUT_BYTES, type SanitizedOutput, TOOL_NAMES, TOOL_SCHEMAS, type ToolModule, WORKATO_DESTRUCTIVE_TOOL_NAMES, WORKATO_INSTRUCTIONS, WORKATO_MODULE, WORKATO_MODULE_ID, WORKATO_MODULE_TITLE, WORKATO_READ_ONLY_TOOL_NAMES, WORKATO_TAB_SHARED_TOOL_NAMES, WORKATO_TOOL_ALIASES, WORKATO_TOOL_NAMES, WORKATO_TOOL_SCHEMAS, aliasDescription, aliasOffMessage, formatRawOutput, isSensitiveKey, moduleOfTool, moduleOffMessage, sanitizeAndLimitOutput, sanitizeText };
784
+ export { CORE_DESTRUCTIVE_TOOL_NAMES, CORE_READ_ONLY_TOOL_NAMES, CORE_TOOL_NAMES, CORE_TOOL_SCHEMAS, DEFAULT_MAX_OUTPUT_BYTES, DEFAULT_SERVER_PORT, type ElementPickerRequest, type ElementPickerResult, type ElementPickerResultItem, HOST_NAME, MODULES, type ModuleStateEntry, type ModulesStatePayload, NETSUITE_DESTRUCTIVE_TOOL_NAMES, NETSUITE_FN_TOOL_NAMES, NETSUITE_INSTRUCTIONS, NETSUITE_MODULE, NETSUITE_MODULE_ID, NETSUITE_MODULE_TITLE, NETSUITE_READ_ONLY_TOOL_NAMES, NETSUITE_TOOL_NAMES, NETSUITE_TOOL_SCHEMAS, type NativeMessage, NativeMessageType, type OutputSanitizerOptions, type PickedElement, type PickedElementPoint, type PickedElementRect, RAW_MAX_OUTPUT_BYTES, type SanitizedOutput, TOOL_NAMES, TOOL_SCHEMAS, type ToolModule, WORKATO_DESTRUCTIVE_TOOL_NAMES, WORKATO_INSTRUCTIONS, WORKATO_MODULE, WORKATO_MODULE_ID, WORKATO_MODULE_TITLE, WORKATO_READ_ONLY_TOOL_NAMES, WORKATO_TAB_SHARED_TOOL_NAMES, WORKATO_TOOL_ALIASES, WORKATO_TOOL_NAMES, WORKATO_TOOL_SCHEMAS, aliasDescription, aliasOffMessage, formatRawOutput, isSensitiveKey, moduleOfTool, moduleOffMessage, sanitizeAndLimitOutput, sanitizeText };
package/dist/index.js CHANGED
@@ -28,6 +28,15 @@ __export(index_exports, {
28
28
  DEFAULT_SERVER_PORT: () => DEFAULT_SERVER_PORT,
29
29
  HOST_NAME: () => HOST_NAME,
30
30
  MODULES: () => MODULES,
31
+ NETSUITE_DESTRUCTIVE_TOOL_NAMES: () => NETSUITE_DESTRUCTIVE_TOOL_NAMES,
32
+ NETSUITE_FN_TOOL_NAMES: () => NETSUITE_FN_TOOL_NAMES,
33
+ NETSUITE_INSTRUCTIONS: () => NETSUITE_INSTRUCTIONS,
34
+ NETSUITE_MODULE: () => NETSUITE_MODULE,
35
+ NETSUITE_MODULE_ID: () => NETSUITE_MODULE_ID,
36
+ NETSUITE_MODULE_TITLE: () => NETSUITE_MODULE_TITLE,
37
+ NETSUITE_READ_ONLY_TOOL_NAMES: () => NETSUITE_READ_ONLY_TOOL_NAMES,
38
+ NETSUITE_TOOL_NAMES: () => NETSUITE_TOOL_NAMES,
39
+ NETSUITE_TOOL_SCHEMAS: () => NETSUITE_TOOL_SCHEMAS,
31
40
  NativeMessageType: () => NativeMessageType,
32
41
  RAW_MAX_OUTPUT_BYTES: () => RAW_MAX_OUTPUT_BYTES,
33
42
  TOOL_NAMES: () => TOOL_NAMES,
@@ -85,6 +94,16 @@ var NativeMessageType = /* @__PURE__ */ ((NativeMessageType2) => {
85
94
  NativeMessageType2["MODULES_GET"] = "modules_get";
86
95
  NativeMessageType2["MODULES_SET"] = "modules_set";
87
96
  NativeMessageType2["MODULES_STATE"] = "modules_state";
97
+ NativeMessageType2["NS_COOKIES_READ"] = "ns_cookies_read";
98
+ NativeMessageType2["NS_COOKIES_WRITE"] = "ns_cookies_write";
99
+ NativeMessageType2["NS_TAB_IDENTITY"] = "ns_tab_identity";
100
+ NativeMessageType2["NS_SESSION_PROBE"] = "ns_session_probe";
101
+ NativeMessageType2["NS_SESSION_CHANGED"] = "ns_session_changed";
102
+ NativeMessageType2["NS_LOGIN_LANDING"] = "ns_login_landing";
103
+ NativeMessageType2["NS_ACTIVITY"] = "ns_activity";
104
+ NativeMessageType2["NS_SESSION_ENDING"] = "ns_session_ending";
105
+ NativeMessageType2["NS_POPUP_LIST"] = "ns_popup_list";
106
+ NativeMessageType2["NS_POPUP_OPEN"] = "ns_popup_open";
88
107
  return NativeMessageType2;
89
108
  })(NativeMessageType || {});
90
109
 
@@ -5656,8 +5675,170 @@ var WORKATO_MODULE = {
5656
5675
  destructiveTools: WORKATO_DESTRUCTIVE_TOOL_NAMES
5657
5676
  };
5658
5677
 
5678
+ // src/modules/netsuite/instructions.ts
5679
+ var NETSUITE_INSTRUCTIONS = "NetSuite: login page -> netsuite_session_ensure (imported: reload); log in only on none, then netsuite_session_publish.";
5680
+
5681
+ // src/modules/netsuite/tool-names.ts
5682
+ var NETSUITE_TOOL_NAMES = {
5683
+ NETSUITE_SESSION: {
5684
+ STATUS: "netsuite_session_status",
5685
+ ENSURE: "netsuite_session_ensure",
5686
+ PUBLISH: "netsuite_session_publish",
5687
+ LOCK: "netsuite_session_lock",
5688
+ UNLOCK: "netsuite_session_unlock"
5689
+ }
5690
+ };
5691
+ var NETSUITE_READ_ONLY_TOOL_NAMES = ["netsuite_session_status"];
5692
+ var NETSUITE_DESTRUCTIVE_TOOL_NAMES = [];
5693
+ var NETSUITE_FN_TOOL_NAMES = [
5694
+ "netsuite_session_ensure",
5695
+ "netsuite_session_publish",
5696
+ "netsuite_session_lock",
5697
+ "netsuite_session_unlock"
5698
+ ];
5699
+
5700
+ // src/modules/netsuite/schemas.ts
5701
+ var T = NETSUITE_TOOL_NAMES.NETSUITE_SESSION;
5702
+ var NETSUITE_TOOL_SCHEMAS = [
5703
+ {
5704
+ name: T.STATUS,
5705
+ description: "The NetSuite sessions the shared store holds: account, user, role, state (live, dying, dead), login and expiry times, last activity, holders, lock, fp (8-char fingerprint). Metadata only. state store_unconfigured: this machine has no store token; no_store: the store is not reachable (behave as without it).",
5706
+ inputSchema: {
5707
+ type: "object",
5708
+ properties: {
5709
+ account: {
5710
+ ...{
5711
+ type: "string",
5712
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5713
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5714
+ },
5715
+ description: "Only this account."
5716
+ }
5717
+ }
5718
+ }
5719
+ },
5720
+ {
5721
+ name: T.ENSURE,
5722
+ description: "Give this Chrome profile the store's live session for an account, so it needs no login. Returns state imported (cookies set in the profile; reload the NetSuite page), partial_import (Chrome refused some cookies), already_live (the profile already has that session), none (nothing alive: log in, then netsuite_session_publish), locked_by {holder, until} (another machine is logging in), store_unconfigured or no_store (no store: behave as without it). The user is the vault item's username when vault_item is given (only an item for this account's site; the name is not echoed, user_source: vault), else the one this profile used last for the account, else the only live one. Never returns a cookie value.",
5723
+ inputSchema: {
5724
+ type: "object",
5725
+ properties: {
5726
+ account: {
5727
+ type: "string",
5728
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5729
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5730
+ },
5731
+ user: { type: "string", description: "NetSuite user email to take the session of." },
5732
+ vault_item: {
5733
+ type: "string",
5734
+ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
5735
+ description: "Bitwarden item id: its username is the user (the item's password is never read)."
5736
+ },
5737
+ wait_for_lock: {
5738
+ type: "boolean",
5739
+ default: false,
5740
+ description: "When another machine holds the login lock, wait (polling every 3 s) until it publishes or the lock ends."
5741
+ }
5742
+ },
5743
+ required: ["account"]
5744
+ }
5745
+ },
5746
+ {
5747
+ name: T.PUBLISH,
5748
+ description: "Put this profile's live session for an account into the store, so other machines can use it. Returns published, unchanged (the store already has it), no_session (no session cookie for the account in this profile), store_unconfigured or no_store. The user and role come from an open tab of the account, else from vault_item or user.",
5749
+ inputSchema: {
5750
+ type: "object",
5751
+ properties: {
5752
+ account: {
5753
+ type: "string",
5754
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5755
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5756
+ },
5757
+ user: {
5758
+ type: "string",
5759
+ description: "NetSuite user email, when no tab of the account is open."
5760
+ },
5761
+ vault_item: {
5762
+ type: "string",
5763
+ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
5764
+ description: "Bitwarden item id whose username is the user, when no tab is open."
5765
+ },
5766
+ login_at: {
5767
+ type: "boolean",
5768
+ default: false,
5769
+ description: "This session was just logged in (sets login_at to now)."
5770
+ }
5771
+ },
5772
+ required: ["account"]
5773
+ }
5774
+ },
5775
+ {
5776
+ name: T.LOCK,
5777
+ description: "Take the login lock for an account and user before a login, so two machines do not log in at once (each would end the other). Returns locked {until}, locked_by {holder, until}, store_unconfigured or no_store. A publish or netsuite_session_unlock releases it; it ends by itself after ttl_s.",
5778
+ inputSchema: {
5779
+ type: "object",
5780
+ properties: {
5781
+ account: {
5782
+ type: "string",
5783
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5784
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5785
+ },
5786
+ user: { type: "string", description: "NetSuite user email." },
5787
+ vault_item: {
5788
+ type: "string",
5789
+ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
5790
+ description: "Bitwarden item id whose username is the user."
5791
+ },
5792
+ run_id: { type: "string", description: "Run id for the lock holder (shown to others)." },
5793
+ ttl_s: {
5794
+ type: "integer",
5795
+ minimum: 10,
5796
+ maximum: 120,
5797
+ default: 120,
5798
+ description: "Seconds the lock lasts."
5799
+ }
5800
+ },
5801
+ required: ["account"]
5802
+ }
5803
+ },
5804
+ {
5805
+ name: T.UNLOCK,
5806
+ description: "Release the login lock this machine and profile hold for an account and user. Returns unlocked, store_unconfigured or no_store.",
5807
+ inputSchema: {
5808
+ type: "object",
5809
+ properties: {
5810
+ account: {
5811
+ type: "string",
5812
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5813
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5814
+ },
5815
+ user: { type: "string", description: "NetSuite user email." },
5816
+ vault_item: {
5817
+ type: "string",
5818
+ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
5819
+ description: "Bitwarden item id whose username is the user."
5820
+ },
5821
+ run_id: { type: "string", description: "The run id the lock was taken with, if any." }
5822
+ },
5823
+ required: ["account"]
5824
+ }
5825
+ }
5826
+ ];
5827
+
5828
+ // src/modules/netsuite/index.ts
5829
+ var NETSUITE_MODULE_ID = "netsuite";
5830
+ var NETSUITE_MODULE_TITLE = "NetSuite";
5831
+ var NETSUITE_MODULE = {
5832
+ id: NETSUITE_MODULE_ID,
5833
+ title: NETSUITE_MODULE_TITLE,
5834
+ tools: NETSUITE_TOOL_SCHEMAS,
5835
+ instructions: NETSUITE_INSTRUCTIONS,
5836
+ readOnlyTools: NETSUITE_READ_ONLY_TOOL_NAMES,
5837
+ destructiveTools: NETSUITE_DESTRUCTIVE_TOOL_NAMES
5838
+ };
5839
+
5659
5840
  // src/modules/index.ts
5660
- var MODULES = [WORKATO_MODULE];
5841
+ var MODULES = [WORKATO_MODULE, NETSUITE_MODULE];
5661
5842
  var TOOL_NAMES = {
5662
5843
  BROWSER: CORE_TOOL_NAMES.BROWSER,
5663
5844
  BRIDGE: CORE_TOOL_NAMES.BRIDGE,
@@ -5667,7 +5848,8 @@ var TOOL_NAMES = {
5667
5848
  WORKATO_LCAP: WORKATO_TOOL_NAMES.WORKATO_LCAP,
5668
5849
  WORKATO_LOOKUP: WORKATO_TOOL_NAMES.WORKATO_LOOKUP,
5669
5850
  WORKATO_DATA_TABLE: WORKATO_TOOL_NAMES.WORKATO_DATA_TABLE,
5670
- WORKATO_SESSION: WORKATO_TOOL_NAMES.WORKATO_SESSION
5851
+ WORKATO_SESSION: WORKATO_TOOL_NAMES.WORKATO_SESSION,
5852
+ NETSUITE_SESSION: NETSUITE_TOOL_NAMES.NETSUITE_SESSION
5671
5853
  };
5672
5854
  var TOOL_SCHEMAS = /* @__PURE__ */ allToolSchemas();
5673
5855
  function allToolSchemas() {
@@ -5964,6 +6146,15 @@ function normalizePositiveInt(value, fallback) {
5964
6146
  DEFAULT_SERVER_PORT,
5965
6147
  HOST_NAME,
5966
6148
  MODULES,
6149
+ NETSUITE_DESTRUCTIVE_TOOL_NAMES,
6150
+ NETSUITE_FN_TOOL_NAMES,
6151
+ NETSUITE_INSTRUCTIONS,
6152
+ NETSUITE_MODULE,
6153
+ NETSUITE_MODULE_ID,
6154
+ NETSUITE_MODULE_TITLE,
6155
+ NETSUITE_READ_ONLY_TOOL_NAMES,
6156
+ NETSUITE_TOOL_NAMES,
6157
+ NETSUITE_TOOL_SCHEMAS,
5967
6158
  NativeMessageType,
5968
6159
  RAW_MAX_OUTPUT_BYTES,
5969
6160
  TOOL_NAMES,
package/dist/index.mjs CHANGED
@@ -30,6 +30,16 @@ var NativeMessageType = /* @__PURE__ */ ((NativeMessageType2) => {
30
30
  NativeMessageType2["MODULES_GET"] = "modules_get";
31
31
  NativeMessageType2["MODULES_SET"] = "modules_set";
32
32
  NativeMessageType2["MODULES_STATE"] = "modules_state";
33
+ NativeMessageType2["NS_COOKIES_READ"] = "ns_cookies_read";
34
+ NativeMessageType2["NS_COOKIES_WRITE"] = "ns_cookies_write";
35
+ NativeMessageType2["NS_TAB_IDENTITY"] = "ns_tab_identity";
36
+ NativeMessageType2["NS_SESSION_PROBE"] = "ns_session_probe";
37
+ NativeMessageType2["NS_SESSION_CHANGED"] = "ns_session_changed";
38
+ NativeMessageType2["NS_LOGIN_LANDING"] = "ns_login_landing";
39
+ NativeMessageType2["NS_ACTIVITY"] = "ns_activity";
40
+ NativeMessageType2["NS_SESSION_ENDING"] = "ns_session_ending";
41
+ NativeMessageType2["NS_POPUP_LIST"] = "ns_popup_list";
42
+ NativeMessageType2["NS_POPUP_OPEN"] = "ns_popup_open";
33
43
  return NativeMessageType2;
34
44
  })(NativeMessageType || {});
35
45
 
@@ -5601,8 +5611,170 @@ var WORKATO_MODULE = {
5601
5611
  destructiveTools: WORKATO_DESTRUCTIVE_TOOL_NAMES
5602
5612
  };
5603
5613
 
5614
+ // src/modules/netsuite/instructions.ts
5615
+ var NETSUITE_INSTRUCTIONS = "NetSuite: login page -> netsuite_session_ensure (imported: reload); log in only on none, then netsuite_session_publish.";
5616
+
5617
+ // src/modules/netsuite/tool-names.ts
5618
+ var NETSUITE_TOOL_NAMES = {
5619
+ NETSUITE_SESSION: {
5620
+ STATUS: "netsuite_session_status",
5621
+ ENSURE: "netsuite_session_ensure",
5622
+ PUBLISH: "netsuite_session_publish",
5623
+ LOCK: "netsuite_session_lock",
5624
+ UNLOCK: "netsuite_session_unlock"
5625
+ }
5626
+ };
5627
+ var NETSUITE_READ_ONLY_TOOL_NAMES = ["netsuite_session_status"];
5628
+ var NETSUITE_DESTRUCTIVE_TOOL_NAMES = [];
5629
+ var NETSUITE_FN_TOOL_NAMES = [
5630
+ "netsuite_session_ensure",
5631
+ "netsuite_session_publish",
5632
+ "netsuite_session_lock",
5633
+ "netsuite_session_unlock"
5634
+ ];
5635
+
5636
+ // src/modules/netsuite/schemas.ts
5637
+ var T = NETSUITE_TOOL_NAMES.NETSUITE_SESSION;
5638
+ var NETSUITE_TOOL_SCHEMAS = [
5639
+ {
5640
+ name: T.STATUS,
5641
+ description: "The NetSuite sessions the shared store holds: account, user, role, state (live, dying, dead), login and expiry times, last activity, holders, lock, fp (8-char fingerprint). Metadata only. state store_unconfigured: this machine has no store token; no_store: the store is not reachable (behave as without it).",
5642
+ inputSchema: {
5643
+ type: "object",
5644
+ properties: {
5645
+ account: {
5646
+ ...{
5647
+ type: "string",
5648
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5649
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5650
+ },
5651
+ description: "Only this account."
5652
+ }
5653
+ }
5654
+ }
5655
+ },
5656
+ {
5657
+ name: T.ENSURE,
5658
+ description: "Give this Chrome profile the store's live session for an account, so it needs no login. Returns state imported (cookies set in the profile; reload the NetSuite page), partial_import (Chrome refused some cookies), already_live (the profile already has that session), none (nothing alive: log in, then netsuite_session_publish), locked_by {holder, until} (another machine is logging in), store_unconfigured or no_store (no store: behave as without it). The user is the vault item's username when vault_item is given (only an item for this account's site; the name is not echoed, user_source: vault), else the one this profile used last for the account, else the only live one. Never returns a cookie value.",
5659
+ inputSchema: {
5660
+ type: "object",
5661
+ properties: {
5662
+ account: {
5663
+ type: "string",
5664
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5665
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5666
+ },
5667
+ user: { type: "string", description: "NetSuite user email to take the session of." },
5668
+ vault_item: {
5669
+ type: "string",
5670
+ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
5671
+ description: "Bitwarden item id: its username is the user (the item's password is never read)."
5672
+ },
5673
+ wait_for_lock: {
5674
+ type: "boolean",
5675
+ default: false,
5676
+ description: "When another machine holds the login lock, wait (polling every 3 s) until it publishes or the lock ends."
5677
+ }
5678
+ },
5679
+ required: ["account"]
5680
+ }
5681
+ },
5682
+ {
5683
+ name: T.PUBLISH,
5684
+ description: "Put this profile's live session for an account into the store, so other machines can use it. Returns published, unchanged (the store already has it), no_session (no session cookie for the account in this profile), store_unconfigured or no_store. The user and role come from an open tab of the account, else from vault_item or user.",
5685
+ inputSchema: {
5686
+ type: "object",
5687
+ properties: {
5688
+ account: {
5689
+ type: "string",
5690
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5691
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5692
+ },
5693
+ user: {
5694
+ type: "string",
5695
+ description: "NetSuite user email, when no tab of the account is open."
5696
+ },
5697
+ vault_item: {
5698
+ type: "string",
5699
+ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
5700
+ description: "Bitwarden item id whose username is the user, when no tab is open."
5701
+ },
5702
+ login_at: {
5703
+ type: "boolean",
5704
+ default: false,
5705
+ description: "This session was just logged in (sets login_at to now)."
5706
+ }
5707
+ },
5708
+ required: ["account"]
5709
+ }
5710
+ },
5711
+ {
5712
+ name: T.LOCK,
5713
+ description: "Take the login lock for an account and user before a login, so two machines do not log in at once (each would end the other). Returns locked {until}, locked_by {holder, until}, store_unconfigured or no_store. A publish or netsuite_session_unlock releases it; it ends by itself after ttl_s.",
5714
+ inputSchema: {
5715
+ type: "object",
5716
+ properties: {
5717
+ account: {
5718
+ type: "string",
5719
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5720
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5721
+ },
5722
+ user: { type: "string", description: "NetSuite user email." },
5723
+ vault_item: {
5724
+ type: "string",
5725
+ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
5726
+ description: "Bitwarden item id whose username is the user."
5727
+ },
5728
+ run_id: { type: "string", description: "Run id for the lock holder (shown to others)." },
5729
+ ttl_s: {
5730
+ type: "integer",
5731
+ minimum: 10,
5732
+ maximum: 120,
5733
+ default: 120,
5734
+ description: "Seconds the lock lasts."
5735
+ }
5736
+ },
5737
+ required: ["account"]
5738
+ }
5739
+ },
5740
+ {
5741
+ name: T.UNLOCK,
5742
+ description: "Release the login lock this machine and profile hold for an account and user. Returns unlocked, store_unconfigured or no_store.",
5743
+ inputSchema: {
5744
+ type: "object",
5745
+ properties: {
5746
+ account: {
5747
+ type: "string",
5748
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5749
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5750
+ },
5751
+ user: { type: "string", description: "NetSuite user email." },
5752
+ vault_item: {
5753
+ type: "string",
5754
+ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
5755
+ description: "Bitwarden item id whose username is the user."
5756
+ },
5757
+ run_id: { type: "string", description: "The run id the lock was taken with, if any." }
5758
+ },
5759
+ required: ["account"]
5760
+ }
5761
+ }
5762
+ ];
5763
+
5764
+ // src/modules/netsuite/index.ts
5765
+ var NETSUITE_MODULE_ID = "netsuite";
5766
+ var NETSUITE_MODULE_TITLE = "NetSuite";
5767
+ var NETSUITE_MODULE = {
5768
+ id: NETSUITE_MODULE_ID,
5769
+ title: NETSUITE_MODULE_TITLE,
5770
+ tools: NETSUITE_TOOL_SCHEMAS,
5771
+ instructions: NETSUITE_INSTRUCTIONS,
5772
+ readOnlyTools: NETSUITE_READ_ONLY_TOOL_NAMES,
5773
+ destructiveTools: NETSUITE_DESTRUCTIVE_TOOL_NAMES
5774
+ };
5775
+
5604
5776
  // src/modules/index.ts
5605
- var MODULES = [WORKATO_MODULE];
5777
+ var MODULES = [WORKATO_MODULE, NETSUITE_MODULE];
5606
5778
  var TOOL_NAMES = {
5607
5779
  BROWSER: CORE_TOOL_NAMES.BROWSER,
5608
5780
  BRIDGE: CORE_TOOL_NAMES.BRIDGE,
@@ -5612,7 +5784,8 @@ var TOOL_NAMES = {
5612
5784
  WORKATO_LCAP: WORKATO_TOOL_NAMES.WORKATO_LCAP,
5613
5785
  WORKATO_LOOKUP: WORKATO_TOOL_NAMES.WORKATO_LOOKUP,
5614
5786
  WORKATO_DATA_TABLE: WORKATO_TOOL_NAMES.WORKATO_DATA_TABLE,
5615
- WORKATO_SESSION: WORKATO_TOOL_NAMES.WORKATO_SESSION
5787
+ WORKATO_SESSION: WORKATO_TOOL_NAMES.WORKATO_SESSION,
5788
+ NETSUITE_SESSION: NETSUITE_TOOL_NAMES.NETSUITE_SESSION
5616
5789
  };
5617
5790
  var TOOL_SCHEMAS = /* @__PURE__ */ allToolSchemas();
5618
5791
  function allToolSchemas() {
@@ -5908,6 +6081,15 @@ export {
5908
6081
  DEFAULT_SERVER_PORT,
5909
6082
  HOST_NAME,
5910
6083
  MODULES,
6084
+ NETSUITE_DESTRUCTIVE_TOOL_NAMES,
6085
+ NETSUITE_FN_TOOL_NAMES,
6086
+ NETSUITE_INSTRUCTIONS,
6087
+ NETSUITE_MODULE,
6088
+ NETSUITE_MODULE_ID,
6089
+ NETSUITE_MODULE_TITLE,
6090
+ NETSUITE_READ_ONLY_TOOL_NAMES,
6091
+ NETSUITE_TOOL_NAMES,
6092
+ NETSUITE_TOOL_SCHEMAS,
5911
6093
  NativeMessageType,
5912
6094
  RAW_MAX_OUTPUT_BYTES,
5913
6095
  TOOL_NAMES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mokuhub/mokutab-shared",
3
- "version": "2.1.0",
3
+ "version": "2.4.0",
4
4
  "description": "Tool schemas shared by the MokuTab bridge and Chrome extension",
5
5
  "author": "Roman Chikalenko <chikalenkor@gmail.com>",
6
6
  "license": "MIT",