@jive-ai/cli 0.0.46 → 0.0.47

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.mjs +48 -62
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -2050,7 +2050,7 @@ async function createGraphQLClient() {
2050
2050
 
2051
2051
  //#endregion
2052
2052
  //#region package.json
2053
- var version = "0.0.46";
2053
+ var version = "0.0.47";
2054
2054
 
2055
2055
  //#endregion
2056
2056
  //#region src/runner/index.ts
@@ -2507,17 +2507,10 @@ async function queryClaude(prompt, mcpServer, opts) {
2507
2507
  permissionMode: mapPermissionMode(permissionMode),
2508
2508
  ...betaFlags.length > 0 && { betas: betaFlags },
2509
2509
  canUseTool: async (toolName, input) => {
2510
- if (toolName === "AskUserQuestion") {
2511
- const result = await task.requestUserQuestions(input);
2512
- if (result) return {
2513
- behavior: "allow",
2514
- updatedInput: result
2515
- };
2516
- else return {
2517
- behavior: "deny",
2518
- message: "User did not answer questions in time"
2519
- };
2520
- }
2510
+ if (toolName === "AskUserQuestion") return {
2511
+ behavior: "deny",
2512
+ message: "AskUserQuestion is not allowed. Use the ask_user_question tool from the jive-tasks MCP server instead."
2513
+ };
2521
2514
  if (await task.requestToolPermission(toolName, input)) return {
2522
2515
  behavior: "allow",
2523
2516
  updatedInput: input
@@ -2527,6 +2520,11 @@ async function queryClaude(prompt, mcpServer, opts) {
2527
2520
  message: "User denied this action"
2528
2521
  };
2529
2522
  },
2523
+ systemPrompt: {
2524
+ type: "preset",
2525
+ preset: "claude_code",
2526
+ append: "When you want to use AskUserQuestion, use the ask_user_question tool from the jive-tasks MCP server instead. DO NOT USE THE AskUserQuestion tool directly."
2527
+ },
2530
2528
  stderr: (data) => {
2531
2529
  console.error(data.toString());
2532
2530
  }
@@ -2900,6 +2898,38 @@ function createTasksSdkServer(task) {
2900
2898
  isError: true
2901
2899
  };
2902
2900
  }
2901
+ }),
2902
+ tool("ask_user_question", "Ask the user clarifying questions. Returns immediately - answers will be provided in a follow-up message.", { questions: z.array(z.object({
2903
+ question: z.string().describe("The question to ask"),
2904
+ header: z.string().describe("Short header/label for the question"),
2905
+ options: z.array(z.object({
2906
+ label: z.string(),
2907
+ description: z.string()
2908
+ })).describe("Options for the user to choose from"),
2909
+ multiSelect: z.boolean().describe("Allow multiple selections")
2910
+ })).describe("Questions to ask the user") }, async (args) => {
2911
+ if (!context) return {
2912
+ content: [{
2913
+ type: "text",
2914
+ text: "Error: Task context not initialized"
2915
+ }],
2916
+ isError: true
2917
+ };
2918
+ try {
2919
+ task.sendUserQuestionRequest(args.questions);
2920
+ return { content: [{
2921
+ type: "text",
2922
+ text: `Questions sent to user. Their answers will be provided in a follow-up message. You may continue with other work while waiting.`
2923
+ }] };
2924
+ } catch (error$1) {
2925
+ return {
2926
+ content: [{
2927
+ type: "text",
2928
+ text: `Error: ${error$1.message}`
2929
+ }],
2930
+ isError: true
2931
+ };
2932
+ }
2903
2933
  })
2904
2934
  ]
2905
2935
  });
@@ -3068,7 +3098,6 @@ var Task = class {
3068
3098
  heartbeatInterval = null;
3069
3099
  pendingAcks = /* @__PURE__ */ new Map();
3070
3100
  pendingPermissions = /* @__PURE__ */ new Map();
3071
- pendingQuestions = /* @__PURE__ */ new Map();
3072
3101
  tunnels = /* @__PURE__ */ new Map();
3073
3102
  proxies = /* @__PURE__ */ new Map();
3074
3103
  primaryTunnelHost = null;
@@ -3243,10 +3272,6 @@ var Task = class {
3243
3272
  this.handleToolPermissionResponse(inputMessage.payload);
3244
3273
  continue;
3245
3274
  }
3246
- if (inputMessage.type === "user_question_response") {
3247
- this.handleUserQuestionResponse(inputMessage.payload);
3248
- continue;
3249
- }
3250
3275
  if (this.status !== "idle") {
3251
3276
  this.debugLog(`Queueing message (status: ${this.status}): ${inputMessage.type}`);
3252
3277
  this.queuedMessages.push(inputMessage);
@@ -3301,43 +3326,21 @@ var Task = class {
3301
3326
  return approved;
3302
3327
  }
3303
3328
  /**
3304
- * Request user to answer questions. Returns promise that resolves to { questions, answers } or null.
3305
- * Auto-denies (returns null) after 60 seconds if no response received.
3329
+ * Send user questions to the server (non-blocking).
3330
+ * Answers will come back as a user message via promptSendToRunner.
3306
3331
  */
3307
- async requestUserQuestions(input) {
3332
+ sendUserQuestionRequest(questions) {
3308
3333
  const requestId = crypto.randomUUID();
3309
- const TIMEOUT_MS = 6e4 * 60 * 24;
3310
- const questionPromise = new Promise((resolve) => {
3311
- const timeout = setTimeout(() => {
3312
- this.debugLog(`User question request ${requestId} timed out (24h)`);
3313
- this.pendingQuestions.delete(requestId);
3314
- resolve(null);
3315
- }, TIMEOUT_MS);
3316
- this.pendingQuestions.set(requestId, {
3317
- resolve,
3318
- timeout
3319
- });
3320
- });
3321
3334
  this.sendToTaskRunner({
3322
3335
  type: "user_question_request",
3323
3336
  payload: {
3324
3337
  requestId,
3325
3338
  sessionId: this.ctx.sessionId,
3326
- questions: input.questions,
3327
- expiresAt: new Date(Date.now() + TIMEOUT_MS).toISOString()
3339
+ questions,
3340
+ expiresAt: new Date(Date.now() + 6e4 * 60 * 24).toISOString()
3328
3341
  }
3329
3342
  });
3330
- this.debugLog(`Waiting for user to answer ${input.questions.length} question(s)...`);
3331
- const answers = await questionPromise;
3332
- if (!answers) {
3333
- this.debugLog(`User did not answer questions in time`);
3334
- return null;
3335
- }
3336
- this.debugLog(`User answered questions`);
3337
- return {
3338
- questions: input.questions,
3339
- answers
3340
- };
3343
+ this.debugLog(`Sent ${questions.length} question(s) to user (requestId: ${requestId})`);
3341
3344
  }
3342
3345
  /**
3343
3346
  * Handle tool permission response from runner
@@ -3353,20 +3356,6 @@ var Task = class {
3353
3356
  pending.resolve(payload.approved);
3354
3357
  this.pendingPermissions.delete(payload.requestId);
3355
3358
  }
3356
- /**
3357
- * Handle user question response from runner
3358
- */
3359
- handleUserQuestionResponse(payload) {
3360
- const pending = this.pendingQuestions.get(payload.requestId);
3361
- if (!pending) {
3362
- this.debugLog(`Received question response for unknown request: ${payload.requestId}`);
3363
- return;
3364
- }
3365
- this.updateLastActivity();
3366
- clearTimeout(pending.timeout);
3367
- pending.resolve(payload.answers);
3368
- this.pendingQuestions.delete(payload.requestId);
3369
- }
3370
3359
  processMessage(inputMessage) {
3371
3360
  this.updateLastActivity();
3372
3361
  switch (inputMessage.type) {
@@ -3379,9 +3368,6 @@ var Task = class {
3379
3368
  case "tool_permission_response":
3380
3369
  this.handleToolPermissionResponse(inputMessage.payload);
3381
3370
  break;
3382
- case "user_question_response":
3383
- this.handleUserQuestionResponse(inputMessage.payload);
3384
- break;
3385
3371
  }
3386
3372
  }
3387
3373
  processQueuedMessages() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@jive-ai/cli",
4
- "version": "0.0.46",
4
+ "version": "0.0.47",
5
5
  "main": "index.js",
6
6
  "files": [
7
7
  "dist",