Skip to content

Commit aa6e3ab

Browse files
authored
Merge pull request #197 from PredicateSystems/rename2
rename sdk to predicatesystems/runtime
2 parents 97c6ccb + ff389d5 commit aa6e3ab

15 files changed

Lines changed: 113 additions & 25 deletions

.github/workflows/release.yml

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ jobs:
170170
npm profile get --registry https://registry.npmjs.org --json || echo "WARN: cannot read npm profile (continuing)"
171171
echo ""
172172
echo "=== Sanity: does package already exist? (ok if 404) ==="
173-
npm view @predicatesystems/sdk version --registry https://registry.npmjs.org --json || echo "INFO: @predicatesystems/sdk not found yet (expected for first publish)"
173+
npm view @predicatesystems/runtime version --registry https://registry.npmjs.org --json || echo "INFO: @predicatesystems/runtime not found yet (expected for first publish)"
174174
175175
- name: Publish to npm
176176
run: |
@@ -185,14 +185,55 @@ jobs:
185185
tag_name: v${{ steps.version.outputs.version }}
186186
name: Release v${{ steps.version.outputs.version }}
187187
body: |
188-
Release v${{ steps.version.outputs.version }} of @predicatesystems/sdk
188+
Release v${{ steps.version.outputs.version }} of @predicatesystems/runtime
189189
190190
## Installation
191191
```bash
192-
npm install @predicatesystems/sdk@${{ steps.version.outputs.version }}
192+
npm install @predicatesystems/runtime@${{ steps.version.outputs.version }}
193193
```
194194
draft: false
195195
prerelease: false
196196
env:
197197
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
198198

199+
publish-compat-shim:
200+
runs-on: ubuntu-latest
201+
needs: build-and-publish
202+
203+
steps:
204+
- name: Checkout code
205+
uses: actions/checkout@v4
206+
207+
- name: Set up Node.js
208+
uses: actions/setup-node@v4
209+
with:
210+
node-version: '20'
211+
registry-url: 'https://registry.npmjs.org'
212+
scope: '@predicatesystems'
213+
always-auth: true
214+
215+
- name: Extract version from tag or input
216+
id: version
217+
run: |
218+
if [ "${{ github.event_name }}" == "release" ]; then
219+
TAG_NAME="${{ github.event.release.tag_name }}"
220+
VERSION=${TAG_NAME#v}
221+
else
222+
VERSION="${{ github.event.inputs.version }}"
223+
fi
224+
echo "version=$VERSION" >> $GITHUB_OUTPUT
225+
echo "Version: $VERSION"
226+
227+
- name: Sync shim version and runtime dependency
228+
run: |
229+
VERSION="${{ steps.version.outputs.version }}"
230+
npm pkg set version=$VERSION --prefix compat/sdk-shim
231+
npm pkg set dependencies."@predicatesystems/runtime"=$VERSION --prefix compat/sdk-shim
232+
233+
- name: Publish compatibility shim to npm
234+
run: |
235+
cd compat/sdk-shim
236+
npm publish --access public
237+
env:
238+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
239+

.lintstagedrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"*.ts": ["eslint --fix --max-warnings=-1", "prettier --write"],
2+
"*.ts": ["eslint --fix --max-warnings=-1 --no-warn-ignored", "prettier --write"],
33
"*.{json,md}": ["prettier --write"]
44
}

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

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

55
## Unreleased
66

@@ -24,7 +24,7 @@ import {
2424
PredicateBrowserAgent,
2525
type RuntimeStep,
2626
LocalLLMProvider, // or OpenAIProvider / AnthropicProvider / DeepInfraProvider
27-
} from '@predicatesystems/sdk';
27+
} from '@predicatesystems/runtime';
2828

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

6767
```ts
68-
import { HumanHandoffSolver } from '@predicatesystems/sdk';
68+
import { HumanHandoffSolver } from '@predicatesystems/runtime';
6969

7070
const agent = new PredicateBrowserAgent({
7171
runtime,

README.md

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,16 @@ The core loop is:
2828
## Install
2929

3030
```bash
31-
npm install @predicatesystems/sdk
31+
npm install @predicatesystems/runtime
3232
npx playwright install chromium
3333
```
3434

35+
Legacy install compatibility remains available through the shim package:
36+
37+
```bash
38+
npm install @predicatesystems/sdk
39+
```
40+
3541
## Naming migration (Predicate rebrand)
3642

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

5359
```ts
54-
import { PredicateBrowser, AgentRuntime } from '@predicatesystems/sdk';
55-
import { JsonlTraceSink, Tracer } from '@predicatesystems/sdk';
56-
import { exists, urlContains } from '@predicatesystems/sdk';
60+
import { PredicateBrowser, AgentRuntime } from '@predicatesystems/runtime';
61+
import { JsonlTraceSink, Tracer } from '@predicatesystems/runtime';
62+
import { exists, urlContains } from '@predicatesystems/runtime';
5763
import type { Page } from 'playwright';
5864

5965
async function main(): Promise<void> {
@@ -102,7 +108,7 @@ import {
102108
JsonlTraceSink,
103109
exists,
104110
urlContains,
105-
} from '@predicatesystems/sdk';
111+
} from '@predicatesystems/runtime';
106112

107113
async function runExistingAgent(page: Page): Promise<void> {
108114
const tracer = new Tracer('run-123', new JsonlTraceSink('trace.jsonl'));
@@ -129,7 +135,14 @@ async function runExistingAgent(page: Page): Promise<void> {
129135
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.
130136

131137
```ts
132-
import { PredicateBrowser, snapshot, find, typeText, click, waitFor } from '@predicatesystems/sdk';
138+
import {
139+
PredicateBrowser,
140+
snapshot,
141+
find,
142+
typeText,
143+
click,
144+
waitFor,
145+
} from '@predicatesystems/runtime';
133146

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

209222
```ts
210-
import { ToolRegistry, registerDefaultTools } from '@predicatesystems/sdk';
223+
import { ToolRegistry, registerDefaultTools } from '@predicatesystems/runtime';
211224

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

221234
```ts
222-
import { PredicateBrowser } from '@predicatesystems/sdk';
223-
import type { PermissionPolicy } from '@predicatesystems/sdk';
235+
import { PredicateBrowser } from '@predicatesystems/runtime';
236+
import type { PermissionPolicy } from '@predicatesystems/runtime';
224237

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

256269
```ts
257-
import { downloadCompleted } from '@predicatesystems/sdk';
270+
import { downloadCompleted } from '@predicatesystems/runtime';
258271

259272
runtime.assert(downloadCompleted('report.csv'), 'download_ok', true);
260273
```

compat/sdk-shim/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# @predicatesystems/sdk compatibility shim
2+
3+
This package preserves install/import compatibility for users still on:
4+
5+
```bash
6+
npm install @predicatesystems/sdk
7+
```
8+
9+
It re-exports from `@predicatesystems/runtime`. New code should import from
10+
`@predicatesystems/runtime` directly.

compat/sdk-shim/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '@predicatesystems/runtime';

compat/sdk-shim/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"use strict";
2+
3+
module.exports = require("@predicatesystems/runtime");

compat/sdk-shim/package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "@predicatesystems/sdk",
3+
"version": "1.1.0",
4+
"description": "Compatibility shim for @predicatesystems/runtime",
5+
"main": "index.js",
6+
"types": "index.d.ts",
7+
"publishConfig": {
8+
"access": "public"
9+
},
10+
"dependencies": {
11+
"@predicatesystems/runtime": "1.1.0"
12+
},
13+
"files": [
14+
"index.js",
15+
"index.d.ts",
16+
"README.md"
17+
],
18+
"license": "(MIT OR Apache-2.0)"
19+
}

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ module.exports = tseslint.config(
4949
'node_modules/**',
5050
'*.js',
5151
'src/extension/**',
52+
'compat/**',
5253
'examples/**',
5354
'tests/**',
5455
],

examples/agent-runtime-captcha-strategies.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {
55
HumanHandoffSolver,
66
SentienceBrowser,
77
VisionSolver,
8-
} from '@predicatesystems/sdk';
9-
import { createTracer } from '@predicatesystems/sdk';
8+
} from '@predicatesystems/runtime';
9+
import { createTracer } from '@predicatesystems/runtime';
1010

1111
async function notifyWebhook(ctx: any): Promise<void> {
1212
console.log(`[captcha] external resolver notified: url=${ctx.url} run_id=${ctx.runId}`);

0 commit comments

Comments
 (0)