veryfront 0.1.700 → 0.1.703
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/esm/cli/templates/manifest.d.ts +0 -2
- package/esm/cli/templates/manifest.js +1 -3
- package/esm/deno.js +1 -1
- package/esm/src/agent/streaming/fork-runtime-part-mapper.d.ts +59 -0
- package/esm/src/agent/streaming/fork-runtime-part-mapper.d.ts.map +1 -0
- package/esm/src/agent/streaming/fork-runtime-part-mapper.js +246 -0
- package/esm/src/agent/streaming/fork-runtime-stream.d.ts +2 -50
- package/esm/src/agent/streaming/fork-runtime-stream.d.ts.map +1 -1
- package/esm/src/agent/streaming/fork-runtime-stream.js +3 -245
- package/esm/src/integrations/_data.d.ts.map +1 -1
- package/esm/src/integrations/_data.js +1 -42
- package/esm/src/oauth/providers/common.d.ts.map +1 -1
- package/esm/src/oauth/providers/common.js +6 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/workflow/claude-code/react/event-state-reducer.d.ts +37 -0
- package/esm/src/workflow/claude-code/react/event-state-reducer.d.ts.map +1 -0
- package/esm/src/workflow/claude-code/react/event-state-reducer.js +104 -0
- package/esm/src/workflow/claude-code/react/use-claude-code-stream.d.ts +3 -35
- package/esm/src/workflow/claude-code/react/use-claude-code-stream.d.ts.map +1 -1
- package/esm/src/workflow/claude-code/react/use-claude-code-stream.js +9 -78
- package/esm/src/workflow/claude-code/react/use-claude-code-websocket.d.ts +2 -27
- package/esm/src/workflow/claude-code/react/use-claude-code-websocket.d.ts.map +1 -1
- package/esm/src/workflow/claude-code/react/use-claude-code-websocket.js +5 -57
- package/esm/src/workflow/executor/dag/index.d.ts +1 -2
- package/esm/src/workflow/executor/dag/index.d.ts.map +1 -1
- package/esm/src/workflow/executor/dag/index.js +37 -216
- package/esm/src/workflow/executor/dag/loop-node-strategy.d.ts +13 -0
- package/esm/src/workflow/executor/dag/loop-node-strategy.d.ts.map +1 -0
- package/esm/src/workflow/executor/dag/loop-node-strategy.js +134 -0
- package/esm/src/workflow/executor/dag/map-node-strategy.d.ts +13 -0
- package/esm/src/workflow/executor/dag/map-node-strategy.d.ts.map +1 -0
- package/esm/src/workflow/executor/dag/map-node-strategy.js +78 -0
- package/esm/src/workflow/executor/dag/node-strategy-types.d.ts +11 -0
- package/esm/src/workflow/executor/dag/node-strategy-types.d.ts.map +1 -0
- package/esm/src/workflow/executor/dag/node-strategy-types.js +1 -0
- package/package.json +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as dntShim from "../../../_dnt.shims.js";
|
|
2
2
|
import { createToolsFromHostDefinitions, traceHostTools, } from "../../tool/index.js";
|
|
3
3
|
import { isRecord } from "../../chat/conversation.js";
|
|
4
|
-
import { safeJsonParse } from "../../chat/provider-errors.js";
|
|
5
4
|
import { runWithVeryfrontCloudContextAsync } from "../../provider/veryfront-cloud/context.js";
|
|
6
|
-
import { mergeToolInputDelta, parseToolInputObject, streamDataStreamEvents,
|
|
5
|
+
import { mergeToolInputDelta, parseToolInputObject, streamDataStreamEvents, } from "./data-stream.js";
|
|
6
|
+
import { buildRecoveredStepParts, createForkRuntimeStreamMappingState, getParsedStreamedToolInput, mapAgUiRuntimeEventToForkParts, } from "./fork-runtime-part-mapper.js";
|
|
7
7
|
import { HOSTED_CHILD_STREAM_TIMEOUT_TOKEN, resolveHostedChildPromiseWithTimeout, } from "../hosted/child-stream-watchdog.js";
|
|
8
8
|
import { getForkRuntimeAllowedToolNames, getProviderNativeToolNames, } from "../runtime/provider-native-tool-inventory.js";
|
|
9
9
|
import { AgentRuntime } from "../runtime/index.js";
|
|
10
|
+
export { buildRecoveredStepParts, createForkRuntimeStreamMappingState, createFrameworkStreamState, mapAgUiRuntimeEventToForkParts, mapFrameworkEventToForkParts, } from "./fork-runtime-part-mapper.js";
|
|
10
11
|
/** Default value for fork response promise timeout ms. */
|
|
11
12
|
export const DEFAULT_FORK_RESPONSE_PROMISE_TIMEOUT_MS = 1_000;
|
|
12
13
|
/** Starts agent runtime fork with host tools. */
|
|
@@ -547,246 +548,3 @@ export async function resolveForkStepResponse(input) {
|
|
|
547
548
|
state: fallbackState,
|
|
548
549
|
});
|
|
549
550
|
}
|
|
550
|
-
function warnForkRuntimeStream(logger, message, metadata) {
|
|
551
|
-
logger?.warn(message, metadata);
|
|
552
|
-
}
|
|
553
|
-
/** Builds recovered step parts. */
|
|
554
|
-
export function buildRecoveredStepParts(step, state) {
|
|
555
|
-
const recoveredParts = [];
|
|
556
|
-
for (const toolCall of step.toolCalls) {
|
|
557
|
-
if (state.emittedToolCallIds.has(toolCall.toolCallId)) {
|
|
558
|
-
continue;
|
|
559
|
-
}
|
|
560
|
-
const streamedCall = state.toolCalls.get(toolCall.toolCallId);
|
|
561
|
-
warnForkRuntimeStream(state.logger, "Child fork recovered missing tool-call from final step", {
|
|
562
|
-
toolCallId: toolCall.toolCallId,
|
|
563
|
-
toolName: toolCall.toolName,
|
|
564
|
-
sawInputStart: streamedCall?.sawInputStart ?? false,
|
|
565
|
-
sawInputDelta: streamedCall?.sawInputDelta ?? false,
|
|
566
|
-
sawInputAvailable: streamedCall?.sawInputAvailable ?? false,
|
|
567
|
-
sawOutputAvailable: streamedCall?.sawOutputAvailable ?? false,
|
|
568
|
-
sawOutputError: streamedCall?.sawOutputError ?? false,
|
|
569
|
-
});
|
|
570
|
-
state.emittedToolCallIds.add(toolCall.toolCallId);
|
|
571
|
-
recoveredParts.push({
|
|
572
|
-
type: "tool-call",
|
|
573
|
-
toolCallId: toolCall.toolCallId,
|
|
574
|
-
toolName: toolCall.toolName,
|
|
575
|
-
input: toolCall.input,
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
for (const toolResult of step.toolResults) {
|
|
579
|
-
if (state.emittedToolResultIds.has(toolResult.toolCallId)) {
|
|
580
|
-
continue;
|
|
581
|
-
}
|
|
582
|
-
const streamedCall = state.toolCalls.get(toolResult.toolCallId);
|
|
583
|
-
warnForkRuntimeStream(state.logger, "Child fork recovered missing tool-result from final step", {
|
|
584
|
-
toolCallId: toolResult.toolCallId,
|
|
585
|
-
toolName: toolResult.toolName,
|
|
586
|
-
sawInputStart: streamedCall?.sawInputStart ?? false,
|
|
587
|
-
sawInputDelta: streamedCall?.sawInputDelta ?? false,
|
|
588
|
-
sawInputAvailable: streamedCall?.sawInputAvailable ?? false,
|
|
589
|
-
sawOutputAvailable: streamedCall?.sawOutputAvailable ?? false,
|
|
590
|
-
sawOutputError: streamedCall?.sawOutputError ?? false,
|
|
591
|
-
});
|
|
592
|
-
state.emittedToolResultIds.add(toolResult.toolCallId);
|
|
593
|
-
recoveredParts.push({
|
|
594
|
-
type: "tool-result",
|
|
595
|
-
toolCallId: toolResult.toolCallId,
|
|
596
|
-
toolName: toolResult.toolName,
|
|
597
|
-
input: toolResult.input,
|
|
598
|
-
output: toolResult.output,
|
|
599
|
-
});
|
|
600
|
-
}
|
|
601
|
-
return recoveredParts;
|
|
602
|
-
}
|
|
603
|
-
function isEmptyRecord(value) {
|
|
604
|
-
return Object.keys(value).length === 0;
|
|
605
|
-
}
|
|
606
|
-
function getParsedStreamedToolInput(inputText) {
|
|
607
|
-
const strippedInputText = stripLeadingEmptyObjectPlaceholder(inputText).trim();
|
|
608
|
-
const normalizedInputText = strippedInputText.startsWith('"')
|
|
609
|
-
? `{${strippedInputText}`
|
|
610
|
-
: strippedInputText;
|
|
611
|
-
if (normalizedInputText.length === 0) {
|
|
612
|
-
return {};
|
|
613
|
-
}
|
|
614
|
-
const parsed = safeJsonParse(normalizedInputText);
|
|
615
|
-
if (!parsed.ok) {
|
|
616
|
-
return null;
|
|
617
|
-
}
|
|
618
|
-
return isRecord(parsed.value) ? Object.fromEntries(Object.entries(parsed.value)) : {};
|
|
619
|
-
}
|
|
620
|
-
function buildToolCallPartIfNeeded(toolCallId, state) {
|
|
621
|
-
const toolCall = state.toolCalls.get(toolCallId);
|
|
622
|
-
if (!toolCall || state.emittedToolCallIds.has(toolCallId)) {
|
|
623
|
-
return [];
|
|
624
|
-
}
|
|
625
|
-
state.emittedToolCallIds.add(toolCallId);
|
|
626
|
-
return [
|
|
627
|
-
{
|
|
628
|
-
type: "tool-call",
|
|
629
|
-
toolCallId,
|
|
630
|
-
toolName: toolCall.toolName,
|
|
631
|
-
input: toolCall.input,
|
|
632
|
-
},
|
|
633
|
-
];
|
|
634
|
-
}
|
|
635
|
-
/** State for create fork runtime stream mapping. */
|
|
636
|
-
export function createForkRuntimeStreamMappingState(input = {}) {
|
|
637
|
-
return {
|
|
638
|
-
toolCalls: new Map(),
|
|
639
|
-
emittedToolCallIds: new Set(),
|
|
640
|
-
emittedToolResultIds: new Set(),
|
|
641
|
-
...(input.logger ? { logger: input.logger } : {}),
|
|
642
|
-
};
|
|
643
|
-
}
|
|
644
|
-
/** Map AG-UI runtime event to fork parts. */
|
|
645
|
-
export function mapAgUiRuntimeEventToForkParts(event, state) {
|
|
646
|
-
switch (event.type) {
|
|
647
|
-
case "reasoning-delta":
|
|
648
|
-
return typeof event.delta === "string"
|
|
649
|
-
? [{ type: "reasoning-delta", text: event.delta }]
|
|
650
|
-
: [];
|
|
651
|
-
case "text-delta":
|
|
652
|
-
return typeof event.delta === "string" ? [{ type: "text-delta", text: event.delta }] : [];
|
|
653
|
-
case "tool-input-start": {
|
|
654
|
-
const toolCallId = typeof event.toolCallId === "string" ? event.toolCallId : null;
|
|
655
|
-
const toolName = typeof event.toolName === "string" ? event.toolName : null;
|
|
656
|
-
if (!toolCallId || !toolName) {
|
|
657
|
-
return [];
|
|
658
|
-
}
|
|
659
|
-
const existing = state.toolCalls.get(toolCallId);
|
|
660
|
-
state.toolCalls.set(toolCallId, {
|
|
661
|
-
toolName,
|
|
662
|
-
inputText: existing?.inputText ?? "",
|
|
663
|
-
input: existing?.input ?? {},
|
|
664
|
-
sawInputStart: true,
|
|
665
|
-
sawInputDelta: existing?.sawInputDelta ?? false,
|
|
666
|
-
sawInputAvailable: existing?.sawInputAvailable ?? false,
|
|
667
|
-
sawOutputAvailable: existing?.sawOutputAvailable ?? false,
|
|
668
|
-
sawOutputError: existing?.sawOutputError ?? false,
|
|
669
|
-
});
|
|
670
|
-
return [{ type: "tool-input-start", toolCallId, toolName }];
|
|
671
|
-
}
|
|
672
|
-
case "tool-input-delta": {
|
|
673
|
-
const inputToolCallId = typeof event.toolCallId === "string" ? event.toolCallId : null;
|
|
674
|
-
const inputDelta = typeof event.inputTextDelta === "string" ? event.inputTextDelta : null;
|
|
675
|
-
if (!inputToolCallId || !inputDelta) {
|
|
676
|
-
return [];
|
|
677
|
-
}
|
|
678
|
-
const existing = state.toolCalls.get(inputToolCallId);
|
|
679
|
-
if (existing) {
|
|
680
|
-
existing.inputText = mergeToolInputDelta(existing.inputText, inputDelta);
|
|
681
|
-
existing.sawInputDelta = true;
|
|
682
|
-
const parsedInput = getParsedStreamedToolInput(existing.inputText);
|
|
683
|
-
if (parsedInput) {
|
|
684
|
-
existing.input = parsedInput;
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
else {
|
|
688
|
-
warnForkRuntimeStream(state.logger, "Child fork received tool-input-delta before tool-input-start", {
|
|
689
|
-
toolCallId: inputToolCallId,
|
|
690
|
-
deltaLength: inputDelta.length,
|
|
691
|
-
});
|
|
692
|
-
}
|
|
693
|
-
return [{ type: "tool-input-delta", toolCallId: inputToolCallId, delta: inputDelta }];
|
|
694
|
-
}
|
|
695
|
-
case "tool-input-available": {
|
|
696
|
-
const toolCallId = typeof event.toolCallId === "string" ? event.toolCallId : null;
|
|
697
|
-
const toolName = typeof event.toolName === "string" ? event.toolName : null;
|
|
698
|
-
if (!toolCallId || !toolName) {
|
|
699
|
-
return [];
|
|
700
|
-
}
|
|
701
|
-
const input = parseToolInputObject(event.input);
|
|
702
|
-
const existing = state.toolCalls.get(toolCallId);
|
|
703
|
-
const resolvedInput = existing && isEmptyRecord(input) && !isEmptyRecord(existing.input)
|
|
704
|
-
? existing.input
|
|
705
|
-
: input;
|
|
706
|
-
state.toolCalls.set(toolCallId, {
|
|
707
|
-
toolName,
|
|
708
|
-
inputText: "",
|
|
709
|
-
input: resolvedInput,
|
|
710
|
-
sawInputStart: existing?.sawInputStart ?? false,
|
|
711
|
-
sawInputDelta: existing?.sawInputDelta ?? false,
|
|
712
|
-
sawInputAvailable: true,
|
|
713
|
-
sawOutputAvailable: existing?.sawOutputAvailable ?? false,
|
|
714
|
-
sawOutputError: existing?.sawOutputError ?? false,
|
|
715
|
-
});
|
|
716
|
-
return buildToolCallPartIfNeeded(toolCallId, state);
|
|
717
|
-
}
|
|
718
|
-
case "tool-output-available": {
|
|
719
|
-
if (event.preliminary === true) {
|
|
720
|
-
return [];
|
|
721
|
-
}
|
|
722
|
-
const toolCallId = typeof event.toolCallId === "string" ? event.toolCallId : null;
|
|
723
|
-
if (!toolCallId) {
|
|
724
|
-
return [];
|
|
725
|
-
}
|
|
726
|
-
const call = state.toolCalls.get(toolCallId);
|
|
727
|
-
if (!call) {
|
|
728
|
-
return [];
|
|
729
|
-
}
|
|
730
|
-
call.sawOutputAvailable = true;
|
|
731
|
-
const parts = [
|
|
732
|
-
...buildToolCallPartIfNeeded(toolCallId, state),
|
|
733
|
-
];
|
|
734
|
-
state.emittedToolResultIds.add(toolCallId);
|
|
735
|
-
parts.push({
|
|
736
|
-
type: "tool-result",
|
|
737
|
-
toolCallId,
|
|
738
|
-
toolName: call.toolName,
|
|
739
|
-
input: call.input,
|
|
740
|
-
output: Object.hasOwn(event, "output") ? event.output : null,
|
|
741
|
-
});
|
|
742
|
-
return parts;
|
|
743
|
-
}
|
|
744
|
-
case "tool-output-error":
|
|
745
|
-
case "tool-input-error": {
|
|
746
|
-
const toolCallId = typeof event.toolCallId === "string" ? event.toolCallId : null;
|
|
747
|
-
if (!toolCallId) {
|
|
748
|
-
return [];
|
|
749
|
-
}
|
|
750
|
-
const call = state.toolCalls.get(toolCallId);
|
|
751
|
-
const errorText = typeof event.errorText === "string"
|
|
752
|
-
? event.errorText
|
|
753
|
-
: typeof event.error === "string"
|
|
754
|
-
? event.error
|
|
755
|
-
: "Tool execution failed";
|
|
756
|
-
if (call) {
|
|
757
|
-
call.sawOutputError = true;
|
|
758
|
-
}
|
|
759
|
-
const parts = [
|
|
760
|
-
...buildToolCallPartIfNeeded(toolCallId, state),
|
|
761
|
-
];
|
|
762
|
-
parts.push({
|
|
763
|
-
type: "tool-error",
|
|
764
|
-
toolCallId,
|
|
765
|
-
toolName: call?.toolName ?? "unknown",
|
|
766
|
-
input: call?.input ?? {},
|
|
767
|
-
error: new Error(errorText),
|
|
768
|
-
});
|
|
769
|
-
return parts;
|
|
770
|
-
}
|
|
771
|
-
case "error": {
|
|
772
|
-
const errorText = typeof event.errorText === "string"
|
|
773
|
-
? event.errorText
|
|
774
|
-
: "Framework stream failed";
|
|
775
|
-
return [{ type: "error", error: new Error(errorText) }];
|
|
776
|
-
}
|
|
777
|
-
default:
|
|
778
|
-
return [];
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
/** State for create framework stream.
|
|
782
|
-
* @deprecated Use createForkRuntimeStreamMappingState.
|
|
783
|
-
*/
|
|
784
|
-
export function createFrameworkStreamState(input = {}) {
|
|
785
|
-
return createForkRuntimeStreamMappingState(input);
|
|
786
|
-
}
|
|
787
|
-
/** Handles map framework event to fork parts.
|
|
788
|
-
* @deprecated Use mapAgUiRuntimeEventToForkParts.
|
|
789
|
-
*/
|
|
790
|
-
export function mapFrameworkEventToForkParts(event, state) {
|
|
791
|
-
return mapAgUiRuntimeEventToForkParts(event, state);
|
|
792
|
-
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_data.d.ts","sourceRoot":"","sources":["../../../src/src/integrations/_data.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,eAAO,MAAM,UAAU,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"_data.d.ts","sourceRoot":"","sources":["../../../src/src/integrations/_data.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,eAAO,MAAM,UAAU,EAAE,iBAAiB,EA66XzC,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA+ExC,CAAC"}
|
|
@@ -2102,33 +2102,10 @@ export const connectors = [
|
|
|
2102
2102
|
"description": "Get the authenticated user's Figma profile (id, email, handle). Use this to verify the connection and identify the user.",
|
|
2103
2103
|
"requiresWrite": false,
|
|
2104
2104
|
"endpoint": { "method": "GET", "url": "https://api.figma.com/v1/me" },
|
|
2105
|
-
}, {
|
|
2106
|
-
"id": "list_files",
|
|
2107
|
-
"name": "List Files",
|
|
2108
|
-
"description": "List recent Figma files accessible to the user",
|
|
2109
|
-
"requiresWrite": false,
|
|
2110
|
-
"endpoint": {
|
|
2111
|
-
"method": "GET",
|
|
2112
|
-
"url": "https://api.figma.com/v1/projects/{projectId}/files",
|
|
2113
|
-
"params": {
|
|
2114
|
-
"projectId": {
|
|
2115
|
-
"type": "string",
|
|
2116
|
-
"in": "path",
|
|
2117
|
-
"description": "Figma project ID whose files should be listed",
|
|
2118
|
-
"required": true,
|
|
2119
|
-
},
|
|
2120
|
-
"branch_data": {
|
|
2121
|
-
"type": "boolean",
|
|
2122
|
-
"in": "query",
|
|
2123
|
-
"description": "Include branch metadata",
|
|
2124
|
-
"default": false,
|
|
2125
|
-
},
|
|
2126
|
-
},
|
|
2127
|
-
},
|
|
2128
2105
|
}, {
|
|
2129
2106
|
"id": "get_file",
|
|
2130
2107
|
"name": "Get File",
|
|
2131
|
-
"description": "Get detailed information about a Figma file including components and styles",
|
|
2108
|
+
"description": "Get detailed information about a Figma file, including pages, frames, components, and styles. Requires a Figma file key from a file or design URL.",
|
|
2132
2109
|
"requiresWrite": false,
|
|
2133
2110
|
"endpoint": {
|
|
2134
2111
|
"method": "GET",
|
|
@@ -2204,24 +2181,6 @@ export const connectors = [
|
|
|
2204
2181
|
},
|
|
2205
2182
|
},
|
|
2206
2183
|
},
|
|
2207
|
-
}, {
|
|
2208
|
-
"id": "list_projects",
|
|
2209
|
-
"name": "List Projects",
|
|
2210
|
-
"description": "List all projects in a team. The teamId is the numeric ID found in the Figma URL: figma.com/files/team/{teamId}/...",
|
|
2211
|
-
"requiresWrite": false,
|
|
2212
|
-
"endpoint": {
|
|
2213
|
-
"method": "GET",
|
|
2214
|
-
"url": "https://api.figma.com/v1/teams/{teamId}/projects",
|
|
2215
|
-
"params": {
|
|
2216
|
-
"teamId": {
|
|
2217
|
-
"type": "string",
|
|
2218
|
-
"in": "path",
|
|
2219
|
-
"description": "Numeric Figma team ID from the URL: figma.com/files/team/{teamId}/...",
|
|
2220
|
-
"required": true,
|
|
2221
|
-
},
|
|
2222
|
-
},
|
|
2223
|
-
"response": { "transform": "projects" },
|
|
2224
|
-
},
|
|
2225
2184
|
}],
|
|
2226
2185
|
"prompts": [{
|
|
2227
2186
|
"id": "review_design",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/src/oauth/providers/common.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,oCAAoC;AACpC,eAAO,MAAM,YAAY,EAAE,kBAU1B,CAAC;AAEF,mCAAmC;AACnC,eAAO,MAAM,WAAW,EAAE,kBAqBzB,CAAC;AAEF,oCAAoC;AACpC,eAAO,MAAM,YAAY,EAAE,kBAc1B,CAAC;AAEF,mCAAmC;AACnC,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/src/oauth/providers/common.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,oCAAoC;AACpC,eAAO,MAAM,YAAY,EAAE,kBAU1B,CAAC;AAEF,mCAAmC;AACnC,eAAO,MAAM,WAAW,EAAE,kBAqBzB,CAAC;AAEF,oCAAoC;AACpC,eAAO,MAAM,YAAY,EAAE,kBAc1B,CAAC;AAEF,mCAAmC;AACnC,eAAO,MAAM,WAAW,EAAE,kBAezB,CAAC;AAEF,oCAAoC;AACpC,eAAO,MAAM,YAAY,EAAE,kBAU1B,CAAC;AAEF,oCAAoC;AACpC,eAAO,MAAM,YAAY,EAAE,kBAU1B,CAAC;AAEF,sCAAsC;AACtC,eAAO,MAAM,cAAc,EAAE,kBAgB5B,CAAC;AAEF,qCAAqC;AACrC,eAAO,MAAM,aAAa,EAAE,kBAa3B,CAAC;AAEF,wCAAwC;AACxC,eAAO,MAAM,gBAAgB,EAAE,kBAU9B,CAAC;AAEF,qCAAqC;AACrC,eAAO,MAAM,aAAa,EAAE,kBAW3B,CAAC;AAEF,mCAAmC;AACnC,eAAO,MAAM,WAAW,EAAE,kBAUzB,CAAC;AAEF,oCAAoC;AACpC,eAAO,MAAM,YAAY,EAAE,kBAU1B,CAAC;AAEF,kCAAkC;AAClC,eAAO,MAAM,UAAU,EAAE,kBAWxB,CAAC;AAEF,sCAAsC;AACtC,eAAO,MAAM,cAAc,EAAE,kBAU5B,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,eAAe,EAAE,kBAU7B,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,eAAe,EAAE,kBAU7B,CAAC;AAEF,qCAAqC;AACrC,eAAO,MAAM,aAAa,EAAE,kBAU3B,CAAC;AAEF,wCAAwC;AACxC,eAAO,MAAM,gBAAgB,EAAE,kBAU9B,CAAC;AAEF,kCAAkC;AAClC,eAAO,MAAM,UAAU,EAAE,kBAgBxB,CAAC;AAEF,iCAAiC;AACjC,eAAO,MAAM,SAAS,EAAE,kBAUvB,CAAC;AAEF,mCAAmC;AACnC,eAAO,MAAM,WAAW,EAAE,kBAUzB,CAAC;AAEF,oCAAoC;AACpC,eAAO,MAAM,YAAY,EAAE,kBAa1B,CAAC;AAEF,qCAAqC;AACrC,eAAO,MAAM,aAAa,EAAE,kBAU3B,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,eAAe,EAAE,kBAU7B,CAAC;AAEF,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyBb,CAAC;AAEX,eAAO,MAAM,cAAc,EAEtB,OAAO,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -60,7 +60,12 @@ export const figmaConfig = {
|
|
|
60
60
|
clientIdEnvVar: "FIGMA_CLIENT_ID",
|
|
61
61
|
clientSecretEnvVar: "FIGMA_CLIENT_SECRET",
|
|
62
62
|
apiBaseUrl: "https://api.figma.com/v1",
|
|
63
|
-
defaultScopes: [
|
|
63
|
+
defaultScopes: [
|
|
64
|
+
"current_user:read",
|
|
65
|
+
"file_content:read",
|
|
66
|
+
"file_comments:read",
|
|
67
|
+
"file_comments:write",
|
|
68
|
+
],
|
|
64
69
|
};
|
|
65
70
|
/** Configuration used by linear. */
|
|
66
71
|
export const linearConfig = {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ClaudeCodeEvent, ClaudeCodeEventExtended, ClaudeCodeResult } from "../types.js";
|
|
2
|
+
export interface ClaudeCodeCurrentTool {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
input: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export interface ClaudeCodeToolCall extends ClaudeCodeCurrentTool {
|
|
8
|
+
output?: string;
|
|
9
|
+
isError?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ClaudeCodeAllToolCall extends ClaudeCodeToolCall {
|
|
12
|
+
iteration: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ClaudeCodeEventState {
|
|
15
|
+
isRunning: boolean;
|
|
16
|
+
currentIteration: number;
|
|
17
|
+
maxIterations: number;
|
|
18
|
+
text: string;
|
|
19
|
+
currentTool: ClaudeCodeCurrentTool | null;
|
|
20
|
+
toolCalls: ClaudeCodeToolCall[];
|
|
21
|
+
result: ClaudeCodeResult | null;
|
|
22
|
+
error: string | null;
|
|
23
|
+
}
|
|
24
|
+
export interface ClaudeCodeEventReducerOptions {
|
|
25
|
+
keepEventHistory?: boolean;
|
|
26
|
+
maxEventHistory?: number;
|
|
27
|
+
trackAllToolCalls?: boolean;
|
|
28
|
+
}
|
|
29
|
+
type ClaudeCodeEventStateWithOptionalTracking = ClaudeCodeEventState & {
|
|
30
|
+
events?: ClaudeCodeEvent[];
|
|
31
|
+
allToolCalls?: ClaudeCodeAllToolCall[];
|
|
32
|
+
};
|
|
33
|
+
export declare function createClaudeCodeEventState(): ClaudeCodeEventState;
|
|
34
|
+
export declare function isClaudeCodeCoreEvent(event: ClaudeCodeEventExtended): event is ClaudeCodeEvent;
|
|
35
|
+
export declare function reduceClaudeCodeEventState<TState extends ClaudeCodeEventStateWithOptionalTracking>(previous: TState, event: ClaudeCodeEvent, options?: ClaudeCodeEventReducerOptions): TState;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=event-state-reducer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-state-reducer.d.ts","sourceRoot":"","sources":["../../../../../src/src/workflow/claude-code/react/event-state-reducer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE9F,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,kBAAmB,SAAQ,qBAAqB;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAC1C,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAChC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,6BAA6B;IAC5C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,KAAK,wCAAwC,GAAG,oBAAoB,GAAG;IACrE,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,qBAAqB,EAAE,CAAC;CACxC,CAAC;AAkBF,wBAAgB,0BAA0B,IAAI,oBAAoB,CAWjE;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,uBAAuB,GAC7B,KAAK,IAAI,eAAe,CAE1B;AAED,wBAAgB,0BAA0B,CACxC,MAAM,SAAS,wCAAwC,EAEvD,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,eAAe,EACtB,OAAO,GAAE,6BAAkC,GAC1C,MAAM,CA2FR"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
const CLAUDE_CODE_CORE_EVENT_TYPES = new Set([
|
|
2
|
+
"iteration_start",
|
|
3
|
+
"text_delta",
|
|
4
|
+
"text_complete",
|
|
5
|
+
"tool_call_start",
|
|
6
|
+
"tool_call_input",
|
|
7
|
+
"tool_call_complete",
|
|
8
|
+
"tool_result",
|
|
9
|
+
"iteration_complete",
|
|
10
|
+
"thinking_start",
|
|
11
|
+
"thinking_delta",
|
|
12
|
+
"thinking_complete",
|
|
13
|
+
"complete",
|
|
14
|
+
"error",
|
|
15
|
+
]);
|
|
16
|
+
export function createClaudeCodeEventState() {
|
|
17
|
+
return {
|
|
18
|
+
isRunning: false,
|
|
19
|
+
currentIteration: 0,
|
|
20
|
+
maxIterations: 20,
|
|
21
|
+
text: "",
|
|
22
|
+
currentTool: null,
|
|
23
|
+
toolCalls: [],
|
|
24
|
+
result: null,
|
|
25
|
+
error: null,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function isClaudeCodeCoreEvent(event) {
|
|
29
|
+
return CLAUDE_CODE_CORE_EVENT_TYPES.has(event.type);
|
|
30
|
+
}
|
|
31
|
+
export function reduceClaudeCodeEventState(previous, event, options = {}) {
|
|
32
|
+
const next = { ...previous };
|
|
33
|
+
if (options.keepEventHistory && Array.isArray(next.events)) {
|
|
34
|
+
next.events = [...(previous.events ?? []), event].slice(-(options.maxEventHistory ?? 100));
|
|
35
|
+
}
|
|
36
|
+
switch (event.type) {
|
|
37
|
+
case "iteration_start":
|
|
38
|
+
next.isRunning = true;
|
|
39
|
+
next.currentIteration = event.iteration;
|
|
40
|
+
next.maxIterations = event.maxIterations;
|
|
41
|
+
next.toolCalls = [];
|
|
42
|
+
next.currentTool = null;
|
|
43
|
+
break;
|
|
44
|
+
case "text_delta":
|
|
45
|
+
next.text = previous.text + event.content;
|
|
46
|
+
break;
|
|
47
|
+
case "text_complete":
|
|
48
|
+
next.text = event.content;
|
|
49
|
+
break;
|
|
50
|
+
case "tool_call_start":
|
|
51
|
+
next.currentTool = {
|
|
52
|
+
id: event.toolCallId,
|
|
53
|
+
name: event.toolName,
|
|
54
|
+
input: {},
|
|
55
|
+
};
|
|
56
|
+
break;
|
|
57
|
+
case "tool_call_complete":
|
|
58
|
+
next.currentTool = null;
|
|
59
|
+
next.toolCalls = [
|
|
60
|
+
...previous.toolCalls,
|
|
61
|
+
{
|
|
62
|
+
id: event.toolCallId,
|
|
63
|
+
name: event.toolName,
|
|
64
|
+
input: event.input,
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
break;
|
|
68
|
+
case "tool_result": {
|
|
69
|
+
next.toolCalls = previous.toolCalls.map((toolCall) => toolCall.id === event.toolCallId
|
|
70
|
+
? { ...toolCall, output: event.output, isError: event.isError }
|
|
71
|
+
: toolCall);
|
|
72
|
+
if (options.trackAllToolCalls && Array.isArray(next.allToolCalls)) {
|
|
73
|
+
const matchingToolCall = previous.toolCalls.find((toolCall) => toolCall.id === event.toolCallId);
|
|
74
|
+
next.allToolCalls = [
|
|
75
|
+
...(previous.allToolCalls ?? []),
|
|
76
|
+
{
|
|
77
|
+
iteration: event.iteration ?? previous.currentIteration,
|
|
78
|
+
id: event.toolCallId,
|
|
79
|
+
name: event.toolName,
|
|
80
|
+
input: matchingToolCall?.input ?? {},
|
|
81
|
+
output: event.output,
|
|
82
|
+
isError: event.isError,
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
case "iteration_complete":
|
|
89
|
+
next.currentTool = null;
|
|
90
|
+
break;
|
|
91
|
+
case "complete":
|
|
92
|
+
next.isRunning = false;
|
|
93
|
+
next.result = event.result;
|
|
94
|
+
next.currentTool = null;
|
|
95
|
+
break;
|
|
96
|
+
case "error":
|
|
97
|
+
next.error = event.message;
|
|
98
|
+
if (!event.recoverable) {
|
|
99
|
+
next.isRunning = false;
|
|
100
|
+
}
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
return next;
|
|
104
|
+
}
|
|
@@ -1,45 +1,13 @@
|
|
|
1
1
|
import type { ClaudeCodeEvent, ClaudeCodeResult } from "../types.js";
|
|
2
|
+
import { type ClaudeCodeAllToolCall, type ClaudeCodeEventState } from "./event-state-reducer.js";
|
|
2
3
|
/**
|
|
3
4
|
* State for Claude Code streaming
|
|
4
5
|
*/
|
|
5
|
-
export interface UseClaudeCodeStreamState {
|
|
6
|
+
export interface UseClaudeCodeStreamState extends ClaudeCodeEventState {
|
|
6
7
|
/** Whether currently connected to stream */
|
|
7
8
|
isConnected: boolean;
|
|
8
|
-
/** Whether agent is currently executing */
|
|
9
|
-
isRunning: boolean;
|
|
10
|
-
/** Current iteration number */
|
|
11
|
-
currentIteration: number;
|
|
12
|
-
/** Maximum iterations allowed */
|
|
13
|
-
maxIterations: number;
|
|
14
|
-
/** Accumulated text output */
|
|
15
|
-
text: string;
|
|
16
|
-
/** Current tool being executed (if any) */
|
|
17
|
-
currentTool: {
|
|
18
|
-
id: string;
|
|
19
|
-
name: string;
|
|
20
|
-
input: Record<string, unknown>;
|
|
21
|
-
} | null;
|
|
22
|
-
/** Tool calls in current iteration */
|
|
23
|
-
toolCalls: Array<{
|
|
24
|
-
id: string;
|
|
25
|
-
name: string;
|
|
26
|
-
input: Record<string, unknown>;
|
|
27
|
-
output?: string;
|
|
28
|
-
isError?: boolean;
|
|
29
|
-
}>;
|
|
30
9
|
/** All tool calls across all iterations */
|
|
31
|
-
allToolCalls:
|
|
32
|
-
iteration: number;
|
|
33
|
-
id: string;
|
|
34
|
-
name: string;
|
|
35
|
-
input: Record<string, unknown>;
|
|
36
|
-
output?: string;
|
|
37
|
-
isError?: boolean;
|
|
38
|
-
}>;
|
|
39
|
-
/** Final result (when complete) */
|
|
40
|
-
result: ClaudeCodeResult | null;
|
|
41
|
-
/** Error message (if any) */
|
|
42
|
-
error: string | null;
|
|
10
|
+
allToolCalls: ClaudeCodeAllToolCall[];
|
|
43
11
|
/** Raw events (for debugging) */
|
|
44
12
|
events: ClaudeCodeEvent[];
|
|
45
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-claude-code-stream.d.ts","sourceRoot":"","sources":["../../../../../src/src/workflow/claude-code/react/use-claude-code-stream.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"use-claude-code-stream.d.ts","sourceRoot":"","sources":["../../../../../src/src/workflow/claude-code/react/use-claude-code-stream.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EAG1B,MAAM,0BAA0B,CAAC;AASlC;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,oBAAoB;IACpE,4CAA4C;IAC5C,WAAW,EAAE,OAAO,CAAC;IAErB,2CAA2C;IAC3C,YAAY,EAAE,qBAAqB,EAAE,CAAC;IAEtC,iCAAiC;IACjC,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,uBAAuB;IACvB,GAAG,EAAE,MAAM,CAAC;IAEZ,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IAEd,4BAA4B;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,8BAA8B;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,6BAA6B;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,2BAA2B;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,oCAAoC;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,gBAAgB;IAChB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACjD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,0BAA0B,GAClC,wBAAwB,GAAG;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB,CAoIA;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,IAAI,CAAC,0BAA0B,EAAE,kBAAkB,GAAG,iBAAiB,CAAC,GAChF;IACD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAGA"}
|