codecraftai-integration-runtime 1.3.1__tar.gz → 1.4.0__tar.gz

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 (48) hide show
  1. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/LICENSE.md +30 -21
  2. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/PKG-INFO +1 -1
  3. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/pyproject.toml +1 -1
  4. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/results/concentrators/progressconcentratorservice.py +211 -14
  5. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/results/streaming/resultstreamer.py +59 -6
  6. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/README.rst +0 -0
  7. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/__init__.py +0 -0
  8. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/entrypoints.py +0 -0
  9. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/initialize.py +0 -0
  10. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/integratedtestjob.py +0 -0
  11. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/integrationruntimedefaulttypefactory.py +0 -0
  12. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/py.typed +0 -0
  13. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/results/__init__.py +0 -0
  14. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/results/concentrators/__init__.py +0 -0
  15. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/results/recorders/__init__.py +0 -0
  16. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/results/recorders/integrationjsonresultrecorder.py +0 -0
  17. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/results/recorders/streamingresultrecorder.py +0 -0
  18. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/results/streaming/__init__.py +0 -0
  19. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/runtimeoutputcontext.py +0 -0
  20. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/runtimerunmetadata.py +0 -0
  21. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/images/test-report-banner-background-image.png +0 -0
  22. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/javascript/d3.v7.js +0 -0
  23. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/javascript/icon-components.js +0 -0
  24. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/javascript/mojo-components.js +0 -0
  25. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/javascript/prism.js +0 -0
  26. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/javascript/testsummary-accessibility.js +0 -0
  27. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/javascript/testsummary-comparison.js +0 -0
  28. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/javascript/testsummary-components.js +0 -0
  29. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/javascript/testsummary-helpers.js +0 -0
  30. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/javascript/testsummary-responsive.js +0 -0
  31. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/javascript/testsummary.js +0 -0
  32. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/javascript/webcomponent-helpers.js +0 -0
  33. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/styles/branding-theme.css +0 -0
  34. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/styles/icon-styles.css +0 -0
  35. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/styles/mojo-components.css +0 -0
  36. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/styles/prism.css +0 -0
  37. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/styles/tabs-responsive.css +0 -0
  38. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/styles/testsummary-accessibility.css +0 -0
  39. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/styles/testsummary-comparison.css +0 -0
  40. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/styles/testsummary-responsive.css +0 -0
  41. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/static/styles/testsummary.css +0 -0
  42. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/tabs/tab-data.html +0 -0
  43. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/tabs/tab-images.html +0 -0
  44. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/tabs/tab-logs.html +0 -0
  45. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/tabs/tab-sounds.html +0 -0
  46. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/tabs/tab-timeseries.html +0 -0
  47. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/tabs/tab-videos.html +0 -0
  48. {codecraftai_integration_runtime-1.3.1 → codecraftai_integration_runtime-1.4.0}/source/packages/ccai/integrationruntime/templates/v2/testsummary.html +0 -0
@@ -1,5 +1,5 @@
1
1
  # Code Craft AI - Source Available License
2
- Version 1.0, October 2026
2
+ Version 1.1, November 2026
3
3
 
4
4
  Copyright (C) 2026, Code Craft AI LLC
5
5
 
@@ -7,12 +7,12 @@ Everyone is permitted to copy and distribute verbatim copies of *This License* d
7
7
 
8
8
  *This License* covers the Python Automation Kit, the full suite of software published by *Licensor* that consists of every `codecraftai-*` package, every `pychestrate` package, and the `pychestrate` server.
9
9
 
10
- *The Software* is source available. Its source code is published so that anyone can read it, learn from it, and use it, but *This License* is not an open source license. *The Software* is free to use for *Non-Commercial Use*. *Commercial Use* is permitted in exchange for a *Usage Fee* that is based on a reasonable estimation of the income derived from *The Software*, as described in section 5. When a company migrates a product or service to *The Software* from another code base, the *Profit* from that product or service is not counted toward the *Usage Fee* for two years, as described in section 5.4. For assurance of costs, a company can disclose its usage and estimated returns to *Licensor* and negotiate a fixed license cost, as described in section 5.10.
10
+ *The Software* is source available. Its source code is published so that anyone can read it, learn from it, and use it, but *This License* is not an open source license. *The Software* is free to use for *Non-Commercial Use*. *Commercial Use* is permitted in exchange for a *Usage Fee* that is based on a reasonable estimation of the income derived from *The Software*, as described in section 5. That estimation starts from *Gross Income*, not net profit, so spending on research and development or other operating expenses does not reduce it. When a company migrates a product or service to *The Software* from another code base, the *Gross Income* from that product or service is not counted toward the *Usage Fee* for two years, as described in section 5.4. For assurance of costs, a company can disclose its usage and estimated returns to *Licensor* and negotiate a fixed license cost, as described in section 5.10.
11
11
 
12
12
  ## 1. Definitions
13
13
 
14
14
  ### 1.1 *This License* or *The License*
15
- **This License** or **The License** refers to version 1.0 of the Code Craft AI - Source Available License.
15
+ **This License** or **The License** refers to version 1.1 of the Code Craft AI - Source Available License.
16
16
 
17
17
  ### 1.2 Licensor
18
18
  **Licensor** refers to Code Craft AI LLC.
@@ -42,14 +42,14 @@ Everyone is permitted to copy and distribute verbatim copies of *This License* d
42
42
  ### 1.9 Fiscal Year
43
43
  **Fiscal Year** means the annual accounting period that *You* use for financial reporting.
44
44
 
45
- ### 1.10 Profit
46
- **Profit** means the net profit that *You* earn from the *Commercial Activity* during a *Fiscal Year*, determined under the accounting principles that *You* regularly use for financial reporting.
45
+ ### 1.10 Gross Income
46
+ **Gross Income** means, for each product or service in connection with which *You* make *Commercial Use* of *The Software*, the gross profit that *You* earn from that product or service during a *Fiscal Year*: the revenue from that product or service, less its cost of goods sold or cost of revenue, determined under the accounting principles that *You* regularly use for financial reporting. *Gross Income* is calculated before operating expenses, such as research and development, sales and marketing, and general and administrative expenses, and before interest and taxes. *Gross Income* is measured for the products and services that *The Software* is used for, not for *Your* business as a whole.
47
47
 
48
48
  ### 1.11 Contribution Estimate
49
- **Contribution Estimate** means *Your* reasonable, good faith estimate of the portion of the *Profit* that *The Software* contributed to, expressed as a number from 0 to 1.
49
+ **Contribution Estimate** means *Your* reasonable, good faith estimate of the portion of the *Gross Income* that *The Software* contributed to, expressed as a number from 0 to 1.
50
50
 
51
51
  ### 1.12 Derived Income
52
- **Derived Income** means the portion of the *Profit* for a *Fiscal Year* that is derived from *The Software*, calculated as described in section 5.2.
52
+ **Derived Income** means the portion of the *Gross Income* for a *Fiscal Year* that is derived from *The Software*, calculated as described in section 5.2.
53
53
 
54
54
  ### 1.13 Usage Fee
55
55
  **Usage Fee** means the yearly fee for *Commercial Use* that is set by the table in section 5.3.
@@ -58,7 +58,7 @@ Everyone is permitted to copy and distribute verbatim copies of *This License* d
58
58
  **Migration** means moving the work for one of *Your* products or services from a code base other than *The Software*, such as another framework, another library, or *Your* own code, to *The Software*.
59
59
 
60
60
  ### 1.15 Migration Period
61
- **Migration Period** means the two (2) year period, described in section 5.4, during which the *Profit* from a product or service that *You* are migrating to *The Software* is not counted.
61
+ **Migration Period** means the two (2) year period, described in section 5.4, during which the *Gross Income* from a product or service that *You* are migrating to *The Software* is not counted.
62
62
 
63
63
  ## 2. License Grant
64
64
 
@@ -96,11 +96,11 @@ For each *Fiscal Year* in which *You* make *Commercial Use* of *The Software*, *
96
96
  ### 5.2 Derived Income
97
97
  The *Derived Income* for a *Fiscal Year* is calculated as follows:
98
98
 
99
- (Contribution Estimate) * (Profit) = (Derived Income)
99
+ (Contribution Estimate) * (Gross Income) = (Derived Income)
100
100
 
101
- If *You* make *Commercial Use* of *The Software* for more than one product or service, calculate the *Derived Income* for each product or service using its own *Contribution Estimate* and *Profit*, and add the results together. The *Profit* from a product or service that is in its *Migration Period* is not counted, as described in section 5.4.
101
+ If *You* make *Commercial Use* of *The Software* for more than one product or service, calculate the *Derived Income* for each product or service using its own *Contribution Estimate* and *Gross Income*, and add the results together. The *Gross Income* from a product or service that is in its *Migration Period* is not counted, as described in section 5.4.
102
102
 
103
- If the *Profit* from a product or service for a *Fiscal Year* is zero or less, then the *Derived Income* from that product or service for that *Fiscal Year* is zero.
103
+ If the *Gross Income* from a product or service for a *Fiscal Year* is zero or less, then the *Derived Income* from that product or service for that *Fiscal Year* is zero.
104
104
 
105
105
  ### 5.3 Usage Fee
106
106
  The *Usage Fee* for a *Fiscal Year* is set by the *Derived Income* for that *Fiscal Year*, as shown in the following table.
@@ -113,56 +113,65 @@ The *Usage Fee* for a *Fiscal Year* is set by the *Derived Income* for that *Fis
113
113
  | More than 100,000,000, up to and including 1,000,000,000 | 250,000 |
114
114
  | More than 1,000,000,000 | 500,000 |
115
115
 
116
- All amounts in this section 5 are in United States dollars. If *You* report *Profit* in a different currency, convert the *Derived Income* to United States dollars using the average exchange rate for the *Fiscal Year*.
116
+ All amounts in this section 5 are in United States dollars. If *You* report *Gross Income* in a different currency, convert the *Derived Income* to United States dollars using the average exchange rate for the *Fiscal Year*.
117
117
 
118
118
  ### 5.4 Migration Allowance
119
- When *You* migrate a product or service to *The Software*, the *Profit* from that product or service is not counted when calculating the *Derived Income* during its *Migration Period* (the **Migration Allowance**).
119
+ When *You* migrate a product or service to *The Software*, the *Gross Income* from that product or service is not counted when calculating the *Derived Income* during its *Migration Period* (the **Migration Allowance**).
120
120
 
121
121
  The *Migration Period* for a product or service begins on the date that *You* first make *Commercial Use* of *The Software* for that product or service as part of its *Migration*, and ends two (2) years after that date.
122
122
 
123
123
  The *Migration Allowance* applies to each product or service separately, and *You* may use it for every product or service that *You* migrate. Each product or service has only one *Migration Period*.
124
124
 
125
- If a *Fiscal Year* is only partly within the *Migration Period* of a product or service, the *Profit* from that product or service for that *Fiscal Year* is reduced in proportion to the number of days of that *Fiscal Year* that fall within its *Migration Period*.
125
+ If a *Fiscal Year* is only partly within the *Migration Period* of a product or service, the *Gross Income* from that product or service for that *Fiscal Year* is reduced in proportion to the number of days of that *Fiscal Year* that fall within its *Migration Period*.
126
126
 
127
- For example, a company tests product A with *The Software* and pays a *Usage Fee* based on the *Profit* from product A. On March 1, 2027, the company begins moving the testing of product B from a different test framework to *The Software*. The company does not count the *Profit* from product B in its *Derived Income* from March 1, 2027 until March 1, 2029. Starting March 1, 2029, the *Profit* from product B is counted. If the company later migrates product C, the *Profit* from product C is not counted for two years from the start of its own *Migration*.
127
+ For example, a company tests product A with *The Software* and pays a *Usage Fee* based on the *Gross Income* from product A. On March 1, 2027, the company begins moving the testing of product B from a different test framework to *The Software*. The company does not count the *Gross Income* from product B in its *Derived Income* from March 1, 2027 until March 1, 2029. Starting March 1, 2029, the *Gross Income* from product B is counted. If the company later migrates product C, the *Gross Income* from product C is not counted for two years from the start of its own *Migration*.
128
128
 
129
129
  ### 5.5 Contribution Estimate
130
130
  *You* are responsible for making the *Contribution Estimate*. A *Contribution Estimate* must be reasonable and made in good faith. The *Contribution Estimate* for a product or service covers all of the *Components* that *You* *Use* for that product or service. When making the *Contribution Estimate*, *You* should consider how important *The Software* is to the *Commercial Activity*, how much of the *Commercial Activity* depends on *The Software*, and the effort and cost that *You* would otherwise need to spend to accomplish what *The Software* accomplishes for *You*.
131
131
 
132
132
  The following table is a guide for making the *Contribution Estimate*. When *Your* *Commercial Use* of *The Software* matches an entry in the table, the *Contribution Estimate* in that entry is a reasonable *Contribution Estimate*. When *Your* *Commercial Use* does not match an entry in the table, make the *Contribution Estimate* by comparing *Your* *Commercial Use* with the entries in the table. When more than one entry matches the same *Commercial Activity*, use the entry with the highest *Contribution Estimate*.
133
133
 
134
+ Many products are not software, such as devices, machines, vehicles, and other physical goods, and software accounts for only part of what such a product is worth. For a product or service that is not software, *You* may reduce the *Contribution Estimate* in proportion to the share of the value of the shipped product that its software reasonably accounts for. To do so, multiply the *Contribution Estimate* from the table by that share, expressed as a number from 0 to 1. *You* must keep records that reasonably support that share, as described in section 5.8.
135
+
134
136
  | Commercial Use of *The Software* | Contribution Estimate |
135
137
  |----------------------------------|-----------------------|
136
138
  | Quality Assurance (QA) and Continuous Integration (CI): *The Software* is used to test or validate the products or services of the *Commercial Activity*, or to run their build and test pipelines | 0.3 |
137
139
  | Products Completely Based on *The Software*: the products or services of the *Commercial Activity* are built completely on *The Software* | 0.5 |
138
140
 
139
141
  ### 5.6 Examples
140
- A company earns 1,000,000,000 in *Profit* from a product line during a *Fiscal Year*. The company uses *The Software* for the QA and CI of that product line, so the *Contribution Estimate* is 0.3.
142
+ A company earns 1,000,000,000 in *Gross Income* from a product line during a *Fiscal Year*. The company uses *The Software* for the QA and CI of that product line, so the *Contribution Estimate* is 0.3.
141
143
 
142
144
  0.3 * 1,000,000,000 = 300,000,000
143
145
 
144
146
  The *Derived Income* of 300,000,000 is more than 100,000,000 and not more than 1,000,000,000, so the *Usage Fee* for that *Fiscal Year* is 250,000.
145
147
 
146
- A company earns 4,000,000 in *Profit* from a product during a *Fiscal Year*. The product is built completely on *The Software*, so the *Contribution Estimate* is 0.5.
148
+ A company earns 4,000,000 in *Gross Income* from a product during a *Fiscal Year*. The product is built completely on *The Software*, so the *Contribution Estimate* is 0.5.
147
149
 
148
150
  0.5 * 4,000,000 = 2,000,000
149
151
 
150
152
  The *Derived Income* of 2,000,000 is more than 1,000,000 and not more than 10,000,000, so the *Usage Fee* for that *Fiscal Year* is 50,000.
151
153
 
152
- A company earns 3,000,000 in *Profit* from a product line during a *Fiscal Year*. The company uses *The Software* for the QA and CI of that product line, so the *Contribution Estimate* is 0.3.
154
+ A company earns 3,000,000 in *Gross Income* from a product line during a *Fiscal Year*. The company uses *The Software* for the QA and CI of that product line, so the *Contribution Estimate* is 0.3.
153
155
 
154
156
  0.3 * 3,000,000 = 900,000
155
157
 
156
158
  The *Derived Income* of 900,000 is 1,000,000 or less, so there is no *Usage Fee* for that *Fiscal Year*.
157
159
 
160
+ A company earns 50,000,000 in *Gross Income* from a line of medical devices during a *Fiscal Year*. The company uses *The Software* for the QA and CI of the devices, so the *Contribution Estimate* from the table is 0.3. The devices are not software, and the company reasonably estimates that their software accounts for one fifth (0.2) of the value of each shipped device, so the company reduces the *Contribution Estimate* to 0.06.
161
+
162
+ 0.3 * 0.2 = 0.06
163
+ 0.06 * 50,000,000 = 3,000,000
164
+
165
+ The *Derived Income* of 3,000,000 is more than 1,000,000 and not more than 10,000,000, so the *Usage Fee* for that *Fiscal Year* is 50,000. Without the reduction, the *Derived Income* would be 15,000,000 and the *Usage Fee* would be 100,000.
166
+
158
167
  ### 5.7 Reporting and Payment
159
- Within one hundred twenty (120) days after the end of each *Fiscal Year* for which a *Usage Fee* is owed, *You* must pay the *Usage Fee* to *Licensor* and provide *Licensor* with a written statement that shows the *Profit*, the *Contribution Estimate*, the reasoning used to make the *Contribution Estimate*, the *Derived Income*, and the *Usage Fee*. *Usage Fees* are payable in United States dollars. If any *Profit* is not counted under section 5.4, the statement must also identify each product or service that is in a *Migration Period* and show the dates of its *Migration Period*. No statement is required for a *Fiscal Year* in which no *Usage Fee* is owed.
168
+ Within one hundred twenty (120) days after the end of each *Fiscal Year* for which a *Usage Fee* is owed, *You* must pay the *Usage Fee* to *Licensor* and provide *Licensor* with a written statement that shows the *Gross Income*, the *Contribution Estimate*, the reasoning used to make the *Contribution Estimate*, the *Derived Income*, and the *Usage Fee*. *Usage Fees* are payable in United States dollars. If any *Gross Income* is not counted under section 5.4, the statement must also identify each product or service that is in a *Migration Period* and show the dates of its *Migration Period*. No statement is required for a *Fiscal Year* in which no *Usage Fee* is owed.
160
169
 
161
170
  ### 5.8 Records and Review
162
- *You* must keep records that reasonably support each *Contribution Estimate*, each *Profit* figure, and the dates of any *Migration Period* for at least three (3) years after the end of the *Fiscal Year* that they apply to. No more than once in any twelve (12) month period, *Licensor* may ask in writing for the records that support a statement, and *You* must provide them within sixty (60) days of the request. *Licensor* will treat those records as confidential.
171
+ *You* must keep records that reasonably support each *Contribution Estimate*, including any share used to reduce it under section 5.5, each *Gross Income* figure, and the dates of any *Migration Period* for at least three (3) years after the end of the *Fiscal Year* that they apply to. No more than once in any twelve (12) month period, *Licensor* may ask in writing for the records that support a statement, and *You* must provide them within sixty (60) days of the request. *Licensor* will treat those records as confidential.
163
172
 
164
173
  ### 5.9 Disputes About the Usage Fee
165
- If *Licensor* believes that a *Contribution Estimate*, a *Profit* figure, or the dates of a *Migration Period* are not reasonable, *Licensor* will notify *You* in writing and explain why. *You* and *Licensor* will then negotiate in good faith for at least sixty (60) days to agree on a reasonable *Usage Fee*. If *You* and *Licensor* cannot agree, either party may resolve the dispute as described in section 8.
174
+ If *Licensor* believes that a *Contribution Estimate*, a *Gross Income* figure, or the dates of a *Migration Period* are not reasonable, *Licensor* will notify *You* in writing and explain why. *You* and *Licensor* will then negotiate in good faith for at least sixty (60) days to agree on a reasonable *Usage Fee*. If *You* and *Licensor* cannot agree, either party may resolve the dispute as described in section 8.
166
175
 
167
176
  ### 5.10 Fixed License Cost
168
177
  For assurance of costs, *You* may disclose to *Licensor* how *You* *Use* *The Software* and the returns that *You* estimate *You* will derive from it, and negotiate a fixed license cost with *Licensor*. A fixed license cost, and any other terms that *You* and *Licensor* agree to, must be set out in a writing signed by both *You* and *Licensor* (a **Fixed License Agreement**).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codecraftai-integration-runtime
3
- Version: 1.3.1
3
+ Version: 1.4.0
4
4
  Summary: Code Craft AI - Integration Runtime
5
5
  License-Expression: LicenseRef-CodeCraftAI-Source-Available
6
6
  License-File: LICENSE.md
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "codecraftai-integration-runtime"
3
- version = "1.3.1"
3
+ version = "1.4.0"
4
4
  description = "Code Craft AI - Integration Runtime"
5
5
  readme = "README.rst"
6
6
  license = "LicenseRef-CodeCraftAI-Source-Available"
@@ -14,9 +14,12 @@ __credits__ = []
14
14
 
15
15
  from typing import Any, Optional, Tuple
16
16
 
17
+ import hmac
17
18
  import json
19
+ import re
18
20
  import requests
19
21
  import os
22
+ import secrets
20
23
  import threading
21
24
  import time
22
25
  import traceback
@@ -32,6 +35,18 @@ ServerAddress = Tuple[str, int]
32
35
  # wedge the forwarder daemon thread indefinitely.
33
36
  FORWARDING_POST_TIMEOUT_SECONDS = 30
34
37
 
38
+ # The concentrator listens on the loopback interface unless the caller asks for another address.
39
+ DEFAULT_SERVER_ADDRESS: ServerAddress = ("127.0.0.1", 0)
40
+
41
+ # A concentrator bound to a non-loopback address generates a random access token for the run. Every
42
+ # progress POST must carry it in this header (401 without it). The token is published to child
43
+ # processes through the environment variable below.
44
+ PROGRESS_TOKEN_HEADER = "X-CCAI-Progress-Token"
45
+ PROGRESS_TOKEN_ENVIRONMENT_VARIABLE = "CCAI_PROGRESS_TOKEN"
46
+
47
+ # The largest progress postback body that is read; a progress record is a small JSON document.
48
+ MAX_PROGRESS_CONTENT_LENGTH = 1024 * 1024
49
+
35
50
  from ccai.xmodules.xlogging.enhancedloggers import getEnhancedLogger
36
51
 
37
52
  from ccai.testbase.results.model.forwardinginfo import ForwardingInfo
@@ -93,9 +108,17 @@ class ProgressCallbackHandler(SimpleHTTPRequestHandler):
93
108
  Multiple workers can submit progress updates simultaneously, with each request
94
109
  being processed in a separate thread.
95
110
 
111
+ Only the progress POST endpoint is served. GET and HEAD are answered with
112
+ 405 so nothing from the working directory of the process is ever served.
113
+
96
114
  Response Codes:
97
115
  - 200 OK: Progress update was successfully processed or no content was provided
98
- - 500 Internal Server Error: An exception occurred during processing
116
+ - 400 Bad Request: The Content-Length header is not a non-negative integer
117
+ - 401 Unauthorized: The server requires an access token and the request does not carry it
118
+ - 405 Method Not Allowed: A GET or HEAD request
119
+ - 413 Payload Too Large: The Content-Length is above ``MAX_PROGRESS_CONTENT_LENGTH``
120
+ - 500 Internal Server Error: An exception occurred during processing; the traceback
121
+ is logged by the server and only the exception type and message are returned
99
122
 
100
123
  Expected JSON Payload Format::
101
124
 
@@ -113,6 +136,41 @@ class ProgressCallbackHandler(SimpleHTTPRequestHandler):
113
136
  }
114
137
  """
115
138
 
139
+ def do_GET(self):
140
+ """
141
+ Refuses GET requests; the handler serves only the progress POST endpoint
142
+ and never the files of the working directory.
143
+ """
144
+ self._send_plain_response(405, "Only POST progress updates are accepted.", allow="POST")
145
+ return
146
+
147
+ def do_HEAD(self):
148
+ """
149
+ Refuses HEAD requests; the handler serves only the progress POST endpoint.
150
+ """
151
+ self._send_plain_response(405, "Only POST progress updates are accepted.", allow="POST", include_body=False)
152
+ return
153
+
154
+ def _send_plain_response(self, code: int, text: str, allow: Optional[str] = None, include_body: bool = True):
155
+ """
156
+ Sends a complete response with a short plain text body.
157
+
158
+ :param code: The HTTP status code.
159
+ :param text: The body text.
160
+ :param allow: An optional value for the 'Allow' header.
161
+ :param include_body: False to send only the headers (HEAD requests).
162
+ """
163
+ body_bytes = text.encode('utf-8')
164
+ self.send_response(code)
165
+ self.send_header("Content-Type", "text/plain")
166
+ self.send_header("Content-Length", str(len(body_bytes)))
167
+ if allow is not None:
168
+ self.send_header("Allow", allow)
169
+ self.end_headers()
170
+ if include_body:
171
+ self.wfile.write(body_bytes)
172
+ return
173
+
116
174
  def do_POST(self):
117
175
  """
118
176
  Handles incoming HTTP POST requests containing progress update data.
@@ -141,14 +199,38 @@ class ProgressCallbackHandler(SimpleHTTPRequestHandler):
141
199
  # before deciding on the response code. If errmsg remains None, processing succeeded.
142
200
  errmsg = None
143
201
 
202
+ # AUTHENTICATION: a concentrator bound to a non-loopback address requires the per-run
203
+ # access token before anything is read from the request.
204
+ server: ProgressConcentratorServer = self.server
205
+ access_token = getattr(server, "access_token", None)
206
+ if access_token is not None:
207
+ presented_token = self.headers.get(PROGRESS_TOKEN_HEADER, "")
208
+ if not hmac.compare_digest(presented_token.encode('utf-8'), access_token.encode('utf-8')):
209
+ self.close_connection = True
210
+ self._send_plain_response(401, "A valid %s header is required." % PROGRESS_TOKEN_HEADER)
211
+ return
212
+
144
213
  # Only process requests that have a content-length header.
145
214
  # Requests without content-length are treated as no-ops and return 200 OK.
146
215
  # This handles edge cases like health checks or empty POST requests gracefully.
147
216
  if 'content-length' in self.headers:
148
217
 
149
- content_length = self.headers["content-length"]
218
+ content_length = self.headers["content-length"].strip()
219
+
220
+ # Validate the length before reading: a value that is not a non-negative integer, or
221
+ # one above the cap, is refused without reading the body.
222
+ if content_length and re.fullmatch(r"[0-9]+", content_length) is None:
223
+ self.close_connection = True
224
+ self._send_plain_response(400, "Invalid Content-Length header.")
225
+ return
226
+
150
227
  length = int(content_length) if content_length else 0
151
228
 
229
+ if length > MAX_PROGRESS_CONTENT_LENGTH:
230
+ self.close_connection = True
231
+ self._send_plain_response(413, "The progress postback is larger than %d bytes." % MAX_PROGRESS_CONTENT_LENGTH)
232
+ return
233
+
152
234
  if length:
153
235
  # ERROR HANDLING: Wrap all processing in try/except to ensure server stability.
154
236
  # Any exception during JSON parsing, ProgressInfo creation, or progress update
@@ -170,13 +252,16 @@ class ProgressCallbackHandler(SimpleHTTPRequestHandler):
170
252
  server.update_task_progress(progress)
171
253
 
172
254
  except Exception as perr:
173
- # ERROR HANDLING: Capture full exception context for debugging.
174
- # Include a human-readable prefix and the complete traceback
175
- # to help diagnose issues with malformed progress payloads.
255
+ # ERROR HANDLING: Log the full traceback locally for debugging and return
256
+ # only the exception type and message to the sender, never the traceback
257
+ # with the source paths of this process.
258
+ getEnhancedLogger().error("Error processing progress postback.%s%s" % (
259
+ os.linesep, traceback.format_exc()))
260
+
176
261
  errmsg_msg_lines = [
177
262
  "Error processing progress postback.",
178
263
  "EXCEPTION:",
179
- traceback.format_exc()
264
+ "%s: %s" % (type(perr).__name__, perr)
180
265
  ]
181
266
  errmsg = os.linesep.join(errmsg_msg_lines)
182
267
 
@@ -247,20 +332,31 @@ class ProgressConcentratorServer(ThreadingMixIn, HTTPServer):
247
332
  forwarding_headers={"Authorization": "Bearer token123"}
248
333
  )
249
334
 
250
- # Create and start concentrator
335
+ # Create and start concentrator (loopback; omit server_address for an ephemeral port)
251
336
  server = ProgressConcentratorServer(
252
337
  recorder=result_recorder,
253
- server_address=("0.0.0.0", 8080),
338
+ server_address=("127.0.0.1", 8080),
254
339
  forwarding_info=forwarding_info
255
340
  )
256
341
  server.start()
342
+
343
+ ...
344
+
345
+ server.stop()
346
+
347
+ Remote Workers:
348
+ The server listens on the loopback interface by default. When it is bound to a
349
+ non-loopback address (for example ("0.0.0.0", 8080)) it generates a random access
350
+ token for the run, publishes it in the ``CCAI_PROGRESS_TOKEN`` environment variable
351
+ so the child processes it starts inherit it, and answers 401 to any progress POST
352
+ that does not carry it in the ``X-CCAI-Progress-Token`` header.
257
353
  """
258
354
 
259
355
  # Increase the listen backlog to handle high concurrency and prevent 'Connection reset by peer'
260
356
  request_queue_size = 128
261
357
 
262
358
 
263
- def __init__(self, recorder: ResultRecorder, server_address: ServerAddress, forwarding_info: Optional[ForwardingInfo] = None,
359
+ def __init__(self, recorder: ResultRecorder, server_address: Optional[ServerAddress] = None, forwarding_info: Optional[ForwardingInfo] = None,
264
360
  bind_and_activate: bool = True) -> None:
265
361
  """
266
362
  Initializes a new ProgressConcentratorServer instance.
@@ -269,8 +365,10 @@ class ProgressConcentratorServer(ThreadingMixIn, HTTPServer):
269
365
  All progress updates received by this server will be forwarded
270
366
  to this recorder's post_task_progress method.
271
367
  :param server_address: A tuple of (host, port) specifying the address to bind to.
272
- Use "0.0.0.0" to listen on all interfaces or "127.0.0.1"
273
- for loopback only.
368
+ Defaults to ("127.0.0.1", 0), the loopback interface on an
369
+ ephemeral port. A non-loopback address such as "0.0.0.0"
370
+ makes the server require a per-run access token on every
371
+ progress POST (see :attr:`access_token`).
274
372
  :param forwarding_info: Optional :class:`ForwardingInfo` configuration for periodic
275
373
  summary forwarding. If provided, a forwarding thread will
276
374
  be started when start() is called.
@@ -283,10 +381,24 @@ class ProgressConcentratorServer(ThreadingMixIn, HTTPServer):
283
381
  self._recorder = recorder
284
382
  self._forwarding_info = forwarding_info
285
383
 
384
+ if server_address is None:
385
+ server_address = DEFAULT_SERVER_ADDRESS
386
+
387
+ # A non-loopback bind is reachable from other hosts, so progress postbacks must carry
388
+ # a per-run random token. It is published through the environment for child processes.
389
+ self._access_token = None
390
+ if not is_loopback_host(server_address[0]):
391
+ self._access_token = secrets.token_urlsafe(32)
392
+
286
393
  super().__init__(server_address, ProgressCallbackHandler, bind_and_activate)
287
394
 
395
+ if self._access_token is not None:
396
+ os.environ[PROGRESS_TOKEN_ENVIRONMENT_VARIABLE] = self._access_token
397
+
288
398
  self._forward_thread = None
289
399
  self._forwarding_running = False
400
+ self._forwarding_wake = threading.Event()
401
+ self._forward_on_exit = False
290
402
 
291
403
  self._server_thread = None
292
404
  self._server_running = False
@@ -295,6 +407,60 @@ class ProgressConcentratorServer(ThreadingMixIn, HTTPServer):
295
407
 
296
408
  return
297
409
 
410
+ @property
411
+ def access_token(self) -> Optional[str]:
412
+ """
413
+ The per-run access token that progress POST requests must carry in the
414
+ ``X-CCAI-Progress-Token`` header, or None when the server is bound to a
415
+ loopback address and no token is required.
416
+ """
417
+ return self._access_token
418
+
419
+ def stop(self, timeout: Optional[float] = None):
420
+ """
421
+ Stops the server: ends the summary forwarding thread after one final forward of
422
+ the summary, stops serving requests and closes the listening socket.
423
+
424
+ :param timeout: The maximum number of seconds to wait for each thread to end;
425
+ None waits until it has ended.
426
+
427
+ :returns: None
428
+ """
429
+
430
+ if self._forward_thread is not None:
431
+ # Wake the forwarding thread from its interval wait so it performs the final
432
+ # forward and exits.
433
+ self._forward_on_exit = True
434
+ self._forwarding_running = False
435
+ self._forwarding_wake.set()
436
+ self._forward_thread.join(timeout)
437
+ self._forward_thread = None
438
+
439
+ if self._server_thread is not None:
440
+ self.shutdown()
441
+ self._server_thread.join(timeout)
442
+ self._server_thread = None
443
+
444
+ self._server_running = False
445
+
446
+ self.server_close()
447
+
448
+ return
449
+
450
+ def server_close(self):
451
+ """
452
+ Closes the listening socket and withdraws the access token of this server from
453
+ the process environment.
454
+
455
+ :returns: None
456
+ """
457
+ super().server_close()
458
+
459
+ if self._access_token is not None and os.environ.get(PROGRESS_TOKEN_ENVIRONMENT_VARIABLE) == self._access_token:
460
+ del os.environ[PROGRESS_TOKEN_ENVIRONMENT_VARIABLE]
461
+
462
+ return
463
+
298
464
  def start(self):
299
465
  """
300
466
  Starts the server and optional forwarding threads.
@@ -416,7 +582,12 @@ class ProgressConcentratorServer(ThreadingMixIn, HTTPServer):
416
582
  # FORWARDING LOOP:
417
583
  # Continuously forward summaries to the external service at the configured interval.
418
584
  # The loop runs until _forwarding_running is set to False (e.g., during shutdown).
419
- while self._forwarding_running:
585
+ # When stop() ends the loop, one final pass forwards the completed summary.
586
+ while True:
587
+
588
+ final_pass = not self._forwarding_running
589
+ if final_pass and not self._forward_on_exit:
590
+ break
420
591
 
421
592
  # ERROR HANDLING - RESILIENT LOOP:
422
593
  # Wrap the entire loop iteration in try/except to ensure the forwarding
@@ -434,7 +605,12 @@ class ProgressConcentratorServer(ThreadingMixIn, HTTPServer):
434
605
  # Serialize the summary to JSON using our custom encoder that handles
435
606
  # datetime objects, then POST to the configured monitoring endpoint.
436
607
  summary_json = json.dumps(summary, cls=SummaryJsonEncoder)
437
- requests.post(forwarding_url, data=summary_json, headers=headers, timeout=FORWARDING_POST_TIMEOUT_SECONDS)
608
+ response = requests.post(forwarding_url, data=summary_json, headers=headers, timeout=FORWARDING_POST_TIMEOUT_SECONDS)
609
+
610
+ # An HTTP error answer (for example 401 for an expired token) is a failed forward.
611
+ status_code = getattr(response, "status_code", None)
612
+ if isinstance(status_code, int) and status_code >= 400:
613
+ self._logger.warning(f"Forwarding progress to {forwarding_url} failed with HTTP status {status_code}.")
438
614
 
439
615
  except (requests.exceptions.ConnectionError, requests.exceptions.RetryError) as err:
440
616
  # ERROR HANDLING - LOG AND CONTINUE:
@@ -455,7 +631,10 @@ class ProgressConcentratorServer(ThreadingMixIn, HTTPServer):
455
631
  # Wait for the configured interval before the next forward.
456
632
  # This controls the frequency of summary updates to external services.
457
633
  if self._forwarding_running:
458
- time.sleep(forwarding_interval)
634
+ self._forwarding_wake.wait(forwarding_interval)
635
+
636
+ if final_pass:
637
+ break
459
638
 
460
639
  return
461
640
 
@@ -524,3 +703,21 @@ class ProgressConcentratorServer(ThreadingMixIn, HTTPServer):
524
703
  return
525
704
 
526
705
 
706
+ def is_loopback_host(host: str) -> bool:
707
+ """
708
+ Determines if a bind host names the loopback interface. An empty host (all
709
+ interfaces) and any host name other than 'localhost' are not loopback.
710
+
711
+ :param host: The host part of a server address.
712
+
713
+ :returns: True if the host is 'localhost', '::1' or an address in 127.0.0.0/8.
714
+ """
715
+ rtnval = False
716
+
717
+ host_lower = host.strip().lower()
718
+ if host_lower in ("localhost", "::1"):
719
+ rtnval = True
720
+ elif re.fullmatch(r"127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}", host_lower) is not None:
721
+ rtnval = True
722
+
723
+ return rtnval
@@ -44,6 +44,10 @@ from ccai.testbase.results.model.streaminginfo import (
44
44
  # result-streamer daemon thread indefinitely.
45
45
  STREAMING_POST_TIMEOUT_SECONDS = 30
46
46
 
47
+ # When 'reconnect_on_failure' is set, a result whose send fails is retried this many times, each
48
+ # retry after a reconnect, before it is counted as lost.
49
+ SEND_RETRY_LIMIT = 1
50
+
47
51
 
48
52
  class StreamingJsonEncoder(json.JSONEncoder):
49
53
  """
@@ -97,6 +101,7 @@ class ResultStreamer(ABC):
97
101
  self._streaming_thread: Optional[threading.Thread] = None
98
102
  self._running = False
99
103
  self._connected = False
104
+ self._drain_requested = False
100
105
 
101
106
  self._lock = threading.Lock()
102
107
  self._stats = {
@@ -147,13 +152,25 @@ class ResultStreamer(ABC):
147
152
  while not self._connected and time.time() - start_time < 5.0:
148
153
  time.sleep(0.05)
149
154
 
150
- def stop(self):
155
+ def stop(self, *, drain_timeout: float = 0):
151
156
  """
152
157
  Stops the streaming thread.
153
158
 
154
159
  This method signals the streaming thread to stop and waits for
155
- it to complete. Any remaining queued results are discarded.
156
- """
160
+ it to complete. With the default ``drain_timeout`` of 0, any remaining
161
+ queued results are discarded.
162
+
163
+ :param drain_timeout: The number of seconds to keep sending the results that
164
+ are still queued (and to flush a partially filled batch)
165
+ before stopping. Results still queued when it expires
166
+ are discarded. The default of 0 stops without draining.
167
+ """
168
+ if drain_timeout > 0 and self._streaming_thread is not None:
169
+ # Let the thread work through the queue up to the sentinel, flush the batch and exit.
170
+ self._drain_requested = True
171
+ self._result_queue.put(None)
172
+ self._streaming_thread.join(timeout=drain_timeout)
173
+
157
174
  self._running = False
158
175
 
159
176
  # Put a sentinel value to wake up the thread
@@ -162,6 +179,8 @@ class ResultStreamer(ABC):
162
179
  if self._streaming_thread is not None:
163
180
  self._streaming_thread.join(timeout=5.0)
164
181
  self._streaming_thread = None
182
+
183
+ self._drain_requested = False
165
184
 
166
185
  self._disconnect()
167
186
 
@@ -216,7 +235,7 @@ class ResultStreamer(ABC):
216
235
  self._send_batch(batch)
217
236
  batch = []
218
237
 
219
- if not self._running:
238
+ if not self._running or self._drain_requested:
220
239
  break
221
240
  continue
222
241
 
@@ -263,8 +282,9 @@ class ResultStreamer(ABC):
263
282
  if not success:
264
283
  continue
265
284
 
266
- # Send via protocol-specific implementation
267
- self._send_result(result_dict, is_preview)
285
+ # Send via protocol-specific implementation, reconnecting and retrying on a
286
+ # send failure when 'reconnect_on_failure' is configured.
287
+ self._send_result_with_reconnect(result_dict, is_preview)
268
288
 
269
289
  # Update stats
270
290
  with self._lock:
@@ -282,6 +302,39 @@ class ResultStreamer(ABC):
282
302
 
283
303
  self._logger.error(f"Error sending result: {traceback.format_exc()}")
284
304
 
305
+ def _send_result_with_reconnect(self, result_dict: dict, is_preview: bool):
306
+ """
307
+ Sends a single result through :meth:`_send_result`. When the streaming
308
+ configuration sets 'reconnect_on_failure', a failed send is counted and
309
+ logged, the connection is re-established and the send is retried, up to
310
+ ``SEND_RETRY_LIMIT`` times. The failure of the last attempt is raised.
311
+
312
+ :param result_dict: The result dictionary to send.
313
+ :param is_preview: True if this is a preview, False for final result.
314
+ """
315
+ retries_left = 0
316
+ if self._streaming_info.reconnect_on_failure:
317
+ retries_left = SEND_RETRY_LIMIT
318
+
319
+ while True:
320
+ try:
321
+ self._send_result(result_dict, is_preview)
322
+ break
323
+ except Exception:
324
+ if retries_left <= 0:
325
+ raise
326
+
327
+ retries_left -= 1
328
+
329
+ with self._lock:
330
+ self._stats["errors"] += 1
331
+
332
+ self._logger.warning(f"Error sending result, reconnecting to retry: {traceback.format_exc()}")
333
+
334
+ self._reconnect()
335
+
336
+ return
337
+
285
338
  def _reconnect(self):
286
339
  """
287
340
  Attempts to reconnect to the external service.