opencode-gateway 0.2.3 → 0.2.5

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 (79) hide show
  1. package/dist/cli.js +0 -0
  2. package/dist/index.js +36910 -56
  3. package/dist/runtime/delay.d.ts +1 -0
  4. package/dist/store/database.d.ts +22 -0
  5. package/dist/store/migrations.d.ts +2 -2
  6. package/dist/store/sqlite.d.ts +2 -2
  7. package/package.json +9 -3
  8. package/dist/binding/execution.js +0 -1
  9. package/dist/binding/gateway.js +0 -1
  10. package/dist/binding/index.js +0 -4
  11. package/dist/binding/opencode.js +0 -1
  12. package/dist/cli/args.js +0 -53
  13. package/dist/cli/doctor.js +0 -49
  14. package/dist/cli/init.js +0 -40
  15. package/dist/cli/opencode-config-file.js +0 -18
  16. package/dist/cli/opencode-config.js +0 -194
  17. package/dist/cli/paths.js +0 -22
  18. package/dist/cli/templates.js +0 -41
  19. package/dist/config/cron.js +0 -52
  20. package/dist/config/gateway.js +0 -148
  21. package/dist/config/memory.js +0 -105
  22. package/dist/config/paths.js +0 -39
  23. package/dist/config/telegram.js +0 -91
  24. package/dist/cron/runtime.js +0 -402
  25. package/dist/delivery/telegram.js +0 -75
  26. package/dist/delivery/text.js +0 -175
  27. package/dist/gateway.js +0 -117
  28. package/dist/host/file-sender.js +0 -59
  29. package/dist/host/logger.js +0 -53
  30. package/dist/host/transport.js +0 -35
  31. package/dist/mailbox/router.js +0 -16
  32. package/dist/media/mime.js +0 -45
  33. package/dist/memory/prompt.js +0 -122
  34. package/dist/opencode/adapter.js +0 -340
  35. package/dist/opencode/driver-hub.js +0 -82
  36. package/dist/opencode/event-normalize.js +0 -48
  37. package/dist/opencode/event-stream.js +0 -65
  38. package/dist/opencode/events.js +0 -1
  39. package/dist/questions/client.js +0 -36
  40. package/dist/questions/format.js +0 -36
  41. package/dist/questions/normalize.js +0 -45
  42. package/dist/questions/parser.js +0 -96
  43. package/dist/questions/runtime.js +0 -195
  44. package/dist/questions/types.js +0 -1
  45. package/dist/runtime/attachments.js +0 -12
  46. package/dist/runtime/conversation-coordinator.js +0 -22
  47. package/dist/runtime/executor.js +0 -407
  48. package/dist/runtime/mailbox.js +0 -112
  49. package/dist/runtime/opencode-runner.js +0 -79
  50. package/dist/runtime/runtime-singleton.js +0 -28
  51. package/dist/session/context.js +0 -23
  52. package/dist/session/conversation-key.js +0 -3
  53. package/dist/session/switcher.js +0 -59
  54. package/dist/session/system-prompt.js +0 -52
  55. package/dist/store/migrations.js +0 -197
  56. package/dist/store/sqlite.js +0 -777
  57. package/dist/telegram/client.js +0 -180
  58. package/dist/telegram/media.js +0 -65
  59. package/dist/telegram/normalize.js +0 -119
  60. package/dist/telegram/poller.js +0 -166
  61. package/dist/telegram/runtime.js +0 -157
  62. package/dist/telegram/state.js +0 -149
  63. package/dist/telegram/types.js +0 -1
  64. package/dist/tools/channel-new-session.js +0 -27
  65. package/dist/tools/channel-send-file.js +0 -27
  66. package/dist/tools/channel-target.js +0 -34
  67. package/dist/tools/cron-run.js +0 -20
  68. package/dist/tools/cron-upsert.js +0 -51
  69. package/dist/tools/gateway-dispatch-cron.js +0 -33
  70. package/dist/tools/gateway-status.js +0 -25
  71. package/dist/tools/schedule-cancel.js +0 -12
  72. package/dist/tools/schedule-format.js +0 -48
  73. package/dist/tools/schedule-list.js +0 -17
  74. package/dist/tools/schedule-once.js +0 -43
  75. package/dist/tools/schedule-status.js +0 -23
  76. package/dist/tools/telegram-send-test.js +0 -26
  77. package/dist/tools/telegram-status.js +0 -49
  78. package/dist/tools/time.js +0 -25
  79. package/dist/utils/error.js +0 -57
@@ -1,57 +0,0 @@
1
- export function formatError(error) {
2
- if (error instanceof Error) {
3
- const errorLike = error;
4
- const nestedMessage = extractNestedDataMessage(errorLike.data);
5
- if (nestedMessage !== null) {
6
- return nestedMessage;
7
- }
8
- return error.message;
9
- }
10
- if (typeof error === "string") {
11
- return error;
12
- }
13
- if (typeof error === "object" && error !== null) {
14
- const errorLike = error;
15
- const nestedMessage = extractNestedDataMessage(errorLike.data);
16
- if (nestedMessage !== null) {
17
- return nestedMessage;
18
- }
19
- if (typeof errorLike.message === "string" && errorLike.message.length > 0) {
20
- const detail = compactObject({
21
- name: errorLike.name,
22
- code: errorLike.code,
23
- status: errorLike.status,
24
- cause: errorLike.cause,
25
- });
26
- return detail === null ? errorLike.message : `${errorLike.message} (${detail})`;
27
- }
28
- const serialized = safeJsonStringify(error);
29
- if (serialized !== null) {
30
- return serialized;
31
- }
32
- }
33
- return String(error);
34
- }
35
- function extractNestedDataMessage(value) {
36
- if (typeof value !== "object" || value === null) {
37
- return null;
38
- }
39
- const message = value.message;
40
- return typeof message === "string" && message.length > 0 ? message : null;
41
- }
42
- function compactObject(value) {
43
- const entries = Object.entries(value).filter(([, fieldValue]) => fieldValue !== undefined && fieldValue !== null);
44
- if (entries.length === 0) {
45
- return null;
46
- }
47
- const serialized = safeJsonStringify(Object.fromEntries(entries));
48
- return serialized ?? entries.map(([key, fieldValue]) => `${key}=${String(fieldValue)}`).join(", ");
49
- }
50
- function safeJsonStringify(value) {
51
- try {
52
- return JSON.stringify(value);
53
- }
54
- catch {
55
- return null;
56
- }
57
- }