@lobu/connector-sdk 7.2.0 → 9.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.
Files changed (67) hide show
  1. package/dist/connector-runtime.d.ts +23 -11
  2. package/dist/connector-runtime.d.ts.map +1 -1
  3. package/dist/connector-runtime.js +32 -8
  4. package/dist/connector-runtime.js.map +1 -1
  5. package/dist/connector-types.d.ts +27 -15
  6. package/dist/connector-types.d.ts.map +1 -1
  7. package/dist/connector-types.js +0 -7
  8. package/dist/connector-types.js.map +1 -1
  9. package/dist/file-source.d.ts +112 -0
  10. package/dist/file-source.d.ts.map +1 -0
  11. package/dist/file-source.js +40 -0
  12. package/dist/file-source.js.map +1 -0
  13. package/dist/identity-normalize.d.ts +12 -0
  14. package/dist/identity-normalize.d.ts.map +1 -1
  15. package/dist/identity-normalize.js +12 -0
  16. package/dist/identity-normalize.js.map +1 -1
  17. package/dist/index.d.ts +15 -9
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +14 -5
  20. package/dist/index.js.map +1 -1
  21. package/dist/reaction-client-types.d.ts +126 -0
  22. package/dist/reaction-client-types.d.ts.map +1 -0
  23. package/dist/reaction-client-types.js +2 -0
  24. package/dist/reaction-client-types.js.map +1 -0
  25. package/dist/sources/cache.d.ts +82 -0
  26. package/dist/sources/cache.d.ts.map +1 -0
  27. package/dist/sources/cache.js +169 -0
  28. package/dist/sources/cache.js.map +1 -0
  29. package/dist/sources/git-file-source.d.ts +33 -0
  30. package/dist/sources/git-file-source.d.ts.map +1 -0
  31. package/dist/sources/git-file-source.js +207 -0
  32. package/dist/sources/git-file-source.js.map +1 -0
  33. package/dist/sources/git-http.d.ts +48 -0
  34. package/dist/sources/git-http.d.ts.map +1 -0
  35. package/dist/sources/git-http.js +179 -0
  36. package/dist/sources/git-http.js.map +1 -0
  37. package/dist/sources/git-snapshot.d.ts +14 -0
  38. package/dist/sources/git-snapshot.d.ts.map +1 -0
  39. package/dist/sources/git-snapshot.js +96 -0
  40. package/dist/sources/git-snapshot.js.map +1 -0
  41. package/dist/sources/glob.d.ts +31 -0
  42. package/dist/sources/glob.d.ts.map +1 -0
  43. package/dist/sources/glob.js +129 -0
  44. package/dist/sources/glob.js.map +1 -0
  45. package/dist/sources/local-file-source.d.ts +29 -0
  46. package/dist/sources/local-file-source.d.ts.map +1 -0
  47. package/dist/sources/local-file-source.js +343 -0
  48. package/dist/sources/local-file-source.js.map +1 -0
  49. package/dist/sources/resolver.d.ts +6 -0
  50. package/dist/sources/resolver.d.ts.map +1 -0
  51. package/dist/sources/resolver.js +47 -0
  52. package/dist/sources/resolver.js.map +1 -0
  53. package/dist/sources/snapshot.d.ts +19 -0
  54. package/dist/sources/snapshot.d.ts.map +1 -0
  55. package/dist/sources/snapshot.js +91 -0
  56. package/dist/sources/snapshot.js.map +1 -0
  57. package/dist/sources/tarball-file-source.d.ts +28 -0
  58. package/dist/sources/tarball-file-source.d.ts.map +1 -0
  59. package/dist/sources/tarball-file-source.js +273 -0
  60. package/dist/sources/tarball-file-source.js.map +1 -0
  61. package/dist/types.d.ts +3 -65
  62. package/dist/types.d.ts.map +1 -1
  63. package/package.json +10 -3
  64. package/dist/event-taxonomy.d.ts +0 -3
  65. package/dist/event-taxonomy.d.ts.map +0 -1
  66. package/dist/event-taxonomy.js +0 -30
  67. package/dist/event-taxonomy.js.map +0 -1
package/dist/index.js CHANGED
@@ -8,8 +8,14 @@ export { ConnectorRuntime } from './connector-runtime.js';
8
8
  export { IDENTITY } from './connector-types.js';
9
9
  // Identity-engine SDK contracts. Each schema export is both a TypeBox
10
10
  // runtime validator (value) AND a TypeScript type via declaration merging.
11
- export { AssuranceLevel, assuranceMeets, AutoCreateWhenRule, CLAIM_COLLISION_SEMANTIC_TYPE, ClaimCollisionPayload, ConnectorFact, ConnectorIdentityCapability, DerivedFromProvenance, DerivedRelationshipMetadata, FactEventMetadata, IDENTITY_FACT_SEMANTIC_TYPE, MatchStrategy, RelationshipTypeIdentityMetadata, } from './identity-types.js';
12
- export { isSourceNativeEventType, SOURCE_NATIVE_EVENT_TYPES } from './event-taxonomy.js';
11
+ // We import then re-export locally instead of `export { } from
12
+ // './identity-types.js'`: bun's ESM linker (macOS + node26 + bun 1.3.5)
13
+ // intermittently fails to resolve a name through a large transitive
14
+ // re-export barrel, surfacing as a flaky `Export named 'X' not found in
15
+ // dist/index.js` under concurrent test load (issue #976). A local export
16
+ // list links against the already-bound import.
17
+ import { AssuranceLevel, assuranceMeets, AutoCreateWhenRule, CLAIM_COLLISION_SEMANTIC_TYPE, ClaimCollisionPayload, ConnectorFact, ConnectorIdentityCapability, DerivedFromProvenance, DerivedRelationshipMetadata, FactEventMetadata, IDENTITY_FACT_SEMANTIC_TYPE, RelationshipTypeIdentityMetadata, } from './identity-types.js';
18
+ export { AssuranceLevel, assuranceMeets, AutoCreateWhenRule, CLAIM_COLLISION_SEMANTIC_TYPE, ClaimCollisionPayload, ConnectorFact, ConnectorIdentityCapability, DerivedFromProvenance, DerivedRelationshipMetadata, FactEventMetadata, IDENTITY_FACT_SEMANTIC_TYPE, RelationshipTypeIdentityMetadata, };
13
19
  export { normalizeAuthUserId, normalizeEmail, normalizeGithubLogin, normalizeGithubRepoFullName, normalizeGoogleContactId, normalizeNumericId, normalizeIdentifier, normalizePhone, normalizeSlackUserId, normalizeWaJid, } from './identity-normalize.js';
14
20
  // Logger
15
21
  export { sdkLogger, sdkLogger as logger } from './logger.js';
@@ -19,9 +25,12 @@ export { withHttpRetry } from './retry.js';
19
25
  export { calculateEngagementScore } from './scoring.js';
20
26
  export { addWatcherPeriod, alignToWatcherWindowStart, getAvailableWatcherGranularities, getFinerWatcherGranularities, getNextWatcherGranularity, getWatcherDateTruncUnit, inferWatcherGranularityFromDays, inferWatcherGranularityFromSchedule, isWatcherTimeGranularity, shiftWatcherPeriod, subtractWatcherPeriod, WATCHER_TIME_GRANULARITIES, } from './watcher-time.js';
21
27
  export { acquireBrowser, BrowserAuthCascadeError } from './browser/acquire.js';
22
- export { discoverChromeListeningPorts, discoverChromeProcessCdpUrls, fetchCdpVersionInfo, normalizeCdpUrl, resolveCdpUrl, tryWebSocketCdp, } from './browser/cdp.js';
28
+ export { fetchCdpVersionInfo, resolveCdpUrl, } from './browser/cdp.js';
23
29
  export { CdpPage } from './browser/cdp-page.js';
24
- export { captureErrorArtifacts, launchBrowser, withErrorCapture, } from './browser/launcher.js';
25
- export { getRandomDelay, humanWait, launchStealthBrowser, randomScroll, testBotDetection, } from './browser/stealth.js';
30
+ export { captureErrorArtifacts, launchBrowser, } from './browser/launcher.js';
26
31
  export { browserNetworkSync } from './browser-network.js';
32
+ export { fileSystemSourceFromUri } from './file-source.js';
33
+ export { GitFileSource, parseGitUri } from './sources/git-file-source.js';
34
+ export { TarballFileSource } from './sources/tarball-file-source.js';
35
+ export { LocalFileSource } from './sources/local-file-source.js';
27
36
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,gFAAgF;AAIhF,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC9C,0CAA0C;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAsC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,sEAAsE;AACtE,2EAA2E;AAC3E,OAAO,EACL,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,6BAA6B,EAC7B,qBAAqB,EACrB,aAAa,EACb,2BAA2B,EAC3B,qBAAqB,EACrB,2BAA2B,EAC3B,iBAAiB,EACjB,2BAA2B,EAC3B,aAAa,EACb,gCAAgC,GACjC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE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/B,mCAAmC,EACnC,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EACL,mBAAmB,EACnB,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EACL,qBAAqB,EACrB,aAAa,GACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAmB1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Type declarations for watcher reaction scripts.
3
+ *
4
+ * Reaction scripts run inside an isolated-vm sandbox where `client` is a
5
+ * Proxy that dispatches calls to the host. You can't import real packages
6
+ * at runtime, but you CAN use these types for editor autocompletion.
7
+ *
8
+ * Usage:
9
+ * import type { ReactionClient, ReactionContext } from "@lobu/connector-sdk";
10
+ *
11
+ * export default async (ctx: ReactionContext, client: ReactionClient) => {
12
+ * await client.knowledge.save({ content: "...", semantic_type: "digest" });
13
+ * };
14
+ */
15
+ import type { ReactionContext } from "./reaction-sdk.js";
16
+ export type { ReactionContext };
17
+ export interface KnowledgeSearchInput {
18
+ query?: string;
19
+ entity_type?: string;
20
+ entity_id?: number;
21
+ fuzzy?: boolean;
22
+ min_similarity?: number;
23
+ limit?: number;
24
+ }
25
+ export interface KnowledgeSaveInput {
26
+ entity_ids?: number[];
27
+ content: string;
28
+ semantic_type: string;
29
+ metadata?: Record<string, unknown>;
30
+ title?: string;
31
+ slug?: string;
32
+ }
33
+ export interface KnowledgeReadInput {
34
+ content_id?: number;
35
+ watcher_id?: number;
36
+ since?: string;
37
+ until?: string;
38
+ limit?: number;
39
+ entity_ids?: number[];
40
+ }
41
+ export interface EntityCreateInput {
42
+ type: string;
43
+ name: string;
44
+ slug?: string;
45
+ content?: string;
46
+ parent_id?: number;
47
+ metadata?: Record<string, unknown>;
48
+ }
49
+ export interface EntityUpdateInput {
50
+ entity_id: number;
51
+ name?: string;
52
+ slug?: string;
53
+ content?: string;
54
+ metadata?: Record<string, unknown>;
55
+ }
56
+ export interface EntityLinkInput {
57
+ from_entity_id: number;
58
+ to_entity_id: number;
59
+ relationship_type_slug: string;
60
+ metadata?: Record<string, unknown>;
61
+ }
62
+ export interface EntityListFilter {
63
+ entity_type?: string;
64
+ search?: string;
65
+ limit?: number;
66
+ offset?: number;
67
+ sort_by?: string;
68
+ sort_order?: "asc" | "desc";
69
+ }
70
+ /**
71
+ * The client object available in reaction scripts.
72
+ *
73
+ * `client.knowledge` — read/write/search knowledge events
74
+ * `client.entities` — CRUD entities and relationships
75
+ * `client.query` — raw SQL (results as JSON rows)
76
+ * `client.log` — structured logging (appears in watcher run logs)
77
+ */
78
+ export interface ReactionClient {
79
+ knowledge: {
80
+ search(input: KnowledgeSearchInput): Promise<unknown>;
81
+ save(input: KnowledgeSaveInput): Promise<unknown>;
82
+ read(input: KnowledgeReadInput): Promise<unknown>;
83
+ delete(input: number | {
84
+ event_id?: number;
85
+ event_ids?: number[];
86
+ reason?: string;
87
+ }): Promise<unknown>;
88
+ };
89
+ entities: {
90
+ list(filter?: EntityListFilter): Promise<unknown>;
91
+ get(entity_id: number): Promise<unknown>;
92
+ create(input: EntityCreateInput): Promise<{
93
+ id: number;
94
+ }>;
95
+ update(input: EntityUpdateInput): Promise<unknown>;
96
+ delete(entity_id: number, options?: {
97
+ force_delete_tree?: boolean;
98
+ }): Promise<unknown>;
99
+ link(input: EntityLinkInput): Promise<unknown>;
100
+ unlink(input: {
101
+ from_entity_id: number;
102
+ to_entity_id: number;
103
+ relationship_type_slug: string;
104
+ }): Promise<unknown>;
105
+ updateLink(input: {
106
+ from_entity_id: number;
107
+ to_entity_id: number;
108
+ relationship_type_slug: string;
109
+ metadata?: Record<string, unknown>;
110
+ }): Promise<unknown>;
111
+ listLinks(input: {
112
+ entity_id: number;
113
+ relationship_type_slug?: string;
114
+ limit?: number;
115
+ offset?: number;
116
+ }): Promise<unknown>;
117
+ search(query: string, options?: {
118
+ limit?: number;
119
+ }): Promise<unknown>;
120
+ };
121
+ /** Run a read-only SQL query against the org's Postgres. */
122
+ query(sql: string): Promise<unknown[]>;
123
+ /** Structured log — appears in the watcher run output. */
124
+ log(message: string, data?: Record<string, unknown>): void;
125
+ }
126
+ //# sourceMappingURL=reaction-client-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reaction-client-types.d.ts","sourceRoot":"","sources":["../src/reaction-client-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,YAAY,EAAE,eAAe,EAAE,CAAC;AAIhC,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAA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AAE;YAChB,cAAc,EAAE,MAAM,CAAC;YACvB,YAAY,EAAE,MAAM,CAAC;YACrB,sBAAsB,EAAE,MAAM,CAAC;YAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACpC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;QACrB,SAAS,CAAC,KAAK,EAAE;YACf,SAAS,EAAE,MAAM,CAAC;YAClB,sBAAsB,CAAC,EAAE,MAAM,CAAC;YAChC,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,MAAM,CAAC,EAAE,MAAM,CAAC;SACjB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;QACrB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;YAAE,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;KACvE,CAAC;IAEF,4DAA4D;IAC5D,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAEvC,0DAA0D;IAC1D,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC5D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=reaction-client-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reaction-client-types.js","sourceRoot":"","sources":["../src/reaction-client-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Cache-layout helpers shared by all FileSystemSource implementations.
3
+ *
4
+ * ${WORKSPACE_DIR}/.lobu-cache/sources/<sha256(uri)[:32]>/
5
+ * ├── snapshot/ ← actual files (connector-visible via Snapshot.readFile)
6
+ * ├── manifest.json ← { ref, files: [{ path, sha256 }], fetched_at }
7
+ * └── meta.json ← { uri, kind }
8
+ *
9
+ * - `WORKSPACE_DIR` env var is the cache root; falls back to `process.cwd()`.
10
+ * - URI is hashed (sha256, first 32 hex chars = 128 bits) for filesystem-safe
11
+ * naming. 128 bits is collision-resistant even against adversarial URIs
12
+ * (1e19 URIs before 50% collision odds).
13
+ * - One cache directory per URI — same URI yields the same directory across
14
+ * runs so re-fetch is incremental for git, manifest-comparable for the rest.
15
+ * On reuse, `meta.json`'s `uri` field is verified to match — a mismatch
16
+ * (theoretical hash collision OR cache-root reuse across schemes) throws.
17
+ * - The cache layout is intentionally NOT exported on the public API; this
18
+ * module is internal to the SDK.
19
+ */
20
+ export type SourceKind = 'git' | 'tarball' | 'local';
21
+ export interface ManifestEntry {
22
+ path: string;
23
+ sha256: string;
24
+ }
25
+ export interface Manifest {
26
+ ref: string;
27
+ files: ManifestEntry[];
28
+ fetched_at: string;
29
+ }
30
+ export interface CacheMeta {
31
+ uri: string;
32
+ kind: SourceKind;
33
+ }
34
+ export interface CachePaths {
35
+ /** Absolute cache root for this URI. */
36
+ readonly root: string;
37
+ /** Where the source's files live (rootDir of the Snapshot). */
38
+ readonly snapshotDir: string;
39
+ /** manifest.json path. */
40
+ readonly manifestPath: string;
41
+ /** meta.json path. */
42
+ readonly metaPath: string;
43
+ }
44
+ /** Build the cache paths for `uri`, anchored under `cacheRoot`. */
45
+ export declare function cachePathsFor(uri: string, cacheRoot?: string): CachePaths;
46
+ /**
47
+ * Read `meta.json` if present and assert it matches `uri`. Throws on URI
48
+ * mismatch (defends against an adversarial collision OR an operator copying
49
+ * a cache dir across sources). Returns `null` for a fresh cache.
50
+ */
51
+ export declare function readAndVerifyMeta(metaPath: string, expectedUri: string): Promise<CacheMeta | null>;
52
+ /**
53
+ * Like `readAndVerifyMeta`, but rejects when the cache is uninitialised.
54
+ * Use this from `diffSinceRef()` paths — calling diff before fetch is a
55
+ * caller bug, and a missing meta also means a stale/collided cache dir
56
+ * should not be silently consumed.
57
+ */
58
+ export declare function requireMeta(metaPath: string, expectedUri: string): Promise<CacheMeta>;
59
+ export declare function withSourceLock<T>(uri: string, fn: () => Promise<T>): Promise<T>;
60
+ /** Default cache root: `WORKSPACE_DIR` env, else `process.cwd()`. */
61
+ export declare function defaultCacheRoot(): string;
62
+ export declare function readManifest(path: string): Promise<Manifest | null>;
63
+ export declare function writeManifest(path: string, manifest: Manifest): Promise<void>;
64
+ export declare function readMeta(path: string): Promise<CacheMeta | null>;
65
+ export declare function writeMeta(path: string, meta: CacheMeta): Promise<void>;
66
+ /**
67
+ * Diff two manifests by `(path, sha256)`. Order-independent.
68
+ */
69
+ export declare function diffManifests(prev: Manifest, next: Manifest): {
70
+ added: string[];
71
+ modified: string[];
72
+ removed: string[];
73
+ };
74
+ /**
75
+ * Canonicalize a manifest's `ref` from its file list:
76
+ *
77
+ * sha256 over lines of `<path>\0<sha256>\n`, sorted by path.
78
+ *
79
+ * Deterministic across runs and platforms.
80
+ */
81
+ export declare function canonicalManifestRef(files: ManifestEntry[]): string;
82
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/sources/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,CAAC;AAErD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,QAAQ,CAAC,WAAW,EAAE,MAA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AE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAiB5D;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,CAUnE"}
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Cache-layout helpers shared by all FileSystemSource implementations.
3
+ *
4
+ * ${WORKSPACE_DIR}/.lobu-cache/sources/<sha256(uri)[:32]>/
5
+ * ├── snapshot/ ← actual files (connector-visible via Snapshot.readFile)
6
+ * ├── manifest.json ← { ref, files: [{ path, sha256 }], fetched_at }
7
+ * └── meta.json ← { uri, kind }
8
+ *
9
+ * - `WORKSPACE_DIR` env var is the cache root; falls back to `process.cwd()`.
10
+ * - URI is hashed (sha256, first 32 hex chars = 128 bits) for filesystem-safe
11
+ * naming. 128 bits is collision-resistant even against adversarial URIs
12
+ * (1e19 URIs before 50% collision odds).
13
+ * - One cache directory per URI — same URI yields the same directory across
14
+ * runs so re-fetch is incremental for git, manifest-comparable for the rest.
15
+ * On reuse, `meta.json`'s `uri` field is verified to match — a mismatch
16
+ * (theoretical hash collision OR cache-root reuse across schemes) throws.
17
+ * - The cache layout is intentionally NOT exported on the public API; this
18
+ * module is internal to the SDK.
19
+ */
20
+ import { createHash } from 'node:crypto';
21
+ import { readFile, writeFile } from 'node:fs/promises';
22
+ import { join } from 'node:path';
23
+ /** Build the cache paths for `uri`, anchored under `cacheRoot`. */
24
+ export function cachePathsFor(uri, cacheRoot = defaultCacheRoot()) {
25
+ const hash = createHash('sha256').update(uri).digest('hex').slice(0, 32);
26
+ const root = join(cacheRoot, '.lobu-cache', 'sources', hash);
27
+ return {
28
+ root,
29
+ snapshotDir: join(root, 'snapshot'),
30
+ manifestPath: join(root, 'manifest.json'),
31
+ metaPath: join(root, 'meta.json'),
32
+ };
33
+ }
34
+ /**
35
+ * Read `meta.json` if present and assert it matches `uri`. Throws on URI
36
+ * mismatch (defends against an adversarial collision OR an operator copying
37
+ * a cache dir across sources). Returns `null` for a fresh cache.
38
+ */
39
+ export async function readAndVerifyMeta(metaPath, expectedUri) {
40
+ const meta = await readMeta(metaPath);
41
+ if (!meta)
42
+ return null;
43
+ if (meta.uri !== expectedUri) {
44
+ throw new Error(`FileSystemSource cache mismatch: ${metaPath} belongs to ${meta.uri}, ` +
45
+ `but ${expectedUri} was requested. Refusing to reuse cache directory.`);
46
+ }
47
+ return meta;
48
+ }
49
+ /**
50
+ * Like `readAndVerifyMeta`, but rejects when the cache is uninitialised.
51
+ * Use this from `diffSinceRef()` paths — calling diff before fetch is a
52
+ * caller bug, and a missing meta also means a stale/collided cache dir
53
+ * should not be silently consumed.
54
+ */
55
+ export async function requireMeta(metaPath, expectedUri) {
56
+ const meta = await readAndVerifyMeta(metaPath, expectedUri);
57
+ if (!meta) {
58
+ throw new Error(`FileSystemSource: source not fetched yet — call fetch() before diffSinceRef() (${expectedUri})`);
59
+ }
60
+ return meta;
61
+ }
62
+ /**
63
+ * Per-source mutex. Same URI → shared `Promise` chain so concurrent
64
+ * `fetch()` calls serialize. Process-local only — fine for the embedded
65
+ * worker model where one worker subprocess owns its cache.
66
+ *
67
+ * v1 limitation: two processes sharing the same
68
+ * `${WORKSPACE_DIR}/.lobu-cache` are NOT coordinated by this lock —
69
+ * each gets its own in-memory `_sourceLocks` map, and they can
70
+ * race-prune each other's per-ref dirs (see `pruneOldRefDirs` in each
71
+ * source impl). v1 assumes one cache owner per workspace. If we ever
72
+ * need multi-process sharing, replace this with a filesystem advisory
73
+ * lock (e.g. `proper-lockfile` against `${root}/.lock`) around
74
+ * fetch+prune.
75
+ *
76
+ * The map stores the *guarded* (error-swallowed) promise so a rejection in
77
+ * `fn` doesn't poison the chain. Identity comparison in `finally` uses the
78
+ * same stored reference, so cleanup actually removes the entry — an
79
+ * earlier draft created a fresh `.catch()` inside `finally` and leaked one
80
+ * entry per distinct URI.
81
+ */
82
+ const _sourceLocks = new Map();
83
+ export async function withSourceLock(uri, fn) {
84
+ const prev = _sourceLocks.get(uri) ?? Promise.resolve();
85
+ const next = prev.then(fn, fn);
86
+ const guarded = next.catch(() => undefined);
87
+ _sourceLocks.set(uri, guarded);
88
+ try {
89
+ return await next;
90
+ }
91
+ finally {
92
+ if (_sourceLocks.get(uri) === guarded) {
93
+ _sourceLocks.delete(uri);
94
+ }
95
+ }
96
+ }
97
+ /** Default cache root: `WORKSPACE_DIR` env, else `process.cwd()`. */
98
+ export function defaultCacheRoot() {
99
+ return process.env.WORKSPACE_DIR ?? process.cwd();
100
+ }
101
+ export async function readManifest(path) {
102
+ try {
103
+ const raw = await readFile(path, 'utf8');
104
+ return JSON.parse(raw);
105
+ }
106
+ catch (err) {
107
+ if (err.code === 'ENOENT')
108
+ return null;
109
+ throw err;
110
+ }
111
+ }
112
+ export async function writeManifest(path, manifest) {
113
+ await writeFile(path, JSON.stringify(manifest, null, 2), 'utf8');
114
+ }
115
+ export async function readMeta(path) {
116
+ try {
117
+ const raw = await readFile(path, 'utf8');
118
+ return JSON.parse(raw);
119
+ }
120
+ catch (err) {
121
+ if (err.code === 'ENOENT')
122
+ return null;
123
+ throw err;
124
+ }
125
+ }
126
+ export async function writeMeta(path, meta) {
127
+ await writeFile(path, JSON.stringify(meta, null, 2), 'utf8');
128
+ }
129
+ /**
130
+ * Diff two manifests by `(path, sha256)`. Order-independent.
131
+ */
132
+ export function diffManifests(prev, next) {
133
+ const prevMap = new Map(prev.files.map((f) => [f.path, f.sha256]));
134
+ const nextMap = new Map(next.files.map((f) => [f.path, f.sha256]));
135
+ const added = [];
136
+ const modified = [];
137
+ const removed = [];
138
+ for (const [path, sha] of nextMap) {
139
+ const prevSha = prevMap.get(path);
140
+ if (prevSha === undefined)
141
+ added.push(path);
142
+ else if (prevSha !== sha)
143
+ modified.push(path);
144
+ }
145
+ for (const path of prevMap.keys()) {
146
+ if (!nextMap.has(path))
147
+ removed.push(path);
148
+ }
149
+ return { added, modified, removed };
150
+ }
151
+ /**
152
+ * Canonicalize a manifest's `ref` from its file list:
153
+ *
154
+ * sha256 over lines of `<path>\0<sha256>\n`, sorted by path.
155
+ *
156
+ * Deterministic across runs and platforms.
157
+ */
158
+ export function canonicalManifestRef(files) {
159
+ const sorted = [...files].sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));
160
+ const h = createHash('sha256');
161
+ for (const f of sorted) {
162
+ h.update(f.path);
163
+ h.update('\0');
164
+ h.update(f.sha256);
165
+ h.update('\n');
166
+ }
167
+ return h.digest('hex');
168
+ }
169
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/sources/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AA+BjC,mEAAmE;AACnE,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,YAAoB,gBAAgB,EAAE;IAC/E,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACzE,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC7D,OAAO;QACL,IAAI;QACJ,WAAW,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC;QACnC,YAAY,EAAE,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC;QACzC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC;KAClC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,QAAgB,EAChB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AM,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3F,MAAM,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACvB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACf,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * GitFileSource — shallow git clone backed by `isomorphic-git`.
3
+ *
4
+ * - URI shape: `git+https://github.com/owner/repo.git[@<ref>]`. Ref may be
5
+ * a branch name, tag, or full commit SHA. If omitted, defaults to `main`.
6
+ * - Initial fetch: shallow clone (`depth: 1`, `singleBranch: true`).
7
+ * - Subsequent fetch: `git.fetch` against the same single branch with
8
+ * `depth: 1` — pulls only the new tip if upstream advanced.
9
+ * - `ref` = `resolveRef('HEAD')` (full commit SHA).
10
+ * - `diffSinceRef(prevRef)` walks two trees with `git.walk` and classifies
11
+ * each path by OID equality (`added`/`modified`/`removed`).
12
+ *
13
+ * Caveats called out in JSDoc rather than hidden:
14
+ *
15
+ * - With `depth: 1`, history before the current tip is NOT in the local
16
+ * repo. `git.walk` requires both trees to be reachable; if the caller
17
+ * passes a `prevRef` we no longer have on disk we throw a clear error.
18
+ * - Snapshot reads point at the working tree inside the cache. Git itself
19
+ * is not exposed.
20
+ */
21
+ import type { FileDelta, FileSystemSource, Snapshot } from '../file-source.js';
22
+ export interface ParsedGitUri {
23
+ url: string;
24
+ ref: string;
25
+ }
26
+ export declare function parseGitUri(uri: string): ParsedGitUri;
27
+ export declare class GitFileSource implements FileSystemSource {
28
+ #private;
29
+ constructor(uri: string);
30
+ fetch(): Promise<Snapshot>;
31
+ diffSinceRef(prevRef: string): Promise<FileDelta>;
32
+ }
33
+ //# sourceMappingURL=git-file-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-file-source.d.ts","sourceRoot":"","sources":["../../src/sources/git-file-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAUH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAiB/E,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAkBrD;AAED,qBAAa,aAAc,YAAW,gBAAgB;;gBAKxC,GAAG,EAAE,MAAM;IAMvB,KAAK,IAAI,OAAO,CAAC,QAAQ,CAAC;IAmD1B,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;CA2DlD"}