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.
Files changed (115) hide show
  1. package/dist/{AgentRuntime-CHipL2jG.mjs → AgentRuntime-BPjQM1Nv.mjs} +2 -2
  2. package/dist/AgentRuntime-BPjQM1Nv.mjs.map +1 -0
  3. package/dist/{DurableAgentRuntime-D7gDKGjH.mjs → DurableAgentRuntime-CdrBuKZY.mjs} +4 -4
  4. package/dist/{DurableAgentRuntime-D7gDKGjH.mjs.map → DurableAgentRuntime-CdrBuKZY.mjs.map} +1 -1
  5. package/dist/{EventSource-OqS_P9ug.d.mts → EventSource-c6GRTCsl.d.mts} +3 -3
  6. package/dist/{PreparedInputAdmission-C4HbjHgl.d.mts → PreparedInputAdmission-QzFbW2LQ.d.mts} +4 -4
  7. package/dist/Records-C9cezOEf.mjs +799 -0
  8. package/dist/Records-C9cezOEf.mjs.map +1 -0
  9. package/dist/{Records-BAGkekt8.d.mts → Records-vFp_ZQ9Y.d.mts} +21 -3
  10. package/dist/{RunJournal-Cgg1kNvc.mjs → RunJournal-lwbrh2hZ.mjs} +2 -2
  11. package/dist/{RunJournal-Cgg1kNvc.mjs.map → RunJournal-lwbrh2hZ.mjs.map} +1 -1
  12. package/dist/{Schedule-H3SEYX9g.d.mts → Schedule-BkZvKyMw.d.mts} +2 -2
  13. package/dist/{Scheduling-C9aIP8zT.mjs → Scheduling-D0QqOoeT.mjs} +2 -2
  14. package/dist/{Scheduling-C9aIP8zT.mjs.map → Scheduling-D0QqOoeT.mjs.map} +1 -1
  15. package/dist/{Subagent-U5qXOFE8.mjs → Subagent-CnTzCy8k.mjs} +2 -2
  16. package/dist/{Subagent-U5qXOFE8.mjs.map → Subagent-CnTzCy8k.mjs.map} +1 -1
  17. package/dist/{Subscription-BEP8oQO5.d.mts → Subscription-CKQ0KDHN.d.mts} +3 -3
  18. package/dist/{SubscriptionInput-vAAOBrK7.d.mts → SubscriptionInput-Cth8F_7b.d.mts} +3 -3
  19. package/dist/capabilities/Subagent.mjs +1 -1
  20. package/dist/capabilities/WebSearch.d.mts +3 -3
  21. package/dist/capabilities/WebSearch.mjs +9 -6
  22. package/dist/capabilities/WebSearch.mjs.map +1 -1
  23. package/dist/durable/ActivityStore.d.mts +1 -1
  24. package/dist/durable/ActivityStore.mjs +1 -1
  25. package/dist/durable/Admin.d.mts +1 -1
  26. package/dist/durable/Admin.mjs +1 -1
  27. package/dist/durable/AgentRegistration.d.mts +1 -1
  28. package/dist/durable/Certification.d.mts +1 -1
  29. package/dist/durable/CommittedActivity.d.mts +1 -1
  30. package/dist/durable/CommittedActivity.mjs +1 -1
  31. package/dist/durable/Digest.d.mts +1 -1
  32. package/dist/durable/Digest.mjs +1 -1
  33. package/dist/durable/DurableAgentRuntime.d.mts +1 -1
  34. package/dist/durable/DurableAgentRuntime.mjs +1 -1
  35. package/dist/durable/EventSource.d.mts +1 -1
  36. package/dist/durable/EventSource.mjs +1 -1
  37. package/dist/durable/GitHubWorkflowSource.d.mts +48 -6
  38. package/dist/durable/GitHubWorkflowSource.mjs +13 -13
  39. package/dist/durable/GitHubWorkflowSource.mjs.map +1 -1
  40. package/dist/durable/MessageDelivery.d.mts +22 -22
  41. package/dist/durable/MessageDelivery.mjs +1 -1
  42. package/dist/durable/MessageDeliveryStoreConformance.d.mts +39 -39
  43. package/dist/durable/MessageDeliveryStoreConformance.mjs +1 -1
  44. package/dist/durable/PersistentHistory.d.mts +1 -1
  45. package/dist/durable/PersistentHistory.mjs +2 -2
  46. package/dist/durable/PreparedInputAdmission.d.mts +1 -1
  47. package/dist/durable/Records.d.mts +1 -1
  48. package/dist/durable/Records.mjs +2 -795
  49. package/dist/durable/Recovery.d.mts +1 -1
  50. package/dist/durable/Recovery.mjs +1 -1
  51. package/dist/durable/RunJournal.d.mts +1 -1
  52. package/dist/durable/RunJournal.mjs +1 -1
  53. package/dist/durable/Schedule.d.mts +1 -1
  54. package/dist/durable/Schedule.mjs +1 -1
  55. package/dist/durable/ScheduleStoreConformance.d.mts +1 -1
  56. package/dist/durable/ScheduleStoreConformance.mjs +1 -1
  57. package/dist/durable/ScheduleTransition.d.mts +1 -1
  58. package/dist/durable/ScheduleTransition.mjs +1 -1
  59. package/dist/durable/Scheduling.d.mts +2 -2
  60. package/dist/durable/Scheduling.mjs +1 -1
  61. package/dist/durable/SqlStorageV2Upgrade.d.mts +2 -2
  62. package/dist/durable/SqlStorageV2Upgrade.mjs +1 -1
  63. package/dist/durable/SqlSubscriptionStore.d.mts +2 -2
  64. package/dist/durable/SqlSubscriptionStore.mjs +1 -1
  65. package/dist/durable/SubmissionLedger.d.mts +1 -1
  66. package/dist/durable/SubmissionLedger.mjs +1 -1
  67. package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
  68. package/dist/durable/SubmissionLedgerConformance.mjs +1 -1
  69. package/dist/durable/SubmissionStatus.d.mts +1 -1
  70. package/dist/durable/Subscription.d.mts +1 -1
  71. package/dist/durable/Subscription.mjs +1 -1
  72. package/dist/durable/SubscriptionInput.d.mts +1 -1
  73. package/dist/durable/SubscriptionInput.mjs +1 -1
  74. package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
  75. package/dist/durable/SubscriptionStoreConformance.mjs +1 -1
  76. package/dist/durable/SubscriptionTools.d.mts +3 -3
  77. package/dist/durable/SubscriptionTransition.d.mts +1 -1
  78. package/dist/durable/SubscriptionTransition.mjs +1 -1
  79. package/dist/durable/Subscriptions.d.mts +5 -5
  80. package/dist/durable/Subscriptions.mjs +1 -1
  81. package/dist/durable/ThreadContextHistory.d.mts +1 -1
  82. package/dist/durable/ThreadContextHistory.mjs +1 -1
  83. package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
  84. package/dist/durable/ThreadContextHistoryProjection.mjs +1 -1
  85. package/dist/durable/ThreadInvariants.d.mts +1 -1
  86. package/dist/durable/ThreadInvariants.mjs +1 -1
  87. package/dist/durable/ThreadProjection.d.mts +1 -1
  88. package/dist/durable/ThreadProjection.mjs +1 -1
  89. package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
  90. package/dist/durable/ThreadStore.d.mts +1 -1
  91. package/dist/durable/ThreadStore.mjs +1 -1
  92. package/dist/durable/ThreadStoreConformance.d.mts +1 -1
  93. package/dist/durable/ThreadStoreConformance.mjs +1 -1
  94. package/dist/durable/ToolReconciler.mjs +1 -1
  95. package/dist/durable/WorkerHost.d.mts +1 -1
  96. package/dist/engine/AgentRuntime.mjs +1 -1
  97. package/dist/index.d.mts +6 -6
  98. package/dist/index.mjs +6 -6
  99. package/dist/sandbox/InteractiveBrowser.mjs +2 -2
  100. package/dist/sandbox/InteractiveBrowser.mjs.map +1 -1
  101. package/dist/sandbox/PageCapture.mjs +4 -4
  102. package/dist/sandbox/PageCapture.mjs.map +1 -1
  103. package/dist/sandbox/ProtectedBrowser.mjs +1 -1
  104. package/dist/sandbox/ProtectedBrowser.mjs.map +1 -1
  105. package/package.json +1 -1
  106. package/src/capabilities/WebSearch.ts +23 -17
  107. package/src/core/internal/strict-schema.ts +14 -0
  108. package/src/durable/GitHubWorkflowSource.ts +32 -38
  109. package/src/durable/Records.ts +8 -4
  110. package/src/engine/internal/primitive-delta.ts +1 -1
  111. package/src/sandbox/InteractiveBrowser.ts +2 -2
  112. package/src/sandbox/PageCapture.ts +6 -7
  113. package/src/sandbox/ProtectedBrowser.ts +1 -1
  114. package/dist/AgentRuntime-CHipL2jG.mjs.map +0 -1
  115. package/dist/durable/Records.mjs.map +0 -1
@@ -1,6 +1,7 @@
1
- import { Context, Effect, Encoding, FileSystem, Layer, Redacted, Schema } from "effect";
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 = strict(
26
- Schema.Struct({
27
- id: PositiveId,
28
- owner: GitHubName,
29
- name: GitHubName,
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 = strict(
37
- Schema.Struct({
38
- runId: PositiveId,
39
- attempt: PositiveId,
40
- expectedHeadSha: GitCommitSha,
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 = strict(
51
- Schema.Struct({
52
- repositoryId: PositiveId,
53
- runId: PositiveId,
54
- attempt: PositiveId,
55
- headSha: GitCommitSha,
56
- conclusion: GitHubConclusion,
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
- options.repository,
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)(request.repository).pipe(
157
- Effect.mapError(() => httpFailure("invalid-response", false)),
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, FileSystem.Size(1024 * 1024)),
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)(options.repository).pipe(
265
- Effect.mapError(() => sourceError("github-repository-configuration", false)),
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
 
@@ -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 isSettlementFailureDiagnostic = Schema.is(SettlementFailureDiagnostic);
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" || isSettlementFailureDiagnostic(settled.result)) &&
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/Content/Part";
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
- ]).pipe(Schema.annotate({ parseOptions: { onExcessProperty: "error" } }));
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
- }).pipe(Schema.annotate({ parseOptions: { onExcessProperty: "error" } })),
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
- }).pipe(Schema.annotate({ parseOptions: { onExcessProperty: "error" } }));
257
+ });
261
258
 
262
- const isResponseFormatDocument = Schema.is(ResponseFormatDocument);
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 (!isResponseFormatDocument(input)) return false;
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
- }).pipe(Schema.annotate({ parseOptions: { onExcessProperty: "error" } })),
143
+ }),
144
144
  ) {}
145
145
 
146
146
  export const CredentialDispatch = Schema.Literals([