terse-cli 0.1.46 → 0.1.48
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/api.d.ts +0 -2
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +2 -2
- package/dist/api.js.map +1 -1
- package/dist/cliError.d.ts +2 -3
- package/dist/cliError.d.ts.map +1 -1
- package/dist/cliError.js +2 -2
- package/dist/cliError.js.map +1 -1
- package/dist/commands/auth.d.ts +0 -5
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +2 -2
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +14 -1
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/test.d.ts +0 -35
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +1 -1
- package/dist/commands/test.js.map +1 -1
- package/dist/env.d.ts +0 -2
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +1 -1
- package/dist/env.js.map +1 -1
- package/dist/projectConfig.d.ts +0 -1
- package/dist/projectConfig.d.ts.map +1 -1
- package/dist/projectConfig.js +1 -1
- package/dist/projectConfig.js.map +1 -1
- package/dist/providers/LanguageProvider.d.ts +1 -1
- package/dist/providers/LanguageProvider.d.ts.map +1 -1
- package/dist/providers/codegenTypes.d.ts +18 -9
- package/dist/providers/codegenTypes.d.ts.map +1 -1
- package/dist/providers/fetchSdkVersion.d.ts +1 -3
- package/dist/providers/fetchSdkVersion.d.ts.map +1 -1
- package/dist/providers/fetchSdkVersion.js +2 -2
- package/dist/providers/fetchSdkVersion.js.map +1 -1
- package/dist/providers/resolveProvider.d.ts +0 -1
- package/dist/providers/resolveProvider.d.ts.map +1 -1
- package/dist/providers/resolveProvider.js +4 -20
- package/dist/providers/resolveProvider.js.map +1 -1
- package/dist/providers/shared/sessionStream.d.ts +0 -4
- package/dist/providers/shared/sessionStream.d.ts.map +1 -1
- package/dist/providers/shared/sessionStream.js +1 -1
- package/dist/providers/shared/sessionStream.js.map +1 -1
- package/dist/providers/shared/shellUtils.d.ts +0 -11
- package/dist/providers/shared/shellUtils.d.ts.map +1 -1
- package/dist/providers/shared/shellUtils.js +0 -44
- package/dist/providers/shared/shellUtils.js.map +1 -1
- package/dist/providers/templateUtils.d.ts +0 -2
- package/dist/providers/templateUtils.d.ts.map +1 -1
- package/dist/providers/templateUtils.js +2 -2
- package/dist/providers/templateUtils.js.map +1 -1
- package/dist/providers/typescript/TypeScriptProvider.d.ts +2 -1
- package/dist/providers/typescript/TypeScriptProvider.d.ts.map +1 -1
- package/dist/providers/typescript/TypeScriptProvider.js +1 -1
- package/dist/providers/typescript/TypeScriptProvider.js.map +1 -1
- package/dist/providers/typescript/prepareCodegenData.d.ts +25 -23
- package/dist/providers/typescript/prepareCodegenData.d.ts.map +1 -1
- package/dist/providers/typescript/prepareCodegenData.js +35 -5
- package/dist/providers/typescript/prepareCodegenData.js.map +1 -1
- package/package.json +3 -3
- package/templates/typescript/codegen/generated.hbs +1 -0
- package/templates/typescript/codegen/partials/hey-reach-section.hbs +3 -0
- package/templates/typescript/codegen/partials/triggers-section.hbs +52 -0
- package/templates/python/codegen/generated.hbs +0 -12
- package/templates/python/codegen/partials/attio-list-objects-method.hbs +0 -8
- package/templates/python/codegen/partials/attio-object-types.hbs +0 -23
- package/templates/python/codegen/partials/attio-query-records-method.hbs +0 -45
- package/templates/python/codegen/partials/attio-section.hbs +0 -110
- package/templates/python/codegen/partials/attio-upsert-record-method.hbs +0 -51
- package/templates/python/codegen/partials/deterministic-tools-section.hbs +0 -308
- package/templates/python/codegen/partials/file-header.hbs +0 -32
- package/templates/python/codegen/partials/github-section.hbs +0 -149
- package/templates/python/codegen/partials/gmail-section.hbs +0 -30
- package/templates/python/codegen/partials/linear-section.hbs +0 -229
- package/templates/python/codegen/partials/schedule-section.hbs +0 -15
- package/templates/python/codegen/partials/slack-section.hbs +0 -266
- package/templates/python/codegen/partials/snowflake-section.hbs +0 -26
- package/templates/python/codegen/partials/tool-name-types.hbs +0 -18
- package/templates/python/codegen/partials/webhook-section.hbs +0 -15
- package/templates/python/codegen/partials/workos-section.hbs +0 -149
- package/templates/python/init/.python-version.hbs +0 -1
- package/templates/python/init/README.md.hbs +0 -68
- package/templates/python/init/env.example.hbs +0 -1
- package/templates/python/init/gitignore.hbs +0 -3
- package/templates/python/init/pyproject.toml.hbs +0 -16
- package/templates/python/init/src/main.py.hbs +0 -23
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
{{~#if workos}}
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
# === WorkOS ===
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class WorkOS:
|
|
8
|
-
@staticmethod
|
|
9
|
-
def on_user_created() -> TriggerConfig[WorkOSUserCreatedTrigger]:
|
|
10
|
-
return TriggerConfig(
|
|
11
|
-
integration_id={{{workos.instanceIdRepr}}},
|
|
12
|
-
integration_type='workos',
|
|
13
|
-
config_type='workos_input',
|
|
14
|
-
config=_compact_dict(eventTypes=[WorkOSEventType.user_created]),
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
@staticmethod
|
|
18
|
-
def on_user_updated() -> TriggerConfig[WorkOSUserUpdatedTrigger]:
|
|
19
|
-
return TriggerConfig(
|
|
20
|
-
integration_id={{{workos.instanceIdRepr}}},
|
|
21
|
-
integration_type='workos',
|
|
22
|
-
config_type='workos_input',
|
|
23
|
-
config=_compact_dict(eventTypes=[WorkOSEventType.user_updated]),
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
@staticmethod
|
|
27
|
-
def on_user_deleted() -> TriggerConfig[WorkOSUserDeletedTrigger]:
|
|
28
|
-
return TriggerConfig(
|
|
29
|
-
integration_id={{{workos.instanceIdRepr}}},
|
|
30
|
-
integration_type='workos',
|
|
31
|
-
config_type='workos_input',
|
|
32
|
-
config=_compact_dict(eventTypes=[WorkOSEventType.user_deleted]),
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
@staticmethod
|
|
36
|
-
def on_membership_created() -> TriggerConfig[WorkOSOrganizationMembershipCreatedTrigger]:
|
|
37
|
-
return TriggerConfig(
|
|
38
|
-
integration_id={{{workos.instanceIdRepr}}},
|
|
39
|
-
integration_type='workos',
|
|
40
|
-
config_type='workos_input',
|
|
41
|
-
config=_compact_dict(eventTypes=[WorkOSEventType.organization_membership_created]),
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
@staticmethod
|
|
45
|
-
def on_membership_updated() -> TriggerConfig[WorkOSOrganizationMembershipUpdatedTrigger]:
|
|
46
|
-
return TriggerConfig(
|
|
47
|
-
integration_id={{{workos.instanceIdRepr}}},
|
|
48
|
-
integration_type='workos',
|
|
49
|
-
config_type='workos_input',
|
|
50
|
-
config=_compact_dict(eventTypes=[WorkOSEventType.organization_membership_updated]),
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
@staticmethod
|
|
54
|
-
def on_membership_deleted() -> TriggerConfig[WorkOSOrganizationMembershipDeletedTrigger]:
|
|
55
|
-
return TriggerConfig(
|
|
56
|
-
integration_id={{{workos.instanceIdRepr}}},
|
|
57
|
-
integration_type='workos',
|
|
58
|
-
config_type='workos_input',
|
|
59
|
-
config=_compact_dict(eventTypes=[WorkOSEventType.organization_membership_deleted]),
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
@staticmethod
|
|
63
|
-
def on_membership_changed() -> TriggerConfig[WorkOSMembershipTrigger]:
|
|
64
|
-
return TriggerConfig(
|
|
65
|
-
integration_id={{{workos.instanceIdRepr}}},
|
|
66
|
-
integration_type='workos',
|
|
67
|
-
config_type='workos_input',
|
|
68
|
-
config=_compact_dict(
|
|
69
|
-
eventTypes=[
|
|
70
|
-
WorkOSEventType.organization_membership_created,
|
|
71
|
-
WorkOSEventType.organization_membership_updated,
|
|
72
|
-
WorkOSEventType.organization_membership_deleted,
|
|
73
|
-
],
|
|
74
|
-
),
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
@staticmethod
|
|
78
|
-
def on_invitation_sent() -> TriggerConfig[WorkOSInvitationTrigger]:
|
|
79
|
-
return TriggerConfig(
|
|
80
|
-
integration_id={{{workos.instanceIdRepr}}},
|
|
81
|
-
integration_type='workos',
|
|
82
|
-
config_type='workos_input',
|
|
83
|
-
config=_compact_dict(
|
|
84
|
-
eventTypes=[
|
|
85
|
-
WorkOSEventType.invitation_created,
|
|
86
|
-
WorkOSEventType.invitation_resent,
|
|
87
|
-
],
|
|
88
|
-
),
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
@staticmethod
|
|
92
|
-
def on_invitation_created() -> TriggerConfig[WorkOSInvitationCreatedTrigger]:
|
|
93
|
-
return TriggerConfig(
|
|
94
|
-
integration_id={{{workos.instanceIdRepr}}},
|
|
95
|
-
integration_type='workos',
|
|
96
|
-
config_type='workos_input',
|
|
97
|
-
config=_compact_dict(eventTypes=[WorkOSEventType.invitation_created]),
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
@staticmethod
|
|
101
|
-
def on_invitation_resent() -> TriggerConfig[WorkOSInvitationResentTrigger]:
|
|
102
|
-
return TriggerConfig(
|
|
103
|
-
integration_id={{{workos.instanceIdRepr}}},
|
|
104
|
-
integration_type='workos',
|
|
105
|
-
config_type='workos_input',
|
|
106
|
-
config=_compact_dict(eventTypes=[WorkOSEventType.invitation_resent]),
|
|
107
|
-
)
|
|
108
|
-
|
|
109
|
-
@staticmethod
|
|
110
|
-
def on_invitation_accepted() -> TriggerConfig[WorkOSInvitationAcceptedTrigger]:
|
|
111
|
-
return TriggerConfig(
|
|
112
|
-
integration_id={{{workos.instanceIdRepr}}},
|
|
113
|
-
integration_type='workos',
|
|
114
|
-
config_type='workos_input',
|
|
115
|
-
config=_compact_dict(eventTypes=[WorkOSEventType.invitation_accepted]),
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
@staticmethod
|
|
119
|
-
def on_invitation_revoked() -> TriggerConfig[WorkOSInvitationRevokedTrigger]:
|
|
120
|
-
return TriggerConfig(
|
|
121
|
-
integration_id={{{workos.instanceIdRepr}}},
|
|
122
|
-
integration_type='workos',
|
|
123
|
-
config_type='workos_input',
|
|
124
|
-
config=_compact_dict(eventTypes=[WorkOSEventType.invitation_revoked]),
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
@staticmethod
|
|
128
|
-
def on_organization_created() -> TriggerConfig[WorkOSOrganizationTrigger]:
|
|
129
|
-
return TriggerConfig(
|
|
130
|
-
integration_id={{{workos.instanceIdRepr}}},
|
|
131
|
-
integration_type='workos',
|
|
132
|
-
config_type='workos_input',
|
|
133
|
-
config=_compact_dict(eventTypes=[WorkOSEventType.organization_created]),
|
|
134
|
-
)
|
|
135
|
-
|
|
136
|
-
@staticmethod
|
|
137
|
-
def trigger(
|
|
138
|
-
*,
|
|
139
|
-
event_types: Sequence[WorkOSEventType] | None = None,
|
|
140
|
-
) -> TriggerConfig[WorkOSTrigger]:
|
|
141
|
-
return TriggerConfig(
|
|
142
|
-
integration_id={{{workos.instanceIdRepr}}},
|
|
143
|
-
integration_type='workos',
|
|
144
|
-
config_type='workos_input',
|
|
145
|
-
config=_compact_dict(
|
|
146
|
-
eventTypes=list(event_types) if event_types is not None else None,
|
|
147
|
-
),
|
|
148
|
-
)
|
|
149
|
-
{{~/if}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.11
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# {{projectName}}
|
|
2
|
-
|
|
3
|
-
Project scaffolded by `terse-cli`.
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
- Python `>=3.11`
|
|
8
|
-
- [`uv`](https://docs.astral.sh/uv/getting-started/installation/) for dependency management and local commands
|
|
9
|
-
|
|
10
|
-
If `terse init` did not install dependencies automatically, install `uv` and run:
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
uv sync
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Quick Start
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
uv sync
|
|
20
|
-
terse test
|
|
21
|
-
terse deploy
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Edit `src/main.py` to register jobs with `@app.job(...)`.
|
|
25
|
-
|
|
26
|
-
## Generated Helpers
|
|
27
|
-
|
|
28
|
-
The starter scaffold shows generated `GitHub` trigger/skill helpers alongside `Slack.skill(...)`.
|
|
29
|
-
|
|
30
|
-
After you connect GitHub, Attio, Slack, or Snowflake in Terse, rerun `terse generate` to refresh `src/terse_generated.py` with the real integration IDs, generated resources, and deterministic tool wrappers.
|
|
31
|
-
|
|
32
|
-
Import helpers like `GitHub`, `GitHubRepo`, `Attio`, `AttioObject`, `Schedule`, `Slack`, `SlackChannel`, `Snowflake`, and `TerseAgent` from `terse_generated`.
|
|
33
|
-
|
|
34
|
-
## Writing a Job
|
|
35
|
-
|
|
36
|
-
Register jobs on the `Terse` app, then build a `TerseAgent` inside the handler with the prompt and skills you want the model to see:
|
|
37
|
-
|
|
38
|
-
```python
|
|
39
|
-
from terse_sdk import Terse
|
|
40
|
-
from terse_sdk.types.events import GithubPRTrigger
|
|
41
|
-
from terse_generated import GitHub, GitHubRepo, Slack, SlackChannel, TerseAgent
|
|
42
|
-
|
|
43
|
-
app = Terse()
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
@app.job(
|
|
47
|
-
name="summarise-prs",
|
|
48
|
-
triggers=[GitHub.on_pr(repo=GitHubRepo.Terse)],
|
|
49
|
-
)
|
|
50
|
-
def summarise_prs(event: GithubPRTrigger) -> None:
|
|
51
|
-
agent = TerseAgent(
|
|
52
|
-
prompt="You summarise pull requests.",
|
|
53
|
-
skills=[
|
|
54
|
-
GitHub.skill(repos=[GitHubRepo.Terse]),
|
|
55
|
-
Slack.skill(channel=SlackChannel.AllTerseInc),
|
|
56
|
-
],
|
|
57
|
-
)
|
|
58
|
-
agent.run_and_wait(f"Summarise: {event.formatted_content}")
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Skills control what the model can do during `agent.run()` / `agent.run_and_wait()`. If the skill also has deterministic tool wrappers (Slack, Attio, Snowflake), they are auto-attached on `agent.tools.*`:
|
|
62
|
-
|
|
63
|
-
```python
|
|
64
|
-
agent.tools.snowflake.execute_query(query="select 1")
|
|
65
|
-
agent.tools.slack.send_message(channel_id=SlackChannel.AllTerseInc.channel_id, message="hi")
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
`skills=[GitHub.skill(repos=[...])]` exposes repo-scoped GitHub tools to the model, but does not add deterministic `agent.tools.github.*` wrappers.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
TERSE_API_KEY=
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "{{projectName}}"
|
|
3
|
-
version = "0.1.0"
|
|
4
|
-
requires-python = ">=3.11"
|
|
5
|
-
dependencies = [
|
|
6
|
-
"{{sdkDependency}}",
|
|
7
|
-
]
|
|
8
|
-
|
|
9
|
-
[tool.uv]
|
|
10
|
-
package = false
|
|
11
|
-
|
|
12
|
-
[dependency-groups]
|
|
13
|
-
dev = ["ty"]
|
|
14
|
-
|
|
15
|
-
[tool.ty.environment]
|
|
16
|
-
python = ".venv"
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
from terse_sdk import Terse
|
|
2
|
-
from terse_sdk.types.events import GithubPRTrigger
|
|
3
|
-
|
|
4
|
-
from terse_generated import GitHub, GitHubRepo, Slack, SlackChannel, TerseAgent
|
|
5
|
-
|
|
6
|
-
app = Terse()
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@app.job(
|
|
10
|
-
name="{{projectName}}",
|
|
11
|
-
triggers=[GitHub.on_pr(repo=GitHubRepo.Terse)],
|
|
12
|
-
)
|
|
13
|
-
def run_job(event: GithubPRTrigger) -> None:
|
|
14
|
-
agent = TerseAgent(
|
|
15
|
-
prompt="You summarise GitHub pull requests and post concise updates to Slack.",
|
|
16
|
-
skills=[
|
|
17
|
-
GitHub.skill(repos=[GitHubRepo.Terse]),
|
|
18
|
-
Slack.skill(channel=SlackChannel.AllTerseInc),
|
|
19
|
-
],
|
|
20
|
-
)
|
|
21
|
-
agent.run_and_wait(
|
|
22
|
-
f"Summarise this PR and post a short update to Slack: {event.formatted_content}"
|
|
23
|
-
)
|