@goodandready/dsh-cron 0.2.25 → 0.2.27

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/lib/chat-start.js CHANGED
@@ -44,7 +44,16 @@ export async function chatStartHandler(ctx, req, res, parseJsonBody, sendJson, r
44
44
  const model = body.model || defaultSel?.model;
45
45
 
46
46
  const cwd = process.cwd();
47
- const presets = ctx.agentPresets || ctx.get?.('agentPresets');
47
+ let presets = null;
48
+ try {
49
+ if (typeof ctx.get === 'function') {
50
+ presets = ctx.get('agentPresets');
51
+ } else {
52
+ presets = ctx.agentPresets;
53
+ }
54
+ } catch {
55
+ presets = null;
56
+ }
48
57
  let preset = null;
49
58
  if (presets && typeof presets.resolve === 'function') {
50
59
  try {
@@ -88,7 +97,7 @@ export async function chatStartHandler(ctx, req, res, parseJsonBody, sendJson, r
88
97
  await handle.agent.whenIdle();
89
98
  handle.agent.followup(createUserMessage({
90
99
  content: [{ type: 'text', text: fullPrompt }],
91
- source: { kind: 'plugin', plugin: 'dsh-cron', form: 'cron-setup' },
100
+ source: { kind: 'plugin:dsh-cron', form: 'cron-setup' },
92
101
  }));
93
102
 
94
103
  sendJson(res, 200, { ok: true, sessionId: handle.agent.session.id });
package/lib/llm-ask.js CHANGED
@@ -60,7 +60,7 @@ function isCleanFinish(kind) {
60
60
 
61
61
  async function buildUserMessage(text) {
62
62
  const content = [{ type: 'text', text }];
63
- const source = { kind: 'plugin', plugin: 'dsh-cron', form: 'helper-call' };
63
+ const source = { kind: 'plugin:dsh-cron', form: 'helper-call' };
64
64
  const mod = await bestEffort('import-dsh-llm', () => import('@deepseek-ai/dsh-llm'));
65
65
  if (mod && typeof mod.createUserMessage === 'function') {
66
66
  return mod.createUserMessage({ content, source });
package/lib/runner.js CHANGED
@@ -329,9 +329,18 @@ export class SessionRunner {
329
329
  let handle = null;
330
330
  let isResumed = false;
331
331
  try {
332
- // Resolve agent preset (#GH-1): scheduled llm sessions must join an agent preset
332
+ // Resolve agent preset (#GH-1, #GH-2): scheduled llm sessions must join an agent preset
333
333
  // (default or task-configured), otherwise tools resolve against the empty global layer.
334
- const presets = this.ctx.agentPresets || (this.ctx.get && this.ctx.get('agentPresets'));
334
+ let presets = null;
335
+ try {
336
+ if (typeof this.ctx.get === 'function') {
337
+ presets = this.ctx.get('agentPresets');
338
+ } else {
339
+ presets = this.ctx.agentPresets;
340
+ }
341
+ } catch {
342
+ presets = null;
343
+ }
335
344
  let preset = null;
336
345
  if (presets && typeof presets.resolve === 'function') {
337
346
  try {
@@ -392,7 +401,7 @@ export class SessionRunner {
392
401
  await prep.raceAbort(handle.agent.whenIdle());
393
402
  handle.agent.followup(prep.createUserMessage({
394
403
  content: [{ type: 'text', text: prep.agentPrompt }],
395
- source: { kind: 'plugin', plugin: 'dsh-cron', form: 'cron-execute' },
404
+ source: { kind: 'plugin:dsh-cron', form: 'cron-execute' },
396
405
  }));
397
406
  // Await agent turn completion (#67), abortable on timeout/overlap (#88)
398
407
  if (typeof handle.agent.whenIdle === 'function') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-cron",
3
- "version": "0.2.25",
3
+ "version": "0.2.27",
4
4
  "description": "Scheduled cron tasks, background automation and agent execution for DeepSeek Harness.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",