agentgraph-connector-twg 0.2.0__tar.gz

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 (28) hide show
  1. agentgraph_connector_twg-0.2.0/LICENSE +21 -0
  2. agentgraph_connector_twg-0.2.0/PKG-INFO +165 -0
  3. agentgraph_connector_twg-0.2.0/README.md +150 -0
  4. agentgraph_connector_twg-0.2.0/agentgraph_connector_twg/__init__.py +1209 -0
  5. agentgraph_connector_twg-0.2.0/agentgraph_connector_twg/atlas.py +352 -0
  6. agentgraph_connector_twg-0.2.0/agentgraph_connector_twg/client.py +331 -0
  7. agentgraph_connector_twg-0.2.0/agentgraph_connector_twg/config.py +176 -0
  8. agentgraph_connector_twg-0.2.0/agentgraph_connector_twg/confluence.py +222 -0
  9. agentgraph_connector_twg-0.2.0/agentgraph_connector_twg/jira.py +462 -0
  10. agentgraph_connector_twg-0.2.0/agentgraph_connector_twg/loom.py +271 -0
  11. agentgraph_connector_twg-0.2.0/agentgraph_connector_twg/payloads.py +298 -0
  12. agentgraph_connector_twg-0.2.0/agentgraph_connector_twg/stubs.py +44 -0
  13. agentgraph_connector_twg-0.2.0/agentgraph_connector_twg/urls.py +459 -0
  14. agentgraph_connector_twg-0.2.0/agentgraph_connector_twg.egg-info/PKG-INFO +165 -0
  15. agentgraph_connector_twg-0.2.0/agentgraph_connector_twg.egg-info/SOURCES.txt +26 -0
  16. agentgraph_connector_twg-0.2.0/agentgraph_connector_twg.egg-info/dependency_links.txt +1 -0
  17. agentgraph_connector_twg-0.2.0/agentgraph_connector_twg.egg-info/entry_points.txt +2 -0
  18. agentgraph_connector_twg-0.2.0/agentgraph_connector_twg.egg-info/requires.txt +2 -0
  19. agentgraph_connector_twg-0.2.0/agentgraph_connector_twg.egg-info/top_level.txt +1 -0
  20. agentgraph_connector_twg-0.2.0/pyproject.toml +71 -0
  21. agentgraph_connector_twg-0.2.0/setup.cfg +4 -0
  22. agentgraph_connector_twg-0.2.0/tests/test_atlas.py +235 -0
  23. agentgraph_connector_twg-0.2.0/tests/test_client.py +228 -0
  24. agentgraph_connector_twg-0.2.0/tests/test_confluence.py +122 -0
  25. agentgraph_connector_twg-0.2.0/tests/test_connector.py +1106 -0
  26. agentgraph_connector_twg-0.2.0/tests/test_jira.py +314 -0
  27. agentgraph_connector_twg-0.2.0/tests/test_loom.py +172 -0
  28. agentgraph_connector_twg-0.2.0/tests/test_urls.py +261 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Simon Wade
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,165 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentgraph-connector-twg
3
+ Version: 0.2.0
4
+ Summary: Atlassian Teamwork Graph (twg) connector for AgentGraph
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/simonexmachina/agentgraph-connector-twg
7
+ Project-URL: Repository, https://github.com/simonexmachina/agentgraph-connector-twg
8
+ Project-URL: Issues, https://github.com/simonexmachina/agentgraph-connector-twg/issues
9
+ Requires-Python: >=3.12
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: agentgraph-server<0.8,>=0.7.0
13
+ Requires-Dist: pydantic>=2.12.5
14
+ Dynamic: license-file
15
+
16
+ # agentgraph-connector-twg
17
+
18
+ An [AgentGraph](https://github.com/simonexmachina/agent-graph) connector for the Atlassian
19
+ Teamwork Graph, built on the `twg` CLI.
20
+
21
+ | Resource | Entity | Content indexed |
22
+ | --- | --- | --- |
23
+ | Jira work item | `Task` | Summary, description, comments, status, assignee, labels |
24
+ | JPD idea | `Task` | As a Jira work item, plus its delivery-ticket links |
25
+ | Jira project | `Folder` | Container for its work items |
26
+ | Confluence page | `Document` | Heading outline plus the page body as markdown |
27
+ | Confluence space | `Folder` | Container for its pages |
28
+ | Atlas goal | `Task` | Name, description, status, owner, target date, latest update |
29
+ | Atlas project | `Task` | The same, plus its linked goals |
30
+ | Loom video | `Video` | Title, description, and the **transcript**; `metadata.web_url` is the watch link |
31
+
32
+ People become `Person` entities from reporters, assignees, commenters, authors, editors, video
33
+ owners, Atlas owners and update authors, and `@` mentions. Relationships from
34
+ `twg context jira workitem`, Jira issue links, and Atlas goal/project links become `references`
35
+ edges, with stub entities for linked resources that have not been fetched yet.
36
+
37
+ This package is kept outside the AgentGraph repository because `twg` is internal Atlassian tooling.
38
+
39
+ ## Requirements
40
+
41
+ - AgentGraph 0.7.0 through 0.7.x (it provides the `Task` and `Video` entity types this connector
42
+ emits).
43
+ - The `twg` CLI, authenticated. The connector never authenticates on your behalf. It reads through
44
+ `twg jira`, `twg confluence`, `twg loom`, `twg context`, and — for Atlas — `twg goals get` and
45
+ `twg projects get`.
46
+
47
+ ## Install
48
+
49
+ ```bash
50
+ uv pip install agentgraph-connector-twg
51
+ ```
52
+
53
+ Releases through 0.2.0 were published privately as `atlassian-agentgraph-connector-twg`; the Python
54
+ import package is unchanged.
55
+
56
+ Confirm registration and configure your site:
57
+
58
+ ```bash
59
+ agentgraph list-connectors
60
+ ```
61
+
62
+ ```bash
63
+ agentgraph connector twg add-site <site>
64
+ ```
65
+
66
+ ```bash
67
+ agentgraph connector twg status
68
+ ```
69
+
70
+ ## Authentication
71
+
72
+ `twg` owns the Atlassian OAuth session. When it expires, the connector reports it and every fetch
73
+ returns the same remediation:
74
+
75
+ ```bash
76
+ twg auth refresh
77
+ ```
78
+
79
+ Run that in a real terminal. `twg` needs write access to `~/.config/twg`, which a sandboxed agent
80
+ cannot grant. Under the `com.agentgraph.server` LaunchAgent the server can refresh the session
81
+ itself.
82
+
83
+ If `twg` is not on `PATH` — likely under launchd — the connector probes `~/.local/bin/twg`,
84
+ `/opt/homebrew/bin/twg` and `/usr/local/bin/twg`. Set `AGENTGRAPH_TWG_BIN` to override.
85
+
86
+ ## Configuration
87
+
88
+ Settings live in `<agentgraph-config-dir>/twg.json` (usually `~/.agentgraph/twg.json`) and are
89
+ managed through the CLI:
90
+
91
+ | Command | Effect |
92
+ | --- | --- |
93
+ | `agentgraph connector twg add-site <site>` / `remove-site` | Atlassian sites; the first is the default `--site` |
94
+ | `agentgraph connector twg add-jql "<jql>"` / `remove-jql` | JQL swept by ingest, then queues an ingest |
95
+ | `agentgraph connector twg add-space <KEY>` / `remove-space` | Confluence spaces swept by ingest, then queues an ingest |
96
+ | `agentgraph connector twg status` | Binary, version, session, and configured scopes |
97
+
98
+ `<site>` is the tenant name, and a site URL is accepted in its place. Both host spellings are
99
+ understood, so `hello`, `hello.atlassian.net` and the per-product domain a migrated tenant is
100
+ served from (`hello.jira.atlassian.cloud`, `hello.confluence.atlassian.cloud`) all configure the
101
+ site `hello`, and browsing either host is observed. Anything else is rejected rather than stored.
102
+
103
+ ## Refresh behaviour
104
+
105
+ - **Observe / fetch:** browsing or fetching a supported URL fetches that resource. Confluence short
106
+ links (`/wiki/x/<tiny>`) are resolved through `twg resolve`.
107
+ - **Poll (every 30 minutes):** `twg work query --scope me` covers your own recently touched work
108
+ items, pages, and videos, hydrating at most `poll_item_limit` (default 50) resources per run and
109
+ skipping anything fetched within the last 15 minutes.
110
+ - **Ingest:** the same sweep over `ingest_since` (default 90 days), plus every configured JQL query
111
+ and Confluence space.
112
+ - **Atlas goals and projects** are indexed on observation or an explicit `agentgraph fetch` only.
113
+ They are not part of the poll or the ingest sweep, and there is nothing to configure for them:
114
+ `home.atlassian.com/o/<orgId>/s/<cloudId>/(goal|project)/<KEY>` carries everything a fetch needs.
115
+ Because that host is not site-scoped, Atlas observation is not narrowed to the configured sites.
116
+ - **JPD ideas** are Jira work items, so they ride the Jira paths above with no extra configuration.
117
+
118
+ Only your own activity and explicitly configured scopes are indexed.
119
+
120
+ ## Data locality
121
+
122
+ Indexed Jira, Confluence, and Loom content — including transcripts — is stored in the local
123
+ AgentGraph SQLite database and becomes readable by any MCP client you connect. This is internal
124
+ work data; choose your polled scopes deliberately.
125
+
126
+ ## Development
127
+
128
+ ```bash
129
+ uv sync
130
+ ```
131
+
132
+ That installs the `dev` dependency group and resolves AgentGraph from PyPI per `uv.lock`. Run the
133
+ same gates CI does (`.github/workflows/ci.yml`):
134
+
135
+ ```bash
136
+ .venv/bin/python -m pytest -q
137
+ .venv/bin/python -m ruff check .
138
+ .venv/bin/python -m pyright
139
+ ```
140
+
141
+ Tests never invoke the real `twg`: the subprocess layer is patched and payload fixtures live in
142
+ `tests/conftest.py`. Those fixtures follow the field paths reported by
143
+ `twg help describe "<command>"`. Re-record them from live output when a `twg` upgrade changes a
144
+ payload, and keep parsing tolerant — `payloads.py` reads the documented field first and falls back
145
+ to known aliases.
146
+
147
+ ### Against a local AgentGraph checkout
148
+
149
+ To develop this connector against an unreleased AgentGraph — a new entity type or a change to
150
+ `BaseConnector` — install that checkout editable over the resolved one:
151
+
152
+ ```bash
153
+ uv pip install -e ../agentgraph --config-setting editable_mode=compat
154
+ ```
155
+
156
+ `editable_mode=compat` is what keeps `pyright` working. A default editable install writes a runtime
157
+ import hook that pyright cannot follow statically, so every `agentgraph` import resolves to nothing
158
+ and cascades into roughly a thousand unknown-type errors. `compat` writes a plain path entry
159
+ instead, and the committed `[tool.pyright]` config then resolves the checkout unchanged.
160
+
161
+ `uv.lock` still pins `agentgraph-server` to a published release, and `uv run`/`uv sync` sync
162
+ exactly against it — **either will silently revert this install**. Run the gates through
163
+ `.venv/bin/python` as above, not `uv run`. If `ModuleNotFoundError: No module named 'agentgraph'`
164
+ appears, or `pyright` suddenly reports hundreds of unknown types, the install was reverted: run the
165
+ command again. To go back to the released AgentGraph deliberately, `uv sync`.
@@ -0,0 +1,150 @@
1
+ # agentgraph-connector-twg
2
+
3
+ An [AgentGraph](https://github.com/simonexmachina/agent-graph) connector for the Atlassian
4
+ Teamwork Graph, built on the `twg` CLI.
5
+
6
+ | Resource | Entity | Content indexed |
7
+ | --- | --- | --- |
8
+ | Jira work item | `Task` | Summary, description, comments, status, assignee, labels |
9
+ | JPD idea | `Task` | As a Jira work item, plus its delivery-ticket links |
10
+ | Jira project | `Folder` | Container for its work items |
11
+ | Confluence page | `Document` | Heading outline plus the page body as markdown |
12
+ | Confluence space | `Folder` | Container for its pages |
13
+ | Atlas goal | `Task` | Name, description, status, owner, target date, latest update |
14
+ | Atlas project | `Task` | The same, plus its linked goals |
15
+ | Loom video | `Video` | Title, description, and the **transcript**; `metadata.web_url` is the watch link |
16
+
17
+ People become `Person` entities from reporters, assignees, commenters, authors, editors, video
18
+ owners, Atlas owners and update authors, and `@` mentions. Relationships from
19
+ `twg context jira workitem`, Jira issue links, and Atlas goal/project links become `references`
20
+ edges, with stub entities for linked resources that have not been fetched yet.
21
+
22
+ This package is kept outside the AgentGraph repository because `twg` is internal Atlassian tooling.
23
+
24
+ ## Requirements
25
+
26
+ - AgentGraph 0.7.0 through 0.7.x (it provides the `Task` and `Video` entity types this connector
27
+ emits).
28
+ - The `twg` CLI, authenticated. The connector never authenticates on your behalf. It reads through
29
+ `twg jira`, `twg confluence`, `twg loom`, `twg context`, and — for Atlas — `twg goals get` and
30
+ `twg projects get`.
31
+
32
+ ## Install
33
+
34
+ ```bash
35
+ uv pip install agentgraph-connector-twg
36
+ ```
37
+
38
+ Releases through 0.2.0 were published privately as `atlassian-agentgraph-connector-twg`; the Python
39
+ import package is unchanged.
40
+
41
+ Confirm registration and configure your site:
42
+
43
+ ```bash
44
+ agentgraph list-connectors
45
+ ```
46
+
47
+ ```bash
48
+ agentgraph connector twg add-site <site>
49
+ ```
50
+
51
+ ```bash
52
+ agentgraph connector twg status
53
+ ```
54
+
55
+ ## Authentication
56
+
57
+ `twg` owns the Atlassian OAuth session. When it expires, the connector reports it and every fetch
58
+ returns the same remediation:
59
+
60
+ ```bash
61
+ twg auth refresh
62
+ ```
63
+
64
+ Run that in a real terminal. `twg` needs write access to `~/.config/twg`, which a sandboxed agent
65
+ cannot grant. Under the `com.agentgraph.server` LaunchAgent the server can refresh the session
66
+ itself.
67
+
68
+ If `twg` is not on `PATH` — likely under launchd — the connector probes `~/.local/bin/twg`,
69
+ `/opt/homebrew/bin/twg` and `/usr/local/bin/twg`. Set `AGENTGRAPH_TWG_BIN` to override.
70
+
71
+ ## Configuration
72
+
73
+ Settings live in `<agentgraph-config-dir>/twg.json` (usually `~/.agentgraph/twg.json`) and are
74
+ managed through the CLI:
75
+
76
+ | Command | Effect |
77
+ | --- | --- |
78
+ | `agentgraph connector twg add-site <site>` / `remove-site` | Atlassian sites; the first is the default `--site` |
79
+ | `agentgraph connector twg add-jql "<jql>"` / `remove-jql` | JQL swept by ingest, then queues an ingest |
80
+ | `agentgraph connector twg add-space <KEY>` / `remove-space` | Confluence spaces swept by ingest, then queues an ingest |
81
+ | `agentgraph connector twg status` | Binary, version, session, and configured scopes |
82
+
83
+ `<site>` is the tenant name, and a site URL is accepted in its place. Both host spellings are
84
+ understood, so `hello`, `hello.atlassian.net` and the per-product domain a migrated tenant is
85
+ served from (`hello.jira.atlassian.cloud`, `hello.confluence.atlassian.cloud`) all configure the
86
+ site `hello`, and browsing either host is observed. Anything else is rejected rather than stored.
87
+
88
+ ## Refresh behaviour
89
+
90
+ - **Observe / fetch:** browsing or fetching a supported URL fetches that resource. Confluence short
91
+ links (`/wiki/x/<tiny>`) are resolved through `twg resolve`.
92
+ - **Poll (every 30 minutes):** `twg work query --scope me` covers your own recently touched work
93
+ items, pages, and videos, hydrating at most `poll_item_limit` (default 50) resources per run and
94
+ skipping anything fetched within the last 15 minutes.
95
+ - **Ingest:** the same sweep over `ingest_since` (default 90 days), plus every configured JQL query
96
+ and Confluence space.
97
+ - **Atlas goals and projects** are indexed on observation or an explicit `agentgraph fetch` only.
98
+ They are not part of the poll or the ingest sweep, and there is nothing to configure for them:
99
+ `home.atlassian.com/o/<orgId>/s/<cloudId>/(goal|project)/<KEY>` carries everything a fetch needs.
100
+ Because that host is not site-scoped, Atlas observation is not narrowed to the configured sites.
101
+ - **JPD ideas** are Jira work items, so they ride the Jira paths above with no extra configuration.
102
+
103
+ Only your own activity and explicitly configured scopes are indexed.
104
+
105
+ ## Data locality
106
+
107
+ Indexed Jira, Confluence, and Loom content — including transcripts — is stored in the local
108
+ AgentGraph SQLite database and becomes readable by any MCP client you connect. This is internal
109
+ work data; choose your polled scopes deliberately.
110
+
111
+ ## Development
112
+
113
+ ```bash
114
+ uv sync
115
+ ```
116
+
117
+ That installs the `dev` dependency group and resolves AgentGraph from PyPI per `uv.lock`. Run the
118
+ same gates CI does (`.github/workflows/ci.yml`):
119
+
120
+ ```bash
121
+ .venv/bin/python -m pytest -q
122
+ .venv/bin/python -m ruff check .
123
+ .venv/bin/python -m pyright
124
+ ```
125
+
126
+ Tests never invoke the real `twg`: the subprocess layer is patched and payload fixtures live in
127
+ `tests/conftest.py`. Those fixtures follow the field paths reported by
128
+ `twg help describe "<command>"`. Re-record them from live output when a `twg` upgrade changes a
129
+ payload, and keep parsing tolerant — `payloads.py` reads the documented field first and falls back
130
+ to known aliases.
131
+
132
+ ### Against a local AgentGraph checkout
133
+
134
+ To develop this connector against an unreleased AgentGraph — a new entity type or a change to
135
+ `BaseConnector` — install that checkout editable over the resolved one:
136
+
137
+ ```bash
138
+ uv pip install -e ../agentgraph --config-setting editable_mode=compat
139
+ ```
140
+
141
+ `editable_mode=compat` is what keeps `pyright` working. A default editable install writes a runtime
142
+ import hook that pyright cannot follow statically, so every `agentgraph` import resolves to nothing
143
+ and cascades into roughly a thousand unknown-type errors. `compat` writes a plain path entry
144
+ instead, and the committed `[tool.pyright]` config then resolves the checkout unchanged.
145
+
146
+ `uv.lock` still pins `agentgraph-server` to a published release, and `uv run`/`uv sync` sync
147
+ exactly against it — **either will silently revert this install**. Run the gates through
148
+ `.venv/bin/python` as above, not `uv run`. If `ModuleNotFoundError: No module named 'agentgraph'`
149
+ appears, or `pyright` suddenly reports hundreds of unknown types, the install was reverted: run the
150
+ command again. To go back to the released AgentGraph deliberately, `uv sync`.