@mokuhub/mokutab-shared 2.1.0 → 2.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/dist/index.d.mts CHANGED
@@ -29,7 +29,11 @@ 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"
33
37
  }
34
38
  /** One installed module and whether it is on, as the bridge reports it. */
35
39
  interface ModuleStateEntry {
@@ -475,6 +479,40 @@ declare const WORKATO_MODULE_ID = "workato";
475
479
  declare const WORKATO_MODULE_TITLE = "Workato";
476
480
  declare const WORKATO_MODULE: ToolModule;
477
481
 
482
+ /**
483
+ * NetSuite module tool names: the session store client (see the bridge module).
484
+ */
485
+ declare const NETSUITE_TOOL_NAMES: {
486
+ readonly NETSUITE_SESSION: {
487
+ readonly STATUS: "netsuite_session_status";
488
+ readonly ENSURE: "netsuite_session_ensure";
489
+ readonly PUBLISH: "netsuite_session_publish";
490
+ readonly LOCK: "netsuite_session_lock";
491
+ readonly UNLOCK: "netsuite_session_unlock";
492
+ };
493
+ };
494
+ /** Tools that change nothing (served with readOnlyHint). */
495
+ declare const NETSUITE_READ_ONLY_TOOL_NAMES: readonly string[];
496
+ /** Tools whose whole job is to remove something. */
497
+ declare const NETSUITE_DESTRUCTIVE_TOOL_NAMES: readonly string[];
498
+ /** The tools a browser function's tool step may call (they run in the bridge, not in the page). */
499
+ declare const NETSUITE_FN_TOOL_NAMES: readonly string[];
500
+
501
+ /**
502
+ * NetSuite module tool schemas. Every result is metadata only: names, hosts,
503
+ * states and an 8-char fingerprint, never a cookie value.
504
+ */
505
+
506
+ declare const NETSUITE_TOOL_SCHEMAS: Tool[];
507
+
508
+ /** The NetSuite part of the server instructions, sent while the module is on. */
509
+ declare const NETSUITE_INSTRUCTIONS: string;
510
+
511
+ /** The id and title on their own, for code that needs no schemas (the extension). */
512
+ declare const NETSUITE_MODULE_ID = "netsuite";
513
+ declare const NETSUITE_MODULE_TITLE = "NetSuite";
514
+ declare const NETSUITE_MODULE: ToolModule;
515
+
478
516
  /**
479
517
  * Installed modules, and the full catalogue assembled from core plus every
480
518
  * module.
@@ -664,6 +702,13 @@ declare const TOOL_NAMES: {
664
702
  WHOAMI: string;
665
703
  SESSION_CONTEXT: string;
666
704
  };
705
+ NETSUITE_SESSION: {
706
+ readonly STATUS: "netsuite_session_status";
707
+ readonly ENSURE: "netsuite_session_ensure";
708
+ readonly PUBLISH: "netsuite_session_publish";
709
+ readonly LOCK: "netsuite_session_lock";
710
+ readonly UNLOCK: "netsuite_session_unlock";
711
+ };
667
712
  };
668
713
  /**
669
714
  * Every tool schema: core first, then each module's.
@@ -730,4 +775,4 @@ declare function sanitizeText(text: string): {
730
775
  */
731
776
  declare function isSensitiveKey(key: string): boolean;
732
777
 
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 };
778
+ 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,11 @@ 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"
33
37
  }
34
38
  /** One installed module and whether it is on, as the bridge reports it. */
35
39
  interface ModuleStateEntry {
@@ -475,6 +479,40 @@ declare const WORKATO_MODULE_ID = "workato";
475
479
  declare const WORKATO_MODULE_TITLE = "Workato";
476
480
  declare const WORKATO_MODULE: ToolModule;
477
481
 
482
+ /**
483
+ * NetSuite module tool names: the session store client (see the bridge module).
484
+ */
485
+ declare const NETSUITE_TOOL_NAMES: {
486
+ readonly NETSUITE_SESSION: {
487
+ readonly STATUS: "netsuite_session_status";
488
+ readonly ENSURE: "netsuite_session_ensure";
489
+ readonly PUBLISH: "netsuite_session_publish";
490
+ readonly LOCK: "netsuite_session_lock";
491
+ readonly UNLOCK: "netsuite_session_unlock";
492
+ };
493
+ };
494
+ /** Tools that change nothing (served with readOnlyHint). */
495
+ declare const NETSUITE_READ_ONLY_TOOL_NAMES: readonly string[];
496
+ /** Tools whose whole job is to remove something. */
497
+ declare const NETSUITE_DESTRUCTIVE_TOOL_NAMES: readonly string[];
498
+ /** The tools a browser function's tool step may call (they run in the bridge, not in the page). */
499
+ declare const NETSUITE_FN_TOOL_NAMES: readonly string[];
500
+
501
+ /**
502
+ * NetSuite module tool schemas. Every result is metadata only: names, hosts,
503
+ * states and an 8-char fingerprint, never a cookie value.
504
+ */
505
+
506
+ declare const NETSUITE_TOOL_SCHEMAS: Tool[];
507
+
508
+ /** The NetSuite part of the server instructions, sent while the module is on. */
509
+ declare const NETSUITE_INSTRUCTIONS: string;
510
+
511
+ /** The id and title on their own, for code that needs no schemas (the extension). */
512
+ declare const NETSUITE_MODULE_ID = "netsuite";
513
+ declare const NETSUITE_MODULE_TITLE = "NetSuite";
514
+ declare const NETSUITE_MODULE: ToolModule;
515
+
478
516
  /**
479
517
  * Installed modules, and the full catalogue assembled from core plus every
480
518
  * module.
@@ -664,6 +702,13 @@ declare const TOOL_NAMES: {
664
702
  WHOAMI: string;
665
703
  SESSION_CONTEXT: string;
666
704
  };
705
+ NETSUITE_SESSION: {
706
+ readonly STATUS: "netsuite_session_status";
707
+ readonly ENSURE: "netsuite_session_ensure";
708
+ readonly PUBLISH: "netsuite_session_publish";
709
+ readonly LOCK: "netsuite_session_lock";
710
+ readonly UNLOCK: "netsuite_session_unlock";
711
+ };
667
712
  };
668
713
  /**
669
714
  * Every tool schema: core first, then each module's.
@@ -730,4 +775,4 @@ declare function sanitizeText(text: string): {
730
775
  */
731
776
  declare function isSensitiveKey(key: string): boolean;
732
777
 
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 };
778
+ 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,10 @@ 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";
88
101
  return NativeMessageType2;
89
102
  })(NativeMessageType || {});
90
103
 
@@ -5656,8 +5669,170 @@ var WORKATO_MODULE = {
5656
5669
  destructiveTools: WORKATO_DESTRUCTIVE_TOOL_NAMES
5657
5670
  };
5658
5671
 
5672
+ // src/modules/netsuite/instructions.ts
5673
+ var NETSUITE_INSTRUCTIONS = "NetSuite: login page -> netsuite_session_ensure (imported: reload); log in only on none, then netsuite_session_publish.";
5674
+
5675
+ // src/modules/netsuite/tool-names.ts
5676
+ var NETSUITE_TOOL_NAMES = {
5677
+ NETSUITE_SESSION: {
5678
+ STATUS: "netsuite_session_status",
5679
+ ENSURE: "netsuite_session_ensure",
5680
+ PUBLISH: "netsuite_session_publish",
5681
+ LOCK: "netsuite_session_lock",
5682
+ UNLOCK: "netsuite_session_unlock"
5683
+ }
5684
+ };
5685
+ var NETSUITE_READ_ONLY_TOOL_NAMES = ["netsuite_session_status"];
5686
+ var NETSUITE_DESTRUCTIVE_TOOL_NAMES = [];
5687
+ var NETSUITE_FN_TOOL_NAMES = [
5688
+ "netsuite_session_ensure",
5689
+ "netsuite_session_publish",
5690
+ "netsuite_session_lock",
5691
+ "netsuite_session_unlock"
5692
+ ];
5693
+
5694
+ // src/modules/netsuite/schemas.ts
5695
+ var T = NETSUITE_TOOL_NAMES.NETSUITE_SESSION;
5696
+ var NETSUITE_TOOL_SCHEMAS = [
5697
+ {
5698
+ name: T.STATUS,
5699
+ 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).",
5700
+ inputSchema: {
5701
+ type: "object",
5702
+ properties: {
5703
+ account: {
5704
+ ...{
5705
+ type: "string",
5706
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5707
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5708
+ },
5709
+ description: "Only this account."
5710
+ }
5711
+ }
5712
+ }
5713
+ },
5714
+ {
5715
+ name: T.ENSURE,
5716
+ 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.",
5717
+ inputSchema: {
5718
+ type: "object",
5719
+ properties: {
5720
+ account: {
5721
+ type: "string",
5722
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5723
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5724
+ },
5725
+ user: { type: "string", description: "NetSuite user email to take the session of." },
5726
+ vault_item: {
5727
+ type: "string",
5728
+ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
5729
+ description: "Bitwarden item id: its username is the user (the item's password is never read)."
5730
+ },
5731
+ wait_for_lock: {
5732
+ type: "boolean",
5733
+ default: false,
5734
+ description: "When another machine holds the login lock, wait (polling every 3 s) until it publishes or the lock ends."
5735
+ }
5736
+ },
5737
+ required: ["account"]
5738
+ }
5739
+ },
5740
+ {
5741
+ name: T.PUBLISH,
5742
+ 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.",
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: {
5752
+ type: "string",
5753
+ description: "NetSuite user email, when no tab of the account is open."
5754
+ },
5755
+ vault_item: {
5756
+ type: "string",
5757
+ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
5758
+ description: "Bitwarden item id whose username is the user, when no tab is open."
5759
+ },
5760
+ login_at: {
5761
+ type: "boolean",
5762
+ default: false,
5763
+ description: "This session was just logged in (sets login_at to now)."
5764
+ }
5765
+ },
5766
+ required: ["account"]
5767
+ }
5768
+ },
5769
+ {
5770
+ name: T.LOCK,
5771
+ 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.",
5772
+ inputSchema: {
5773
+ type: "object",
5774
+ properties: {
5775
+ account: {
5776
+ type: "string",
5777
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5778
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5779
+ },
5780
+ user: { type: "string", description: "NetSuite user email." },
5781
+ vault_item: {
5782
+ type: "string",
5783
+ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
5784
+ description: "Bitwarden item id whose username is the user."
5785
+ },
5786
+ run_id: { type: "string", description: "Run id for the lock holder (shown to others)." },
5787
+ ttl_s: {
5788
+ type: "integer",
5789
+ minimum: 10,
5790
+ maximum: 120,
5791
+ default: 120,
5792
+ description: "Seconds the lock lasts."
5793
+ }
5794
+ },
5795
+ required: ["account"]
5796
+ }
5797
+ },
5798
+ {
5799
+ name: T.UNLOCK,
5800
+ description: "Release the login lock this machine and profile hold for an account and user. Returns unlocked, store_unconfigured or no_store.",
5801
+ inputSchema: {
5802
+ type: "object",
5803
+ properties: {
5804
+ account: {
5805
+ type: "string",
5806
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5807
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5808
+ },
5809
+ user: { type: "string", description: "NetSuite user email." },
5810
+ vault_item: {
5811
+ type: "string",
5812
+ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
5813
+ description: "Bitwarden item id whose username is the user."
5814
+ },
5815
+ run_id: { type: "string", description: "The run id the lock was taken with, if any." }
5816
+ },
5817
+ required: ["account"]
5818
+ }
5819
+ }
5820
+ ];
5821
+
5822
+ // src/modules/netsuite/index.ts
5823
+ var NETSUITE_MODULE_ID = "netsuite";
5824
+ var NETSUITE_MODULE_TITLE = "NetSuite";
5825
+ var NETSUITE_MODULE = {
5826
+ id: NETSUITE_MODULE_ID,
5827
+ title: NETSUITE_MODULE_TITLE,
5828
+ tools: NETSUITE_TOOL_SCHEMAS,
5829
+ instructions: NETSUITE_INSTRUCTIONS,
5830
+ readOnlyTools: NETSUITE_READ_ONLY_TOOL_NAMES,
5831
+ destructiveTools: NETSUITE_DESTRUCTIVE_TOOL_NAMES
5832
+ };
5833
+
5659
5834
  // src/modules/index.ts
5660
- var MODULES = [WORKATO_MODULE];
5835
+ var MODULES = [WORKATO_MODULE, NETSUITE_MODULE];
5661
5836
  var TOOL_NAMES = {
5662
5837
  BROWSER: CORE_TOOL_NAMES.BROWSER,
5663
5838
  BRIDGE: CORE_TOOL_NAMES.BRIDGE,
@@ -5667,7 +5842,8 @@ var TOOL_NAMES = {
5667
5842
  WORKATO_LCAP: WORKATO_TOOL_NAMES.WORKATO_LCAP,
5668
5843
  WORKATO_LOOKUP: WORKATO_TOOL_NAMES.WORKATO_LOOKUP,
5669
5844
  WORKATO_DATA_TABLE: WORKATO_TOOL_NAMES.WORKATO_DATA_TABLE,
5670
- WORKATO_SESSION: WORKATO_TOOL_NAMES.WORKATO_SESSION
5845
+ WORKATO_SESSION: WORKATO_TOOL_NAMES.WORKATO_SESSION,
5846
+ NETSUITE_SESSION: NETSUITE_TOOL_NAMES.NETSUITE_SESSION
5671
5847
  };
5672
5848
  var TOOL_SCHEMAS = /* @__PURE__ */ allToolSchemas();
5673
5849
  function allToolSchemas() {
@@ -5964,6 +6140,15 @@ function normalizePositiveInt(value, fallback) {
5964
6140
  DEFAULT_SERVER_PORT,
5965
6141
  HOST_NAME,
5966
6142
  MODULES,
6143
+ NETSUITE_DESTRUCTIVE_TOOL_NAMES,
6144
+ NETSUITE_FN_TOOL_NAMES,
6145
+ NETSUITE_INSTRUCTIONS,
6146
+ NETSUITE_MODULE,
6147
+ NETSUITE_MODULE_ID,
6148
+ NETSUITE_MODULE_TITLE,
6149
+ NETSUITE_READ_ONLY_TOOL_NAMES,
6150
+ NETSUITE_TOOL_NAMES,
6151
+ NETSUITE_TOOL_SCHEMAS,
5967
6152
  NativeMessageType,
5968
6153
  RAW_MAX_OUTPUT_BYTES,
5969
6154
  TOOL_NAMES,
package/dist/index.mjs CHANGED
@@ -30,6 +30,10 @@ 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";
33
37
  return NativeMessageType2;
34
38
  })(NativeMessageType || {});
35
39
 
@@ -5601,8 +5605,170 @@ var WORKATO_MODULE = {
5601
5605
  destructiveTools: WORKATO_DESTRUCTIVE_TOOL_NAMES
5602
5606
  };
5603
5607
 
5608
+ // src/modules/netsuite/instructions.ts
5609
+ var NETSUITE_INSTRUCTIONS = "NetSuite: login page -> netsuite_session_ensure (imported: reload); log in only on none, then netsuite_session_publish.";
5610
+
5611
+ // src/modules/netsuite/tool-names.ts
5612
+ var NETSUITE_TOOL_NAMES = {
5613
+ NETSUITE_SESSION: {
5614
+ STATUS: "netsuite_session_status",
5615
+ ENSURE: "netsuite_session_ensure",
5616
+ PUBLISH: "netsuite_session_publish",
5617
+ LOCK: "netsuite_session_lock",
5618
+ UNLOCK: "netsuite_session_unlock"
5619
+ }
5620
+ };
5621
+ var NETSUITE_READ_ONLY_TOOL_NAMES = ["netsuite_session_status"];
5622
+ var NETSUITE_DESTRUCTIVE_TOOL_NAMES = [];
5623
+ var NETSUITE_FN_TOOL_NAMES = [
5624
+ "netsuite_session_ensure",
5625
+ "netsuite_session_publish",
5626
+ "netsuite_session_lock",
5627
+ "netsuite_session_unlock"
5628
+ ];
5629
+
5630
+ // src/modules/netsuite/schemas.ts
5631
+ var T = NETSUITE_TOOL_NAMES.NETSUITE_SESSION;
5632
+ var NETSUITE_TOOL_SCHEMAS = [
5633
+ {
5634
+ name: T.STATUS,
5635
+ 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).",
5636
+ inputSchema: {
5637
+ type: "object",
5638
+ properties: {
5639
+ account: {
5640
+ ...{
5641
+ type: "string",
5642
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5643
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5644
+ },
5645
+ description: "Only this account."
5646
+ }
5647
+ }
5648
+ }
5649
+ },
5650
+ {
5651
+ name: T.ENSURE,
5652
+ 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.",
5653
+ inputSchema: {
5654
+ type: "object",
5655
+ properties: {
5656
+ account: {
5657
+ type: "string",
5658
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5659
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5660
+ },
5661
+ user: { type: "string", description: "NetSuite user email to take the session of." },
5662
+ vault_item: {
5663
+ type: "string",
5664
+ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
5665
+ description: "Bitwarden item id: its username is the user (the item's password is never read)."
5666
+ },
5667
+ wait_for_lock: {
5668
+ type: "boolean",
5669
+ default: false,
5670
+ description: "When another machine holds the login lock, wait (polling every 3 s) until it publishes or the lock ends."
5671
+ }
5672
+ },
5673
+ required: ["account"]
5674
+ }
5675
+ },
5676
+ {
5677
+ name: T.PUBLISH,
5678
+ 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.",
5679
+ inputSchema: {
5680
+ type: "object",
5681
+ properties: {
5682
+ account: {
5683
+ type: "string",
5684
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5685
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5686
+ },
5687
+ user: {
5688
+ type: "string",
5689
+ description: "NetSuite user email, when no tab of the account is open."
5690
+ },
5691
+ vault_item: {
5692
+ type: "string",
5693
+ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
5694
+ description: "Bitwarden item id whose username is the user, when no tab is open."
5695
+ },
5696
+ login_at: {
5697
+ type: "boolean",
5698
+ default: false,
5699
+ description: "This session was just logged in (sets login_at to now)."
5700
+ }
5701
+ },
5702
+ required: ["account"]
5703
+ }
5704
+ },
5705
+ {
5706
+ name: T.LOCK,
5707
+ 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.",
5708
+ inputSchema: {
5709
+ type: "object",
5710
+ properties: {
5711
+ account: {
5712
+ type: "string",
5713
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5714
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5715
+ },
5716
+ user: { type: "string", description: "NetSuite user email." },
5717
+ vault_item: {
5718
+ type: "string",
5719
+ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
5720
+ description: "Bitwarden item id whose username is the user."
5721
+ },
5722
+ run_id: { type: "string", description: "Run id for the lock holder (shown to others)." },
5723
+ ttl_s: {
5724
+ type: "integer",
5725
+ minimum: 10,
5726
+ maximum: 120,
5727
+ default: 120,
5728
+ description: "Seconds the lock lasts."
5729
+ }
5730
+ },
5731
+ required: ["account"]
5732
+ }
5733
+ },
5734
+ {
5735
+ name: T.UNLOCK,
5736
+ description: "Release the login lock this machine and profile hold for an account and user. Returns unlocked, store_unconfigured or no_store.",
5737
+ inputSchema: {
5738
+ type: "object",
5739
+ properties: {
5740
+ account: {
5741
+ type: "string",
5742
+ pattern: "^([0-9]+|[Tt][Dd][0-9]+|[Tt][Ss][Tt][Dd][Rr][Vv][0-9]+)([_-][A-Za-z0-9]+)?$",
5743
+ description: "NetSuite account id: 1234567, 1234567_SB2, td3125712, tstdrv1234567 (any case)."
5744
+ },
5745
+ user: { type: "string", description: "NetSuite user email." },
5746
+ vault_item: {
5747
+ type: "string",
5748
+ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
5749
+ description: "Bitwarden item id whose username is the user."
5750
+ },
5751
+ run_id: { type: "string", description: "The run id the lock was taken with, if any." }
5752
+ },
5753
+ required: ["account"]
5754
+ }
5755
+ }
5756
+ ];
5757
+
5758
+ // src/modules/netsuite/index.ts
5759
+ var NETSUITE_MODULE_ID = "netsuite";
5760
+ var NETSUITE_MODULE_TITLE = "NetSuite";
5761
+ var NETSUITE_MODULE = {
5762
+ id: NETSUITE_MODULE_ID,
5763
+ title: NETSUITE_MODULE_TITLE,
5764
+ tools: NETSUITE_TOOL_SCHEMAS,
5765
+ instructions: NETSUITE_INSTRUCTIONS,
5766
+ readOnlyTools: NETSUITE_READ_ONLY_TOOL_NAMES,
5767
+ destructiveTools: NETSUITE_DESTRUCTIVE_TOOL_NAMES
5768
+ };
5769
+
5604
5770
  // src/modules/index.ts
5605
- var MODULES = [WORKATO_MODULE];
5771
+ var MODULES = [WORKATO_MODULE, NETSUITE_MODULE];
5606
5772
  var TOOL_NAMES = {
5607
5773
  BROWSER: CORE_TOOL_NAMES.BROWSER,
5608
5774
  BRIDGE: CORE_TOOL_NAMES.BRIDGE,
@@ -5612,7 +5778,8 @@ var TOOL_NAMES = {
5612
5778
  WORKATO_LCAP: WORKATO_TOOL_NAMES.WORKATO_LCAP,
5613
5779
  WORKATO_LOOKUP: WORKATO_TOOL_NAMES.WORKATO_LOOKUP,
5614
5780
  WORKATO_DATA_TABLE: WORKATO_TOOL_NAMES.WORKATO_DATA_TABLE,
5615
- WORKATO_SESSION: WORKATO_TOOL_NAMES.WORKATO_SESSION
5781
+ WORKATO_SESSION: WORKATO_TOOL_NAMES.WORKATO_SESSION,
5782
+ NETSUITE_SESSION: NETSUITE_TOOL_NAMES.NETSUITE_SESSION
5616
5783
  };
5617
5784
  var TOOL_SCHEMAS = /* @__PURE__ */ allToolSchemas();
5618
5785
  function allToolSchemas() {
@@ -5908,6 +6075,15 @@ export {
5908
6075
  DEFAULT_SERVER_PORT,
5909
6076
  HOST_NAME,
5910
6077
  MODULES,
6078
+ NETSUITE_DESTRUCTIVE_TOOL_NAMES,
6079
+ NETSUITE_FN_TOOL_NAMES,
6080
+ NETSUITE_INSTRUCTIONS,
6081
+ NETSUITE_MODULE,
6082
+ NETSUITE_MODULE_ID,
6083
+ NETSUITE_MODULE_TITLE,
6084
+ NETSUITE_READ_ONLY_TOOL_NAMES,
6085
+ NETSUITE_TOOL_NAMES,
6086
+ NETSUITE_TOOL_SCHEMAS,
5911
6087
  NativeMessageType,
5912
6088
  RAW_MAX_OUTPUT_BYTES,
5913
6089
  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.2.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",