@fre4x/jules 1.0.64 → 1.0.65-beta.1
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 +121 -44
- 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({
|
|
@@ -42127,11 +42137,11 @@ var CreateSessionInputSchema = z3.object({
|
|
|
42127
42137
|
),
|
|
42128
42138
|
startingBranch: z3.string().default("main").describe("The starting branch for the repository."),
|
|
42129
42139
|
automationMode: z3.enum(["AUTO_CREATE_PR", "NONE"]).optional().describe(
|
|
42130
|
-
"Whether
|
|
42140
|
+
"Whether Jules should auto-open a PR after the session ('AUTO_CREATE_PR' or 'NONE', default: 'NONE')."
|
|
42131
42141
|
),
|
|
42132
42142
|
title: z3.string().describe("The title of the session."),
|
|
42133
42143
|
requirePlanApproval: z3.boolean().default(false).describe(
|
|
42134
|
-
"If true,
|
|
42144
|
+
"If true, the session pauses after planning until jules_approve_plan is called."
|
|
42135
42145
|
)
|
|
42136
42146
|
});
|
|
42137
42147
|
var CreateSessionOutputSchema = 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({
|
|
@@ -42155,12 +42167,14 @@ var ListSessionsOutputSchema = z3.object({
|
|
|
42155
42167
|
nextPageToken: z3.string().optional()
|
|
42156
42168
|
});
|
|
42157
42169
|
var ApprovePlanInputSchema = z3.object({
|
|
42158
|
-
sessionId: z3.string().describe(
|
|
42170
|
+
sessionId: z3.string().describe(
|
|
42171
|
+
"The paused session ID or resource name to unblock (e.g., 'sessions/12345')."
|
|
42172
|
+
)
|
|
42159
42173
|
});
|
|
42160
42174
|
var ApprovePlanOutputSchema = z3.object({
|
|
42161
42175
|
success: z3.boolean(),
|
|
42162
42176
|
session: z3.string(),
|
|
42163
|
-
data: z3.record(z3.string(), z3.
|
|
42177
|
+
data: z3.record(z3.string(), z3.unknown()).optional()
|
|
42164
42178
|
});
|
|
42165
42179
|
|
|
42166
42180
|
// ../node_modules/axios/lib/helpers/bind.js
|
|
@@ -46035,7 +46049,7 @@ function handleApiError(error48) {
|
|
|
46035
46049
|
function registerApprovePlanTool(server2) {
|
|
46036
46050
|
server2.tool(
|
|
46037
46051
|
"jules_approve_plan",
|
|
46038
|
-
"Approve a
|
|
46052
|
+
"Approve a plan-gated Jules session so execution can continue.",
|
|
46039
46053
|
ApprovePlanInputSchema.shape,
|
|
46040
46054
|
async (params) => {
|
|
46041
46055
|
try {
|
|
@@ -46121,6 +46135,33 @@ function registerCreateSessionTool(server2) {
|
|
|
46121
46135
|
);
|
|
46122
46136
|
}
|
|
46123
46137
|
|
|
46138
|
+
// src/tools/paginationWindow.ts
|
|
46139
|
+
async function fetchPaginationWindow(params, fetchPage) {
|
|
46140
|
+
const targetCount = params.offset + params.limit + 1;
|
|
46141
|
+
const collected = [];
|
|
46142
|
+
let nextPageToken = params.pageToken;
|
|
46143
|
+
while (collected.length < targetCount) {
|
|
46144
|
+
const page = await fetchPage({
|
|
46145
|
+
pageSize: Math.max(
|
|
46146
|
+
1,
|
|
46147
|
+
Math.min(100, targetCount - collected.length)
|
|
46148
|
+
),
|
|
46149
|
+
pageToken: nextPageToken
|
|
46150
|
+
});
|
|
46151
|
+
collected.push(...page.items);
|
|
46152
|
+
nextPageToken = page.nextPageToken;
|
|
46153
|
+
if (!page.items.length || !page.nextPageToken) {
|
|
46154
|
+
break;
|
|
46155
|
+
}
|
|
46156
|
+
}
|
|
46157
|
+
const paginated = applyPagination(collected, params);
|
|
46158
|
+
return {
|
|
46159
|
+
items: paginated.items,
|
|
46160
|
+
nextPageToken,
|
|
46161
|
+
hasMore: paginated.hasMore
|
|
46162
|
+
};
|
|
46163
|
+
}
|
|
46164
|
+
|
|
46124
46165
|
// src/tools/listSessions.ts
|
|
46125
46166
|
function registerListSessionsTool(server2) {
|
|
46126
46167
|
server2.tool(
|
|
@@ -46129,19 +46170,25 @@ function registerListSessionsTool(server2) {
|
|
|
46129
46170
|
ListSessionsInputSchema.shape,
|
|
46130
46171
|
async (params) => {
|
|
46131
46172
|
try {
|
|
46132
|
-
const
|
|
46133
|
-
|
|
46134
|
-
|
|
46135
|
-
|
|
46136
|
-
|
|
46137
|
-
|
|
46138
|
-
|
|
46139
|
-
|
|
46140
|
-
|
|
46173
|
+
const paginated = await fetchPaginationWindow(
|
|
46174
|
+
params,
|
|
46175
|
+
async ({ pageSize, pageToken }) => {
|
|
46176
|
+
const data = IS_MOCK ? MOCK_FIXTURES.listSessions : await julesApiRequest(
|
|
46177
|
+
"/v1alpha/sessions",
|
|
46178
|
+
"GET",
|
|
46179
|
+
void 0,
|
|
46180
|
+
{
|
|
46181
|
+
pageSize,
|
|
46182
|
+
...pageToken ? { pageToken } : {}
|
|
46183
|
+
}
|
|
46184
|
+
);
|
|
46185
|
+
return {
|
|
46186
|
+
items: data?.sessions ?? [],
|
|
46187
|
+
nextPageToken: data?.nextPageToken
|
|
46188
|
+
};
|
|
46189
|
+
}
|
|
46141
46190
|
);
|
|
46142
|
-
|
|
46143
|
-
const nextPageToken = data?.nextPageToken;
|
|
46144
|
-
if (!sessions.length) {
|
|
46191
|
+
if (!paginated.items.length) {
|
|
46145
46192
|
return {
|
|
46146
46193
|
content: [
|
|
46147
46194
|
{
|
|
@@ -46151,12 +46198,12 @@ function registerListSessionsTool(server2) {
|
|
|
46151
46198
|
],
|
|
46152
46199
|
structuredContent: {
|
|
46153
46200
|
sessions: [],
|
|
46154
|
-
nextPageToken
|
|
46201
|
+
nextPageToken: paginated.nextPageToken
|
|
46155
46202
|
}
|
|
46156
46203
|
};
|
|
46157
46204
|
}
|
|
46158
46205
|
const lines = ["# Jules Sessions", ""];
|
|
46159
|
-
for (const session of
|
|
46206
|
+
for (const session of paginated.items) {
|
|
46160
46207
|
lines.push(`## ${session.title}`);
|
|
46161
46208
|
lines.push(`- **ID**: ${session.name}`);
|
|
46162
46209
|
if (session.state)
|
|
@@ -46167,8 +46214,17 @@ function registerListSessionsTool(server2) {
|
|
|
46167
46214
|
);
|
|
46168
46215
|
lines.push("");
|
|
46169
46216
|
}
|
|
46170
|
-
if (nextPageToken)
|
|
46171
|
-
lines.push(
|
|
46217
|
+
if (paginated.nextPageToken) {
|
|
46218
|
+
lines.push(
|
|
46219
|
+
`**Next API Page Token**: ${paginated.nextPageToken}`
|
|
46220
|
+
);
|
|
46221
|
+
}
|
|
46222
|
+
if (paginated.hasMore) {
|
|
46223
|
+
lines.push(
|
|
46224
|
+
`
|
|
46225
|
+
*More sessions available locally. Increase offset to view.*`
|
|
46226
|
+
);
|
|
46227
|
+
}
|
|
46172
46228
|
const textContent = lines.join("\n");
|
|
46173
46229
|
return {
|
|
46174
46230
|
content: [
|
|
@@ -46177,7 +46233,10 @@ function registerListSessionsTool(server2) {
|
|
|
46177
46233
|
text: truncateToLimit(textContent)
|
|
46178
46234
|
}
|
|
46179
46235
|
],
|
|
46180
|
-
structuredContent: {
|
|
46236
|
+
structuredContent: {
|
|
46237
|
+
sessions: paginated.items,
|
|
46238
|
+
nextPageToken: paginated.nextPageToken
|
|
46239
|
+
}
|
|
46181
46240
|
};
|
|
46182
46241
|
} catch (error48) {
|
|
46183
46242
|
return handleApiError(error48);
|
|
@@ -46194,19 +46253,25 @@ function registerListSourcesTool(server2) {
|
|
|
46194
46253
|
ListSourcesInputSchema.shape,
|
|
46195
46254
|
async (params) => {
|
|
46196
46255
|
try {
|
|
46197
|
-
const
|
|
46198
|
-
|
|
46199
|
-
|
|
46200
|
-
|
|
46201
|
-
|
|
46202
|
-
|
|
46203
|
-
|
|
46204
|
-
|
|
46205
|
-
|
|
46256
|
+
const paginated = await fetchPaginationWindow(
|
|
46257
|
+
params,
|
|
46258
|
+
async ({ pageSize, pageToken }) => {
|
|
46259
|
+
const data = IS_MOCK ? MOCK_FIXTURES.listSources : await julesApiRequest(
|
|
46260
|
+
"/v1alpha/sources",
|
|
46261
|
+
"GET",
|
|
46262
|
+
void 0,
|
|
46263
|
+
{
|
|
46264
|
+
pageSize,
|
|
46265
|
+
...pageToken ? { pageToken } : {}
|
|
46266
|
+
}
|
|
46267
|
+
);
|
|
46268
|
+
return {
|
|
46269
|
+
items: data?.sources ?? [],
|
|
46270
|
+
nextPageToken: data?.nextPageToken
|
|
46271
|
+
};
|
|
46272
|
+
}
|
|
46206
46273
|
);
|
|
46207
|
-
|
|
46208
|
-
const nextPageToken = data?.nextPageToken;
|
|
46209
|
-
if (!sources.length) {
|
|
46274
|
+
if (!paginated.items.length) {
|
|
46210
46275
|
return {
|
|
46211
46276
|
content: [
|
|
46212
46277
|
{
|
|
@@ -46216,12 +46281,12 @@ function registerListSourcesTool(server2) {
|
|
|
46216
46281
|
],
|
|
46217
46282
|
structuredContent: {
|
|
46218
46283
|
sources: [],
|
|
46219
|
-
nextPageToken
|
|
46284
|
+
nextPageToken: paginated.nextPageToken
|
|
46220
46285
|
}
|
|
46221
46286
|
};
|
|
46222
46287
|
}
|
|
46223
46288
|
const lines = ["# Jules Sources", ""];
|
|
46224
|
-
for (const source of
|
|
46289
|
+
for (const source of paginated.items) {
|
|
46225
46290
|
lines.push(`## ${source.name}`);
|
|
46226
46291
|
if (source.id) lines.push(`- **ID**: ${source.id}`);
|
|
46227
46292
|
if (source.githubRepo)
|
|
@@ -46230,8 +46295,17 @@ function registerListSourcesTool(server2) {
|
|
|
46230
46295
|
);
|
|
46231
46296
|
lines.push("");
|
|
46232
46297
|
}
|
|
46233
|
-
if (nextPageToken)
|
|
46234
|
-
lines.push(
|
|
46298
|
+
if (paginated.nextPageToken) {
|
|
46299
|
+
lines.push(
|
|
46300
|
+
`**Next API Page Token**: ${paginated.nextPageToken}`
|
|
46301
|
+
);
|
|
46302
|
+
}
|
|
46303
|
+
if (paginated.hasMore) {
|
|
46304
|
+
lines.push(
|
|
46305
|
+
`
|
|
46306
|
+
*More sources available locally. Increase offset to view.*`
|
|
46307
|
+
);
|
|
46308
|
+
}
|
|
46235
46309
|
const textContent = lines.join("\n");
|
|
46236
46310
|
return {
|
|
46237
46311
|
content: [
|
|
@@ -46240,7 +46314,10 @@ function registerListSourcesTool(server2) {
|
|
|
46240
46314
|
text: truncateToLimit(textContent)
|
|
46241
46315
|
}
|
|
46242
46316
|
],
|
|
46243
|
-
structuredContent: {
|
|
46317
|
+
structuredContent: {
|
|
46318
|
+
sources: paginated.items,
|
|
46319
|
+
nextPageToken: paginated.nextPageToken
|
|
46320
|
+
}
|
|
46244
46321
|
};
|
|
46245
46322
|
} catch (error48) {
|
|
46246
46323
|
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.1",
|
|
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": {
|