@questionbase/deskfree 0.3.0-alpha.21 → 0.3.0-alpha.23

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,31 +15,30 @@ 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_suggest_tasks
19
- deskfree_create_activity
20
- deskfree_update_activity
21
- deskfree_classify_task
22
- deskfree_learn_from_task
23
- deskfree_update_deliverable
24
- │ deskfree_send_message (+ task suggestions) │
18
+ deskfree_send_message
19
+ deskfree_propose
20
+ deskfree_update_file
21
+ deskfree_create_file
22
+ deskfree_claim_evaluation
23
+ deskfree_submit_evaluation
25
24
  └──────────┬───────────────────────────┬───────────────────────────┘
26
25
  │ │
27
26
  ▼ ▼
28
27
  ┌──────────────────────────────────────────────────────────────────┐
29
28
  │ DeskFree Backend │
30
29
  │ │
31
- │ Tasks Activities Messages WebSocket Gateway│
32
- │ ────── ────────── ──────── ─────────────── │
33
- │ State machine Knowledge 1:1 bot↔user DynamoDB-backed │
34
- │ RLS-scoped containers Threaded by Thin notifs │
35
- │ Atomic claims Learn loop task + polling fallback│
30
+ │ Tasks Files Messages WebSocket Gateway│
31
+ │ ────── ───── ──────── ─────────────── │
32
+ │ State machine Persistent 1:1 bot↔user DynamoDB-backed │
33
+ │ RLS-scoped documents Threaded by Thin notifs │
34
+ │ Atomic claims Versioned task + polling fallback│
36
35
  └──────────────────────────────────────────────────────────────────┘
37
36
  ```
38
37
 
39
38
  The plugin registers three things with OpenClaw:
40
39
 
41
40
  1. **Channel** — bidirectional messaging between DeskFree users and the agent
42
- 2. **Tools** — 10 task, activity, and messaging tools the agent can call
41
+ 2. **Tools** — 9 task, file, and messaging tools the agent can call
43
42
  3. **Skill** — workflow knowledge that teaches the agent how to use the tools correctly
44
43
 
45
44
  ## Install
@@ -126,12 +125,33 @@ bot ──[start_task]──> bot (is_working) ──[complete_task(done)]──
126
125
  [approve] → done
127
126
  ```
128
127
 
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.
128
+ See `skills/deskfree/references/tools.md` for the full tool reference.
129
+
130
+ ### Message Flow
131
+
132
+ **Inbound (human → agent):** WebSocket sends thin notification (`hint: "message.new"`) → plugin fetches full message via HTTP. Fallback: polls every 30s if WebSocket is unavailable.
133
+
134
+ **Outbound (agent → human):** Supports streaming (progressive deltas via `streamChunk`, finalized via `updateMessage`) and non-streaming (direct `POST messages.send`). Text chunked at 2000 chars when streaming is not active.
135
+
136
+ ### WebSocket Gateway
137
+
138
+ 1. Request ticket: `POST messages.wsTicket` → one-time ticket (30s expiry)
139
+ 2. Connect: `wss://...?ticket=<ticket>`
140
+ 3. Keep alive: ping every 5 min (API Gateway idle timeout = 10 min)
141
+ 4. Reconnect: exponential backoff (2s → 30s) on disconnect
142
+ 5. Cursor persisted to `deskfree/{accountId}/cursor` for resume after restart
143
+
144
+ ### Plugin Registration
145
+
146
+ ```
147
+ register(api)
148
+ ├─ setDeskFreeRuntime(api.runtime) // runtime singleton
149
+ ├─ api.registerChannel(deskFreePlugin) // messaging channel
150
+ └─ api.registerTool(factory) // task management tools
151
+ ```
130
152
 
131
153
  ## Documentation
132
154
 
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
155
  - **[Publishing](PUBLISH.md)** — how to release new versions
136
156
 
137
157
  ## 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,14 +448,30 @@ 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;
463
+ skillContext?: Array<{
464
+ skillId: string;
465
+ name: string;
466
+ displayName: string;
467
+ instructions: string;
468
+ criticalSection: string;
469
+ }>;
444
470
  }
445
471
  interface CompleteTaskInput {
446
472
  taskId: string;
447
473
  outcome: 'done' | 'blocked';
474
+ summary?: string;
448
475
  }
449
476
  interface WorkspaceStateTask {
450
477
  taskId: string;
@@ -452,7 +479,8 @@ interface WorkspaceStateTask {
452
479
  status: 'bot' | 'human' | 'done';
453
480
  isWorking?: boolean;
454
481
  instructions?: string | null;
455
- deliverable?: string | null;
482
+ fileId?: string | null;
483
+ fileName?: string | null;
456
484
  createdAt: string;
457
485
  updatedAt: string;
458
486
  }
@@ -465,6 +493,14 @@ interface Initiative {
465
493
  taskCount: number;
466
494
  activeTaskCount: number;
467
495
  }
496
+ interface WorkspaceFile {
497
+ fileId: string;
498
+ name: string;
499
+ description: string;
500
+ contentFormat: string;
501
+ version: number;
502
+ updatedAt: string;
503
+ }
468
504
  interface WorkspaceState {
469
505
  tasks: WorkspaceStateTask[];
470
506
  recentlyDone: WorkspaceStateTask[];
@@ -476,6 +512,7 @@ interface WorkspaceState {
476
512
  initiativeId?: string | null;
477
513
  }>;
478
514
  initiatives: Initiative[];
515
+ files: WorkspaceFile[];
479
516
  }
480
517
  interface EvaluationTaskMessage {
481
518
  messageId: string;
@@ -537,13 +574,24 @@ declare class DeskFreeClient {
537
574
  content: string;
538
575
  }>;
539
576
  /**
540
- * Send a text message (with optional attachments or suggestions) to a DeskFree conversation.
577
+ * Send a streaming chunk (delta only) for an in-progress message.
578
+ * Broadcasts delta over WS and stores full content in DynamoDB for crash recovery.
579
+ */
580
+ streamChunk(input: {
581
+ messageId: string;
582
+ delta: string;
583
+ fullContent: string;
584
+ }): Promise<{
585
+ messageId: string;
586
+ }>;
587
+ /**
588
+ * Send a text message to a DeskFree conversation.
541
589
  *
542
- * @param input - Message content, optional userId, taskId, attachments, and suggestions
590
+ * @param input - Message content, optional userId, taskId, attachments
543
591
  */
544
592
  sendMessage(input: {
545
593
  userId?: string;
546
- content?: string;
594
+ content: string;
547
595
  taskId?: string;
548
596
  attachments?: Array<{
549
597
  s3Key: string;
@@ -551,10 +599,6 @@ declare class DeskFreeClient {
551
599
  contentType: string;
552
600
  size: number;
553
601
  }>;
554
- suggestions?: Array<{
555
- title: string;
556
- instructions?: string;
557
- }>;
558
602
  }): Promise<{
559
603
  messageId: string;
560
604
  content: string;
@@ -562,6 +606,7 @@ declare class DeskFreeClient {
562
606
  /** Fetch paginated message history for a conversation. */
563
607
  listMessages(input: {
564
608
  userId?: string;
609
+ taskId?: string;
565
610
  cursor?: string | null;
566
611
  limit?: number;
567
612
  }): Promise<MessagesResponse>;
@@ -570,13 +615,37 @@ declare class DeskFreeClient {
570
615
  /** Claim a task so the bot can begin working on it. Returns enriched context. */
571
616
  claimTask(input: {
572
617
  taskId: string;
618
+ runnerId?: string;
573
619
  }): Promise<TaskWithContext>;
574
- /** Update the deliverable (markdown or HTML content) for a task. */
575
- updateDeliverable(input: {
620
+ /** Fetch a lightweight task summary by ID. Read-only, no side effects. */
621
+ getTask(input: {
576
622
  taskId: string;
577
- deliverable: string;
578
- format?: 'markdown' | 'html';
623
+ }): Promise<TaskSummary>;
624
+ /** Update the content of an existing file. */
625
+ updateFile(input: {
626
+ fileId: string;
627
+ content: string;
628
+ contentFormat?: 'markdown' | 'html';
579
629
  }): Promise<void>;
630
+ /** Create a new persistent file. */
631
+ createFile(input: {
632
+ name: string;
633
+ description?: string;
634
+ content?: string;
635
+ contentFormat?: 'markdown' | 'html';
636
+ }): Promise<{
637
+ fileId: string;
638
+ name: string;
639
+ }>;
640
+ /** List all files for this bot (metadata only, no content). */
641
+ listFiles(): Promise<Array<{
642
+ fileId: string;
643
+ name: string;
644
+ description: string;
645
+ contentFormat: string;
646
+ version: number;
647
+ updatedAt: string;
648
+ }>>;
580
649
  /** Send an agent status update to DeskFree. */
581
650
  statusUpdate(input: {
582
651
  status: 'idle' | 'working' | 'responding';
@@ -623,35 +692,35 @@ declare class DeskFreeClient {
623
692
  completeTask(input: CompleteTaskInput): Promise<Task & {
624
693
  outcome: 'done' | 'blocked';
625
694
  }>;
626
- /** Suggest new tasks for the human to review and approve (via messages.send with suggestions). */
627
- suggestTasks(input: {
695
+ /** Reopen a completed/human task back to bot status for further work. */
696
+ reopenTask(input: {
697
+ taskId: string;
698
+ reason?: string;
699
+ }): Promise<Task>;
700
+ /** Propose a plan — creates a proposal message with plan metadata. No DB rows until human approves. */
701
+ proposePlan(input: {
628
702
  tasks: Array<{
629
- title: string;
630
- instructions?: string;
631
- }>;
632
- taskId?: string;
633
- }): Promise<{
634
- messageId: string;
635
- content: string;
636
- }>;
637
- /** Suggest tasks via the dedicated bot/tasks.suggest endpoint. */
638
- suggestTasksDedicated(input: {
639
- suggestions: Array<{
640
- title: string;
703
+ title?: string;
641
704
  instructions?: string;
705
+ substeps?: string[];
706
+ file?: {
707
+ type: 'existing';
708
+ existingId: string;
709
+ } | {
710
+ type: 'new';
711
+ name: string;
712
+ description?: string;
713
+ };
642
714
  estimatedTokens?: number;
643
- dependsOn?: string[];
644
- initiativeId?: string;
715
+ scheduledFor?: string;
645
716
  }>;
646
- parentTaskId?: string;
647
- initiativeSuggestions?: Array<{
717
+ initiative?: string | {
648
718
  title: string;
649
719
  content: string;
650
- taskRefs?: number[];
651
- }>;
720
+ };
721
+ context?: string;
652
722
  }): Promise<{
653
- suggestionIds: string[];
654
- initiativeSuggestionIds?: string[];
723
+ messageId: string;
655
724
  }>;
656
725
  /**
657
726
  * Claim a pending evaluation for a task. Atomically sets isWorking=true where
@@ -747,4 +816,4 @@ declare const plugin: {
747
816
  register(api: OpenClawPluginApi): void;
748
817
  };
749
818
 
750
- 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 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 TaskWithContext, type WizardPrompter, type WorkspaceState, type WorkspaceStateTask, type WsNotification, type WsTicketResponse, plugin as default, reportError };
819
+ 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 };