Skip to content

Commit 1883489

Browse files
committed
Add v1.1.0 commons examples
1 parent a19548c commit 1883489

File tree

123 files changed

+1567
-69
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+1567
-69
lines changed

README.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ npm install @commandlayer/commons ajv
9797
**Validate a request against a canonical verb schema**
9898

9999
```
100-
npx cl-validate examples/v1.0.0/commons/summarize/request.json
100+
npx cl-validate examples/v1.1.0/commons/summarize/json/valid/001-summarize.request.valid.json
101101
# ✓ VALID — trace: bafybeieoynknza...
102102
```
103103
**Programmatic usage (Node.js/ESM)**
@@ -371,13 +371,26 @@ protocol-commons/
371371
│ ├── trace.schema.json
372372
│ └── receipt.base.schema.json
373373
├── examples/
374-
│ └── v1.0.0/
374+
│ ├── v1.0.0/
375+
│ │ └── commons/
376+
│ │ └── <verb>/
377+
│ │ ├── valid/
378+
│ │ │ └── *.json
379+
│ │ └── invalid/
380+
│ │ └── *.json
381+
│ └── v1.1.0/
375382
│ └── commons/
376383
│ └── <verb>/
377-
│ ├── valid/
378-
│ │ └── *.json
379-
│ └── invalid/
380-
│ └── *.json
384+
│ ├── json/
385+
│ │ ├── valid/
386+
│ │ │ └── *.json
387+
│ │ └── invalid/
388+
│ │ └── *.json
389+
│ └── ts/
390+
│ ├── valid/
391+
│ │ └── *.ts
392+
│ └── invalid/
393+
│ └── *.ts
381394
├── checksums.txt
382395
├── manifest.json
383396
├── SPEC.md
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"verb": "summarize",
3+
"version": "1.1.0",
4+
"input": {
5+
"text": "This should be a string."
6+
},
7+
"mode": "bullet-points"
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"verb": "analyze",
3+
"version": "1.1.0",
4+
"status": "ok",
5+
"timestamp": "not-a-date",
6+
"request_hash": "sha256:xyz",
7+
"signature": "short",
8+
"error": "ok receipts should not rely on error only"
9+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"verb": "analyze",
3+
"version": "1.1.0",
4+
"input": "Review this smart-contract audit summary and extract the core risk themes for launch readiness.",
5+
"mode": "extract"
6+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"verb": "analyze",
3+
"version": "1.1.0",
4+
"status": "ok",
5+
"timestamp": "2026-03-18T12:00:00Z",
6+
"agent": "analyzeagent.eth",
7+
"request_hash": "sha256:1111111111111111111111111111111111111111111111111111111111111111",
8+
"result_hash": "sha256:2222222222222222222222222222222222222222222222222222222222222222",
9+
"result_cid": "bafybeianalyzereceiptokexample0001",
10+
"summary": "Core risks center on signer key rotation gaps, unresolved indexer scaling assumptions, and an unstated rollback plan.",
11+
"signature": "sigAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
12+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// INVALID analyze.receipt #1 — bad timestamp, malformed hash, short signature
2+
3+
export const analyzeReceiptInvalid1: any = {
4+
"verb": "analyze",
5+
"version": "1.1.0",
6+
"status": "ok",
7+
"timestamp": "not-a-date",
8+
"request_hash": "sha256:xyz",
9+
"signature": "short",
10+
"error": "ok receipts should not rely on error only"
11+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// INVALID analyze.receipt #2 — error status without required error field
2+
3+
export const analyzeReceiptInvalid2: any = {
4+
"verb": "analyze",
5+
"version": "1.1.0",
6+
"status": "error",
7+
"timestamp": "2026-03-18T12:05:00Z",
8+
"request_hash": "sha256:4444444444444444444444444444444444444444444444444444444444444444",
9+
"signature": "sigBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
10+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// INVALID analyze.request #1 — wrong verb + wrong input type + unsupported mode
2+
3+
export const analyzeRequestInvalid1: any = {
4+
"verb": "summarize",
5+
"version": "1.1.0",
6+
"input": {
7+
"text": "This should be a string."
8+
},
9+
"mode": "bullet-points"
10+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// INVALID analyze.request #2 — missing required input and wrong version type
2+
3+
export const analyzeRequestInvalid2: any = {
4+
"verb": "analyze",
5+
"version": 110,
6+
"mode": "extract"
7+
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// VALID analyze.receipt #1 — success receipt with signer identity and hashes
2+
3+
export interface AnalyzeReceipt {
4+
verb: "analyze";
5+
version: "1.1.0";
6+
status: "ok" | "error";
7+
timestamp: string;
8+
agent?: string;
9+
request_hash: `sha256:${string}`;
10+
result_hash?: `sha256:${string}`;
11+
result_cid?: string;
12+
summary?: string;
13+
signature: string;
14+
error?: string;
15+
}
16+
17+
export const analyzeReceiptValid1: AnalyzeReceipt = {
18+
"verb": "analyze",
19+
"version": "1.1.0",
20+
"status": "ok",
21+
"timestamp": "2026-03-18T12:00:00Z",
22+
"agent": "analyzeagent.eth",
23+
"request_hash": "sha256:1111111111111111111111111111111111111111111111111111111111111111",
24+
"result_hash": "sha256:2222222222222222222222222222222222222222222222222222222222222222",
25+
"result_cid": "bafybeianalyzereceiptokexample0001",
26+
"summary": "Core risks center on signer key rotation gaps, unresolved indexer scaling assumptions, and an unstated rollback plan.",
27+
"signature": "sigAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
28+
};

0 commit comments

Comments
 (0)