@fre4x/jules 1.0.61 → 1.0.65-beta.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.js +115 -40
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -32507,6 +32507,18 @@ var paginationSchema = z2.object({
|
|
|
32507
32507
|
limit: z2.number().int().min(1).max(100).default(20).describe("Maximum results to return (1\u2013100, default 20)"),
|
|
32508
32508
|
offset: z2.number().int().min(0).default(0).describe("Number of results to skip for pagination (default 0)")
|
|
32509
32509
|
});
|
|
32510
|
+
function applyPagination(items, params) {
|
|
32511
|
+
const { limit, offset } = params;
|
|
32512
|
+
const total = items.length;
|
|
32513
|
+
const sliced = items.slice(offset, offset + limit);
|
|
32514
|
+
return {
|
|
32515
|
+
items: sliced,
|
|
32516
|
+
total,
|
|
32517
|
+
offset,
|
|
32518
|
+
limit,
|
|
32519
|
+
hasMore: offset + limit < total
|
|
32520
|
+
};
|
|
32521
|
+
}
|
|
32510
32522
|
|
|
32511
32523
|
// ../packages/shared/dist/package.js
|
|
32512
32524
|
import { createRequire as createJsonRequire } from "node:module";
|
|
@@ -42102,11 +42114,9 @@ var MOCK_FIXTURES = {
|
|
|
42102
42114
|
// src/schemas/julesSchemas.ts
|
|
42103
42115
|
var zodCompat2 = zod_exports;
|
|
42104
42116
|
var z3 = zodCompat2.z ?? zodCompat2.default?.z ?? zodCompat2.default ?? zodCompat2;
|
|
42105
|
-
var
|
|
42106
|
-
|
|
42107
|
-
pageToken: z3.string().optional().describe("Page token for retrieving the next page")
|
|
42117
|
+
var ListSourcesInputSchema = paginationSchema.extend({
|
|
42118
|
+
pageToken: z3.string().optional().describe("Upstream page token for retrieving the next API page")
|
|
42108
42119
|
});
|
|
42109
|
-
var ListSourcesInputSchema = PaginationSchema;
|
|
42110
42120
|
var ListSourcesOutputSchema = z3.object({
|
|
42111
42121
|
sources: z3.array(
|
|
42112
42122
|
z3.object({
|
|
@@ -42139,7 +42149,9 @@ var CreateSessionOutputSchema = z3.object({
|
|
|
42139
42149
|
prompt: z3.string().optional(),
|
|
42140
42150
|
title: z3.string().optional()
|
|
42141
42151
|
});
|
|
42142
|
-
var ListSessionsInputSchema =
|
|
42152
|
+
var ListSessionsInputSchema = paginationSchema.extend({
|
|
42153
|
+
pageToken: z3.string().optional().describe("Upstream page token for retrieving the next API page")
|
|
42154
|
+
});
|
|
42143
42155
|
var ListSessionsOutputSchema = z3.object({
|
|
42144
42156
|
sessions: z3.array(
|
|
42145
42157
|
z3.object({
|
|
@@ -42160,7 +42172,7 @@ var ApprovePlanInputSchema = z3.object({
|
|
|
42160
42172
|
var ApprovePlanOutputSchema = z3.object({
|
|
42161
42173
|
success: z3.boolean(),
|
|
42162
42174
|
session: z3.string(),
|
|
42163
|
-
data: z3.record(z3.string(), z3.
|
|
42175
|
+
data: z3.record(z3.string(), z3.unknown()).optional()
|
|
42164
42176
|
});
|
|
42165
42177
|
|
|
42166
42178
|
// ../node_modules/axios/lib/helpers/bind.js
|
|
@@ -46121,6 +46133,33 @@ function registerCreateSessionTool(server2) {
|
|
|
46121
46133
|
);
|
|
46122
46134
|
}
|
|
46123
46135
|
|
|
46136
|
+
// src/tools/paginationWindow.ts
|
|
46137
|
+
async function fetchPaginationWindow(params, fetchPage) {
|
|
46138
|
+
const targetCount = params.offset + params.limit + 1;
|
|
46139
|
+
const collected = [];
|
|
46140
|
+
let nextPageToken = params.pageToken;
|
|
46141
|
+
while (collected.length < targetCount) {
|
|
46142
|
+
const page = await fetchPage({
|
|
46143
|
+
pageSize: Math.max(
|
|
46144
|
+
1,
|
|
46145
|
+
Math.min(100, targetCount - collected.length)
|
|
46146
|
+
),
|
|
46147
|
+
pageToken: nextPageToken
|
|
46148
|
+
});
|
|
46149
|
+
collected.push(...page.items);
|
|
46150
|
+
nextPageToken = page.nextPageToken;
|
|
46151
|
+
if (!page.items.length || !page.nextPageToken) {
|
|
46152
|
+
break;
|
|
46153
|
+
}
|
|
46154
|
+
}
|
|
46155
|
+
const paginated = applyPagination(collected, params);
|
|
46156
|
+
return {
|
|
46157
|
+
items: paginated.items,
|
|
46158
|
+
nextPageToken,
|
|
46159
|
+
hasMore: paginated.hasMore
|
|
46160
|
+
};
|
|
46161
|
+
}
|
|
46162
|
+
|
|
46124
46163
|
// src/tools/listSessions.ts
|
|
46125
46164
|
function registerListSessionsTool(server2) {
|
|
46126
46165
|
server2.tool(
|
|
@@ -46129,19 +46168,25 @@ function registerListSessionsTool(server2) {
|
|
|
46129
46168
|
ListSessionsInputSchema.shape,
|
|
46130
46169
|
async (params) => {
|
|
46131
46170
|
try {
|
|
46132
|
-
const
|
|
46133
|
-
|
|
46134
|
-
|
|
46135
|
-
|
|
46136
|
-
|
|
46137
|
-
|
|
46138
|
-
|
|
46139
|
-
|
|
46140
|
-
|
|
46171
|
+
const paginated = await fetchPaginationWindow(
|
|
46172
|
+
params,
|
|
46173
|
+
async ({ pageSize, pageToken }) => {
|
|
46174
|
+
const data = IS_MOCK ? MOCK_FIXTURES.listSessions : await julesApiRequest(
|
|
46175
|
+
"/v1alpha/sessions",
|
|
46176
|
+
"GET",
|
|
46177
|
+
void 0,
|
|
46178
|
+
{
|
|
46179
|
+
pageSize,
|
|
46180
|
+
...pageToken ? { pageToken } : {}
|
|
46181
|
+
}
|
|
46182
|
+
);
|
|
46183
|
+
return {
|
|
46184
|
+
items: data?.sessions ?? [],
|
|
46185
|
+
nextPageToken: data?.nextPageToken
|
|
46186
|
+
};
|
|
46187
|
+
}
|
|
46141
46188
|
);
|
|
46142
|
-
|
|
46143
|
-
const nextPageToken = data?.nextPageToken;
|
|
46144
|
-
if (!sessions.length) {
|
|
46189
|
+
if (!paginated.items.length) {
|
|
46145
46190
|
return {
|
|
46146
46191
|
content: [
|
|
46147
46192
|
{
|
|
@@ -46151,12 +46196,12 @@ function registerListSessionsTool(server2) {
|
|
|
46151
46196
|
],
|
|
46152
46197
|
structuredContent: {
|
|
46153
46198
|
sessions: [],
|
|
46154
|
-
nextPageToken
|
|
46199
|
+
nextPageToken: paginated.nextPageToken
|
|
46155
46200
|
}
|
|
46156
46201
|
};
|
|
46157
46202
|
}
|
|
46158
46203
|
const lines = ["# Jules Sessions", ""];
|
|
46159
|
-
for (const session of
|
|
46204
|
+
for (const session of paginated.items) {
|
|
46160
46205
|
lines.push(`## ${session.title}`);
|
|
46161
46206
|
lines.push(`- **ID**: ${session.name}`);
|
|
46162
46207
|
if (session.state)
|
|
@@ -46167,8 +46212,17 @@ function registerListSessionsTool(server2) {
|
|
|
46167
46212
|
);
|
|
46168
46213
|
lines.push("");
|
|
46169
46214
|
}
|
|
46170
|
-
if (nextPageToken)
|
|
46171
|
-
lines.push(
|
|
46215
|
+
if (paginated.nextPageToken) {
|
|
46216
|
+
lines.push(
|
|
46217
|
+
`**Next API Page Token**: ${paginated.nextPageToken}`
|
|
46218
|
+
);
|
|
46219
|
+
}
|
|
46220
|
+
if (paginated.hasMore) {
|
|
46221
|
+
lines.push(
|
|
46222
|
+
`
|
|
46223
|
+
*More sessions available locally. Increase offset to view.*`
|
|
46224
|
+
);
|
|
46225
|
+
}
|
|
46172
46226
|
const textContent = lines.join("\n");
|
|
46173
46227
|
return {
|
|
46174
46228
|
content: [
|
|
@@ -46177,7 +46231,10 @@ function registerListSessionsTool(server2) {
|
|
|
46177
46231
|
text: truncateToLimit(textContent)
|
|
46178
46232
|
}
|
|
46179
46233
|
],
|
|
46180
|
-
structuredContent: {
|
|
46234
|
+
structuredContent: {
|
|
46235
|
+
sessions: paginated.items,
|
|
46236
|
+
nextPageToken: paginated.nextPageToken
|
|
46237
|
+
}
|
|
46181
46238
|
};
|
|
46182
46239
|
} catch (error48) {
|
|
46183
46240
|
return handleApiError(error48);
|
|
@@ -46194,19 +46251,25 @@ function registerListSourcesTool(server2) {
|
|
|
46194
46251
|
ListSourcesInputSchema.shape,
|
|
46195
46252
|
async (params) => {
|
|
46196
46253
|
try {
|
|
46197
|
-
const
|
|
46198
|
-
|
|
46199
|
-
|
|
46200
|
-
|
|
46201
|
-
|
|
46202
|
-
|
|
46203
|
-
|
|
46204
|
-
|
|
46205
|
-
|
|
46254
|
+
const paginated = await fetchPaginationWindow(
|
|
46255
|
+
params,
|
|
46256
|
+
async ({ pageSize, pageToken }) => {
|
|
46257
|
+
const data = IS_MOCK ? MOCK_FIXTURES.listSources : await julesApiRequest(
|
|
46258
|
+
"/v1alpha/sources",
|
|
46259
|
+
"GET",
|
|
46260
|
+
void 0,
|
|
46261
|
+
{
|
|
46262
|
+
pageSize,
|
|
46263
|
+
...pageToken ? { pageToken } : {}
|
|
46264
|
+
}
|
|
46265
|
+
);
|
|
46266
|
+
return {
|
|
46267
|
+
items: data?.sources ?? [],
|
|
46268
|
+
nextPageToken: data?.nextPageToken
|
|
46269
|
+
};
|
|
46270
|
+
}
|
|
46206
46271
|
);
|
|
46207
|
-
|
|
46208
|
-
const nextPageToken = data?.nextPageToken;
|
|
46209
|
-
if (!sources.length) {
|
|
46272
|
+
if (!paginated.items.length) {
|
|
46210
46273
|
return {
|
|
46211
46274
|
content: [
|
|
46212
46275
|
{
|
|
@@ -46216,12 +46279,12 @@ function registerListSourcesTool(server2) {
|
|
|
46216
46279
|
],
|
|
46217
46280
|
structuredContent: {
|
|
46218
46281
|
sources: [],
|
|
46219
|
-
nextPageToken
|
|
46282
|
+
nextPageToken: paginated.nextPageToken
|
|
46220
46283
|
}
|
|
46221
46284
|
};
|
|
46222
46285
|
}
|
|
46223
46286
|
const lines = ["# Jules Sources", ""];
|
|
46224
|
-
for (const source of
|
|
46287
|
+
for (const source of paginated.items) {
|
|
46225
46288
|
lines.push(`## ${source.name}`);
|
|
46226
46289
|
if (source.id) lines.push(`- **ID**: ${source.id}`);
|
|
46227
46290
|
if (source.githubRepo)
|
|
@@ -46230,8 +46293,17 @@ function registerListSourcesTool(server2) {
|
|
|
46230
46293
|
);
|
|
46231
46294
|
lines.push("");
|
|
46232
46295
|
}
|
|
46233
|
-
if (nextPageToken)
|
|
46234
|
-
lines.push(
|
|
46296
|
+
if (paginated.nextPageToken) {
|
|
46297
|
+
lines.push(
|
|
46298
|
+
`**Next API Page Token**: ${paginated.nextPageToken}`
|
|
46299
|
+
);
|
|
46300
|
+
}
|
|
46301
|
+
if (paginated.hasMore) {
|
|
46302
|
+
lines.push(
|
|
46303
|
+
`
|
|
46304
|
+
*More sources available locally. Increase offset to view.*`
|
|
46305
|
+
);
|
|
46306
|
+
}
|
|
46235
46307
|
const textContent = lines.join("\n");
|
|
46236
46308
|
return {
|
|
46237
46309
|
content: [
|
|
@@ -46240,7 +46312,10 @@ function registerListSourcesTool(server2) {
|
|
|
46240
46312
|
text: truncateToLimit(textContent)
|
|
46241
46313
|
}
|
|
46242
46314
|
],
|
|
46243
|
-
structuredContent: {
|
|
46315
|
+
structuredContent: {
|
|
46316
|
+
sources: paginated.items,
|
|
46317
|
+
nextPageToken: paginated.nextPageToken
|
|
46318
|
+
}
|
|
46244
46319
|
};
|
|
46245
46320
|
} catch (error48) {
|
|
46246
46321
|
return handleApiError(error48);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fre4x/jules",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.65-beta.0",
|
|
4
4
|
"description": "MCP server for Jules API integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"build": "node ../scripts/build-package.mjs",
|
|
17
17
|
"typecheck": "cross-env NODE_OPTIONS=--max-old-space-size=4096 tsc --noEmit",
|
|
18
18
|
"inspector": "npm run build && node ../scripts/run-official-inspector.mjs node dist/index.js",
|
|
19
|
-
"test": "vitest run --exclude dist",
|
|
20
|
-
"test:watch": "vitest",
|
|
19
|
+
"test": "node ../scripts/run-vitest.mjs run --exclude dist",
|
|
20
|
+
"test:watch": "node ../scripts/run-vitest.mjs",
|
|
21
21
|
"clean": "rm -rf dist"
|
|
22
22
|
},
|
|
23
23
|
"engines": {
|