Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions runtime/tests/runtime-signing.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ test("private PEM_B64 + public raw32 b64 path signs and /verify roundtrip works"
assert.equal(h.kid, keys.kid);

const body = {
x402: { verb: "describe", version: "1.0.0", entry: "x402://describeagent.eth/describe/v1.0.0" },
x402: { verb: "describe", version: "1.1.0", entry: "x402://describeagent.eth/describe/v1.1.0" },
input: { subject: "t", detail_level: "short" },
trace: { provider: "test" },
};
const receiptResp = await fetch(`${srv.base}/describe/v1.0.0`, {
const receiptResp = await fetch(`${srv.base}/describe/v1.1.0`, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify(body),
Expand Down Expand Up @@ -144,12 +144,12 @@ test("/verify?ens=1 passes with mocked ENS TXT response", async () => {

try {
const body = {
x402: { verb: "describe", version: "1.0.0", entry: "x402://describeagent.eth/describe/v1.0.0" },
x402: { verb: "describe", version: "1.1.0", entry: "x402://describeagent.eth/describe/v1.1.0" },
input: { subject: "t", detail_level: "short" },
trace: { provider: "test" },
};
const response = await (
await fetch(`${srv.base}/describe/v1.0.0`, {
await fetch(`${srv.base}/describe/v1.1.0`, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify(body),
Expand Down
2 changes: 1 addition & 1 deletion scripts/smoke-ens.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -euo pipefail

BASE="${RUNTIME_BASE:-https://runtime.commandlayer.org}"

curl -sS -X POST "$BASE/describe/v1.0.0" \
curl -sS -X POST "$BASE/describe/v1.1.0" \
-H "content-type: application/json" \
--data-binary '{"input":{"subject":"hello"}}' > /tmp/receipt.json

Expand Down
6 changes: 3 additions & 3 deletions scripts/smoke.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import process from "node:process";

const base = process.env.SMOKE_BASE_URL || `http://127.0.0.1:${process.env.PORT || 8080}`;
const input = {
x402: { entry: "x402://describeagent.eth/describe/v1.0.0", verb: "describe", version: "1.0.0" },
x402: { entry: "x402://describeagent.eth/describe/v1.1.0", verb: "describe", version: "1.1.0" },
input: { subject: "CommandLayer", detail_level: "short" },
};

Expand All @@ -18,14 +18,14 @@ try {
if (!healthResp.ok) fail("/health http", health);
if (!health.signer_ok || !health.verifier_ok) fail("/health signer/verifier", health);

const describeResp = await fetch(`${base}/describe/v1.0.0`, {
const describeResp = await fetch(`${base}/describe/v1.1.0`, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify(input),
});
const response = await describeResp.json();
const receipt = response?.receipt || response;
if (!describeResp.ok) fail("/describe/v1.0.0 http", response);
if (!describeResp.ok) fail("/describe/v1.1.0 http", response);
if (!receipt?.metadata?.proof?.hash_sha256 || !receipt?.metadata?.proof?.signature_b64) {
fail("describe proof fields", receipt?.metadata?.proof || response);
}
Expand Down
10 changes: 5 additions & 5 deletions server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ const runtimeConfig = {

// service identity / discovery
const SERVICE_NAME = process.env.SERVICE_NAME || "commandlayer-runtime";
const SERVICE_VERSION = process.env.SERVICE_VERSION || "1.0.0";
const SERVICE_VERSION = process.env.SERVICE_VERSION || "1.1.0";
const CANONICAL_BASE = (process.env.CANONICAL_BASE_URL || "https://runtime.commandlayer.org").replace(/\/+$/, "");
const API_VERSION = process.env.API_VERSION || "1.0.0";
const API_VERSION = process.env.API_VERSION || "1.1.0";

// ENS verifier config
const ETH_RPC_URL = runtimeConfig.ethRpcUrl;
Expand Down Expand Up @@ -1020,7 +1020,7 @@ function doDescribe(body) {
? `**${subject}** is a standard “API meaning” contract agents can call using published schemas and receipts.`
: `**${subject}** is a semantic contract for agents. It standardizes verbs, strict JSON Schemas (requests + receipts), and verifiable receipts so different runtimes can execute the same intent without semantic drift.`;

return { description, bullets, properties: { verb: "describe", version: "1.0.0", detail_level: detail } };
return { description, bullets, properties: { verb: "describe", version: API_VERSION, detail_level: detail } };
}

function doFormat(body) {
Expand Down Expand Up @@ -1349,7 +1349,7 @@ async function handleVerb(verb, req, res) {
};

try {
const x402 = req.body?.x402 || { verb, version: "1.0.0", entry: `x402://${verb}agent.eth/${verb}/v1.0.0` };
const x402 = req.body?.x402 || { verb, version: API_VERSION, entry: `x402://${verb}agent.eth/${verb}/v${API_VERSION}` };

const callerTimeout = Number(req.body?.limits?.timeout_ms || req.body?.limits?.max_latency_ms || 0);
const timeoutMs = Math.min(SERVER_MAX_HANDLER_MS, callerTimeout && callerTimeout > 0 ? callerTimeout : SERVER_MAX_HANDLER_MS);
Expand All @@ -1374,7 +1374,7 @@ async function handleVerb(verb, req, res) {
}

} catch (e) {
const x402 = req.body?.x402 || { verb, version: "1.0.0", entry: `x402://${verb}agent.eth/${verb}/v1.0.0` };
const x402 = req.body?.x402 || { verb, version: API_VERSION, entry: `x402://${verb}agent.eth/${verb}/v${API_VERSION}` };

const actor = req.body?.actor
? { id: String(req.body.actor), role: "user" }
Expand Down
4 changes: 2 additions & 2 deletions tests/smoke.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,12 @@ async function main() {
}

const describeBody = {
x402: { verb: "describe", version: "1.0.0", entry: "x402://describeagent.eth/describe/v1.0.0" },
x402: { verb: "describe", version: "1.1.0", entry: "x402://describeagent.eth/describe/v1.1.0" },
input: { subject: "smoke-test", detail_level: "short" },
trace: { provider: "smoke" },
};

const describe = await httpJson(`${baseUrl}/describe/v1.0.0`, { method: "POST", body: describeBody });
const describe = await httpJson(`${baseUrl}/describe/v1.1.0`, { method: "POST", body: describeBody });
assert.equal(describe.status, 200, `describe failed: ${JSON.stringify(describe.json)}`);
const { receipt, runtimeMetadata } = extractReceiptEnvelope(describe.json);
assert.equal(receipt.status, "success", `describe receipt status must be success`);
Expand Down
Loading