intentkit 0.6.18__py3-none-any.whl → 0.6.19__py3-none-any.whl
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.
Potentially problematic release.
This version of intentkit might be problematic. Click here for more details.
- intentkit/__init__.py +1 -1
- intentkit/clients/cdp.py +11 -0
- intentkit/core/credit.py +258 -103
- intentkit/models/agent_schema.json +3 -4
- intentkit/models/chat.py +3 -4
- intentkit/models/credit.py +75 -4
- {intentkit-0.6.18.dist-info → intentkit-0.6.19.dist-info}/METADATA +1 -1
- {intentkit-0.6.18.dist-info → intentkit-0.6.19.dist-info}/RECORD +10 -10
- {intentkit-0.6.18.dist-info → intentkit-0.6.19.dist-info}/WHEEL +0 -0
- {intentkit-0.6.18.dist-info → intentkit-0.6.19.dist-info}/licenses/LICENSE +0 -0
intentkit/__init__.py
CHANGED
intentkit/clients/cdp.py
CHANGED
|
@@ -144,6 +144,17 @@ class CdpClient:
|
|
|
144
144
|
wallet_secret=wallet_secret,
|
|
145
145
|
)
|
|
146
146
|
self._wallet_provider = CdpEvmServerWalletProvider(self._wallet_provider_config)
|
|
147
|
+
# hack for cdp bug
|
|
148
|
+
if network_id == "base-mainnet":
|
|
149
|
+
self._wallet_provider._network.network_id = "base"
|
|
150
|
+
elif network_id == "arbitrum-mainnet":
|
|
151
|
+
self._wallet_provider._network.network_id = "arbitrum"
|
|
152
|
+
elif network_id == "optimism-mainnet":
|
|
153
|
+
self._wallet_provider._network.network_id = "optimism"
|
|
154
|
+
elif network_id == "polygon-mainnet":
|
|
155
|
+
self._wallet_provider._network.network_id = "polygon"
|
|
156
|
+
elif network_id == "ethereum-mainnet":
|
|
157
|
+
self._wallet_provider._network.network_id = "ethereum"
|
|
147
158
|
return self._wallet_provider
|
|
148
159
|
|
|
149
160
|
async def get_account(self) -> EvmServerAccount:
|
intentkit/core/credit.py
CHANGED
|
@@ -117,8 +117,9 @@ async def recharge(
|
|
|
117
117
|
session=session,
|
|
118
118
|
owner_type=OwnerType.USER,
|
|
119
119
|
owner_id=user_id,
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
amount_details={
|
|
121
|
+
CreditType.PERMANENT: amount
|
|
122
|
+
}, # Recharge adds to permanent credits
|
|
122
123
|
event_id=event_id,
|
|
123
124
|
)
|
|
124
125
|
|
|
@@ -149,6 +150,9 @@ async def recharge(
|
|
|
149
150
|
+ user_account.reward_credits,
|
|
150
151
|
base_amount=amount,
|
|
151
152
|
base_original_amount=amount,
|
|
153
|
+
base_free_amount=Decimal("0"), # No free credits involved in base amount
|
|
154
|
+
base_reward_amount=Decimal("0"), # No reward credits involved in base amount
|
|
155
|
+
base_permanent_amount=amount, # All base amount is permanent for recharge
|
|
152
156
|
permanent_amount=amount, # Set permanent_amount since this is a permanent credit
|
|
153
157
|
free_amount=Decimal("0"), # No free credits involved
|
|
154
158
|
reward_amount=Decimal("0"), # No reward credits involved
|
|
@@ -168,6 +172,9 @@ async def recharge(
|
|
|
168
172
|
credit_debit=CreditDebit.CREDIT,
|
|
169
173
|
change_amount=amount,
|
|
170
174
|
credit_type=CreditType.PERMANENT,
|
|
175
|
+
free_amount=Decimal("0"),
|
|
176
|
+
reward_amount=Decimal("0"),
|
|
177
|
+
permanent_amount=amount,
|
|
171
178
|
)
|
|
172
179
|
session.add(user_tx)
|
|
173
180
|
|
|
@@ -180,6 +187,9 @@ async def recharge(
|
|
|
180
187
|
credit_debit=CreditDebit.DEBIT,
|
|
181
188
|
change_amount=amount,
|
|
182
189
|
credit_type=CreditType.PERMANENT,
|
|
190
|
+
free_amount=Decimal("0"),
|
|
191
|
+
reward_amount=Decimal("0"),
|
|
192
|
+
permanent_amount=amount,
|
|
183
193
|
)
|
|
184
194
|
session.add(platform_tx)
|
|
185
195
|
|
|
@@ -239,8 +249,7 @@ async def reward(
|
|
|
239
249
|
session=session,
|
|
240
250
|
owner_type=OwnerType.USER,
|
|
241
251
|
owner_id=user_id,
|
|
242
|
-
|
|
243
|
-
credit_type=CreditType.REWARD, # Reward adds to reward credits
|
|
252
|
+
amount_details={CreditType.REWARD: amount}, # Reward adds to reward credits
|
|
244
253
|
event_id=event_id,
|
|
245
254
|
)
|
|
246
255
|
|
|
@@ -271,6 +280,11 @@ async def reward(
|
|
|
271
280
|
+ user_account.reward_credits,
|
|
272
281
|
base_amount=amount,
|
|
273
282
|
base_original_amount=amount,
|
|
283
|
+
base_free_amount=Decimal("0"), # No free credits involved in base amount
|
|
284
|
+
base_reward_amount=amount, # All base amount is reward for reward events
|
|
285
|
+
base_permanent_amount=Decimal(
|
|
286
|
+
"0"
|
|
287
|
+
), # No permanent credits involved in base amount
|
|
274
288
|
reward_amount=amount, # Set reward_amount since this is a reward credit
|
|
275
289
|
free_amount=Decimal("0"), # No free credits involved
|
|
276
290
|
permanent_amount=Decimal("0"), # No permanent credits involved
|
|
@@ -290,6 +304,9 @@ async def reward(
|
|
|
290
304
|
credit_debit=CreditDebit.CREDIT,
|
|
291
305
|
change_amount=amount,
|
|
292
306
|
credit_type=CreditType.REWARD,
|
|
307
|
+
free_amount=Decimal("0"),
|
|
308
|
+
reward_amount=amount,
|
|
309
|
+
permanent_amount=Decimal("0"),
|
|
293
310
|
)
|
|
294
311
|
session.add(user_tx)
|
|
295
312
|
|
|
@@ -302,6 +319,9 @@ async def reward(
|
|
|
302
319
|
credit_debit=CreditDebit.DEBIT,
|
|
303
320
|
change_amount=amount,
|
|
304
321
|
credit_type=CreditType.REWARD,
|
|
322
|
+
free_amount=Decimal("0"),
|
|
323
|
+
reward_amount=amount,
|
|
324
|
+
permanent_amount=Decimal("0"),
|
|
305
325
|
)
|
|
306
326
|
session.add(platform_tx)
|
|
307
327
|
|
|
@@ -375,8 +395,7 @@ async def adjustment(
|
|
|
375
395
|
session=session,
|
|
376
396
|
owner_type=OwnerType.USER,
|
|
377
397
|
owner_id=user_id,
|
|
378
|
-
|
|
379
|
-
credit_type=credit_type,
|
|
398
|
+
amount_details={credit_type: abs_amount},
|
|
380
399
|
event_id=event_id,
|
|
381
400
|
)
|
|
382
401
|
else:
|
|
@@ -407,8 +426,7 @@ async def adjustment(
|
|
|
407
426
|
session=session,
|
|
408
427
|
owner_type=OwnerType.PLATFORM,
|
|
409
428
|
owner_id=DEFAULT_PLATFORM_ACCOUNT_ADJUSTMENT,
|
|
410
|
-
|
|
411
|
-
credit_type=credit_type,
|
|
429
|
+
amount_details={credit_type: abs_amount},
|
|
412
430
|
event_id=event_id,
|
|
413
431
|
)
|
|
414
432
|
|
|
@@ -441,6 +459,9 @@ async def adjustment(
|
|
|
441
459
|
+ user_account.reward_credits,
|
|
442
460
|
base_amount=abs_amount,
|
|
443
461
|
base_original_amount=abs_amount,
|
|
462
|
+
base_free_amount=free_amount,
|
|
463
|
+
base_reward_amount=reward_amount,
|
|
464
|
+
base_permanent_amount=permanent_amount,
|
|
444
465
|
free_amount=free_amount,
|
|
445
466
|
reward_amount=reward_amount,
|
|
446
467
|
permanent_amount=permanent_amount,
|
|
@@ -460,6 +481,9 @@ async def adjustment(
|
|
|
460
481
|
credit_debit=credit_debit_user,
|
|
461
482
|
change_amount=abs_amount,
|
|
462
483
|
credit_type=credit_type,
|
|
484
|
+
free_amount=free_amount,
|
|
485
|
+
reward_amount=reward_amount,
|
|
486
|
+
permanent_amount=permanent_amount,
|
|
463
487
|
)
|
|
464
488
|
session.add(user_tx)
|
|
465
489
|
|
|
@@ -472,6 +496,9 @@ async def adjustment(
|
|
|
472
496
|
credit_debit=credit_debit_platform,
|
|
473
497
|
change_amount=abs_amount,
|
|
474
498
|
credit_type=credit_type,
|
|
499
|
+
free_amount=free_amount,
|
|
500
|
+
reward_amount=reward_amount,
|
|
501
|
+
permanent_amount=permanent_amount,
|
|
475
502
|
)
|
|
476
503
|
session.add(platform_tx)
|
|
477
504
|
|
|
@@ -842,34 +869,7 @@ async def expense_message(
|
|
|
842
869
|
session=session, id=agent.id, amount=details.get(CreditType.FREE)
|
|
843
870
|
)
|
|
844
871
|
|
|
845
|
-
# 3.
|
|
846
|
-
message_account = await CreditAccount.income_in_session(
|
|
847
|
-
session=session,
|
|
848
|
-
owner_type=OwnerType.PLATFORM,
|
|
849
|
-
owner_id=DEFAULT_PLATFORM_ACCOUNT_MESSAGE,
|
|
850
|
-
credit_type=CreditType.PERMANENT,
|
|
851
|
-
amount=base_amount,
|
|
852
|
-
event_id=event_id,
|
|
853
|
-
)
|
|
854
|
-
platform_fee_account = await CreditAccount.income_in_session(
|
|
855
|
-
session=session,
|
|
856
|
-
owner_type=OwnerType.PLATFORM,
|
|
857
|
-
owner_id=DEFAULT_PLATFORM_ACCOUNT_FEE,
|
|
858
|
-
credit_type=CreditType.PERMANENT,
|
|
859
|
-
amount=fee_platform_amount,
|
|
860
|
-
event_id=event_id,
|
|
861
|
-
)
|
|
862
|
-
if fee_agent_amount > 0:
|
|
863
|
-
agent_account = await CreditAccount.income_in_session(
|
|
864
|
-
session=session,
|
|
865
|
-
owner_type=OwnerType.AGENT,
|
|
866
|
-
owner_id=agent.id,
|
|
867
|
-
credit_type=CreditType.REWARD,
|
|
868
|
-
amount=fee_agent_amount,
|
|
869
|
-
event_id=event_id,
|
|
870
|
-
)
|
|
871
|
-
|
|
872
|
-
# 4. Create credit event record
|
|
872
|
+
# 3. Calculate detailed amounts for fees based on user payment details
|
|
873
873
|
# Set the appropriate credit amount field based on credit type
|
|
874
874
|
free_amount = details.get(CreditType.FREE, Decimal("0"))
|
|
875
875
|
reward_amount = details.get(CreditType.REWARD, Decimal("0"))
|
|
@@ -925,6 +925,52 @@ async def expense_message(
|
|
|
925
925
|
fee_agent_amount - fee_agent_free_amount - fee_agent_reward_amount
|
|
926
926
|
).quantize(FOURPLACES, rounding=ROUND_HALF_UP)
|
|
927
927
|
|
|
928
|
+
# Calculate base amounts by credit type using subtraction method
|
|
929
|
+
# This ensures that: permanent_amount = base_permanent_amount + fee_platform_permanent_amount + fee_agent_permanent_amount
|
|
930
|
+
base_free_amount = free_amount - fee_platform_free_amount - fee_agent_free_amount
|
|
931
|
+
base_reward_amount = (
|
|
932
|
+
reward_amount - fee_platform_reward_amount - fee_agent_reward_amount
|
|
933
|
+
)
|
|
934
|
+
base_permanent_amount = (
|
|
935
|
+
permanent_amount - fee_platform_permanent_amount - fee_agent_permanent_amount
|
|
936
|
+
)
|
|
937
|
+
|
|
938
|
+
# 4. Update fee account - add credits with detailed amounts
|
|
939
|
+
message_account = await CreditAccount.income_in_session(
|
|
940
|
+
session=session,
|
|
941
|
+
owner_type=OwnerType.PLATFORM,
|
|
942
|
+
owner_id=DEFAULT_PLATFORM_ACCOUNT_MESSAGE,
|
|
943
|
+
amount_details={
|
|
944
|
+
CreditType.FREE: base_free_amount,
|
|
945
|
+
CreditType.REWARD: base_reward_amount,
|
|
946
|
+
CreditType.PERMANENT: base_permanent_amount,
|
|
947
|
+
},
|
|
948
|
+
event_id=event_id,
|
|
949
|
+
)
|
|
950
|
+
platform_fee_account = await CreditAccount.income_in_session(
|
|
951
|
+
session=session,
|
|
952
|
+
owner_type=OwnerType.PLATFORM,
|
|
953
|
+
owner_id=DEFAULT_PLATFORM_ACCOUNT_FEE,
|
|
954
|
+
amount_details={
|
|
955
|
+
CreditType.FREE: fee_platform_free_amount,
|
|
956
|
+
CreditType.REWARD: fee_platform_reward_amount,
|
|
957
|
+
CreditType.PERMANENT: fee_platform_permanent_amount,
|
|
958
|
+
},
|
|
959
|
+
event_id=event_id,
|
|
960
|
+
)
|
|
961
|
+
if fee_agent_amount > 0:
|
|
962
|
+
agent_account = await CreditAccount.income_in_session(
|
|
963
|
+
session=session,
|
|
964
|
+
owner_type=OwnerType.AGENT,
|
|
965
|
+
owner_id=agent.id,
|
|
966
|
+
amount_details={
|
|
967
|
+
CreditType.FREE: fee_agent_free_amount,
|
|
968
|
+
CreditType.REWARD: fee_agent_reward_amount,
|
|
969
|
+
CreditType.PERMANENT: fee_agent_permanent_amount,
|
|
970
|
+
},
|
|
971
|
+
event_id=event_id,
|
|
972
|
+
)
|
|
973
|
+
|
|
928
974
|
# Get agent wallet address
|
|
929
975
|
agent_data = await AgentData.get(agent.id)
|
|
930
976
|
agent_wallet_address = agent_data.evm_wallet_address if agent_data else None
|
|
@@ -949,6 +995,9 @@ async def expense_message(
|
|
|
949
995
|
+ user_account.reward_credits,
|
|
950
996
|
base_amount=base_amount,
|
|
951
997
|
base_original_amount=base_original_amount,
|
|
998
|
+
base_free_amount=base_free_amount,
|
|
999
|
+
base_reward_amount=base_reward_amount,
|
|
1000
|
+
base_permanent_amount=base_permanent_amount,
|
|
952
1001
|
base_llm_amount=base_llm_amount,
|
|
953
1002
|
fee_platform_amount=fee_platform_amount,
|
|
954
1003
|
fee_platform_free_amount=fee_platform_free_amount,
|
|
@@ -977,6 +1026,9 @@ async def expense_message(
|
|
|
977
1026
|
credit_debit=CreditDebit.DEBIT,
|
|
978
1027
|
change_amount=total_amount,
|
|
979
1028
|
credit_type=credit_type,
|
|
1029
|
+
free_amount=free_amount,
|
|
1030
|
+
reward_amount=reward_amount,
|
|
1031
|
+
permanent_amount=permanent_amount,
|
|
980
1032
|
)
|
|
981
1033
|
session.add(user_tx)
|
|
982
1034
|
|
|
@@ -989,6 +1041,9 @@ async def expense_message(
|
|
|
989
1041
|
credit_debit=CreditDebit.CREDIT,
|
|
990
1042
|
change_amount=base_amount,
|
|
991
1043
|
credit_type=credit_type,
|
|
1044
|
+
free_amount=base_free_amount,
|
|
1045
|
+
reward_amount=base_reward_amount,
|
|
1046
|
+
permanent_amount=base_permanent_amount,
|
|
992
1047
|
)
|
|
993
1048
|
session.add(message_tx)
|
|
994
1049
|
|
|
@@ -1001,6 +1056,9 @@ async def expense_message(
|
|
|
1001
1056
|
credit_debit=CreditDebit.CREDIT,
|
|
1002
1057
|
change_amount=fee_platform_amount,
|
|
1003
1058
|
credit_type=credit_type,
|
|
1059
|
+
free_amount=fee_platform_free_amount,
|
|
1060
|
+
reward_amount=fee_platform_reward_amount,
|
|
1061
|
+
permanent_amount=fee_platform_permanent_amount,
|
|
1004
1062
|
)
|
|
1005
1063
|
session.add(platform_tx)
|
|
1006
1064
|
|
|
@@ -1014,6 +1072,9 @@ async def expense_message(
|
|
|
1014
1072
|
credit_debit=CreditDebit.CREDIT,
|
|
1015
1073
|
change_amount=fee_agent_amount,
|
|
1016
1074
|
credit_type=credit_type,
|
|
1075
|
+
free_amount=fee_agent_free_amount,
|
|
1076
|
+
reward_amount=fee_agent_reward_amount,
|
|
1077
|
+
permanent_amount=fee_agent_permanent_amount,
|
|
1017
1078
|
)
|
|
1018
1079
|
session.add(agent_tx)
|
|
1019
1080
|
|
|
@@ -1170,43 +1231,7 @@ async def expense_skill(
|
|
|
1170
1231
|
session=session, id=agent.id, amount=details[CreditType.FREE]
|
|
1171
1232
|
)
|
|
1172
1233
|
|
|
1173
|
-
# 3.
|
|
1174
|
-
skill_account = await CreditAccount.income_in_session(
|
|
1175
|
-
session=session,
|
|
1176
|
-
owner_type=OwnerType.PLATFORM,
|
|
1177
|
-
owner_id=DEFAULT_PLATFORM_ACCOUNT_SKILL,
|
|
1178
|
-
credit_type=CreditType.PERMANENT,
|
|
1179
|
-
amount=skill_cost_info.base_amount,
|
|
1180
|
-
event_id=event_id,
|
|
1181
|
-
)
|
|
1182
|
-
platform_account = await CreditAccount.income_in_session(
|
|
1183
|
-
session=session,
|
|
1184
|
-
owner_type=OwnerType.PLATFORM,
|
|
1185
|
-
owner_id=DEFAULT_PLATFORM_ACCOUNT_FEE,
|
|
1186
|
-
credit_type=CreditType.PERMANENT,
|
|
1187
|
-
amount=skill_cost_info.fee_platform_amount,
|
|
1188
|
-
event_id=event_id,
|
|
1189
|
-
)
|
|
1190
|
-
if skill_cost_info.fee_dev_amount > 0:
|
|
1191
|
-
dev_account = await CreditAccount.income_in_session(
|
|
1192
|
-
session=session,
|
|
1193
|
-
owner_type=skill_cost_info.fee_dev_user_type,
|
|
1194
|
-
owner_id=skill_cost_info.fee_dev_user,
|
|
1195
|
-
credit_type=CreditType.REWARD, # put dev fee in reward
|
|
1196
|
-
amount=skill_cost_info.fee_dev_amount,
|
|
1197
|
-
event_id=event_id,
|
|
1198
|
-
)
|
|
1199
|
-
if skill_cost_info.fee_agent_amount > 0:
|
|
1200
|
-
agent_account = await CreditAccount.income_in_session(
|
|
1201
|
-
session=session,
|
|
1202
|
-
owner_type=OwnerType.AGENT,
|
|
1203
|
-
owner_id=agent.id,
|
|
1204
|
-
credit_type=CreditType.REWARD,
|
|
1205
|
-
amount=skill_cost_info.fee_agent_amount,
|
|
1206
|
-
event_id=event_id,
|
|
1207
|
-
)
|
|
1208
|
-
|
|
1209
|
-
# 4. Create credit event record
|
|
1234
|
+
# 3. Calculate detailed amounts for fees
|
|
1210
1235
|
# Set the appropriate credit amount field based on credit type
|
|
1211
1236
|
free_amount = details.get(CreditType.FREE, Decimal("0"))
|
|
1212
1237
|
reward_amount = details.get(CreditType.REWARD, Decimal("0"))
|
|
@@ -1306,6 +1331,78 @@ async def expense_skill(
|
|
|
1306
1331
|
skill_cost_info.fee_dev_amount - fee_dev_free_amount - fee_dev_reward_amount
|
|
1307
1332
|
).quantize(FOURPLACES, rounding=ROUND_HALF_UP)
|
|
1308
1333
|
|
|
1334
|
+
# Calculate base amounts by credit type using subtraction method
|
|
1335
|
+
base_free_amount = (
|
|
1336
|
+
free_amount
|
|
1337
|
+
- fee_platform_free_amount
|
|
1338
|
+
- fee_agent_free_amount
|
|
1339
|
+
- fee_dev_free_amount
|
|
1340
|
+
)
|
|
1341
|
+
|
|
1342
|
+
base_reward_amount = (
|
|
1343
|
+
reward_amount
|
|
1344
|
+
- fee_platform_reward_amount
|
|
1345
|
+
- fee_agent_reward_amount
|
|
1346
|
+
- fee_dev_reward_amount
|
|
1347
|
+
)
|
|
1348
|
+
|
|
1349
|
+
base_permanent_amount = (
|
|
1350
|
+
permanent_amount
|
|
1351
|
+
- fee_platform_permanent_amount
|
|
1352
|
+
- fee_agent_permanent_amount
|
|
1353
|
+
- fee_dev_permanent_amount
|
|
1354
|
+
)
|
|
1355
|
+
|
|
1356
|
+
# 4. Update fee account - add credits
|
|
1357
|
+
skill_account = await CreditAccount.income_in_session(
|
|
1358
|
+
session=session,
|
|
1359
|
+
owner_type=OwnerType.PLATFORM,
|
|
1360
|
+
owner_id=DEFAULT_PLATFORM_ACCOUNT_SKILL,
|
|
1361
|
+
amount_details={
|
|
1362
|
+
CreditType.FREE: base_free_amount,
|
|
1363
|
+
CreditType.REWARD: base_reward_amount,
|
|
1364
|
+
CreditType.PERMANENT: base_permanent_amount,
|
|
1365
|
+
},
|
|
1366
|
+
event_id=event_id,
|
|
1367
|
+
)
|
|
1368
|
+
platform_account = await CreditAccount.income_in_session(
|
|
1369
|
+
session=session,
|
|
1370
|
+
owner_type=OwnerType.PLATFORM,
|
|
1371
|
+
owner_id=DEFAULT_PLATFORM_ACCOUNT_FEE,
|
|
1372
|
+
amount_details={
|
|
1373
|
+
CreditType.FREE: fee_platform_free_amount,
|
|
1374
|
+
CreditType.REWARD: fee_platform_reward_amount,
|
|
1375
|
+
CreditType.PERMANENT: fee_platform_permanent_amount,
|
|
1376
|
+
},
|
|
1377
|
+
event_id=event_id,
|
|
1378
|
+
)
|
|
1379
|
+
if skill_cost_info.fee_dev_amount > 0:
|
|
1380
|
+
dev_account = await CreditAccount.income_in_session(
|
|
1381
|
+
session=session,
|
|
1382
|
+
owner_type=skill_cost_info.fee_dev_user_type,
|
|
1383
|
+
owner_id=skill_cost_info.fee_dev_user,
|
|
1384
|
+
amount_details={
|
|
1385
|
+
CreditType.FREE: fee_dev_free_amount,
|
|
1386
|
+
CreditType.REWARD: fee_dev_reward_amount,
|
|
1387
|
+
CreditType.PERMANENT: fee_dev_permanent_amount,
|
|
1388
|
+
},
|
|
1389
|
+
event_id=event_id,
|
|
1390
|
+
)
|
|
1391
|
+
if skill_cost_info.fee_agent_amount > 0:
|
|
1392
|
+
agent_account = await CreditAccount.income_in_session(
|
|
1393
|
+
session=session,
|
|
1394
|
+
owner_type=OwnerType.AGENT,
|
|
1395
|
+
owner_id=agent.id,
|
|
1396
|
+
amount_details={
|
|
1397
|
+
CreditType.FREE: fee_agent_free_amount,
|
|
1398
|
+
CreditType.REWARD: fee_agent_reward_amount,
|
|
1399
|
+
CreditType.PERMANENT: fee_agent_permanent_amount,
|
|
1400
|
+
},
|
|
1401
|
+
event_id=event_id,
|
|
1402
|
+
)
|
|
1403
|
+
|
|
1404
|
+
# 5. Create credit event record
|
|
1405
|
+
|
|
1309
1406
|
# Get agent wallet address
|
|
1310
1407
|
agent_data = await AgentData.get(agent.id)
|
|
1311
1408
|
agent_wallet_address = agent_data.evm_wallet_address if agent_data else None
|
|
@@ -1332,6 +1429,9 @@ async def expense_skill(
|
|
|
1332
1429
|
base_amount=skill_cost_info.base_amount,
|
|
1333
1430
|
base_original_amount=skill_cost_info.base_original_amount,
|
|
1334
1431
|
base_skill_amount=skill_cost_info.base_skill_amount,
|
|
1432
|
+
base_free_amount=base_free_amount,
|
|
1433
|
+
base_reward_amount=base_reward_amount,
|
|
1434
|
+
base_permanent_amount=base_permanent_amount,
|
|
1335
1435
|
fee_platform_amount=skill_cost_info.fee_platform_amount,
|
|
1336
1436
|
fee_platform_free_amount=fee_platform_free_amount,
|
|
1337
1437
|
fee_platform_reward_amount=fee_platform_reward_amount,
|
|
@@ -1366,6 +1466,9 @@ async def expense_skill(
|
|
|
1366
1466
|
credit_debit=CreditDebit.DEBIT,
|
|
1367
1467
|
change_amount=skill_cost_info.total_amount,
|
|
1368
1468
|
credit_type=credit_type,
|
|
1469
|
+
free_amount=free_amount,
|
|
1470
|
+
reward_amount=reward_amount,
|
|
1471
|
+
permanent_amount=permanent_amount,
|
|
1369
1472
|
)
|
|
1370
1473
|
session.add(user_tx)
|
|
1371
1474
|
|
|
@@ -1378,6 +1481,9 @@ async def expense_skill(
|
|
|
1378
1481
|
credit_debit=CreditDebit.CREDIT,
|
|
1379
1482
|
change_amount=skill_cost_info.base_amount,
|
|
1380
1483
|
credit_type=credit_type,
|
|
1484
|
+
free_amount=base_free_amount,
|
|
1485
|
+
reward_amount=base_reward_amount,
|
|
1486
|
+
permanent_amount=base_permanent_amount,
|
|
1381
1487
|
)
|
|
1382
1488
|
session.add(skill_tx)
|
|
1383
1489
|
|
|
@@ -1390,6 +1496,9 @@ async def expense_skill(
|
|
|
1390
1496
|
credit_debit=CreditDebit.CREDIT,
|
|
1391
1497
|
change_amount=skill_cost_info.fee_platform_amount,
|
|
1392
1498
|
credit_type=credit_type,
|
|
1499
|
+
free_amount=fee_platform_free_amount,
|
|
1500
|
+
reward_amount=fee_platform_reward_amount,
|
|
1501
|
+
permanent_amount=fee_platform_permanent_amount,
|
|
1393
1502
|
)
|
|
1394
1503
|
session.add(platform_tx)
|
|
1395
1504
|
|
|
@@ -1403,6 +1512,9 @@ async def expense_skill(
|
|
|
1403
1512
|
credit_debit=CreditDebit.CREDIT,
|
|
1404
1513
|
change_amount=skill_cost_info.fee_dev_amount,
|
|
1405
1514
|
credit_type=CreditType.REWARD,
|
|
1515
|
+
free_amount=fee_dev_free_amount,
|
|
1516
|
+
reward_amount=fee_dev_reward_amount,
|
|
1517
|
+
permanent_amount=fee_dev_permanent_amount,
|
|
1406
1518
|
)
|
|
1407
1519
|
session.add(dev_tx)
|
|
1408
1520
|
|
|
@@ -1416,6 +1528,9 @@ async def expense_skill(
|
|
|
1416
1528
|
credit_debit=CreditDebit.CREDIT,
|
|
1417
1529
|
change_amount=skill_cost_info.fee_agent_amount,
|
|
1418
1530
|
credit_type=credit_type,
|
|
1531
|
+
free_amount=fee_agent_free_amount,
|
|
1532
|
+
reward_amount=fee_agent_reward_amount,
|
|
1533
|
+
permanent_amount=fee_agent_permanent_amount,
|
|
1419
1534
|
)
|
|
1420
1535
|
session.add(agent_tx)
|
|
1421
1536
|
|
|
@@ -1460,8 +1575,7 @@ async def refill_free_credits_for_account(
|
|
|
1460
1575
|
session=session,
|
|
1461
1576
|
owner_type=account.owner_type,
|
|
1462
1577
|
owner_id=account.owner_id,
|
|
1463
|
-
|
|
1464
|
-
credit_type=CreditType.FREE,
|
|
1578
|
+
amount_details={CreditType.FREE: amount_to_add},
|
|
1465
1579
|
event_id=event_id,
|
|
1466
1580
|
)
|
|
1467
1581
|
|
|
@@ -1492,6 +1606,9 @@ async def refill_free_credits_for_account(
|
|
|
1492
1606
|
+ updated_account.reward_credits,
|
|
1493
1607
|
base_amount=amount_to_add,
|
|
1494
1608
|
base_original_amount=amount_to_add,
|
|
1609
|
+
base_free_amount=amount_to_add,
|
|
1610
|
+
base_reward_amount=Decimal("0"),
|
|
1611
|
+
base_permanent_amount=Decimal("0"),
|
|
1495
1612
|
free_amount=amount_to_add, # Set free_amount since this is a free credit refill
|
|
1496
1613
|
reward_amount=Decimal("0"), # No reward credits involved
|
|
1497
1614
|
permanent_amount=Decimal("0"), # No permanent credits involved
|
|
@@ -1636,38 +1753,12 @@ async def expense_summarize(
|
|
|
1636
1753
|
session=session, id=agent.id, amount=details.get(CreditType.FREE)
|
|
1637
1754
|
)
|
|
1638
1755
|
|
|
1639
|
-
# 3.
|
|
1640
|
-
memory_account = await CreditAccount.income_in_session(
|
|
1641
|
-
session=session,
|
|
1642
|
-
owner_type=OwnerType.PLATFORM,
|
|
1643
|
-
owner_id=DEFAULT_PLATFORM_ACCOUNT_MEMORY,
|
|
1644
|
-
credit_type=CreditType.PERMANENT,
|
|
1645
|
-
amount=base_amount,
|
|
1646
|
-
event_id=event_id,
|
|
1647
|
-
)
|
|
1648
|
-
platform_fee_account = await CreditAccount.income_in_session(
|
|
1649
|
-
session=session,
|
|
1650
|
-
owner_type=OwnerType.PLATFORM,
|
|
1651
|
-
owner_id=DEFAULT_PLATFORM_ACCOUNT_FEE,
|
|
1652
|
-
credit_type=CreditType.PERMANENT,
|
|
1653
|
-
amount=fee_platform_amount,
|
|
1654
|
-
event_id=event_id,
|
|
1655
|
-
)
|
|
1656
|
-
if fee_agent_amount > 0:
|
|
1657
|
-
agent_account = await CreditAccount.income_in_session(
|
|
1658
|
-
session=session,
|
|
1659
|
-
owner_type=OwnerType.AGENT,
|
|
1660
|
-
owner_id=agent.id,
|
|
1661
|
-
credit_type=CreditType.REWARD,
|
|
1662
|
-
amount=fee_agent_amount,
|
|
1663
|
-
event_id=event_id,
|
|
1664
|
-
)
|
|
1665
|
-
|
|
1666
|
-
# 4. Create credit event record
|
|
1756
|
+
# 3. Calculate fee amounts by credit type before income_in_session calls
|
|
1667
1757
|
# Set the appropriate credit amount field based on credit type
|
|
1668
1758
|
free_amount = details.get(CreditType.FREE, Decimal("0"))
|
|
1669
1759
|
reward_amount = details.get(CreditType.REWARD, Decimal("0"))
|
|
1670
1760
|
permanent_amount = details.get(CreditType.PERMANENT, Decimal("0"))
|
|
1761
|
+
|
|
1671
1762
|
if CreditType.PERMANENT in details:
|
|
1672
1763
|
credit_type = CreditType.PERMANENT
|
|
1673
1764
|
elif CreditType.REWARD in details:
|
|
@@ -1719,6 +1810,55 @@ async def expense_summarize(
|
|
|
1719
1810
|
fee_agent_amount - fee_agent_free_amount - fee_agent_reward_amount
|
|
1720
1811
|
).quantize(FOURPLACES, rounding=ROUND_HALF_UP)
|
|
1721
1812
|
|
|
1813
|
+
# Calculate base amounts by credit type using subtraction method
|
|
1814
|
+
base_free_amount = free_amount - fee_platform_free_amount - fee_agent_free_amount
|
|
1815
|
+
|
|
1816
|
+
base_reward_amount = (
|
|
1817
|
+
reward_amount - fee_platform_reward_amount - fee_agent_reward_amount
|
|
1818
|
+
)
|
|
1819
|
+
|
|
1820
|
+
base_permanent_amount = (
|
|
1821
|
+
permanent_amount - fee_platform_permanent_amount - fee_agent_permanent_amount
|
|
1822
|
+
)
|
|
1823
|
+
|
|
1824
|
+
# 4. Update fee account - add credits
|
|
1825
|
+
memory_account = await CreditAccount.income_in_session(
|
|
1826
|
+
session=session,
|
|
1827
|
+
owner_type=OwnerType.PLATFORM,
|
|
1828
|
+
owner_id=DEFAULT_PLATFORM_ACCOUNT_MEMORY,
|
|
1829
|
+
amount_details={
|
|
1830
|
+
CreditType.FREE: base_free_amount,
|
|
1831
|
+
CreditType.REWARD: base_reward_amount,
|
|
1832
|
+
CreditType.PERMANENT: base_permanent_amount,
|
|
1833
|
+
},
|
|
1834
|
+
event_id=event_id,
|
|
1835
|
+
)
|
|
1836
|
+
platform_fee_account = await CreditAccount.income_in_session(
|
|
1837
|
+
session=session,
|
|
1838
|
+
owner_type=OwnerType.PLATFORM,
|
|
1839
|
+
owner_id=DEFAULT_PLATFORM_ACCOUNT_FEE,
|
|
1840
|
+
amount_details={
|
|
1841
|
+
CreditType.FREE: fee_platform_free_amount,
|
|
1842
|
+
CreditType.REWARD: fee_platform_reward_amount,
|
|
1843
|
+
CreditType.PERMANENT: fee_platform_permanent_amount,
|
|
1844
|
+
},
|
|
1845
|
+
event_id=event_id,
|
|
1846
|
+
)
|
|
1847
|
+
if fee_agent_amount > 0:
|
|
1848
|
+
agent_account = await CreditAccount.income_in_session(
|
|
1849
|
+
session=session,
|
|
1850
|
+
owner_type=OwnerType.AGENT,
|
|
1851
|
+
owner_id=agent.id,
|
|
1852
|
+
amount_details={
|
|
1853
|
+
CreditType.FREE: fee_agent_free_amount,
|
|
1854
|
+
CreditType.REWARD: fee_agent_reward_amount,
|
|
1855
|
+
CreditType.PERMANENT: fee_agent_permanent_amount,
|
|
1856
|
+
},
|
|
1857
|
+
event_id=event_id,
|
|
1858
|
+
)
|
|
1859
|
+
|
|
1860
|
+
# 5. Create credit event record
|
|
1861
|
+
|
|
1722
1862
|
# Get agent wallet address
|
|
1723
1863
|
agent_data = await AgentData.get(agent.id)
|
|
1724
1864
|
agent_wallet_address = agent_data.evm_wallet_address if agent_data else None
|
|
@@ -1744,6 +1884,9 @@ async def expense_summarize(
|
|
|
1744
1884
|
base_amount=base_amount,
|
|
1745
1885
|
base_original_amount=base_original_amount,
|
|
1746
1886
|
base_llm_amount=base_llm_amount,
|
|
1887
|
+
base_free_amount=base_free_amount,
|
|
1888
|
+
base_reward_amount=base_reward_amount,
|
|
1889
|
+
base_permanent_amount=base_permanent_amount,
|
|
1747
1890
|
fee_platform_amount=fee_platform_amount,
|
|
1748
1891
|
fee_platform_free_amount=fee_platform_free_amount,
|
|
1749
1892
|
fee_platform_reward_amount=fee_platform_reward_amount,
|
|
@@ -1769,6 +1912,9 @@ async def expense_summarize(
|
|
|
1769
1912
|
credit_debit=CreditDebit.DEBIT,
|
|
1770
1913
|
change_amount=total_amount,
|
|
1771
1914
|
credit_type=credit_type,
|
|
1915
|
+
free_amount=free_amount,
|
|
1916
|
+
reward_amount=reward_amount,
|
|
1917
|
+
permanent_amount=permanent_amount,
|
|
1772
1918
|
)
|
|
1773
1919
|
session.add(user_tx)
|
|
1774
1920
|
|
|
@@ -1781,6 +1927,9 @@ async def expense_summarize(
|
|
|
1781
1927
|
credit_debit=CreditDebit.CREDIT,
|
|
1782
1928
|
change_amount=base_amount,
|
|
1783
1929
|
credit_type=credit_type,
|
|
1930
|
+
free_amount=base_free_amount,
|
|
1931
|
+
reward_amount=base_reward_amount,
|
|
1932
|
+
permanent_amount=base_permanent_amount,
|
|
1784
1933
|
)
|
|
1785
1934
|
session.add(memory_tx)
|
|
1786
1935
|
|
|
@@ -1793,6 +1942,9 @@ async def expense_summarize(
|
|
|
1793
1942
|
credit_debit=CreditDebit.CREDIT,
|
|
1794
1943
|
change_amount=fee_platform_amount,
|
|
1795
1944
|
credit_type=credit_type,
|
|
1945
|
+
free_amount=fee_platform_free_amount,
|
|
1946
|
+
reward_amount=fee_platform_reward_amount,
|
|
1947
|
+
permanent_amount=fee_platform_permanent_amount,
|
|
1796
1948
|
)
|
|
1797
1949
|
session.add(platform_tx)
|
|
1798
1950
|
|
|
@@ -1806,6 +1958,9 @@ async def expense_summarize(
|
|
|
1806
1958
|
credit_debit=CreditDebit.CREDIT,
|
|
1807
1959
|
change_amount=fee_agent_amount,
|
|
1808
1960
|
credit_type=CreditType.REWARD,
|
|
1961
|
+
free_amount=fee_agent_free_amount,
|
|
1962
|
+
reward_amount=fee_agent_reward_amount,
|
|
1963
|
+
permanent_amount=fee_agent_permanent_amount,
|
|
1809
1964
|
)
|
|
1810
1965
|
session.add(agent_tx)
|
|
1811
1966
|
|
|
@@ -685,7 +685,7 @@
|
|
|
685
685
|
"network_id": {
|
|
686
686
|
"title": "Default Network",
|
|
687
687
|
"type": "string",
|
|
688
|
-
"description": "Default Network",
|
|
688
|
+
"description": "Default Network, please note that some CDP Wallet native skills like swap only support the base network.",
|
|
689
689
|
"default": "base-mainnet",
|
|
690
690
|
"enum": [
|
|
691
691
|
"ethereum-mainnet",
|
|
@@ -697,8 +697,7 @@
|
|
|
697
697
|
"arbitrum-mainnet",
|
|
698
698
|
"arbitrum-sepolia",
|
|
699
699
|
"optimism-mainnet",
|
|
700
|
-
"optimism-sepolia"
|
|
701
|
-
"solana"
|
|
700
|
+
"optimism-sepolia"
|
|
702
701
|
],
|
|
703
702
|
"x-group": "onchain"
|
|
704
703
|
}
|
|
@@ -715,7 +714,7 @@
|
|
|
715
714
|
"readonly_wallet_address": {
|
|
716
715
|
"title": "Readonly Wallet Address",
|
|
717
716
|
"type": "string",
|
|
718
|
-
"description": "
|
|
717
|
+
"description": "Set the wallet address as agent wallet, then it can only be analyzed by the agent.",
|
|
719
718
|
"maxLength": 100,
|
|
720
719
|
"x-group": "onchain"
|
|
721
720
|
}
|
intentkit/models/chat.py
CHANGED
|
@@ -503,18 +503,17 @@ class ChatMessage(ChatMessageCreate):
|
|
|
503
503
|
def sanitize_privacy(self) -> "ChatMessage":
|
|
504
504
|
"""Remove sensitive information from the chat message.
|
|
505
505
|
|
|
506
|
-
This method clears the
|
|
506
|
+
This method clears the skill parameters and response
|
|
507
507
|
from skill calls while preserving the structure and metadata.
|
|
508
508
|
|
|
509
509
|
Returns:
|
|
510
510
|
ChatMessage: A new ChatMessage instance with sensitive data removed
|
|
511
511
|
"""
|
|
512
|
+
if self.author_type != AuthorType.SKILL:
|
|
513
|
+
return self
|
|
512
514
|
# Create a copy of the current message
|
|
513
515
|
sanitized_data = self.model_dump()
|
|
514
516
|
|
|
515
|
-
# Clear the message content
|
|
516
|
-
sanitized_data["message"] = ""
|
|
517
|
-
|
|
518
517
|
# Clear sensitive data from skill calls
|
|
519
518
|
if sanitized_data.get("skill_calls"):
|
|
520
519
|
for skill_call in sanitized_data["skill_calls"]:
|
intentkit/models/credit.py
CHANGED
|
@@ -404,20 +404,25 @@ class CreditAccount(BaseModel):
|
|
|
404
404
|
session: AsyncSession,
|
|
405
405
|
owner_type: OwnerType,
|
|
406
406
|
owner_id: str,
|
|
407
|
-
|
|
408
|
-
credit_type: CreditType,
|
|
407
|
+
amount_details: Dict[CreditType, Decimal],
|
|
409
408
|
event_id: Optional[str] = None,
|
|
410
409
|
) -> "CreditAccount":
|
|
411
410
|
# check first, create if not exists
|
|
412
411
|
await cls.get_or_create_in_session(session, owner_type, owner_id)
|
|
413
412
|
# income
|
|
414
413
|
values_dict = {
|
|
415
|
-
credit_type.value: getattr(CreditAccountTable, credit_type.value) + amount,
|
|
416
414
|
"income_at": datetime.now(timezone.utc),
|
|
417
415
|
}
|
|
418
416
|
if event_id:
|
|
419
417
|
values_dict["last_event_id"] = event_id
|
|
420
418
|
|
|
419
|
+
# Add credit type values based on amount_details
|
|
420
|
+
for credit_type, amount in amount_details.items():
|
|
421
|
+
if amount > 0:
|
|
422
|
+
values_dict[credit_type.value] = (
|
|
423
|
+
getattr(CreditAccountTable, credit_type.value) + amount
|
|
424
|
+
)
|
|
425
|
+
|
|
421
426
|
stmt = (
|
|
422
427
|
update(CreditAccountTable)
|
|
423
428
|
.where(
|
|
@@ -515,6 +520,7 @@ class CreditAccount(BaseModel):
|
|
|
515
520
|
balance_after=free_quota,
|
|
516
521
|
base_amount=free_quota,
|
|
517
522
|
base_original_amount=free_quota,
|
|
523
|
+
base_free_amount=free_quota,
|
|
518
524
|
free_amount=free_quota, # Set free_amount since this is a free credit refill
|
|
519
525
|
reward_amount=Decimal("0"), # No reward credits involved
|
|
520
526
|
permanent_amount=Decimal("0"), # No permanent credits involved
|
|
@@ -534,6 +540,9 @@ class CreditAccount(BaseModel):
|
|
|
534
540
|
credit_debit=CreditDebit.CREDIT,
|
|
535
541
|
change_amount=free_quota,
|
|
536
542
|
credit_type=CreditType.FREE,
|
|
543
|
+
free_amount=free_quota,
|
|
544
|
+
reward_amount=Decimal("0"),
|
|
545
|
+
permanent_amount=Decimal("0"),
|
|
537
546
|
)
|
|
538
547
|
session.add(user_tx)
|
|
539
548
|
|
|
@@ -546,6 +555,9 @@ class CreditAccount(BaseModel):
|
|
|
546
555
|
credit_debit=CreditDebit.DEBIT,
|
|
547
556
|
change_amount=free_quota,
|
|
548
557
|
credit_type=CreditType.FREE,
|
|
558
|
+
free_amount=free_quota,
|
|
559
|
+
reward_amount=Decimal("0"),
|
|
560
|
+
permanent_amount=Decimal("0"),
|
|
549
561
|
)
|
|
550
562
|
session.add(platform_tx)
|
|
551
563
|
|
|
@@ -794,6 +806,21 @@ class CreditEventTable(Base):
|
|
|
794
806
|
default=0,
|
|
795
807
|
nullable=True,
|
|
796
808
|
)
|
|
809
|
+
base_free_amount = Column(
|
|
810
|
+
Numeric(22, 4),
|
|
811
|
+
default=0,
|
|
812
|
+
nullable=True,
|
|
813
|
+
)
|
|
814
|
+
base_reward_amount = Column(
|
|
815
|
+
Numeric(22, 4),
|
|
816
|
+
default=0,
|
|
817
|
+
nullable=True,
|
|
818
|
+
)
|
|
819
|
+
base_permanent_amount = Column(
|
|
820
|
+
Numeric(22, 4),
|
|
821
|
+
default=0,
|
|
822
|
+
nullable=True,
|
|
823
|
+
)
|
|
797
824
|
fee_platform_amount = Column(
|
|
798
825
|
Numeric(22, 4),
|
|
799
826
|
default=0,
|
|
@@ -968,6 +995,18 @@ class CreditEvent(BaseModel):
|
|
|
968
995
|
Optional[Decimal],
|
|
969
996
|
Field(default=Decimal("0"), description="Base skill cost amount"),
|
|
970
997
|
]
|
|
998
|
+
base_free_amount: Annotated[
|
|
999
|
+
Optional[Decimal],
|
|
1000
|
+
Field(default=Decimal("0"), description="Base free credit amount"),
|
|
1001
|
+
]
|
|
1002
|
+
base_reward_amount: Annotated[
|
|
1003
|
+
Optional[Decimal],
|
|
1004
|
+
Field(default=Decimal("0"), description="Base reward credit amount"),
|
|
1005
|
+
]
|
|
1006
|
+
base_permanent_amount: Annotated[
|
|
1007
|
+
Optional[Decimal],
|
|
1008
|
+
Field(default=Decimal("0"), description="Base permanent credit amount"),
|
|
1009
|
+
]
|
|
971
1010
|
fee_platform_amount: Annotated[
|
|
972
1011
|
Optional[Decimal],
|
|
973
1012
|
Field(default=Decimal("0"), description="Platform fee amount"),
|
|
@@ -1062,6 +1101,9 @@ class CreditEvent(BaseModel):
|
|
|
1062
1101
|
"base_original_amount",
|
|
1063
1102
|
"base_llm_amount",
|
|
1064
1103
|
"base_skill_amount",
|
|
1104
|
+
"base_free_amount",
|
|
1105
|
+
"base_reward_amount",
|
|
1106
|
+
"base_permanent_amount",
|
|
1065
1107
|
"fee_platform_amount",
|
|
1066
1108
|
"fee_platform_free_amount",
|
|
1067
1109
|
"fee_platform_reward_amount",
|
|
@@ -1183,6 +1225,21 @@ class CreditTransactionTable(Base):
|
|
|
1183
1225
|
default=0,
|
|
1184
1226
|
nullable=False,
|
|
1185
1227
|
)
|
|
1228
|
+
free_amount = Column(
|
|
1229
|
+
Numeric(22, 4),
|
|
1230
|
+
default=0,
|
|
1231
|
+
nullable=False,
|
|
1232
|
+
)
|
|
1233
|
+
reward_amount = Column(
|
|
1234
|
+
Numeric(22, 4),
|
|
1235
|
+
default=0,
|
|
1236
|
+
nullable=False,
|
|
1237
|
+
)
|
|
1238
|
+
permanent_amount = Column(
|
|
1239
|
+
Numeric(22, 4),
|
|
1240
|
+
default=0,
|
|
1241
|
+
nullable=False,
|
|
1242
|
+
)
|
|
1186
1243
|
credit_type = Column(
|
|
1187
1244
|
String,
|
|
1188
1245
|
nullable=False,
|
|
@@ -1223,8 +1280,22 @@ class CreditTransaction(BaseModel):
|
|
|
1223
1280
|
change_amount: Annotated[
|
|
1224
1281
|
Decimal, Field(default=Decimal("0"), description="Amount of credits changed")
|
|
1225
1282
|
]
|
|
1283
|
+
free_amount: Annotated[
|
|
1284
|
+
Decimal,
|
|
1285
|
+
Field(default=Decimal("0"), description="Amount of free credits changed"),
|
|
1286
|
+
]
|
|
1287
|
+
reward_amount: Annotated[
|
|
1288
|
+
Decimal,
|
|
1289
|
+
Field(default=Decimal("0"), description="Amount of reward credits changed"),
|
|
1290
|
+
]
|
|
1291
|
+
permanent_amount: Annotated[
|
|
1292
|
+
Decimal,
|
|
1293
|
+
Field(default=Decimal("0"), description="Amount of permanent credits changed"),
|
|
1294
|
+
]
|
|
1226
1295
|
|
|
1227
|
-
@field_validator(
|
|
1296
|
+
@field_validator(
|
|
1297
|
+
"change_amount", "free_amount", "reward_amount", "permanent_amount"
|
|
1298
|
+
)
|
|
1228
1299
|
@classmethod
|
|
1229
1300
|
def round_decimal(cls, v: Any) -> Decimal:
|
|
1230
1301
|
"""Round decimal values to 4 decimal places."""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: intentkit
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.19
|
|
4
4
|
Summary: Intent-based AI Agent Platform - Core Package
|
|
5
5
|
Project-URL: Homepage, https://github.com/crestal-network/intentkit
|
|
6
6
|
Project-URL: Repository, https://github.com/crestal-network/intentkit
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
intentkit/__init__.py,sha256=
|
|
1
|
+
intentkit/__init__.py,sha256=FmDOou4eKFWVVffgyC8ibQV_z8X3ych6jsxuIL43U3k,379
|
|
2
2
|
intentkit/abstracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
intentkit/abstracts/agent.py,sha256=108gb5W8Q1Sy4G55F2_ZFv2-_CnY76qrBtpIr0Oxxqk,1489
|
|
4
4
|
intentkit/abstracts/api.py,sha256=ZUc24vaQvQVbbjznx7bV0lbbQxdQPfEV8ZxM2R6wZWo,166
|
|
@@ -7,7 +7,7 @@ intentkit/abstracts/graph.py,sha256=sX5hVemXsODvwIYLHufaf-zSXmW97bXRoZuyxYqaEV4,
|
|
|
7
7
|
intentkit/abstracts/skill.py,sha256=cIJ6BkASD31U1IEkE8rdAawq99w_xsg0lt3oalqa1ZA,5071
|
|
8
8
|
intentkit/abstracts/twitter.py,sha256=cEtP7ygR_b-pHdc9i8kBuyooz1cPoGUGwsBHDpowJyY,1262
|
|
9
9
|
intentkit/clients/__init__.py,sha256=sQ_6_bRC2MPWLPH-skQ3qsEe8ce-dUGL7i8VJOautHg,298
|
|
10
|
-
intentkit/clients/cdp.py,sha256=
|
|
10
|
+
intentkit/clients/cdp.py,sha256=_A0QRRi6uPYr_AL26arW-Yofez0JcrEQdfxGCVgC7kM,7038
|
|
11
11
|
intentkit/clients/twitter.py,sha256=Lfa7srHOFnY96SXcElW0jfg7XKS_WliWnXjPZEe6SQc,18976
|
|
12
12
|
intentkit/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
intentkit/config/config.py,sha256=jhPr7FzZZHUsLIdyiOcaKeAsZQ8FdEo6yUaiIcvmryo,8879
|
|
@@ -15,19 +15,19 @@ intentkit/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
15
15
|
intentkit/core/agent.py,sha256=GIKDn1dTenIHWMRxe-ud7hd1cQaHzbTDdypy5IAgPfU,16658
|
|
16
16
|
intentkit/core/api.py,sha256=WfoaHNquujYJIpNPuTR1dSaaxog0S3X2W4lG9Ehmkm4,3284
|
|
17
17
|
intentkit/core/client.py,sha256=J5K7f08-ucszBKAbn9K3QNOFKIC__7amTbKYii1jFkI,3056
|
|
18
|
-
intentkit/core/credit.py,sha256=
|
|
18
|
+
intentkit/core/credit.py,sha256=1aKT3hNLCvcQYjNckMxBsUpdtc4RH_KZQPAfzpOs-DU,69552
|
|
19
19
|
intentkit/core/engine.py,sha256=H4ew1jhn2coMYJ3zR9isM1Y-XbnXNMg91SeDoeXdQ4U,36562
|
|
20
20
|
intentkit/core/node.py,sha256=7h9zgDSd928bzUi3m3EZnKkhbwqlbRAQUr_uz7gKB5Y,8880
|
|
21
21
|
intentkit/core/prompt.py,sha256=a6nogIGZuDt2u2EuDd29DAv73OjCBOn-bZnuqYRvY7A,15804
|
|
22
22
|
intentkit/core/skill.py,sha256=vPK37sDRT9kzkMBymPwqZ5uEdxTTRtb_DfREIeyz-Xw,5788
|
|
23
23
|
intentkit/models/agent.py,sha256=uC5AErdVucaEajKCXAcF6C3VwYRVIhXTIfOBp-n-Xhg,66310
|
|
24
24
|
intentkit/models/agent_data.py,sha256=mVsiK8TziYa1W1ujU1KwI9osIVIeSM7XJEogGRL1WVU,28263
|
|
25
|
-
intentkit/models/agent_schema.json,sha256=
|
|
25
|
+
intentkit/models/agent_schema.json,sha256=psrYONIzAbiuZB4zzYQFmANP1pw31TV_900TagSYT7o,21109
|
|
26
26
|
intentkit/models/app_setting.py,sha256=iYbW63QD91bt4oEYV3wOXHuRFav2b4VXLwb_StgUQtQ,8230
|
|
27
27
|
intentkit/models/base.py,sha256=o-zRjVrak-f5Jokdvj8BjLm8gcC3yYiYMCTLegwT2lA,185
|
|
28
|
-
intentkit/models/chat.py,sha256=
|
|
28
|
+
intentkit/models/chat.py,sha256=cDccEHU8nd7Y5uhrHDCuZGwqrRwhqCaeztMiZcemiug,20469
|
|
29
29
|
intentkit/models/conversation.py,sha256=nrbDIw-3GK5BYi_xkI15FLdx4a6SNrFK8wfAGLCsrqk,9032
|
|
30
|
-
intentkit/models/credit.py,sha256=
|
|
30
|
+
intentkit/models/credit.py,sha256=BHX_Ty1u-TlPCDMjnMbogoUtlbcff0tHHVVZLzkrnGY,45090
|
|
31
31
|
intentkit/models/db.py,sha256=nuDX6NEtnfD5YLr2iVpAAXsgHbSpG5diqfLC-PkHsA4,4406
|
|
32
32
|
intentkit/models/db_mig.py,sha256=vT6Tanm-BHC2T7dTztuB1UG494EFBAlHADKsNzR6xaQ,3577
|
|
33
33
|
intentkit/models/generator.py,sha256=lyZu9U9rZUGkqd_QT5SAhay9DY358JJY8EhDSpN8I1M,10298
|
|
@@ -411,7 +411,7 @@ intentkit/utils/random.py,sha256=DymMxu9g0kuQLgJUqalvgksnIeLdS-v0aRk5nQU0mLI,452
|
|
|
411
411
|
intentkit/utils/s3.py,sha256=9trQNkKQ5VgxWsewVsV8Y0q_pXzGRvsCYP8xauyUYkg,8549
|
|
412
412
|
intentkit/utils/slack_alert.py,sha256=s7UpRgyzLW7Pbmt8cKzTJgMA9bm4EP-1rQ5KXayHu6E,2264
|
|
413
413
|
intentkit/utils/tx.py,sha256=2yLLGuhvfBEY5n_GJ8wmIWLCzn0FsYKv5kRNzw_sLUI,1454
|
|
414
|
-
intentkit-0.6.
|
|
415
|
-
intentkit-0.6.
|
|
416
|
-
intentkit-0.6.
|
|
417
|
-
intentkit-0.6.
|
|
414
|
+
intentkit-0.6.19.dist-info/METADATA,sha256=0Z-h-KZ0LRjUEPTxR9_H7-Le0pnXe7jcZpet-2AFiBE,6409
|
|
415
|
+
intentkit-0.6.19.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
416
|
+
intentkit-0.6.19.dist-info/licenses/LICENSE,sha256=Bln6DhK-LtcO4aXy-PBcdZv2f24MlJFm_qn222biJtE,1071
|
|
417
|
+
intentkit-0.6.19.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|