Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 15 additions & 0 deletions .changeset/tsconfig-roles-and-ts-extensions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
"@systemfsoftware/agent-ai-decision": none
"@systemfsoftware/agent": none
"@systemfsoftware/agent-platform-cloudflare": none
"@systemfsoftware/agent-platform-node": none
"@systemfsoftware/agent-pr-review": none
"@systemfsoftware/agent-storage-cloudflare": none
"@systemfsoftware/agent-storage-memory": none
"@systemfsoftware/agent-storage-postgres": none
"@systemfsoftware/agent-storage-sql": none
"@systemfsoftware/agent-storage-sqlite": none
"@systemfsoftware/agent-testing": none
---

Typecheck configuration only: solution-root tsconfigs with composite role projects, `tsc -b` typecheck scripts, and extensionless relative imports. No runtime or public API change.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ test/fixtures/*.d.ts
/result-*
# Astro build cache and generated content types
.astro/
# esbuild bundles of node-run entrypoints
.scripts/
**/.scripts/
scripts/.verify-record-format.mjs
**/.entries/
4 changes: 2 additions & 2 deletions docs/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import yieldedTheme from '@yielded/starlight-theme'
import { defineConfig } from 'astro/config'
import starlightLinksValidator from 'starlight-links-validator'

import { snippetPlugins } from './integrations/snippets.ts'
import { socialImages } from './integrations/social-images.ts'
import { snippetPlugins } from './integrations/snippets'
import { socialImages } from './integrations/social-images'

export default defineConfig({
// No `site` until an approved documentation domain exists: a repository URL is not a docs
Expand Down
3 changes: 1 addition & 2 deletions docs/integrations/snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const snippetPlugins = [
sourcePlugin,
ecTwoSlash({
cwd: snippetsRoot,
tsConfigPath: resolve(import.meta.dirname, '../tsconfig.snippets.json'),
tsConfigPath: resolve(import.meta.dirname, '../snippets.compiler-options.json'),
instanceConfigs: { twoslash: { explicitTrigger: true, languages: ['ts', 'tsx'] } },
twoslashOptions: {
tsModule: ts,
Expand All @@ -55,7 +55,6 @@ export const snippetPlugins = [
target: ts.ScriptTarget.ES2023,
module: ts.ModuleKind.ESNext,
moduleResolution: ts.ModuleResolutionKind.Bundler,
allowImportingTsExtensions: true,
noEmit: true,
strict: true,
typeRoots: [
Expand Down
2 changes: 1 addition & 1 deletion docs/integrations/social-images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { NodeServices } from '@effect/platform-node'
import type { AstroIntegration } from 'astro'
import { Effect, FileSystem } from 'effect'

import { type SocialPage, writeSocialImages } from './social-renderer.ts'
import { type SocialPage, writeSocialImages } from './social-renderer'

// Read the rendered metadata so crawlers and generated cards always share page copy.
const decodeHtml = (text: string) =>
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "astro build",
"dev": "astro dev",
"preview": "astro preview",
"typecheck": "astro sync && tsrs --noEmit -p tsconfig.json"
"typecheck": "astro sync && tsc -b --dry && effect-tsgo tsrs --noEmit -p tsconfig.app.json"
},
"dependencies": {
"@astrojs/starlight": "catalog:",
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions docs/snippets/travel-planner/background-coordinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Agent, Subagent } from '@systemfsoftware/agent'
import { Schema } from 'effect'
import { Toolkit } from 'effect/ai'

import { CoordinatorInput } from './background-input.ts'
import { Researcher } from './researcher.ts'
import { CoordinatorInput } from './background-input'
import { Researcher } from './researcher'

const Research = Subagent.make('activity-researcher', { target: Researcher })

Expand Down
10 changes: 5 additions & 5 deletions docs/snippets/travel-planner/background-host.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { NodeDurableHost } from '@systemfsoftware/agent-platform-node'
import { Layer } from 'effect'

import { WorkerAccessLive } from './background-access.ts'
import { BackgroundCoordinator, FollowUpResearch, ResearchReporting, StartResearch } from './background-coordinator.ts'
import { definitions, ModelLive, OpenAiLive } from './node-agent.ts'
import { Researcher } from './researcher.ts'
import { TravelToolsLive } from './tools.ts'
import { WorkerAccessLive } from './background-access'
import { BackgroundCoordinator, FollowUpResearch, ResearchReporting, StartResearch } from './background-coordinator'
import { definitions, ModelLive, OpenAiLive } from './node-agent'
import { Researcher } from './researcher'
import { TravelToolsLive } from './tools'

export const HostLive = NodeDurableHost.layer(
[
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/travel-planner/background-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { NodeRuntime } from '@effect/platform-node'
import { NodeDurableHost } from '@systemfsoftware/agent-platform-node'
import { Effect } from 'effect'

import { HostLive } from './background-host.ts'
import { HostLive } from './background-host'

NodeRuntime.runMain(NodeDurableHost.run.pipe(Effect.provide(HostLive)))
2 changes: 1 addition & 1 deletion docs/snippets/travel-planner/coordinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Agent } from '@systemfsoftware/agent'
import { Schema } from 'effect'
import { Toolkit } from 'effect/ai'

import { Research } from './delegation.ts'
import { Research } from './delegation'

export const Coordinator = Agent.make('trip-coordinator', {
input: Schema.Struct({ city: Schema.String }),
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/travel-planner/delegation-custom.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Subagent } from '@systemfsoftware/agent'
import { Effect, Schema } from 'effect'

import { Researcher } from './researcher.ts'
import { Researcher } from './researcher'

export class ResearchFailed extends Schema.TaggedError<ResearchFailed>()('ResearchFailed', {
reason: Schema.String,
Expand Down
6 changes: 3 additions & 3 deletions docs/snippets/travel-planner/delegation-live.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { AgentRuntime, InMemory, Subagent } from '@systemfsoftware/agent'
import { Config, Effect, Layer } from 'effect'
import { FetchHttpClient } from 'effect/http'

import { Coordinator } from './coordinator.ts'
import { Research } from './delegation.ts'
import { TravelToolsLive } from './tools.ts'
import { Coordinator } from './coordinator'
import { Research } from './delegation'
import { TravelToolsLive } from './tools'

const ModelLive = OpenAiLanguageModel.model('gpt-6-luna')

Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/travel-planner/delegation-main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NodeRuntime } from '@effect/platform-node'
import { Console, Effect } from 'effect'

import { program } from './delegation-live.ts'
import { program } from './delegation-live'

NodeRuntime.runMain(program.pipe(Effect.tap(({ output }) => Console.log(output))))
2 changes: 1 addition & 1 deletion docs/snippets/travel-planner/delegation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Subagent } from '@systemfsoftware/agent'

import { Researcher } from './researcher.ts'
import { Researcher } from './researcher'

export const Research = Subagent.make('delegate_research_activities', { target: Researcher })
8 changes: 4 additions & 4 deletions docs/snippets/travel-planner/durable-delegation-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { NodeDurableHost } from '@systemfsoftware/agent-platform-node'
import { SubagentReservationsMemoryLive } from '@systemfsoftware/agent/subagent-reservations'
import { Layer } from 'effect'

import { Coordinator } from './coordinator.ts'
import { Research } from './delegation.ts'
import { definitions, ModelLive, OpenAiLive } from './node-agent.ts'
import { TravelToolsLive } from './tools.ts'
import { Coordinator } from './coordinator'
import { Research } from './delegation'
import { definitions, ModelLive, OpenAiLive } from './node-agent'
import { TravelToolsLive } from './tools'

const ResearchLive = Subagent.layer(Research).pipe(
Layer.provide(ModelLive),
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/travel-planner/node-host.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NodeDurableHost } from '@systemfsoftware/agent-platform-node'
import { Layer } from 'effect'

import { definitions, ModelLive, OpenAiLive, planner } from './node-agent.ts'
import { definitions, ModelLive, OpenAiLive, planner } from './node-agent'

export const HostLive = NodeDurableHost.layer([{ agent: planner, model: ModelLive, definitions }], {
filename: './agents.sqlite',
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/travel-planner/node-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { NodeRuntime } from '@effect/platform-node'
import { NodeDurableHost } from '@systemfsoftware/agent-platform-node'
import { Effect } from 'effect'

import { HostLive } from './node-host.ts'
import { HostLive } from './node-host'

NodeRuntime.runMain(NodeDurableHost.run.pipe(Effect.provide(HostLive)))
2 changes: 1 addition & 1 deletion docs/snippets/travel-planner/observe-updates.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AgentRuntime, AgentUpdates } from '@systemfsoftware/agent'
import { Effect, Stream } from 'effect'

import { HotelResearcher } from './background-updates.ts'
import { HotelResearcher } from './background-updates'

const updates = AgentRuntime.stream(HotelResearcher, {
city: 'Johannesburg',
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/travel-planner/researcher.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Agent } from '@systemfsoftware/agent'
import { Schema } from 'effect'

import { TravelTools } from './tools.ts'
import { TravelTools } from './tools'

export const Researcher = Agent.make('activity-researcher', {
input: Schema.Struct({ city: Schema.String, focus: Schema.String }),
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/guide/run-agents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ accepts work that can outlive the request and resume after restart. Both use the
```ts twoslash
import { AgentRuntime } from "@systemfsoftware/agent";
import { Effect } from "effect";
import { TravelPlanner as planner } from "./planner.ts";
import { TravelPlanner as planner } from "./planner";
// ---cut---
const program = Effect.gen(function* () {
const result = yield* AgentRuntime.run(planner, { city: "Lisbon", days: 2 });
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/guide/threads.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ it does not by itself make execution durable or authorize access.
import { AgentRuntime, InMemory } from '@systemfsoftware/agent'
import { Effect } from 'effect'

import { ModelLive, OpenAiLive, planner } from './node-agent.ts'
import { ModelLive, OpenAiLive, planner } from './node-agent'
// ---cut---
const conversation = Effect.gen(function*() {
const first = yield* AgentRuntime.run(planner, 'Plan a weekend in Lisbon.')
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/platforms/cloudflare.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ provider. Reuse the [example agent and provider setup](https://github.com/system

```ts twoslash
// @types: @cloudflare/workers-types
import { definitions, ModelLive, OpenAiLive, planner } from "./node-agent.ts";
import { definitions, ModelLive, OpenAiLive, planner } from "./node-agent";
// ---cut---
import { ThreadObject } from "@systemfsoftware/agent-platform-cloudflare";
import { Layer } from "effect";
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/reference/decision-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ task context to `resolve`. Bind its returned native model to the Agent before ru
import { Agent, AgentRuntime, Identifiers } from '@systemfsoftware/agent'
import { Effect, Schema } from 'effect'

import { Assistant, ThreadAuthorization, ThreadModels } from './auto-model.ts'
import { Assistant, ThreadAuthorization, ThreadModels } from './auto-model'
declare const threadId: Identifiers.ThreadId
declare const rawInput: unknown
// ---cut---
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/storage/memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ can end with the process. No storage package is required.
import { AgentRuntime, InMemory } from '@systemfsoftware/agent'
import { Effect } from 'effect'

import { planner } from './node-agent.ts'
import { planner } from './node-agent'

const conversation = Effect.gen(function*() {
const first = yield* AgentRuntime.run(planner, 'Plan a trip to Lisbon')
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/storage/sqlite.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { AgentRuntime, PersistentHistory } from '@systemfsoftware/agent'
import { SqliteThreadStore } from '@systemfsoftware/agent-storage-sqlite'
import { Effect, Layer } from 'effect'

import { planner } from './node-agent.ts'
import { planner } from './node-agent'

const History = PersistentHistory.layer.pipe(
Layer.provide(SqliteThreadStore.layer({ filename: './history.sqlite' })),
Expand Down
22 changes: 22 additions & 0 deletions docs/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"composite": true,
"noEmit": false,
"emitDeclarationOnly": true,
"outDir": "node_modules/.cache/tsc/app",
"tsBuildInfoFile": "node_modules/.cache/tsconfig.app.tsbuildinfo",
"customConditions": [
"@systemfsoftware/source"
]
},
"include": [
".astro/types.d.ts",
"src/**/*.ts",
"integrations/**/*.ts"
],
"exclude": [
"dist",
"snippets"
]
}
8 changes: 6 additions & 2 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"extends": "astro/tsconfigs/strict",
"include": [".astro/types.d.ts", "src/**/*.ts", "integrations/**/*.ts"],
"exclude": ["dist", "snippets"]
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
}
]
}
4 changes: 2 additions & 2 deletions examples/browser-speed/src/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { Context, Effect, Layer, Schema } from 'effect'
import { Tool, Toolkit } from 'effect/ai'
import type { Page } from 'puppeteer-core/lib/esm/puppeteer/puppeteer-core-browser.js'

import { BrowserHandoff, defaultChallenge, LabError, type RunInput } from './contract.ts'
import { Trace } from './telemetry.ts'
import { BrowserHandoff, defaultChallenge, LabError, type RunInput } from './contract'
import { Trace } from './telemetry'

export const TaskResult = Schema.Struct({
message: Schema.String,
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-speed/src/kitesurf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type BrowserSession, BrowserSessionError } from '@systemfsoftware/agent
import { Effect, Option, Redacted, Schema, Semaphore } from 'effect'
import puppeteer, { type ConnectionTransport } from 'puppeteer-core/lib/esm/puppeteer/puppeteer-core-browser.js'

import { browserCommandTimeoutMillis, LabError } from './contract.ts'
import { browserCommandTimeoutMillis, LabError } from './contract'

const Identity = Schema.Struct({
product: Schema.NonEmptyString,
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-speed/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import '@fontsource-variable/ibm-plex-sans'

import '@fontsource/ibm-plex-mono/400.css'

import { App } from './ui.tsx'
import { App } from './ui'

import './style.css'

Expand Down
12 changes: 6 additions & 6 deletions examples/browser-speed/src/owner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { ThreadHistory } from '@systemfsoftware/agent/thread-history'
import { Cause, Clock, Effect, Exit, Fiber, type Layer, Option, Redacted, Schema } from 'effect'
import * as SecureRandom from 'effect/crypto/SecureRandom'

import { Browser, makeBrowser } from './browser.ts'
import { Browser, makeBrowser } from './browser'
import {
browserCommandTimeoutMillis,
coffeeDemo,
Expand All @@ -30,11 +30,11 @@ import {
type Snapshot,
supportsUltrafast,
type ViewMode,
} from './contract.ts'
import type { connectKitesurf } from './kitesurf.ts'
import { executeTask } from './runner.ts'
import { makeTrace, Trace, traceOtlp } from './telemetry.ts'
import { TraceStore } from './trace-store.ts'
} from './contract'
import type { connectKitesurf } from './kitesurf'
import { executeTask } from './runner'
import { makeTrace, Trace, traceOtlp } from './telemetry'
import { TraceStore } from './trace-store'

const randomUUID = SecureRandom.SecureRandom.use((crypto) => crypto.uuidV4()).pipe(
Effect.provide(BrowserCrypto.layer),
Expand Down
8 changes: 4 additions & 4 deletions examples/browser-speed/src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import { Duration, Effect, Layer, Redacted, Schema } from 'effect'
import { Toolkit } from 'effect/ai'
import { FetchHttpClient, HttpClient, HttpClientRequest } from 'effect/http'

import { Browser, completionTools, TaskResult } from './browser.ts'
import { defaultChallenge, LabError, type ModelApi, type RunInput } from './contract.ts'
import { Trace, traceModels, traceModelStream, traceOpenAiClient } from './telemetry.ts'
import { prepareWikipedia } from './wikipedia.ts'
import { Browser, completionTools, TaskResult } from './browser'
import { defaultChallenge, LabError, type ModelApi, type RunInput } from './contract'
import { Trace, traceModels, traceModelStream, traceOpenAiClient } from './telemetry'
import { prepareWikipedia } from './wikipedia'

const browserCode = BrowserUse.make({
limits: CodeExecutionLimits.make({
Expand Down
3 changes: 2 additions & 1 deletion examples/browser-speed/src/state.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="vite/client" />
import * as BrowserCrypto from '@effect/platform-browser/BrowserCrypto'
import { authenticatedHttpClient, sessionObservation } from '@systemfsoftware/agent-example-auth/client'
import { Cause, Effect, Option, Predicate, Redacted, Schema } from 'effect'
Expand All @@ -16,7 +17,7 @@ import {
serviceTierForModel,
TraceArchive,
VisitorKey,
} from './contract.ts'
} from './contract'

const randomUUID = SecureRandom.SecureRandom.use((crypto) => crypto.uuidV4()).pipe(
Effect.provide(BrowserCrypto.layer),
Expand Down
4 changes: 2 additions & 2 deletions examples/browser-speed/src/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
type Report,
type RunInput,
type Span,
} from './contract.ts'
import { TraceStore } from './trace-store.ts'
} from './contract'
import { TraceStore } from './trace-store'

type Details = Partial<
Pick<
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-speed/src/trace-store.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Clock, Context, Effect, Schema, Semaphore } from 'effect'

import { LabError, PrivateEntry, Report, TraceArchive, TraceEvent } from './contract.ts'
import { LabError, PrivateEntry, Report, TraceArchive, TraceEvent } from './contract'

export interface TraceSink {
readonly append: (event: TraceEvent) => void
Expand Down
Loading