@sayknow-cli/natives 0.4.3 → 0.4.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.
- package/native/index.d.ts +140 -21
- package/native/index.js +1 -1
- package/package.json +6 -6
package/native/index.d.ts
CHANGED
|
@@ -120,16 +120,32 @@ export declare class NotificationServer {
|
|
|
120
120
|
* Create a server for `session_id` authenticated by `token`.
|
|
121
121
|
*
|
|
122
122
|
* `state_root` (when given) is where the endpoint discovery file is written
|
|
123
|
-
* (e.g. `<repo>/.
|
|
123
|
+
* (e.g. `<repo>/.gjc/state`). `resolver_available` defaults to `true`.
|
|
124
124
|
*/
|
|
125
125
|
constructor(sessionId: string, token: string, stateRoot?: string | undefined | null, resolverAvailable?: boolean | undefined | null)
|
|
126
126
|
/** Register the reply callback. Must be called before [`Self::start`]. */
|
|
127
127
|
onReply(callback: (err: null | Error, reply: ReplyEvent) => void): void
|
|
128
128
|
/**
|
|
129
|
-
* Register the inbound-message callback (free-text
|
|
130
|
-
*
|
|
129
|
+
* Register the authenticated inbound-message callback (free-text,
|
|
130
|
+
* side-question request/cancel, and in-thread config/control commands).
|
|
131
|
+
* Must be called before [`Self::start`].
|
|
131
132
|
*/
|
|
132
133
|
onInbound(callback: (err: null | Error, msg: InboundEvent) => void): void
|
|
134
|
+
/**
|
|
135
|
+
* Register the raw v3 SDK frame callback. Must be called before
|
|
136
|
+
* [`Self::start`].
|
|
137
|
+
*/
|
|
138
|
+
onSdkFrame(callback: (err: null | Error, frame: SdkFrameEvent) => void): void
|
|
139
|
+
/**
|
|
140
|
+
* Register the negotiated-capabilities callback. Must be called before
|
|
141
|
+
* [`Self::start`].
|
|
142
|
+
*/
|
|
143
|
+
onNegotiatedCapabilities(callback: (err: null | Error, connectionId: string, capabilities: string[]) => void): void
|
|
144
|
+
/**
|
|
145
|
+
* Register the connection-close callback. Must be called before
|
|
146
|
+
* [`Self::start`].
|
|
147
|
+
*/
|
|
148
|
+
onConnectionClose(callback: (err: null | Error, connectionId: string) => void): void
|
|
133
149
|
/**
|
|
134
150
|
* Bind the loopback endpoint and start serving. Resolves with the bound
|
|
135
151
|
* endpoint info once the socket is bound.
|
|
@@ -141,12 +157,32 @@ export declare class NotificationServer {
|
|
|
141
157
|
/**
|
|
142
158
|
* Broadcast an `action_needed` ask. `needed_json` is a JSON `ActionNeeded`.
|
|
143
159
|
*
|
|
144
|
-
* `repliable` should be `true` only
|
|
160
|
+
* `repliable` should be `true` only when an SDK workflow-gate resolver is
|
|
161
|
+
* available.
|
|
145
162
|
*
|
|
146
163
|
* # Errors
|
|
147
164
|
* Fails if not started or `needed_json` is invalid.
|
|
148
165
|
*/
|
|
149
166
|
registerAsk(neededJson: string, repliable: boolean): void
|
|
167
|
+
/**
|
|
168
|
+
* Register a correlated workflow-gate ask. `workflow_json` must be an
|
|
169
|
+
* `action_needed` wire frame carrying a nonempty `workflowGateId`.
|
|
170
|
+
*/
|
|
171
|
+
registerWorkflowGateAsk(workflowJson: string, repliable: boolean): void
|
|
172
|
+
/**
|
|
173
|
+
* Register an ask and return an opaque in-process capability. Pass it
|
|
174
|
+
* unchanged to [`Self::retire_if_unclaimed`]; do not construct, persist,
|
|
175
|
+
* inspect, or treat it as workflow-gate authority. A supplied
|
|
176
|
+
* `workflowGateId` is preserved.
|
|
177
|
+
*/
|
|
178
|
+
registerArbitratedAsk(neededJson: string, repliable: boolean): PresentationLease
|
|
179
|
+
/**
|
|
180
|
+
* Atomically terminalize the exact presentation named by an opaque lease.
|
|
181
|
+
* The typed status proves whether it retired, was already terminal, was
|
|
182
|
+
* claimed, or became stale without exposing claims, receipts, registration
|
|
183
|
+
* state, or workflow-gate authority.
|
|
184
|
+
*/
|
|
185
|
+
retireIfUnclaimed(lease: PresentationLease): RetireIfUnclaimedResult
|
|
150
186
|
/**
|
|
151
187
|
* Broadcast an ephemeral `action_needed` idle ping. `needed_json` is JSON
|
|
152
188
|
* `ActionNeeded`.
|
|
@@ -158,13 +194,31 @@ export declare class NotificationServer {
|
|
|
158
194
|
/**
|
|
159
195
|
* Broadcast an ephemeral threaded-session frame. `frame_json` is a JSON
|
|
160
196
|
* `ServerMessage` (e.g. `identity_header`, `context_update`, `turn_stream`,
|
|
161
|
-
* `
|
|
162
|
-
* buffered for replay.
|
|
197
|
+
* `ephemeral_turn_result`, `image_attachment`, `session_closed`,
|
|
198
|
+
* `config_update`, `hello`). Not buffered for replay.
|
|
163
199
|
*
|
|
164
200
|
* # Errors
|
|
165
201
|
* Fails if not started or `frame_json` is not a valid `ServerMessage`.
|
|
166
202
|
*/
|
|
167
203
|
pushFrame(frameJson: string): void
|
|
204
|
+
/**
|
|
205
|
+
* Broadcast a TypeScript-constructed turn frame without re-parsing JSON.
|
|
206
|
+
* External frames must continue through [`Self::push_frame`] for serde
|
|
207
|
+
* validation.
|
|
208
|
+
*/
|
|
209
|
+
pushTurnStreamUnchecked(sessionId: string, phase: string, text: string, finalAnswer?: boolean | undefined | null, messageRef?: string | undefined | null): void
|
|
210
|
+
/**
|
|
211
|
+
* Broadcast a file attachment from raw N-API bytes, encoding the unchanged
|
|
212
|
+
* base64 wire field only in Rust.
|
|
213
|
+
*/
|
|
214
|
+
pushFileAttachmentUnchecked(sessionId: string, name: string, mime: string | undefined | null, data: Buffer, caption?: string | undefined | null): void
|
|
215
|
+
/**
|
|
216
|
+
* Return counters guarding the known-good frame crossing against
|
|
217
|
+
* regressions.
|
|
218
|
+
*/
|
|
219
|
+
knownGoodFrameStats(): KnownGoodFrameStats
|
|
220
|
+
/** Send a validated, bounded JSON envelope to one connected v3 SDK client. */
|
|
221
|
+
sendTo(connectionId: string, json: string): void
|
|
168
222
|
/**
|
|
169
223
|
* Publish a replayable `session_ready` readiness signal. `ready_json` is a
|
|
170
224
|
* JSON `SessionReady`. Unlike [`Self::push_frame`], this frame is buffered
|
|
@@ -177,11 +231,10 @@ export declare class NotificationServer {
|
|
|
177
231
|
*/
|
|
178
232
|
pushSessionReady(readyJson: string): void
|
|
179
233
|
/**
|
|
180
|
-
* Resolve
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* Fails if not started or `answer_json` is invalid.
|
|
234
|
+
* Resolve a legacy/non-arbitrated action locally (the CLI/TUI answered).
|
|
235
|
+
* Arbitrated presentations require their opaque exact lease to be passed to
|
|
236
|
+
* [`Self::retire_if_unclaimed`], so an id-only local resolution fails
|
|
237
|
+
* closed.
|
|
185
238
|
*/
|
|
186
239
|
resolveLocal(id: string, answerJson?: string | undefined | null): void
|
|
187
240
|
/**
|
|
@@ -219,7 +272,7 @@ export declare class NotificationServer {
|
|
|
219
272
|
*/
|
|
220
273
|
reject(id: string, reason?: string | undefined | null): void
|
|
221
274
|
/**
|
|
222
|
-
* Update whether the
|
|
275
|
+
* Update whether the SDK workflow-gate resolver is currently available.
|
|
223
276
|
*
|
|
224
277
|
* # Errors
|
|
225
278
|
* Fails if not started.
|
|
@@ -229,6 +282,8 @@ export declare class NotificationServer {
|
|
|
229
282
|
clientCount(): number
|
|
230
283
|
/** Stop the server (idempotent) and remove the endpoint discovery file. */
|
|
231
284
|
stop(): void
|
|
285
|
+
/** Stop the server and resolve only after all native socket owners exit. */
|
|
286
|
+
stopAndWait(): Promise<void>
|
|
232
287
|
}
|
|
233
288
|
|
|
234
289
|
/** Stable process reference. */
|
|
@@ -406,7 +461,7 @@ export declare class Shell {
|
|
|
406
461
|
* `packages/natives/native/index.js` (which derives the name from
|
|
407
462
|
* `package.json#version`).
|
|
408
463
|
*/
|
|
409
|
-
export declare function
|
|
464
|
+
export declare function __piNativesV0_4_5(): void
|
|
410
465
|
|
|
411
466
|
/**
|
|
412
467
|
* Apply conservative pre-execution rewrites to a bash command.
|
|
@@ -1134,26 +1189,51 @@ export interface HtmlToMarkdownOptions {
|
|
|
1134
1189
|
}
|
|
1135
1190
|
|
|
1136
1191
|
/**
|
|
1137
|
-
* An inbound message forwarded to the TypeScript host:
|
|
1138
|
-
* in-thread config command,
|
|
1192
|
+
* An authenticated inbound message forwarded to the TypeScript host: free-text
|
|
1193
|
+
* injection, ephemeral side-question request/cancel, in-thread config command,
|
|
1194
|
+
* or deterministic control command.
|
|
1139
1195
|
*/
|
|
1140
1196
|
export interface InboundEvent {
|
|
1141
|
-
/**
|
|
1197
|
+
/**
|
|
1198
|
+
* Inbound kind (`user_message`, `ephemeral_turn`,
|
|
1199
|
+
* `ephemeral_turn_cancel`, `config_command`, or `control_command`).
|
|
1200
|
+
*/
|
|
1142
1201
|
kind: string
|
|
1202
|
+
/**
|
|
1203
|
+
* Server-authenticated identity of the WebSocket connection that delivered
|
|
1204
|
+
* this event.
|
|
1205
|
+
*/
|
|
1206
|
+
connectionId: string
|
|
1143
1207
|
/** The session this inbound belongs to. */
|
|
1144
1208
|
sessionId: string
|
|
1145
|
-
/** Free-text body (`user_message` only). */
|
|
1209
|
+
/** Free-text body (`user_message` or `ephemeral_turn` only). */
|
|
1146
1210
|
text?: string
|
|
1147
|
-
/**
|
|
1211
|
+
/**
|
|
1212
|
+
* Telegram update id for dedupe (`user_message`, `ephemeral_turn`, or
|
|
1213
|
+
* `ephemeral_turn_cancel` only).
|
|
1214
|
+
*/
|
|
1148
1215
|
updateId?: number
|
|
1149
|
-
/**
|
|
1216
|
+
/**
|
|
1217
|
+
* Originating thread/topic id (`user_message`, `ephemeral_turn`, or
|
|
1218
|
+
* `ephemeral_turn_cancel` only).
|
|
1219
|
+
*/
|
|
1150
1220
|
threadId?: string
|
|
1221
|
+
/**
|
|
1222
|
+
* Originating Telegram message id (`ephemeral_turn` and
|
|
1223
|
+
* `ephemeral_turn_cancel` only).
|
|
1224
|
+
*/
|
|
1225
|
+
messageId?: number
|
|
1151
1226
|
/** Requested verbosity `"lean"|"verbose"` (`config_command` only). */
|
|
1152
1227
|
verbosity?: string
|
|
1153
1228
|
/** Requested redaction state (`config_command` only). */
|
|
1154
1229
|
redact?: boolean
|
|
1155
|
-
/**
|
|
1230
|
+
/**
|
|
1231
|
+
* Client-generated request id (`ephemeral_turn`, `ephemeral_turn_cancel`,
|
|
1232
|
+
* or `control_command` only).
|
|
1233
|
+
*/
|
|
1156
1234
|
requestId?: string
|
|
1235
|
+
/** Cancellation reason (`ephemeral_turn_cancel` only). */
|
|
1236
|
+
reason?: string
|
|
1157
1237
|
/** JSON-encoded command payload (`control_command` only). */
|
|
1158
1238
|
commandJson?: string
|
|
1159
1239
|
/**
|
|
@@ -1305,6 +1385,19 @@ export declare enum KeyEventType {
|
|
|
1305
1385
|
Release = 3
|
|
1306
1386
|
}
|
|
1307
1387
|
|
|
1388
|
+
/** Observable counters for the internal known-good N-API frame lane. */
|
|
1389
|
+
export interface KnownGoodFrameStats {
|
|
1390
|
+
/** Frames constructed as `TurnStream` without parsing a JSON string. */
|
|
1391
|
+
knownGoodTurnStreamFrames: number
|
|
1392
|
+
/** JSON serde parses of externally supplied `turn_stream` frames. */
|
|
1393
|
+
turnStreamSerdeValidationParses: number
|
|
1394
|
+
/**
|
|
1395
|
+
* Base64 characters encoded in Rust for `file_attachment` frames (the JS
|
|
1396
|
+
* side crosses raw `Buffer` bytes and never allocates the base64 string).
|
|
1397
|
+
*/
|
|
1398
|
+
fileAttachmentRustBase64Chars: number
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1308
1401
|
/** A lifecycle request forwarded to the TypeScript daemon for orchestration. */
|
|
1309
1402
|
export interface LifecycleRequestEvent {
|
|
1310
1403
|
/** One of `"session_create"`, `"session_close"`, `"session_resume"`. */
|
|
@@ -1751,6 +1844,18 @@ export declare function parseKey(data: string, kittyProtocolActive: boolean): st
|
|
|
1751
1844
|
*/
|
|
1752
1845
|
export declare function parseKittySequence(data: string): ParsedKittyResult | null
|
|
1753
1846
|
|
|
1847
|
+
/**
|
|
1848
|
+
* Opaque in-process presentation capability.
|
|
1849
|
+
*
|
|
1850
|
+
* Returned by [`NotificationServer::register_arbitrated_ask`]. Pass it
|
|
1851
|
+
* unchanged to [`NotificationServer::retire_if_unclaimed`]; do not construct,
|
|
1852
|
+
* persist, inspect, or treat it as workflow-gate authority.
|
|
1853
|
+
*/
|
|
1854
|
+
export interface PresentationLease {
|
|
1855
|
+
actionId: string
|
|
1856
|
+
registrationEpoch: number
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1754
1859
|
/** Current state of a process reference. */
|
|
1755
1860
|
export declare enum ProcessStatus {
|
|
1756
1861
|
/** The referenced process is still running. */
|
|
@@ -1847,7 +1952,10 @@ export declare function renameNoReplacePath(sourcePath: string, destinationPath:
|
|
|
1847
1952
|
|
|
1848
1953
|
/** A client reply forwarded to the TypeScript host for gate resolution. */
|
|
1849
1954
|
export interface ReplyEvent {
|
|
1850
|
-
/**
|
|
1955
|
+
/**
|
|
1956
|
+
* The transient action/presentation id being answered. This is not the
|
|
1957
|
+
* durable workflow gate id.
|
|
1958
|
+
*/
|
|
1851
1959
|
id: string
|
|
1852
1960
|
/** JSON-encoded `ReplyAnswer` (number, string, or `{selected,custom}`). */
|
|
1853
1961
|
answerJson: string
|
|
@@ -1863,6 +1971,17 @@ export interface ReplyEvent {
|
|
|
1863
1971
|
*/
|
|
1864
1972
|
export declare function retainBrokerPublication(agentDir: string): NativeRetainedBrokerPublication
|
|
1865
1973
|
|
|
1974
|
+
/** Public status of exact direct retirement. Claims and receipts remain native. */
|
|
1975
|
+
export interface RetireIfUnclaimedResult {
|
|
1976
|
+
status: 'retired' | 'already_terminal' | 'claimed' | 'stale'
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
/** A raw v3 SDK frame paired with its actual WebSocket connection id. */
|
|
1980
|
+
export interface SdkFrameEvent {
|
|
1981
|
+
connectionId: string
|
|
1982
|
+
json: string
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1866
1985
|
/**
|
|
1867
1986
|
* Search content for a pattern (one-shot, compiles pattern each time).
|
|
1868
1987
|
* For repeated searches with the same pattern, use [`grep`] with file filters.
|
package/native/index.js
CHANGED
|
@@ -29,7 +29,7 @@ export const RecoveryFsRoot = nativeBindings.RecoveryFsRoot;
|
|
|
29
29
|
export const Shell = nativeBindings.Shell;
|
|
30
30
|
|
|
31
31
|
// functions
|
|
32
|
-
export const
|
|
32
|
+
export const __piNativesV0_4_5 = nativeBindings.__piNativesV0_4_5;
|
|
33
33
|
export const applyBashFixups = nativeBindings.applyBashFixups;
|
|
34
34
|
export const applyOwnerOnlyFdSecurity = nativeBindings.applyOwnerOnlyFdSecurity;
|
|
35
35
|
export const applyOwnerOnlyPathSecurity = nativeBindings.applyOwnerOnlyPathSecurity;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sayknow-cli/natives",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "Native Rust bindings for grep, clipboard, image processing, syntax highlighting, PTY, and shell operations via N-API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://sayknow-cli.com",
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"README.md"
|
|
62
62
|
],
|
|
63
63
|
"optionalDependencies": {
|
|
64
|
-
"@sayknow-cli/natives-darwin-arm64": "0.4.
|
|
65
|
-
"@sayknow-cli/natives-darwin-x64": "0.4.
|
|
66
|
-
"@sayknow-cli/natives-linux-arm64": "0.4.
|
|
67
|
-
"@sayknow-cli/natives-linux-x64": "0.4.
|
|
68
|
-
"@sayknow-cli/natives-win32-x64": "0.4.
|
|
64
|
+
"@sayknow-cli/natives-darwin-arm64": "0.4.5",
|
|
65
|
+
"@sayknow-cli/natives-darwin-x64": "0.4.5",
|
|
66
|
+
"@sayknow-cli/natives-linux-arm64": "0.4.5",
|
|
67
|
+
"@sayknow-cli/natives-linux-x64": "0.4.5",
|
|
68
|
+
"@sayknow-cli/natives-win32-x64": "0.4.5"
|
|
69
69
|
},
|
|
70
70
|
"exports": {
|
|
71
71
|
".": {
|