@opengeni/react 3.5.1-canary.0 → 3.7.0-canary.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/artifacts.d.ts +1 -1
- package/dist/artifacts.js +229 -6
- package/dist/artifacts.js.map +1 -1
- package/dist/{chunk-IB27C53Y.js → chunk-C6WDLHBA.js} +31 -23
- package/dist/chunk-C6WDLHBA.js.map +1 -0
- package/dist/{chunk-WY3MELVJ.js → chunk-DOK4KZF2.js} +119 -8
- package/dist/chunk-DOK4KZF2.js.map +1 -0
- package/dist/{chunk-TJFMMDQU.js → chunk-FJBOU2TH.js} +112 -6
- package/dist/chunk-FJBOU2TH.js.map +1 -0
- package/dist/{chunk-UNCXXIQR.js → chunk-R55HFTT3.js} +66 -24
- package/dist/chunk-R55HFTT3.js.map +1 -0
- package/dist/client.d.ts +1 -1
- package/dist/components/artifacts/index.d.ts +1 -1
- package/dist/components/artifacts/published-html-artifact-frame.d.ts +45 -3
- package/dist/components/composer.d.ts +2 -0
- package/dist/components/session-chrome.d.ts +1 -1
- package/dist/composer.js +1 -1
- package/dist/{fleet-decision-row-GGCAT4E4.js → fleet-decision-row-YZ3ZKWMM.js} +2 -1
- package/dist/fleet-decision-row-YZ3ZKWMM.js.map +1 -0
- package/dist/hooks/use-file-attachments.d.ts +6 -0
- package/dist/hooks/use-sandbox-files.d.ts +4 -1
- package/dist/hooks/use-workspace-edit.d.ts +4 -0
- package/dist/index.js +114 -58
- package/dist/index.js.map +1 -1
- package/dist/session-ui.js +2 -2
- package/dist/session.js +2 -2
- package/dist/timeline/registry.d.ts +2 -0
- package/dist/timeline/types.d.ts +1 -1
- package/package.json +2 -2
- package/src/artifacts.ts +3 -0
- package/src/client.ts +2 -1
- package/src/components/artifacts/index.ts +3 -0
- package/src/components/artifacts/published-html-artifact-frame.tsx +284 -4
- package/src/components/composer.tsx +89 -25
- package/src/components/message-timeline.tsx +32 -8
- package/src/components/sandbox-workspace.tsx +11 -1
- package/src/components/session-chrome.tsx +3 -3
- package/src/hooks/use-file-attachments.ts +34 -0
- package/src/hooks/use-sandbox-files.ts +68 -20
- package/src/hooks/use-session-events.ts +21 -26
- package/src/hooks/use-workspace-edit.ts +23 -5
- package/src/timeline/fleet-decision-projection.ts +2 -1
- package/src/timeline/fleet-decision-row.tsx +1 -0
- package/src/timeline/projection.ts +151 -7
- package/src/timeline/registry.ts +15 -3
- package/src/timeline/tool-renderers.tsx +117 -1
- package/src/timeline/types.ts +8 -1
- package/dist/chunk-IB27C53Y.js.map +0 -1
- package/dist/chunk-TJFMMDQU.js.map +0 -1
- package/dist/chunk-UNCXXIQR.js.map +0 -1
- package/dist/chunk-WY3MELVJ.js.map +0 -1
- package/dist/fleet-decision-row-GGCAT4E4.js.map +0 -1
|
@@ -58,6 +58,8 @@ const WORKER_SPAWN_TOOL = "session_create";
|
|
|
58
58
|
const WORKER_MESSAGE_TOOL = "session_send_message";
|
|
59
59
|
const WORKER_FAILURE_CODE_MAX_LENGTH = 128;
|
|
60
60
|
const WORKER_FAILURE_MESSAGE_MAX_UTF8_BYTES = 1_024;
|
|
61
|
+
type PendingWaitOutcome = { id: string; reason: string; occurredAt: string };
|
|
62
|
+
type TrackedAgentResponse = { item: AgentMessageItem; completed: boolean };
|
|
61
63
|
|
|
62
64
|
/**
|
|
63
65
|
* Tools whose durable side-effect events already own the timeline (MemoryRow).
|
|
@@ -131,6 +133,8 @@ export function buildTimeline(events: SessionEvent[]): TimelineItem[] {
|
|
|
131
133
|
const items: TimelineItem[] = [];
|
|
132
134
|
const prescan = prescanTurnAnchors(events);
|
|
133
135
|
const ordered = orderTimelineEvents(events, prescan);
|
|
136
|
+
const pendingWaitOutcomeByTurn = new Map<string | null, PendingWaitOutcome>();
|
|
137
|
+
const latestAgentResponseByTurn = new Map<string | null, TrackedAgentResponse>();
|
|
134
138
|
const humanInputRequests = humanInputRequestsById(events);
|
|
135
139
|
const humanInputToolCallIds = new Set(
|
|
136
140
|
[...humanInputRequests.values()]
|
|
@@ -220,6 +224,31 @@ export function buildTimeline(events: SessionEvent[]): TimelineItem[] {
|
|
|
220
224
|
|
|
221
225
|
const last = (): TimelineItem | undefined => items[items.length - 1];
|
|
222
226
|
|
|
227
|
+
const rememberAgentResponse = (
|
|
228
|
+
turnId: string | null,
|
|
229
|
+
item: AgentMessageItem,
|
|
230
|
+
completed: boolean,
|
|
231
|
+
): void => {
|
|
232
|
+
latestAgentResponseByTurn.set(turnId, { item, completed });
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const takePendingWaitOutcome = (turnId: string | null): PendingWaitOutcome | undefined => {
|
|
236
|
+
const outcome = pendingWaitOutcomeByTurn.get(turnId);
|
|
237
|
+
pendingWaitOutcomeByTurn.delete(turnId);
|
|
238
|
+
return outcome;
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
const takeAgentResponse = (turnId: string | null): TrackedAgentResponse | undefined => {
|
|
242
|
+
const response = latestAgentResponseByTurn.get(turnId);
|
|
243
|
+
latestAgentResponseByTurn.delete(turnId);
|
|
244
|
+
return response;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
const clearUnscopedTerminalTracking = (): void => {
|
|
248
|
+
latestAgentResponseByTurn.delete(null);
|
|
249
|
+
pendingWaitOutcomeByTurn.delete(null);
|
|
250
|
+
};
|
|
251
|
+
|
|
223
252
|
/** A new item of a different kind ends whatever was streaming at the tail. */
|
|
224
253
|
const closeStreamingTail = (): void => {
|
|
225
254
|
const open = last();
|
|
@@ -298,6 +327,7 @@ export function buildTimeline(events: SessionEvent[]): TimelineItem[] {
|
|
|
298
327
|
case "user.message": {
|
|
299
328
|
// A steering message must not mark in-flight tools complete; it only
|
|
300
329
|
// ends whatever text was streaming. Turn lifecycle events finalize.
|
|
330
|
+
clearUnscopedTerminalTracking();
|
|
301
331
|
closeStreamingTail();
|
|
302
332
|
const childCompletion = workerCompletionPayload(payload.childCompletion);
|
|
303
333
|
if (childCompletion) {
|
|
@@ -381,17 +411,20 @@ export function buildTimeline(events: SessionEvent[]): TimelineItem[] {
|
|
|
381
411
|
const open = last();
|
|
382
412
|
if (open?.kind === "agent-message" && open.streaming && open.turnId === turnId) {
|
|
383
413
|
open.text += text;
|
|
414
|
+
rememberAgentResponse(turnId, open, false);
|
|
384
415
|
break;
|
|
385
416
|
}
|
|
386
417
|
closeStreamingTail();
|
|
387
|
-
|
|
418
|
+
const item: AgentMessageItem = {
|
|
388
419
|
kind: "agent-message",
|
|
389
420
|
id: event.id,
|
|
390
421
|
turnId,
|
|
391
422
|
text,
|
|
392
423
|
streaming: true,
|
|
393
424
|
occurredAt: event.occurredAt,
|
|
394
|
-
}
|
|
425
|
+
};
|
|
426
|
+
items.push(item);
|
|
427
|
+
rememberAgentResponse(turnId, item, false);
|
|
395
428
|
break;
|
|
396
429
|
}
|
|
397
430
|
|
|
@@ -447,10 +480,11 @@ export function buildTimeline(events: SessionEvent[]): TimelineItem[] {
|
|
|
447
480
|
items.splice(openIndex, 1);
|
|
448
481
|
items.push(open);
|
|
449
482
|
}
|
|
483
|
+
rememberAgentResponse(turnId, open, true);
|
|
450
484
|
break;
|
|
451
485
|
}
|
|
452
486
|
if (text) {
|
|
453
|
-
|
|
487
|
+
const item: AgentMessageItem = {
|
|
454
488
|
kind: "agent-message",
|
|
455
489
|
id: event.id,
|
|
456
490
|
turnId,
|
|
@@ -466,7 +500,9 @@ export function buildTimeline(events: SessionEvent[]): TimelineItem[] {
|
|
|
466
500
|
turnId,
|
|
467
501
|
text,
|
|
468
502
|
},
|
|
469
|
-
}
|
|
503
|
+
};
|
|
504
|
+
items.push(item);
|
|
505
|
+
rememberAgentResponse(turnId, item, true);
|
|
470
506
|
}
|
|
471
507
|
break;
|
|
472
508
|
}
|
|
@@ -616,6 +652,7 @@ export function buildTimeline(events: SessionEvent[]): TimelineItem[] {
|
|
|
616
652
|
}
|
|
617
653
|
|
|
618
654
|
case "turn.started": {
|
|
655
|
+
if (turnId) clearUnscopedTerminalTracking();
|
|
619
656
|
if (!turnId) break;
|
|
620
657
|
const queuedAt = queuedAtByTurn.get(turnId);
|
|
621
658
|
if (!queuedAt) break;
|
|
@@ -781,6 +818,20 @@ export function buildTimeline(events: SessionEvent[]): TimelineItem[] {
|
|
|
781
818
|
break;
|
|
782
819
|
}
|
|
783
820
|
|
|
821
|
+
case "codex.capacity.waiting": {
|
|
822
|
+
items.push({
|
|
823
|
+
kind: "notice",
|
|
824
|
+
id: event.id,
|
|
825
|
+
tone: "waiting",
|
|
826
|
+
text:
|
|
827
|
+
stringValue(payload.detail) ??
|
|
828
|
+
stringValue(payload.error) ??
|
|
829
|
+
"Waiting for Codex capacity.",
|
|
830
|
+
occurredAt: event.occurredAt,
|
|
831
|
+
});
|
|
832
|
+
break;
|
|
833
|
+
}
|
|
834
|
+
|
|
784
835
|
case "session.requiresAction": {
|
|
785
836
|
finalizeOpen(turnId, "complete", event.occurredAt);
|
|
786
837
|
items.push({
|
|
@@ -922,6 +973,8 @@ export function buildTimeline(events: SessionEvent[]): TimelineItem[] {
|
|
|
922
973
|
// extra agent response.
|
|
923
974
|
if (payload.maintenance === "context_compaction") {
|
|
924
975
|
finalizeOpen(turnId, "complete", event.occurredAt);
|
|
976
|
+
takeAgentResponse(turnId);
|
|
977
|
+
takePendingWaitOutcome(turnId);
|
|
925
978
|
break;
|
|
926
979
|
}
|
|
927
980
|
// Credit exhaustion arrives as a NOMINALLY completed turn (`detail:
|
|
@@ -932,6 +985,8 @@ export function buildTimeline(events: SessionEvent[]): TimelineItem[] {
|
|
|
932
985
|
// projects exactly like a failed turn plus an explicit notice.
|
|
933
986
|
if (isCreditExhaustionPayload(payload)) {
|
|
934
987
|
finalizeOpen(turnId, "complete", event.occurredAt);
|
|
988
|
+
takeAgentResponse(turnId);
|
|
989
|
+
takePendingWaitOutcome(turnId);
|
|
935
990
|
items.push(turnEndItem(event, "failed", CREDIT_EXHAUSTION_MESSAGE));
|
|
936
991
|
items.push({
|
|
937
992
|
kind: "notice",
|
|
@@ -942,12 +997,68 @@ export function buildTimeline(events: SessionEvent[]): TimelineItem[] {
|
|
|
942
997
|
});
|
|
943
998
|
break;
|
|
944
999
|
}
|
|
1000
|
+
const latestAgentResponse = takeAgentResponse(turnId);
|
|
1001
|
+
const finalOutput = stringValue(payload.output);
|
|
1002
|
+
const visibleFinalOutput = stripOpaqueCitationTokens(finalOutput).trim();
|
|
1003
|
+
const visibleTrackedResponse = stripOpaqueCitationTokens(
|
|
1004
|
+
latestAgentResponse?.item.text ?? "",
|
|
1005
|
+
).trim();
|
|
1006
|
+
const finalOutputMirrorsCommentary =
|
|
1007
|
+
latestAgentResponse?.item.phase === "commentary" &&
|
|
1008
|
+
visibleTrackedResponse === visibleFinalOutput;
|
|
1009
|
+
const hasAuthoritativeFinalOutput =
|
|
1010
|
+
Boolean(visibleFinalOutput) && !finalOutputMirrorsCommentary;
|
|
1011
|
+
const pendingWaitOutcome = takePendingWaitOutcome(turnId);
|
|
1012
|
+
if (hasAuthoritativeFinalOutput) {
|
|
1013
|
+
// `agent.message.completed` and `turn.completed` normally commit
|
|
1014
|
+
// together, but legacy or partially compacted ledgers may retain only
|
|
1015
|
+
// the terminal output receipt. Keep that authoritative response
|
|
1016
|
+
// visible instead of leaving it trapped in raw audit data.
|
|
1017
|
+
if (
|
|
1018
|
+
latestAgentResponse &&
|
|
1019
|
+
!latestAgentResponse.completed &&
|
|
1020
|
+
finalOutput.startsWith(latestAgentResponse.item.text)
|
|
1021
|
+
) {
|
|
1022
|
+
latestAgentResponse.item.text = finalOutput;
|
|
1023
|
+
latestAgentResponse.item.streaming = false;
|
|
1024
|
+
latestAgentResponse.item.occurredAt = event.occurredAt;
|
|
1025
|
+
const responseIndex = items.indexOf(latestAgentResponse.item);
|
|
1026
|
+
if (responseIndex >= 0 && responseIndex < items.length - 1) {
|
|
1027
|
+
items.splice(responseIndex, 1);
|
|
1028
|
+
items.push(latestAgentResponse.item);
|
|
1029
|
+
}
|
|
1030
|
+
} else if (visibleTrackedResponse !== visibleFinalOutput) {
|
|
1031
|
+
items.push({
|
|
1032
|
+
kind: "agent-message",
|
|
1033
|
+
id: `${event.id}-output-message`,
|
|
1034
|
+
turnId,
|
|
1035
|
+
text: finalOutput,
|
|
1036
|
+
streaming: false,
|
|
1037
|
+
occurredAt: event.occurredAt,
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
945
1041
|
finalizeOpen(turnId, "complete", event.occurredAt);
|
|
946
1042
|
items.push(turnEndItem(event, "complete", null));
|
|
1043
|
+
const hasCompletedFinalResponse =
|
|
1044
|
+
latestAgentResponse?.completed === true &&
|
|
1045
|
+
latestAgentResponse.item.phase !== "commentary" &&
|
|
1046
|
+
Boolean(visibleTrackedResponse);
|
|
1047
|
+
if (!hasAuthoritativeFinalOutput && !hasCompletedFinalResponse && pendingWaitOutcome) {
|
|
1048
|
+
items.push({
|
|
1049
|
+
kind: "notice",
|
|
1050
|
+
id: `${pendingWaitOutcome.id}-visible-outcome`,
|
|
1051
|
+
tone: "waiting",
|
|
1052
|
+
text: waitingOutcomeText(pendingWaitOutcome.reason),
|
|
1053
|
+
occurredAt: pendingWaitOutcome.occurredAt,
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
947
1056
|
break;
|
|
948
1057
|
}
|
|
949
1058
|
|
|
950
1059
|
case "turn.failed": {
|
|
1060
|
+
takeAgentResponse(turnId);
|
|
1061
|
+
takePendingWaitOutcome(turnId);
|
|
951
1062
|
const hadActivity = hasTurnActivity(items, turnId);
|
|
952
1063
|
// Credit death can hide behind fields `failureMessage` doesn't read
|
|
953
1064
|
// (detail/segmentLimit), so classify the whole payload before falling
|
|
@@ -980,6 +1091,8 @@ export function buildTimeline(events: SessionEvent[]): TimelineItem[] {
|
|
|
980
1091
|
if (turnId && !prescan.startedTurnIds.has(turnId)) {
|
|
981
1092
|
break;
|
|
982
1093
|
}
|
|
1094
|
+
takeAgentResponse(turnId);
|
|
1095
|
+
takePendingWaitOutcome(turnId);
|
|
983
1096
|
const hadActivity = hasTurnActivity(items, turnId);
|
|
984
1097
|
finalizeOpen(turnId, "cancelled", event.occurredAt);
|
|
985
1098
|
items.push(turnEndItem(event, "cancelled", null));
|
|
@@ -1025,6 +1138,9 @@ export function buildTimeline(events: SessionEvent[]): TimelineItem[] {
|
|
|
1025
1138
|
case "goal.cleared":
|
|
1026
1139
|
case "goal.held":
|
|
1027
1140
|
case "goal.continuation": {
|
|
1141
|
+
if (event.type === "goal.held" && payload.actor === "agent") {
|
|
1142
|
+
rememberPendingWaitOutcome(pendingWaitOutcomeByTurn, event, payload, turnId);
|
|
1143
|
+
}
|
|
1028
1144
|
// Agent tool mutations already appear as tool-call rows in the activity
|
|
1029
1145
|
// cluster. Re-emitting them as GoalRow landmarks splits "N steps" mid-turn.
|
|
1030
1146
|
if (shouldSuppressAgentGoalLandmark(event.type, payload)) {
|
|
@@ -1043,6 +1159,13 @@ export function buildTimeline(events: SessionEvent[]): TimelineItem[] {
|
|
|
1043
1159
|
break;
|
|
1044
1160
|
}
|
|
1045
1161
|
|
|
1162
|
+
case "session.wait.started": {
|
|
1163
|
+
if (payload.actor === "agent") {
|
|
1164
|
+
rememberPendingWaitOutcome(pendingWaitOutcomeByTurn, event, payload, turnId);
|
|
1165
|
+
}
|
|
1166
|
+
break;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1046
1169
|
default:
|
|
1047
1170
|
break;
|
|
1048
1171
|
}
|
|
@@ -1953,6 +2076,8 @@ const SESSION_STATUSES: readonly SessionStatus[] = [
|
|
|
1953
2076
|
"running",
|
|
1954
2077
|
"idle",
|
|
1955
2078
|
"requires_action",
|
|
2079
|
+
"recovering",
|
|
2080
|
+
"waiting_capacity",
|
|
1956
2081
|
"failed",
|
|
1957
2082
|
"cancelled",
|
|
1958
2083
|
];
|
|
@@ -2173,11 +2298,30 @@ function goalText(payload: Record<string, unknown>): string | null {
|
|
|
2173
2298
|
return null;
|
|
2174
2299
|
}
|
|
2175
2300
|
|
|
2301
|
+
function rememberPendingWaitOutcome(
|
|
2302
|
+
pending: Map<string | null, PendingWaitOutcome>,
|
|
2303
|
+
event: SessionEvent,
|
|
2304
|
+
payload: Record<string, unknown>,
|
|
2305
|
+
eventTurnId: string | null,
|
|
2306
|
+
): void {
|
|
2307
|
+
const reason = stringValue(payload.reason).trim();
|
|
2308
|
+
if (!reason) return;
|
|
2309
|
+
const turnId =
|
|
2310
|
+
eventTurnId || stringValue(payload.waitTurnId) || stringValue(payload.turnId) || null;
|
|
2311
|
+
pending.set(turnId, { id: event.id, reason, occurredAt: event.occurredAt });
|
|
2312
|
+
}
|
|
2313
|
+
|
|
2314
|
+
function waitingOutcomeText(reason: string): string {
|
|
2315
|
+
return /^waiting\b/i.test(reason) ? reason : `Waiting: ${reason}`;
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2176
2318
|
/**
|
|
2177
2319
|
* Agent-owned goal mutations already have an in-cluster tool row. Suppress the
|
|
2178
|
-
* breakaway landmark for those only.
|
|
2179
|
-
* and
|
|
2180
|
-
*
|
|
2320
|
+
* breakaway landmark for those only. Empty wait turns retain the durable hold
|
|
2321
|
+
* reason and surface it after the folded steps. `goal.completed` has no actor
|
|
2322
|
+
* field today and is only emitted by the agent tool, so it is always
|
|
2323
|
+
* suppressed. API / system / create-session / continuation landmarks stay
|
|
2324
|
+
* visible.
|
|
2181
2325
|
*/
|
|
2182
2326
|
function shouldSuppressAgentGoalLandmark(type: string, payload: Record<string, unknown>): boolean {
|
|
2183
2327
|
if (type === "goal.completed") {
|
package/src/timeline/registry.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type { ToolCallItem } from "./types";
|
|
|
13
13
|
Resolution order (most → least specific):
|
|
14
14
|
1. exact match on `raw.type` (e.g. "apply_patch_call", "computer_call")
|
|
15
15
|
2. exact match on the tool `name` (e.g. "exec_command", "web_search_call")
|
|
16
|
-
3. leaf match after MCP `__` prefix (e.g. opengeni__environment_set_variable)
|
|
16
|
+
3. allowed leaf match after MCP `__` prefix (e.g. opengeni__environment_set_variable)
|
|
17
17
|
4. the registry's generic fallback
|
|
18
18
|
|
|
19
19
|
A consumer extends the defaults without forking by passing overrides to
|
|
@@ -48,7 +48,13 @@ export type ToolRenderer = ComponentType<ToolRendererProps>;
|
|
|
48
48
|
/** A registry entry: which key it matches and the component that renders it. */
|
|
49
49
|
export type ToolRegistryEntry =
|
|
50
50
|
| { match: "rawType"; type: string; render: ToolRenderer }
|
|
51
|
-
| {
|
|
51
|
+
| {
|
|
52
|
+
match: "name";
|
|
53
|
+
name: string;
|
|
54
|
+
render: ToolRenderer;
|
|
55
|
+
/** Disable untrusted `<server>__${name}` leaf matching for identity-sensitive renderers. */
|
|
56
|
+
matchPrefixedLeaf?: boolean | undefined;
|
|
57
|
+
};
|
|
52
58
|
|
|
53
59
|
export type ToolRegistry = {
|
|
54
60
|
/** Resolve the renderer for a call (never null — falls back to generic). */
|
|
@@ -92,6 +98,7 @@ export function createToolRegistry(
|
|
|
92
98
|
|
|
93
99
|
const byRawType = new Map<string, ToolRenderer>();
|
|
94
100
|
const byName = new Map<string, ToolRenderer>();
|
|
101
|
+
const byPrefixedLeaf = new Map<string, ToolRenderer>();
|
|
95
102
|
for (const entry of entries) {
|
|
96
103
|
if (entry.match === "rawType") {
|
|
97
104
|
if (!byRawType.has(entry.type)) {
|
|
@@ -100,6 +107,11 @@ export function createToolRegistry(
|
|
|
100
107
|
} else if (!byName.has(entry.name)) {
|
|
101
108
|
byName.set(entry.name, entry.render);
|
|
102
109
|
}
|
|
110
|
+
if (entry.match === "name" && entry.matchPrefixedLeaf !== false) {
|
|
111
|
+
if (!byPrefixedLeaf.has(entry.name)) {
|
|
112
|
+
byPrefixedLeaf.set(entry.name, entry.render);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
103
115
|
}
|
|
104
116
|
|
|
105
117
|
const resolve = (item: ToolCallItem): ToolRenderer => {
|
|
@@ -116,7 +128,7 @@ export function createToolRegistry(
|
|
|
116
128
|
}
|
|
117
129
|
const leaf = mcpToolLeaf(item.name);
|
|
118
130
|
if (leaf !== item.name) {
|
|
119
|
-
const byLeaf =
|
|
131
|
+
const byLeaf = byPrefixedLeaf.get(leaf);
|
|
120
132
|
if (byLeaf) {
|
|
121
133
|
return byLeaf;
|
|
122
134
|
}
|
|
@@ -1085,6 +1085,98 @@ function SandboxFilePublishRenderer({ item, loadRetainedArtifact }: ToolRenderer
|
|
|
1085
1085
|
);
|
|
1086
1086
|
}
|
|
1087
1087
|
|
|
1088
|
+
type PublishedSiteReceipt = {
|
|
1089
|
+
workspaceId: string;
|
|
1090
|
+
artifactId: string;
|
|
1091
|
+
title: string;
|
|
1092
|
+
revision: number;
|
|
1093
|
+
replayed: boolean;
|
|
1094
|
+
};
|
|
1095
|
+
|
|
1096
|
+
function publishedSiteReceipt(output: unknown): PublishedSiteReceipt | null {
|
|
1097
|
+
const { text, isError } = unwrapMcpOutput(output);
|
|
1098
|
+
if (isError) return null;
|
|
1099
|
+
const parsed = tryParseJson(text);
|
|
1100
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
1101
|
+
const artifact = (parsed as Record<string, unknown>).artifact;
|
|
1102
|
+
const version = (parsed as Record<string, unknown>).version;
|
|
1103
|
+
if (
|
|
1104
|
+
!artifact ||
|
|
1105
|
+
typeof artifact !== "object" ||
|
|
1106
|
+
Array.isArray(artifact) ||
|
|
1107
|
+
!version ||
|
|
1108
|
+
typeof version !== "object" ||
|
|
1109
|
+
Array.isArray(version)
|
|
1110
|
+
) {
|
|
1111
|
+
return null;
|
|
1112
|
+
}
|
|
1113
|
+
const artifactRecord = artifact as Record<string, unknown>;
|
|
1114
|
+
const versionRecord = version as Record<string, unknown>;
|
|
1115
|
+
if (
|
|
1116
|
+
typeof artifactRecord.workspaceId !== "string" ||
|
|
1117
|
+
typeof artifactRecord.id !== "string" ||
|
|
1118
|
+
typeof artifactRecord.title !== "string" ||
|
|
1119
|
+
typeof versionRecord.revision !== "number" ||
|
|
1120
|
+
!Number.isInteger(versionRecord.revision) ||
|
|
1121
|
+
versionRecord.revision < 1
|
|
1122
|
+
) {
|
|
1123
|
+
return null;
|
|
1124
|
+
}
|
|
1125
|
+
return {
|
|
1126
|
+
workspaceId: artifactRecord.workspaceId,
|
|
1127
|
+
artifactId: artifactRecord.id,
|
|
1128
|
+
title: artifactRecord.title,
|
|
1129
|
+
revision: versionRecord.revision,
|
|
1130
|
+
replayed: (parsed as Record<string, unknown>).replayed === true,
|
|
1131
|
+
};
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
function SiteOpenLink({ receipt }: { receipt: PublishedSiteReceipt }) {
|
|
1135
|
+
const href = `/workspaces/${encodeURIComponent(receipt.workspaceId)}/artifacts/${encodeURIComponent(receipt.artifactId)}`;
|
|
1136
|
+
return (
|
|
1137
|
+
<a
|
|
1138
|
+
href={href}
|
|
1139
|
+
aria-label={`Open ${receipt.title}`}
|
|
1140
|
+
className="inline-flex min-h-7 items-center rounded-og-sm px-2 text-og-sm font-medium text-og-accent-strong hover:bg-og-surface-2 hover:underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent pointer-coarse:min-h-10"
|
|
1141
|
+
onClick={(event) => event.stopPropagation()}
|
|
1142
|
+
onKeyDown={(event) => event.stopPropagation()}
|
|
1143
|
+
>
|
|
1144
|
+
Open
|
|
1145
|
+
</a>
|
|
1146
|
+
);
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
function SiteArtifactRenderer({ item }: ToolRendererProps) {
|
|
1150
|
+
const leaf = mcpToolLeaf(item.name);
|
|
1151
|
+
const publishingExisting = leaf === "artifacts_publish";
|
|
1152
|
+
if (item.status === "running") {
|
|
1153
|
+
return (
|
|
1154
|
+
<ActivityDisclosure
|
|
1155
|
+
icon={<PanelsTopLeftIcon className={ICON_SIZE} />}
|
|
1156
|
+
iconTone="running"
|
|
1157
|
+
title={publishingExisting ? "Publishing Site update" : "Publishing Site"}
|
|
1158
|
+
running
|
|
1159
|
+
preview={<RunningPreview>retaining source and compiled HTML…</RunningPreview>}
|
|
1160
|
+
/>
|
|
1161
|
+
);
|
|
1162
|
+
}
|
|
1163
|
+
const receipt = publishedSiteReceipt(item.output);
|
|
1164
|
+
if (!receipt || item.status === "failed") return <GenericRenderer item={item} />;
|
|
1165
|
+
return (
|
|
1166
|
+
<ActivityDisclosure
|
|
1167
|
+
icon={<PanelsTopLeftIcon className={ICON_SIZE} />}
|
|
1168
|
+
iconTone="accent"
|
|
1169
|
+
title={publishingExisting ? `Updated ${receipt.title}` : `Published ${receipt.title}`}
|
|
1170
|
+
media={<SiteOpenLink receipt={receipt} />}
|
|
1171
|
+
>
|
|
1172
|
+
<BodyNote>
|
|
1173
|
+
Version {receipt.revision} is live
|
|
1174
|
+
{receipt.replayed ? " (replayed from the original publication)." : "."}
|
|
1175
|
+
</BodyNote>
|
|
1176
|
+
</ActivityDisclosure>
|
|
1177
|
+
);
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1088
1180
|
function GeneratedImageDisclosure({
|
|
1089
1181
|
receipt,
|
|
1090
1182
|
load,
|
|
@@ -2198,7 +2290,7 @@ function goalToolPreview(name: string, args: unknown): string | null {
|
|
|
2198
2290
|
leaf !== "goal_update" &&
|
|
2199
2291
|
leaf !== "goal_complete" &&
|
|
2200
2292
|
leaf !== "goal_pause" &&
|
|
2201
|
-
leaf !== "
|
|
2293
|
+
leaf !== "wait_for_input"
|
|
2202
2294
|
) {
|
|
2203
2295
|
return null;
|
|
2204
2296
|
}
|
|
@@ -2308,6 +2400,30 @@ const BASE_ENTRIES: ToolRegistryEntry[] = [
|
|
|
2308
2400
|
{ match: "name", name: "tool_search", render: ToolSearchRenderer },
|
|
2309
2401
|
{ match: "name", name: "view_image", render: ViewImageRenderer },
|
|
2310
2402
|
{ match: "name", name: "sandbox_file_publish", render: SandboxFilePublishRenderer },
|
|
2403
|
+
{
|
|
2404
|
+
match: "name",
|
|
2405
|
+
name: "artifacts_create",
|
|
2406
|
+
render: SiteArtifactRenderer,
|
|
2407
|
+
matchPrefixedLeaf: false,
|
|
2408
|
+
},
|
|
2409
|
+
{
|
|
2410
|
+
match: "name",
|
|
2411
|
+
name: "artifacts_publish",
|
|
2412
|
+
render: SiteArtifactRenderer,
|
|
2413
|
+
matchPrefixedLeaf: false,
|
|
2414
|
+
},
|
|
2415
|
+
{
|
|
2416
|
+
match: "name",
|
|
2417
|
+
name: "opengeni__artifacts_create",
|
|
2418
|
+
render: SiteArtifactRenderer,
|
|
2419
|
+
matchPrefixedLeaf: false,
|
|
2420
|
+
},
|
|
2421
|
+
{
|
|
2422
|
+
match: "name",
|
|
2423
|
+
name: "opengeni__artifacts_publish",
|
|
2424
|
+
render: SiteArtifactRenderer,
|
|
2425
|
+
matchPrefixedLeaf: false,
|
|
2426
|
+
},
|
|
2311
2427
|
{ match: "name", name: "environment_set_variable", render: SecretSetRenderer },
|
|
2312
2428
|
{ match: "name", name: "variable_set_set_variable", render: SecretSetRenderer },
|
|
2313
2429
|
{ match: "name", name: "search_documents", render: DocsSearchRenderer },
|
package/src/timeline/types.ts
CHANGED
|
@@ -279,7 +279,14 @@ export type FleetDecisionItem = {
|
|
|
279
279
|
policyVersion: "adaptive-shadow-v1";
|
|
280
280
|
actualOutcome: "selected" | "waiting" | "none";
|
|
281
281
|
actualCandidateKey: string | null;
|
|
282
|
-
actualReason:
|
|
282
|
+
actualReason:
|
|
283
|
+
| "lease_reused"
|
|
284
|
+
| "pin"
|
|
285
|
+
| "rotation"
|
|
286
|
+
| "active"
|
|
287
|
+
| "all_capped"
|
|
288
|
+
| "allocator_disabled"
|
|
289
|
+
| "none";
|
|
283
290
|
shadowOutcome: "selected" | "paced" | "none";
|
|
284
291
|
shadowCandidateKey: string | null;
|
|
285
292
|
shadowReason:
|