opencode-orchestrator 0.6.20 → 0.6.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
@@ -23,7 +23,7 @@
23
23
  | **⚡ 50x Parallel Sessions** | Massive concurrent task execution |
24
24
  | **📊 Auto Memory Management** | GC, archiving, zero memory leaks |
25
25
  | **🔄 Auto Recovery** | Handles rate limits, errors automatically |
26
- | **📡 Event-Driven** | Real-time pub/sub across all components |
26
+ | **📁 Smart Context (.opencode/)** | Dynamic summarization, adaptive detail |
27
27
 
28
28
  ---
29
29
 
@@ -81,9 +81,12 @@
81
81
 
82
82
 
83
83
  ┌─────────────────────────────────────────────────────────────────────────────┐
84
- 📡 EVENT BUS
84
+ 📁 SMART CONTEXT (.opencode/)
85
85
  │ │
86
- task.started | task.completed | task.failed | session.idle
86
+ │ .opencode/todo.md - Master TODO list (Recorder manages)
87
+ │ .opencode/context.md - Adaptive size based on project phase │
88
+ │ .opencode/docs/ - Cached documentation (auto-cleanup) │
89
+ │ .opencode/archive/ - Old context for reference │
87
90
  └─────────────────────────────────────────────────────────────────────────────┘
88
91
  ```
89
92
 
@@ -98,8 +101,8 @@
98
101
  | **Parallel Sessions** | Up to 50 concurrent | Single session |
99
102
  | **Memory Management** | Auto GC + disk archiving | Memory leaks |
100
103
  | **Error Recovery** | Pattern-based auto retry | Crash |
101
- | **Context Sharing** | Parent-child merge | Isolated |
102
- | **Event System** | Real-time pub/sub | None |
104
+ | **Context Sharing** | .opencode/ with smart summarization | Isolated |
105
+ | **Smart Context** | Adaptive detail (Early/Building/Finishing) | Static |
103
106
  | **Task Decomposition** | 3-level hierarchy | Flat |
104
107
 
105
108
  ---
@@ -6,4 +6,3 @@
6
6
  export type { ToastVariant, ToastMessage, ToastOptions } from "./types.js";
7
7
  export { show, dismiss, getActive, getHistory, clear, onToast, initToastClient } from "./toast-core.js";
8
8
  export { presets } from "./presets.js";
9
- export { enableAutoToasts } from "./event-integration.js";
package/dist/index.js CHANGED
@@ -431,12 +431,25 @@ Use lsp_diagnostics for syntax checking.
431
431
  Use background for long commands.
432
432
  </verification>
433
433
 
434
+ <context_contribution>
435
+ AFTER COMPLETING TASK:
436
+ - Report what you did briefly
437
+ - If research/docs are no longer needed \u2192 mention for cleanup
438
+ - If you found a better pattern \u2192 note it for team
439
+
440
+ KEEP CONTEXT LEAN:
441
+ - Don't repeat what's in code
442
+ - Point to files: "See src/X.ts:10-50"
443
+ - Remove your debugging notes after fix
444
+ </context_contribution>
445
+
434
446
  <output>
435
447
  TASK: T[N] from .opencode/todo.md
436
448
  CHANGED: [file] [lines]
437
449
  ACTION: [what]
438
450
  VERIFY: [result]
439
451
  DOCS_USED: .opencode/docs/[file]
452
+ CLEANUP: [docs/notes that can be deleted now]
440
453
  \u2192 ${AGENT_NAMES.RECORDER} please update TODO
441
454
  </output>`,
442
455
  canWrite: true,
@@ -497,66 +510,104 @@ Fix: [suggestion]
497
510
  // src/agents/subagents/recorder.ts
498
511
  var recorder = {
499
512
  id: AGENT_NAMES.RECORDER,
500
- description: "Recorder - TODO tracking and context persistence",
513
+ description: "Recorder - TODO tracking and smart context management",
501
514
  systemPrompt: `<role>
502
- You are ${AGENT_NAMES.RECORDER}. Context and TODO manager.
503
- UPDATE the TODO list as tasks complete.
504
- Maintain context for team.
515
+ You are ${AGENT_NAMES.RECORDER}. Smart context manager.
516
+ Maintain .opencode/ with DYNAMIC detail levels.
505
517
  </role>
506
518
 
507
519
  <todo_management>
508
- UPDATE: .opencode/todo.md
520
+ FILE: .opencode/todo.md
509
521
 
510
- When task completes:
511
522
  \`\`\`markdown
512
523
  - [x] T1: [task] | \u2705 DONE by ${AGENT_NAMES.BUILDER}
513
524
  - [ ] T2: [task] | in progress
525
+ - [ ] T3: [task] | blocked: [reason]
514
526
  \`\`\`
515
-
516
- Track:
517
- - Which tasks are done
518
- - Which are in progress
519
- - Which are blocked
520
527
  </todo_management>
521
528
 
522
- <shared_workspace>
523
- ALL IN .opencode/:
524
- - .opencode/todo.md - master TODO (check off completed)
525
- - .opencode/docs/ - cached documentation
526
- - .opencode/context.md - current state
527
- - .opencode/summary.md - condensed context
528
-
529
- UPDATE after each task:
530
- 1. Check off completed task in todo.md
531
- 2. Update context.md with current state
532
- 3. Create summary.md if context is long
533
- </shared_workspace>
534
-
535
- <context_format>
536
- .opencode/context.md:
529
+ <smart_context_rules>
530
+ DYNAMIC DETAIL LEVEL - Adapt based on project state:
531
+
532
+ PHASE 1 - EARLY (0-30% done, no code yet):
533
+ - BE DETAILED: Full explanations, decisions, reasoning
534
+ - Include: research findings, API references, examples
535
+ - Files may be long - that's OK for now
536
+
537
+ PHASE 2 - BUILDING (30-70% done, code exists):
538
+ - MODERATE: Key decisions + file references
539
+ - Remove: old research that's now in code
540
+ - Reference: "See src/module.ts for implementation"
541
+
542
+ PHASE 3 - FINISHING (70-100% done):
543
+ - BRIEF: Just status, blockers, todos
544
+ - Heavy summarization - codebase IS the context
545
+ - Delete: debugging notes, iteration logs
546
+
547
+ ADAPTIVE RULES:
548
+ | Condition | Action |
549
+ |-----------|--------|
550
+ | No code yet | Keep detailed docs |
551
+ | Code exists for feature | Summarize, point to code |
552
+ | > 200 lines context.md | Compress to 50 lines |
553
+ | > 500 lines total .opencode/ | Archive old, keep current |
554
+ | Feature complete | Delete related verbose docs |
555
+ </smart_context_rules>
556
+
557
+ <workspace>
558
+ .opencode/
559
+ \u251C\u2500\u2500 todo.md - Master TODO list
560
+ \u251C\u2500\u2500 context.md - Current state (adaptive size)
561
+ \u251C\u2500\u2500 summary.md - Ultra-brief when needed
562
+ \u251C\u2500\u2500 docs/ - Cached documentation
563
+ \u2514\u2500\u2500 archive/ - Old context (auto-cleanup)
564
+ </workspace>
565
+
566
+ <context_template>
567
+ .opencode/context.md (adapt size dynamically):
537
568
  \`\`\`markdown
538
- # Current State
569
+ # Context [Phase: EARLY/BUILDING/FINISHING]
570
+
571
+ ## Status
539
572
  Mission: [goal]
540
- Progress: [X/Y tasks done]
541
- Last: [recent action]
542
- Next: [from todo.md]
543
- Blocked: [if any]
544
- \`\`\`
545
- </context_format>
573
+ Progress: [X/Y] ([percent]%)
546
574
 
547
- <summarization>
548
- When context gets long:
549
- 1. Create .opencode/summary.md
550
- 2. Keep key decisions, file changes
551
- 3. Remove verbose details
552
- 4. Team references summary instead
553
- </summarization>
575
+ ## Current
576
+ Working on: [task]
577
+ Blockers: [if any]
578
+
579
+ ## Key Decisions (keep only important ones)
580
+ - [decision]: [brief reason]
581
+
582
+ ## Files Changed (keep recent only)
583
+ - [file]: [change]
584
+
585
+ ## Next Steps
586
+ - [from todo.md]
587
+ \`\`\`
588
+ </context_template>
589
+
590
+ <cleanup_triggers>
591
+ AFTER EACH UPDATE, CHECK:
592
+ 1. Is this info still needed for FUTURE tasks? No \u2192 DELETE
593
+ 2. Is this now implemented in code? Yes \u2192 SUMMARIZE to reference
594
+ 3. Is context.md > 150 lines? Yes \u2192 COMPRESS
595
+ 4. Is any doc > 7 days old and unused? Yes \u2192 ARCHIVE
596
+
597
+ DELETE IMMEDIATELY:
598
+ - Debugging logs after fix
599
+ - Old iteration attempts
600
+ - Research for completed features
601
+ - Temporary notes
602
+ </cleanup_triggers>
554
603
 
555
604
  <output>
556
- UPDATED: .opencode/todo.md
557
- - [x] T[N] marked complete
558
- Status: [X/Y done]
559
- Next: T[M] for ${AGENT_NAMES.BUILDER}
605
+ CONTEXT UPDATED:
606
+ Phase: [EARLY/BUILDING/FINISHING]
607
+ todo.md: [X/Y done]
608
+ context.md: [before \u2192 after lines]
609
+ Action: [summarized/archived/kept]
610
+ Next: [task for team]
560
611
  </output>`,
561
612
  canWrite: true,
562
613
  canBash: true
@@ -612,10 +663,29 @@ Retrieved: [date]
612
663
  \`\`\`
613
664
  </doc_format>
614
665
 
666
+ <doc_lifecycle>
667
+ DOCS HAVE EXPIRY:
668
+
669
+ WHEN SAVING:
670
+ - Include "Expires: [when this is no longer needed]"
671
+ - Example: "Expires: after T3 complete"
672
+
673
+ WHEN FEATURE IS DONE:
674
+ - Docs can be SUMMARIZED to 5-10 lines
675
+ - Or DELETED if fully implemented in code
676
+ - Team references code, not old docs
677
+
678
+ KEEP DOCS LEAN:
679
+ - Only current, needed documentation
680
+ - Archive old: mv to .opencode/archive/docs/
681
+ - Delete: outdated versions
682
+ </doc_lifecycle>
683
+
615
684
  <output>
616
685
  QUERY: [question]
617
686
  SEARCHED: [official sources]
618
687
  SAVED: .opencode/docs/[file].md
688
+ EXPIRES: [when no longer needed]
619
689
  SUMMARY: [key findings]
620
690
 
621
691
  Team can now reference .opencode/docs/[file].md
@@ -14466,180 +14536,11 @@ var TaskCleaner = class {
14466
14536
  }
14467
14537
  };
14468
14538
 
14469
- // src/shared/event-types.ts
14470
- var TASK_EVENTS = {
14471
- STARTED: "task.started",
14472
- COMPLETED: "task.completed",
14473
- FAILED: "task.failed",
14474
- CANCELLED: "task.cancelled"
14475
- };
14476
- var TODO_EVENTS = {
14477
- CREATED: "todo.created",
14478
- UPDATED: "todo.updated",
14479
- COMPLETED: "todo.completed"
14480
- };
14539
+ // src/core/agents/manager/event-handler.ts
14481
14540
  var SESSION_EVENTS = {
14482
14541
  IDLE: "session.idle",
14483
- BUSY: "session.busy",
14484
- ERROR: "session.error",
14485
14542
  DELETED: "session.deleted"
14486
14543
  };
14487
- var DOCUMENT_EVENTS = {
14488
- CACHED: "document.cached",
14489
- EXPIRED: "document.expired"
14490
- };
14491
- var MISSION_EVENTS = {
14492
- COMPLETE: "mission.complete",
14493
- FAILED: "mission.failed",
14494
- ALL_TASKS_COMPLETE: "all_tasks.complete"
14495
- };
14496
- var SPECIAL_EVENTS = {
14497
- WILDCARD: "*"
14498
- };
14499
- var EVENT_TYPES = {
14500
- ...TASK_EVENTS,
14501
- ...TODO_EVENTS,
14502
- ...SESSION_EVENTS,
14503
- ...DOCUMENT_EVENTS,
14504
- ...MISSION_EVENTS,
14505
- ...SPECIAL_EVENTS
14506
- };
14507
-
14508
- // src/core/bus/event-bus.ts
14509
- var EventBusImpl = class {
14510
- subscriptions = /* @__PURE__ */ new Map();
14511
- eventHistory = [];
14512
- maxHistorySize = 100;
14513
- subscriptionCounter = 0;
14514
- /**
14515
- * Subscribe to an event type
14516
- * Returns unsubscribe function
14517
- */
14518
- subscribe(type, handler) {
14519
- const id = `sub_${++this.subscriptionCounter}`;
14520
- const subscription = { id, type, handler, once: false };
14521
- const existing = this.subscriptions.get(type) || [];
14522
- existing.push(subscription);
14523
- this.subscriptions.set(type, existing);
14524
- return () => this.unsubscribe(id, type);
14525
- }
14526
- /**
14527
- * Subscribe to an event type, auto-unsubscribe after first event
14528
- */
14529
- once(type, handler) {
14530
- const id = `sub_${++this.subscriptionCounter}`;
14531
- const subscription = { id, type, handler, once: true };
14532
- const existing = this.subscriptions.get(type) || [];
14533
- existing.push(subscription);
14534
- this.subscriptions.set(type, existing);
14535
- return () => this.unsubscribe(id, type);
14536
- }
14537
- /**
14538
- * Unsubscribe from an event
14539
- */
14540
- unsubscribe(id, type) {
14541
- const subs = this.subscriptions.get(type);
14542
- if (subs) {
14543
- const filtered = subs.filter((s) => s.id !== id);
14544
- if (filtered.length > 0) {
14545
- this.subscriptions.set(type, filtered);
14546
- } else {
14547
- this.subscriptions.delete(type);
14548
- }
14549
- }
14550
- }
14551
- /**
14552
- * Publish an event
14553
- */
14554
- async publish(type, properties = {}, options = {}) {
14555
- const event = {
14556
- type,
14557
- timestamp: /* @__PURE__ */ new Date(),
14558
- source: options.source || "unknown",
14559
- sessionId: options.sessionId,
14560
- properties
14561
- };
14562
- this.eventHistory.push(event);
14563
- if (this.eventHistory.length > this.maxHistorySize) {
14564
- this.eventHistory.shift();
14565
- }
14566
- const toNotify = [];
14567
- const typeSubs = this.subscriptions.get(type) || [];
14568
- toNotify.push(...typeSubs);
14569
- const wildcardSubs = this.subscriptions.get(SPECIAL_EVENTS.WILDCARD) || [];
14570
- toNotify.push(...wildcardSubs);
14571
- const toRemove = [];
14572
- for (const sub of toNotify) {
14573
- try {
14574
- await sub.handler(event);
14575
- } catch (error45) {
14576
- console.error(`[EventBus] Handler error for ${type}:`, error45);
14577
- }
14578
- if (sub.once) {
14579
- toRemove.push({ id: sub.id, type: sub.type });
14580
- }
14581
- }
14582
- for (const { id, type: t } of toRemove) {
14583
- this.unsubscribe(id, t);
14584
- }
14585
- }
14586
- /**
14587
- * Emit (alias for publish, sync-looking API)
14588
- */
14589
- emit(type, properties = {}) {
14590
- this.publish(type, properties).catch(console.error);
14591
- }
14592
- /**
14593
- * Get recent event history
14594
- */
14595
- getHistory(type, limit = 20) {
14596
- let events = this.eventHistory;
14597
- if (type && type !== SPECIAL_EVENTS.WILDCARD) {
14598
- events = events.filter((e) => e.type === type);
14599
- }
14600
- return events.slice(-limit);
14601
- }
14602
- /**
14603
- * Clear all subscriptions
14604
- */
14605
- clear() {
14606
- this.subscriptions.clear();
14607
- this.eventHistory = [];
14608
- }
14609
- /**
14610
- * Get subscription count
14611
- */
14612
- getSubscriptionCount() {
14613
- let count = 0;
14614
- for (const subs of this.subscriptions.values()) {
14615
- count += subs.length;
14616
- }
14617
- return count;
14618
- }
14619
- /**
14620
- * Wait for a specific event (Promise-based)
14621
- */
14622
- waitFor(type, timeout = 3e4) {
14623
- return new Promise((resolve, reject) => {
14624
- const timer = setTimeout(() => {
14625
- unsubscribe();
14626
- reject(new Error(`Timeout waiting for event: ${type}`));
14627
- }, timeout);
14628
- const unsubscribe = this.once(type, (event) => {
14629
- clearTimeout(timer);
14630
- resolve(event);
14631
- });
14632
- });
14633
- }
14634
- };
14635
-
14636
- // src/core/bus/index.ts
14637
- var EventBus = new EventBusImpl();
14638
- function emit(type, properties) {
14639
- EventBus.emit(type, properties);
14640
- }
14641
-
14642
- // src/core/agents/manager/event-handler.ts
14643
14544
  var EventHandler = class {
14644
14545
  constructor(client, store, concurrency, findBySession, notifyParentIfAllComplete, scheduleCleanup, validateSessionHasOutput) {
14645
14546
  this.client = client;
@@ -16009,40 +15910,6 @@ ${r.content}
16009
15910
  }
16010
15911
  });
16011
15912
 
16012
- // src/core/notification/event-integration.ts
16013
- function enableAutoToasts() {
16014
- const unsubscribers = [];
16015
- unsubscribers.push(EventBus.subscribe(TASK_EVENTS.STARTED, (event) => {
16016
- const { taskId, agent } = event.properties;
16017
- presets.taskStarted(taskId, agent);
16018
- }));
16019
- unsubscribers.push(EventBus.subscribe(TASK_EVENTS.COMPLETED, (event) => {
16020
- const { taskId, agent } = event.properties;
16021
- presets.taskCompleted(taskId, agent);
16022
- }));
16023
- unsubscribers.push(EventBus.subscribe(TASK_EVENTS.FAILED, (event) => {
16024
- const { taskId, error: error45 } = event.properties;
16025
- presets.taskFailed(taskId, error45);
16026
- }));
16027
- unsubscribers.push(EventBus.subscribe(MISSION_EVENTS.ALL_TASKS_COMPLETE, (event) => {
16028
- const { count } = event.properties;
16029
- presets.allTasksComplete(count);
16030
- }));
16031
- unsubscribers.push(EventBus.subscribe(MISSION_EVENTS.COMPLETE, (event) => {
16032
- const { summary } = event.properties;
16033
- presets.missionComplete(summary);
16034
- }));
16035
- unsubscribers.push(EventBus.subscribe(DOCUMENT_EVENTS.CACHED, (event) => {
16036
- const { filename } = event.properties;
16037
- presets.documentCached(filename);
16038
- }));
16039
- return () => {
16040
- for (const unsub of unsubscribers) {
16041
- unsub();
16042
- }
16043
- };
16044
- }
16045
-
16046
15913
  // src/core/progress/store.ts
16047
15914
  var progressHistory = /* @__PURE__ */ new Map();
16048
15915
  var sessionStartTimes = /* @__PURE__ */ new Map();
@@ -16164,7 +16031,6 @@ var OrchestratorPlugin = async (input) => {
16164
16031
  console.log(`[orchestrator] Log file: ${getLogPath()}`);
16165
16032
  log2("[index.ts] Plugin initialized", { version: PLUGIN_VERSION, directory });
16166
16033
  initToastClient(client);
16167
- const disableAutoToasts = enableAutoToasts();
16168
16034
  log2("[index.ts] Toast notifications enabled with TUI");
16169
16035
  const sessions = /* @__PURE__ */ new Map();
16170
16036
  const parallelAgentManager2 = ParallelAgentManager.getInstance(client, directory);
@@ -16307,7 +16173,7 @@ var OrchestratorPlugin = async (input) => {
16307
16173
  log2("[index.ts] event: session.created", { sessionID });
16308
16174
  presets.missionStarted(`Session ${sessionID.slice(0, 12)}...`);
16309
16175
  }
16310
- if (event.type === "session.deleted" || event.type === SESSION_EVENTS.DELETED) {
16176
+ if (event.type === "session.deleted") {
16311
16177
  const sessionID = event.properties?.id || event.properties?.info?.id || "";
16312
16178
  const session = sessions.get(sessionID);
16313
16179
  if (session) {
@@ -16364,11 +16230,7 @@ var OrchestratorPlugin = async (input) => {
16364
16230
  anomalyCount: 0
16365
16231
  });
16366
16232
  startSession(sessionID);
16367
- emit(TASK_EVENTS.STARTED, {
16368
- taskId: sessionID,
16369
- agent: AGENT_NAMES.COMMANDER,
16370
- description: "Mission started"
16371
- });
16233
+ presets.taskStarted(sessionID, AGENT_NAMES.COMMANDER);
16372
16234
  }
16373
16235
  if (!parsed || parsed.command !== "task") {
16374
16236
  const taskTemplate = COMMANDS["task"].template;
@@ -16527,10 +16389,7 @@ Anomaly count: ${stateSession.anomalyCount}
16527
16389
  if (textContent.includes(MISSION.COMPLETE) || textContent.includes(MISSION.COMPLETE_TEXT)) {
16528
16390
  session.active = false;
16529
16391
  state.missionActive = false;
16530
- emit(MISSION_EVENTS.COMPLETE, {
16531
- sessionId: sessionID,
16532
- summary: "Mission completed successfully"
16533
- });
16392
+ presets.missionComplete("Mission completed successfully");
16534
16393
  clearSession(sessionID);
16535
16394
  sessions.delete(sessionID);
16536
16395
  state.sessions.delete(sessionID);
@@ -16539,10 +16398,7 @@ Anomaly count: ${stateSession.anomalyCount}
16539
16398
  if (textContent.includes(MISSION.STOP_COMMAND) || textContent.includes(MISSION.CANCEL_COMMAND)) {
16540
16399
  session.active = false;
16541
16400
  state.missionActive = false;
16542
- emit(TASK_EVENTS.FAILED, {
16543
- taskId: sessionID,
16544
- error: "Cancelled by user"
16545
- });
16401
+ presets.taskFailed(sessionID, "Cancelled by user");
16546
16402
  clearSession(sessionID);
16547
16403
  sessions.delete(sessionID);
16548
16404
  state.sessions.delete(sessionID);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "opencode-orchestrator",
3
3
  "displayName": "OpenCode Orchestrator",
4
4
  "description": "Distributed Cognitive Architecture for OpenCode. Turns simple prompts into specialized multi-agent workflows (Planner, Coder, Reviewer).",
5
- "version": "0.6.20",
5
+ "version": "0.6.22",
6
6
  "author": "agnusdei1207",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -1,53 +0,0 @@
1
- /**
2
- * Event Bus Implementation
3
- *
4
- * Core pub/sub system for communication between sessions and agents
5
- */
6
- import type { EventType } from "./types.js";
7
- import type { BusEvent, EventHandler } from "./interfaces.js";
8
- export declare class EventBusImpl {
9
- private subscriptions;
10
- private eventHistory;
11
- private maxHistorySize;
12
- private subscriptionCounter;
13
- /**
14
- * Subscribe to an event type
15
- * Returns unsubscribe function
16
- */
17
- subscribe(type: EventType, handler: EventHandler): () => void;
18
- /**
19
- * Subscribe to an event type, auto-unsubscribe after first event
20
- */
21
- once(type: EventType, handler: EventHandler): () => void;
22
- /**
23
- * Unsubscribe from an event
24
- */
25
- private unsubscribe;
26
- /**
27
- * Publish an event
28
- */
29
- publish(type: EventType, properties?: Record<string, unknown>, options?: {
30
- source?: string;
31
- sessionId?: string;
32
- }): Promise<void>;
33
- /**
34
- * Emit (alias for publish, sync-looking API)
35
- */
36
- emit(type: EventType, properties?: Record<string, unknown>): void;
37
- /**
38
- * Get recent event history
39
- */
40
- getHistory(type?: EventType, limit?: number): BusEvent[];
41
- /**
42
- * Clear all subscriptions
43
- */
44
- clear(): void;
45
- /**
46
- * Get subscription count
47
- */
48
- getSubscriptionCount(): number;
49
- /**
50
- * Wait for a specific event (Promise-based)
51
- */
52
- waitFor(type: EventType, timeout?: number): Promise<BusEvent>;
53
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * Event Bus System
3
- *
4
- * Pub/Sub system for communication between sessions and agents
5
- * Enables loose coupling and async event handling
6
- */
7
- export type { EventType, EventProperties } from "./types.js";
8
- export type { BusEvent, EventHandler, Subscription, PublishOptions } from "./interfaces.js";
9
- export { EVENT_TYPES, TASK_EVENTS, TODO_EVENTS, SESSION_EVENTS, DOCUMENT_EVENTS, MISSION_EVENTS, SPECIAL_EVENTS, } from "../../shared/event-types.js";
10
- import { EventBusImpl } from "./event-bus.js";
11
- import type { EventType, EventProperties } from "./types.js";
12
- import type { EventHandler } from "./interfaces.js";
13
- export declare const EventBus: EventBusImpl;
14
- export declare function subscribe(type: EventType, handler: EventHandler): () => void;
15
- export declare function publish(type: EventType, properties?: EventProperties, options?: {
16
- source?: string;
17
- sessionId?: string;
18
- }): Promise<void>;
19
- export declare function emit(type: EventType, properties?: EventProperties): void;
@@ -1,34 +0,0 @@
1
- /**
2
- * Event Bus Interfaces
3
- */
4
- import type { EventType, EventProperties } from "./types.js";
5
- /**
6
- * Event payload structure
7
- */
8
- export interface BusEvent {
9
- type: EventType;
10
- timestamp: Date;
11
- source: string;
12
- sessionId?: string;
13
- properties: EventProperties;
14
- }
15
- /**
16
- * Event handler function signature
17
- */
18
- export type EventHandler = (event: BusEvent) => void | Promise<void>;
19
- /**
20
- * Internal subscription record
21
- */
22
- export interface Subscription {
23
- id: string;
24
- type: EventType;
25
- handler: EventHandler;
26
- once: boolean;
27
- }
28
- /**
29
- * Publish options
30
- */
31
- export interface PublishOptions {
32
- source?: string;
33
- sessionId?: string;
34
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * Event Bus Types (Type Aliases Only)
3
- */
4
- import type { EventTypeValue } from "../../shared/event-types.js";
5
- /**
6
- * Event type - allows constants or custom strings
7
- */
8
- export type EventType = EventTypeValue | (string & {});
9
- /**
10
- * Properties payload for events
11
- */
12
- export type EventProperties = Record<string, unknown>;
@@ -1,7 +0,0 @@
1
- /**
2
- * Event Bus Integration - Auto-subscribe to events
3
- */
4
- /**
5
- * Auto-subscribe to events and show toasts
6
- */
7
- export declare function enableAutoToasts(): () => void;