@xenosystem/agent-interface-panel 0.1.27 → 0.1.29
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/dist/index.d.ts +39 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -40,10 +40,37 @@
|
|
|
40
40
|
*/
|
|
41
41
|
import type { PanelModule } from '@xenosystem/panel-sdk';
|
|
42
42
|
import type { AgentHostClient } from '@xenosystem/agent-interface-client';
|
|
43
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* The platform bridge, structurally. Deliberately not `XenoAPI`: a panel host implements the
|
|
45
|
+
* capabilities the interface reaches and refuses the rest by name, so demanding the full type
|
|
46
|
+
* here would put back exactly the barrier this panel exists to remove.
|
|
47
|
+
*/
|
|
48
|
+
export type AgentPlatformBridgeLike = object;
|
|
49
|
+
/**
|
|
50
|
+
* Options for {@link createXenoAgentInterfacePanel} — supply EITHER a client or a bridge.
|
|
51
|
+
*
|
|
52
|
+
* 🔴 **Two mount modes, because hosts differ in a way that is a security boundary, not a
|
|
53
|
+
* preference.**
|
|
54
|
+
*
|
|
55
|
+
* | mode | supply | for |
|
|
56
|
+
* |---|---|---|
|
|
57
|
+
* | **client** | `createClient` | a host that already holds an `AgentHostClient` — Hub, Shell, the Agent app |
|
|
58
|
+
* | **bridge** | `createBridge` | a PANEL host, which does not and must not |
|
|
59
|
+
*
|
|
60
|
+
* `AgentHostClient` takes a `transport` with a generic `request(method, input)`, so supplying one
|
|
61
|
+
* means the renderer can invoke ANY of the 141 host methods — `workspace.file.write`,
|
|
62
|
+
* `workspace.command.run`, every `workspace.pty.*` verb. That is fine in the Agent app, whose
|
|
63
|
+
* renderer is its own. It is not fine in a panel host, whose renderer runs user-authored panels.
|
|
64
|
+
* `xeno-apps`'s preload says so in its own words: the asymmetry "is the whole security design".
|
|
65
|
+
*
|
|
66
|
+
* ⚠️ The bridge mode exists because it was MEASURED to be sufficient, not assumed. Mounting the
|
|
67
|
+
* real interface against a recording bridge showed it reaches `workspace`, `agentContext` and
|
|
68
|
+
* `subagents` — platform-bridge members, not client methods — and it renders from a bridge alone.
|
|
69
|
+
* The client is the embed lifecycle; the component reads the bridge.
|
|
70
|
+
*/
|
|
44
71
|
export interface CreateXenoAgentInterfacePanelOptions {
|
|
45
72
|
/**
|
|
46
|
-
* Build the client this panel mounts against.
|
|
73
|
+
* Build the client this panel mounts against — the EMBED path.
|
|
47
74
|
*
|
|
48
75
|
* 🔴 A FACTORY, not a client. A panel can be mounted more than once in one layout and can be
|
|
49
76
|
* closed and reopened without the host restarting; sharing a single client across those
|
|
@@ -51,7 +78,16 @@ export interface CreateXenoAgentInterfacePanelOptions {
|
|
|
51
78
|
*
|
|
52
79
|
* The client's `surface` must be `'panel-embed'` or the embed layer refuses the mount.
|
|
53
80
|
*/
|
|
54
|
-
createClient
|
|
81
|
+
createClient?: () => AgentHostClient | Promise<AgentHostClient>;
|
|
82
|
+
/**
|
|
83
|
+
* Build the platform bridge this panel mounts against — the PANEL path, and the one a panel host
|
|
84
|
+
* should use.
|
|
85
|
+
*
|
|
86
|
+
* A factory for the same reason `createClient` is one. Returning `null` means this surface has no
|
|
87
|
+
* agent host, which is the ordinary state of a machine: the panel renders its own empty state
|
|
88
|
+
* rather than the host failing to start.
|
|
89
|
+
*/
|
|
90
|
+
createBridge?: () => AgentPlatformBridgeLike | null | Promise<AgentPlatformBridgeLike | null>;
|
|
55
91
|
/** Called when a mount fails, so a host can surface it rather than showing an empty tile. */
|
|
56
92
|
onError?: (error: unknown) => void;
|
|
57
93
|
}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AAOzE;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAA;AAc5C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,oCAAoC;IACnD;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;IAC/D;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,uBAAuB,GAAG,IAAI,GAAG,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAA;IAC7F,6FAA6F;IAC7F,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CACnC;AAED,6CAA6C;AAC7C,eAAO,MAAM,mBAAmB,EAAG,aAAsB,CAAA;AAEzD;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,oCAAoC,GAC5C,WAAW,CAiFb"}
|
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ import { createElement } from 'react';
|
|
|
42
42
|
import { createRoot } from 'react-dom/client';
|
|
43
43
|
import { createAgentPanel } from '@xenosystem/panel-agent';
|
|
44
44
|
import { mountXenoAgentInterface } from '@xenosystem/agent-interface-embed';
|
|
45
|
-
import { XenoAgentInterface } from '@xenosystem/agent-interface-ui';
|
|
45
|
+
import { XenoAgentInterface, configureAgentPlatformBridge, } from '@xenosystem/agent-interface-ui';
|
|
46
46
|
/*
|
|
47
47
|
* ⚠️ The cast is not laziness. `AgentInterface` declares its props parameter as OPTIONAL —
|
|
48
48
|
* `(props?: AgentInterfaceProps)` — and `createElement` narrows such a component to `{}`, so
|
|
@@ -67,6 +67,8 @@ export function createXenoAgentInterfacePanel(options) {
|
|
|
67
67
|
render(el) {
|
|
68
68
|
let handle = null;
|
|
69
69
|
let root = null;
|
|
70
|
+
/* Restores whatever bridge was installed before this mount — a panel can be mounted twice. */
|
|
71
|
+
let restoreBridge = null;
|
|
70
72
|
/*
|
|
71
73
|
* 🔴 Disposal can be requested BEFORE the mount resolves, and a panel closed during its own
|
|
72
74
|
* startup is an ordinary thing in a dockable layout — drag a tile away while it is opening.
|
|
@@ -76,6 +78,29 @@ export function createXenoAgentInterfacePanel(options) {
|
|
|
76
78
|
let disposed = false;
|
|
77
79
|
void (async () => {
|
|
78
80
|
try {
|
|
81
|
+
/*
|
|
82
|
+
* The BRIDGE path first, because it is the one a panel host should take: configure the
|
|
83
|
+
* platform bridge and render the interface directly. No AgentHostClient, so no generic
|
|
84
|
+
* `request(method, input)`, so the host never has to widen its renderer's authority to
|
|
85
|
+
* all 141 host methods in order to draw a panel.
|
|
86
|
+
*/
|
|
87
|
+
if (options.createBridge) {
|
|
88
|
+
const bridge = await options.createBridge();
|
|
89
|
+
if (disposed)
|
|
90
|
+
return;
|
|
91
|
+
if (!bridge) {
|
|
92
|
+
// No agent host on this machine — the ordinary state. The panel shows its own empty
|
|
93
|
+
// state rather than the host treating a missing optional agent as a failure.
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
restoreBridge = configureAgentPlatformBridge(bridge);
|
|
97
|
+
root = createRoot(el);
|
|
98
|
+
root.render(createElement(AgentInterfaceComponent, { surface: 'embedded' }));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (!options.createClient) {
|
|
102
|
+
throw new Error('createXenoAgentInterfacePanel needs either createBridge or createClient.');
|
|
103
|
+
}
|
|
79
104
|
const client = await options.createClient();
|
|
80
105
|
const mounted = await mountXenoAgentInterface(el, {
|
|
81
106
|
surface: AGENT_PANEL_SURFACE,
|
|
@@ -112,6 +137,8 @@ export function createXenoAgentInterfacePanel(options) {
|
|
|
112
137
|
handle = null;
|
|
113
138
|
root?.unmount();
|
|
114
139
|
root = null;
|
|
140
|
+
restoreBridge?.();
|
|
141
|
+
restoreBridge = null;
|
|
115
142
|
};
|
|
116
143
|
},
|
|
117
144
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,aAAa,EAA0B,MAAM,OAAO,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAa,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE1D,OAAO,EAAE,uBAAuB,EAAsC,MAAM,mCAAmC,CAAA;AAE/G,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,aAAa,EAA0B,MAAM,OAAO,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAa,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE1D,OAAO,EAAE,uBAAuB,EAAsC,MAAM,mCAAmC,CAAA;AAE/G,OAAO,EACL,kBAAkB,EAClB,4BAA4B,GAE7B,MAAM,gCAAgC,CAAA;AASvC;;;;;;;;;GASG;AACH,MAAM,uBAAuB,GAAG,kBAA4D,CAAA;AAgD5F,6CAA6C;AAC7C,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAsB,CAAA;AAEzD;;;;;GAKG;A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C,aAAa,CAAC,uBAAuB,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC,CAAA;4BAC9E,CAAC;4BACD,OAAO;gCACL,IAAI,EAAE,OAAO,EAAE,CAAA;gCACf,IAAI,GAAG,IAAI,CAAA;4BACb,CAAC;yBACF;qBACF,CAAC,CAAA;oBACF,IAAI,QAAQ,EAAE,CAAC;wBACb,MAAM,OAAO,CAAC,OAAO,EAAE,CAAA;wBACvB,OAAM;oBACR,CAAC;oBACD,MAAM,GAAG,OAAO,CAAA;gBAClB,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAA;gBAC1B,CAAC;YACH,CAAC,CAAC,EAAE,CAAA;YAEJ,OAAO,GAAG,EAAE;gBACV,QAAQ,GAAG,IAAI,CAAA;gBACf,KAAK,MAAM,EAAE,OAAO,EAAE,CAAA;gBACtB,MAAM,GAAG,IAAI,CAAA;gBACb,IAAI,EAAE,OAAO,EAAE,CAAA;gBACf,IAAI,GAAG,IAAI,CAAA;gBACX,aAAa,EAAE,EAAE,CAAA;gBACjB,aAAa,GAAG,IAAI,CAAA;YACtB,CAAC,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xenosystem/agent-interface-panel",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@xenosystem/panel-agent": "^0.1.0",
|
|
27
|
-
"@xenosystem/agent-interface-client": "0.1.
|
|
28
|
-
"@xenosystem/agent-interface-
|
|
29
|
-
"@xenosystem/agent-interface-contract": "0.1.
|
|
30
|
-
"@xenosystem/agent-interface-
|
|
27
|
+
"@xenosystem/agent-interface-client": "0.1.29",
|
|
28
|
+
"@xenosystem/agent-interface-embed": "0.1.29",
|
|
29
|
+
"@xenosystem/agent-interface-contract": "0.1.29",
|
|
30
|
+
"@xenosystem/agent-interface-ui": "0.1.29"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@xenosystem/panel-sdk": "^1.1.0",
|