logicsrc/packages/sdk/src/openrental.ts
Anthony Ettinger 68f3151699 Merge master; OpenFleet keeps its name, PR 177's rental descriptor becomes OpenRental
PR 177 shipped a second OpenFleet under the same slug: a published listing of OpenAgent profiles and ipfile swarms with CoinPay rental offers. Anthony ruled that OpenFleet means the human-controlled fleet and the record of who spawned whom, so the rental contract is renamed OpenRental (slug openrental, catalogs family, group noun listing): docs/openrental.md, logicsrc-openrental.schema.json with type logicsrc.openrental and scope kind listing, fixtures/openrental, createOpenRental and OpenRental* types in the SDK, the openrental validator kind. Minor bumps because an export moved: @logicsrc/schemas 0.2.0, @logicsrc/validators 0.2.0, @logicsrc/sdk 0.2.0. The discovery contract test now covers openfleet, openrental and openwall, one per family, and accepts a landing-page link in llms.txt.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01RZV4zJ2pDZLNN3kE5jFCmV
2026-09-13 08:45:33 +00:00

71 lines
2.2 KiB
TypeScript

export type OpenRentalJsonValue =
| null | boolean | number | string
| OpenRentalJsonValue[] | { [key: string]: OpenRentalJsonValue };
/** OpenAgent binds to a logicsrc.agent DID; OpenSwarm binds to a file key. */
export type OpenRentalMemberReference =
| { kind: "openagent"; id: string }
| { kind: "openswarm"; id: `ed25519:${string}` };
export type OpenRentalMember = OpenRentalMemberReference & {
/** HTTPS URL of the agent profile or the signed ipfile manifest. */
url: string;
name?: string;
role?: string;
metadata?: Record<string, OpenRentalJsonValue>;
};
export type OpenRentalRentalScope =
| { kind: "listing" }
| { kind: "members"; members: OpenRentalMemberReference[] };
export interface OpenRentalRental {
id: string;
name?: string;
scope: OpenRentalRentalScope;
rate: {
/** Exact non-negative USD decimal string, with six fractional digits. */
amount: string;
currency: "USD";
/** Whole billing units; a month is 30 days, a task an agreed deliverable. */
unit: "hour" | "day" | "month" | "task";
};
minimum_units?: number;
maximum_units?: number;
valid_from?: string;
valid_until?: string;
terms_url?: string;
payment: {
provider: "coinpay";
payee_did: string;
/** Merchant-published HTTPS checkout entry point; no fixed CoinPay API. */
checkout_url: string;
};
metadata?: Record<string, OpenRentalJsonValue>;
}
export interface OpenRental {
type: "logicsrc.openrental";
version: "0.1";
/** Stable HTTPS listing identifier, unique at its publisher's origin. */
id: string;
name: string;
owner_did: string;
description?: string;
updated_at?: string;
availability?: "available" | "busy" | "offline" | "unknown";
tags?: string[];
capabilities?: string[];
metadata?: Record<string, OpenRentalJsonValue>;
members: OpenRentalMember[];
rentals?: OpenRentalRental[];
}
/**
* Construct a descriptor without fetching members or initiating payments.
* Use validate("openrental", document) from @logicsrc/validators before use:
* TypeScript alone cannot check DID/key formats or rental references.
*/
export function createOpenRental(input: Omit<OpenRental, "type" | "version">): OpenRental {
return { ...input, type: "logicsrc.openrental", version: "0.1" };
}