opencode-routines 0.1.2 → 0.1.3
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/dist/index.d.ts +0 -51
- package/dist/index.js +10 -8
- package/dist/tui.d.ts +1 -56
- package/dist/tui.js +3 -5
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -12,56 +12,5 @@
|
|
|
12
12
|
* - Environment variable injection (PATH for node/npx)
|
|
13
13
|
*/
|
|
14
14
|
import type { Plugin } from "@opencode-ai/plugin";
|
|
15
|
-
type OpencodeRunFormat = "default" | "json";
|
|
16
|
-
interface JobRunSpec {
|
|
17
|
-
prompt?: string;
|
|
18
|
-
command?: string;
|
|
19
|
-
arguments?: string;
|
|
20
|
-
files?: string[];
|
|
21
|
-
agent?: string;
|
|
22
|
-
model?: string;
|
|
23
|
-
variant?: string;
|
|
24
|
-
title?: string;
|
|
25
|
-
share?: boolean;
|
|
26
|
-
continue?: boolean;
|
|
27
|
-
session?: string;
|
|
28
|
-
runFormat?: OpencodeRunFormat;
|
|
29
|
-
attachUrl?: string;
|
|
30
|
-
port?: number;
|
|
31
|
-
}
|
|
32
|
-
type JobInvocation = {
|
|
33
|
-
command: string;
|
|
34
|
-
args: string[];
|
|
35
|
-
};
|
|
36
|
-
interface Job {
|
|
37
|
-
scopeId?: string;
|
|
38
|
-
slug: string;
|
|
39
|
-
name: string;
|
|
40
|
-
schedule: string;
|
|
41
|
-
prompt?: string;
|
|
42
|
-
attachUrl?: string;
|
|
43
|
-
run?: JobRunSpec;
|
|
44
|
-
invocation?: JobInvocation;
|
|
45
|
-
timeoutSeconds?: number;
|
|
46
|
-
source?: string;
|
|
47
|
-
workdir?: string;
|
|
48
|
-
createdAt: string;
|
|
49
|
-
updatedAt?: string;
|
|
50
|
-
lastRunAt?: string;
|
|
51
|
-
lastRunExitCode?: number;
|
|
52
|
-
lastRunError?: string;
|
|
53
|
-
lastRunSource?: "manual" | "scheduled";
|
|
54
|
-
lastRunStatus?: "running" | "success" | "failed";
|
|
55
|
-
}
|
|
56
|
-
type RoutinePromptClient = {
|
|
57
|
-
session?: {
|
|
58
|
-
prompt?: (input: unknown) => Promise<unknown>;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
export declare function __testSubmitSessionPrompt(client: RoutinePromptClient, sessionID: string, prompt: string): Promise<void>;
|
|
62
|
-
export declare function __testBuildOpencodeArgs(job: Job): {
|
|
63
|
-
command: string;
|
|
64
|
-
args: string[];
|
|
65
|
-
};
|
|
66
15
|
export declare const SchedulerPlugin: Plugin;
|
|
67
16
|
export default SchedulerPlugin;
|
package/dist/index.js
CHANGED
|
@@ -12969,17 +12969,17 @@ function promptResultError(result) {
|
|
|
12969
12969
|
return;
|
|
12970
12970
|
return typeof error45 === "string" ? error45 : JSON.stringify(error45);
|
|
12971
12971
|
}
|
|
12972
|
-
async function
|
|
12972
|
+
async function testSubmitSessionPrompt(client, sessionID, prompt) {
|
|
12973
12973
|
await submitSessionPrompt(client, sessionID, prompt);
|
|
12974
12974
|
}
|
|
12975
12975
|
async function submitSessionPrompt(client, sessionID, prompt) {
|
|
12976
12976
|
const session = client.session;
|
|
12977
|
-
const send = session?.
|
|
12977
|
+
const send = session?.promptAsync;
|
|
12978
12978
|
if (!send)
|
|
12979
|
-
throw new Error("Current opencode client does not expose session.
|
|
12979
|
+
throw new Error("Current opencode client does not expose session.promptAsync");
|
|
12980
12980
|
const result = await send.call(session, {
|
|
12981
|
-
sessionID,
|
|
12982
|
-
parts: [{ type: "text", text: prompt }]
|
|
12981
|
+
path: { id: sessionID },
|
|
12982
|
+
body: { parts: [{ type: "text", text: prompt }] }
|
|
12983
12983
|
});
|
|
12984
12984
|
const error45 = promptResultError(result);
|
|
12985
12985
|
if (error45)
|
|
@@ -14182,7 +14182,7 @@ function buildOpencodeArgs(job) {
|
|
|
14182
14182
|
args.push(run.command ? run.arguments ?? "" : run.prompt ?? "");
|
|
14183
14183
|
return { command, args };
|
|
14184
14184
|
}
|
|
14185
|
-
function
|
|
14185
|
+
function testBuildOpencodeArgs(job) {
|
|
14186
14186
|
return buildOpencodeArgs(job);
|
|
14187
14187
|
}
|
|
14188
14188
|
function buildRunEnvironment() {
|
|
@@ -15386,10 +15386,12 @@ ${logs}`, { job, logPath, logs });
|
|
|
15386
15386
|
}
|
|
15387
15387
|
};
|
|
15388
15388
|
};
|
|
15389
|
+
SchedulerPlugin.__test = {
|
|
15390
|
+
buildOpencodeArgs: testBuildOpencodeArgs,
|
|
15391
|
+
submitSessionPrompt: testSubmitSessionPrompt
|
|
15392
|
+
};
|
|
15389
15393
|
var src_default = SchedulerPlugin;
|
|
15390
15394
|
export {
|
|
15391
15395
|
src_default as default,
|
|
15392
|
-
__testSubmitSessionPrompt,
|
|
15393
|
-
__testBuildOpencodeArgs,
|
|
15394
15396
|
SchedulerPlugin
|
|
15395
15397
|
};
|
package/dist/tui.d.ts
CHANGED
|
@@ -1,59 +1,4 @@
|
|
|
1
|
-
type
|
|
2
|
-
route: {
|
|
3
|
-
current: {
|
|
4
|
-
name: string;
|
|
5
|
-
params?: Record<string, any>;
|
|
6
|
-
};
|
|
7
|
-
navigate?: (name: string, params?: Record<string, unknown>) => void;
|
|
8
|
-
};
|
|
9
|
-
client: {
|
|
10
|
-
session: {
|
|
11
|
-
prompt: (input: any) => Promise<unknown>;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
ui: {
|
|
15
|
-
dialog: {
|
|
16
|
-
replace: (render: () => any) => void;
|
|
17
|
-
clear: () => void;
|
|
18
|
-
};
|
|
19
|
-
DialogAlert: (props: {
|
|
20
|
-
title: string;
|
|
21
|
-
message: string;
|
|
22
|
-
}) => any;
|
|
23
|
-
DialogPrompt: (props: {
|
|
24
|
-
title: string;
|
|
25
|
-
placeholder?: string;
|
|
26
|
-
onConfirm?: (value: string) => void;
|
|
27
|
-
}) => any;
|
|
28
|
-
DialogSelect: (props: {
|
|
29
|
-
title: string;
|
|
30
|
-
options: Array<{
|
|
31
|
-
title: string;
|
|
32
|
-
value: string;
|
|
33
|
-
description?: string;
|
|
34
|
-
footer?: string;
|
|
35
|
-
}>;
|
|
36
|
-
onSelect?: (option: {
|
|
37
|
-
value: string;
|
|
38
|
-
}) => void;
|
|
39
|
-
}) => any;
|
|
40
|
-
toast: (input: {
|
|
41
|
-
variant?: "info" | "success" | "warning" | "error";
|
|
42
|
-
title?: string;
|
|
43
|
-
message: string;
|
|
44
|
-
}) => void;
|
|
45
|
-
};
|
|
46
|
-
lifecycle: {
|
|
47
|
-
onDispose: (fn: () => void) => void;
|
|
48
|
-
};
|
|
49
|
-
keymap: {
|
|
50
|
-
registerLayer: (input: {
|
|
51
|
-
commands: any[];
|
|
52
|
-
bindings?: any[];
|
|
53
|
-
}) => unknown;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
type TuiPlugin = (api: TuiApi, options?: Record<string, unknown>, meta?: Record<string, unknown>) => Promise<void>;
|
|
1
|
+
import type { TuiPlugin } from "@opencode-ai/plugin/tui";
|
|
57
2
|
declare const _default: {
|
|
58
3
|
id: string;
|
|
59
4
|
tui: TuiPlugin;
|
package/dist/tui.js
CHANGED
|
@@ -54,11 +54,9 @@ function loopID() {
|
|
|
54
54
|
}
|
|
55
55
|
async function submitPrompt(api, loop) {
|
|
56
56
|
loop.fires += 1;
|
|
57
|
-
await api.client.session.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
parts: [{ type: "text", text: loop.prompt }]
|
|
61
|
-
}
|
|
57
|
+
await api.client.session.promptAsync({
|
|
58
|
+
sessionID: loop.sessionID,
|
|
59
|
+
parts: [{ type: "text", text: loop.prompt }]
|
|
62
60
|
});
|
|
63
61
|
}
|
|
64
62
|
function scheduleFixed(api, loop) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-routines",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "OpenCode routines: same-session loops, cron prompts, and host-backed standalone scheduled agents",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
},
|
|
55
55
|
"homepage": "https://github.com/EmilioEsposito/opencode-routines#readme",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@opencode-ai/plugin": "^1.
|
|
57
|
+
"@opencode-ai/plugin": "^1.17.3"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"bun-types": "latest",
|
|
61
61
|
"typescript": "^5.7.3"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@opencode-ai/plugin": ">=1.
|
|
64
|
+
"@opencode-ai/plugin": ">=1.17.3"
|
|
65
65
|
}
|
|
66
66
|
}
|