@lobu/runtime-device 21.2.1 → 23.0.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/component.json +1 -1
- package/dist/dependencies.bun.lock +91 -83
- package/npm-shrinkwrap.json +492 -438
- package/package.json +12 -2
- package/vendor/cli/dist/bundled-skills/lobu/SKILL.md +1 -1
- package/vendor/cli/dist/commands/_lib/apply/apply-cmd.js +5 -6
- package/vendor/cli/dist/commands/_lib/apply/client.d.ts +1 -0
- package/vendor/cli/dist/commands/_lib/apply/client.js +26 -7
- package/vendor/cli/dist/commands/_lib/apply/desired-state.d.ts +9 -1
- package/vendor/cli/dist/commands/_lib/apply/diff.d.ts +1 -0
- package/vendor/cli/dist/commands/_lib/apply/diff.js +46 -4
- package/vendor/cli/dist/commands/_lib/apply/map-config.js +18 -38
- package/vendor/cli/dist/commands/_lib/init-from-org/bootstrap.js +5 -17
- package/vendor/cli/dist/commands/init.d.ts +0 -2
- package/vendor/cli/dist/commands/init.js +0 -27
- package/vendor/cli/dist/commands/login.d.ts +17 -0
- package/vendor/cli/dist/commands/login.js +43 -17
- package/vendor/cli/dist/commands/memory/_lib/errors.d.ts +0 -8
- package/vendor/cli/dist/commands/memory/_lib/errors.js +0 -12
- package/vendor/cli/dist/commands/memory/_lib/mcp.js +6 -6
- package/vendor/cli/dist/commands/memory/_lib/seed-cmd.js +4 -10
- package/vendor/cli/dist/config/define.d.ts +21 -15
- package/vendor/cli/dist/config/define.js +2 -2
- package/vendor/cli/dist/connectors/README.md +21 -6
- package/vendor/cli/dist/connectors/_google/actions.ts +270 -0
- package/vendor/cli/dist/connectors/_google/discovery/calendar_v3.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/chat_v1.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/docs_v1.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/drive_v3.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/gmail_v1.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/people_v1.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/sheets_v4.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/tasks_v1.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery/youtube_v3.json +1 -0
- package/vendor/cli/dist/connectors/_google/discovery.ts +442 -0
- package/vendor/cli/dist/connectors/_google/errors.ts +91 -0
- package/vendor/cli/dist/connectors/_google/list-feed.ts +223 -0
- package/vendor/cli/dist/connectors/_google/policies.ts +127 -0
- package/vendor/cli/dist/connectors/agentid.ts +43 -0
- package/vendor/cli/dist/connectors/chat-user-identity.ts +2 -1
- package/vendor/cli/dist/connectors/github-automation-events.ts +9 -0
- package/vendor/cli/dist/connectors/github-identity.ts +28 -3
- package/vendor/cli/dist/connectors/github.ts +101 -59
- package/vendor/cli/dist/connectors/google_calendar.ts +207 -719
- package/vendor/cli/dist/connectors/google_drive.ts +16 -2
- package/vendor/cli/dist/connectors/google_gmail.ts +52 -33
- package/vendor/cli/dist/connectors/herdr.ts +406 -0
- package/vendor/cli/dist/connectors/jira-helpers.ts +313 -0
- package/vendor/cli/dist/connectors/jira.ts +35 -227
- package/vendor/cli/dist/connectors/linear.ts +7 -4
- package/vendor/cli/dist/connectors/linkedin-browser-script.ts +13 -0
- package/vendor/cli/dist/connectors/linkedin-draft-page.js +104 -0
- package/vendor/cli/dist/connectors/linkedin-drafts.ts +73 -0
- package/vendor/cli/dist/connectors/linkedin-identity.ts +32 -0
- package/vendor/cli/dist/connectors/linkedin-inbox-adapter.js +1185 -0
- package/vendor/cli/dist/connectors/linkedin-inbox.ts +156 -0
- package/vendor/cli/dist/connectors/linkedin-like.ts +114 -0
- package/vendor/cli/dist/connectors/linkedin-takeout.ts +577 -0
- package/vendor/cli/dist/connectors/linkedin.ts +3998 -0
- package/vendor/cli/dist/connectors/postgres.ts +27 -2
- package/vendor/cli/dist/connectors/takeout-utils.ts +240 -0
- package/vendor/cli/dist/connectors/tiktok-inbox-page.js +230 -0
- package/vendor/cli/dist/connectors/tiktok-web-page.js +217 -0
- package/vendor/cli/dist/connectors/tiktok_web.ts +319 -0
- package/vendor/cli/dist/connectors/whatsapp-web-adapter.js +285 -567
- package/vendor/cli/dist/connectors/whatsapp-web-helpers.ts +74 -455
- package/vendor/cli/dist/connectors/whatsapp-web-identity.ts +135 -0
- package/vendor/cli/dist/connectors/whatsapp_web.ts +159 -618
- package/vendor/cli/dist/connectors/x-dm-adapter.js +556 -0
- package/vendor/cli/dist/connectors/x-identity.ts +31 -2
- package/vendor/cli/dist/connectors/x.ts +539 -253
- package/vendor/cli/dist/index.js +1 -37
- package/vendor/cli/dist/internal/context.d.ts +10 -0
- package/vendor/cli/dist/internal/context.js +26 -16
- package/vendor/cli/dist/internal/node-version.d.ts +1 -1
- package/vendor/cli/dist/internal/node-version.js +1 -1
- package/vendor/cli/dist/internal/oauth.d.ts +3 -1
- package/vendor/cli/dist/internal/oauth.js +4 -3
- package/vendor/cli/dist/internal/runtime-components.d.ts +9 -0
- package/vendor/cli/dist/internal/runtime-components.js +67 -2
- package/vendor/cli/dist/mac-auth.js +17 -1
- package/vendor/cli/dist/providers.json +1 -1
- package/vendor/cli/dist/runtime-components.json +4 -4
- package/vendor/cli/dist/templates/AGENTS.md.tmpl +12 -5
- package/vendor/cli/dist/templates/README.md.tmpl +1 -1
- package/vendor/cli/dist/vendor/ora/.bun-tag-fde20e9a6df212fa +0 -0
- package/vendor/cli/dist/vendor/ora/index.d.ts +332 -0
- package/vendor/cli/dist/vendor/ora/index.js +424 -0
- package/vendor/cli/dist/vendor/ora/license +9 -0
- package/vendor/cli/dist/vendor/ora/package.json +64 -0
- package/vendor/cli/dist/vendor/ora/readme.md +329 -0
- package/vendor/cli/package.json +2 -2
- package/vendor/connector-sdk/dist/browser-handoff-banner.d.ts +39 -0
- package/vendor/connector-sdk/dist/browser-handoff-banner.js +175 -0
- package/vendor/connector-sdk/dist/browser-requirement.d.ts +36 -0
- package/vendor/connector-sdk/dist/browser-requirement.js +60 -0
- package/vendor/connector-sdk/dist/browser-source-read.d.ts +52 -0
- package/vendor/connector-sdk/dist/browser-source-read.js +107 -0
- package/vendor/connector-sdk/dist/connector-runtime.d.ts +3 -1
- package/vendor/connector-sdk/dist/connector-runtime.js +10 -0
- package/vendor/connector-sdk/dist/connector-types.d.ts +169 -45
- package/vendor/connector-sdk/dist/define-connector.d.ts +4 -2
- package/vendor/connector-sdk/dist/define-connector.js +3 -0
- package/vendor/connector-sdk/dist/index.d.ts +8 -2
- package/vendor/connector-sdk/dist/index.js +3 -0
- package/vendor/connector-sdk/dist/reaction-client-types.d.ts +16 -21
- package/vendor/connector-sdk/dist/reaction-client-types.typecheck.d.ts +5 -0
- package/vendor/connector-sdk/package.json +13 -1
- package/vendor/connector-worker/dist/agent-turn/guest-entry.js +43 -30
- package/vendor/connector-worker/dist/agent-turn/guest.bundle.js +416 -330
- package/vendor/connector-worker/dist/agent-turn/memory.d.ts +3 -2
- package/vendor/connector-worker/dist/agent-turn/memory.js +3 -20
- package/vendor/connector-worker/dist/agent-turn/types.d.ts +3 -15
- package/vendor/connector-worker/dist/agent-turn/workspace.d.ts +2 -2
- package/vendor/connector-worker/dist/agent-turn/workspace.js +2 -4
- package/vendor/connector-worker/dist/daemon/action-monitor.d.ts +12 -0
- package/vendor/connector-worker/dist/daemon/action-monitor.js +25 -0
- package/vendor/connector-worker/dist/daemon/agent-turn.js +0 -9
- package/vendor/connector-worker/dist/daemon/automation.d.ts +4 -11
- package/vendor/connector-worker/dist/daemon/automation.js +6 -6
- package/vendor/connector-worker/dist/daemon/builtins/index.d.ts +12 -0
- package/vendor/connector-worker/dist/daemon/builtins/index.js +61 -1
- package/vendor/connector-worker/dist/daemon/builtins/os-shell.d.ts +2 -1
- package/vendor/connector-worker/dist/daemon/builtins/os-shell.js +40 -27
- package/vendor/connector-worker/dist/daemon/client.d.ts +6 -4
- package/vendor/connector-worker/dist/daemon/client.js +3 -3
- package/vendor/connector-worker/dist/daemon/device-concurrency.d.ts +8 -0
- package/vendor/connector-worker/dist/daemon/device-concurrency.js +13 -0
- package/vendor/connector-worker/dist/daemon/executor.d.ts +1 -1
- package/vendor/connector-worker/dist/daemon/executor.js +48 -120
- package/vendor/connector-worker/dist/daemon/log.d.ts +2 -0
- package/vendor/connector-worker/dist/daemon/log.js +23 -2
- package/vendor/connector-worker/dist/daemon/mac-device-daemon.d.ts +23 -6
- package/vendor/connector-worker/dist/daemon/mac-device-daemon.js +57 -23
- package/vendor/connector-worker/dist/daemon/native-bridge/client.d.ts +6 -0
- package/vendor/connector-worker/dist/daemon/native-bridge/client.js +15 -0
- package/vendor/connector-worker/dist/daemon/native-bridge/executor.js +29 -25
- package/vendor/connector-worker/dist/daemon/native-bridge/protocol.d.ts +1 -1
- package/vendor/connector-worker/dist/daemon/native-bridge/protocol.js +1 -0
- package/vendor/connector-worker/dist/daemon/poll-loop.d.ts +3 -0
- package/vendor/connector-worker/dist/daemon/poll-loop.js +5 -1
- package/vendor/connector-worker/dist/daemon/start.d.ts +1 -0
- package/vendor/connector-worker/dist/daemon/start.js +15 -20
- package/vendor/connector-worker/dist/daemon/terminal-failure.js +0 -11
- package/vendor/connector-worker/dist/daemon/worker-id.d.ts +17 -0
- package/vendor/connector-worker/dist/daemon/worker-id.js +22 -0
- package/vendor/connector-worker/dist/executor/interface.d.ts +34 -2
- package/vendor/connector-worker/dist/executor/isolate.js +66 -15
- package/vendor/connector-worker/dist/executor/redact.d.ts +1 -0
- package/vendor/connector-worker/dist/executor/redact.js +97 -26
- package/vendor/connector-worker/dist/executor/runtime.d.ts +7 -0
- package/vendor/connector-worker/dist/executor/runtime.js +26 -0
- package/vendor/connector-worker/dist/isolate/bridge.js +3 -1
- package/vendor/connector-worker/dist/mac-device-daemon.js +24 -29
- package/vendor/connector-worker/package.json +2 -2
- package/vendor/core/dist/agent-policy.js +1 -1
- package/vendor/core/dist/agent-store.d.ts +2 -0
- package/vendor/core/dist/agent-tooling.d.ts +1 -1
- package/vendor/core/dist/agent-tooling.js +1 -1
- package/vendor/core/dist/capabilities.d.ts +1 -1
- package/vendor/core/dist/capabilities.js +2 -1
- package/vendor/core/dist/connector-query-errors.d.ts +32 -0
- package/vendor/core/dist/connector-query-errors.js +41 -1
- package/vendor/core/dist/contracts/agent-settings.d.ts +0 -11
- package/vendor/core/dist/contracts/agent-settings.js +1 -7
- package/vendor/core/dist/contracts/tools/collection-presentation.d.ts +93 -0
- package/vendor/core/dist/contracts/tools/collection-presentation.js +88 -0
- package/vendor/core/dist/contracts/tools/collection-selection.d.ts +47 -0
- package/vendor/core/dist/contracts/tools/collection-selection.js +74 -0
- package/vendor/core/dist/contracts/tools/manage-agents.d.ts +10 -4
- package/vendor/core/dist/contracts/tools/manage-auth-profiles.d.ts +1 -1
- package/vendor/core/dist/contracts/tools/manage-auth-profiles.js +5 -1
- package/vendor/core/dist/contracts/tools/manage-automations.d.ts +19 -4
- package/vendor/core/dist/contracts/tools/manage-automations.js +25 -8
- package/vendor/core/dist/contracts/tools/manage-connections.d.ts +1 -0
- package/vendor/core/dist/contracts/tools/manage-connections.js +3 -0
- package/vendor/core/dist/contracts/tools/manage-conversations.js +2 -2
- package/vendor/core/dist/contracts/tools/manage-entity-schema.d.ts +11 -0
- package/vendor/core/dist/contracts/tools/manage-entity-schema.js +42 -3
- package/vendor/core/dist/contracts/tools/manage-entity.d.ts +181 -152
- package/vendor/core/dist/contracts/tools/manage-entity.js +118 -162
- package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +14 -0
- package/vendor/core/dist/contracts/tools/manage-feeds.js +17 -0
- package/vendor/core/dist/contracts/tools/manage-operations.d.ts +41 -3
- package/vendor/core/dist/contracts/tools/manage-operations.js +40 -2
- package/vendor/core/dist/contracts/tools/manage-views.d.ts +182 -7
- package/vendor/core/dist/contracts/tools/manage-views.js +49 -13
- package/vendor/core/dist/contracts/tools/read-knowledge.d.ts +11 -2
- package/vendor/core/dist/contracts/tools/read-knowledge.js +23 -3
- package/vendor/core/dist/contracts/tools/save-memory.d.ts +3 -6
- package/vendor/core/dist/contracts/tools/save-memory.js +2 -6
- package/vendor/core/dist/contracts/tools/view-attach.d.ts +2 -1
- package/vendor/core/dist/contracts/tools/view-attach.js +7 -2
- package/vendor/core/dist/contracts/worker/protocol.d.ts +130 -159
- package/vendor/core/dist/contracts/worker/protocol.js +88 -76
- package/vendor/core/dist/device-pin-tombstones.d.ts +44 -0
- package/vendor/core/dist/device-pin-tombstones.js +57 -0
- package/vendor/core/dist/index.d.ts +5 -5
- package/vendor/core/dist/index.js +4 -6
- package/vendor/core/dist/json-template.d.ts +6 -10
- package/vendor/core/dist/json-template.js +5 -9
- package/vendor/core/dist/logger.js +17 -26
- package/vendor/core/dist/shell-safety.d.ts +9 -0
- package/vendor/core/dist/shell-safety.js +154 -0
- package/vendor/core/dist/suggestions.d.ts +1 -1
- package/vendor/core/dist/suggestions.js +1 -1
- package/vendor/core/dist/tool-trace-summary.d.ts +1 -1
- package/vendor/core/dist/tool-trace-summary.js +1 -1
- package/vendor/core/dist/types.d.ts +1 -3
- package/vendor/core/dist/utils/diagnostic-scrubber.d.ts +7 -0
- package/vendor/core/dist/utils/diagnostic-scrubber.js +437 -0
- package/vendor/core/dist/worker/auth.d.ts +44 -6
- package/vendor/core/dist/worker/auth.js +44 -11
- package/vendor/core/dist/worker/wire.d.ts +0 -10
- package/vendor/core/package.json +20 -11
- package/vendor/ora/.bun-tag-fde20e9a6df212fa +0 -0
- package/vendor/ora/index.d.ts +332 -0
- package/vendor/ora/index.js +424 -0
- package/vendor/ora/license +9 -0
- package/vendor/ora/package.json +53 -0
- package/vendor/ora/readme.md +329 -0
- package/vendor/cli/dist/commands/telemetry.d.ts +0 -10
- package/vendor/cli/dist/commands/telemetry.js +0 -66
- package/vendor/connector-worker/dist/daemon/device-chat.d.ts +0 -9
- package/vendor/connector-worker/dist/daemon/device-chat.js +0 -61
- package/vendor/core/dist/contracts/worker/device-chat.d.ts +0 -4
- package/vendor/core/dist/contracts/worker/device-chat.js +0 -26
- package/vendor/core/dist/sentry.d.ts +0 -26
- package/vendor/core/dist/sentry.js +0 -133
- package/vendor/core/dist/tool-policy.d.ts +0 -74
- package/vendor/core/dist/tool-policy.js +0 -305
- package/vendor/core/dist/utils/sentry-scrubber.d.ts +0 -29
- package/vendor/core/dist/utils/sentry-scrubber.js +0 -228
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GitHub Connector (V1 runtime)
|
|
3
3
|
*
|
|
4
|
-
* Syncs GitHub repository content and executes write actions.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Syncs GitHub repository content and executes write actions. Provider
|
|
5
|
+
* deliveries (the App webhook, or a per-connection hook for OAuth/PAT) mark the
|
|
6
|
+
* matching feed due; star deliveries are recorded directly through the
|
|
7
|
+
* stargazers feed's `normalize`, keyed on the poll's origin_id.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { randomBytes } from 'node:crypto';
|
|
@@ -17,9 +17,11 @@ import {
|
|
|
17
17
|
createHttpClient,
|
|
18
18
|
type EventAttributionRule,
|
|
19
19
|
type EventEnvelope,
|
|
20
|
+
type FeedWebhookDeclaration,
|
|
20
21
|
SubscriptionCandidateSchema,
|
|
21
22
|
type SyncContext,
|
|
22
23
|
type SyncResult,
|
|
24
|
+
type WebhookRecordContext,
|
|
23
25
|
type WebhookRegistration,
|
|
24
26
|
type WebhookRegistrationContext,
|
|
25
27
|
} from '@lobu/connector-sdk';
|
|
@@ -35,6 +37,7 @@ import {
|
|
|
35
37
|
githubUserIdentityKey,
|
|
36
38
|
normalizeGithubLogin,
|
|
37
39
|
normalizeGithubRepoFullName,
|
|
40
|
+
resolveGithubToken,
|
|
38
41
|
} from './github-identity.js';
|
|
39
42
|
|
|
40
43
|
type GitHubContentType =
|
|
@@ -377,12 +380,19 @@ const GITHUB_REPO_ATTRIBUTION: EventAttributionRule = {
|
|
|
377
380
|
},
|
|
378
381
|
};
|
|
379
382
|
|
|
383
|
+
// A delivery belongs to the repo feeds configured for its repository. GitHub
|
|
384
|
+
// owner/repo names are case-insensitive.
|
|
385
|
+
const GITHUB_REPO_MATCH: FeedWebhookDeclaration['match'] = {
|
|
386
|
+
fields: { repo_owner: 'repository.owner.login', repo_name: 'repository.name' },
|
|
387
|
+
caseInsensitive: true,
|
|
388
|
+
};
|
|
389
|
+
|
|
380
390
|
export default class GitHubConnector extends ConnectorRuntime {
|
|
381
391
|
readonly definition: RuntimeConnectorDefinition = {
|
|
382
392
|
key: 'github',
|
|
383
393
|
name: 'GitHub',
|
|
384
394
|
description: 'Collects GitHub issues/discussions and executes repo actions.',
|
|
385
|
-
version: '1.
|
|
395
|
+
version: '1.5.0',
|
|
386
396
|
automationEvents: GITHUB_AUTOMATION_EVENTS,
|
|
387
397
|
faviconDomain: 'github.com',
|
|
388
398
|
// A GitHub connection gives the agent's sandbox an authenticated `gh`.
|
|
@@ -400,6 +410,7 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
400
410
|
algorithm: 'sha256',
|
|
401
411
|
signaturePrefix: 'sha256=',
|
|
402
412
|
dedupeHeader: 'x-github-delivery',
|
|
413
|
+
eventType: { header: 'x-github-event' },
|
|
403
414
|
// App-installation delivery: one App-level webhook is configured ONCE on
|
|
404
415
|
// the GitHub App (not per connection), and inbound deliveries route via
|
|
405
416
|
// the shared `/api/v1/app-webhooks/github` endpoint keyed on
|
|
@@ -468,10 +479,11 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
468
479
|
type: 'oauth',
|
|
469
480
|
provider: 'github',
|
|
470
481
|
requiredScopes: ['read:user'],
|
|
471
|
-
//
|
|
472
|
-
//
|
|
473
|
-
//
|
|
474
|
-
|
|
482
|
+
// OPTIONAL scopes are requested only when selected, never at first
|
|
483
|
+
// connect. `repo` covers private-repo reads and write actions; listing
|
|
484
|
+
// repository collaborators for access sync needs `read:org` alongside
|
|
485
|
+
// `repo`; the hook scopes back live feeds and org-wide ingestion.
|
|
486
|
+
optionalScopes: ['repo', 'read:org', 'admin:repo_hook', 'admin:org_hook'],
|
|
475
487
|
loginScopes: ['read:user', 'user:email'],
|
|
476
488
|
clientIdKey: 'GITHUB_CLIENT_ID',
|
|
477
489
|
clientSecretKey: 'GITHUB_CLIENT_SECRET',
|
|
@@ -479,7 +491,7 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
479
491
|
tokenEndpointAuthMethod: 'client_secret_post',
|
|
480
492
|
required: false,
|
|
481
493
|
description:
|
|
482
|
-
'GitHub OAuth enables repo access for this connection. Upgrade to
|
|
494
|
+
'GitHub OAuth enables repo access for this connection. Upgrade to repo for private repositories and write actions; add read:org to synchronize repository access permissions.',
|
|
483
495
|
loginProvisioning: {
|
|
484
496
|
autoCreateConnection: true,
|
|
485
497
|
},
|
|
@@ -509,7 +521,7 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
509
521
|
requiredScopes: [],
|
|
510
522
|
description: 'Sync GitHub issues from a repository.',
|
|
511
523
|
displayNameTemplate: '{repo_owner}/{repo_name} issues',
|
|
512
|
-
webhook: { events: ['issues'] },
|
|
524
|
+
webhook: { events: ['issues'], match: GITHUB_REPO_MATCH },
|
|
513
525
|
configSchema: {
|
|
514
526
|
type: 'object',
|
|
515
527
|
required: ['repo_owner', 'repo_name'],
|
|
@@ -542,7 +554,7 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
542
554
|
requiredScopes: [],
|
|
543
555
|
description: 'Sync GitHub pull requests from a repository.',
|
|
544
556
|
displayNameTemplate: '{repo_owner}/{repo_name} PRs',
|
|
545
|
-
webhook: { events: ['pull_request'] },
|
|
557
|
+
webhook: { events: ['pull_request'], match: GITHUB_REPO_MATCH },
|
|
546
558
|
configSchema: {
|
|
547
559
|
type: 'object',
|
|
548
560
|
required: ['repo_owner', 'repo_name'],
|
|
@@ -575,7 +587,7 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
575
587
|
requiredScopes: [],
|
|
576
588
|
description: 'Sync comments on GitHub issues.',
|
|
577
589
|
displayNameTemplate: '{repo_owner}/{repo_name} issue comments',
|
|
578
|
-
webhook: { events: ['issue_comment'] },
|
|
590
|
+
webhook: { events: ['issue_comment'], match: GITHUB_REPO_MATCH },
|
|
579
591
|
configSchema: {
|
|
580
592
|
type: 'object',
|
|
581
593
|
required: ['repo_owner', 'repo_name'],
|
|
@@ -604,7 +616,7 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
604
616
|
requiredScopes: [],
|
|
605
617
|
description: 'Sync comments on GitHub pull requests.',
|
|
606
618
|
displayNameTemplate: '{repo_owner}/{repo_name} PR comments',
|
|
607
|
-
webhook: { events: ['pull_request_review_comment'] },
|
|
619
|
+
webhook: { events: ['pull_request_review_comment'], match: GITHUB_REPO_MATCH },
|
|
608
620
|
configSchema: {
|
|
609
621
|
type: 'object',
|
|
610
622
|
required: ['repo_owner', 'repo_name'],
|
|
@@ -633,7 +645,7 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
633
645
|
requiredScopes: [],
|
|
634
646
|
description: 'Sync GitHub discussions from a repository.',
|
|
635
647
|
displayNameTemplate: '{repo_owner}/{repo_name} discussions',
|
|
636
|
-
webhook: { events: ['discussion'] },
|
|
648
|
+
webhook: { events: ['discussion'], match: GITHUB_REPO_MATCH },
|
|
637
649
|
configSchema: {
|
|
638
650
|
type: 'object',
|
|
639
651
|
required: ['repo_owner', 'repo_name'],
|
|
@@ -665,7 +677,7 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
665
677
|
requiredScopes: [],
|
|
666
678
|
description: 'Sync comments on GitHub discussions.',
|
|
667
679
|
displayNameTemplate: '{repo_owner}/{repo_name} discussion comments',
|
|
668
|
-
webhook: { events: ['discussion_comment'] },
|
|
680
|
+
webhook: { events: ['discussion_comment'], match: GITHUB_REPO_MATCH },
|
|
669
681
|
configSchema: {
|
|
670
682
|
type: 'object',
|
|
671
683
|
required: ['repo_owner', 'repo_name'],
|
|
@@ -695,7 +707,7 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
695
707
|
requiredScopes: [],
|
|
696
708
|
description: 'Sync commits pushed to a repository, attributed to their authors.',
|
|
697
709
|
displayNameTemplate: '{repo_owner}/{repo_name} commits',
|
|
698
|
-
webhook: { events: ['push'] },
|
|
710
|
+
webhook: { events: ['push'], match: GITHUB_REPO_MATCH },
|
|
699
711
|
configSchema: {
|
|
700
712
|
type: 'object',
|
|
701
713
|
required: ['repo_owner', 'repo_name'],
|
|
@@ -726,7 +738,12 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
726
738
|
requiredScopes: [],
|
|
727
739
|
description: 'Sync GitHub users who starred a repository.',
|
|
728
740
|
displayNameTemplate: '{repo_owner}/{repo_name} stargazers',
|
|
729
|
-
webhook: {
|
|
741
|
+
webhook: {
|
|
742
|
+
events: ['star', 'watch'],
|
|
743
|
+
kind: 'record',
|
|
744
|
+
match: GITHUB_REPO_MATCH,
|
|
745
|
+
normalize: (payload, ctx) => this.normalizeStarDelivery(payload, ctx),
|
|
746
|
+
},
|
|
730
747
|
configSchema: {
|
|
731
748
|
type: 'object',
|
|
732
749
|
required: ['repo_owner', 'repo_name'],
|
|
@@ -911,7 +928,7 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
911
928
|
private async syncFeed(ctx: SyncContext): Promise<SyncResult> {
|
|
912
929
|
const config = ctx.config as GitHubConfig;
|
|
913
930
|
const repo = this.resolveRepo(config, {});
|
|
914
|
-
const token =
|
|
931
|
+
const token = resolveGithubToken(ctx.credentials?.accessToken, config);
|
|
915
932
|
const contentType = (ctx.feedKey ?? 'issues') as GitHubContentType;
|
|
916
933
|
// Cold start / checkpoint reset: resolveSince falls back to lookback_days
|
|
917
934
|
// (default 365). Every PR in that window is first-seen and would flood
|
|
@@ -963,7 +980,7 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
963
980
|
try {
|
|
964
981
|
const config = ctx.config as GitHubConfig;
|
|
965
982
|
const repo = this.resolveRepo(config, ctx.input);
|
|
966
|
-
const token =
|
|
983
|
+
const token = resolveGithubToken(ctx.credentials?.accessToken, config);
|
|
967
984
|
|
|
968
985
|
if (!token) {
|
|
969
986
|
return { success: false, error: 'GitHub action requires OAuth or GITHUB_TOKEN.' };
|
|
@@ -994,7 +1011,7 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
994
1011
|
}
|
|
995
1012
|
|
|
996
1013
|
// -------------------------------------------------------------------------
|
|
997
|
-
// Webhooks (subscription lifecycle
|
|
1014
|
+
// Webhooks (subscription lifecycle; the platform dispatches deliveries)
|
|
998
1015
|
// -------------------------------------------------------------------------
|
|
999
1016
|
|
|
1000
1017
|
/**
|
|
@@ -1046,7 +1063,7 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
1046
1063
|
return { externalId: '', metadata: { delivery: 'app_installation', noop: true } };
|
|
1047
1064
|
}
|
|
1048
1065
|
|
|
1049
|
-
const token =
|
|
1066
|
+
const token = resolveGithubToken(ctx.credentials?.accessToken, ctx.config);
|
|
1050
1067
|
if (!token) {
|
|
1051
1068
|
throw new Error('GitHub webhook registration requires OAuth or GITHUB_TOKEN.');
|
|
1052
1069
|
}
|
|
@@ -1067,10 +1084,9 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
1067
1084
|
body: {
|
|
1068
1085
|
name: 'web',
|
|
1069
1086
|
active: true,
|
|
1070
|
-
// Subscribe to
|
|
1071
|
-
//
|
|
1072
|
-
//
|
|
1073
|
-
// Override with config.webhook_events for a narrower subscription.
|
|
1087
|
+
// Subscribe to every event type; the platform dispatches only the
|
|
1088
|
+
// events a feed declares and acks the rest. Override with
|
|
1089
|
+
// config.webhook_events for a narrower subscription.
|
|
1074
1090
|
events: ctx.config.webhook_events ?? ['*'],
|
|
1075
1091
|
config: {
|
|
1076
1092
|
url: ctx.callbackUrl,
|
|
@@ -1093,7 +1109,7 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
1093
1109
|
const externalId = ctx.externalId;
|
|
1094
1110
|
if (!externalId) return;
|
|
1095
1111
|
|
|
1096
|
-
const token =
|
|
1112
|
+
const token = resolveGithubToken(ctx.credentials?.accessToken, ctx.config);
|
|
1097
1113
|
if (!token) return;
|
|
1098
1114
|
|
|
1099
1115
|
const base = this.hooksApiUrl(ctx.config);
|
|
@@ -1125,20 +1141,6 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
1125
1141
|
return { owner, repo };
|
|
1126
1142
|
}
|
|
1127
1143
|
|
|
1128
|
-
private resolveToken(oauthToken: string | undefined, config: GitHubConfig): string | null {
|
|
1129
|
-
if (oauthToken && oauthToken.trim().length > 0) {
|
|
1130
|
-
return oauthToken;
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
const envOverrides = config.env_overrides ?? {};
|
|
1134
|
-
const configuredToken =
|
|
1135
|
-
asString(envOverrides.GITHUB_TOKEN) ??
|
|
1136
|
-
asString((config as Record<string, unknown>).GITHUB_TOKEN) ??
|
|
1137
|
-
asString((config as Record<string, unknown>).github_token);
|
|
1138
|
-
|
|
1139
|
-
return configuredToken ?? null;
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
1144
|
private resolveSince(checkpoint: Record<string, unknown> | null, lookbackDays: number): string {
|
|
1143
1145
|
const cp = (checkpoint ?? {}) as GitHubCheckpoint;
|
|
1144
1146
|
const fromCheckpoint = toIsoOrUndefined(cp.last_sync_at);
|
|
@@ -1676,24 +1678,7 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
1676
1678
|
});
|
|
1677
1679
|
|
|
1678
1680
|
if (!previousStargazer) {
|
|
1679
|
-
events.push({
|
|
1680
|
-
origin_id: `stargazer_${repo.owner}_${repo.repo}_${githubKeyForOriginId(key)}`,
|
|
1681
|
-
title: `${login} starred ${repo.owner}/${repo.repo}`,
|
|
1682
|
-
payload_text: `${login} starred ${repo.owner}/${repo.repo}.`,
|
|
1683
|
-
author_name: login,
|
|
1684
|
-
source_url: user.html_url ?? `https://github.com/${login}`,
|
|
1685
|
-
occurred_at: starredAt,
|
|
1686
|
-
origin_type: 'stargazer',
|
|
1687
|
-
score: 1,
|
|
1688
|
-
metadata: {
|
|
1689
|
-
actor: this.buildActor(user, login),
|
|
1690
|
-
target,
|
|
1691
|
-
action: 'starred',
|
|
1692
|
-
starred_at: starredAt.toISOString(),
|
|
1693
|
-
source: 'github_stargazers_snapshot',
|
|
1694
|
-
...this.buildAuthorMetadata({ login, id: user.id }),
|
|
1695
|
-
},
|
|
1696
|
-
});
|
|
1681
|
+
events.push(this.stargazerEvent({ repo, user, login, starredAt, target, source: 'github_stargazers_snapshot' }));
|
|
1697
1682
|
}
|
|
1698
1683
|
}
|
|
1699
1684
|
const current = [...new Map(currentStargazers.map(star => [star.key, star])).values()];
|
|
@@ -1729,6 +1714,63 @@ export default class GitHubConnector extends ConnectorRuntime {
|
|
|
1729
1714
|
return { events, checkpoint: { last_sync_at: scan.started_at, stargazers: current }, status: 'complete' };
|
|
1730
1715
|
}
|
|
1731
1716
|
|
|
1717
|
+
/** The `stargazer` envelope the poll and a live star delivery share, so both key one origin_id. */
|
|
1718
|
+
private stargazerEvent(params: {
|
|
1719
|
+
repo: RepoRef;
|
|
1720
|
+
user: GitHubStargazerLike['user'] | GitHubStargazerLike;
|
|
1721
|
+
login: string;
|
|
1722
|
+
starredAt: Date;
|
|
1723
|
+
target: ReturnType<GitHubConnector['buildRepoTarget']>;
|
|
1724
|
+
source: string;
|
|
1725
|
+
}): EventEnvelope {
|
|
1726
|
+
const { repo, user, login, starredAt } = params;
|
|
1727
|
+
const key = githubUserIdentityKey({ userId: user?.id, login });
|
|
1728
|
+
return {
|
|
1729
|
+
origin_id: `stargazer_${repo.owner}_${repo.repo}_${githubKeyForOriginId(key)}`,
|
|
1730
|
+
title: `${login} starred ${repo.owner}/${repo.repo}`,
|
|
1731
|
+
payload_text: `${login} starred ${repo.owner}/${repo.repo}.`,
|
|
1732
|
+
author_name: login,
|
|
1733
|
+
source_url: user?.html_url ?? `https://github.com/${login}`,
|
|
1734
|
+
occurred_at: starredAt,
|
|
1735
|
+
origin_type: 'stargazer',
|
|
1736
|
+
score: 1,
|
|
1737
|
+
metadata: {
|
|
1738
|
+
actor: this.buildActor(user, login),
|
|
1739
|
+
target: params.target,
|
|
1740
|
+
action: 'starred',
|
|
1741
|
+
starred_at: starredAt.toISOString(),
|
|
1742
|
+
source: params.source,
|
|
1743
|
+
...this.buildAuthorMetadata({ login, id: user?.id }),
|
|
1744
|
+
},
|
|
1745
|
+
};
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
/**
|
|
1749
|
+
* Record a live star delivery as the stargazer event the poll emits for the
|
|
1750
|
+
* same user. Only a new star records; an unstar is left to the poll's
|
|
1751
|
+
* snapshot diff. The feed config (not the payload's display casing) names
|
|
1752
|
+
* the repo, so the origin_id matches the poll's.
|
|
1753
|
+
*/
|
|
1754
|
+
private normalizeStarDelivery(payload: unknown, ctx: WebhookRecordContext): EventEnvelope | null {
|
|
1755
|
+
const body = payload && typeof payload === 'object' ? (payload as Record<string, unknown>) : null;
|
|
1756
|
+
const action = asString(body?.action);
|
|
1757
|
+
const starred = ctx.eventType === 'star' ? action === 'created' : ctx.eventType === 'watch' && action === 'started';
|
|
1758
|
+
const sender = body?.sender as GitHubStargazerLike | undefined;
|
|
1759
|
+
const login = asString(sender?.login);
|
|
1760
|
+
if (!body || !starred || !login) return null;
|
|
1761
|
+
const repo = this.resolveRepo(ctx.config as GitHubConfig, {});
|
|
1762
|
+
const event = this.stargazerEvent({
|
|
1763
|
+
repo,
|
|
1764
|
+
user: sender,
|
|
1765
|
+
login,
|
|
1766
|
+
starredAt: new Date(toIsoOrUndefined(body.starred_at) ?? ctx.receivedAt),
|
|
1767
|
+
target: this.buildRepoTarget(repo, (body.repository ?? {}) as GitHubRepositoryLike),
|
|
1768
|
+
source: 'github_star_webhook',
|
|
1769
|
+
});
|
|
1770
|
+
this.stampRepoAttribution([event], repo, { attachAutomationSignals: false });
|
|
1771
|
+
return event;
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1732
1774
|
private shouldRefreshStargazerProfile(
|
|
1733
1775
|
previous: GitHubStargazerCheckpoint | undefined,
|
|
1734
1776
|
now: Date
|