@questionbase/deskfree 0.3.0-alpha.40 → 0.3.0-alpha.41

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.d.ts CHANGED
@@ -699,6 +699,7 @@ declare class DeskFreeClient {
699
699
  tasks: Array<{
700
700
  title?: string;
701
701
  instructions?: string;
702
+ steps?: string[];
702
703
  substeps?: string[];
703
704
  file?: {
704
705
  type: 'existing';
package/dist/index.js CHANGED
@@ -4810,7 +4810,7 @@ async function deliverMessageToAgent(ctx, message, client) {
4810
4810
  From: message.humanId,
4811
4811
  To: message.humanId,
4812
4812
  MessageSid: message.messageId,
4813
- ThreadId: message.taskId ?? void 0,
4813
+ MessageThreadId: message.taskId ?? void 0,
4814
4814
  Timestamp: message.createdAt,
4815
4815
  AccountId: ctx.accountId,
4816
4816
  FromName: message.userName ?? "Unknown",
@@ -8163,6 +8163,9 @@ var ORCHESTRATOR_TOOLS = {
8163
8163
  name: "deskfree_send_message",
8164
8164
  description: "Send a message to the human. Keep it short \u2014 1-3 sentences. No walls of text.",
8165
8165
  parameters: Type.Object({
8166
+ type: Type.Union([Type.Literal("notify"), Type.Literal("ask")], {
8167
+ description: "notify = general update (quiet). ask = needs human attention (surfaces prominently)."
8168
+ }),
8166
8169
  content: Type.String({
8167
8170
  description: "Message content."
8168
8171
  }),
@@ -8323,11 +8326,6 @@ var SHARED_TOOLS = {
8323
8326
  description: "Updated global Ways of Working (full replacement). Keep surgical \u2014 only add or modify relevant sections, do not inflate with restated context."
8324
8327
  })
8325
8328
  ),
8326
- initiativeId: Type.Optional(
8327
- Type.String({
8328
- description: "Initiative ID to update"
8329
- })
8330
- ),
8331
8329
  initiativeContent: Type.Optional(
8332
8330
  Type.String({
8333
8331
  description: "Updated initiative content (full replacement). Keep surgical \u2014 evolve what exists, do not rewrite from scratch."
@@ -9001,16 +8999,17 @@ You do NOT claim tasks, complete tasks, or do work directly \u2014 you have no a
9001
8999
  - Initiative titles should reflect aspirations and outcomes, not activities. "AI Thought Leadership on LinkedIn" over "LinkedIn Content."
9002
9000
  - Initiative descriptions should be 2-3 sentences that make the human think "wow, this will enable my dreams." Reflect their ambition back to them. No headers, no phases, no formal structure. Aspirational, not operational.`;
9003
9001
  var DESKFREE_WORKER_DIRECTIVE = `## DeskFree Worker
9004
- You are a worker sub-agent. Call \`deskfree_start_task\` with your taskId to claim and load context.
9002
+ You are a worker sub-agent. If you have prior conversation history with task context, continue from where you left off. Otherwise, call \`deskfree_start_task\` with your taskId to claim and load context.
9005
9003
  Tools: deskfree_start_task, deskfree_update_steps, deskfree_update_file, deskfree_complete_task, deskfree_send_message, deskfree_propose.
9006
9004
 
9007
9005
  **After claiming a task, your first message should be how you plan to approach it.** Work one step at a time and share progress naturally \u2014 like updating a coworker.
9008
9006
 
9009
- - Claim your task first with deskfree_start_task \u2014 this loads steps, messages, and file context.
9007
+ - If continuing from a previous conversation (you can see prior tool calls and context), respond directly to the human's latest message \u2014 do NOT call deskfree_start_task again.
9008
+ - If starting fresh, claim your task first with deskfree_start_task \u2014 this loads steps, messages, and file context.
9010
9009
  - Use deskfree_update_steps to update step progress as you work. Send the full step list each time with updated statuses.
9011
9010
  - Save work to linked files with deskfree_update_file. Build up incrementally \u2014 start with structure/outline, then flesh out.
9012
9011
  - Use deskfree_send_message with type "notify" for progress updates. Keep it brief \u2014 1-3 sentences.
9013
- - Use deskfree_send_message with type "ask" when you need human input OR when work is ready for review. Terminate after sending an ask.
9012
+ - Use deskfree_send_message with type "ask" when you need human input OR when work is ready for review.
9014
9013
  - Only complete (deskfree_complete_task with humanApproved: true) after the human has confirmed in the thread. Never self-complete without human response.
9015
9014
  - When completing: pass "learnings" only for genuine new knowledge. Pass "followUps" as brief handoffs.
9016
9015
  - On 409 or 404 errors: STOP. Do not retry. Call deskfree_state to find available tasks.`;
@@ -9330,6 +9329,11 @@ function parseProposeTasks(raw) {
9330
9329
  if (typeof title !== "string" || title.trim() === "") {
9331
9330
  throw new Error(`tasks[${i}].title must be a non-empty string`);
9332
9331
  }
9332
+ let steps;
9333
+ if (Array.isArray(item["steps"]) && item["steps"].length > 0) {
9334
+ steps = item["steps"].filter((s2) => typeof s2 === "string" && s2.trim() !== "").map((s2) => s2.trim());
9335
+ if (steps.length === 0) steps = void 0;
9336
+ }
9333
9337
  let substeps;
9334
9338
  if (Array.isArray(item["substeps"]) && item["substeps"].length > 0) {
9335
9339
  substeps = item["substeps"].filter((s2) => typeof s2 === "string" && s2.trim() !== "").map((s2) => s2.trim());
@@ -9351,6 +9355,7 @@ function parseProposeTasks(raw) {
9351
9355
  return {
9352
9356
  title: title.trim(),
9353
9357
  instructions: typeof item["instructions"] === "string" ? item["instructions"] : void 0,
9358
+ steps,
9354
9359
  substeps,
9355
9360
  file,
9356
9361
  estimatedTokens: typeof item["estimatedTokens"] === "number" ? item["estimatedTokens"] : void 0,
@@ -9381,7 +9386,8 @@ function makeUpdateStepsHandler(client) {
9381
9386
  throw new Error("steps must be a non-empty array");
9382
9387
  }
9383
9388
  const steps = rawSteps.map((s) => {
9384
- if (typeof s !== "object" || s === null) throw new Error("Invalid step");
9389
+ if (typeof s !== "object" || s === null)
9390
+ throw new Error("Invalid step");
9385
9391
  const obj = s;
9386
9392
  const label = typeof obj["label"] === "string" ? obj["label"].trim() : "";
9387
9393
  const status = typeof obj["status"] === "string" ? obj["status"] : "pending";
@@ -9392,10 +9398,16 @@ function makeUpdateStepsHandler(client) {
9392
9398
  return { label, status };
9393
9399
  });
9394
9400
  await client.updateSteps({ taskId, steps });
9395
- const doneCount = steps.filter((s) => s.status === "done").length;
9401
+ const doneCount = steps.filter(
9402
+ (s) => s.status === "done"
9403
+ ).length;
9404
+ const allDone = doneCount === steps.length;
9396
9405
  return formatConfirmation(
9397
9406
  `Updated steps for task ${taskId} (${doneCount}/${steps.length} done)`,
9398
- ["Step progress saved \u2014 continue working"]
9407
+ allDone ? [
9408
+ "All steps complete \u2014 send an ask message for human review",
9409
+ 'Use deskfree_send_message with type "ask" to request review, then terminate and wait'
9410
+ ] : ["Step progress saved \u2014 continue working"]
9399
9411
  );
9400
9412
  } catch (err) {
9401
9413
  return errorResult(err);
@@ -9416,7 +9428,7 @@ function makeUpdateFileHandler(client) {
9416
9428
  await client.updateFile({ fileId, content, contentFormat });
9417
9429
  return formatConfirmation(`Updated file ${fileId}`, [
9418
9430
  "File content has been saved",
9419
- "Complete the task with deskfree_complete_task when ready"
9431
+ 'When work is ready for review, send an ask message with deskfree_send_message (type "ask") and terminate'
9420
9432
  ]);
9421
9433
  } catch (err) {
9422
9434
  return errorResult(err);
@@ -9521,6 +9533,7 @@ function makeProposeHandler(client) {
9521
9533
  tasks: tasks.map((t) => ({
9522
9534
  title: t.title,
9523
9535
  instructions: t.instructions,
9536
+ steps: t.steps,
9524
9537
  substeps: t.substeps,
9525
9538
  file: t.file,
9526
9539
  estimatedTokens: t.estimatedTokens,
@@ -9630,16 +9643,13 @@ ${s.criticalSection}`
9630
9643
  const taskJson = JSON.stringify(
9631
9644
  {
9632
9645
  summary: `Claimed task "${result.title}" \u2014 full context loaded${result.skillContext?.length ? ` (${result.skillContext.length} skill${result.skillContext.length > 1 ? "s" : ""} loaded \u2014 use deskfree_read_skill_section for full details)` : ""}`,
9633
- mode: trimmedTask.mode ?? "work",
9634
9646
  nextActions: [
9635
9647
  "Read the instructions and message history carefully",
9636
9648
  ...result.fileContext ? [
9637
9649
  `Task has a linked file "${result.fileContext.name}" (ID: ${result.fileContext.fileId}) \u2014 use deskfree_update_file to save your work to it`
9638
9650
  ] : [],
9639
- ...trimmedTask.mode === "evaluation" ? [
9640
- "This is an evaluation task \u2014 review the WoW context and provide your evaluation in deskfree_complete_task"
9641
- ] : [],
9642
- "Complete with deskfree_complete_task when done (summary required)"
9651
+ 'When work is done, send an ask message (deskfree_send_message type "ask") for human review, then terminate',
9652
+ "Only call deskfree_complete_task after the human has responded in the thread"
9643
9653
  ],
9644
9654
  task: trimmedTask
9645
9655
  },