@questionbase/deskfree 0.3.0-alpha.20 → 0.3.0-alpha.22

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/README.md CHANGED
@@ -15,7 +15,7 @@ Agents can pick up tasks, post progress updates, mark work as done or blocked, m
15
15
  │ deskfree_state Inbound messages from humans │
16
16
  │ deskfree_start_task Outbound replies from agent │
17
17
  │ deskfree_complete_task Real-time notifications │
18
- deskfree_create_task
18
+ deskfree_suggest_tasks
19
19
  │ deskfree_create_activity │
20
20
  │ deskfree_update_activity │
21
21
  │ deskfree_classify_task │
@@ -126,12 +126,33 @@ bot ──[start_task]──> bot (is_working) ──[complete_task(done)]──
126
126
  [approve] → done
127
127
  ```
128
128
 
129
- See [docs/tools.md](docs/tools.md) for the full tool reference and [docs/architecture.md](docs/architecture.md) for how the system works under the hood.
129
+ See `skills/deskfree/references/tools.md` for the full tool reference.
130
+
131
+ ### Message Flow
132
+
133
+ **Inbound (human → agent):** WebSocket sends thin notification (`hint: "message.new"`) → plugin fetches full message via HTTP. Fallback: polls every 30s if WebSocket is unavailable.
134
+
135
+ **Outbound (agent → human):** Messages chunked at 2000 chars → `POST messages.send` per chunk.
136
+
137
+ ### WebSocket Gateway
138
+
139
+ 1. Request ticket: `POST messages.wsTicket` → one-time ticket (30s expiry)
140
+ 2. Connect: `wss://...?ticket=<ticket>`
141
+ 3. Keep alive: ping every 5 min (API Gateway idle timeout = 10 min)
142
+ 4. Reconnect: exponential backoff (2s → 30s) on disconnect
143
+ 5. Cursor persisted to `deskfree/{accountId}/cursor` for resume after restart
144
+
145
+ ### Plugin Registration
146
+
147
+ ```
148
+ register(api)
149
+ ├─ setDeskFreeRuntime(api.runtime) // runtime singleton
150
+ ├─ api.registerChannel(deskFreePlugin) // messaging channel
151
+ └─ api.registerTool(factory) // task management tools
152
+ ```
130
153
 
131
154
  ## Documentation
132
155
 
133
- - **[Architecture](docs/architecture.md)** — system design, message flow, WebSocket gateway
134
- - **[Tools reference](docs/tools.md)** — all 8 agent tools with parameters and behavior
135
156
  - **[Publishing](PUBLISH.md)** — how to release new versions
136
157
 
137
158
  ## License
package/dist/index.d.ts CHANGED
@@ -426,8 +426,19 @@ interface Task {
426
426
  botId?: string | null;
427
427
  createdById: string;
428
428
  reason?: string | null;
429
- deliverable?: string | null;
430
- deliverableFormat?: 'markdown' | 'html' | null;
429
+ fileId?: string | null;
430
+ fileName?: string | null;
431
+ }
432
+ interface TaskSummary {
433
+ taskId: string;
434
+ title: string;
435
+ status: 'bot' | 'human' | 'done';
436
+ instructions: string | null;
437
+ isWorking: boolean;
438
+ fileId: string | null;
439
+ fileName: string | null;
440
+ createdAt: string;
441
+ updatedAt: string;
431
442
  }
432
443
  interface TaskMessage {
433
444
  messageId: string;
@@ -437,21 +448,23 @@ interface TaskMessage {
437
448
  createdAt: string;
438
449
  userName?: string | null;
439
450
  }
451
+ interface FileContext {
452
+ fileId: string;
453
+ name: string;
454
+ description: string;
455
+ content: string;
456
+ contentFormat: string;
457
+ version: number;
458
+ }
440
459
  interface TaskWithContext extends Task {
441
460
  instructions: string;
442
- deliverable: string;
443
461
  messages: TaskMessage[];
462
+ fileContext: FileContext | null;
444
463
  }
445
- /**
446
- * Response from the tasks.create bot endpoint.
447
- *
448
- * The backend mutation (`trpc.bot.tasks.create`) returns the Task object
449
- * directly (not wrapped in `{ task: ... }`).
450
- */
451
- type CreateTaskResponse = Task;
452
464
  interface CompleteTaskInput {
453
465
  taskId: string;
454
466
  outcome: 'done' | 'blocked';
467
+ summary?: string;
455
468
  }
456
469
  interface WorkspaceStateTask {
457
470
  taskId: string;
@@ -459,10 +472,28 @@ interface WorkspaceStateTask {
459
472
  status: 'bot' | 'human' | 'done';
460
473
  isWorking?: boolean;
461
474
  instructions?: string | null;
462
- deliverable?: string | null;
475
+ fileId?: string | null;
476
+ fileName?: string | null;
463
477
  createdAt: string;
464
478
  updatedAt: string;
465
479
  }
480
+ interface Initiative {
481
+ id: string;
482
+ title: string;
483
+ status: 'suggested' | 'active' | 'paused';
484
+ content: string;
485
+ contentVersion: number;
486
+ taskCount: number;
487
+ activeTaskCount: number;
488
+ }
489
+ interface WorkspaceFile {
490
+ fileId: string;
491
+ name: string;
492
+ description: string;
493
+ contentFormat: string;
494
+ version: number;
495
+ updatedAt: string;
496
+ }
466
497
  interface WorkspaceState {
467
498
  tasks: WorkspaceStateTask[];
468
499
  recentlyDone: WorkspaceStateTask[];
@@ -471,7 +502,10 @@ interface WorkspaceState {
471
502
  taskId: string;
472
503
  taskNumber: number;
473
504
  title: string;
505
+ initiativeId?: string | null;
474
506
  }>;
507
+ initiatives: Initiative[];
508
+ files: WorkspaceFile[];
475
509
  }
476
510
  interface EvaluationTaskMessage {
477
511
  messageId: string;
@@ -487,6 +521,11 @@ interface ClaimEvaluationResponse {
487
521
  waysOfWorking: string | null;
488
522
  currentVersion: number;
489
523
  messages: EvaluationTaskMessage[];
524
+ initiative?: {
525
+ id: string;
526
+ title: string;
527
+ content: string;
528
+ } | null;
490
529
  }
491
530
 
492
531
  /** Enhanced error class for DeskFree API errors with user-friendly messages */
@@ -528,13 +567,13 @@ declare class DeskFreeClient {
528
567
  content: string;
529
568
  }>;
530
569
  /**
531
- * Send a text message (with optional attachments or suggestions) to a DeskFree conversation.
570
+ * Send a text message to a DeskFree conversation.
532
571
  *
533
- * @param input - Message content, optional userId, taskId, attachments, and suggestions
572
+ * @param input - Message content, optional userId, taskId, attachments
534
573
  */
535
574
  sendMessage(input: {
536
575
  userId?: string;
537
- content?: string;
576
+ content: string;
538
577
  taskId?: string;
539
578
  attachments?: Array<{
540
579
  s3Key: string;
@@ -542,10 +581,6 @@ declare class DeskFreeClient {
542
581
  contentType: string;
543
582
  size: number;
544
583
  }>;
545
- suggestions?: Array<{
546
- title: string;
547
- instructions?: string;
548
- }>;
549
584
  }): Promise<{
550
585
  messageId: string;
551
586
  content: string;
@@ -558,29 +593,39 @@ declare class DeskFreeClient {
558
593
  }): Promise<MessagesResponse>;
559
594
  /** Obtain a one-time WebSocket authentication ticket for real-time notifications. */
560
595
  getWsTicket(): Promise<WsTicketResponse>;
561
- /** Create a new task, optionally with a recurring schedule. */
562
- createTask(input: {
563
- title: string;
564
- instructions?: string;
565
- isRecurring?: boolean;
566
- recurringSchedule?: {
567
- frequency: 'daily' | 'weekly' | 'biweekly' | 'monthly';
568
- dayOfWeek?: number;
569
- dayOfMonth?: number;
570
- time: string;
571
- timezone?: string;
572
- };
573
- }): Promise<CreateTaskResponse>;
574
596
  /** Claim a task so the bot can begin working on it. Returns enriched context. */
575
597
  claimTask(input: {
576
598
  taskId: string;
577
599
  }): Promise<TaskWithContext>;
578
- /** Update the deliverable (markdown or HTML content) for a task. */
579
- updateDeliverable(input: {
600
+ /** Fetch a lightweight task summary by ID. Read-only, no side effects. */
601
+ getTask(input: {
580
602
  taskId: string;
581
- deliverable: string;
582
- format?: 'markdown' | 'html';
603
+ }): Promise<TaskSummary>;
604
+ /** Update the content of an existing file. */
605
+ updateFile(input: {
606
+ fileId: string;
607
+ content: string;
608
+ contentFormat?: 'markdown' | 'html';
583
609
  }): Promise<void>;
610
+ /** Create a new persistent file. */
611
+ createFile(input: {
612
+ name: string;
613
+ description?: string;
614
+ content?: string;
615
+ contentFormat?: 'markdown' | 'html';
616
+ }): Promise<{
617
+ fileId: string;
618
+ name: string;
619
+ }>;
620
+ /** List all files for this bot (metadata only, no content). */
621
+ listFiles(): Promise<Array<{
622
+ fileId: string;
623
+ name: string;
624
+ description: string;
625
+ contentFormat: string;
626
+ version: number;
627
+ updatedAt: string;
628
+ }>>;
584
629
  /** Send an agent status update to DeskFree. */
585
630
  statusUpdate(input: {
586
631
  status: 'idle' | 'working' | 'responding';
@@ -627,16 +672,24 @@ declare class DeskFreeClient {
627
672
  completeTask(input: CompleteTaskInput): Promise<Task & {
628
673
  outcome: 'done' | 'blocked';
629
674
  }>;
630
- /** Suggest new tasks for the human to review and approve (via messages.send with suggestions). */
631
- suggestTasks(input: {
632
- tasks: Array<{
675
+ /** Suggest tasks via the dedicated bot/tasks.suggest endpoint. */
676
+ suggestTasksDedicated(input: {
677
+ suggestions: Array<{
633
678
  title: string;
634
679
  instructions?: string;
680
+ estimatedTokens?: number;
681
+ initiativeId?: string;
682
+ scheduledFor?: string;
683
+ }>;
684
+ parentTaskId?: string;
685
+ initiativeSuggestions?: Array<{
686
+ title: string;
687
+ content: string;
688
+ taskRefs?: number[];
635
689
  }>;
636
- taskId?: string;
637
690
  }): Promise<{
638
- messageId: string;
639
- content: string;
691
+ suggestionIds: string[];
692
+ initiativeSuggestionIds?: string[];
640
693
  }>;
641
694
  /**
642
695
  * Claim a pending evaluation for a task. Atomically sets isWorking=true where
@@ -647,17 +700,24 @@ declare class DeskFreeClient {
647
700
  }): Promise<ClaimEvaluationResponse | null>;
648
701
  /**
649
702
  * Submit the result of a ways-of-working evaluation.
650
- * If hasChanges is true and updatedContent is provided, inserts a new version.
703
+ * Dual output: globalWoW (applies everywhere) and initiative (applies to the task's initiative).
651
704
  * Clears evaluationPending and isWorking on the task.
652
705
  */
653
706
  submitEvaluation(input: {
654
707
  taskId: string;
655
- updatedContent?: string;
656
708
  reasoning: string;
657
- hasChanges: boolean;
709
+ globalWoW: {
710
+ hasChanges: boolean;
711
+ updatedContent?: string;
712
+ };
713
+ initiative: {
714
+ hasChanges: boolean;
715
+ updatedContent?: string;
716
+ };
658
717
  }): Promise<{
659
718
  success: boolean;
660
- version?: number;
719
+ globalVersion?: number;
720
+ initiativeVersion?: number;
661
721
  }>;
662
722
  /**
663
723
  * Lightweight health check that verifies connectivity and authentication.
@@ -725,4 +785,4 @@ declare const plugin: {
725
785
  register(api: OpenClawPluginApi): void;
726
786
  };
727
787
 
728
- export { type AnyAgentTool, type ChannelAccountSnapshot, type ChannelCapabilities, type ChannelConfigAdapter, type ChannelGatewayAdapter, type ChannelGatewayContext, type ChannelLogoutContext, type ChannelLogoutResult, type ChannelMessagingAdapter, type ChannelMessagingTargetResolver, type ChannelMeta, type ChannelOnboardingAdapter, type ChannelOnboardingResult, type ChannelOnboardingStatus, type ChannelOutboundAdapter, type ChannelOutboundContext, type ChannelPlugin, type ChannelProbeResult, type ChannelSecurityAdapter, type ChannelSecurityDmPolicy, type ChannelSetupAdapter, type ChannelStatusAdapter, type ChannelStatusIssue, type ChatMessage, type ChatMessageAttachment, type ClaimEvaluationResponse, type CompleteTaskInput, type CreateTaskResponse, type DeskFreeChannelConfig, DeskFreeClient, DeskFreeError, type EvaluationTaskMessage, type FinalizedMsgContext, type MessagesResponse, OfflineQueue, type OpenClawConfig, type OpenClawPluginApi, type OpenClawPluginToolContext, type OpenClawPluginToolFactory, type OpenClawPluginToolOptions, type OutboundDeliveryResult, type PluginHookAgentContext, type PluginHookBeforeAgentStartEvent, type PluginHookBeforeAgentStartResult, type PluginHookHandlerMap, type PluginHookName, type PluginLogger, type PluginRuntime, type ReplyDispatcher, type ResolvedDeskFreeAccount, type Task, type TaskMessage, type TaskWithContext, type WizardPrompter, type WorkspaceState, type WorkspaceStateTask, type WsNotification, type WsTicketResponse, plugin as default, reportError };
788
+ export { type AnyAgentTool, type ChannelAccountSnapshot, type ChannelCapabilities, type ChannelConfigAdapter, type ChannelGatewayAdapter, type ChannelGatewayContext, type ChannelLogoutContext, type ChannelLogoutResult, type ChannelMessagingAdapter, type ChannelMessagingTargetResolver, type ChannelMeta, type ChannelOnboardingAdapter, type ChannelOnboardingResult, type ChannelOnboardingStatus, type ChannelOutboundAdapter, type ChannelOutboundContext, type ChannelPlugin, type ChannelProbeResult, type ChannelSecurityAdapter, type ChannelSecurityDmPolicy, type ChannelSetupAdapter, type ChannelStatusAdapter, type ChannelStatusIssue, type ChatMessage, type ChatMessageAttachment, type ClaimEvaluationResponse, type CompleteTaskInput, type DeskFreeChannelConfig, DeskFreeClient, DeskFreeError, type EvaluationTaskMessage, type FileContext, type FinalizedMsgContext, type Initiative, type MessagesResponse, OfflineQueue, type OpenClawConfig, type OpenClawPluginApi, type OpenClawPluginToolContext, type OpenClawPluginToolFactory, type OpenClawPluginToolOptions, type OutboundDeliveryResult, type PluginHookAgentContext, type PluginHookBeforeAgentStartEvent, type PluginHookBeforeAgentStartResult, type PluginHookHandlerMap, type PluginHookName, type PluginLogger, type PluginRuntime, type ReplyDispatcher, type ResolvedDeskFreeAccount, type Task, type TaskMessage, type TaskSummary, type TaskWithContext, type WizardPrompter, type WorkspaceFile, type WorkspaceState, type WorkspaceStateTask, type WsNotification, type WsTicketResponse, plugin as default, reportError };