@j-o-r/hello-dave 0.0.5 → 0.0.7

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.
Files changed (127) hide show
  1. package/CHANGELOG.md +13 -26
  2. package/README.md +161 -522
  3. package/README.md.bak +144 -449
  4. package/{examples → agents}/ask_agent.js +5 -5
  5. package/{examples → agents}/codeserver.sh +14 -14
  6. package/{examples → agents}/daisy_agent.js +5 -5
  7. package/{examples → agents}/docs_agent.js +5 -5
  8. package/{examples → agents}/gpt_agent.js +5 -5
  9. package/{examples → agents}/grok_agent.js +5 -5
  10. package/agents/memory_agent.js +263 -0
  11. package/{examples → agents}/npm_agent.js +5 -5
  12. package/{examples → agents}/prompt_agent.js +5 -5
  13. package/agents/spawn_agent.js +137 -0
  14. package/{examples → agents}/test_agent.js +6 -8
  15. package/{examples → agents}/todo_agent.js +5 -5
  16. package/bin/codeDave +58 -0
  17. package/bin/dave.js +114 -96
  18. package/lib/AgentClient.js +111 -67
  19. package/lib/AgentManager.js +111 -80
  20. package/lib/AgentServer.js +144 -104
  21. package/lib/Cli.js +126 -93
  22. package/lib/Prompt.js +38 -5
  23. package/lib/Session.js +102 -79
  24. package/lib/ToolSet.js +79 -60
  25. package/lib/fafs.js +54 -19
  26. package/lib/genericToolset.js +109 -213
  27. package/lib/wsCli.js +50 -19
  28. package/lib/wsIO.js +11 -17
  29. package/package.json +2 -2
  30. package/types/AgentClient.d.ts +69 -35
  31. package/types/AgentManager.d.ts +50 -56
  32. package/types/AgentServer.d.ts +63 -16
  33. package/types/Cli.d.ts +56 -10
  34. package/types/Prompt.d.ts +36 -4
  35. package/types/Session.d.ts +23 -9
  36. package/types/ToolSet.d.ts +49 -32
  37. package/types/fafs.d.ts +68 -25
  38. package/types/wsCli.d.ts +14 -0
  39. package/types/wsIO.d.ts +9 -5
  40. package/utils/search_sessions.sh +100 -53
  41. package/README.md.backup +0 -269
  42. package/README.md.bak.1774780058 +0 -338
  43. package/README.md.bak2 +0 -531
  44. package/bin/spawn_agent.js +0 -293
  45. package/docs.bak.1774780058/agent-manager.md +0 -167
  46. package/docs.bak.1774780058/agent-manager.md.bak +0 -137
  47. package/docs.bak.1774780058/agent-manager.md.bak2 +0 -157
  48. package/docs.bak.1774780058/codeserver-pattern.md +0 -191
  49. package/docs.bak.1774780058/path-resolution-best-practices.md +0 -104
  50. package/docs.bak.1774780058/project-overview.md +0 -67
  51. package/docs.bak.1774780058/project-overview.md.bak +0 -67
  52. package/docs.bak.1774780058/prompt-class.md +0 -141
  53. package/docs.bak.1774780058/prompt-class.md.bak +0 -142
  54. package/docs.bak.1774780058/tools-syntax-validation.md +0 -121
  55. package/docs.bak.1774780058/tools-syntax-validation.md.bak2 +0 -125
  56. package/docs.bak.1774780058/tools-syntax-validation.md.bak3 +0 -125
  57. package/docs.bak.1774780058/tools-syntax-validation.md.bak4 +0 -106
  58. package/docs.bak.1774780058/tools-syntax-validation.md.bak_path +0 -106
  59. package/docs.bak.1774780058/toolset.md +0 -164
  60. package/docs.bak.1774780058/toolset.md.bak +0 -94
  61. package/docs.bak.1774780058/toolset.md.bak3 +0 -161
  62. package/docs.bak.1774780058/toolset.md.bak4 +0 -161
  63. package/docs.bak.1774780058/toolset.md.bak5 +0 -161
  64. package/docs.bak.1774780058/toolset.md.bak6 +0 -163
  65. package/docs.bak.1774780058/toolset.md.bak_path +0 -163
  66. package/docs.bak.1774780058/toolset.md.bak_syntax +0 -161
  67. package/docs.bak.1774780058/xai-responses.md +0 -111
  68. package/docs.bak.1774780058/xai-responses.md.bak +0 -107
  69. package/docs.bak.1774780058/xai-responses.md.bak2 +0 -107
  70. package/docs.bak.1774780058/xai_collections.md +0 -106
  71. package/examples/memory_agent.js +0 -152
  72. package/examples.bak.1774780058/ask_agent.js +0 -114
  73. package/examples.bak.1774780058/code_agent.js +0 -149
  74. package/examples.bak.1774780058/coderev_agent.js +0 -72
  75. package/examples.bak.1774780058/codeserver.sh +0 -47
  76. package/examples.bak.1774780058/daisy_agent.js +0 -177
  77. package/examples.bak.1774780058/docs_agent.js +0 -119
  78. package/examples.bak.1774780058/gpt_agent.js +0 -109
  79. package/examples.bak.1774780058/grok_agent.js +0 -98
  80. package/examples.bak.1774780058/memory_agent.js +0 -112
  81. package/examples.bak.1774780058/npm_agent.js +0 -175
  82. package/examples.bak.1774780058/prompt_agent.js +0 -112
  83. package/examples.bak.1774780058/readme_agent.js +0 -144
  84. package/examples.bak.1774780058/spawn_agent.js +0 -263
  85. package/examples.bak.1774780058/test_agent.js +0 -162
  86. package/examples.bak.1774780058/todo_agent.js +0 -138
  87. package/lib/genericToolset.js.bak_syntax +0 -402
  88. package/scenarios.bak.1774780058/data/eval_node_message.json +0 -9
  89. package/scenarios.bak.1774780058/data/hist_oa.json +0 -66
  90. package/scenarios.bak.1774780058/data/o3_response1.json +0 -96
  91. package/scenarios.bak.1774780058/data/oa_reasoning_parse.json +0 -112
  92. package/scenarios.bak.1774780058/data/tool_oa.json +0 -96
  93. package/scenarios.bak.1774780058/data/tool_xai.json +0 -59
  94. package/scenarios.bak.1774780058/data/tool_xai2.json +0 -40
  95. package/scenarios.bak.1774780058/data/xai-response-1.json +0 -59
  96. package/scenarios.bak.1774780058/data/xai-response-2.json +0 -10
  97. package/scenarios.bak.1774780058/data/xai_reasoning_tools_resp.json +0 -59
  98. package/scenarios.bak.1774780058/data/xai_search_response.json +0 -58
  99. package/scenarios.bak.1774780058/environment.js +0 -10
  100. package/scenarios.bak.1774780058/example.js +0 -17
  101. package/scenarios.bak.1774780058/genericToolset.test.js +0 -182
  102. package/scenarios.bak.1774780058/grok.js +0 -113
  103. package/scenarios.bak.1774780058/memory-tools.js +0 -51
  104. package/scenarios.bak.1774780058/openai-o3.js +0 -137
  105. package/scenarios.bak.1774780058/openai-prompt.js +0 -155
  106. package/scenarios.bak.1774780058/openai-session.js +0 -148
  107. package/scenarios.bak.1774780058/openai.js +0 -102
  108. package/scenarios.bak.1774780058/prompt.js +0 -118
  109. package/scenarios.bak.1774780058/promptFishbowl.js +0 -76
  110. package/scenarios.bak.1774780058/search.brave.com.js +0 -25
  111. package/scenarios.bak.1774780058/sh.js +0 -15
  112. package/scenarios.bak.1774780058/test-wsio.js +0 -26
  113. package/scenarios.bak.1774780058/testToolset.js +0 -42
  114. package/scenarios.bak.1774780058/toolset.js +0 -16
  115. package/scenarios.bak.1774780058/toolset.test.js +0 -141
  116. package/scenarios.bak.1774780058/write_file_syntax.test.js +0 -145
  117. package/scenarios.bak.1774780058/write_file_validation/README.md +0 -30
  118. package/scenarios.bak.1774780058/write_file_validation/bad.js +0 -3
  119. package/scenarios.bak.1774780058/write_file_validation/good.js +0 -4
  120. package/scenarios.bak.1774780058/write_file_validation/test.sh +0 -43
  121. package/scenarios.bak.1774780058/wsClient.js +0 -69
  122. package/scenarios.bak.1774780058/xai_responses.integration.test.js +0 -57
  123. package/scenarios.bak.1774780058/xai_responses.test.js +0 -154
  124. package/scenarios.bak.1774780058/xaicoll.js +0 -50
  125. package/scenarios.bak.1774780058/xaifiles.js +0 -48
  126. /package/{examples → agents}/code_agent.js +0 -0
  127. /package/{examples → agents}/readme_agent.js +0 -0
@@ -1,96 +0,0 @@
1
- {
2
- "status": 200,
3
- "response": {
4
- "id": "resp_685d593c2be081a3aead008d73a85ccb0c3ba89bbd579f4c",
5
- "object": "response",
6
- "created_at": 1750948156,
7
- "status": "completed",
8
- "background": false,
9
- "error": null,
10
- "incomplete_details": null,
11
- "instructions": "You are an assistant for an administrative office. Respond precise and concise",
12
- "max_output_tokens": 4000,
13
- "max_tool_calls": null,
14
- "model": "gpt-4.1-2025-04-14",
15
- "output": [
16
- {
17
- "id": "fc_685d593ccbec81a3a82ce22587b0ea1f0c3ba89bbd579f4c",
18
- "type": "function_call",
19
- "status": "completed",
20
- "arguments": "{}",
21
- "call_id": "call_at1hBqHlVOXWvjs2d2KZnY6n",
22
- "name": "get_date_time"
23
- },
24
- {
25
- "id": "fc_685d593ce3dc81a3a78b88ed1f9c80d50c3ba89bbd579f4c",
26
- "type": "function_call",
27
- "status": "completed",
28
- "arguments": "{\"location\":\"Amsterdam, The Netherlands\"}",
29
- "call_id": "call_e233mDWoMkYk1uwbaHj4T9kF",
30
- "name": "get_current_weather"
31
- }
32
- ],
33
- "parallel_tool_calls": true,
34
- "previous_response_id": null,
35
- "reasoning": {
36
- "effort": null,
37
- "summary": null
38
- },
39
- "service_tier": "default",
40
- "store": false,
41
- "temperature": 1,
42
- "text": {
43
- "format": {
44
- "type": "text"
45
- }
46
- },
47
- "tool_choice": "auto",
48
- "tools": [
49
- {
50
- "type": "function",
51
- "description": "Get the current weather in a given location",
52
- "name": "get_current_weather",
53
- "parameters": {
54
- "type": "object",
55
- "properties": {
56
- "location": {
57
- "type": "string",
58
- "description": "The city and country"
59
- }
60
- },
61
- "required": [
62
- "location"
63
- ]
64
- },
65
- "strict": true
66
- },
67
- {
68
- "type": "function",
69
- "description": "Get the current date and time",
70
- "name": "get_date_time",
71
- "parameters": {
72
- "type": "object",
73
- "properties": {}
74
- },
75
- "strict": true
76
- }
77
- ],
78
- "top_p": 1,
79
- "truncation": "disabled",
80
- "usage": {
81
- "input_tokens": 134,
82
- "input_tokens_details": {
83
- "cached_tokens": 0
84
- },
85
- "output_tokens": 46,
86
- "output_tokens_details": {
87
- "reasoning_tokens": 0
88
- },
89
- "total_tokens": 180
90
- },
91
- "user": null,
92
- "metadata": {}
93
- },
94
- "headers": {},
95
- "responseType": "js"
96
- }
@@ -1,59 +0,0 @@
1
- {
2
- "status": 200,
3
- "response": {
4
- "id": "2ebef507-bb45-4f25-bf52-87640fa092de",
5
- "object": "chat.completion",
6
- "created": 1751032835,
7
- "model": "grok-3",
8
- "choices": [
9
- {
10
- "index": 0,
11
- "message": {
12
- "role": "assistant",
13
- "content": "\n",
14
- "tool_calls": [
15
- {
16
- "id": "call_43974044",
17
- "function": {
18
- "name": "get_date_time",
19
- "arguments": "{}"
20
- },
21
- "type": "function"
22
- },
23
- {
24
- "id": "call_08990177",
25
- "function": {
26
- "name": "get_current_weather",
27
- "arguments": "{\"location\":\"Amsterdam, The Netherlands\"}"
28
- },
29
- "type": "function"
30
- }
31
- ],
32
- "refusal": null
33
- },
34
- "finish_reason": "stop"
35
- }
36
- ],
37
- "usage": {
38
- "prompt_tokens": 352,
39
- "completion_tokens": 52,
40
- "total_tokens": 404,
41
- "prompt_tokens_details": {
42
- "text_tokens": 352,
43
- "audio_tokens": 0,
44
- "image_tokens": 0,
45
- "cached_tokens": 6
46
- },
47
- "completion_tokens_details": {
48
- "reasoning_tokens": 0,
49
- "audio_tokens": 0,
50
- "accepted_prediction_tokens": 0,
51
- "rejected_prediction_tokens": 0
52
- },
53
- "num_sources_used": 0
54
- },
55
- "system_fingerprint": "fp_be0739e203"
56
- },
57
- "headers": {},
58
- "responseType": "js"
59
- }
@@ -1,40 +0,0 @@
1
- {
2
- "status": 200,
3
- "responseType": "js",
4
- "response": {
5
- "id": "bf3d0a13-75f8-e2e5-4eab-93b4f20611cd",
6
- "object": "chat.completion",
7
- "created": 1751356925,
8
- "model": "grok-3",
9
- "choices": [
10
- {
11
- "index": 0,
12
- "message": {
13
- "role": "assistant",
14
- "content": "Today is Friday, May 12, 2025, and the time is 12:45. The current weather in Amsterdam, The Netherlands, is 24°C.",
15
- "refusal": null
16
- },
17
- "finish_reason": "stop"
18
- }
19
- ],
20
- "usage": {
21
- "prompt_tokens": 386,
22
- "completion_tokens": 35,
23
- "total_tokens": 421,
24
- "prompt_tokens_details": {
25
- "text_tokens": 386,
26
- "audio_tokens": 0,
27
- "image_tokens": 0,
28
- "cached_tokens": 5
29
- },
30
- "completion_tokens_details": {
31
- "reasoning_tokens": 0,
32
- "audio_tokens": 0,
33
- "accepted_prediction_tokens": 0,
34
- "rejected_prediction_tokens": 0
35
- },
36
- "num_sources_used": 0
37
- },
38
- "system_fingerprint": "fp_be0739e203"
39
- }
40
- }
@@ -1,59 +0,0 @@
1
- {
2
- "status": 200,
3
- "response": {
4
- "id": "080ab233-e37e-bd72-4d2e-e0fb478e05e8",
5
- "object": "chat.completion",
6
- "created": 1752061910,
7
- "model": "grok-3",
8
- "choices": [
9
- {
10
- "index": 0,
11
- "message": {
12
- "role": "assistant",
13
- "content": "\n",
14
- "tool_calls": [
15
- {
16
- "id": "call_95425891",
17
- "function": {
18
- "name": "get_date_time",
19
- "arguments": "{}"
20
- },
21
- "type": "function"
22
- },
23
- {
24
- "id": "call_27865503",
25
- "function": {
26
- "name": "get_current_weather",
27
- "arguments": "{\"location\":\"Amsterdam, The Netherlands\"}"
28
- },
29
- "type": "function"
30
- }
31
- ],
32
- "refusal": null
33
- },
34
- "finish_reason": "stop"
35
- }
36
- ],
37
- "usage": {
38
- "prompt_tokens": 305,
39
- "completion_tokens": 52,
40
- "total_tokens": 357,
41
- "prompt_tokens_details": {
42
- "text_tokens": 305,
43
- "audio_tokens": 0,
44
- "image_tokens": 0,
45
- "cached_tokens": 2
46
- },
47
- "completion_tokens_details": {
48
- "reasoning_tokens": 0,
49
- "audio_tokens": 0,
50
- "accepted_prediction_tokens": 0,
51
- "rejected_prediction_tokens": 0
52
- },
53
- "num_sources_used": 0
54
- },
55
- "system_fingerprint": "fp_9ad1a16f77"
56
- },
57
- "headers": {},
58
- "responseType": "js"
59
- }
@@ -1,10 +0,0 @@
1
- 1. Parse reponse 1 {
2
- "status": 422,
3
- "response": "Failed to deserialize the JSON body into the target type: messages[2]: missing field `name` at line 1 column 527",
4
- "headers": {},
5
- "responseType": "text"
6
- }
7
- (duration: 394 ms)
8
- --------------------------------------------------
9
- Total: 2 tests, executed: 1 in 394 ms - errors: 0
10
- ** Not all tests have been executed **
@@ -1,59 +0,0 @@
1
- {
2
- "status": 200,
3
- "responseType": "js",
4
- "response": {
5
- "id": "cb870601-b91e-c00f-bb28-bb3211c9ba0a",
6
- "object": "chat.completion",
7
- "created": 1751294195,
8
- "model": "grok-3-mini-fast",
9
- "choices": [
10
- {
11
- "index": 0,
12
- "message": {
13
- "role": "assistant",
14
- "content": "\n",
15
- "reasoning_content": "First, the user is asking two things: 1) What day is today? 2) What is the weather forecast in Amsterdam, The Netherlands.\n\nAvailable tools:\n\n- get_current_weather: This requires a location, like a city and country. The user specified \"Amsterdam, The Netherlands\", which matches perfectly.\n\n- get_date_time: This gets the current date and time. It doesn't require any parameters, so I can call it directly.\n\nI need to address both parts of the query. For the date and time, I can use get_date_time. For the weather, I can use get_current_weather with the location provided.\n\nThe description for get_current_weather says \"Get the current weather\", not \"forecast\". The user said \"weather forecast\", but the tool is for current weather. I should use it as is, since it's the closest match.\n\nIn a multi-turn conversation, I should call functions to advance the request. So, I need to call both functions.\n\nResponse guidelines: Respond precisely and concisely. Only use <function_call> tags when deciding to call a function.\n\nSince both parts can be handled by available functions, I should call them.\n\nFirst, call get_date_time for the current date and time.\n\nSecond, call get_current_weather for Amsterdam, The Netherlands.\n\nI can use multiple <function_call> tags in my response.\n\nAfter calling these functions, the system will presumably execute them and provide results, then I can respond based on that.\n\nMy response should only contain the function calls if that's the next step.\n\nStructure: If I'm calling functions, my response should just be the <function_call> tags, without additional text, to keep it concise.\n\nThe instructions say: \"You are only permitted to use the <function_call> tag in your response only if you have made the decision to call a function.\"\n\nSo, for this query, my response should consist of the function calls.\n\nOrder: Maybe call get_date_time first, then get_current_weather.\n\nFinally, once I have the results, in a subsequent turn, I can compile the answer.\n\nBut for now, in this response, I just need to output the function calls.",
16
- "tool_calls": [
17
- {
18
- "id": "call_73832078",
19
- "function": {
20
- "name": "get_date_time",
21
- "arguments": "{}"
22
- },
23
- "type": "function"
24
- },
25
- {
26
- "id": "call_35308569",
27
- "function": {
28
- "name": "get_current_weather",
29
- "arguments": "{\"location\":\"Amsterdam, The Netherlands\"}"
30
- },
31
- "type": "function"
32
- }
33
- ],
34
- "refusal": null
35
- },
36
- "finish_reason": "stop"
37
- }
38
- ],
39
- "usage": {
40
- "prompt_tokens": 341,
41
- "completion_tokens": 52,
42
- "total_tokens": 827,
43
- "prompt_tokens_details": {
44
- "text_tokens": 341,
45
- "audio_tokens": 0,
46
- "image_tokens": 0,
47
- "cached_tokens": 5
48
- },
49
- "completion_tokens_details": {
50
- "reasoning_tokens": 434,
51
- "audio_tokens": 0,
52
- "accepted_prediction_tokens": 0,
53
- "rejected_prediction_tokens": 0
54
- },
55
- "num_sources_used": 0
56
- },
57
- "system_fingerprint": "fp_768091f8b2"
58
- }
59
- }
@@ -1,58 +0,0 @@
1
- {
2
- "status": 200,
3
- "responseType": "js",
4
- "response": {
5
- "id": "f964eed9-95b6-5d95-2383-d25be743d8e6",
6
- "object": "chat.completion",
7
- "created": 1751456496,
8
- "model": "grok-3-mini",
9
- "choices": [
10
- {
11
- "index": 0,
12
- "message": {
13
- "role": "assistant",
14
- "content": "To install a Language Server Protocol (LSP) for JavaScript on the Helix editor, follow these steps based on Helix documentation and community guides:\n\n### 1. **Install a JavaScript Language Server**\n - The most common LSP for JavaScript is the TypeScript Language Server (tsserver), which also supports JavaScript.\n - Install it via npm (Node.js package manager):\n ```\n npm install -g typescript\n ```\n - Ensure Node.js and npm are installed first (download from the official Node.js website if needed).\n - Alternatively, other LSPs like ESLint or Volar can be used for specific features; install them via npm or their respective methods.\n\n### 2. **Configure Helix Editor**\n - Helix uses a `languages.toml` file for language server settings.\n - Locate or create a `languages.toml` file in one of these locations (as per Helix docs):\n - User config: `~/.config/helix/languages.toml`\n - Project-specific: In your project directory.\n - Add or update the JavaScript section. For example, add this to your `languages.toml`:\n ```\n [language.javascript]\n language-server = { command = \"typescript-language-server\", args = [\"--stdio\"] }\n ```\n - This assumes `typescript-language-server` is installed (it comes with the TypeScript global install).\n - Save the file and restart Helix.\n\n### 3. **Verify and Test**\n - Run `hx --health` in your terminal to check language server support.\n - Open a JavaScript file in Helix (e.g., `.js` or `.ts`) and test features like autocompletion or diagnostics.\n\nFor more details, refer to the Helix documentation on language support (e.g., docs.helix-editor.com/lang-support.html) or a guide on installing Helix language servers. If you encounter issues, ensure your Helix version is up to date. If this doesn't work, posts on platforms like X suggest checking npm installations for compatibility.",
15
- "reasoning_content": "First, the user is asking: \"How to install an LSP for JavaScript on the Helix editor.\" This matches the search query I have context for: \"Install Language Server Protocol for JavaScript on Helix editor.\"\n\nI need to respond precisely and concisely, as per my system prompt. I'm an assistant for searches on the internet, so I should base my answer on the provided web results, news results, and X posts, but only if relevant.\n\nKey relevant information from the web results:\n\n- From ‽web:0 (docs.helix-editor.com/lang-support.html): Helix supports languages and Language Servers. You need to configure the appropriate Language Server.\n\n- From ‽web:1 (docs.helix-editor.com/languages.html): Language-specific settings are in languages.toml files.\n\n- From ‽web:2 (ar.al/2022/11/14/...): There's a script for installing Language Servers for web development in Helix.\n\n- From ‽web:3 (batsov.com/articles/2025/02/21/...): A basic Helix setup for JavaScript, which likely includes LSP setup.\n\n- From ‽web:4 (github.com/helix-editor/helix): The languages.toml file, which is key for configuration.\n\nFrom news results:\n\n- ‽web:3 (volarjs.dev/guides/first-server/): This is about Volar, which is a Language Server for Vue.js but might be adaptable for JavaScript.\n\n- ‽web:4 (guillermoap.medium.com/...): Turning Helix into an IDE, which could involve LSP setup.\n\nFrom X posts:\n\n- There's a post about IntelliJ supporting LSP, but that's not directly related.\n\n- Astro post mentions building on LSP and using it for JS.\n\n- A post by Alisher mentions installing with npm, which could be relevant for JavaScript LSP.\n\nThe most directly relevant is the script from Aral Balkan's blog (‽web:2) and the Helix documentation.\n\nSteps to install LSP for JavaScript in Helix:\n\n1. Identify the Language Server for JavaScript. Common ones are like TypeScript Language Server (tsserver) since JavaScript is handled by TypeScript tools.\n\n2. Configure it in Helix via languages.toml.\n\nFrom the results, users need to install the Language Server first, then configure it in Helix.\n\nA concise answer should include:\n\n- Install a JavaScript Language Server, e.g., via npm (like typescript, which includes tsserver).\n\n- Configure it in Helix's languages.toml file.\n\nMention sources briefly if it makes sense, like referring to Helix documentation.\n\nFinally, structure the response: Be precise, use bullet points or numbered steps for clarity, and keep it concise.",
16
- "refusal": null
17
- },
18
- "finish_reason": "stop"
19
- }
20
- ],
21
- "usage": {
22
- "prompt_tokens": 2434,
23
- "completion_tokens": 411,
24
- "total_tokens": 3393,
25
- "prompt_tokens_details": {
26
- "text_tokens": 2434,
27
- "audio_tokens": 0,
28
- "image_tokens": 0,
29
- "cached_tokens": 6
30
- },
31
- "completion_tokens_details": {
32
- "reasoning_tokens": 548,
33
- "audio_tokens": 0,
34
- "accepted_prediction_tokens": 0,
35
- "rejected_prediction_tokens": 0
36
- },
37
- "num_sources_used": 3
38
- },
39
- "system_fingerprint": "fp_2e0c052777",
40
- "citations": [
41
- "https://docs.helix-editor.com/lang-support.html",
42
- "https://docs.helix-editor.com/languages.html",
43
- "https://ar.al/2022/11/14/installing-helix-editor-language-servers/",
44
- "https://batsov.com/articles/2025/02/21/a-basic-helix-setup-for-javascript/",
45
- "https://github.com/helix-editor/helix/blob/master/languages.toml",
46
- "https://herecomesthemoon.net/2025/06/i-like-helix/",
47
- "https://freecodecamp.org/news/how-to-build-a-custom-mcp-server-with-typescript-a-handbook-for-developers",
48
- "https://infoworld.com/article/3849654/typescript-gets-go-faster-stripes.html",
49
- "https://volarjs.dev/guides/first-server/",
50
- "https://guillermoap.medium.com/turning-helix-into-an-ide-with-the-help-of-zellij-03c4e52524da",
51
- "https://x.com/JBPlatform/status/1677320230534561793",
52
- "https://x.com/sawaba/status/1061673555652472833",
53
- "https://x.com/0xMert_/status/1748394502073520405",
54
- "https://x.com/astrodotbuild/status/1760709773589188811",
55
- "https://x.com/JavaScriptDaily/status/1264628987592093697"
56
- ]
57
- }
58
- }
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- import { Test , assert} from '@j-o-r/sh';
3
- import {env} from '../lib/fafs.js';
4
- const test = new Test();
5
- test.add('Test enviroment caching', async () => {
6
- const user = await env();
7
- console.log(user);
8
- assert.strictEqual(typeof user, 'object');
9
- });
10
- await test.run();
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- import assert from 'node:assert/strict';
3
- /**
4
- * Create a async callstack
5
- * @param {function} callback - async function
6
- */
7
- const test = (callback) => {
8
- (async () => {
9
- return await callback()
10
- })()
11
- }
12
- test(async () => {
13
- assert.equal(true, true);
14
- });
15
-
16
-
17
-
@@ -1,182 +0,0 @@
1
- #!/usr/bin/env node
2
- import { Test, assert, jsType } from '@j-o-r/sh';
3
- import tools from '../lib/genericToolset.js'; // Import the ToolSet instance to test
4
-
5
- const t = new Test();
6
-
7
- // Test 1: get_user_env - Should return a string with environment details
8
- t.add('get_user_env returns environment info', async () => {
9
- const result = await tools.call('get_user_env', {});
10
- assert.ok(typeof result === 'string' && result.includes('Name:') && result.includes('System:'));
11
- console.log('Environment snippet:', result.slice(0, 100));
12
- });
13
-
14
- // Test 2: javascript_interpreter - Execute a simple JS script
15
- t.add('javascript_interpreter executes basic math', async () => {
16
- const script = "console.log(2 + 2);";
17
- const result = await tools.call('javascript_interpreter', { script });
18
- assert.ok(result.includes('4'));
19
- });
20
-
21
- // Test 3: execute_bash_script - Run pwd (flexible path check)
22
- t.add('execute_bash_script runs pwd', async () => {
23
- const bash_script = 'pwd';
24
- const result = await tools.call('execute_bash_script', { bash_script });
25
- assert.ok(result && result.includes('hello-dave'));
26
- console.log('Current dir:', result.trim());
27
- });
28
-
29
- // Test 4: history_search - Empty query lists sessions (no error)
30
- t.add('history_search empty query lists sessions', async () => {
31
- const result = await tools.call('history_search', { query: '' });
32
- assert.ok(typeof result === 'string' && result.length > 10); // Expect non-trivial output from list_sessions.sh
33
- console.log('History search snippet:', result.slice(0, 200));
34
- });
35
-
36
- // Test 5: ToolSet basics - Verify key tools exist (flexible, subset + min count)
37
- t.add('ToolSet has expected tools', () => {
38
- const toolList = tools.list();
39
- const expectedTools = [
40
- 'execute_bash_script', 'execute_remote_script', 'get_user_env', 'history_search',
41
- 'javascript_interpreter', 'memory_recall', 'memory_write', 'open_link',
42
- 'read_file', 'send_email', 'syntax_check', 'write_file'
43
- ];
44
- const actualNames = toolList.map(t => t.name).sort();
45
- assert.ok(toolList.length >= 12, `Expected at least 12 tools, got ${toolList.length}`);
46
- assert.ok(expectedTools.every(name => actualNames.includes(name)),
47
- `Missing tools. Expected: ${expectedTools.join(', ')}. Got: ${actualNames.join(', ')}`);
48
- console.log(`Tool count: ${toolList.length}, names: ${actualNames.slice(0,5).join(', ')}...`);
49
- });
50
-
51
- // Test 6: javascript_interpreter - Complex JS with backticks (template literal)
52
- t.add('javascript_interpreter handles backticks/templates', async () => {
53
- const script = `
54
- const name = 'Dave';
55
- const greeting = \`Hello \${name}!\`;
56
- console.log(greeting);
57
- console.log(\`2 + 2 = \${2 + 2}\`);
58
- `.trim();
59
- const result = await tools.call('javascript_interpreter', { script });
60
- assert.ok(result.includes('Hello Dave!') && result.includes('2 + 2 = 4'));
61
- });
62
-
63
- // Test 7: javascript_interpreter - Arrow functions & async/await
64
- t.add('javascript_interpreter handles ESNext features', async () => {
65
- const script = `
66
- const add = async (a, b) => a + b;
67
- console.log(await add(3, 4));
68
- `.trim();
69
- const result = await tools.call('javascript_interpreter', { script });
70
- assert.ok(result.includes('7'));
71
- });
72
-
73
- // Test 8: javascript_interpreter - Error handling
74
- t.add('javascript_interpreter reports JS errors', async () => {
75
- const script = 'console.log("ok"); invalidSyntaxHere();';
76
- const result = await tools.call('javascript_interpreter', { script });
77
- assert.ok(result.includes('invalidSyntaxHere') || result.includes('ReferenceError'));
78
- });
79
-
80
- // Test 9: read_file - Read package.json
81
- t.add('read_file reads package.json', async () => {
82
- const result = await tools.call('read_file', { file: 'package.json' });
83
- assert.ok(result.includes('@j-o-r/hello-dave') && result.includes('"tests":'));
84
- });
85
-
86
- // Test 10: write_file + read_file roundtrip (temp file, cleanup)
87
- t.add('write_file + read_file roundtrip', async () => {
88
- const tempFile = 'scenarios/temp.test.txt';
89
- const testContent = 'Test content: ' + Date.now();
90
-
91
- // Write
92
- const writeRes = await tools.call('write_file', {
93
- file: tempFile,
94
- content: testContent
95
- });
96
- assert.ok(writeRes.includes('Successfully wrote'));
97
-
98
- // Read back
99
- const readRes = await tools.call('read_file', { file: tempFile });
100
- assert.strictEqual(readRes.trim(), testContent);
101
-
102
- // Cleanup
103
- await tools.call('execute_bash_script', { bash_script: `rm -f ${tempFile}` });
104
- console.log('Temp file roundtrip OK');
105
- });
106
-
107
- // Test 11: memory_write + memory_recall
108
- t.add('memory_write and recall', async () => {
109
- const cat = 'tasks';
110
- const content = 'Test task from genericToolset.test.js';
111
-
112
- // Write
113
- await tools.call('memory_write', { category: cat, content });
114
-
115
- // Recall
116
- const recall = await tools.call('memory_recall', { query: cat });
117
- assert.ok(recall.includes(cat) && recall.includes('Test task'));
118
-
119
- console.log('Memory test OK');
120
- });
121
-
122
- // Test 12: write_file rejects invalid JS syntax (unclosed string)
123
- t.add('write_file rejects invalid JS syntax', async () => {
124
- const ts = Date.now().toString();
125
- const tempFile = `scenarios/temp_invalid_${ts}.js`;
126
- const invalidJS = `console.log("unclosed quote`;
127
- await assert.rejects(
128
- () => tools.call('write_file', { file: tempFile, content: invalidJS }),
129
- (err) => {
130
- assert.strictEqual(jsType(err), 'Error');
131
- assert.ok(err.message.includes('❌ SYNTAX ERROR'));
132
- assert.ok(err.message.includes('syntax error') || err.message.includes('SyntaxError'));
133
- return true;
134
- }
135
- );
136
- // Cleanup if exists (write happens before check)
137
- await tools.call('execute_bash_script', { bash_script: `rm -f ${tempFile}` }).catch(() => {});
138
- console.log('Invalid JS rejection OK');
139
- });
140
-
141
- // Test 13: write_file rejects invalid Python syntax (unclosed string)
142
- t.add('write_file rejects invalid Python syntax', async () => {
143
- const ts = Date.now().toString();
144
- const tempFile = `scenarios/temp_invalid_${ts}.py`;
145
- const invalidPy = `print("unclosed quote`;
146
- await assert.rejects(
147
- () => tools.call('write_file', { file: tempFile, content: invalidPy }),
148
- (err) => {
149
- assert.strictEqual(jsType(err), 'Error');
150
- assert.ok(err.message.includes('❌ SYNTAX ERROR'));
151
- assert.ok(err.message.includes('syntax error') || err.message.includes('SyntaxError'));
152
- return true;
153
- }
154
- );
155
- // Cleanup
156
- await tools.call('execute_bash_script', { bash_script: `rm -f ${tempFile}` }).catch(() => {});
157
- console.log('Invalid Python rejection OK');
158
- });
159
-
160
- // Test 14: write_file rejects invalid Bash syntax (unclosed string)
161
- t.add('write_file rejects invalid Bash syntax', async () => {
162
- const ts = Date.now().toString();
163
- const tempFile = `scenarios/temp_invalid_${ts}.sh`;
164
- const invalidBash = `echo "unclosed quote`;
165
- await assert.rejects(
166
- () => tools.call('write_file', { file: tempFile, content: invalidBash }),
167
- (err) => {
168
- assert.strictEqual(jsType(err), 'Error');
169
- assert.ok(err.message.includes('❌ SYNTAX ERROR'));
170
- assert.ok(err.message.includes('syntax error') || err.message.includes('SyntaxError') || err.message.includes('unexpected EOF'));
171
- return true;
172
- }
173
- );
174
- // Cleanup
175
- await tools.call('execute_bash_script', { bash_script: `rm -f ${tempFile}` }).catch(() => {});
176
- console.log('Invalid Bash rejection OK');
177
- });
178
-
179
- // Run tests
180
- const report = await t.run();
181
- console.log('\n=== Final Report ===', report);
182
- process.exit(report.errors > 0 ? 1 : 0);