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/AgentImage.test.ts
CHANGED
|
@@ -6,11 +6,11 @@ import * as Exit from "effect/Exit"
|
|
|
6
6
|
import * as Layer from "effect/Layer"
|
|
7
7
|
import * as Option from "effect/Option"
|
|
8
8
|
import * as Stream from "effect/Stream"
|
|
9
|
-
import * as AiError from "effect/
|
|
10
|
-
import * as LanguageModel from "effect/
|
|
11
|
-
import * as Model from "effect/
|
|
12
|
-
import type * as Prompt from "effect/
|
|
13
|
-
import type * as Response from "effect/
|
|
9
|
+
import * as AiError from "effect/ai/AiError"
|
|
10
|
+
import * as LanguageModel from "effect/ai/LanguageModel"
|
|
11
|
+
import * as Model from "effect/ai/Model"
|
|
12
|
+
import type * as Prompt from "effect/ai/Prompt"
|
|
13
|
+
import type * as Response from "effect/ai/Response"
|
|
14
14
|
import * as Agent from "./Agent.ts"
|
|
15
15
|
import * as AgentExecutor from "./AgentExecutor.ts"
|
|
16
16
|
import { tinyPng } from "./fixtures/TestImages.ts"
|
package/src/AgentOutput.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @since 1.0.0
|
|
3
3
|
*/
|
|
4
4
|
/** @effect-diagnostics schemaNumber:off */
|
|
5
|
-
import * as Prompt from "effect/
|
|
6
|
-
import * as AiError from "effect/
|
|
5
|
+
import * as Prompt from "effect/ai/Prompt"
|
|
6
|
+
import * as AiError from "effect/ai/AiError"
|
|
7
7
|
import * as Schema from "effect/Schema"
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -87,6 +87,14 @@ export class Usage extends Schema.TaggedClass<Usage>()("Usage", {
|
|
|
87
87
|
contextTokens: Schema.Number,
|
|
88
88
|
inputTokens: Schema.Number,
|
|
89
89
|
outputTokens: Schema.Number,
|
|
90
|
+
/**
|
|
91
|
+
* Cumulative cache reads included in `inputTokens`. Zero is not proof of no cache activity.
|
|
92
|
+
*/
|
|
93
|
+
cacheRead: Schema.Number,
|
|
94
|
+
/**
|
|
95
|
+
* Cumulative cache writes included in `inputTokens`. Zero is not proof of no cache activity.
|
|
96
|
+
*/
|
|
97
|
+
cacheWrite: Schema.Number,
|
|
90
98
|
}) {}
|
|
91
99
|
|
|
92
100
|
/**
|
package/src/AgentSkills.test.ts
CHANGED
|
@@ -7,8 +7,8 @@ import * as Layer from "effect/Layer"
|
|
|
7
7
|
import * as Option from "effect/Option"
|
|
8
8
|
import * as Path from "effect/Path"
|
|
9
9
|
import * as Stream from "effect/Stream"
|
|
10
|
-
import * as LanguageModel from "effect/
|
|
11
|
-
import * as Model from "effect/
|
|
10
|
+
import * as LanguageModel from "effect/ai/LanguageModel"
|
|
11
|
+
import * as Model from "effect/ai/Model"
|
|
12
12
|
import * as Agent from "./Agent.ts"
|
|
13
13
|
import * as AgentExecutor from "./AgentExecutor.ts"
|
|
14
14
|
import * as AgentSkills from "./AgentSkills.ts"
|
|
@@ -219,7 +219,9 @@ describe("AgentSkills", () => {
|
|
|
219
219
|
if (mode !== "missing skills")
|
|
220
220
|
assert.deepStrictEqual(reads, [
|
|
221
221
|
path.join(roots.project, ".agents", "skills"),
|
|
222
|
+
path.join(roots.project, ".agents", "skills", "proj"),
|
|
222
223
|
path.join(roots.home, ".agents", "skills"),
|
|
224
|
+
path.join(roots.home, ".agents", "skills", "usr"),
|
|
223
225
|
])
|
|
224
226
|
}),
|
|
225
227
|
).pipe(Effect.provide(NodeServices.layer)),
|
|
@@ -601,58 +603,65 @@ describe("AgentSkills", () => {
|
|
|
601
603
|
).pipe(Effect.provide(NodeServices.layer)),
|
|
602
604
|
)
|
|
603
605
|
|
|
604
|
-
it.effect(
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
606
|
+
it.effect(
|
|
607
|
+
"skips skills without a description or with invalid frontmatter",
|
|
608
|
+
() =>
|
|
609
|
+
withRoots(
|
|
610
|
+
Effect.fnUntraced(function* (roots) {
|
|
611
|
+
yield* writeSkill(
|
|
612
|
+
roots.project,
|
|
613
|
+
"no-description",
|
|
614
|
+
`---
|
|
611
615
|
name: no-description
|
|
612
616
|
---
|
|
613
617
|
body`,
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
618
|
+
)
|
|
619
|
+
yield* writeSkill(
|
|
620
|
+
roots.project,
|
|
621
|
+
"empty-description",
|
|
622
|
+
`---
|
|
619
623
|
name: empty-description
|
|
620
624
|
description: ""
|
|
621
625
|
---
|
|
622
626
|
body`,
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
627
|
+
)
|
|
628
|
+
yield* writeSkill(
|
|
629
|
+
roots.project,
|
|
630
|
+
"broken",
|
|
631
|
+
`---
|
|
628
632
|
this is not yaml at all
|
|
629
633
|
---
|
|
630
634
|
body`,
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
635
|
+
)
|
|
636
|
+
yield* writeSkill(roots.project, "no-frontmatter", "# Just markdown")
|
|
637
|
+
yield* writeSkill(
|
|
638
|
+
roots.project,
|
|
639
|
+
"unquoted-colon",
|
|
640
|
+
"---\nname: unquoted-colon\ndescription: Use when: deploying\n---\nbody",
|
|
641
|
+
)
|
|
642
|
+
yield* writeSkill(
|
|
643
|
+
roots.project,
|
|
644
|
+
"messy",
|
|
645
|
+
`---
|
|
637
646
|
name: messy-name-differs
|
|
638
|
-
description: Use when: the task mentions colons, "quotes" or other messy things
|
|
647
|
+
description: 'Use when: the task mentions colons, "quotes" or other messy things'
|
|
639
648
|
metadata:
|
|
640
649
|
author: someone
|
|
641
650
|
---
|
|
642
651
|
body`,
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
[
|
|
652
|
+
)
|
|
653
|
+
const skills = yield* discover(roots)
|
|
654
|
+
assert.deepStrictEqual(
|
|
655
|
+
skills.map((skill) => [skill.name, skill.description]),
|
|
648
656
|
[
|
|
649
|
-
|
|
650
|
-
|
|
657
|
+
[
|
|
658
|
+
"messy-name-differs",
|
|
659
|
+
'Use when: the task mentions colons, "quotes" or other messy things',
|
|
660
|
+
],
|
|
651
661
|
],
|
|
652
|
-
|
|
653
|
-
)
|
|
654
|
-
|
|
655
|
-
).pipe(Effect.provide(NodeServices.layer)),
|
|
662
|
+
)
|
|
663
|
+
}),
|
|
664
|
+
).pipe(Effect.provide(NodeServices.layer)),
|
|
656
665
|
)
|
|
657
666
|
|
|
658
667
|
it.effect("reads quoted and block scalar frontmatter values", () =>
|
|
@@ -740,6 +749,41 @@ body`,
|
|
|
740
749
|
).pipe(Effect.provide(NodeServices.layer)),
|
|
741
750
|
)
|
|
742
751
|
|
|
752
|
+
it.effect(
|
|
753
|
+
"requires exact filename casing even when SKILL.md is readable",
|
|
754
|
+
() =>
|
|
755
|
+
withRoots(
|
|
756
|
+
Effect.fnUntraced(function* (roots) {
|
|
757
|
+
const fs = yield* FileSystem.FileSystem
|
|
758
|
+
const path = yield* Path.Path
|
|
759
|
+
const location = yield* writeSkill(
|
|
760
|
+
roots.project,
|
|
761
|
+
"lowercase",
|
|
762
|
+
skillFile("lowercase", "Ignored"),
|
|
763
|
+
)
|
|
764
|
+
const regular = yield* writeSkill(
|
|
765
|
+
roots.project,
|
|
766
|
+
"regular",
|
|
767
|
+
skillFile("regular", "Found"),
|
|
768
|
+
)
|
|
769
|
+
const controlledFs = FileSystem.FileSystem.of({
|
|
770
|
+
...fs,
|
|
771
|
+
readDirectory: (directory, options) =>
|
|
772
|
+
directory === path.dirname(location)
|
|
773
|
+
? Effect.succeed(["skill.md"])
|
|
774
|
+
: fs.readDirectory(directory, options),
|
|
775
|
+
})
|
|
776
|
+
const skills = yield* discover(roots).pipe(
|
|
777
|
+
Effect.provideService(FileSystem.FileSystem, controlledFs),
|
|
778
|
+
)
|
|
779
|
+
assert.deepStrictEqual(
|
|
780
|
+
skills.map((skill) => skill.location),
|
|
781
|
+
[regular],
|
|
782
|
+
)
|
|
783
|
+
}),
|
|
784
|
+
).pipe(Effect.provide(NodeServices.layer)),
|
|
785
|
+
)
|
|
786
|
+
|
|
743
787
|
it.effect("returns an empty catalog when nothing exists", () =>
|
|
744
788
|
withRoots(
|
|
745
789
|
Effect.fnUntraced(function* (roots) {
|
package/src/AgentSkills.ts
CHANGED
|
@@ -9,7 +9,7 @@ import * as Option from "effect/Option"
|
|
|
9
9
|
import * as Path from "effect/Path"
|
|
10
10
|
import * as Predicate from "effect/Predicate"
|
|
11
11
|
import * as Schema from "effect/Schema"
|
|
12
|
-
import * as Yaml from "effect/
|
|
12
|
+
import * as Yaml from "effect/encoding/Yaml"
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @since 1.0.0
|
|
@@ -90,6 +90,10 @@ export const discover: (options: {
|
|
|
90
90
|
.pipe(Effect.orElseSucceed(() => []))
|
|
91
91
|
entries.sort()
|
|
92
92
|
for (const entry of entries) {
|
|
93
|
+
const files = yield* fs
|
|
94
|
+
.readDirectory(path.join(skillsDir, entry))
|
|
95
|
+
.pipe(Effect.orElseSucceed((): Array<string> => []))
|
|
96
|
+
if (!files.includes("SKILL.md")) continue
|
|
93
97
|
const location = path.join(skillsDir, entry, "SKILL.md")
|
|
94
98
|
const content = yield* Effect.option(
|
|
95
99
|
fs.stat(location).pipe(
|
package/src/AgentTools.ts
CHANGED
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
import { parsePatch, patchChunks } from "./ApplyPatch.ts"
|
|
6
6
|
import * as ExaSearch from "./ExaSearch.ts"
|
|
7
7
|
import * as WebToMarkdown from "./WebToMarkdown.ts"
|
|
8
|
-
import type * as HttpClient from "effect/
|
|
8
|
+
import type * as HttpClient from "effect/http/HttpClient"
|
|
9
9
|
import * as Context from "effect/Context"
|
|
10
10
|
import * as Effect from "effect/Effect"
|
|
11
|
-
import * as Toolkit from "effect/
|
|
12
|
-
import * as Tool from "effect/
|
|
11
|
+
import * as Toolkit from "effect/ai/Toolkit"
|
|
12
|
+
import * as Tool from "effect/ai/Tool"
|
|
13
13
|
import * as Schema from "effect/Schema"
|
|
14
|
-
import * as ChildProcessSpawner from "effect/
|
|
14
|
+
import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner"
|
|
15
15
|
import * as FileSystem from "effect/FileSystem"
|
|
16
16
|
import * as Path from "effect/Path"
|
|
17
|
-
import * as ChildProcess from "effect/
|
|
17
|
+
import * as ChildProcess from "effect/process/ChildProcess"
|
|
18
18
|
import * as Stream from "effect/Stream"
|
|
19
19
|
import { pipe } from "effect/Function"
|
|
20
20
|
import * as Array from "effect/Array"
|
|
@@ -10,10 +10,10 @@ import * as FileSystem from "effect/FileSystem"
|
|
|
10
10
|
import * as Layer from "effect/Layer"
|
|
11
11
|
import * as Path from "effect/Path"
|
|
12
12
|
import * as Stream from "effect/Stream"
|
|
13
|
-
import * as LanguageModel from "effect/
|
|
14
|
-
import * as Model from "effect/
|
|
15
|
-
import type * as Prompt from "effect/
|
|
16
|
-
import type * as Response from "effect/
|
|
13
|
+
import * as LanguageModel from "effect/ai/LanguageModel"
|
|
14
|
+
import * as Model from "effect/ai/Model"
|
|
15
|
+
import type * as Prompt from "effect/ai/Prompt"
|
|
16
|
+
import type * as Response from "effect/ai/Response"
|
|
17
17
|
import * as Agent from "./Agent.ts"
|
|
18
18
|
import * as AgentExecutor from "./AgentExecutor.ts"
|
|
19
19
|
import type * as AgentOutput from "./AgentOutput.ts"
|
package/src/ChunkRepo.test.ts
CHANGED
|
@@ -5,8 +5,8 @@ import * as NodeServices from "@effect/platform-node/NodeServices"
|
|
|
5
5
|
import { assert, describe, it } from "@effect/vitest"
|
|
6
6
|
import * as Effect from "effect/Effect"
|
|
7
7
|
import * as Layer from "effect/Layer"
|
|
8
|
-
import * as EmbeddingModel from "effect/
|
|
9
|
-
import * as SqlClient from "effect/
|
|
8
|
+
import * as EmbeddingModel from "effect/ai/EmbeddingModel"
|
|
9
|
+
import * as SqlClient from "effect/sql/SqlClient"
|
|
10
10
|
import { Chunk, ChunkRepo, layer, SyncId } from "./ChunkRepo.ts"
|
|
11
11
|
import { SqliteLayer } from "./Sqlite.ts"
|
|
12
12
|
|
package/src/ChunkRepo.ts
CHANGED
|
@@ -4,15 +4,15 @@ import * as Layer from "effect/Layer"
|
|
|
4
4
|
import * as Schema from "effect/Schema"
|
|
5
5
|
import * as SchemaTransformation from "effect/SchemaTransformation"
|
|
6
6
|
import * as Context from "effect/Context"
|
|
7
|
-
import * as Model from "effect/
|
|
8
|
-
import * as SqlClient from "effect/
|
|
9
|
-
import * as SqlError from "effect/
|
|
10
|
-
import * as SqlModel from "effect/
|
|
11
|
-
import * as SqlSchema from "effect/
|
|
7
|
+
import * as Model from "effect/schema/Model"
|
|
8
|
+
import * as SqlClient from "effect/sql/SqlClient"
|
|
9
|
+
import * as SqlError from "effect/sql/SqlError"
|
|
10
|
+
import * as SqlModel from "effect/sql/SqlModel"
|
|
11
|
+
import * as SqlSchema from "effect/sql/SqlSchema"
|
|
12
12
|
import type * as Cause from "effect/Cause"
|
|
13
13
|
import type * as Option from "effect/Option"
|
|
14
|
-
import * as EmbeddingModel from "effect/
|
|
15
|
-
import * as SqlResolver from "effect/
|
|
14
|
+
import * as EmbeddingModel from "effect/ai/EmbeddingModel"
|
|
15
|
+
import * as SqlResolver from "effect/sql/SqlResolver"
|
|
16
16
|
import * as RequestResolver from "effect/RequestResolver"
|
|
17
17
|
|
|
18
18
|
/**
|
package/src/CodeChunker.ts
CHANGED
|
@@ -9,8 +9,8 @@ import * as Layer from "effect/Layer"
|
|
|
9
9
|
import * as Path from "effect/Path"
|
|
10
10
|
import * as Context from "effect/Context"
|
|
11
11
|
import * as Stream from "effect/Stream"
|
|
12
|
-
import * as ChildProcess from "effect/
|
|
13
|
-
import * as ChildProcessSpawner from "effect/
|
|
12
|
+
import * as ChildProcess from "effect/process/ChildProcess"
|
|
13
|
+
import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner"
|
|
14
14
|
import TreeSitter, { type SyntaxNode } from "tree-sitter"
|
|
15
15
|
import TreeSitterJavaScript from "tree-sitter-javascript"
|
|
16
16
|
import TreeSitterTypeScript from "tree-sitter-typescript"
|
package/src/Codex.ts
CHANGED
|
@@ -6,10 +6,10 @@ import * as Layer from "effect/Layer"
|
|
|
6
6
|
import * as Struct from "effect/Struct"
|
|
7
7
|
import { CodexAuth } from "./CodexAuth.ts"
|
|
8
8
|
import { AgentModelConfig } from "./Agent.ts"
|
|
9
|
-
import * as Model from "effect/
|
|
10
|
-
import type * as LanguageModel from "effect/
|
|
11
|
-
import type * as Socket from "effect/
|
|
12
|
-
import type * as ResponseIdTracker from "effect/
|
|
9
|
+
import * as Model from "effect/ai/Model"
|
|
10
|
+
import type * as LanguageModel from "effect/ai/LanguageModel"
|
|
11
|
+
import type * as Socket from "effect/socket/Socket"
|
|
12
|
+
import type * as ResponseIdTracker from "effect/ai/ResponseIdTracker"
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @since 1.0.0
|
package/src/CodexAuth.test.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { assert, describe, it } from "@effect/vitest"
|
|
2
2
|
import * as Effect from "effect/Effect"
|
|
3
|
-
import * as
|
|
3
|
+
import * as Base64Url from "effect/encoding/Base64Url"
|
|
4
4
|
import * as Option from "effect/Option"
|
|
5
|
-
import * as KeyValueStore from "effect/
|
|
5
|
+
import * as KeyValueStore from "effect/persistence/KeyValueStore"
|
|
6
6
|
import {
|
|
7
7
|
CodexAuthError,
|
|
8
8
|
STORE_PREFIX,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./CodexAuth.ts"
|
|
18
18
|
|
|
19
19
|
const createJwt = (payload: string): string =>
|
|
20
|
-
`${
|
|
20
|
+
`${Base64Url.encode(JSON.stringify({ alg: "none" }))}.${Base64Url.encode(payload)}.sig`
|
|
21
21
|
|
|
22
22
|
const createTestJwt = (payload: Record<string, unknown>): string =>
|
|
23
23
|
createJwt(JSON.stringify(payload))
|
package/src/CodexAuth.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/** @effect-diagnostics schemaNumber:off */
|
|
5
5
|
import * as Effect from "effect/Effect"
|
|
6
|
-
import * as
|
|
6
|
+
import * as Base64Url from "effect/encoding/Base64Url"
|
|
7
7
|
import * as Function from "effect/Function"
|
|
8
8
|
import * as Layer from "effect/Layer"
|
|
9
9
|
import * as Option from "effect/Option"
|
|
@@ -12,10 +12,10 @@ import * as Schedule from "effect/Schedule"
|
|
|
12
12
|
import * as Schema from "effect/Schema"
|
|
13
13
|
import * as Semaphore from "effect/Semaphore"
|
|
14
14
|
import * as Context from "effect/Context"
|
|
15
|
-
import * as HttpClient from "effect/
|
|
16
|
-
import * as HttpClientRequest from "effect/
|
|
17
|
-
import * as HttpClientResponse from "effect/
|
|
18
|
-
import * as KeyValueStore from "effect/
|
|
15
|
+
import * as HttpClient from "effect/http/HttpClient"
|
|
16
|
+
import * as HttpClientRequest from "effect/http/HttpClientRequest"
|
|
17
|
+
import * as HttpClientResponse from "effect/http/HttpClientResponse"
|
|
18
|
+
import * as KeyValueStore from "effect/persistence/KeyValueStore"
|
|
19
19
|
import { DeviceCodeHandler } from "./DeviceCodeHandler.ts"
|
|
20
20
|
|
|
21
21
|
export const CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann"
|
|
@@ -158,7 +158,7 @@ const decodeJwtPayload = (token: string): Option.Option<string> => {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
return Option.fromNullishOr(
|
|
161
|
-
Result.getOrUndefined(
|
|
161
|
+
Result.getOrUndefined(Base64Url.decodeString(payload)),
|
|
162
162
|
)
|
|
163
163
|
}
|
|
164
164
|
|
package/src/Compaction.test.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { assert, describe, it } from "@effect/vitest"
|
|
2
2
|
import * as Effect from "effect/Effect"
|
|
3
3
|
import * as Option from "effect/Option"
|
|
4
|
-
import * as AiError from "effect/
|
|
5
|
-
import * as Prompt from "effect/
|
|
6
|
-
import * as ResponseIdTracker from "effect/
|
|
4
|
+
import * as AiError from "effect/ai/AiError"
|
|
5
|
+
import * as Prompt from "effect/ai/Prompt"
|
|
6
|
+
import * as ResponseIdTracker from "effect/ai/ResponseIdTracker"
|
|
7
7
|
import * as Compaction from "./Compaction.ts"
|
|
8
8
|
|
|
9
9
|
// -----------------------------------------------------------------------------
|
package/src/Compaction.ts
CHANGED
|
@@ -19,9 +19,9 @@ import * as Layer from "effect/Layer"
|
|
|
19
19
|
import * as Option from "effect/Option"
|
|
20
20
|
import * as Predicate from "effect/Predicate"
|
|
21
21
|
import * as Stream from "effect/Stream"
|
|
22
|
-
import * as AiError from "effect/
|
|
23
|
-
import * as LanguageModel from "effect/
|
|
24
|
-
import * as Prompt from "effect/
|
|
22
|
+
import * as AiError from "effect/ai/AiError"
|
|
23
|
+
import * as LanguageModel from "effect/ai/LanguageModel"
|
|
24
|
+
import * as Prompt from "effect/ai/Prompt"
|
|
25
25
|
import type * as AgentOutput from "./AgentOutput.ts"
|
|
26
26
|
import * as Image from "./Image.ts"
|
|
27
27
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { assert, describe, it } from "@effect/vitest"
|
|
2
2
|
import * as Effect from "effect/Effect"
|
|
3
|
-
import * as
|
|
3
|
+
import * as Base64 from "effect/encoding/Base64"
|
|
4
4
|
import * as Layer from "effect/Layer"
|
|
5
5
|
import * as Option from "effect/Option"
|
|
6
6
|
import * as Stream from "effect/Stream"
|
|
7
|
-
import * as LanguageModel from "effect/
|
|
8
|
-
import * as Prompt from "effect/
|
|
7
|
+
import * as LanguageModel from "effect/ai/LanguageModel"
|
|
8
|
+
import * as Prompt from "effect/ai/Prompt"
|
|
9
9
|
import * as Compaction from "./Compaction.ts"
|
|
10
10
|
import { tinyPng } from "./fixtures/TestImages.ts"
|
|
11
11
|
|
|
12
|
-
const base64 =
|
|
12
|
+
const base64 = Base64.encode(tinyPng)
|
|
13
13
|
|
|
14
14
|
const user = (text: string) =>
|
|
15
15
|
Prompt.makeMessage("user", {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { assert, describe, it } from "@effect/vitest"
|
|
2
|
-
import * as
|
|
2
|
+
import * as Base64 from "effect/encoding/Base64"
|
|
3
3
|
import * as Option from "effect/Option"
|
|
4
4
|
import * as Schema from "effect/Schema"
|
|
5
|
-
import * as Prompt from "effect/
|
|
5
|
+
import * as Prompt from "effect/ai/Prompt"
|
|
6
6
|
import * as Compaction from "./Compaction.ts"
|
|
7
7
|
|
|
8
8
|
const text = (value: string) => Prompt.makePart("text", { text: value })
|
|
@@ -141,7 +141,7 @@ describe("Compaction image token estimates", () => {
|
|
|
141
141
|
if (image.type !== "file") return
|
|
142
142
|
assert.strictEqual(
|
|
143
143
|
image.data,
|
|
144
|
-
|
|
144
|
+
Base64.encode(new Uint8Array(1024).fill(137)),
|
|
145
145
|
)
|
|
146
146
|
assert.strictEqual(
|
|
147
147
|
Compaction.estimateTokens(restored),
|
|
@@ -6,12 +6,12 @@ import * as Exit from "effect/Exit"
|
|
|
6
6
|
import * as Layer from "effect/Layer"
|
|
7
7
|
import * as Option from "effect/Option"
|
|
8
8
|
import * as Stream from "effect/Stream"
|
|
9
|
-
import * as AiError from "effect/
|
|
10
|
-
import * as LanguageModel from "effect/
|
|
11
|
-
import * as Prompt from "effect/
|
|
12
|
-
import * as HttpClient from "effect/
|
|
13
|
-
import type * as HttpClientRequest from "effect/
|
|
14
|
-
import * as HttpClientResponse from "effect/
|
|
9
|
+
import * as AiError from "effect/ai/AiError"
|
|
10
|
+
import * as LanguageModel from "effect/ai/LanguageModel"
|
|
11
|
+
import * as Prompt from "effect/ai/Prompt"
|
|
12
|
+
import * as HttpClient from "effect/http/HttpClient"
|
|
13
|
+
import type * as HttpClientRequest from "effect/http/HttpClientRequest"
|
|
14
|
+
import * as HttpClientResponse from "effect/http/HttpClientResponse"
|
|
15
15
|
import * as Codex from "./Codex.ts"
|
|
16
16
|
import * as Compaction from "./Compaction.ts"
|
|
17
17
|
import * as Copilot from "./Copilot.ts"
|
package/src/Copilot.ts
CHANGED
|
@@ -7,8 +7,8 @@ import * as Struct from "effect/Struct"
|
|
|
7
7
|
import { API_URL, GithubCopilotAuth } from "./CopilotAuth.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
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @since 1.0.0
|
package/src/CopilotAuth.test.ts
CHANGED
|
@@ -4,12 +4,8 @@ import * as Effect from "effect/Effect"
|
|
|
4
4
|
import * as Fiber from "effect/Fiber"
|
|
5
5
|
import * as Option from "effect/Option"
|
|
6
6
|
import * as Ref from "effect/Ref"
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
HttpClientRequest,
|
|
10
|
-
HttpClientResponse,
|
|
11
|
-
} from "effect/unstable/http"
|
|
12
|
-
import * as KeyValueStore from "effect/unstable/persistence/KeyValueStore"
|
|
7
|
+
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http"
|
|
8
|
+
import * as KeyValueStore from "effect/persistence/KeyValueStore"
|
|
13
9
|
import {
|
|
14
10
|
COPILOT_VISION_REQUEST_HEADER,
|
|
15
11
|
DEFAULT_OPENAI_INTENT,
|
package/src/CopilotAuth.ts
CHANGED
|
@@ -10,10 +10,10 @@ import * as Schedule from "effect/Schedule"
|
|
|
10
10
|
import * as Schema from "effect/Schema"
|
|
11
11
|
import * as Semaphore from "effect/Semaphore"
|
|
12
12
|
import * as Context from "effect/Context"
|
|
13
|
-
import * as HttpClient from "effect/
|
|
14
|
-
import * as HttpClientRequest from "effect/
|
|
15
|
-
import * as HttpClientResponse from "effect/
|
|
16
|
-
import * as KeyValueStore from "effect/
|
|
13
|
+
import * as HttpClient from "effect/http/HttpClient"
|
|
14
|
+
import * as HttpClientRequest from "effect/http/HttpClientRequest"
|
|
15
|
+
import * as HttpClientResponse from "effect/http/HttpClientResponse"
|
|
16
|
+
import * as KeyValueStore from "effect/persistence/KeyValueStore"
|
|
17
17
|
import { DeviceCodeHandler } from "./DeviceCodeHandler.ts"
|
|
18
18
|
|
|
19
19
|
export const CLIENT_ID = "Ov23li8tweQw6odWQebz"
|
package/src/GlobalWebSocket.ts
CHANGED
package/src/Image.test.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Photon from "@silvia-odwyer/photon-node"
|
|
2
2
|
import { assert, describe, it } from "@effect/vitest"
|
|
3
3
|
import * as Effect from "effect/Effect"
|
|
4
|
-
import * as
|
|
4
|
+
import * as Base64 from "effect/encoding/Base64"
|
|
5
5
|
import * as Option from "effect/Option"
|
|
6
6
|
import { vi } from "vitest"
|
|
7
7
|
import * as Image from "./Image.ts"
|
|
@@ -32,7 +32,7 @@ const withDecoderSpy = <A, E, R>(
|
|
|
32
32
|
)
|
|
33
33
|
})
|
|
34
34
|
|
|
35
|
-
const base64Length = (bytes: Uint8Array) =>
|
|
35
|
+
const base64Length = (bytes: Uint8Array) => Base64.encode(bytes).length
|
|
36
36
|
|
|
37
37
|
describe("Image.prepare", () => {
|
|
38
38
|
it.effect("passes an in-limit image through unchanged", () =>
|
package/src/Image.ts
CHANGED
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import type * as Photon from "@silvia-odwyer/photon-node"
|
|
16
16
|
import * as Effect from "effect/Effect"
|
|
17
|
-
import * as
|
|
17
|
+
import * as Base64 from "effect/encoding/Base64"
|
|
18
18
|
import type * as FileSystem from "effect/FileSystem"
|
|
19
19
|
import * as Option from "effect/Option"
|
|
20
20
|
import * as Schema from "effect/Schema"
|
|
21
21
|
import * as Stream from "effect/Stream"
|
|
22
|
-
import type * as AiError from "effect/
|
|
23
|
-
import * as Prompt from "effect/
|
|
22
|
+
import type * as AiError from "effect/ai/AiError"
|
|
23
|
+
import * as Prompt from "effect/ai/Prompt"
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* @since 1.0.0
|
|
@@ -677,7 +677,7 @@ export const partBytes = (part: Prompt.FilePart): Option.Option<Uint8Array> => {
|
|
|
677
677
|
const base64 = part.data.startsWith("data:")
|
|
678
678
|
? part.data.slice(part.data.indexOf(",") + 1)
|
|
679
679
|
: part.data
|
|
680
|
-
const decoded =
|
|
680
|
+
const decoded = Base64.decode(base64)
|
|
681
681
|
return decoded._tag === "Success"
|
|
682
682
|
? Option.some(decoded.success)
|
|
683
683
|
: Option.none()
|
package/src/OutputFormatter.ts
CHANGED
|
@@ -9,7 +9,7 @@ import * as Context from "effect/Context"
|
|
|
9
9
|
import * as Stream from "effect/Stream"
|
|
10
10
|
import type { AgentFinished, Output } from "./AgentOutput.ts"
|
|
11
11
|
import chalk from "chalk"
|
|
12
|
-
import type * as Prompt from "effect/
|
|
12
|
+
import type * as Prompt from "effect/ai/Prompt"
|
|
13
13
|
import * as Cause from "effect/Cause"
|
|
14
14
|
import { identity } from "effect/Function"
|
|
15
15
|
import * as Predicate from "effect/Predicate"
|
|
@@ -4,7 +4,7 @@ import * as Effect from "effect/Effect"
|
|
|
4
4
|
import * as Fiber from "effect/Fiber"
|
|
5
5
|
import * as RequestResolver from "effect/RequestResolver"
|
|
6
6
|
import { TestClock } from "effect/testing"
|
|
7
|
-
import type * as EmbeddingModel from "effect/
|
|
7
|
+
import type * as EmbeddingModel from "effect/ai/EmbeddingModel"
|
|
8
8
|
import { makeEmbeddingResolver } from "./SemanticSearch.ts"
|
|
9
9
|
|
|
10
10
|
const baseResolver = RequestResolver.make<EmbeddingModel.EmbeddingRequest>(
|
package/src/SemanticSearch.ts
CHANGED
|
@@ -8,7 +8,7 @@ import * as CodeChunker from "./CodeChunker.ts"
|
|
|
8
8
|
import * as Layer from "effect/Layer"
|
|
9
9
|
import * as Stream from "effect/Stream"
|
|
10
10
|
import { pipe } from "effect/Function"
|
|
11
|
-
import * as EmbeddingModel from "effect/
|
|
11
|
+
import * as EmbeddingModel from "effect/ai/EmbeddingModel"
|
|
12
12
|
import * as RequestResolver from "effect/RequestResolver"
|
|
13
13
|
import * as Option from "effect/Option"
|
|
14
14
|
import * as Path from "effect/Path"
|
|
@@ -16,10 +16,10 @@ import * as Fiber from "effect/Fiber"
|
|
|
16
16
|
import * as Duration from "effect/Duration"
|
|
17
17
|
import * as FiberHandle from "effect/FiberHandle"
|
|
18
18
|
import { SqliteLayer } from "./Sqlite.ts"
|
|
19
|
-
import type * as SqlError from "effect/
|
|
19
|
+
import type * as SqlError from "effect/sql/SqlError"
|
|
20
20
|
import type * as SqliteMigrator from "@effect/sql-sqlite-node/SqliteMigrator"
|
|
21
21
|
import type * as PlatformError from "effect/PlatformError"
|
|
22
|
-
import type * as ChildProcessSpawner from "effect/
|
|
22
|
+
import type * as ChildProcessSpawner from "effect/process/ChildProcessSpawner"
|
|
23
23
|
import type * as FileSystem from "effect/FileSystem"
|
|
24
24
|
import * as Console from "effect/Console"
|
|
25
25
|
import { SemanticSearch } from "./SemanticSearch/Service.ts"
|
package/src/Sqlite.ts
CHANGED
|
@@ -5,7 +5,7 @@ import * as SqliteClient from "@effect/sql-sqlite-node/SqliteClient"
|
|
|
5
5
|
import * as SqliteMigrator from "@effect/sql-sqlite-node/SqliteMigrator"
|
|
6
6
|
import * as Effect from "effect/Effect"
|
|
7
7
|
import * as Layer from "effect/Layer"
|
|
8
|
-
import * as SqlClient from "effect/
|
|
8
|
+
import * as SqlClient from "effect/sql/SqlClient"
|
|
9
9
|
import * as FileSystem from "effect/FileSystem"
|
|
10
10
|
import * as Path from "effect/Path"
|
|
11
11
|
import { getLoadablePath } from "sqlite-vec"
|