@mirrowel/opencode-openshare 0.0.0-stage → 0.1.1

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.
Files changed (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +181 -2
  3. package/ci/README.md +56 -0
  4. package/ci/openshare.config.json +10 -0
  5. package/ci/openshare.js +2270 -0
  6. package/dist/commands.d.ts +7 -0
  7. package/dist/commands.js +440 -0
  8. package/dist/config.d.ts +138 -0
  9. package/dist/config.js +524 -0
  10. package/dist/core.d.ts +117 -0
  11. package/dist/core.js +1944 -0
  12. package/dist/dialogs.d.ts +94 -0
  13. package/dist/dialogs.js +725 -0
  14. package/dist/server.d.ts +64 -0
  15. package/dist/server.js +30 -0
  16. package/dist/settings.d.ts +24 -0
  17. package/dist/settings.js +1226 -0
  18. package/dist/share-flow.d.ts +287 -0
  19. package/dist/share-flow.js +516 -0
  20. package/dist/sidebar.d.ts +19 -0
  21. package/dist/sidebar.js +144 -0
  22. package/dist/tui-host.d.ts +158 -0
  23. package/dist/tui-host.js +6 -0
  24. package/dist/tui.d.ts +17 -0
  25. package/dist/tui.js +4719 -0
  26. package/dist/ui-prefs.d.ts +16 -0
  27. package/dist/ui-prefs.js +27 -0
  28. package/dist/v2-server.d.ts +81 -0
  29. package/dist/v2-server.js +402 -0
  30. package/dist/v2-tui.d.ts +24 -0
  31. package/dist/v2-tui.js +313 -0
  32. package/dist/v2-types.d.ts +134 -0
  33. package/dist/v2-types.js +8 -0
  34. package/openshare.config.json +16 -0
  35. package/package.json +98 -4
  36. package/src/banner.txt +25 -0
  37. package/src/commands.ts +452 -0
  38. package/src/config.ts +524 -0
  39. package/src/core.ts +1997 -0
  40. package/src/dialogs.tsx +971 -0
  41. package/src/server.ts +47 -0
  42. package/src/settings.ts +1239 -0
  43. package/src/share-flow.ts +551 -0
  44. package/src/sidebar.tsx +187 -0
  45. package/src/tui-host.ts +134 -0
  46. package/src/tui.tsx +318 -0
  47. package/src/ui-prefs.ts +36 -0
  48. package/src/v2-server.ts +438 -0
  49. package/src/v2-tui.ts +315 -0
  50. package/src/v2-types.ts +102 -0
  51. package/tsconfig.json +18 -0
@@ -0,0 +1,64 @@
1
+ import { type Engine, type EngineDeps } from "./core.js";
2
+ export declare const PLUGIN_ID = "openshare";
3
+ type V1PluginInput = {
4
+ client?: EngineDeps["client"];
5
+ directory?: string;
6
+ worktree?: string;
7
+ [key: string]: unknown;
8
+ };
9
+ export type V1Plugin = (input: V1PluginInput, options?: Record<string, unknown>) => Promise<Engine["hooks"] | Record<string, never>>;
10
+ export declare const OpenSharePlugin: V1Plugin;
11
+ declare const _default: {
12
+ id: string;
13
+ server: V1Plugin;
14
+ setup: (context: {
15
+ event?: {
16
+ subscribe(options?: {
17
+ signal?: AbortSignal;
18
+ }): AsyncIterable<{
19
+ [key: string]: unknown;
20
+ type: string;
21
+ data?: Record<string, unknown>;
22
+ }>;
23
+ };
24
+ client?: {
25
+ session?: {
26
+ get(input: {
27
+ sessionID: string;
28
+ }): Promise<unknown>;
29
+ update(input: {
30
+ sessionID: string;
31
+ title?: string;
32
+ metadata?: Record<string, unknown>;
33
+ }): Promise<unknown>;
34
+ list(input?: {
35
+ directory?: string;
36
+ parentID?: string;
37
+ cursor?: string;
38
+ limit?: number;
39
+ }): Promise<unknown>;
40
+ diff(input: {
41
+ sessionID: string;
42
+ }): Promise<unknown>;
43
+ remove?(input: {
44
+ sessionID: string;
45
+ }): Promise<unknown>;
46
+ };
47
+ message?: {
48
+ list(input: {
49
+ sessionID: string;
50
+ limit?: number;
51
+ cursor?: string;
52
+ }): Promise<unknown>;
53
+ };
54
+ };
55
+ options?: Record<string, unknown>;
56
+ app?: {
57
+ name?: string;
58
+ version?: string;
59
+ channel?: string;
60
+ };
61
+ signal?: AbortSignal;
62
+ }) => Promise<(() => void) | void>;
63
+ };
64
+ export default _default;
package/dist/server.js ADDED
@@ -0,0 +1,30 @@
1
+ // Open(code)Share — server plugin entry.
2
+ //
3
+ // Dual-target:
4
+ // - OpenCode v1 invokes the `server` factory with (input, options); the
5
+ // input carries the SDK client, directory and worktree.
6
+ // - OpenCode v2 validates `default` as `{ id, setup }` and calls setup
7
+ // with the v2 plugin context (see v2-server.ts).
8
+ // The excess keys are ignored by the other host, so one default export
9
+ // serves both loaders.
10
+ import { moduleDir } from "./config.js";
11
+ import { createEngine } from "./core.js";
12
+ import { createV2ServerSetup } from "./v2-server.js";
13
+ export const PLUGIN_ID = "openshare";
14
+ export const OpenSharePlugin = async (input, options) => {
15
+ const deps = {
16
+ client: input?.client,
17
+ directory: typeof input?.directory === "string" ? input.directory : undefined,
18
+ worktree: typeof input?.worktree === "string" ? input.worktree : undefined,
19
+ pluginDir: moduleDir(),
20
+ options,
21
+ };
22
+ const engine = createEngine(deps);
23
+ return engine.hooks;
24
+ };
25
+ const server = OpenSharePlugin;
26
+ export default {
27
+ id: PLUGIN_ID,
28
+ server,
29
+ setup: createV2ServerSetup(),
30
+ };
@@ -0,0 +1,24 @@
1
+ import type { ShareHostApi } from "./tui-host.js";
2
+ /** Connect (add + enroll) a server — the /share first-run flow and the
3
+ * settings "Connect to a server" row share it. Prompts the URL, probes
4
+ * the auth mode, prompts a code for private servers, enrolls, persists
5
+ * the token and makes it the active server. */
6
+ export declare function connectServerFlow(host: ShareHostApi): Promise<{
7
+ ok: boolean;
8
+ message: string;
9
+ url?: string;
10
+ }>;
11
+ /** Manage a share server with its root token: users, tokens, codes,
12
+ * shares — the /api/admin surface as promise menus. Reached from the
13
+ * per-server submenu (Admin panel); pinnedUrl skips the server picker. */
14
+ export declare function adminConsole(host: ShareHostApi, pinnedUrl?: string): Promise<void>;
15
+ /** The settings dialog: a compact ROOT of group entries (with live
16
+ * summaries) opening focused submenus. Two-level by design — one flat
17
+ * ~25-row dump was unreadable (owner-directed regroup 2026-10-19).
18
+ * Save semantics unchanged: root Exit saves when dirty; submenu Back
19
+ * just returns. */
20
+ export declare function settingsDialog(host: ShareHostApi, startAtSession?: string): Promise<void>;
21
+ /** Onboarding shown by /share when no server is connected: connect flow
22
+ * first (URL + optional code = enrolled + active), full settings as the
23
+ * fallback for manual configuration. */
24
+ export declare function onboardingDialog(host: ShareHostApi): Promise<void>;