@llm4ts/flow 2.54.1 → 3.2.0
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/Activity.d.ts +1 -1
- package/dist/Activity.d.ts.map +1 -1
- package/dist/Activity.js +20 -0
- package/dist/Activity.js.map +1 -1
- package/dist/EstimatedUsage.d.ts.map +1 -1
- package/dist/EstimatedUsage.js +0 -1
- package/dist/EstimatedUsage.js.map +1 -1
- package/dist/Pack.d.ts +11 -0
- package/dist/Pack.d.ts.map +1 -1
- package/dist/Pack.js +2 -0
- package/dist/Pack.js.map +1 -1
- package/dist/Replay.d.ts.map +1 -1
- package/dist/Replay.js +1 -4
- package/dist/Replay.js.map +1 -1
- package/dist/RosterSeats.d.ts.map +1 -1
- package/dist/RosterSeats.js +0 -1
- package/dist/RosterSeats.js.map +1 -1
- package/dist/Timing.d.ts.map +1 -1
- package/dist/Timing.js +0 -1
- package/dist/Timing.js.map +1 -1
- package/dist/Transcript.d.ts.map +1 -1
- package/dist/Transcript.js +0 -1
- package/dist/Transcript.js.map +1 -1
- package/dist/TransientRetry.d.ts.map +1 -1
- package/dist/TransientRetry.js +0 -1
- package/dist/TransientRetry.js.map +1 -1
- package/dist/endpoint/Auth.d.ts +194 -0
- package/dist/endpoint/Auth.d.ts.map +1 -0
- package/dist/endpoint/Auth.js +302 -0
- package/dist/endpoint/Auth.js.map +1 -0
- package/dist/endpoint/Endpoints.d.ts +21 -0
- package/dist/endpoint/Endpoints.d.ts.map +1 -0
- package/dist/endpoint/Endpoints.js +34 -0
- package/dist/endpoint/Endpoints.js.map +1 -0
- package/dist/endpoint/Transport.d.ts +90 -0
- package/dist/endpoint/Transport.d.ts.map +1 -0
- package/dist/endpoint/Transport.js +306 -0
- package/dist/endpoint/Transport.js.map +1 -0
- package/dist/tools/Builtin.d.ts +5 -0
- package/dist/tools/Builtin.d.ts.map +1 -0
- package/dist/tools/Builtin.js +7 -0
- package/dist/tools/Builtin.js.map +1 -0
- package/dist/tools/Diff.d.ts +8 -0
- package/dist/tools/Diff.d.ts.map +1 -0
- package/dist/tools/Diff.js +45 -0
- package/dist/tools/Diff.js.map +1 -0
- package/dist/tools/HttpCall.d.ts +14 -0
- package/dist/tools/HttpCall.d.ts.map +1 -0
- package/dist/tools/HttpCall.js +101 -0
- package/dist/tools/HttpCall.js.map +1 -0
- package/dist/tools/JsonSchemaCheck.d.ts +36 -0
- package/dist/tools/JsonSchemaCheck.d.ts.map +1 -0
- package/dist/tools/JsonSchemaCheck.js +342 -0
- package/dist/tools/JsonSchemaCheck.js.map +1 -0
- package/dist/tools/JsonValidate.d.ts +11 -0
- package/dist/tools/JsonValidate.d.ts.map +1 -0
- package/dist/tools/JsonValidate.js +84 -0
- package/dist/tools/JsonValidate.js.map +1 -0
- package/dist/tools/Tool.d.ts +126 -0
- package/dist/tools/Tool.d.ts.map +1 -0
- package/dist/tools/Tool.js +218 -0
- package/dist/tools/Tool.js.map +1 -0
- package/dist/tools/TreeDiff.d.ts +42 -0
- package/dist/tools/TreeDiff.d.ts.map +1 -0
- package/dist/tools/TreeDiff.js +276 -0
- package/dist/tools/TreeDiff.js.map +1 -0
- package/package.json +12 -4
- package/src/Activity.ts +22 -0
- package/src/EstimatedUsage.ts +0 -1
- package/src/Pack.ts +16 -0
- package/src/Replay.ts +1 -7
- package/src/RosterSeats.ts +0 -2
- package/src/Timing.ts +0 -10
- package/src/Transcript.ts +0 -1
- package/src/TransientRetry.ts +0 -2
- package/src/endpoint/Auth.ts +446 -0
- package/src/endpoint/Endpoints.ts +54 -0
- package/src/endpoint/Transport.ts +456 -0
- package/src/tools/Builtin.ts +10 -0
- package/src/tools/Diff.ts +61 -0
- package/src/tools/HttpCall.ts +124 -0
- package/src/tools/JsonSchemaCheck.ts +457 -0
- package/src/tools/JsonValidate.ts +106 -0
- package/src/tools/Tool.ts +351 -0
- package/src/tools/TreeDiff.ts +386 -0
- package/dist/WorkspaceLayout.d.ts +0 -3
- package/dist/WorkspaceLayout.d.ts.map +0 -1
- package/dist/WorkspaceLayout.js +0 -19
- package/dist/WorkspaceLayout.js.map +0 -1
- package/dist/WorkspaceTools.d.ts +0 -4
- package/dist/WorkspaceTools.d.ts.map +0 -1
- package/dist/WorkspaceTools.js +0 -130
- package/dist/WorkspaceTools.js.map +0 -1
- package/src/WorkspaceLayout.ts +0 -22
- package/src/WorkspaceTools.ts +0 -188
package/src/WorkspaceTools.ts
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect"
|
|
2
|
-
import { ToolExecutionFailed, makeTool, type Tool } from "@llm4ts/core/tools/Tool"
|
|
3
|
-
import { isJsonRecord } from "@llm4ts/core/providers/CliSupport"
|
|
4
|
-
import type { JsonValue } from "@llm4ts/core/providers/CliSupport"
|
|
5
|
-
import type { WorkspaceShape } from "./Workspace.ts"
|
|
6
|
-
|
|
7
|
-
const parameter = (
|
|
8
|
-
parameters: JsonValue,
|
|
9
|
-
name: string
|
|
10
|
-
): Effect.Effect<string, ToolExecutionFailed> => {
|
|
11
|
-
if (!isJsonRecord(parameters)) {
|
|
12
|
-
return Effect.fail(
|
|
13
|
-
ToolExecutionFailed.make({
|
|
14
|
-
message: "tool parameters must be an object"
|
|
15
|
-
})
|
|
16
|
-
)
|
|
17
|
-
}
|
|
18
|
-
const value = parameters[name]
|
|
19
|
-
return typeof value === "string"
|
|
20
|
-
? Effect.succeed(value)
|
|
21
|
-
: Effect.fail(
|
|
22
|
-
ToolExecutionFailed.make({
|
|
23
|
-
message: `parameter '${name}' must be a string`
|
|
24
|
-
})
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const optionalParameter = (
|
|
29
|
-
parameters: JsonValue,
|
|
30
|
-
name: string
|
|
31
|
-
): Effect.Effect<string | undefined, ToolExecutionFailed> => {
|
|
32
|
-
if (!isJsonRecord(parameters)) {
|
|
33
|
-
return Effect.fail(
|
|
34
|
-
ToolExecutionFailed.make({
|
|
35
|
-
message: "tool parameters must be an object"
|
|
36
|
-
})
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
const value = parameters[name]
|
|
40
|
-
return value === undefined || typeof value === "string"
|
|
41
|
-
? Effect.succeed(value)
|
|
42
|
-
: Effect.fail(
|
|
43
|
-
ToolExecutionFailed.make({
|
|
44
|
-
message: `parameter '${name}' must be a string when supplied`
|
|
45
|
-
})
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const mapWorkspaceError = Effect.mapError((error: { readonly message: string }) =>
|
|
50
|
-
ToolExecutionFailed.make({ message: error.message })
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
const pathSchema = {
|
|
54
|
-
type: "object",
|
|
55
|
-
properties: {
|
|
56
|
-
path: { type: "string" }
|
|
57
|
-
},
|
|
58
|
-
required: ["path"],
|
|
59
|
-
additionalProperties: false
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const contentSchema = {
|
|
63
|
-
type: "object",
|
|
64
|
-
properties: {
|
|
65
|
-
path: { type: "string" },
|
|
66
|
-
contents: { type: "string" }
|
|
67
|
-
},
|
|
68
|
-
required: ["path", "contents"],
|
|
69
|
-
additionalProperties: false
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export const workspaceTools = (workspace: WorkspaceShape): ReadonlyArray<Tool> => [
|
|
73
|
-
makeTool({
|
|
74
|
-
name: "workspace_read",
|
|
75
|
-
description: "Read a bounded UTF-8 file under the workspace root",
|
|
76
|
-
parameters: pathSchema,
|
|
77
|
-
tags: ["file", "read", "workspace"],
|
|
78
|
-
sandbox: "WorkspaceReadOnly",
|
|
79
|
-
execute: (parameters) =>
|
|
80
|
-
Effect.all({
|
|
81
|
-
path: parameter(parameters, "path")
|
|
82
|
-
}).pipe(
|
|
83
|
-
Effect.flatMap(({ path }) => workspace.read(path)),
|
|
84
|
-
mapWorkspaceError
|
|
85
|
-
)
|
|
86
|
-
}),
|
|
87
|
-
makeTool({
|
|
88
|
-
name: "workspace_write",
|
|
89
|
-
description: "Write bounded UTF-8 content under the workspace root",
|
|
90
|
-
parameters: contentSchema,
|
|
91
|
-
tags: ["file", "write", "workspace"],
|
|
92
|
-
execute: (parameters) =>
|
|
93
|
-
Effect.all({
|
|
94
|
-
path: parameter(parameters, "path"),
|
|
95
|
-
contents: parameter(parameters, "contents")
|
|
96
|
-
}).pipe(
|
|
97
|
-
Effect.flatMap(({ path, contents }) => workspace.write(path, contents)),
|
|
98
|
-
mapWorkspaceError,
|
|
99
|
-
Effect.as({ written: true })
|
|
100
|
-
)
|
|
101
|
-
}),
|
|
102
|
-
makeTool({
|
|
103
|
-
name: "workspace_append",
|
|
104
|
-
description: "Append bounded UTF-8 content under the workspace root",
|
|
105
|
-
parameters: contentSchema,
|
|
106
|
-
tags: ["file", "append", "workspace"],
|
|
107
|
-
execute: (parameters) =>
|
|
108
|
-
Effect.all({
|
|
109
|
-
path: parameter(parameters, "path"),
|
|
110
|
-
contents: parameter(parameters, "contents")
|
|
111
|
-
}).pipe(
|
|
112
|
-
Effect.flatMap(({ path, contents }) => workspace.append(path, contents)),
|
|
113
|
-
mapWorkspaceError,
|
|
114
|
-
Effect.as({ appended: true })
|
|
115
|
-
)
|
|
116
|
-
}),
|
|
117
|
-
makeTool({
|
|
118
|
-
name: "workspace_discover",
|
|
119
|
-
description: "Discover files under the workspace root using a bounded glob",
|
|
120
|
-
parameters: {
|
|
121
|
-
type: "object",
|
|
122
|
-
properties: {
|
|
123
|
-
pattern: { type: "string" }
|
|
124
|
-
},
|
|
125
|
-
additionalProperties: false
|
|
126
|
-
},
|
|
127
|
-
tags: ["file", "glob", "discover", "workspace"],
|
|
128
|
-
sandbox: "WorkspaceReadOnly",
|
|
129
|
-
execute: (parameters) =>
|
|
130
|
-
optionalParameter(parameters, "pattern").pipe(
|
|
131
|
-
Effect.flatMap((pattern) => workspace.discover(pattern)),
|
|
132
|
-
mapWorkspaceError,
|
|
133
|
-
Effect.map((paths) => [...paths])
|
|
134
|
-
)
|
|
135
|
-
}),
|
|
136
|
-
makeTool({
|
|
137
|
-
name: "workspace_search",
|
|
138
|
-
description: "Search bounded workspace files for literal text",
|
|
139
|
-
parameters: {
|
|
140
|
-
type: "object",
|
|
141
|
-
properties: {
|
|
142
|
-
query: { type: "string" },
|
|
143
|
-
pattern: { type: "string" }
|
|
144
|
-
},
|
|
145
|
-
required: ["query"],
|
|
146
|
-
additionalProperties: false
|
|
147
|
-
},
|
|
148
|
-
tags: ["file", "search", "workspace"],
|
|
149
|
-
sandbox: "WorkspaceReadOnly",
|
|
150
|
-
execute: (parameters) =>
|
|
151
|
-
Effect.all({
|
|
152
|
-
query: parameter(parameters, "query"),
|
|
153
|
-
pattern: optionalParameter(parameters, "pattern")
|
|
154
|
-
}).pipe(
|
|
155
|
-
Effect.flatMap(({ pattern, query }) => workspace.search(query, pattern)),
|
|
156
|
-
mapWorkspaceError,
|
|
157
|
-
Effect.map((matches) =>
|
|
158
|
-
matches.map((match) => ({
|
|
159
|
-
path: match.path,
|
|
160
|
-
line: match.line,
|
|
161
|
-
text: match.text
|
|
162
|
-
}))
|
|
163
|
-
)
|
|
164
|
-
)
|
|
165
|
-
}),
|
|
166
|
-
makeTool({
|
|
167
|
-
name: "workspace_validate_json",
|
|
168
|
-
description: "Validate that a bounded workspace file contains JSON",
|
|
169
|
-
parameters: pathSchema,
|
|
170
|
-
tags: ["file", "validate", "json", "workspace"],
|
|
171
|
-
sandbox: "WorkspaceReadOnly",
|
|
172
|
-
execute: (parameters) =>
|
|
173
|
-
parameter(parameters, "path").pipe(
|
|
174
|
-
Effect.flatMap((path) => workspace.read(path)),
|
|
175
|
-
mapWorkspaceError,
|
|
176
|
-
Effect.flatMap((contents) =>
|
|
177
|
-
Effect.try({
|
|
178
|
-
try: () => JSON.parse(contents),
|
|
179
|
-
catch: (error) =>
|
|
180
|
-
ToolExecutionFailed.make({
|
|
181
|
-
message: `invalid JSON: ${String(error)}`
|
|
182
|
-
})
|
|
183
|
-
})
|
|
184
|
-
),
|
|
185
|
-
Effect.as({ valid: true })
|
|
186
|
-
)
|
|
187
|
-
})
|
|
188
|
-
]
|