@inflatable-cookie/longhorn 0.5.0 → 0.6.0
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/agent-control/inject.ts +4 -1
- package/src/agent-control/selection.ts +35 -20
- package/src/agent-control/shim.ts +302 -144
- package/src/bridge/direct.ts +1 -1
- package/src/bridge/generated/fields.ts +3 -2
- package/src/bridge/generated/protocol.ts +7 -3
- package/src/bridge/job.ts +4 -14
- package/src/bridge/loopback.ts +7 -25
- package/src/bridge/operation.ts +13 -43
- package/src/bridge/router.ts +10 -23
- package/src/bridge/runtime/connection.ts +77 -105
- package/src/bridge/runtime/policy.ts +8 -28
- package/src/bridge/runtime/retry.ts +6 -18
- package/src/bridge/session.ts +4 -14
- package/src/bridge/stream/connection.ts +16 -38
- package/src/bridge/stream/source.ts +2 -6
- package/src/bridge/stream/tracker.ts +7 -12
- package/src/bridge/supervision.ts +11 -26
- package/src/bridge/validation/base.ts +17 -39
- package/src/bridge/validation/jobs.ts +11 -25
- package/src/bridge/validation/negotiation.ts +27 -37
- package/src/bridge/validation/operations.ts +28 -52
- package/src/bridge/validation/streams.ts +3 -10
- package/src/commands/client.ts +21 -26
- package/src/commands/controller.ts +32 -47
- package/src/commands/generated/fields.ts +3 -2
- package/src/commands/generated/protocol.ts +4 -0
- package/src/commands/keyboard.ts +92 -89
- package/src/commands/ports.ts +6 -12
- package/src/commands/projectors.ts +50 -48
- package/src/commands/validation.ts +70 -97
- package/src/config/client.ts +6 -19
- package/src/config/generated/fields.ts +2 -2
- package/src/config/names.ts +6 -12
- package/src/config/validation/commands.ts +5 -17
- package/src/config/validation/outcomes.ts +31 -39
- package/src/config/validation/primitives.ts +36 -53
- package/src/config/validation/projection.ts +66 -94
- package/src/core/connection.ts +70 -61
- package/src/core/record.ts +4 -0
- package/src/core/transport.ts +4 -15
- package/src/core/wire-copy.ts +6 -0
- package/src/history/client.ts +6 -12
- package/src/history/controller.ts +46 -46
- package/src/history/direct.ts +1 -3
- package/src/history/generated/fields.ts +2 -2
- package/src/history/ports.ts +4 -6
- package/src/history/serialized.ts +9 -13
- package/src/history/validation.ts +71 -55
- package/src/history-tree/client.ts +87 -11
- package/src/history-tree/controller.ts +313 -70
- package/src/history-tree/direct.ts +3 -1
- package/src/history-tree/generated/fields.ts +2 -2
- package/src/history-tree/ports.ts +3 -1
- package/src/history-tree/serialized.ts +39 -11
- package/src/history-tree/validation.ts +262 -63
- package/src/layout/generated/protocol.ts +2 -2
- package/src/layout/ratio.ts +2 -8
- package/src/layout/validation.ts +10 -19
- package/src/layout/visibility.ts +1 -2
- package/src/licence/client.ts +44 -7
- package/src/licence/controller.ts +76 -40
- package/src/licence/direct.ts +3 -1
- package/src/licence/generated/fields.ts +2 -2
- package/src/licence/generated/key-conformance.json +28 -0
- package/src/licence/generated/protocol.ts +1 -1
- package/src/licence/key.ts +40 -12
- package/src/licence/ports.ts +3 -1
- package/src/licence/serialized.ts +32 -9
- package/src/licence/validation.ts +120 -36
- package/src/native-content/client.ts +178 -236
- package/src/native-content/generated/fields.ts +2 -2
- package/src/native-content/ports.ts +9 -15
- package/src/native-content/serialized.ts +12 -19
- package/src/native-content/validation/base.ts +57 -50
- package/src/native-content/validation/messages.ts +21 -35
- package/src/native-content/validation/state.ts +31 -33
- package/src/notifications/client.ts +87 -31
- package/src/notifications/controller.ts +215 -61
- package/src/notifications/direct.ts +3 -1
- package/src/notifications/generated/fields.ts +2 -2
- package/src/notifications/ports.ts +7 -3
- package/src/notifications/serialized.ts +11 -9
- package/src/notifications/validation.ts +147 -43
- package/src/operation/bridge.ts +117 -50
- package/src/operation/client.ts +38 -24
- package/src/operation/controller.ts +33 -42
- package/src/operation/direct.ts +1 -3
- package/src/operation/generated/fields.ts +2 -2
- package/src/operation/ports.ts +10 -9
- package/src/operation/serialized.ts +8 -9
- package/src/operation/validation.ts +152 -65
- package/src/settings/client.ts +11 -44
- package/src/settings/connection.ts +26 -40
- package/src/settings/generated/fields.ts +3 -3
- package/src/settings/generated/protocol.ts +9 -4
- package/src/settings/names.ts +2 -4
- package/src/settings/registry.ts +23 -25
- package/src/settings/validation/authority.ts +19 -17
- package/src/settings/validation/command.ts +17 -37
- package/src/settings/validation/error.ts +2 -8
- package/src/settings/validation/primitives.ts +26 -42
- package/src/settings/validation/projection.ts +8 -24
- package/src/settings/validation/registry.ts +25 -73
- package/src/surface-transfer/client.ts +6 -18
- package/src/surface-transfer/generated/fields.ts +2 -2
- package/src/surface-transfer/validation.ts +31 -49
- package/src/surfaces/client.ts +12 -22
- package/src/surfaces/generated/fields.ts +2 -2
- package/src/surfaces/validation.ts +40 -49
- package/src/transfer/client.ts +26 -60
- package/src/transfer/connection.ts +12 -20
- package/src/transfer/generated/fields.ts +5 -5
- package/src/transfer/generated/protocol.ts +4 -4
- package/src/transfer/payload.ts +13 -31
- package/src/transfer/validation.ts +39 -75
- package/src/update/client.ts +59 -9
- package/src/update/controller.ts +113 -48
- package/src/update/direct.ts +3 -1
- package/src/update/generated/fields.ts +3 -3
- package/src/update/generated/protocol.ts +7 -3
- package/src/update/generated/variant-fields.ts +1 -0
- package/src/update/ports.ts +6 -2
- package/src/update/serialized.ts +34 -10
- package/src/update/validation.ts +115 -35
package/package.json
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { installAgentControlShim
|
|
1
|
+
import { installAgentControlShim } from "./shim.ts";
|
|
2
|
+
import type { ShimWorld } from "./shim.ts";
|
|
2
3
|
|
|
4
|
+
// The standalone IIFE runs in the browser world carrying these DOM globals.
|
|
5
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion, quality/no-chained-type-assertions -- The injection host supplies the browser world, including its dynamically installed shim key.
|
|
3
6
|
const target = globalThis as unknown as ShimWorld;
|
|
4
7
|
installAgentControlShim(target);
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
//! opens. Human-originated calls pass the original options to the plugin
|
|
5
5
|
//! unchanged. Origin is the in-page shim, not an active-server flag.
|
|
6
6
|
|
|
7
|
-
import { SHIM_GLOBAL
|
|
7
|
+
import { SHIM_GLOBAL } from "./shim.ts";
|
|
8
|
+
import type { AgentControlApi } from "./shim.ts";
|
|
8
9
|
|
|
9
10
|
/** Renderer invoke name. Host-protocol pairs this with the Rust command. */
|
|
10
11
|
export const BEGIN_SELECTION_COMMAND = "longhorn_agent_control_begin_selection";
|
|
@@ -23,13 +24,13 @@ export type SelectionOrigin = typeof SELECTION_ORIGIN_AGENT | typeof SELECTION_O
|
|
|
23
24
|
|
|
24
25
|
export type DialogFilter = {
|
|
25
26
|
name: string;
|
|
26
|
-
extensions: string
|
|
27
|
+
extensions: Array<string>;
|
|
27
28
|
};
|
|
28
29
|
|
|
29
30
|
export type OpenDialogOptions = {
|
|
30
31
|
title?: string;
|
|
31
32
|
defaultPath?: string;
|
|
32
|
-
filters?: DialogFilter
|
|
33
|
+
filters?: Array<DialogFilter>;
|
|
33
34
|
multiple?: boolean;
|
|
34
35
|
directory?: boolean;
|
|
35
36
|
};
|
|
@@ -37,10 +38,10 @@ export type OpenDialogOptions = {
|
|
|
37
38
|
export type SaveDialogOptions = {
|
|
38
39
|
title?: string;
|
|
39
40
|
defaultPath?: string;
|
|
40
|
-
filters?: DialogFilter
|
|
41
|
+
filters?: Array<DialogFilter>;
|
|
41
42
|
};
|
|
42
43
|
|
|
43
|
-
export type OpenDialogResult = string | string
|
|
44
|
+
export type OpenDialogResult = string | Array<string> | null;
|
|
44
45
|
export type SaveDialogResult = string | null;
|
|
45
46
|
|
|
46
47
|
export type FileSelectionPorts = {
|
|
@@ -66,17 +67,13 @@ function isAgentOriginated(world: FileSelectionWorld): boolean {
|
|
|
66
67
|
* Page origin as a command-argument token. Reads the installed shim;
|
|
67
68
|
* with no shim, or when the shim reports human, the token is `"human"`.
|
|
68
69
|
*/
|
|
70
|
+
// oxlint-disable-next-line quality/no-object-parameters -- The world is a page global with an optional shim, including plain host test doubles.
|
|
69
71
|
export function currentSelectionOrigin(world: object = globalThis): SelectionOrigin {
|
|
70
|
-
return isAgentOriginated(world
|
|
71
|
-
? SELECTION_ORIGIN_AGENT
|
|
72
|
-
: SELECTION_ORIGIN_HUMAN;
|
|
72
|
+
return isAgentOriginated(world) ? SELECTION_ORIGIN_AGENT : SELECTION_ORIGIN_HUMAN;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
function beginOptions(
|
|
76
|
-
kind
|
|
77
|
-
options: OpenDialogOptions | SaveDialogOptions | undefined,
|
|
78
|
-
): Record<string, unknown> {
|
|
79
|
-
const open = kind === "open" ? (options as OpenDialogOptions | undefined) : undefined;
|
|
75
|
+
function beginOptions(kind: "open" | "save", options: OpenDialogOptions | undefined) {
|
|
76
|
+
const open = kind === "open" ? options : undefined;
|
|
80
77
|
return {
|
|
81
78
|
kind,
|
|
82
79
|
directory: open?.directory ?? false,
|
|
@@ -93,21 +90,39 @@ function beginOptions(
|
|
|
93
90
|
*/
|
|
94
91
|
export function bindFileSelection(
|
|
95
92
|
ports: FileSelectionPorts,
|
|
93
|
+
// oxlint-disable-next-line quality/no-object-parameters -- The world is a page global with an optional shim.
|
|
96
94
|
world: object = globalThis,
|
|
97
95
|
): FileSelectionApi {
|
|
98
|
-
const originWorld = world as FileSelectionWorld;
|
|
99
96
|
return {
|
|
100
97
|
open: async (options?: OpenDialogOptions) => {
|
|
101
|
-
if (!isAgentOriginated(
|
|
102
|
-
|
|
98
|
+
if (!isAgentOriginated(world)) {
|
|
99
|
+
return ports.pluginOpen(options);
|
|
100
|
+
}
|
|
101
|
+
const result = await ports.invoke(BEGIN_SELECTION_COMMAND, {
|
|
103
102
|
options: beginOptions("open", options),
|
|
104
|
-
})
|
|
103
|
+
});
|
|
104
|
+
if (result === null || typeof result === "string") {
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
if (
|
|
108
|
+
Array.isArray(result) &&
|
|
109
|
+
result.every((path): path is string => typeof path === "string")
|
|
110
|
+
) {
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
throw new TypeError("invalid agent open-dialog result");
|
|
105
114
|
},
|
|
106
115
|
save: async (options?: SaveDialogOptions) => {
|
|
107
|
-
if (!isAgentOriginated(
|
|
108
|
-
|
|
116
|
+
if (!isAgentOriginated(world)) {
|
|
117
|
+
return ports.pluginSave(options);
|
|
118
|
+
}
|
|
119
|
+
const result = await ports.invoke(BEGIN_SELECTION_COMMAND, {
|
|
109
120
|
options: beginOptions("save", options),
|
|
110
|
-
})
|
|
121
|
+
});
|
|
122
|
+
if (result === null || typeof result === "string") {
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
throw new TypeError("invalid agent save-dialog result");
|
|
111
126
|
},
|
|
112
127
|
};
|
|
113
128
|
}
|