-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Save command-result card to workspace (#1647)
* can copy to workspace * update realm url selection * handling null message content * style results isolated template * fix arrow in copy button * update realm url selection * resolve bot error * revert changes no longer needed * fix typo * clean up * updating tests * fix messages missing content * fix getting attached resources * update tests * use CommandObjectField type * updating realmURL fallback behavior * update stackIndex logic * update comment * add test for when no cards are open in stack * fix cropped search icon * update template for CommandObjectField * fix lint error
- Loading branch information
1 parent
e1bc789
commit 9db69e0
Showing
20 changed files
with
604 additions
and
177 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,51 @@ | ||
import { | ||
CardDef, | ||
Component, | ||
FieldDef, | ||
StringField, | ||
contains, | ||
field, | ||
primitive, | ||
queryableValue, | ||
} from './card-api'; | ||
import { CommandResult } from './command-result'; | ||
|
||
type JSONValue = string | number | boolean | null | JSONObject | [JSONValue]; | ||
export type CommandStatus = 'applied' | 'ready'; | ||
|
||
type JSONObject = { [x: string]: JSONValue }; | ||
class CommandStatusField extends StringField { | ||
static [primitive]: CommandStatus; | ||
} | ||
|
||
type CommandObject = JSONObject; | ||
class CommandObjectFieldTemplate extends Component<typeof CommandObjectField> { | ||
<template> | ||
<pre>{{this.stringValue}}</pre> | ||
<style scoped> | ||
pre { | ||
margin: 0; | ||
white-space: pre-wrap; | ||
} | ||
</style> | ||
</template> | ||
|
||
class CommandObjectField extends FieldDef { | ||
static [primitive]: CommandObject; | ||
get stringValue() { | ||
return JSON.stringify(this.args.model, null, 2); | ||
} | ||
} | ||
|
||
export type CommandStatus = 'applied' | 'ready'; | ||
|
||
class CommandStatusField extends FieldDef { | ||
static [primitive]: CommandStatus; | ||
export class CommandObjectField extends FieldDef { | ||
static [primitive]: Record<string, any>; | ||
static [queryableValue](value: Record<string, any> | undefined) { | ||
return Boolean(value) && typeof value === 'object' | ||
? JSON.stringify(value) | ||
: undefined; | ||
} | ||
static edit = CommandObjectFieldTemplate; | ||
static embedded = CommandObjectFieldTemplate; | ||
} | ||
|
||
export class CommandField extends CardDef { | ||
export class CommandCard extends CardDef { | ||
@field toolCallId = contains(StringField); | ||
@field name = contains(StringField); | ||
@field payload = contains(CommandObjectField); //arguments of toolCall. Its not called arguments due to lint | ||
@field eventId = contains(StringField); | ||
@field status = contains(CommandStatusField); | ||
@field result = contains(CommandResult); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion
2
packages/boxel-ui/addon/raw-icons/search.svg → ...-ui/addon/raw-icons/icon-search-thick.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.