@openserv-labs/client 2.5.0 → 2.5.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
@@ -719,6 +719,83 @@ triggers.manual({
719
719
  // { type: 'manual', name: '...', description: '...' }
720
720
  ```
721
721
 
722
+ ## Deploy to OpenServ Cloud
723
+
724
+ Deploy your agent to the OpenServ managed cloud with a single command:
725
+
726
+ ```bash
727
+ npx @openserv-labs/client deploy [path]
728
+ ```
729
+
730
+ Where `[path]` is the directory containing your agent code (defaults to current directory).
731
+
732
+ ### Prerequisites
733
+
734
+ 1. **`OPENSERV_USER_API_KEY` in `.env`** — The deploy CLI needs this key to authenticate with the platform. If you've already run `provision()` at least once, check your `.openserv.json` file — it contains a `userApiKey` field you can use:
735
+
736
+ ```bash
737
+ # Look for the userApiKey in .openserv.json
738
+ cat .openserv.json | grep userApiKey
739
+ ```
740
+
741
+ Copy that value into your `.env`:
742
+
743
+ ```env
744
+ OPENSERV_USER_API_KEY=<userApiKey from .openserv.json>
745
+ ```
746
+
747
+ If you haven't provisioned yet, get the key from the [OpenServ platform dashboard](https://platform.openserv.ai/profile/api-keys) instead.
748
+
749
+ 2. **Run `provision()` first** — Your agent must be provisioned at least once before deploying. `provision()` registers the agent on the platform and writes credentials to `.openserv.json`. Starting the agent locally (`npm run dev`) is enough if your code calls `provision()` before `run(agent)`.
750
+
751
+ ### How It Works
752
+
753
+ The deploy command:
754
+
755
+ 1. Reads `.openserv.json` to find the provisioned agent ID
756
+ 2. Creates or reuses a cloud container (saves `OPENSERV_CONTAINER_ID` to `.env`)
757
+ 3. Archives your source code (respects `.gitignore`, excludes `node_modules`, `.git`, `.env`, `dist`)
758
+ 4. Uploads and installs dependencies in the container
759
+ 5. Starts (or restarts) the agent and exposes a public URL
760
+ 6. Updates the agent's endpoint URL on the platform automatically
761
+
762
+ ### Deploy Workflow
763
+
764
+ ```bash
765
+ # 1. Run locally once to provision (registers agent + writes .openserv.json)
766
+ npm run dev
767
+
768
+ # 2. Set OPENSERV_USER_API_KEY in .env
769
+ # - If you already provisioned: grab userApiKey from .openserv.json
770
+ # - Otherwise: get it from the platform dashboard
771
+ echo "OPENSERV_USER_API_KEY=your-key" >> .env
772
+
773
+ # 3. Deploy to cloud
774
+ npx @openserv-labs/client deploy .
775
+ ```
776
+
777
+ On subsequent deploys, the CLI reuses the existing container — it uploads your latest code, reinstalls dependencies, and restarts the agent.
778
+
779
+ ### Environment Variables for Deploy
780
+
781
+ | Variable | Description | Required |
782
+ | --------------------------- | ---------------------------------------- | -------- |
783
+ | `OPENSERV_USER_API_KEY` | Your OpenServ user API key | Yes |
784
+ | `OPENSERV_CONTAINER_ID` | Container ID (auto-set after first deploy) | No |
785
+
786
+ ### CLI Reference
787
+
788
+ The package also exposes a `serv` binary:
789
+
790
+ ```bash
791
+ # Via npx
792
+ npx @openserv-labs/client deploy [path]
793
+
794
+ # Or if installed globally / as a dependency
795
+ serv deploy [path]
796
+ serv --help
797
+ ```
798
+
722
799
  ## Environment Variables
723
800
 
724
801
  | Variable | Description | Required |
@@ -1 +1 @@
1
- {"version":3,"file":"tar.d.ts","sourceRoot":"","sources":["../../src/deploy/tar.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAerE"}
1
+ {"version":3,"file":"tar.d.ts","sourceRoot":"","sources":["../../src/deploy/tar.ts"],"names":[],"mappings":"AAuBA,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAerE"}
@@ -14,7 +14,6 @@ const ALWAYS_EXCLUDE = [
14
14
  "dist",
15
15
  ".next",
16
16
  ".turbo",
17
- ".env",
18
17
  ".env.example",
19
18
  ".env.local",
20
19
  ".env.*.local",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openserv-labs/client",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "description": "OpenServ Platform Client - Manage agents, workflows, tasks, and triggers via the OpenServ API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",