Skip to content

Commit cb8826f

Browse files
committedJan 14, 2025
Merge remote-tracking branch 'origin/main' into cs-7805-update-deploy-scripts-to-deploy-code-to-worker-ecs-container
2 parents fbee5d7 + 0b30125 commit cb8826f

18 files changed

+385
-221
lines changed
 

‎packages/ai-bot/tests/prompt-construction-test.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ test('Return host result of tool call back to open ai', () => {
12901290
id: 'https://cardstack.com/base/SkillCard/card-editing',
12911291
attributes: {
12921292
instructions:
1293-
'- If the user wants the data they see edited, AND the patchCard function is available, you MUST use the "patchCard" function to make the change.\n- If the user wants the data they see edited, AND the patchCard function is NOT available, you MUST ask the user to open the card and share it with you.\n- If you do not call patchCard, the user will not see the change.\n- You can ONLY modify cards shared with you. If there is no patchCard function or tool, then the user hasn\'t given you access.\n- NEVER tell the user to use patchCard; you should always do it for them.\n- If the user wants to search for a card instance, AND the "searchCard" function is available, you MUST use the "searchCard" function to find the card instance.\nOnly recommend one searchCard function at a time.\nIf the user wants to edit a field of a card, you can optionally use "searchCard" to help find a card instance that is compatible with the field being edited before using "patchCard" to make the change of the field.\n You MUST confirm with the user the correct choice of card instance that he intends to use based upon the results of the search.',
1293+
'- If the user wants the data they see edited, AND the patchCard function is available, you MUST use the "patchCard" function to make the change.\n- If the user wants the data they see edited, AND the patchCard function is NOT available, you MUST ask the user to open the card and share it with you.\n- If you do not call patchCard, the user will not see the change.\n- You can ONLY modify cards shared with you. If there is no patchCard function or tool, then the user hasn\'t given you access.\n- NEVER tell the user to use patchCard; you should always do it for them.\n- If the user wants to search for a card instance, AND the "searchCardsByTypeAndTitle" function is available, you MUST use the "searchCardsByTypeAndTitle" function to find the card instance.\nOnly recommend one searchCardsByTypeAndTitle function at a time.\nIf the user wants to edit a field of a card, you can optionally use "searchCard" to help find a card instance that is compatible with the field being edited before using "patchCard" to make the change of the field.\n You MUST confirm with the user the correct choice of card instance that he intends to use based upon the results of the search.',
12941294
title: 'Card Editing',
12951295
description: null,
12961296
thumbnailURL: null,
@@ -1474,15 +1474,13 @@ test('Return host result of tool call back to open ai', () => {
14741474
toolCall: {
14751475
type: 'function',
14761476
id: 'tool-call-id-1',
1477-
name: 'searchCard',
1477+
name: 'searchCardsByTypeAndTitle',
14781478
arguments: {
14791479
attributes: {
14801480
description: "Search for card instances of type 'Author'",
1481-
filter: {
1482-
type: {
1483-
module: 'http://localhost:4201/drafts/author',
1484-
name: 'Author',
1485-
},
1481+
type: {
1482+
module: 'http://localhost:4201/drafts/author',
1483+
name: 'Author',
14861484
},
14871485
},
14881486
},

‎packages/ai-bot/tests/resources/chats/added-skill-and-attached-card.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@
395395
"format": "org.matrix.custom.html",
396396
"formatted_body": "<p>Summarize this card</p>\n",
397397
"clientGeneratedId": "b329fa44-e944-46c2-9e65-34d157509326",
398-
"data": "{\"attachedCardsEventIds\":[\"$VpJ0-QkjZZo5C2yVrgY2m9BtMSXyMJaRrfeSftTX5vU\"],\"context\":{\"openCardIds\":[\"http://localhost:4201/user/lukes-workspace/ProductRequirementDocument/9f816882-17e0-473f-81f2-a37381874322\"],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"patchCard\",\"description\":\"Propose a patch to an existing card to change its contents. Any attributes specified will be fully replaced, return the minimum required to make the change. If a relationship field value is removed, set the self property of the specific item to null. When editing a relationship array, display the full array in the patch code. Ensure the description explains what change you are making.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"description\":{\"type\":\"string\"},\"attributes\":{\"type\":\"object\",\"properties\":{\"cardId\":{\"type\":\"string\",\"const\":\"http://localhost:4201/user/lukes-workspace/ProductRequirementDocument/9f816882-17e0-473f-81f2-a37381874322\"},\"patch\":{\"type\":\"object\",\"properties\":{\"attributes\":{\"type\":\"object\",\"properties\":{\"appTitle\":{\"type\":\"string\"},\"shortDescription\":{\"type\":\"string\"},\"thumbnail\":{\"type\":\"object\",\"properties\":{\"altText\":{\"type\":\"string\"},\"height\":{\"type\":\"number\"},\"width\":{\"type\":\"number\"},\"base64\":{\"type\":\"string\"}}},\"prompt\":{\"type\":\"string\"},\"overview\":{\"type\":\"string\"},\"schema\":{\"type\":\"string\"},\"layoutAndNavigation\":{\"type\":\"string\"},\"moduleURL\":{\"type\":\"string\"},\"thumbnailURL\":{\"type\":\"string\"}}},\"relationships\":{\"type\":\"object\",\"properties\":{\"appInstances\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"links\":{\"type\":\"object\",\"properties\":{\"self\":{\"type\":\"string\"}},\"required\":[\"self\"]}},\"required\":[\"links\"]}}},\"required\":[\"appInstances\"]}}}}}},\"required\":[\"attributes\",\"description\"]}}},{\"type\":\"function\",\"function\":{\"name\":\"searchCard\",\"description\":\"Propose a query to search for a card instance filtered by type. If a card was shared with you, always prioritise search based upon the card that was last shared. If you do not have information on card module and name, do the search using the `_cardType` attribute.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"description\":{\"type\":\"string\"},\"attributes\":{\"type\":\"object\",\"properties\":{\"filter\":{\"type\":\"object\",\"properties\":{\"contains\":{\"type\":\"object\",\"properties\":{\"title\":{\"type\":\"string\",\"description\":\"title of the card\"}},\"required\":[\"title\"]},\"eq\":{\"type\":\"object\",\"properties\":{\"_cardType\":{\"type\":\"string\",\"description\":\"name of the card type\"}},\"required\":[\"_cardType\"]}}}}}},\"required\":[\"attributes\",\"description\"]}}},{\"type\":\"function\",\"function\":{\"name\":\"generateAppModule\",\"description\":\"Propose a post request to generate a new app module. Insert the module code in the 'moduleCode' property of the payload and the title for the module in the 'appTitle' property. Ensure the description explains what change you are making.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"attached_card_id\":{\"type\":\"string\",\"const\":\"http://localhost:4201/user/lukes-workspace/ProductRequirementDocument/9f816882-17e0-473f-81f2-a37381874322\"},\"description\":{\"type\":\"string\"},\"appTitle\":{\"type\":\"string\"},\"moduleCode\":{\"type\":\"string\"}},\"required\":[\"attached_card_id\",\"description\",\"appTitle\",\"moduleCode\"]}}}],\"submode\":\"interact\"}}"
398+
"data": "{\"attachedCardsEventIds\":[\"$VpJ0-QkjZZo5C2yVrgY2m9BtMSXyMJaRrfeSftTX5vU\"],\"context\":{\"openCardIds\":[\"http://localhost:4201/user/lukes-workspace/ProductRequirementDocument/9f816882-17e0-473f-81f2-a37381874322\"],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"patchCard\",\"description\":\"Propose a patch to an existing card to change its contents. Any attributes specified will be fully replaced, return the minimum required to make the change. If a relationship field value is removed, set the self property of the specific item to null. When editing a relationship array, display the full array in the patch code. Ensure the description explains what change you are making.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"description\":{\"type\":\"string\"},\"attributes\":{\"type\":\"object\",\"properties\":{\"cardId\":{\"type\":\"string\",\"const\":\"http://localhost:4201/user/lukes-workspace/ProductRequirementDocument/9f816882-17e0-473f-81f2-a37381874322\"},\"patch\":{\"type\":\"object\",\"properties\":{\"attributes\":{\"type\":\"object\",\"properties\":{\"appTitle\":{\"type\":\"string\"},\"shortDescription\":{\"type\":\"string\"},\"thumbnail\":{\"type\":\"object\",\"properties\":{\"altText\":{\"type\":\"string\"},\"height\":{\"type\":\"number\"},\"width\":{\"type\":\"number\"},\"base64\":{\"type\":\"string\"}}},\"prompt\":{\"type\":\"string\"},\"overview\":{\"type\":\"string\"},\"schema\":{\"type\":\"string\"},\"layoutAndNavigation\":{\"type\":\"string\"},\"moduleURL\":{\"type\":\"string\"},\"thumbnailURL\":{\"type\":\"string\"}}},\"relationships\":{\"type\":\"object\",\"properties\":{\"appInstances\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"links\":{\"type\":\"object\",\"properties\":{\"self\":{\"type\":\"string\"}},\"required\":[\"self\"]}},\"required\":[\"links\"]}}},\"required\":[\"appInstances\"]}}}}}},\"required\":[\"attributes\",\"description\"]}}},{\"type\":\"function\",\"function\":{\"name\":\"searchCard\",\"description\":\"Propose a query to search for a card instance filtered by type. If a card was shared with you, always prioritise search based upon the card that was last shared. If you do not have information on card module and name, do the search using the `cardType` attribute.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"description\":{\"type\":\"string\"},\"attributes\":{\"type\":\"object\",\"properties\":{\"title\":{\"type\":\"string\",\"description\":\"title of the card\"},\"cardType\":{\"type\":\"string\",\"description\":\"name of the card type\"}},\"required\":[\"cardType\"]}}},\"required\":[\"attributes\",\"description\"]}},{\"type\":\"function\",\"function\":{\"name\":\"generateAppModule\",\"description\":\"Propose a post request to generate a new app module. Insert the module code in the 'moduleCode' property of the payload and the title for the module in the 'appTitle' property. Ensure the description explains what change you are making.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"attached_card_id\":{\"type\":\"string\",\"const\":\"http://localhost:4201/user/lukes-workspace/ProductRequirementDocument/9f816882-17e0-473f-81f2-a37381874322\"},\"description\":{\"type\":\"string\"},\"appTitle\":{\"type\":\"string\"},\"moduleCode\":{\"type\":\"string\"}},\"required\":[\"attached_card_id\",\"description\",\"appTitle\",\"moduleCode\"]}}}],\"submode\":\"interact\"}}"
399399
},
400400
"origin_server_ts": 1733266550275,
401401
"unsigned": {

‎packages/ai-bot/tests/resources/chats/required-tools-multiple-messages.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@
420420
"format": "org.matrix.custom.html",
421421
"formatted_body": "<p>did you get requested to do that?</p>\n",
422422
"clientGeneratedId": "ffc42b0c-40c0-4693-b005-bcffb4bd3168",
423-
"data": "{\"attachedCardsEventIds\":[\"$zSyK_aqxFvxAeosa8ZUeSjEAG2g7pI0n1ZXb7UpNe20\"],\"context\":{\"openCardIds\":[\"http://localhost:4201/admin/new-app-card-test/MessageSender/102fe7c0-5147-44b4-ae52-b9164480d47c\"],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"patchCard\",\"description\":\"Propose a patch to an existing card to change its contents. Any attributes specified will be fully replaced, return the minimum required to make the change. If a relationship field value is removed, set the self property of the specific item to null. When editing a relationship array, display the full array in the patch code. Ensure the description explains what change you are making.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"description\":{\"type\":\"string\"},\"attributes\":{\"type\":\"object\",\"properties\":{\"cardId\":{\"type\":\"string\",\"const\":\"http://localhost:4201/admin/new-app-card-test/MessageSender/102fe7c0-5147-44b4-ae52-b9164480d47c\"},\"patch\":{\"type\":\"object\",\"properties\":{\"attributes\":{\"type\":\"object\",\"properties\":{\"roomId\":{\"type\":\"string\"},\"title\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"thumbnailURL\":{\"type\":\"string\"}}},\"relationships\":{\"type\":\"object\",\"properties\":{}}}}}}},\"required\":[\"attributes\",\"description\"]}}},{\"type\":\"function\",\"function\":{\"name\":\"searchCard\",\"description\":\"Propose a query to search for a card instance filtered by type. If a card was shared with you, always prioritise search based upon the card that was last shared. If you do not have information on card module and name, do the search using the `_cardType` attribute.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"description\":{\"type\":\"string\"},\"attributes\":{\"type\":\"object\",\"properties\":{\"filter\":{\"type\":\"object\",\"properties\":{\"contains\":{\"type\":\"object\",\"properties\":{\"title\":{\"type\":\"string\",\"description\":\"title of the card\"}},\"required\":[\"title\"]},\"eq\":{\"type\":\"object\",\"properties\":{\"_cardType\":{\"type\":\"string\",\"description\":\"name of the card type\"}},\"required\":[\"_cardType\"]}}}}}},\"required\":[\"attributes\",\"description\"]}}}],\"submode\":\"interact\"}}"
423+
"data": "{\"attachedCardsEventIds\":[\"$zSyK_aqxFvxAeosa8ZUeSjEAG2g7pI0n1ZXb7UpNe20\"],\"context\":{\"openCardIds\":[\"http://localhost:4201/admin/new-app-card-test/MessageSender/102fe7c0-5147-44b4-ae52-b9164480d47c\"],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"patchCard\",\"description\":\"Propose a patch to an existing card to change its contents. Any attributes specified will be fully replaced, return the minimum required to make the change. If a relationship field value is removed, set the self property of the specific item to null. When editing a relationship array, display the full array in the patch code. Ensure the description explains what change you are making.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"description\":{\"type\":\"string\"},\"attributes\":{\"type\":\"object\",\"properties\":{\"cardId\":{\"type\":\"string\",\"const\":\"http://localhost:4201/admin/new-app-card-test/MessageSender/102fe7c0-5147-44b4-ae52-b9164480d47c\"},\"patch\":{\"type\":\"object\",\"properties\":{\"attributes\":{\"type\":\"object\",\"properties\":{\"roomId\":{\"type\":\"string\"},\"title\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"thumbnailURL\":{\"type\":\"string\"}}},\"relationships\":{\"type\":\"object\",\"properties\":{}}}}}}},\"required\":[\"attributes\",\"description\"]}}},{\"type\":\"function\",\"function\":{\"name\":\"searchCard\",\"description\":\"Propose a query to search for a card instance filtered by type. If a card was shared with you, always prioritise search based upon the card that was last shared. If you do not have information on card module and name, do the search using the `cardType` attribute.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"description\":{\"type\":\"string\"},\"attributes\":{\"type\":\"object\",\"properties\":{\"title\":{\"type\":\"string\",\"description\":\"title of the card\"},\"cardType\":{\"type\":\"string\",\"description\":\"name of the card type\"}}}},\"required\":[\"attributes\",\"description\"]}}}],\"submode\":\"interact\"}}"
424424
},
425425
"origin_server_ts": 1734900034846,
426426
"unsigned": {
@@ -609,7 +609,7 @@
609609
"format": "org.matrix.custom.html",
610610
"formatted_body": "<p>that's alright we're testing some key things here, you were not told to but had a flag that forced it to happen. Now alert with \"testing by consent\"</p>\n",
611611
"clientGeneratedId": "39e2b952-d85a-4120-b499-27d3eebae1e1",
612-
"data": "{\"attachedCardsEventIds\":[\"$zSyK_aqxFvxAeosa8ZUeSjEAG2g7pI0n1ZXb7UpNe20\"],\"context\":{\"openCardIds\":[\"http://localhost:4201/admin/new-app-card-test/MessageSender/102fe7c0-5147-44b4-ae52-b9164480d47c\"],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"patchCard\",\"description\":\"Propose a patch to an existing card to change its contents. Any attributes specified will be fully replaced, return the minimum required to make the change. If a relationship field value is removed, set the self property of the specific item to null. When editing a relationship array, display the full array in the patch code. Ensure the description explains what change you are making.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"description\":{\"type\":\"string\"},\"attributes\":{\"type\":\"object\",\"properties\":{\"cardId\":{\"type\":\"string\",\"const\":\"http://localhost:4201/admin/new-app-card-test/MessageSender/102fe7c0-5147-44b4-ae52-b9164480d47c\"},\"patch\":{\"type\":\"object\",\"properties\":{\"attributes\":{\"type\":\"object\",\"properties\":{\"roomId\":{\"type\":\"string\"},\"title\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"thumbnailURL\":{\"type\":\"string\"}}},\"relationships\":{\"type\":\"object\",\"properties\":{}}}}}}},\"required\":[\"attributes\",\"description\"]}}},{\"type\":\"function\",\"function\":{\"name\":\"searchCard\",\"description\":\"Propose a query to search for a card instance filtered by type. If a card was shared with you, always prioritise search based upon the card that was last shared. If you do not have information on card module and name, do the search using the `_cardType` attribute.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"description\":{\"type\":\"string\"},\"attributes\":{\"type\":\"object\",\"properties\":{\"filter\":{\"type\":\"object\",\"properties\":{\"contains\":{\"type\":\"object\",\"properties\":{\"title\":{\"type\":\"string\",\"description\":\"title of the card\"}},\"required\":[\"title\"]},\"eq\":{\"type\":\"object\",\"properties\":{\"_cardType\":{\"type\":\"string\",\"description\":\"name of the card type\"}},\"required\":[\"_cardType\"]}}}}}},\"required\":[\"attributes\",\"description\"]}}}],\"submode\":\"interact\"}}"
612+
"data": "{\"attachedCardsEventIds\":[\"$zSyK_aqxFvxAeosa8ZUeSjEAG2g7pI0n1ZXb7UpNe20\"],\"context\":{\"openCardIds\":[\"http://localhost:4201/admin/new-app-card-test/MessageSender/102fe7c0-5147-44b4-ae52-b9164480d47c\"],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"patchCard\",\"description\":\"Propose a patch to an existing card to change its contents. Any attributes specified will be fully replaced, return the minimum required to make the change. If a relationship field value is removed, set the self property of the specific item to null. When editing a relationship array, display the full array in the patch code. Ensure the description explains what change you are making.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"description\":{\"type\":\"string\"},\"attributes\":{\"type\":\"object\",\"properties\":{\"cardId\":{\"type\":\"string\",\"const\":\"http://localhost:4201/admin/new-app-card-test/MessageSender/102fe7c0-5147-44b4-ae52-b9164480d47c\"},\"patch\":{\"type\":\"object\",\"properties\":{\"attributes\":{\"type\":\"object\",\"properties\":{\"roomId\":{\"type\":\"string\"},\"title\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"thumbnailURL\":{\"type\":\"string\"}}},\"relationships\":{\"type\":\"object\",\"properties\":{}}}}}}},\"required\":[\"attributes\",\"description\"]}}},{\"type\":\"function\",\"function\":{\"name\":\"searchCard\",\"description\":\"Propose a query to search for a card instance filtered by type. If a card was shared with you, always prioritise search based upon the card that was last shared. If you do not have information on card module and name, do the search using the `cardType` attribute.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"description\":{\"type\":\"string\"},\"attributes\":{\"type\":\"object\",\"properties\":{\"filter\":{\"type\":\"object\",\"properties\":{\"contains\":{\"type\":\"object\",\"properties\":{\"title\":{\"type\":\"string\",\"description\":\"title of the card\"}},\"required\":[\"title\"]},\"eq\":{\"type\":\"object\",\"properties\":{\"_cardType\":{\"type\":\"string\",\"description\":\"name of the card type\"}},\"required\":[\"_cardType\"]}}}}}},\"required\":[\"attributes\",\"description\"]}}}],\"submode\":\"interact\"}}"
613613
},
614614
"origin_server_ts": 1734900093056,
615615
"unsigned": {
@@ -685,4 +685,4 @@
685685
"user_id": "@admin:localhost",
686686
"age": 62985
687687
}
688-
]
688+
]

0 commit comments

Comments
 (0)