terse-cli 0.1.16 → 0.1.17
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/assertProjectRoot.d.ts +3 -2
- package/dist/assertProjectRoot.d.ts.map +1 -1
- package/dist/assertProjectRoot.js +5 -8
- package/dist/assertProjectRoot.js.map +1 -1
- package/dist/deploy.d.ts +2 -1
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +11 -12
- package/dist/deploy.js.map +1 -1
- package/dist/generate.d.ts +2 -1
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +12 -11
- package/dist/generate.js.map +1 -1
- package/dist/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +2 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +29 -57
- package/dist/init.js.map +1 -1
- package/dist/loadJob.d.ts +4 -3
- package/dist/loadJob.d.ts.map +1 -1
- package/dist/loadJob.js +6 -54
- package/dist/loadJob.js.map +1 -1
- package/dist/providers/LanguageProvider.d.ts +31 -0
- package/dist/providers/LanguageProvider.d.ts.map +1 -0
- package/dist/providers/LanguageProvider.js +2 -0
- package/dist/providers/LanguageProvider.js.map +1 -0
- package/dist/providers/codegenTypes.d.ts +130 -0
- package/dist/providers/codegenTypes.d.ts.map +1 -0
- package/dist/providers/codegenTypes.js +2 -0
- package/dist/providers/codegenTypes.js.map +1 -0
- package/dist/providers/python/PythonProvider.d.ts +33 -0
- package/dist/providers/python/PythonProvider.d.ts.map +1 -0
- package/dist/providers/python/PythonProvider.js +369 -0
- package/dist/providers/python/PythonProvider.js.map +1 -0
- package/dist/providers/python/preparePythonCodegenData.d.ts +73 -0
- package/dist/providers/python/preparePythonCodegenData.d.ts.map +1 -0
- package/dist/providers/python/preparePythonCodegenData.js +338 -0
- package/dist/providers/python/preparePythonCodegenData.js.map +1 -0
- package/dist/providers/python/pythonTemplateEngine.d.ts +3 -0
- package/dist/providers/python/pythonTemplateEngine.d.ts.map +1 -0
- package/dist/providers/python/pythonTemplateEngine.js +30 -0
- package/dist/providers/python/pythonTemplateEngine.js.map +1 -0
- package/dist/providers/resolveProvider.d.ts +8 -0
- package/dist/providers/resolveProvider.d.ts.map +1 -0
- package/dist/providers/resolveProvider.js +47 -0
- package/dist/providers/resolveProvider.js.map +1 -0
- package/dist/providers/shared/sessionStream.d.ts +24 -0
- package/dist/providers/shared/sessionStream.d.ts.map +1 -0
- package/dist/providers/shared/sessionStream.js +159 -0
- package/dist/providers/shared/sessionStream.js.map +1 -0
- package/dist/providers/shared/shellUtils.d.ts +13 -0
- package/dist/providers/shared/shellUtils.d.ts.map +1 -0
- package/dist/providers/shared/shellUtils.js +70 -0
- package/dist/providers/shared/shellUtils.js.map +1 -0
- package/dist/providers/templateUtils.d.ts +7 -0
- package/dist/providers/templateUtils.d.ts.map +1 -0
- package/dist/providers/templateUtils.js +30 -0
- package/dist/providers/templateUtils.js.map +1 -0
- package/dist/providers/typescript/TypeScriptProvider.d.ts +33 -0
- package/dist/providers/typescript/TypeScriptProvider.d.ts.map +1 -0
- package/dist/providers/typescript/TypeScriptProvider.js +162 -0
- package/dist/providers/typescript/TypeScriptProvider.js.map +1 -0
- package/dist/providers/typescript/prepareCodegenData.d.ts +145 -0
- package/dist/providers/typescript/prepareCodegenData.d.ts.map +1 -0
- package/dist/providers/typescript/prepareCodegenData.js +834 -0
- package/dist/providers/typescript/prepareCodegenData.js.map +1 -0
- package/dist/providers/typescript/templateEngine.d.ts +3 -0
- package/dist/providers/typescript/templateEngine.d.ts.map +1 -0
- package/dist/providers/typescript/templateEngine.js +37 -0
- package/dist/providers/typescript/templateEngine.js.map +1 -0
- package/dist/run.d.ts +2 -11
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +5 -192
- package/dist/run.js.map +1 -1
- package/dist/shared/types.d.ts +899 -107
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/test.d.ts +2 -1
- package/dist/test.d.ts.map +1 -1
- package/dist/test.js +5 -5
- package/dist/test.js.map +1 -1
- package/package.json +2 -2
- package/templates/python/codegen/generated.hbs +6 -0
- package/templates/python/codegen/partials/attio-list-objects-method.hbs +8 -0
- package/templates/python/codegen/partials/attio-object-types.hbs +23 -0
- package/templates/python/codegen/partials/attio-query-records-method.hbs +45 -0
- package/templates/python/codegen/partials/attio-section.hbs +111 -0
- package/templates/python/codegen/partials/attio-upsert-record-method.hbs +51 -0
- package/templates/python/codegen/partials/deterministic-tools-section.hbs +194 -0
- package/templates/python/codegen/partials/file-header.hbs +32 -0
- package/templates/python/codegen/partials/schedule-section.hbs +9 -0
- package/templates/python/codegen/partials/snowflake-section.hbs +26 -0
- package/templates/python/codegen/partials/tool-name-types.hbs +15 -0
- package/templates/python/init/.python-version.hbs +1 -0
- package/templates/python/init/README.md.hbs +38 -0
- package/templates/python/init/gitignore.hbs +3 -0
- package/templates/python/init/pyproject.toml.hbs +16 -0
- package/templates/python/init/src/main.py.hbs +21 -0
- package/templates/typescript/codegen/generated.hbs +17 -0
- package/templates/typescript/codegen/partials/atlassian-section.hbs +32 -0
- package/templates/typescript/codegen/partials/attio-section.hbs +38 -0
- package/templates/typescript/codegen/partials/datadog-section.hbs +11 -0
- package/templates/typescript/codegen/partials/figma-section.hbs +13 -0
- package/templates/typescript/codegen/partials/github-section.hbs +62 -0
- package/templates/typescript/codegen/partials/gmail-section.hbs +21 -0
- package/templates/typescript/codegen/partials/header.hbs +12 -0
- package/templates/typescript/codegen/partials/launchdarkly-section.hbs +11 -0
- package/templates/typescript/codegen/partials/linear-section.hbs +27 -0
- package/templates/typescript/codegen/partials/notion-section.hbs +15 -0
- package/templates/typescript/codegen/partials/posthog-section.hbs +11 -0
- package/templates/typescript/codegen/partials/resource-class.hbs +9 -0
- package/templates/typescript/codegen/partials/slack-section.hbs +23 -0
- package/templates/typescript/codegen/partials/snowflake-section.hbs +9 -0
- package/templates/typescript/codegen/partials/system-section.hbs +18 -0
- package/templates/typescript/codegen/partials/tools-section.hbs +68 -0
- package/templates/typescript/codegen/partials/workos-section.hbs +53 -0
- package/templates/typescript/init/env.example.hbs +1 -0
- package/templates/{package.json.tmpl → typescript/init/package.json.hbs} +1 -1
- package/templates/{src/index.ts.tmpl → typescript/init/src/index.ts.hbs} +1 -3
- /package/templates/{env.example.tmpl → python/init/env.example.hbs} +0 -0
- /package/templates/{.claude/settings.json.tmpl → typescript/init/.claude/settings.json.hbs} +0 -0
- /package/templates/{gitignore.tmpl → typescript/init/gitignore.hbs} +0 -0
- /package/templates/{tsconfig.json.tmpl → typescript/init/tsconfig.json.hbs} +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{{sectionHeader "Slack"}}
|
|
2
|
+
|
|
3
|
+
{{> resource-class channelClass}}
|
|
4
|
+
|
|
5
|
+
export const Slack = {
|
|
6
|
+
/** Trigger on any message in a channel */
|
|
7
|
+
onMessage(opts: { channel: SlackChannel; userIds?: string[] }): SlackConfig {
|
|
8
|
+
return new SlackConfig("{{escape id}}", opts.channel.channelId, opts.channel.name, false, opts.userIds, [SlackEventType.MESSAGE])
|
|
9
|
+
},
|
|
10
|
+
/** Trigger on direct messages to the bot */
|
|
11
|
+
onDm(opts?: { userIds?: string[] }): SlackConfig {
|
|
12
|
+
return new SlackConfig("{{escape id}}", undefined, undefined, true, opts?.userIds, [SlackEventType.MESSAGE])
|
|
13
|
+
},
|
|
14
|
+
/** Trigger on all Slack events (messages + DMs) for a channel */
|
|
15
|
+
trigger(opts?: { channel?: SlackChannel; listenToUserDms?: boolean; userIds?: string[]; eventTypes?: SlackEventType[] }): SlackConfig {
|
|
16
|
+
return new SlackConfig("{{escape id}}", opts?.channel?.channelId, opts?.channel?.name, opts?.listenToUserDms, opts?.userIds, opts?.eventTypes)
|
|
17
|
+
},
|
|
18
|
+
/** Use in `skills[]` */
|
|
19
|
+
skill(opts?: { channel?: SlackChannel; userIds?: string[]; userNames?: string[]; listenToUserDms?: boolean }): TypedSkill<{{{skillToolType}}}> {
|
|
20
|
+
return new SlackOutputConfig("{{escape id}}", opts?.channel?.channelId, opts?.channel?.name, opts?.userIds, opts?.userNames, opts?.listenToUserDms) as TypedSkill<{{{skillToolType}}}>
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{{sectionHeader "Schedule"}}
|
|
2
|
+
|
|
3
|
+
export const Schedule = {
|
|
4
|
+
/** Use in `triggers[]` — run on a cron schedule */
|
|
5
|
+
cron(opts: { expression: string }): TimeTriggerConfig {
|
|
6
|
+
return new TimeTriggerConfig(opts.expression)
|
|
7
|
+
},
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
{{sectionHeader "Terse"}}
|
|
11
|
+
|
|
12
|
+
export const Terse = {
|
|
13
|
+
/** Use in `skills[]` — built-in web search */
|
|
14
|
+
skill(): TypedSkill<{{{skillToolType}}}> {
|
|
15
|
+
return new TerseConfig() as TypedSkill<{{{skillToolType}}}>
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{{sectionHeader "Typed Tools"}}
|
|
2
|
+
|
|
3
|
+
{{#each attioPreludeLines}}
|
|
4
|
+
{{{this}}}
|
|
5
|
+
{{/each}}
|
|
6
|
+
{{#each paramTypes}}
|
|
7
|
+
{{#if description}}/** {{description}} */
|
|
8
|
+
{{/if}}export type {{typeName}} = {{{tsType}}}
|
|
9
|
+
|
|
10
|
+
{{/each}}
|
|
11
|
+
{{#if githubRepoMappings.length}}
|
|
12
|
+
const __githubRepoNameToFullName = new Map<string, string>([
|
|
13
|
+
{{#each githubRepoMappings}}
|
|
14
|
+
["{{escape name}}", "{{escape fullName}}"],
|
|
15
|
+
{{/each}}
|
|
16
|
+
])
|
|
17
|
+
|
|
18
|
+
function __normalizeGitHubRepos(repo: unknown): string {
|
|
19
|
+
if (repo && typeof repo === "object" && "fullName" in (repo as Record<string, unknown>)) {
|
|
20
|
+
const fullName = (repo as { fullName?: unknown }).fullName
|
|
21
|
+
if (typeof fullName === "string" && fullName.length > 0) return fullName
|
|
22
|
+
}
|
|
23
|
+
if (typeof repo === "string") {
|
|
24
|
+
if (repo.includes("/")) return repo
|
|
25
|
+
return __githubRepoNameToFullName.get(repo) ?? repo
|
|
26
|
+
}
|
|
27
|
+
return String(repo ?? "")
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function __normalizeGitHubReposNames(repositories: unknown): string[] {
|
|
31
|
+
if (!Array.isArray(repositories)) return []
|
|
32
|
+
return repositories.map(repo => __normalizeGitHubRepos(repo))
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
{{/if}}
|
|
36
|
+
export type GeneratedTools = {
|
|
37
|
+
{{#each groups}}
|
|
38
|
+
{{key}}: {
|
|
39
|
+
{{#each methods}}
|
|
40
|
+
{{#if description}} /** {{description}} */
|
|
41
|
+
{{/if}} {{{generatedSignature}}}
|
|
42
|
+
{{/each}}
|
|
43
|
+
}
|
|
44
|
+
{{/each}}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare module "terse-sdk" {
|
|
48
|
+
interface TerseAgent {
|
|
49
|
+
readonly tools: GeneratedTools
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function createTools(agent: TerseAgent): GeneratedTools {
|
|
54
|
+
const allowed: Set<string> = new Set(agent.skills.map(s => s.integrationType))
|
|
55
|
+
return {
|
|
56
|
+
{{#each groups}}
|
|
57
|
+
...(allowed.has("{{escape integrationType}}") ? { {{key}}: {
|
|
58
|
+
{{#each methods}}
|
|
59
|
+
{{#each runtimeLines}}
|
|
60
|
+
{{{this}}}
|
|
61
|
+
{{/each}}
|
|
62
|
+
{{/each}}
|
|
63
|
+
} } : {}),
|
|
64
|
+
{{/each}}
|
|
65
|
+
} as GeneratedTools
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
;(globalThis as any).__terse_createTools = createTools
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{{sectionHeader "WorkOS"}}
|
|
2
|
+
|
|
3
|
+
export const WorkOS = {
|
|
4
|
+
/** Trigger on user creation */
|
|
5
|
+
onUserCreated(): TypedTrigger<WorkOSUserInputEvent> {
|
|
6
|
+
return new WorkOSInputConfig("{{escape id}}", [WorkOSEventType.USER_CREATED]) as TypedTrigger<WorkOSUserInputEvent>
|
|
7
|
+
},
|
|
8
|
+
/** Trigger on user update */
|
|
9
|
+
onUserUpdated(): TypedTrigger<WorkOSUserInputEvent> {
|
|
10
|
+
return new WorkOSInputConfig("{{escape id}}", [WorkOSEventType.USER_UPDATED]) as TypedTrigger<WorkOSUserInputEvent>
|
|
11
|
+
},
|
|
12
|
+
/** Trigger on user deletion */
|
|
13
|
+
onUserDeleted(): TypedTrigger<WorkOSUserInputEvent> {
|
|
14
|
+
return new WorkOSInputConfig("{{escape id}}", [WorkOSEventType.USER_DELETED]) as TypedTrigger<WorkOSUserInputEvent>
|
|
15
|
+
},
|
|
16
|
+
/** Trigger on organization membership change */
|
|
17
|
+
onMembershipChanged(): TypedTrigger<WorkOSMembershipInputEvent> {
|
|
18
|
+
return new WorkOSInputConfig("{{escape id}}", [WorkOSEventType.ORGANIZATION_MEMBERSHIP_CREATED, WorkOSEventType.ORGANIZATION_MEMBERSHIP_UPDATED, WorkOSEventType.ORGANIZATION_MEMBERSHIP_DELETED]) as TypedTrigger<WorkOSMembershipInputEvent>
|
|
19
|
+
},
|
|
20
|
+
/** Trigger when an invitation is sent */
|
|
21
|
+
onInvitationSent(): TypedTrigger<WorkOSInvitationInputEvent> {
|
|
22
|
+
return new WorkOSInputConfig("{{escape id}}", [WorkOSEventType.INVITATION_CREATED, WorkOSEventType.INVITATION_RESENT]) as TypedTrigger<WorkOSInvitationInputEvent>
|
|
23
|
+
},
|
|
24
|
+
/** Trigger when an invitation is first created */
|
|
25
|
+
onInvitationCreated(): TypedTrigger<WorkOSInvitationInputEvent> {
|
|
26
|
+
return new WorkOSInputConfig("{{escape id}}", [WorkOSEventType.INVITATION_CREATED]) as TypedTrigger<WorkOSInvitationInputEvent>
|
|
27
|
+
},
|
|
28
|
+
/** Trigger when an invitation is resent */
|
|
29
|
+
onInvitationResent(): TypedTrigger<WorkOSInvitationInputEvent> {
|
|
30
|
+
return new WorkOSInputConfig("{{escape id}}", [WorkOSEventType.INVITATION_RESENT]) as TypedTrigger<WorkOSInvitationInputEvent>
|
|
31
|
+
},
|
|
32
|
+
/** Trigger on invitation accepted */
|
|
33
|
+
onInvitationAccepted(): TypedTrigger<WorkOSInvitationInputEvent> {
|
|
34
|
+
return new WorkOSInputConfig("{{escape id}}", [WorkOSEventType.INVITATION_ACCEPTED]) as TypedTrigger<WorkOSInvitationInputEvent>
|
|
35
|
+
},
|
|
36
|
+
/** Trigger when an invitation is revoked */
|
|
37
|
+
onInvitationRevoked(): TypedTrigger<WorkOSInvitationInputEvent> {
|
|
38
|
+
return new WorkOSInputConfig("{{escape id}}", [WorkOSEventType.INVITATION_REVOKED]) as TypedTrigger<WorkOSInvitationInputEvent>
|
|
39
|
+
},
|
|
40
|
+
/** Trigger on organization creation */
|
|
41
|
+
onOrganizationCreated(): TypedTrigger<WorkOSOrganizationInputEvent> {
|
|
42
|
+
return new WorkOSInputConfig("{{escape id}}", [WorkOSEventType.ORGANIZATION_CREATED]) as TypedTrigger<WorkOSOrganizationInputEvent>
|
|
43
|
+
},
|
|
44
|
+
/** Trigger on specific WorkOS event types */
|
|
45
|
+
trigger(opts?: { eventTypes?: WorkOSEventType[] }): TypedTrigger<WorkOSInputEvent | WorkOSUserInputEvent | WorkOSMembershipInputEvent | WorkOSInvitationInputEvent | WorkOSOrganizationInputEvent> {
|
|
46
|
+
return new WorkOSInputConfig("{{escape id}}", opts?.eventTypes) as TypedTrigger<WorkOSInputEvent | WorkOSUserInputEvent | WorkOSMembershipInputEvent | WorkOSInvitationInputEvent | WorkOSOrganizationInputEvent>
|
|
47
|
+
},
|
|
48
|
+
/** Use in `skills[]` */
|
|
49
|
+
skill(): TypedSkill<{{{skillToolType}}}> {
|
|
50
|
+
return new WorkOSOutputConfig("{{escape id}}") as TypedSkill<{{{skillToolType}}}>
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
TERSE_API_KEY=
|
|
@@ -14,8 +14,6 @@ await client.createJob({
|
|
|
14
14
|
const message = await Agent.tools.slack.sendMessage({
|
|
15
15
|
channelId: SlackChannel.AllTerseInc.channelId,
|
|
16
16
|
message: "New PR from " + event.sender.login + "!",
|
|
17
|
-
thread_ts: "",
|
|
18
|
-
blocks: "",
|
|
19
17
|
});
|
|
20
18
|
|
|
21
19
|
const prompt =
|
|
@@ -25,4 +23,4 @@ await client.createJob({
|
|
|
25
23
|
|
|
26
24
|
await Agent.runAndWait(prompt);
|
|
27
25
|
}
|
|
28
|
-
});
|
|
26
|
+
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|