@port66/openai-agents 0.0.0-stage → 0.1.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 CHANGED
@@ -1,3 +1,26 @@
1
- # Temporary Holding Version
1
+ # @port66/openai-agents
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [Port66](https://port66.xyz) tools for the [OpenAI Agents SDK](https://github.com/openai/openai-agents-js). Search authenticated luxury, streetwear and collectibles, and buy a listing in **one x402 request** with USDC on Base, paid straight to the seller.
4
+
5
+ ```bash
6
+ npm install @port66/openai-agents @openai/agents zod
7
+ ```
8
+
9
+ ```ts
10
+ import { Agent, run } from "@openai/agents";
11
+ import { port66Tools } from "@port66/openai-agents";
12
+
13
+ const agent = new Agent({
14
+ name: "Personal shopper",
15
+ instructions: "Find what the user wants on Port66. Confirm item, total and address before buying.",
16
+ tools: port66Tools({
17
+ maxPurchaseUsd: 200, // buying is off without a cap
18
+ wallet: process.env.AGENT_KEY as `0x${string}`, // EOA on Base holding USDC; only needed to buy
19
+ }),
20
+ });
21
+ const result = await run(agent, "Find me a white Supreme box logo tee in M under $200");
22
+ ```
23
+
24
+ Tools: `port66_search_listings` and `port66_get_listing` (free), and `port66_buy_listing` (pays the listing's total). The schemas are strict-mode compatible. Leave out `wallet` and `maxPurchaseUsd` for a browse-only agent.
25
+
26
+ How buying works, and its safety checks: see [`@port66/sdk`](https://www.npmjs.com/package/@port66/sdk). More: [port66.xyz/ai](https://port66.xyz/ai) · MIT
@@ -0,0 +1,27 @@
1
+ import { type Port66Config, type Port66Wallet } from "@port66/sdk";
2
+ import { z } from "zod";
3
+ export interface Port66ToolsOptions extends Port66Config {
4
+ /** The agent's wallet: a private key (EOA on Base holding USDC) or a Port66Wallet. Needed only to buy. */
5
+ wallet?: `0x${string}` | Port66Wallet;
6
+ }
7
+ /**
8
+ * Port66 tools for the OpenAI Agents SDK: search listings and get a listing
9
+ * (free), and buy a listing in one x402 request with USDC on Base. Buying
10
+ * stays off until `maxPurchaseUsd` is set and a `wallet` is given.
11
+ */
12
+ export declare function port66Tools(options?: Port66ToolsOptions): (import("@openai/agents").FunctionTool<unknown, z.ZodObject<{
13
+ query: z.ZodNullable<z.ZodString>;
14
+ brand: z.ZodNullable<z.ZodString>;
15
+ category: z.ZodNullable<z.ZodString>;
16
+ size: z.ZodNullable<z.ZodString>;
17
+ maxPriceUsd: z.ZodNullable<z.ZodNumber>;
18
+ sort: z.ZodNullable<z.ZodEnum<{
19
+ newest: "newest";
20
+ price_asc: "price_asc";
21
+ price_desc: "price_desc";
22
+ }>>;
23
+ limit: z.ZodNullable<z.ZodNumber>;
24
+ }, z.core.$strip>, string> | import("@openai/agents").FunctionTool<unknown, z.ZodObject<{
25
+ id: z.ZodString;
26
+ }, z.core.$strip>, string>)[];
27
+ export { Port66, walletFromPrivateKey, type Port66Config, type Port66Wallet } from "@port66/sdk";
package/dist/index.js ADDED
@@ -0,0 +1,53 @@
1
+ import { tool } from "@openai/agents";
2
+ import { FIELDS, Port66, TOOLS, walletFromPrivateKey } from "@port66/sdk";
3
+ import { z } from "zod";
4
+ // OpenAI strict tool schemas need every field present: optional ones are nullable.
5
+ const ShippingAddress = z.object({
6
+ name: z.string().describe("Recipient's full name"),
7
+ line1: z.string().describe("Street address"),
8
+ line2: z.string().nullable().describe("Apartment, suite, etc., or null"),
9
+ city: z.string(),
10
+ region: z.string().nullable().describe("State, province or region, or null"),
11
+ postal: z.string().describe("Postal or ZIP code"),
12
+ country: z.string().describe("Country, e.g. 'US' or 'Canada'"),
13
+ phone: z.string().nullable(),
14
+ });
15
+ /**
16
+ * Port66 tools for the OpenAI Agents SDK: search listings and get a listing
17
+ * (free), and buy a listing in one x402 request with USDC on Base. Buying
18
+ * stays off until `maxPurchaseUsd` is set and a `wallet` is given.
19
+ */
20
+ export function port66Tools(options = {}) {
21
+ const { wallet, ...config } = options;
22
+ const port66 = new Port66(config);
23
+ const agentWallet = typeof wallet === "string" ? walletFromPrivateKey(wallet) : wallet;
24
+ const search = tool({
25
+ ...TOOLS.search,
26
+ parameters: z.object({
27
+ query: z.string().nullable().describe(FIELDS.query),
28
+ brand: z.string().nullable().describe(FIELDS.brand),
29
+ category: z.string().nullable().describe(FIELDS.category),
30
+ size: z.string().nullable().describe(FIELDS.size),
31
+ maxPriceUsd: z.number().nullable().describe(FIELDS.searchMaxPriceUsd),
32
+ sort: z.enum(["newest", "price_asc", "price_desc"]).nullable().describe(FIELDS.sort),
33
+ limit: z.number().int().nullable().describe(FIELDS.limit),
34
+ }),
35
+ execute: (args) => port66.search(args),
36
+ });
37
+ const getListing = tool({
38
+ ...TOOLS.get,
39
+ parameters: z.object({ id: z.string().describe(FIELDS.id) }),
40
+ execute: ({ id }) => port66.getListing(id),
41
+ });
42
+ const buy = tool({
43
+ ...TOOLS.buy,
44
+ parameters: z.object({
45
+ id: z.string().describe(FIELDS.id),
46
+ maxPriceUsd: z.number().describe(FIELDS.buyMaxPriceUsd),
47
+ shippingAddress: ShippingAddress.describe(FIELDS.shippingAddress),
48
+ }),
49
+ execute: (args) => port66.buy(agentWallet, args),
50
+ });
51
+ return [search, getListing, buy];
52
+ }
53
+ export { Port66, walletFromPrivateKey } from "@port66/sdk";
package/package.json CHANGED
@@ -1,6 +1,50 @@
1
1
  {
2
2
  "name": "@port66/openai-agents",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "OpenAI Agents SDK tools for Port66: search authenticated luxury and collectibles, and buy a listing in one x402 request with USDC on Base",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "README.md"
11
+ ],
12
+ "keywords": [
13
+ "openai",
14
+ "openai-agents",
15
+ "tools",
16
+ "port66",
17
+ "x402",
18
+ "ai-agents",
19
+ "marketplace",
20
+ "usdc",
21
+ "base"
22
+ ],
23
+ "license": "MIT",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/port66-official/port66",
27
+ "directory": "integrations/openai-agents"
28
+ },
29
+ "homepage": "https://port66.xyz/ai",
30
+ "peerDependencies": {
31
+ "@openai/agents": ">=0.1.0",
32
+ "zod": ">=3.25.0"
33
+ },
34
+ "dependencies": {
35
+ "@port66/sdk": "^0.1.0"
36
+ },
37
+ "devDependencies": {
38
+ "@openai/agents": "0.22.0",
39
+ "zod": "^4.1.0",
40
+ "@types/node": "^22.0.0",
41
+ "tsx": "^4.19.2",
42
+ "typescript": "^5.9.3",
43
+ "viem": "^2.38.3"
44
+ },
45
+ "scripts": {
46
+ "build": "tsc -p tsconfig.json",
47
+ "test": "tsx --test test/*.test.ts",
48
+ "typecheck": "tsc --noEmit"
49
+ }
6
50
  }