@oh-my-pi/pi-coding-agent 3.4.1337 → 3.6.1337

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.
@@ -11,6 +11,7 @@
11
11
  * - Hook UI: Hook UI requests are emitted, client responds with hook_ui_response
12
12
  */
13
13
 
14
+ import { nanoid } from "nanoid";
14
15
  import type { AgentSession } from "../../core/agent-session";
15
16
  import type { HookUIContext } from "../../core/hooks/index";
16
17
  import { logger } from "../../core/logger";
@@ -52,7 +53,7 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
52
53
  */
53
54
  const createHookUIContext = (): HookUIContext => ({
54
55
  async select(title: string, options: string[]): Promise<string | undefined> {
55
- const id = crypto.randomUUID();
56
+ const id = nanoid();
56
57
  return new Promise((resolve, reject) => {
57
58
  pendingHookRequests.set(id, {
58
59
  resolve: (response: RpcHookUIResponse) => {
@@ -71,7 +72,7 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
71
72
  },
72
73
 
73
74
  async confirm(title: string, message: string): Promise<boolean> {
74
- const id = crypto.randomUUID();
75
+ const id = nanoid();
75
76
  return new Promise((resolve, reject) => {
76
77
  pendingHookRequests.set(id, {
77
78
  resolve: (response: RpcHookUIResponse) => {
@@ -90,7 +91,7 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
90
91
  },
91
92
 
92
93
  async input(title: string, placeholder?: string): Promise<string | undefined> {
93
- const id = crypto.randomUUID();
94
+ const id = nanoid();
94
95
  return new Promise((resolve, reject) => {
95
96
  pendingHookRequests.set(id, {
96
97
  resolve: (response: RpcHookUIResponse) => {
@@ -112,7 +113,7 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
112
113
  // Fire and forget - no response needed
113
114
  output({
114
115
  type: "hook_ui_request",
115
- id: crypto.randomUUID(),
116
+ id: nanoid(),
116
117
  method: "notify",
117
118
  message,
118
119
  notifyType: type,
@@ -123,7 +124,7 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
123
124
  // Fire and forget - no response needed
124
125
  output({
125
126
  type: "hook_ui_request",
126
- id: crypto.randomUUID(),
127
+ id: nanoid(),
127
128
  method: "setStatus",
128
129
  statusKey: key,
129
130
  statusText: text,
@@ -139,7 +140,7 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
139
140
  // Fire and forget - host can implement editor control
140
141
  output({
141
142
  type: "hook_ui_request",
142
- id: crypto.randomUUID(),
143
+ id: nanoid(),
143
144
  method: "set_editor_text",
144
145
  text,
145
146
  } as RpcHookUIRequest);
@@ -152,7 +153,7 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
152
153
  },
153
154
 
154
155
  async editor(title: string, prefill?: string): Promise<string | undefined> {
155
- const id = crypto.randomUUID();
156
+ const id = nanoid();
156
157
  return new Promise((resolve, reject) => {
157
158
  pendingHookRequests.set(id, {
158
159
  resolve: (response: RpcHookUIResponse) => {