lumiverse-spindle-types 0.4.55 → 0.4.56
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 +1 -1
- package/src/api.ts +24 -0
- package/src/index.ts +1 -0
- package/src/spindle-api.ts +32 -0
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -1593,6 +1593,14 @@ export interface TokenCountResultDTO {
|
|
|
1593
1593
|
approximate: boolean;
|
|
1594
1594
|
}
|
|
1595
1595
|
|
|
1596
|
+
/** Context delivered to an on-request shared RPC endpoint handler. */
|
|
1597
|
+
export interface SharedRpcRequestContextDTO {
|
|
1598
|
+
/** Fully-qualified endpoint name (for example `weather_ext.status.current`). */
|
|
1599
|
+
endpoint: string;
|
|
1600
|
+
/** Identifier of the extension requesting the value. */
|
|
1601
|
+
requesterExtensionId: string;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1596
1604
|
// ─── Worker → Host messages ──────────────────────────────────────────────
|
|
1597
1605
|
|
|
1598
1606
|
export type WorkerToHost =
|
|
@@ -1675,6 +1683,16 @@ export type WorkerToHost =
|
|
|
1675
1683
|
reservationId: string;
|
|
1676
1684
|
}
|
|
1677
1685
|
| { type: "permissions_get_granted"; requestId: string }
|
|
1686
|
+
| { type: "rpc_pool_sync"; endpoint: string; value: unknown }
|
|
1687
|
+
| { type: "rpc_pool_register_handler"; endpoint: string }
|
|
1688
|
+
| { type: "rpc_pool_unregister"; endpoint: string }
|
|
1689
|
+
| { type: "rpc_pool_read"; requestId: string; endpoint: string }
|
|
1690
|
+
| {
|
|
1691
|
+
type: "rpc_pool_handler_result";
|
|
1692
|
+
requestId: string;
|
|
1693
|
+
result?: unknown;
|
|
1694
|
+
error?: string;
|
|
1695
|
+
}
|
|
1678
1696
|
| { type: "connections_list"; requestId: string; userId?: string }
|
|
1679
1697
|
| { type: "connections_get"; requestId: string; connectionId: string; userId?: string }
|
|
1680
1698
|
| { type: "chat_get_messages"; requestId: string; chatId: string }
|
|
@@ -2010,6 +2028,12 @@ export type WorkerToHost =
|
|
|
2010
2028
|
export type HostToWorker =
|
|
2011
2029
|
| { type: "init"; manifest: SpindleManifest; storagePath: string }
|
|
2012
2030
|
| { type: "event"; event: string; payload: unknown; userId?: string }
|
|
2031
|
+
| {
|
|
2032
|
+
type: "rpc_pool_request";
|
|
2033
|
+
requestId: string;
|
|
2034
|
+
endpoint: string;
|
|
2035
|
+
requesterExtensionId: string;
|
|
2036
|
+
}
|
|
2013
2037
|
| {
|
|
2014
2038
|
type: "intercept_request";
|
|
2015
2039
|
requestId: string;
|
package/src/index.ts
CHANGED
package/src/spindle-api.ts
CHANGED
|
@@ -83,6 +83,7 @@ import type {
|
|
|
83
83
|
MacroInterceptorResultDTO,
|
|
84
84
|
MessageContentProcessorCtxDTO,
|
|
85
85
|
MessageContentProcessorResultDTO,
|
|
86
|
+
SharedRpcRequestContextDTO,
|
|
86
87
|
} from "./api";
|
|
87
88
|
|
|
88
89
|
export interface FrontendProcessHandle {
|
|
@@ -816,6 +817,37 @@ export interface SpindleAPI {
|
|
|
816
817
|
onChanged(handler: (detail: PermissionChangedDetail) => void): () => void;
|
|
817
818
|
};
|
|
818
819
|
|
|
820
|
+
/**
|
|
821
|
+
* Shared RPC pool (free tier).
|
|
822
|
+
*
|
|
823
|
+
* Use this to expose lightweight cross-extension state behind a stable
|
|
824
|
+
* `<extension_id>.<channel>` endpoint. Owner methods accept either the bare
|
|
825
|
+
* channel suffix (`status.current`) or the fully-qualified endpoint.
|
|
826
|
+
*/
|
|
827
|
+
rpcPool: {
|
|
828
|
+
/**
|
|
829
|
+
* Publish the latest value for an endpoint. Replaces any previous on-demand
|
|
830
|
+
* handler for the same endpoint.
|
|
831
|
+
*
|
|
832
|
+
* Returns the fully-qualified endpoint name.
|
|
833
|
+
*/
|
|
834
|
+
sync(endpoint: string, value: unknown): string;
|
|
835
|
+
/**
|
|
836
|
+
* Register an on-demand endpoint handler. Replaces any previously synced
|
|
837
|
+
* value or handler for the same endpoint.
|
|
838
|
+
*
|
|
839
|
+
* Returns the fully-qualified endpoint name.
|
|
840
|
+
*/
|
|
841
|
+
handle(
|
|
842
|
+
endpoint: string,
|
|
843
|
+
handler: (ctx: SharedRpcRequestContextDTO) => unknown | Promise<unknown>
|
|
844
|
+
): string;
|
|
845
|
+
/** Read the latest value from another extension's fully-qualified endpoint. */
|
|
846
|
+
read<T = unknown>(endpoint: string): Promise<T>;
|
|
847
|
+
/** Remove an endpoint owned by this extension. */
|
|
848
|
+
unregister(endpoint: string): void;
|
|
849
|
+
};
|
|
850
|
+
|
|
819
851
|
/** Make a CORS-proxied HTTP request */
|
|
820
852
|
cors(url: string, options?: RequestInitDTO): Promise<unknown>;
|
|
821
853
|
|