@unieai/rabi-client-ui-directory-picker-native 0.0.0-stage → 0.2.1-rc.3
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/LICENSE +21 -0
- package/README.md +7 -2
- package/lib/client.js +83 -0
- package/lib/index.js +12 -0
- package/lib/types/client/flow.d.ts +17 -0
- package/lib/types/client/index.d.ts +12 -0
- package/lib/types/index.d.ts +10 -0
- package/locale/en.json +5 -0
- package/locale/zh.json +6 -0
- package/package.json +42 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DeepSeek
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @unieai/rabi-client-ui-directory-picker-native
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Native directory-picker surface: the renderless workspace directory-flow occupant driving the local Desktop or Host OS chooser
|
|
4
|
+
|
|
5
|
+
Part of Rabi, the agent harness UnieAI Code runs on. Installed as a dependency of `@unieai/rabi`;
|
|
6
|
+
not meant to be used on its own.
|
|
7
|
+
|
|
8
|
+
See LICENSE for the license and copyright of this package.
|
package/lib/client.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "@unieai/rabi-client-ui-directory-picker-native",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
let react = require("react");
|
|
8
|
+
//#region lib/types/client/flow.js
|
|
9
|
+
/**
|
|
10
|
+
* The native picking occupant (package-internal; the `./client` surface
|
|
11
|
+
* exposes only the Loader exports). Same-package tests exercise it directly
|
|
12
|
+
* through this module.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Renderless flow occupant: each rising `open` edge runs exactly one pick and
|
|
16
|
+
* reports exactly one outcome; the ref arms once per open so re-renders (and
|
|
17
|
+
* an adoption keeping `open` true while `busy`) never launch a second
|
|
18
|
+
* chooser. The owner withdrawing `open` re-arms the next request.
|
|
19
|
+
* @param props - owner conversation plus the injected pick call.
|
|
20
|
+
* @returns nothing — the native chooser renders on the host display.
|
|
21
|
+
*/
|
|
22
|
+
function NativeDirectoryFlow(props) {
|
|
23
|
+
const { open, pick } = props;
|
|
24
|
+
const armed = (0, react.useRef)(false);
|
|
25
|
+
const outcome = (0, react.useRef)(props);
|
|
26
|
+
outcome.current = props;
|
|
27
|
+
const alive = (0, react.useRef)(true);
|
|
28
|
+
(0, react.useEffect)(() => {
|
|
29
|
+
alive.current = true;
|
|
30
|
+
return () => {
|
|
31
|
+
alive.current = false;
|
|
32
|
+
};
|
|
33
|
+
}, []);
|
|
34
|
+
(0, react.useEffect)(() => {
|
|
35
|
+
if (!open) {
|
|
36
|
+
armed.current = false;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (armed.current) return;
|
|
40
|
+
armed.current = true;
|
|
41
|
+
pick().then((path) => {
|
|
42
|
+
if (!alive.current) return;
|
|
43
|
+
if (path === null) outcome.current.onCancel();
|
|
44
|
+
else outcome.current.onPicked(path);
|
|
45
|
+
}, (reason) => {
|
|
46
|
+
if (!alive.current) return;
|
|
47
|
+
outcome.current.onError(reason instanceof Error ? reason.message : String(reason));
|
|
48
|
+
});
|
|
49
|
+
}, [open, pick]);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region lib/types/client/index.js
|
|
54
|
+
/** Required services (cordis fiber inject): the slot registry and workspace UI service. */
|
|
55
|
+
const inject = ["slots", "uiWorkspace"];
|
|
56
|
+
/**
|
|
57
|
+
* Client plugin body: register the renderless native flow into both
|
|
58
|
+
* directory-flow holes through `slots.inject()` because the ui-workspace
|
|
59
|
+
* entries may activate later or replace their declarations.
|
|
60
|
+
* @param ctx - client root context.
|
|
61
|
+
*/
|
|
62
|
+
function apply(ctx) {
|
|
63
|
+
const desktop = globalThis.__RABI_DIRECTORY_PICKER__;
|
|
64
|
+
const pick = desktop === void 0 ? () => ctx.uiWorkspace.pickDirectory() : () => desktop.pick();
|
|
65
|
+
const injected = () => ({ pick });
|
|
66
|
+
ctx.slots.inject("conversation.hero.workspace.directoryFlow", () => ctx.slots.inject("sidebar.workspaces.directoryFlow", function* () {
|
|
67
|
+
yield ctx.slots.register({
|
|
68
|
+
name: "conversation.hero.workspace.directoryFlow",
|
|
69
|
+
inject: injected
|
|
70
|
+
}, NativeDirectoryFlow);
|
|
71
|
+
yield ctx.slots.register({
|
|
72
|
+
name: "sidebar.workspaces.directoryFlow",
|
|
73
|
+
inject: injected
|
|
74
|
+
}, NativeDirectoryFlow);
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
exports.apply = apply;
|
|
79
|
+
exports.inject = inject;
|
|
80
|
+
return module.exports;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region lib/types/index.js
|
|
2
|
+
/**
|
|
3
|
+
* Native directory-picker surface, node half. Pure UI plugin: the empty apply
|
|
4
|
+
* exists so the plugin appears in the host cordis.yml / Loader; the browser
|
|
5
|
+
* half ships via exports["./client"], discovered through the package.json
|
|
6
|
+
* rabi.client declaration. The OS chooser it drives lives in
|
|
7
|
+
* `@unieai/rabi-host-directory-picker-native`.
|
|
8
|
+
*/
|
|
9
|
+
/** Host plugin body — no host-side behavior for this surface plugin. */
|
|
10
|
+
function apply() {}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { apply };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { DirectoryFlowOwnerProps } from '@unieai/rabi-client-ui-workspace/client';
|
|
3
|
+
/** Injected face: the native chooser call the flow drives (bound in apply's closure). */
|
|
4
|
+
export interface NativeFlowInjected {
|
|
5
|
+
/** Open the local desktop or Host single-directory chooser. */
|
|
6
|
+
pick: () => Promise<string | null>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Renderless flow occupant: each rising `open` edge runs exactly one pick and
|
|
10
|
+
* reports exactly one outcome; the ref arms once per open so re-renders (and
|
|
11
|
+
* an adoption keeping `open` true while `busy`) never launch a second
|
|
12
|
+
* chooser. The owner withdrawing `open` re-arms the next request.
|
|
13
|
+
* @param props - owner conversation plus the injected pick call.
|
|
14
|
+
* @returns nothing — the native chooser renders on the host display.
|
|
15
|
+
*/
|
|
16
|
+
export declare function NativeDirectoryFlow(props: DirectoryFlowOwnerProps & NativeFlowInjected): ReactElement | null;
|
|
17
|
+
//# sourceMappingURL=flow.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Native directory flow using the local desktop bridge or the Host's OS chooser. */
|
|
2
|
+
import type { Context as ClientContext } from '@unieai/cordis';
|
|
3
|
+
/** Required services (cordis fiber inject): the slot registry and workspace UI service. */
|
|
4
|
+
export declare const inject: string[];
|
|
5
|
+
/**
|
|
6
|
+
* Client plugin body: register the renderless native flow into both
|
|
7
|
+
* directory-flow holes through `slots.inject()` because the ui-workspace
|
|
8
|
+
* entries may activate later or replace their declarations.
|
|
9
|
+
* @param ctx - client root context.
|
|
10
|
+
*/
|
|
11
|
+
export declare function apply(ctx: ClientContext): void;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native directory-picker surface, node half. Pure UI plugin: the empty apply
|
|
3
|
+
* exists so the plugin appears in the host cordis.yml / Loader; the browser
|
|
4
|
+
* half ships via exports["./client"], discovered through the package.json
|
|
5
|
+
* rabi.client declaration. The OS chooser it drives lives in
|
|
6
|
+
* `@unieai/rabi-host-directory-picker-native`.
|
|
7
|
+
*/
|
|
8
|
+
/** Host plugin body — no host-side behavior for this surface plugin. */
|
|
9
|
+
export declare function apply(): void;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unieai/rabi-client-ui-directory-picker-native",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"description": "Native directory-picker surface: the renderless workspace directory-flow occupant driving the local Desktop or Host OS chooser",
|
|
4
|
+
"version": "0.2.1-rc.3",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "lib/index.js",
|
|
10
|
+
"types": "lib/types/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./lib/types/index.d.ts",
|
|
14
|
+
"default": "./lib/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./client": {
|
|
17
|
+
"types": "./lib/types/client/index.d.ts",
|
|
18
|
+
"default": "./lib/client.js"
|
|
19
|
+
},
|
|
20
|
+
"./src/*": "./src/*",
|
|
21
|
+
"./package.json": "./package.json",
|
|
22
|
+
"./locale/*.json": "./locale/*.json"
|
|
23
|
+
},
|
|
24
|
+
"rabi": {
|
|
25
|
+
"client": {
|
|
26
|
+
"inject": [
|
|
27
|
+
"@unieai/rabi-client-ui-renderer",
|
|
28
|
+
"@unieai/rabi-client-ui-workspace"
|
|
29
|
+
],
|
|
30
|
+
"platform": "web"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@unieai/cordis": "4.0.5"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"locale/*.json",
|
|
39
|
+
"lib/index.js",
|
|
40
|
+
"lib/client.js",
|
|
41
|
+
"lib/types/**/*.d.ts",
|
|
42
|
+
"README.md"
|
|
43
|
+
]
|
|
44
|
+
}
|