codecraftai-taskplus 1.3.0__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 (26) hide show
  1. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/LICENSE.md +30 -21
  2. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/PKG-INFO +5 -5
  3. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/pyproject.toml +6 -28
  4. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/execution.py +22 -2
  5. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/model/flowengine.py +30 -2
  6. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/tasks/createenvironment.py +17 -3
  7. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/tasks/embeddedpython.py +15 -3
  8. codecraftai_taskplus-1.4.0/source/packages/ccai/taskplus/tasks/outputtext.py +27 -0
  9. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/tasks/runcommand.py +3 -2
  10. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/tasks/shellscript.py +22 -7
  11. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/README.md +0 -0
  12. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/__init__.py +0 -0
  13. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/cli/__init__.py +0 -0
  14. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/cli/cmdtree/__init__.py +0 -0
  15. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/cli/cmdtree/workflow.py +0 -0
  16. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/cli/taskpluscommand.py +0 -0
  17. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/entrypoints.py +0 -0
  18. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/initialize.py +0 -0
  19. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/model/__init__.py +0 -0
  20. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/model/flownode.py +0 -0
  21. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/model/task.py +0 -0
  22. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/model/taskgroup.py +0 -0
  23. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/model/workflow.py +0 -0
  24. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/py.typed +0 -0
  25. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/tasks/__init__.py +0 -0
  26. {codecraftai_taskplus-1.3.0 → codecraftai_taskplus-1.4.0}/source/packages/ccai/taskplus/tasks/gitcheckout.py +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-taskplus
3
- Version: 1.3.0
3
+ Version: 1.4.0
4
4
  Summary: Code Craft AI Task Plus Library
5
5
  License-Expression: LicenseRef-CodeCraftAI-Source-Available
6
6
  License-File: LICENSE.md
@@ -11,10 +11,10 @@ Requires-Python: >=3.10,<4.0
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Operating System :: POSIX
13
13
  Requires-Dist: click (>=8.1.3,<9.0.0)
14
- Requires-Dist: codecraftai-foundations (<2.0.0)
15
- Requires-Dist: codecraftai-runtime (<2.0.0)
16
- Requires-Dist: codecraftai-this-app (<2.0.0)
17
- Requires-Dist: codecraftai-xmodules (<2.0.0)
14
+ Requires-Dist: codecraftai-foundations (>=1.0.0,<2.0.0)
15
+ Requires-Dist: codecraftai-runtime (>=1.0.0,<2.0.0)
16
+ Requires-Dist: codecraftai-this-app (>=1.0.0,<2.0.0)
17
+ Requires-Dist: codecraftai-xmodules (>=1.0.0,<2.0.0)
18
18
  Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
19
19
  Project-URL: Homepage, https://code-craft.ai
20
20
  Project-URL: Repository, https://github.com/code-craft-ai-company/codecraftai-taskplus
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "codecraftai-taskplus"
3
- version = "1.3.0"
3
+ version = "1.4.0"
4
4
  description = "Code Craft AI Task Plus Library"
5
5
  readme = "README.md"
6
6
  license = "LicenseRef-CodeCraftAI-Source-Available"
@@ -15,10 +15,10 @@ classifiers = [
15
15
  requires-python = ">=3.10,<4.0"
16
16
  dependencies = [
17
17
  "click>=8.1.3,<9.0.0",
18
- "codecraftai-foundations<2.0.0",
19
- "codecraftai-runtime<2.0.0",
20
- "codecraftai-this-app<2.0.0",
21
- "codecraftai-xmodules<2.0.0",
18
+ "codecraftai-foundations>=1.0.0,<2.0.0",
19
+ "codecraftai-runtime>=1.0.0,<2.0.0",
20
+ "codecraftai-this-app>=1.0.0,<2.0.0",
21
+ "codecraftai-xmodules>=1.0.0,<2.0.0",
22
22
  "pyyaml>=6.0.2,<7.0.0",
23
23
  ]
24
24
 
@@ -31,7 +31,7 @@ Repository = "https://github.com/code-craft-ai-company/codecraftai-taskplus"
31
31
 
32
32
  [dependency-groups]
33
33
  dev = [
34
- "codecraftai-testbase<2.0.0",
34
+ "codecraftai-testbase>=1.0.0,<2.0.0",
35
35
  "myst-parser>=0.18.1,<0.19.0",
36
36
  "sphinx>=1.6,<6",
37
37
  "sphinx-rtd-theme>=1.1.1,<2.0.0",
@@ -40,28 +40,6 @@ dev = [
40
40
  [tool.poetry]
41
41
  packages = [{include="ccai", from="source/packages"}]
42
42
 
43
- [tool.poetry.dependencies]
44
- codecraftai-foundations = {source = "codecraftai"}
45
- codecraftai-runtime = {source = "codecraftai"}
46
- codecraftai-this-app = {source = "codecraftai"}
47
- codecraftai-xmodules = {source = "codecraftai"}
48
-
49
- [tool.poetry.group.dev.dependencies]
50
- codecraftai-testbase = {source = "codecraftai"}
51
-
52
- [[tool.poetry.source]]
53
- name = "codecraftai"
54
- url = "https://code-craft.ai/licensed-repository/simple/"
55
- priority = "supplemental"
56
-
57
- [[tool.uv.index]]
58
- # Same licensed index as [[tool.poetry.source]]. Listed before PyPI so that
59
- # codecraftai-* packages (direct and transitive) resolve from it; everything
60
- # else falls through to PyPI. Credentials: UV_INDEX_CODECRAFTAI_USERNAME /
61
- # UV_INDEX_CODECRAFTAI_PASSWORD, or `uv auth login`.
62
- name = "codecraftai"
63
- url = "https://code-craft.ai/licensed-repository/simple/"
64
-
65
43
  [tool.ruff.lint]
66
44
  # Deliberately narrow. This gate exists for one reason: a bare `except:`
67
45
  # swallows ConfigurationError and SemanticError, which derive from
@@ -5,6 +5,11 @@
5
5
  of an individual workpacket.
6
6
 
7
7
  .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
8
+
9
+ .. deprecated::
10
+ This legacy function-based execution module is kept for compatibility and will be removed in
11
+ the next major version. Use :class:`ccai.taskplus.model.workflow.Workflow` and
12
+ :class:`ccai.taskplus.model.flowengine.FlowEngine` instead.
8
13
  """
9
14
 
10
15
  __author__ = "Myron Walker"
@@ -15,6 +20,7 @@ __credits__ = []
15
20
  from typing import Any, Dict, List
16
21
 
17
22
  import os
23
+ import warnings
18
24
 
19
25
  from ccai.xmodules.ximport import import_by_name
20
26
 
@@ -23,6 +29,12 @@ from ccai.errors.exceptions import ConfigurationError
23
29
  from ccai.taskplus.model.task import Task
24
30
 
25
31
 
32
+ DEPRECATION_MESSAGE = (
33
+ "ccai.taskplus.execution is deprecated and will be removed in the next major version; "
34
+ "use ccai.taskplus.model.workflow.Workflow and ccai.taskplus.model.flowengine.FlowEngine instead."
35
+ )
36
+
37
+
26
38
  class JumpContext:
27
39
  def __init__(self) -> None:
28
40
  self.on_failure_section = None
@@ -31,6 +43,8 @@ class JumpContext:
31
43
 
32
44
  def execute_tasklist(logger, jump_context: JumpContext, parameters: dict, tasklist: List[Dict[str, Any]], ordinal_prefix: str=None, **kwargs):
33
45
 
46
+ warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning, stacklevel=2)
47
+
34
48
  result_code = 0
35
49
 
36
50
  for index, item in enumerate(tasklist):
@@ -104,7 +118,7 @@ def execute_tasklist(logger, jump_context: JumpContext, parameters: dict, taskli
104
118
  tg_onfailure = tg_info.get("onfailure", None)
105
119
  tg_onsuccess = tg_info.get("onsuccess", None)
106
120
 
107
- tg_result = execute_tasklist(logger, jump_context, parameters, tg_items, ordinal_prefix=group_prefix)
121
+ tg_result = execute_tasklist(logger, jump_context, parameters, tg_items, ordinal_prefix=group_prefix, **kwargs)
108
122
  if tg_result != 0:
109
123
  result_code = 1
110
124
  if tg_onfailure is not None:
@@ -120,6 +134,8 @@ def execute_tasklist(logger, jump_context: JumpContext, parameters: dict, taskli
120
134
 
121
135
  def execute_workflow(logger, *, environment: dict, parameters: dict, workflow: list, **kwargs):
122
136
 
137
+ warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning, stacklevel=2)
138
+
123
139
  # Publish the environment variables so they will take effect in the current
124
140
  # process and any sub-processes lauched from this process
125
141
  for key, val in environment.items():
@@ -127,6 +143,10 @@ def execute_workflow(logger, *, environment: dict, parameters: dict, workflow: l
127
143
 
128
144
  jump_context = JumpContext()
129
145
 
130
- result_code = execute_tasklist(logger, jump_context, parameters, workflow)
146
+ # Task.execute requires the environment and the per-run flow state, so pass them to every task,
147
+ # including the tasks inside task groups.
148
+ flowstate = kwargs.pop("flowstate", {})
149
+ result_code = execute_tasklist(logger, jump_context, parameters, workflow, environment=environment,
150
+ flowstate=flowstate, **kwargs)
131
151
 
132
152
  return result_code
@@ -6,6 +6,10 @@ __credits__ = []
6
6
 
7
7
  from typing import Any, Dict, List
8
8
 
9
+ import os
10
+
11
+ from ccai.errors.exceptions import ConfigurationError
12
+
9
13
  from ccai.taskplus.model.flownode import FlowNode
10
14
  from ccai.taskplus.model.task import Task
11
15
  from ccai.taskplus.model.taskgroup import TaskGroup
@@ -31,7 +35,17 @@ class FlowEngine:
31
35
  # (plus ``environment``/``parameters``) so conditional flow can reference
32
36
  # accumulated state. (Previously this read the always-empty instance
33
37
  # ``self._flowstate`` and was passed no per-run state at all.)
34
- eval_result = eval(if_expr)
38
+
39
+ # YAML loads 'if: true' or 'if: 1' as a bool or a number rather than as
40
+ # expression text, so a literal value is taken for its truth value.
41
+ if isinstance(if_expr, (bool, int, float)):
42
+ eval_result = bool(if_expr)
43
+ elif isinstance(if_expr, str):
44
+ eval_result = eval(if_expr)
45
+ else:
46
+ errmsg = "An 'if' condition must be an expression string, a boolean or a number, got {} {!r}.".format(
47
+ type(if_expr).__name__, if_expr)
48
+ raise ConfigurationError(errmsg)
35
49
 
36
50
  return eval_result
37
51
 
@@ -49,7 +63,21 @@ class FlowEngine:
49
63
  errors = []
50
64
  jump_context = JumpContext()
51
65
 
52
- self.process_flowitems(environment, parameters, flowstate, errors, flowitems, jump_context)
66
+ # Publish the workflow 'environment' section so it takes effect in this process and in every
67
+ # sub-process the tasks launch, then restore the previous values once the flow has run.
68
+ previous_environment = {}
69
+ for env_name, env_value in environment.items():
70
+ previous_environment[env_name] = os.environ.get(env_name, None)
71
+ os.environ[env_name] = str(env_value)
72
+
73
+ try:
74
+ self.process_flowitems(environment, parameters, flowstate, errors, flowitems, jump_context)
75
+ finally:
76
+ for env_name, prev_value in previous_environment.items():
77
+ if prev_value is None:
78
+ os.environ.pop(env_name, None)
79
+ else:
80
+ os.environ[env_name] = prev_value
53
81
 
54
82
  if len(errors) > 0:
55
83
  result_code = 1
@@ -18,6 +18,7 @@ import os
18
18
  import subprocess
19
19
 
20
20
  from ccai.taskplus.model.task import Task
21
+ from ccai.taskplus.tasks.outputtext import decode_output_text
21
22
 
22
23
  class CreateEnvironment(Task):
23
24
  """
@@ -70,10 +71,23 @@ class CreateEnvironment(Task):
70
71
  exit_code = proc.wait()
71
72
 
72
73
  if exit_code == 0:
73
- var_val = stdout.decode().strip()
74
- os.environ[var_name] = var_val
74
+ try:
75
+ var_val = stdout.decode().strip()
76
+ os.environ[var_name] = var_val
77
+ except UnicodeDecodeError as decode_err:
78
+ # A value that does not decode cleanly is not set; it is reported as a failed
79
+ # variable like a failing command, rather than aborting the whole workflow.
80
+ errmsg_lines = [
81
+ "Error creating environment variable '{}': the output is not valid UTF-8 ({}).".format(
82
+ var_name, decode_err),
83
+ "COMMAND: {}".format(var_command),
84
+ "STDOUT: {}".format(decode_output_text(stdout))
85
+ ]
86
+ errmsg = os.linesep.join(errmsg_lines)
87
+ self._logger.error(errmsg)
88
+ status_code = 1
75
89
  else:
76
- stderr_text = stderr.decode()
90
+ stderr_text = decode_output_text(stderr)
77
91
  errmsg_lines = [
78
92
  "Error creating environment variable '{}' with:".format(var_name),
79
93
  "COMMAND: {}".format(var_command),
@@ -39,11 +39,23 @@ class EmbeddedPython(Task):
39
39
 
40
40
  exit_status = 0
41
41
 
42
+ # Execute the inline python script in a single namespace that holds the module globals
43
+ # and the task arguments. Separate globals and locals dictionaries would run the script
44
+ # like a class body, so functions defined by the script could not see its own imports
45
+ # and variables.
46
+ script_namespace = dict(globals())
47
+ script_namespace["self"] = self
48
+ script_namespace["environment"] = environment
49
+ script_namespace["parameters"] = parameters
50
+ script_namespace["flowstate"] = flowstate
51
+
42
52
  try:
43
- # Execute the inline python script in the context of the current
44
- # globals and locals.
45
- exec(script_content, globals(), locals())
53
+ script_code = compile(script_content, "<embedded-python %s>" % self._label, "exec")
54
+ exec(script_code, script_namespace)
46
55
  except Exception:
56
+ # The task reports a failing script through its exit status; log the traceback so
57
+ # the cause of the failure is visible in the task log.
58
+ self._logger.exception("The embedded python script of task %r (%s) failed." % (self._label, self._ordinal))
47
59
  exit_status = 1
48
60
 
49
61
  return exit_status
@@ -0,0 +1,27 @@
1
+ """
2
+ .. module:: outputtext
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: A module that provides the helper used by the command based tasks to turn
5
+ the captured output of a sub-process into text for the task log.
6
+
7
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
8
+ """
9
+
10
+ __author__ = "Myron Walker"
11
+ __copyright__ = "Copyright 2025, Code Craft AI LLC"
12
+ __credits__ = []
13
+
14
+
15
+ def decode_output_text(output: bytes) -> str:
16
+ """
17
+ Decodes the captured output of a sub-process for logging. Bytes that are not
18
+ valid UTF-8 (binary output, file names or localized messages in another code
19
+ page) are replaced rather than raising, so the exit status of the command is
20
+ still reported.
21
+
22
+ :param output: The bytes captured from the stdout or stderr of a sub-process.
23
+
24
+ :returns: The decoded text.
25
+ """
26
+ rtnval = output.decode("utf-8", errors="replace")
27
+ return rtnval
@@ -20,6 +20,7 @@ import subprocess
20
20
  from ccai.xmodules.xformatting import indent_lines
21
21
 
22
22
  from ccai.taskplus.model.task import Task
23
+ from ccai.taskplus.tasks.outputtext import decode_output_text
23
24
 
24
25
  class RunCommand(Task):
25
26
  """
@@ -48,8 +49,8 @@ class RunCommand(Task):
48
49
  stdout, stderr = proc.communicate()
49
50
  exit_code = proc.wait()
50
51
 
51
- stdout = stdout.decode()
52
- stderr = stderr.decode()
52
+ stdout = decode_output_text(stdout)
53
+ stderr = decode_output_text(stderr)
53
54
 
54
55
  log_msg_lines = [
55
56
  "RESULT CODE: %d" % exit_code,
@@ -16,6 +16,7 @@ __credits__ = []
16
16
  from typing import Any, Dict, Optional
17
17
 
18
18
  import os
19
+ import shlex
19
20
  import stat
20
21
  import subprocess
21
22
 
@@ -23,6 +24,7 @@ from ccai.thisapp.paths import get_temporary_file
23
24
  from ccai.xmodules.xformatting import indent_lines
24
25
 
25
26
  from ccai.taskplus.model.task import Task
27
+ from ccai.taskplus.tasks.outputtext import decode_output_text
26
28
 
27
29
  class ShellScript(Task):
28
30
  """
@@ -43,7 +45,11 @@ class ShellScript(Task):
43
45
 
44
46
  def perform_task(self, environment: Dict[str, str], parameters: Optional[Dict[str, Any]], flowstate: Dict[str, Any]) -> int:
45
47
 
46
- script_content = os.linesep.join(self._script)
48
+ # The 'script' entry is either a list of lines or a YAML block string that is used as-is.
49
+ if isinstance(self._script, str):
50
+ script_content = self._script
51
+ else:
52
+ script_content = os.linesep.join(self._script)
47
53
 
48
54
  # The platform shell only runs script files it recognizes, so the suffix has to match the shell.
49
55
  if os.name == "nt":
@@ -60,13 +66,22 @@ class ShellScript(Task):
60
66
 
61
67
  os.chmod(tempfile, stat.S_IREAD | stat.S_IWRITE | stat.S_IEXEC)
62
68
 
63
- # Hand the script path to the shell as a single string so it is not re-quoted on Windows.
64
- proc = subprocess.Popen(tempfile, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
65
- stdout, stderr = proc.communicate()
66
- exit_code = proc.wait()
69
+ # Hand the script path to the shell as a single string so it is not re-quoted on Windows, but
70
+ # quote it for that shell so an output directory with a space or other metacharacter still works.
71
+ if os.name == "nt":
72
+ script_command = subprocess.list2cmdline([tempfile])
73
+ else:
74
+ script_command = shlex.quote(tempfile)
75
+
76
+ try:
77
+ proc = subprocess.Popen(script_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
78
+ stdout, stderr = proc.communicate()
79
+ exit_code = proc.wait()
80
+ finally:
81
+ os.remove(tempfile)
67
82
 
68
- stdout_text = stdout.decode()
69
- stderr_text = stderr.decode()
83
+ stdout_text = decode_output_text(stdout)
84
+ stderr_text = decode_output_text(stderr)
70
85
 
71
86
  log_msg_script = [
72
87
  "RESULT CODE: %d" % exit_code,