-
Notifications
You must be signed in to change notification settings - Fork 20
feat(landing): config-first homepage on a single sales example #1076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,10 @@ | ||
| // biome-ignore-all format: stays compact for the landing-page code panel | ||
| import { ConnectorRuntime, type SyncContext } from "@lobu/connector-sdk"; | ||
|
|
||
| export default class SalesforcePipelineConnector extends ConnectorRuntime { | ||
| interface Checkpoint { last_modified: string } | ||
| interface Opportunity { Id: string; Name: string; StageName: string; LastModifiedDate: string } | ||
|
|
||
| export default class SalesforcePipelineConnector extends ConnectorRuntime<Checkpoint> { | ||
| readonly definition = { | ||
| key: "salesforce-pipeline", | ||
| name: "Salesforce pipeline", | ||
|
|
@@ -10,11 +13,11 @@ export default class SalesforcePipelineConnector extends ConnectorRuntime { | |
| feeds: { opportunities: { key: "opportunities", name: "Opportunities" } }, | ||
| }; | ||
|
|
||
| async sync(ctx: SyncContext) { | ||
| const since = (ctx.checkpoint as any)?.last_modified ?? "2000-01-01T00:00:00Z"; | ||
| async sync(ctx: SyncContext<Checkpoint>) { | ||
| const since = ctx.checkpoint?.last_modified ?? "2000-01-01T00:00:00Z"; | ||
| const q = `SELECT Id,Name,StageName,LastModifiedDate FROM Opportunity WHERE LastModifiedDate > ${since} LIMIT 200`; | ||
| const r = await fetch(`${ctx.config.instance_url}/services/data/v60.0/query?q=${encodeURIComponent(q)}`); | ||
| const records: any[] = (await r.json() as any).records ?? []; | ||
| const records = ((await r.json()) as { records?: Opportunity[] }).records ?? []; | ||
|
Comment on lines
19
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handle non-2xx responses before JSON parsing.
Suggested fix const r = await fetch(`${ctx.config.instance_url}/services/data/v60.0/query?q=${encodeURIComponent(q)}`);
+ if (!r.ok) {
+ throw new Error(`Salesforce query failed: ${r.status} ${r.statusText}`);
+ }
const records = ((await r.json()) as { records?: Opportunity[] }).records ?? [];🤖 Prompt for AI Agents |
||
| return { | ||
| events: records.map((o) => ({ | ||
| origin_id: o.Id, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| --- | ||
| name: account-brief | ||
| description: Build a pre-renewal brief for a tracked account from its recent public news and announcements. Use before a renewal call or QBR, after the account-health watcher flags a risk. Reading public news is allowed; do not log in, submit forms, or touch any CRM write endpoint. | ||
| nixPackages: | ||
| - jq | ||
| network: | ||
| allow: | ||
| - .reuters.com | ||
| - .apnews.com | ||
| judge: | ||
| - domain: newsapi.org | ||
| judge: news-read | ||
| - domain: .newsapi.org | ||
| judge: news-read | ||
| judges: | ||
| news-read: > | ||
| Allow GET reads of public news and headlines. Deny logins, posting, | ||
| and any account, billing, or write action. Fail closed if unclear. | ||
| --- | ||
|
|
||
| # Account brief | ||
|
|
||
| Use this skill when the user asks for a pre-renewal brief on a tracked account, | ||
| or when the `account-health-monitor` watcher flags a risk signal. | ||
|
|
||
| ## Steps | ||
|
|
||
| 1. Resolve the company name from the `organization` entity. | ||
| 2. Fetch recent headlines and filter to the last 90 days. | ||
| 3. Summarize anything that moves renewal risk: leadership changes, funding, | ||
| layoffs, M&A, or competitive losses. | ||
| 4. Save a `renewal-risk` entity per material signal, linked to the account with | ||
| the `affects` relationship. | ||
|
|
||
| ## Rules | ||
|
|
||
| - Read public sources only. Never log in, submit forms, or change account, | ||
| billing, or profile data. | ||
| - If a source is paywalled or asks for credentials, skip it and note the gap. | ||
| - Keep the brief to five bullets or fewer; the rep reads it on a phone. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add deterministic ordering before deriving the next checkpoint.
Checkpointing from
records.at(-1)is unsafe withoutORDER BY LastModifiedDate ASC; API return order is not guaranteed, which can skip or replay events across sync runs.Suggested fix
Also applies to: 29-29
🤖 Prompt for AI Agents