tardie 0.32.0 → 0.33.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tardie",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
4
4
  "license": "MIT",
5
5
  "author": "Clavia, Inc.",
6
6
  "description": "Actor, agent, client, and host APIs for Tardigrade.",
@@ -16,7 +16,7 @@
16
16
  "access": "public"
17
17
  },
18
18
  "tardigrade": {
19
- "sourceTree": "618e446f7731d0575ee2c6d6655815fb3dfe132f"
19
+ "sourceTree": "02a46923bddfedfb422dd594b7418a27591191a4"
20
20
  },
21
21
  "files": [
22
22
  "src",
@@ -5,6 +5,7 @@ import type { CodeComponent } from "tardie/code/package/definition"
5
5
  import type { KeyValueStore } from "effect/unstable/persistence"
6
6
  import { tools as packageTools, type ToolsOptions } from "./packages"
7
7
  import type { Event } from "tardie/core/log/event"
8
+ import { EventLog } from "tardie/core/log"
8
9
  import { toolReturned } from "../../log/events"
9
10
  import type { ToolSpec } from "../../model/request"
10
11
  import type { ToolOffer } from "../view"
@@ -15,7 +16,13 @@ export interface NativeTool<R = never> {
15
16
  readonly spec: ToolSpec
16
17
  readonly run: (
17
18
  input: unknown,
18
- context: { readonly callId: string; readonly turn?: string; readonly signal: AbortSignal }
19
+ context: {
20
+ readonly callId: string
21
+ readonly turn?: string
22
+ readonly signal: AbortSignal
23
+ // readEvents reads the committed actor log when its effect runs (machine.test.ts).
24
+ readonly readEvents: () => Effect.Effect<ReadonlyArray<Event>>
25
+ }
19
26
  ) => Effect.Effect<unknown, never, R>
20
27
  }
21
28
 
@@ -41,10 +48,12 @@ const nativeTools = <R = never>(
41
48
  input: { callId: call.callId, arguments: call.arguments, turn: call.turn },
42
49
  act: (input, { signal }) =>
43
50
  Effect.gen(function* () {
51
+ const log = yield* EventLog
44
52
  const result = yield* tool.run(input.arguments, {
45
53
  callId: input.callId,
46
54
  ...(input.turn === undefined ? {} : { turn: input.turn }),
47
- signal
55
+ signal,
56
+ readEvents: () => log.read
48
57
  })
49
58
  const at = yield* Clock.currentTimeMillis
50
59
  return [toolReturned({ callId: input.callId, result, ...stamp, at })]