gravity-schema 0.12.0__tar.gz → 0.12.2__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 (140) hide show
  1. gravity_schema-0.12.2/PKG-INFO +115 -0
  2. gravity_schema-0.12.2/README.md +103 -0
  3. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/microsoft_teams.yaml +2 -1
  4. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/pyproject.toml +1 -1
  5. gravity_schema-0.12.0/PKG-INFO +0 -15
  6. gravity_schema-0.12.0/README.md +0 -3
  7. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/.gitignore +0 -0
  8. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/LICENSE +0 -0
  9. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/NOTICE +0 -0
  10. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/__init__.py +0 -0
  11. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/__main__.py +0 -0
  12. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/built_ins.py +0 -0
  13. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/catalog.py +0 -0
  14. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/catalog.yaml +0 -0
  15. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/catalog_imported.yaml +0 -0
  16. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/contract.py +0 -0
  17. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/cron.py +0 -0
  18. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/describe.py +0 -0
  19. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/errors.py +0 -0
  20. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/export.py +0 -0
  21. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/gen_catalog.py +0 -0
  22. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/gen_vocabulary.py +0 -0
  23. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/instance.py +0 -0
  24. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/manifest.py +0 -0
  25. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/manifest_v2.py +0 -0
  26. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/rules.py +0 -0
  27. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/rules_cases.json +0 -0
  28. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/source_scan.py +0 -0
  29. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/specs.py +0 -0
  30. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/validation.py +0 -0
  31. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/__init__.py +0 -0
  32. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/__main__.py +0 -0
  33. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/capabilities.yaml +0 -0
  34. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/airtable.yaml +0 -0
  35. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/asana.yaml +0 -0
  36. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/browser_tool.yaml +0 -0
  37. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/composio_search.yaml +0 -0
  38. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/dropbox.yaml +0 -0
  39. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/exa.yaml +0 -0
  40. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/excel.yaml +0 -0
  41. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/firecrawl.yaml +0 -0
  42. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/github.yaml +0 -0
  43. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/gmail.yaml +0 -0
  44. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/googlecalendar.yaml +0 -0
  45. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/googledocs.yaml +0 -0
  46. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/googledrive.yaml +0 -0
  47. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/googlesheets.yaml +0 -0
  48. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/googleslides.yaml +0 -0
  49. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/googletasks.yaml +0 -0
  50. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/hackernews.yaml +0 -0
  51. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/hubspot.yaml +0 -0
  52. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/instagram.yaml +0 -0
  53. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/jira.yaml +0 -0
  54. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/linear.yaml +0 -0
  55. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/linkedin.yaml +0 -0
  56. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/notion.yaml +0 -0
  57. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/outlook.yaml +0 -0
  58. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/perplexityai.yaml +0 -0
  59. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/pinterest.yaml +0 -0
  60. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/reddit.yaml +0 -0
  61. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/slack.yaml +0 -0
  62. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/tavily.yaml +0 -0
  63. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/connectors/youtube.yaml +0 -0
  64. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/core_shapes.yaml +0 -0
  65. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/generated_shapes.yaml +0 -0
  66. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/policy.yaml +0 -0
  67. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/airtable.json +0 -0
  68. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/asana.json +0 -0
  69. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/browser_tool.json +0 -0
  70. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/composio_search.json +0 -0
  71. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/dropbox.json +0 -0
  72. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/exa.json +0 -0
  73. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/excel.json +0 -0
  74. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/firecrawl.json +0 -0
  75. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/github.json +0 -0
  76. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/gmail.json +0 -0
  77. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/googlecalendar.json +0 -0
  78. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/googledocs.json +0 -0
  79. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/googledrive.json +0 -0
  80. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/googlesheets.json +0 -0
  81. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/googleslides.json +0 -0
  82. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/googletasks.json +0 -0
  83. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/hackernews.json +0 -0
  84. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/hubspot.json +0 -0
  85. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/instagram.json +0 -0
  86. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/jira.json +0 -0
  87. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/linear.json +0 -0
  88. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/linkedin.json +0 -0
  89. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/microsoft_teams.json +0 -0
  90. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/notion.json +0 -0
  91. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/outlook.json +0 -0
  92. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/perplexityai.json +0 -0
  93. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/pinterest.json +0 -0
  94. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/reddit.json +0 -0
  95. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/slack.json +0 -0
  96. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/tavily.json +0 -0
  97. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas/youtube.json +0 -0
  98. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/schemas.py +0 -0
  99. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/shapes.d/ochat.yaml +0 -0
  100. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/shapes.d/ocrm.yaml +0 -0
  101. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/shapes.d/ogh.yaml +0 -0
  102. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/shapes.d/oms.yaml +0 -0
  103. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/shapes.d/oweb.yaml +0 -0
  104. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/shapes.d/owork.yaml +0 -0
  105. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/shapes.d/shared.yaml +0 -0
  106. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/sync.py +0 -0
  107. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/verbs.d/ochat.yaml +0 -0
  108. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/verbs.d/ocrm.yaml +0 -0
  109. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/verbs.d/ogh.yaml +0 -0
  110. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/verbs.d/oms.yaml +0 -0
  111. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/verbs.d/oweb.yaml +0 -0
  112. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/verbs.d/owork.yaml +0 -0
  113. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/verbs.d/rchat.yaml +0 -0
  114. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/verbs.d/rfiles.yaml +0 -0
  115. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/verbs.d/rgh.yaml +0 -0
  116. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/verbs.d/rtrack.yaml +0 -0
  117. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/verbs.d/rwork.yaml +0 -0
  118. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/gravity_schema/vocabulary/verbs.yaml +0 -0
  119. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/schema/manifest.schema.json +0 -0
  120. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/conftest.py +0 -0
  121. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/fixtures/demo_manifests.yaml +0 -0
  122. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_accounts.py +0 -0
  123. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_actions_memory.py +0 -0
  124. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_catalog_parity.py +0 -0
  125. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_cron.py +0 -0
  126. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_describe.py +0 -0
  127. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_errors.py +0 -0
  128. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_generated_tables.py +0 -0
  129. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_instance.py +0 -0
  130. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_json_schema.py +0 -0
  131. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_kind_outputs.py +0 -0
  132. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_manifest.py +0 -0
  133. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_manifest_v2.py +0 -0
  134. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_place_maker.py +0 -0
  135. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_rules.py +0 -0
  136. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_slots.py +0 -0
  137. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_source_scan.py +0 -0
  138. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_sync.py +0 -0
  139. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_validation.py +0 -0
  140. {gravity_schema-0.12.0 → gravity_schema-0.12.2}/tests/test_vocabulary.py +0 -0
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.5
2
+ Name: gravity-schema
3
+ Version: 0.12.2
4
+ Summary: Gravity agent manifest contract — models, validation, and JSON Schema export
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ License-File: NOTICE
8
+ Requires-Python: >=3.11
9
+ Requires-Dist: pydantic>=2.10
10
+ Requires-Dist: pyyaml>=6.0
11
+ Description-Content-Type: text/markdown
12
+
13
+ # gravity-schema
14
+
15
+ The Gravity agent manifest contract: its models, validation, the capability vocabulary and JSON Schema export.
16
+ It is the one definition the [gravity CLI](https://pypi.org/project/gravity-cli/), the agent runner and Gravity's
17
+ platform share, so a manifest that passes here passes everywhere. If you build agents, use `gravity-cli`: it
18
+ depends on this package, in the same version.
19
+
20
+ ```bash
21
+ pip install gravity-schema
22
+ ```
23
+
24
+ ## Two contracts
25
+
26
+ The manifest's `contract` picks one, and Gravity runs both side by side.
27
+
28
+ - **v1** (`Manifest`): the agent names the **tools** it calls, such as `gmail.send`. A manifest without
29
+ `contract` is v1.
30
+ - **v2** (`ManifestV2`): the agent names **capabilities**, such as `message.list` or `issue.create`. What it reads
31
+ goes under `sources` and what it changes under `writes`, and the person picks the app (Gmail or Outlook, Linear
32
+ or Jira) when they set it up. That setup is an `Instance`.
33
+
34
+ ## Load and validate a manifest
35
+
36
+ ```python
37
+ from gravity_schema import load_manifest_text
38
+
39
+ manifest = load_manifest_text("""
40
+ contract: v2
41
+ name: inbox-digest
42
+ version: 1.0.0
43
+ description: "A morning digest of my inbox"
44
+ runtime: {framework: langgraph, python: "3.12", entrypoint: src/agent.py:graph}
45
+ dependencies: {lockfile: requirements.lock}
46
+ sources:
47
+ inbox: {capability: message.list, label: "Which inbox?", window: 1d}
48
+ writes:
49
+ digest: {capability: message.send, label: "Where should the digest go?"}
50
+ approvals: {required_for: [message.send]}
51
+ """)
52
+ manifest.contract # 'v2'
53
+ manifest.capabilities # frozenset({'message.list', 'message.send'})
54
+ ```
55
+
56
+ `load_manifest_file(path)` reads a file instead. Both return whichever contract the manifest declares, and raise
57
+ `ManifestValidationError` with its `ManifestIssue`s (each a code, location, message and remediation) when it
58
+ doesn't fit. Unknown fields are rejected, so a typo is reported rather than ignored.
59
+
60
+ ## The capability vocabulary (v2)
61
+
62
+ `VOCABULARY` holds every capability and which apps serve it.
63
+
64
+ ```python
65
+ from gravity_schema import VOCABULARY
66
+
67
+ VOCABULARY.apps_for("message.list") # ('gmail', 'instagram', 'microsoft_teams', 'outlook', ...)
68
+ ```
69
+
70
+ ## A consumer's setup and a run's grant (v2)
71
+
72
+ ```python
73
+ from datetime import UTC, datetime
74
+ from gravity_schema import Instance, check_instance, grant, run_token_body
75
+
76
+ setup = Instance.model_validate({
77
+ "agent": "inbox-digest", "version": "1.0.0",
78
+ "sources": {"inbox": {"app": "gmail"}},
79
+ "writes": {"digest": {"app": "gmail"}},
80
+ })
81
+ check_instance(manifest, setup) # []: the setup fits (otherwise, what doesn't)
82
+ grant(manifest, setup).as_dict() # exactly what one run may call, and what waits for approval
83
+ run_token_body(manifest, setup, now=datetime.now(UTC)) # {'bindings', 'grant', 'approvals'} for a run token
84
+ ```
85
+
86
+ ## Explain an agent to its users (v2)
87
+
88
+ These write plain text from the manifest and the setup, with no model involved.
89
+
90
+ ```python
91
+ from gravity_schema import capabilities_summary, permissions
92
+
93
+ capabilities_summary(manifest)
94
+ # {'can': ['Read your messages', 'Send a message'], 'cant': [...], 'also': [...]}
95
+ permissions(manifest, setup)
96
+ # per app: what it reads, what it changes, what asks first, and what it never does
97
+ ```
98
+
99
+ `setup_plan` lists what a consumer has to pick, and `live` describes a running setup.
100
+
101
+ ## JSON Schema
102
+
103
+ ```python
104
+ from gravity_schema import manifest_json_schema
105
+
106
+ schema = manifest_json_schema() # one schema covering v1 and v2
107
+ ```
108
+
109
+ Or from the command line, `python -m gravity_schema --out manifest.schema.json`. Add `--check` to exit 1 when
110
+ that file is out of date.
111
+
112
+ ## Versions
113
+
114
+ gravity-schema and gravity-cli are released together, always in the same version. The changes are in the CLI's
115
+ changelog (`gravity changelog`).
@@ -0,0 +1,103 @@
1
+ # gravity-schema
2
+
3
+ The Gravity agent manifest contract: its models, validation, the capability vocabulary and JSON Schema export.
4
+ It is the one definition the [gravity CLI](https://pypi.org/project/gravity-cli/), the agent runner and Gravity's
5
+ platform share, so a manifest that passes here passes everywhere. If you build agents, use `gravity-cli`: it
6
+ depends on this package, in the same version.
7
+
8
+ ```bash
9
+ pip install gravity-schema
10
+ ```
11
+
12
+ ## Two contracts
13
+
14
+ The manifest's `contract` picks one, and Gravity runs both side by side.
15
+
16
+ - **v1** (`Manifest`): the agent names the **tools** it calls, such as `gmail.send`. A manifest without
17
+ `contract` is v1.
18
+ - **v2** (`ManifestV2`): the agent names **capabilities**, such as `message.list` or `issue.create`. What it reads
19
+ goes under `sources` and what it changes under `writes`, and the person picks the app (Gmail or Outlook, Linear
20
+ or Jira) when they set it up. That setup is an `Instance`.
21
+
22
+ ## Load and validate a manifest
23
+
24
+ ```python
25
+ from gravity_schema import load_manifest_text
26
+
27
+ manifest = load_manifest_text("""
28
+ contract: v2
29
+ name: inbox-digest
30
+ version: 1.0.0
31
+ description: "A morning digest of my inbox"
32
+ runtime: {framework: langgraph, python: "3.12", entrypoint: src/agent.py:graph}
33
+ dependencies: {lockfile: requirements.lock}
34
+ sources:
35
+ inbox: {capability: message.list, label: "Which inbox?", window: 1d}
36
+ writes:
37
+ digest: {capability: message.send, label: "Where should the digest go?"}
38
+ approvals: {required_for: [message.send]}
39
+ """)
40
+ manifest.contract # 'v2'
41
+ manifest.capabilities # frozenset({'message.list', 'message.send'})
42
+ ```
43
+
44
+ `load_manifest_file(path)` reads a file instead. Both return whichever contract the manifest declares, and raise
45
+ `ManifestValidationError` with its `ManifestIssue`s (each a code, location, message and remediation) when it
46
+ doesn't fit. Unknown fields are rejected, so a typo is reported rather than ignored.
47
+
48
+ ## The capability vocabulary (v2)
49
+
50
+ `VOCABULARY` holds every capability and which apps serve it.
51
+
52
+ ```python
53
+ from gravity_schema import VOCABULARY
54
+
55
+ VOCABULARY.apps_for("message.list") # ('gmail', 'instagram', 'microsoft_teams', 'outlook', ...)
56
+ ```
57
+
58
+ ## A consumer's setup and a run's grant (v2)
59
+
60
+ ```python
61
+ from datetime import UTC, datetime
62
+ from gravity_schema import Instance, check_instance, grant, run_token_body
63
+
64
+ setup = Instance.model_validate({
65
+ "agent": "inbox-digest", "version": "1.0.0",
66
+ "sources": {"inbox": {"app": "gmail"}},
67
+ "writes": {"digest": {"app": "gmail"}},
68
+ })
69
+ check_instance(manifest, setup) # []: the setup fits (otherwise, what doesn't)
70
+ grant(manifest, setup).as_dict() # exactly what one run may call, and what waits for approval
71
+ run_token_body(manifest, setup, now=datetime.now(UTC)) # {'bindings', 'grant', 'approvals'} for a run token
72
+ ```
73
+
74
+ ## Explain an agent to its users (v2)
75
+
76
+ These write plain text from the manifest and the setup, with no model involved.
77
+
78
+ ```python
79
+ from gravity_schema import capabilities_summary, permissions
80
+
81
+ capabilities_summary(manifest)
82
+ # {'can': ['Read your messages', 'Send a message'], 'cant': [...], 'also': [...]}
83
+ permissions(manifest, setup)
84
+ # per app: what it reads, what it changes, what asks first, and what it never does
85
+ ```
86
+
87
+ `setup_plan` lists what a consumer has to pick, and `live` describes a running setup.
88
+
89
+ ## JSON Schema
90
+
91
+ ```python
92
+ from gravity_schema import manifest_json_schema
93
+
94
+ schema = manifest_json_schema() # one schema covering v1 and v2
95
+ ```
96
+
97
+ Or from the command line, `python -m gravity_schema --out manifest.schema.json`. Add `--check` to exit 1 when
98
+ that file is out of date.
99
+
100
+ ## Versions
101
+
102
+ gravity-schema and gravity-cli are released together, always in the same version. The changes are in the CLI's
103
+ changelog (`gravity changelog`).
@@ -1932,8 +1932,9 @@ writes:
1932
1932
  message.send:
1933
1933
  target: {resource: chat, label: Chat}
1934
1934
  steps:
1935
+ # a draft with html (the platform's rendered document) posts it as html, so Teams shows it formatted
1935
1936
  - action: MICROSOFT_TEAMS_TEAMS_POST_CHAT_MESSAGE
1936
- args: {chat_id: "{target}", content: "{draft.text}"}
1937
+ args: {chat_id: "{target}", content: "{draft.html ?? draft.text}", content_type: "{draft.html|enum(*:html) ?? ='text'}"}
1937
1938
  save: {id: data.id, link: data.webUrl}
1938
1939
  returns: {id: id, link: link, text: draft.text}
1939
1940
  # unverified until a live write
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "gravity-schema"
3
- version = "0.12.0"
3
+ version = "0.12.2"
4
4
  description = "Gravity agent manifest contract — models, validation, and JSON Schema export"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -1,15 +0,0 @@
1
- Metadata-Version: 2.5
2
- Name: gravity-schema
3
- Version: 0.12.0
4
- Summary: Gravity agent manifest contract — models, validation, and JSON Schema export
5
- License-Expression: Apache-2.0
6
- License-File: LICENSE
7
- License-File: NOTICE
8
- Requires-Python: >=3.11
9
- Requires-Dist: pydantic>=2.10
10
- Requires-Dist: pyyaml>=6.0
11
- Description-Content-Type: text/markdown
12
-
13
- # gravity-schema
14
-
15
- Manifest contract models, validation, and JSON Schema export.
@@ -1,3 +0,0 @@
1
- # gravity-schema
2
-
3
- Manifest contract models, validation, and JSON Schema export.
File without changes
File without changes