@agent-workspace/core 0.2.1 → 0.5.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.
Files changed (39) hide show
  1. package/dist/constants.d.ts +23 -3
  2. package/dist/constants.d.ts.map +1 -1
  3. package/dist/constants.js +35 -7
  4. package/dist/constants.js.map +1 -1
  5. package/dist/constants.test.d.ts +2 -0
  6. package/dist/constants.test.d.ts.map +1 -0
  7. package/dist/constants.test.js +73 -0
  8. package/dist/constants.test.js.map +1 -0
  9. package/dist/index.d.ts +7 -3
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +3 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/types/contract.d.ts +49 -0
  14. package/dist/types/contract.d.ts.map +1 -0
  15. package/dist/types/contract.js +2 -0
  16. package/dist/types/contract.js.map +1 -0
  17. package/dist/types/project.d.ts +49 -0
  18. package/dist/types/project.d.ts.map +1 -0
  19. package/dist/types/project.js +2 -0
  20. package/dist/types/project.js.map +1 -0
  21. package/dist/types/reputation.d.ts +60 -0
  22. package/dist/types/reputation.d.ts.map +1 -0
  23. package/dist/types/reputation.js +2 -0
  24. package/dist/types/reputation.js.map +1 -0
  25. package/dist/types/swarm.d.ts +55 -0
  26. package/dist/types/swarm.d.ts.map +1 -0
  27. package/dist/types/swarm.js +2 -0
  28. package/dist/types/swarm.js.map +1 -0
  29. package/dist/types/workspace.d.ts +68 -7
  30. package/dist/types/workspace.d.ts.map +1 -1
  31. package/package.json +6 -1
  32. package/schemas/delegation-contract.schema.json +139 -0
  33. package/schemas/experiment.schema.json +223 -0
  34. package/schemas/manifesto.schema.json +214 -0
  35. package/schemas/project.schema.json +106 -0
  36. package/schemas/reputation-profile.schema.json +132 -0
  37. package/schemas/society.schema.json +190 -0
  38. package/schemas/swarm.schema.json +126 -0
  39. package/schemas/task.schema.json +90 -0
@@ -1,65 +1,106 @@
1
1
  /**
2
- * AWP Workspace manifest (.awp/workspace.json)
2
+ * AWP Workspace manifest stored at .awp/workspace.json
3
+ * Contains workspace-level metadata and agent configuration.
3
4
  */
4
5
  export interface WorkspaceManifest {
6
+ /** AWP specification version (e.g., "0.4.0") */
5
7
  awp: string;
8
+ /** Unique workspace identifier (URN format) */
6
9
  id: string;
10
+ /** Human-readable workspace name */
7
11
  name: string;
12
+ /** ISO 8601 timestamp when workspace was created */
8
13
  created: string;
14
+ /** Agent configuration */
9
15
  agent: {
16
+ /** Agent's decentralized identifier (did:key format) */
10
17
  did?: string;
18
+ /** Path to identity file (default: "IDENTITY.md") */
11
19
  identityFile: string;
12
20
  };
21
+ /** List of agent capabilities (e.g., ["coding", "research"]) */
13
22
  capabilities?: string[];
23
+ /** Protocol support flags */
14
24
  protocols?: {
25
+ /** Agent-to-Agent protocol support */
15
26
  a2a?: boolean;
27
+ /** Model Context Protocol support */
16
28
  mcp?: boolean;
17
29
  };
18
30
  }
19
31
  /**
20
- * Common frontmatter fields shared by all workspace files
32
+ * Common YAML frontmatter fields shared by all AWP workspace files.
33
+ * Every workspace file (*.md) includes these base fields.
21
34
  */
22
35
  export interface BaseFrontmatter {
36
+ /** AWP specification version */
23
37
  awp: string;
38
+ /** File type identifier (e.g., "identity", "soul", "memory-daily") */
24
39
  type: string;
40
+ /** ISO 8601 timestamp of last modification */
25
41
  lastModified?: string;
42
+ /** DID or identifier of last modifier */
26
43
  modifiedBy?: string;
27
44
  }
28
45
  /**
29
- * IDENTITY.md frontmatter
46
+ * IDENTITY.md frontmatter - defines the agent's public identity.
47
+ * Contains factual information about what the agent is and can do.
30
48
  */
31
49
  export interface IdentityFrontmatter extends BaseFrontmatter {
32
50
  type: "identity";
51
+ /** Decentralized identifier (did:key format) */
33
52
  did?: string;
53
+ /** Agent's display name */
34
54
  name: string;
55
+ /** What kind of entity this is (e.g., "digital assistant", "coding agent") */
35
56
  creature?: string;
57
+ /** Representative emoji */
36
58
  emoji?: string;
59
+ /** URL to avatar image */
37
60
  avatar?: string;
61
+ /** List of capabilities this agent has */
38
62
  capabilities?: string[];
63
+ /** ISO 8601 timestamp when identity was created */
39
64
  created: string;
40
65
  }
41
66
  /**
42
- * SOUL.md frontmatter
67
+ * SOUL.md frontmatter - defines the agent's personality, values, and behavioral constraints.
68
+ * This is who the agent IS, not just what it can do.
43
69
  */
44
70
  export interface SoulFrontmatter extends BaseFrontmatter {
45
71
  type: "soul";
72
+ /** Brief personality description */
46
73
  vibe?: string;
74
+ /** Core values that guide behavior */
47
75
  values?: SoulValue[];
76
+ /** Behavioral boundaries and constraints */
48
77
  boundaries?: SoulBoundary[];
78
+ /** Governance rules for human oversight */
49
79
  governance?: SoulGovernance;
50
80
  }
81
+ /** A core value that guides agent behavior */
51
82
  export interface SoulValue {
83
+ /** Unique identifier for this value */
52
84
  id: string;
85
+ /** Priority ranking (1 = highest) */
53
86
  priority?: number;
87
+ /** Description of what this value means in practice */
54
88
  description: string;
55
89
  }
90
+ /** A behavioral boundary or constraint */
56
91
  export interface SoulBoundary {
92
+ /** Unique identifier for this boundary */
57
93
  id: string;
94
+ /** The rule or constraint */
58
95
  rule: string;
96
+ /** Severity level: "hard" = never violate, "soft" = prefer to follow */
59
97
  severity: "hard" | "soft";
60
98
  }
99
+ /** Governance rules defining what requires human approval */
61
100
  export interface SoulGovernance {
101
+ /** Actions that always require human approval */
62
102
  humanApprovalRequired?: string[];
103
+ /** Actions the agent can take autonomously */
63
104
  autonomouslyAllowed?: string[];
64
105
  }
65
106
  /**
@@ -90,17 +131,25 @@ export interface OperationsFrontmatter extends BaseFrontmatter {
90
131
  };
91
132
  }
92
133
  /**
93
- * Daily memory log frontmatter
134
+ * Daily memory log frontmatter (memory/YYYY-MM-DD.md).
135
+ * Contains structured entries from a single day.
94
136
  */
95
137
  export interface MemoryDailyFrontmatter extends BaseFrontmatter {
96
138
  type: "memory-daily";
139
+ /** Date in YYYY-MM-DD format */
97
140
  date: string;
141
+ /** Structured memory entries for this day */
98
142
  entries?: MemoryEntry[];
99
143
  }
144
+ /** A single memory entry in a daily log */
100
145
  export interface MemoryEntry {
146
+ /** Time of entry in HH:MM format */
101
147
  time?: string;
148
+ /** The memory content */
102
149
  content: string;
150
+ /** Tags for categorization and search */
103
151
  tags?: string[];
152
+ /** Whether this entry should be preserved during compaction */
104
153
  pinned?: boolean;
105
154
  }
106
155
  /**
@@ -132,16 +181,28 @@ export interface HeartbeatTask {
132
181
  enabled?: boolean;
133
182
  }
134
183
  import type { ArtifactFrontmatter } from "./artifact.js";
184
+ import type { ReputationProfileFrontmatter } from "./reputation.js";
185
+ import type { DelegationContractFrontmatter } from "./contract.js";
186
+ import type { ProjectFrontmatter, TaskFrontmatter } from "./project.js";
135
187
  /**
136
188
  * Union of all frontmatter types
137
189
  */
138
- export type AnyFrontmatter = IdentityFrontmatter | SoulFrontmatter | UserFrontmatter | OperationsFrontmatter | ToolsFrontmatter | HeartbeatFrontmatter | MemoryDailyFrontmatter | MemoryLongtermFrontmatter | ArtifactFrontmatter;
190
+ export type AnyFrontmatter = IdentityFrontmatter | SoulFrontmatter | UserFrontmatter | OperationsFrontmatter | ToolsFrontmatter | HeartbeatFrontmatter | MemoryDailyFrontmatter | MemoryLongtermFrontmatter | ArtifactFrontmatter | ReputationProfileFrontmatter | DelegationContractFrontmatter | ProjectFrontmatter | TaskFrontmatter;
139
191
  /**
140
- * A parsed workspace file frontmatter + markdown body
192
+ * A parsed AWP workspace file containing YAML frontmatter and markdown body.
193
+ * Generic type T allows type-safe access to specific frontmatter types.
194
+ *
195
+ * @template T - The frontmatter type (extends BaseFrontmatter)
196
+ * @example
197
+ * const identity = await parseWorkspaceFile<IdentityFrontmatter>("IDENTITY.md");
198
+ * console.log(identity.frontmatter.name); // Type-safe access
141
199
  */
142
200
  export interface WorkspaceFile<T extends BaseFrontmatter = BaseFrontmatter> {
201
+ /** Parsed YAML frontmatter */
143
202
  frontmatter: T;
203
+ /** Markdown body content (without frontmatter) */
144
204
  body: string;
205
+ /** Absolute path to the file */
145
206
  filePath: string;
146
207
  }
147
208
  //# sourceMappingURL=workspace.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/types/workspace.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE;QACL,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE;QACV,GAAG,CAAC,EAAE,OAAO,CAAC;QACd,GAAG,CAAC,EAAE,OAAO,CAAC;KACf,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,YAAY,EAAE,CAAC;IAC5B,UAAU,CAAC,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C,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,mBAAmB,GACnB,eAAe,GACf,eAAe,GACf,qBAAqB,GACrB,gBAAgB,GAChB,oBAAoB,GACpB,sBAAsB,GACtB,yBAAyB,GACzB,mBAAmB,GACnB,4BAA4B,GAC5B,6BAA6B,GAC7B,kBAAkB,GAClB,eAAe,CAAC;AAEpB;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IACxE,8BAA8B;IAC9B,WAAW,EAAE,CAAC,CAAC;IACf,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAC;CAClB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-workspace/core",
3
- "version": "0.2.1",
3
+ "version": "0.5.0",
4
4
  "description": "Core types, constants, and schemas for the Agent Workspace Protocol",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -39,8 +39,13 @@
39
39
  "node": ">=18"
40
40
  },
41
41
  "scripts": {
42
+ "copy-schemas": "cp -r ../../spec/schemas/* ./schemas/",
43
+ "prebuild": "npm run copy-schemas",
42
44
  "build": "tsc",
43
45
  "dev": "tsc --watch",
46
+ "lint": "eslint src/",
47
+ "test": "vitest run",
48
+ "test:watch": "vitest",
44
49
  "typecheck": "tsc --noEmit",
45
50
  "prepublishOnly": "npm run build"
46
51
  },
@@ -0,0 +1,139 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://awp.dev/schemas/delegation-contract.schema.json",
4
+ "title": "AWP Delegation Contract",
5
+ "description": "Schema for AWP delegation contract frontmatter (RDP v1.0)",
6
+ "type": "object",
7
+ "required": ["awp", "rdp", "type", "id", "status", "delegator", "delegate", "delegateSlug", "created", "task", "evaluation"],
8
+ "properties": {
9
+ "awp": {
10
+ "type": "string",
11
+ "pattern": "^\\d+\\.\\d+\\.\\d+$",
12
+ "description": "AWP specification version"
13
+ },
14
+ "rdp": {
15
+ "type": "string",
16
+ "description": "RDP specification version"
17
+ },
18
+ "type": {
19
+ "type": "string",
20
+ "const": "delegation-contract"
21
+ },
22
+ "id": {
23
+ "type": "string",
24
+ "pattern": "^contract:[a-z0-9][a-z0-9-]*$",
25
+ "description": "Unique identifier (contract:<slug>)"
26
+ },
27
+ "status": {
28
+ "type": "string",
29
+ "enum": ["draft", "active", "completed", "evaluated"],
30
+ "description": "Contract lifecycle state"
31
+ },
32
+ "delegator": {
33
+ "type": "string",
34
+ "description": "DID of the agent delegating work"
35
+ },
36
+ "delegate": {
37
+ "type": "string",
38
+ "description": "DID of the agent receiving work"
39
+ },
40
+ "delegateSlug": {
41
+ "type": "string",
42
+ "pattern": "^[a-z0-9][a-z0-9-]*$",
43
+ "description": "Slug of delegate's reputation profile"
44
+ },
45
+ "created": {
46
+ "type": "string",
47
+ "format": "date-time",
48
+ "description": "Contract creation timestamp"
49
+ },
50
+ "deadline": {
51
+ "type": "string",
52
+ "format": "date-time",
53
+ "description": "Optional deadline"
54
+ },
55
+ "task": {
56
+ "type": "object",
57
+ "required": ["description"],
58
+ "properties": {
59
+ "description": {
60
+ "type": "string",
61
+ "description": "What needs to be done"
62
+ },
63
+ "outputFormat": {
64
+ "type": "string",
65
+ "description": "Expected output type (e.g., 'knowledge-artifact')"
66
+ },
67
+ "outputSlug": {
68
+ "type": "string",
69
+ "description": "Expected output artifact slug"
70
+ }
71
+ },
72
+ "additionalProperties": true
73
+ },
74
+ "scope": {
75
+ "type": "object",
76
+ "properties": {
77
+ "include": {
78
+ "type": "array",
79
+ "items": { "type": "string" },
80
+ "description": "What's in scope"
81
+ },
82
+ "exclude": {
83
+ "type": "array",
84
+ "items": { "type": "string" },
85
+ "description": "What's out of scope"
86
+ }
87
+ },
88
+ "additionalProperties": true
89
+ },
90
+ "constraints": {
91
+ "type": "object",
92
+ "properties": {
93
+ "requireCitations": {
94
+ "type": "boolean",
95
+ "description": "Must cite sources"
96
+ },
97
+ "confidenceThreshold": {
98
+ "type": "number",
99
+ "minimum": 0,
100
+ "maximum": 1,
101
+ "description": "Minimum confidence for claims"
102
+ }
103
+ },
104
+ "additionalProperties": true
105
+ },
106
+ "evaluation": {
107
+ "type": "object",
108
+ "required": ["criteria"],
109
+ "properties": {
110
+ "criteria": {
111
+ "type": "object",
112
+ "description": "Map of criterion name to weight (should sum to 1.0)",
113
+ "additionalProperties": {
114
+ "type": "number",
115
+ "minimum": 0,
116
+ "maximum": 1
117
+ }
118
+ },
119
+ "result": {
120
+ "oneOf": [
121
+ { "type": "null" },
122
+ {
123
+ "type": "object",
124
+ "description": "Map of criterion name to score (0.0-1.0)",
125
+ "additionalProperties": {
126
+ "type": "number",
127
+ "minimum": 0,
128
+ "maximum": 1
129
+ }
130
+ }
131
+ ],
132
+ "description": "Evaluation results, null until evaluated"
133
+ }
134
+ },
135
+ "additionalProperties": true
136
+ }
137
+ },
138
+ "additionalProperties": true
139
+ }
@@ -0,0 +1,223 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://awp.dev/schemas/experiment.schema.json",
4
+ "title": "AWP Experiment",
5
+ "description": "Schema for experiment manifest - comparing societies under different manifestos (EXP v1.0)",
6
+ "type": "object",
7
+ "required": ["exp", "type", "id", "name", "status", "created", "societies", "simulation"],
8
+ "properties": {
9
+ "exp": {
10
+ "type": "string",
11
+ "description": "EXP specification version"
12
+ },
13
+ "type": {
14
+ "type": "string",
15
+ "const": "experiment"
16
+ },
17
+ "id": {
18
+ "type": "string",
19
+ "pattern": "^experiment:[a-z0-9][a-z0-9-]*$",
20
+ "description": "Unique identifier (experiment:<slug>)"
21
+ },
22
+ "name": {
23
+ "type": "string",
24
+ "description": "Human-readable experiment name"
25
+ },
26
+ "hypothesis": {
27
+ "type": "string",
28
+ "description": "The hypothesis being tested"
29
+ },
30
+ "created": {
31
+ "type": "string",
32
+ "format": "date-time",
33
+ "description": "Creation timestamp"
34
+ },
35
+ "status": {
36
+ "type": "string",
37
+ "enum": ["draft", "running", "paused", "completed", "analyzed"],
38
+ "description": "Experiment lifecycle state"
39
+ },
40
+ "societies": {
41
+ "type": "array",
42
+ "items": { "$ref": "#/$defs/societyRef" },
43
+ "minItems": 1,
44
+ "description": "Societies being compared"
45
+ },
46
+ "simulation": {
47
+ "$ref": "#/$defs/simulationConfig",
48
+ "description": "Simulation parameters"
49
+ },
50
+ "measurement": {
51
+ "$ref": "#/$defs/measurementConfig",
52
+ "description": "What and how to measure"
53
+ },
54
+ "comparison": {
55
+ "$ref": "#/$defs/comparisonConfig",
56
+ "description": "How to compare societies"
57
+ },
58
+ "results": {
59
+ "$ref": "#/$defs/experimentResults",
60
+ "description": "Experiment results (populated after completion)"
61
+ }
62
+ },
63
+ "additionalProperties": true,
64
+ "$defs": {
65
+ "societyRef": {
66
+ "type": "object",
67
+ "required": ["id", "manifesto"],
68
+ "properties": {
69
+ "id": {
70
+ "type": "string",
71
+ "pattern": "^society:[a-z0-9][a-z0-9-]*$"
72
+ },
73
+ "manifesto": {
74
+ "type": "string",
75
+ "pattern": "^manifesto:[a-z0-9][a-z0-9-]*$"
76
+ },
77
+ "label": {
78
+ "type": "string",
79
+ "description": "Short label for charts/comparisons"
80
+ }
81
+ }
82
+ },
83
+ "simulationConfig": {
84
+ "type": "object",
85
+ "required": ["cycles"],
86
+ "properties": {
87
+ "cycles": {
88
+ "type": "integer",
89
+ "minimum": 1,
90
+ "description": "Number of cycles to run"
91
+ },
92
+ "cycleLength": {
93
+ "type": "string",
94
+ "description": "Simulated time per cycle (e.g., '1 day')"
95
+ },
96
+ "tasksPerCycle": {
97
+ "type": "integer",
98
+ "minimum": 0,
99
+ "description": "Tasks generated per cycle"
100
+ },
101
+ "contractsPerCycle": {
102
+ "type": "integer",
103
+ "minimum": 0,
104
+ "description": "Contracts created per cycle"
105
+ },
106
+ "randomSeed": {
107
+ "type": "integer",
108
+ "description": "Random seed for reproducibility"
109
+ },
110
+ "parallelExecution": {
111
+ "type": "boolean",
112
+ "description": "Run societies in parallel"
113
+ }
114
+ }
115
+ },
116
+ "measurementConfig": {
117
+ "type": "object",
118
+ "properties": {
119
+ "interval": {
120
+ "type": "integer",
121
+ "minimum": 1,
122
+ "description": "Measure every N cycles"
123
+ },
124
+ "metrics": {
125
+ "type": "array",
126
+ "items": { "type": "string" },
127
+ "description": "Metrics to collect"
128
+ },
129
+ "snapshots": {
130
+ "type": "boolean",
131
+ "description": "Whether to store full state snapshots"
132
+ }
133
+ }
134
+ },
135
+ "comparisonConfig": {
136
+ "type": "object",
137
+ "properties": {
138
+ "primary": {
139
+ "type": "string",
140
+ "description": "Primary metric for comparison"
141
+ },
142
+ "statistical": {
143
+ "type": "string",
144
+ "enum": ["t-test", "anova", "mann-whitney", "kruskal-wallis"],
145
+ "description": "Statistical test to use"
146
+ },
147
+ "significance": {
148
+ "type": "number",
149
+ "minimum": 0,
150
+ "maximum": 1,
151
+ "description": "Significance level (alpha)"
152
+ }
153
+ }
154
+ },
155
+ "experimentResults": {
156
+ "type": "object",
157
+ "properties": {
158
+ "completedAt": {
159
+ "type": "string",
160
+ "format": "date-time"
161
+ },
162
+ "totalCycles": {
163
+ "type": "integer"
164
+ },
165
+ "societyResults": {
166
+ "type": "object",
167
+ "additionalProperties": { "$ref": "#/$defs/societyResult" }
168
+ },
169
+ "comparison": {
170
+ "$ref": "#/$defs/comparisonResult"
171
+ },
172
+ "conclusion": {
173
+ "type": "string",
174
+ "description": "Human-readable conclusion"
175
+ },
176
+ "hypothesisSupported": {
177
+ "type": "boolean",
178
+ "description": "Whether the hypothesis was supported"
179
+ }
180
+ }
181
+ },
182
+ "societyResult": {
183
+ "type": "object",
184
+ "properties": {
185
+ "finalFitness": { "type": "number" },
186
+ "avgFitness": { "type": "number" },
187
+ "finalPurityMean": { "type": "number" },
188
+ "roleTemplatesEmerged": { "type": "integer" },
189
+ "humanInterventions": { "type": "integer" },
190
+ "antiPatternViolations": { "type": "integer" },
191
+ "populationHistory": {
192
+ "type": "array",
193
+ "items": { "type": "integer" }
194
+ },
195
+ "fitnessHistory": {
196
+ "type": "array",
197
+ "items": { "type": "number" }
198
+ }
199
+ }
200
+ },
201
+ "comparisonResult": {
202
+ "type": "object",
203
+ "properties": {
204
+ "metric": { "type": "string" },
205
+ "means": {
206
+ "type": "object",
207
+ "additionalProperties": { "type": "number" }
208
+ },
209
+ "stddevs": {
210
+ "type": "object",
211
+ "additionalProperties": { "type": "number" }
212
+ },
213
+ "testStatistic": { "type": "number" },
214
+ "pValue": { "type": "number" },
215
+ "significantDifference": { "type": "boolean" },
216
+ "winner": {
217
+ "type": "string",
218
+ "description": "Society ID with best performance on primary metric"
219
+ }
220
+ }
221
+ }
222
+ }
223
+ }