clanka 0.7.7 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Acp.d.ts +4 -4
- package/dist/Acp.d.ts.map +1 -1
- package/dist/Acp.js +8 -6
- package/dist/Acp.js.map +1 -1
- package/dist/Acp.test.js +66 -4
- package/dist/Acp.test.js.map +1 -1
- package/dist/AcpImage.test.js +7 -7
- package/dist/AcpImage.test.js.map +1 -1
- package/dist/Agent.d.ts +8 -8
- package/dist/Agent.d.ts.map +1 -1
- package/dist/Agent.js +17 -7
- package/dist/Agent.js.map +1 -1
- package/dist/Agent.test.js +53 -8
- package/dist/Agent.test.js.map +1 -1
- package/dist/AgentExecutor.d.ts +9 -9
- package/dist/AgentExecutor.d.ts.map +1 -1
- package/dist/AgentExecutor.js +5 -5
- package/dist/AgentExecutor.js.map +1 -1
- package/dist/AgentExecutorImage.test.js +6 -6
- package/dist/AgentExecutorImage.test.js.map +1 -1
- package/dist/AgentImage.test.js +3 -3
- package/dist/AgentImage.test.js.map +1 -1
- package/dist/AgentOutput.d.ts +10 -2
- package/dist/AgentOutput.d.ts.map +1 -1
- package/dist/AgentOutput.js +10 -2
- package/dist/AgentOutput.js.map +1 -1
- package/dist/AgentSkills.d.ts.map +1 -1
- package/dist/AgentSkills.js +6 -1
- package/dist/AgentSkills.js.map +1 -1
- package/dist/AgentSkills.test.js +21 -4
- package/dist/AgentSkills.test.js.map +1 -1
- package/dist/AgentTools.d.ts +4 -4
- package/dist/AgentTools.d.ts.map +1 -1
- package/dist/AgentTools.js +4 -4
- package/dist/AgentTools.js.map +1 -1
- package/dist/AgentToolsImage.test.js +2 -2
- package/dist/AgentToolsImage.test.js.map +1 -1
- package/dist/ChunkRepo.d.ts +10 -10
- package/dist/ChunkRepo.d.ts.map +1 -1
- package/dist/ChunkRepo.js +7 -7
- package/dist/ChunkRepo.js.map +1 -1
- package/dist/ChunkRepo.test.js +2 -2
- package/dist/ChunkRepo.test.js.map +1 -1
- package/dist/CodeChunker.d.ts +1 -1
- package/dist/CodeChunker.d.ts.map +1 -1
- package/dist/CodeChunker.js +2 -2
- package/dist/CodeChunker.js.map +1 -1
- package/dist/Codex.d.ts +5 -5
- package/dist/Codex.d.ts.map +1 -1
- package/dist/Codex.js +1 -1
- package/dist/Codex.js.map +1 -1
- package/dist/CodexAuth.d.ts +2 -2
- package/dist/CodexAuth.d.ts.map +1 -1
- package/dist/CodexAuth.js +6 -6
- package/dist/CodexAuth.js.map +1 -1
- package/dist/CodexAuth.test.js +3 -3
- package/dist/CodexAuth.test.js.map +1 -1
- package/dist/Compaction.d.ts +3 -3
- package/dist/Compaction.d.ts.map +1 -1
- package/dist/Compaction.js +3 -3
- package/dist/Compaction.js.map +1 -1
- package/dist/Compaction.test.js +3 -3
- package/dist/Compaction.test.js.map +1 -1
- package/dist/CompactionImage.test.js +4 -4
- package/dist/CompactionImage.test.js.map +1 -1
- package/dist/CompactionTokens.test.js +3 -3
- package/dist/CompactionTokens.test.js.map +1 -1
- package/dist/CompactionTransport.test.js +5 -5
- package/dist/CompactionTransport.test.js.map +1 -1
- package/dist/Copilot.d.ts +3 -3
- package/dist/Copilot.d.ts.map +1 -1
- package/dist/Copilot.js +1 -1
- package/dist/Copilot.js.map +1 -1
- package/dist/CopilotAuth.d.ts +2 -2
- package/dist/CopilotAuth.d.ts.map +1 -1
- package/dist/CopilotAuth.js +4 -4
- package/dist/CopilotAuth.js.map +1 -1
- package/dist/CopilotAuth.test.js +2 -2
- package/dist/CopilotAuth.test.js.map +1 -1
- package/dist/GlobalWebSocket.d.ts +1 -1
- package/dist/GlobalWebSocket.d.ts.map +1 -1
- package/dist/GlobalWebSocket.js +1 -1
- package/dist/GlobalWebSocket.js.map +1 -1
- package/dist/Image.d.ts +2 -2
- package/dist/Image.d.ts.map +1 -1
- package/dist/Image.js +3 -3
- package/dist/Image.js.map +1 -1
- package/dist/Image.test.js +2 -2
- package/dist/Image.test.js.map +1 -1
- package/dist/SemanticSearch.d.ts +3 -3
- package/dist/SemanticSearch.d.ts.map +1 -1
- package/dist/SemanticSearch.js +1 -1
- package/dist/SemanticSearch.js.map +1 -1
- package/dist/Sqlite.d.ts +2 -2
- package/dist/Sqlite.d.ts.map +1 -1
- package/dist/Sqlite.js +1 -1
- package/dist/Sqlite.js.map +1 -1
- package/dist/ToolkitRenderer.d.ts +2 -2
- package/dist/ToolkitRenderer.d.ts.map +1 -1
- package/dist/WebToMarkdown.d.ts +2 -2
- package/dist/WebToMarkdown.d.ts.map +1 -1
- package/dist/WebToMarkdown.js +1 -1
- package/dist/WebToMarkdown.js.map +1 -1
- package/dist/WebToMarkdown.test.js +1 -1
- package/dist/WebToMarkdown.test.js.map +1 -1
- package/dist/Xai.d.ts +10 -3
- package/dist/Xai.d.ts.map +1 -1
- package/dist/Xai.js +26 -2
- package/dist/Xai.js.map +1 -1
- package/dist/Xai.test.js +38 -4
- package/dist/Xai.test.js.map +1 -1
- package/dist/XaiAuth.d.ts +2 -2
- package/dist/XaiAuth.d.ts.map +1 -1
- package/dist/XaiAuth.js +4 -4
- package/dist/XaiAuth.js.map +1 -1
- package/dist/XaiAuth.test.js +2 -2
- package/dist/XaiAuth.test.js.map +1 -1
- package/dist/bin/{Effect-CeAMoJlg.mjs → Effect-DvI8YVcR.mjs} +81 -387
- package/dist/bin/Effect-DvI8YVcR.mjs.map +1 -0
- package/dist/bin/{McpClient-zQibhsnA.mjs → McpClient-CM7u8ZVd.mjs} +3 -3
- package/dist/bin/{McpClient-zQibhsnA.mjs.map → McpClient-CM7u8ZVd.mjs.map} +1 -1
- package/dist/bin/{OutputFormatter-C7Awn0DS.mjs → OutputFormatter-BpggeGvI.mjs} +3 -3
- package/dist/bin/{OutputFormatter-C7Awn0DS.mjs.map → OutputFormatter-BpggeGvI.mjs.map} +1 -1
- package/dist/bin/{Schema-Bc06DxcV.mjs → Schema-DyJ738Wp.mjs} +1979 -1663
- package/dist/bin/Schema-DyJ738Wp.mjs.map +1 -0
- package/dist/bin/{SemanticSearch-BPxQoRSC.mjs → SemanticSearch-BHUGFT1y.mjs} +46 -42
- package/dist/bin/SemanticSearch-BHUGFT1y.mjs.map +1 -0
- package/dist/bin/{Stream-DlGXvw0L.mjs → Stream-Dg7AGCgJ.mjs} +60 -61
- package/dist/bin/Stream-Dg7AGCgJ.mjs.map +1 -0
- package/dist/bin/cli.mjs +614 -371
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/cli.js +7 -5
- package/dist/cli.js.map +1 -1
- package/dist/fixtures/TestImages.js +2 -2
- package/dist/fixtures/TestImages.js.map +1 -1
- package/package.json +7 -7
- package/src/Acp.test.ts +107 -5
- package/src/Acp.ts +10 -8
- package/src/AcpImage.test.ts +9 -9
- package/src/Agent.test.ts +61 -9
- package/src/Agent.ts +20 -10
- package/src/AgentExecutor.ts +8 -8
- package/src/AgentExecutorImage.test.ts +6 -6
- package/src/AgentImage.test.ts +5 -5
- package/src/AgentOutput.ts +10 -2
- package/src/AgentSkills.test.ts +81 -37
- package/src/AgentSkills.ts +5 -1
- package/src/AgentTools.ts +5 -5
- package/src/AgentToolsImage.test.ts +4 -4
- package/src/ChunkRepo.test.ts +2 -2
- package/src/ChunkRepo.ts +7 -7
- package/src/CodeChunker.ts +2 -2
- package/src/Codex.ts +4 -4
- package/src/CodexAuth.test.ts +3 -3
- package/src/CodexAuth.ts +6 -6
- package/src/Compaction.test.ts +3 -3
- package/src/Compaction.ts +3 -3
- package/src/CompactionImage.test.ts +4 -4
- package/src/CompactionTokens.test.ts +3 -3
- package/src/CompactionTransport.test.ts +6 -6
- package/src/Copilot.ts +2 -2
- package/src/CopilotAuth.test.ts +2 -6
- package/src/CopilotAuth.ts +4 -4
- package/src/GlobalWebSocket.ts +1 -1
- package/src/Image.test.ts +2 -2
- package/src/Image.ts +4 -4
- package/src/OutputFormatter.ts +1 -1
- package/src/SemanticSearch.test.ts +1 -1
- package/src/SemanticSearch.ts +3 -3
- package/src/Sqlite.ts +1 -1
- package/src/ToolkitRenderer.ts +2 -2
- package/src/WebToMarkdown.test.ts +1 -1
- package/src/WebToMarkdown.ts +2 -2
- package/src/Xai.test.ts +67 -8
- package/src/Xai.ts +52 -3
- package/src/XaiAuth.test.ts +2 -2
- package/src/XaiAuth.ts +4 -4
- package/src/cli.ts +9 -7
- package/src/fixtures/TestImages.ts +2 -2
- package/src/fixtures/patch13-broken.txt +4 -4
- package/src/fixtures/patch13-fixed.txt +4 -4
- package/dist/bin/Effect-CeAMoJlg.mjs.map +0 -1
- package/dist/bin/Schema-Bc06DxcV.mjs.map +0 -1
- package/dist/bin/SemanticSearch-BPxQoRSC.mjs.map +0 -1
- package/dist/bin/Stream-DlGXvw0L.mjs.map +0 -1
package/src/ToolkitRenderer.ts
CHANGED
|
@@ -5,8 +5,8 @@ import * as Array from "effect/Array"
|
|
|
5
5
|
import * as Layer from "effect/Layer"
|
|
6
6
|
import * as SchemaAST from "effect/SchemaAST"
|
|
7
7
|
import * as Context from "effect/Context"
|
|
8
|
-
import type * as Tool from "effect/
|
|
9
|
-
import type * as Toolkit from "effect/
|
|
8
|
+
import type * as Tool from "effect/ai/Tool"
|
|
9
|
+
import type * as Toolkit from "effect/ai/Toolkit"
|
|
10
10
|
import * as TypeBuilder from "./TypeBuilder.ts"
|
|
11
11
|
import * as Function from "effect/Function"
|
|
12
12
|
|
package/src/WebToMarkdown.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import * as Effect from "effect/Effect"
|
|
5
5
|
import * as Layer from "effect/Layer"
|
|
6
6
|
import * as Context from "effect/Context"
|
|
7
|
-
import * as HttpClient from "effect/
|
|
8
|
-
import type * as HttpClientError from "effect/
|
|
7
|
+
import * as HttpClient from "effect/http/HttpClient"
|
|
8
|
+
import type * as HttpClientError from "effect/http/HttpClientError"
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @since 1.0.0
|
package/src/Xai.test.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { assert, describe, it } from "@effect/vitest"
|
|
2
|
+
import { OpenAiClient } from "@effect/ai-openai"
|
|
2
3
|
import * as Effect from "effect/Effect"
|
|
3
4
|
import * as Exit from "effect/Exit"
|
|
4
5
|
import * as Layer from "effect/Layer"
|
|
5
6
|
import * as Stream from "effect/Stream"
|
|
6
|
-
import * as LanguageModel from "effect/
|
|
7
|
-
import * as Model from "effect/
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
HttpClientResponse,
|
|
12
|
-
} from "effect/unstable/http"
|
|
13
|
-
import * as KeyValueStore from "effect/unstable/persistence/KeyValueStore"
|
|
7
|
+
import * as LanguageModel from "effect/ai/LanguageModel"
|
|
8
|
+
import * as Model from "effect/ai/Model"
|
|
9
|
+
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http"
|
|
10
|
+
import * as KeyValueStore from "effect/persistence/KeyValueStore"
|
|
11
|
+
import * as Socket from "effect/socket/Socket"
|
|
14
12
|
import * as Compaction from "./Compaction.ts"
|
|
15
13
|
import { DeviceCodeHandler } from "./DeviceCodeHandler.ts"
|
|
16
14
|
import * as Public from "./index.ts"
|
|
@@ -61,6 +59,67 @@ const noLogin = Layer.succeed(DeviceCodeHandler, {
|
|
|
61
59
|
})
|
|
62
60
|
|
|
63
61
|
describe("Xai provider", () => {
|
|
62
|
+
it.todo(
|
|
63
|
+
"replays WebSocket history inline with storage enabled once upstream supports disabling item references",
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
for (const store of [undefined, false, true] as const) {
|
|
67
|
+
it.effect("always stores WebSocket responses with store=" + store, () =>
|
|
68
|
+
Effect.gen(function* () {
|
|
69
|
+
const http = capture()
|
|
70
|
+
const requests: Array<
|
|
71
|
+
Parameters<
|
|
72
|
+
OpenAiClient.OpenAiSocket["Service"]["createResponseStream"]
|
|
73
|
+
>[0]
|
|
74
|
+
> = []
|
|
75
|
+
yield* Effect.gen(function* () {
|
|
76
|
+
const ai = yield* LanguageModel.LanguageModel
|
|
77
|
+
const summarize = yield* Compaction.SummarizerTransform
|
|
78
|
+
const request = ai
|
|
79
|
+
.streamText({ prompt: "hello" })
|
|
80
|
+
.pipe(Stream.runDrain)
|
|
81
|
+
yield* request.pipe(Effect.exit)
|
|
82
|
+
yield* summarize(request).pipe(Effect.exit)
|
|
83
|
+
}).pipe(
|
|
84
|
+
Effect.provideService(OpenAiClient.OpenAiSocket, {
|
|
85
|
+
createResponseStream: (request) =>
|
|
86
|
+
Effect.sync(() => {
|
|
87
|
+
requests.push(request)
|
|
88
|
+
return [
|
|
89
|
+
HttpClientResponse.fromWeb(
|
|
90
|
+
HttpClientRequest.post("https://api.x.ai/v1/responses"),
|
|
91
|
+
new Response(),
|
|
92
|
+
),
|
|
93
|
+
Stream.empty,
|
|
94
|
+
] as const
|
|
95
|
+
}),
|
|
96
|
+
}),
|
|
97
|
+
Effect.provide(
|
|
98
|
+
Xai.modelWebSocket(
|
|
99
|
+
"grok-4.6",
|
|
100
|
+
store === undefined ? undefined : { store },
|
|
101
|
+
).pipe(
|
|
102
|
+
Layer.provide(
|
|
103
|
+
OpenAiClient.layer({ apiUrl: "https://api.x.ai/v1" }),
|
|
104
|
+
),
|
|
105
|
+
Layer.provide(http.layer),
|
|
106
|
+
Layer.provide(
|
|
107
|
+
Layer.succeed(Socket.WebSocketConstructor, () => {
|
|
108
|
+
throw new Error("Unexpected live WebSocket")
|
|
109
|
+
}),
|
|
110
|
+
),
|
|
111
|
+
),
|
|
112
|
+
),
|
|
113
|
+
)
|
|
114
|
+
assert.lengthOf(http.requests, 0)
|
|
115
|
+
assert.lengthOf(requests, 2)
|
|
116
|
+
for (const request of requests) assert.strictEqual(request.store, true)
|
|
117
|
+
assert.isUndefined(requests[0]!.max_output_tokens)
|
|
118
|
+
assert.strictEqual(requests[1]!.max_output_tokens, 4000)
|
|
119
|
+
}),
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
64
123
|
it("exports Xai, but not XaiAuth, from the public entry point", () => {
|
|
65
124
|
assert.strictEqual(Public.Xai, Xai)
|
|
66
125
|
assert.isFalse("XaiAuth" in Public)
|
package/src/Xai.ts
CHANGED
|
@@ -7,8 +7,10 @@ import * as Struct from "effect/Struct"
|
|
|
7
7
|
import { XaiAuth } from "./XaiAuth.ts"
|
|
8
8
|
import { AgentModelConfig } from "./Agent.ts"
|
|
9
9
|
import * as Compaction from "./Compaction.ts"
|
|
10
|
-
import * as Model from "effect/
|
|
11
|
-
import type * as LanguageModel from "effect/
|
|
10
|
+
import * as Model from "effect/ai/Model"
|
|
11
|
+
import type * as LanguageModel from "effect/ai/LanguageModel"
|
|
12
|
+
import type * as Socket from "effect/socket/Socket"
|
|
13
|
+
import type * as ResponseIdTracker from "effect/ai/ResponseIdTracker"
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* @since 1.0.0
|
|
@@ -39,7 +41,7 @@ export const model = (
|
|
|
39
41
|
"systemPromptTransform",
|
|
40
42
|
"supportsImages",
|
|
41
43
|
]),
|
|
42
|
-
store: false,
|
|
44
|
+
store: options?.store ?? false,
|
|
43
45
|
reasoning: { effort: "high", ...options?.reasoning },
|
|
44
46
|
},
|
|
45
47
|
}),
|
|
@@ -55,3 +57,50 @@ export const model = (
|
|
|
55
57
|
),
|
|
56
58
|
),
|
|
57
59
|
)
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @since 1.0.0
|
|
63
|
+
* @category Layers
|
|
64
|
+
*/
|
|
65
|
+
export const modelWebSocket = (
|
|
66
|
+
model: string,
|
|
67
|
+
options?:
|
|
68
|
+
| (OpenAiLanguageModel.Config["Service"] & typeof AgentModelConfig.Service)
|
|
69
|
+
| undefined,
|
|
70
|
+
): Model.Model<
|
|
71
|
+
"xai",
|
|
72
|
+
| LanguageModel.LanguageModel
|
|
73
|
+
| OpenAiClient.OpenAiSocket
|
|
74
|
+
| ResponseIdTracker.ResponseIdTracker,
|
|
75
|
+
OpenAiClient.OpenAiClient | Socket.WebSocketConstructor
|
|
76
|
+
> =>
|
|
77
|
+
Model.make(
|
|
78
|
+
"xai",
|
|
79
|
+
model,
|
|
80
|
+
Layer.mergeAll(
|
|
81
|
+
OpenAiLanguageModel.layer({
|
|
82
|
+
model,
|
|
83
|
+
config: {
|
|
84
|
+
...Struct.omit(options ?? {}, [
|
|
85
|
+
"systemPromptTransform",
|
|
86
|
+
"supportsImages",
|
|
87
|
+
]),
|
|
88
|
+
// xAI needs stored responses to resolve previous_response_id.
|
|
89
|
+
store: true,
|
|
90
|
+
useItemReferences: false,
|
|
91
|
+
reasoning: { effort: "high", ...options?.reasoning },
|
|
92
|
+
},
|
|
93
|
+
}),
|
|
94
|
+
AgentModelConfig.layer({
|
|
95
|
+
systemPromptTransform: options?.systemPromptTransform,
|
|
96
|
+
supportsImages: options?.supportsImages,
|
|
97
|
+
}),
|
|
98
|
+
// Cap compaction summaries; xAI honours max_output_tokens.
|
|
99
|
+
Layer.succeed(Compaction.SummarizerTransform, (effect) =>
|
|
100
|
+
OpenAiLanguageModel.withConfigOverride(effect, {
|
|
101
|
+
max_output_tokens: Compaction.summarizerMaxOutputTokens,
|
|
102
|
+
}),
|
|
103
|
+
),
|
|
104
|
+
Layer.fresh(OpenAiClient.layerWebSocketMode),
|
|
105
|
+
),
|
|
106
|
+
)
|
package/src/XaiAuth.test.ts
CHANGED
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
HttpClientError,
|
|
10
10
|
type HttpClientRequest,
|
|
11
11
|
HttpClientResponse,
|
|
12
|
-
} from "effect/
|
|
13
|
-
import * as KeyValueStore from "effect/
|
|
12
|
+
} from "effect/http"
|
|
13
|
+
import * as KeyValueStore from "effect/persistence/KeyValueStore"
|
|
14
14
|
import { DeviceCodeHandler } from "./DeviceCodeHandler.ts"
|
|
15
15
|
import { XaiAuth, TokenData, toTokenStore } from "./XaiAuth.ts"
|
|
16
16
|
|
package/src/XaiAuth.ts
CHANGED
|
@@ -9,10 +9,10 @@ import * as Option from "effect/Option"
|
|
|
9
9
|
import * as Schedule from "effect/Schedule"
|
|
10
10
|
import * as Schema from "effect/Schema"
|
|
11
11
|
import * as Semaphore from "effect/Semaphore"
|
|
12
|
-
import * as HttpClient from "effect/
|
|
13
|
-
import * as HttpClientRequest from "effect/
|
|
14
|
-
import * as HttpClientResponse from "effect/
|
|
15
|
-
import * as KeyValueStore from "effect/
|
|
12
|
+
import * as HttpClient from "effect/http/HttpClient"
|
|
13
|
+
import * as HttpClientRequest from "effect/http/HttpClientRequest"
|
|
14
|
+
import * as HttpClientResponse from "effect/http/HttpClientResponse"
|
|
15
|
+
import * as KeyValueStore from "effect/persistence/KeyValueStore"
|
|
16
16
|
import { DeviceCodeHandler } from "./DeviceCodeHandler.ts"
|
|
17
17
|
|
|
18
18
|
const CLIENT_ID = "b1a00492-073a-47ea-816f-4c329264a828"
|
package/src/cli.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --optimize-for-size
|
|
2
2
|
import * as Effect from "effect/Effect"
|
|
3
|
-
import * as Prompt from "effect/
|
|
3
|
+
import * as Prompt from "effect/cli/Prompt"
|
|
4
4
|
import * as NodeHttpClient from "@effect/platform-node/NodeHttpClient"
|
|
5
|
-
import * as Command from "effect/
|
|
6
|
-
import * as Flag from "effect/
|
|
5
|
+
import * as Command from "effect/cli/Command"
|
|
6
|
+
import * as Flag from "effect/cli/Flag"
|
|
7
7
|
import * as NodeServices from "@effect/platform-node/NodeServices"
|
|
8
8
|
import * as NodeRuntime from "@effect/platform-node/NodeRuntime"
|
|
9
9
|
import * as GlobalWebSocket from "./GlobalWebSocket.ts"
|
|
@@ -21,10 +21,10 @@ import * as Layer from "effect/Layer"
|
|
|
21
21
|
import * as Logger from "effect/Logger"
|
|
22
22
|
import * as Path from "effect/Path"
|
|
23
23
|
import * as Schema from "effect/Schema"
|
|
24
|
-
import type * as LanguageModel from "effect/
|
|
25
|
-
import type * as Model from "effect/
|
|
24
|
+
import type * as LanguageModel from "effect/ai/LanguageModel"
|
|
25
|
+
import type * as Model from "effect/ai/Model"
|
|
26
26
|
import * as Config from "effect/Config"
|
|
27
|
-
import * as KeyValueStore from "effect/
|
|
27
|
+
import * as KeyValueStore from "effect/persistence/KeyValueStore"
|
|
28
28
|
import * as Option from "effect/Option"
|
|
29
29
|
import { OpenAiClient, OpenAiEmbeddingModel } from "@effect/ai-openai"
|
|
30
30
|
import * as DeviceCodeHandler from "./DeviceCodeHandler.ts"
|
|
@@ -58,7 +58,9 @@ const modelLayer = (provider: Provider, model: string, effort: string) =>
|
|
|
58
58
|
).pipe(Layer.provide(Codex.layerClient))
|
|
59
59
|
: provider === "xai"
|
|
60
60
|
? withSubagentModel(
|
|
61
|
-
Xai.
|
|
61
|
+
Xai.modelWebSocket(model, {
|
|
62
|
+
reasoning: { effort: effort as any },
|
|
63
|
+
}),
|
|
62
64
|
).pipe(Layer.provide(Xai.layerClient))
|
|
63
65
|
: withSubagentModel(Copilot.model(model, { reasoning: { effort } })).pipe(
|
|
64
66
|
Layer.provide(Copilot.layerClient),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Photon from "@silvia-odwyer/photon-node"
|
|
2
2
|
import * as Zlib from "node:zlib"
|
|
3
|
-
import * as
|
|
3
|
+
import * as Base64 from "effect/encoding/Base64"
|
|
4
4
|
|
|
5
5
|
export const encodePng = (options: {
|
|
6
6
|
readonly width: number
|
|
@@ -278,7 +278,7 @@ export const bytesOf = (data: string | Uint8Array | URL): Uint8Array => {
|
|
|
278
278
|
const base64 = data.startsWith("data:")
|
|
279
279
|
? data.slice(data.indexOf(",") + 1)
|
|
280
280
|
: data
|
|
281
|
-
const decoded =
|
|
281
|
+
const decoded = Base64.decode(base64)
|
|
282
282
|
if (decoded._tag === "Failure") throw new Error("Invalid base64 image data")
|
|
283
283
|
return decoded.success
|
|
284
284
|
}
|
|
@@ -3,8 +3,8 @@ await applyPatch(`*** Begin Patch
|
|
|
3
3
|
@@
|
|
4
4
|
import * as ExaSearch from "./ExaSearch.ts"
|
|
5
5
|
import * as WebToMarkdown from "./WebToMarkdown.ts"
|
|
6
|
-
-import type * as HttpClient from "effect/
|
|
7
|
-
+import * as HttpClient from "effect/
|
|
6
|
+
-import type * as HttpClient from "effect/http/HttpClient"
|
|
7
|
+
+import * as HttpClient from "effect/http/HttpClient"
|
|
8
8
|
@@
|
|
9
9
|
Tool.make("fetchMarkdown", {
|
|
10
10
|
description: "Fetch a web page and convert it to markdown.",
|
|
@@ -64,7 +64,7 @@ await applyPatch(`*** Begin Patch
|
|
|
64
64
|
+ HttpClient,
|
|
65
65
|
+ type HttpClientRequest,
|
|
66
66
|
+ HttpClientResponse,
|
|
67
|
-
+} from "effect/
|
|
67
|
+
+} from "effect/http"
|
|
68
68
|
+import * as AgentTools from "./AgentTools.ts"
|
|
69
69
|
+import * as ToolkitRenderer from "./ToolkitRenderer.ts"
|
|
70
70
|
+
|
|
@@ -146,4 +146,4 @@ await applyPatch(`*** Begin Patch
|
|
|
146
146
|
+
|
|
147
147
|
+Add a built-in `fetchJson` agent tool for fetching and parsing JSON responses.
|
|
148
148
|
*** End Patch`);
|
|
149
|
-
console.log('patch applied');
|
|
149
|
+
console.log('patch applied');
|
|
@@ -3,8 +3,8 @@ await applyPatch(`*** Begin Patch
|
|
|
3
3
|
@@
|
|
4
4
|
import * as ExaSearch from "./ExaSearch.ts"
|
|
5
5
|
import * as WebToMarkdown from "./WebToMarkdown.ts"
|
|
6
|
-
-import type * as HttpClient from "effect/
|
|
7
|
-
+import * as HttpClient from "effect/
|
|
6
|
+
-import type * as HttpClient from "effect/http/HttpClient"
|
|
7
|
+
+import * as HttpClient from "effect/http/HttpClient"
|
|
8
8
|
@@
|
|
9
9
|
Tool.make("fetchMarkdown", {
|
|
10
10
|
description: "Fetch a web page and convert it to markdown.",
|
|
@@ -64,7 +64,7 @@ await applyPatch(`*** Begin Patch
|
|
|
64
64
|
+ HttpClient,
|
|
65
65
|
+ type HttpClientRequest,
|
|
66
66
|
+ HttpClientResponse,
|
|
67
|
-
+} from "effect/
|
|
67
|
+
+} from "effect/http"
|
|
68
68
|
+import * as AgentTools from "./AgentTools.ts"
|
|
69
69
|
+import * as ToolkitRenderer from "./ToolkitRenderer.ts"
|
|
70
70
|
+
|
|
@@ -146,4 +146,4 @@ await applyPatch(`*** Begin Patch
|
|
|
146
146
|
+
|
|
147
147
|
+Add a built-in \`fetchJson\` agent tool for fetching and parsing JSON responses.
|
|
148
148
|
*** End Patch`);
|
|
149
|
-
console.log('patch applied');
|
|
149
|
+
console.log('patch applied');
|