@opengeni/react 0.20.0 → 0.25.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/{chunk-6BXBGJ3B.js → chunk-6XUS5VFM.js} +2 -2
- package/dist/{chunk-MRSECXRP.js → chunk-AVPU5PMC.js} +87 -57
- package/dist/chunk-AVPU5PMC.js.map +1 -0
- package/dist/{chunk-HHFA4AFX.js → chunk-I3BJZIG5.js} +15 -1
- package/dist/chunk-I3BJZIG5.js.map +1 -0
- package/dist/{chunk-LAZ2A743.js → chunk-RDPDU4TA.js} +8 -7
- package/dist/chunk-RDPDU4TA.js.map +1 -0
- package/dist/{chunk-6UT5OC3P.js → chunk-SHOFILHJ.js} +130 -16
- package/dist/chunk-SHOFILHJ.js.map +1 -0
- package/dist/{chunk-EBTT3MYN.js → chunk-YDNWMKXO.js} +11 -1
- package/dist/chunk-YDNWMKXO.js.map +1 -0
- package/dist/{composer-DvUaa5ki.d.ts → composer-BXb0Q1HF.d.ts} +19 -5
- package/dist/composer.d.ts +3 -3
- package/dist/composer.js +3 -3
- package/dist/fleet-decision-projection-SLNZMS42.js +241 -0
- package/dist/fleet-decision-projection-SLNZMS42.js.map +1 -0
- package/dist/fleet-decision-row-GGCAT4E4.js +351 -0
- package/dist/fleet-decision-row-GGCAT4E4.js.map +1 -0
- package/dist/index.d.ts +14 -11
- package/dist/index.js +466 -244
- package/dist/index.js.map +1 -1
- package/dist/machines.d.ts +1 -1
- package/dist/machines.js +2 -2
- package/dist/{queue-surface-implementation-NQMV2ML3.js → queue-surface-implementation-3UW3MIIR.js} +9 -9
- package/dist/queue-surface-implementation-3UW3MIIR.js.map +1 -0
- package/dist/{session-Gd4iVPYw.d.ts → session-BEvtFWhe.d.ts} +71 -24
- package/dist/{session-context-DIFFlXKc.d.ts → session-context-rgrfElMl.d.ts} +7 -1
- package/dist/session.d.ts +3 -3
- package/dist/session.js +7 -3
- package/dist/{use-composer-BCfm4mzX.d.ts → use-composer-BnEzheSk.d.ts} +13 -20
- package/package.json +2 -2
- package/src/client.ts +4 -0
- package/src/components/composer.tsx +7 -6
- package/src/components/message-timeline.tsx +197 -25
- package/src/components/queue-draft-policy.ts +18 -0
- package/src/components/queue-surface-implementation.tsx +6 -10
- package/src/components/queue-surface.tsx +1 -0
- package/src/hooks/use-composer.ts +143 -83
- package/src/hooks/use-file-attachments.ts +95 -2
- package/src/hooks/use-goal.ts +22 -4
- package/src/hooks/use-session-mcp-approval-policy.ts +161 -0
- package/src/hooks/use-workspace-sessions.ts +30 -5
- package/src/index.ts +9 -0
- package/src/session-context.ts +25 -0
- package/src/session.ts +10 -0
- package/src/timeline/activity-rail.tsx +17 -1
- package/src/timeline/fleet-decision-projection.ts +366 -0
- package/src/timeline/fleet-decision-row.tsx +412 -0
- package/src/timeline/index.ts +2 -0
- package/src/timeline/projection.ts +19 -8
- package/src/timeline/tool-display-name.ts +16 -0
- package/src/timeline/tool-renderers.tsx +1 -1
- package/src/timeline/types.ts +76 -16
- package/dist/chunk-6UT5OC3P.js.map +0 -1
- package/dist/chunk-EBTT3MYN.js.map +0 -1
- package/dist/chunk-HHFA4AFX.js.map +0 -1
- package/dist/chunk-LAZ2A743.js.map +0 -1
- package/dist/chunk-MRSECXRP.js.map +0 -1
- package/dist/queue-surface-implementation-NQMV2ML3.js.map +0 -1
- /package/dist/{chunk-6BXBGJ3B.js.map → chunk-6XUS5VFM.js.map} +0 -0
|
@@ -6,12 +6,19 @@ import {
|
|
|
6
6
|
useDebouncedCallback,
|
|
7
7
|
useEmbeddedHumanInputSession,
|
|
8
8
|
useEmbeddedSession,
|
|
9
|
+
useEmbeddedSessionMcpApprovalPolicy,
|
|
9
10
|
useMutationRunner,
|
|
10
11
|
usePolledValue,
|
|
11
12
|
useSessionEventTrigger
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-I3BJZIG5.js";
|
|
13
14
|
|
|
14
15
|
// src/timeline/projection.ts
|
|
16
|
+
var { default: fleetDecisionItem } = await import("./fleet-decision-projection-SLNZMS42.js");
|
|
17
|
+
function toolDisplayName(name) {
|
|
18
|
+
const boundary = name.indexOf("__");
|
|
19
|
+
const toolPart = boundary >= 0 ? name.slice(boundary + 2) : name;
|
|
20
|
+
return toolPart.replace(/[_-]+/g, " ").trim();
|
|
21
|
+
}
|
|
15
22
|
var WORKER_SPAWN_TOOL = "session_create";
|
|
16
23
|
var WORKER_MESSAGE_TOOL = "session_send_message";
|
|
17
24
|
function buildTimeline(events) {
|
|
@@ -379,6 +386,14 @@ ${message}` : message;
|
|
|
379
386
|
}
|
|
380
387
|
break;
|
|
381
388
|
}
|
|
389
|
+
case "codex.fleet.decision": {
|
|
390
|
+
const decision = fleetDecisionItem(event, payload);
|
|
391
|
+
if (decision) {
|
|
392
|
+
closeStreamingTail();
|
|
393
|
+
items.push(decision);
|
|
394
|
+
}
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
382
397
|
case "goal.set":
|
|
383
398
|
case "goal.updated":
|
|
384
399
|
case "goal.completed":
|
|
@@ -439,6 +454,7 @@ function isActivityItem(item) {
|
|
|
439
454
|
case "worker":
|
|
440
455
|
case "sandbox":
|
|
441
456
|
case "memory":
|
|
457
|
+
case "fleet-decision":
|
|
442
458
|
return true;
|
|
443
459
|
default:
|
|
444
460
|
return false;
|
|
@@ -565,7 +581,7 @@ function isAgentActivityEvent(type) {
|
|
|
565
581
|
return type.startsWith("agent.") || type.startsWith("sandbox.");
|
|
566
582
|
}
|
|
567
583
|
function isTurnExecutionEvidence(type) {
|
|
568
|
-
return isAgentActivityEvent(type) || type === "turn.completed" || type === "turn.failed" || type === "turn.recovery.requested" || type === "turn.capacity_waiting" || type === "session.requiresAction" || type === "tool.auth_needed" || type === "credential.auth_needed" || type.startsWith("rig.setup.") || type === "codex.capacity.waiting" || type === "codex.capacity.resumed";
|
|
584
|
+
return isAgentActivityEvent(type) || type === "turn.completed" || type === "turn.failed" || type === "turn.recovery.requested" || type === "turn.capacity_waiting" || type === "session.requiresAction" || type === "tool.auth_needed" || type === "credential.auth_needed" || type.startsWith("rig.setup.") || type === "codex.capacity.waiting" || type === "codex.capacity.resumed" || type === "codex.fleet.decision";
|
|
569
585
|
}
|
|
570
586
|
function turnEndItem(event, outcome, failureText) {
|
|
571
587
|
return {
|
|
@@ -916,11 +932,6 @@ function extractSessionRef(value, depth = 0) {
|
|
|
916
932
|
function looksLikeId(value) {
|
|
917
933
|
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
|
918
934
|
}
|
|
919
|
-
function toolDisplayName(name) {
|
|
920
|
-
const boundary = name.indexOf("__");
|
|
921
|
-
const toolPart = boundary >= 0 ? name.slice(boundary + 2) : name;
|
|
922
|
-
return toolPart.replace(/[_-]+/g, " ").trim();
|
|
923
|
-
}
|
|
924
935
|
|
|
925
936
|
// src/hooks/use-session-events.ts
|
|
926
937
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -1945,6 +1956,107 @@ function useSessionControl(sessionId, options = {}) {
|
|
|
1945
1956
|
};
|
|
1946
1957
|
}
|
|
1947
1958
|
|
|
1959
|
+
// src/hooks/use-session-mcp-approval-policy.ts
|
|
1960
|
+
import { useCallback as useCallback4, useEffect as useEffect3, useLayoutEffect as useLayoutEffect3, useMemo as useMemo3, useRef as useRef4, useState as useState3 } from "react";
|
|
1961
|
+
function isSessionMcpApprovalPolicyEvent(event, serverId) {
|
|
1962
|
+
if (event.type !== "session.mcp.approval_policy.updated") {
|
|
1963
|
+
return false;
|
|
1964
|
+
}
|
|
1965
|
+
if (serverId === void 0) {
|
|
1966
|
+
return true;
|
|
1967
|
+
}
|
|
1968
|
+
const payload = event.payload;
|
|
1969
|
+
return payload?.serverId === serverId;
|
|
1970
|
+
}
|
|
1971
|
+
function useSessionMcpApprovalPolicy(sessionId, serverId, options = {}) {
|
|
1972
|
+
const { client, workspaceId } = useEmbeddedSessionMcpApprovalPolicy(options);
|
|
1973
|
+
const enabled = (options.enabled ?? true) && Boolean(sessionId && serverId);
|
|
1974
|
+
const [override, setOverride] = useState3(null);
|
|
1975
|
+
const targetKey = `${workspaceId}\0${sessionId ?? ""}\0${serverId ?? ""}`;
|
|
1976
|
+
const authoritativeGeneration = useRef4(0);
|
|
1977
|
+
const mutationIdentity = useMemo3(() => ({ client, targetKey }), [client, targetKey]);
|
|
1978
|
+
const { run, mutating, mutationError, clearMutationError } = useMutationRunner(mutationIdentity);
|
|
1979
|
+
useLayoutEffect3(() => {
|
|
1980
|
+
authoritativeGeneration.current += 1;
|
|
1981
|
+
setOverride(null);
|
|
1982
|
+
}, [client, targetKey]);
|
|
1983
|
+
const load = useCallback4(async () => {
|
|
1984
|
+
const generation = authoritativeGeneration.current;
|
|
1985
|
+
if (!sessionId || !serverId) {
|
|
1986
|
+
return { targetKey, generation, server: null };
|
|
1987
|
+
}
|
|
1988
|
+
const session = await client.getSession(workspaceId, sessionId);
|
|
1989
|
+
return {
|
|
1990
|
+
targetKey,
|
|
1991
|
+
generation,
|
|
1992
|
+
server: session.mcpServers.find((server2) => server2.id === serverId) ?? null
|
|
1993
|
+
};
|
|
1994
|
+
}, [client, serverId, sessionId, targetKey, workspaceId]);
|
|
1995
|
+
const {
|
|
1996
|
+
data,
|
|
1997
|
+
loading,
|
|
1998
|
+
error: loadError,
|
|
1999
|
+
refresh
|
|
2000
|
+
} = usePolledValue(load, {
|
|
2001
|
+
enabled,
|
|
2002
|
+
pollIntervalMs: options.pollIntervalMs
|
|
2003
|
+
});
|
|
2004
|
+
useEffect3(() => {
|
|
2005
|
+
if (data?.targetKey === targetKey && data.generation === authoritativeGeneration.current) {
|
|
2006
|
+
setOverride(null);
|
|
2007
|
+
}
|
|
2008
|
+
}, [data, targetKey]);
|
|
2009
|
+
const scheduleRefresh = useDebouncedCallback(() => void refresh());
|
|
2010
|
+
const matchesPolicyEvent = useCallback4(
|
|
2011
|
+
(event) => isSessionMcpApprovalPolicyEvent(event, serverId ?? void 0),
|
|
2012
|
+
[serverId]
|
|
2013
|
+
);
|
|
2014
|
+
useSessionEventTrigger(
|
|
2015
|
+
client,
|
|
2016
|
+
workspaceId,
|
|
2017
|
+
sessionId,
|
|
2018
|
+
matchesPolicyEvent,
|
|
2019
|
+
scheduleRefresh,
|
|
2020
|
+
{
|
|
2021
|
+
enabled,
|
|
2022
|
+
...options.events !== void 0 ? { events: options.events } : {}
|
|
2023
|
+
},
|
|
2024
|
+
async () => await refresh()
|
|
2025
|
+
);
|
|
2026
|
+
const update = useCallback4(
|
|
2027
|
+
async (policy) => {
|
|
2028
|
+
if (!sessionId || !serverId) {
|
|
2029
|
+
return null;
|
|
2030
|
+
}
|
|
2031
|
+
const response = await run(
|
|
2032
|
+
() => client.updateSessionMcpApprovalPolicy(workspaceId, sessionId, serverId, {
|
|
2033
|
+
requireApproval: policy
|
|
2034
|
+
})
|
|
2035
|
+
);
|
|
2036
|
+
if (response) {
|
|
2037
|
+
authoritativeGeneration.current += 1;
|
|
2038
|
+
setOverride(response.server);
|
|
2039
|
+
void refresh();
|
|
2040
|
+
}
|
|
2041
|
+
return response;
|
|
2042
|
+
},
|
|
2043
|
+
[client, refresh, run, serverId, sessionId, workspaceId]
|
|
2044
|
+
);
|
|
2045
|
+
const server = override ?? data?.server ?? null;
|
|
2046
|
+
return {
|
|
2047
|
+
server,
|
|
2048
|
+
policy: server?.requireApproval ?? null,
|
|
2049
|
+
loading,
|
|
2050
|
+
error: mutationError ?? loadError,
|
|
2051
|
+
refresh: async () => {
|
|
2052
|
+
await refresh();
|
|
2053
|
+
},
|
|
2054
|
+
update,
|
|
2055
|
+
updating: mutating,
|
|
2056
|
+
clearError: clearMutationError
|
|
2057
|
+
};
|
|
2058
|
+
}
|
|
2059
|
+
|
|
1948
2060
|
// src/approvals.ts
|
|
1949
2061
|
function approvalsFromRequiresAction(payload) {
|
|
1950
2062
|
const approvals = payload && typeof payload === "object" ? payload.approvals : void 0;
|
|
@@ -2039,14 +2151,14 @@ function isRecord(value) {
|
|
|
2039
2151
|
}
|
|
2040
2152
|
|
|
2041
2153
|
// src/hooks/use-human-input.ts
|
|
2042
|
-
import { useCallback as
|
|
2154
|
+
import { useCallback as useCallback5, useEffect as useEffect4, useRef as useRef5, useState as useState4 } from "react";
|
|
2043
2155
|
function isHumanInputEvent(event) {
|
|
2044
2156
|
return event.type === "session.humanInput.requested" || event.type === "user.humanInputResponse" || event.type === "turn.completed" || event.type === "turn.failed" || event.type === "turn.cancelled";
|
|
2045
2157
|
}
|
|
2046
2158
|
function useHumanInputRequests(sessionId, options = {}) {
|
|
2047
2159
|
const { client, workspaceId, registerSessionReconciler } = useEmbeddedHumanInputSession(options);
|
|
2048
2160
|
const enabled = (options.enabled ?? true) && Boolean(sessionId);
|
|
2049
|
-
const load =
|
|
2161
|
+
const load = useCallback5(
|
|
2050
2162
|
async () => sessionId ? await client.listHumanInputRequests(workspaceId, sessionId, { status: "pending" }) : [],
|
|
2051
2163
|
[client, sessionId, workspaceId]
|
|
2052
2164
|
);
|
|
@@ -2055,13 +2167,13 @@ function useHumanInputRequests(sessionId, options = {}) {
|
|
|
2055
2167
|
pollIntervalMs: options.pollIntervalMs
|
|
2056
2168
|
});
|
|
2057
2169
|
const mutation = useMutationRunner(`${workspaceId}\0${sessionId ?? ""}`);
|
|
2058
|
-
const [respondingRequestId, setRespondingRequestId] =
|
|
2059
|
-
const respondingRequestRef =
|
|
2060
|
-
|
|
2170
|
+
const [respondingRequestId, setRespondingRequestId] = useState4(null);
|
|
2171
|
+
const respondingRequestRef = useRef5(null);
|
|
2172
|
+
useEffect4(() => {
|
|
2061
2173
|
respondingRequestRef.current = null;
|
|
2062
2174
|
setRespondingRequestId(null);
|
|
2063
2175
|
}, [sessionId, workspaceId]);
|
|
2064
|
-
|
|
2176
|
+
useEffect4(() => {
|
|
2065
2177
|
if (!sessionId || !enabled) return;
|
|
2066
2178
|
return registerSessionReconciler(sessionId, "human-input", state.refresh);
|
|
2067
2179
|
}, [enabled, registerSessionReconciler, sessionId, state.refresh]);
|
|
@@ -2070,7 +2182,7 @@ function useHumanInputRequests(sessionId, options = {}) {
|
|
|
2070
2182
|
enabled,
|
|
2071
2183
|
...options.events !== void 0 ? { events: options.events } : {}
|
|
2072
2184
|
});
|
|
2073
|
-
const respond =
|
|
2185
|
+
const respond = useCallback5(
|
|
2074
2186
|
async (requestId, response) => {
|
|
2075
2187
|
if (!sessionId || respondingRequestRef.current !== null) return null;
|
|
2076
2188
|
respondingRequestRef.current = requestId;
|
|
@@ -2107,12 +2219,12 @@ function useHumanInputRequests(sessionId, options = {}) {
|
|
|
2107
2219
|
}
|
|
2108
2220
|
|
|
2109
2221
|
export {
|
|
2222
|
+
toolDisplayName,
|
|
2110
2223
|
buildTimeline,
|
|
2111
2224
|
creditExhaustedFromEvents,
|
|
2112
2225
|
sessionStatusFromEvents,
|
|
2113
2226
|
groupTimeline,
|
|
2114
2227
|
extractSessionRef,
|
|
2115
|
-
toolDisplayName,
|
|
2116
2228
|
SESSION_EVENT_BROWSER_MAX_BYTES,
|
|
2117
2229
|
SESSION_EVENT_BROWSER_MAX_COUNT,
|
|
2118
2230
|
SESSION_EVENT_BROWSER_SINGLE_EVENT_MAX_BYTES,
|
|
@@ -2123,6 +2235,8 @@ export {
|
|
|
2123
2235
|
isTurnQueueEvent,
|
|
2124
2236
|
useTurnQueue,
|
|
2125
2237
|
useSessionControl,
|
|
2238
|
+
isSessionMcpApprovalPolicyEvent,
|
|
2239
|
+
useSessionMcpApprovalPolicy,
|
|
2126
2240
|
approvalsFromRequiresAction,
|
|
2127
2241
|
projectPendingApprovals,
|
|
2128
2242
|
humanInputRequestFromEvent,
|
|
@@ -2130,4 +2244,4 @@ export {
|
|
|
2130
2244
|
isHumanInputEvent,
|
|
2131
2245
|
useHumanInputRequests
|
|
2132
2246
|
};
|
|
2133
|
-
//# sourceMappingURL=chunk-
|
|
2247
|
+
//# sourceMappingURL=chunk-SHOFILHJ.js.map
|