@botpress/adk 1.19.0-beta.9 → 2.0.0-alpha.0
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.
- package/dist/agent-init/agent-project-generator.d.ts +5 -1
- package/dist/agent-init/agent-project-generator.d.ts.map +1 -1
- package/dist/agent-project/agent-project.d.ts +3 -3
- package/dist/agent-project/agent-project.d.ts.map +1 -1
- package/dist/agent-project/agent-resolver.d.ts.map +1 -1
- package/dist/agent-project/config-writer.d.ts +1 -1
- package/dist/agent-project/dependency-state-to-dependencies.d.ts +11 -0
- package/dist/agent-project/dependency-state-to-dependencies.d.ts.map +1 -0
- package/dist/agent-project/types.d.ts +9 -4
- package/dist/agent-project/types.d.ts.map +1 -1
- package/dist/agent0/capabilities/commands/adk-build.md +6 -5
- package/dist/agent0/capabilities/commands/adk-debug.md +1 -1
- package/dist/agent0/capabilities/commands/adk-dev-console.md +1 -1
- package/dist/agent0/capabilities/commands/adk-document.md +10 -2
- package/dist/agent0/capabilities/commands/adk-eval.md +1 -1
- package/dist/agent0/capabilities/commands/adk-explain.md +2 -2
- package/dist/agent0/capabilities/commands/adk-init.md +2 -2
- package/dist/agent0/capabilities/commands/adk-ship.md +1 -1
- package/dist/agent0/capabilities/commands/adk-test.md +3 -3
- package/dist/agent0/capabilities/commands/adk-validate.md +3 -3
- package/dist/agent0/capabilities/skills/adk/SKILL.md +21 -21
- package/dist/agent0/capabilities/skills/adk/references/actions.md +245 -239
- package/dist/agent0/capabilities/skills/adk/references/advanced-patterns.md +185 -218
- package/dist/agent0/capabilities/skills/adk/references/agent-config.md +74 -71
- package/dist/agent0/capabilities/skills/adk/references/assets.md +45 -48
- package/dist/agent0/capabilities/skills/adk/references/autonomous-execution.md +40 -46
- package/dist/agent0/capabilities/skills/adk/references/cli.md +17 -7
- package/dist/agent0/capabilities/skills/adk/references/context-api.md +98 -94
- package/dist/agent0/capabilities/skills/adk/references/conversation-lifecycle.md +65 -62
- package/dist/agent0/capabilities/skills/adk/references/conversations.md +395 -385
- package/dist/agent0/capabilities/skills/adk/references/custom-components.md +1 -1
- package/dist/agent0/capabilities/skills/adk/references/desk.md +236 -234
- package/dist/agent0/capabilities/skills/adk/references/explain-config.md +54 -37
- package/dist/agent0/capabilities/skills/adk/references/files.md +301 -306
- package/dist/agent0/capabilities/skills/adk/references/integration-actions.md +211 -214
- package/dist/agent0/capabilities/skills/adk/references/integrations.md +33 -31
- package/dist/agent0/capabilities/skills/adk/references/interfaces.md +13 -12
- package/dist/agent0/capabilities/skills/adk/references/knowledge-bases.md +98 -111
- package/dist/agent0/capabilities/skills/adk/references/mcp-server.md +6 -0
- package/dist/agent0/capabilities/skills/adk/references/messages.md +280 -256
- package/dist/agent0/capabilities/skills/adk/references/model-configuration.md +52 -49
- package/dist/agent0/capabilities/skills/adk/references/patterns-mistakes.md +102 -101
- package/dist/agent0/capabilities/skills/adk/references/plugins.md +15 -15
- package/dist/agent0/capabilities/skills/adk/references/tables.md +204 -210
- package/dist/agent0/capabilities/skills/adk/references/tags.md +141 -143
- package/dist/agent0/capabilities/skills/adk/references/tools.md +191 -199
- package/dist/agent0/capabilities/skills/adk/references/triggers.md +331 -336
- package/dist/agent0/capabilities/skills/adk/references/workflow-steps.md +132 -96
- package/dist/agent0/capabilities/skills/adk/references/workflows.md +479 -464
- package/dist/agent0/capabilities/skills/adk/references/zai-agent-reference.md +127 -129
- package/dist/agent0/capabilities/skills/adk/references/zai-complete-guide.md +255 -276
- package/dist/agent0/capabilities/skills/adk-debugger/SKILL.md +21 -17
- package/dist/agent0/capabilities/skills/adk-debugger/references/common-failures.md +25 -25
- package/dist/agent0/capabilities/skills/adk-debugger/references/conversation-analysis.md +49 -41
- package/dist/agent0/capabilities/skills/adk-debugger/references/debug-workflow.md +20 -14
- package/dist/agent0/capabilities/skills/adk-debugger/references/llm-debugging.md +13 -13
- package/dist/agent0/capabilities/skills/adk-debugger/references/trace-summarization.md +18 -18
- package/dist/agent0/capabilities/skills/adk-debugger/references/traces-and-logs.md +67 -67
- package/dist/agent0/capabilities/skills/adk-dev-console/SKILL.md +36 -36
- package/dist/agent0/capabilities/skills/adk-dev-console/references/agent-steps.md +14 -6
- package/dist/agent0/capabilities/skills/adk-dev-console/references/multi-agent-dashboard.md +13 -13
- package/dist/agent0/capabilities/skills/adk-dev-console/references/pages.md +18 -0
- package/dist/agent0/capabilities/skills/adk-docs/SKILL.md +13 -13
- package/dist/agent0/capabilities/skills/adk-docs/references/doc-standards.md +15 -0
- package/dist/agent0/capabilities/skills/adk-evals/SKILL.md +29 -23
- package/dist/agent0/capabilities/skills/adk-evals/references/eval-format.md +31 -23
- package/dist/agent0/capabilities/skills/adk-evals/references/test-patterns.md +25 -36
- package/dist/agent0/capabilities/skills/adk-evals/references/testing-workflow.md +6 -4
- package/dist/agent0/index.js +41 -19
- package/dist/agent0/index.js.map +7 -7
- package/dist/agent0/runtime/client.d.ts +2 -0
- package/dist/agent0/runtime/client.d.ts.map +1 -1
- package/dist/agent0/runtime/engine.d.ts +2 -1
- package/dist/agent0/runtime/engine.d.ts.map +1 -1
- package/dist/agent0/runtime/process.d.ts +1 -0
- package/dist/agent0/runtime/process.d.ts.map +1 -1
- package/dist/assets/manager.d.ts +3 -0
- package/dist/assets/manager.d.ts.map +1 -1
- package/dist/auth/credentials.d.ts +1 -1
- package/dist/bot-generator/generator.d.ts +22 -0
- package/dist/bot-generator/generator.d.ts.map +1 -1
- package/dist/bot-generator/plugin-sync.d.ts.map +1 -1
- package/dist/commands/base-command.d.ts +1 -0
- package/dist/commands/base-command.d.ts.map +1 -1
- package/dist/commands/bp-dev-command.d.ts +1 -1
- package/dist/commands/bp-dev-command.d.ts.map +1 -1
- package/dist/commands/bp-dev-stderr.d.ts +9 -0
- package/dist/commands/bp-dev-stderr.d.ts.map +1 -1
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/dependencies/catalog/catalog-service.d.ts +53 -0
- package/dist/dependencies/catalog/catalog-service.d.ts.map +1 -0
- package/dist/dependencies/catalog/client-factory.d.ts +33 -0
- package/dist/dependencies/catalog/client-factory.d.ts.map +1 -0
- package/dist/dependencies/catalog/integration-source.d.ts +34 -0
- package/dist/dependencies/catalog/integration-source.d.ts.map +1 -0
- package/dist/dependencies/catalog/interface-source.d.ts +23 -0
- package/dist/dependencies/catalog/interface-source.d.ts.map +1 -0
- package/dist/dependencies/catalog/plugin-source.d.ts +49 -0
- package/dist/dependencies/catalog/plugin-source.d.ts.map +1 -0
- package/dist/dependencies/catalog/resolution-cache.d.ts +76 -0
- package/dist/dependencies/catalog/resolution-cache.d.ts.map +1 -0
- package/dist/dependencies/dependency-manager.d.ts +31 -16
- package/dist/dependencies/dependency-manager.d.ts.map +1 -1
- package/dist/dependencies/errors.d.ts +2 -2
- package/dist/dependencies/errors.d.ts.map +1 -1
- package/dist/dependencies/index.d.ts +5 -4
- package/dist/dependencies/index.d.ts.map +1 -1
- package/dist/dependencies/index.js +2089 -1670
- package/dist/dependencies/index.js.map +37 -30
- package/dist/dependencies/legacy-lock-file.d.ts +15 -0
- package/dist/dependencies/legacy-lock-file.d.ts.map +1 -0
- package/dist/dependencies/migration.d.ts +19 -0
- package/dist/dependencies/migration.d.ts.map +1 -1
- package/dist/dependencies/resolvers/integration-resolver.d.ts +4 -3
- package/dist/dependencies/resolvers/integration-resolver.d.ts.map +1 -1
- package/dist/dependencies/resolvers/plugin-resolver.d.ts +4 -4
- package/dist/dependencies/resolvers/plugin-resolver.d.ts.map +1 -1
- package/dist/dependencies/snapshot-store.d.ts +59 -0
- package/dist/dependencies/snapshot-store.d.ts.map +1 -0
- package/dist/dependencies/status-resolver.d.ts +36 -0
- package/dist/dependencies/status-resolver.d.ts.map +1 -0
- package/dist/dependencies/status.d.ts +214 -0
- package/dist/dependencies/status.d.ts.map +1 -0
- package/dist/dependencies/types.d.ts +380 -29
- package/dist/dependencies/types.d.ts.map +1 -1
- package/dist/file-watcher/watcher.d.ts +21 -5
- package/dist/file-watcher/watcher.d.ts.map +1 -1
- package/dist/generators/action-types.d.ts.map +1 -1
- package/dist/generators/client-wrapper.d.ts.map +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3134 -2226
- package/dist/index.js.map +55 -48
- package/dist/integrations/config-utils.d.ts +11 -7
- package/dist/integrations/config-utils.d.ts.map +1 -1
- package/dist/integrations/hub-cache.d.ts +0 -58
- package/dist/integrations/hub-cache.d.ts.map +1 -1
- package/dist/integrations/index.d.ts +1 -3
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/manager.d.ts +19 -53
- package/dist/integrations/manager.d.ts.map +1 -1
- package/dist/interfaces/enhanced-cache.d.ts +7 -7
- package/dist/interfaces/enhanced-cache.d.ts.map +1 -1
- package/dist/interfaces/manager.d.ts +11 -17
- package/dist/interfaces/manager.d.ts.map +1 -1
- package/dist/knowledge/manager.d.ts +3 -0
- package/dist/knowledge/manager.d.ts.map +1 -1
- package/dist/plugins/index.d.ts +0 -1
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/manager.d.ts +16 -48
- package/dist/plugins/manager.d.ts.map +1 -1
- package/dist/preflight/checker.d.ts +6 -1
- package/dist/preflight/checker.d.ts.map +1 -1
- package/dist/preflight/dependency-gate.d.ts +37 -0
- package/dist/preflight/dependency-gate.d.ts.map +1 -0
- package/dist/preflight/index.d.ts +2 -1
- package/dist/preflight/index.d.ts.map +1 -1
- package/dist/preflight/types.d.ts +18 -0
- package/dist/preflight/types.d.ts.map +1 -1
- package/dist/runner/script-runner.d.ts.map +1 -1
- package/dist/tables/table-manager.d.ts +3 -0
- package/dist/tables/table-manager.d.ts.map +1 -1
- package/dist/templates/README.md +23 -13
- package/dist/templates/blank/agent.config.ts +3 -3
- package/dist/templates/blank/src/triggers/index.ts +1 -1
- package/dist/templates/botpress-desk/evals/index.eval.ts +1 -1
- package/dist/templates/botpress-desk/src/triggers/index.ts +1 -1
- package/dist/templates/crm-enrichment/README.md +3 -3
- package/dist/templates/crm-enrichment/agent.config.ts +2 -2
- package/dist/templates/crm-enrichment/src/conversations/index.ts +1 -1
- package/dist/templates/hello-world/agent.config.ts +3 -3
- package/dist/templates/hello-world/src/triggers/index.ts +1 -1
- package/dist/templates/knowledge-assistant/src/triggers/index.ts +1 -1
- package/dist/templates/template.config.json +3 -3
- package/dist/utils/ids.d.ts +10 -0
- package/dist/utils/ids.d.ts.map +1 -1
- package/dist/workspace/workspace-cache.d.ts +2 -1
- package/dist/workspace/workspace-cache.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/agent-project/lock-to-dependencies.d.ts +0 -11
- package/dist/agent-project/lock-to-dependencies.d.ts.map +0 -1
- package/dist/dependencies/lock-file.d.ts +0 -15
- package/dist/dependencies/lock-file.d.ts.map +0 -1
- package/dist/integrations/enhanced-cache.d.ts +0 -53
- package/dist/integrations/enhanced-cache.d.ts.map +0 -1
- package/dist/plugins/enhanced-cache.d.ts +0 -53
- package/dist/plugins/enhanced-cache.d.ts.map +0 -1
- package/dist/templates/blank/package.json +0 -17
- package/dist/templates/blank/tsconfig.json +0 -25
- package/dist/templates/botpress-desk/package.json +0 -17
- package/dist/templates/crm-enrichment/package.json +0 -18
- package/dist/templates/crm-enrichment/tsconfig.json +0 -25
- package/dist/templates/hello-world/package.json +0 -18
- package/dist/templates/hello-world/tsconfig.json +0 -25
- package/dist/templates/knowledge-assistant/package.json +0 -18
- package/dist/templates/knowledge-assistant/tsconfig.json +0 -25
- package/dist/templates/slack-triage/package.json +0 -18
- package/dist/templates/slack-triage/tsconfig.json +0 -25
|
@@ -9,19 +9,19 @@ For basic conversation setup, channel routing, and handler parameters, see **[co
|
|
|
9
9
|
Add a `lifecycle` object to any Conversation definition. Durations use `ms`-compatible strings (`"30s"`, `"5m"`, `"1h"`, `"1d"`).
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
import { Conversation, z } from
|
|
12
|
+
import { Conversation, z } from '@botpress/runtime'
|
|
13
13
|
|
|
14
14
|
export const Chat = new Conversation({
|
|
15
|
-
channel:
|
|
15
|
+
channel: 'webchat.channel',
|
|
16
16
|
|
|
17
17
|
lifecycle: {
|
|
18
18
|
nudge: {
|
|
19
|
-
after:
|
|
20
|
-
interval:
|
|
21
|
-
max: 3,
|
|
19
|
+
after: '5m', // First nudge fires 5 min after last user message
|
|
20
|
+
interval: '10m', // Subsequent nudges fire every 10 min
|
|
21
|
+
max: 3, // Stop after 3 nudges (omit for unlimited)
|
|
22
22
|
},
|
|
23
23
|
expire: {
|
|
24
|
-
after:
|
|
24
|
+
after: '1h', // Session expires 1 hour after last user message
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
|
|
@@ -32,17 +32,17 @@ export const Chat = new Conversation({
|
|
|
32
32
|
handler: async (props) => {
|
|
33
33
|
// handler receives nudge and expire events alongside regular messages
|
|
34
34
|
},
|
|
35
|
-
})
|
|
35
|
+
})
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
### Configuration Fields
|
|
39
39
|
|
|
40
|
-
| Field
|
|
41
|
-
|
|
42
|
-
| `nudge.after`
|
|
43
|
-
| `nudge.interval` | `string` | No
|
|
44
|
-
| `nudge.max`
|
|
45
|
-
| `expire.after`
|
|
40
|
+
| Field | Type | Required | Description |
|
|
41
|
+
| ---------------- | -------- | --------------- | ---------------------------------------------------------------------- |
|
|
42
|
+
| `nudge.after` | `string` | Yes (if nudge) | Duration of silence before the first nudge fires |
|
|
43
|
+
| `nudge.interval` | `string` | No | Duration between subsequent nudges. Defaults to `nudge.after` |
|
|
44
|
+
| `nudge.max` | `number` | No | Max nudges per session. Must be a positive integer. Omit for unlimited |
|
|
45
|
+
| `expire.after` | `string` | Yes (if expire) | Duration of silence before the session expires |
|
|
46
46
|
|
|
47
47
|
Nudge and expire are independent -- you can configure either or both.
|
|
48
48
|
|
|
@@ -52,35 +52,35 @@ When lifecycle is enabled, the conversation handler receives two additional even
|
|
|
52
52
|
|
|
53
53
|
```typescript
|
|
54
54
|
handler: async ({ type, conversation, state, execute }) => {
|
|
55
|
-
if (type ===
|
|
55
|
+
if (type === 'nudge') {
|
|
56
56
|
// User has been silent -- send a re-engagement message
|
|
57
57
|
await conversation.send({
|
|
58
|
-
type:
|
|
59
|
-
payload: { text:
|
|
60
|
-
})
|
|
61
|
-
return
|
|
58
|
+
type: 'text',
|
|
59
|
+
payload: { text: 'Still there? Let me know if you need anything.' },
|
|
60
|
+
})
|
|
61
|
+
return
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
if (type ===
|
|
64
|
+
if (type === 'expire') {
|
|
65
65
|
// Session is about to be torn down -- send a farewell
|
|
66
66
|
await conversation.send({
|
|
67
|
-
type:
|
|
68
|
-
payload: { text:
|
|
69
|
-
})
|
|
67
|
+
type: 'text',
|
|
68
|
+
payload: { text: 'This session has expired. Send a new message to start fresh.' },
|
|
69
|
+
})
|
|
70
70
|
// After the handler returns, the runtime automatically:
|
|
71
71
|
// 1. Cancels all active workflows on the conversation
|
|
72
72
|
// 2. Tags the conversation with sessionExpired = "true"
|
|
73
73
|
// 3. Resets conversation state to defaults
|
|
74
74
|
// 4. Clears the transcript
|
|
75
75
|
// 5. Sets lifecycle status to "expired"
|
|
76
|
-
return
|
|
76
|
+
return
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
if (type ===
|
|
79
|
+
if (type === 'message') {
|
|
80
80
|
// Normal message handling
|
|
81
81
|
await execute({
|
|
82
|
-
instructions:
|
|
83
|
-
})
|
|
82
|
+
instructions: 'You are a helpful assistant',
|
|
83
|
+
})
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
```
|
|
@@ -88,10 +88,12 @@ handler: async ({ type, conversation, state, execute }) => {
|
|
|
88
88
|
### Handler Props by Type
|
|
89
89
|
|
|
90
90
|
When `type === "nudge"`:
|
|
91
|
+
|
|
91
92
|
- `event` is typed as `LifecycleNudgeEventType` with payload `{ conversationId, sessionId, scheduledAt }`
|
|
92
93
|
- `message` is `undefined`
|
|
93
94
|
|
|
94
95
|
When `type === "expire"`:
|
|
96
|
+
|
|
95
97
|
- `event` is typed as `LifecycleExpireEventType` with payload `{ conversationId, sessionId, scheduledAt }`
|
|
96
98
|
- `message` is `undefined`
|
|
97
99
|
|
|
@@ -103,28 +105,28 @@ Lifecycle-enabled conversations expose a read-only `conversation.session` proper
|
|
|
103
105
|
|
|
104
106
|
```typescript
|
|
105
107
|
handler: async ({ type, conversation }) => {
|
|
106
|
-
const session = conversation.session
|
|
107
|
-
if (!session) return
|
|
108
|
-
|
|
109
|
-
console.log(session.id)
|
|
110
|
-
console.log(session.number)
|
|
111
|
-
console.log(session.status)
|
|
112
|
-
console.log(session.startedAt)
|
|
113
|
-
console.log(session.lastActivityAt)
|
|
114
|
-
console.log(session.nudgeCount)
|
|
108
|
+
const session = conversation.session
|
|
109
|
+
if (!session) return // undefined when lifecycle is not configured
|
|
110
|
+
|
|
111
|
+
console.log(session.id) // ULID identifying the current session
|
|
112
|
+
console.log(session.number) // Monotonically increasing (1, 2, 3...)
|
|
113
|
+
console.log(session.status) // "active" or "expired"
|
|
114
|
+
console.log(session.startedAt) // ISO timestamp
|
|
115
|
+
console.log(session.lastActivityAt) // ISO timestamp of last user message
|
|
116
|
+
console.log(session.nudgeCount) // Number of nudges fired this session
|
|
115
117
|
}
|
|
116
118
|
```
|
|
117
119
|
|
|
118
120
|
### Session Fields
|
|
119
121
|
|
|
120
|
-
| Field
|
|
121
|
-
|
|
122
|
-
| `id`
|
|
123
|
-
| `number`
|
|
124
|
-
| `status`
|
|
125
|
-
| `startedAt`
|
|
126
|
-
| `lastActivityAt` | `string`
|
|
127
|
-
| `nudgeCount`
|
|
122
|
+
| Field | Type | Description |
|
|
123
|
+
| ---------------- | ----------------------- | ------------------------------------------------------------ |
|
|
124
|
+
| `id` | `string` | ULID unique to the current session |
|
|
125
|
+
| `number` | `number` | Session counter, increments on each expiration (starts at 1) |
|
|
126
|
+
| `status` | `"active" \| "expired"` | Current session status |
|
|
127
|
+
| `startedAt` | `string` | ISO timestamp when this session began |
|
|
128
|
+
| `lastActivityAt` | `string` | ISO timestamp of the last user message |
|
|
129
|
+
| `nudgeCount` | `number` | Number of nudges delivered in this session |
|
|
128
130
|
|
|
129
131
|
## How Timers Work
|
|
130
132
|
|
|
@@ -161,6 +163,7 @@ This means every user message resets the clock. Timers always measure silence fr
|
|
|
161
163
|
### Session Renewal
|
|
162
164
|
|
|
163
165
|
When a message arrives on an expired session:
|
|
166
|
+
|
|
164
167
|
1. A new `sessionId` (ULID) is generated
|
|
165
168
|
2. `sessionNumber` increments
|
|
166
169
|
3. `nudgeCount` resets to 0
|
|
@@ -175,15 +178,15 @@ Lifecycle automatically manages these tags without any user configuration:
|
|
|
175
178
|
|
|
176
179
|
### Conversation Tags
|
|
177
180
|
|
|
178
|
-
| Tag
|
|
179
|
-
|
|
181
|
+
| Tag | Description |
|
|
182
|
+
| ---------------- | ---------------------------------------------------------- |
|
|
180
183
|
| `sessionExpired` | Set to `"true"` when a session expires. Cleared on renewal |
|
|
181
184
|
|
|
182
185
|
### Message Tags
|
|
183
186
|
|
|
184
|
-
| Tag
|
|
185
|
-
|
|
186
|
-
| `sessionId`
|
|
187
|
+
| Tag | Description |
|
|
188
|
+
| --------------- | -------------------------------------------------------- |
|
|
189
|
+
| `sessionId` | ULID of the session this message belongs to |
|
|
187
190
|
| `sessionNumber` | Session sequence number at the time the message was sent |
|
|
188
191
|
|
|
189
192
|
Message tags are applied automatically to both incoming user messages and outgoing bot messages. They enable grouping messages by session.
|
|
@@ -204,26 +207,26 @@ Use `conversation.session.nudgeCount` to vary the message urgency:
|
|
|
204
207
|
|
|
205
208
|
```typescript
|
|
206
209
|
handler: async ({ type, conversation }) => {
|
|
207
|
-
if (type ===
|
|
208
|
-
const count = conversation.session?.nudgeCount ?? 0
|
|
210
|
+
if (type === 'nudge') {
|
|
211
|
+
const count = conversation.session?.nudgeCount ?? 0
|
|
209
212
|
|
|
210
213
|
if (count === 1) {
|
|
211
214
|
await conversation.send({
|
|
212
|
-
type:
|
|
213
|
-
payload: { text:
|
|
214
|
-
})
|
|
215
|
+
type: 'text',
|
|
216
|
+
payload: { text: 'Just checking in -- do you still need help?' },
|
|
217
|
+
})
|
|
215
218
|
} else if (count === 2) {
|
|
216
219
|
await conversation.send({
|
|
217
|
-
type:
|
|
220
|
+
type: 'text',
|
|
218
221
|
payload: { text: "I'm still here if you need me." },
|
|
219
|
-
})
|
|
222
|
+
})
|
|
220
223
|
} else {
|
|
221
224
|
await conversation.send({
|
|
222
|
-
type:
|
|
225
|
+
type: 'text',
|
|
223
226
|
payload: { text: "This conversation will expire soon if there's no activity." },
|
|
224
|
-
})
|
|
227
|
+
})
|
|
225
228
|
}
|
|
226
|
-
return
|
|
229
|
+
return
|
|
227
230
|
}
|
|
228
231
|
// ... handle messages
|
|
229
232
|
}
|
|
@@ -235,17 +238,17 @@ Send a session summary before the session is torn down:
|
|
|
235
238
|
|
|
236
239
|
```typescript
|
|
237
240
|
handler: async ({ type, conversation, state, execute }) => {
|
|
238
|
-
if (type ===
|
|
241
|
+
if (type === 'expire') {
|
|
239
242
|
if (state.topic) {
|
|
240
243
|
await conversation.send({
|
|
241
|
-
type:
|
|
244
|
+
type: 'text',
|
|
242
245
|
payload: {
|
|
243
246
|
text: `Session expired. You were working on: ${state.topic}. Send a message to start a new session.`,
|
|
244
247
|
},
|
|
245
|
-
})
|
|
248
|
+
})
|
|
246
249
|
}
|
|
247
250
|
// State will be reset after this handler returns
|
|
248
|
-
return
|
|
251
|
+
return
|
|
249
252
|
}
|
|
250
253
|
// ... handle messages
|
|
251
254
|
}
|