@hasna/contracts 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.
@@ -0,0 +1,11 @@
1
+ {
2
+ "schema": "hasna.actor_ref.v1",
3
+ "id": "actor_codewith_account004",
4
+ "createdAt": "2026-06-27T10:00:00.000Z",
5
+ "kind": "agent",
6
+ "name": "Codewith account004",
7
+ "provider": "codewith",
8
+ "accountId": "account004",
9
+ "machineId": "spark01",
10
+ "capabilities": ["coding", "review"]
11
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "schema": "hasna.agent_trajectory.v1",
3
+ "id": "trajectory_123",
4
+ "createdAt": "2026-06-27T10:00:00.000Z",
5
+ "actor": {
6
+ "kind": "agent",
7
+ "id": "actor_codewith_account004",
8
+ "provider": "codewith"
9
+ },
10
+ "workRunRef": {
11
+ "kind": "run",
12
+ "id": "work_run_123",
13
+ "externalId": "work_run_123",
14
+ "sourcePackage": "@hasna/contracts"
15
+ },
16
+ "events": [
17
+ {
18
+ "id": "event_test",
19
+ "at": "2026-06-27T10:04:00.000Z",
20
+ "kind": "test",
21
+ "summary": "bun test passed",
22
+ "evidenceRefs": [
23
+ {
24
+ "id": "ev_tests",
25
+ "kind": "command_output",
26
+ "uri": "artifact://runs/run_123/tests.txt"
27
+ }
28
+ ]
29
+ }
30
+ ],
31
+ "outcome": "succeeded"
32
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "schema": "hasna.capability_card.v1",
3
+ "id": "capability_terminal_lane",
4
+ "createdAt": "2026-06-27T10:00:00.000Z",
5
+ "kind": "lane",
6
+ "name": "terminal",
7
+ "version": "1",
8
+ "status": "available",
9
+ "capabilities": ["command", "background-process", "structured-output"],
10
+ "limitations": ["requires-shell-access"],
11
+ "riskLevel": "medium"
12
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "schema": "hasna.context_pack.v1",
3
+ "id": "ctx_open_contracts_123",
4
+ "createdAt": "2026-06-27T10:00:00.000Z",
5
+ "objective": "Explain how @hasna/contracts schemas are enforced.",
6
+ "budget": {
7
+ "maxTokens": 2000
8
+ },
9
+ "items": [
10
+ {
11
+ "id": "item_readme",
12
+ "title": "README contract boundary",
13
+ "summary": "@hasna/contracts owns schemas, not storage.",
14
+ "source": {
15
+ "id": "ev_readme",
16
+ "kind": "file",
17
+ "uri": "artifact://repo/open-contracts/README.md"
18
+ }
19
+ }
20
+ ],
21
+ "citations": [
22
+ {
23
+ "id": "ev_readme",
24
+ "kind": "file",
25
+ "uri": "artifact://repo/open-contracts/README.md"
26
+ }
27
+ ],
28
+ "freshness": "fresh",
29
+ "permissions": ["read-public"],
30
+ "redactions": [],
31
+ "conflicts": []
32
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "schema": "hasna.cost_estimate.v1",
3
+ "id": "cost_run_123",
4
+ "createdAt": "2026-06-27T10:00:00.000Z",
5
+ "currency": "USD",
6
+ "amountMicros": 125000,
7
+ "provider": "openai",
8
+ "model": "gpt-5.4",
9
+ "accountId": "account004",
10
+ "promptTokens": 1200,
11
+ "completionTokens": 800,
12
+ "totalTokens": 2000,
13
+ "basis": "estimated",
14
+ "resourceRefs": [
15
+ {
16
+ "kind": "task",
17
+ "id": "task_868c77df",
18
+ "externalId": "868c77df-df31-4de5-8027-5d9e7474cdd3",
19
+ "sourcePackage": "@hasna/todos"
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "schema": "hasna.decision_envelope.v1",
3
+ "id": "decision_model_route_123",
4
+ "createdAt": "2026-06-27T10:00:00.000Z",
5
+ "decisionType": "model_route",
6
+ "status": "selected",
7
+ "actor": {
8
+ "kind": "agent",
9
+ "id": "actor_codewith_account004",
10
+ "provider": "codewith",
11
+ "accountId": "account004"
12
+ },
13
+ "traceId": "trace_123",
14
+ "selected": [
15
+ {
16
+ "kind": "model",
17
+ "id": "model_gpt_5_4",
18
+ "sourcePackage": "@hasna/models",
19
+ "externalId": "gpt-5.4"
20
+ }
21
+ ],
22
+ "reason": "Selected high-capability coding model within budget.",
23
+ "obligations": ["record-cost"],
24
+ "costEstimate": {
25
+ "schema": "hasna.cost_estimate.v1",
26
+ "id": "cost_run_123",
27
+ "createdAt": "2026-06-27T10:00:00.000Z",
28
+ "currency": "USD",
29
+ "amountMicros": 125000,
30
+ "basis": "estimated"
31
+ }
32
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "schema": "hasna.evidence_ref.v1",
3
+ "id": "ev_test_output_456",
4
+ "createdAt": "2026-06-27T10:00:00.000Z",
5
+ "kind": "command_output",
6
+ "uri": "artifact://runs/run_123/test-output.txt",
7
+ "summary": "bun test passed",
8
+ "redaction": "none"
9
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "schema": "hasna.proof_bundle.v1",
3
+ "id": "proof_empty_invalid",
4
+ "createdAt": "2026-06-27T10:00:00.000Z",
5
+ "subject": {
6
+ "kind": "repo",
7
+ "id": "open-contracts",
8
+ "uri": "git+https://github.com/hasna/contracts.git"
9
+ },
10
+ "status": "succeeded",
11
+ "verdict": "passed",
12
+ "checks": []
13
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "schema": "hasna.proof_bundle.v1",
3
+ "id": "proof_contracts_release",
4
+ "createdAt": "2026-06-27T10:00:00.000Z",
5
+ "subject": {
6
+ "kind": "repo",
7
+ "id": "open-contracts",
8
+ "uri": "git+https://github.com/hasna/contracts.git"
9
+ },
10
+ "validationPlanRef": {
11
+ "kind": "verification",
12
+ "id": "validation_contracts_release",
13
+ "externalId": "validation_contracts_release",
14
+ "sourcePackage": "@hasna/contracts"
15
+ },
16
+ "status": "succeeded",
17
+ "verdict": "passed",
18
+ "checks": [
19
+ {
20
+ "checkId": "typecheck",
21
+ "status": "succeeded",
22
+ "evidenceRefs": [
23
+ {
24
+ "id": "ev_typecheck",
25
+ "kind": "command_output",
26
+ "uri": "artifact://runs/run_123/typecheck.txt"
27
+ }
28
+ ]
29
+ }
30
+ ],
31
+ "verifier": {
32
+ "kind": "agent",
33
+ "id": "actor_verifier",
34
+ "provider": "codewith"
35
+ },
36
+ "freshness": "fresh"
37
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "schema": "hasna.resource_ref.v1",
3
+ "id": "task_without_locator",
4
+ "createdAt": "2026-06-27T10:00:00.000Z",
5
+ "kind": "task"
6
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "schema": "hasna.resource_ref.v1",
3
+ "id": "task_868c77df",
4
+ "createdAt": "2026-06-27T10:00:00.000Z",
5
+ "kind": "task",
6
+ "externalId": "868c77df-df31-4de5-8027-5d9e7474cdd3",
7
+ "sourcePackage": "@hasna/todos",
8
+ "tags": ["open-todos", "contracts"]
9
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "schema": "hasna.validation_plan.v1",
3
+ "id": "validation_invalid",
4
+ "createdAt": "2026-06-27T10:00:00.000Z",
5
+ "objective": "Invalid actionable check without command or expected.",
6
+ "checks": [
7
+ {
8
+ "id": "typecheck",
9
+ "kind": "typecheck"
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "schema": "hasna.validation_plan.v1",
3
+ "id": "validation_contracts_release",
4
+ "createdAt": "2026-06-27T10:00:00.000Z",
5
+ "objective": "Verify @hasna/contracts release readiness.",
6
+ "subject": {
7
+ "kind": "repo",
8
+ "id": "open-contracts",
9
+ "uri": "git+https://github.com/hasna/contracts.git"
10
+ },
11
+ "checks": [
12
+ {
13
+ "id": "typecheck",
14
+ "kind": "typecheck",
15
+ "command": "bun run typecheck",
16
+ "required": true
17
+ },
18
+ {
19
+ "id": "tests",
20
+ "kind": "test",
21
+ "command": "bun test",
22
+ "required": true
23
+ }
24
+ ],
25
+ "requiredEvidenceKinds": ["command_output"]
26
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "schema": "hasna.work_run.v1",
3
+ "id": "work_run_123",
4
+ "createdAt": "2026-06-27T10:00:00.000Z",
5
+ "objective": "Implement @hasna/contracts schemas.",
6
+ "status": "succeeded",
7
+ "actor": {
8
+ "kind": "agent",
9
+ "id": "actor_codewith_account004",
10
+ "provider": "codewith",
11
+ "accountId": "account004"
12
+ },
13
+ "traceId": "trace_123",
14
+ "startedAt": "2026-06-27T10:00:00.000Z",
15
+ "finishedAt": "2026-06-27T10:05:00.000Z",
16
+ "resourceRefs": [
17
+ {
18
+ "kind": "task",
19
+ "id": "task_efd590d0",
20
+ "externalId": "efd590d0-b38d-48f8-a087-162d52f8c39d",
21
+ "sourcePackage": "@hasna/todos"
22
+ }
23
+ ],
24
+ "evidenceRefs": [
25
+ {
26
+ "id": "ev_tests",
27
+ "kind": "command_output",
28
+ "uri": "artifact://runs/run_123/tests.txt"
29
+ }
30
+ ]
31
+ }
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@hasna/contracts",
3
+ "version": "0.1.0",
4
+ "description": "Shared schemas and validators for Hasna open-source agent infrastructure contracts.",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/hasna/contracts.git"
10
+ },
11
+ "homepage": "https://github.com/hasna/contracts",
12
+ "bugs": {
13
+ "url": "https://github.com/hasna/contracts/issues"
14
+ },
15
+ "publishConfig": {
16
+ "registry": "https://registry.npmjs.org",
17
+ "access": "public"
18
+ },
19
+ "bin": {
20
+ "contracts": "dist/cli/index.js",
21
+ "contracts-cli": "dist/cli/index.js"
22
+ },
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./dist/index.js"
27
+ },
28
+ "./schemas": {
29
+ "types": "./dist/schemas.d.ts",
30
+ "import": "./dist/schemas.js"
31
+ },
32
+ "./validators": {
33
+ "types": "./dist/validators.d.ts",
34
+ "import": "./dist/validators.js"
35
+ }
36
+ },
37
+ "files": [
38
+ "dist",
39
+ "examples",
40
+ "README.md",
41
+ "LICENSE"
42
+ ],
43
+ "scripts": {
44
+ "build": "rm -rf dist && bun build src/index.ts src/schemas.ts src/validators.ts --outdir dist --target bun && bun build src/cli/index.ts --outdir dist/cli --target bun && tsc -p tsconfig.build.json --emitDeclarationOnly --outDir dist",
45
+ "typecheck": "tsc --noEmit",
46
+ "test": "bun test",
47
+ "lint": "tsc --noEmit",
48
+ "verify:release": "bun run typecheck && bun test && bun run build && bun run smoke:dist && bun run pack:check",
49
+ "smoke:dist": "bun scripts/smoke-dist.ts",
50
+ "pack:check": "npm pack --dry-run --json --ignore-scripts",
51
+ "dev:cli": "bun run src/cli/index.ts",
52
+ "prepack": "bun run verify:release",
53
+ "prepublishOnly": "bun run typecheck && bun test"
54
+ },
55
+ "keywords": [
56
+ "contracts",
57
+ "schemas",
58
+ "agents",
59
+ "zod",
60
+ "json-schema",
61
+ "hasna"
62
+ ],
63
+ "engines": {
64
+ "bun": ">=1.0.0"
65
+ },
66
+ "dependencies": {
67
+ "commander": "^13.1.0",
68
+ "zod": "^3.25.76"
69
+ },
70
+ "devDependencies": {
71
+ "@types/bun": "^1.2.4",
72
+ "typescript": "^5.7.3"
73
+ }
74
+ }