@hosty-sdk/app 0.43.0 → 0.46.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.
@@ -106,6 +106,7 @@ export interface DecisionRecord {
106
106
  resolutionRevision: number;
107
107
  receivedAt: string | null;
108
108
  } | null;
109
+ notificationPending?: boolean | null;
109
110
  continuation: DecisionContinuation | null;
110
111
  reason?: string | null;
111
112
  contentRemovedAt?: string | null;
@@ -1,5 +1,5 @@
1
1
  import type { ProviderServerOptions } from "@hosty-sdk/app/providers/server";
2
- import { type FeedbackCapabilities, type FeedbackSubmit, type FeedbackReport, type FeedbackCollection, type FeedbackDispatch, type FeedbackDispatchInput, type FeedbackDelivery, type FeedbackOutcome } from "@hosty-sdk/app/feedback";
2
+ import { type FeedbackCapabilities, type FeedbackSubmit, type FeedbackReport, type FeedbackCollection, type FeedbackDispatch, type FeedbackDispatchInput, type FeedbackDelivery, type FeedbackOutcome, type FeedbackEdit, type FeedbackDelete } from "@hosty-sdk/app/feedback";
3
3
  export declare class FeedbackServerClient {
4
4
  private readonly appId;
5
5
  private readonly core;
@@ -24,6 +24,11 @@ export declare class FeedbackServerClient {
24
24
  workspaceId: string | null;
25
25
  disposition?: string | null;
26
26
  }, token: string): Promise<FeedbackReport>;
27
+ edit(id: string, input: FeedbackEdit, token: string): Promise<FeedbackReport>;
28
+ remove(id: string, input: FeedbackDelete, token: string): Promise<{
29
+ id: string;
30
+ status: "deleted";
31
+ }>;
27
32
  reserve(input: FeedbackDispatchInput, token: string): Promise<FeedbackDispatch>;
28
33
  delivery(id: string, input: FeedbackDelivery, token: string): Promise<FeedbackDispatch>;
29
34
  outcomes(id: string, outcomes: FeedbackOutcome[], token: string): Promise<FeedbackDispatch>;
@@ -10,7 +10,7 @@ export class FeedbackServerClient {
10
10
  if (!this.appId || !this.service)
11
11
  throw new FeedbackError("hosty_misconfigured", "Hosty app credentials are unavailable.", 503);
12
12
  }
13
- async response(path, token, body, signal) {
13
+ async response(path, token, body, signal, mutation) {
14
14
  if (!token)
15
15
  throw new FeedbackError("identity_required", "Sign in to use feedback.", 401);
16
16
  const response = await fetch(new URL("/api/internal/apps/" + encodeURIComponent(this.appId) + "/" + path, this.core), {
@@ -21,12 +21,14 @@ export class FeedbackServerClient {
21
21
  });
22
22
  if (!response.ok) {
23
23
  const error = await response.json().catch(() => null);
24
+ if (mutation && error === null && (response.status === 404 || response.status === 405))
25
+ throw new FeedbackError("feedback_mutation_unsupported", `This Core does not support ${mutation} feedback. Update Core and retry.`, response.status);
24
26
  throw new FeedbackError(error?.code ?? "feedback_unavailable", error?.message ?? "Feedback is unavailable. Your draft is retained.", response.status);
25
27
  }
26
28
  return response;
27
29
  }
28
- async request(path, token, body, signal) {
29
- return (await this.response(path, token, body, signal)).json();
30
+ async request(path, token, body, signal, mutation) {
31
+ return (await this.response(path, token, body, signal, mutation)).json();
30
32
  }
31
33
  capabilities(token, signal) { return this.request("ui/feedback", token, undefined, signal); }
32
34
  submit(input, token, signal) { return this.request("ui/feedback", token, input, signal); }
@@ -35,6 +37,12 @@ export class FeedbackServerClient {
35
37
  change(id, input, token) {
36
38
  return this.request("feedback/" + encodeURIComponent(id), token, input);
37
39
  }
40
+ edit(id, input, token) {
41
+ return this.request("feedback/" + encodeURIComponent(id) + "/edit", token, input, undefined, "editing");
42
+ }
43
+ remove(id, input, token) {
44
+ return this.request("feedback/" + encodeURIComponent(id) + "/delete", token, input, undefined, "deleting");
45
+ }
38
46
  reserve(input, token) { return this.request("feedback/dispatches", token, input); }
39
47
  delivery(id, input, token) {
40
48
  return this.request("feedback/dispatches/" + encodeURIComponent(id) + "/delivery", token, input);
@@ -76,6 +76,19 @@ export type FeedbackSelection = {
76
76
  id: string;
77
77
  revision: number;
78
78
  };
79
+ export type FeedbackEdit = {
80
+ requestId: string;
81
+ expectedRevision: number;
82
+ comment: string;
83
+ annotations: {
84
+ id: string;
85
+ text: string;
86
+ }[];
87
+ };
88
+ export type FeedbackDelete = {
89
+ requestId: string;
90
+ expectedRevision: number;
91
+ };
79
92
  export type FeedbackDispatchInput = {
80
93
  requestId: string;
81
94
  sessionId: string;
package/dist/install.d.ts CHANGED
@@ -201,6 +201,8 @@ export declare class InstallationFlow {
201
201
  submit(settings?: Record<string, string | null>, autostart?: boolean): Promise<InstallationRequest | null>;
202
202
  refresh(): Promise<void>;
203
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;
204
206
  /** Open synchronously in a click handler, before awaiting plan/submit requests. */
205
207
  export declare function openInstallationConfirmation(): Window | null;
206
208
  export declare function showInstallationConfirmation(popup: Window | null, request: InstallationRequest): void;
package/dist/install.js CHANGED
@@ -141,6 +141,20 @@ export class InstallationFlow {
141
141
  }
142
142
  }
143
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
+ }
144
158
  /** Open synchronously in a click handler, before awaiting plan/submit requests. */
145
159
  export function openInstallationConfirmation() {
146
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;
@@ -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);
@@ -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
- optionId: string | null;
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 only while no shell has spoken — a declared theme is a choice, and a
106
- * choice is not overruled by the OS.
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 only while no shell has spoken — a declared theme is a choice, and a
508
- * choice is not overruled by the OS.
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
- apply(message.theme, message.preference, true);
556
+ preference = message.preference;
557
+ apply(message.theme, preference, true);
554
558
  };
555
559
  const handleSystemChange = () => {
556
- if (!declared && followSystem) {
557
- apply(system.matches ? "dark" : "light", "system", false);
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);
@@ -1,5 +1,5 @@
1
1
  import type { ProviderClient } from "./providers-server.js";
2
- import type { TaskProviderRef, TaskRef, TaskRecord, TaskPage, TaskCreate, TaskEdit, TaskAction, TaskStatus, TaskCapabilities, TaskExecutorOptions, TaskExecutionInput, TaskExecutionReceipt } from "./tasks.js";
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>;
@@ -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,17 @@ 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.removed !== undefined)
34
+ query.set("removed", String(options.removed));
35
+ if (options.rootsOnly !== undefined)
36
+ query.set("rootsOnly", String(options.rootsOnly));
28
37
  return this.call(`/tasks?${query}`, "GET", undefined, options.signal);
29
38
  }
39
+ request(requestId, signal) { return this.call(`/requests/${encodeURIComponent(requestId)}`, "GET", undefined, signal); }
30
40
  create(input, signal) { return this.call("/tasks", "POST", input, signal); }
31
41
  get(ref, signal) { return this.call(`/tasks/${this.id(ref)}`, "GET", undefined, signal); }
32
42
  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. Numbers are opaque; references bind an installation. */
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
- optionId?: string;
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
- workspaceId?: string;
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
- taskRevision: number;
54
- executorOptionId?: string;
55
- input: Omit<TaskInput, "assignee">;
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
- /** Native segment exit while the same attempt remains awaiting_input; does not release the attempt. */
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
- }; /** An absolute HTTP(S) UI URL for cross-app readers; same-app readers can resolve a local path. */
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,42 @@ 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
- inputRevision: number;
114
+ ref: TaskOutcomeRef;
86
115
  result: TaskResult;
116
+ childOutcomes?: TaskOutcomeRef[];
87
117
  recordedAt: string;
88
- executionId?: string;
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
+ removed?: {
133
+ batchId: string;
134
+ at: string;
135
+ by: TaskActor;
136
+ };
137
+ coordination?: TaskCoordination;
91
138
  ref: TaskRef;
92
139
  number: string;
93
140
  revision: number;
94
141
  inputRevision: number;
95
142
  status: TaskStatus;
143
+ rootTaskRef: TaskRef;
144
+ depth: number;
145
+ relationRevision: number;
146
+ graphRevision: number;
96
147
  createdBy: TaskActor;
97
148
  owner: TaskActor;
98
149
  createdAt: string;
@@ -102,47 +153,82 @@ export type TaskRecord = TaskInput & {
102
153
  message: string;
103
154
  };
104
155
  cancelRequested: boolean;
156
+ armed: boolean;
105
157
  result?: TaskResult;
106
- resultInputRevision?: number;
158
+ resultRef?: TaskOutcomeRef;
159
+ acceptedResultRef?: TaskOutcomeRef;
107
160
  attempts: TaskAttempt[];
108
- outcomes?: TaskOutcome[];
161
+ outcomes: TaskOutcome[];
162
+ disposition?: TaskDisposition;
109
163
  };
110
164
  export type TaskMutation = {
111
165
  requestId: string;
112
166
  expectedRevision: number;
113
167
  };
114
- export type TaskInputWrite = Omit<TaskInput, "requiresReview"> & {
115
- requiresReview?: boolean;
116
- };
168
+ /** Defaults apply only to omitted optional fields; obsolete v1 fields are rejected. */
169
+ export type TaskInputWrite = Omit<TaskInput, "review" | "parentTaskRef" | "dependsOn"> & Partial<Pick<TaskInput, "review" | "parentTaskRef" | "dependsOn">>;
117
170
  export type TaskCreate = {
118
171
  requestId: string;
119
172
  input: TaskInputWrite;
173
+ expectedGraphRevision?: number;
120
174
  };
121
175
  export type TaskEdit = TaskMutation & {
122
176
  input: TaskInputWrite;
177
+ expectedGraphRevision?: number;
123
178
  };
124
179
  export type TaskAction = TaskMutation & {
125
- action: "ready" | "draft" | "start" | "complete" | "cancel" | "accept" | "request_changes";
180
+ action: "ready" | "draft" | "start" | "complete" | "cancel" | "accept" | "request_changes" | "retry" | "disposition" | "remove" | "restore";
126
181
  result?: TaskResult;
127
- resultInputRevision?: number;
182
+ resultRef?: TaskOutcomeRef;
128
183
  feedback?: string;
184
+ selection?: TaskSelection;
185
+ disposition?: TaskDisposition;
186
+ removalScope?: Array<{
187
+ taskRef: TaskRef;
188
+ revision: number;
189
+ }>;
190
+ };
191
+ export type TaskRequestReceipt = {
192
+ requestId: string;
193
+ state: "applied";
194
+ taskRef: TaskRef;
195
+ result: TaskRecord;
129
196
  };
130
197
  export type TaskPage = {
131
198
  tasks: TaskRecord[];
132
199
  nextCursor: string | null;
133
200
  };
201
+ export type TaskListOptions = {
202
+ cursor?: string;
203
+ limit?: number;
204
+ status?: TaskStatus;
205
+ parentTaskRef?: TaskRef;
206
+ rootTaskRef?: TaskRef;
207
+ rootsOnly?: boolean;
208
+ removed?: boolean;
209
+ };
134
210
  export type TaskCapabilities = {
135
211
  version: 1;
136
212
  prefix: string;
137
213
  statuses: TaskStatus[];
138
214
  maxPageSize: number;
215
+ capabilities?: string[];
216
+ };
217
+ export type TaskExecutorAvailability = {
218
+ state: "available" | "unavailable" | "unknown";
219
+ reason?: string;
139
220
  };
140
221
  export type TaskExecutorOption = {
141
222
  id: string;
223
+ revision: number;
142
224
  name: string;
225
+ description: string;
143
226
  capabilities: string[];
227
+ availability: TaskExecutorAvailability;
144
228
  };
145
229
  export type TaskExecutorOptions = {
230
+ version: 1;
231
+ revision: number;
146
232
  options: TaskExecutorOption[];
147
233
  defaultId: string | null;
148
234
  };
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 { theme: declared, preference: normalizeThemePreference(input.preferenceParam) ?? declared, source: "param" };
58
+ return resolve(declared, normalizeThemePreference(input.preferenceParam) ?? declared, "param");
53
59
  }
54
60
  const stored = normalizeResolvedTheme(input.stored);
55
61
  if (stored) {
56
- return { theme: stored, preference: normalizeThemePreference(input.storedPreference) ?? stored, source: "stored" };
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
- setReview(url);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hosty-sdk/app",
3
- "version": "0.43.0",
3
+ "version": "0.46.0",
4
4
  "description": "Hosty app auth: session state machine, recovery bridge, Core revalidation, and the embedder responder.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",