terse-sdk 0.1.50 → 0.1.52
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/README.md +28 -14
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -16,28 +16,42 @@ The fastest way to get started is `npm install -g terse-cli && terse init my-pro
|
|
|
16
16
|
|
|
17
17
|
## Example
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
A Terse workflow is a single TypeScript file. The job below watches a repo for new pull requests, posts a deterministic Slack message, then threads an agent-written summary under it:
|
|
20
20
|
|
|
21
21
|
```ts
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
import { Triggers } from "./terse.generated"
|
|
22
|
+
import { GithubPRTrigger, TerseAgent, createJob } from "terse-sdk"
|
|
23
|
+
import { Repos, Skills, SlackChannel, Triggers } from "../terse.generated"
|
|
24
|
+
// ^^ Generated based on your workspace
|
|
26
25
|
|
|
27
26
|
createJob({
|
|
28
|
-
name: "
|
|
29
|
-
triggers: [Triggers.
|
|
30
|
-
onTrigger: async (event) => {
|
|
27
|
+
name: "Summarize PR and send slack message",
|
|
28
|
+
triggers: [Triggers.github.onPROpened({ repo: Repos.TerseAI.Terse })],
|
|
29
|
+
onTrigger: async (event: GithubPRTrigger) => {
|
|
30
|
+
// Create durable Agents
|
|
31
|
+
const prompt = "Summarize the incoming PR and send to slack. Format the summary in Block Kit; include screenshots or diagrams from the PR as image blocks."
|
|
31
32
|
const agent = TerseAgent.create({
|
|
32
|
-
prompt
|
|
33
|
-
skills: [
|
|
33
|
+
prompt,
|
|
34
|
+
skills: [
|
|
35
|
+
// Fine tune what agents have access to. Impossible to modify anything outside of this scope
|
|
36
|
+
Skills.github({ repos: [Repos.TerseAI.Terse] }),
|
|
37
|
+
Skills.slack({ channel: SlackChannel.AllTerseInc })
|
|
38
|
+
]
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
// deterministically call a tool
|
|
42
|
+
const message = await agent.tools.slack.sendMessage({
|
|
43
|
+
channelId: SlackChannel.AllTerseInc.channelId,
|
|
44
|
+
message: "New PR from " + event.sender.login + "!"
|
|
34
45
|
})
|
|
35
46
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}))
|
|
47
|
+
// Outputs are strongly typed
|
|
48
|
+
const parentId = message.message_ts
|
|
39
49
|
|
|
40
|
-
|
|
50
|
+
// Trigger the Agent with Github + Slack tools auto added
|
|
51
|
+
await agent.runAndWait(`
|
|
52
|
+
Summarize this PR ${event.formatForAgentRunner()}.
|
|
53
|
+
Keep it short. Reply in a thread to the Slack message (thread parent ts: ${parentId}).
|
|
54
|
+
`)
|
|
41
55
|
}
|
|
42
56
|
})
|
|
43
57
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "terse-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.52",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"repository": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"zod": "^4.3.6"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"terse-types": "0.0.
|
|
26
|
+
"terse-types": "0.0.47"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build": "tsc",
|