@hosty-sdk/app 0.42.0 → 0.44.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/dist/install-react.js +3 -1
- package/dist/install.d.ts +5 -0
- package/dist/install.js +18 -0
- package/dist/providers-server.d.ts +1 -0
- package/dist/providers-server.js +4 -1
- package/dist/providers.d.ts +26 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +9 -5
- package/dist/tasks-server.d.ts +3 -5
- package/dist/tasks-server.js +8 -0
- package/dist/tasks.d.ts +94 -18
- package/dist/theme.d.ts +4 -1
- package/dist/theme.js +12 -3
- package/dist/ui-frame.js +7 -3
- package/package.json +1 -1
package/dist/install-react.js
CHANGED
|
@@ -127,7 +127,9 @@ function InstallationSession({ client, source, confirmationWindow, onClose, onCh
|
|
|
127
127
|
const popup = openInstallationConfirmation();
|
|
128
128
|
claimPopup(popup);
|
|
129
129
|
// A known draft submit failure retries its existing identity, without resolving the feed again.
|
|
130
|
-
if (
|
|
130
|
+
if (request?.updatePlan?.error)
|
|
131
|
+
flow.clearReview();
|
|
132
|
+
if (!flow.snapshot().request)
|
|
131
133
|
await flow.review(initialSource ?? { manifestPath: manifestPath.trim() });
|
|
132
134
|
if (flow.snapshot().request?.status !== "draft") {
|
|
133
135
|
closeUnusedPopup(popup);
|
package/dist/install.d.ts
CHANGED
|
@@ -114,6 +114,9 @@ export interface InstallationRequest {
|
|
|
114
114
|
status: "draft" | "pending" | "executing" | "succeeded" | "denied" | "failed";
|
|
115
115
|
plan: InstallPlan | null;
|
|
116
116
|
updatePlan?: {
|
|
117
|
+
error?: string | null;
|
|
118
|
+
errorCode?: string | null;
|
|
119
|
+
readiness?: string | null;
|
|
117
120
|
appId: string;
|
|
118
121
|
displayName?: string | null;
|
|
119
122
|
targetVersion: string;
|
|
@@ -198,6 +201,8 @@ export declare class InstallationFlow {
|
|
|
198
201
|
submit(settings?: Record<string, string | null>, autostart?: boolean): Promise<InstallationRequest | null>;
|
|
199
202
|
refresh(): Promise<void>;
|
|
200
203
|
}
|
|
204
|
+
/** Open Core confirmation outside an embedded app's sandbox; Core still owns consent. */
|
|
205
|
+
export declare function presentInstallationConfirmation(request: Pick<InstallationRequest, "id" | "approvalUrl">): void;
|
|
201
206
|
/** Open synchronously in a click handler, before awaiting plan/submit requests. */
|
|
202
207
|
export declare function openInstallationConfirmation(): Window | null;
|
|
203
208
|
export declare function showInstallationConfirmation(popup: Window | null, request: InstallationRequest): void;
|
package/dist/install.js
CHANGED
|
@@ -78,6 +78,10 @@ export class InstallationFlow {
|
|
|
78
78
|
async submit(settings, autostart) {
|
|
79
79
|
if (this.state.busy || this.state.uncertainSubmit || this.state.request?.status !== "draft")
|
|
80
80
|
return null;
|
|
81
|
+
if (this.state.request.updatePlan?.error) {
|
|
82
|
+
this.set({ ...this.state, error: this.state.request.updatePlan.error });
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
81
85
|
const id = this.state.request.id;
|
|
82
86
|
const generation = this.generation;
|
|
83
87
|
this.submitting = true;
|
|
@@ -137,6 +141,20 @@ export class InstallationFlow {
|
|
|
137
141
|
}
|
|
138
142
|
}
|
|
139
143
|
function message(error) { return error instanceof Error ? error.message : "Installation request failed."; }
|
|
144
|
+
/** Open Core confirmation outside an embedded app's sandbox; Core still owns consent. */
|
|
145
|
+
export function presentInstallationConfirmation(request) {
|
|
146
|
+
const url = new URL(request.approvalUrl);
|
|
147
|
+
if (!["http:", "https:"].includes(url.protocol))
|
|
148
|
+
throw new Error("Invalid Core confirmation URL.");
|
|
149
|
+
if (window.parent !== window) {
|
|
150
|
+
if (!/^[a-f0-9]{48}$/.test(request.id))
|
|
151
|
+
throw new Error("Invalid Core confirmation ID.");
|
|
152
|
+
// The host derives its own Core origin. No credentials or caller-supplied URL cross the frame.
|
|
153
|
+
window.parent.postMessage({ type: "hosty:request-installation-confirmation", requestId: request.id }, "*");
|
|
154
|
+
}
|
|
155
|
+
else
|
|
156
|
+
window.open(url.href, "_blank", "popup,width=640,height=720,noopener");
|
|
157
|
+
}
|
|
140
158
|
/** Open synchronously in a click handler, before awaiting plan/submit requests. */
|
|
141
159
|
export function openInstallationConfirmation() {
|
|
142
160
|
return window.open("about:blank", "_blank", "popup,width=640,height=720");
|
|
@@ -20,6 +20,7 @@ export declare class ProviderClient {
|
|
|
20
20
|
taskDispatch<T>(input: import("./providers.js").TaskDispatchRequest, signal?: AbortSignal): Promise<T>;
|
|
21
21
|
/** No general user/source credential is minted; the original attempt and grants remain authoritative. */
|
|
22
22
|
taskWorkspace<T>(input: import("./providers.js").TaskWorkspaceRequest, signal?: AbortSignal): Promise<T>;
|
|
23
|
+
taskWorkflow<T>(input: import("./providers.js").TaskWorkflowRequest, signal?: AbortSignal): Promise<T>;
|
|
23
24
|
taskDispatchAuthority(dispatch: import("./providers.js").TaskDispatchRef, signal?: AbortSignal): Promise<{
|
|
24
25
|
dispatch: import("./providers.js").TaskDispatchRef;
|
|
25
26
|
scope: import("./providers.js").TaskDispatchScope;
|
package/dist/providers-server.js
CHANGED
|
@@ -32,6 +32,9 @@ export class ProviderClient {
|
|
|
32
32
|
taskWorkspace(input, signal) {
|
|
33
33
|
return this.coreRequest("/task-workspace", input, signal);
|
|
34
34
|
}
|
|
35
|
+
taskWorkflow(input, signal) {
|
|
36
|
+
return this.coreRequest("/task-workflow", input, signal);
|
|
37
|
+
}
|
|
35
38
|
taskDispatchAuthority(dispatch, signal) {
|
|
36
39
|
return this.coreRequest("/task-dispatch-authority", { dispatch }, signal);
|
|
37
40
|
}
|
|
@@ -99,7 +102,7 @@ export class ProviderClient {
|
|
|
99
102
|
/** Bounded task protocol transport. The selected installation is checked on every operation. */
|
|
100
103
|
async taskRequest(provider, kind, route, method, input, userToken, signal) {
|
|
101
104
|
const allowed = kind === "tasks"
|
|
102
|
-
? /^(?:\/capabilities|\/tasks(?:\?[a-zA-Z0-9%=&_-]*|\/[a-zA-Z0-9-]+(?:\/actions)?)?)$/
|
|
105
|
+
? /^(?:\/capabilities|\/requests\/[a-zA-Z0-9-]+|\/tasks(?:\?[a-zA-Z0-9%=&_-]*|\/[a-zA-Z0-9-]+(?:\/actions)?)?)$/
|
|
103
106
|
: /^(?:\/options|\/executions\/[a-zA-Z0-9-]+(?:\/cancel)?)$/;
|
|
104
107
|
if (!allowed.test(route) || !["GET", "POST", "PATCH", "PUT"].includes(method))
|
|
105
108
|
throw new ProviderError("task_route_invalid", "Use a version-one task operation.", 400);
|
package/dist/providers.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export type ProviderInvocation = {
|
|
|
38
38
|
};
|
|
39
39
|
/** Core-mediated v2 invocations carry the original principal; direct clients have no app identity. */
|
|
40
40
|
export type MediatedProviderInvocation = {
|
|
41
|
+
taskWorkflow?: TaskWorkflowBinding;
|
|
41
42
|
version: 2;
|
|
42
43
|
callerAppId: string | null;
|
|
43
44
|
callerInstallation: string | null;
|
|
@@ -121,9 +122,10 @@ export type TaskDispatchScope = {
|
|
|
121
122
|
executor: import("./tasks.js").TaskProviderRef;
|
|
122
123
|
inputRevision: number;
|
|
123
124
|
inputHash: string;
|
|
124
|
-
|
|
125
|
+
selection: import("./tasks.js").TaskSelection | null;
|
|
125
126
|
executionId: string | null;
|
|
126
127
|
workspaceId?: string | null;
|
|
128
|
+
executionHash?: string | null;
|
|
127
129
|
};
|
|
128
130
|
export type TaskDispatchRequest = {
|
|
129
131
|
dispatch: TaskDispatchRef;
|
|
@@ -134,12 +136,20 @@ export type TaskDispatchRequest = {
|
|
|
134
136
|
requestId?: string;
|
|
135
137
|
};
|
|
136
138
|
/** Executor-only access to the workspace already selected by an immutable task attempt. */
|
|
139
|
+
export type TaskSourceReference = {
|
|
140
|
+
rootDispatch: TaskDispatchRef;
|
|
141
|
+
contextId: string;
|
|
142
|
+
contextRevision: number;
|
|
143
|
+
workspaceId: string;
|
|
144
|
+
};
|
|
137
145
|
export type TaskWorkspaceRequest = {
|
|
138
146
|
dispatch: TaskDispatchRef;
|
|
139
147
|
executionId: string;
|
|
140
148
|
sessionId: string;
|
|
141
149
|
leaseId: string;
|
|
142
|
-
kind: "observe" | "attach" | "lease" | "activity";
|
|
150
|
+
kind: "observe" | "attach" | "lease" | "activity" | "associate_history" | "history_observe";
|
|
151
|
+
source?: TaskSourceReference;
|
|
152
|
+
taskRef?: import("./tasks.js").TaskRef;
|
|
143
153
|
requestId?: string;
|
|
144
154
|
expectedRevision?: number;
|
|
145
155
|
title?: string;
|
|
@@ -152,3 +162,17 @@ export type TaskWorkspaceRequest = {
|
|
|
152
162
|
sequence?: number;
|
|
153
163
|
};
|
|
154
164
|
};
|
|
165
|
+
/** Exact current coordinator identity, constructed by Core rather than a model argument. */
|
|
166
|
+
export type TaskWorkflowBinding = {
|
|
167
|
+
rootDispatch: TaskDispatchRef;
|
|
168
|
+
rootTaskRef: import("./tasks.js").TaskRef;
|
|
169
|
+
parentTaskRef: import("./tasks.js").TaskRef;
|
|
170
|
+
parentExecutionId: string;
|
|
171
|
+
coordinatorEpoch: number;
|
|
172
|
+
rootGeneration: number;
|
|
173
|
+
};
|
|
174
|
+
export type TaskWorkflowRequest = Omit<TaskWorkflowBinding, "rootTaskRef"> & {
|
|
175
|
+
requestId: string;
|
|
176
|
+
operation: "create_child" | "edit" | "read" | "action" | "observe" | "bind_session" | "prepare_source" | "bind_source" | "observe_source";
|
|
177
|
+
payload: Record<string, unknown>;
|
|
178
|
+
};
|
package/dist/react.d.ts
CHANGED
|
@@ -102,8 +102,8 @@ export interface HostThemeBridgeProps {
|
|
|
102
102
|
*
|
|
103
103
|
* Pair it with `themeBootstrapScript` in the head: this effect runs after first paint, so without
|
|
104
104
|
* the script a document paints in the default theme for a frame before it is corrected. The system
|
|
105
|
-
* preference is followed live
|
|
106
|
-
*
|
|
105
|
+
* preference is followed live while no shell has spoken, or while a standalone tab retains a
|
|
106
|
+
* declared system preference. Explicit light/dark choices and embedded host decisions stay authoritative.
|
|
107
107
|
*/
|
|
108
108
|
export declare function HostThemeBridge({ followSystem, onTheme }?: HostThemeBridgeProps): null;
|
|
109
109
|
export { MissingPermissionsNotice } from "./permissions-react.js";
|
package/dist/react.js
CHANGED
|
@@ -504,8 +504,8 @@ function clearStoredTheme() {
|
|
|
504
504
|
*
|
|
505
505
|
* Pair it with `themeBootstrapScript` in the head: this effect runs after first paint, so without
|
|
506
506
|
* the script a document paints in the default theme for a frame before it is corrected. The system
|
|
507
|
-
* preference is followed live
|
|
508
|
-
*
|
|
507
|
+
* preference is followed live while no shell has spoken, or while a standalone tab retains a
|
|
508
|
+
* declared system preference. Explicit light/dark choices and embedded host decisions stay authoritative.
|
|
509
509
|
*/
|
|
510
510
|
export function HostThemeBridge({ followSystem = true, onTheme } = {}) {
|
|
511
511
|
const onThemeRef = useRef(onTheme);
|
|
@@ -515,6 +515,7 @@ export function HostThemeBridge({ followSystem = true, onTheme } = {}) {
|
|
|
515
515
|
useEffect(() => {
|
|
516
516
|
const root = document.documentElement;
|
|
517
517
|
const system = window.matchMedia("(prefers-color-scheme: dark)");
|
|
518
|
+
const standalone = window.parent === window.self;
|
|
518
519
|
const apply = (theme, preference, declared) => {
|
|
519
520
|
applyTheme(root, theme, preference);
|
|
520
521
|
if (declared) {
|
|
@@ -532,8 +533,10 @@ export function HostThemeBridge({ followSystem = true, onTheme } = {}) {
|
|
|
532
533
|
stored: readStoredTheme(THEME_STORAGE_KEY),
|
|
533
534
|
storedPreference: readStoredTheme(THEME_PREFERENCE_STORAGE_KEY),
|
|
534
535
|
systemPrefersDark: system.matches,
|
|
536
|
+
standalone,
|
|
535
537
|
});
|
|
536
538
|
let declared = resolution.source !== "system";
|
|
539
|
+
let preference = resolution.preference;
|
|
537
540
|
if (declared || followSystem) {
|
|
538
541
|
apply(resolution.theme, resolution.preference, declared);
|
|
539
542
|
}
|
|
@@ -550,11 +553,12 @@ export function HostThemeBridge({ followSystem = true, onTheme } = {}) {
|
|
|
550
553
|
return;
|
|
551
554
|
}
|
|
552
555
|
declared = true;
|
|
553
|
-
|
|
556
|
+
preference = message.preference;
|
|
557
|
+
apply(message.theme, preference, true);
|
|
554
558
|
};
|
|
555
559
|
const handleSystemChange = () => {
|
|
556
|
-
if (
|
|
557
|
-
apply(system.matches ? "dark" : "light", "system",
|
|
560
|
+
if (declared ? standalone && preference === "system" : followSystem) {
|
|
561
|
+
apply(system.matches ? "dark" : "light", "system", declared);
|
|
558
562
|
}
|
|
559
563
|
};
|
|
560
564
|
window.addEventListener("message", handleMessage);
|
package/dist/tasks-server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProviderClient } from "./providers-server.js";
|
|
2
|
-
import type { TaskProviderRef, TaskRef, TaskRecord, TaskPage, TaskCreate, TaskEdit, TaskAction,
|
|
2
|
+
import type { TaskListOptions, TaskRequestReceipt, TaskProviderRef, TaskRef, TaskRecord, TaskPage, TaskCreate, TaskEdit, TaskAction, TaskCapabilities, TaskExecutorOptions, TaskExecutionInput, TaskExecutionReceipt } from "./tasks.js";
|
|
3
3
|
/** Server-side task API. Every request obtains a fresh Core binding; no mutation is retried implicitly. */
|
|
4
4
|
export declare class TaskClient {
|
|
5
5
|
private readonly providers;
|
|
@@ -9,12 +9,10 @@ export declare class TaskClient {
|
|
|
9
9
|
private call;
|
|
10
10
|
private id;
|
|
11
11
|
capabilities(signal?: AbortSignal): Promise<TaskCapabilities>;
|
|
12
|
-
list(options?: {
|
|
13
|
-
cursor?: string;
|
|
14
|
-
limit?: number;
|
|
15
|
-
status?: TaskStatus;
|
|
12
|
+
list(options?: TaskListOptions & {
|
|
16
13
|
signal?: AbortSignal;
|
|
17
14
|
}): Promise<TaskPage>;
|
|
15
|
+
request(requestId: string, signal?: AbortSignal): Promise<TaskRequestReceipt>;
|
|
18
16
|
create(input: TaskCreate, signal?: AbortSignal): Promise<TaskRecord>;
|
|
19
17
|
get(ref: TaskRef, signal?: AbortSignal): Promise<TaskRecord>;
|
|
20
18
|
edit(ref: TaskRef, input: TaskEdit, signal?: AbortSignal): Promise<TaskRecord>;
|
package/dist/tasks-server.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { taskReferenceKey } from "./tasks.js";
|
|
1
2
|
/** Server-side task API. Every request obtains a fresh Core binding; no mutation is retried implicitly. */
|
|
2
3
|
export class TaskClient {
|
|
3
4
|
providers;
|
|
@@ -25,8 +26,15 @@ export class TaskClient {
|
|
|
25
26
|
query.set("limit", String(options.limit));
|
|
26
27
|
if (options.status)
|
|
27
28
|
query.set("status", options.status);
|
|
29
|
+
if (options.parentTaskRef)
|
|
30
|
+
query.set("parentTaskRef", taskReferenceKey(options.parentTaskRef));
|
|
31
|
+
if (options.rootTaskRef)
|
|
32
|
+
query.set("rootTaskRef", taskReferenceKey(options.rootTaskRef));
|
|
33
|
+
if (options.rootsOnly !== undefined)
|
|
34
|
+
query.set("rootsOnly", String(options.rootsOnly));
|
|
28
35
|
return this.call(`/tasks?${query}`, "GET", undefined, options.signal);
|
|
29
36
|
}
|
|
37
|
+
request(requestId, signal) { return this.call(`/requests/${encodeURIComponent(requestId)}`, "GET", undefined, signal); }
|
|
30
38
|
create(input, signal) { return this.call("/tasks", "POST", input, signal); }
|
|
31
39
|
get(ref, signal) { return this.call(`/tasks/${this.id(ref)}`, "GET", undefined, signal); }
|
|
32
40
|
edit(ref, input, signal) { return this.call(`/tasks/${this.id(ref)}`, "PATCH", input, signal); }
|
package/dist/tasks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Core's version-one task contract.
|
|
1
|
+
/** Core's version-one task contract. References bind an installation; numbers are display labels. */
|
|
2
2
|
export type TaskProviderRef = {
|
|
3
3
|
appId: string;
|
|
4
4
|
installationId: string;
|
|
@@ -20,6 +20,11 @@ export type TaskResource = {
|
|
|
20
20
|
revision: string;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
+
export type TaskSelection = {
|
|
24
|
+
kind: "option" | "configuration";
|
|
25
|
+
id: string;
|
|
26
|
+
revision: number;
|
|
27
|
+
};
|
|
23
28
|
export type TaskAssignee = {
|
|
24
29
|
kind: "human";
|
|
25
30
|
userId: string;
|
|
@@ -27,16 +32,20 @@ export type TaskAssignee = {
|
|
|
27
32
|
} | {
|
|
28
33
|
kind: "app";
|
|
29
34
|
executor: TaskProviderRef;
|
|
30
|
-
|
|
35
|
+
selection?: TaskSelection;
|
|
31
36
|
name?: string;
|
|
32
37
|
};
|
|
38
|
+
export type TaskReview = {
|
|
39
|
+
mode: "none" | "owner" | "delegator";
|
|
40
|
+
};
|
|
33
41
|
export type TaskInput = {
|
|
34
42
|
title: string;
|
|
35
43
|
markdown: string;
|
|
36
44
|
assignee: TaskAssignee | null;
|
|
37
|
-
requiresReview: boolean;
|
|
38
45
|
resources: TaskResource[];
|
|
39
|
-
|
|
46
|
+
review: TaskReview;
|
|
47
|
+
parentTaskRef: TaskRef | null;
|
|
48
|
+
dependsOn: TaskRef[];
|
|
40
49
|
};
|
|
41
50
|
export type TaskActor = {
|
|
42
51
|
userId: string | null;
|
|
@@ -47,27 +56,46 @@ export type TaskResult = {
|
|
|
47
56
|
markdown: string;
|
|
48
57
|
resources: TaskResource[];
|
|
49
58
|
};
|
|
59
|
+
export type TaskOutcomeRef = {
|
|
60
|
+
taskRef: TaskRef;
|
|
61
|
+
inputRevision: number;
|
|
62
|
+
executionId: string | null;
|
|
63
|
+
resultRevision: number;
|
|
64
|
+
};
|
|
50
65
|
export type TaskExecutionState = "accepted" | "running" | "awaiting_input" | "cancelling" | "completed" | "failed" | "cancelled" | "interrupted";
|
|
51
66
|
export type TaskExecutionInput = {
|
|
67
|
+
version: 1;
|
|
52
68
|
taskRef: TaskRef;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
inputRevision: number;
|
|
70
|
+
selection?: TaskSelection;
|
|
71
|
+
content: Pick<TaskInput, "title" | "markdown" | "resources" | "review">;
|
|
72
|
+
relations: {
|
|
73
|
+
rootTaskRef: TaskRef;
|
|
74
|
+
parentTaskRef: TaskRef | null;
|
|
75
|
+
relationRevision: number;
|
|
76
|
+
};
|
|
77
|
+
prerequisiteOutcomes: TaskOutcomeRef[];
|
|
56
78
|
};
|
|
57
79
|
export type TaskExecutionReceipt = {
|
|
80
|
+
childOutcomes?: TaskOutcomeRef[];
|
|
58
81
|
executionId: string;
|
|
59
82
|
revision: number;
|
|
60
83
|
state: TaskExecutionState;
|
|
61
84
|
stopConfirmed: boolean;
|
|
62
|
-
/**
|
|
85
|
+
/** A parked native segment is stopped while its business attempt remains active. */
|
|
63
86
|
nativeStopConfirmed?: boolean;
|
|
87
|
+
wait?: {
|
|
88
|
+
kind: "children" | "human" | "mode" | "source" | "limits";
|
|
89
|
+
reference: string;
|
|
90
|
+
};
|
|
64
91
|
createdAt: string;
|
|
65
92
|
updatedAt: string;
|
|
66
93
|
result?: TaskResult;
|
|
67
94
|
error?: {
|
|
68
95
|
code: string;
|
|
69
96
|
message: string;
|
|
70
|
-
};
|
|
97
|
+
};
|
|
98
|
+
/** Absolute HTTP(S) for cross-app readers; same-app readers may resolve a local path. */
|
|
71
99
|
sessionRef?: {
|
|
72
100
|
id: string;
|
|
73
101
|
path: string;
|
|
@@ -80,19 +108,37 @@ export type TaskAttempt = {
|
|
|
80
108
|
receipt?: TaskExecutionReceipt;
|
|
81
109
|
cancelRequested: boolean;
|
|
82
110
|
createdAt: string;
|
|
111
|
+
invalidated?: boolean;
|
|
83
112
|
};
|
|
84
113
|
export type TaskOutcome = {
|
|
85
|
-
|
|
114
|
+
ref: TaskOutcomeRef;
|
|
86
115
|
result: TaskResult;
|
|
116
|
+
childOutcomes?: TaskOutcomeRef[];
|
|
87
117
|
recordedAt: string;
|
|
88
|
-
|
|
118
|
+
acceptedAt?: string;
|
|
119
|
+
invalidated?: boolean;
|
|
120
|
+
};
|
|
121
|
+
export type TaskDisposition = {
|
|
122
|
+
kind: "superseded" | "not_required";
|
|
123
|
+
reason: string;
|
|
124
|
+
replacementRefs: TaskRef[];
|
|
125
|
+
};
|
|
126
|
+
export type TaskCoordination = {
|
|
127
|
+
rootGeneration: number;
|
|
128
|
+
coordinatorEpoch: number;
|
|
129
|
+
executionId: string;
|
|
89
130
|
};
|
|
90
131
|
export type TaskRecord = TaskInput & {
|
|
132
|
+
coordination?: TaskCoordination;
|
|
91
133
|
ref: TaskRef;
|
|
92
134
|
number: string;
|
|
93
135
|
revision: number;
|
|
94
136
|
inputRevision: number;
|
|
95
137
|
status: TaskStatus;
|
|
138
|
+
rootTaskRef: TaskRef;
|
|
139
|
+
depth: number;
|
|
140
|
+
relationRevision: number;
|
|
141
|
+
graphRevision: number;
|
|
96
142
|
createdBy: TaskActor;
|
|
97
143
|
owner: TaskActor;
|
|
98
144
|
createdAt: string;
|
|
@@ -102,47 +148,77 @@ export type TaskRecord = TaskInput & {
|
|
|
102
148
|
message: string;
|
|
103
149
|
};
|
|
104
150
|
cancelRequested: boolean;
|
|
151
|
+
armed: boolean;
|
|
105
152
|
result?: TaskResult;
|
|
106
|
-
|
|
153
|
+
resultRef?: TaskOutcomeRef;
|
|
154
|
+
acceptedResultRef?: TaskOutcomeRef;
|
|
107
155
|
attempts: TaskAttempt[];
|
|
108
|
-
outcomes
|
|
156
|
+
outcomes: TaskOutcome[];
|
|
157
|
+
disposition?: TaskDisposition;
|
|
109
158
|
};
|
|
110
159
|
export type TaskMutation = {
|
|
111
160
|
requestId: string;
|
|
112
161
|
expectedRevision: number;
|
|
113
162
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
};
|
|
163
|
+
/** Defaults apply only to omitted optional fields; obsolete v1 fields are rejected. */
|
|
164
|
+
export type TaskInputWrite = Omit<TaskInput, "review" | "parentTaskRef" | "dependsOn"> & Partial<Pick<TaskInput, "review" | "parentTaskRef" | "dependsOn">>;
|
|
117
165
|
export type TaskCreate = {
|
|
118
166
|
requestId: string;
|
|
119
167
|
input: TaskInputWrite;
|
|
168
|
+
expectedGraphRevision?: number;
|
|
120
169
|
};
|
|
121
170
|
export type TaskEdit = TaskMutation & {
|
|
122
171
|
input: TaskInputWrite;
|
|
172
|
+
expectedGraphRevision?: number;
|
|
123
173
|
};
|
|
124
174
|
export type TaskAction = TaskMutation & {
|
|
125
|
-
action: "ready" | "draft" | "start" | "complete" | "cancel" | "accept" | "request_changes";
|
|
175
|
+
action: "ready" | "draft" | "start" | "complete" | "cancel" | "accept" | "request_changes" | "retry" | "disposition";
|
|
126
176
|
result?: TaskResult;
|
|
127
|
-
|
|
177
|
+
resultRef?: TaskOutcomeRef;
|
|
128
178
|
feedback?: string;
|
|
179
|
+
selection?: TaskSelection;
|
|
180
|
+
disposition?: TaskDisposition;
|
|
181
|
+
};
|
|
182
|
+
export type TaskRequestReceipt = {
|
|
183
|
+
requestId: string;
|
|
184
|
+
state: "applied";
|
|
185
|
+
taskRef: TaskRef;
|
|
186
|
+
result: TaskRecord;
|
|
129
187
|
};
|
|
130
188
|
export type TaskPage = {
|
|
131
189
|
tasks: TaskRecord[];
|
|
132
190
|
nextCursor: string | null;
|
|
133
191
|
};
|
|
192
|
+
export type TaskListOptions = {
|
|
193
|
+
cursor?: string;
|
|
194
|
+
limit?: number;
|
|
195
|
+
status?: TaskStatus;
|
|
196
|
+
parentTaskRef?: TaskRef;
|
|
197
|
+
rootTaskRef?: TaskRef;
|
|
198
|
+
rootsOnly?: boolean;
|
|
199
|
+
};
|
|
134
200
|
export type TaskCapabilities = {
|
|
135
201
|
version: 1;
|
|
136
202
|
prefix: string;
|
|
137
203
|
statuses: TaskStatus[];
|
|
138
204
|
maxPageSize: number;
|
|
205
|
+
capabilities?: string[];
|
|
206
|
+
};
|
|
207
|
+
export type TaskExecutorAvailability = {
|
|
208
|
+
state: "available" | "unavailable" | "unknown";
|
|
209
|
+
reason?: string;
|
|
139
210
|
};
|
|
140
211
|
export type TaskExecutorOption = {
|
|
141
212
|
id: string;
|
|
213
|
+
revision: number;
|
|
142
214
|
name: string;
|
|
215
|
+
description: string;
|
|
143
216
|
capabilities: string[];
|
|
217
|
+
availability: TaskExecutorAvailability;
|
|
144
218
|
};
|
|
145
219
|
export type TaskExecutorOptions = {
|
|
220
|
+
version: 1;
|
|
221
|
+
revision: number;
|
|
146
222
|
options: TaskExecutorOption[];
|
|
147
223
|
defaultId: string | null;
|
|
148
224
|
};
|
package/dist/theme.d.ts
CHANGED
|
@@ -42,7 +42,8 @@ export interface ThemeResolution {
|
|
|
42
42
|
* either channel is ignored rather than honoured — a newer shell must degrade an older app to
|
|
43
43
|
* what it did before, never to a theme it cannot render. A preference that arrives without a
|
|
44
44
|
* recognizable value defaults to the theme itself: a shell that resolved `dark` and said nothing
|
|
45
|
-
* more chose dark.
|
|
45
|
+
* more chose dark. In a standalone tab, a system preference resolves against the current OS
|
|
46
|
+
* instead of retaining the shell's old resolved color; an embedded frame follows its host.
|
|
46
47
|
*/
|
|
47
48
|
export declare function resolveTheme(input: {
|
|
48
49
|
param?: string | null;
|
|
@@ -50,6 +51,8 @@ export declare function resolveTheme(input: {
|
|
|
50
51
|
stored?: string | null;
|
|
51
52
|
storedPreference?: string | null;
|
|
52
53
|
systemPrefersDark: boolean;
|
|
54
|
+
/** True for a top-level document; embedded frames retain the host's resolved color. */
|
|
55
|
+
standalone?: boolean;
|
|
53
56
|
}): ThemeResolution;
|
|
54
57
|
/** The slice of the document root the bridge writes to. */
|
|
55
58
|
export interface ThemeRoot {
|
package/dist/theme.js
CHANGED
|
@@ -44,16 +44,22 @@ export function normalizeThemePreference(value) {
|
|
|
44
44
|
* either channel is ignored rather than honoured — a newer shell must degrade an older app to
|
|
45
45
|
* what it did before, never to a theme it cannot render. A preference that arrives without a
|
|
46
46
|
* recognizable value defaults to the theme itself: a shell that resolved `dark` and said nothing
|
|
47
|
-
* more chose dark.
|
|
47
|
+
* more chose dark. In a standalone tab, a system preference resolves against the current OS
|
|
48
|
+
* instead of retaining the shell's old resolved color; an embedded frame follows its host.
|
|
48
49
|
*/
|
|
49
50
|
export function resolveTheme(input) {
|
|
51
|
+
const resolve = (theme, preference, source) => ({
|
|
52
|
+
theme: input.standalone && preference === "system" ? (input.systemPrefersDark ? "dark" : "light") : theme,
|
|
53
|
+
preference,
|
|
54
|
+
source,
|
|
55
|
+
});
|
|
50
56
|
const declared = normalizeResolvedTheme(input.param);
|
|
51
57
|
if (declared) {
|
|
52
|
-
return
|
|
58
|
+
return resolve(declared, normalizeThemePreference(input.preferenceParam) ?? declared, "param");
|
|
53
59
|
}
|
|
54
60
|
const stored = normalizeResolvedTheme(input.stored);
|
|
55
61
|
if (stored) {
|
|
56
|
-
return
|
|
62
|
+
return resolve(stored, normalizeThemePreference(input.storedPreference) ?? stored, "stored");
|
|
57
63
|
}
|
|
58
64
|
return { theme: input.systemPrefersDark ? "dark" : "light", preference: "system", source: "system" };
|
|
59
65
|
}
|
|
@@ -140,6 +146,9 @@ export function createThemeBootstrapScript(options = {}) {
|
|
|
140
146
|
theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
141
147
|
preference = "system";
|
|
142
148
|
}
|
|
149
|
+
if (preference === "system" && window.parent === window.self) {
|
|
150
|
+
theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
151
|
+
}
|
|
143
152
|
const root = document.documentElement;
|
|
144
153
|
root.classList.toggle(${JSON.stringify(DARK_THEME_CLASS)}, theme === "dark");
|
|
145
154
|
root.style.colorScheme = theme;
|
package/dist/ui-frame.js
CHANGED
|
@@ -113,10 +113,14 @@ export function HostyAppFrame(props) {
|
|
|
113
113
|
current.onAttention?.(attention);
|
|
114
114
|
const permission = parseActiveFramePermissionReview(event, frame, source, surface.appId);
|
|
115
115
|
const mcp = parseFrameMcpReview(event, frame, source, surface.appId);
|
|
116
|
+
const confirmation = event.data?.type === "hosty:request-installation-confirmation"
|
|
117
|
+
&& typeof event.data.requestId === "string" && /^[a-f0-9]{48}$/.test(event.data.requestId) ? event.data.requestId : null;
|
|
116
118
|
const core = host?.getSnapshot().bootstrap?.coreOrigin;
|
|
117
|
-
if (core && (permission || mcp)) {
|
|
118
|
-
const url = mcp ? new URL(`/install/agents/${encodeURIComponent(mcp.appId)}/${encodeURIComponent(mcp.targetAppId)}`, core).href : permissionReviewUrl(core, surface.appId);
|
|
119
|
-
|
|
119
|
+
if (core && (permission || mcp || confirmation)) {
|
|
120
|
+
const url = confirmation ? new URL(`/install/confirm/${confirmation}`, core).href : mcp ? new URL(`/install/agents/${encodeURIComponent(mcp.appId)}/${encodeURIComponent(mcp.targetAppId)}`, core).href : permissionReviewUrl(core, surface.appId);
|
|
121
|
+
// The requesting app owns receipt polling and its retry link; the host owns no operation state.
|
|
122
|
+
if (!confirmation)
|
|
123
|
+
setReview(url);
|
|
120
124
|
window.open(url, "_blank", "noopener,noreferrer");
|
|
121
125
|
}
|
|
122
126
|
current.onMessage?.(event, frame);
|
package/package.json
CHANGED