@effect/chat-teams 0.0.0 → 4.1.5
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/AGENTS.md +434 -0
- package/CLAUDE.md +434 -0
- package/LICENSE +21 -0
- package/README.md +116 -0
- package/ai-docs/README.md +44 -0
- package/ai-docs/package.json +36 -0
- package/ai-docs/src/01_effect/01_basics/01_effect-gen.ts +30 -0
- package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +52 -0
- package/ai-docs/src/01_effect/01_basics/10_creating-effects.ts +74 -0
- package/ai-docs/src/01_effect/01_basics/index.md +7 -0
- package/ai-docs/src/01_effect/02_schema/10_schema-basics.ts +43 -0
- package/ai-docs/src/01_effect/02_schema/index.md +7 -0
- package/ai-docs/src/01_effect/03_services/01_service.ts +45 -0
- package/ai-docs/src/01_effect/03_services/10_reference.ts +10 -0
- package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +70 -0
- package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +66 -0
- package/ai-docs/src/01_effect/03_services/index.md +5 -0
- package/ai-docs/src/01_effect/04_errors/01_error-handling.ts +30 -0
- package/ai-docs/src/01_effect/04_errors/10_catch-tags.ts +24 -0
- package/ai-docs/src/01_effect/04_errors/20_reason-errors.ts +64 -0
- package/ai-docs/src/01_effect/04_errors/index.md +1 -0
- package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +105 -0
- package/ai-docs/src/01_effect/05_resources/20_layer-side-effects.ts +31 -0
- package/ai-docs/src/01_effect/05_resources/30_layer-map.ts +86 -0
- package/ai-docs/src/01_effect/05_resources/index.md +3 -0
- package/ai-docs/src/01_effect/06_running/10_run-main.ts +30 -0
- package/ai-docs/src/01_effect/06_running/20_layer-launch.ts +27 -0
- package/ai-docs/src/01_effect/06_running/index.md +1 -0
- package/ai-docs/src/01_effect/07_pubsub/10_pubsub.ts +56 -0
- package/ai-docs/src/01_effect/07_pubsub/index.md +3 -0
- package/ai-docs/src/03_stream/10_creating-streams.ts +103 -0
- package/ai-docs/src/03_stream/20_consuming-streams.ts +137 -0
- package/ai-docs/src/03_stream/30_encoding.ts +163 -0
- package/ai-docs/src/03_stream/index.md +4 -0
- package/ai-docs/src/04_integration/10_managed-runtime.ts +129 -0
- package/ai-docs/src/04_integration/index.md +5 -0
- package/ai-docs/src/05_batching/10_request-resolver.ts +89 -0
- package/ai-docs/src/05_batching/index.md +3 -0
- package/ai-docs/src/06_schedule/10_schedules.ts +111 -0
- package/ai-docs/src/06_schedule/index.md +3 -0
- package/ai-docs/src/07_datetime/10_creating-and-formatting.ts +30 -0
- package/ai-docs/src/07_datetime/20_time-zones.ts +44 -0
- package/ai-docs/src/07_datetime/index.md +5 -0
- package/ai-docs/src/08_observability/10_logging.ts +66 -0
- package/ai-docs/src/08_observability/20_otlp-tracing.ts +95 -0
- package/ai-docs/src/08_observability/index.md +7 -0
- package/ai-docs/src/09_testing/10_effect-tests.ts +55 -0
- package/ai-docs/src/09_testing/20_layer-tests.ts +138 -0
- package/ai-docs/src/09_testing/index.md +1 -0
- package/ai-docs/src/10_predicate/01_basics.ts +14 -0
- package/ai-docs/src/10_predicate/index.md +9 -0
- package/ai-docs/src/40_sql/10_basics.ts +175 -0
- package/ai-docs/src/40_sql/index.md +6 -0
- package/ai-docs/src/50_http-client/10_basics.ts +102 -0
- package/ai-docs/src/50_http-client/index.md +3 -0
- package/ai-docs/src/51_http-server/10_basics.ts +118 -0
- package/ai-docs/src/51_http-server/20_testing.ts +100 -0
- package/ai-docs/src/51_http-server/fixtures/api/Api.ts +14 -0
- package/ai-docs/src/51_http-server/fixtures/api/Authorization.ts +36 -0
- package/ai-docs/src/51_http-server/fixtures/api/System.ts +10 -0
- package/ai-docs/src/51_http-server/fixtures/api/Users.ts +107 -0
- package/ai-docs/src/51_http-server/fixtures/domain/User.ts +21 -0
- package/ai-docs/src/51_http-server/fixtures/domain/UserErrors.ts +22 -0
- package/ai-docs/src/51_http-server/fixtures/server/Authorization.ts +37 -0
- package/ai-docs/src/51_http-server/fixtures/server/Users/http.ts +80 -0
- package/ai-docs/src/51_http-server/fixtures/server/Users.ts +183 -0
- package/ai-docs/src/51_http-server/index.md +3 -0
- package/ai-docs/src/52_graphql/10_basics.ts +117 -0
- package/ai-docs/src/52_graphql/20_testing.ts +45 -0
- package/ai-docs/src/52_graphql/30_batching.ts +118 -0
- package/ai-docs/src/52_graphql/40_aliased-batching.ts +124 -0
- package/ai-docs/src/52_graphql/50_errors-and-retries.ts +74 -0
- package/ai-docs/src/52_graphql/index.md +6 -0
- package/ai-docs/src/60_child-process/10_working-with-child-processes.ts +117 -0
- package/ai-docs/src/60_child-process/index.md +3 -0
- package/ai-docs/src/70_cli/10_basics.ts +162 -0
- package/ai-docs/src/70_cli/index.md +5 -0
- package/ai-docs/src/71_ai/10_language-model.ts +156 -0
- package/ai-docs/src/71_ai/20_tools.ts +226 -0
- package/ai-docs/src/71_ai/30_chat.ts +158 -0
- package/ai-docs/src/71_ai/fixtures/domain/LaunchPlan.ts +9 -0
- package/ai-docs/src/71_ai/index.md +5 -0
- package/ai-docs/src/80_cluster/10_entities.ts +97 -0
- package/ai-docs/src/80_cluster/index.md +4 -0
- package/ai-docs/src/index.md +10 -0
- package/ai-docs/tsconfig.json +28 -0
- package/dist/TeamsChat.d.ts +318 -0
- package/dist/TeamsChat.d.ts.map +1 -0
- package/dist/TeamsChat.js +316 -0
- package/dist/TeamsChat.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/adapter.d.ts +2 -0
- package/dist/internal/adapter.d.ts.map +1 -0
- package/dist/internal/adapter.js +300 -0
- package/dist/internal/adapter.js.map +1 -0
- package/dist/internal/address.d.ts +2 -0
- package/dist/internal/address.d.ts.map +1 -0
- package/dist/internal/address.js +52 -0
- package/dist/internal/address.js.map +1 -0
- package/dist/internal/auth.d.ts +2 -0
- package/dist/internal/auth.d.ts.map +1 -0
- package/dist/internal/auth.js +142 -0
- package/dist/internal/auth.js.map +1 -0
- package/dist/internal/connector.d.ts +2 -0
- package/dist/internal/connector.d.ts.map +1 -0
- package/dist/internal/connector.js +173 -0
- package/dist/internal/connector.js.map +1 -0
- package/dist/internal/download.d.ts +5 -0
- package/dist/internal/download.d.ts.map +1 -0
- package/dist/internal/download.js +183 -0
- package/dist/internal/download.js.map +1 -0
- package/dist/internal/envelope.d.ts +2 -0
- package/dist/internal/envelope.d.ts.map +1 -0
- package/dist/internal/envelope.js +337 -0
- package/dist/internal/envelope.js.map +1 -0
- package/dist/internal/errors.d.ts +2 -0
- package/dist/internal/errors.d.ts.map +1 -0
- package/dist/internal/errors.js +113 -0
- package/dist/internal/errors.js.map +1 -0
- package/dist/internal/interactions.d.ts +2 -0
- package/dist/internal/interactions.d.ts.map +1 -0
- package/dist/internal/interactions.js +288 -0
- package/dist/internal/interactions.js.map +1 -0
- package/dist/internal/length.d.ts +2 -0
- package/dist/internal/length.d.ts.map +1 -0
- package/dist/internal/length.js +147 -0
- package/dist/internal/length.js.map +1 -0
- package/dist/internal/normalize.d.ts +2 -0
- package/dist/internal/normalize.d.ts.map +1 -0
- package/dist/internal/normalize.js +224 -0
- package/dist/internal/normalize.js.map +1 -0
- package/dist/internal/parse.d.ts +2 -0
- package/dist/internal/parse.d.ts.map +1 -0
- package/dist/internal/parse.js +33 -0
- package/dist/internal/parse.js.map +1 -0
- package/dist/internal/render.d.ts +2 -0
- package/dist/internal/render.d.ts.map +1 -0
- package/dist/internal/render.js +316 -0
- package/dist/internal/render.js.map +1 -0
- package/dist/internal/webhook.d.ts +2 -0
- package/dist/internal/webhook.d.ts.map +1 -0
- package/dist/internal/webhook.js +88 -0
- package/dist/internal/webhook.js.map +1 -0
- package/package.json +61 -1
- package/src/TeamsChat.ts +470 -0
- package/src/index.ts +12 -0
- package/src/internal/adapter.ts +351 -0
- package/src/internal/address.ts +67 -0
- package/src/internal/auth.ts +192 -0
- package/src/internal/connector.ts +253 -0
- package/src/internal/download.ts +277 -0
- package/src/internal/envelope.ts +427 -0
- package/src/internal/errors.ts +94 -0
- package/src/internal/interactions.ts +294 -0
- package/src/internal/length.ts +170 -0
- package/src/internal/normalize.ts +232 -0
- package/src/internal/parse.ts +41 -0
- package/src/internal/render.ts +318 -0
- package/src/internal/webhook.ts +117 -0
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
# Effect library documentation
|
|
2
|
+
|
|
3
|
+
This documentation covers the Effect library and its related packages.
|
|
4
|
+
|
|
5
|
+
When you need to find information about Effect, use this documentation and the
|
|
6
|
+
Effect source code available in your environment. Avoid unrelated copies of
|
|
7
|
+
Effect or external documentation, as they may be outdated or incorrect.
|
|
8
|
+
|
|
9
|
+
**Note**: The examples in this documentation contain comments for illustration
|
|
10
|
+
purposes. In practice, you would not include these comments in your code.
|
|
11
|
+
|
|
12
|
+
## Writing `Effect` code
|
|
13
|
+
|
|
14
|
+
Prefer `Effect.gen` for inline Effect code. For reusable functions, prefer
|
|
15
|
+
`Effect.fn("name")` when tracing is useful and `Effect.fnUntraced` when it is not,
|
|
16
|
+
particularly in library implementations and hot paths. Avoid functions that only
|
|
17
|
+
wrap and return `Effect.gen`. Attach additional behaviour with combinators; this
|
|
18
|
+
style is more readable and easier to maintain than using combinators alone.
|
|
19
|
+
|
|
20
|
+
### Using Effect.gen
|
|
21
|
+
|
|
22
|
+
Use `Effect.gen` to write code in an imperative style similar to async await.
|
|
23
|
+
You can use `yield*` to access the result of an effect.
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { Effect, Schema } from "effect"
|
|
27
|
+
|
|
28
|
+
Effect.gen(function*() {
|
|
29
|
+
yield* Effect.log("Starting the file processing...")
|
|
30
|
+
yield* Effect.log("Reading file...")
|
|
31
|
+
|
|
32
|
+
// Always return when raising an error, to ensure typescript understands that
|
|
33
|
+
// the function will not continue executing.
|
|
34
|
+
return yield* new FileProcessingError({ message: "Failed to read the file" })
|
|
35
|
+
}).pipe(
|
|
36
|
+
// Add additional functionality with .pipe
|
|
37
|
+
Effect.catch((error) => Effect.logError(`An error occurred: ${error}`)),
|
|
38
|
+
Effect.withSpan("fileProcessing", {
|
|
39
|
+
attributes: {
|
|
40
|
+
method: "Effect.gen"
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
// Use Schema.TaggedError to define a custom error
|
|
46
|
+
export class FileProcessingError extends Schema.TaggedError<FileProcessingError>()("FileProcessingError", {
|
|
47
|
+
message: Schema.String
|
|
48
|
+
}) {}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Using Effect.fn and Effect.fnUntraced
|
|
52
|
+
|
|
53
|
+
When writing reusable functions that return an Effect, use `Effect.fn` or
|
|
54
|
+
`Effect.fnUntraced` to use the generator syntax.
|
|
55
|
+
|
|
56
|
+
Use `Effect.fn("name")` when the function should create a tracing span. Prefer
|
|
57
|
+
`Effect.fnUntraced` when tracing is not needed, particularly for library
|
|
58
|
+
implementations and hot paths.
|
|
59
|
+
|
|
60
|
+
**Avoid creating functions that only wrap and return an `Effect.gen`**.
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import { Effect, Schema } from "effect"
|
|
64
|
+
|
|
65
|
+
// Pass a string to Effect.fn, which will improve stack traces and also
|
|
66
|
+
// attach a tracing span (using Effect.withSpan behind the scenes).
|
|
67
|
+
//
|
|
68
|
+
// The name string should match the function name.
|
|
69
|
+
//
|
|
70
|
+
export const effectFunction = Effect.fn("effectFunction")(
|
|
71
|
+
// You can use `Effect.fn.Return` to specify the return type of the function.
|
|
72
|
+
// It accepts the same type parameters as `Effect.Effect`.
|
|
73
|
+
function*(n: number): Effect.fn.Return<string, SomeError> {
|
|
74
|
+
yield* Effect.logInfo("Received number:", n)
|
|
75
|
+
|
|
76
|
+
// Always return when raising an error, to ensure typescript understands that
|
|
77
|
+
// the function will not continue executing.
|
|
78
|
+
return yield* new SomeError({ message: "Failed to read the file" })
|
|
79
|
+
},
|
|
80
|
+
// Add additional functionality by passing in additional arguments.
|
|
81
|
+
// **Do not** use .pipe with Effect.fn
|
|
82
|
+
Effect.catch((error) => Effect.logError(`An error occurred: ${error}`)),
|
|
83
|
+
Effect.annotateLogs({
|
|
84
|
+
method: "effectFunction"
|
|
85
|
+
})
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
// Effect.fnUntraced avoids tracing and stack-frame capture while still reusing
|
|
89
|
+
// the generator body. This is preferred for library functions that do not
|
|
90
|
+
// represent a useful tracing boundary.
|
|
91
|
+
export const validateBatchSize = Effect.fnUntraced(function*(size: number): Effect.fn.Return<number, SomeError> {
|
|
92
|
+
if (!Number.isInteger(size) || size <= 0) {
|
|
93
|
+
return yield* new SomeError({ message: "Batch size must be a positive integer" })
|
|
94
|
+
}
|
|
95
|
+
return size
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
// Use Schema.TaggedError to define a custom error
|
|
99
|
+
export class SomeError extends Schema.TaggedError<SomeError>()("SomeError", {
|
|
100
|
+
message: Schema.String
|
|
101
|
+
}) {}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### More examples
|
|
105
|
+
|
|
106
|
+
- **[Creating effects from common sources](./ai-docs/src/01_effect/01_basics/10_creating-effects.ts)**:
|
|
107
|
+
Learn how to create effects from various sources, including plain values,
|
|
108
|
+
synchronous code, Promise APIs, optional values, and callback-based APIs.
|
|
109
|
+
|
|
110
|
+
## Defining schemas and domain models
|
|
111
|
+
|
|
112
|
+
All validation and domain modeling in Effect is done with `Schema`.
|
|
113
|
+
|
|
114
|
+
**AVOID using predicates or manual parsing**, instead use `Schema` to parse untrusted data and validate it.
|
|
115
|
+
|
|
116
|
+
For a comprehensive guide, see [SCHEMA.md](https://github.com/Effect-TS/effect/blob/main/packages/effect/SCHEMA.md). Make sure to read the guide in chunks, as it is a large document.
|
|
117
|
+
|
|
118
|
+
- **[Schema basics](./ai-docs/src/01_effect/02_schema/10_schema-basics.ts)**:
|
|
119
|
+
Define `Schema.Class`s, decode unknown input into typed values, and
|
|
120
|
+
encode typed values back into their external representation.
|
|
121
|
+
|
|
122
|
+
## Writing Effect services
|
|
123
|
+
|
|
124
|
+
Effect services are the most common way to structure Effect code. Prefer using
|
|
125
|
+
services to encapsulate behaviour over other approaches, as it ensures that your
|
|
126
|
+
code is modular, testable, and maintainable.
|
|
127
|
+
|
|
128
|
+
### Context.Service
|
|
129
|
+
|
|
130
|
+
The default way to define a service is to extend `Context.Service`,
|
|
131
|
+
passing in the service interface as a type parameter.
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
// file: src/db/Database.ts
|
|
135
|
+
import { Context, Effect, Layer, Schema } from "effect"
|
|
136
|
+
|
|
137
|
+
// Pass in the service class name as the first type parameter, and the service
|
|
138
|
+
// interface as the second type parameter.
|
|
139
|
+
export class Database extends Context.Service<Database, {
|
|
140
|
+
query(sql: string): Effect.Effect<Array<unknown>, DatabaseError>
|
|
141
|
+
}>()(
|
|
142
|
+
// The string identifier for the service, which should include the package
|
|
143
|
+
// name and the subdirectory path to the service file.
|
|
144
|
+
"myapp/db/Database"
|
|
145
|
+
) {
|
|
146
|
+
// Attach a static layer to the service, which will be used to provide an
|
|
147
|
+
// implementation of the service.
|
|
148
|
+
static readonly layer = Layer.effect(
|
|
149
|
+
Database,
|
|
150
|
+
Effect.gen(function*() {
|
|
151
|
+
// Define the service methods using Effect.fn
|
|
152
|
+
const query = Effect.fn("Database.query")(function*(sql: string) {
|
|
153
|
+
yield* Effect.log("Executing SQL query:", sql)
|
|
154
|
+
return [{ id: 1, name: "Alice" }, { id: 2, name: "Bob" }]
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
// Return an instance of the service using Database.of, passing in an
|
|
158
|
+
// object that implements the service interface.
|
|
159
|
+
return Database.of({
|
|
160
|
+
query
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export class DatabaseError extends Schema.TaggedError<DatabaseError>()("DatabaseError", {
|
|
167
|
+
cause: Schema.Defect()
|
|
168
|
+
}) {}
|
|
169
|
+
|
|
170
|
+
// If you ever need to access the service type, use `Database["Service"]`
|
|
171
|
+
export type DatabaseService = Database["Service"]
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### More examples
|
|
175
|
+
|
|
176
|
+
- **[Context.Reference](./ai-docs/src/01_effect/03_services/10_reference.ts)**: For defining configuration values, feature flags, or any other service that has a default value.
|
|
177
|
+
- **[Composing services with the Layer module](./ai-docs/src/01_effect/03_services/20_layer-composition.ts)**:
|
|
178
|
+
Build focused service layers, then compose them with `Layer.provide` and
|
|
179
|
+
`Layer.provideMerge` based on what services you want to expose.
|
|
180
|
+
- **[Creating Layers from configuration and/or Effects](./ai-docs/src/01_effect/03_services/20_layer-unwrap.ts)**: Build a layer dynamically from an Effect / Config with `Layer.unwrap`.
|
|
181
|
+
|
|
182
|
+
## Error handling
|
|
183
|
+
|
|
184
|
+
### Error handling basics
|
|
185
|
+
|
|
186
|
+
Defining custom errors and handling them with Effect.catch and Effect.catchTag.
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
import { Effect, Schema } from "effect"
|
|
190
|
+
|
|
191
|
+
// Define custom errors using Schema.TaggedError
|
|
192
|
+
export class ParseError extends Schema.TaggedError<ParseError>()("ParseError", {
|
|
193
|
+
input: Schema.String,
|
|
194
|
+
message: Schema.String
|
|
195
|
+
}) {}
|
|
196
|
+
|
|
197
|
+
export class ReservedPortError extends Schema.TaggedError<ReservedPortError>()("ReservedPortError", {
|
|
198
|
+
port: Schema.Int
|
|
199
|
+
}) {}
|
|
200
|
+
|
|
201
|
+
declare const loadPort: (input: string) => Effect.Effect<number, ParseError | ReservedPortError>
|
|
202
|
+
|
|
203
|
+
export const recovered = loadPort("80").pipe(
|
|
204
|
+
// Catch multiple errors with Effect.catchTag, and return a default port number.
|
|
205
|
+
Effect.catchTag(["ParseError", "ReservedPortError"], (_) => Effect.succeed(3000))
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
export const withFinalFallback = loadPort("invalid").pipe(
|
|
209
|
+
// Catch a specific error with Effect.catchTag
|
|
210
|
+
Effect.catchTag("ReservedPortError", (_) => Effect.succeed(3000)),
|
|
211
|
+
// Catch all errors with Effect.catch
|
|
212
|
+
Effect.catch((_) => Effect.succeed(3000))
|
|
213
|
+
)
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### More examples
|
|
217
|
+
|
|
218
|
+
- **[Catch multiple errors with Effect.catchTags](./ai-docs/src/01_effect/04_errors/10_catch-tags.ts)**: Use `Effect.catchTags` to handle several tagged errors in one place.
|
|
219
|
+
- **[Creating and handling errors with reasons](./ai-docs/src/01_effect/04_errors/20_reason-errors.ts)**:
|
|
220
|
+
Define a tagged error with a tagged `reason` field, then recover with
|
|
221
|
+
`Effect.catchReason`, `Effect.catchReasons`, or by unwrapping the reason into
|
|
222
|
+
the error channel with `Effect.unwrapReason`.
|
|
223
|
+
|
|
224
|
+
## Managing resources and `Scope`s
|
|
225
|
+
|
|
226
|
+
Learn how to safely manage resources in Effect using `Scope`s and finalizers.
|
|
227
|
+
|
|
228
|
+
- **[Acquiring resources with Effect.acquireRelease](./ai-docs/src/01_effect/05_resources/10_acquire-release.ts)**:
|
|
229
|
+
Define a service that uses `Effect.acquireRelease` to manage the lifecycle of
|
|
230
|
+
a resource, ensuring that it is properly cleaned up when the service is no
|
|
231
|
+
longer needed.
|
|
232
|
+
- **[Creating Layers that run background tasks](./ai-docs/src/01_effect/05_resources/20_layer-side-effects.ts)**: Use Layer.effectDiscard to encapsulate background tasks without a service interface.
|
|
233
|
+
- **[Dynamic resources with LayerMap](./ai-docs/src/01_effect/05_resources/30_layer-map.ts)**:
|
|
234
|
+
Use `LayerMap.Service` to dynamically build and manage resources that are
|
|
235
|
+
keyed by some identifier, such as a tenant ID.
|
|
236
|
+
|
|
237
|
+
## Running Effect programs
|
|
238
|
+
|
|
239
|
+
- **[Running effects with NodeRuntime and BunRuntime](./ai-docs/src/01_effect/06_running/10_run-main.ts)**: Use `NodeRuntime.runMain` to run an Effect program as your process entrypoint.
|
|
240
|
+
- **[Using Layer.launch as the application entry point](./ai-docs/src/01_effect/06_running/20_layer-launch.ts)**: Use `Layer.launch` to run a long-running Effect program as your process entrypoint.
|
|
241
|
+
|
|
242
|
+
## Broadcasting messages with PubSub
|
|
243
|
+
|
|
244
|
+
Use `PubSub` when you need one producer to fan out messages to many consumers.
|
|
245
|
+
|
|
246
|
+
- **[Broadcasting domain events with PubSub](./ai-docs/src/01_effect/07_pubsub/10_pubsub.ts)**: Build an in-process event bus with `PubSub` and expose it as a service.
|
|
247
|
+
|
|
248
|
+
## Working with Streams
|
|
249
|
+
|
|
250
|
+
Effect Streams represent effectful, pull-based sequences of values over time.
|
|
251
|
+
They let you model finite or infinite data sources.
|
|
252
|
+
|
|
253
|
+
- **[Creating streams from common data sources](./ai-docs/src/03_stream/10_creating-streams.ts)**:
|
|
254
|
+
Learn how to create streams from various data sources. Includes:
|
|
255
|
+
|
|
256
|
+
- `Stream.fromIterable` for arrays and other iterables
|
|
257
|
+
- `Stream.fromEffectSchedule` for polling effects
|
|
258
|
+
- `Stream.paginate` for paginated APIs
|
|
259
|
+
- `Stream.fromAsyncIterable` for async iterables
|
|
260
|
+
- `Stream.fromEventListener` for DOM events
|
|
261
|
+
- `Stream.callback` for any callback-based API
|
|
262
|
+
- `NodeStream.fromReadable` for Node.js readable streams
|
|
263
|
+
- **[Consuming and transforming streams](./ai-docs/src/03_stream/20_consuming-streams.ts)**: How to transform and consume streams using operators like `map`, `flatMap`, `filter`, `mapEffect`, and various `run*` methods.
|
|
264
|
+
- **[Decoding and encoding streams](./ai-docs/src/03_stream/30_encoding.ts)**:
|
|
265
|
+
Use `Stream.pipeThroughChannel` with the `Ndjson` and `SchemaBinary` modules to
|
|
266
|
+
decode and encode streams of structured data.
|
|
267
|
+
|
|
268
|
+
## Integrating Effect into existing applications
|
|
269
|
+
|
|
270
|
+
`ManagedRuntime` bridges Effect programs with non-Effect code. Build one runtime
|
|
271
|
+
from your application Layer, then use it anywhere you need imperative execution,
|
|
272
|
+
like web handlers, framework hooks, worker queues, or legacy callback APIs.
|
|
273
|
+
|
|
274
|
+
- **[Using ManagedRuntime with Hono](./ai-docs/src/04_integration/10_managed-runtime.ts)**: Use `ManagedRuntime` to run Effect programs from external frameworks while keeping your domain logic in services and Layers.
|
|
275
|
+
|
|
276
|
+
## Batching external requests
|
|
277
|
+
|
|
278
|
+
Learn how to batch multiple requests into fewer external calls.
|
|
279
|
+
|
|
280
|
+
- **[Batching requests with RequestResolver](./ai-docs/src/05_batching/10_request-resolver.ts)**: Define request types with `Request.Class`, resolve them in batches with `RequestResolver`.
|
|
281
|
+
|
|
282
|
+
## Working with Schedules
|
|
283
|
+
|
|
284
|
+
Schedules define recurring patterns for retries, repeats and polling.
|
|
285
|
+
|
|
286
|
+
- **[Working with the Schedule module](./ai-docs/src/06_schedule/10_schedules.ts)**: Build schedules, compose them, and use them with `Effect.retry` and `Effect.repeat`.
|
|
287
|
+
|
|
288
|
+
## Working with DateTime
|
|
289
|
+
|
|
290
|
+
When working with dates and time, use the `DateTime` module instead of `Date` and `Date.now`.
|
|
291
|
+
|
|
292
|
+
Use it when your Effect programs need testable current time, safe parsing, stable ISO formatting, time-zone conversion, or calendar arithmetic.
|
|
293
|
+
|
|
294
|
+
- **[Creating and formatting DateTime values](./ai-docs/src/07_datetime/10_creating-and-formatting.ts)**:
|
|
295
|
+
Parse incoming date values safely, use Clock-powered current time, and format
|
|
296
|
+
instants for API payloads or user-facing labels.
|
|
297
|
+
- **[Working with time zones](./ai-docs/src/07_datetime/20_time-zones.ts)**:
|
|
298
|
+
Attach IANA zones to instants, render zoned ISO strings, and provide a
|
|
299
|
+
CurrentTimeZone service for code that should use the workspace/user zone.
|
|
300
|
+
|
|
301
|
+
## Observability
|
|
302
|
+
|
|
303
|
+
Effect has built-in support for structured logging, distributed tracing, and
|
|
304
|
+
metrics. For exporting telemetry, use the lightweight Otlp modules from
|
|
305
|
+
`effect/observability` in new projects, or use
|
|
306
|
+
`@effect/opentelemetry` NodeSdk when integrating with an existing OpenTelemetry
|
|
307
|
+
setup.
|
|
308
|
+
|
|
309
|
+
- **[Customizing logging](./ai-docs/src/08_observability/10_logging.ts)**: Configure loggers & log-level filtering for production applications.
|
|
310
|
+
- **[Setting up tracing with Otlp modules](./ai-docs/src/08_observability/20_otlp-tracing.ts)**: Configure Otlp tracing + log export with a reusable observability layer.
|
|
311
|
+
|
|
312
|
+
## Testing Effect programs
|
|
313
|
+
|
|
314
|
+
- **[Writing Effect tests with @effect/vitest](./ai-docs/src/09_testing/10_effect-tests.ts)**: Using `it.effect` for Effect-based tests.
|
|
315
|
+
- **[Testing services with shared layers](./ai-docs/src/09_testing/20_layer-tests.ts)**: How to test Effect services that depend on other services.
|
|
316
|
+
|
|
317
|
+
## Runtime type guards
|
|
318
|
+
|
|
319
|
+
The `Predicate` module contains small, reusable runtime checks.
|
|
320
|
+
|
|
321
|
+
**NEVER** write your own helper functions like `isRecord` or `isString`, instead
|
|
322
|
+
use the helpers from the `Predicate` module.
|
|
323
|
+
|
|
324
|
+
Predicates can be composed with apis such as `Predicate.and`,
|
|
325
|
+
`Predicate.or`, `Predicate.not`, and `Predicate.compose`.
|
|
326
|
+
|
|
327
|
+
### Using the Predicate module
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
```ts
|
|
332
|
+
import { Predicate } from "effect"
|
|
333
|
+
|
|
334
|
+
const thing: unknown = {
|
|
335
|
+
a: 1
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
if (Predicate.isObject(thing)) {
|
|
339
|
+
if (Predicate.isNumber(thing.a)) {
|
|
340
|
+
console.log("number", thing.a)
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
## Working with SQL databases
|
|
346
|
+
|
|
347
|
+
Use the `effect/sql` modules together with a driver package such as
|
|
348
|
+
`@effect/sql-sqlite-node` to access SQL databases. Define domain models with
|
|
349
|
+
`Model.Class` to derive schemas for the database and JSON boundaries, run
|
|
350
|
+
migrations, and write type-safe queries.
|
|
351
|
+
|
|
352
|
+
- **[Getting started with SQL](./ai-docs/src/40_sql/10_basics.ts)**:
|
|
353
|
+
Define a schema-backed domain model, run migrations against a SQLite
|
|
354
|
+
database, and expose a derived repository through a service.
|
|
355
|
+
|
|
356
|
+
## Effect HttpClient
|
|
357
|
+
|
|
358
|
+
Build http clients with the `HttpClient` module.
|
|
359
|
+
|
|
360
|
+
- **[Getting started with HttpClient](./ai-docs/src/50_http-client/10_basics.ts)**: Define a service that uses the HttpClient module to fetch data from an external API
|
|
361
|
+
|
|
362
|
+
## Building HttpApi servers
|
|
363
|
+
|
|
364
|
+
`HttpApi` gives you schema-first, type-safe HTTP APIs with runtime validation, typed clients, and OpenAPI docs from one definition.
|
|
365
|
+
|
|
366
|
+
- **[Getting started with HttpApi](./ai-docs/src/51_http-server/10_basics.ts)**:
|
|
367
|
+
Define a schema-first API, implement handlers, secure endpoints with
|
|
368
|
+
middleware, serve it over HTTP, and call it using a generated typed client.
|
|
369
|
+
- **[Testing HttpApi implementations](./ai-docs/src/51_http-server/20_testing.ts)**:
|
|
370
|
+
Test handlers through an in-memory typed client with `HttpApiTest`, without
|
|
371
|
+
starting an HTTP server or touching a real database.
|
|
372
|
+
|
|
373
|
+
## Typed GraphQL clients with `effect/graphql`
|
|
374
|
+
|
|
375
|
+
Use the `effect/graphql` modules to call GraphQL APIs with typed
|
|
376
|
+
operations. Run `graphqlgen` from `@effect/graphql-generator` to generate
|
|
377
|
+
operations from `.graphql` documents, then build a client with
|
|
378
|
+
`GraphQLClient.make` and provide a transport from `GraphQLProtocol`.
|
|
379
|
+
|
|
380
|
+
- **[Getting started with GraphQL clients](./ai-docs/src/52_graphql/10_basics.ts)**:
|
|
381
|
+
Define a query, build a typed client service over HTTP with an auth
|
|
382
|
+
middleware, and page through a cursor connection.
|
|
383
|
+
- **[Testing code that uses a GraphQL client](./ai-docs/src/52_graphql/20_testing.ts)**:
|
|
384
|
+
Replace a client service with `GraphQLClient.layerTest`, answering each
|
|
385
|
+
operation from a handler instead of a server.
|
|
386
|
+
- **[Batching lookups with GraphQLResolver](./ai-docs/src/52_graphql/30_batching.ts)**:
|
|
387
|
+
Collect concurrent lookups by id into one `nodes(ids:)` request with
|
|
388
|
+
`GraphQLResolver`, instead of one request per id.
|
|
389
|
+
- **[Batching single-item lookups with aliases](./ai-docs/src/52_graphql/40_aliased-batching.ts)**:
|
|
390
|
+
When an API has no field that takes a list of keys, `GraphQLResolver.aliased`
|
|
391
|
+
repeats a generated operation under aliases, so concurrent lookups share one
|
|
392
|
+
request and keep their generated types.
|
|
393
|
+
- **[Handling GraphQL errors, retries and rate limits](./ai-docs/src/52_graphql/50_errors-and-retries.ts)**:
|
|
394
|
+
Read rate-limit headers in a middleware, tell GraphQL errors apart by their
|
|
395
|
+
fields, and retry timeouts and rate limits with `Effect.retry`.
|
|
396
|
+
|
|
397
|
+
## Working with child processes
|
|
398
|
+
|
|
399
|
+
Use the `effect/process` modules to define child processes and run them with `ChildProcessSpawner`.
|
|
400
|
+
|
|
401
|
+
- **[Working with child processes](./ai-docs/src/60_child-process/10_working-with-child-processes.ts)**: This example shows how to collect process output, compose pipelines, and stream long-running command output.
|
|
402
|
+
|
|
403
|
+
## Building CLI applications
|
|
404
|
+
|
|
405
|
+
Use the "effect/cli" modules to build CLI applications. These modules
|
|
406
|
+
provide utilities for parsing command-line arguments, handling user input, and
|
|
407
|
+
managing the flow of a CLI application.
|
|
408
|
+
|
|
409
|
+
- **[Getting started with Effect CLI modules](./ai-docs/src/70_cli/10_basics.ts)**:
|
|
410
|
+
Build a command-line app with typed arguments and flags, then wire subcommand
|
|
411
|
+
handlers into a single executable command.
|
|
412
|
+
|
|
413
|
+
## Working with AI modules
|
|
414
|
+
|
|
415
|
+
Effect's AI modules provide a provider-agnostic interface for language models.
|
|
416
|
+
You can generate text, decode structured objects with `Schema` and stream partial
|
|
417
|
+
responses.
|
|
418
|
+
|
|
419
|
+
- **[Using LanguageModel for text, objects, and streams](./ai-docs/src/71_ai/10_language-model.ts)**:
|
|
420
|
+
Configure a provider once, then use `LanguageModel` for plain text
|
|
421
|
+
generation, schema-validated object generation, and streaming responses.
|
|
422
|
+
- **[Defining and using AI tools](./ai-docs/src/71_ai/20_tools.ts)**:
|
|
423
|
+
Define tools with schemas, group them into toolkits, implement handlers,
|
|
424
|
+
and pass them to `LanguageModel.generateText`.
|
|
425
|
+
- **[Stateful chat sessions](./ai-docs/src/71_ai/30_chat.ts)**:
|
|
426
|
+
The AI `Chat` module maintains conversation history automatically. Build
|
|
427
|
+
AI agents or chat assistants.
|
|
428
|
+
|
|
429
|
+
## Building distributed applications with cluster
|
|
430
|
+
|
|
431
|
+
The cluster modules let you model stateful services as entities and distribute
|
|
432
|
+
them across multiple machines.
|
|
433
|
+
|
|
434
|
+
- **[Defining cluster entities](./ai-docs/src/80_cluster/10_entities.ts)**: Define distributed entity RPCs and run them in a cluster.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Effectful Technologies Inc
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# @effect/chat-teams
|
|
2
|
+
|
|
3
|
+
A [Microsoft Teams](https://www.microsoft.com/microsoft-teams) adapter for `effect/chat`, over the Bot Framework Connector. It includes the messaging endpoint, a pure activity normaliser, and the address helpers.
|
|
4
|
+
|
|
5
|
+
Nothing in this package has run against a real tenant yet, the default capabilities included. It is released ahead of that testing, which is follow-up work: the checks under [Live checks](#live-checks) list what is still to verify. Until a check passes, treat what it covers as unverified.
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
One layer serves one Entra tenant through a single-tenant Azure Bot registration:
|
|
10
|
+
|
|
11
|
+
1. Register an app in Entra ID and create a client secret, or use a certificate or managed identity through a credentials provider.
|
|
12
|
+
2. Create an Azure Bot resource of type single-tenant with that app id, turn on the Microsoft Teams channel, and point its messaging endpoint at the route given to `TeamsChat.layerWebhook`.
|
|
13
|
+
3. Install the bot's app package in the tenant.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import * as TeamsChat from "@effect/chat-teams/TeamsChat"
|
|
17
|
+
import * as Layer from "effect/Layer"
|
|
18
|
+
import * as Redacted from "effect/Redacted"
|
|
19
|
+
|
|
20
|
+
const Teams = TeamsChat.layerWebhook({ path: "/api/messages" }).pipe(
|
|
21
|
+
Layer.provideMerge(TeamsChat.layer({
|
|
22
|
+
appId: "<app id>",
|
|
23
|
+
tenantId: "<tenant id>",
|
|
24
|
+
credentials: Redacted.make("<client secret>")
|
|
25
|
+
}))
|
|
26
|
+
)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`TeamsChat.layer` needs `HttpClient`, the chat `Registry`, `Mac` and `Digest`. `TeamsChat.layerWebhook` needs `HttpRouter`, a `ChatHandler`, `HttpClient` and `Signature`. The adapter never calls `crypto.subtle` itself. Importing Bot Framework's public keys goes through `Jwk.importPublic`, which needs a `WebCrypto` reference whatever backend provides `Signature`.
|
|
30
|
+
|
|
31
|
+
The `HttpClient` must add no credentials of its own and follow no redirects. The adapter decides per request which host gets the bot's token, asks Fetch for `redirect: "manual"`, and fails a response that came from another URL than the one it sent to. With a client other than `FetchHttpClient`, or middleware that rewrites requests, keep both properties.
|
|
32
|
+
|
|
33
|
+
The cloud's endpoints and host allowlists come from `TeamsChat.publicCloud` or a `Cloud` of your own. They are configuration and are never read from an activity.
|
|
34
|
+
|
|
35
|
+
## Capabilities
|
|
36
|
+
|
|
37
|
+
Every capability below is unverified against a tenant. They fall in three groups.
|
|
38
|
+
|
|
39
|
+
**On by default:** `post`, `edit`, `delete`, `getThread` and `getUser`. `getUser` needs `in`, the thread whose roster to read.
|
|
40
|
+
|
|
41
|
+
**Implemented, off by default.** Turn these on with the `unverified` option, at your own risk. Turning one on advertises a capability no tenant has confirmed:
|
|
42
|
+
|
|
43
|
+
| Option | Turns on | Also needs |
|
|
44
|
+
| ------------- | ------------------------------------------- | ----------------- |
|
|
45
|
+
| `buttons` | `buttons` (buttons and link buttons) | `interactionKeys` |
|
|
46
|
+
| `modals` | `modals`, `modalErrors` (dialogs) | `buttons` |
|
|
47
|
+
| `commands` | `commands`, `ephemeral` (targeted messages) | |
|
|
48
|
+
| `startThread` | `startThread` | |
|
|
49
|
+
| `download` | `download` | |
|
|
50
|
+
|
|
51
|
+
A dialog opens only from a button whose id is listed in `modalButtons`. Any other `OpenModal` is refused as `Unsupported`.
|
|
52
|
+
|
|
53
|
+
**Not implemented in this version.** These are `Unsupported` whatever the options:
|
|
54
|
+
|
|
55
|
+
- `fetchMessage`, `history` and `opener`. They need Microsoft Graph, which is deferred.
|
|
56
|
+
- `replyTo` (quoted replies).
|
|
57
|
+
- Files: `filesPerMessage` is 0, and the size reservation holds nothing for them.
|
|
58
|
+
- Native streams. Streams are posted and then edited.
|
|
59
|
+
- Selects.
|
|
60
|
+
|
|
61
|
+
The element caps are the adapter's own, since Teams publishes none: 6 elements per message and 10 fields per modal. `actionDataLength` (1,000) and `modalMetadataLength` (4,000) count the whole signed token that carries the data, envelope included. With a GUID app and tenant that leaves about 500 ASCII characters for a button's id and value. A dialog token also carries the modal's definition, so its id, metadata, title, labels, options and texts share about 1,880 bytes of JSON. A modal over that is refused `TooLarge` before anything opens. Check 13 may raise the cap once the dialog card's real size limit is known.
|
|
62
|
+
|
|
63
|
+
## Security
|
|
64
|
+
|
|
65
|
+
- Inbound requests need a Bot Framework token: RS256, with a key endorsed for `msteams`, the cloud's issuer, the app id as audience, and a `serviceurl` claim equal to the activity's `serviceUrl`. The channel must be `msteams` and the tenant the configured one. Anything else is answered 403. The OpenID metadata and the key set are fetched with redirects off. Metadata over 64 KiB, or with a `jwks_uri` that is not a URL, is answered 503.
|
|
66
|
+
- The bot's token goes only to a Connector host from the cloud's allowlist, over `https:` on the default port. A download sends it only when the first URL is on its own class's allowlist. `redirectHosts` admits a host as a redirect target, never as the first hop, and a redirect hop gets no token.
|
|
67
|
+
- Button and dialog tokens are signed (HS256) and bound to the app, the tenant and the conversation. They are not encrypted: anyone who sees a card can read a button's id and value, and a modal's metadata. Do not put secrets in them.
|
|
68
|
+
- Button tokens have no replay protection. A click can be sent again for as long as the conversation exists. Dialog tokens also bind the user and the exact conversation id of the click, and expire after an hour. Signing does not stop a submit from arriving twice, so handlers still authorise and stay idempotent.
|
|
69
|
+
- A command's private answer goes as a targeted message to the user who sent the command. If that fails, the answer is not posted in public.
|
|
70
|
+
|
|
71
|
+
## Live checks
|
|
72
|
+
|
|
73
|
+
None of these has run. They are follow-up work, not a condition of publication, and need a Microsoft 365 developer tenant, an Azure Bot resource and a public tunnel to the endpoint. Each check covers only what it names. A failed check removes that capability, or, for the base, needs a fix in the adapter.
|
|
74
|
+
|
|
75
|
+
| Gate | Checks | If a check fails |
|
|
76
|
+
| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
77
|
+
| Base: `post`, `edit`, `delete`, events, user ids | 1, 12, 4, 8, 9, 10, 16, 7, 18 | A fix in the adapter. Check 4 failing for an op brings in a `serviceUrl` resolver. Check 10 failing changes the docs only. |
|
|
78
|
+
| `startThread` | 12 | Absent |
|
|
79
|
+
| `buttons` | 1, 9, 2, 3 | Absent, or absent from private answers only |
|
|
80
|
+
| `modals` | 17, the `task/fetch` and `task/submit` envelopes, the older-client fallback, `Ack` on a declared button leaving nothing open, 2, 13 | Absent |
|
|
81
|
+
| `modalErrors` | 13 | Absent: `Errors` then closes the dialog and sends a private message |
|
|
82
|
+
| `commands`, `ephemeral` | 3, 4 | Absent. Targeted activities are still classified first and never reach anything public. |
|
|
83
|
+
| Native streams | 5, 4 | Stays absent, so post-then-edit |
|
|
84
|
+
| `replyTo` | 14 | Stays absent |
|
|
85
|
+
| Files | 1, and the attachment header limits Teams accepts | Stay absent |
|
|
86
|
+
| `download` | 18 | Absent |
|
|
87
|
+
| Reaction events | 11 | Unknown types pass through as the raw string |
|
|
88
|
+
| Graph reads | 6, and history ordering | Deferred |
|
|
89
|
+
| Selects | 15 | Not in v1, so it gates nothing |
|
|
90
|
+
|
|
91
|
+
The checks:
|
|
92
|
+
|
|
93
|
+
1. The text form and the card form each arrive as one message with an id that `PUT` can edit, and `PUT` can switch between them. For files, an attachments-only activity with a card and images is one message.
|
|
94
|
+
2. The deadline for `adaptiveCard/action`, `task/fetch` and `task/submit` answers, and the failure answer that shows nothing unsafe.
|
|
95
|
+
3. The wire shape of a slash command in each scope: a leading slash or not, where the targeted flag appears (expected `recipient.isTargeted`), whether personal chats show the slash menu, no public fallback on failure, no Prompt Preview on a public answer, and a click on a private answer making no public activity.
|
|
96
|
+
4. Edit, delete, streaming and targeted sends all work through the global `serviceUrl`, and a targeted send works through the inbound `serviceUrl`.
|
|
97
|
+
5. Streaming over raw REST in group chats and channels, with a stored `replyTo` after the inbound request has returned, and a second stream answering the same message after a rotation.
|
|
98
|
+
6. Whether the Connector's activity id equals the Graph message id, and the Graph chat id of a personal bot chat.
|
|
99
|
+
7. Member lookup, targeted recipients and mention entities accept an Entra object id.
|
|
100
|
+
8. How `<`, `&` and `$` are escaped in `extendedmarkdown`, and whether bot messages unfurl links.
|
|
101
|
+
9. The real size edge for text and for cards. It sets `Edge` and the reservation `R`, and may only raise a term.
|
|
102
|
+
10. Whether a non-2xx answer is redelivered, and whether a retry keeps the activity id.
|
|
103
|
+
11. Reaction `type` strings beyond the six documented ones.
|
|
104
|
+
12. Which route makes a new top-level channel post and returns its id, and that the id is the reply chain's root.
|
|
105
|
+
13. Whether `ContinueTask` re-renders the dialog in place, where the errors show, and the size cap of a dialog card.
|
|
106
|
+
14. Quoted replies over raw REST in channels and group chats.
|
|
107
|
+
15. That `Input.ChoiceSet` has no submit-on-change in current Teams clients.
|
|
108
|
+
16. The issuer, audience and endorsements on inbound tokens for a single-tenant registration.
|
|
109
|
+
17. Whether an `adaptiveCard/action` answer can carry a task continuation that opens a dialog. If it can, `modalButtons` goes away.
|
|
110
|
+
18. The hosts actually seen for `serviceUrl`, image `contentUrl` and `downloadUrl` in each cloud and scope, and their redirect chains. These are written into the cloud presets. Nothing is added at runtime.
|
|
111
|
+
|
|
112
|
+
## Links
|
|
113
|
+
|
|
114
|
+
- [Website](https://effect.website): documentation, guides, and news.
|
|
115
|
+
- [Discord](https://discord.gg/effect-ts): ask questions, share what you're building, and talk to the core team.
|
|
116
|
+
- [Issues](https://github.com/Effect-TS/effect/issues): bug reports and feature requests.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# AI docs
|
|
2
|
+
|
|
3
|
+
`LLMS.md` is generated from `ai-docs/src`.
|
|
4
|
+
|
|
5
|
+
## Add content
|
|
6
|
+
|
|
7
|
+
1. Add or update markdown in `ai-docs/src/**/index.md` for section intro text.
|
|
8
|
+
2. Add examples as `.ts` files in the same folder.
|
|
9
|
+
3. Run `pnpm ai-docgen` to regenerate `LLMS.md`.
|
|
10
|
+
|
|
11
|
+
## Source file conventions
|
|
12
|
+
|
|
13
|
+
- Use numeric filename prefixes to control ordering (`10_`, `20_`, etc). Avoid starting with `0` unless explicity requested to do so.
|
|
14
|
+
- Use a top JSDoc block with `@title` and optional description to control rendered title/description.
|
|
15
|
+
- `fixtures` directories are ignored and not included in the generated
|
|
16
|
+
documentation. Use them for any supporting code or data needed for examples.
|
|
17
|
+
|
|
18
|
+
## Example guidelines
|
|
19
|
+
|
|
20
|
+
Before writing an example, look at the existing examples in `ai-docs/src` to
|
|
21
|
+
learn the style and conventions used in this project. Also read the current
|
|
22
|
+
`LLMS.md` to understand the content and style of the documentation.
|
|
23
|
+
|
|
24
|
+
**All code examples should be well commented** explaining the how and why of the
|
|
25
|
+
code, not just what the code is doing. The goal is to teach users how to use the
|
|
26
|
+
API.
|
|
27
|
+
|
|
28
|
+
**Code must represent real world usage and best practices.**
|
|
29
|
+
Do not include toy examples that are not representative of how the API should be
|
|
30
|
+
used in practice.
|
|
31
|
+
|
|
32
|
+
- **Prefer using the service style** of structuring code, as this represents real
|
|
33
|
+
world usage and best practices.
|
|
34
|
+
- Use the `fixtures` directory to illustrate / suggest best practices for
|
|
35
|
+
project structure, file organization, and code organization.
|
|
36
|
+
|
|
37
|
+
Pull requests with only ai documentation changes **DO NOT** need a changeset.
|
|
38
|
+
|
|
39
|
+
## Regeneration
|
|
40
|
+
|
|
41
|
+
- One-shot: `pnpm ai-docgen`
|
|
42
|
+
- Watch mode: `pnpm ai-docgen:watch`
|
|
43
|
+
|
|
44
|
+
`pnpm ai-docgen` regenerates `LLMS.md` files from content in `ai-docs/src`.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ai-docs",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"version": "0.0.0",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@effect/ai-anthropic": "workspace:*",
|
|
8
|
+
"@effect/ai-openai": "workspace:*",
|
|
9
|
+
"@effect/ai-openai-compat": "workspace:*",
|
|
10
|
+
"@effect/ai-openrouter": "workspace:*",
|
|
11
|
+
"@effect/atom-react": "workspace:*",
|
|
12
|
+
"@effect/atom-solid": "workspace:*",
|
|
13
|
+
"@effect/atom-vue": "workspace:*",
|
|
14
|
+
"@effect/opentelemetry": "workspace:*",
|
|
15
|
+
"@effect/platform-bun": "workspace:*",
|
|
16
|
+
"@effect/platform-node": "workspace:*",
|
|
17
|
+
"@effect/sql-clickhouse": "workspace:*",
|
|
18
|
+
"@effect/sql-d1": "workspace:*",
|
|
19
|
+
"@effect/sql-libsql": "workspace:*",
|
|
20
|
+
"@effect/sql-mssql": "workspace:*",
|
|
21
|
+
"@effect/sql-mysql2": "workspace:*",
|
|
22
|
+
"@effect/sql-pg": "workspace:*",
|
|
23
|
+
"@effect/sql-sqlite-bun": "workspace:*",
|
|
24
|
+
"@effect/sql-sqlite-do": "workspace:*",
|
|
25
|
+
"@effect/sql-sqlite-node": "workspace:*",
|
|
26
|
+
"@effect/sql-sqlite-react-native": "workspace:*",
|
|
27
|
+
"@effect/sql-sqlite-wasm": "workspace:*",
|
|
28
|
+
"@effect/vitest": "workspace:*",
|
|
29
|
+
"effect": "workspace:*",
|
|
30
|
+
"hono": "^4.13.18",
|
|
31
|
+
"nodemailer": "^10.5.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/nodemailer": "^8.0.2"
|
|
35
|
+
}
|
|
36
|
+
}
|