@fre4x/jules 1.0.30 → 1.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -39
- package/dist/index.js +46200 -25
- package/package.json +5 -5
- package/dist/__tests__/julesApiClient.test.d.ts +0 -2
- package/dist/__tests__/julesApiClient.test.d.ts.map +0 -1
- package/dist/__tests__/julesApiClient.test.js +0 -53
- package/dist/__tests__/julesApiClient.test.js.map +0 -1
- package/dist/__tests__/toolRegistration.test.d.ts +0 -2
- package/dist/__tests__/toolRegistration.test.d.ts.map +0 -1
- package/dist/__tests__/toolRegistration.test.js +0 -21
- package/dist/__tests__/toolRegistration.test.js.map +0 -1
- package/dist/constants.d.ts +0 -3
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -3
- package/dist/constants.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mock.d.ts +0 -43
- package/dist/mock.d.ts.map +0 -1
- package/dist/mock.js +0 -60
- package/dist/mock.js.map +0 -1
- package/dist/schemas/julesSchemas.d.ts +0 -60
- package/dist/schemas/julesSchemas.d.ts.map +0 -1
- package/dist/schemas/julesSchemas.js +0 -61
- package/dist/schemas/julesSchemas.js.map +0 -1
- package/dist/services/julesApiClient.d.ts +0 -17
- package/dist/services/julesApiClient.d.ts.map +0 -1
- package/dist/services/julesApiClient.js +0 -63
- package/dist/services/julesApiClient.js.map +0 -1
- package/dist/tools/approvePlan.d.ts +0 -3
- package/dist/tools/approvePlan.d.ts.map +0 -1
- package/dist/tools/approvePlan.js +0 -44
- package/dist/tools/approvePlan.js.map +0 -1
- package/dist/tools/createSession.d.ts +0 -3
- package/dist/tools/createSession.d.ts.map +0 -1
- package/dist/tools/createSession.js +0 -62
- package/dist/tools/createSession.js.map +0 -1
- package/dist/tools/listSessions.d.ts +0 -3
- package/dist/tools/listSessions.d.ts.map +0 -1
- package/dist/tools/listSessions.js +0 -71
- package/dist/tools/listSessions.js.map +0 -1
- package/dist/tools/listSources.d.ts +0 -3
- package/dist/tools/listSources.d.ts.map +0 -1
- package/dist/tools/listSources.js +0 -70
- package/dist/tools/listSources.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fre4x/jules",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.42",
|
|
4
4
|
"description": "MCP server for Jules API integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"main": "dist/index.js",
|
|
13
13
|
"scripts": {
|
|
14
14
|
"start": "node dist/index.js",
|
|
15
|
-
"dev": "
|
|
16
|
-
"build": "
|
|
17
|
-
"typecheck": "NODE_OPTIONS
|
|
15
|
+
"dev": "tsx src/index.ts",
|
|
16
|
+
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && npx esbuild src/index.ts --bundle --outfile=dist/index.js --platform=node --format=esm --banner:js=\"import{createRequire}from'module';const require=createRequire(import.meta.url);\"",
|
|
17
|
+
"typecheck": "cross-env NODE_OPTIONS=--max-old-space-size=4096 tsc --noEmit",
|
|
18
18
|
"inspector": "MOCK=true npx @modelcontextprotocol/inspector dist/index.js",
|
|
19
19
|
"test": "vitest run --exclude dist",
|
|
20
20
|
"test:watch": "vitest",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
31
31
|
"axios": "^1.7.9",
|
|
32
|
-
"zod": "4.
|
|
32
|
+
"zod": "^4.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "^22.10.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"julesApiClient.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/julesApiClient.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach } from 'vitest';
|
|
2
|
-
import axios from 'axios';
|
|
3
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
4
|
-
import { julesApiRequest, handleApiError } from '../services/julesApiClient.js';
|
|
5
|
-
import { API_BASE_URL } from '../constants.js';
|
|
6
|
-
// biome-ignore lint/suspicious/noExplicitAny: Axios type mismatch between static and instance in this environment
|
|
7
|
-
const mock = new MockAdapter(axios);
|
|
8
|
-
describe('julesApiClient', () => {
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
mock.reset();
|
|
11
|
-
process.env.JULES_API_KEY = 'test-api-key';
|
|
12
|
-
});
|
|
13
|
-
it('should make an authenticated GET request', async () => {
|
|
14
|
-
mock.onGet(`${API_BASE_URL}/v1alpha/sources`).reply(200, {
|
|
15
|
-
sources: [{ name: 'test-source' }],
|
|
16
|
-
});
|
|
17
|
-
const result = (await julesApiRequest('/v1alpha/sources'));
|
|
18
|
-
expect(result.sources[0].name).toBe('test-source');
|
|
19
|
-
expect(mock.history.get[0].headers?.['X-Goog-Api-Key']).toBe('test-api-key');
|
|
20
|
-
});
|
|
21
|
-
it('should throw error if JULES_API_KEY is missing', async () => {
|
|
22
|
-
delete process.env.JULES_API_KEY;
|
|
23
|
-
await expect(julesApiRequest('/v1alpha/sources')).rejects.toThrow('JULES_API_KEY environment variable is missing.');
|
|
24
|
-
});
|
|
25
|
-
it('should handle API errors correctly', async () => {
|
|
26
|
-
// Simulate a network call that fails with 401
|
|
27
|
-
mock.onGet(`${API_BASE_URL}/v1alpha/sources`).reply(401, {
|
|
28
|
-
error: { message: 'Unauthorized' },
|
|
29
|
-
});
|
|
30
|
-
await expect(julesApiRequest('/v1alpha/sources')).rejects.toThrow();
|
|
31
|
-
try {
|
|
32
|
-
await julesApiRequest('/v1alpha/sources');
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
const result = handleApiError(error);
|
|
36
|
-
expect(result.content[0].text).toContain('Unauthorized (401)');
|
|
37
|
-
expect(result.isError).toBe(true);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
it('should handle timeout errors correctly', async () => {
|
|
41
|
-
mock.onGet(`${API_BASE_URL}/v1alpha/sources`).timeout();
|
|
42
|
-
await expect(julesApiRequest('/v1alpha/sources')).rejects.toThrow();
|
|
43
|
-
try {
|
|
44
|
-
await julesApiRequest('/v1alpha/sources');
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
const result = handleApiError(error);
|
|
48
|
-
expect(result.content[0].text).toContain('Request timed out');
|
|
49
|
-
expect(result.isError).toBe(true);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
//# sourceMappingURL=julesApiClient.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"julesApiClient.test.js","sourceRoot":"","sources":["../../src/__tests__/julesApiClient.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,kHAAkH;AAClH,MAAM,IAAI,GAAG,IAAI,WAAW,CAAC,KAAY,CAAC,CAAC;AAE3C,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC5B,UAAU,CAAC,GAAG,EAAE;QACZ,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,cAAc,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE,KAAK,IAAI,EAAE;QACtD,IAAI,CAAC,KAAK,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CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;YAC/D,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,KAAK,IAAI,EAAE;QACpD,IAAI,CAAC,KAAK,CAAC,GAAG,YAAY,kBAAkB,CAAC,CAAC,OAAO,EAAE,CAAC;QAExD,MAAM,MAAM,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAEpE,IAAI,CAAC;YACD,MAAM,eAAe,CAAC,kBAAkB,CAAC,CAAC;QAC9C,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;YACrC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;YAC9D,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toolRegistration.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/toolRegistration.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
-
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
-
import { registerListSourcesTool } from '../tools/listSources.js';
|
|
4
|
-
import { registerCreateSessionTool } from '../tools/createSession.js';
|
|
5
|
-
import { registerListSessionsTool } from '../tools/listSessions.js';
|
|
6
|
-
import { registerApprovePlanTool } from '../tools/approvePlan.js';
|
|
7
|
-
describe('Tool Registration', () => {
|
|
8
|
-
it('should register all core jules tools', () => {
|
|
9
|
-
const server = new McpServer({ name: 'test', version: '1.0.0' });
|
|
10
|
-
const registerSpy = vi.spyOn(server, 'registerTool');
|
|
11
|
-
registerListSourcesTool(server);
|
|
12
|
-
registerCreateSessionTool(server);
|
|
13
|
-
registerListSessionsTool(server);
|
|
14
|
-
registerApprovePlanTool(server);
|
|
15
|
-
expect(registerSpy).toHaveBeenCalledWith('jules_list_sources', expect.any(Object), expect.any(Function));
|
|
16
|
-
expect(registerSpy).toHaveBeenCalledWith('jules_create_session', expect.any(Object), expect.any(Function));
|
|
17
|
-
expect(registerSpy).toHaveBeenCalledWith('jules_list_sessions', expect.any(Object), expect.any(Function));
|
|
18
|
-
expect(registerSpy).toHaveBeenCalledWith('jules_approve_plan', expect.any(Object), expect.any(Function));
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
//# sourceMappingURL=toolRegistration.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toolRegistration.test.js","sourceRoot":"","sources":["../../src/__tests__/toolRegistration.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAElE,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC5C,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QACjE,MAAM,WAAW,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QAErD,uBAAuB,CAAC,MAAM,CAAC,CAAC;QAChC,yBAAyB,CAAC,MAAM,CAAC,CAAC;QAClC,wBAAwB,CAAC,MAAM,CAAC,CAAC;QACjC,uBAAuB,CAAC,MAAM,CAAC,CAAC;QAEhC,MAAM,CAAC,WAAW,CAAC,CAAC,oBAAoB,CACpC,oBAAoB,EACpB,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAClB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CACvB,CAAC;QACF,MAAM,CAAC,WAAW,CAAC,CAAC,oBAAoB,CACpC,sBAAsB,EACtB,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAClB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CACvB,CAAC;QACF,MAAM,CAAC,WAAW,CAAC,CAAC,oBAAoB,CACpC,qBAAqB,EACrB,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAClB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CACvB,CAAC;QACF,MAAM,CAAC,WAAW,CAAC,CAAC,oBAAoB,CACpC,oBAAoB,EACpB,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAClB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CACvB,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/dist/constants.d.ts
DELETED
package/dist/constants.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,iCAAiC,CAAC;AAC3D,eAAO,MAAM,eAAe,QAAQ,CAAC"}
|
package/dist/constants.js
DELETED
package/dist/constants.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,8BAA8B,CAAC;AAC3D,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC"}
|
package/dist/index.d.ts
DELETED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IACzB,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,OAAO;CACnB,CAAC,CAAC;AAEH,uBAAuB,CAAC,MAAM,CAAC,CAAC;AAChC,yBAAyB,CAAC,MAAM,CAAC,CAAC;AAClC,wBAAwB,CAAC,MAAM,CAAC,CAAC;AACjC,uBAAuB,CAAC,MAAM,CAAC,CAAC;AAEhC,KAAK,UAAU,IAAI;IACf,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QACzC,OAAO,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;QACxE,OAAO,CAAC,KAAK,CACT,4DAA4D,CAC/D,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;AAC1D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
package/dist/mock.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export declare const IS_MOCK: boolean;
|
|
2
|
-
export declare const MOCK_FIXTURES: {
|
|
3
|
-
listSources: {
|
|
4
|
-
sources: {
|
|
5
|
-
name: string;
|
|
6
|
-
id: string;
|
|
7
|
-
githubRepo: {
|
|
8
|
-
owner: string;
|
|
9
|
-
repo: string;
|
|
10
|
-
};
|
|
11
|
-
}[];
|
|
12
|
-
nextPageToken: undefined;
|
|
13
|
-
};
|
|
14
|
-
listSessions: {
|
|
15
|
-
sessions: {
|
|
16
|
-
name: string;
|
|
17
|
-
id: string;
|
|
18
|
-
title: string;
|
|
19
|
-
prompt: string;
|
|
20
|
-
state: string;
|
|
21
|
-
pendingPlanApproval: boolean;
|
|
22
|
-
outputs: {
|
|
23
|
-
pullRequest: {
|
|
24
|
-
title: string;
|
|
25
|
-
url: string;
|
|
26
|
-
};
|
|
27
|
-
}[];
|
|
28
|
-
}[];
|
|
29
|
-
nextPageToken: undefined;
|
|
30
|
-
};
|
|
31
|
-
createSession: {
|
|
32
|
-
name: string;
|
|
33
|
-
id: string;
|
|
34
|
-
title: string;
|
|
35
|
-
prompt: string;
|
|
36
|
-
state: string;
|
|
37
|
-
};
|
|
38
|
-
approvePlan: {
|
|
39
|
-
name: string;
|
|
40
|
-
state: string;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=mock.d.ts.map
|
package/dist/mock.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../src/mock.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,SACgD,CAAC;AAErE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDzB,CAAC"}
|
package/dist/mock.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
export const IS_MOCK = process.env.MOCK === 'true' || process.env.JULES_MOCK === 'true';
|
|
2
|
-
export const MOCK_FIXTURES = {
|
|
3
|
-
listSources: {
|
|
4
|
-
sources: [
|
|
5
|
-
{
|
|
6
|
-
name: 'sources/github/fritzprix/b1te',
|
|
7
|
-
id: 'src-001',
|
|
8
|
-
githubRepo: { owner: 'fritzprix', repo: 'b1te' },
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
name: 'sources/github/fritzprix/demo-repo',
|
|
12
|
-
id: 'src-002',
|
|
13
|
-
githubRepo: { owner: 'fritzprix', repo: 'demo-repo' },
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
nextPageToken: undefined,
|
|
17
|
-
},
|
|
18
|
-
listSessions: {
|
|
19
|
-
sessions: [
|
|
20
|
-
{
|
|
21
|
-
name: 'sessions/12345',
|
|
22
|
-
id: '12345',
|
|
23
|
-
title: 'Add pagination to HN server',
|
|
24
|
-
prompt: 'Add limit/offset pagination to all list tools in the HN MCP server.',
|
|
25
|
-
state: 'SUCCEEDED',
|
|
26
|
-
pendingPlanApproval: false,
|
|
27
|
-
outputs: [
|
|
28
|
-
{
|
|
29
|
-
pullRequest: {
|
|
30
|
-
title: 'feat: add pagination to HN list tools',
|
|
31
|
-
url: 'https://github.com/fritzprix/b1te/pull/42',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: 'sessions/67890',
|
|
38
|
-
id: '67890',
|
|
39
|
-
title: 'Fix type errors in fred server',
|
|
40
|
-
prompt: 'Remove all any types from the FRED MCP server implementation.',
|
|
41
|
-
state: 'AWAITING_PLAN_APPROVAL',
|
|
42
|
-
pendingPlanApproval: true,
|
|
43
|
-
outputs: [],
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
nextPageToken: undefined,
|
|
47
|
-
},
|
|
48
|
-
createSession: {
|
|
49
|
-
name: 'sessions/99999',
|
|
50
|
-
id: '99999',
|
|
51
|
-
title: 'Mock Session',
|
|
52
|
-
prompt: 'This is a mock session created without a real API call.',
|
|
53
|
-
state: 'PENDING',
|
|
54
|
-
},
|
|
55
|
-
approvePlan: {
|
|
56
|
-
name: 'sessions/67890',
|
|
57
|
-
state: 'IN_PROGRESS',
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
//# sourceMappingURL=mock.js.map
|
package/dist/mock.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock.js","sourceRoot":"","sources":["../src/mock.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAChB,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,MAAM,CAAC;AAErE,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,WAAW,EAAE;QACT,OAAO,EAAE;YACL;gBACI,IAAI,EAAE,+BAA+B;gBACrC,EAAE,EAAE,SAAS;gBACb,UAAU,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE;aACnD;YACD;gBACI,IAAI,EAAE,oCAAoC;gBAC1C,EAAE,EAAE,SAAS;gBACb,UAAU,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE;aACxD;SACJ;QACD,aAAa,EAAE,SAAS;KAC3B;IACD,YAAY,EAAE;QACV,QAAQ,EAAE;YACN;gBACI,IAAI,EAAE,gBAAgB;gBACtB,EAAE,EAAE,OAAO;gBACX,KAAK,EAAE,6BAA6B;gBACpC,MAAM,EAAE,qEAAqE;gBAC7E,KAAK,EAAE,WAAW;gBAClB,mBAAmB,EAAE,KAAK;gBAC1B,OAAO,EAAE;oBACL;wBACI,WAAW,EAAE;4BACT,KAAK,EAAE,uCAAuC;4BAC9C,GAAG,EAAE,2CAA2C;yBACnD;qBACJ;iBACJ;aACJ;YACD;gBACI,IAAI,EAAE,gBAAgB;gBACtB,EAAE,EAAE,OAAO;gBACX,KAAK,EAAE,gCAAgC;gBACvC,MAAM,EAAE,+DAA+D;gBACvE,KAAK,EAAE,wBAAwB;gBAC/B,mBAAmB,EAAE,IAAI;gBACzB,OAAO,EAAE,EAAE;aACd;SACJ;QACD,aAAa,EAAE,SAAS;KAC3B;IACD,aAAa,EAAE;QACX,IAAI,EAAE,gBAAgB;QACtB,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,cAAc;QACrB,MAAM,EAAE,yDAAyD;QACjE,KAAK,EAAE,SAAS;KACnB;IACD,WAAW,EAAE;QACT,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,aAAa;KACvB;CACJ,CAAC"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import * as zod from 'zod';
|
|
2
|
-
export declare enum ResponseFormat {
|
|
3
|
-
MARKDOWN = "markdown",
|
|
4
|
-
JSON = "json"
|
|
5
|
-
}
|
|
6
|
-
export declare const ResponseFormatSchema: zod.ZodOptional<zod.ZodEnum<{
|
|
7
|
-
markdown: "markdown";
|
|
8
|
-
json: "json";
|
|
9
|
-
}>>;
|
|
10
|
-
export declare const PaginationSchema: zod.ZodObject<{
|
|
11
|
-
pageSize: zod.ZodDefault<zod.ZodNumber>;
|
|
12
|
-
pageToken: zod.ZodOptional<zod.ZodString>;
|
|
13
|
-
response_format: zod.ZodOptional<zod.ZodEnum<{
|
|
14
|
-
markdown: "markdown";
|
|
15
|
-
json: "json";
|
|
16
|
-
}>>;
|
|
17
|
-
}, zod.z.core.$strip>;
|
|
18
|
-
export declare const ListSourcesInputSchema: zod.ZodObject<{
|
|
19
|
-
pageSize: zod.ZodDefault<zod.ZodNumber>;
|
|
20
|
-
pageToken: zod.ZodOptional<zod.ZodString>;
|
|
21
|
-
response_format: zod.ZodOptional<zod.ZodEnum<{
|
|
22
|
-
markdown: "markdown";
|
|
23
|
-
json: "json";
|
|
24
|
-
}>>;
|
|
25
|
-
}, zod.z.core.$strip>;
|
|
26
|
-
export type ListSourcesInput = zod.z.infer<typeof ListSourcesInputSchema>;
|
|
27
|
-
export declare const CreateSessionInputSchema: zod.ZodObject<{
|
|
28
|
-
prompt: zod.ZodString;
|
|
29
|
-
source: zod.ZodString;
|
|
30
|
-
startingBranch: zod.ZodDefault<zod.ZodString>;
|
|
31
|
-
automationMode: zod.ZodOptional<zod.ZodEnum<{
|
|
32
|
-
AUTO_CREATE_PR: "AUTO_CREATE_PR";
|
|
33
|
-
NONE: "NONE";
|
|
34
|
-
}>>;
|
|
35
|
-
title: zod.ZodString;
|
|
36
|
-
requirePlanApproval: zod.ZodDefault<zod.ZodBoolean>;
|
|
37
|
-
response_format: zod.ZodOptional<zod.ZodEnum<{
|
|
38
|
-
markdown: "markdown";
|
|
39
|
-
json: "json";
|
|
40
|
-
}>>;
|
|
41
|
-
}, zod.z.core.$strip>;
|
|
42
|
-
export type CreateSessionInput = zod.z.infer<typeof CreateSessionInputSchema>;
|
|
43
|
-
export declare const ListSessionsInputSchema: zod.ZodObject<{
|
|
44
|
-
pageSize: zod.ZodDefault<zod.ZodNumber>;
|
|
45
|
-
pageToken: zod.ZodOptional<zod.ZodString>;
|
|
46
|
-
response_format: zod.ZodOptional<zod.ZodEnum<{
|
|
47
|
-
markdown: "markdown";
|
|
48
|
-
json: "json";
|
|
49
|
-
}>>;
|
|
50
|
-
}, zod.z.core.$strip>;
|
|
51
|
-
export type ListSessionsInput = zod.z.infer<typeof ListSessionsInputSchema>;
|
|
52
|
-
export declare const ApprovePlanInputSchema: zod.ZodObject<{
|
|
53
|
-
sessionId: zod.ZodString;
|
|
54
|
-
response_format: zod.ZodOptional<zod.ZodEnum<{
|
|
55
|
-
markdown: "markdown";
|
|
56
|
-
json: "json";
|
|
57
|
-
}>>;
|
|
58
|
-
}, zod.z.core.$strip>;
|
|
59
|
-
export type ApprovePlanInput = zod.z.infer<typeof ApprovePlanInputSchema>;
|
|
60
|
-
//# sourceMappingURL=julesSchemas.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"julesSchemas.d.ts","sourceRoot":"","sources":["../../src/schemas/julesSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAK3B,oBAAY,cAAc;IACtB,QAAQ,aAAa;IACrB,IAAI,SAAS;CAChB;AAGD,eAAO,MAAM,oBAAoB;;;GAGuC,CAAC;AAEzE,eAAO,MAAM,gBAAgB;;;;;;;qBAa3B,CAAC;AAGH,eAAO,MAAM,sBAAsB;;;;;;;qBAAmB,CAAC;AACvD,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAG1E,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;qBAyBnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAG9E,eAAO,MAAM,uBAAuB;;;;;;;qBAAmB,CAAC;AACxD,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAG5E,eAAO,MAAM,sBAAsB;;;;;;qBAKjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import * as zod from 'zod';
|
|
2
|
-
// biome-ignore lint/suspicious/noExplicitAny: compatibility pattern
|
|
3
|
-
const z = zod.z || zod.default || zod;
|
|
4
|
-
// --- Enums ---
|
|
5
|
-
export var ResponseFormat;
|
|
6
|
-
(function (ResponseFormat) {
|
|
7
|
-
ResponseFormat["MARKDOWN"] = "markdown";
|
|
8
|
-
ResponseFormat["JSON"] = "json";
|
|
9
|
-
})(ResponseFormat || (ResponseFormat = {}));
|
|
10
|
-
// --- Common ---
|
|
11
|
-
export const ResponseFormatSchema = z
|
|
12
|
-
.enum(['markdown', 'json'])
|
|
13
|
-
.optional()
|
|
14
|
-
.describe("Output format: 'markdown' or 'json' (default: markdown)");
|
|
15
|
-
export const PaginationSchema = z.object({
|
|
16
|
-
pageSize: z
|
|
17
|
-
.number()
|
|
18
|
-
.int()
|
|
19
|
-
.min(1)
|
|
20
|
-
.max(100)
|
|
21
|
-
.default(20)
|
|
22
|
-
.describe('Maximum results to return'),
|
|
23
|
-
pageToken: z
|
|
24
|
-
.string()
|
|
25
|
-
.optional()
|
|
26
|
-
.describe('Page token for retrieving the next page'),
|
|
27
|
-
response_format: ResponseFormatSchema,
|
|
28
|
-
});
|
|
29
|
-
// --- jules_list_sources ---
|
|
30
|
-
export const ListSourcesInputSchema = PaginationSchema;
|
|
31
|
-
// --- jules_create_session ---
|
|
32
|
-
export const CreateSessionInputSchema = z.object({
|
|
33
|
-
prompt: z.string().describe("The user's goal or prompt for the session."),
|
|
34
|
-
source: z
|
|
35
|
-
.string()
|
|
36
|
-
.describe("The name of the source resource (e.g., 'sources/github/owner/repo')."),
|
|
37
|
-
startingBranch: z
|
|
38
|
-
.string()
|
|
39
|
-
.default('main')
|
|
40
|
-
.describe('The starting branch for the repository.'),
|
|
41
|
-
automationMode: z
|
|
42
|
-
.enum(['AUTO_CREATE_PR', 'NONE'])
|
|
43
|
-
.optional()
|
|
44
|
-
.describe("Whether to automatically create a PR ('AUTO_CREATE_PR' or 'NONE', default: 'NONE')."),
|
|
45
|
-
title: z.string().describe('The title of the session.'),
|
|
46
|
-
requirePlanApproval: z
|
|
47
|
-
.boolean()
|
|
48
|
-
.default(false)
|
|
49
|
-
.describe('If true, requires an explicit call to approve_plan to proceed.'),
|
|
50
|
-
response_format: ResponseFormatSchema,
|
|
51
|
-
});
|
|
52
|
-
// --- jules_list_sessions ---
|
|
53
|
-
export const ListSessionsInputSchema = PaginationSchema;
|
|
54
|
-
// --- jules_approve_plan ---
|
|
55
|
-
export const ApprovePlanInputSchema = z.object({
|
|
56
|
-
sessionId: z
|
|
57
|
-
.string()
|
|
58
|
-
.describe("The session ID or resource name (e.g., 'sessions/12345')."),
|
|
59
|
-
response_format: ResponseFormatSchema,
|
|
60
|
-
});
|
|
61
|
-
//# sourceMappingURL=julesSchemas.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"julesSchemas.js","sourceRoot":"","sources":["../../src/schemas/julesSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,oEAAoE;AACpE,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,IAAK,GAAW,CAAC,OAAO,IAAI,GAAG,CAAC;AAE/C,gBAAgB;AAChB,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,uCAAqB,CAAA;IACrB,+BAAa,CAAA;AACjB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,iBAAiB;AACjB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAChC,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;KAC1B,QAAQ,EAAE;KACV,QAA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AAGxD,6BAA6B;AAC7B,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,SAAS,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,CAAC,2DAA2D,CAAC;IAC1E,eAAe,EAAE,oBAAoB;CACxC,CAAC,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
type ErrorResult = {
|
|
2
|
-
content: [{
|
|
3
|
-
type: 'text';
|
|
4
|
-
text: string;
|
|
5
|
-
}];
|
|
6
|
-
isError: true;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Make an authenticated request to the Jules API.
|
|
10
|
-
*/
|
|
11
|
-
export declare function julesApiRequest<T>(endpoint: string, method?: 'GET' | 'POST' | 'PUT' | 'DELETE', data?: unknown, params?: Record<string, unknown>): Promise<T>;
|
|
12
|
-
/**
|
|
13
|
-
* Convert a caught error into a tool error result.
|
|
14
|
-
*/
|
|
15
|
-
export declare function handleApiError(error: unknown): ErrorResult;
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=julesApiClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"julesApiClient.d.ts","sourceRoot":"","sources":["../../src/services/julesApiClient.ts"],"names":[],"mappings":"AAGA,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC;AAMhF;;GAEG;AACH,wBAAsB,eAAe,CAAC,CAAC,EACnC,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAgB,EACjD,IAAI,CAAC,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,OAAO,CAAC,CAAC,CAAC,CAmBZ;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CA+C1D"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { API_BASE_URL } from '../constants.js';
|
|
3
|
-
function apiError(message) {
|
|
4
|
-
return { content: [{ type: 'text', text: message }], isError: true };
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Make an authenticated request to the Jules API.
|
|
8
|
-
*/
|
|
9
|
-
export async function julesApiRequest(endpoint, method = 'GET', data, params) {
|
|
10
|
-
const apiKey = process.env.JULES_API_KEY;
|
|
11
|
-
if (!apiKey) {
|
|
12
|
-
throw new Error('JULES_API_KEY environment variable is missing.');
|
|
13
|
-
}
|
|
14
|
-
const response = await axios({
|
|
15
|
-
method,
|
|
16
|
-
url: `${API_BASE_URL}${endpoint.startsWith('/') ? endpoint : `/${endpoint}`}`,
|
|
17
|
-
data,
|
|
18
|
-
params,
|
|
19
|
-
timeout: 30000,
|
|
20
|
-
headers: {
|
|
21
|
-
'Content-Type': 'application/json',
|
|
22
|
-
Accept: 'application/json',
|
|
23
|
-
'X-Goog-Api-Key': apiKey,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
return response.data;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Convert a caught error into a tool error result.
|
|
30
|
-
*/
|
|
31
|
-
export function handleApiError(error) {
|
|
32
|
-
if (error instanceof Error && error.message.includes('JULES_API_KEY')) {
|
|
33
|
-
return apiError(error.message);
|
|
34
|
-
}
|
|
35
|
-
if (axios.isAxiosError(error)) {
|
|
36
|
-
if (error.response) {
|
|
37
|
-
const status = error.response.status;
|
|
38
|
-
const data = error.response.data;
|
|
39
|
-
const detail = String(data?.error?.message ??
|
|
40
|
-
JSON.stringify(data) ??
|
|
41
|
-
'No details.');
|
|
42
|
-
switch (status) {
|
|
43
|
-
case 400:
|
|
44
|
-
return apiError(`Bad Request (400): ${detail}`);
|
|
45
|
-
case 401:
|
|
46
|
-
return apiError(`Unauthorized (401). Ensure JULES_API_KEY is correct. ${detail}`);
|
|
47
|
-
case 403:
|
|
48
|
-
return apiError(`Forbidden (403). You do not have access to this resource. ${detail}`);
|
|
49
|
-
case 404:
|
|
50
|
-
return apiError(`Not Found (404). The resource does not exist. ${detail}`);
|
|
51
|
-
case 429:
|
|
52
|
-
return apiError(`Rate limit exceeded (429). Please wait before retrying. ${detail}`);
|
|
53
|
-
default:
|
|
54
|
-
return apiError(`API request failed with status ${status}. ${detail}`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
if (error.code === 'ECONNABORTED') {
|
|
58
|
-
return apiError('Request timed out. Please try again.');
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return apiError(`Unexpected error: ${error instanceof Error ? error.message : String(error)}`);
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=julesApiClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"julesApiClient.js","sourceRoot":"","sources":["../../src/services/julesApiClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI/C,SAAS,QAAQ,CAAC,OAAe;IAC7B,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACzE,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACjC,QAAgB,EAChB,SAA4C,KAAK,EACjD,IAAc,EACd,MAAgC;IAEhC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;IACzC,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,QAAQ,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ACN,KAAK,GAAG;oBACJ,OAAO,QAAQ,CACX,iDAAiD,MAAM,EAAE,CAC5D,CAAC;gBACN,KAAK,GAAG;oBACJ,OAAO,QAAQ,CACX,2DAA2D,MAAM,EAAE,CACtE,CAAC;gBACN;oBACI,OAAO,QAAQ,CACX,kCAAkC,MAAM,KAAK,MAAM,EAAE,CACxD,CAAC;YACV,CAAC;QACL,CAAC;QACD,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAChC,OAAO,QAAQ,CAAC,sCAAsC,CAAC,CAAC;QAC5D,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CACX,qBAAqB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAChF,CAAC;AACN,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"approvePlan.d.ts","sourceRoot":"","sources":["../../src/tools/approvePlan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAUzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,QAoDxD"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { handleApiError, julesApiRequest } from '../services/julesApiClient.js';
|
|
2
|
-
import { ApprovePlanInputSchema, ResponseFormat, } from '../schemas/julesSchemas.js';
|
|
3
|
-
import { CHARACTER_LIMIT } from '../constants.js';
|
|
4
|
-
import { IS_MOCK, MOCK_FIXTURES } from '../mock.js';
|
|
5
|
-
export function registerApprovePlanTool(server) {
|
|
6
|
-
server.registerTool('jules_approve_plan', {
|
|
7
|
-
title: 'Approve Jules Session Plan',
|
|
8
|
-
description: 'Approve a pending plan for a Jules session to proceed.',
|
|
9
|
-
inputSchema: ApprovePlanInputSchema,
|
|
10
|
-
annotations: {
|
|
11
|
-
readOnlyHint: false,
|
|
12
|
-
destructiveHint: true,
|
|
13
|
-
idempotentHint: false,
|
|
14
|
-
openWorldHint: false,
|
|
15
|
-
},
|
|
16
|
-
}, async (params) => {
|
|
17
|
-
try {
|
|
18
|
-
const endpoint = params.sessionId.includes('/')
|
|
19
|
-
? `/${params.sessionId}:approvePlan`
|
|
20
|
-
: `/v1alpha/sessions/${params.sessionId}:approvePlan`;
|
|
21
|
-
const data = IS_MOCK
|
|
22
|
-
? MOCK_FIXTURES.approvePlan
|
|
23
|
-
: await julesApiRequest(endpoint, 'POST', {});
|
|
24
|
-
let textContent;
|
|
25
|
-
if (params.response_format !== ResponseFormat.JSON) {
|
|
26
|
-
textContent = `# Plan Approved\n\nSuccessfully approved plan for session \`${params.sessionId}\`.\n\nUse \`jules_list_sessions\` to monitor progress.`;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
textContent = JSON.stringify({ success: true, session: params.sessionId, data }, null, 2);
|
|
30
|
-
}
|
|
31
|
-
if (textContent.length > CHARACTER_LIMIT)
|
|
32
|
-
textContent =
|
|
33
|
-
textContent.slice(0, CHARACTER_LIMIT) +
|
|
34
|
-
'\n...[truncated]';
|
|
35
|
-
return {
|
|
36
|
-
content: [{ type: 'text', text: textContent }],
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
return handleApiError(error);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=approvePlan.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"approvePlan.js","sourceRoot":"","sources":["../../src/tools/approvePlan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EACH,sBAAsB,EAEtB,cAAc,GACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,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,WAAW,EAAE,CAAC;aAC1D,CAAC;QACN,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;IACL,CAAC,CACJ,CAAC;AACN,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createSession.d.ts","sourceRoot":"","sources":["../../src/tools/createSession.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgBzE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,QAiE1D"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { handleApiError, julesApiRequest } from '../services/julesApiClient.js';
|
|
2
|
-
import { CreateSessionInputSchema, ResponseFormat, } from '../schemas/julesSchemas.js';
|
|
3
|
-
import { CHARACTER_LIMIT } from '../constants.js';
|
|
4
|
-
import { IS_MOCK, MOCK_FIXTURES } from '../mock.js';
|
|
5
|
-
export function registerCreateSessionTool(server) {
|
|
6
|
-
server.registerTool('jules_create_session', {
|
|
7
|
-
title: 'Create Jules Session',
|
|
8
|
-
description: 'Create a new Jules session to work on a repository.',
|
|
9
|
-
inputSchema: CreateSessionInputSchema,
|
|
10
|
-
annotations: {
|
|
11
|
-
readOnlyHint: false,
|
|
12
|
-
destructiveHint: false,
|
|
13
|
-
idempotentHint: false,
|
|
14
|
-
openWorldHint: false,
|
|
15
|
-
},
|
|
16
|
-
}, async (params) => {
|
|
17
|
-
try {
|
|
18
|
-
const data = IS_MOCK
|
|
19
|
-
? MOCK_FIXTURES.createSession
|
|
20
|
-
: await julesApiRequest('/v1alpha/sessions', 'POST', {
|
|
21
|
-
prompt: params.prompt,
|
|
22
|
-
title: params.title,
|
|
23
|
-
sourceContext: {
|
|
24
|
-
source: params.source,
|
|
25
|
-
githubRepoContext: {
|
|
26
|
-
startingBranch: params.startingBranch,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
automationMode: params.automationMode,
|
|
30
|
-
requirePlanApproval: params.requirePlanApproval,
|
|
31
|
-
});
|
|
32
|
-
const sessionId = data.name;
|
|
33
|
-
let textContent;
|
|
34
|
-
if (params.response_format !== ResponseFormat.JSON) {
|
|
35
|
-
const lines = [
|
|
36
|
-
'# Session Created',
|
|
37
|
-
'',
|
|
38
|
-
`- **Session ID**: ${sessionId}`,
|
|
39
|
-
`- **Title**: ${data.title ?? params.title}`,
|
|
40
|
-
`- **Prompt**: ${data.prompt ?? params.prompt}`,
|
|
41
|
-
'',
|
|
42
|
-
'Use `jules_list_sessions` to check its status.',
|
|
43
|
-
];
|
|
44
|
-
textContent = lines.join('\n');
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
textContent = JSON.stringify(data, null, 2);
|
|
48
|
-
}
|
|
49
|
-
if (textContent.length > CHARACTER_LIMIT)
|
|
50
|
-
textContent =
|
|
51
|
-
textContent.slice(0, CHARACTER_LIMIT) +
|
|
52
|
-
'\n...[truncated]';
|
|
53
|
-
return {
|
|
54
|
-
content: [{ type: 'text', text: textContent }],
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
return handleApiError(error);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=createSession.js.map
|