@isomorph.ai/app-sdk 1.4.2 → 1.5.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/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # Isomorph app SDK: M1 server AI and browser reads
2
+
3
+ Use upstream `ai@7.0.118` and `@ai-sdk/openai@4.0.78` directly in actions. The platform supplies the gateway connection and approved aliases; no model wrapper is needed. Never import the provider setup into frontend code.
4
+
5
+ ```ts
6
+ // actions/summarise.ts
7
+ import { generateText, tool, jsonSchema, stepCountIs } from 'ai';
8
+ import { createOpenAI } from '@ai-sdk/openai';
9
+ import { createClient } from '@isomorph.ai/app-sdk';
10
+
11
+ export default async function summarise() {
12
+ const gateway = createOpenAI({
13
+ baseURL: process.env.OPENAI_BASE_URL,
14
+ apiKey: process.env.OPENAI_API_KEY,
15
+ });
16
+ const isomorph = createClient();
17
+ const result = await generateText({
18
+ model: gateway.chat(process.env.ISOMORPH_AI_GENERATION_MODEL_ALIAS!),
19
+ prompt: 'Summarise the approved channel.',
20
+ stopWhen: stepCountIs(5),
21
+ tools: {
22
+ readChannel: tool({
23
+ description: 'Read the approved team channel.',
24
+ inputSchema: jsonSchema<Record<string, never>>({ type: 'object', properties: {}, additionalProperties: false }),
25
+ execute: () => isomorph.integrations.execute('company-slack', {
26
+ operation: 'slack.channel.history', resource: 'APP_APPROVED_CHANNEL', input: { limit: 10 },
27
+ }),
28
+ }),
29
+ },
30
+ });
31
+ return { text: result.text };
32
+ }
33
+ ```
34
+
35
+ Replace the connection/resource with the app's existing approved integration. Tools inherit the invoking person's signed identity. Expose read operations only; existing SDK write methods are not M1 agent tools.
36
+
37
+ For images call `generateImage({model: gateway.image(process.env.ISOMORPH_AI_IMAGE_MODEL_ALIAS!), prompt: 'A blue notebook'})`. Editing uses `prompt: {text: 'Make it red', images: [inputBytes]}` only when `isomorph ai models` advertises edit. Reuse app files upload/signed reads for authorized input and output storage; respect existing transfer/action limits and never return credentials.
38
+
39
+ ## Browser read tools
40
+
41
+ Install optional peers `ai` and `playwright-core@1.58.2`. Locally run `npx playwright-core install chromium --only-shell`; V2 packages Chromium in the existing app image. An existing system executable can be supplied as executablePath.
42
+
43
+ ```ts
44
+ import { createBrowserTools } from '@isomorph.ai/app-sdk/dist/browser.js';
45
+ // Inside an action with its context:
46
+ const browser = await createBrowserTools({
47
+ pages: ['https://example.com/'],
48
+ signal: context.signal,
49
+ });
50
+ try {
51
+ // Add browser.tools to generateText's tools; keep stopWhen: stepCountIs(5).
52
+ } finally {
53
+ await browser.close();
54
+ }
55
+ ```
56
+
57
+ App code declares exact HTTPS pages and named click/fill selectors reviewed for reads. Tools provide navigate, observe, control, scroll, screenshot and close. Observations are untrusted webpage content. One isolated page per run, one active run per process, 50 actions, five minutes, ten-second operations, bounded text/screenshots. Private destinations, undeclared navigation, downloads, popups, WebSockets, service workers and non-GET/HEAD requests are blocked. GET-only filtering cannot infer website business semantics: never declare URLs/controls that perform external writes. Chromium's sandbox remains enabled; unsupported sandbox environments fail clearly.
58
+
59
+ ## Running and rollout
60
+
61
+ `isomorph dev` uses canned server-model fixtures. `dev --real` supplies an approved development connection to the action process. Hosted actions resolve their exact ACTIVE version key. The current V2 PLAN is published after LIVE; before key activation, an AI action fails and later actions retry. LIVE alone is not AI acceptance.
62
+
63
+ Requires compatible SDK/CLI/toolkit publication, gateway protocol fixes, governance connection routes and V2 packaging/version wiring. No deployment is claimed here. Real model/file authorization and hosted Chromium sandbox checks remain release acceptance. Search, company skills, integration/browser writes, video, audio, STT, TTS and realtime audio are deferred.