effect-agent 0.1.0-beta.91 → 0.1.0-beta.92
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/{AgentRuntime-CHipL2jG.mjs → AgentRuntime-BPjQM1Nv.mjs} +2 -2
- package/dist/AgentRuntime-BPjQM1Nv.mjs.map +1 -0
- package/dist/{DurableAgentRuntime-D7gDKGjH.mjs → DurableAgentRuntime-CdrBuKZY.mjs} +4 -4
- package/dist/{DurableAgentRuntime-D7gDKGjH.mjs.map → DurableAgentRuntime-CdrBuKZY.mjs.map} +1 -1
- package/dist/{EventSource-OqS_P9ug.d.mts → EventSource-c6GRTCsl.d.mts} +3 -3
- package/dist/{PreparedInputAdmission-C4HbjHgl.d.mts → PreparedInputAdmission-QzFbW2LQ.d.mts} +4 -4
- package/dist/Records-C9cezOEf.mjs +799 -0
- package/dist/Records-C9cezOEf.mjs.map +1 -0
- package/dist/{Records-BAGkekt8.d.mts → Records-vFp_ZQ9Y.d.mts} +21 -3
- package/dist/{RunJournal-Cgg1kNvc.mjs → RunJournal-lwbrh2hZ.mjs} +2 -2
- package/dist/{RunJournal-Cgg1kNvc.mjs.map → RunJournal-lwbrh2hZ.mjs.map} +1 -1
- package/dist/{Schedule-H3SEYX9g.d.mts → Schedule-BkZvKyMw.d.mts} +2 -2
- package/dist/{Scheduling-C9aIP8zT.mjs → Scheduling-D0QqOoeT.mjs} +2 -2
- package/dist/{Scheduling-C9aIP8zT.mjs.map → Scheduling-D0QqOoeT.mjs.map} +1 -1
- package/dist/{Subagent-U5qXOFE8.mjs → Subagent-CnTzCy8k.mjs} +2 -2
- package/dist/{Subagent-U5qXOFE8.mjs.map → Subagent-CnTzCy8k.mjs.map} +1 -1
- package/dist/{Subscription-BEP8oQO5.d.mts → Subscription-CKQ0KDHN.d.mts} +3 -3
- package/dist/{SubscriptionInput-vAAOBrK7.d.mts → SubscriptionInput-Cth8F_7b.d.mts} +3 -3
- package/dist/capabilities/Subagent.mjs +1 -1
- package/dist/capabilities/WebSearch.d.mts +3 -3
- package/dist/capabilities/WebSearch.mjs +9 -6
- package/dist/capabilities/WebSearch.mjs.map +1 -1
- package/dist/durable/ActivityStore.d.mts +1 -1
- package/dist/durable/ActivityStore.mjs +1 -1
- package/dist/durable/Admin.d.mts +1 -1
- package/dist/durable/Admin.mjs +1 -1
- package/dist/durable/AgentRegistration.d.mts +1 -1
- package/dist/durable/Certification.d.mts +1 -1
- package/dist/durable/CommittedActivity.d.mts +1 -1
- package/dist/durable/CommittedActivity.mjs +1 -1
- package/dist/durable/Digest.d.mts +1 -1
- package/dist/durable/Digest.mjs +1 -1
- package/dist/durable/DurableAgentRuntime.d.mts +1 -1
- package/dist/durable/DurableAgentRuntime.mjs +1 -1
- package/dist/durable/EventSource.d.mts +1 -1
- package/dist/durable/EventSource.mjs +1 -1
- package/dist/durable/GitHubWorkflowSource.d.mts +48 -6
- package/dist/durable/GitHubWorkflowSource.mjs +13 -13
- package/dist/durable/GitHubWorkflowSource.mjs.map +1 -1
- package/dist/durable/MessageDelivery.d.mts +22 -22
- package/dist/durable/MessageDelivery.mjs +1 -1
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +39 -39
- package/dist/durable/MessageDeliveryStoreConformance.mjs +1 -1
- package/dist/durable/PersistentHistory.d.mts +1 -1
- package/dist/durable/PersistentHistory.mjs +2 -2
- package/dist/durable/PreparedInputAdmission.d.mts +1 -1
- package/dist/durable/Records.d.mts +1 -1
- package/dist/durable/Records.mjs +2 -795
- package/dist/durable/Recovery.d.mts +1 -1
- package/dist/durable/Recovery.mjs +1 -1
- package/dist/durable/RunJournal.d.mts +1 -1
- package/dist/durable/RunJournal.mjs +1 -1
- package/dist/durable/Schedule.d.mts +1 -1
- package/dist/durable/Schedule.mjs +1 -1
- package/dist/durable/ScheduleStoreConformance.d.mts +1 -1
- package/dist/durable/ScheduleStoreConformance.mjs +1 -1
- package/dist/durable/ScheduleTransition.d.mts +1 -1
- package/dist/durable/ScheduleTransition.mjs +1 -1
- package/dist/durable/Scheduling.d.mts +2 -2
- package/dist/durable/Scheduling.mjs +1 -1
- package/dist/durable/SqlStorageV2Upgrade.d.mts +2 -2
- package/dist/durable/SqlStorageV2Upgrade.mjs +1 -1
- package/dist/durable/SqlSubscriptionStore.d.mts +2 -2
- package/dist/durable/SqlSubscriptionStore.mjs +1 -1
- package/dist/durable/SubmissionLedger.d.mts +1 -1
- package/dist/durable/SubmissionLedger.mjs +1 -1
- package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
- package/dist/durable/SubmissionLedgerConformance.mjs +1 -1
- package/dist/durable/SubmissionStatus.d.mts +1 -1
- package/dist/durable/Subscription.d.mts +1 -1
- package/dist/durable/Subscription.mjs +1 -1
- package/dist/durable/SubscriptionInput.d.mts +1 -1
- package/dist/durable/SubscriptionInput.mjs +1 -1
- package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
- package/dist/durable/SubscriptionStoreConformance.mjs +1 -1
- package/dist/durable/SubscriptionTools.d.mts +3 -3
- package/dist/durable/SubscriptionTransition.d.mts +1 -1
- package/dist/durable/SubscriptionTransition.mjs +1 -1
- package/dist/durable/Subscriptions.d.mts +5 -5
- package/dist/durable/Subscriptions.mjs +1 -1
- package/dist/durable/ThreadContextHistory.d.mts +1 -1
- package/dist/durable/ThreadContextHistory.mjs +1 -1
- package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
- package/dist/durable/ThreadContextHistoryProjection.mjs +1 -1
- package/dist/durable/ThreadInvariants.d.mts +1 -1
- package/dist/durable/ThreadInvariants.mjs +1 -1
- package/dist/durable/ThreadProjection.d.mts +1 -1
- package/dist/durable/ThreadProjection.mjs +1 -1
- package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
- package/dist/durable/ThreadStore.d.mts +1 -1
- package/dist/durable/ThreadStore.mjs +1 -1
- package/dist/durable/ThreadStoreConformance.d.mts +1 -1
- package/dist/durable/ThreadStoreConformance.mjs +1 -1
- package/dist/durable/ToolReconciler.mjs +1 -1
- package/dist/durable/WorkerHost.d.mts +1 -1
- package/dist/engine/AgentRuntime.mjs +1 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +6 -6
- package/dist/sandbox/InteractiveBrowser.mjs +2 -2
- package/dist/sandbox/InteractiveBrowser.mjs.map +1 -1
- package/dist/sandbox/PageCapture.mjs +4 -4
- package/dist/sandbox/PageCapture.mjs.map +1 -1
- package/dist/sandbox/ProtectedBrowser.mjs +1 -1
- package/dist/sandbox/ProtectedBrowser.mjs.map +1 -1
- package/package.json +1 -1
- package/src/capabilities/WebSearch.ts +23 -17
- package/src/core/internal/strict-schema.ts +14 -0
- package/src/durable/GitHubWorkflowSource.ts +32 -38
- package/src/durable/Records.ts +8 -4
- package/src/engine/internal/primitive-delta.ts +1 -1
- package/src/sandbox/InteractiveBrowser.ts +2 -2
- package/src/sandbox/PageCapture.ts +6 -7
- package/src/sandbox/ProtectedBrowser.ts +1 -1
- package/dist/AgentRuntime-CHipL2jG.mjs.map +0 -1
- package/dist/durable/Records.mjs.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Context, Effect, Encoding,
|
|
1
|
+
import { Context, Effect, Encoding, ByteSize, Layer, Redacted, Schema } from "effect";
|
|
2
2
|
import { HttpClient, HttpIncomingMessage, HttpClientRequest } from "effect/unstable/http";
|
|
3
3
|
|
|
4
|
+
import { strictSchema } from "../core/internal/strict-schema.ts";
|
|
4
5
|
import { makeEventSource, type EventSource } from "./EventSource.ts";
|
|
5
6
|
import type { Principal } from "./SubmissionLedger.ts";
|
|
6
7
|
import type { EventAcknowledgement } from "./Subscription.ts";
|
|
@@ -18,28 +19,21 @@ const GitCommitSha = Schema.String.check(Schema.isPattern(/^(?:[0-9a-f]{40}|[0-9
|
|
|
18
19
|
const GitHubConclusion = Schema.NonEmptyString.check(Schema.isMaxLength(64));
|
|
19
20
|
const GitHubStatus = Schema.NonEmptyString.check(Schema.isMaxLength(32));
|
|
20
21
|
|
|
21
|
-
const strict = <S extends Schema.Top>(schema: S) =>
|
|
22
|
-
schema.pipe(Schema.annotate({ parseOptions: { onExcessProperty: "error" } }));
|
|
23
|
-
|
|
24
22
|
/** One repository whose identity and credentials are selected by the host. */
|
|
25
|
-
export const GitHubRepository =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}),
|
|
31
|
-
);
|
|
23
|
+
export const GitHubRepository = Schema.Struct({
|
|
24
|
+
id: PositiveId,
|
|
25
|
+
owner: GitHubName,
|
|
26
|
+
name: GitHubName,
|
|
27
|
+
}).pipe(strictSchema);
|
|
32
28
|
|
|
33
29
|
export type GitHubRepository = typeof GitHubRepository.Type;
|
|
34
30
|
|
|
35
31
|
/** Exact workflow attempt requested by an Agent through a host-permitted source. */
|
|
36
|
-
export const GitHubWorkflowRunWatch =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}),
|
|
42
|
-
);
|
|
32
|
+
export const GitHubWorkflowRunWatch = Schema.Struct({
|
|
33
|
+
runId: PositiveId,
|
|
34
|
+
attempt: PositiveId,
|
|
35
|
+
expectedHeadSha: GitCommitSha,
|
|
36
|
+
}).pipe(strictSchema);
|
|
43
37
|
|
|
44
38
|
export type GitHubWorkflowRunWatch = typeof GitHubWorkflowRunWatch.Type;
|
|
45
39
|
|
|
@@ -47,15 +41,13 @@ export type GitHubWorkflowRunWatch = typeof GitHubWorkflowRunWatch.Type;
|
|
|
47
41
|
* Small canonical completion shared by webhook intake and REST reconciliation. Provider delivery
|
|
48
42
|
* IDs, URLs, actors, and mutable metadata are deliberately omitted from durable event identity.
|
|
49
43
|
*/
|
|
50
|
-
export const GitHubWorkflowRunCompletion =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}),
|
|
58
|
-
);
|
|
44
|
+
export const GitHubWorkflowRunCompletion = Schema.Struct({
|
|
45
|
+
repositoryId: PositiveId,
|
|
46
|
+
runId: PositiveId,
|
|
47
|
+
attempt: PositiveId,
|
|
48
|
+
headSha: GitCommitSha,
|
|
49
|
+
conclusion: GitHubConclusion,
|
|
50
|
+
}).pipe(strictSchema);
|
|
59
51
|
|
|
60
52
|
export type GitHubWorkflowRunCompletion = typeof GitHubWorkflowRunCompletion.Type;
|
|
61
53
|
|
|
@@ -144,18 +136,18 @@ export const githubWorkflowRunsHttpLayer = (
|
|
|
144
136
|
Effect.gen(function* () {
|
|
145
137
|
const client = yield* HttpClient.HttpClient;
|
|
146
138
|
|
|
147
|
-
const permittedRepository = yield* Schema.decodeEffect(GitHubRepository
|
|
148
|
-
|
|
149
|
-
).pipe(Effect.mapError(() => httpFailure("invalid-response", false)));
|
|
139
|
+
const permittedRepository = yield* Schema.decodeEffect(GitHubRepository, {
|
|
140
|
+
onExcessProperty: "error",
|
|
141
|
+
})(options.repository).pipe(Effect.mapError(() => httpFailure("invalid-response", false)));
|
|
150
142
|
|
|
151
143
|
const apiUrl = (options.apiUrl ?? "https://api.github.com").replace(/\/$/, "");
|
|
152
144
|
|
|
153
145
|
const getAttempt = Effect.fn("GitHubWorkflowRuns.getAttempt")(function* (
|
|
154
146
|
request: GitHubWorkflowRunAttemptRequest,
|
|
155
147
|
) {
|
|
156
|
-
const repository = yield* Schema.decodeEffect(GitHubRepository
|
|
157
|
-
|
|
158
|
-
);
|
|
148
|
+
const repository = yield* Schema.decodeEffect(GitHubRepository, {
|
|
149
|
+
onExcessProperty: "error",
|
|
150
|
+
})(request.repository).pipe(Effect.mapError(() => httpFailure("invalid-response", false)));
|
|
159
151
|
|
|
160
152
|
if (
|
|
161
153
|
repository.id !== permittedRepository.id ||
|
|
@@ -165,7 +157,9 @@ export const githubWorkflowRunsHttpLayer = (
|
|
|
165
157
|
return yield* httpFailure("unauthorized", false);
|
|
166
158
|
}
|
|
167
159
|
|
|
168
|
-
const watch = yield* Schema.decodeEffect(GitHubWorkflowRunWatch
|
|
160
|
+
const watch = yield* Schema.decodeEffect(GitHubWorkflowRunWatch, {
|
|
161
|
+
onExcessProperty: "error",
|
|
162
|
+
})({
|
|
169
163
|
runId: request.runId,
|
|
170
164
|
attempt: request.attempt,
|
|
171
165
|
expectedHeadSha: "0".repeat(40),
|
|
@@ -203,7 +197,7 @@ export const githubWorkflowRunsHttpLayer = (
|
|
|
203
197
|
}
|
|
204
198
|
|
|
205
199
|
return yield* response.json.pipe(
|
|
206
|
-
Effect.provideService(HttpIncomingMessage.MaxBodySize,
|
|
200
|
+
Effect.provideService(HttpIncomingMessage.MaxBodySize, ByteSize.mebibytes(1)),
|
|
207
201
|
Effect.mapError(() => httpFailure("invalid-response", false)),
|
|
208
202
|
Effect.flatMap(Schema.decodeUnknownEffect(GitHubWorkflowRunAttempt)),
|
|
209
203
|
Effect.mapError(() => httpFailure("invalid-response", false)),
|
|
@@ -261,9 +255,9 @@ export interface GitHubWorkflowRunSourceOptions {
|
|
|
261
255
|
export const makeGitHubWorkflowRunSource = Effect.fn("makeGitHubWorkflowRunSource")(function* (
|
|
262
256
|
options: GitHubWorkflowRunSourceOptions,
|
|
263
257
|
): Effect.fn.Return<EventSource, SubscriptionSourceError, GitHubWorkflowRuns> {
|
|
264
|
-
const repository = yield* Schema.decodeEffect(GitHubRepository)(
|
|
265
|
-
|
|
266
|
-
);
|
|
258
|
+
const repository = yield* Schema.decodeEffect(GitHubRepository, { onExcessProperty: "error" })(
|
|
259
|
+
options.repository,
|
|
260
|
+
).pipe(Effect.mapError(() => sourceError("github-repository-configuration", false)));
|
|
267
261
|
|
|
268
262
|
const runs = yield* GitHubWorkflowRuns;
|
|
269
263
|
|
package/src/durable/Records.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
1
|
+
import { Option, Schema } from "effect";
|
|
2
2
|
import { Prompt } from "effect/unstable/ai";
|
|
3
3
|
|
|
4
4
|
import { InputMessage } from "../capabilities/Messaging.ts";
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
ToolCallId,
|
|
18
18
|
TurnId,
|
|
19
19
|
} from "../core/Identifiers.ts";
|
|
20
|
+
import { strictSchema } from "../core/internal/strict-schema.ts";
|
|
20
21
|
import { utf8ByteLength } from "../core/internal/utf8.ts";
|
|
21
22
|
import { IdempotencyKey, Principal } from "../core/Receipt.ts";
|
|
22
23
|
import { ExhaustedLimit } from "../core/RunEvent.ts";
|
|
@@ -95,9 +96,9 @@ export const SettlementFailureDiagnostic = Schema.Struct({
|
|
|
95
96
|
errorTag: SettlementFailureTag,
|
|
96
97
|
message: SettlementFailureMessage,
|
|
97
98
|
}).pipe(
|
|
99
|
+
strictSchema,
|
|
98
100
|
Schema.annotate({
|
|
99
101
|
identifier: "@effect-agent/thread/SettlementFailureDiagnostic",
|
|
100
|
-
parseOptions: { onExcessProperty: "error" },
|
|
101
102
|
}),
|
|
102
103
|
);
|
|
103
104
|
|
|
@@ -594,7 +595,9 @@ const isPolicyFailureProjection = Schema.is(
|
|
|
594
595
|
Schema.Struct({ errorTag: Schema.Literal("AgentPolicyError") }),
|
|
595
596
|
);
|
|
596
597
|
|
|
597
|
-
const
|
|
598
|
+
const decodeSettlementFailureDiagnostic = Schema.decodeUnknownOption(SettlementFailureDiagnostic, {
|
|
599
|
+
onExcessProperty: "error",
|
|
600
|
+
});
|
|
598
601
|
|
|
599
602
|
const hasValidSettlementFamily = (settled: typeof RawSubmissionSettled.Type): boolean =>
|
|
600
603
|
(settled.finishReason === undefined || settled.outcome === "completed") &&
|
|
@@ -607,7 +610,8 @@ const hasValidSettlementFamily = (settled: typeof RawSubmissionSettled.Type): bo
|
|
|
607
610
|
settled.finishReason === undefined &&
|
|
608
611
|
settled.runId !== undefined &&
|
|
609
612
|
settled.result !== undefined)) &&
|
|
610
|
-
(settled.outcome !== "failed" ||
|
|
613
|
+
(settled.outcome !== "failed" ||
|
|
614
|
+
Option.isSome(decodeSettlementFailureDiagnostic(settled.result))) &&
|
|
611
615
|
(settled.outcome !== "aborted" || settled.result === undefined) &&
|
|
612
616
|
(settled.policyLimit === undefined ||
|
|
613
617
|
(settled.outcome === "failed" && isPolicyFailureProjection(settled.result)));
|
|
@@ -4,7 +4,7 @@ import { Response } from "effect/unstable/ai";
|
|
|
4
4
|
import { utf8ByteLength } from "../../core/internal/utf8.ts";
|
|
5
5
|
import { boundedValueFootprint } from "./bounded-value.ts";
|
|
6
6
|
|
|
7
|
-
const brand = "~effect/ai/
|
|
7
|
+
const brand = "~effect/ai/Response/Part";
|
|
8
8
|
const keys = [brand, "type", "id", "delta", "metadata"];
|
|
9
9
|
|
|
10
10
|
const decode = Schema.decodeUnknownOption(
|
|
@@ -75,7 +75,7 @@ export const InteractiveBrowserNetworkPolicy = Schema.Union([
|
|
|
75
75
|
}),
|
|
76
76
|
Schema.TaggedStruct("PublicWeb", {}),
|
|
77
77
|
Schema.TaggedStruct("Unrestricted", {}),
|
|
78
|
-
])
|
|
78
|
+
]);
|
|
79
79
|
|
|
80
80
|
export type InteractiveBrowserNetworkPolicy = typeof InteractiveBrowserNetworkPolicy.Type;
|
|
81
81
|
|
|
@@ -88,7 +88,7 @@ export class InteractiveBrowserPolicy extends Schema.Class<InteractiveBrowserPol
|
|
|
88
88
|
maxActions: PositiveInt.check(Schema.isLessThanOrEqualTo(1_000)),
|
|
89
89
|
maxElapsedMillis: PositiveInt.check(Schema.isLessThanOrEqualTo(60 * 60_000)),
|
|
90
90
|
maxReturnedBytes: PositiveInt.check(Schema.isLessThanOrEqualTo(8 * 1024 * 1024)),
|
|
91
|
-
})
|
|
91
|
+
}),
|
|
92
92
|
) {}
|
|
93
93
|
|
|
94
94
|
export class BrowserNavigateRequest extends Schema.Class<BrowserNavigateRequest>(
|
|
@@ -160,10 +160,7 @@ type ResponseFormatNode = Schema.JsonObject & {
|
|
|
160
160
|
};
|
|
161
161
|
|
|
162
162
|
const ResponseFormatNode: Schema.Codec<ResponseFormatNode> = Schema.suspend(
|
|
163
|
-
(): Schema.Codec<ResponseFormatNode> =>
|
|
164
|
-
Schema.Struct(responseFormatFields()).pipe(
|
|
165
|
-
Schema.annotate({ parseOptions: { onExcessProperty: "error" } }),
|
|
166
|
-
),
|
|
163
|
+
(): Schema.Codec<ResponseFormatNode> => Schema.Struct(responseFormatFields()),
|
|
167
164
|
);
|
|
168
165
|
|
|
169
166
|
const responseFormatFields = () => {
|
|
@@ -257,9 +254,11 @@ const responseFormatFields = () => {
|
|
|
257
254
|
const ResponseFormatDocument = Schema.Struct({
|
|
258
255
|
...responseFormatFields(),
|
|
259
256
|
type: Schema.Literal("object"),
|
|
260
|
-
})
|
|
257
|
+
});
|
|
261
258
|
|
|
262
|
-
const
|
|
259
|
+
const decodeResponseFormatDocument = Schema.decodeUnknownOption(ResponseFormatDocument, {
|
|
260
|
+
onExcessProperty: "error",
|
|
261
|
+
});
|
|
263
262
|
|
|
264
263
|
/** Preflight graph bounds before recursively decoding an untrusted JSON Schema. */
|
|
265
264
|
const isBoundedResponseFormat = (input: unknown): input is typeof ResponseFormatDocument.Type => {
|
|
@@ -313,7 +312,7 @@ const isBoundedResponseFormat = (input: unknown): input is typeof ResponseFormat
|
|
|
313
312
|
}
|
|
314
313
|
}
|
|
315
314
|
|
|
316
|
-
if (
|
|
315
|
+
if (Option.isNone(decodeResponseFormatDocument(input))) return false;
|
|
317
316
|
const encoded = JSON.stringify(input);
|
|
318
317
|
|
|
319
318
|
return Encoding.encodeHex(encoded).length / 2 <= MAX_RESPONSE_FORMAT_BYTES;
|
|
@@ -140,7 +140,7 @@ export class ProtectedBrowserFill extends Schema.Class<ProtectedBrowserFill>(
|
|
|
140
140
|
Schema.Struct({
|
|
141
141
|
ref: BrowserReference,
|
|
142
142
|
value: Schema.String.check(Schema.isMaxLength(8192)),
|
|
143
|
-
})
|
|
143
|
+
}),
|
|
144
144
|
) {}
|
|
145
145
|
|
|
146
146
|
export const CredentialDispatch = Schema.Literals([
|