opencode-gateway 0.1.0 → 0.2.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 +26 -0
- package/dist/binding/gateway.d.ts +2 -1
- package/dist/binding/index.d.ts +1 -1
- package/dist/cli/doctor.js +3 -1
- package/dist/cli/init.js +4 -1
- package/dist/cli/paths.js +1 -1
- package/dist/cli/templates.js +15 -0
- package/dist/cli.js +28 -4
- package/dist/config/gateway.d.ts +5 -0
- package/dist/config/gateway.js +6 -1
- package/dist/config/memory.d.ts +18 -0
- package/dist/config/memory.js +105 -0
- package/dist/config/paths.d.ts +2 -0
- package/dist/config/paths.js +5 -1
- package/dist/cron/runtime.d.ts +24 -5
- package/dist/cron/runtime.js +178 -13
- package/dist/delivery/text.js +1 -1
- package/dist/gateway.d.ts +3 -1
- package/dist/gateway.js +49 -37
- package/dist/host/logger.d.ts +8 -0
- package/dist/host/logger.js +53 -0
- package/dist/index.js +11 -7
- package/dist/memory/prompt.d.ts +9 -0
- package/dist/memory/prompt.js +122 -0
- package/dist/opencode/adapter.d.ts +2 -0
- package/dist/opencode/adapter.js +56 -7
- package/dist/runtime/conversation-coordinator.d.ts +4 -0
- package/dist/runtime/conversation-coordinator.js +22 -0
- package/dist/runtime/executor.d.ts +34 -5
- package/dist/runtime/executor.js +241 -22
- package/dist/runtime/runtime-singleton.d.ts +2 -0
- package/dist/runtime/runtime-singleton.js +28 -0
- package/dist/session/context.d.ts +1 -1
- package/dist/session/context.js +2 -23
- package/dist/session/system-prompt.d.ts +8 -0
- package/dist/session/system-prompt.js +52 -0
- package/dist/store/migrations.js +15 -1
- package/dist/store/sqlite.d.ts +20 -2
- package/dist/store/sqlite.js +103 -4
- package/dist/tools/channel-target.d.ts +5 -0
- package/dist/tools/channel-target.js +6 -0
- package/dist/tools/cron-run.js +1 -1
- package/dist/tools/cron-upsert.d.ts +2 -1
- package/dist/tools/cron-upsert.js +20 -6
- package/dist/tools/{cron-list.d.ts → schedule-cancel.d.ts} +1 -1
- package/dist/tools/schedule-cancel.js +12 -0
- package/dist/tools/schedule-format.d.ts +4 -0
- package/dist/tools/schedule-format.js +48 -0
- package/dist/tools/{cron-remove.d.ts → schedule-list.d.ts} +1 -1
- package/dist/tools/schedule-list.js +17 -0
- package/dist/tools/schedule-once.d.ts +4 -0
- package/dist/tools/schedule-once.js +43 -0
- package/dist/tools/schedule-status.d.ts +3 -0
- package/dist/tools/schedule-status.js +23 -0
- package/generated/wasm/pkg/opencode_gateway_ffi_bg.wasm +0 -0
- package/package.json +4 -4
- package/dist/host/noop.d.ts +0 -4
- package/dist/host/noop.js +0 -14
- package/dist/tools/cron-list.js +0 -34
- package/dist/tools/cron-remove.js +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-gateway",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Gateway plugin for OpenCode",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
},
|
|
42
42
|
"repository": {
|
|
43
43
|
"type": "git",
|
|
44
|
-
"url": "git+https://github.com/M4n5ter/
|
|
44
|
+
"url": "git+https://github.com/M4n5ter/opencode-gateway.git",
|
|
45
45
|
"directory": "packages/opencode-plugin"
|
|
46
46
|
},
|
|
47
47
|
"bugs": {
|
|
48
|
-
"url": "https://github.com/M4n5ter/
|
|
48
|
+
"url": "https://github.com/M4n5ter/opencode-gateway/issues"
|
|
49
49
|
},
|
|
50
|
-
"homepage": "https://github.com/M4n5ter/
|
|
50
|
+
"homepage": "https://github.com/M4n5ter/opencode-gateway",
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
package/dist/host/noop.d.ts
DELETED
package/dist/host/noop.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export class ConsoleLoggerHost {
|
|
2
|
-
log(level, message) {
|
|
3
|
-
const line = `[gateway:${level}] ${message}`;
|
|
4
|
-
if (level === "error") {
|
|
5
|
-
console.error(line);
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
if (level === "warn") {
|
|
9
|
-
console.warn(line);
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
console.info(line);
|
|
13
|
-
}
|
|
14
|
-
}
|
package/dist/tools/cron-list.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { tool } from "@opencode-ai/plugin";
|
|
2
|
-
import { formatUnixMsAsUtc, formatUnixMsInTimeZone } from "./time";
|
|
3
|
-
export function createCronListTool(runtime) {
|
|
4
|
-
return tool({
|
|
5
|
-
description: "List persisted gateway cron jobs. Schedules use cron.timezone or the runtime local time zone.",
|
|
6
|
-
args: {},
|
|
7
|
-
async execute() {
|
|
8
|
-
const jobs = runtime.listJobs();
|
|
9
|
-
if (jobs.length === 0) {
|
|
10
|
-
return "no cron jobs";
|
|
11
|
-
}
|
|
12
|
-
return jobs.map((job) => formatCronJob(job, runtime.timeZone())).join("\n\n");
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
function formatCronJob(job, timeZone) {
|
|
17
|
-
return [
|
|
18
|
-
`id=${job.id}`,
|
|
19
|
-
`enabled=${job.enabled}`,
|
|
20
|
-
`schedule=${job.schedule}`,
|
|
21
|
-
`timezone=${timeZone}`,
|
|
22
|
-
`next_run_at_ms=${job.nextRunAtMs}`,
|
|
23
|
-
`next_run_at_local=${formatUnixMsInTimeZone(job.nextRunAtMs, timeZone)}`,
|
|
24
|
-
`next_run_at_utc=${formatUnixMsAsUtc(job.nextRunAtMs)}`,
|
|
25
|
-
`delivery=${formatDelivery(job.deliveryChannel, job.deliveryTarget, job.deliveryTopic)}`,
|
|
26
|
-
`prompt=${job.prompt}`,
|
|
27
|
-
].join("\n");
|
|
28
|
-
}
|
|
29
|
-
function formatDelivery(channel, target, topic) {
|
|
30
|
-
if (channel === null || target === null) {
|
|
31
|
-
return "none";
|
|
32
|
-
}
|
|
33
|
-
return topic === null ? `${channel}:${target}` : `${channel}:${target}:topic:${topic}`;
|
|
34
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { tool } from "@opencode-ai/plugin";
|
|
2
|
-
export function createCronRemoveTool(runtime) {
|
|
3
|
-
return tool({
|
|
4
|
-
description: "Remove a persisted gateway cron job",
|
|
5
|
-
args: {
|
|
6
|
-
id: tool.schema.string().min(1),
|
|
7
|
-
},
|
|
8
|
-
async execute(args) {
|
|
9
|
-
return runtime.removeJob(args.id) ? `removed=${args.id}` : `missing=${args.id}`;
|
|
10
|
-
},
|
|
11
|
-
});
|
|
12
|
-
}
|