@nyte-ai/plugin 0.0.0-stage → 0.0.18
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/LICENSE +21 -0
- package/THIRD-PARTY-NOTICES.md +800 -0
- package/dist/chunks/billing-0y7dfkp2.js +146 -0
- package/dist/chunks/billing-2v3g7rd9.js +190 -0
- package/dist/chunks/billing-3j77ss7y.js +86 -0
- package/dist/chunks/billing-3scqmkzb.js +559 -0
- package/dist/chunks/billing-6z2kgtyt.js +51 -0
- package/dist/chunks/billing-8rjk35gr.js +444 -0
- package/dist/chunks/billing-9mfedmsh.js +373 -0
- package/dist/chunks/billing-9nn3yp18.js +176 -0
- package/dist/chunks/billing-9qc0eqh4.js +174 -0
- package/dist/chunks/billing-a9vqn66p.js +351 -0
- package/dist/chunks/billing-bv5zr32b.js +369 -0
- package/dist/chunks/billing-cy1rg619.js +302 -0
- package/dist/chunks/billing-ejx2hv52.js +323 -0
- package/dist/chunks/billing-h13r0byk.js +80 -0
- package/dist/chunks/billing-j643d12p.js +197 -0
- package/dist/chunks/billing-k2p1t25n.js +109 -0
- package/dist/chunks/billing-kn3d30b4.js +276 -0
- package/dist/chunks/billing-mvc33pv6.js +36 -0
- package/dist/chunks/billing-s4rrspsk.js +7 -0
- package/dist/chunks/billing-svrhh5a5.js +307 -0
- package/dist/chunks/billing-sxc70w72.js +161 -0
- package/dist/chunks/billing-t1qrxe16.js +41 -0
- package/dist/chunks/billing-tzr3cebf.js +20 -0
- package/dist/chunks/billing-wmcbg6fw.js +52 -0
- package/dist/chunks/billing-wmkxkypm.js +527 -0
- package/dist/chunks/billing-ye3wk5r3.js +205 -0
- package/dist/chunks/billing-zfpm2rt0.js +29 -0
- package/dist/examples/claude-code/LICENSE +21 -0
- package/dist/examples/claude-code/billing.d.ts +7 -0
- package/dist/examples/claude-code/billing.js +11 -0
- package/dist/examples/claude-code/claude-cli.d.ts +35 -0
- package/dist/examples/claude-code/claude-cli.js +15 -0
- package/dist/examples/claude-code/env.d.ts +1 -0
- package/dist/examples/claude-code/env.js +6 -0
- package/dist/examples/claude-code/index.d.ts +24 -0
- package/dist/examples/claude-code/index.js +149 -0
- package/dist/examples/claude-code/inert-mcp.d.ts +1 -0
- package/dist/examples/claude-code/inert-mcp.js +6 -0
- package/dist/examples/claude-code/model-catalog.d.ts +27 -0
- package/dist/examples/claude-code/model-catalog.js +12 -0
- package/dist/examples/claude-code/process.d.ts +22 -0
- package/dist/examples/claude-code/process.js +25 -0
- package/dist/examples/claude-code/replay.d.ts +4 -0
- package/dist/examples/claude-code/replay.js +11 -0
- package/dist/examples/claude-code/stream.d.ts +3 -0
- package/dist/examples/claude-code/stream.js +16 -0
- package/dist/examples/claude-code/transcript.d.ts +83 -0
- package/dist/examples/claude-code/transcript.js +23 -0
- package/dist/examples/claude-code/turn-relay.d.ts +48 -0
- package/dist/examples/claude-code/turn-relay.js +9 -0
- package/dist/examples/claude-code/wire.d.ts +372 -0
- package/dist/examples/claude-code/wire.js +18 -0
- package/dist/src/acp/connection.d.ts +24 -0
- package/dist/src/acp/connection.js +8 -0
- package/dist/src/acp/index.d.ts +54 -0
- package/dist/src/acp/index.js +1004 -0
- package/dist/src/acp/registry.d.ts +18 -0
- package/dist/src/acp/registry.js +8 -0
- package/dist/src/acp/thread.d.ts +46 -0
- package/dist/src/acp/thread.js +7 -0
- package/dist/src/acp/transcript.d.ts +8 -0
- package/dist/src/acp/transcript.js +11 -0
- package/dist/src/acp/translate.d.ts +33 -0
- package/dist/src/acp/translate.js +20 -0
- package/dist/src/approvals/approvals.d.ts +189 -0
- package/dist/src/approvals/approvals.js +143 -0
- package/dist/src/approvals/schema.d.ts +169 -0
- package/dist/src/approvals/schema.js +18 -0
- package/dist/src/bash-description.d.ts +30 -0
- package/dist/src/bash-description.js +18 -0
- package/dist/src/browser-tools.d.ts +25 -0
- package/dist/src/browser-tools.js +246 -0
- package/dist/src/canvas/canvas-compile.d.ts +48 -0
- package/dist/src/canvas/canvas-compile.js +8 -0
- package/dist/src/canvas/canvas-libraries.d.ts +32 -0
- package/dist/src/canvas/canvas-libraries.js +6 -0
- package/dist/src/canvas/canvas-preview.d.ts +107 -0
- package/dist/src/canvas/canvas-preview.js +12 -0
- package/dist/src/canvas/canvas-protocol.d.ts +184 -0
- package/dist/src/canvas/canvas-protocol.js +75 -0
- package/dist/src/canvas/canvas.d.ts +50 -0
- package/dist/src/canvas/canvas.js +221 -0
- package/dist/src/canvas/schema.d.ts +47 -0
- package/dist/src/canvas/schema.js +8 -0
- package/dist/src/claude-code-sdk/index.d.ts +35 -0
- package/dist/src/claude-code-sdk/index.js +368 -0
- package/dist/src/claude-code-sdk/session.d.ts +48 -0
- package/dist/src/claude-code-sdk/session.js +7 -0
- package/dist/src/claude-code-sdk/transcript.d.ts +19 -0
- package/dist/src/claude-code-sdk/transcript.js +15 -0
- package/dist/src/claude-code-sdk/translate.d.ts +18 -0
- package/dist/src/claude-code-sdk/translate.js +20 -0
- package/dist/src/client/mount.d.ts +44 -0
- package/dist/src/client/mount.js +252 -0
- package/dist/src/client/notifications.d.ts +35 -0
- package/dist/src/client/notifications.js +26 -0
- package/dist/src/client/presentation.d.ts +336 -0
- package/dist/src/client/presentation.js +373 -0
- package/dist/src/client/transcript-tui.d.ts +23 -0
- package/dist/src/client/transcript-tui.js +20 -0
- package/dist/src/client/transcript.d.ts +23 -0
- package/dist/src/client/transcript.js +51 -0
- package/dist/src/client.d.ts +53 -0
- package/dist/src/client.js +22 -0
- package/dist/src/codemode-runtime.d.ts +11 -0
- package/dist/src/codemode-runtime.js +10 -0
- package/dist/src/codemode-worker.d.ts +1 -0
- package/dist/src/codemode-worker.js +2 -0
- package/dist/src/codemode.d.ts +21 -0
- package/dist/src/codemode.js +170 -0
- package/dist/src/core.d.ts +43 -0
- package/dist/src/core.js +11 -0
- package/dist/src/openai-astra-context.d.ts +23 -0
- package/dist/src/openai-astra-context.js +14 -0
- package/dist/src/openai-compaction.d.ts +15 -0
- package/dist/src/openai-compaction.js +55 -0
- package/dist/src/question/client/questions-tui.d.ts +9 -0
- package/dist/src/question/client/questions-tui.js +19 -0
- package/dist/src/question/client/questions.d.ts +9 -0
- package/dist/src/question/client/questions.js +160 -0
- package/dist/src/question/question.d.ts +63 -0
- package/dist/src/question/question.js +9 -0
- package/dist/src/question/schema.d.ts +101 -0
- package/dist/src/question/schema.js +14 -0
- package/dist/src/rename.d.ts +78 -0
- package/dist/src/rename.js +78 -0
- package/dist/src/telemetry.d.ts +36 -0
- package/dist/src/telemetry.js +84 -0
- package/dist/src/web-search.d.ts +78 -0
- package/dist/src/web-search.js +219 -0
- package/package.json +190 -3
- package/README.md +0 -3
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// src/claude-code-sdk/translate.ts
|
|
2
|
+
import { calculateCost, parseStreamingJson } from "@nyte-ai/ai";
|
|
3
|
+
var CLAUDE_CODE_PROVIDER2 = "claude-code";
|
|
4
|
+
var MIRROR_TOOL3 = "claude_code";
|
|
5
|
+
var BACKGROUND_TOOL2 = "BackgroundTasks";
|
|
6
|
+
var NYTE_SERVER2 = "nyte";
|
|
7
|
+
var NYTE_TOOL_PREFIX2 = `mcp__${NYTE_SERVER2}__`;
|
|
8
|
+
function emptyMessage3(model) {
|
|
9
|
+
return {
|
|
10
|
+
role: "assistant",
|
|
11
|
+
content: [],
|
|
12
|
+
api: model.api,
|
|
13
|
+
provider: model.provider,
|
|
14
|
+
model: model.id,
|
|
15
|
+
usage: {
|
|
16
|
+
input: 0,
|
|
17
|
+
output: 0,
|
|
18
|
+
cacheRead: 0,
|
|
19
|
+
cacheWrite: 0,
|
|
20
|
+
totalTokens: 0,
|
|
21
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
|
|
22
|
+
},
|
|
23
|
+
stopReason: "pending",
|
|
24
|
+
timestamp: Date.now()
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function mirrorCall2(id, name, input) {
|
|
28
|
+
return { type: "toolCall", id, name: MIRROR_TOOL3, arguments: { id, name, input } };
|
|
29
|
+
}
|
|
30
|
+
function stopReason(reason) {
|
|
31
|
+
if (reason === "tool_use")
|
|
32
|
+
return "toolUse";
|
|
33
|
+
if (reason === "max_tokens" || reason === "model_context_window_exceeded")
|
|
34
|
+
return "length";
|
|
35
|
+
if (reason === "refusal")
|
|
36
|
+
return "error";
|
|
37
|
+
return "stop";
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
class Translator3 {
|
|
41
|
+
#blocks = new Map;
|
|
42
|
+
#model;
|
|
43
|
+
#output;
|
|
44
|
+
#stream;
|
|
45
|
+
#spent = 0;
|
|
46
|
+
#current = 0;
|
|
47
|
+
#started = false;
|
|
48
|
+
constructor(model, output, stream) {
|
|
49
|
+
this.#model = model;
|
|
50
|
+
this.#output = output;
|
|
51
|
+
this.#stream = stream;
|
|
52
|
+
}
|
|
53
|
+
apply(event) {
|
|
54
|
+
switch (event.type) {
|
|
55
|
+
case "message_start":
|
|
56
|
+
this.#started = true;
|
|
57
|
+
this.#blocks.clear();
|
|
58
|
+
this.#output.responseId = event.message.id;
|
|
59
|
+
if (event.message.model !== this.#model.id)
|
|
60
|
+
this.#output.responseModel = event.message.model;
|
|
61
|
+
this.#usage(event.message.usage);
|
|
62
|
+
return;
|
|
63
|
+
case "content_block_start":
|
|
64
|
+
this.#start(event.index, event.content_block);
|
|
65
|
+
return;
|
|
66
|
+
case "content_block_delta":
|
|
67
|
+
this.#delta(event.index, event.delta);
|
|
68
|
+
return;
|
|
69
|
+
case "content_block_stop":
|
|
70
|
+
return this.#stop(event.index);
|
|
71
|
+
case "message_delta":
|
|
72
|
+
if (event.delta.stop_reason !== null) {
|
|
73
|
+
this.#output.rawStopReason = event.delta.stop_reason;
|
|
74
|
+
this.#output.stopReason = stopReason(event.delta.stop_reason);
|
|
75
|
+
if (event.delta.stop_reason === "refusal")
|
|
76
|
+
this.#output.errorMessage = "The model refused to complete the request.";
|
|
77
|
+
}
|
|
78
|
+
this.#usage(event.usage);
|
|
79
|
+
return;
|
|
80
|
+
case "message_stop":
|
|
81
|
+
this.#spent += this.#current;
|
|
82
|
+
this.#current = 0;
|
|
83
|
+
return this.#output.rawStopReason ?? "end_turn";
|
|
84
|
+
default:
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
append(call) {
|
|
89
|
+
const contentIndex = this.#output.content.push(call) - 1;
|
|
90
|
+
this.#stream.push({ type: "toolcall_start", contentIndex, partial: this.#output });
|
|
91
|
+
this.#stream.push({
|
|
92
|
+
type: "toolcall_end",
|
|
93
|
+
contentIndex,
|
|
94
|
+
toolCall: call,
|
|
95
|
+
partial: this.#output
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
#usage(usage) {
|
|
99
|
+
const usageOutput = this.#output.usage;
|
|
100
|
+
if (this.#started) {
|
|
101
|
+
usageOutput.input = usage.input_tokens ?? usageOutput.input;
|
|
102
|
+
usageOutput.cacheRead = usage.cache_read_input_tokens ?? usageOutput.cacheRead;
|
|
103
|
+
usageOutput.cacheWrite = usage.cache_creation_input_tokens ?? usageOutput.cacheWrite;
|
|
104
|
+
}
|
|
105
|
+
this.#current = usage.output_tokens ?? this.#current;
|
|
106
|
+
usageOutput.output = this.#spent + this.#current;
|
|
107
|
+
usageOutput.totalTokens = usageOutput.input + usageOutput.output + usageOutput.cacheRead + usageOutput.cacheWrite;
|
|
108
|
+
calculateCost(this.#model, usageOutput);
|
|
109
|
+
}
|
|
110
|
+
#start(native, block) {
|
|
111
|
+
const content = block.type === "text" ? { type: "text", text: block.text } : block.type === "thinking" ? { type: "thinking", thinking: block.thinking, thinkingSignature: block.signature } : block.type === "redacted_thinking" ? {
|
|
112
|
+
type: "thinking",
|
|
113
|
+
thinking: "[Reasoning redacted]",
|
|
114
|
+
thinkingSignature: block.data,
|
|
115
|
+
redacted: true
|
|
116
|
+
} : block.type === "tool_use" ? block.name.startsWith(NYTE_TOOL_PREFIX2) ? {
|
|
117
|
+
type: "toolCall",
|
|
118
|
+
id: block.id,
|
|
119
|
+
name: block.name.slice(NYTE_TOOL_PREFIX2.length),
|
|
120
|
+
arguments: {}
|
|
121
|
+
} : mirrorCall2(block.id, block.name, {}) : undefined;
|
|
122
|
+
if (content === undefined)
|
|
123
|
+
return;
|
|
124
|
+
const index = this.#output.content.push(content) - 1;
|
|
125
|
+
this.#blocks.set(native, { index, json: "" });
|
|
126
|
+
this.#stream.push({
|
|
127
|
+
type: content.type === "text" ? "text_start" : content.type === "thinking" ? "thinking_start" : "toolcall_start",
|
|
128
|
+
contentIndex: index,
|
|
129
|
+
partial: this.#output
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
#delta(native, delta) {
|
|
133
|
+
const slot = this.#blocks.get(native);
|
|
134
|
+
if (slot === undefined)
|
|
135
|
+
return;
|
|
136
|
+
const content = this.#output.content[slot.index];
|
|
137
|
+
const contentIndex = slot.index;
|
|
138
|
+
if (delta.type === "text_delta" && content?.type === "text") {
|
|
139
|
+
content.text += delta.text;
|
|
140
|
+
this.#stream.push({
|
|
141
|
+
type: "text_delta",
|
|
142
|
+
contentIndex,
|
|
143
|
+
delta: delta.text,
|
|
144
|
+
partial: this.#output
|
|
145
|
+
});
|
|
146
|
+
} else if (delta.type === "thinking_delta" && content?.type === "thinking") {
|
|
147
|
+
content.thinking += delta.thinking;
|
|
148
|
+
this.#stream.push({
|
|
149
|
+
type: "thinking_delta",
|
|
150
|
+
contentIndex,
|
|
151
|
+
delta: delta.thinking,
|
|
152
|
+
partial: this.#output
|
|
153
|
+
});
|
|
154
|
+
} else if (delta.type === "signature_delta" && content?.type === "thinking") {
|
|
155
|
+
content.thinkingSignature = (content.thinkingSignature ?? "") + delta.signature;
|
|
156
|
+
} else if (delta.type === "input_json_delta" && content?.type === "toolCall") {
|
|
157
|
+
slot.json += delta.partial_json;
|
|
158
|
+
const input = parseStreamingJson(slot.json);
|
|
159
|
+
content.arguments = content.name === MIRROR_TOOL3 ? { ...content.arguments, input } : input;
|
|
160
|
+
this.#stream.push({
|
|
161
|
+
type: "toolcall_delta",
|
|
162
|
+
contentIndex,
|
|
163
|
+
delta: delta.partial_json,
|
|
164
|
+
partial: this.#output
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
#stop(native) {
|
|
169
|
+
const slot = this.#blocks.get(native);
|
|
170
|
+
if (slot === undefined)
|
|
171
|
+
return;
|
|
172
|
+
this.#blocks.delete(native);
|
|
173
|
+
const content = this.#output.content[slot.index];
|
|
174
|
+
const contentIndex = slot.index;
|
|
175
|
+
if (content?.type === "text")
|
|
176
|
+
this.#stream.push({
|
|
177
|
+
type: "text_end",
|
|
178
|
+
contentIndex,
|
|
179
|
+
content: content.text,
|
|
180
|
+
partial: this.#output
|
|
181
|
+
});
|
|
182
|
+
else if (content?.type === "thinking")
|
|
183
|
+
this.#stream.push({
|
|
184
|
+
type: "thinking_end",
|
|
185
|
+
contentIndex,
|
|
186
|
+
content: content.thinking,
|
|
187
|
+
partial: this.#output
|
|
188
|
+
});
|
|
189
|
+
else if (content?.type === "toolCall") {
|
|
190
|
+
this.#stream.push({
|
|
191
|
+
type: "toolcall_end",
|
|
192
|
+
contentIndex,
|
|
193
|
+
toolCall: content,
|
|
194
|
+
partial: this.#output
|
|
195
|
+
});
|
|
196
|
+
if (content.name !== MIRROR_TOOL3) {
|
|
197
|
+
this.#output.stopReason = "toolUse";
|
|
198
|
+
return "tool_use";
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export { CLAUDE_CODE_PROVIDER2, MIRROR_TOOL3, BACKGROUND_TOOL2, NYTE_SERVER2, NYTE_TOOL_PREFIX2, emptyMessage3, mirrorCall2, Translator3 };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/canvas/canvas-libraries.ts
|
|
2
|
+
var CANVAS_LIBRARIES2 = {
|
|
3
|
+
three: {
|
|
4
|
+
version: "0.186.1",
|
|
5
|
+
exports: "ACESFilmicToneMapping AddEquation AddOperation AdditiveAnimationBlendMode AdditiveBlending AgXToneMapping AlphaFormat AlwaysCompare AlwaysDepth AlwaysStencilFunc AmbientLight AnimationAction AnimationClip AnimationLoader AnimationMixer AnimationObjectGroup AnimationUtils ArcCurve ArrayCamera ArrowHelper AttachedBindMode Audio AudioAnalyser AudioContext AudioListener AudioLoader AxesHelper BackSide BasicDepthPacking BasicShadowMap BatchedMesh BezierInterpolant Bone BooleanKeyframeTrack Box2 Box3 Box3Helper BoxGeometry BoxHelper BufferAttribute BufferGeometry BufferGeometryLoader ByteType Cache Camera CameraHelper CanvasTexture CapsuleGeometry CatmullRomCurve3 CineonToneMapping CircleGeometry ClampToEdgeWrapping Clock Color ColorKeyframeTrack ColorManagement Compatibility CompressedArrayTexture CompressedCubeTexture CompressedTexture CompressedTextureLoader ConeGeometry ConstantAlphaFactor ConstantColorFactor Controls CubeCamera CubeDepthTexture CubeReflectionMapping CubeRefractionMapping CubeTexture CubeTextureLoader CubeUVReflectionMapping CubicBezierCurve CubicBezierCurve3 CubicInterpolant CullFaceBack CullFaceFront CullFaceFrontBack CullFaceNone Curve CurvePath CustomBlending CustomToneMapping CylinderGeometry Cylindrical Data3DTexture DataArrayTexture DataTexture DataTextureLoader DataUtils DecrementStencilOp DecrementWrapStencilOp DefaultLoadingManager DepthFormat DepthStencilFormat DepthTexture DetachedBindMode DirectionalLight DirectionalLightHelper DiscreteInterpolant DodecahedronGeometry DoubleSide DstAlphaFactor DstColorFactor DynamicCopyUsage DynamicDrawUsage DynamicReadUsage EdgesGeometry EllipseCurve EqualCompare EqualDepth EqualStencilFunc EquirectangularReflectionMapping EquirectangularRefractionMapping Euler EventDispatcher ExternalTexture ExtrudeGeometry FileLoader Float16BufferAttribute Float32BufferAttribute FloatType Fog FogExp2 FramebufferTexture FrontSide Frustum FrustumArray GLBufferAttribute GLSL1 GLSL3 GreaterCompare GreaterDepth GreaterEqualCompare GreaterEqualDepth GreaterEqualStencilFunc GreaterStencilFunc GridHelper Group HTMLTexture HalfFloatType HemisphereLight HemisphereLightHelper IcosahedronGeometry ImageBitmapLoader ImageLoader ImageUtils IncrementStencilOp IncrementWrapStencilOp InstancedBufferAttribute InstancedBufferGeometry InstancedInterleavedBuffer InstancedMesh Int16BufferAttribute Int32BufferAttribute Int8BufferAttribute IntType InterleavedBuffer InterleavedBufferAttribute Interpolant InterpolateBezier InterpolateDiscrete InterpolateLinear InterpolateSmooth InterpolationSamplingMode InterpolationSamplingType InvertStencilOp KeepStencilOp KeyframeTrack LOD LatheGeometry Layers LessCompare LessDepth LessEqualCompare LessEqualDepth LessEqualStencilFunc LessStencilFunc Light LightProbe LightShadow Line Line3 LineBasicMaterial LineCurve LineCurve3 LineDashedMaterial LineLoop LineSegments LinearFilter LinearInterpolant LinearMipMapLinearFilter LinearMipMapNearestFilter LinearMipmapLinearFilter LinearMipmapNearestFilter LinearSRGBColorSpace LinearToneMapping LinearTransfer Loader LoaderUtils LoadingManager LoopOnce LoopPingPong LoopRepeat MOUSE Material MaterialBlending MaterialLoader MathUtils Matrix2 Matrix3 Matrix4 MaxEquation Mesh MeshBasicMaterial MeshDepthMaterial MeshDistanceMaterial MeshLambertMaterial MeshMatcapMaterial MeshNormalMaterial MeshPhongMaterial MeshPhysicalMaterial MeshStandardMaterial MeshToonMaterial MinEquation MirroredRepeatWrapping MixOperation MultiplyBlending MultiplyOperation NearestFilter NearestMipMapLinearFilter NearestMipMapNearestFilter NearestMipmapLinearFilter NearestMipmapNearestFilter NeutralToneMapping NeverCompare NeverDepth NeverStencilFunc NoBlending NoColorSpace NoNormalPacking NoToneMapping NormalAnimationBlendMode NormalBlending NormalGAPacking NormalRGPacking NotEqualCompare NotEqualDepth NotEqualStencilFunc NumberKeyframeTrack Object3D ObjectLoader ObjectSpaceNormalMap OctahedronGeometry OneFactor OneMinusConstantAlphaFactor OneMinusConstantColorFactor OneMinusDstAlphaFactor OneMinusDstColorFactor OneMinusSrcAlphaFactor OneMinusSrcColorFactor OrthographicCamera PCFShadowMap PCFSoftShadowMap PMREMGenerator Path PerspectiveCamera Plane PlaneGeometry PlaneHelper PointLight PointLightHelper Points PointsMaterial PolarGridHelper PolyhedronGeometry PositionalAudio PropertyBinding PropertyMixer QuadraticBezierCurve QuadraticBezierCurve3 Quaternion QuaternionKeyframeTrack QuaternionLinearInterpolant R11_EAC_Format RED_GREEN_RGTC2_Format RED_RGTC1_Format REVISION RG11_EAC_Format RGBADepthPacking RGBAFormat RGBAIntegerFormat RGBA_ASTC_10x10_Format RGBA_ASTC_10x5_Format RGBA_ASTC_10x6_Format RGBA_ASTC_10x8_Format RGBA_ASTC_12x10_Format RGBA_ASTC_12x12_Format RGBA_ASTC_4x4_Format RGBA_ASTC_5x4_Format RGBA_ASTC_5x5_Format RGBA_ASTC_6x5_Format RGBA_ASTC_6x6_Format RGBA_ASTC_8x5_Format RGBA_ASTC_8x6_Format RGBA_ASTC_8x8_Format RGBA_BPTC_Format RGBA_ETC2_EAC_Format RGBA_PVRTC_2BPPV1_Format RGBA_PVRTC_4BPPV1_Format RGBA_S3TC_DXT1_Format RGBA_S3TC_DXT3_Format RGBA_S3TC_DXT5_Format RGBDepthPacking RGBFormat RGBIntegerFormat RGB_BPTC_SIGNED_Format RGB_BPTC_UNSIGNED_Format RGB_ETC1_Format RGB_ETC2_Format RGB_PVRTC_2BPPV1_Format RGB_PVRTC_4BPPV1_Format RGB_S3TC_DXT1_Format RGDepthPacking RGFormat RGIntegerFormat RawShaderMaterial Ray Raycaster RectAreaLight RedFormat RedIntegerFormat ReinhardToneMapping RenderObjectRefreshType RenderTarget RenderTarget3D RepeatWrapping ReplaceStencilOp ReverseSubtractEquation RingGeometry SIGNED_R11_EAC_Format SIGNED_RED_GREEN_RGTC2_Format SIGNED_RED_RGTC1_Format SIGNED_RG11_EAC_Format SRGBColorSpace SRGBTransfer Scene ShaderChunk ShaderLib ShaderMaterial ShadowMaterial Shape ShapeGeometry ShapePath ShapeUtils ShortType Skeleton SkeletonHelper SkinnedMesh Source Sphere SphereGeometry Spherical SphericalHarmonics3 SplineCurve SpotLight SpotLightHelper Sprite SpriteMaterial SrcAlphaFactor SrcAlphaSaturateFactor SrcColorFactor StaticCopyUsage StaticDrawUsage StaticReadUsage StereoCamera StreamCopyUsage StreamDrawUsage StreamReadUsage StringKeyframeTrack SubtractEquation SubtractiveBlending TOUCH TangentSpaceNormalMap TetrahedronGeometry Texture TextureLoader TextureSource TextureUtils Timer TimestampQuery TorusGeometry TorusKnotGeometry Triangle TriangleFanDrawMode TriangleStripDrawMode TrianglesDrawMode TubeGeometry UVMapping Uint16BufferAttribute Uint32BufferAttribute Uint8BufferAttribute Uint8ClampedBufferAttribute Uniform UniformsGroup UniformsLib UniformsUtils UnsignedByteType UnsignedInt101111Type UnsignedInt248Type UnsignedInt5999Type UnsignedIntType UnsignedShort4444Type UnsignedShort5551Type UnsignedShortType VSMShadowMap Vector2 Vector3 Vector4 VectorKeyframeTrack VideoFrameTexture VideoTexture WebGL3DRenderTarget WebGLArrayRenderTarget WebGLCoordinateSystem WebGLCubeRenderTarget WebGLRenderTarget WebGLRenderer WebGLUtils WebGPUCoordinateSystem WebXRController WireframeGeometry WrapAroundEnding ZeroCurvatureEnding ZeroFactor ZeroSlopeEnding ZeroStencilOp createCanvasElement error getConsoleFunction log setConsoleFunction warn warnOnce"
|
|
6
|
+
},
|
|
7
|
+
"d3-array": {
|
|
8
|
+
version: "3.2.4",
|
|
9
|
+
exports: "Adder InternMap InternSet ascending bin bisect bisectCenter bisectLeft bisectRight bisector blur blur2 blurImage count cross cumsum descending deviation difference disjoint every extent fcumsum filter flatGroup flatRollup fsum greatest greatestIndex group groupSort groups histogram index indexes intersection least leastIndex map max maxIndex mean median medianIndex merge min minIndex mode nice pairs permute quantile quantileIndex quantileSorted quickselect range rank reduce reverse rollup rollups scan shuffle shuffler some sort subset sum superset thresholdFreedmanDiaconis thresholdScott thresholdSturges tickIncrement tickStep ticks transpose union variance zip"
|
|
10
|
+
},
|
|
11
|
+
"d3-scale": {
|
|
12
|
+
version: "4.0.2",
|
|
13
|
+
exports: "scaleBand scaleDiverging scaleDivergingLog scaleDivergingPow scaleDivergingSqrt scaleDivergingSymlog scaleIdentity scaleImplicit scaleLinear scaleLog scaleOrdinal scalePoint scalePow scaleQuantile scaleQuantize scaleRadial scaleSequential scaleSequentialLog scaleSequentialPow scaleSequentialQuantile scaleSequentialSqrt scaleSequentialSymlog scaleSqrt scaleSymlog scaleThreshold scaleTime scaleUtc tickFormat"
|
|
14
|
+
},
|
|
15
|
+
"d3-shape": {
|
|
16
|
+
version: "3.2.0",
|
|
17
|
+
exports: "arc area areaRadial curveBasis curveBasisClosed curveBasisOpen curveBumpX curveBumpY curveBundle curveCardinal curveCardinalClosed curveCardinalOpen curveCatmullRom curveCatmullRomClosed curveCatmullRomOpen curveLinear curveLinearClosed curveMonotoneX curveMonotoneY curveNatural curveStep curveStepAfter curveStepBefore line lineRadial link linkHorizontal linkRadial linkVertical pie pointRadial radialArea radialLine stack stackOffsetDiverging stackOffsetExpand stackOffsetNone stackOffsetSilhouette stackOffsetWiggle stackOrderAppearance stackOrderAscending stackOrderDescending stackOrderInsideOut stackOrderNone stackOrderReverse symbol symbolAsterisk symbolCircle symbolCross symbolDiamond symbolDiamond2 symbolPlus symbolSquare symbolSquare2 symbolStar symbolTimes symbolTriangle symbolTriangle2 symbolWye symbolX symbols symbolsFill symbolsStroke"
|
|
18
|
+
},
|
|
19
|
+
"d3-hierarchy": {
|
|
20
|
+
version: "3.1.2",
|
|
21
|
+
exports: "Node cluster hierarchy pack packEnclose packSiblings partition stratify tree treemap treemapBinary treemapDice treemapResquarify treemapSlice treemapSliceDice treemapSquarify"
|
|
22
|
+
},
|
|
23
|
+
"d3-force": {
|
|
24
|
+
version: "3.0.0",
|
|
25
|
+
exports: "forceCenter forceCollide forceLink forceManyBody forceRadial forceSimulation forceX forceY"
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { CANVAS_LIBRARIES2 };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Armin Ronacher
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NativeOutputEvent } from "./wire.ts";
|
|
2
|
+
export type RateLimitInfo = NonNullable<Extract<NativeOutputEvent, {
|
|
3
|
+
type: "rate_limit_event";
|
|
4
|
+
}>["rate_limit_info"]>;
|
|
5
|
+
export declare function usageCreditsAllowed(env: Record<string, string | undefined>): boolean;
|
|
6
|
+
export declare function usageCreditsChargeError(info: RateLimitInfo): Error;
|
|
7
|
+
export declare function describeUsageCreditsRejection(message: string): string | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
usageCreditsAllowed2,
|
|
3
|
+
usageCreditsChargeError2,
|
|
4
|
+
describeUsageCreditsRejection2
|
|
5
|
+
} from "../../chunks/billing-tzr3cebf.js";
|
|
6
|
+
import"../../chunks/billing-s4rrspsk.js";
|
|
7
|
+
export {
|
|
8
|
+
describeUsageCreditsRejection2 as describeUsageCreditsRejection,
|
|
9
|
+
usageCreditsAllowed2 as usageCreditsAllowed,
|
|
10
|
+
usageCreditsChargeError2 as usageCreditsChargeError
|
|
11
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { RateLimitInfo } from "./billing.ts";
|
|
2
|
+
import type { AnthropicStreamEvent, JsonRecord, NativeFrame, NativeMessage, NativeUsage } from "./wire.ts";
|
|
3
|
+
import type { NativeSystemInjection, ToolManifestEntry } from "./transcript.ts";
|
|
4
|
+
export interface RunClaudeInput {
|
|
5
|
+
model: string;
|
|
6
|
+
cwd?: string;
|
|
7
|
+
frames: NativeFrame[];
|
|
8
|
+
systemPrompt: string;
|
|
9
|
+
manifest: ToolManifestEntry[];
|
|
10
|
+
extraBody: JsonRecord;
|
|
11
|
+
toolNames: Set<string>;
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
timeoutMs?: number;
|
|
14
|
+
env?: Record<string, string | undefined>;
|
|
15
|
+
upstreamUrl?: string;
|
|
16
|
+
initialUserPrefix?: unknown[];
|
|
17
|
+
initialSystemMessages?: unknown[];
|
|
18
|
+
nativeSystemInjections?: NativeSystemInjection[];
|
|
19
|
+
betas?: string[];
|
|
20
|
+
onEvent?: (event: AnthropicStreamEvent) => void;
|
|
21
|
+
sessionId?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface RunClaudeOutput {
|
|
24
|
+
message: NativeMessage;
|
|
25
|
+
usage: NativeUsage;
|
|
26
|
+
relay: {
|
|
27
|
+
upstreamRequests: number;
|
|
28
|
+
blockedRequests: number;
|
|
29
|
+
requestId?: string;
|
|
30
|
+
};
|
|
31
|
+
initialUserPrefix?: unknown[];
|
|
32
|
+
initialSystemMessages?: unknown[];
|
|
33
|
+
rateLimit?: RateLimitInfo;
|
|
34
|
+
}
|
|
35
|
+
export declare function runClaudeRequest(input: RunClaudeInput): Promise<RunClaudeOutput>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runClaudeRequest2
|
|
3
|
+
} from "../../chunks/billing-3scqmkzb.js";
|
|
4
|
+
import"../../chunks/billing-ejx2hv52.js";
|
|
5
|
+
import"../../chunks/billing-a9vqn66p.js";
|
|
6
|
+
import"../../chunks/billing-tzr3cebf.js";
|
|
7
|
+
import"../../chunks/billing-t1qrxe16.js";
|
|
8
|
+
import"../../chunks/billing-cy1rg619.js";
|
|
9
|
+
import"../../chunks/billing-s4rrspsk.js";
|
|
10
|
+
import"../../chunks/billing-9qc0eqh4.js";
|
|
11
|
+
import"../../chunks/billing-j643d12p.js";
|
|
12
|
+
import"../../chunks/billing-0y7dfkp2.js";
|
|
13
|
+
export {
|
|
14
|
+
runClaudeRequest2 as runClaudeRequest
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function envFlagEnabled(value: string | undefined): boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Provider } from "@nyte-ai/ai";
|
|
2
|
+
/** Returns the Anthropic provider using Claude Code's login and CLI; Nyte owns history, approvals and tool execution. */
|
|
3
|
+
export declare function claudeCodeProvider(): Provider;
|
|
4
|
+
declare const _default: {
|
|
5
|
+
id: string;
|
|
6
|
+
activate({ session, signal }: {
|
|
7
|
+
readonly side: "core";
|
|
8
|
+
readonly sdk: import("@nyte-ai/core").Connection;
|
|
9
|
+
readonly contribute: import("@nyte-ai/core").Registries<"core">;
|
|
10
|
+
readonly storage: import("@nyte-ai/core").PluginStorage;
|
|
11
|
+
readonly signal: AbortSignal;
|
|
12
|
+
hook<N extends "session_activated" | "before_send" | "run_started" | "transform_transcript" | "before_compaction" | "before_request" | "before_tool" | "after_tool" | "after_request" | "run_ended">(name: N, entry: import("@nyte-ai/core").HookEntry<"core", N>): import("@nyte-ai/schema").Disposer;
|
|
13
|
+
report(issue: import("@nyte-ai/schema").ValidationIssue): void;
|
|
14
|
+
reload(): void;
|
|
15
|
+
} & {
|
|
16
|
+
readonly session: import("@nyte-ai/core").Session;
|
|
17
|
+
readonly env: import("@nyte-ai/core").ExecutionEnv;
|
|
18
|
+
wrapEnv(wrap: import("@nyte-ai/core").EnvironmentWrap): import("@nyte-ai/schema").Disposer;
|
|
19
|
+
readonly inputs: import("@nyte-ai/core").Resources;
|
|
20
|
+
request<T = string>(input: import("@nyte-ai/schema").ModelRequestInput<T>): Promise<import("@nyte-ai/schema").ModelRequestOutcome<T>>;
|
|
21
|
+
approve(call: import("@nyte-ai/core").RuntimeCall, signal: AbortSignal): Promise<import("@nyte-ai/core").RuntimeVerdict>;
|
|
22
|
+
}): void;
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import"../../chunks/billing-s4rrspsk.js";
|
|
2
|
+
import {
|
|
3
|
+
PROVIDER_ID2,
|
|
4
|
+
API_ID2,
|
|
5
|
+
createClaudeModelCatalog2
|
|
6
|
+
} from "../../chunks/billing-9qc0eqh4.js";
|
|
7
|
+
import"../../chunks/billing-0y7dfkp2.js";
|
|
8
|
+
import {
|
|
9
|
+
LOGIN_HINT2,
|
|
10
|
+
getClaudeStatus2,
|
|
11
|
+
discoverClaudeModels2
|
|
12
|
+
} from "../../chunks/billing-cy1rg619.js";
|
|
13
|
+
import"../../chunks/billing-tzr3cebf.js";
|
|
14
|
+
import"../../chunks/billing-t1qrxe16.js";
|
|
15
|
+
import"../../chunks/billing-j643d12p.js";
|
|
16
|
+
import"../../chunks/billing-a9vqn66p.js";
|
|
17
|
+
import"../../chunks/billing-ejx2hv52.js";
|
|
18
|
+
import"../../chunks/billing-3scqmkzb.js";
|
|
19
|
+
import {
|
|
20
|
+
streamClaudeCode2
|
|
21
|
+
} from "../../chunks/billing-8rjk35gr.js";
|
|
22
|
+
|
|
23
|
+
// examples/claude-code/index.ts
|
|
24
|
+
import process from "node:process";
|
|
25
|
+
import { acquireSessionResources, anthropicProvider } from "@nyte-ai/ai";
|
|
26
|
+
var ENV_NAMES = [
|
|
27
|
+
"NYTE_CLAUDE_CODE_COMMAND",
|
|
28
|
+
"NYTE_CLAUDE_CODE_CONFIG_DIR",
|
|
29
|
+
"NYTE_CLAUDE_CODE_ALLOW_USAGE_CREDITS",
|
|
30
|
+
"CLAUDE_CONFIG_DIR"
|
|
31
|
+
];
|
|
32
|
+
async function providerEnvironment(ctx) {
|
|
33
|
+
const env = {};
|
|
34
|
+
for (const name of ENV_NAMES) {
|
|
35
|
+
const value = await ctx.env(name);
|
|
36
|
+
if (value !== undefined)
|
|
37
|
+
env[name] = value;
|
|
38
|
+
}
|
|
39
|
+
return env;
|
|
40
|
+
}
|
|
41
|
+
function claudeCodeProvider() {
|
|
42
|
+
const catalog = anthropicProvider();
|
|
43
|
+
const routes = createClaudeModelCatalog2();
|
|
44
|
+
let env = {};
|
|
45
|
+
let discovered;
|
|
46
|
+
const check = async ({
|
|
47
|
+
ctx,
|
|
48
|
+
signal
|
|
49
|
+
}) => {
|
|
50
|
+
env = await providerEnvironment(ctx);
|
|
51
|
+
const status = await getClaudeStatus2({ ...process.env, ...env }, signal);
|
|
52
|
+
if (!status.available || !status.loggedIn)
|
|
53
|
+
return;
|
|
54
|
+
return {
|
|
55
|
+
type: status.subscription ? "oauth" : "api_key",
|
|
56
|
+
source: status.subscription ? `Claude Code ${status.plan ?? "subscription"}` : "Claude Code CLI"
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
id: PROVIDER_ID2,
|
|
61
|
+
name: "Claude Code",
|
|
62
|
+
baseUrl: "process://claude-code",
|
|
63
|
+
auth: {
|
|
64
|
+
apiKey: {
|
|
65
|
+
name: "Claude Code login",
|
|
66
|
+
check,
|
|
67
|
+
async resolve({ ctx, signal }) {
|
|
68
|
+
signal.throwIfAborted();
|
|
69
|
+
env = await providerEnvironment(ctx);
|
|
70
|
+
return { auth: {}, env, source: "Claude Code CLI" };
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
oauth: {
|
|
74
|
+
check,
|
|
75
|
+
name: "Claude Code subscription",
|
|
76
|
+
isSubscription: true,
|
|
77
|
+
async login() {
|
|
78
|
+
throw new Error("Claude Code manages its login. Run `claude auth login` in a terminal; Nyte uses it automatically.");
|
|
79
|
+
},
|
|
80
|
+
async refresh(_credential, signal) {
|
|
81
|
+
const status = await getClaudeStatus2({ ...process.env, ...env }, signal);
|
|
82
|
+
if (!status.subscription)
|
|
83
|
+
throw new Error(LOGIN_HINT2);
|
|
84
|
+
return {
|
|
85
|
+
type: "oauth",
|
|
86
|
+
access: "claude-code-external",
|
|
87
|
+
refresh: "claude-code-external",
|
|
88
|
+
expires: Date.now() + 365 * 24 * 60 * 60 * 1000
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
toAuth: async () => ({})
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
getModels() {
|
|
95
|
+
const builtins = catalog.getModels();
|
|
96
|
+
routes.restoreAnthropicModels(builtins);
|
|
97
|
+
if (discovered)
|
|
98
|
+
return discovered.map(routes.modelFromDiscovery);
|
|
99
|
+
const models = builtins.map((model) => ({
|
|
100
|
+
...model,
|
|
101
|
+
api: API_ID2,
|
|
102
|
+
compat: undefined,
|
|
103
|
+
baseUrl: "process://claude-code"
|
|
104
|
+
}));
|
|
105
|
+
const ids = new Set(models.map((model) => model.id));
|
|
106
|
+
return [...models, ...routes.fallbackClaudeModels().filter((model) => !ids.has(model.id))];
|
|
107
|
+
},
|
|
108
|
+
async refreshModels(context) {
|
|
109
|
+
if (!context.allowNetwork) {
|
|
110
|
+
await catalog.refreshModels?.(context);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const results = await Promise.allSettled([
|
|
114
|
+
catalog.refreshModels?.(context),
|
|
115
|
+
discoverClaudeModels2({ ...process.env, ...env }, context.signal).then((next) => context.publish({
|
|
116
|
+
update: () => {
|
|
117
|
+
discovered = next;
|
|
118
|
+
}
|
|
119
|
+
}))
|
|
120
|
+
]);
|
|
121
|
+
context.signal.throwIfAborted();
|
|
122
|
+
const discovery = results[1];
|
|
123
|
+
if (discovery?.status === "rejected")
|
|
124
|
+
throw discovery.reason;
|
|
125
|
+
},
|
|
126
|
+
stream: (model, context, options) => streamClaudeCode2(model, context, {
|
|
127
|
+
signal: options?.signal,
|
|
128
|
+
env: options?.env,
|
|
129
|
+
timeoutMs: options?.timeoutMs,
|
|
130
|
+
maxTokens: options?.maxTokens,
|
|
131
|
+
sessionId: options?.sessionId,
|
|
132
|
+
cacheRetention: options?.cacheRetention
|
|
133
|
+
}, routes),
|
|
134
|
+
streamSimple: (model, context, options) => streamClaudeCode2(model, context, options, routes)
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
var claude_code_default = {
|
|
138
|
+
id: "claude-code",
|
|
139
|
+
activate({ session, signal }) {
|
|
140
|
+
const release = acquireSessionResources(session.id);
|
|
141
|
+
signal.addEventListener("abort", release, { once: true });
|
|
142
|
+
if (signal.aborted)
|
|
143
|
+
release();
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
export {
|
|
147
|
+
claudeCodeProvider,
|
|
148
|
+
claude_code_default as default
|
|
149
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const INERT_MCP_SOURCE = "#!/usr/bin/env node\nimport { readFile } from \"node:fs/promises\";\nimport { createInterface } from \"node:readline\";\n\nconst manifestPath = process.argv[2];\nif (!manifestPath) process.exit(2);\nconst tools = JSON.parse(await readFile(manifestPath, \"utf8\"));\nconst lines = createInterface({ input: process.stdin, crlfDelay: Infinity });\n\nfor await (const line of lines) {\n let request;\n try {\n request = JSON.parse(line);\n } catch {\n continue;\n }\n\n let result = {};\n if (request.method === \"initialize\") {\n result = {\n protocolVersion: \"2024-11-05\",\n capabilities: { tools: {} },\n serverInfo: { name: \"nyte-inert-tool-inventory\", version: \"1\" },\n };\n } else if (request.method === \"tools/list\") {\n result = { tools };\n } else if (request.method === \"tools/call\") {\n result = {\n isError: true,\n content: [{ type: \"text\", text: \"Denied: Claude Code tools are inert; only Nyte executes tools.\" }],\n };\n }\n\n if (request.id !== undefined) {\n process.stdout.write(`${JSON.stringify({ jsonrpc: \"2.0\", id: request.id, result })}\\n`);\n }\n}\n";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Model } from "@nyte-ai/ai";
|
|
2
|
+
import { Type } from "typebox";
|
|
3
|
+
import type { Static } from "typebox";
|
|
4
|
+
export declare const PROVIDER_ID = "anthropic";
|
|
5
|
+
export declare const API_ID = "claude-code-stream-json";
|
|
6
|
+
export type ClaudeCodeModel = Model<typeof API_ID>;
|
|
7
|
+
export declare const discoveredModelSchema: Type.TObject<{
|
|
8
|
+
value: Type.TString;
|
|
9
|
+
resolvedModel: Type.TOptional<Type.TString>;
|
|
10
|
+
displayName: Type.TString;
|
|
11
|
+
description: Type.TString;
|
|
12
|
+
supportsEffort: Type.TOptional<Type.TBoolean>;
|
|
13
|
+
supportedEffortLevels: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"low">, Type.TLiteral<"medium">, Type.TLiteral<"high">, Type.TLiteral<"xhigh">, Type.TLiteral<"max">]>>>;
|
|
14
|
+
supportsAdaptiveThinking: Type.TOptional<Type.TBoolean>;
|
|
15
|
+
supportsFastMode: Type.TOptional<Type.TBoolean>;
|
|
16
|
+
supportsAutoMode: Type.TOptional<Type.TBoolean>;
|
|
17
|
+
}>;
|
|
18
|
+
export type DiscoveredClaudeModel = Static<typeof discoveredModelSchema>;
|
|
19
|
+
export declare function createClaudeModelCatalog(): {
|
|
20
|
+
restoreAnthropicModels: (models: readonly Model<"anthropic-messages">[]) => void;
|
|
21
|
+
modelFromDiscovery: (info: DiscoveredClaudeModel) => ClaudeCodeModel;
|
|
22
|
+
fallbackClaudeModels: () => ClaudeCodeModel[];
|
|
23
|
+
nativeModel: (model: string) => string;
|
|
24
|
+
supportsAdaptiveThinking: (model: string) => boolean;
|
|
25
|
+
supportsNativeToolChanges: (model: string) => boolean;
|
|
26
|
+
};
|
|
27
|
+
export type ClaudeModelCatalog = ReturnType<typeof createClaudeModelCatalog>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PROVIDER_ID2,
|
|
3
|
+
API_ID2,
|
|
4
|
+
discoveredModelSchema2,
|
|
5
|
+
createClaudeModelCatalog2
|
|
6
|
+
} from "../../chunks/billing-9qc0eqh4.js";
|
|
7
|
+
export {
|
|
8
|
+
API_ID2 as API_ID,
|
|
9
|
+
PROVIDER_ID2 as PROVIDER_ID,
|
|
10
|
+
createClaudeModelCatalog2 as createClaudeModelCatalog,
|
|
11
|
+
discoveredModelSchema2 as discoveredModelSchema
|
|
12
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import type { ChildProcess } from "node:child_process";
|
|
3
|
+
import type { DiscoveredClaudeModel } from "./model-catalog.ts";
|
|
4
|
+
import type { JsonRecord } from "./wire.ts";
|
|
5
|
+
export declare const LOGIN_HINT = "Claude Code is installed but not logged in. Run `claude auth login` and try again.";
|
|
6
|
+
export interface ClaudeStatus {
|
|
7
|
+
available: boolean;
|
|
8
|
+
loggedIn: boolean;
|
|
9
|
+
subscription: boolean;
|
|
10
|
+
authMethod?: string;
|
|
11
|
+
plan?: string;
|
|
12
|
+
detail?: string;
|
|
13
|
+
command?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function configuredCommand(env: Record<string, string | undefined>): string;
|
|
16
|
+
export declare function getClaudeStatus(envInput?: Record<string, string | undefined>, signal?: AbortSignal): Promise<ClaudeStatus>;
|
|
17
|
+
export declare function readyClaudeCommand(envInput: Record<string, string | undefined>, signal?: AbortSignal): Promise<string>;
|
|
18
|
+
export declare function discoverClaudeModels(envInput?: Record<string, string | undefined>, signal?: AbortSignal, timeoutMs?: number): Promise<DiscoveredClaudeModel[]>;
|
|
19
|
+
export declare function spawnCommand(command: string, args: string[], options: Parameters<typeof spawn>[2]): ChildProcess;
|
|
20
|
+
export declare function childExit(child: ChildProcess): Promise<number>;
|
|
21
|
+
export declare function killProcessTree(child: ChildProcess): void;
|
|
22
|
+
export declare function processEnvironment(input: Record<string, string | undefined> | undefined, extraBody: JsonRecord): Record<string, string>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LOGIN_HINT2,
|
|
3
|
+
configuredCommand2,
|
|
4
|
+
getClaudeStatus2,
|
|
5
|
+
readyClaudeCommand2,
|
|
6
|
+
discoverClaudeModels2,
|
|
7
|
+
spawnCommand2,
|
|
8
|
+
childExit2,
|
|
9
|
+
killProcessTree2,
|
|
10
|
+
processEnvironment2
|
|
11
|
+
} from "../../chunks/billing-cy1rg619.js";
|
|
12
|
+
import"../../chunks/billing-s4rrspsk.js";
|
|
13
|
+
import"../../chunks/billing-9qc0eqh4.js";
|
|
14
|
+
import"../../chunks/billing-0y7dfkp2.js";
|
|
15
|
+
export {
|
|
16
|
+
LOGIN_HINT2 as LOGIN_HINT,
|
|
17
|
+
childExit2 as childExit,
|
|
18
|
+
configuredCommand2 as configuredCommand,
|
|
19
|
+
discoverClaudeModels2 as discoverClaudeModels,
|
|
20
|
+
getClaudeStatus2 as getClaudeStatus,
|
|
21
|
+
killProcessTree2 as killProcessTree,
|
|
22
|
+
processEnvironment2 as processEnvironment,
|
|
23
|
+
readyClaudeCommand2 as readyClaudeCommand,
|
|
24
|
+
spawnCommand2 as spawnCommand
|
|
25
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NativeSystemInjection } from "./transcript.ts";
|
|
2
|
+
export declare function deriveInitialUserPrefix(body: Buffer | undefined, canonicalContent: unknown[]): unknown[] | undefined;
|
|
3
|
+
export declare function deriveInitialSystemMessages(body: Buffer | undefined): unknown[] | undefined;
|
|
4
|
+
export declare function rewriteInitialRequest(body: Buffer, prefix: unknown[] | undefined, canonicalContent: unknown[], initialSystemMessages: unknown[] | undefined, nativeSystemInjections?: NativeSystemInjection[]): Buffer;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deriveInitialUserPrefix2,
|
|
3
|
+
deriveInitialSystemMessages2,
|
|
4
|
+
rewriteInitialRequest2
|
|
5
|
+
} from "../../chunks/billing-j643d12p.js";
|
|
6
|
+
import"../../chunks/billing-0y7dfkp2.js";
|
|
7
|
+
export {
|
|
8
|
+
deriveInitialSystemMessages2 as deriveInitialSystemMessages,
|
|
9
|
+
deriveInitialUserPrefix2 as deriveInitialUserPrefix,
|
|
10
|
+
rewriteInitialRequest2 as rewriteInitialRequest
|
|
11
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Api, AssistantMessageEventStream, Model, SimpleStreamOptions, TranscriptContext } from "@nyte-ai/ai";
|
|
2
|
+
import type { ClaudeModelCatalog } from "./model-catalog.ts";
|
|
3
|
+
export declare function streamClaudeCode(model: Model<Api>, context: TranscriptContext, options: SimpleStreamOptions | undefined, catalog: ClaudeModelCatalog): AssistantMessageEventStream;
|