orynacode-ai 1.16.5 → 1.16.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "1.16.5",
3
+ "version": "1.16.7",
4
4
  "name": "orynacode-ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -57,8 +57,6 @@ export function start() {
57
57
  stopped = false
58
58
  const url = process.env.ORYNA_GATE_URL || readAuthUrl()
59
59
  if (!url) return
60
- if (connecting) return
61
- connecting = true
62
60
 
63
61
  const host = new URL(url).host
64
62
  const user = os.userInfo().username || "user"
@@ -66,12 +64,15 @@ export function start() {
66
64
  const wsUrl = `ws://${host}/ws?token=${token}&name=orynacode`
67
65
 
68
66
  const connect = () => {
67
+ if (connecting) return
68
+ connecting = true
69
69
  const socket = new WebSocket(wsUrl)
70
70
  ws = socket
71
71
 
72
72
  socket.addEventListener("open", () => {
73
73
  startReplyWatch()
74
- setAgentStatus({ connected: true, processing: false, ready: false, url: host })
74
+ const s = agentStatus()
75
+ setAgentStatus({ connected: true, processing: false, ready: s.ready, url: host })
75
76
  heartbeatTimer = setInterval(() => {
76
77
  if (socket.readyState === WebSocket.OPEN) socket.send("__PING__")
77
78
  }, 30000)
@@ -89,15 +90,22 @@ export function start() {
89
90
  const from = msg.data?.from || "unknown"
90
91
  if (!content) return
91
92
 
92
- setTimeout(() => setAgentStatus({ connected: true, processing: true, ready: false, url: host }), 0)
93
+ setTimeout(() => {
94
+ const s = agentStatus()
95
+ setAgentStatus({ connected: true, processing: true, ready: s.ready, url: host })
96
+ }, 0)
93
97
  if (onMessage) await onMessage(content, from)
94
- setTimeout(() => setAgentStatus({ connected: true, processing: false, ready: false, url: host }), 0)
98
+ setTimeout(() => {
99
+ const s = agentStatus()
100
+ setAgentStatus({ connected: true, processing: false, ready: s.ready, url: host })
101
+ }, 0)
95
102
  } catch {}
96
103
  })
97
104
 
98
105
  socket.addEventListener("close", () => {
99
106
  connecting = false
100
- setAgentStatus({ connected: false, processing: false, ready: false, url: host })
107
+ const s = agentStatus()
108
+ setAgentStatus({ connected: false, processing: false, ready: s.ready, url: host })
101
109
  if (!stopped) reconnectTimer = setTimeout(connect, 3000)
102
110
  })
103
111
 
@@ -2,9 +2,11 @@ import { appendFileSync } from "fs"
2
2
 
3
3
  const FILE = `/tmp/oryna-reply-${process.pid}`
4
4
 
5
- export function sendReply(content: string) {
5
+ export function sendReply(content: string, to?: string) {
6
+ const args: Record<string, string> = { content }
7
+ if (to) args.to = to
6
8
  appendFileSync(
7
9
  FILE,
8
- JSON.stringify({ cmd: "reply", args: JSON.stringify({ content }) }) + "\n",
10
+ JSON.stringify({ cmd: "reply", args: JSON.stringify(args) }) + "\n",
9
11
  )
10
12
  }
package/src/tool/reply.ts CHANGED
@@ -6,6 +6,9 @@ export const Parameters = Schema.Struct({
6
6
  content: Schema.String.annotate({
7
7
  description: "The reply content to send back. Keep it concise.",
8
8
  }),
9
+ to: Schema.optional(Schema.String).annotate({
10
+ description: "The recipient to reply to. Must match the 'from' value in the collaboration message.",
11
+ }),
9
12
  })
10
13
 
11
14
  export const ReplyTool = Tool.define(
@@ -17,7 +20,7 @@ export const ReplyTool = Tool.define(
17
20
  parameters: Parameters,
18
21
  execute: (params: Schema.Schema.Type<typeof Parameters>, _ctx: Tool.Context) =>
19
22
  Effect.gen(function* () {
20
- sendReply(params.content)
23
+ sendReply(params.content, params.to)
21
24
  return {
22
25
  title: "Replied to collaboration message",
23
26
  output: "Reply sent successfully.",