aamp-openclaw-plugin 0.1.28 → 0.1.30

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
@@ -63,6 +63,7 @@ The plugin also understands:
63
63
  - dispatch priority via `X-AAMP-Priority`
64
64
  - dispatch expiry via `X-AAMP-Expires-At`
65
65
  - sender-side cancellation via `task.cancel`
66
+ - realtime streaming via `task.stream.opened` + SSE-compatible stream events
66
67
 
67
68
  When multiple tasks are pending locally, the plugin schedules them in this order:
68
69
 
@@ -71,3 +72,10 @@ When multiple tasks are pending locally, the plugin schedules them in this order
71
72
  3. `normal`
72
73
 
73
74
  Within the same priority, tasks are processed FIFO by receive time. On startup, the plugin reconciles recent mailbox history so that still-valid tasks can be recovered after the agent was offline.
75
+
76
+ While a task is running, the plugin now:
77
+
78
+ 1. creates a task stream
79
+ 2. sends `task.stream.opened`
80
+ 3. emits `status`, `progress`, and `text.delta` events
81
+ 4. closes the stream before sending `task.result` or `task.help_needed`
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
3
+ import { cpSync, existsSync, mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
4
4
  import { homedir } from 'node:os'
5
- import { dirname, join } from 'node:path'
5
+ import { dirname, join, resolve } from 'node:path'
6
6
  import { createInterface } from 'node:readline/promises'
7
7
  import { stdin as input, stdout as output, stderr } from 'node:process'
8
8
  import { spawnSync } from 'node:child_process'
@@ -699,7 +699,18 @@ export async function main() {
699
699
  process.exitCode = 1
700
700
  }
701
701
 
702
- if (process.argv[1] === fileURLToPath(import.meta.url)) {
702
+ export function shouldRunAsCli(argv1 = process.argv[1]) {
703
+ if (!argv1) return false
704
+
705
+ const entryPath = fileURLToPath(import.meta.url)
706
+ try {
707
+ return realpathSync(argv1) === realpathSync(entryPath)
708
+ } catch {
709
+ return resolve(argv1) === entryPath
710
+ }
711
+ }
712
+
713
+ if (shouldRunAsCli()) {
703
714
  main().catch((err) => {
704
715
  stderr.write(`${err instanceof Error ? err.message : String(err)}\n`)
705
716
  process.exit(1)