@dcrays/scheduled-task 0.1.0
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 +5 -0
- package/cordis.patch.yml +12 -0
- package/package.json +49 -0
- package/plugin/index.d.ts +65 -0
- package/plugin/index.js +1799 -0
- package/src/cron.d.ts +24 -0
- package/src/cron.js +211 -0
- package/src/manager.d.ts +51 -0
- package/src/manager.js +452 -0
- package/src/openclaw-sqlite.d.ts +40 -0
- package/src/openclaw-sqlite.js +136 -0
- package/src/protocol.d.ts +24 -0
- package/src/protocol.js +94 -0
- package/src/repository.d.ts +85 -0
- package/src/repository.js +393 -0
package/README.md
ADDED
package/cordis.patch.yml
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dcrays/scheduled-task",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Persistent client-facing cron automation service for DeepSeek Harness (production)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "plugin/index.js",
|
|
7
|
+
"types": "plugin/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./plugin/index.d.ts",
|
|
11
|
+
"default": "./plugin/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./protocol": {
|
|
14
|
+
"types": "./src/protocol.d.ts",
|
|
15
|
+
"default": "./src/protocol.js"
|
|
16
|
+
},
|
|
17
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
18
|
+
"./package.json": "./package.json"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"plugin/**",
|
|
22
|
+
"src/**",
|
|
23
|
+
"cordis.patch.yml",
|
|
24
|
+
"README.md",
|
|
25
|
+
"!**/*.map"
|
|
26
|
+
],
|
|
27
|
+
"dsh": {
|
|
28
|
+
"bundle": {
|
|
29
|
+
"patch": "./cordis.patch.yml"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=24.0.0"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@deepseek-ai/dsh-home-paths": "0.1.1-rc.2",
|
|
37
|
+
"@deepseek-ai/dsh-llm": "0.1.1-rc.2",
|
|
38
|
+
"@deepseek-ai/schemastery": "^3.18.1"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
42
|
+
"@deepseek-ai/dsh-agent": "^0.1.1-rc.2",
|
|
43
|
+
"@deepseek-ai/dsh-host-webserver": "^0.1.1-rc.2",
|
|
44
|
+
"@deepseek-ai/dsh-tools": "^0.1.1-rc.2"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import { Service } from '@deepseek-ai/cordis';
|
|
4
|
+
import { type CronAutomationPatch, type CronRunStatus } from '../src/manager.js';
|
|
5
|
+
import { CRON_LIST_TYPE, type CronCreateEnvelope } from '../src/protocol.js';
|
|
6
|
+
import { type StoredCronAutomation } from '../src/repository.js';
|
|
7
|
+
export declare const name = "dsh-cron-automation";
|
|
8
|
+
export declare const inject: string[];
|
|
9
|
+
export interface Config {
|
|
10
|
+
databaseFile?: string;
|
|
11
|
+
openclawSqlite?: string;
|
|
12
|
+
maxPromptChars: number;
|
|
13
|
+
listPushIntervalSeconds: number;
|
|
14
|
+
}
|
|
15
|
+
export declare const Config: Schemastery<Config>;
|
|
16
|
+
export type CronListReason = 'startup' | 'interval' | 'change' | 'subscribe';
|
|
17
|
+
export interface CronListSnapshot {
|
|
18
|
+
type: typeof CRON_LIST_TYPE;
|
|
19
|
+
version: 1;
|
|
20
|
+
sequence: number;
|
|
21
|
+
generatedAt: string;
|
|
22
|
+
reason: CronListReason;
|
|
23
|
+
jobs: StoredCronAutomation[];
|
|
24
|
+
}
|
|
25
|
+
declare module '@deepseek-ai/cordis' {
|
|
26
|
+
interface Context {
|
|
27
|
+
cronAutomations: CronAutomationService;
|
|
28
|
+
}
|
|
29
|
+
interface Events {
|
|
30
|
+
'cron-automation/created'(cron: StoredCronAutomation): void;
|
|
31
|
+
'cron-automation/changed'(cron: StoredCronAutomation): void;
|
|
32
|
+
'cron-automation/dispatched'(cron: StoredCronAutomation, occurrenceAt: string): void;
|
|
33
|
+
'cron-automation/list'(snapshot: CronListSnapshot): void;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export declare class CronAutomationService extends Service {
|
|
37
|
+
private readonly owner;
|
|
38
|
+
private readonly config;
|
|
39
|
+
private readonly manager;
|
|
40
|
+
private readonly subscribers;
|
|
41
|
+
private sequence;
|
|
42
|
+
private interval;
|
|
43
|
+
private started?;
|
|
44
|
+
private pushTail;
|
|
45
|
+
private pendingPushReason;
|
|
46
|
+
private pushQueued;
|
|
47
|
+
private stopping;
|
|
48
|
+
constructor(owner: Context, config: Config);
|
|
49
|
+
start(): Promise<void>;
|
|
50
|
+
private initialize;
|
|
51
|
+
private importOpenClawJobs;
|
|
52
|
+
stop(): Promise<void>;
|
|
53
|
+
create(agentId: string, envelope: CronCreateEnvelope): Promise<StoredCronAutomation>;
|
|
54
|
+
list(agentId?: string): Promise<StoredCronAutomation[]>;
|
|
55
|
+
update(cronId: string, patch: CronAutomationPatch): Promise<StoredCronAutomation | undefined>;
|
|
56
|
+
delete(cronId: string): Promise<boolean>;
|
|
57
|
+
runOnce(cronId: string): Promise<boolean>;
|
|
58
|
+
runOnceStatus(cronId: string): Promise<CronRunStatus>;
|
|
59
|
+
notifyAgentAvailable(agentId: string): void;
|
|
60
|
+
snapshot(reason?: CronListReason): Promise<CronListSnapshot>;
|
|
61
|
+
handleHttp(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
62
|
+
private requestListPush;
|
|
63
|
+
private publishList;
|
|
64
|
+
}
|
|
65
|
+
export declare function apply(ctx: Context, config: Config): void;
|