@fre4x/jules 1.0.55 → 1.0.57

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 (2) hide show
  1. package/dist/index.js +131 -134
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -18438,22 +18438,26 @@ var require_follow_redirects = __commonJS({
18438
18438
  // ../packages/shared/dist/errors.js
18439
18439
  function createApiError(message, statusCode) {
18440
18440
  let hint = "Check your network connection and retry.";
18441
+ let type = "Service Error";
18441
18442
  if (statusCode === 429) {
18442
- hint = "Rate limit exceeded. Suggestion: Wait for 60 seconds (Exponential Backoff) before retrying or reduce concurrent calls.";
18443
+ type = "Rate Limit";
18444
+ hint = "Request volume is too high. Suggestion: Wait briefly before retrying or reduce concurrent calls.";
18443
18445
  } else if (statusCode === 401 || statusCode === 403) {
18444
- hint = "Authentication failed. Suggestion: Verify your API key or token in the environment configuration.";
18446
+ type = "Authentication Error";
18447
+ hint = "The request could not be authorized. Suggestion: Verify your API key or token in the environment configuration.";
18445
18448
  } else if (statusCode && statusCode >= 500) {
18446
- hint = "Upstream service is having issues. Suggestion: This is a temporary external error. Try again in a few minutes.";
18449
+ type = "Upstream Error";
18450
+ hint = "The remote service is experiencing temporary issues. Suggestion: Try again in a few minutes.";
18447
18451
  } else if (statusCode === 404) {
18448
- hint = "The requested resource was not found. Suggestion: Check if the ID or Ticker is correct, or search for it first.";
18452
+ type = "Not Found";
18453
+ hint = "The requested information could not be found. Suggestion: Check if the ID, Ticker, or query parameters are correct.";
18449
18454
  }
18450
- const detail = statusCode ? ` (HTTP ${statusCode})` : "";
18451
18455
  return {
18452
18456
  isError: true,
18453
18457
  content: [
18454
18458
  {
18455
18459
  type: "text",
18456
- text: `API Error${detail}: ${message}
18460
+ text: `${type}: ${message}
18457
18461
 
18458
18462
  **Next Action**: ${hint}`
18459
18463
  }
@@ -32497,7 +32501,8 @@ config(en_default());
32497
32501
  var zod_default = external_exports;
32498
32502
 
32499
32503
  // ../packages/shared/dist/pagination.js
32500
- var z2 = external_exports || zod_default || zod_exports;
32504
+ var zodCompat = zod_exports;
32505
+ var z2 = zodCompat.z ?? zodCompat.default?.z ?? zodCompat.default ?? zodCompat;
32501
32506
  var paginationSchema = z2.object({
32502
32507
  limit: z2.number().int().min(1).max(100).default(20).describe("Maximum results to return (1\u2013100, default 20)"),
32503
32508
  offset: z2.number().int().min(0).default(0).describe("Number of results to skip for pagination (default 0)")
@@ -42095,14 +42100,26 @@ var MOCK_FIXTURES = {
42095
42100
  };
42096
42101
 
42097
42102
  // src/schemas/julesSchemas.ts
42098
- var z3 = external_exports || zod_default || zod_exports;
42099
- var ResponseFormatSchema = z3.enum(["markdown", "json"]).optional().describe("Output format: 'markdown' or 'json' (default: markdown)");
42103
+ var zodCompat2 = zod_exports;
42104
+ var z3 = zodCompat2.z ?? zodCompat2.default?.z ?? zodCompat2.default ?? zodCompat2;
42100
42105
  var PaginationSchema = z3.object({
42101
42106
  pageSize: z3.number().int().min(1).max(100).default(20).describe("Maximum results to return"),
42102
- pageToken: z3.string().optional().describe("Page token for retrieving the next page"),
42103
- response_format: ResponseFormatSchema
42107
+ pageToken: z3.string().optional().describe("Page token for retrieving the next page")
42104
42108
  });
42105
42109
  var ListSourcesInputSchema = PaginationSchema;
42110
+ var ListSourcesOutputSchema = z3.object({
42111
+ sources: z3.array(
42112
+ z3.object({
42113
+ name: z3.string(),
42114
+ id: z3.string().optional(),
42115
+ githubRepo: z3.object({
42116
+ owner: z3.string(),
42117
+ repo: z3.string()
42118
+ }).optional()
42119
+ })
42120
+ ).optional(),
42121
+ nextPageToken: z3.string().optional()
42122
+ });
42106
42123
  var CreateSessionInputSchema = z3.object({
42107
42124
  prompt: z3.string().describe("The user's goal or prompt for the session."),
42108
42125
  source: z3.string().describe(
@@ -42115,13 +42132,35 @@ var CreateSessionInputSchema = z3.object({
42115
42132
  title: z3.string().describe("The title of the session."),
42116
42133
  requirePlanApproval: z3.boolean().default(false).describe(
42117
42134
  "If true, requires an explicit call to approve_plan to proceed."
42118
- ),
42119
- response_format: ResponseFormatSchema
42135
+ )
42136
+ });
42137
+ var CreateSessionOutputSchema = z3.object({
42138
+ name: z3.string(),
42139
+ prompt: z3.string().optional(),
42140
+ title: z3.string().optional()
42120
42141
  });
42121
42142
  var ListSessionsInputSchema = PaginationSchema;
42143
+ var ListSessionsOutputSchema = z3.object({
42144
+ sessions: z3.array(
42145
+ z3.object({
42146
+ name: z3.string(),
42147
+ title: z3.string(),
42148
+ state: z3.string().optional(),
42149
+ githubPr: z3.object({
42150
+ url: z3.string(),
42151
+ number: z3.number()
42152
+ }).optional()
42153
+ })
42154
+ ).optional(),
42155
+ nextPageToken: z3.string().optional()
42156
+ });
42122
42157
  var ApprovePlanInputSchema = z3.object({
42123
- sessionId: z3.string().describe("The session ID or resource name (e.g., 'sessions/12345')."),
42124
- response_format: ResponseFormatSchema
42158
+ sessionId: z3.string().describe("The session ID or resource name (e.g., 'sessions/12345').")
42159
+ });
42160
+ var ApprovePlanOutputSchema = z3.object({
42161
+ success: z3.boolean(),
42162
+ session: z3.string(),
42163
+ data: z3.record(z3.string(), z3.any()).optional()
42125
42164
  });
42126
42165
 
42127
42166
  // ../node_modules/axios/lib/helpers/bind.js
@@ -45949,9 +45988,13 @@ function handleApiError(error48) {
45949
45988
  if (error48.response) {
45950
45989
  const status = error48.response.status;
45951
45990
  const data = error48.response.data;
45952
- const detail = String(
45953
- data?.error?.message ?? JSON.stringify(data) ?? "No details."
45991
+ const rawDetail = String(
45992
+ data?.error?.message ?? "No additional information available."
45954
45993
  );
45994
+ const detail = rawDetail.replace(
45995
+ /database|query|sql|internal|stack|trace|axios/gi,
45996
+ "service"
45997
+ ).slice(0, 500);
45955
45998
  switch (status) {
45956
45999
  case 400:
45957
46000
  return createApiError(`Bad Request: ${detail}`, 400);
@@ -45990,19 +46033,10 @@ function handleApiError(error48) {
45990
46033
 
45991
46034
  // src/tools/approvePlan.ts
45992
46035
  function registerApprovePlanTool(server2) {
45993
- server2.registerTool(
46036
+ server2.tool(
45994
46037
  "jules_approve_plan",
45995
- {
45996
- title: "Approve Jules Session Plan",
45997
- description: "Approve a pending plan for a Jules session to proceed.",
45998
- inputSchema: ApprovePlanInputSchema,
45999
- annotations: {
46000
- readOnlyHint: false,
46001
- destructiveHint: true,
46002
- idempotentHint: false,
46003
- openWorldHint: false
46004
- }
46005
- },
46038
+ "Approve a pending plan for a Jules session to proceed.",
46039
+ ApprovePlanInputSchema.shape,
46006
46040
  async (params) => {
46007
46041
  try {
46008
46042
  const endpoint = params.sessionId.includes("/") ? `/${params.sessionId}:approvePlan` : `/v1alpha/sessions/${params.sessionId}:approvePlan`;
@@ -46011,27 +46045,23 @@ function registerApprovePlanTool(server2) {
46011
46045
  "POST",
46012
46046
  {}
46013
46047
  );
46014
- let textContent;
46015
- if (params.response_format !== "json" /* JSON */) {
46016
- textContent = `# Plan Approved
46048
+ const textContent = `# Plan Approved
46017
46049
 
46018
46050
  Successfully approved plan for session \`${params.sessionId}\`.
46019
46051
 
46020
46052
  Use \`jules_list_sessions\` to monitor progress.`;
46021
- } else {
46022
- textContent = JSON.stringify(
46023
- { success: true, session: params.sessionId, data },
46024
- null,
46025
- 2
46026
- );
46027
- }
46028
46053
  return {
46029
46054
  content: [
46030
46055
  {
46031
46056
  type: "text",
46032
46057
  text: truncateToLimit(textContent)
46033
46058
  }
46034
- ]
46059
+ ],
46060
+ structuredContent: {
46061
+ success: true,
46062
+ session: params.sessionId,
46063
+ data
46064
+ }
46035
46065
  };
46036
46066
  } catch (error48) {
46037
46067
  return handleApiError(error48);
@@ -46042,19 +46072,10 @@ Use \`jules_list_sessions\` to monitor progress.`;
46042
46072
 
46043
46073
  // src/tools/createSession.ts
46044
46074
  function registerCreateSessionTool(server2) {
46045
- server2.registerTool(
46075
+ server2.tool(
46046
46076
  "jules_create_session",
46047
- {
46048
- title: "Create Jules Session",
46049
- description: "Create a new Jules session to work on a repository.",
46050
- inputSchema: CreateSessionInputSchema,
46051
- annotations: {
46052
- readOnlyHint: false,
46053
- destructiveHint: false,
46054
- idempotentHint: false,
46055
- openWorldHint: false
46056
- }
46057
- },
46077
+ "Create a new Jules session to work on a repository.",
46078
+ CreateSessionInputSchema.shape,
46058
46079
  async (params) => {
46059
46080
  try {
46060
46081
  const data = IS_MOCK ? MOCK_FIXTURES.createSession : await julesApiRequest(
@@ -46074,28 +46095,24 @@ function registerCreateSessionTool(server2) {
46074
46095
  }
46075
46096
  );
46076
46097
  const sessionId = data.name;
46077
- let textContent;
46078
- if (params.response_format !== "json" /* JSON */) {
46079
- const lines = [
46080
- "# Session Created",
46081
- "",
46082
- `- **Session ID**: ${sessionId}`,
46083
- `- **Title**: ${data.title ?? params.title}`,
46084
- `- **Prompt**: ${data.prompt ?? params.prompt}`,
46085
- "",
46086
- "Use `jules_list_sessions` to check its status."
46087
- ];
46088
- textContent = lines.join("\n");
46089
- } else {
46090
- textContent = JSON.stringify(data, null, 2);
46091
- }
46098
+ const lines = [
46099
+ "# Session Created",
46100
+ "",
46101
+ `- **Session ID**: ${sessionId}`,
46102
+ `- **Title**: ${data.title ?? params.title}`,
46103
+ `- **Prompt**: ${data.prompt ?? params.prompt}`,
46104
+ "",
46105
+ "Use `jules_list_sessions` to check its status."
46106
+ ];
46107
+ const textContent = lines.join("\n");
46092
46108
  return {
46093
46109
  content: [
46094
46110
  {
46095
46111
  type: "text",
46096
46112
  text: truncateToLimit(textContent)
46097
46113
  }
46098
- ]
46114
+ ],
46115
+ structuredContent: data
46099
46116
  };
46100
46117
  } catch (error48) {
46101
46118
  return handleApiError(error48);
@@ -46106,19 +46123,10 @@ function registerCreateSessionTool(server2) {
46106
46123
 
46107
46124
  // src/tools/listSessions.ts
46108
46125
  function registerListSessionsTool(server2) {
46109
- server2.registerTool(
46126
+ server2.tool(
46110
46127
  "jules_list_sessions",
46111
- {
46112
- title: "List Jules Sessions",
46113
- description: "List your active and past Jules sessions and their status.",
46114
- inputSchema: ListSessionsInputSchema,
46115
- annotations: {
46116
- readOnlyHint: true,
46117
- destructiveHint: false,
46118
- idempotentHint: true,
46119
- openWorldHint: false
46120
- }
46121
- },
46128
+ "List your active and past Jules sessions and their status.",
46129
+ ListSessionsInputSchema.shape,
46122
46130
  async (params) => {
46123
46131
  try {
46124
46132
  const queryParams = {
@@ -46140,37 +46148,36 @@ function registerListSessionsTool(server2) {
46140
46148
  type: "text",
46141
46149
  text: "No sessions found."
46142
46150
  }
46143
- ]
46151
+ ],
46152
+ structuredContent: {
46153
+ sessions: [],
46154
+ nextPageToken
46155
+ }
46144
46156
  };
46145
46157
  }
46146
- const output = { sessions, nextPageToken };
46147
- let textContent;
46148
- if (params.response_format !== "json" /* JSON */) {
46149
- const lines = ["# Jules Sessions", ""];
46150
- for (const session of sessions) {
46151
- lines.push(`## ${session.title}`);
46152
- lines.push(`- **ID**: ${session.name}`);
46153
- if (session.state)
46154
- lines.push(`- **State**: ${session.state}`);
46155
- if (session.githubPr)
46156
- lines.push(
46157
- `- **GitHub PR**: #${session.githubPr.number} (${session.githubPr.url})`
46158
- );
46159
- lines.push("");
46160
- }
46161
- if (nextPageToken)
46162
- lines.push(`**Next Page Token**: ${nextPageToken}`);
46163
- textContent = lines.join("\n");
46164
- } else {
46165
- textContent = JSON.stringify(output, null, 2);
46158
+ const lines = ["# Jules Sessions", ""];
46159
+ for (const session of sessions) {
46160
+ lines.push(`## ${session.title}`);
46161
+ lines.push(`- **ID**: ${session.name}`);
46162
+ if (session.state)
46163
+ lines.push(`- **State**: ${session.state}`);
46164
+ if (session.githubPr)
46165
+ lines.push(
46166
+ `- **GitHub PR**: #${session.githubPr.number} (${session.githubPr.url})`
46167
+ );
46168
+ lines.push("");
46166
46169
  }
46170
+ if (nextPageToken)
46171
+ lines.push(`**Next Page Token**: ${nextPageToken}`);
46172
+ const textContent = lines.join("\n");
46167
46173
  return {
46168
46174
  content: [
46169
46175
  {
46170
46176
  type: "text",
46171
46177
  text: truncateToLimit(textContent)
46172
46178
  }
46173
- ]
46179
+ ],
46180
+ structuredContent: { sessions, nextPageToken }
46174
46181
  };
46175
46182
  } catch (error48) {
46176
46183
  return handleApiError(error48);
@@ -46181,19 +46188,10 @@ function registerListSessionsTool(server2) {
46181
46188
 
46182
46189
  // src/tools/listSources.ts
46183
46190
  function registerListSourcesTool(server2) {
46184
- server2.registerTool(
46191
+ server2.tool(
46185
46192
  "jules_list_sources",
46186
- {
46187
- title: "List Jules Sources",
46188
- description: "List available sources (repositories) connected to Jules.",
46189
- inputSchema: ListSourcesInputSchema,
46190
- annotations: {
46191
- readOnlyHint: true,
46192
- destructiveHint: false,
46193
- idempotentHint: true,
46194
- openWorldHint: false
46195
- }
46196
- },
46193
+ "List available sources (repositories) connected to Jules.",
46194
+ ListSourcesInputSchema.shape,
46197
46195
  async (params) => {
46198
46196
  try {
46199
46197
  const queryParams = {
@@ -46215,35 +46213,34 @@ function registerListSourcesTool(server2) {
46215
46213
  type: "text",
46216
46214
  text: "No sources found."
46217
46215
  }
46218
- ]
46216
+ ],
46217
+ structuredContent: {
46218
+ sources: [],
46219
+ nextPageToken
46220
+ }
46219
46221
  };
46220
46222
  }
46221
- const output = { sources, nextPageToken };
46222
- let textContent;
46223
- if (params.response_format !== "json" /* JSON */) {
46224
- const lines = ["# Jules Sources", ""];
46225
- for (const source of sources) {
46226
- lines.push(`## ${source.name}`);
46227
- if (source.id) lines.push(`- **ID**: ${source.id}`);
46228
- if (source.githubRepo)
46229
- lines.push(
46230
- `- **GitHub Repo**: ${source.githubRepo.owner}/${source.githubRepo.repo}`
46231
- );
46232
- lines.push("");
46233
- }
46234
- if (nextPageToken)
46235
- lines.push(`**Next Page Token**: ${nextPageToken}`);
46236
- textContent = lines.join("\n");
46237
- } else {
46238
- textContent = JSON.stringify(output, null, 2);
46223
+ const lines = ["# Jules Sources", ""];
46224
+ for (const source of sources) {
46225
+ lines.push(`## ${source.name}`);
46226
+ if (source.id) lines.push(`- **ID**: ${source.id}`);
46227
+ if (source.githubRepo)
46228
+ lines.push(
46229
+ `- **GitHub Repo**: ${source.githubRepo.owner}/${source.githubRepo.repo}`
46230
+ );
46231
+ lines.push("");
46239
46232
  }
46233
+ if (nextPageToken)
46234
+ lines.push(`**Next Page Token**: ${nextPageToken}`);
46235
+ const textContent = lines.join("\n");
46240
46236
  return {
46241
46237
  content: [
46242
46238
  {
46243
46239
  type: "text",
46244
46240
  text: truncateToLimit(textContent)
46245
46241
  }
46246
- ]
46242
+ ],
46243
+ structuredContent: { sources, nextPageToken }
46247
46244
  };
46248
46245
  } catch (error48) {
46249
46246
  return handleApiError(error48);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fre4x/jules",
3
- "version": "1.0.55",
3
+ "version": "1.0.57",
4
4
  "description": "MCP server for Jules API integration",
5
5
  "type": "module",
6
6
  "bin": {