opencode-orchestrator 0.6.4 → 0.6.5

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.
@@ -6,9 +6,18 @@ export declare const presets: {
6
6
  taskCompleted: (taskId: string, agent: string) => import("./types.js").ToastMessage;
7
7
  taskFailed: (taskId: string, error: string) => import("./types.js").ToastMessage;
8
8
  allTasksComplete: (count: number) => import("./types.js").ToastMessage;
9
+ sessionCreated: (sessionId: string, agent: string) => import("./types.js").ToastMessage;
10
+ sessionResumed: (sessionId: string, agent: string) => import("./types.js").ToastMessage;
11
+ sessionCompleted: (sessionId: string, duration: string) => import("./types.js").ToastMessage;
12
+ parallelTasksLaunched: (count: number, agents: string[]) => import("./types.js").ToastMessage;
13
+ concurrencyAcquired: (agent: string, slot: string) => import("./types.js").ToastMessage;
14
+ concurrencyReleased: (agent: string) => import("./types.js").ToastMessage;
9
15
  missionComplete: (summary: string) => import("./types.js").ToastMessage;
16
+ missionStarted: (description: string) => import("./types.js").ToastMessage;
17
+ toolExecuted: (toolName: string, target: string) => import("./types.js").ToastMessage;
10
18
  documentCached: (filename: string) => import("./types.js").ToastMessage;
11
19
  researchStarted: (topic: string) => import("./types.js").ToastMessage;
12
20
  warningRateLimited: () => import("./types.js").ToastMessage;
13
21
  errorRecovery: (action: string) => import("./types.js").ToastMessage;
22
+ warningMaxDepth: (depth: number) => import("./types.js").ToastMessage;
14
23
  };
package/dist/index.js CHANGED
@@ -14290,6 +14290,182 @@ Use \`get_task_result({ taskId: "task_xxx" })\` to retrieve results.
14290
14290
  </system-notification>`;
14291
14291
  }
14292
14292
 
14293
+ // src/core/notification/toast-core.ts
14294
+ var tuiClient = null;
14295
+ function initToastClient(client) {
14296
+ tuiClient = client;
14297
+ }
14298
+ var toasts = [];
14299
+ var MAX_HISTORY = 50;
14300
+ var handlers = [];
14301
+ function show(options) {
14302
+ const toast = {
14303
+ id: `toast_${Date.now()}_${Math.random().toString(36).slice(2, 6)}`,
14304
+ title: options.title,
14305
+ message: options.message,
14306
+ variant: options.variant || "info",
14307
+ timestamp: /* @__PURE__ */ new Date(),
14308
+ duration: options.duration ?? 5e3,
14309
+ dismissed: false
14310
+ };
14311
+ toasts.push(toast);
14312
+ if (toasts.length > MAX_HISTORY) {
14313
+ toasts.shift();
14314
+ }
14315
+ for (const handler of handlers) {
14316
+ try {
14317
+ handler(toast);
14318
+ } catch (error45) {
14319
+ }
14320
+ }
14321
+ if (tuiClient) {
14322
+ const client = tuiClient;
14323
+ if (client.tui?.showToast) {
14324
+ client.tui.showToast({
14325
+ body: {
14326
+ title: toast.title,
14327
+ message: toast.message,
14328
+ variant: toast.variant,
14329
+ duration: toast.duration
14330
+ }
14331
+ }).catch(() => {
14332
+ });
14333
+ }
14334
+ }
14335
+ return toast;
14336
+ }
14337
+
14338
+ // src/core/notification/presets.ts
14339
+ var presets = {
14340
+ // =========================================
14341
+ // Task Lifecycle
14342
+ // =========================================
14343
+ taskStarted: (taskId, agent) => show({
14344
+ title: "\u26A1 Task Started",
14345
+ message: `${agent}: ${taskId}`,
14346
+ variant: "info",
14347
+ duration: 3e3
14348
+ }),
14349
+ taskCompleted: (taskId, agent) => show({
14350
+ title: "\u2705 Task Completed",
14351
+ message: `${agent}: ${taskId}`,
14352
+ variant: "success",
14353
+ duration: 3e3
14354
+ }),
14355
+ taskFailed: (taskId, error45) => show({
14356
+ title: "\u274C Task Failed",
14357
+ message: `${taskId}: ${error45}`,
14358
+ variant: "error",
14359
+ duration: 0
14360
+ // Persistent
14361
+ }),
14362
+ allTasksComplete: (count) => show({
14363
+ title: "\u{1F389} All Tasks Complete",
14364
+ message: `${count} tasks finished successfully`,
14365
+ variant: "success",
14366
+ duration: 5e3
14367
+ }),
14368
+ // =========================================
14369
+ // Session Management
14370
+ // =========================================
14371
+ sessionCreated: (sessionId, agent) => show({
14372
+ title: "\u{1F4CC} Session Created",
14373
+ message: `${agent} \u2192 ${sessionId.slice(0, 12)}...`,
14374
+ variant: "info",
14375
+ duration: 2e3
14376
+ }),
14377
+ sessionResumed: (sessionId, agent) => show({
14378
+ title: "\u{1F504} Session Resumed",
14379
+ message: `${agent} \u2192 ${sessionId.slice(0, 12)}...`,
14380
+ variant: "info",
14381
+ duration: 2e3
14382
+ }),
14383
+ sessionCompleted: (sessionId, duration3) => show({
14384
+ title: "\u2705 Session Completed",
14385
+ message: `${sessionId.slice(0, 12)}... (${duration3})`,
14386
+ variant: "success",
14387
+ duration: 3e3
14388
+ }),
14389
+ // =========================================
14390
+ // Parallel Processing
14391
+ // =========================================
14392
+ parallelTasksLaunched: (count, agents) => show({
14393
+ title: "\u{1F680} Parallel Tasks Launched",
14394
+ message: `${count} tasks: ${agents.join(", ")}`,
14395
+ variant: "info",
14396
+ duration: 4e3
14397
+ }),
14398
+ concurrencyAcquired: (agent, slot) => show({
14399
+ title: "\u{1F512} Concurrency Slot",
14400
+ message: `${agent} acquired ${slot}`,
14401
+ variant: "info",
14402
+ duration: 2e3
14403
+ }),
14404
+ concurrencyReleased: (agent) => show({
14405
+ title: "\u{1F513} Slot Released",
14406
+ message: agent,
14407
+ variant: "info",
14408
+ duration: 1500
14409
+ }),
14410
+ // =========================================
14411
+ // Mission & Progress
14412
+ // =========================================
14413
+ missionComplete: (summary) => show({
14414
+ title: "\u{1F389} Mission Complete",
14415
+ message: summary,
14416
+ variant: "success",
14417
+ duration: 0
14418
+ }),
14419
+ missionStarted: (description) => show({
14420
+ title: "\u{1F3AF} Mission Started",
14421
+ message: description.slice(0, 100),
14422
+ variant: "info",
14423
+ duration: 4e3
14424
+ }),
14425
+ // =========================================
14426
+ // Tools & Research
14427
+ // =========================================
14428
+ toolExecuted: (toolName, target) => show({
14429
+ title: `\u{1F527} ${toolName}`,
14430
+ message: target.slice(0, 80),
14431
+ variant: "info",
14432
+ duration: 2e3
14433
+ }),
14434
+ documentCached: (filename) => show({
14435
+ title: "\u{1F4C4} Document Cached",
14436
+ message: `.cache/docs/${filename}`,
14437
+ variant: "info",
14438
+ duration: 2e3
14439
+ }),
14440
+ researchStarted: (topic) => show({
14441
+ title: "\u{1F52C} Research Started",
14442
+ message: topic,
14443
+ variant: "info",
14444
+ duration: 3e3
14445
+ }),
14446
+ // =========================================
14447
+ // Warnings & Errors
14448
+ // =========================================
14449
+ warningRateLimited: () => show({
14450
+ title: "\u26A0\uFE0F Rate Limited",
14451
+ message: "Waiting before retry...",
14452
+ variant: "warning",
14453
+ duration: 5e3
14454
+ }),
14455
+ errorRecovery: (action) => show({
14456
+ title: "\u26A0\uFE0F Error Recovery",
14457
+ message: `Attempting: ${action}`,
14458
+ variant: "warning",
14459
+ duration: 3e3
14460
+ }),
14461
+ warningMaxDepth: (depth) => show({
14462
+ title: "\u26A0\uFE0F Max Depth Reached",
14463
+ message: `Recursion blocked at depth ${depth}`,
14464
+ variant: "warning",
14465
+ duration: 5e3
14466
+ })
14467
+ };
14468
+
14293
14469
  // src/core/agents/manager/task-launcher.ts
14294
14470
  var TaskLauncher = class {
14295
14471
  constructor(client, directory, store, concurrency, onTaskError, startPolling) {
@@ -14350,6 +14526,7 @@ var TaskLauncher = class {
14350
14526
  log2(`Prompt error for ${taskId}:`, error45);
14351
14527
  this.onTaskError(taskId, error45);
14352
14528
  });
14529
+ presets.sessionCreated(sessionID, input.agent);
14353
14530
  log2(`Launched ${taskId} in session ${sessionID}`);
14354
14531
  return task;
14355
14532
  } catch (error45) {
@@ -14495,7 +14672,9 @@ var TaskPoller = class {
14495
14672
  this.store.queueNotification(task);
14496
14673
  await this.notifyParentIfAllComplete(task.parentSessionID);
14497
14674
  this.scheduleCleanup(task.id);
14498
- log2(`Completed ${task.id} (${formatDuration(task.startedAt, task.completedAt)})`);
14675
+ const duration3 = formatDuration(task.startedAt, task.completedAt);
14676
+ presets.sessionCompleted(task.sessionID, duration3);
14677
+ log2(`Completed ${task.id} (${duration3})`);
14499
14678
  }
14500
14679
  async updateTaskProgress(task) {
14501
14680
  try {
@@ -16136,110 +16315,6 @@ ${r.content}
16136
16315
  }
16137
16316
  });
16138
16317
 
16139
- // src/core/notification/toast-core.ts
16140
- var tuiClient = null;
16141
- function initToastClient(client) {
16142
- tuiClient = client;
16143
- }
16144
- var toasts = [];
16145
- var MAX_HISTORY = 50;
16146
- var handlers = [];
16147
- function show(options) {
16148
- const toast = {
16149
- id: `toast_${Date.now()}_${Math.random().toString(36).slice(2, 6)}`,
16150
- title: options.title,
16151
- message: options.message,
16152
- variant: options.variant || "info",
16153
- timestamp: /* @__PURE__ */ new Date(),
16154
- duration: options.duration ?? 5e3,
16155
- dismissed: false
16156
- };
16157
- toasts.push(toast);
16158
- if (toasts.length > MAX_HISTORY) {
16159
- toasts.shift();
16160
- }
16161
- for (const handler of handlers) {
16162
- try {
16163
- handler(toast);
16164
- } catch (error45) {
16165
- }
16166
- }
16167
- if (tuiClient) {
16168
- const client = tuiClient;
16169
- if (client.tui?.showToast) {
16170
- client.tui.showToast({
16171
- body: {
16172
- title: toast.title,
16173
- message: toast.message,
16174
- variant: toast.variant,
16175
- duration: toast.duration
16176
- }
16177
- }).catch(() => {
16178
- });
16179
- }
16180
- }
16181
- return toast;
16182
- }
16183
-
16184
- // src/core/notification/presets.ts
16185
- var presets = {
16186
- taskStarted: (taskId, agent) => show({
16187
- title: "Task Started",
16188
- message: `${agent}: ${taskId}`,
16189
- variant: "info",
16190
- duration: 3e3
16191
- }),
16192
- taskCompleted: (taskId, agent) => show({
16193
- title: "Task Completed",
16194
- message: `${agent}: ${taskId}`,
16195
- variant: "success",
16196
- duration: 3e3
16197
- }),
16198
- taskFailed: (taskId, error45) => show({
16199
- title: "Task Failed",
16200
- message: `${taskId}: ${error45}`,
16201
- variant: "error",
16202
- duration: 0
16203
- // Persistent
16204
- }),
16205
- allTasksComplete: (count) => show({
16206
- title: "All Tasks Complete",
16207
- message: `${count} tasks finished successfully`,
16208
- variant: "success",
16209
- duration: 5e3
16210
- }),
16211
- missionComplete: (summary) => show({
16212
- title: "\u{1F389} Mission Complete",
16213
- message: summary,
16214
- variant: "success",
16215
- duration: 0
16216
- }),
16217
- documentCached: (filename) => show({
16218
- title: "Document Cached",
16219
- message: `.cache/docs/${filename}`,
16220
- variant: "info",
16221
- duration: 2e3
16222
- }),
16223
- researchStarted: (topic) => show({
16224
- title: "Research Started",
16225
- message: topic,
16226
- variant: "info",
16227
- duration: 3e3
16228
- }),
16229
- warningRateLimited: () => show({
16230
- title: "Rate Limited",
16231
- message: "Waiting before retry...",
16232
- variant: "warning",
16233
- duration: 5e3
16234
- }),
16235
- errorRecovery: (action) => show({
16236
- title: "Error Recovery",
16237
- message: `Attempting: ${action}`,
16238
- variant: "warning",
16239
- duration: 3e3
16240
- })
16241
- };
16242
-
16243
16318
  // src/core/notification/event-integration.ts
16244
16319
  function enableAutoToasts() {
16245
16320
  const unsubscribers = [];
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.4",
5
+ "version": "0.6.5",
6
6
  "author": "agnusdei1207",
7
7
  "license": "MIT",
8
8
  "repository": {