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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 44 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jobs:
npm profile get --registry https://registry.npmjs.org --json || echo "WARN: cannot read npm profile (continuing)"
echo ""
echo "=== Sanity: does package already exist? (ok if 404) ==="
npm view @predicatesystems/sdk version --registry https://registry.npmjs.org --json || echo "INFO: @predicatesystems/sdk not found yet (expected for first publish)"
npm view @predicatesystems/runtime version --registry https://registry.npmjs.org --json || echo "INFO: @predicatesystems/runtime not found yet (expected for first publish)"

- name: Publish to npm
run: |
Expand All @@ -185,14 +185,55 @@ jobs:
tag_name: v${{ steps.version.outputs.version }}
name: Release v${{ steps.version.outputs.version }}
body: |
Release v${{ steps.version.outputs.version }} of @predicatesystems/sdk
Release v${{ steps.version.outputs.version }} of @predicatesystems/runtime

## Installation
```bash
npm install @predicatesystems/sdk@${{ steps.version.outputs.version }}
npm install @predicatesystems/runtime@${{ steps.version.outputs.version }}
```
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-compat-shim:
runs-on: ubuntu-latest
needs: build-and-publish

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
scope: '@predicatesystems'
always-auth: true

- name: Extract version from tag or input
id: version
run: |
if [ "${{ github.event_name }}" == "release" ]; then
TAG_NAME="${{ github.event.release.tag_name }}"
VERSION=${TAG_NAME#v}
else
VERSION="${{ github.event.inputs.version }}"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"

- name: Sync shim version and runtime dependency
run: |
VERSION="${{ steps.version.outputs.version }}"
npm pkg set version=$VERSION --prefix compat/sdk-shim
npm pkg set dependencies."@predicatesystems/runtime"=$VERSION --prefix compat/sdk-shim

- name: Publish compatibility shim to npm
run: |
cd compat/sdk-shim
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

2 changes: 1 addition & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"*.ts": ["eslint --fix --max-warnings=-1", "prettier --write"],
"*.ts": ["eslint --fix --max-warnings=-1 --no-warn-ignored", "prettier --write"],
"*.{json,md}": ["prettier --write"]
}
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

All notable changes to `@predicatesystems/sdk` will be documented in this file.
All notable changes to `@predicatesystems/runtime` will be documented in this file.

## Unreleased

Expand All @@ -24,7 +24,7 @@ import {
PredicateBrowserAgent,
type RuntimeStep,
LocalLLMProvider, // or OpenAIProvider / AnthropicProvider / DeepInfraProvider
} from '@predicatesystems/sdk';
} from '@predicatesystems/runtime';

const runtime = new AgentRuntime(browserLike, page, tracer);
const llm = new LocalLLMProvider({ model: 'qwen2.5:7b', baseUrl: 'http://localhost:11434/v1' });
Expand Down Expand Up @@ -65,7 +65,7 @@ const agent = new PredicateBrowserAgent({
If you set `captcha.policy="callback"`, you must provide a handler. The SDK does **not** include a public CAPTCHA solver.

```ts
import { HumanHandoffSolver } from '@predicatesystems/sdk';
import { HumanHandoffSolver } from '@predicatesystems/runtime';

const agent = new PredicateBrowserAgent({
runtime,
Expand Down
33 changes: 23 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ The core loop is:
## Install

```bash
npm install @predicatesystems/sdk
npm install @predicatesystems/runtime
npx playwright install chromium
```

Legacy install compatibility remains available through the shim package:

```bash
npm install @predicatesystems/sdk
```

## Naming migration (Predicate rebrand)

Use the new `Predicate*` class names for all new code:
Expand All @@ -51,9 +57,9 @@ Use the new `Predicate*` class names for all new code:
## Quickstart: a verification-first loop

```ts
import { PredicateBrowser, AgentRuntime } from '@predicatesystems/sdk';
import { JsonlTraceSink, Tracer } from '@predicatesystems/sdk';
import { exists, urlContains } from '@predicatesystems/sdk';
import { PredicateBrowser, AgentRuntime } from '@predicatesystems/runtime';
import { JsonlTraceSink, Tracer } from '@predicatesystems/runtime';
import { exists, urlContains } from '@predicatesystems/runtime';
import type { Page } from 'playwright';

async function main(): Promise<void> {
Expand Down Expand Up @@ -102,7 +108,7 @@ import {
JsonlTraceSink,
exists,
urlContains,
} from '@predicatesystems/sdk';
} from '@predicatesystems/runtime';

async function runExistingAgent(page: Page): Promise<void> {
const tracer = new Tracer('run-123', new JsonlTraceSink('trace.jsonl'));
Expand All @@ -129,7 +135,14 @@ async function runExistingAgent(page: Page): Promise<void> {
If you want Predicate to drive the loop end-to-end, you can use the SDK primitives directly: take a snapshot, select elements, act, then verify.

```ts
import { PredicateBrowser, snapshot, find, typeText, click, waitFor } from '@predicatesystems/sdk';
import {
PredicateBrowser,
snapshot,
find,
typeText,
click,
waitFor,
} from '@predicatesystems/runtime';

async function loginExample(): Promise<void> {
const browser = new PredicateBrowser();
Expand Down Expand Up @@ -207,7 +220,7 @@ if (!ok) {
## ToolRegistry (LLM-callable tools)

```ts
import { ToolRegistry, registerDefaultTools } from '@predicatesystems/sdk';
import { ToolRegistry, registerDefaultTools } from '@predicatesystems/runtime';

const registry = new ToolRegistry();
registerDefaultTools(registry);
Expand All @@ -219,8 +232,8 @@ const toolsForLLM = registry.llmTools();
Chrome permission prompts are outside the DOM and can be invisible to snapshots. Prefer setting a policy **before navigation**.

```ts
import { PredicateBrowser } from '@predicatesystems/sdk';
import type { PermissionPolicy } from '@predicatesystems/sdk';
import { PredicateBrowser } from '@predicatesystems/runtime';
import type { PermissionPolicy } from '@predicatesystems/runtime';

const policy: PermissionPolicy = {
default: 'clear',
Expand Down Expand Up @@ -254,7 +267,7 @@ If your backend supports it, you can also use ToolRegistry permission tools (`gr
## Downloads (verification predicate)

```ts
import { downloadCompleted } from '@predicatesystems/sdk';
import { downloadCompleted } from '@predicatesystems/runtime';

runtime.assert(downloadCompleted('report.csv'), 'download_ok', true);
```
Expand Down
10 changes: 10 additions & 0 deletions compat/sdk-shim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# @predicatesystems/sdk compatibility shim

This package preserves install/import compatibility for users still on:

```bash
npm install @predicatesystems/sdk
```

It re-exports from `@predicatesystems/runtime`. New code should import from
`@predicatesystems/runtime` directly.
1 change: 1 addition & 0 deletions compat/sdk-shim/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@predicatesystems/runtime';
3 changes: 3 additions & 0 deletions compat/sdk-shim/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"use strict";

module.exports = require("@predicatesystems/runtime");
19 changes: 19 additions & 0 deletions compat/sdk-shim/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@predicatesystems/sdk",
"version": "1.1.0",
"description": "Compatibility shim for @predicatesystems/runtime",
"main": "index.js",
"types": "index.d.ts",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@predicatesystems/runtime": "1.1.0"
},
"files": [
"index.js",
"index.d.ts",
"README.md"
],
"license": "(MIT OR Apache-2.0)"
}
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ module.exports = tseslint.config(
'node_modules/**',
'*.js',
'src/extension/**',
'compat/**',
'examples/**',
'tests/**',
],
Expand Down
4 changes: 2 additions & 2 deletions examples/agent-runtime-captcha-strategies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
HumanHandoffSolver,
SentienceBrowser,
VisionSolver,
} from '@predicatesystems/sdk';
import { createTracer } from '@predicatesystems/sdk';
} from '@predicatesystems/runtime';
import { createTracer } from '@predicatesystems/runtime';

async function notifyWebhook(ctx: any): Promise<void> {
console.log(`[captcha] external resolver notified: url=${ctx.url} run_id=${ctx.runId}`);
Expand Down
2 changes: 1 addition & 1 deletion examples/lang-chain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ These examples show how to wrap Sentience TS SDK primitives as LangChain JS tool
Install (example):

```bash
npm install @predicatesystems/sdk @langchain/core zod
npm install @predicatesystems/runtime @langchain/core zod
```

Run:
Expand Down
2 changes: 1 addition & 1 deletion examples/lang-chain/sentience-tools-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Example: Wrap Sentience TS SDK primitives as LangChain JS tools.
*
* Install (example):
* npm install @predicatesystems/sdk @langchain/core zod
* npm install @predicatesystems/runtime @langchain/core zod
*
* Run:
* npx ts-node examples/lang-chain/sentience-tools-demo.ts
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@predicatesystems/sdk",
"name": "@predicatesystems/runtime",
"version": "1.1.0",
"description": "TypeScript SDK for Sentience AI Agent Browser Automation",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/visual-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ Return ONLY the integer ID number from the label, nothing else.`;
playgroundPath = path.join(cwd, 'playground', 'images');
} else {
// Check if we're in a playground context via module path
const modulePaths = require.resolve.paths('@predicatesystems/sdk') || [];
const modulePaths = require.resolve.paths('@predicatesystems/runtime') || [];
for (const modulePath of modulePaths) {
const potentialPlayground = path.join(modulePath, '..', 'playground', 'images');
if (fs.existsSync(path.dirname(potentialPlayground))) {
Expand Down
Loading