@relvehq/agent-ready 0.4.0 → 0.4.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.
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "0.4.0";
1
+ export declare const PACKAGE_VERSION = "0.4.1";
@@ -5,4 +5,4 @@
5
5
  // EDGE-SAFE.
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.PACKAGE_VERSION = void 0;
8
- exports.PACKAGE_VERSION = "0.4.0";
8
+ exports.PACKAGE_VERSION = "0.4.1";
@@ -17,6 +17,12 @@ export interface ProviderOptions {
17
17
  baseUrl?: string;
18
18
  fetch?: typeof fetch;
19
19
  timeoutMs?: number;
20
+ /**
21
+ * Sampling temperature; left out of the request when unset (provider
22
+ * default). The refine API uses a low one so articles are copied, not
23
+ * reworded (changes/agent-ready-article-prompt).
24
+ */
25
+ temperature?: number;
20
26
  }
21
27
  export declare const DEFAULT_CLAUDE_MODEL = "claude-opus-5-5";
22
28
  export declare const DEFAULT_OPENAI_MODEL = "gpt-4o";
@@ -29,6 +29,7 @@ function anthropicModel(opts) {
29
29
  }, {
30
30
  model,
31
31
  max_tokens: req.maxTokens ?? 8000,
32
+ ...(opts.temperature === undefined ? {} : { temperature: opts.temperature }),
32
33
  system: req.system,
33
34
  messages: [{ role: "user", content: req.user }],
34
35
  });
@@ -44,6 +45,7 @@ function openaiModel(opts) {
44
45
  const json = await post(opts, `${base}/v1/chat/completions`, { authorization: `Bearer ${opts.apiKey}` }, {
45
46
  model: opts.model,
46
47
  max_completion_tokens: req.maxTokens ?? 8000,
48
+ ...(opts.temperature === undefined ? {} : { temperature: opts.temperature }),
47
49
  messages: [
48
50
  { role: "system", content: req.system },
49
51
  { role: "user", content: req.user },
@@ -2,7 +2,7 @@ import { PACKAGE_VERSION } from "../core/version";
2
2
  export { PACKAGE_VERSION };
3
3
  export declare const DEFAULT_REFINE_ENDPOINT = "https://relvehq.com/api/agent-ready/v1/refine";
4
4
  export declare const REFINE_MODELS: readonly ["gpt-4o", "gpt-4o-mini", "gpt-4.1", "gpt-4.1-mini"];
5
- export declare const USER_AGENT = "agent-ready/0.4.0 (+https://relvehq.com/agent-ready)";
5
+ export declare const USER_AGENT = "agent-ready/0.4.1 (+https://relvehq.com/agent-ready)";
6
6
  export type RemoteStatus = "ok" | "unchanged" | "rejected" | "error" | "skipped";
7
7
  export interface RemoteItem {
8
8
  path: string;
@@ -215,6 +215,14 @@ class Relve_AR_Router {
215
215
  $source = 'native';
216
216
  $store = new Relve_AR_Store();
217
217
  $stored = $store->get( $d['path'], self::home_path() );
218
+ if ( null === $stored ) {
219
+ // Asked by "?p=12&format=md" (or ?post_type=...): the refined
220
+ // file is stored under the permalink's path, not the request's.
221
+ $canon_path = self::canonical_path( $target['canonical'] );
222
+ if ( null !== $canon_path && $canon_path !== $d['path'] ) {
223
+ $stored = $store->get( $canon_path, self::home_path() );
224
+ }
225
+ }
218
226
  if ( null !== $stored ) {
219
227
  $source = 'stored';
220
228
  $body = Relve_AR_Markdown_Builder::for_stored( $stored, $target['canonical'], isset( $target['post'] ) ? $target['post'] : null, $target['title'] );
@@ -251,6 +259,17 @@ class Relve_AR_Router {
251
259
  exit;
252
260
  }
253
261
 
262
+ /**
263
+ * Normalised path of a canonical URL, or null.
264
+ *
265
+ * @param string $canonical Canonical URL.
266
+ * @return string|null
267
+ */
268
+ public static function canonical_path( $canonical ) {
269
+ $path = wp_parse_url( (string) $canonical, PHP_URL_PATH );
270
+ return is_string( $path ) && '' !== $path ? Relve_AR_Negotiation::normalize_path( $path ) : null;
271
+ }
272
+
254
273
  /**
255
274
  * What the main query resolved to, if it is something we serve.
256
275
  *
@@ -4,7 +4,7 @@ Tags: markdown, llms.txt, ai, agents, seo
4
4
  Requires at least: 6.0
5
5
  Tested up to: 6.7
6
6
  Requires PHP: 7.4
7
- Stable tag: 0.3.0
7
+ Stable tag: 0.3.1
8
8
  License: MIT
9
9
  License URI: https://opensource.org/licenses/MIT
10
10
 
@@ -103,6 +103,9 @@ Deactivating flushes rewrite rules, removes the WP Rocket rules and cancels sche
103
103
 
104
104
  == Changelog ==
105
105
 
106
+ = 0.3.1 =
107
+ * A rewritten post is also served when asked by its ID (`?p=12&format=md`, `?post_type=news&p=12&format=md`), not only by its permalink.
108
+
106
109
  = 0.3.0 =
107
110
  * New, off by default: "Share visit stats with Relve". For each Markdown page or llms.txt an agent reads, the plugin sends Relve the path, how it was asked for, the agent's user agent, status, tokens, bytes and time taken, after the agent has its answer. Never the Markdown, never the visitor's IP.
108
111
 
@@ -3,7 +3,7 @@
3
3
  * Plugin Name: Relve Agent Ready
4
4
  * Plugin URI: https://relvehq.com/agent-md
5
5
  * Description: Serves a Markdown version of posts, pages and archives to AI agents (Accept: text/markdown, .md URLs, ?format=md) plus an llms.txt. Optionally rewrites posts into better Markdown with Relve's prompt and your own OpenAI key. Browsers are never affected. Off until enabled in Settings -> Agent Ready.
6
- * Version: 0.3.0
6
+ * Version: 0.3.1
7
7
  * Requires at least: 6.0
8
8
  * Requires PHP: 7.4
9
9
  * Author: Relve
@@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
19
19
  exit;
20
20
  }
21
21
 
22
- define( 'RELVE_AR_VERSION', '0.3.0' );
22
+ define( 'RELVE_AR_VERSION', '0.3.1' );
23
23
  define( 'RELVE_AR_FILE', __FILE__ );
24
24
  define( 'RELVE_AR_DIR', plugin_dir_path( __FILE__ ) );
25
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relvehq/agent-ready",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "license": "MIT",
5
5
  "description": "Make your site agent-ready: serve every page as clean Markdown to AI agents (Accept: text/markdown, .md URLs, llms.txt), refine it with AI ahead of time, and prove it with a free checker and a visits dashboard. Next.js adapter included.",
6
6
  "keywords": [
@@ -20,7 +20,7 @@
20
20
  "perplexity",
21
21
  "seo"
22
22
  ],
23
- "homepage": "https://relvehq.com/agent-md",
23
+ "homepage": "https://relvehq.com/agent-ready",
24
24
  "author": "Relve (https://relvehq.com)",
25
25
  "main": "./dist/index.js",
26
26
  "types": "./dist/index.d.ts",