@xiangyixie/dsh-superagent 0.14.5 → 0.14.6

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.
Binary file
Binary file
Binary file
package/lib/console.js CHANGED
@@ -287,7 +287,10 @@ export function createConsole({ port, stateRoot, host, version, log = () => {} }
287
287
  records: tidied,
288
288
  })}\n`
289
289
  const tmp = `${timelinePath}.${process.pid}.tmp`
290
- return fsp.writeFile(tmp, body, 'utf8')
290
+ // The state directory may not exist yet when a stop flushes the timeline
291
+ // during startup, so create it instead of failing the flush with ENOENT.
292
+ return fsp.mkdir(path.dirname(timelinePath), { recursive: true })
293
+ .then(() => fsp.writeFile(tmp, body, 'utf8'))
291
294
  .then(() => replaceTimeline(tmp))
292
295
  .catch(error => log(`console: cannot save ${timelinePath}: ${messageOf(error)}`))
293
296
  }
@@ -676,7 +679,14 @@ export function createConsole({ port, stateRoot, host, version, log = () => {} }
676
679
  clients.delete(res)
677
680
  // With nobody watching there is no reason to keep the follow loop alive.
678
681
  // The transcript stays cached so a reconnect can rebuild the page.
679
- if (clients.size === 0) detach()
682
+ if (clients.size === 0) {
683
+ detach()
684
+ // A decision can no longer arrive: settle every pending question
685
+ // cancelled now instead of leaving the tool call parked until the
686
+ // ten-minute deadline. Cancellation is the fail-closed outcome, so a
687
+ // closed page or a dropped stream never approves anything.
688
+ for (const entry of [...approvals.values()]) entry.settle('cancelled')
689
+ }
680
690
  }
681
691
  req.on('close', cleanup)
682
692
  res.on('close', cleanup)
package/lib/index.js CHANGED
@@ -3745,7 +3745,19 @@ export function apply(ctx, config) {
3745
3745
  // waterfall listener, and a listener that never calls `next()` would win by
3746
3746
  // order alone. Answering our own sessions first is what routes this tree's
3747
3747
  // ask to this page; every other session still falls through untouched.
3748
- const approvalCtx = (ctx.root && typeof ctx.root.on === 'function') ? ctx.root : ctx
3748
+ // Cordis exposes the root context under a well-known symbol, not a `root`
3749
+ // property; reading `ctx.root` makes the service resolver throw before the
3750
+ // bridge is even registered. Fall back to this plugin's own context so a
3751
+ // host that hides the symbol still keeps its normal answerer chain.
3752
+ const rootContext = (() => {
3753
+ try {
3754
+ const candidate = ctx[Symbol.for('cordis.root')]
3755
+ return candidate && typeof candidate.on === 'function' ? candidate : ctx
3756
+ } catch {
3757
+ return ctx
3758
+ }
3759
+ })()
3760
+ const approvalCtx = rootContext
3749
3761
  const bridgeApproval = (request, next) => {
3750
3762
  try {
3751
3763
  const session = request?.agent?.session
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiangyixie/dsh-superagent",
3
- "version": "0.14.5",
3
+ "version": "0.14.6",
4
4
  "description": "长周期自主执行插件:一个目标拆成可并行的子任务,交付一份合并报告,重启后仍可继续。",
5
5
  "author": "Admire (LittleChenLiya)",
6
6
  "type": "module",
@@ -87,6 +87,7 @@
87
87
  "docs/DETAIL.md",
88
88
  "docs/DETAIL.zh.md",
89
89
  "docs/LONG-GOAL.md",
90
+ "docs/images/*.png",
90
91
  "CHANGELOG.md",
91
92
  "README.md",
92
93
  "README.en.md",