@fias/arche-sdk 1.0.0 → 1.1.1

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 CHANGED
@@ -10,18 +10,28 @@ npx create-fias-plugin my-plugin
10
10
  cd my-plugin
11
11
  npm install
12
12
 
13
- # Start the dev server
13
+ # Terminal 1: Start the plugin dev server
14
14
  npm run dev
15
15
 
16
- # Open the dev preview in your browser (requires a running FIAS platform)
17
- # http://localhost:3000/a/arche_plugins/dev-preview?url=http://localhost:3100&permissions=theme:read
16
+ # Terminal 2: Start the dev harness (mock mode free, offline)
17
+ npm run dev:mock
18
+
19
+ # Open http://localhost:3200 in your browser
20
+ ```
21
+
22
+ For real AI testing with live entity invocations (costs credits), click the **MOCK** badge in the toolbar to switch to live mode. If you haven't saved an API key yet, the harness will prompt you to enter one.
23
+
24
+ Alternatively, use the CLI:
25
+
26
+ ```bash
27
+ npx fias-dev login # Save your API key (one-time)
28
+ npm run dev:harness # Start harness in live mode
18
29
  ```
19
30
 
20
31
  When you're ready to submit:
21
32
 
22
33
  ```bash
23
- npm run build
24
- # Package your plugin into a tarball, then upload it through the submission flow (see below)
34
+ npm run submit # Builds, validates, packages, and submits for review
25
35
  ```
26
36
 
27
37
  ## Manifest Reference (`fias-plugin.json`)
@@ -42,17 +52,17 @@ Every plugin must include a `fias-plugin.json` at its root:
42
52
  }
43
53
  ```
44
54
 
45
- | Field | Type | Description |
46
- | ------------- | ----------------------------------------------- | ----------------------------------------------------- |
47
- | `name` | `string` | Unique plugin identifier (lowercase, hyphens allowed) |
48
- | `version` | `string` | Semver version of your plugin |
49
- | `description` | `string` | Short description shown in the marketplace |
50
- | `main` | `string` | Entry point source file |
51
- | `archeType` | `"tool" \| "assistant" \| "workflow"` | Category of your plugin |
52
- | `tags` | `string[]` | Discovery tags for the marketplace |
53
- | `pricing` | `{ model: "free" \| "paid", currency: string }` | Pricing model |
54
- | `permissions` | `PluginPermission[]` | Scopes your plugin requires (see Permissions) |
55
- | `sdk` | `string` | Required SDK version range |
55
+ | Field | Type | Description |
56
+ | ------------- | ------------------------------------------------------- | ----------------------------------------------------- |
57
+ | `name` | `string` | Unique plugin identifier (lowercase, hyphens allowed) |
58
+ | `version` | `string` | Semver version of your plugin |
59
+ | `description` | `string` | Short description shown in the marketplace |
60
+ | `main` | `string` | Entry point source file |
61
+ | `archeType` | `"tool" \| "site"` | Category of your plugin |
62
+ | `tags` | `string[]` | Discovery tags for the marketplace |
63
+ | `pricing` | `{ model: "free" \| "fixed" \| "per_use" \| "tiered" }` | Pricing model |
64
+ | `permissions` | `PluginPermission[]` | Scopes your plugin requires (see Permissions) |
65
+ | `sdk` | `string` | Required SDK version range |
56
66
 
57
67
  ## API Reference
58
68
 
@@ -280,56 +290,85 @@ Requesting only the permissions you need improves user trust and review speed.
280
290
  - `storage_delete`: 60/minute
281
291
  - **Sandboxing:** Plugins run in an iframe with `sandbox="allow-scripts allow-forms"`. No access to the parent page DOM, cookies, or local storage.
282
292
 
283
- ## Dev Preview
293
+ ## Local Development
284
294
 
285
- Test your plugin locally against the real FIAS platform:
295
+ The recommended way to develop and test plugins is with the **`@fias/plugin-dev-harness`** a standalone local server that provides a production-accurate iframe environment without requiring the full FIAS platform.
286
296
 
287
- 1. Start the FIAS platform on `localhost:3000`
288
- 2. Start your plugin dev server:
289
- ```bash
290
- cd my-plugin
291
- npm run dev
292
- # Runs on localhost:3100
293
- ```
294
- 3. Open the dev preview URL in your browser:
295
- ```
296
- http://localhost:3000/a/arche_plugins/dev-preview?url=http://localhost:3100&permissions=theme:read,storage:sandbox
297
- ```
297
+ ### Mock Mode (free, offline)
298
298
 
299
- The dev preview page:
299
+ Best for UI development, layout, and styling work:
300
300
 
301
- - Loads your plugin in an iframe with a real `PluginBridgeHost`
302
- - Provides real auth tokens, user data, and theme from the platform
303
- - Grants the permissions you specify in the `permissions` query parameter
304
- - Shows a toolbar with the plugin URL, reload button, and active permissions
301
+ ```bash
302
+ npm run dev:mock
303
+ # Opens http://localhost:3200 with canned AI responses and in-memory storage
304
+ ```
305
305
 
306
- **URL requirements:**
306
+ ### Live Mode (real AI, costs credits)
307
307
 
308
- - Must be `localhost` or `https://` (no arbitrary HTTP origins)
309
- - Your Vite dev server must have CORS enabled (the scaffold template configures this)
308
+ Best for integration testing with real AI models:
309
+
310
+ ```bash
311
+ npx fias-dev login # One-time: save your API key
312
+ npm run dev:harness # Connects to FIAS production API
313
+ ```
314
+
315
+ The harness provides:
316
+
317
+ - An iframe embedding your plugin (same sandbox attributes as production)
318
+ - A toolbar with:
319
+ - Clickable **MOCK/LIVE** badge to toggle between modes
320
+ - **DARK/LIGHT** theme badge
321
+ - Credit balance (visible in live mode)
322
+ - Theme toggle and reload buttons
323
+ - A dev console showing all bridge messages with timestamps
324
+
325
+ ### Dev Preview (alternative)
326
+
327
+ If you have the full FIAS platform running locally, you can also use the built-in dev preview:
328
+
329
+ ```
330
+ http://localhost:3000/a/arche_plugins/dev-preview?url=http://localhost:3100&permissions=theme:read,storage:sandbox
331
+ ```
332
+
333
+ This loads your plugin with a real `PluginBridgeHost`, auth tokens, and live platform data. The URL must be `localhost` or `https://`.
310
334
 
311
335
  ## Submission Flow
312
336
 
313
- Once your plugin is ready for review:
337
+ The easiest way to submit is with the dev harness CLI:
338
+
339
+ ```bash
340
+ npm run submit
341
+ # or: npx fias-dev submit
342
+ ```
343
+
344
+ This automates the full pipeline: build, validate manifest, package, upload to S3, create submission, and poll review status.
345
+
346
+ ### Manual submission
347
+
348
+ If you prefer to submit manually via the API:
314
349
 
315
350
  1. **Build:** `npm run build` to create the production bundle in `dist/`
316
- 2. **Package:** Create a tarball of the build output
317
- 3. **Get upload URL:**
318
- ```
319
- POST /v1/arches/plugins/submissions/upload-url
320
- { uploadUrl, submissionId }
321
- ```
322
- 4. **Upload:** PUT the tarball to the returned `uploadUrl`
323
- 5. **Create submission:**
324
- ```
325
- POST /v1/arches/plugins/submissions
326
- Body: { submissionId, manifest: <contents of fias-plugin.json> }
327
- ```
328
- 6. **Track status:**
329
- ```
330
- GET /v1/arches/plugins/submissions/:submissionId
331
- { status: "pending" | "reviewing" | "approved" | "rejected", feedback?: string }
332
- ```
351
+ 2. **Validate:** `npx fias-dev validate` to check your manifest
352
+ 3. **Get upload URL:** `POST /v1/plugins/submissions/upload-url`
353
+ 4. **Upload:** PUT your `.tar.gz` to the returned presigned URL
354
+ 5. **Create submission:** `POST /v1/plugins/submissions` with `{ submissionId, manifest }`
355
+ 6. **Track status:** `GET /v1/plugins/submissions/:submissionId`
356
+
357
+ See `docs/api-plugins.md` for full API details.
358
+
359
+ ## CLI Tools
360
+
361
+ The `@fias/plugin-dev-harness` package provides CLI commands for the full development lifecycle:
362
+
363
+ ```bash
364
+ npx fias-dev # Start harness (mock mode)
365
+ npx fias-dev --live # Start harness (live mode, costs credits)
366
+ npx fias-dev login # Save API key to ~/.fias/credentials
367
+ npx fias-dev entities # Browse available entities
368
+ npx fias-dev entities --search "summarize"
369
+ npx fias-dev validate # Validate fias-plugin.json
370
+ npx fias-dev submit # Build, package, and submit for review
371
+ ```
333
372
 
334
373
  ## TypeScript Types
335
374
 
@@ -351,6 +390,12 @@ import type {
351
390
  } from '@fias/arche-sdk';
352
391
  ```
353
392
 
393
+ ## Further Reading
394
+
395
+ - **[Plugin Creation Guide](../../docs/plugin-creation-guide.md)** — Step-by-step tutorial for beginners
396
+ - **[Developer API Reference](../../docs/api-developer.md)** — Bridge, entities, credits, and validation endpoints
397
+ - **[Plugin API Reference](../../docs/api-plugins.md)** — Submission, review pipeline, and production bridge
398
+
354
399
  ## License
355
400
 
356
401
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fias/arche-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "SDK for building FIAS platform plugin arches",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -6,7 +6,9 @@
6
6
  "dev": "vite",
7
7
  "build": "vite build",
8
8
  "validate": "tsc --noEmit",
9
- "submit": "echo 'Submission CLI not yet available'"
9
+ "dev:harness": "fias-dev --live",
10
+ "dev:mock": "fias-dev",
11
+ "submit": "fias-dev submit"
10
12
  },
11
13
  "dependencies": {
12
14
  "@fias/arche-sdk": "^1.0.0",
@@ -14,6 +16,7 @@
14
16
  "react-dom": "^19.0.0"
15
17
  },
16
18
  "devDependencies": {
19
+ "@fias/plugin-dev-harness": "^1.0.0",
17
20
  "@types/react": "^19.0.0",
18
21
  "@types/react-dom": "^19.0.0",
19
22
  "@vitejs/plugin-react": "^4.0.0",