@whaletalk/dsh-codex-collab 0.1.7 → 0.1.10

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +197 -26
  3. package/codex-plugin/plugins/dsh/.codex-plugin/plugin.json +1 -1
  4. package/codex-plugin/plugins/dsh/skills/dsh-collab/SKILL.md +102 -6
  5. package/codex-plugin/plugins/dsh/skills/dsh-collab/scripts/review.mjs +91 -6
  6. package/codex-plugin/plugins/dsh/skills/dsh-collab/scripts/task.mjs +571 -44
  7. package/docs/CODEX_DSH_APPROVAL_DELEGATION_PLAN.md +130 -0
  8. package/docs/CODEX_DSH_APPROVAL_M0_EVIDENCE.md +285 -0
  9. package/docs/CODEX_DSH_DELIVERY_CONTROL_PLAN.md +81 -0
  10. package/docs/CODEX_DSH_MODEL_ROUTING_PLAN.md +75 -0
  11. package/docs/CODEX_DSH_TASK_REPLY_PLAN.md +206 -0
  12. package/docs/DSH_APPROVAL_DELEGATION.md +142 -0
  13. package/docs/DSH_DELIVERY_M0_EVIDENCE.md +69 -0
  14. package/docs/DSH_MODEL_ROUTING_M0_EVIDENCE.md +166 -0
  15. package/docs/DSH_TO_CODEX_INBOX.md +167 -0
  16. package/docs/DSH_TO_CODEX_MESSAGING_PLAN.md +140 -0
  17. package/docs/codex-desktop-attachment-evidence.md +116 -0
  18. package/harness/audit-tail.mjs +32 -0
  19. package/harness/codex-approvals.mjs +1078 -0
  20. package/harness/codex-associations.mjs +297 -0
  21. package/harness/codex-outbox.mjs +432 -0
  22. package/harness/dsh-bridge.mjs +2429 -167
  23. package/harness/fs-lock.mjs +208 -0
  24. package/harness/model-route-host.mjs +530 -0
  25. package/harness/model-routing.mjs +500 -0
  26. package/harness/session-observer.mjs +217 -0
  27. package/harness/session-target.mjs +291 -2
  28. package/harness/task-table.mjs +34 -0
  29. package/mcp/codex-desktop-probe.mjs +407 -0
  30. package/mcp/codex-inbox.mjs +271 -0
  31. package/mcp/dsh-mcp.mjs +616 -24
  32. package/package.json +4 -2
@@ -0,0 +1,32 @@
1
+ import fs from 'node:fs'
2
+
3
+ /** Only the bounded tail is decoded; unchanged files are never decoded again. */
4
+ export const createAuditTailReader = ({ file, fallback, maxBytes = 1024 * 1024 }) => {
5
+ let identity = null, records = []
6
+ const counters = { reads: 0, bytes: 0, truncated: false }
7
+ return {
8
+ read(taskId, limit = 50) {
9
+ const name = file()
10
+ if (!name) return fallback().filter(e => taskId === undefined || e.taskId === taskId).slice(-limit)
11
+ let fd
12
+ try {
13
+ const stat = fs.statSync(name)
14
+ const key = [name, stat.dev, stat.ino, stat.size, stat.mtimeMs, stat.ctimeMs].join(':')
15
+ if (key !== identity) {
16
+ fd = fs.openSync(name, 'r')
17
+ const size = Math.min(stat.size, maxBytes), offset = stat.size - size
18
+ const buffer = Buffer.alloc(size)
19
+ const read = fs.readSync(fd, buffer, 0, size, offset)
20
+ let text = buffer.subarray(0, read).toString('utf8')
21
+ if (offset > 0) { const boundary = text.indexOf('\n'); text = boundary < 0 ? '' : text.slice(boundary + 1) }
22
+ records = []
23
+ for (const line of text.split('\n')) { try { const value = JSON.parse(line); if (value && typeof value === 'object') records.push(value) } catch { /* partial/bad audit rows are not execution evidence */ } }
24
+ identity = key; counters.reads++; counters.bytes += read; counters.truncated = offset > 0
25
+ }
26
+ return records.filter(e => taskId === undefined || e.taskId === taskId).slice(-limit)
27
+ } catch { return fallback().filter(e => taskId === undefined || e.taskId === taskId).slice(-limit) }
28
+ finally { if (fd !== undefined) fs.closeSync(fd) }
29
+ },
30
+ status: () => ({ ...counters }),
31
+ }
32
+ }