@hanzo/app 0.3.90 → 0.3.91
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/bots/ComputerDialog.js +2 -13
- package/dist/bots/api.d.ts +9 -0
- package/dist/bots/api.js +14 -0
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ import { useAi } from '../lib/ai.js';
|
|
|
15
15
|
import { say } from '../failure.js';
|
|
16
16
|
import { called } from '../team.js';
|
|
17
17
|
import { VaultDialog, readVault } from '../vault.js';
|
|
18
|
-
import { actComputer, bootOrResumeComputer, disk, findBotComputer, grant, parkComputer, updateBotMeta, } from './api.js';
|
|
18
|
+
import { actComputer, bootOrResumeComputer, disk, findBotComputer, grant, opened, parkComputer, updateBotMeta, } from './api.js';
|
|
19
19
|
import { CLIP, PILL, WORD } from './kit.js';
|
|
20
20
|
import { DIM } from './ink.js';
|
|
21
21
|
// Always-dark translucent surfaces inside the pure-black desktop window chrome,
|
|
@@ -37,17 +37,6 @@ function PulsingCluster({ label }) {
|
|
|
37
37
|
return (_jsx(YStack, { width: mid ? 7 : 4, height: mid ? 7 : 4, rounded: 999, bg: "var(--pure-white)", opacity: active ? 1 : 0.35 }, i));
|
|
38
38
|
}) }), _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "500", color: "var(--pure-white)", opacity: 0.58, children: label })] }));
|
|
39
39
|
}
|
|
40
|
-
function appendViewParam(rawUrl, viewOnly) {
|
|
41
|
-
try {
|
|
42
|
-
const u = new URL(rawUrl, typeof window !== 'undefined' ? window.location.origin : 'https://api.hanzo.ai');
|
|
43
|
-
u.searchParams.set('viewOnly', viewOnly ? '1' : '0');
|
|
44
|
-
return u.toString();
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
const join = rawUrl.includes('?') ? '&' : '?';
|
|
48
|
-
return `${rawUrl}${join}viewOnly=${viewOnly ? '1' : '0'}`;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
40
|
export function ComputerDialog({ open, onOpenChange, bot, box, onUpdated, }) {
|
|
52
41
|
const { t } = useI18n();
|
|
53
42
|
const { client } = useAi();
|
|
@@ -112,7 +101,7 @@ export function ComputerDialog({ open, onOpenChange, bot, box, onUpdated, }) {
|
|
|
112
101
|
try {
|
|
113
102
|
const g = await grant(client, targetId, kind);
|
|
114
103
|
if (g.url) {
|
|
115
|
-
const finalUrl = kind === 'screen' ?
|
|
104
|
+
const finalUrl = opened(g.url, kind === 'screen' ? wantViewOnly : undefined);
|
|
116
105
|
setFrameUrl(finalUrl);
|
|
117
106
|
// Terminal or older edge screen page without postMessage transitions smoothly after load
|
|
118
107
|
window.setTimeout(() => {
|
package/dist/bots/api.d.ts
CHANGED
|
@@ -178,6 +178,15 @@ export interface Grant {
|
|
|
178
178
|
expiresIn?: number;
|
|
179
179
|
}
|
|
180
180
|
export declare const grant: (c: Client, id: string, kind: 'terminal' | 'screen') => Promise<Grant>;
|
|
181
|
+
/**
|
|
182
|
+
* Where a grant opens: its address on the API host, and for a screen whether it
|
|
183
|
+
* opens to watch or to control. Cloud answers a PATH
|
|
184
|
+
* (`/v1/sandbox/<id>/screen?ticket=…`, cloud apps/sandbox `ticketGrant`), and the
|
|
185
|
+
* API's host serves it, never the page's: on hanzo.bot the page's own host is the
|
|
186
|
+
* static site, which answers that path with a page that refuses to be framed, and
|
|
187
|
+
* a bot's computer read "hanzo.bot refused to connect".
|
|
188
|
+
*/
|
|
189
|
+
export declare function opened(url: string, viewOnly?: boolean): string;
|
|
181
190
|
/**
|
|
182
191
|
* Finds the bot's existing desktop sandbox across both named project disks (`bot-<name>`)
|
|
183
192
|
* and Free-tier persistent `disk: true` sandboxes bound via `bot.computeRef`.
|
package/dist/bots/api.js
CHANGED
|
@@ -180,6 +180,20 @@ export async function slackChannels(signal) {
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
export const grant = (c, id, kind) => c.http.json({ method: 'POST', path: `/v1/sandbox/${encodeURIComponent(id)}/${kind}/ticket` });
|
|
183
|
+
/**
|
|
184
|
+
* Where a grant opens: its address on the API host, and for a screen whether it
|
|
185
|
+
* opens to watch or to control. Cloud answers a PATH
|
|
186
|
+
* (`/v1/sandbox/<id>/screen?ticket=…`, cloud apps/sandbox `ticketGrant`), and the
|
|
187
|
+
* API's host serves it, never the page's: on hanzo.bot the page's own host is the
|
|
188
|
+
* static site, which answers that path with a page that refuses to be framed, and
|
|
189
|
+
* a bot's computer read "hanzo.bot refused to connect".
|
|
190
|
+
*/
|
|
191
|
+
export function opened(url, viewOnly) {
|
|
192
|
+
const u = new URL(url, `${api()}/`);
|
|
193
|
+
if (viewOnly !== undefined)
|
|
194
|
+
u.searchParams.set('viewOnly', viewOnly ? '1' : '0');
|
|
195
|
+
return u.toString();
|
|
196
|
+
}
|
|
183
197
|
function bestSandbox(boxes) {
|
|
184
198
|
return (boxes.find((b) => b.status === 'running') ??
|
|
185
199
|
boxes.find((b) => b.status === 'pending') ??
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/app",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.91",
|
|
4
4
|
"description": "Hanzo's app: the shell and its apps (Home, Chat, Inbox, Contacts, Meet, Calendar, Drive, Board, Work, Bots), once, for every Hanzo surface.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|