@datalayer/core 1.2.26 → 1.2.27
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/lib/api/mcp/tasks.d.ts
CHANGED
|
@@ -17,13 +17,20 @@ export declare const listTasks: (token: string, filters?: McpTaskListFilters, ba
|
|
|
17
17
|
export declare const getTask: (token: string, taskUid: string, baseUrl?: string) => Promise<McpTask>;
|
|
18
18
|
/** Stop a task that is still going. Idempotent: a finished task is answered as it is. */
|
|
19
19
|
export declare const cancelTask: (token: string, taskUid: string, baseUrl?: string) => Promise<McpTask>;
|
|
20
|
+
/** What the gateway says of an answer: that it was passed on, not the task. */
|
|
21
|
+
export type McpTaskAnswered = {
|
|
22
|
+
uid: string;
|
|
23
|
+
answered: boolean;
|
|
24
|
+
};
|
|
20
25
|
/**
|
|
21
26
|
* Answer a task that is `input_required`.
|
|
22
27
|
*
|
|
23
28
|
* The input is the tool's own and goes over as typed; only the envelope is
|
|
24
|
-
* converted. The idempotency key makes a retried answer one answer.
|
|
29
|
+
* converted. The idempotency key makes a retried answer one answer. The
|
|
30
|
+
* reply is an acknowledgement, not the task: read the task again for its
|
|
31
|
+
* status.
|
|
25
32
|
*/
|
|
26
|
-
export declare const answerTask: (token: string, taskUid: string, request: McpTaskInput, idempotencyKey: string, baseUrl?: string) => Promise<
|
|
33
|
+
export declare const answerTask: (token: string, taskUid: string, request: McpTaskInput, idempotencyKey: string, baseUrl?: string) => Promise<McpTaskAnswered>;
|
|
27
34
|
/** The tasks of one notebook; empty until milestone 2 fills it. */
|
|
28
35
|
export declare const listNotebookTasks: (token: string, notebookUid: string, filters?: Pick<McpTaskListFilters, "status" | "cursor" | "limit">, baseUrl?: string) => Promise<McpTaskList>;
|
|
29
36
|
/** Where a task's server-sent events are. */
|
package/lib/api/mcp/tasks.js
CHANGED
|
@@ -54,7 +54,9 @@ export const cancelTask = async (token, taskUid, baseUrl = DEFAULT_SERVICE_URLS.
|
|
|
54
54
|
* Answer a task that is `input_required`.
|
|
55
55
|
*
|
|
56
56
|
* The input is the tool's own and goes over as typed; only the envelope is
|
|
57
|
-
* converted. The idempotency key makes a retried answer one answer.
|
|
57
|
+
* converted. The idempotency key makes a retried answer one answer. The
|
|
58
|
+
* reply is an acknowledgement, not the task: read the task again for its
|
|
59
|
+
* status.
|
|
58
60
|
*/
|
|
59
61
|
export const answerTask = async (token, taskUid, request, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.JUPYTER_MCP_SERVER) => fromWire(await requestDatalayerAPI({
|
|
60
62
|
url: taskUrl(baseUrl, taskUid, '/input'),
|
|
@@ -90,7 +92,11 @@ export const parseTaskEventFrame = (frame) => {
|
|
|
90
92
|
return undefined;
|
|
91
93
|
}
|
|
92
94
|
const payload = fromWire(JSON.parse(data.join('\n')));
|
|
93
|
-
return {
|
|
95
|
+
return {
|
|
96
|
+
...payload,
|
|
97
|
+
event: payload.event ?? event,
|
|
98
|
+
taskId: payload.taskId ?? '',
|
|
99
|
+
};
|
|
94
100
|
};
|
|
95
101
|
/**
|
|
96
102
|
* Subscribe to a task's events.
|
|
@@ -103,7 +109,10 @@ export const subscribeTaskEvents = (token, taskUid, handlers, baseUrl = DEFAULT_
|
|
|
103
109
|
const controller = new AbortController();
|
|
104
110
|
const run = async () => {
|
|
105
111
|
const response = await fetch(taskEventsUrl(taskUid, baseUrl), {
|
|
106
|
-
headers: {
|
|
112
|
+
headers: {
|
|
113
|
+
Authorization: `Bearer ${token}`,
|
|
114
|
+
Accept: 'text/event-stream',
|
|
115
|
+
},
|
|
107
116
|
signal: controller.signal,
|
|
108
117
|
});
|
|
109
118
|
if (!response.ok || !response.body) {
|
package/lib/hooks/useMcp.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type McpActivity, type McpActivityFilters, type McpAuditFilters, type McpBindingListFilters, type McpGatewayVersion, type McpMetricsFilters, type McpMetricsSnapshot, type McpOrganizationOverview, type McpOrganizationUsage, type McpOrganizationOverviewFilters, type McpPolicyFilters, type McpRunLogs, type McpRunTrace, type McpTaskEvent, type McpTaskListFilters, type McpWorkerList, type McpWorkflowsHealth } from '../api/mcp';
|
|
1
|
+
import { type McpTaskAnswered, type McpActivity, type McpActivityFilters, type McpAuditFilters, type McpBindingListFilters, type McpGatewayVersion, type McpMetricsFilters, type McpMetricsSnapshot, type McpOrganizationOverview, type McpOrganizationUsage, type McpOrganizationOverviewFilters, type McpPolicyFilters, type McpRunLogs, type McpRunTrace, type McpTaskEvent, type McpTaskListFilters, type McpWorkerList, type McpWorkflowsHealth } from '../api/mcp';
|
|
2
2
|
import { type ConnectedAgent } from '../api/iam/connectedAgents';
|
|
3
3
|
import { type OrganizationTeam } from '../api/iam/organizationTeams';
|
|
4
4
|
import { setAuditSettings, type McpAuditSettings } from '../api/iam/mcpAuditSettings';
|
|
@@ -29,7 +29,7 @@ export declare const useTaskEvents: (taskUid?: string, options?: {
|
|
|
29
29
|
onEvent?: (event: McpTaskEvent) => void;
|
|
30
30
|
}) => void;
|
|
31
31
|
export declare const useCancelTask: () => import("@tanstack/react-query").UseMutationResult<McpTask, Error, string, unknown>;
|
|
32
|
-
export declare const useAnswerTask: () => import("@tanstack/react-query").UseMutationResult<
|
|
32
|
+
export declare const useAnswerTask: () => import("@tanstack/react-query").UseMutationResult<McpTaskAnswered, Error, {
|
|
33
33
|
taskUid: string;
|
|
34
34
|
input: Record<string, unknown>;
|
|
35
35
|
}, unknown>;
|
package/lib/hooks/useMcp.js
CHANGED
|
@@ -137,8 +137,11 @@ export const useAnswerTask = () => {
|
|
|
137
137
|
const mcpUrl = useMcpServerUrl();
|
|
138
138
|
return useMutation({
|
|
139
139
|
mutationFn: ({ taskUid, input }) => answerTask(token ?? '', taskUid, { input }, crypto.randomUUID(), mcpUrl),
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
// The gateway acknowledges the answer, it does not send the task back:
|
|
141
|
+
// read the task again rather than writing the acknowledgement in its
|
|
142
|
+
// place (the run page read its status from it and fell).
|
|
143
|
+
onSuccess: (_answered, { taskUid }) => {
|
|
144
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.mcp.task(taskUid) });
|
|
142
145
|
queryClient.invalidateQueries({ queryKey: queryKeys.mcp.tasks() });
|
|
143
146
|
},
|
|
144
147
|
});
|
|
@@ -294,7 +294,13 @@ export function viewForRoute(route, current) {
|
|
|
294
294
|
if (path === '/research' || path.startsWith('/research/')) {
|
|
295
295
|
return 'research';
|
|
296
296
|
}
|
|
297
|
-
|
|
297
|
+
// The SVG gallery is the admin sidebar's, at its own address: filed under
|
|
298
|
+
// the Platform, the Platform button came back to it with the admin sidebar
|
|
299
|
+
// beside it (reported 28 October 2026).
|
|
300
|
+
if (path === '/admin' ||
|
|
301
|
+
path.startsWith('/admin/') ||
|
|
302
|
+
path === '/svg' ||
|
|
303
|
+
path.startsWith('/svg/')) {
|
|
298
304
|
return 'admin';
|
|
299
305
|
}
|
|
300
306
|
// The Apps shell, and the hosted applications at `/apps/<slug>` with it.
|