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.
Files changed (60) hide show
  1. package/README.md +26 -0
  2. package/dist/binding/gateway.d.ts +2 -1
  3. package/dist/binding/index.d.ts +1 -1
  4. package/dist/cli/doctor.js +3 -1
  5. package/dist/cli/init.js +4 -1
  6. package/dist/cli/paths.js +1 -1
  7. package/dist/cli/templates.js +15 -0
  8. package/dist/cli.js +28 -4
  9. package/dist/config/gateway.d.ts +5 -0
  10. package/dist/config/gateway.js +6 -1
  11. package/dist/config/memory.d.ts +18 -0
  12. package/dist/config/memory.js +105 -0
  13. package/dist/config/paths.d.ts +2 -0
  14. package/dist/config/paths.js +5 -1
  15. package/dist/cron/runtime.d.ts +24 -5
  16. package/dist/cron/runtime.js +178 -13
  17. package/dist/delivery/text.js +1 -1
  18. package/dist/gateway.d.ts +3 -1
  19. package/dist/gateway.js +49 -37
  20. package/dist/host/logger.d.ts +8 -0
  21. package/dist/host/logger.js +53 -0
  22. package/dist/index.js +11 -7
  23. package/dist/memory/prompt.d.ts +9 -0
  24. package/dist/memory/prompt.js +122 -0
  25. package/dist/opencode/adapter.d.ts +2 -0
  26. package/dist/opencode/adapter.js +56 -7
  27. package/dist/runtime/conversation-coordinator.d.ts +4 -0
  28. package/dist/runtime/conversation-coordinator.js +22 -0
  29. package/dist/runtime/executor.d.ts +34 -5
  30. package/dist/runtime/executor.js +241 -22
  31. package/dist/runtime/runtime-singleton.d.ts +2 -0
  32. package/dist/runtime/runtime-singleton.js +28 -0
  33. package/dist/session/context.d.ts +1 -1
  34. package/dist/session/context.js +2 -23
  35. package/dist/session/system-prompt.d.ts +8 -0
  36. package/dist/session/system-prompt.js +52 -0
  37. package/dist/store/migrations.js +15 -1
  38. package/dist/store/sqlite.d.ts +20 -2
  39. package/dist/store/sqlite.js +103 -4
  40. package/dist/tools/channel-target.d.ts +5 -0
  41. package/dist/tools/channel-target.js +6 -0
  42. package/dist/tools/cron-run.js +1 -1
  43. package/dist/tools/cron-upsert.d.ts +2 -1
  44. package/dist/tools/cron-upsert.js +20 -6
  45. package/dist/tools/{cron-list.d.ts → schedule-cancel.d.ts} +1 -1
  46. package/dist/tools/schedule-cancel.js +12 -0
  47. package/dist/tools/schedule-format.d.ts +4 -0
  48. package/dist/tools/schedule-format.js +48 -0
  49. package/dist/tools/{cron-remove.d.ts → schedule-list.d.ts} +1 -1
  50. package/dist/tools/schedule-list.js +17 -0
  51. package/dist/tools/schedule-once.d.ts +4 -0
  52. package/dist/tools/schedule-once.js +43 -0
  53. package/dist/tools/schedule-status.d.ts +3 -0
  54. package/dist/tools/schedule-status.js +23 -0
  55. package/generated/wasm/pkg/opencode_gateway_ffi_bg.wasm +0 -0
  56. package/package.json +4 -4
  57. package/dist/host/noop.d.ts +0 -4
  58. package/dist/host/noop.js +0 -14
  59. package/dist/tools/cron-list.js +0 -34
  60. 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.1.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/aI.git",
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/aI/issues"
48
+ "url": "https://github.com/M4n5ter/opencode-gateway/issues"
49
49
  },
50
- "homepage": "https://github.com/M4n5ter/aI",
50
+ "homepage": "https://github.com/M4n5ter/opencode-gateway",
51
51
  "publishConfig": {
52
52
  "access": "public"
53
53
  },
@@ -1,4 +0,0 @@
1
- import type { BindingLoggerHost } from "../binding";
2
- export declare class ConsoleLoggerHost implements BindingLoggerHost {
3
- log(level: string, message: string): void;
4
- }
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
- }
@@ -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
- }