studiograph 1.3.3 → 1.3.5
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/agent/orchestrator.d.ts +10 -0
- package/dist/agent/orchestrator.js +26 -7
- package/dist/agent/orchestrator.js.map +1 -1
- package/dist/agent/skills/sync-configuration.md +4 -29
- package/dist/agent/skills/sync-setup.md +2 -4
- package/dist/agent/tools/graph-tools.d.ts +5 -1
- package/dist/agent/tools/graph-tools.js +161 -9
- package/dist/agent/tools/graph-tools.js.map +1 -1
- package/dist/agent/tools/ops-tools.js +15 -126
- package/dist/agent/tools/ops-tools.js.map +1 -1
- package/dist/agent/tools/permission-tools.d.ts +15 -14
- package/dist/agent/tools/permission-tools.js +65 -128
- package/dist/agent/tools/permission-tools.js.map +1 -1
- package/dist/agent/tools/sync-tools.d.ts +7 -6
- package/dist/agent/tools/sync-tools.js +205 -178
- package/dist/agent/tools/sync-tools.js.map +1 -1
- package/dist/cli/commands/about.d.ts +13 -0
- package/dist/cli/commands/about.js +97 -0
- package/dist/cli/commands/about.js.map +1 -0
- package/dist/cli/commands/clone.d.ts +5 -2
- package/dist/cli/commands/clone.js +131 -62
- package/dist/cli/commands/clone.js.map +1 -1
- package/dist/cli/commands/connector.d.ts +2 -16
- package/dist/cli/commands/connector.js +32 -109
- package/dist/cli/commands/connector.js.map +1 -1
- package/dist/cli/commands/deploy.d.ts +0 -1
- package/dist/cli/commands/deploy.js +13 -103
- package/dist/cli/commands/deploy.js.map +1 -1
- package/dist/cli/commands/init.js +6 -93
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/join.d.ts +3 -2
- package/dist/cli/commands/join.js +142 -97
- package/dist/cli/commands/join.js.map +1 -1
- package/dist/cli/commands/redeploy.js +1 -2
- package/dist/cli/commands/redeploy.js.map +1 -1
- package/dist/cli/commands/serve.d.ts +1 -3
- package/dist/cli/commands/serve.js +29 -109
- package/dist/cli/commands/serve.js.map +1 -1
- package/dist/cli/commands/start.js +1 -1
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/sync-collection.d.ts +14 -0
- package/dist/cli/commands/sync-collection.js +366 -0
- package/dist/cli/commands/sync-collection.js.map +1 -0
- package/dist/cli/commands/sync.d.ts +4 -2
- package/dist/cli/commands/sync.js +529 -94
- package/dist/cli/commands/sync.js.map +1 -1
- package/dist/cli/index.js +15 -30
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/setup-wizard.d.ts +0 -13
- package/dist/cli/setup-wizard.js +6 -81
- package/dist/cli/setup-wizard.js.map +1 -1
- package/dist/core/graph.d.ts +8 -2
- package/dist/core/graph.js +11 -7
- package/dist/core/graph.js.map +1 -1
- package/dist/core/types.d.ts +149 -21
- package/dist/core/types.js +16 -4
- package/dist/core/types.js.map +1 -1
- package/dist/core/workspace-manager.js +1 -5
- package/dist/core/workspace-manager.js.map +1 -1
- package/dist/core/workspace.d.ts +11 -4
- package/dist/core/workspace.js +61 -26
- package/dist/core/workspace.js.map +1 -1
- package/dist/integrations/asana.d.ts +26 -0
- package/dist/integrations/asana.js +77 -0
- package/dist/integrations/asana.js.map +1 -0
- package/dist/integrations/figma-local.d.ts +16 -0
- package/dist/integrations/figma-local.js +10 -0
- package/dist/integrations/figma-local.js.map +1 -0
- package/dist/integrations/figma.d.ts +17 -0
- package/dist/integrations/figma.js +16 -0
- package/dist/integrations/figma.js.map +1 -0
- package/dist/integrations/granola.d.ts +24 -0
- package/dist/integrations/granola.js +59 -0
- package/dist/integrations/granola.js.map +1 -0
- package/dist/integrations/linear.d.ts +14 -0
- package/dist/integrations/linear.js +70 -0
- package/dist/integrations/linear.js.map +1 -0
- package/dist/integrations/paper-local.d.ts +14 -0
- package/dist/integrations/paper-local.js +10 -0
- package/dist/integrations/paper-local.js.map +1 -0
- package/dist/integrations/paper.d.ts +2 -0
- package/dist/integrations/paper.js +10 -0
- package/dist/integrations/paper.js.map +1 -0
- package/dist/integrations/pipedrive.d.ts +26 -0
- package/dist/integrations/pipedrive.js +97 -0
- package/dist/integrations/pipedrive.js.map +1 -0
- package/dist/integrations/registry.d.ts +15 -0
- package/dist/integrations/registry.js +27 -0
- package/dist/integrations/registry.js.map +1 -0
- package/dist/integrations/types.d.ts +34 -0
- package/dist/integrations/types.js +9 -0
- package/dist/integrations/types.js.map +1 -0
- package/dist/mcp/connector-manager.d.ts +45 -31
- package/dist/mcp/connector-manager.js +164 -116
- package/dist/mcp/connector-manager.js.map +1 -1
- package/dist/mcp/server-oauth-provider.d.ts +56 -0
- package/dist/mcp/server-oauth-provider.js +138 -0
- package/dist/mcp/server-oauth-provider.js.map +1 -0
- package/dist/server/chrome/chrome.css +142 -28
- package/dist/server/chrome/chrome.js +46 -220
- package/dist/server/collab-authority.d.ts +70 -0
- package/dist/server/collab-authority.js +218 -0
- package/dist/server/collab-authority.js.map +1 -0
- package/dist/server/collab.d.ts +29 -0
- package/dist/server/collab.js +195 -0
- package/dist/server/collab.js.map +1 -0
- package/dist/server/commit-scheduler.d.ts +39 -0
- package/dist/server/commit-scheduler.js +113 -0
- package/dist/server/commit-scheduler.js.map +1 -0
- package/dist/server/index.d.ts +0 -2
- package/dist/server/index.js +166 -55
- package/dist/server/index.js.map +1 -1
- package/dist/server/routes/auth-api.d.ts +6 -0
- package/dist/server/routes/auth-api.js +78 -0
- package/dist/server/routes/auth-api.js.map +1 -1
- package/dist/server/routes/chat.js +4 -0
- package/dist/server/routes/chat.js.map +1 -1
- package/dist/server/routes/collab.d.ts +6 -0
- package/dist/server/routes/collab.js +10 -0
- package/dist/server/routes/collab.js.map +1 -0
- package/dist/server/routes/git-http.d.ts +23 -0
- package/dist/server/routes/git-http.js +251 -0
- package/dist/server/routes/git-http.js.map +1 -0
- package/dist/server/routes/graph-api.d.ts +6 -2
- package/dist/server/routes/graph-api.js +266 -82
- package/dist/server/routes/graph-api.js.map +1 -1
- package/dist/server/routes/mcp.d.ts +12 -0
- package/dist/server/routes/mcp.js +35 -0
- package/dist/server/routes/mcp.js.map +1 -0
- package/dist/server/routes/permissions-api.d.ts +6 -4
- package/dist/server/routes/permissions-api.js +53 -167
- package/dist/server/routes/permissions-api.js.map +1 -1
- package/dist/server/routes/sync-api.d.ts +26 -0
- package/dist/server/routes/sync-api.js +757 -0
- package/dist/server/routes/sync-api.js.map +1 -0
- package/dist/server/routes/ws.d.ts +9 -0
- package/dist/server/routes/ws.js +131 -0
- package/dist/server/routes/ws.js.map +1 -0
- package/dist/server/session-manager.d.ts +40 -0
- package/dist/server/session-manager.js +132 -0
- package/dist/server/session-manager.js.map +1 -0
- package/dist/server/ws-hub.d.ts +130 -0
- package/dist/server/ws-hub.js +250 -0
- package/dist/server/ws-hub.js.map +1 -0
- package/dist/server/yjs-manager.d.ts +59 -0
- package/dist/server/yjs-manager.js +194 -0
- package/dist/server/yjs-manager.js.map +1 -0
- package/dist/services/auth-service.d.ts +74 -0
- package/dist/services/auth-service.js +286 -6
- package/dist/services/auth-service.js.map +1 -1
- package/dist/services/git.d.ts +6 -0
- package/dist/services/git.js +32 -2
- package/dist/services/git.js.map +1 -1
- package/dist/services/sync/collection-sync.d.ts +73 -0
- package/dist/services/sync/collection-sync.js +726 -0
- package/dist/services/sync/collection-sync.js.map +1 -0
- package/dist/services/sync/commit.js +5 -20
- package/dist/services/sync/commit.js.map +1 -1
- package/dist/services/sync/data-fetcher.d.ts +31 -0
- package/dist/services/sync/data-fetcher.js +12 -0
- package/dist/services/sync/data-fetcher.js.map +1 -0
- package/dist/services/sync/entity-refresh.d.ts +30 -0
- package/dist/services/sync/entity-refresh.js +275 -0
- package/dist/services/sync/entity-refresh.js.map +1 -0
- package/dist/services/sync/frontmatter-extractor.d.ts +2 -2
- package/dist/services/sync/frontmatter-extractor.js +1 -2
- package/dist/services/sync/frontmatter-extractor.js.map +1 -1
- package/dist/services/sync/graph-match.js +1 -1
- package/dist/services/sync/graph-match.js.map +1 -1
- package/dist/services/sync/mcp-client.d.ts +16 -4
- package/dist/services/sync/mcp-client.js +34 -20
- package/dist/services/sync/mcp-client.js.map +1 -1
- package/dist/services/sync/prompts.js +1 -1
- package/dist/services/sync/reconciler.js +1 -2
- package/dist/services/sync/reconciler.js.map +1 -1
- package/dist/services/sync/rest-client.d.ts +40 -0
- package/dist/services/sync/rest-client.js +100 -0
- package/dist/services/sync/rest-client.js.map +1 -0
- package/dist/services/sync/source-config.d.ts +23 -1
- package/dist/services/sync/source-config.js +112 -16
- package/dist/services/sync/source-config.js.map +1 -1
- package/dist/services/sync/source-definitions/asana.d.ts +3 -4
- package/dist/services/sync/source-definitions/asana.js +7 -13
- package/dist/services/sync/source-definitions/asana.js.map +1 -1
- package/dist/services/sync/source-definitions/definitions.d.ts +5 -18
- package/dist/services/sync/source-definitions/definitions.js +4 -22
- package/dist/services/sync/source-definitions/definitions.js.map +1 -1
- package/dist/services/sync/source-definitions/granola.d.ts +1 -1
- package/dist/services/sync/source-definitions/granola.js +11 -18
- package/dist/services/sync/source-definitions/granola.js.map +1 -1
- package/dist/services/sync/source-definitions/linear.d.ts +1 -1
- package/dist/services/sync/source-definitions/linear.js +17 -15
- package/dist/services/sync/source-definitions/linear.js.map +1 -1
- package/dist/services/sync/source-definitions/pipedrive.d.ts +1 -1
- package/dist/services/sync/source-definitions/pipedrive.js +6 -15
- package/dist/services/sync/source-definitions/pipedrive.js.map +1 -1
- package/dist/services/sync/staging.js +1 -2
- package/dist/services/sync/staging.js.map +1 -1
- package/dist/services/sync/structured-extractor.d.ts +8 -2
- package/dist/services/sync/structured-extractor.js +243 -35
- package/dist/services/sync/structured-extractor.js.map +1 -1
- package/dist/services/sync/types.d.ts +192 -23
- package/dist/services/sync/unstructured-extractor.d.ts +1 -3
- package/dist/services/sync/unstructured-extractor.js +2 -14
- package/dist/services/sync/unstructured-extractor.js.map +1 -1
- package/dist/utils/git.d.ts +33 -20
- package/dist/utils/git.js +119 -62
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/preflight.d.ts +1 -15
- package/dist/utils/preflight.js +1 -35
- package/dist/utils/preflight.js.map +1 -1
- package/dist/web/_app/immutable/assets/0.CupILLQs.css +1 -0
- package/dist/web/_app/immutable/assets/3.CtJi4Cy9.css +1 -0
- package/dist/web/_app/immutable/assets/5.CydFyZSu.css +1 -0
- package/dist/web/_app/immutable/assets/6.kqeOo0OW.css +1 -0
- package/dist/web/_app/immutable/assets/7.CseIx7qQ.css +1 -0
- package/dist/web/_app/immutable/assets/8.BYpFDZHK.css +1 -0
- package/dist/web/_app/immutable/assets/AppShell.Ch_ef9hJ.css +1 -0
- package/dist/web/_app/immutable/assets/ChatPanel.CP-_8txt.css +1 -0
- package/dist/web/_app/immutable/chunks/0oxpWEgM.js +1 -0
- package/dist/web/_app/immutable/chunks/B1y7Wy5O.js +18 -0
- package/dist/web/_app/immutable/chunks/BBLgaWN8.js +1 -0
- package/dist/web/_app/immutable/chunks/BCB5cYCz.js +2 -0
- package/dist/web/_app/immutable/chunks/BNwaTAEi.js +1 -0
- package/dist/web/_app/immutable/chunks/{aosHekRC.js → BPUy9_sS.js} +1 -1
- package/dist/web/_app/immutable/chunks/BVBRzmeQ.js +7 -0
- package/dist/web/_app/immutable/chunks/{CUzqHQY_.js → BXuvR8Ks.js} +2 -1
- package/dist/web/_app/immutable/chunks/BeBar3OL.js +1 -0
- package/dist/web/_app/immutable/chunks/BuOTIbJu.js +1 -0
- package/dist/web/_app/immutable/chunks/CLFba8FK.js +5 -0
- package/dist/web/_app/immutable/chunks/CQCkXCml.js +1 -0
- package/dist/web/_app/immutable/chunks/CR70O-Zc.js +64 -0
- package/dist/web/_app/immutable/chunks/ChURX7q7.js +1 -0
- package/dist/web/_app/immutable/chunks/Cs5oz2oJ.js +5 -0
- package/dist/web/_app/immutable/chunks/Cs_ROD7H.js +2 -0
- package/dist/web/_app/immutable/chunks/D2aTbzFm.js +3 -0
- package/dist/web/_app/immutable/chunks/DCGSm8Hl.js +1 -0
- package/dist/web/_app/immutable/chunks/DMQKkbyp.js +1 -0
- package/dist/web/_app/immutable/chunks/DP09rP34.js +2 -0
- package/dist/web/_app/immutable/chunks/DiP47fAp.js +1 -0
- package/dist/web/_app/immutable/chunks/DvPliCZE.js +27 -0
- package/dist/web/_app/immutable/chunks/O0fx2ss6.js +1 -0
- package/dist/web/_app/immutable/chunks/mLOCL_1Z.js +1 -0
- package/dist/web/_app/immutable/chunks/xBRYfpah.js +1 -0
- package/dist/web/_app/immutable/entry/app.BcjicA1n.js +2 -0
- package/dist/web/_app/immutable/entry/start.Bwjb_6uL.js +1 -0
- package/dist/web/_app/immutable/nodes/0.p2-jprGE.js +10 -0
- package/dist/web/_app/immutable/nodes/1.DU93aLWG.js +1 -0
- package/dist/web/_app/immutable/nodes/2.cvPHG4LO.js +1 -0
- package/dist/web/_app/immutable/nodes/3.CTUfmgsr.js +11 -0
- package/dist/web/_app/immutable/nodes/{5.BBpmYkAu.js → 4.yO3SDYpr.js} +2 -2
- package/dist/web/_app/immutable/nodes/5.BQ_D1Eea.js +2 -0
- package/dist/web/_app/immutable/nodes/6.ljQTLrU2.js +1 -0
- package/dist/web/_app/immutable/nodes/7.C_LqUu_m.js +2 -0
- package/dist/web/_app/immutable/nodes/8.BA0tZS13.js +1 -0
- package/dist/web/_app/version.json +1 -1
- package/dist/web/index.html +10 -12
- package/package.json +12 -2
- package/dist/web/_app/immutable/assets/0.CDbX4Cwz.css +0 -1
- package/dist/web/_app/immutable/assets/3.BJy7pVXi.css +0 -1
- package/dist/web/_app/immutable/assets/4.Ad16uh9o.css +0 -1
- package/dist/web/_app/immutable/assets/6.Bm2i7O0j.css +0 -1
- package/dist/web/_app/immutable/assets/AppShell.D0rmbdqF.css +0 -1
- package/dist/web/_app/immutable/assets/ChatPanel.RFD5GGYI.css +0 -1
- package/dist/web/_app/immutable/assets/editor.CPAf2SRV.css +0 -1
- package/dist/web/_app/immutable/chunks/479TgXB4.js +0 -1
- package/dist/web/_app/immutable/chunks/4QY4j-jX.js +0 -1
- package/dist/web/_app/immutable/chunks/BFb0g4TQ.js +0 -64
- package/dist/web/_app/immutable/chunks/Bopa-Ask.js +0 -1
- package/dist/web/_app/immutable/chunks/COwytaCP.js +0 -1
- package/dist/web/_app/immutable/chunks/DEJSHbC3.js +0 -1
- package/dist/web/_app/immutable/chunks/DNywhIex.js +0 -23
- package/dist/web/_app/immutable/chunks/DTUXhwEY.js +0 -1
- package/dist/web/_app/immutable/chunks/DThXpa0U.js +0 -6
- package/dist/web/_app/immutable/chunks/Dh_H7Owr.js +0 -18
- package/dist/web/_app/immutable/chunks/Dml-u95b.js +0 -2
- package/dist/web/_app/immutable/chunks/DnlgZ_Tk.js +0 -5
- package/dist/web/_app/immutable/chunks/DtVH--hH.js +0 -6
- package/dist/web/_app/immutable/chunks/DvKVaE7M.js +0 -1
- package/dist/web/_app/immutable/chunks/MbiSz-iW.js +0 -2
- package/dist/web/_app/immutable/chunks/bSAC733J.js +0 -1
- package/dist/web/_app/immutable/entry/app.BvodXQQ0.js +0 -2
- package/dist/web/_app/immutable/entry/start.Bkui3Kyw.js +0 -1
- package/dist/web/_app/immutable/nodes/0.DfbCOBhn.js +0 -2
- package/dist/web/_app/immutable/nodes/1.vtxUGpe6.js +0 -1
- package/dist/web/_app/immutable/nodes/2.Cq29oW4h.js +0 -1
- package/dist/web/_app/immutable/nodes/3.SquslPZy.js +0 -1
- package/dist/web/_app/immutable/nodes/4.COV8FR8b.js +0 -16
- package/dist/web/_app/immutable/nodes/6.BBbh6z9I.js +0 -2
- /package/dist/web/_app/immutable/assets/{5.BhKgiXd2.css → 4.BhKgiXd2.css} +0 -0
|
@@ -4,6 +4,27 @@
|
|
|
4
4
|
* Defines source configs, extraction records, sync state, reconciliation
|
|
5
5
|
* results, and staging metadata used across all sync pipeline stages.
|
|
6
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* Declares a filterable field that a source exposes.
|
|
9
|
+
* Used by the UI to render filter inputs and by the sync runner to apply
|
|
10
|
+
* client-side post-extraction filters.
|
|
11
|
+
*/
|
|
12
|
+
export interface FilterFieldDef {
|
|
13
|
+
/** Key used in CollectionSyncRule.filter (e.g. "title_contains") */
|
|
14
|
+
key: string;
|
|
15
|
+
/** Display label shown in the UI */
|
|
16
|
+
label: string;
|
|
17
|
+
/** Input placeholder text */
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
/** Input type — currently only 'text' is supported */
|
|
20
|
+
type: 'text';
|
|
21
|
+
/** Where filtering is applied: 'client' = post-extraction, 'server' = passed to MCP API */
|
|
22
|
+
mode: 'client' | 'server';
|
|
23
|
+
/** Frontmatter fields to check when mode='client'. Defaults to ['title', 'name']. */
|
|
24
|
+
fields?: string[];
|
|
25
|
+
/** Comparison operator for client-side filtering. Default: 'contains'. */
|
|
26
|
+
op?: 'contains' | 'exact';
|
|
27
|
+
}
|
|
7
28
|
/**
|
|
8
29
|
* Source configuration stored at .studiograph/sources/<name>.json.
|
|
9
30
|
* Defines how to map external data to Studiograph entities.
|
|
@@ -30,8 +51,8 @@ export interface EntityMapping {
|
|
|
30
51
|
source_type: string;
|
|
31
52
|
/** Studiograph entity type (e.g. "project", "meeting") */
|
|
32
53
|
entity_type: string;
|
|
33
|
-
/** Repo to write to
|
|
34
|
-
target_repo
|
|
54
|
+
/** Repo to write to — set by collection-sync runner, not by source config */
|
|
55
|
+
target_repo?: string;
|
|
35
56
|
/** Structured: field map driven. Unstructured: LLM extraction. */
|
|
36
57
|
extraction_mode: 'structured' | 'unstructured' | 'frontmatter';
|
|
37
58
|
/** Maps source field paths to entity field names or transforms */
|
|
@@ -50,15 +71,8 @@ export interface EntityMapping {
|
|
|
50
71
|
* Pass an array to make multiple list calls and merge results
|
|
51
72
|
* (e.g. [{ archived: false }, { archived: true }]). */
|
|
52
73
|
list_params?: Record<string, any> | Record<string, any>[];
|
|
53
|
-
/** How entities are written to disk. 'entity' (default): repo/id
|
|
74
|
+
/** How entities are written to disk. 'entity' (default): repo/type/id.md. 'collection': repo/id.md */
|
|
54
75
|
write_mode?: 'entity' | 'collection';
|
|
55
|
-
/** Co-locate entities as sub-content inside a parent entity folder. */
|
|
56
|
-
co_locate?: {
|
|
57
|
-
/** Frontmatter field that references the parent entity (e.g., "project"). Value is a wikilink like "[[my-project]]". */
|
|
58
|
-
parent_field: string;
|
|
59
|
-
/** Subfolder name inside the parent entity folder (e.g., "tasks"). */
|
|
60
|
-
subfolder: string;
|
|
61
|
-
};
|
|
62
76
|
/** Fetch body content per record via a separate MCP tool call (e.g. readGoogleDoc).
|
|
63
77
|
* The result text becomes the entity's markdown body. */
|
|
64
78
|
content_tool?: {
|
|
@@ -70,6 +84,8 @@ export interface EntityMapping {
|
|
|
70
84
|
id_from?: string;
|
|
71
85
|
/** Extra args to pass to the tool (e.g. { format: "markdown" }) */
|
|
72
86
|
extra_args?: Record<string, any>;
|
|
87
|
+
/** Field name to extract content from in array responses (default: "content") */
|
|
88
|
+
content_field?: string;
|
|
73
89
|
};
|
|
74
90
|
/** Directory patterns to match source files */
|
|
75
91
|
directory_patterns?: string[];
|
|
@@ -77,6 +93,14 @@ export interface EntityMapping {
|
|
|
77
93
|
list_tool?: string;
|
|
78
94
|
/** Explicit MCP tool name for reading a file (e.g. "get_vault_file"). Falls back to heuristic matching. */
|
|
79
95
|
read_tool?: string;
|
|
96
|
+
/** REST endpoint path for listing (e.g. "/v1/notes") */
|
|
97
|
+
list_endpoint?: string;
|
|
98
|
+
/** REST endpoint path for detail (e.g. "/v1/notes/{note_id}") */
|
|
99
|
+
detail_endpoint?: string;
|
|
100
|
+
/** Extra query params for detail endpoint (e.g. { "include": "transcript" }) */
|
|
101
|
+
detail_params?: Record<string, string>;
|
|
102
|
+
/** Page size for REST pagination */
|
|
103
|
+
page_size?: number;
|
|
80
104
|
/** Maximum recursion depth for directory listing. 0 = files directly in the pattern dir, 1 = one level of subdirs, etc. Undefined = unlimited. */
|
|
81
105
|
max_depth?: number;
|
|
82
106
|
/** Glob pattern matched against filename (without .md extension). Only matching files are included. Supports * and ? wildcards. E.g. "dec-*", "*.project". */
|
|
@@ -91,7 +115,7 @@ export interface FieldTransform {
|
|
|
91
115
|
/** Target entity field name */
|
|
92
116
|
field: string;
|
|
93
117
|
/** Transform type to apply */
|
|
94
|
-
transform: 'direct' | 'kebab-case' | 'date-iso' | 'wikilink' | 'wikilink-array';
|
|
118
|
+
transform: 'direct' | 'kebab-case' | 'date-iso' | 'wikilink' | 'wikilink-array' | 'string-array';
|
|
95
119
|
/** For array-of-objects: extract this sub-path from each element before transforming */
|
|
96
120
|
subfield?: string;
|
|
97
121
|
}
|
|
@@ -113,17 +137,12 @@ export interface StagingMetadata {
|
|
|
113
137
|
export interface ExtractedRecord {
|
|
114
138
|
entity_type: string;
|
|
115
139
|
entity_id: string;
|
|
116
|
-
target_repo
|
|
140
|
+
target_repo?: string;
|
|
117
141
|
frontmatter: Record<string, any>;
|
|
118
142
|
content: string;
|
|
119
143
|
source_name: string;
|
|
120
144
|
source_ref: string;
|
|
121
145
|
confidence: number;
|
|
122
|
-
/** Co-location config from the entity mapping, if present. */
|
|
123
|
-
co_locate?: {
|
|
124
|
-
parent_field: string;
|
|
125
|
-
subfolder: string;
|
|
126
|
-
};
|
|
127
146
|
/** Write mode from the entity mapping, if present. */
|
|
128
147
|
write_mode?: 'entity' | 'collection';
|
|
129
148
|
}
|
|
@@ -152,7 +171,7 @@ export interface SourceSyncState {
|
|
|
152
171
|
export interface ReconciliationMatch {
|
|
153
172
|
entity_id: string;
|
|
154
173
|
entity_type: string;
|
|
155
|
-
target_repo
|
|
174
|
+
target_repo?: string;
|
|
156
175
|
records: ExtractedRecord[];
|
|
157
176
|
match_type: 'exact-id' | 'email' | 'name-variant' | 'fuzzy-name' | 'single';
|
|
158
177
|
action: 'create' | 'update';
|
|
@@ -161,11 +180,6 @@ export interface ReconciliationMatch {
|
|
|
161
180
|
confidence: number;
|
|
162
181
|
notes: string;
|
|
163
182
|
field_sources?: Record<string, string>;
|
|
164
|
-
/** Co-location config, if this entity should be written as sub-content. */
|
|
165
|
-
co_locate?: {
|
|
166
|
-
parent_field: string;
|
|
167
|
-
subfolder: string;
|
|
168
|
-
};
|
|
169
183
|
/** Write mode: 'entity' (default) or 'collection' (loose file). */
|
|
170
184
|
write_mode?: 'entity' | 'collection';
|
|
171
185
|
}
|
|
@@ -201,3 +215,158 @@ export interface DerivationRule {
|
|
|
201
215
|
/** Repo to write derived entities to */
|
|
202
216
|
target_repo: string;
|
|
203
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* New-format source definition stored at .studiograph/sources/<name>.json.
|
|
220
|
+
* Keyed by entity type, with primary/derived entity configs.
|
|
221
|
+
*/
|
|
222
|
+
export interface SourceDefinition {
|
|
223
|
+
connector: string;
|
|
224
|
+
/** Transport: 'mcp' (default) uses MCP tool calls, 'rest' uses direct HTTP. */
|
|
225
|
+
adapter?: 'mcp' | 'rest';
|
|
226
|
+
/** REST adapter config (required when adapter: 'rest'). */
|
|
227
|
+
rest?: {
|
|
228
|
+
base_url: string;
|
|
229
|
+
/** Auth via query params instead of headers (e.g. { api_token: "$PIPEDRIVE_API_TOKEN" }) */
|
|
230
|
+
query_auth?: Record<string, string>;
|
|
231
|
+
};
|
|
232
|
+
/** Filter fields this source supports (drives UI and client-side filtering). */
|
|
233
|
+
filter_fields?: FilterFieldDef[];
|
|
234
|
+
entities: Record<string, SourceEntityConfig>;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Configuration for a single entity type within a source definition.
|
|
238
|
+
*/
|
|
239
|
+
export interface SourceEntityConfig {
|
|
240
|
+
/** Source record type in the external system (e.g. "issue" for Linear). Defaults to the entity type key. */
|
|
241
|
+
source_type?: string;
|
|
242
|
+
/** If true, this is the primary entity type fetched from the source */
|
|
243
|
+
primary?: boolean;
|
|
244
|
+
/** Source field to derive from (for secondary entities like person from deal.contact_person) */
|
|
245
|
+
derive_from?: string;
|
|
246
|
+
/** Exact-match dedup field (e.g., "email" for person, "domain" for organization) */
|
|
247
|
+
dedupe_field?: string;
|
|
248
|
+
/** Maps source fields → entity fields (string for direct, FieldTransform for transforms) */
|
|
249
|
+
field_map: Record<string, string | FieldTransform>;
|
|
250
|
+
/** Maps source status values to entity status values */
|
|
251
|
+
status_map?: Record<string, string>;
|
|
252
|
+
/** Source field to slugify for entity_id */
|
|
253
|
+
id_from?: string;
|
|
254
|
+
/** Source field whose value becomes the entity markdown body */
|
|
255
|
+
content_from?: string;
|
|
256
|
+
/** If true, fetch full record via get tool for each listed ID */
|
|
257
|
+
fetch_details?: boolean;
|
|
258
|
+
/** Override the limit param sent to the list tool */
|
|
259
|
+
list_limit?: number;
|
|
260
|
+
/** Extra params passed to the list tool. Array = multiple calls merged. */
|
|
261
|
+
list_params?: Record<string, any> | Record<string, any>[];
|
|
262
|
+
/** Extraction mode (default: structured) */
|
|
263
|
+
extraction_mode?: 'structured' | 'frontmatter';
|
|
264
|
+
/** Directory patterns for frontmatter mode */
|
|
265
|
+
directory_patterns?: string[];
|
|
266
|
+
/** Explicit MCP tool name for listing */
|
|
267
|
+
list_tool?: string;
|
|
268
|
+
/** Explicit MCP tool name for reading */
|
|
269
|
+
read_tool?: string;
|
|
270
|
+
/** REST endpoint path for listing (e.g. "/v1/notes") */
|
|
271
|
+
list_endpoint?: string;
|
|
272
|
+
/** REST endpoint path for detail (e.g. "/v1/notes/{note_id}") */
|
|
273
|
+
detail_endpoint?: string;
|
|
274
|
+
/** Extra query params for detail endpoint (e.g. { "include": "transcript" }) */
|
|
275
|
+
detail_params?: Record<string, string>;
|
|
276
|
+
/** Pagination style for REST adapter */
|
|
277
|
+
pagination?: 'cursor' | 'offset' | 'none';
|
|
278
|
+
/** Page size for REST adapter */
|
|
279
|
+
page_size?: number;
|
|
280
|
+
/** Field name containing the record ID (default: 'id') */
|
|
281
|
+
id_field?: string;
|
|
282
|
+
/** Fetch body content per record via a separate tool/endpoint call */
|
|
283
|
+
content_tool?: {
|
|
284
|
+
tool: string;
|
|
285
|
+
id_param: string;
|
|
286
|
+
id_from?: string;
|
|
287
|
+
extra_args?: Record<string, any>;
|
|
288
|
+
content_field?: string;
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* A single target within a workspace-level sync rule.
|
|
293
|
+
*/
|
|
294
|
+
export interface WorkspaceSyncTarget {
|
|
295
|
+
/** Collection to write matching entities into */
|
|
296
|
+
repo: string;
|
|
297
|
+
/** Client-side filter applied after extraction (same shape as CollectionSyncRule.filter) */
|
|
298
|
+
filter?: Record<string, any>;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* A workspace-level sync rule (stored in workspace.json top-level sync array).
|
|
302
|
+
* Fetches from a source once and distributes to multiple target collections.
|
|
303
|
+
*/
|
|
304
|
+
export interface WorkspaceSyncRule {
|
|
305
|
+
/** Source definition name */
|
|
306
|
+
source: string;
|
|
307
|
+
/** Override which entity type from source def (default: primary) */
|
|
308
|
+
entity_type?: string;
|
|
309
|
+
/** One or more target collections. A target with no filter receives all records. */
|
|
310
|
+
targets: WorkspaceSyncTarget[];
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Result of one target within a workspace sync rule run.
|
|
314
|
+
*/
|
|
315
|
+
export interface WorkspaceSyncTargetResult {
|
|
316
|
+
repo: string;
|
|
317
|
+
created: number;
|
|
318
|
+
skipped: number;
|
|
319
|
+
derived: number;
|
|
320
|
+
errors: string[];
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Result of running one workspace-level sync rule.
|
|
324
|
+
*/
|
|
325
|
+
export interface WorkspaceSyncRuleResult {
|
|
326
|
+
source: string;
|
|
327
|
+
targets: WorkspaceSyncTargetResult[];
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* A sync rule on a collection (stored in workspace.json repo entry).
|
|
331
|
+
*/
|
|
332
|
+
export interface CollectionSyncRule {
|
|
333
|
+
/** Source definition name (matches .studiograph/sources/<name>.json) */
|
|
334
|
+
source: string;
|
|
335
|
+
/** Override which entity type from source def (default: primary) */
|
|
336
|
+
entity_type?: string;
|
|
337
|
+
/** Source-side filter passed to MCP connector */
|
|
338
|
+
filter?: Record<string, any>;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Result of syncing one source into one collection.
|
|
342
|
+
*/
|
|
343
|
+
export interface CollectionSyncResult {
|
|
344
|
+
collection: string;
|
|
345
|
+
source: string;
|
|
346
|
+
created: number;
|
|
347
|
+
skipped: number;
|
|
348
|
+
derived: number;
|
|
349
|
+
errors: string[];
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* A single field diff for entity refresh.
|
|
353
|
+
*/
|
|
354
|
+
export interface RefreshDiff {
|
|
355
|
+
field: string;
|
|
356
|
+
old_value: any;
|
|
357
|
+
new_value: any;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Result of refreshing a single entity from its source.
|
|
361
|
+
*/
|
|
362
|
+
export interface RefreshResult {
|
|
363
|
+
entity_id: string;
|
|
364
|
+
source_ref: string;
|
|
365
|
+
diffs: RefreshDiff[];
|
|
366
|
+
body_changed: boolean;
|
|
367
|
+
body_diff?: {
|
|
368
|
+
old: string;
|
|
369
|
+
new: string;
|
|
370
|
+
};
|
|
371
|
+
applied: boolean;
|
|
372
|
+
}
|
|
@@ -6,14 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { SyncMCPClient } from './mcp-client.js';
|
|
8
8
|
import type { SchemaRegistry } from '../../core/schema-registry.js';
|
|
9
|
-
import type { GraphRAGClient } from './graphrag-client.js';
|
|
10
9
|
import type { SourceConfig, EntityMapping, ExtractedRecord, SourceFile } from './types.js';
|
|
11
10
|
export declare class UnstructuredExtractor {
|
|
12
11
|
private client;
|
|
13
12
|
private sourceConfig;
|
|
14
13
|
private schemaRegistry;
|
|
15
|
-
|
|
16
|
-
constructor(client: SyncMCPClient, sourceConfig: SourceConfig, schemaRegistry: SchemaRegistry, graphrag?: GraphRAGClient);
|
|
14
|
+
constructor(client: SyncMCPClient, sourceConfig: SourceConfig, schemaRegistry: SchemaRegistry);
|
|
17
15
|
/**
|
|
18
16
|
* Discover files matching directory patterns.
|
|
19
17
|
*/
|
|
@@ -12,12 +12,10 @@ export class UnstructuredExtractor {
|
|
|
12
12
|
client;
|
|
13
13
|
sourceConfig;
|
|
14
14
|
schemaRegistry;
|
|
15
|
-
|
|
16
|
-
constructor(client, sourceConfig, schemaRegistry, graphrag) {
|
|
15
|
+
constructor(client, sourceConfig, schemaRegistry) {
|
|
17
16
|
this.client = client;
|
|
18
17
|
this.sourceConfig = sourceConfig;
|
|
19
18
|
this.schemaRegistry = schemaRegistry;
|
|
20
|
-
this.graphrag = graphrag;
|
|
21
19
|
}
|
|
22
20
|
/**
|
|
23
21
|
* Discover files matching directory patterns.
|
|
@@ -122,16 +120,7 @@ export class UnstructuredExtractor {
|
|
|
122
120
|
// Get schema for extraction
|
|
123
121
|
const schema = this.schemaRegistry.getSchema(mapping.entity_type);
|
|
124
122
|
try {
|
|
125
|
-
|
|
126
|
-
let graphragContext;
|
|
127
|
-
if (this.graphrag) {
|
|
128
|
-
const entityName = file.name.replace(/\.md$/, '');
|
|
129
|
-
const ctx = this.graphrag.getEntityContext(entityName, mapping.entity_type, content);
|
|
130
|
-
if (ctx.formattedContext) {
|
|
131
|
-
graphragContext = ctx.formattedContext;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
const frontmatter = await llmExtract(content, mapping.entity_type, schema, graphragContext);
|
|
123
|
+
const frontmatter = await llmExtract(content, mapping.entity_type, schema);
|
|
135
124
|
// Generate entity_id from extracted name/title or filename
|
|
136
125
|
const nameField = frontmatter.name ?? frontmatter.title ?? file.name.replace(/\.md$/, '');
|
|
137
126
|
const entityId = slugify(String(nameField));
|
|
@@ -147,7 +136,6 @@ export class UnstructuredExtractor {
|
|
|
147
136
|
source_ref: `${this.sourceConfig.name}:${file.path}`,
|
|
148
137
|
confidence: 0.7,
|
|
149
138
|
...(mapping.write_mode ? { write_mode: mapping.write_mode } : {}),
|
|
150
|
-
...(mapping.co_locate ? { co_locate: mapping.co_locate } : {}),
|
|
151
139
|
};
|
|
152
140
|
}
|
|
153
141
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unstructured-extractor.js","sourceRoot":"","sources":["../../../src/services/sync/unstructured-extractor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"unstructured-extractor.js","sourceRoot":"","sources":["../../../src/services/sync/unstructured-extractor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAIvD,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,MAAM,OAAO,qBAAqB;IACxB,MAAM,CAAgB;IACtB,YAAY,CAAe;IAC3B,cAAc,CAAiB;IAEvC,YAAY,MAAqB,EAAE,YAA0B,EAAE,cAA8B;QAC3F,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,OAAsB;QACnC,0EAA0E;QAC1E,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS;YAChC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,SAAS,CAAC;YAC/C,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAA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AO,CAAC,GAAG,CACpC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAC9D,CAAC;YACF,KAAK,MAAM,MAAM,IAAI,YAAY,EAAE,CAAC;gBAClC,IAAI,MAAM;oBAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAED,SAAS,YAAY,CAAC,GAAW;IAC/B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC;AAED,iFAAiF;AACjF,SAAS,aAAa,CAAC,GAAW;IAChC,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IACzC,MAAM,KAAK,GAAG,MAAM,EAAE,KAAK,IAAI,MAAM,EAAE,IAAI,IAAI,MAAM,EAAE,OAAO,IAAI,MAAM,EAAE,KAAK,CAAC;IAChF,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3C,CAAC"}
|
package/dist/utils/git.d.ts
CHANGED
|
@@ -2,20 +2,22 @@
|
|
|
2
2
|
* Thin wrappers around git shell operations.
|
|
3
3
|
* Extracted so tests can mock them without mocking the built-in child_process.
|
|
4
4
|
*/
|
|
5
|
-
export type PullResult = 'updated' | 'up-to-date' | '
|
|
5
|
+
export type PullResult = 'updated' | 'up-to-date' | 'diverged';
|
|
6
6
|
export type PushResult = 'pushed' | 'nothing-to-push' | 'rejected';
|
|
7
7
|
export interface GitPullOptions {
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
/** Basic Auth credentials for the embedded git server (injected via GIT_ASKPASS). */
|
|
9
|
+
credentials?: {
|
|
10
|
+
username: string;
|
|
11
|
+
password: string;
|
|
12
|
+
};
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
|
-
* Pull the latest changes in a local git repo.
|
|
14
|
-
*
|
|
15
|
-
* (
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* Pull the latest changes in a local git repo using fetch + fast-forward merge.
|
|
16
|
+
* Returns 'updated', 'up-to-date', or 'diverged' (local has commits the remote doesn't).
|
|
17
|
+
* Throws on hard errors (no remote, auth failure, fetch error, etc.).
|
|
18
|
+
*
|
|
19
|
+
* Fast-forward only: if the branches have diverged the caller should ask the
|
|
20
|
+
* user to resolve manually with `git pull --rebase`.
|
|
19
21
|
*/
|
|
20
22
|
export declare function gitPull(repoPath: string, opts?: GitPullOptions): PullResult;
|
|
21
23
|
/**
|
|
@@ -24,11 +26,6 @@ export declare function gitPull(repoPath: string, opts?: GitPullOptions): PullRe
|
|
|
24
26
|
* Throws on hard errors (no remote, auth failure, etc.).
|
|
25
27
|
*/
|
|
26
28
|
export declare function gitPush(repoPath: string): PushResult;
|
|
27
|
-
/**
|
|
28
|
-
* Pop the most recent stash entry, if any.
|
|
29
|
-
* Safe to call even if the stash is empty.
|
|
30
|
-
*/
|
|
31
|
-
export declare function gitStashPop(repoPath: string): void;
|
|
32
29
|
/**
|
|
33
30
|
* Check if a git repo has uncommitted changes (staged or unstaged).
|
|
34
31
|
* Returns true if the working tree is dirty.
|
|
@@ -38,9 +35,30 @@ export declare function gitHasUncommittedChanges(repoPath: string): boolean;
|
|
|
38
35
|
* Check if a directory is a git repository.
|
|
39
36
|
*/
|
|
40
37
|
export declare function isGitRepo(repoPath: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Check if a git repo has a remote named "origin" configured.
|
|
40
|
+
*/
|
|
41
|
+
export declare function gitHasRemote(repoPath: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Set or update the 'origin' remote URL on a local git repo.
|
|
44
|
+
*/
|
|
45
|
+
export declare function gitSetRemote(repoPath: string, url: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Push local commits to origin with Basic Auth credentials via GIT_ASKPASS.
|
|
48
|
+
* Used for pushing to the embedded git server.
|
|
49
|
+
*/
|
|
50
|
+
export declare function gitPushWithCredentials(repoPath: string, credentials: {
|
|
51
|
+
username: string;
|
|
52
|
+
password: string;
|
|
53
|
+
}): PushResult;
|
|
41
54
|
export interface GitCloneOptions {
|
|
42
55
|
/** When true, suppress all output and disable interactive prompts (for server use). */
|
|
43
56
|
silent?: boolean;
|
|
57
|
+
/** Basic Auth credentials for the embedded git server. */
|
|
58
|
+
credentials?: {
|
|
59
|
+
username: string;
|
|
60
|
+
password: string;
|
|
61
|
+
};
|
|
44
62
|
}
|
|
45
63
|
/**
|
|
46
64
|
* Clone a remote repository to a local path.
|
|
@@ -54,11 +72,6 @@ export interface GitCloneOptions {
|
|
|
54
72
|
* Throws if the git command fails.
|
|
55
73
|
*/
|
|
56
74
|
export declare function gitClone(remoteUrl: string, localPath: string, opts?: GitCloneOptions): void;
|
|
57
|
-
/**
|
|
58
|
-
* Check if a git repo is currently in a rebase state.
|
|
59
|
-
* Looks for .git/rebase-merge/ or .git/rebase-apply/ directories.
|
|
60
|
-
*/
|
|
61
|
-
export declare function isInRebase(repoPath: string): boolean;
|
|
62
75
|
/**
|
|
63
76
|
* Read a git config value.
|
|
64
77
|
* Returns undefined if the key is not set.
|