-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathtaskfile.yaml
More file actions
73 lines (67 loc) · 2.4 KB
/
taskfile.yaml
File metadata and controls
73 lines (67 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
version: "3"
dotenv: [".env.local"]
vars:
INDENT: 4
REL_PATH: "{{ relPath .USER_WORKING_DIR .ROOT_DIR }}"
VENV_DIR: ".venv"
NODE_MAIN: '{{ joinPath "./src" "main.ts" }}'
tasks:
post_create:
desc: "Runs after this template is instantiated as a Sandbox or Bootstrap"
cmds:
- echo 'Your agent has been created!'
- echo 'To run the new agent locally:'
- echo ''
- echo '{{ indent .INDENT "cd" }} {{ .REL_PATH }}'
- echo '{{ indent .INDENT "pnpm install" }}'
- echo '{{ indent .INDENT "pnpm download-files" }}'
- echo '{{ indent .INDENT "pnpm dev" }}'
- echo ''
- task: help_open_web_console
- echo 'To deploy your agent to LiveKit cloud:'
- echo ''
- echo '{{ indent .INDENT "lk agent deploy" }}'
- echo ''
- task: set_agent_name_if_present
- task: help_open_sandbox_if_present
set_agent_name_if_present:
desc: "When LIVEKIT_AGENT_NAME is set, configure the agent to use it on init"
status:
- test -z "$LIVEKIT_AGENT_NAME"
cmds:
- |
old="agentName: 'my-agent'"
new="agentName: '{{ .LIVEKIT_AGENT_NAME }}'"
file="{{ .NODE_MAIN }}"
tmp="$(mktemp)"
while IFS= read -r line; do
printf '%s\n' "${line//$old/$new}" >> "$tmp"
done < "$file"
mv "$tmp" "$file"
help_open_web_console:
status:
- test -z "$LIVEKIT_AGENT_NAME"
vars:
CONSOLE_URL: "https://cloud.livekit.io/projects/p_/agents/console"
CONSOLE_LINK: '{{ print "\x1b]8;;" .CONSOLE_URL "/?autoStart=true&agentName=" .LIVEKIT_AGENT_NAME "\x1b\\\x1b[36;4m" .CONSOLE_URL "/?autoStart=true&agentName=" .LIVEKIT_AGENT_NAME "\x1b[0m\x1b]8;;\x1b\\" }}'
cmds:
- echo 'Then open the web console:'
- echo ''
- echo '{{ indent .INDENT .CONSOLE_LINK }}'
- echo ''
help_open_sandbox_if_present:
desc: "When LIVEKIT_SANDBOX_ID is set, print the URL to open it"
status:
- test -z "$LIVEKIT_SANDBOX_ID"
vars:
SANDBOX_URL: 'https://{{ .LIVEKIT_SANDBOX_ID }}.sandbox.livekit.io'
SANDBOX_LINK: '{{ print "\x1b]8;;" .SANDBOX_URL "\x1b\\\x1b[36;4m" .SANDBOX_URL "\x1b[0m\x1b]8;;\x1b\\" }}'
cmds:
- echo 'To chat with your running agent, visit:'
- echo ''
- echo '{{ indent .INDENT .SANDBOX_LINK }}'
- echo ''
install:
desc: "Bootstrap application for local development"
cmds:
- "pnpm install"