@inferencesh/sdk 0.6.14 → 0.6.19

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 (89) hide show
  1. package/README.md +1 -1
  2. package/dist/agent/actions.js +10 -0
  3. package/dist/agent/provider.d.ts +2 -1
  4. package/dist/agent/provider.js +5 -5
  5. package/dist/agent/types.d.ts +3 -0
  6. package/dist/api/apps.d.ts +4 -0
  7. package/dist/api/apps.js +6 -0
  8. package/dist/api/index.d.ts +3 -3
  9. package/dist/http/index.d.ts +3 -3
  10. package/dist/index.d.ts +9 -9
  11. package/dist/types.d.ts +131 -19
  12. package/dist/types.js +26 -9
  13. package/package.json +8 -5
  14. package/dist/agent/actions.test.d.ts +0 -1
  15. package/dist/agent/actions.test.js +0 -820
  16. package/dist/agent/api.test.d.ts +0 -1
  17. package/dist/agent/api.test.js +0 -246
  18. package/dist/agent/reducer.test.d.ts +0 -1
  19. package/dist/agent/reducer.test.js +0 -131
  20. package/dist/agent/types.test.d.ts +0 -1
  21. package/dist/agent/types.test.js +0 -75
  22. package/dist/api/agents.test.d.ts +0 -1
  23. package/dist/api/agents.test.js +0 -1014
  24. package/dist/api/api-keys.test.d.ts +0 -1
  25. package/dist/api/api-keys.test.js +0 -44
  26. package/dist/api/apps.test.d.ts +0 -1
  27. package/dist/api/apps.test.js +0 -135
  28. package/dist/api/chats.test.d.ts +0 -1
  29. package/dist/api/chats.test.js +0 -85
  30. package/dist/api/engines.test.d.ts +0 -1
  31. package/dist/api/engines.test.js +0 -133
  32. package/dist/api/files.test.d.ts +0 -1
  33. package/dist/api/files.test.js +0 -256
  34. package/dist/api/flow-runs.test.d.ts +0 -1
  35. package/dist/api/flow-runs.test.js +0 -97
  36. package/dist/api/flows.test.d.ts +0 -1
  37. package/dist/api/flows.test.js +0 -118
  38. package/dist/api/integrations.test.d.ts +0 -1
  39. package/dist/api/integrations.test.js +0 -109
  40. package/dist/api/knowledge.test.d.ts +0 -1
  41. package/dist/api/knowledge.test.js +0 -238
  42. package/dist/api/mcp-servers.test.d.ts +0 -1
  43. package/dist/api/mcp-servers.test.js +0 -98
  44. package/dist/api/projects.test.d.ts +0 -1
  45. package/dist/api/projects.test.js +0 -61
  46. package/dist/api/search.test.d.ts +0 -1
  47. package/dist/api/search.test.js +0 -50
  48. package/dist/api/secrets.test.d.ts +0 -1
  49. package/dist/api/secrets.test.js +0 -61
  50. package/dist/api/sessions.test.d.ts +0 -1
  51. package/dist/api/sessions.test.js +0 -61
  52. package/dist/api/tasks.test.d.ts +0 -1
  53. package/dist/api/tasks.test.js +0 -381
  54. package/dist/api/teams.test.d.ts +0 -1
  55. package/dist/api/teams.test.js +0 -139
  56. package/dist/client.test.d.ts +0 -1
  57. package/dist/client.test.js +0 -446
  58. package/dist/http/client.test.d.ts +0 -1
  59. package/dist/http/client.test.js +0 -435
  60. package/dist/http/errors.test.d.ts +0 -1
  61. package/dist/http/errors.test.js +0 -66
  62. package/dist/http/poll.test.d.ts +0 -1
  63. package/dist/http/poll.test.js +0 -146
  64. package/dist/http/streamable.test.d.ts +0 -4
  65. package/dist/http/streamable.test.js +0 -510
  66. package/dist/integration.test.d.ts +0 -9
  67. package/dist/integration.test.js +0 -107
  68. package/dist/proxy/express.test.d.ts +0 -1
  69. package/dist/proxy/express.test.js +0 -106
  70. package/dist/proxy/hono.test.d.ts +0 -1
  71. package/dist/proxy/hono.test.js +0 -90
  72. package/dist/proxy/index.test.d.ts +0 -1
  73. package/dist/proxy/index.test.js +0 -173
  74. package/dist/proxy/nextjs.test.d.ts +0 -1
  75. package/dist/proxy/nextjs.test.js +0 -125
  76. package/dist/proxy/remix.test.d.ts +0 -1
  77. package/dist/proxy/remix.test.js +0 -66
  78. package/dist/proxy/svelte.test.d.ts +0 -1
  79. package/dist/proxy/svelte.test.js +0 -69
  80. package/dist/sessions.integration.test.d.ts +0 -13
  81. package/dist/sessions.integration.test.js +0 -310
  82. package/dist/stream.test.d.ts +0 -1
  83. package/dist/stream.test.js +0 -363
  84. package/dist/streamable.integration.test.d.ts +0 -11
  85. package/dist/streamable.integration.test.js +0 -150
  86. package/dist/tool-builder.test.d.ts +0 -1
  87. package/dist/tool-builder.test.js +0 -407
  88. package/dist/utils.test.d.ts +0 -1
  89. package/dist/utils.test.js +0 -43
@@ -1,98 +0,0 @@
1
- import { HttpClient } from '../http/client';
2
- import { MCPServersAPI } from './mcp-servers';
3
- const mockFetch = jest.fn();
4
- global.fetch = mockFetch;
5
- function mockJsonResponse(body) {
6
- mockFetch.mockResolvedValueOnce({
7
- ok: true,
8
- status: 200,
9
- text: () => Promise.resolve(JSON.stringify(body)),
10
- });
11
- }
12
- describe('MCPServersAPI', () => {
13
- beforeEach(() => {
14
- jest.clearAllMocks();
15
- });
16
- const api = () => new MCPServersAPI(new HttpClient({ apiKey: 'test-key' }));
17
- it('should POST /mcps/list for list()', async () => {
18
- const page = { items: [{ slug: 'filesystem' }], next_cursor: null };
19
- mockJsonResponse(page);
20
- const result = await api().list();
21
- expect(result).toEqual(page);
22
- const [url, init] = mockFetch.mock.calls[0];
23
- expect(url).toContain('/mcps/list');
24
- expect(init.method).toBe('POST');
25
- });
26
- it('should GET /mcps/{slug}/tools for listTools()', async () => {
27
- const tools = [{ name: 'read_file' }];
28
- mockJsonResponse(tools);
29
- const result = await api().listTools('filesystem');
30
- expect(result).toEqual(tools);
31
- const [url, init] = mockFetch.mock.calls[0];
32
- expect(url).toContain('/mcps/filesystem/tools');
33
- expect(init.method).toBe('GET');
34
- });
35
- it('should POST /mcps/{slug}/tools/{tool} for callTool()', async () => {
36
- const input = { path: '/tmp/test.txt' };
37
- const output = { content: 'hello' };
38
- mockJsonResponse(output);
39
- const result = await api().callTool('filesystem', 'read_file', input);
40
- expect(result).toEqual(output);
41
- const [url, init] = mockFetch.mock.calls[0];
42
- expect(url).toContain('/mcps/filesystem/tools/read_file');
43
- expect(init.method).toBe('POST');
44
- expect(JSON.parse(init.body)).toEqual(input);
45
- });
46
- it('should POST /mcp-servers for create()', async () => {
47
- const payload = { name: 'My MCP', slug: 'my-mcp' };
48
- const server = { id: 'mcp-1', ...payload };
49
- mockJsonResponse(server);
50
- const result = await api().create(payload);
51
- expect(result).toEqual(server);
52
- const [url, init] = mockFetch.mock.calls[0];
53
- expect(url).toContain('/mcp-servers');
54
- expect(init.method).toBe('POST');
55
- });
56
- it('should PUT /mcp-servers/{id} for update()', async () => {
57
- const server = { id: 'mcp-1', name: 'Updated MCP' };
58
- mockJsonResponse(server);
59
- await api().update('mcp-1', { name: 'Updated MCP' });
60
- const [url, init] = mockFetch.mock.calls[0];
61
- expect(url).toContain('/mcp-servers/mcp-1');
62
- expect(init.method).toBe('PUT');
63
- });
64
- it('should GET /mcps/{slug} for get()', async () => {
65
- const server = { slug: 'filesystem', name: 'Filesystem MCP' };
66
- mockJsonResponse(server);
67
- const result = await api().get('filesystem');
68
- expect(result).toEqual(server);
69
- const [url, init] = mockFetch.mock.calls[0];
70
- expect(url).toContain('/mcps/filesystem');
71
- expect(init.method).toBe('GET');
72
- });
73
- it('should POST /mcp-servers/list for listOwned()', async () => {
74
- const page = { items: [{ id: 'mcp-1' }], next_cursor: null };
75
- mockJsonResponse(page);
76
- const result = await api().listOwned({ limit: 5 });
77
- expect(result).toEqual(page);
78
- const [url, init] = mockFetch.mock.calls[0];
79
- expect(url).toContain('/mcp-servers/list');
80
- expect(init.method).toBe('POST');
81
- });
82
- it('should GET /mcp-servers/{id} for getOwned()', async () => {
83
- const server = { id: 'mcp-1', name: 'My MCP' };
84
- mockJsonResponse(server);
85
- const result = await api().getOwned('mcp-1');
86
- expect(result).toEqual(server);
87
- const [url, init] = mockFetch.mock.calls[0];
88
- expect(url).toContain('/mcp-servers/mcp-1');
89
- expect(init.method).toBe('GET');
90
- });
91
- it('should DELETE /mcp-servers/{id} for delete()', async () => {
92
- mockJsonResponse(null);
93
- await api().delete('mcp-1');
94
- const [url, init] = mockFetch.mock.calls[0];
95
- expect(url).toContain('/mcp-servers/mcp-1');
96
- expect(init.method).toBe('DELETE');
97
- });
98
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,61 +0,0 @@
1
- import { HttpClient } from '../http/client';
2
- import { ProjectsAPI } from './projects';
3
- const mockFetch = jest.fn();
4
- global.fetch = mockFetch;
5
- function mockJsonResponse(body) {
6
- mockFetch.mockResolvedValueOnce({
7
- ok: true,
8
- status: 200,
9
- text: () => Promise.resolve(JSON.stringify(body)),
10
- });
11
- }
12
- describe('ProjectsAPI', () => {
13
- beforeEach(() => {
14
- jest.clearAllMocks();
15
- });
16
- const api = () => new ProjectsAPI(new HttpClient({ apiKey: 'test-key' }));
17
- it('should POST /projects/list for list()', async () => {
18
- const page = { items: [{ id: 'proj-1' }], next_cursor: null };
19
- mockJsonResponse(page);
20
- const result = await api().list({ limit: 20 });
21
- expect(result).toEqual(page);
22
- const [url, init] = mockFetch.mock.calls[0];
23
- expect(url).toContain('/projects/list');
24
- expect(init.method).toBe('POST');
25
- });
26
- it('should GET /projects/{id} for get()', async () => {
27
- const project = { id: 'proj-1', name: 'Demo' };
28
- mockJsonResponse(project);
29
- const result = await api().get('proj-1');
30
- expect(result).toEqual(project);
31
- const [url, init] = mockFetch.mock.calls[0];
32
- expect(url).toContain('/projects/proj-1');
33
- expect(init.method).toBe('GET');
34
- });
35
- it('should POST /projects for create()', async () => {
36
- const payload = { name: 'New Project' };
37
- const project = { id: 'proj-new', ...payload };
38
- mockJsonResponse(project);
39
- const result = await api().create(payload);
40
- expect(result).toEqual(project);
41
- const [url, init] = mockFetch.mock.calls[0];
42
- expect(url).toContain('/projects');
43
- expect(init.method).toBe('POST');
44
- });
45
- it('should DELETE /projects/{id} for delete()', async () => {
46
- mockJsonResponse(null);
47
- await api().delete('proj-1');
48
- const [url, init] = mockFetch.mock.calls[0];
49
- expect(url).toContain('/projects/proj-1');
50
- expect(init.method).toBe('DELETE');
51
- });
52
- it('should POST /projects/{id} for update()', async () => {
53
- const project = { id: 'proj-1', name: 'Renamed' };
54
- mockJsonResponse(project);
55
- const result = await api().update('proj-1', { name: 'Renamed' });
56
- expect(result).toEqual(project);
57
- const [url, init] = mockFetch.mock.calls[0];
58
- expect(url).toContain('/projects/proj-1');
59
- expect(JSON.parse(init.body)).toEqual({ name: 'Renamed' });
60
- });
61
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,50 +0,0 @@
1
- import { HttpClient } from '../http/client';
2
- import { SearchAPI } from './search';
3
- const mockFetch = jest.fn();
4
- global.fetch = mockFetch;
5
- function mockJsonResponse(body) {
6
- mockFetch.mockResolvedValueOnce({
7
- ok: true,
8
- status: 200,
9
- text: () => Promise.resolve(JSON.stringify(body)),
10
- });
11
- }
12
- describe('SearchAPI', () => {
13
- beforeEach(() => {
14
- jest.clearAllMocks();
15
- });
16
- const api = () => new SearchAPI(new HttpClient({ apiKey: 'test-key' }));
17
- it('should POST /suggest for suggest()', async () => {
18
- const payload = { query: 'image gen', types: ['apps', 'skills'] };
19
- const response = { results: [{ type: 'app', id: 'app-1' }] };
20
- mockJsonResponse(response);
21
- const result = await api().suggest(payload);
22
- expect(result).toEqual(response);
23
- const [url, init] = mockFetch.mock.calls[0];
24
- expect(url).toContain('/suggest');
25
- expect(init.method).toBe('POST');
26
- expect(JSON.parse(init.body)).toEqual(payload);
27
- });
28
- it('should forward conversation context in suggest() body', async () => {
29
- const payload = {
30
- query: 'flux',
31
- context: 'previous conversation about image generation',
32
- limit: 5,
33
- };
34
- mockJsonResponse({ results: [] });
35
- await api().suggest(payload);
36
- const [, init] = mockFetch.mock.calls[0];
37
- expect(JSON.parse(init.body)).toEqual(payload);
38
- });
39
- it('should POST /search for search()', async () => {
40
- const payload = { q: 'claude', type: 'apps', limit: 5 };
41
- const response = { hits: [{ id: 'app-1' }] };
42
- mockJsonResponse(response);
43
- const result = await api().search(payload);
44
- expect(result).toEqual(response);
45
- const [url, init] = mockFetch.mock.calls[0];
46
- expect(url).toContain('/search');
47
- expect(init.method).toBe('POST');
48
- expect(JSON.parse(init.body)).toEqual(payload);
49
- });
50
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,61 +0,0 @@
1
- import { HttpClient } from '../http/client';
2
- import { SecretsAPI } from './secrets';
3
- const mockFetch = jest.fn();
4
- global.fetch = mockFetch;
5
- function mockJsonResponse(body) {
6
- mockFetch.mockResolvedValueOnce({
7
- ok: true,
8
- status: 200,
9
- text: () => Promise.resolve(JSON.stringify(body)),
10
- });
11
- }
12
- describe('SecretsAPI', () => {
13
- beforeEach(() => {
14
- jest.clearAllMocks();
15
- });
16
- const api = () => new SecretsAPI(new HttpClient({ apiKey: 'test-key' }));
17
- it('should POST /secrets/list for list()', async () => {
18
- const page = { items: [{ key: 'API_KEY' }], next_cursor: null };
19
- mockJsonResponse(page);
20
- const result = await api().list({ limit: 10 });
21
- expect(result).toEqual(page);
22
- const [url, init] = mockFetch.mock.calls[0];
23
- expect(url).toContain('/secrets/list');
24
- expect(init.method).toBe('POST');
25
- });
26
- it('should POST /secrets for create()', async () => {
27
- const payload = { key: 'DB_PASSWORD', value: 'secret' };
28
- const secret = { key: 'DB_PASSWORD' };
29
- mockJsonResponse(secret);
30
- const result = await api().create(payload);
31
- expect(result).toEqual(secret);
32
- const [url, init] = mockFetch.mock.calls[0];
33
- expect(url).toContain('/secrets');
34
- expect(init.method).toBe('POST');
35
- expect(JSON.parse(init.body)).toEqual(payload);
36
- });
37
- it('should PUT /secrets/{key} for update()', async () => {
38
- const secret = { key: 'DB_PASSWORD' };
39
- mockJsonResponse(secret);
40
- await api().update('DB_PASSWORD', { value: 'new-secret' });
41
- const [url, init] = mockFetch.mock.calls[0];
42
- expect(url).toContain('/secrets/DB_PASSWORD');
43
- expect(init.method).toBe('PUT');
44
- });
45
- it('should GET /secrets/reveal/{key} for reveal()', async () => {
46
- const secret = { key: 'API_KEY', value: 'sk-live-abc' };
47
- mockJsonResponse(secret);
48
- const result = await api().reveal('API_KEY');
49
- expect(result).toEqual(secret);
50
- const [url, init] = mockFetch.mock.calls[0];
51
- expect(url).toContain('/secrets/reveal/API_KEY');
52
- expect(init.method).toBe('GET');
53
- });
54
- it('should DELETE /secrets/{key} for delete()', async () => {
55
- mockJsonResponse(null);
56
- await api().delete('OLD_KEY');
57
- const [url, init] = mockFetch.mock.calls[0];
58
- expect(url).toContain('/secrets/OLD_KEY');
59
- expect(init.method).toBe('DELETE');
60
- });
61
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,61 +0,0 @@
1
- import { HttpClient } from '../http/client';
2
- import { SessionsAPI } from './sessions';
3
- const mockFetch = jest.fn();
4
- global.fetch = mockFetch;
5
- function mockJsonResponse(body) {
6
- mockFetch.mockResolvedValueOnce({
7
- ok: true,
8
- status: 200,
9
- text: () => Promise.resolve(JSON.stringify(body)),
10
- });
11
- }
12
- describe('SessionsAPI', () => {
13
- beforeEach(() => {
14
- jest.clearAllMocks();
15
- });
16
- const api = () => new SessionsAPI(new HttpClient({ apiKey: 'test-key' }));
17
- it('should GET /sessions/{id} for get()', async () => {
18
- const session = { id: 'sess_1', status: 'active' };
19
- mockJsonResponse(session);
20
- const result = await api().get('sess_1');
21
- expect(result).toEqual(session);
22
- const [url, init] = mockFetch.mock.calls[0];
23
- expect(url).toContain('/sessions/sess_1');
24
- expect(init.method).toBe('GET');
25
- });
26
- it('should GET /sessions and return session list', async () => {
27
- const sessions = [
28
- { id: 'sess_1', status: 'active' },
29
- { id: 'sess_2', status: 'active' },
30
- ];
31
- mockJsonResponse(sessions);
32
- const result = await api().list();
33
- expect(result).toEqual(sessions);
34
- const [url, init] = mockFetch.mock.calls[0];
35
- expect(url).toContain('/sessions');
36
- expect(init.method).toBe('GET');
37
- });
38
- it('should return an empty array when list() response is null', async () => {
39
- mockJsonResponse(null);
40
- const result = await api().list();
41
- expect(result).toEqual([]);
42
- const [url] = mockFetch.mock.calls[0];
43
- expect(url).toContain('/sessions');
44
- });
45
- it('should POST /sessions/{id}/keepalive for keepalive()', async () => {
46
- const session = { id: 'sess_2', status: 'active' };
47
- mockJsonResponse(session);
48
- const result = await api().keepalive('sess_2');
49
- expect(result).toEqual(session);
50
- const [url, init] = mockFetch.mock.calls[0];
51
- expect(url).toContain('/sessions/sess_2/keepalive');
52
- expect(init.method).toBe('POST');
53
- });
54
- it('should DELETE /sessions/{id} for end()', async () => {
55
- mockJsonResponse(null);
56
- await api().end('sess_3');
57
- const [url, init] = mockFetch.mock.calls[0];
58
- expect(url).toContain('/sessions/sess_3');
59
- expect(init.method).toBe('DELETE');
60
- });
61
- });
@@ -1 +0,0 @@
1
- export {};