@get-bb/plugin-sdk 0.6.37 → 0.6.42
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/bundled-types/bb-plugin-sdk-app.d.ts +391 -281
- package/bundled-types/bb-plugin-sdk-internal-composer-handle.d.ts +1 -10
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +9 -23
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +2 -1
- package/bundled-types/bb-plugin-sdk-provider-bridge-acp-next.d.ts +606 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge-acp.d.ts +32 -90
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +11 -10
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +66 -220
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +2 -1
- package/bundled-types/bb-plugin-sdk-testing.d.ts +7 -3
- package/bundled-types/bb-plugin-sdk.d.ts +409 -284
- package/dist/internal/host-policy.js +13 -7
- package/dist/internal/plugin-app-collector.js +32 -0
- package/dist/provider-bridge-acp-next.js +24029 -0
- package/dist/provider-bridge-acp.js +959 -873
- package/dist/provider-bridge-testing.js +571 -510
- package/dist/provider-bridge.js +633 -559
- package/dist/testing/app.js +32 -0
- package/dist/testing/index.js +15 -7
- package/package.json +8 -1
|
@@ -621,7 +621,22 @@ var reasoningLevelValues = [
|
|
|
621
621
|
"max",
|
|
622
622
|
"ultra"
|
|
623
623
|
];
|
|
624
|
-
var reasoningLevelSchema = z3.
|
|
624
|
+
var reasoningLevelSchema = z3.string().min(1);
|
|
625
|
+
function isStandardReasoningLevel(level) {
|
|
626
|
+
return reasoningLevelValues.includes(level);
|
|
627
|
+
}
|
|
628
|
+
function standardReasoningLevelRank(level) {
|
|
629
|
+
const rank = reasoningLevelValues.indexOf(level);
|
|
630
|
+
return rank === -1 ? null : rank;
|
|
631
|
+
}
|
|
632
|
+
function compareReasoningLevels(a2, b) {
|
|
633
|
+
const aRank = standardReasoningLevelRank(a2);
|
|
634
|
+
const bRank = standardReasoningLevelRank(b);
|
|
635
|
+
if (aRank === null || bRank === null) {
|
|
636
|
+
return aRank === bRank ? 0 : aRank === null ? 1 : -1;
|
|
637
|
+
}
|
|
638
|
+
return aRank - bRank;
|
|
639
|
+
}
|
|
625
640
|
var serviceTierSchema = z3.string().min(1);
|
|
626
641
|
var instructionModeValues = ["append", "replace"];
|
|
627
642
|
var instructionModeSchema = z3.enum(instructionModeValues);
|
|
@@ -893,11 +908,17 @@ var runtimePermissionPolicySchema = z3.discriminatedUnion(
|
|
|
893
908
|
]
|
|
894
909
|
);
|
|
895
910
|
var promptModeSchema = z3.literal("plan");
|
|
911
|
+
var sessionOptionValueSchema = z3.union([z3.string(), z3.boolean()]);
|
|
912
|
+
var sessionOptionSelectionsSchema = z3.record(
|
|
913
|
+
z3.string().min(1),
|
|
914
|
+
sessionOptionValueSchema
|
|
915
|
+
);
|
|
896
916
|
var runtimeThreadExecutionBaseOptionsSchema = z3.object({
|
|
897
917
|
model: z3.string().min(1),
|
|
898
918
|
serviceTier: serviceTierSchema,
|
|
899
919
|
reasoningLevel: reasoningLevelSchema,
|
|
900
920
|
promptMode: promptModeSchema.optional(),
|
|
921
|
+
sessionOptions: sessionOptionSelectionsSchema.optional(),
|
|
901
922
|
providerOptions: jsonObjectSchema
|
|
902
923
|
});
|
|
903
924
|
var runtimeThreadExecutionOptionsSchema = runtimeThreadExecutionBaseOptionsSchema.and(runtimePermissionPolicySchema);
|
|
@@ -926,7 +947,7 @@ var providerNativeSkillRootsSchema = z4.object({
|
|
|
926
947
|
user: uniqueProviderSkillRootPathsSchema.default([]),
|
|
927
948
|
project: uniqueProviderSkillRootPathsSchema.default([])
|
|
928
949
|
}).strict();
|
|
929
|
-
var acpReasoningCliLevelValueOverridesSchema = z4.
|
|
950
|
+
var acpReasoningCliLevelValueOverridesSchema = z4.record(
|
|
930
951
|
reasoningLevelSchema,
|
|
931
952
|
z4.string().min(1)
|
|
932
953
|
);
|
|
@@ -2318,11 +2339,16 @@ var threadEventTokenUsageBreakdownSchema = z16.object({
|
|
|
2318
2339
|
outputTokens: z16.number(),
|
|
2319
2340
|
reasoningOutputTokens: z16.number()
|
|
2320
2341
|
});
|
|
2342
|
+
var threadUsageCostSchema = z16.object({
|
|
2343
|
+
amount: z16.number().nonnegative(),
|
|
2344
|
+
currency: z16.string().min(1)
|
|
2345
|
+
});
|
|
2321
2346
|
var threadEventContextWindowUsageSchema = z16.object({
|
|
2322
2347
|
snapshot: contextSnapshotSchema.optional(),
|
|
2323
2348
|
usedTokens: z16.number().nullable(),
|
|
2324
2349
|
modelContextWindow: z16.number().nullable(),
|
|
2325
|
-
estimated: z16.boolean()
|
|
2350
|
+
estimated: z16.boolean(),
|
|
2351
|
+
cost: threadUsageCostSchema.optional()
|
|
2326
2352
|
});
|
|
2327
2353
|
var threadEventTokenUsageSchema = z16.object({
|
|
2328
2354
|
total: threadEventTokenUsageBreakdownSchema,
|
|
@@ -2505,7 +2531,8 @@ var unscopedProviderEventSchema = z16.discriminatedUnion("type", [
|
|
|
2505
2531
|
type: z16.literal("thread/name/updated"),
|
|
2506
2532
|
threadId: z16.string(),
|
|
2507
2533
|
providerThreadId: z16.string(),
|
|
2508
|
-
threadName: z16.string()
|
|
2534
|
+
threadName: z16.string(),
|
|
2535
|
+
source: z16.literal("agent").optional()
|
|
2509
2536
|
}),
|
|
2510
2537
|
z16.object({
|
|
2511
2538
|
type: z16.literal("thread/compacted"),
|
|
@@ -2771,103 +2798,154 @@ var threadEventTypeSchema = z16.string().refine(
|
|
|
2771
2798
|
"Invalid thread event type"
|
|
2772
2799
|
);
|
|
2773
2800
|
|
|
2774
|
-
// ../domain/src/provider-
|
|
2801
|
+
// ../domain/src/thread-provider-state.ts
|
|
2775
2802
|
import { z as z17 } from "zod";
|
|
2803
|
+
var THREAD_PROVIDER_COMMANDS_STATE_KIND = "bb/provider-commands";
|
|
2804
|
+
var THREAD_SESSION_OPTIONS_STATE_KIND = "bb/session-options";
|
|
2805
|
+
var threadProviderCommandSchema = z17.object({
|
|
2806
|
+
name: z17.string().min(1),
|
|
2807
|
+
description: z17.string(),
|
|
2808
|
+
inputHint: z17.string().min(1).optional()
|
|
2809
|
+
});
|
|
2810
|
+
var threadProviderCommandsStateSchema = z17.object({
|
|
2811
|
+
commands: z17.array(threadProviderCommandSchema).max(500)
|
|
2812
|
+
});
|
|
2813
|
+
var threadSessionOptionValueSchema = z17.object({
|
|
2814
|
+
id: z17.string().min(1),
|
|
2815
|
+
label: z17.string().min(1),
|
|
2816
|
+
description: z17.string().min(1).optional(),
|
|
2817
|
+
group: z17.string().min(1).optional()
|
|
2818
|
+
});
|
|
2819
|
+
var threadSessionOptionBaseShape = {
|
|
2820
|
+
id: z17.string().min(1),
|
|
2821
|
+
label: z17.string().min(1),
|
|
2822
|
+
description: z17.string().min(1).optional(),
|
|
2823
|
+
category: z17.string().min(1).optional()
|
|
2824
|
+
};
|
|
2825
|
+
var threadSessionOptionSchema = z17.discriminatedUnion("type", [
|
|
2826
|
+
z17.object({
|
|
2827
|
+
...threadSessionOptionBaseShape,
|
|
2828
|
+
type: z17.literal("select"),
|
|
2829
|
+
value: z17.string(),
|
|
2830
|
+
values: z17.array(threadSessionOptionValueSchema).max(1e3)
|
|
2831
|
+
}),
|
|
2832
|
+
z17.object({
|
|
2833
|
+
...threadSessionOptionBaseShape,
|
|
2834
|
+
type: z17.literal("boolean"),
|
|
2835
|
+
value: z17.boolean(),
|
|
2836
|
+
fixed: z17.boolean().optional()
|
|
2837
|
+
})
|
|
2838
|
+
]);
|
|
2839
|
+
var threadSessionOptionsStateSchema = z17.object({
|
|
2840
|
+
options: z17.array(threadSessionOptionSchema).max(64)
|
|
2841
|
+
});
|
|
2842
|
+
var threadSessionOptionSelectionsStateSchema = z17.object({
|
|
2843
|
+
selections: sessionOptionSelectionsSchema
|
|
2844
|
+
});
|
|
2845
|
+
var CORE_THREAD_STATE_SCHEMAS = {
|
|
2846
|
+
[THREAD_PROVIDER_COMMANDS_STATE_KIND]: threadProviderCommandsStateSchema,
|
|
2847
|
+
[THREAD_SESSION_OPTIONS_STATE_KIND]: threadSessionOptionsStateSchema
|
|
2848
|
+
};
|
|
2849
|
+
|
|
2850
|
+
// ../domain/src/provider-fork.ts
|
|
2851
|
+
import { z as z18 } from "zod";
|
|
2776
2852
|
var PROVIDER_FORK_VALUES = ["none", "tip", "checkpoint"];
|
|
2777
|
-
var providerForkSchema =
|
|
2853
|
+
var providerForkSchema = z18.enum(PROVIDER_FORK_VALUES);
|
|
2778
2854
|
|
|
2779
2855
|
// ../domain/src/provider-types.ts
|
|
2780
|
-
import { z as
|
|
2781
|
-
var modelReasoningEffortSchema =
|
|
2856
|
+
import { z as z19 } from "zod";
|
|
2857
|
+
var modelReasoningEffortSchema = z19.object({
|
|
2782
2858
|
reasoningEffort: reasoningLevelSchema,
|
|
2783
|
-
|
|
2859
|
+
label: z19.string().min(1).optional(),
|
|
2860
|
+
description: z19.string()
|
|
2784
2861
|
});
|
|
2785
|
-
var modelServiceTierSchema =
|
|
2862
|
+
var modelServiceTierSchema = z19.object({
|
|
2786
2863
|
id: serviceTierSchema,
|
|
2787
|
-
label:
|
|
2788
|
-
description:
|
|
2864
|
+
label: z19.string().min(1).optional(),
|
|
2865
|
+
description: z19.string().min(1).optional()
|
|
2789
2866
|
});
|
|
2790
|
-
var availableModelSchema =
|
|
2791
|
-
id:
|
|
2792
|
-
model:
|
|
2793
|
-
displayName:
|
|
2794
|
-
routeProviderId:
|
|
2795
|
-
description:
|
|
2796
|
-
supportedReasoningEfforts:
|
|
2867
|
+
var availableModelSchema = z19.object({
|
|
2868
|
+
id: z19.string(),
|
|
2869
|
+
model: z19.string(),
|
|
2870
|
+
displayName: z19.string(),
|
|
2871
|
+
routeProviderId: z19.string().min(1).optional(),
|
|
2872
|
+
description: z19.string(),
|
|
2873
|
+
supportedReasoningEfforts: z19.array(modelReasoningEffortSchema),
|
|
2797
2874
|
defaultReasoningEffort: reasoningLevelSchema,
|
|
2798
|
-
supportedServiceTiers:
|
|
2799
|
-
|
|
2875
|
+
supportedServiceTiers: z19.array(modelServiceTierSchema).optional(),
|
|
2876
|
+
sessionOptions: z19.array(threadSessionOptionSchema).max(64).optional(),
|
|
2877
|
+
isDefault: z19.boolean()
|
|
2800
2878
|
});
|
|
2801
|
-
var providerModelCatalogScopeSchema =
|
|
2802
|
-
var providerCapabilitiesSchema =
|
|
2803
|
-
supportsThreadArchive:
|
|
2804
|
-
supportsThreadRename:
|
|
2805
|
-
supportsServiceTier:
|
|
2806
|
-
supportsNativeUserQuestion:
|
|
2807
|
-
supportsFork:
|
|
2808
|
-
supportsSessionRewind:
|
|
2809
|
-
permissionModes:
|
|
2879
|
+
var providerModelCatalogScopeSchema = z19.enum(["host", "workspace"]);
|
|
2880
|
+
var providerCapabilitiesSchema = z19.object({
|
|
2881
|
+
supportsThreadArchive: z19.boolean(),
|
|
2882
|
+
supportsThreadRename: z19.boolean(),
|
|
2883
|
+
supportsServiceTier: z19.boolean(),
|
|
2884
|
+
supportsNativeUserQuestion: z19.boolean(),
|
|
2885
|
+
supportsFork: z19.boolean(),
|
|
2886
|
+
supportsSessionRewind: z19.boolean(),
|
|
2887
|
+
permissionModes: z19.array(permissionModeSchema).min(1),
|
|
2810
2888
|
modelCatalogScope: providerModelCatalogScopeSchema
|
|
2811
2889
|
});
|
|
2812
|
-
var providerComposerCommandSchema =
|
|
2890
|
+
var providerComposerCommandSchema = z19.object({
|
|
2813
2891
|
trigger: promptMentionCommandTriggerSchema,
|
|
2814
|
-
name:
|
|
2815
|
-
trailingText:
|
|
2892
|
+
name: z19.string().min(1).regex(/^[^\s/$]+$/u),
|
|
2893
|
+
trailingText: z19.string().regex(/^\s*$/u)
|
|
2816
2894
|
});
|
|
2817
|
-
var providerComposerActionSchema =
|
|
2818
|
-
|
|
2819
|
-
kind:
|
|
2895
|
+
var providerComposerActionSchema = z19.discriminatedUnion("kind", [
|
|
2896
|
+
z19.object({
|
|
2897
|
+
kind: z19.literal("skills"),
|
|
2820
2898
|
trigger: promptMentionCommandTriggerSchema
|
|
2821
2899
|
}),
|
|
2822
|
-
|
|
2823
|
-
kind:
|
|
2900
|
+
z19.object({
|
|
2901
|
+
kind: z19.literal("plan"),
|
|
2824
2902
|
command: providerComposerCommandSchema
|
|
2825
2903
|
}),
|
|
2826
|
-
|
|
2827
|
-
kind:
|
|
2904
|
+
z19.object({
|
|
2905
|
+
kind: z19.literal("goal"),
|
|
2828
2906
|
command: providerComposerCommandSchema
|
|
2829
2907
|
})
|
|
2830
2908
|
]);
|
|
2831
|
-
var providerStringsSchema =
|
|
2832
|
-
signInHint:
|
|
2833
|
-
expiredHint:
|
|
2834
|
-
installUrl:
|
|
2835
|
-
brandPrefix:
|
|
2836
|
-
planModeCopy:
|
|
2837
|
-
iconTint:
|
|
2909
|
+
var providerStringsSchema = z19.object({
|
|
2910
|
+
signInHint: z19.string().min(1),
|
|
2911
|
+
expiredHint: z19.string().min(1),
|
|
2912
|
+
installUrl: z19.string().min(1),
|
|
2913
|
+
brandPrefix: z19.string().min(1).optional(),
|
|
2914
|
+
planModeCopy: z19.string().min(1).optional(),
|
|
2915
|
+
iconTint: z19.object({ light: z19.string().min(1), dark: z19.string().min(1) }).optional()
|
|
2838
2916
|
});
|
|
2839
|
-
var providerOptionDescriptorSchema =
|
|
2840
|
-
id:
|
|
2841
|
-
label:
|
|
2842
|
-
description:
|
|
2917
|
+
var providerOptionDescriptorSchema = z19.object({
|
|
2918
|
+
id: z19.string().min(1),
|
|
2919
|
+
label: z19.string().min(1),
|
|
2920
|
+
description: z19.string().min(1).optional()
|
|
2843
2921
|
});
|
|
2844
|
-
var providerExtensionKindInfoSchema =
|
|
2845
|
-
item:
|
|
2846
|
-
state:
|
|
2922
|
+
var providerExtensionKindInfoSchema = z19.object({
|
|
2923
|
+
item: z19.boolean(),
|
|
2924
|
+
state: z19.boolean()
|
|
2847
2925
|
});
|
|
2848
|
-
var providerExtensionKindsSchema =
|
|
2926
|
+
var providerExtensionKindsSchema = z19.record(
|
|
2849
2927
|
extensionKindSchema,
|
|
2850
2928
|
providerExtensionKindInfoSchema
|
|
2851
2929
|
);
|
|
2852
|
-
var providerInfoSchema =
|
|
2853
|
-
id:
|
|
2854
|
-
pluginId:
|
|
2855
|
-
displayName:
|
|
2856
|
-
family:
|
|
2857
|
-
icon:
|
|
2858
|
-
logoUrl:
|
|
2859
|
-
maintenance:
|
|
2860
|
-
health:
|
|
2861
|
-
usage:
|
|
2862
|
-
installation:
|
|
2930
|
+
var providerInfoSchema = z19.object({
|
|
2931
|
+
id: z19.string(),
|
|
2932
|
+
pluginId: z19.string().min(1),
|
|
2933
|
+
displayName: z19.string(),
|
|
2934
|
+
family: z19.string().min(1).optional(),
|
|
2935
|
+
icon: z19.object({ glyph: z19.string().min(1) }).optional(),
|
|
2936
|
+
logoUrl: z19.string().min(1).nullable(),
|
|
2937
|
+
maintenance: z19.object({
|
|
2938
|
+
health: z19.boolean(),
|
|
2939
|
+
usage: z19.boolean(),
|
|
2940
|
+
installation: z19.boolean()
|
|
2863
2941
|
}),
|
|
2864
2942
|
capabilities: providerCapabilitiesSchema,
|
|
2865
|
-
composerActions:
|
|
2943
|
+
composerActions: z19.array(providerComposerActionSchema),
|
|
2866
2944
|
completedTurnDisplay: completedTurnDisplaySchema,
|
|
2867
|
-
available:
|
|
2945
|
+
available: z19.boolean(),
|
|
2868
2946
|
strings: providerStringsSchema.optional(),
|
|
2869
|
-
serviceTiers:
|
|
2870
|
-
reasoningLevels:
|
|
2947
|
+
serviceTiers: z19.array(providerOptionDescriptorSchema).optional(),
|
|
2948
|
+
reasoningLevels: z19.array(providerOptionDescriptorSchema).optional(),
|
|
2871
2949
|
extensionKinds: providerExtensionKindsSchema.optional()
|
|
2872
2950
|
});
|
|
2873
2951
|
var providerRecoveryKindValues = [
|
|
@@ -2877,34 +2955,34 @@ var providerRecoveryKindValues = [
|
|
|
2877
2955
|
"staleTurn",
|
|
2878
2956
|
"rateLimited"
|
|
2879
2957
|
];
|
|
2880
|
-
var providerRecoveryKindSchema =
|
|
2881
|
-
var toolCallOutputItemSchema =
|
|
2882
|
-
|
|
2883
|
-
type:
|
|
2884
|
-
text:
|
|
2958
|
+
var providerRecoveryKindSchema = z19.enum(providerRecoveryKindValues);
|
|
2959
|
+
var toolCallOutputItemSchema = z19.discriminatedUnion("type", [
|
|
2960
|
+
z19.object({
|
|
2961
|
+
type: z19.literal("inputText"),
|
|
2962
|
+
text: z19.string()
|
|
2885
2963
|
}),
|
|
2886
|
-
|
|
2887
|
-
type:
|
|
2888
|
-
imageUrl:
|
|
2964
|
+
z19.object({
|
|
2965
|
+
type: z19.literal("inputImage"),
|
|
2966
|
+
imageUrl: z19.string()
|
|
2889
2967
|
})
|
|
2890
2968
|
]);
|
|
2891
|
-
var toolCallRequestSchema =
|
|
2892
|
-
requestId:
|
|
2893
|
-
threadId:
|
|
2894
|
-
providerThreadId:
|
|
2895
|
-
turnId:
|
|
2896
|
-
callId:
|
|
2897
|
-
tool:
|
|
2898
|
-
arguments:
|
|
2969
|
+
var toolCallRequestSchema = z19.object({
|
|
2970
|
+
requestId: z19.union([z19.string().min(1), z19.number()]),
|
|
2971
|
+
threadId: z19.string().min(1),
|
|
2972
|
+
providerThreadId: z19.string().min(1),
|
|
2973
|
+
turnId: z19.string().min(1),
|
|
2974
|
+
callId: z19.string().min(1),
|
|
2975
|
+
tool: z19.string().min(1),
|
|
2976
|
+
arguments: z19.unknown().optional()
|
|
2899
2977
|
});
|
|
2900
|
-
var toolCallResponseSchema =
|
|
2901
|
-
contentItems:
|
|
2902
|
-
success:
|
|
2978
|
+
var toolCallResponseSchema = z19.object({
|
|
2979
|
+
contentItems: z19.array(toolCallOutputItemSchema),
|
|
2980
|
+
success: z19.boolean()
|
|
2903
2981
|
});
|
|
2904
|
-
var dynamicToolSchema =
|
|
2905
|
-
name:
|
|
2906
|
-
description:
|
|
2907
|
-
inputSchema:
|
|
2982
|
+
var dynamicToolSchema = z19.object({
|
|
2983
|
+
name: z19.string(),
|
|
2984
|
+
description: z19.string(),
|
|
2985
|
+
inputSchema: z19.unknown(),
|
|
2908
2986
|
presentation: threadEventItemPresentationSchema.optional()
|
|
2909
2987
|
});
|
|
2910
2988
|
|
|
@@ -2952,14 +3030,16 @@ var REASONING_EFFORT_BY_LEVEL = {
|
|
|
2952
3030
|
ultra: ULTRA_REASONING_EFFORT
|
|
2953
3031
|
};
|
|
2954
3032
|
function reasoningEffortsForLevels(levels) {
|
|
2955
|
-
return levels.map(
|
|
3033
|
+
return levels.map(
|
|
3034
|
+
(level) => isStandardReasoningLevel(level) ? { ...REASONING_EFFORT_BY_LEVEL[level] } : { reasoningEffort: level, description: level }
|
|
3035
|
+
);
|
|
2956
3036
|
}
|
|
2957
3037
|
|
|
2958
3038
|
// ../provider-bridge-acp/src/launch-spec.ts
|
|
2959
|
-
import { z as
|
|
2960
|
-
var acpNativeSkillRootsSchema =
|
|
2961
|
-
user:
|
|
2962
|
-
project:
|
|
3039
|
+
import { z as z20 } from "zod";
|
|
3040
|
+
var acpNativeSkillRootsSchema = z20.object({
|
|
3041
|
+
user: z20.array(providerNativeRootInputSchema).default([]),
|
|
3042
|
+
project: z20.array(providerNativeRootInputSchema).default([])
|
|
2963
3043
|
}).strict().superRefine((roots, context) => {
|
|
2964
3044
|
const normalized = providerNativeRootsSchema.safeParse(
|
|
2965
3045
|
normalizeProviderNativeRoots(roots)
|
|
@@ -2975,16 +3055,16 @@ var acpNativeSkillRootsSchema = z19.object({
|
|
|
2975
3055
|
});
|
|
2976
3056
|
}
|
|
2977
3057
|
});
|
|
2978
|
-
var acpLaunchSpecSchema =
|
|
2979
|
-
displayName:
|
|
2980
|
-
command:
|
|
2981
|
-
args:
|
|
2982
|
-
env:
|
|
2983
|
-
cwd:
|
|
2984
|
-
modelCli:
|
|
2985
|
-
listArgs:
|
|
2986
|
-
selectFlag:
|
|
2987
|
-
primaryModels:
|
|
3058
|
+
var acpLaunchSpecSchema = z20.object({
|
|
3059
|
+
displayName: z20.string().min(1),
|
|
3060
|
+
command: z20.string().min(1),
|
|
3061
|
+
args: z20.array(z20.string()),
|
|
3062
|
+
env: z20.record(z20.string().min(1), z20.string()),
|
|
3063
|
+
cwd: z20.string().min(1).optional(),
|
|
3064
|
+
modelCli: z20.object({
|
|
3065
|
+
listArgs: z20.array(z20.string()),
|
|
3066
|
+
selectFlag: z20.string().min(1).optional(),
|
|
3067
|
+
primaryModels: z20.array(z20.string())
|
|
2988
3068
|
}).strict().transform(
|
|
2989
3069
|
(modelCli) => modelCli.listArgs.length > 0 ? modelCli : void 0
|
|
2990
3070
|
).optional(),
|
|
@@ -2999,67 +3079,68 @@ var PROVIDER_BRIDGE_PROTOCOL_VERSION = 2;
|
|
|
2999
3079
|
var THREAD_DELTA_GRAMMAR_V3 = 3;
|
|
3000
3080
|
|
|
3001
3081
|
// ../provider-bridge-protocol/src/handshake.ts
|
|
3002
|
-
import { z as
|
|
3003
|
-
var bridgeGrammarVersionsSchema =
|
|
3082
|
+
import { z as z21 } from "zod";
|
|
3083
|
+
var bridgeGrammarVersionsSchema = z21.tuple([z21.number().int().positive(), z21.number().int().positive()]).refine(([min, max]) => min <= max, {
|
|
3004
3084
|
message: "grammarVersions must be an ascending [min, max] range"
|
|
3005
3085
|
});
|
|
3006
|
-
var bridgeSteerModeSchema =
|
|
3007
|
-
var bridgeCapabilitiesSchema =
|
|
3008
|
-
sessionRestore:
|
|
3009
|
-
threadArchive:
|
|
3010
|
-
threadRename:
|
|
3011
|
-
threadGoalClear:
|
|
3086
|
+
var bridgeSteerModeSchema = z21.enum(["inject", "queue"]);
|
|
3087
|
+
var bridgeCapabilitiesSchema = z21.object({
|
|
3088
|
+
sessionRestore: z21.boolean().default(false),
|
|
3089
|
+
threadArchive: z21.boolean().default(false),
|
|
3090
|
+
threadRename: z21.boolean().default(false),
|
|
3091
|
+
threadGoalClear: z21.boolean().default(false),
|
|
3012
3092
|
fork: providerForkSchema.default("none"),
|
|
3013
|
-
approvalEnforcedBy:
|
|
3093
|
+
approvalEnforcedBy: z21.enum(["runtime", "provider"]).default("runtime"),
|
|
3014
3094
|
grammarVersions: bridgeGrammarVersionsSchema.default([
|
|
3015
3095
|
PROVIDER_BRIDGE_PROTOCOL_VERSION,
|
|
3016
3096
|
PROVIDER_BRIDGE_PROTOCOL_VERSION
|
|
3017
3097
|
]),
|
|
3018
3098
|
steerMode: bridgeSteerModeSchema.default("queue"),
|
|
3019
|
-
skills:
|
|
3099
|
+
skills: z21.object({ configure: z21.boolean().default(false) }).default({ configure: false })
|
|
3020
3100
|
}).passthrough();
|
|
3021
|
-
var initializeParamsSchema =
|
|
3022
|
-
protocolVersion:
|
|
3023
|
-
client:
|
|
3101
|
+
var initializeParamsSchema = z21.object({
|
|
3102
|
+
protocolVersion: z21.number().int().positive(),
|
|
3103
|
+
client: z21.object({ name: z21.string().min(1), version: z21.string().min(1) }),
|
|
3024
3104
|
grammarVersions: bridgeGrammarVersionsSchema.default([
|
|
3025
3105
|
PROVIDER_BRIDGE_PROTOCOL_VERSION,
|
|
3026
3106
|
PROVIDER_BRIDGE_PROTOCOL_VERSION
|
|
3027
3107
|
])
|
|
3028
3108
|
}).passthrough();
|
|
3029
|
-
var initializeResultSchema =
|
|
3030
|
-
protocolVersion:
|
|
3031
|
-
capabilities:
|
|
3109
|
+
var initializeResultSchema = z21.object({
|
|
3110
|
+
protocolVersion: z21.number().int().positive(),
|
|
3111
|
+
capabilities: z21.preprocess(
|
|
3032
3112
|
(value) => value ?? {},
|
|
3033
3113
|
bridgeCapabilitiesSchema
|
|
3034
3114
|
)
|
|
3035
3115
|
}).passthrough();
|
|
3036
3116
|
|
|
3037
3117
|
// ../provider-bridge-protocol/src/execution-options.ts
|
|
3038
|
-
import { z as
|
|
3039
|
-
var bridgeExecutionOptionsSchema =
|
|
3040
|
-
model:
|
|
3118
|
+
import { z as z22 } from "zod";
|
|
3119
|
+
var bridgeExecutionOptionsSchema = z22.object({
|
|
3120
|
+
model: z22.string().min(1).optional(),
|
|
3041
3121
|
serviceTier: serviceTierSchema.optional(),
|
|
3042
3122
|
reasoningLevel: reasoningLevelSchema.optional(),
|
|
3043
3123
|
promptMode: promptModeSchema.optional(),
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3124
|
+
sessionOptions: sessionOptionSelectionsSchema.optional(),
|
|
3125
|
+
instructions: z22.string().optional(),
|
|
3126
|
+
envVars: z22.record(z22.string(), z22.string()).optional(),
|
|
3127
|
+
providerOptions: z22.record(z22.string(), z22.unknown()).optional()
|
|
3047
3128
|
}).and(runtimePermissionPolicySchema);
|
|
3048
3129
|
|
|
3049
3130
|
// ../provider-bridge-protocol/src/provider-maintenance.ts
|
|
3050
|
-
import { z as
|
|
3051
|
-
var providerMaintenanceParamsSchema =
|
|
3052
|
-
providerId:
|
|
3053
|
-
cwd:
|
|
3054
|
-
providerOptions:
|
|
3131
|
+
import { z as z23 } from "zod";
|
|
3132
|
+
var providerMaintenanceParamsSchema = z23.object({
|
|
3133
|
+
providerId: z23.string().min(1),
|
|
3134
|
+
cwd: z23.string().min(1).optional(),
|
|
3135
|
+
providerOptions: z23.record(z23.string(), z23.unknown()).optional()
|
|
3055
3136
|
}).passthrough();
|
|
3056
|
-
var providerInstallationRequirementSchema =
|
|
3137
|
+
var providerInstallationRequirementSchema = z23.enum(["thread_rewind"]);
|
|
3057
3138
|
var providerInstallationStatusParamsSchema = providerMaintenanceParamsSchema.extend({
|
|
3058
3139
|
requirement: providerInstallationRequirementSchema.optional(),
|
|
3059
|
-
checkUpdates:
|
|
3140
|
+
checkUpdates: z23.boolean().default(true)
|
|
3060
3141
|
});
|
|
3061
|
-
var providerHealthSchema =
|
|
3062
|
-
status:
|
|
3142
|
+
var providerHealthSchema = z23.object({
|
|
3143
|
+
status: z23.enum([
|
|
3063
3144
|
"ready",
|
|
3064
3145
|
"not_installed",
|
|
3065
3146
|
"unauthenticated",
|
|
@@ -3067,115 +3148,115 @@ var providerHealthSchema = z22.object({
|
|
|
3067
3148
|
"unsupported_version",
|
|
3068
3149
|
"unknown"
|
|
3069
3150
|
]),
|
|
3070
|
-
statusMessage:
|
|
3071
|
-
accountEmail:
|
|
3072
|
-
planLabel:
|
|
3073
|
-
installedVersion:
|
|
3074
|
-
minimumSupportedVersion:
|
|
3075
|
-
canInstall:
|
|
3076
|
-
canUpdate:
|
|
3077
|
-
loginCommand:
|
|
3078
|
-
localLoginCommand:
|
|
3151
|
+
statusMessage: z23.string().min(1).nullable(),
|
|
3152
|
+
accountEmail: z23.string().nullable(),
|
|
3153
|
+
planLabel: z23.string().min(1).nullable(),
|
|
3154
|
+
installedVersion: z23.string().min(1).nullable(),
|
|
3155
|
+
minimumSupportedVersion: z23.string().min(1).nullable(),
|
|
3156
|
+
canInstall: z23.boolean(),
|
|
3157
|
+
canUpdate: z23.boolean(),
|
|
3158
|
+
loginCommand: z23.string().min(1).nullable(),
|
|
3159
|
+
localLoginCommand: z23.string().min(1).nullable().optional()
|
|
3079
3160
|
}).passthrough();
|
|
3080
|
-
var providerUsageWindowSchema =
|
|
3081
|
-
label:
|
|
3082
|
-
usedPercent:
|
|
3083
|
-
resetsAt:
|
|
3084
|
-
cost:
|
|
3085
|
-
usedUsdCents:
|
|
3086
|
-
limitUsdCents:
|
|
3161
|
+
var providerUsageWindowSchema = z23.object({
|
|
3162
|
+
label: z23.string().min(1),
|
|
3163
|
+
usedPercent: z23.number().min(0).max(100),
|
|
3164
|
+
resetsAt: z23.string().min(1).nullable(),
|
|
3165
|
+
cost: z23.object({
|
|
3166
|
+
usedUsdCents: z23.number().int().nonnegative(),
|
|
3167
|
+
limitUsdCents: z23.number().int().positive()
|
|
3087
3168
|
}).optional()
|
|
3088
3169
|
}).passthrough();
|
|
3089
|
-
var providerUsageSchema =
|
|
3090
|
-
|
|
3091
|
-
status:
|
|
3092
|
-
accountEmail:
|
|
3093
|
-
planLabel:
|
|
3094
|
-
windows:
|
|
3170
|
+
var providerUsageSchema = z23.discriminatedUnion("status", [
|
|
3171
|
+
z23.object({
|
|
3172
|
+
status: z23.literal("ok"),
|
|
3173
|
+
accountEmail: z23.string().email().nullable(),
|
|
3174
|
+
planLabel: z23.string().min(1).nullable(),
|
|
3175
|
+
windows: z23.array(providerUsageWindowSchema)
|
|
3095
3176
|
}).passthrough(),
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
status:
|
|
3101
|
-
message:
|
|
3102
|
-
planLabel:
|
|
3103
|
-
accountEmail:
|
|
3177
|
+
z23.object({ status: z23.literal("not_installed") }).passthrough(),
|
|
3178
|
+
z23.object({ status: z23.literal("unauthenticated") }).passthrough(),
|
|
3179
|
+
z23.object({ status: z23.literal("expired") }).passthrough(),
|
|
3180
|
+
z23.object({
|
|
3181
|
+
status: z23.literal("error"),
|
|
3182
|
+
message: z23.string().min(1),
|
|
3183
|
+
planLabel: z23.string().min(1).nullable().default(null),
|
|
3184
|
+
accountEmail: z23.string().nullable().default(null)
|
|
3104
3185
|
}).passthrough()
|
|
3105
3186
|
]);
|
|
3106
|
-
var providerHealthResultSchema =
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
supported:
|
|
3187
|
+
var providerHealthResultSchema = z23.discriminatedUnion("supported", [
|
|
3188
|
+
z23.object({ supported: z23.literal(false) }).passthrough(),
|
|
3189
|
+
z23.object({
|
|
3190
|
+
supported: z23.literal(true),
|
|
3110
3191
|
health: providerHealthSchema
|
|
3111
3192
|
}).passthrough()
|
|
3112
3193
|
]);
|
|
3113
|
-
var providerUsageResultSchema =
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
supported:
|
|
3194
|
+
var providerUsageResultSchema = z23.discriminatedUnion("supported", [
|
|
3195
|
+
z23.object({ supported: z23.literal(false) }).passthrough(),
|
|
3196
|
+
z23.object({
|
|
3197
|
+
supported: z23.literal(true),
|
|
3117
3198
|
usage: providerUsageSchema
|
|
3118
3199
|
}).passthrough()
|
|
3119
3200
|
]);
|
|
3120
|
-
var providerInstallationActionKindSchema =
|
|
3201
|
+
var providerInstallationActionKindSchema = z23.enum([
|
|
3121
3202
|
"install",
|
|
3122
3203
|
"update"
|
|
3123
3204
|
]);
|
|
3124
|
-
var providerInstallationActionSchema =
|
|
3205
|
+
var providerInstallationActionSchema = z23.object({
|
|
3125
3206
|
kind: providerInstallationActionKindSchema,
|
|
3126
|
-
label:
|
|
3127
|
-
command:
|
|
3207
|
+
label: z23.enum(["Install", "Update"]),
|
|
3208
|
+
command: z23.string().min(1)
|
|
3128
3209
|
}).passthrough();
|
|
3129
|
-
var providerInstallationSourceSchema =
|
|
3210
|
+
var providerInstallationSourceSchema = z23.enum([
|
|
3130
3211
|
"notInstalled",
|
|
3131
3212
|
"npmGlobal",
|
|
3132
3213
|
"external"
|
|
3133
3214
|
]);
|
|
3134
|
-
var providerInstallationStatusSchema =
|
|
3135
|
-
executableName:
|
|
3136
|
-
executablePath:
|
|
3137
|
-
installed:
|
|
3215
|
+
var providerInstallationStatusSchema = z23.object({
|
|
3216
|
+
executableName: z23.string().min(1),
|
|
3217
|
+
executablePath: z23.string().min(1).nullable(),
|
|
3218
|
+
installed: z23.boolean(),
|
|
3138
3219
|
installSource: providerInstallationSourceSchema,
|
|
3139
|
-
currentVersion:
|
|
3140
|
-
latestVersion:
|
|
3141
|
-
minimumSupportedVersion:
|
|
3142
|
-
npmPackageName:
|
|
3143
|
-
npmGlobalPackageVersion:
|
|
3220
|
+
currentVersion: z23.string().min(1).nullable(),
|
|
3221
|
+
latestVersion: z23.string().min(1).nullable(),
|
|
3222
|
+
minimumSupportedVersion: z23.string().min(1).nullable(),
|
|
3223
|
+
npmPackageName: z23.string().min(1).nullable(),
|
|
3224
|
+
npmGlobalPackageVersion: z23.string().min(1).nullable(),
|
|
3144
3225
|
installAction: providerInstallationActionSchema.nullable(),
|
|
3145
|
-
needsUpdate:
|
|
3146
|
-
versionUnsupported:
|
|
3226
|
+
needsUpdate: z23.boolean(),
|
|
3227
|
+
versionUnsupported: z23.boolean()
|
|
3147
3228
|
}).passthrough();
|
|
3148
3229
|
var providerInstallationRunParamsSchema = providerMaintenanceParamsSchema.extend({
|
|
3149
3230
|
action: providerInstallationActionKindSchema
|
|
3150
3231
|
});
|
|
3151
|
-
var providerInstallationCommandSchema =
|
|
3152
|
-
command:
|
|
3153
|
-
args:
|
|
3154
|
-
displayCommand:
|
|
3232
|
+
var providerInstallationCommandSchema = z23.object({
|
|
3233
|
+
command: z23.string().min(1),
|
|
3234
|
+
args: z23.array(z23.string()).max(64),
|
|
3235
|
+
displayCommand: z23.string().min(1)
|
|
3155
3236
|
}).passthrough();
|
|
3156
|
-
var providerInstallationVerificationSchema =
|
|
3237
|
+
var providerInstallationVerificationSchema = z23.discriminatedUnion(
|
|
3157
3238
|
"kind",
|
|
3158
3239
|
[
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
kind:
|
|
3162
|
-
previousVersion:
|
|
3240
|
+
z23.object({ kind: z23.literal("installed") }).passthrough(),
|
|
3241
|
+
z23.object({
|
|
3242
|
+
kind: z23.literal("version_changed"),
|
|
3243
|
+
previousVersion: z23.string().min(1)
|
|
3163
3244
|
}).passthrough(),
|
|
3164
|
-
|
|
3165
|
-
kind:
|
|
3166
|
-
version:
|
|
3245
|
+
z23.object({
|
|
3246
|
+
kind: z23.literal("version_at_least"),
|
|
3247
|
+
version: z23.string().min(1)
|
|
3167
3248
|
}).passthrough()
|
|
3168
3249
|
]
|
|
3169
3250
|
);
|
|
3170
|
-
var providerInstallationRunResultSchema =
|
|
3251
|
+
var providerInstallationRunResultSchema = z23.discriminatedUnion(
|
|
3171
3252
|
"available",
|
|
3172
3253
|
[
|
|
3173
|
-
|
|
3174
|
-
available:
|
|
3175
|
-
message:
|
|
3254
|
+
z23.object({
|
|
3255
|
+
available: z23.literal(false),
|
|
3256
|
+
message: z23.string().min(1)
|
|
3176
3257
|
}).passthrough(),
|
|
3177
|
-
|
|
3178
|
-
available:
|
|
3258
|
+
z23.object({
|
|
3259
|
+
available: z23.literal(true),
|
|
3179
3260
|
command: providerInstallationCommandSchema,
|
|
3180
3261
|
verification: providerInstallationVerificationSchema
|
|
3181
3262
|
}).passthrough()
|
|
@@ -3183,80 +3264,80 @@ var providerInstallationRunResultSchema = z22.discriminatedUnion(
|
|
|
3183
3264
|
);
|
|
3184
3265
|
|
|
3185
3266
|
// ../provider-bridge-protocol/src/requests.ts
|
|
3186
|
-
import { z as
|
|
3267
|
+
import { z as z24 } from "zod";
|
|
3187
3268
|
var sessionConstructionFields = {
|
|
3188
|
-
threadId:
|
|
3189
|
-
cwd:
|
|
3269
|
+
threadId: z24.string().min(1),
|
|
3270
|
+
cwd: z24.string().min(1),
|
|
3190
3271
|
options: bridgeExecutionOptionsSchema,
|
|
3191
|
-
dynamicTools:
|
|
3192
|
-
disallowedTools:
|
|
3272
|
+
dynamicTools: z24.array(dynamicToolSchema).optional(),
|
|
3273
|
+
disallowedTools: z24.array(z24.string().min(1)).optional(),
|
|
3193
3274
|
instructionMode: instructionModeSchema
|
|
3194
3275
|
};
|
|
3195
|
-
var modelListParamsSchema =
|
|
3196
|
-
var threadStartParamsSchema =
|
|
3276
|
+
var modelListParamsSchema = z24.object({ cwd: z24.string().min(1).optional() }).passthrough();
|
|
3277
|
+
var threadStartParamsSchema = z24.object({
|
|
3197
3278
|
...sessionConstructionFields,
|
|
3198
|
-
input:
|
|
3279
|
+
input: z24.array(promptInputSchema).optional()
|
|
3199
3280
|
}).passthrough();
|
|
3200
|
-
var threadResumeParamsSchema =
|
|
3281
|
+
var threadResumeParamsSchema = z24.object({
|
|
3201
3282
|
...sessionConstructionFields,
|
|
3202
|
-
providerThreadId:
|
|
3283
|
+
providerThreadId: z24.string().min(1)
|
|
3203
3284
|
}).passthrough();
|
|
3204
|
-
var threadForkParamsSchema =
|
|
3285
|
+
var threadForkParamsSchema = z24.object({
|
|
3205
3286
|
...sessionConstructionFields,
|
|
3206
|
-
sourceProviderThreadId:
|
|
3207
|
-
sourceProviderCheckpointId:
|
|
3287
|
+
sourceProviderThreadId: z24.string().min(1),
|
|
3288
|
+
sourceProviderCheckpointId: z24.string().min(1).optional()
|
|
3208
3289
|
}).passthrough();
|
|
3209
|
-
var threadStopParamsSchema =
|
|
3210
|
-
threadId:
|
|
3211
|
-
providerThreadId:
|
|
3212
|
-
intent:
|
|
3213
|
-
activeTurnId:
|
|
3290
|
+
var threadStopParamsSchema = z24.object({
|
|
3291
|
+
threadId: z24.string().min(1),
|
|
3292
|
+
providerThreadId: z24.string().min(1),
|
|
3293
|
+
intent: z24.enum(["interrupt", "release"]),
|
|
3294
|
+
activeTurnId: z24.string().min(1).nullable()
|
|
3214
3295
|
}).passthrough();
|
|
3215
|
-
var threadRefParams =
|
|
3216
|
-
threadId:
|
|
3217
|
-
providerThreadId:
|
|
3296
|
+
var threadRefParams = z24.object({
|
|
3297
|
+
threadId: z24.string().min(1),
|
|
3298
|
+
providerThreadId: z24.string().min(1)
|
|
3218
3299
|
}).passthrough();
|
|
3219
3300
|
var threadDiscardParamsSchema = threadRefParams;
|
|
3220
|
-
var threadNameSetParamsSchema =
|
|
3221
|
-
threadId:
|
|
3222
|
-
providerThreadId:
|
|
3223
|
-
title:
|
|
3301
|
+
var threadNameSetParamsSchema = z24.object({
|
|
3302
|
+
threadId: z24.string().min(1),
|
|
3303
|
+
providerThreadId: z24.string().min(1),
|
|
3304
|
+
title: z24.string().min(1)
|
|
3224
3305
|
}).passthrough();
|
|
3225
3306
|
var turnInputFields = {
|
|
3226
|
-
threadId:
|
|
3227
|
-
providerThreadId:
|
|
3228
|
-
input:
|
|
3307
|
+
threadId: z24.string().min(1),
|
|
3308
|
+
providerThreadId: z24.string().min(1),
|
|
3309
|
+
input: z24.array(promptInputSchema),
|
|
3229
3310
|
clientRequestId: clientTurnRequestIdSchema,
|
|
3230
3311
|
options: bridgeExecutionOptionsSchema
|
|
3231
3312
|
};
|
|
3232
|
-
var turnStartParamsSchema =
|
|
3233
|
-
var turnSteerParamsSchema =
|
|
3313
|
+
var turnStartParamsSchema = z24.object(turnInputFields).passthrough();
|
|
3314
|
+
var turnSteerParamsSchema = z24.object({
|
|
3234
3315
|
...turnInputFields,
|
|
3235
|
-
expectedTurnId:
|
|
3316
|
+
expectedTurnId: z24.string().min(1)
|
|
3236
3317
|
}).passthrough();
|
|
3237
|
-
var skillsConfigureRootSchema =
|
|
3238
|
-
id:
|
|
3239
|
-
path:
|
|
3240
|
-
skills:
|
|
3241
|
-
|
|
3242
|
-
name:
|
|
3243
|
-
description:
|
|
3318
|
+
var skillsConfigureRootSchema = z24.object({
|
|
3319
|
+
id: z24.string().min(1),
|
|
3320
|
+
path: z24.string().min(1),
|
|
3321
|
+
skills: z24.array(
|
|
3322
|
+
z24.object({
|
|
3323
|
+
name: z24.string().min(1),
|
|
3324
|
+
description: z24.string()
|
|
3244
3325
|
}).passthrough()
|
|
3245
3326
|
)
|
|
3246
3327
|
}).passthrough();
|
|
3247
|
-
var skillsConfigureParamsSchema =
|
|
3248
|
-
roots:
|
|
3328
|
+
var skillsConfigureParamsSchema = z24.object({
|
|
3329
|
+
roots: z24.array(skillsConfigureRootSchema)
|
|
3249
3330
|
}).passthrough();
|
|
3250
|
-
var threadIdentityResultSchema =
|
|
3251
|
-
providerThreadId:
|
|
3252
|
-
sessionRestorable:
|
|
3331
|
+
var threadIdentityResultSchema = z24.object({
|
|
3332
|
+
providerThreadId: z24.string().min(1),
|
|
3333
|
+
sessionRestorable: z24.boolean().optional()
|
|
3253
3334
|
}).passthrough();
|
|
3254
3335
|
|
|
3255
3336
|
// ../provider-bridge-protocol/src/notifications.ts
|
|
3256
|
-
import { z as
|
|
3337
|
+
import { z as z26 } from "zod";
|
|
3257
3338
|
|
|
3258
3339
|
// ../provider-bridge-protocol/src/errors.ts
|
|
3259
|
-
import { z as
|
|
3340
|
+
import { z as z25 } from "zod";
|
|
3260
3341
|
var BRIDGE_JSON_RPC_ERRORS = {
|
|
3261
3342
|
INVALID_PARAMS: -32602,
|
|
3262
3343
|
METHOD_NOT_FOUND: -32601,
|
|
@@ -3266,12 +3347,12 @@ var BRIDGE_JSON_RPC_ERRORS = {
|
|
|
3266
3347
|
FORK_CHECKPOINT_UNSUPPORTED: -32003,
|
|
3267
3348
|
MISSING_EXECUTABLE: -32004
|
|
3268
3349
|
};
|
|
3269
|
-
var providerRecoveryHintSchema =
|
|
3350
|
+
var providerRecoveryHintSchema = z25.object({
|
|
3270
3351
|
kind: providerRecoveryKindSchema,
|
|
3271
|
-
message:
|
|
3272
|
-
retryable:
|
|
3352
|
+
message: z25.string().min(1),
|
|
3353
|
+
retryable: z25.boolean()
|
|
3273
3354
|
});
|
|
3274
|
-
var bridgeErrorDataSchema =
|
|
3355
|
+
var bridgeErrorDataSchema = z25.object({ recovery: providerRecoveryHintSchema.optional() }).passthrough();
|
|
3275
3356
|
|
|
3276
3357
|
// ../provider-bridge-protocol/src/notifications.ts
|
|
3277
3358
|
var BRIDGE_NOTIFICATION_METHODS = {
|
|
@@ -3281,177 +3362,177 @@ var BRIDGE_NOTIFICATION_METHODS = {
|
|
|
3281
3362
|
providerRecovery: "provider/recovery",
|
|
3282
3363
|
error: "error"
|
|
3283
3364
|
};
|
|
3284
|
-
var threadIdentityNotificationSchema =
|
|
3285
|
-
threadId:
|
|
3286
|
-
providerThreadId:
|
|
3287
|
-
sessionRestorable:
|
|
3365
|
+
var threadIdentityNotificationSchema = z26.object({
|
|
3366
|
+
threadId: z26.string().min(1),
|
|
3367
|
+
providerThreadId: z26.string().min(1),
|
|
3368
|
+
sessionRestorable: z26.boolean().optional()
|
|
3288
3369
|
}).passthrough();
|
|
3289
|
-
var sessionReplacedNotificationSchema =
|
|
3290
|
-
threadId:
|
|
3291
|
-
providerThreadId:
|
|
3292
|
-
reason:
|
|
3293
|
-
contextLost:
|
|
3294
|
-
showRuntimeNote:
|
|
3370
|
+
var sessionReplacedNotificationSchema = z26.object({
|
|
3371
|
+
threadId: z26.string().min(1),
|
|
3372
|
+
providerThreadId: z26.string().min(1).nullable(),
|
|
3373
|
+
reason: z26.string().min(1),
|
|
3374
|
+
contextLost: z26.boolean().default(false),
|
|
3375
|
+
showRuntimeNote: z26.boolean().default(false)
|
|
3295
3376
|
}).passthrough();
|
|
3296
|
-
var providerRecoveryNotificationSchema =
|
|
3297
|
-
threadId:
|
|
3377
|
+
var providerRecoveryNotificationSchema = z26.object({
|
|
3378
|
+
threadId: z26.string().min(1).optional(),
|
|
3298
3379
|
...providerRecoveryHintSchema.shape
|
|
3299
3380
|
}).passthrough();
|
|
3300
|
-
var errorNotificationSchema =
|
|
3301
|
-
threadId:
|
|
3302
|
-
providerThreadId:
|
|
3303
|
-
message:
|
|
3381
|
+
var errorNotificationSchema = z26.object({
|
|
3382
|
+
threadId: z26.string().min(1).optional(),
|
|
3383
|
+
providerThreadId: z26.string().min(1).optional(),
|
|
3384
|
+
message: z26.string().min(1)
|
|
3304
3385
|
}).passthrough();
|
|
3305
3386
|
|
|
3306
3387
|
// ../provider-bridge-protocol/src/bridge-requests.ts
|
|
3307
|
-
import { z as
|
|
3388
|
+
import { z as z27 } from "zod";
|
|
3308
3389
|
var BRIDGE_INBOUND_REQUEST_METHODS = {
|
|
3309
3390
|
toolCall: "item/tool/call",
|
|
3310
3391
|
interactionRequest: "interaction/request"
|
|
3311
3392
|
};
|
|
3312
|
-
var toolCallRequestParamsSchema =
|
|
3313
|
-
providerThreadId:
|
|
3314
|
-
threadId:
|
|
3315
|
-
turnId:
|
|
3316
|
-
callId:
|
|
3317
|
-
tool:
|
|
3318
|
-
arguments:
|
|
3319
|
-
providerNativeIds:
|
|
3393
|
+
var toolCallRequestParamsSchema = z27.object({
|
|
3394
|
+
providerThreadId: z27.string().min(1),
|
|
3395
|
+
threadId: z27.string().min(1).optional(),
|
|
3396
|
+
turnId: z27.union([z27.string().min(1), z27.null()]),
|
|
3397
|
+
callId: z27.string().min(1),
|
|
3398
|
+
tool: z27.string().min(1),
|
|
3399
|
+
arguments: z27.unknown(),
|
|
3400
|
+
providerNativeIds: z27.boolean().optional()
|
|
3320
3401
|
}).passthrough();
|
|
3321
|
-
var toolCallResultSchema =
|
|
3322
|
-
success:
|
|
3323
|
-
contentItems:
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
type:
|
|
3328
|
-
imageUrl:
|
|
3402
|
+
var toolCallResultSchema = z27.object({
|
|
3403
|
+
success: z27.boolean(),
|
|
3404
|
+
contentItems: z27.array(
|
|
3405
|
+
z27.discriminatedUnion("type", [
|
|
3406
|
+
z27.object({ type: z27.literal("inputText"), text: z27.string() }),
|
|
3407
|
+
z27.object({
|
|
3408
|
+
type: z27.literal("inputImage"),
|
|
3409
|
+
imageUrl: z27.string().min(1)
|
|
3329
3410
|
})
|
|
3330
3411
|
])
|
|
3331
3412
|
)
|
|
3332
3413
|
}).passthrough();
|
|
3333
|
-
var interactionRequestParamsSchema =
|
|
3334
|
-
providerThreadId:
|
|
3335
|
-
threadId:
|
|
3336
|
-
turnId:
|
|
3414
|
+
var interactionRequestParamsSchema = z27.object({
|
|
3415
|
+
providerThreadId: z27.string().min(1),
|
|
3416
|
+
threadId: z27.string().min(1).optional(),
|
|
3417
|
+
turnId: z27.union([z27.string().min(1), z27.null()]),
|
|
3337
3418
|
payload: pendingInteractionPayloadSchema,
|
|
3338
|
-
providerNativeIds:
|
|
3419
|
+
providerNativeIds: z27.boolean().optional()
|
|
3339
3420
|
}).passthrough();
|
|
3340
3421
|
|
|
3341
3422
|
// ../provider-bridge-protocol/src/thread-delta.ts
|
|
3342
|
-
import { z as
|
|
3423
|
+
import { z as z28 } from "zod";
|
|
3343
3424
|
var THREAD_DELTA_NOTIFICATION_METHOD = "thread/delta";
|
|
3344
3425
|
var deltaPresentationSchema = threadEventItemPresentationSchema;
|
|
3345
3426
|
var THREAD_DELTA_KEY_SEPARATOR = "";
|
|
3346
|
-
var deltaKeyPartSchema =
|
|
3427
|
+
var deltaKeyPartSchema = z28.string().min(1).refine((value) => !value.includes(THREAD_DELTA_KEY_SEPARATOR), {
|
|
3347
3428
|
message: "provider keys must not contain the internal key separator (\\u001f)"
|
|
3348
3429
|
});
|
|
3349
|
-
var deltaItemKeySchema =
|
|
3430
|
+
var deltaItemKeySchema = z28.object({
|
|
3350
3431
|
providerItemId: deltaKeyPartSchema.optional(),
|
|
3351
3432
|
channel: deltaKeyPartSchema.optional(),
|
|
3352
3433
|
parentRef: deltaKeyPartSchema.optional()
|
|
3353
3434
|
});
|
|
3354
3435
|
var providerTurnIdSchema = deltaKeyPartSchema;
|
|
3355
|
-
var deltaFileChangeSchema =
|
|
3356
|
-
path:
|
|
3357
|
-
kind:
|
|
3358
|
-
movePath:
|
|
3359
|
-
diff:
|
|
3360
|
-
oldText:
|
|
3361
|
-
newText:
|
|
3436
|
+
var deltaFileChangeSchema = z28.object({
|
|
3437
|
+
path: z28.string(),
|
|
3438
|
+
kind: z28.enum(["add", "update", "delete"]),
|
|
3439
|
+
movePath: z28.string().optional(),
|
|
3440
|
+
diff: z28.string().optional(),
|
|
3441
|
+
oldText: z28.string().optional(),
|
|
3442
|
+
newText: z28.string().optional()
|
|
3362
3443
|
});
|
|
3363
|
-
var deltaBackgroundTaskShapeSchema =
|
|
3364
|
-
type:
|
|
3365
|
-
familyId:
|
|
3366
|
-
taskType:
|
|
3367
|
-
description:
|
|
3444
|
+
var deltaBackgroundTaskShapeSchema = z28.object({
|
|
3445
|
+
type: z28.literal("backgroundTask"),
|
|
3446
|
+
familyId: z28.string().min(1),
|
|
3447
|
+
taskType: z28.string(),
|
|
3448
|
+
description: z28.string(),
|
|
3368
3449
|
status: threadEventItemStatusSchema,
|
|
3369
3450
|
taskStatus: backgroundTaskStatusSchema,
|
|
3370
|
-
skipTranscript:
|
|
3371
|
-
workflowName:
|
|
3451
|
+
skipTranscript: z28.boolean(),
|
|
3452
|
+
workflowName: z28.string().optional(),
|
|
3372
3453
|
workflow: workflowProgressSnapshotSchema.optional(),
|
|
3373
3454
|
usage: backgroundTaskUsageSchema.optional(),
|
|
3374
|
-
summary:
|
|
3375
|
-
error:
|
|
3376
|
-
outputFile:
|
|
3455
|
+
summary: z28.string().optional(),
|
|
3456
|
+
error: z28.string().optional(),
|
|
3457
|
+
outputFile: z28.string().optional()
|
|
3377
3458
|
});
|
|
3378
|
-
var deltaFileReadShapeSchema =
|
|
3379
|
-
type:
|
|
3380
|
-
path:
|
|
3381
|
-
cmd:
|
|
3459
|
+
var deltaFileReadShapeSchema = z28.object({
|
|
3460
|
+
type: z28.literal("fileRead"),
|
|
3461
|
+
path: z28.string(),
|
|
3462
|
+
cmd: z28.string().optional()
|
|
3382
3463
|
});
|
|
3383
|
-
var deltaSearchShapeSchema =
|
|
3384
|
-
type:
|
|
3464
|
+
var deltaSearchShapeSchema = z28.object({
|
|
3465
|
+
type: z28.literal("search"),
|
|
3385
3466
|
mode: threadEventSearchModeSchema,
|
|
3386
|
-
query:
|
|
3387
|
-
path:
|
|
3388
|
-
cmd:
|
|
3467
|
+
query: z28.string(),
|
|
3468
|
+
path: z28.string().optional(),
|
|
3469
|
+
cmd: z28.string().optional()
|
|
3389
3470
|
});
|
|
3390
|
-
var deltaDelegationShapeSchema =
|
|
3391
|
-
type:
|
|
3471
|
+
var deltaDelegationShapeSchema = z28.object({
|
|
3472
|
+
type: z28.literal("delegation"),
|
|
3392
3473
|
childRef: deltaKeyPartSchema,
|
|
3393
|
-
label:
|
|
3394
|
-
background:
|
|
3395
|
-
summary:
|
|
3474
|
+
label: z28.string(),
|
|
3475
|
+
background: z28.boolean(),
|
|
3476
|
+
summary: z28.string().optional()
|
|
3396
3477
|
});
|
|
3397
|
-
var deltaPlanStepsShapeSchema =
|
|
3398
|
-
type:
|
|
3399
|
-
steps:
|
|
3400
|
-
explanation:
|
|
3478
|
+
var deltaPlanStepsShapeSchema = z28.object({
|
|
3479
|
+
type: z28.literal("planSteps"),
|
|
3480
|
+
steps: z28.array(threadEventPlanStepSchema),
|
|
3481
|
+
explanation: z28.string().optional()
|
|
3401
3482
|
});
|
|
3402
|
-
var deltaExtensionShapeSchema =
|
|
3403
|
-
type:
|
|
3483
|
+
var deltaExtensionShapeSchema = z28.object({
|
|
3484
|
+
type: z28.literal("extension"),
|
|
3404
3485
|
kind: extensionKindSchema,
|
|
3405
3486
|
payload: jsonValueSchema
|
|
3406
3487
|
});
|
|
3407
|
-
var deltaItemShapeSchema =
|
|
3408
|
-
|
|
3409
|
-
type:
|
|
3410
|
-
command:
|
|
3411
|
-
cwd:
|
|
3412
|
-
aggregatedOutput:
|
|
3413
|
-
exitCode:
|
|
3414
|
-
durationMs:
|
|
3488
|
+
var deltaItemShapeSchema = z28.discriminatedUnion("type", [
|
|
3489
|
+
z28.object({
|
|
3490
|
+
type: z28.literal("command"),
|
|
3491
|
+
command: z28.string(),
|
|
3492
|
+
cwd: z28.string(),
|
|
3493
|
+
aggregatedOutput: z28.string().optional(),
|
|
3494
|
+
exitCode: z28.number().optional(),
|
|
3495
|
+
durationMs: z28.number().optional()
|
|
3415
3496
|
}),
|
|
3416
|
-
|
|
3417
|
-
type:
|
|
3418
|
-
changes:
|
|
3497
|
+
z28.object({
|
|
3498
|
+
type: z28.literal("fileChange"),
|
|
3499
|
+
changes: z28.array(deltaFileChangeSchema)
|
|
3419
3500
|
}),
|
|
3420
|
-
|
|
3421
|
-
type:
|
|
3422
|
-
tool:
|
|
3423
|
-
server:
|
|
3424
|
-
args:
|
|
3425
|
-
result:
|
|
3426
|
-
error:
|
|
3427
|
-
durationMs:
|
|
3501
|
+
z28.object({
|
|
3502
|
+
type: z28.literal("tool"),
|
|
3503
|
+
tool: z28.string(),
|
|
3504
|
+
server: z28.string().optional(),
|
|
3505
|
+
args: z28.unknown().optional(),
|
|
3506
|
+
result: z28.unknown().optional(),
|
|
3507
|
+
error: z28.string().optional(),
|
|
3508
|
+
durationMs: z28.number().optional()
|
|
3428
3509
|
}),
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
type:
|
|
3433
|
-
summary:
|
|
3434
|
-
content:
|
|
3510
|
+
z28.object({ type: z28.literal("compaction") }),
|
|
3511
|
+
z28.object({ type: z28.literal("agentMessage"), text: z28.string() }),
|
|
3512
|
+
z28.object({
|
|
3513
|
+
type: z28.literal("reasoning"),
|
|
3514
|
+
summary: z28.array(z28.string()),
|
|
3515
|
+
content: z28.array(z28.string())
|
|
3435
3516
|
}),
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
type:
|
|
3439
|
-
queries:
|
|
3517
|
+
z28.object({ type: z28.literal("plan"), text: z28.string() }),
|
|
3518
|
+
z28.object({
|
|
3519
|
+
type: z28.literal("webSearch"),
|
|
3520
|
+
queries: z28.array(z28.string()).min(1)
|
|
3440
3521
|
}),
|
|
3441
|
-
|
|
3442
|
-
type:
|
|
3443
|
-
url:
|
|
3444
|
-
prompt:
|
|
3445
|
-
pattern:
|
|
3522
|
+
z28.object({
|
|
3523
|
+
type: z28.literal("webFetch"),
|
|
3524
|
+
url: z28.string(),
|
|
3525
|
+
prompt: z28.string().nullable().optional(),
|
|
3526
|
+
pattern: z28.string().nullable()
|
|
3446
3527
|
}),
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
type:
|
|
3450
|
-
prompt:
|
|
3451
|
-
path:
|
|
3452
|
-
result:
|
|
3453
|
-
error:
|
|
3454
|
-
transparentBackground:
|
|
3528
|
+
z28.object({ type: z28.literal("imageView"), path: z28.string() }),
|
|
3529
|
+
z28.object({
|
|
3530
|
+
type: z28.literal("imageGeneration"),
|
|
3531
|
+
prompt: z28.string().nullable(),
|
|
3532
|
+
path: z28.string().nullable(),
|
|
3533
|
+
result: z28.string().optional(),
|
|
3534
|
+
error: z28.string().nullable(),
|
|
3535
|
+
transparentBackground: z28.boolean()
|
|
3455
3536
|
}),
|
|
3456
3537
|
deltaBackgroundTaskShapeSchema,
|
|
3457
3538
|
deltaFileReadShapeSchema,
|
|
@@ -3460,22 +3541,22 @@ var deltaItemShapeSchema = z27.discriminatedUnion("type", [
|
|
|
3460
3541
|
deltaPlanStepsShapeSchema,
|
|
3461
3542
|
deltaExtensionShapeSchema
|
|
3462
3543
|
]);
|
|
3463
|
-
var deltaProgressSnapshotSchema =
|
|
3544
|
+
var deltaProgressSnapshotSchema = z28.discriminatedUnion("type", [
|
|
3464
3545
|
deltaBackgroundTaskShapeSchema,
|
|
3465
3546
|
deltaDelegationShapeSchema
|
|
3466
3547
|
]);
|
|
3467
|
-
var deltaTextChannelSchema =
|
|
3548
|
+
var deltaTextChannelSchema = z28.enum([
|
|
3468
3549
|
"agentMessage",
|
|
3469
3550
|
"reasoningSummary",
|
|
3470
3551
|
"reasoningText",
|
|
3471
3552
|
"plan"
|
|
3472
3553
|
]);
|
|
3473
|
-
var deltaOutputChannelSchema =
|
|
3474
|
-
var deltaErrorSchema =
|
|
3475
|
-
var deltaAttachSchema =
|
|
3476
|
-
var deltaNoTurnFallbackSchema =
|
|
3554
|
+
var deltaOutputChannelSchema = z28.enum(["command", "fileChange"]);
|
|
3555
|
+
var deltaErrorSchema = z28.object({ message: z28.string() });
|
|
3556
|
+
var deltaAttachSchema = z28.enum(["open", "currentOrLast"]);
|
|
3557
|
+
var deltaNoTurnFallbackSchema = z28.object({
|
|
3477
3558
|
raw: providerRawEventSchema,
|
|
3478
|
-
rawType:
|
|
3559
|
+
rawType: z28.string()
|
|
3479
3560
|
});
|
|
3480
3561
|
function requireExtensionPresentation(delta, ctx) {
|
|
3481
3562
|
if (delta.item.type === "extension" && delta.presentation === void 0) {
|
|
@@ -3486,32 +3567,32 @@ function requireExtensionPresentation(delta, ctx) {
|
|
|
3486
3567
|
});
|
|
3487
3568
|
}
|
|
3488
3569
|
}
|
|
3489
|
-
var threadDeltaSchema =
|
|
3490
|
-
|
|
3491
|
-
kind:
|
|
3570
|
+
var threadDeltaSchema = z28.discriminatedUnion("kind", [
|
|
3571
|
+
z28.object({
|
|
3572
|
+
kind: z28.literal("input.accepted"),
|
|
3492
3573
|
clientRequestId: clientTurnRequestIdSchema,
|
|
3493
3574
|
providerTurnId: providerTurnIdSchema.optional()
|
|
3494
3575
|
}),
|
|
3495
|
-
|
|
3496
|
-
kind:
|
|
3497
|
-
text:
|
|
3576
|
+
z28.object({
|
|
3577
|
+
kind: z28.literal("input.provider"),
|
|
3578
|
+
text: z28.string().min(1),
|
|
3498
3579
|
parentRef: deltaKeyPartSchema.optional()
|
|
3499
3580
|
}),
|
|
3500
|
-
|
|
3501
|
-
kind:
|
|
3581
|
+
z28.object({
|
|
3582
|
+
kind: z28.literal("turn.open"),
|
|
3502
3583
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
3503
3584
|
parentRef: deltaKeyPartSchema.optional()
|
|
3504
3585
|
}),
|
|
3505
|
-
|
|
3506
|
-
kind:
|
|
3586
|
+
z28.object({
|
|
3587
|
+
kind: z28.literal("turn.boundary"),
|
|
3507
3588
|
status: threadEventTurnStatusSchema,
|
|
3508
3589
|
error: deltaErrorSchema.optional(),
|
|
3509
|
-
providerCheckpointId:
|
|
3510
|
-
claimIfIdle:
|
|
3590
|
+
providerCheckpointId: z28.string().min(1).optional(),
|
|
3591
|
+
claimIfIdle: z28.boolean().optional(),
|
|
3511
3592
|
providerTurnId: providerTurnIdSchema.optional()
|
|
3512
3593
|
}),
|
|
3513
|
-
|
|
3514
|
-
kind:
|
|
3594
|
+
z28.object({
|
|
3595
|
+
kind: z28.literal("item.open"),
|
|
3515
3596
|
key: deltaItemKeySchema,
|
|
3516
3597
|
item: deltaItemShapeSchema,
|
|
3517
3598
|
presentation: deltaPresentationSchema.optional(),
|
|
@@ -3519,154 +3600,159 @@ var threadDeltaSchema = z27.discriminatedUnion("kind", [
|
|
|
3519
3600
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
3520
3601
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
3521
3602
|
}).superRefine(requireExtensionPresentation),
|
|
3522
|
-
|
|
3523
|
-
kind:
|
|
3603
|
+
z28.object({
|
|
3604
|
+
kind: z28.literal("item.close"),
|
|
3524
3605
|
key: deltaItemKeySchema,
|
|
3525
3606
|
status: threadEventItemStatusSchema,
|
|
3526
|
-
resultText:
|
|
3527
|
-
exitCode:
|
|
3528
|
-
aggregatedOutput:
|
|
3529
|
-
approvalStatus:
|
|
3607
|
+
resultText: z28.string().optional(),
|
|
3608
|
+
exitCode: z28.number().optional(),
|
|
3609
|
+
aggregatedOutput: z28.string().optional(),
|
|
3610
|
+
approvalStatus: z28.literal("denied").optional(),
|
|
3530
3611
|
item: deltaItemShapeSchema,
|
|
3531
3612
|
presentation: deltaPresentationSchema.optional(),
|
|
3532
3613
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
3533
3614
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
3534
3615
|
}).superRefine(requireExtensionPresentation),
|
|
3535
|
-
|
|
3536
|
-
kind:
|
|
3616
|
+
z28.object({
|
|
3617
|
+
kind: z28.literal("item.progress"),
|
|
3537
3618
|
key: deltaItemKeySchema,
|
|
3538
|
-
message:
|
|
3619
|
+
message: z28.string().optional(),
|
|
3539
3620
|
snapshot: deltaProgressSnapshotSchema.optional(),
|
|
3540
|
-
flush:
|
|
3621
|
+
flush: z28.boolean().optional(),
|
|
3541
3622
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
3542
3623
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
3543
3624
|
}),
|
|
3544
|
-
|
|
3545
|
-
kind:
|
|
3625
|
+
z28.object({
|
|
3626
|
+
kind: z28.literal("item.textDelta"),
|
|
3546
3627
|
key: deltaItemKeySchema,
|
|
3547
3628
|
channel: deltaTextChannelSchema,
|
|
3548
|
-
text:
|
|
3629
|
+
text: z28.string(),
|
|
3549
3630
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
3550
3631
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
3551
3632
|
}),
|
|
3552
|
-
|
|
3553
|
-
kind:
|
|
3633
|
+
z28.object({
|
|
3634
|
+
kind: z28.literal("item.textClose"),
|
|
3554
3635
|
key: deltaItemKeySchema,
|
|
3555
3636
|
channel: deltaTextChannelSchema,
|
|
3556
|
-
text:
|
|
3637
|
+
text: z28.string().optional(),
|
|
3557
3638
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
3558
3639
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
3559
3640
|
}),
|
|
3560
|
-
|
|
3561
|
-
kind:
|
|
3641
|
+
z28.object({
|
|
3642
|
+
kind: z28.literal("item.outputDelta"),
|
|
3562
3643
|
key: deltaItemKeySchema,
|
|
3563
3644
|
channel: deltaOutputChannelSchema,
|
|
3564
|
-
text:
|
|
3645
|
+
text: z28.string(),
|
|
3565
3646
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
3566
3647
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
3567
3648
|
}),
|
|
3568
|
-
|
|
3569
|
-
kind:
|
|
3649
|
+
z28.object({
|
|
3650
|
+
kind: z28.literal("command.outputSnapshot"),
|
|
3570
3651
|
key: deltaItemKeySchema,
|
|
3571
|
-
text:
|
|
3652
|
+
text: z28.string(),
|
|
3572
3653
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
3573
3654
|
}),
|
|
3574
|
-
|
|
3575
|
-
kind:
|
|
3655
|
+
z28.object({
|
|
3656
|
+
kind: z28.literal("usage"),
|
|
3576
3657
|
total: threadEventTokenUsageBreakdownSchema,
|
|
3577
3658
|
last: threadEventTokenUsageBreakdownSchema,
|
|
3578
|
-
modelContextWindow:
|
|
3659
|
+
modelContextWindow: z28.number().nullable(),
|
|
3579
3660
|
providerTurnId: providerTurnIdSchema.optional()
|
|
3580
3661
|
}),
|
|
3581
|
-
|
|
3582
|
-
kind:
|
|
3662
|
+
z28.object({
|
|
3663
|
+
kind: z28.literal("contextWindow"),
|
|
3583
3664
|
snapshot: contextSnapshotSchema.optional(),
|
|
3584
|
-
used:
|
|
3585
|
-
size:
|
|
3586
|
-
estimated:
|
|
3665
|
+
used: z28.number().nullable(),
|
|
3666
|
+
size: z28.number().nullable().optional(),
|
|
3667
|
+
estimated: z28.boolean(),
|
|
3668
|
+
cost: threadUsageCostSchema.optional(),
|
|
3587
3669
|
attach: deltaAttachSchema,
|
|
3588
3670
|
providerTurnId: providerTurnIdSchema.optional()
|
|
3589
3671
|
}),
|
|
3590
|
-
|
|
3591
|
-
kind:
|
|
3672
|
+
z28.object({
|
|
3673
|
+
kind: z28.literal("context.compacted"),
|
|
3592
3674
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
3593
3675
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
3594
3676
|
}),
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
kind:
|
|
3598
|
-
diff:
|
|
3677
|
+
z28.object({ kind: z28.literal("context.cleared") }),
|
|
3678
|
+
z28.object({
|
|
3679
|
+
kind: z28.literal("turn.diff"),
|
|
3680
|
+
diff: z28.string(),
|
|
3599
3681
|
providerTurnId: providerTurnIdSchema.optional()
|
|
3600
3682
|
}),
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
kind:
|
|
3604
|
-
providerThreadId:
|
|
3683
|
+
z28.object({ kind: z28.literal("thread.started") }),
|
|
3684
|
+
z28.object({
|
|
3685
|
+
kind: z28.literal("thread.identity"),
|
|
3686
|
+
providerThreadId: z28.string().min(1)
|
|
3605
3687
|
}),
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3688
|
+
z28.object({
|
|
3689
|
+
kind: z28.literal("thread.name"),
|
|
3690
|
+
name: z28.string().min(1),
|
|
3691
|
+
source: z28.literal("agent").optional()
|
|
3692
|
+
}),
|
|
3693
|
+
z28.object({
|
|
3694
|
+
kind: z28.literal("extension.state"),
|
|
3609
3695
|
extensionKind: extensionKindSchema,
|
|
3610
3696
|
payload: jsonValueSchema
|
|
3611
3697
|
}),
|
|
3612
|
-
|
|
3613
|
-
kind:
|
|
3698
|
+
z28.object({
|
|
3699
|
+
kind: z28.literal("provider.rateLimits"),
|
|
3614
3700
|
rateLimits: providerRateLimitStateSchema
|
|
3615
3701
|
}),
|
|
3616
|
-
|
|
3617
|
-
kind:
|
|
3618
|
-
message:
|
|
3619
|
-
detail:
|
|
3620
|
-
willRetry:
|
|
3702
|
+
z28.object({
|
|
3703
|
+
kind: z28.literal("provider.error"),
|
|
3704
|
+
message: z28.string(),
|
|
3705
|
+
detail: z28.string().optional(),
|
|
3706
|
+
willRetry: z28.boolean().optional(),
|
|
3621
3707
|
category: providerErrorCategorySchema.optional(),
|
|
3622
3708
|
errorInfo: providerErrorInfoSchema.optional(),
|
|
3623
|
-
settlesTurn:
|
|
3709
|
+
settlesTurn: z28.boolean().optional(),
|
|
3624
3710
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
3625
|
-
threadScoped:
|
|
3711
|
+
threadScoped: z28.boolean().optional()
|
|
3626
3712
|
}),
|
|
3627
|
-
|
|
3628
|
-
kind:
|
|
3629
|
-
originalModel:
|
|
3630
|
-
fallbackModel:
|
|
3631
|
-
reason:
|
|
3632
|
-
message:
|
|
3713
|
+
z28.object({
|
|
3714
|
+
kind: z28.literal("provider.modelFallback"),
|
|
3715
|
+
originalModel: z28.string().min(1),
|
|
3716
|
+
fallbackModel: z28.string().min(1),
|
|
3717
|
+
reason: z28.enum(["refusal", "provider"]),
|
|
3718
|
+
message: z28.string()
|
|
3633
3719
|
}),
|
|
3634
|
-
|
|
3635
|
-
kind:
|
|
3636
|
-
summary:
|
|
3637
|
-
details:
|
|
3720
|
+
z28.object({
|
|
3721
|
+
kind: z28.literal("provider.warning"),
|
|
3722
|
+
summary: z28.string().optional(),
|
|
3723
|
+
details: z28.string().optional(),
|
|
3638
3724
|
category: threadEventWarningCategorySchema.optional(),
|
|
3639
|
-
vouchedTurn:
|
|
3725
|
+
vouchedTurn: z28.boolean().optional()
|
|
3640
3726
|
}),
|
|
3641
|
-
|
|
3642
|
-
kind:
|
|
3727
|
+
z28.object({
|
|
3728
|
+
kind: z28.literal("unhandled"),
|
|
3643
3729
|
raw: providerRawEventSchema,
|
|
3644
|
-
rawType:
|
|
3645
|
-
vouchedTurn:
|
|
3646
|
-
onlyIfNoTurn:
|
|
3730
|
+
rawType: z28.string(),
|
|
3731
|
+
vouchedTurn: z28.boolean(),
|
|
3732
|
+
onlyIfNoTurn: z28.boolean().optional(),
|
|
3647
3733
|
parentRef: deltaKeyPartSchema.optional(),
|
|
3648
3734
|
providerTurnId: providerTurnIdSchema.optional()
|
|
3649
3735
|
}),
|
|
3650
|
-
|
|
3651
|
-
|
|
3736
|
+
z28.object({ kind: z28.literal("session.ended") }),
|
|
3737
|
+
z28.object({ kind: z28.literal("session.reset") })
|
|
3652
3738
|
]);
|
|
3653
|
-
var threadDeltaNotificationParamsSchema =
|
|
3654
|
-
threadId:
|
|
3655
|
-
deltas:
|
|
3739
|
+
var threadDeltaNotificationParamsSchema = z28.object({
|
|
3740
|
+
threadId: z28.string().min(1),
|
|
3741
|
+
deltas: z28.array(threadDeltaSchema)
|
|
3656
3742
|
}).passthrough();
|
|
3657
3743
|
|
|
3658
3744
|
// ../provider-bridge-protocol/src/bridge-kit/adapter-utils.ts
|
|
3659
|
-
import { z as
|
|
3745
|
+
import { z as z30 } from "zod";
|
|
3660
3746
|
|
|
3661
3747
|
// ../provider-bridge-protocol/src/bridge-kit/tool-arg-schemas.ts
|
|
3662
|
-
import { z as
|
|
3663
|
-
var bashArgsSchema =
|
|
3664
|
-
command:
|
|
3665
|
-
cwd:
|
|
3748
|
+
import { z as z29 } from "zod";
|
|
3749
|
+
var bashArgsSchema = z29.object({
|
|
3750
|
+
command: z29.string().optional(),
|
|
3751
|
+
cwd: z29.string().optional()
|
|
3666
3752
|
}).passthrough();
|
|
3667
|
-
var textBlockSchema =
|
|
3668
|
-
type:
|
|
3669
|
-
text:
|
|
3753
|
+
var textBlockSchema = z29.object({
|
|
3754
|
+
type: z29.literal("text"),
|
|
3755
|
+
text: z29.string()
|
|
3670
3756
|
});
|
|
3671
3757
|
|
|
3672
3758
|
// ../provider-bridge-protocol/src/bridge-kit/provider-visibility-helpers.ts
|
|
@@ -3679,10 +3765,10 @@ function getStringProperty(value, key) {
|
|
|
3679
3765
|
}
|
|
3680
3766
|
|
|
3681
3767
|
// ../provider-bridge-protocol/src/bridge-kit/adapter-utils.ts
|
|
3682
|
-
var contentWrapperSchema =
|
|
3683
|
-
content:
|
|
3768
|
+
var contentWrapperSchema = z30.object({
|
|
3769
|
+
content: z30.array(z30.unknown())
|
|
3684
3770
|
}).passthrough();
|
|
3685
|
-
var shellEnvironmentVariableKeySchema =
|
|
3771
|
+
var shellEnvironmentVariableKeySchema = z30.string().regex(/^[A-Z_][A-Z0-9_]*$/i);
|
|
3686
3772
|
function toOptionalString(value) {
|
|
3687
3773
|
return typeof value === "string" ? value : void 0;
|
|
3688
3774
|
}
|
|
@@ -4036,26 +4122,26 @@ function withoutBridgeRuntimeEnv(env) {
|
|
|
4036
4122
|
}
|
|
4037
4123
|
|
|
4038
4124
|
// ../provider-bridge-protocol/src/bridge-kit/bridge-tool-calls.ts
|
|
4039
|
-
import { z as
|
|
4040
|
-
var bridgeRequestEnvelopeSchema =
|
|
4041
|
-
jsonrpc:
|
|
4042
|
-
id:
|
|
4043
|
-
method:
|
|
4044
|
-
params:
|
|
4125
|
+
import { z as z31 } from "zod";
|
|
4126
|
+
var bridgeRequestEnvelopeSchema = z31.object({
|
|
4127
|
+
jsonrpc: z31.literal("2.0"),
|
|
4128
|
+
id: z31.union([z31.string(), z31.number()]),
|
|
4129
|
+
method: z31.string(),
|
|
4130
|
+
params: z31.record(z31.string(), z31.unknown()).optional()
|
|
4045
4131
|
});
|
|
4046
|
-
var jsonRpcErrorSchema =
|
|
4047
|
-
code:
|
|
4048
|
-
message:
|
|
4049
|
-
data:
|
|
4132
|
+
var jsonRpcErrorSchema = z31.object({
|
|
4133
|
+
code: z31.number(),
|
|
4134
|
+
message: z31.string().optional(),
|
|
4135
|
+
data: z31.unknown().optional()
|
|
4050
4136
|
});
|
|
4051
|
-
var jsonRpcSuccessResponseSchema =
|
|
4052
|
-
jsonrpc:
|
|
4053
|
-
id:
|
|
4054
|
-
result:
|
|
4137
|
+
var jsonRpcSuccessResponseSchema = z31.object({
|
|
4138
|
+
jsonrpc: z31.literal("2.0"),
|
|
4139
|
+
id: z31.union([z31.string(), z31.number()]),
|
|
4140
|
+
result: z31.unknown()
|
|
4055
4141
|
});
|
|
4056
|
-
var jsonRpcErrorResponseSchema =
|
|
4057
|
-
jsonrpc:
|
|
4058
|
-
id:
|
|
4142
|
+
var jsonRpcErrorResponseSchema = z31.object({
|
|
4143
|
+
jsonrpc: z31.literal("2.0"),
|
|
4144
|
+
id: z31.union([z31.string(), z31.number()]),
|
|
4059
4145
|
error: jsonRpcErrorSchema
|
|
4060
4146
|
});
|
|
4061
4147
|
function isJsonRpcRequest(input) {
|
|
@@ -4143,47 +4229,47 @@ function buildBridgeToolCallContent(result) {
|
|
|
4143
4229
|
}
|
|
4144
4230
|
|
|
4145
4231
|
// ../provider-bridge-protocol/src/bridge-kit/json-rpc-envelope.ts
|
|
4146
|
-
import { z as
|
|
4147
|
-
var recordSchema =
|
|
4148
|
-
var jsonRpcEnvelopeSchema =
|
|
4149
|
-
jsonrpc:
|
|
4150
|
-
method:
|
|
4232
|
+
import { z as z32 } from "zod";
|
|
4233
|
+
var recordSchema = z32.record(z32.string(), z32.unknown());
|
|
4234
|
+
var jsonRpcEnvelopeSchema = z32.object({
|
|
4235
|
+
jsonrpc: z32.literal("2.0"),
|
|
4236
|
+
method: z32.string(),
|
|
4151
4237
|
params: recordSchema.optional()
|
|
4152
4238
|
}).passthrough();
|
|
4153
|
-
var sdkMessageEnvelopeSchema =
|
|
4154
|
-
jsonrpc:
|
|
4155
|
-
method:
|
|
4156
|
-
params:
|
|
4157
|
-
message:
|
|
4158
|
-
threadId:
|
|
4159
|
-
parent_tool_use_id:
|
|
4239
|
+
var sdkMessageEnvelopeSchema = z32.object({
|
|
4240
|
+
jsonrpc: z32.literal("2.0"),
|
|
4241
|
+
method: z32.literal("sdk/message"),
|
|
4242
|
+
params: z32.object({
|
|
4243
|
+
message: z32.unknown(),
|
|
4244
|
+
threadId: z32.string().optional(),
|
|
4245
|
+
parent_tool_use_id: z32.string().optional()
|
|
4160
4246
|
}).passthrough()
|
|
4161
4247
|
}).passthrough();
|
|
4162
|
-
var threadIdentityEnvelopeSchema =
|
|
4163
|
-
jsonrpc:
|
|
4164
|
-
method:
|
|
4165
|
-
params:
|
|
4166
|
-
threadId:
|
|
4167
|
-
providerThreadId:
|
|
4248
|
+
var threadIdentityEnvelopeSchema = z32.object({
|
|
4249
|
+
jsonrpc: z32.literal("2.0"),
|
|
4250
|
+
method: z32.literal("thread/identity"),
|
|
4251
|
+
params: z32.object({
|
|
4252
|
+
threadId: z32.string().optional(),
|
|
4253
|
+
providerThreadId: z32.string().optional()
|
|
4168
4254
|
}).passthrough()
|
|
4169
4255
|
}).passthrough();
|
|
4170
|
-
var threadContextWindowUsageEnvelopeSchema =
|
|
4171
|
-
jsonrpc:
|
|
4172
|
-
method:
|
|
4173
|
-
params:
|
|
4174
|
-
threadId:
|
|
4175
|
-
contextWindowUsage:
|
|
4176
|
-
usedTokens:
|
|
4177
|
-
modelContextWindow:
|
|
4178
|
-
estimated:
|
|
4256
|
+
var threadContextWindowUsageEnvelopeSchema = z32.object({
|
|
4257
|
+
jsonrpc: z32.literal("2.0"),
|
|
4258
|
+
method: z32.literal("thread/contextWindowUsage/updated"),
|
|
4259
|
+
params: z32.object({
|
|
4260
|
+
threadId: z32.string().optional(),
|
|
4261
|
+
contextWindowUsage: z32.object({
|
|
4262
|
+
usedTokens: z32.number().nullable(),
|
|
4263
|
+
modelContextWindow: z32.number().nullable(),
|
|
4264
|
+
estimated: z32.boolean()
|
|
4179
4265
|
})
|
|
4180
4266
|
}).passthrough()
|
|
4181
4267
|
}).passthrough();
|
|
4182
|
-
var errorEnvelopeSchema =
|
|
4183
|
-
jsonrpc:
|
|
4184
|
-
method:
|
|
4185
|
-
params:
|
|
4186
|
-
message:
|
|
4268
|
+
var errorEnvelopeSchema = z32.object({
|
|
4269
|
+
jsonrpc: z32.literal("2.0"),
|
|
4270
|
+
method: z32.literal("error"),
|
|
4271
|
+
params: z32.object({
|
|
4272
|
+
message: z32.string().optional()
|
|
4187
4273
|
}).passthrough().optional()
|
|
4188
4274
|
}).passthrough();
|
|
4189
4275
|
|
|
@@ -11528,7 +11614,7 @@ import { constants as fsConstants } from "node:fs";
|
|
|
11528
11614
|
import { access } from "node:fs/promises";
|
|
11529
11615
|
import path8 from "node:path";
|
|
11530
11616
|
import { promisify as promisify4 } from "node:util";
|
|
11531
|
-
import { z as
|
|
11617
|
+
import { z as z33 } from "zod";
|
|
11532
11618
|
var execFileAsync2 = promisify4(execFile3);
|
|
11533
11619
|
var CLI_PROBE_TIMEOUT_MS = 5e3;
|
|
11534
11620
|
var DEFAULT_WINDOWS_PATHEXT = ".COM;.EXE;.BAT;.CMD";
|
|
@@ -11614,9 +11700,9 @@ function clampPercent(value) {
|
|
|
11614
11700
|
}
|
|
11615
11701
|
|
|
11616
11702
|
// ../provider-bridge-protocol/src/bridge-kit/provider-tool-call-contract.ts
|
|
11617
|
-
import { z as
|
|
11618
|
-
var providerToolCallCancellationSchema =
|
|
11619
|
-
requestId:
|
|
11703
|
+
import { z as z34 } from "zod";
|
|
11704
|
+
var providerToolCallCancellationSchema = z34.object({
|
|
11705
|
+
requestId: z34.union([z34.string(), z34.number().int()])
|
|
11620
11706
|
});
|
|
11621
11707
|
var PROVIDER_TOOL_CALL_CANCELLED_METHOD = "notifications/cancelled";
|
|
11622
11708
|
|
|
@@ -11632,8 +11718,8 @@ function createProviderVisibilityMetadata(args) {
|
|
|
11632
11718
|
}
|
|
11633
11719
|
|
|
11634
11720
|
// ../provider-bridge-protocol/src/bridge-kit/runtime-json-rpc.ts
|
|
11635
|
-
import { z as
|
|
11636
|
-
var ignoredJsonRpcResultSchema =
|
|
11721
|
+
import { z as z35 } from "zod";
|
|
11722
|
+
var ignoredJsonRpcResultSchema = z35.unknown();
|
|
11637
11723
|
|
|
11638
11724
|
// ../provider-bridge-acp/src/bridge/bridge.ts
|
|
11639
11725
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
@@ -11642,21 +11728,21 @@ import { createServer } from "node:net";
|
|
|
11642
11728
|
import { dirname as dirname2, isAbsolute as isAbsolute2, basename as basename3, relative as relative2, resolve as resolve4 } from "node:path";
|
|
11643
11729
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
11644
11730
|
import { isDeepStrictEqual } from "node:util";
|
|
11645
|
-
import { z as
|
|
11731
|
+
import { z as z44 } from "zod";
|
|
11646
11732
|
|
|
11647
11733
|
// ../provider-bridge-acp/src/bridge-protocol.ts
|
|
11648
|
-
import { z as
|
|
11734
|
+
import { z as z37 } from "zod";
|
|
11649
11735
|
|
|
11650
11736
|
// ../provider-bridge-acp/src/wire.ts
|
|
11651
|
-
import { z as
|
|
11652
|
-
var acpTextContentBlockSchema =
|
|
11653
|
-
type:
|
|
11654
|
-
text:
|
|
11737
|
+
import { z as z36 } from "zod";
|
|
11738
|
+
var acpTextContentBlockSchema = z36.object({
|
|
11739
|
+
type: z36.literal("text"),
|
|
11740
|
+
text: z36.string()
|
|
11655
11741
|
}).passthrough();
|
|
11656
|
-
var acpOtherContentBlockSchema =
|
|
11657
|
-
type:
|
|
11742
|
+
var acpOtherContentBlockSchema = z36.object({
|
|
11743
|
+
type: z36.string()
|
|
11658
11744
|
}).passthrough();
|
|
11659
|
-
var acpContentBlockSchema =
|
|
11745
|
+
var acpContentBlockSchema = z36.union([
|
|
11660
11746
|
acpTextContentBlockSchema,
|
|
11661
11747
|
acpOtherContentBlockSchema
|
|
11662
11748
|
]);
|
|
@@ -11679,7 +11765,7 @@ var ACP_TOOL_KINDS = [
|
|
|
11679
11765
|
"switch_mode",
|
|
11680
11766
|
"other"
|
|
11681
11767
|
];
|
|
11682
|
-
var acpToolKindSchema =
|
|
11768
|
+
var acpToolKindSchema = z36.enum(ACP_TOOL_KINDS);
|
|
11683
11769
|
var ACP_TOOL_KIND_SET = new Set(ACP_TOOL_KINDS);
|
|
11684
11770
|
var ACP_TOOL_CALL_STATUSES = [
|
|
11685
11771
|
"pending",
|
|
@@ -11688,48 +11774,48 @@ var ACP_TOOL_CALL_STATUSES = [
|
|
|
11688
11774
|
"failed",
|
|
11689
11775
|
"cancelled"
|
|
11690
11776
|
];
|
|
11691
|
-
var acpToolCallStatusSchema =
|
|
11777
|
+
var acpToolCallStatusSchema = z36.enum(ACP_TOOL_CALL_STATUSES);
|
|
11692
11778
|
var ACP_TOOL_CALL_STATUS_SET = new Set(
|
|
11693
11779
|
ACP_TOOL_CALL_STATUSES
|
|
11694
11780
|
);
|
|
11695
|
-
var acpToolCallContentSchema =
|
|
11696
|
-
|
|
11697
|
-
type:
|
|
11781
|
+
var acpToolCallContentSchema = z36.union([
|
|
11782
|
+
z36.object({
|
|
11783
|
+
type: z36.literal("content"),
|
|
11698
11784
|
content: acpContentBlockSchema
|
|
11699
11785
|
}).passthrough(),
|
|
11700
|
-
|
|
11701
|
-
type:
|
|
11702
|
-
path:
|
|
11703
|
-
oldText:
|
|
11704
|
-
newText:
|
|
11786
|
+
z36.object({
|
|
11787
|
+
type: z36.literal("diff"),
|
|
11788
|
+
path: z36.string(),
|
|
11789
|
+
oldText: z36.string().nullable().optional(),
|
|
11790
|
+
newText: z36.string()
|
|
11705
11791
|
}).passthrough(),
|
|
11706
|
-
|
|
11707
|
-
type:
|
|
11708
|
-
terminalId:
|
|
11792
|
+
z36.object({
|
|
11793
|
+
type: z36.literal("terminal"),
|
|
11794
|
+
terminalId: z36.string()
|
|
11709
11795
|
}).passthrough()
|
|
11710
11796
|
]);
|
|
11711
|
-
var acpToolCallContentListSchema =
|
|
11797
|
+
var acpToolCallContentListSchema = z36.array(z36.unknown()).transform(
|
|
11712
11798
|
(entries) => entries.flatMap((entry) => {
|
|
11713
11799
|
const parsed = acpToolCallContentSchema.safeParse(entry);
|
|
11714
11800
|
return parsed.success ? [parsed.data] : [];
|
|
11715
11801
|
})
|
|
11716
11802
|
);
|
|
11717
|
-
var acpToolCallLocationSchema =
|
|
11718
|
-
path:
|
|
11719
|
-
line:
|
|
11803
|
+
var acpToolCallLocationSchema = z36.object({
|
|
11804
|
+
path: z36.string(),
|
|
11805
|
+
line: z36.number().optional().nullable()
|
|
11720
11806
|
}).passthrough();
|
|
11721
|
-
var acpToolCallNameSchema =
|
|
11722
|
-
var acpToolCallFieldsSchema =
|
|
11723
|
-
toolCallId:
|
|
11724
|
-
title:
|
|
11807
|
+
var acpToolCallNameSchema = z36.union([z36.string(), z36.null()]).transform((value) => value ?? void 0).optional();
|
|
11808
|
+
var acpToolCallFieldsSchema = z36.object({
|
|
11809
|
+
toolCallId: z36.string(),
|
|
11810
|
+
title: z36.string().optional(),
|
|
11725
11811
|
name: acpToolCallNameSchema,
|
|
11726
11812
|
kind: acpToolKindSchema.optional(),
|
|
11727
|
-
rawKind:
|
|
11813
|
+
rawKind: z36.string().optional(),
|
|
11728
11814
|
status: acpToolCallStatusSchema.optional(),
|
|
11729
11815
|
content: acpToolCallContentListSchema.optional(),
|
|
11730
|
-
locations:
|
|
11731
|
-
rawInput:
|
|
11732
|
-
rawOutput:
|
|
11816
|
+
locations: z36.array(acpToolCallLocationSchema).optional(),
|
|
11817
|
+
rawInput: z36.unknown().optional(),
|
|
11818
|
+
rawOutput: z36.unknown().optional()
|
|
11733
11819
|
});
|
|
11734
11820
|
function openAcpToolCallEnums(value) {
|
|
11735
11821
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
@@ -11755,43 +11841,43 @@ function openAcpToolCallEnums(value) {
|
|
|
11755
11841
|
}
|
|
11756
11842
|
return next;
|
|
11757
11843
|
}
|
|
11758
|
-
var acpAgentMessageChunkUpdateSchema =
|
|
11759
|
-
sessionUpdate:
|
|
11844
|
+
var acpAgentMessageChunkUpdateSchema = z36.object({
|
|
11845
|
+
sessionUpdate: z36.literal("agent_message_chunk"),
|
|
11760
11846
|
content: acpContentBlockSchema
|
|
11761
11847
|
}).passthrough();
|
|
11762
|
-
var acpAgentThoughtChunkUpdateSchema =
|
|
11763
|
-
sessionUpdate:
|
|
11848
|
+
var acpAgentThoughtChunkUpdateSchema = z36.object({
|
|
11849
|
+
sessionUpdate: z36.literal("agent_thought_chunk"),
|
|
11764
11850
|
content: acpContentBlockSchema
|
|
11765
11851
|
}).passthrough();
|
|
11766
|
-
var acpToolCallUpdateEventSchema =
|
|
11852
|
+
var acpToolCallUpdateEventSchema = z36.preprocess(
|
|
11767
11853
|
openAcpToolCallEnums,
|
|
11768
11854
|
acpToolCallFieldsSchema.extend({
|
|
11769
|
-
sessionUpdate:
|
|
11855
|
+
sessionUpdate: z36.enum(["tool_call", "tool_call_update"])
|
|
11770
11856
|
}).passthrough()
|
|
11771
11857
|
);
|
|
11772
|
-
var acpPlanEntryStatusSchema =
|
|
11858
|
+
var acpPlanEntryStatusSchema = z36.enum([
|
|
11773
11859
|
"pending",
|
|
11774
11860
|
"in_progress",
|
|
11775
11861
|
"completed"
|
|
11776
11862
|
]);
|
|
11777
|
-
var acpPlanUpdateSchema =
|
|
11778
|
-
sessionUpdate:
|
|
11779
|
-
entries:
|
|
11780
|
-
|
|
11781
|
-
content:
|
|
11863
|
+
var acpPlanUpdateSchema = z36.object({
|
|
11864
|
+
sessionUpdate: z36.literal("plan"),
|
|
11865
|
+
entries: z36.array(
|
|
11866
|
+
z36.object({
|
|
11867
|
+
content: z36.string(),
|
|
11782
11868
|
status: acpPlanEntryStatusSchema.optional()
|
|
11783
11869
|
}).passthrough()
|
|
11784
11870
|
)
|
|
11785
11871
|
}).passthrough();
|
|
11786
|
-
var acpUsageUpdateSchema =
|
|
11787
|
-
sessionUpdate:
|
|
11788
|
-
used:
|
|
11789
|
-
size:
|
|
11872
|
+
var acpUsageUpdateSchema = z36.object({
|
|
11873
|
+
sessionUpdate: z36.literal("usage_update"),
|
|
11874
|
+
used: z36.number().int().nonnegative(),
|
|
11875
|
+
size: z36.number().int().nonnegative()
|
|
11790
11876
|
}).passthrough();
|
|
11791
|
-
var acpOtherSessionUpdateSchema =
|
|
11792
|
-
sessionUpdate:
|
|
11877
|
+
var acpOtherSessionUpdateSchema = z36.object({
|
|
11878
|
+
sessionUpdate: z36.string()
|
|
11793
11879
|
}).passthrough();
|
|
11794
|
-
var acpSessionUpdateSchema =
|
|
11880
|
+
var acpSessionUpdateSchema = z36.union([
|
|
11795
11881
|
acpAgentMessageChunkUpdateSchema,
|
|
11796
11882
|
acpAgentThoughtChunkUpdateSchema,
|
|
11797
11883
|
acpToolCallUpdateEventSchema,
|
|
@@ -11799,57 +11885,57 @@ var acpSessionUpdateSchema = z35.union([
|
|
|
11799
11885
|
acpUsageUpdateSchema,
|
|
11800
11886
|
acpOtherSessionUpdateSchema
|
|
11801
11887
|
]);
|
|
11802
|
-
var acpSessionNotificationParamsSchema =
|
|
11803
|
-
sessionId:
|
|
11888
|
+
var acpSessionNotificationParamsSchema = z36.object({
|
|
11889
|
+
sessionId: z36.string(),
|
|
11804
11890
|
update: acpSessionUpdateSchema
|
|
11805
11891
|
}).passthrough();
|
|
11806
11892
|
var ACP_PROTOCOL_VERSION = 1;
|
|
11807
|
-
var acpInitializeResultSchema =
|
|
11808
|
-
protocolVersion:
|
|
11809
|
-
agentCapabilities:
|
|
11810
|
-
loadSession:
|
|
11811
|
-
sessionCapabilities:
|
|
11812
|
-
fork:
|
|
11893
|
+
var acpInitializeResultSchema = z36.object({
|
|
11894
|
+
protocolVersion: z36.number(),
|
|
11895
|
+
agentCapabilities: z36.object({
|
|
11896
|
+
loadSession: z36.boolean().optional(),
|
|
11897
|
+
sessionCapabilities: z36.object({
|
|
11898
|
+
fork: z36.object({}).passthrough().nullable().optional()
|
|
11813
11899
|
}).passthrough().optional(),
|
|
11814
|
-
promptCapabilities:
|
|
11815
|
-
image:
|
|
11900
|
+
promptCapabilities: z36.object({
|
|
11901
|
+
image: z36.boolean().optional()
|
|
11816
11902
|
}).passthrough().optional()
|
|
11817
11903
|
}).passthrough().optional(),
|
|
11818
|
-
authMethods:
|
|
11904
|
+
authMethods: z36.array(z36.object({ id: z36.string() }).passthrough()).optional()
|
|
11819
11905
|
}).passthrough();
|
|
11820
|
-
var acpOptionalString =
|
|
11821
|
-
var acpConfigOptionSelectOptionSchema =
|
|
11822
|
-
value:
|
|
11906
|
+
var acpOptionalString = z36.union([z36.string(), z36.null()]).transform((value) => value ?? void 0).optional();
|
|
11907
|
+
var acpConfigOptionSelectOptionSchema = z36.object({
|
|
11908
|
+
value: z36.string(),
|
|
11823
11909
|
name: acpOptionalString
|
|
11824
11910
|
}).passthrough();
|
|
11825
|
-
var acpConfigOptionSchema =
|
|
11826
|
-
id:
|
|
11911
|
+
var acpConfigOptionSchema = z36.object({
|
|
11912
|
+
id: z36.string(),
|
|
11827
11913
|
name: acpOptionalString,
|
|
11828
11914
|
category: acpOptionalString,
|
|
11829
|
-
type:
|
|
11915
|
+
type: z36.string(),
|
|
11830
11916
|
currentValue: acpOptionalString,
|
|
11831
|
-
options:
|
|
11917
|
+
options: z36.array(acpConfigOptionSelectOptionSchema).optional()
|
|
11832
11918
|
}).passthrough();
|
|
11833
|
-
var acpSessionModelSchema =
|
|
11834
|
-
modelId:
|
|
11919
|
+
var acpSessionModelSchema = z36.object({
|
|
11920
|
+
modelId: z36.string(),
|
|
11835
11921
|
name: acpOptionalString,
|
|
11836
11922
|
description: acpOptionalString
|
|
11837
11923
|
}).passthrough();
|
|
11838
|
-
var acpSessionModelsSchema =
|
|
11924
|
+
var acpSessionModelsSchema = z36.object({
|
|
11839
11925
|
currentModelId: acpOptionalString,
|
|
11840
|
-
availableModels:
|
|
11926
|
+
availableModels: z36.array(acpSessionModelSchema).optional()
|
|
11841
11927
|
}).passthrough();
|
|
11842
|
-
var acpLooseConfigOptionSchema =
|
|
11843
|
-
id:
|
|
11844
|
-
name:
|
|
11928
|
+
var acpLooseConfigOptionSchema = z36.object({
|
|
11929
|
+
id: z36.string().optional(),
|
|
11930
|
+
name: z36.unknown().optional(),
|
|
11845
11931
|
category: acpOptionalString,
|
|
11846
|
-
type:
|
|
11847
|
-
currentValue:
|
|
11848
|
-
options:
|
|
11932
|
+
type: z36.unknown().optional(),
|
|
11933
|
+
currentValue: z36.unknown().optional(),
|
|
11934
|
+
options: z36.unknown().optional()
|
|
11849
11935
|
}).passthrough();
|
|
11850
|
-
var acpConfigOptionSelectGroupSchema =
|
|
11851
|
-
group:
|
|
11852
|
-
options:
|
|
11936
|
+
var acpConfigOptionSelectGroupSchema = z36.object({
|
|
11937
|
+
group: z36.string(),
|
|
11938
|
+
options: z36.array(z36.unknown())
|
|
11853
11939
|
}).passthrough();
|
|
11854
11940
|
function flattenAcpConfigOptionGroups(option) {
|
|
11855
11941
|
if (typeof option !== "object" || option === null) {
|
|
@@ -11910,119 +11996,119 @@ function parseAcpConfigOptions(options, ctx) {
|
|
|
11910
11996
|
}
|
|
11911
11997
|
return parsedOptions;
|
|
11912
11998
|
}
|
|
11913
|
-
var acpSessionNewResultSchema =
|
|
11914
|
-
sessionId:
|
|
11999
|
+
var acpSessionNewResultSchema = z36.object({
|
|
12000
|
+
sessionId: z36.string(),
|
|
11915
12001
|
models: acpSessionModelsSchema.optional(),
|
|
11916
|
-
configOptions:
|
|
12002
|
+
configOptions: z36.array(z36.unknown()).nullable().optional().transform((options, ctx) => parseAcpConfigOptions(options, ctx))
|
|
11917
12003
|
}).passthrough();
|
|
11918
|
-
var acpConfigStateResultSchema =
|
|
12004
|
+
var acpConfigStateResultSchema = z36.object({
|
|
11919
12005
|
models: acpSessionModelsSchema.optional(),
|
|
11920
|
-
configOptions:
|
|
12006
|
+
configOptions: z36.array(z36.unknown()).nullable().optional().transform((options, ctx) => parseAcpConfigOptions(options, ctx))
|
|
11921
12007
|
}).passthrough();
|
|
11922
12008
|
var acpSessionForkResultSchema = acpConfigStateResultSchema.extend({
|
|
11923
|
-
sessionId:
|
|
12009
|
+
sessionId: z36.string()
|
|
11924
12010
|
});
|
|
11925
|
-
var acpStopReasonSchema =
|
|
12011
|
+
var acpStopReasonSchema = z36.enum([
|
|
11926
12012
|
"end_turn",
|
|
11927
12013
|
"max_tokens",
|
|
11928
12014
|
"max_turn_requests",
|
|
11929
12015
|
"refusal",
|
|
11930
12016
|
"cancelled"
|
|
11931
12017
|
]);
|
|
11932
|
-
var acpPromptResultSchema =
|
|
12018
|
+
var acpPromptResultSchema = z36.object({
|
|
11933
12019
|
stopReason: acpStopReasonSchema
|
|
11934
12020
|
}).passthrough();
|
|
11935
|
-
var acpPermissionOptionKindSchema =
|
|
12021
|
+
var acpPermissionOptionKindSchema = z36.enum([
|
|
11936
12022
|
"allow_once",
|
|
11937
12023
|
"allow_always",
|
|
11938
12024
|
"reject_once",
|
|
11939
12025
|
"reject_always"
|
|
11940
12026
|
]);
|
|
11941
|
-
var acpPermissionOptionSchema =
|
|
11942
|
-
optionId:
|
|
11943
|
-
name:
|
|
12027
|
+
var acpPermissionOptionSchema = z36.object({
|
|
12028
|
+
optionId: z36.string(),
|
|
12029
|
+
name: z36.string(),
|
|
11944
12030
|
kind: acpPermissionOptionKindSchema
|
|
11945
12031
|
}).passthrough();
|
|
11946
|
-
var acpRequestPermissionParamsSchema =
|
|
11947
|
-
sessionId:
|
|
11948
|
-
toolCall:
|
|
12032
|
+
var acpRequestPermissionParamsSchema = z36.object({
|
|
12033
|
+
sessionId: z36.string(),
|
|
12034
|
+
toolCall: z36.preprocess(
|
|
11949
12035
|
openAcpToolCallEnums,
|
|
11950
12036
|
acpToolCallFieldsSchema.partial().passthrough()
|
|
11951
12037
|
).optional(),
|
|
11952
|
-
options:
|
|
12038
|
+
options: z36.array(acpPermissionOptionSchema).min(1)
|
|
11953
12039
|
}).passthrough();
|
|
11954
|
-
var acpReadTextFileParamsSchema =
|
|
11955
|
-
sessionId:
|
|
11956
|
-
path:
|
|
11957
|
-
line:
|
|
11958
|
-
limit:
|
|
12040
|
+
var acpReadTextFileParamsSchema = z36.object({
|
|
12041
|
+
sessionId: z36.string(),
|
|
12042
|
+
path: z36.string(),
|
|
12043
|
+
line: z36.number().nullable().optional(),
|
|
12044
|
+
limit: z36.number().nullable().optional()
|
|
11959
12045
|
}).passthrough();
|
|
11960
|
-
var acpWriteTextFileParamsSchema =
|
|
11961
|
-
sessionId:
|
|
11962
|
-
path:
|
|
11963
|
-
content:
|
|
12046
|
+
var acpWriteTextFileParamsSchema = z36.object({
|
|
12047
|
+
sessionId: z36.string(),
|
|
12048
|
+
path: z36.string(),
|
|
12049
|
+
content: z36.string()
|
|
11964
12050
|
}).passthrough();
|
|
11965
12051
|
|
|
11966
12052
|
// ../provider-bridge-acp/src/bridge-protocol.ts
|
|
11967
12053
|
var ACP_DEFAULT_MODEL_ID = "acp-default";
|
|
11968
12054
|
var acpModelListParamsSchema = modelListParamsSchema.extend({
|
|
11969
|
-
providerOptions:
|
|
12055
|
+
providerOptions: z37.record(z37.string(), z37.unknown()).optional()
|
|
11970
12056
|
});
|
|
11971
|
-
var acpBridgeCommandSchema =
|
|
11972
|
-
|
|
11973
|
-
method:
|
|
12057
|
+
var acpBridgeCommandSchema = z37.discriminatedUnion("method", [
|
|
12058
|
+
z37.object({
|
|
12059
|
+
method: z37.literal("initialize"),
|
|
11974
12060
|
params: initializeParamsSchema
|
|
11975
12061
|
}),
|
|
11976
|
-
|
|
11977
|
-
method:
|
|
12062
|
+
z37.object({
|
|
12063
|
+
method: z37.literal("model/list"),
|
|
11978
12064
|
params: acpModelListParamsSchema
|
|
11979
12065
|
}),
|
|
11980
|
-
|
|
11981
|
-
method:
|
|
12066
|
+
z37.object({
|
|
12067
|
+
method: z37.literal("provider/health"),
|
|
11982
12068
|
params: providerMaintenanceParamsSchema
|
|
11983
12069
|
}),
|
|
11984
|
-
|
|
11985
|
-
method:
|
|
12070
|
+
z37.object({
|
|
12071
|
+
method: z37.literal("provider/usage"),
|
|
11986
12072
|
params: providerMaintenanceParamsSchema
|
|
11987
12073
|
}),
|
|
11988
|
-
|
|
11989
|
-
method:
|
|
12074
|
+
z37.object({
|
|
12075
|
+
method: z37.literal("provider/installation/status"),
|
|
11990
12076
|
params: providerInstallationStatusParamsSchema
|
|
11991
12077
|
}),
|
|
11992
|
-
|
|
11993
|
-
method:
|
|
12078
|
+
z37.object({
|
|
12079
|
+
method: z37.literal("provider/installation/run"),
|
|
11994
12080
|
params: providerInstallationRunParamsSchema
|
|
11995
12081
|
}),
|
|
11996
|
-
|
|
11997
|
-
method:
|
|
12082
|
+
z37.object({
|
|
12083
|
+
method: z37.literal("thread/start"),
|
|
11998
12084
|
params: threadStartParamsSchema
|
|
11999
12085
|
}),
|
|
12000
|
-
|
|
12001
|
-
method:
|
|
12086
|
+
z37.object({
|
|
12087
|
+
method: z37.literal("thread/resume"),
|
|
12002
12088
|
params: threadResumeParamsSchema
|
|
12003
12089
|
}),
|
|
12004
|
-
|
|
12005
|
-
method:
|
|
12090
|
+
z37.object({
|
|
12091
|
+
method: z37.literal("thread/fork"),
|
|
12006
12092
|
params: threadForkParamsSchema
|
|
12007
12093
|
}),
|
|
12008
|
-
|
|
12009
|
-
method:
|
|
12094
|
+
z37.object({
|
|
12095
|
+
method: z37.literal("turn/start"),
|
|
12010
12096
|
params: turnStartParamsSchema
|
|
12011
12097
|
}),
|
|
12012
|
-
|
|
12013
|
-
method:
|
|
12098
|
+
z37.object({
|
|
12099
|
+
method: z37.literal("turn/steer"),
|
|
12014
12100
|
params: turnSteerParamsSchema
|
|
12015
12101
|
}),
|
|
12016
|
-
|
|
12017
|
-
method:
|
|
12102
|
+
z37.object({
|
|
12103
|
+
method: z37.literal("thread/stop"),
|
|
12018
12104
|
params: threadStopParamsSchema
|
|
12019
12105
|
}),
|
|
12020
|
-
|
|
12021
|
-
method:
|
|
12106
|
+
z37.object({
|
|
12107
|
+
method: z37.literal("thread/discard"),
|
|
12022
12108
|
params: threadDiscardParamsSchema
|
|
12023
12109
|
}),
|
|
12024
|
-
|
|
12025
|
-
method:
|
|
12110
|
+
z37.object({
|
|
12111
|
+
method: z37.literal("skills/configure"),
|
|
12026
12112
|
params: skillsConfigureParamsSchema
|
|
12027
12113
|
})
|
|
12028
12114
|
]);
|
|
@@ -12036,53 +12122,53 @@ var ACP_COMPACTION_COMPLETED_METHOD = "acp/compaction/completed";
|
|
|
12036
12122
|
var ACP_UPDATE_METHOD = "acp/update";
|
|
12037
12123
|
var ACP_FS_WRITE_METHOD = "acp/fs/write";
|
|
12038
12124
|
var ACP_WARNING_METHOD = "acp/warning";
|
|
12039
|
-
var acpTurnStartedNotificationParamsSchema =
|
|
12040
|
-
threadId:
|
|
12125
|
+
var acpTurnStartedNotificationParamsSchema = z37.object({
|
|
12126
|
+
threadId: z37.string().min(1)
|
|
12041
12127
|
}).passthrough();
|
|
12042
|
-
var acpTurnCompletedNotificationParamsSchema =
|
|
12043
|
-
threadId:
|
|
12128
|
+
var acpTurnCompletedNotificationParamsSchema = z37.object({
|
|
12129
|
+
threadId: z37.string().min(1),
|
|
12044
12130
|
stopReason: acpStopReasonSchema
|
|
12045
12131
|
}).passthrough();
|
|
12046
|
-
var acpCompactionCompletedNotificationParamsSchema =
|
|
12047
|
-
|
|
12048
|
-
threadId:
|
|
12049
|
-
status:
|
|
12132
|
+
var acpCompactionCompletedNotificationParamsSchema = z37.discriminatedUnion("status", [
|
|
12133
|
+
z37.object({
|
|
12134
|
+
threadId: z37.string().min(1),
|
|
12135
|
+
status: z37.literal("completed")
|
|
12050
12136
|
}).passthrough(),
|
|
12051
|
-
|
|
12052
|
-
threadId:
|
|
12053
|
-
status:
|
|
12137
|
+
z37.object({
|
|
12138
|
+
threadId: z37.string().min(1),
|
|
12139
|
+
status: z37.literal("interrupted")
|
|
12054
12140
|
}).passthrough(),
|
|
12055
|
-
|
|
12056
|
-
threadId:
|
|
12057
|
-
status:
|
|
12058
|
-
detail:
|
|
12141
|
+
z37.object({
|
|
12142
|
+
threadId: z37.string().min(1),
|
|
12143
|
+
status: z37.literal("skipped"),
|
|
12144
|
+
detail: z37.string().min(1)
|
|
12059
12145
|
}).passthrough(),
|
|
12060
|
-
|
|
12061
|
-
threadId:
|
|
12062
|
-
status:
|
|
12063
|
-
error:
|
|
12146
|
+
z37.object({
|
|
12147
|
+
threadId: z37.string().min(1),
|
|
12148
|
+
status: z37.literal("failed"),
|
|
12149
|
+
error: z37.string().min(1)
|
|
12064
12150
|
}).passthrough()
|
|
12065
12151
|
]);
|
|
12066
|
-
var acpUpdateNotificationParamsSchema =
|
|
12067
|
-
threadId:
|
|
12152
|
+
var acpUpdateNotificationParamsSchema = z37.object({
|
|
12153
|
+
threadId: z37.string().min(1),
|
|
12068
12154
|
update: acpSessionUpdateSchema
|
|
12069
12155
|
}).passthrough();
|
|
12070
|
-
var acpFsWriteNotificationParamsSchema =
|
|
12071
|
-
threadId:
|
|
12072
|
-
path:
|
|
12073
|
-
kind:
|
|
12074
|
-
oldText:
|
|
12075
|
-
content:
|
|
12156
|
+
var acpFsWriteNotificationParamsSchema = z37.object({
|
|
12157
|
+
threadId: z37.string().min(1),
|
|
12158
|
+
path: z37.string().min(1),
|
|
12159
|
+
kind: z37.enum(["add", "update"]),
|
|
12160
|
+
oldText: z37.string().optional(),
|
|
12161
|
+
content: z37.string()
|
|
12076
12162
|
}).passthrough();
|
|
12077
|
-
var acpWarningNotificationParamsSchema =
|
|
12078
|
-
threadId:
|
|
12079
|
-
summary:
|
|
12080
|
-
details:
|
|
12163
|
+
var acpWarningNotificationParamsSchema = z37.object({
|
|
12164
|
+
threadId: z37.string().min(1),
|
|
12165
|
+
summary: z37.string().min(1),
|
|
12166
|
+
details: z37.string().optional()
|
|
12081
12167
|
}).passthrough();
|
|
12082
12168
|
|
|
12083
12169
|
// ../provider-bridge-acp/src/dialect.ts
|
|
12084
12170
|
import { basename } from "node:path";
|
|
12085
|
-
import { z as
|
|
12171
|
+
import { z as z42 } from "zod";
|
|
12086
12172
|
|
|
12087
12173
|
// ../provider-bridge-acp/src/bridge/provider-maintenance.ts
|
|
12088
12174
|
import { execFile as execFile4 } from "node:child_process";
|
|
@@ -12092,51 +12178,51 @@ import os2 from "node:os";
|
|
|
12092
12178
|
import path10 from "node:path";
|
|
12093
12179
|
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
12094
12180
|
import { promisify as promisify5 } from "node:util";
|
|
12095
|
-
import { z as
|
|
12181
|
+
import { z as z39 } from "zod";
|
|
12096
12182
|
|
|
12097
12183
|
// ../provider-bridge-acp/src/bridge/opencode-usage.ts
|
|
12098
12184
|
import fs2 from "node:fs/promises";
|
|
12099
12185
|
import os from "node:os";
|
|
12100
12186
|
import path9 from "node:path";
|
|
12101
12187
|
import { DatabaseSync } from "node:sqlite";
|
|
12102
|
-
import { z as
|
|
12103
|
-
var apiCredentialSchema =
|
|
12104
|
-
type:
|
|
12105
|
-
key:
|
|
12188
|
+
import { z as z38 } from "zod";
|
|
12189
|
+
var apiCredentialSchema = z38.object({
|
|
12190
|
+
type: z38.literal("api"),
|
|
12191
|
+
key: z38.string().trim().min(1)
|
|
12106
12192
|
});
|
|
12107
|
-
var storedKeySchema = apiCredentialSchema.extend({ type:
|
|
12108
|
-
var credentialsSchema =
|
|
12109
|
-
var accountSchema =
|
|
12110
|
-
id:
|
|
12111
|
-
email:
|
|
12112
|
-
url:
|
|
12113
|
-
access_token:
|
|
12114
|
-
token_expiry:
|
|
12115
|
-
active_org_id:
|
|
12193
|
+
var storedKeySchema = apiCredentialSchema.extend({ type: z38.literal("key") });
|
|
12194
|
+
var credentialsSchema = z38.record(z38.string(), z38.unknown());
|
|
12195
|
+
var accountSchema = z38.object({
|
|
12196
|
+
id: z38.string().min(1),
|
|
12197
|
+
email: z38.email().nullable().catch(null),
|
|
12198
|
+
url: z38.url(),
|
|
12199
|
+
access_token: z38.string().min(1),
|
|
12200
|
+
token_expiry: z38.number().nullable(),
|
|
12201
|
+
active_org_id: z38.string().min(1).nullable()
|
|
12116
12202
|
});
|
|
12117
|
-
var storedOAuthSchema =
|
|
12118
|
-
type:
|
|
12119
|
-
methodID:
|
|
12120
|
-
access:
|
|
12121
|
-
expires:
|
|
12122
|
-
metadata:
|
|
12123
|
-
server:
|
|
12124
|
-
accountID:
|
|
12125
|
-
email:
|
|
12126
|
-
orgID:
|
|
12203
|
+
var storedOAuthSchema = z38.object({
|
|
12204
|
+
type: z38.literal("oauth"),
|
|
12205
|
+
methodID: z38.literal("device"),
|
|
12206
|
+
access: z38.string().min(1),
|
|
12207
|
+
expires: z38.number().nonnegative(),
|
|
12208
|
+
metadata: z38.object({
|
|
12209
|
+
server: z38.url().default("https://opencode.ai/console"),
|
|
12210
|
+
accountID: z38.string().min(1),
|
|
12211
|
+
email: z38.email().nullable().catch(null),
|
|
12212
|
+
orgID: z38.string().min(1)
|
|
12127
12213
|
})
|
|
12128
12214
|
});
|
|
12129
12215
|
function isOfficialConsole(url) {
|
|
12130
12216
|
const issuer = new URL(url);
|
|
12131
12217
|
return issuer.origin === "https://opencode.ai" && ["/", "/console", "/console/"].includes(issuer.pathname);
|
|
12132
12218
|
}
|
|
12133
|
-
var windowSchema =
|
|
12134
|
-
status:
|
|
12135
|
-
percent:
|
|
12136
|
-
resetsAt:
|
|
12219
|
+
var windowSchema = z38.object({
|
|
12220
|
+
status: z38.enum(["ok", "rate-limited"]),
|
|
12221
|
+
percent: z38.number().nonnegative(),
|
|
12222
|
+
resetsAt: z38.iso.datetime({ offset: true })
|
|
12137
12223
|
});
|
|
12138
|
-
var usageSchema =
|
|
12139
|
-
usage:
|
|
12224
|
+
var usageSchema = z38.object({
|
|
12225
|
+
usage: z38.object({
|
|
12140
12226
|
rolling: windowSchema,
|
|
12141
12227
|
weekly: windowSchema,
|
|
12142
12228
|
monthly: windowSchema
|
|
@@ -12185,7 +12271,7 @@ function readStoredCredential(database) {
|
|
|
12185
12271
|
for (const provider of ["opencode-go", "opencode"]) {
|
|
12186
12272
|
const row = query.get(provider);
|
|
12187
12273
|
if (!row) continue;
|
|
12188
|
-
const value =
|
|
12274
|
+
const value = z38.string().parse(row.value);
|
|
12189
12275
|
const parsed = JSON.parse(value);
|
|
12190
12276
|
const credential = storedKeySchema.safeParse(parsed);
|
|
12191
12277
|
if (credential.success)
|
|
@@ -12366,8 +12452,8 @@ async function readKeychainAccessToken() {
|
|
|
12366
12452
|
return null;
|
|
12367
12453
|
}
|
|
12368
12454
|
}
|
|
12369
|
-
var cursorFileCredentialsSchema =
|
|
12370
|
-
accessToken:
|
|
12455
|
+
var cursorFileCredentialsSchema = z39.object({
|
|
12456
|
+
accessToken: z39.string().min(1).nullish()
|
|
12371
12457
|
});
|
|
12372
12458
|
async function readAccessToken() {
|
|
12373
12459
|
const keychain = await readKeychainAccessToken();
|
|
@@ -12414,7 +12500,7 @@ function readAccountEmail() {
|
|
|
12414
12500
|
database = new DatabaseSync2(databasePath);
|
|
12415
12501
|
database.exec("PRAGMA query_only = true");
|
|
12416
12502
|
const row = database.prepare("SELECT value FROM ItemTable WHERE key = ?").get("cursorAuth/cachedEmail");
|
|
12417
|
-
const parsed =
|
|
12503
|
+
const parsed = z39.object({ value: z39.string().email() }).safeParse(row);
|
|
12418
12504
|
return parsed.success ? parsed.data.value : null;
|
|
12419
12505
|
} catch {
|
|
12420
12506
|
return null;
|
|
@@ -12518,14 +12604,14 @@ function buildAcpProviderInstallationRun(status, args) {
|
|
|
12518
12604
|
verification: { kind: "installed" }
|
|
12519
12605
|
};
|
|
12520
12606
|
}
|
|
12521
|
-
var cursorNonNegativeIntegerSchema =
|
|
12522
|
-
|
|
12523
|
-
|
|
12607
|
+
var cursorNonNegativeIntegerSchema = z39.union([
|
|
12608
|
+
z39.number().int().nonnegative(),
|
|
12609
|
+
z39.string().regex(/^\d+$/u).transform(Number)
|
|
12524
12610
|
]).refine(Number.isSafeInteger);
|
|
12525
|
-
var cursorUsageResponseSchema =
|
|
12611
|
+
var cursorUsageResponseSchema = z39.object({
|
|
12526
12612
|
billingCycleEnd: cursorNonNegativeIntegerSchema.nullish(),
|
|
12527
|
-
planUsage:
|
|
12528
|
-
spendLimitUsage:
|
|
12613
|
+
planUsage: z39.object({ totalPercentUsed: z39.number().nonnegative().default(0) }).nullish(),
|
|
12614
|
+
spendLimitUsage: z39.object({
|
|
12529
12615
|
overallLimit: cursorNonNegativeIntegerSchema.nullish(),
|
|
12530
12616
|
overallUsed: cursorNonNegativeIntegerSchema.nullish(),
|
|
12531
12617
|
individualLimit: cursorNonNegativeIntegerSchema.nullish(),
|
|
@@ -12534,8 +12620,8 @@ var cursorUsageResponseSchema = z38.object({
|
|
|
12534
12620
|
pooledUsed: cursorNonNegativeIntegerSchema.nullish()
|
|
12535
12621
|
}).nullish()
|
|
12536
12622
|
}).passthrough();
|
|
12537
|
-
var cursorPlanResponseSchema =
|
|
12538
|
-
planInfo:
|
|
12623
|
+
var cursorPlanResponseSchema = z39.object({
|
|
12624
|
+
planInfo: z39.object({ planName: z39.string().min(1) }).nullish()
|
|
12539
12625
|
}).passthrough();
|
|
12540
12626
|
function normalizeUsage(rawUsage, rawPlan, accountEmail = null) {
|
|
12541
12627
|
const usage = cursorUsageResponseSchema.safeParse(rawUsage);
|
|
@@ -12748,17 +12834,17 @@ function toolKindPresentation(args) {
|
|
|
12748
12834
|
}
|
|
12749
12835
|
|
|
12750
12836
|
// ../provider-bridge-acp/src/tool-classification.ts
|
|
12751
|
-
import { z as
|
|
12837
|
+
import { z as z41 } from "zod";
|
|
12752
12838
|
|
|
12753
12839
|
// ../provider-bridge-acp/src/tool-call-operation.ts
|
|
12754
12840
|
import path11 from "node:path";
|
|
12755
|
-
import { z as
|
|
12756
|
-
var acpRawInputCommandSchema =
|
|
12757
|
-
var acpRawInputPathSchema =
|
|
12758
|
-
path:
|
|
12759
|
-
filePath:
|
|
12760
|
-
file_path:
|
|
12761
|
-
target_file:
|
|
12841
|
+
import { z as z40 } from "zod";
|
|
12842
|
+
var acpRawInputCommandSchema = z40.object({ command: z40.string() }).passthrough();
|
|
12843
|
+
var acpRawInputPathSchema = z40.object({
|
|
12844
|
+
path: z40.string().optional(),
|
|
12845
|
+
filePath: z40.string().optional(),
|
|
12846
|
+
file_path: z40.string().optional(),
|
|
12847
|
+
target_file: z40.string().optional()
|
|
12762
12848
|
}).passthrough();
|
|
12763
12849
|
function resolveAcpToolCallPath(value, options) {
|
|
12764
12850
|
const cwd = options?.cwd;
|
|
@@ -12934,14 +13020,14 @@ function extractAcpToolCallOutputText(event) {
|
|
|
12934
13020
|
).trim();
|
|
12935
13021
|
return rawOutputText.length > 0 ? rawOutputText : void 0;
|
|
12936
13022
|
}
|
|
12937
|
-
var commandRawOutputSchema =
|
|
12938
|
-
exitCode:
|
|
12939
|
-
exit_code:
|
|
12940
|
-
stdout:
|
|
12941
|
-
stderr:
|
|
12942
|
-
output_for_prompt:
|
|
12943
|
-
signal:
|
|
12944
|
-
timed_out:
|
|
13023
|
+
var commandRawOutputSchema = z41.object({
|
|
13024
|
+
exitCode: z41.number().int().nullable().optional(),
|
|
13025
|
+
exit_code: z41.number().int().nullable().optional(),
|
|
13026
|
+
stdout: z41.string().optional(),
|
|
13027
|
+
stderr: z41.string().optional(),
|
|
13028
|
+
output_for_prompt: z41.string().optional(),
|
|
13029
|
+
signal: z41.string().nullable().optional(),
|
|
13030
|
+
timed_out: z41.boolean().optional()
|
|
12945
13031
|
}).passthrough();
|
|
12946
13032
|
function emptyToUndefined(value) {
|
|
12947
13033
|
return value === void 0 || value.length === 0 ? void 0 : value;
|
|
@@ -13010,10 +13096,10 @@ function extractAcpCommandResult(event) {
|
|
|
13010
13096
|
...output === void 0 ? {} : { output: scrubInlineImageDataUrls(output) }
|
|
13011
13097
|
};
|
|
13012
13098
|
}
|
|
13013
|
-
var optionalNonBlank =
|
|
13099
|
+
var optionalNonBlank = z41.string().optional().transform(
|
|
13014
13100
|
(value) => value !== void 0 && value.trim().length > 0 ? value : void 0
|
|
13015
13101
|
);
|
|
13016
|
-
var searchRawInputSchema =
|
|
13102
|
+
var searchRawInputSchema = z41.object({
|
|
13017
13103
|
pattern: optionalNonBlank,
|
|
13018
13104
|
query: optionalNonBlank,
|
|
13019
13105
|
regex: optionalNonBlank,
|
|
@@ -13022,8 +13108,8 @@ var searchRawInputSchema = z40.object({
|
|
|
13022
13108
|
path: optionalNonBlank,
|
|
13023
13109
|
directory: optionalNonBlank
|
|
13024
13110
|
}).passthrough();
|
|
13025
|
-
var fetchRawInputSchema =
|
|
13026
|
-
var thinkRawInputSchema =
|
|
13111
|
+
var fetchRawInputSchema = z41.object({ url: optionalNonBlank, uri: optionalNonBlank }).passthrough();
|
|
13112
|
+
var thinkRawInputSchema = z41.object({ thought: optionalNonBlank, thinking: optionalNonBlank }).passthrough();
|
|
13027
13113
|
var SINGLE_TICKED_TOKEN_PATTERN = /^[^`]*`([^`\n]+)`[^`]*$/;
|
|
13028
13114
|
var URL_PATTERN = /https?:\/\/[^\s`'"<>]+/g;
|
|
13029
13115
|
function tickedTokenFromTitle(title) {
|
|
@@ -13216,10 +13302,10 @@ function classifyAcpToolCall2(event, injected, options) {
|
|
|
13216
13302
|
|
|
13217
13303
|
// ../provider-bridge-acp/src/dialect.ts
|
|
13218
13304
|
var GENERIC_ACP_DIALECT = { id: "acp" };
|
|
13219
|
-
var grokToolMetaSchema =
|
|
13220
|
-
"x.ai/tool":
|
|
13221
|
-
name:
|
|
13222
|
-
kind:
|
|
13305
|
+
var grokToolMetaSchema = z42.object({
|
|
13306
|
+
"x.ai/tool": z42.object({
|
|
13307
|
+
name: z42.string().optional(),
|
|
13308
|
+
kind: z42.string().optional()
|
|
13223
13309
|
}).passthrough()
|
|
13224
13310
|
}).passthrough();
|
|
13225
13311
|
function grokToolIdentity(event) {
|
|
@@ -13235,10 +13321,10 @@ function grokToolIdentity(event) {
|
|
|
13235
13321
|
};
|
|
13236
13322
|
}
|
|
13237
13323
|
var GROK_SPAWN_SUBAGENT_TOOL = "spawn_subagent";
|
|
13238
|
-
var grokSpawnSubagentInputSchema =
|
|
13239
|
-
description:
|
|
13240
|
-
prompt:
|
|
13241
|
-
subagent_type:
|
|
13324
|
+
var grokSpawnSubagentInputSchema = z42.object({
|
|
13325
|
+
description: z42.string().optional(),
|
|
13326
|
+
prompt: z42.string().optional(),
|
|
13327
|
+
subagent_type: z42.string().optional()
|
|
13242
13328
|
}).passthrough();
|
|
13243
13329
|
function grokClassifyToolCall(event) {
|
|
13244
13330
|
if (grokToolIdentity(event)?.name !== GROK_SPAWN_SUBAGENT_TOOL) {
|
|
@@ -13266,27 +13352,27 @@ var GROK_ACP_DIALECT = {
|
|
|
13266
13352
|
toolIdentity: grokToolIdentity,
|
|
13267
13353
|
classifyToolCall: grokClassifyToolCall
|
|
13268
13354
|
};
|
|
13269
|
-
var grokModelMetaSchema =
|
|
13270
|
-
totalContextTokens:
|
|
13355
|
+
var grokModelMetaSchema = z42.object({
|
|
13356
|
+
totalContextTokens: z42.number().int().positive()
|
|
13271
13357
|
}).passthrough();
|
|
13272
|
-
var grokPromptMetaSchema =
|
|
13273
|
-
inputTokens:
|
|
13274
|
-
totalTokens:
|
|
13275
|
-
usage:
|
|
13276
|
-
inputTokens:
|
|
13277
|
-
totalTokens:
|
|
13358
|
+
var grokPromptMetaSchema = z42.object({
|
|
13359
|
+
inputTokens: z42.number().int().nonnegative().optional(),
|
|
13360
|
+
totalTokens: z42.number().int().nonnegative().optional(),
|
|
13361
|
+
usage: z42.object({
|
|
13362
|
+
inputTokens: z42.number().int().nonnegative().optional(),
|
|
13363
|
+
totalTokens: z42.number().int().nonnegative().optional()
|
|
13278
13364
|
}).passthrough().optional()
|
|
13279
13365
|
}).passthrough();
|
|
13280
|
-
var grokPromptResultSchema =
|
|
13366
|
+
var grokPromptResultSchema = z42.object({
|
|
13281
13367
|
_meta: grokPromptMetaSchema.optional()
|
|
13282
13368
|
}).passthrough();
|
|
13283
|
-
var grokSessionModelSchema =
|
|
13284
|
-
modelId:
|
|
13369
|
+
var grokSessionModelSchema = z42.object({
|
|
13370
|
+
modelId: z42.string(),
|
|
13285
13371
|
_meta: grokModelMetaSchema.optional()
|
|
13286
13372
|
}).passthrough();
|
|
13287
|
-
var grokSessionModelsSchema =
|
|
13288
|
-
currentModelId:
|
|
13289
|
-
availableModels:
|
|
13373
|
+
var grokSessionModelsSchema = z42.object({
|
|
13374
|
+
currentModelId: z42.string().optional(),
|
|
13375
|
+
availableModels: z42.array(grokSessionModelSchema).optional()
|
|
13290
13376
|
}).passthrough();
|
|
13291
13377
|
function grokContextWindowSizeFromSessionModels(models) {
|
|
13292
13378
|
const parsed = grokSessionModelsSchema.safeParse(models);
|
|
@@ -13316,14 +13402,14 @@ function grokContextUsageFromPromptResult(result) {
|
|
|
13316
13402
|
return used === void 0 ? void 0 : { used };
|
|
13317
13403
|
}
|
|
13318
13404
|
var CURSOR_TASK_TOOL = "task";
|
|
13319
|
-
var cursorTaskRawInputSchema =
|
|
13405
|
+
var cursorTaskRawInputSchema = z42.object({ _toolName: z42.string().optional() }).passthrough();
|
|
13320
13406
|
var CURSOR_TASK_METHOD = "cursor/task";
|
|
13321
|
-
var cursorTaskParamsSchema =
|
|
13322
|
-
toolCallId:
|
|
13323
|
-
description:
|
|
13324
|
-
prompt:
|
|
13325
|
-
agentId:
|
|
13326
|
-
model:
|
|
13407
|
+
var cursorTaskParamsSchema = z42.object({
|
|
13408
|
+
toolCallId: z42.string(),
|
|
13409
|
+
description: z42.string().optional(),
|
|
13410
|
+
prompt: z42.string().optional(),
|
|
13411
|
+
agentId: z42.string().optional(),
|
|
13412
|
+
model: z42.string().optional()
|
|
13327
13413
|
}).passthrough();
|
|
13328
13414
|
function cursorClassifyToolCall(event) {
|
|
13329
13415
|
const parsed = cursorTaskRawInputSchema.safeParse(event.rawInput);
|
|
@@ -13371,23 +13457,23 @@ var CURSOR_ACP_DIALECT = {
|
|
|
13371
13457
|
handleClientRequest: cursorHandleClientRequest,
|
|
13372
13458
|
maintenance: CURSOR_ACP_MAINTENANCE
|
|
13373
13459
|
};
|
|
13374
|
-
var ompBashRawInputSchema =
|
|
13375
|
-
command:
|
|
13376
|
-
async:
|
|
13460
|
+
var ompBashRawInputSchema = z42.object({
|
|
13461
|
+
command: z42.string(),
|
|
13462
|
+
async: z42.boolean().optional()
|
|
13377
13463
|
}).passthrough();
|
|
13378
13464
|
var ompBashRawOutputSchema = commandRawOutputSchema.extend({
|
|
13379
|
-
content:
|
|
13380
|
-
|
|
13381
|
-
type:
|
|
13382
|
-
text:
|
|
13465
|
+
content: z42.array(
|
|
13466
|
+
z42.object({
|
|
13467
|
+
type: z42.literal("text"),
|
|
13468
|
+
text: z42.string()
|
|
13383
13469
|
}).passthrough()
|
|
13384
13470
|
),
|
|
13385
|
-
details:
|
|
13386
|
-
exitCode:
|
|
13387
|
-
wallTimeMs:
|
|
13388
|
-
timedOut:
|
|
13389
|
-
signal:
|
|
13390
|
-
async:
|
|
13471
|
+
details: z42.object({
|
|
13472
|
+
exitCode: z42.number().int().optional(),
|
|
13473
|
+
wallTimeMs: z42.number().nonnegative().optional(),
|
|
13474
|
+
timedOut: z42.boolean().optional(),
|
|
13475
|
+
signal: z42.unknown().optional(),
|
|
13476
|
+
async: z42.unknown().optional()
|
|
13391
13477
|
}).passthrough()
|
|
13392
13478
|
});
|
|
13393
13479
|
function stripOmpTrailingNotice(text, notice) {
|
|
@@ -13450,11 +13536,11 @@ var OMP_ACP_DIALECT = {
|
|
|
13450
13536
|
id: "omp",
|
|
13451
13537
|
commandResult: ompCommandResult
|
|
13452
13538
|
};
|
|
13453
|
-
var openCodeCommandRawOutputSchema =
|
|
13454
|
-
output:
|
|
13455
|
-
metadata:
|
|
13456
|
-
exit:
|
|
13457
|
-
output:
|
|
13539
|
+
var openCodeCommandRawOutputSchema = z42.object({
|
|
13540
|
+
output: z42.unknown().optional(),
|
|
13541
|
+
metadata: z42.object({
|
|
13542
|
+
exit: z42.number().int().nullable().optional(),
|
|
13543
|
+
output: z42.string().optional()
|
|
13458
13544
|
}).passthrough().optional()
|
|
13459
13545
|
}).passthrough();
|
|
13460
13546
|
function normalizeOpenCodeCommandEvent(event) {
|
|
@@ -14590,7 +14676,7 @@ function buildAcpNativeReasoningSupport(thoughtLevelOption) {
|
|
|
14590
14676
|
});
|
|
14591
14677
|
}
|
|
14592
14678
|
supportedReasoningEfforts.sort(
|
|
14593
|
-
(a2, b) =>
|
|
14679
|
+
(a2, b) => compareReasoningLevels(a2.reasoningEffort, b.reasoningEffort)
|
|
14594
14680
|
);
|
|
14595
14681
|
if (supportedReasoningEfforts.length === 0) {
|
|
14596
14682
|
return {
|
|
@@ -14756,7 +14842,7 @@ function buildAgentModelCatalog(rawModels) {
|
|
|
14756
14842
|
const defaultEntry = pool.find((entry) => entry.level === "medium") ?? pool.find((entry) => entry.level !== "none") ?? pool[0];
|
|
14757
14843
|
const defaultVariant = defaultEntry.member;
|
|
14758
14844
|
const levelsInLadderOrder = [...byLevel.keys()].sort(
|
|
14759
|
-
|
|
14845
|
+
compareReasoningLevels
|
|
14760
14846
|
);
|
|
14761
14847
|
const nameByLevel = /* @__PURE__ */ new Map();
|
|
14762
14848
|
for (const { member, level } of leveled) {
|
|
@@ -14877,7 +14963,7 @@ function cursorCatalogModel(model) {
|
|
|
14877
14963
|
id: selection.modelId,
|
|
14878
14964
|
model: selection.modelId,
|
|
14879
14965
|
supportedReasoningEfforts: [...efforts.values()].sort(
|
|
14880
|
-
(a2, b) =>
|
|
14966
|
+
(a2, b) => compareReasoningLevels(a2.reasoningEffort, b.reasoningEffort)
|
|
14881
14967
|
),
|
|
14882
14968
|
defaultReasoningEffort: selection.reasoningLevel ?? model.defaultReasoningEffort
|
|
14883
14969
|
},
|
|
@@ -14927,7 +15013,7 @@ function buildCursorParameterizedModelCatalog(models) {
|
|
|
14927
15013
|
model: {
|
|
14928
15014
|
...preferred.model,
|
|
14929
15015
|
supportedReasoningEfforts: [...efforts.values()].sort(
|
|
14930
|
-
(a2, b) =>
|
|
15016
|
+
(a2, b) => compareReasoningLevels(a2.reasoningEffort, b.reasoningEffort)
|
|
14931
15017
|
),
|
|
14932
15018
|
...serviceTiers === void 0 ? {} : { supportedServiceTiers: serviceTiers },
|
|
14933
15019
|
isDefault: current.model.isDefault || candidate.model.isDefault
|
|
@@ -15418,7 +15504,7 @@ import { basename as basename2, dirname, join as join2, resolve as resolve3 } fr
|
|
|
15418
15504
|
// ../provider-bridge-acp/src/bridge/tool-proxy-mcp.ts
|
|
15419
15505
|
import { createConnection } from "node:net";
|
|
15420
15506
|
import { createInterface as createInterface2 } from "node:readline";
|
|
15421
|
-
import { z as
|
|
15507
|
+
import { z as z43 } from "zod";
|
|
15422
15508
|
var ACP_BRIDGE_MCP_SERVER_NAME = "bb-bridge";
|
|
15423
15509
|
var ENV_HOST = "BB_ACP_DYNAMIC_TOOL_HOST";
|
|
15424
15510
|
var ENV_PORT = "BB_ACP_DYNAMIC_TOOL_PORT";
|
|
@@ -15426,45 +15512,45 @@ var ENV_TOKEN = "BB_ACP_DYNAMIC_TOOL_TOKEN";
|
|
|
15426
15512
|
var ENV_THREAD_ID = "BB_ACP_DYNAMIC_TOOL_THREAD_ID";
|
|
15427
15513
|
var ENV_TOOLS = "BB_ACP_DYNAMIC_TOOLS";
|
|
15428
15514
|
var ENV_PROGRESS_INTERVAL_MS = "BB_ACP_DYNAMIC_TOOL_PROGRESS_INTERVAL_MS";
|
|
15429
|
-
var dynamicToolBridgeRequestSchema =
|
|
15430
|
-
|
|
15431
|
-
kind:
|
|
15432
|
-
threadId:
|
|
15433
|
-
token:
|
|
15434
|
-
toolCount:
|
|
15515
|
+
var dynamicToolBridgeRequestSchema = z43.discriminatedUnion("kind", [
|
|
15516
|
+
z43.object({
|
|
15517
|
+
kind: z43.literal("initialized"),
|
|
15518
|
+
threadId: z43.string().min(1),
|
|
15519
|
+
token: z43.string().min(1),
|
|
15520
|
+
toolCount: z43.number().int().nonnegative()
|
|
15435
15521
|
}),
|
|
15436
|
-
|
|
15437
|
-
kind:
|
|
15438
|
-
arguments:
|
|
15439
|
-
callId:
|
|
15440
|
-
threadId:
|
|
15441
|
-
token:
|
|
15442
|
-
tool:
|
|
15522
|
+
z43.object({
|
|
15523
|
+
kind: z43.literal("toolCall"),
|
|
15524
|
+
arguments: z43.record(z43.string(), z43.unknown()).default({}),
|
|
15525
|
+
callId: z43.string().min(1),
|
|
15526
|
+
threadId: z43.string().min(1),
|
|
15527
|
+
token: z43.string().min(1),
|
|
15528
|
+
tool: z43.string().min(1)
|
|
15443
15529
|
})
|
|
15444
15530
|
]);
|
|
15445
|
-
var bridgeToolCallResponseSchema =
|
|
15446
|
-
|
|
15447
|
-
ok:
|
|
15448
|
-
content:
|
|
15449
|
-
contentBlocks:
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
|
|
15453
|
-
type:
|
|
15454
|
-
data:
|
|
15455
|
-
mimeType:
|
|
15531
|
+
var bridgeToolCallResponseSchema = z43.union([
|
|
15532
|
+
z43.object({
|
|
15533
|
+
ok: z43.literal(true),
|
|
15534
|
+
content: z43.string(),
|
|
15535
|
+
contentBlocks: z43.array(
|
|
15536
|
+
z43.discriminatedUnion("type", [
|
|
15537
|
+
z43.object({ type: z43.literal("text"), text: z43.string() }),
|
|
15538
|
+
z43.object({
|
|
15539
|
+
type: z43.literal("image"),
|
|
15540
|
+
data: z43.string(),
|
|
15541
|
+
mimeType: z43.string()
|
|
15456
15542
|
})
|
|
15457
15543
|
])
|
|
15458
15544
|
).optional(),
|
|
15459
|
-
images:
|
|
15460
|
-
isError:
|
|
15545
|
+
images: z43.array(z43.object({ data: z43.string(), mimeType: z43.string() })).default([]),
|
|
15546
|
+
isError: z43.boolean().optional()
|
|
15461
15547
|
}),
|
|
15462
|
-
|
|
15548
|
+
z43.object({ ok: z43.literal(false), error: z43.string() })
|
|
15463
15549
|
]);
|
|
15464
|
-
var jsonRpcMessageSchema =
|
|
15465
|
-
id:
|
|
15466
|
-
method:
|
|
15467
|
-
params:
|
|
15550
|
+
var jsonRpcMessageSchema = z43.object({
|
|
15551
|
+
id: z43.union([z43.string(), z43.number().int()]).optional(),
|
|
15552
|
+
method: z43.string().optional(),
|
|
15553
|
+
params: z43.unknown().optional()
|
|
15468
15554
|
});
|
|
15469
15555
|
var nextMcpToolCallId = 0;
|
|
15470
15556
|
var TOOL_CALL_PROGRESS_INTERVAL_MS = 15e3;
|
|
@@ -16262,7 +16348,7 @@ async function authenticateAcpAgent(args) {
|
|
|
16262
16348
|
await args.connection.request({
|
|
16263
16349
|
method: "authenticate",
|
|
16264
16350
|
params: { methodId, _meta: { headless: true } },
|
|
16265
|
-
resultSchema:
|
|
16351
|
+
resultSchema: z44.unknown()
|
|
16266
16352
|
});
|
|
16267
16353
|
} catch (error) {
|
|
16268
16354
|
throw new AcpAuthRequiredError(
|
|
@@ -16283,7 +16369,7 @@ async function loadAgentModelCatalog(listCommand) {
|
|
|
16283
16369
|
({ stdout: stdout2 }) => stdout2,
|
|
16284
16370
|
(error) => {
|
|
16285
16371
|
if (isMissingExecutableError(error)) throw error;
|
|
16286
|
-
const output =
|
|
16372
|
+
const output = z44.object({ stdout: z44.string(), stderr: z44.string() }).safeParse(error);
|
|
16287
16373
|
if (isAuthRequiredModelListError(
|
|
16288
16374
|
error,
|
|
16289
16375
|
output.success ? output.data.stdout : "",
|
|
@@ -16600,7 +16686,7 @@ async function selectAcpNativeModel(args) {
|
|
|
16600
16686
|
configId: modelOption.id,
|
|
16601
16687
|
value: selection.modelId
|
|
16602
16688
|
},
|
|
16603
|
-
resultSchema:
|
|
16689
|
+
resultSchema: z44.union([acpConfigStateResultSchema, z44.null()])
|
|
16604
16690
|
});
|
|
16605
16691
|
setModel = false;
|
|
16606
16692
|
} catch {
|
|
@@ -16611,7 +16697,7 @@ async function selectAcpNativeModel(args) {
|
|
|
16611
16697
|
configState = await session.connection.request({
|
|
16612
16698
|
method: "session/set_model",
|
|
16613
16699
|
params: { sessionId: args.sessionId, modelId: selection.modelId },
|
|
16614
|
-
resultSchema:
|
|
16700
|
+
resultSchema: z44.union([acpConfigStateResultSchema, z44.null()])
|
|
16615
16701
|
});
|
|
16616
16702
|
}
|
|
16617
16703
|
const current = session.nativeConfig;
|
|
@@ -16682,7 +16768,7 @@ async function selectAcpNativeReasoning(args) {
|
|
|
16682
16768
|
configId: thoughtLevelOption.id,
|
|
16683
16769
|
value
|
|
16684
16770
|
},
|
|
16685
|
-
resultSchema:
|
|
16771
|
+
resultSchema: z44.union([acpConfigStateResultSchema, z44.null()])
|
|
16686
16772
|
});
|
|
16687
16773
|
} catch {
|
|
16688
16774
|
return;
|
|
@@ -16708,7 +16794,7 @@ async function selectAcpNativeServiceTier(args) {
|
|
|
16708
16794
|
configId: fastOption.id,
|
|
16709
16795
|
value
|
|
16710
16796
|
},
|
|
16711
|
-
resultSchema:
|
|
16797
|
+
resultSchema: z44.union([acpConfigStateResultSchema, z44.null()])
|
|
16712
16798
|
});
|
|
16713
16799
|
recordAcpConfigValue(args.session, configState, fastOption.id, value);
|
|
16714
16800
|
}
|
|
@@ -17146,7 +17232,7 @@ async function startAgentSession(request) {
|
|
|
17146
17232
|
cwd: params.cwd,
|
|
17147
17233
|
mcpServers
|
|
17148
17234
|
},
|
|
17149
|
-
resultSchema:
|
|
17235
|
+
resultSchema: z44.union([acpConfigStateResultSchema, z44.null()])
|
|
17150
17236
|
});
|
|
17151
17237
|
loadedConfigOptions = configState?.configOptions;
|
|
17152
17238
|
loadedModels = configState?.models;
|
|
@@ -17747,12 +17833,12 @@ function decodeLaunchSpec(providerOptions) {
|
|
|
17747
17833
|
);
|
|
17748
17834
|
return launchSpec.success ? launchSpec.data : null;
|
|
17749
17835
|
}
|
|
17750
|
-
var acpProviderOptionsSchema =
|
|
17751
|
-
additionalWorkspaceWriteRoots:
|
|
17752
|
-
acpDialect:
|
|
17753
|
-
parameterizedModelPicker:
|
|
17754
|
-
primaryModels:
|
|
17755
|
-
reasoningProbePriorityModelIds:
|
|
17836
|
+
var acpProviderOptionsSchema = z44.object({
|
|
17837
|
+
additionalWorkspaceWriteRoots: z44.array(z44.string()).optional(),
|
|
17838
|
+
acpDialect: z44.string().min(1).optional(),
|
|
17839
|
+
parameterizedModelPicker: z44.boolean().optional(),
|
|
17840
|
+
primaryModels: z44.array(z44.string().min(1)).optional(),
|
|
17841
|
+
reasoningProbePriorityModelIds: z44.array(z44.string().min(1)).optional()
|
|
17756
17842
|
}).passthrough();
|
|
17757
17843
|
function decodeAcpModelPickerOptions(providerOptions) {
|
|
17758
17844
|
const parsed = acpProviderOptionsSchema.parse(providerOptions ?? {});
|
|
@@ -18052,7 +18138,7 @@ var experimental_providerBridge = experimental_defineProviderBridge({
|
|
|
18052
18138
|
});
|
|
18053
18139
|
|
|
18054
18140
|
// ../provider-bridge-acp/src/probe.ts
|
|
18055
|
-
import { z as
|
|
18141
|
+
import { z as z45 } from "zod";
|
|
18056
18142
|
var PROBE_TIMEOUT_MS = 1e4;
|
|
18057
18143
|
function describe(error) {
|
|
18058
18144
|
if (error instanceof AcpAgentExitedError) {
|
|
@@ -18110,9 +18196,9 @@ async function probeAcpAgent(request) {
|
|
|
18110
18196
|
connected.kill();
|
|
18111
18197
|
}
|
|
18112
18198
|
}
|
|
18113
|
-
var acpAgentProbeSchema =
|
|
18114
|
-
|
|
18115
|
-
|
|
18199
|
+
var acpAgentProbeSchema = z45.union([
|
|
18200
|
+
z45.object({ reachable: z45.literal(true), fork: z45.boolean() }),
|
|
18201
|
+
z45.object({ reachable: z45.literal(false), reason: z45.string() })
|
|
18116
18202
|
]);
|
|
18117
18203
|
export {
|
|
18118
18204
|
acpAgentProbeSchema as experimental_acpAgentProbeSchema,
|