viewport-context 0.1.0__py3-none-any.whl
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.
- viewport_context-0.1.0.dist-info/METADATA +84 -0
- viewport_context-0.1.0.dist-info/RECORD +48 -0
- viewport_context-0.1.0.dist-info/WHEEL +4 -0
- viewport_context-0.1.0.dist-info/entry_points.txt +5 -0
- viewport_context-0.1.0.dist-info/licenses/LICENSE +202 -0
- viewportai/context/__init__.py +197 -0
- viewportai/context/_loop.py +96 -0
- viewportai/context/_schemas.py +10 -0
- viewportai/context/_shapes.py +44 -0
- viewportai/context/_validate.py +109 -0
- viewportai/context/anthropic.py +111 -0
- viewportai/context/catalog.py +63 -0
- viewportai/context/claude_agent_sdk.py +231 -0
- viewportai/context/cli.py +325 -0
- viewportai/context/config.py +315 -0
- viewportai/context/errors.py +117 -0
- viewportai/context/events.py +96 -0
- viewportai/context/export.py +133 -0
- viewportai/context/langgraph.py +437 -0
- viewportai/context/langgraph_testing.py +70 -0
- viewportai/context/lint.py +149 -0
- viewportai/context/openai.py +109 -0
- viewportai/context/openai_agents.py +268 -0
- viewportai/context/prompt.py +560 -0
- viewportai/context/py.typed +0 -0
- viewportai/context/pydantic_ai.py +126 -0
- viewportai/context/pytest_plugin.py +70 -0
- viewportai/context/registry.py +1054 -0
- viewportai/context/render/__init__.py +20 -0
- viewportai/context/render/anthropic.py +93 -0
- viewportai/context/render/gemini.py +46 -0
- viewportai/context/render/generic.py +33 -0
- viewportai/context/render/openai.py +100 -0
- viewportai/context/render/shared.py +63 -0
- viewportai/context/routers/__init__.py +19 -0
- viewportai/context/routers/keyword.py +134 -0
- viewportai/context/routers/router.py +99 -0
- viewportai/context/session.py +1377 -0
- viewportai/context/skill.py +585 -0
- viewportai/context/source.py +265 -0
- viewportai/context/testing.py +321 -0
- viewportai/context/text.py +76 -0
- viewportai/context/tokens/__init__.py +51 -0
- viewportai/context/tokens/counter.py +199 -0
- viewportai/context/tokens/estimate.py +96 -0
- viewportai/context/tokens/providers.py +220 -0
- viewportai/context/tools.py +184 -0
- viewportai/context/transcript.py +261 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: viewport-context
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Progressive skill and context loading for agents: a skills registry, tools bound only while their skill is loaded, context budgets and cache-friendly prompt assembly.
|
|
5
|
+
Project-URL: Homepage, https://getviewport.com
|
|
6
|
+
Project-URL: Documentation, https://docs.getviewport.com/context
|
|
7
|
+
Project-URL: Repository, https://github.com/viewportai/context
|
|
8
|
+
Project-URL: Issues, https://github.com/viewportai/context/issues
|
|
9
|
+
Author-email: Viewport <hello@getviewport.com>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: agents,ai,claude-agent-sdk,context,langgraph,openai-agents,prompt-caching,skills,tokens
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Framework :: Pytest
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Requires-Dist: pydantic>=2.7
|
|
25
|
+
Requires-Dist: viewport-core>=0.1.0
|
|
26
|
+
Provides-Extra: anthropic
|
|
27
|
+
Requires-Dist: anthropic>=2.14; extra == 'anthropic'
|
|
28
|
+
Provides-Extra: claude-agent-sdk
|
|
29
|
+
Requires-Dist: claude-agent-sdk>=0.2.189; extra == 'claude-agent-sdk'
|
|
30
|
+
Provides-Extra: gemini
|
|
31
|
+
Requires-Dist: google-genai>=3.6; extra == 'gemini'
|
|
32
|
+
Provides-Extra: langgraph
|
|
33
|
+
Requires-Dist: langchain>=1.5.2; extra == 'langgraph'
|
|
34
|
+
Requires-Dist: langgraph>=1.2.24; extra == 'langgraph'
|
|
35
|
+
Provides-Extra: openai
|
|
36
|
+
Requires-Dist: openai>=3.59; extra == 'openai'
|
|
37
|
+
Provides-Extra: openai-agents
|
|
38
|
+
Requires-Dist: openai-agents>=0.26; extra == 'openai-agents'
|
|
39
|
+
Provides-Extra: otel
|
|
40
|
+
Requires-Dist: opentelemetry-api>=1.27; extra == 'otel'
|
|
41
|
+
Provides-Extra: pydantic-ai
|
|
42
|
+
Requires-Dist: pydantic-ai-slim>=2.75; extra == 'pydantic-ai'
|
|
43
|
+
Provides-Extra: tiktoken
|
|
44
|
+
Requires-Dist: tiktoken>=0.14; extra == 'tiktoken'
|
|
45
|
+
Description-Content-Type: text/markdown
|
|
46
|
+
|
|
47
|
+
# viewport-context
|
|
48
|
+
|
|
49
|
+
Progressive skill loading and per-skill tool binding for agents (Python, import `viewportai.context`). The model starts
|
|
50
|
+
with a short catalog and one tool, `load_skill`; each skill's instructions and tools arrive only when it loads, inside a
|
|
51
|
+
token budget. The npm package `@viewportai/context` implements the same spec, pinned by shared conformance vectors.
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
pip install viewport-context # or: uv add viewport-context
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Python 3.11 or newer. To build from source, see https://github.com/viewportai/context#from-source.
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
import asyncio
|
|
61
|
+
|
|
62
|
+
from tools import issue_refund, lookup_order, search_docs # your core tools
|
|
63
|
+
from viewportai import context
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
async def main() -> None:
|
|
67
|
+
skills = context.load_skills("skills", tools=[lookup_order, issue_refund, search_docs], budget=8_000)
|
|
68
|
+
session = skills.session()
|
|
69
|
+
print(session.prompt("My order A-1001 arrived damaged.").tool_names) # ['load_skill']
|
|
70
|
+
await session.call("load_skill", name="refunds") # exactly what the model does
|
|
71
|
+
print(session.prompt().tool_names) # ['load_skill', 'lookup_order', 'issue_refund']
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
asyncio.run(main())
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
A skill's tools become callable in the next step, once a new prompt is built, so the model reads the instructions
|
|
78
|
+
first; a tool called in the same step as its skill's load is refused with a message to call it next step.
|
|
79
|
+
|
|
80
|
+
Adapters (extras): `viewportai.context.langgraph`, `.openai_agents`, `.claude_agent_sdk` (preview), `.pydantic_ai`,
|
|
81
|
+
`.anthropic`,
|
|
82
|
+
`.openai`; test helpers in `viewportai.context.testing` and pytest fixtures (`tmp_skills`, `skills`, `skill_events`).
|
|
83
|
+
|
|
84
|
+
Docs, examples and the design: https://github.com/viewportai/context. License: Apache-2.0.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
viewportai/context/__init__.py,sha256=87UhYa_tBTNCU6pfSat54TxZWA189j9DI366JuRYjSM,4630
|
|
2
|
+
viewportai/context/_loop.py,sha256=utKSg8ef7FP7qXudXIRvOow5-klfxCVt5rfA_zWgZeU,3922
|
|
3
|
+
viewportai/context/_schemas.py,sha256=8JxZsuNOYH6E1cS9BKrS5ALwasH_9rY0Yg1iRXPg17A,7081
|
|
4
|
+
viewportai/context/_shapes.py,sha256=x3kSnekK4gPhdF1wi8WyW2d4ViWchgtYEFFZXmhOjn0,2052
|
|
5
|
+
viewportai/context/_validate.py,sha256=lTdWyI138cHdCHN-Uqj0BZ24_lW9V7NFg-7Qowt6a6o,4225
|
|
6
|
+
viewportai/context/anthropic.py,sha256=olDlOvRaDXlIZ1AeVBnkxJRmCB4H1f8bnkIx0hWmjXI,4989
|
|
7
|
+
viewportai/context/catalog.py,sha256=uYXzS7S_aiVXMBwfz8vItSrizaW9evQeUdCKuCBBJSM,2368
|
|
8
|
+
viewportai/context/claude_agent_sdk.py,sha256=z4D_jZ7n4_3xK_lQtwPRUY7w_Wscs-vdMBa-HsDtIU8,11009
|
|
9
|
+
viewportai/context/cli.py,sha256=fguEXkSIcbkvrrChACu9Hb5HhhWYIOaX6q3IYR8vGOs,11626
|
|
10
|
+
viewportai/context/config.py,sha256=YrhYKe_OEOgJOgpGfwUpmwkR3PojUZmGG9ZYix83ZzA,12532
|
|
11
|
+
viewportai/context/errors.py,sha256=_hDQ1Dd0Of4JEKYZcqmkA4ZetIYUH4WPlXZ3EyxXbrw,4169
|
|
12
|
+
viewportai/context/events.py,sha256=xeTGE0aeXa7R0olBEC9aKqdbpg0L04dn6OIK-0plOaU,3279
|
|
13
|
+
viewportai/context/export.py,sha256=35HgK4et-DbtiYx9c_v1rbIqQ1jktxMvXeQ2vV-sl88,5098
|
|
14
|
+
viewportai/context/langgraph.py,sha256=HbesWKMvGpgvMLNjIVOoUAZL5SZ2YDwRMaWomkFpvUQ,19903
|
|
15
|
+
viewportai/context/langgraph_testing.py,sha256=McryrbF5gJujVehXRZTOHPU01Kg8rwn23ZPigQPEk50,2719
|
|
16
|
+
viewportai/context/lint.py,sha256=mpUZI9Qb-7glSxTcpygPuYA-5_rAosB529oJi3flkKM,6381
|
|
17
|
+
viewportai/context/openai.py,sha256=8w0I4G_nznvJIYaFSf1u_jN3Oq4FlywBq8N5flFXFPo,4782
|
|
18
|
+
viewportai/context/openai_agents.py,sha256=DsgV9ipfqsQ7y4YeikCyuBQ8wcUaJbd48OJV39m9l8s,11848
|
|
19
|
+
viewportai/context/prompt.py,sha256=dNFHcuH73R6iI41dg3YeCeimC57TJtvlfRP75MxO678,21853
|
|
20
|
+
viewportai/context/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
+
viewportai/context/pydantic_ai.py,sha256=5RkWo2j-3uSDUrntFklXz4fpQJxLb0JW03WvZTVnYbI,5108
|
|
22
|
+
viewportai/context/pytest_plugin.py,sha256=7y08KWH_S_YMb7g7mzu5a1R9OB43LT29JFPkK1AVfv8,2449
|
|
23
|
+
viewportai/context/registry.py,sha256=QXEPjMz7ys9cPq6d5OHpSzThX_q6LtjtZe0-E5UCe74,42268
|
|
24
|
+
viewportai/context/session.py,sha256=BAV_9_br6YNH3DmKZ7-LDqJqUios8Jo_DWf8xihR-hc,61827
|
|
25
|
+
viewportai/context/skill.py,sha256=_b07vMrhCGLdpkUlYQubtfirFKCQ7oup0l06N8voCIE,22833
|
|
26
|
+
viewportai/context/source.py,sha256=Ms8KwFN2P0gYFFnV28ua1Nmc7lI9hS4fQQl1R0Oz7Vg,10729
|
|
27
|
+
viewportai/context/testing.py,sha256=migsPTkUHP0au9R6aYJqV51fv2cPV0U6dcYiSnAAw3Y,11527
|
|
28
|
+
viewportai/context/text.py,sha256=jZrZ475e2dBOwU-nxkOCCZmZ4wPyaTo87KIrvy8Sbd0,2859
|
|
29
|
+
viewportai/context/tools.py,sha256=2d0v5sq_5K6mUf2LiOT8CxSMSM106NRjXy11zQWANa8,6896
|
|
30
|
+
viewportai/context/transcript.py,sha256=_o-QTvS6k5geGhBAQTQiftWjsWQrdgRLk6fJ6jKelGo,9447
|
|
31
|
+
viewportai/context/render/__init__.py,sha256=FyzC7vptZvEinkk5qYZQQIU2yHd4Wh6PZ8TP1vBFHe4,565
|
|
32
|
+
viewportai/context/render/anthropic.py,sha256=Z_FW8kIyR-MbWPtnoZtF7CYLcbNQiYXviLP3MWIoRWI,3654
|
|
33
|
+
viewportai/context/render/gemini.py,sha256=w26lOD4V59I_g3nezGaNu6jnqr0QIOmOLYg8ajhIDug,1581
|
|
34
|
+
viewportai/context/render/generic.py,sha256=a2HD6JhofzBT_eUDCksqBg_pgq5taAAyb41SFwCpE4I,944
|
|
35
|
+
viewportai/context/render/openai.py,sha256=p6XeS67iWkD1b9EKrNO_QcX0ZSW5aKib0mOPYM-1BLY,3839
|
|
36
|
+
viewportai/context/render/shared.py,sha256=rqs8apUlgLrjxbNbBYHFFPQtcUtKAq21uDlCwg5FIzU,2766
|
|
37
|
+
viewportai/context/routers/__init__.py,sha256=dG5RqyHZF8H6lHTrG2gn8EGPqO1WWAIM3eFUmCvJBAo,451
|
|
38
|
+
viewportai/context/routers/keyword.py,sha256=b159BW8SwXsmRhM6SDWuB0Q5C6fs2pnJa_X4bjAf6V4,3549
|
|
39
|
+
viewportai/context/routers/router.py,sha256=aIdZSxfuLMaZMF06yHyaaHPnrwB3Rpus2q3QgDVLacE,3034
|
|
40
|
+
viewportai/context/tokens/__init__.py,sha256=PiPv0KpDIrqcGJtPrcrMyUOuIYaK7bCvogo4gTdx14M,1076
|
|
41
|
+
viewportai/context/tokens/counter.py,sha256=FtNNzjvviQOz4pTvHdS7huO7vh5v7ihw0SGDMNvp1Hk,6411
|
|
42
|
+
viewportai/context/tokens/estimate.py,sha256=YJrMc-tpI2jEzS96rz3TVT8cUuOafeTHJPpHp_p132w,4002
|
|
43
|
+
viewportai/context/tokens/providers.py,sha256=3m_1dGaPFy3CN1203KMH879iIacRbzoN7J1U73FPB-g,7946
|
|
44
|
+
viewport_context-0.1.0.dist-info/METADATA,sha256=pclvJpUhNyVJ-XJMpnWMLU9QhXTmOgbYf69NFJj6c2Y,3765
|
|
45
|
+
viewport_context-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
46
|
+
viewport_context-0.1.0.dist-info/entry_points.txt,sha256=2woGdzEIAl_1_3x0LC_lZj-YKHgIg331kwoJQiEQl54,129
|
|
47
|
+
viewport_context-0.1.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
48
|
+
viewport_context-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"""Viewport Context: progressive skill loading, per-skill tool binding, context budgets and cache-friendly prompt
|
|
2
|
+
assembly for any agent stack.
|
|
3
|
+
|
|
4
|
+
::
|
|
5
|
+
|
|
6
|
+
from viewportai import context
|
|
7
|
+
|
|
8
|
+
skills = context.load_skills("skills/", tools=[lookup_order, issue_refund], budget=8_000)
|
|
9
|
+
session = skills.session()
|
|
10
|
+
session.prompt("My order arrived damaged.").tool_names # ["load_skill"]
|
|
11
|
+
await session.call("load_skill", name="refunds")
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
from viewportai.core import Tool, ToolContext, ToolMiddleware
|
|
17
|
+
|
|
18
|
+
from . import tokens as counters
|
|
19
|
+
from .catalog import CatalogLevel, catalog_entry, render_catalog
|
|
20
|
+
from .config import (
|
|
21
|
+
CONFIG_FILE,
|
|
22
|
+
ContextBudget,
|
|
23
|
+
Expose,
|
|
24
|
+
LoadedConfig,
|
|
25
|
+
ResolvedOptions,
|
|
26
|
+
SessionOptions,
|
|
27
|
+
env_config,
|
|
28
|
+
load_config,
|
|
29
|
+
)
|
|
30
|
+
from .errors import ContextBudgetExceeded, ContextError, SkillNotFound, ToolNotLoaded
|
|
31
|
+
from .events import ContextEvent, ContextEventListener, LoadStatus, Via
|
|
32
|
+
from .export import ExportResult, Omitted, export_skills
|
|
33
|
+
from .lint import RECOMMENDED_MAX_LINES, RECOMMENDED_MAX_TOKENS, LintIssue
|
|
34
|
+
from .prompt import (
|
|
35
|
+
BudgetReport,
|
|
36
|
+
Dropped,
|
|
37
|
+
ExtraSection,
|
|
38
|
+
Prompt,
|
|
39
|
+
PromptPrefix,
|
|
40
|
+
Provider,
|
|
41
|
+
Renderer,
|
|
42
|
+
Section,
|
|
43
|
+
SectionBudget,
|
|
44
|
+
Tier,
|
|
45
|
+
register_renderer,
|
|
46
|
+
)
|
|
47
|
+
from .registry import LoadOptions, RegistryOptions, SkillRegistry, SkillTokens, aload_skills, load_skills
|
|
48
|
+
from .render.anthropic import anthropic_expose, anthropic_tool_result, render_anthropic
|
|
49
|
+
from .render.gemini import render_gemini
|
|
50
|
+
from .render.generic import render_generic
|
|
51
|
+
from .render.openai import openai_expose, render_openai
|
|
52
|
+
from .render.shared import json_tool
|
|
53
|
+
from .routers import KeywordRouter, Router, RouterFactory, keyword_router, register_router, router
|
|
54
|
+
from .session import (
|
|
55
|
+
RESOURCE_CAP,
|
|
56
|
+
LoadedEntry,
|
|
57
|
+
LoadedSkill,
|
|
58
|
+
Placement,
|
|
59
|
+
Session,
|
|
60
|
+
SessionState,
|
|
61
|
+
SessionStateEntry,
|
|
62
|
+
ToolResult,
|
|
63
|
+
is_resource_path,
|
|
64
|
+
)
|
|
65
|
+
from .skill import (
|
|
66
|
+
ALWAYS_PRIORITY,
|
|
67
|
+
DEFAULT_PRIORITY,
|
|
68
|
+
Loading,
|
|
69
|
+
ParseResult,
|
|
70
|
+
Skill,
|
|
71
|
+
Trigger,
|
|
72
|
+
define_skill,
|
|
73
|
+
parse_skill,
|
|
74
|
+
)
|
|
75
|
+
from .source import DirSource, RawSkill, SkillSource, from_dir, inline
|
|
76
|
+
from .text import first_sentence, normalize_text, truncate_text
|
|
77
|
+
from .tokens import (
|
|
78
|
+
TOOL_OVERHEAD,
|
|
79
|
+
CounterClients,
|
|
80
|
+
CounterFactory,
|
|
81
|
+
TokenCounter,
|
|
82
|
+
ToolSchema,
|
|
83
|
+
count_tool,
|
|
84
|
+
estimate_tokens,
|
|
85
|
+
register_counter,
|
|
86
|
+
resolve_counter,
|
|
87
|
+
tool_text,
|
|
88
|
+
)
|
|
89
|
+
from .tokens.counter import counter
|
|
90
|
+
from .tools import RESOURCE_TOOL, SEARCH_TOOL, LoadResult, skill_block, skill_section, tool_schema
|
|
91
|
+
|
|
92
|
+
__version__ = "0.1.0"
|
|
93
|
+
|
|
94
|
+
__all__ = [
|
|
95
|
+
"ALWAYS_PRIORITY",
|
|
96
|
+
"CONFIG_FILE",
|
|
97
|
+
"DEFAULT_PRIORITY",
|
|
98
|
+
"RECOMMENDED_MAX_LINES",
|
|
99
|
+
"RECOMMENDED_MAX_TOKENS",
|
|
100
|
+
"RESOURCE_CAP",
|
|
101
|
+
"RESOURCE_TOOL",
|
|
102
|
+
"SEARCH_TOOL",
|
|
103
|
+
"TOOL_OVERHEAD",
|
|
104
|
+
"BudgetReport",
|
|
105
|
+
"CatalogLevel",
|
|
106
|
+
"ContextBudget",
|
|
107
|
+
"ContextBudgetExceeded",
|
|
108
|
+
"ContextError",
|
|
109
|
+
"ContextEvent",
|
|
110
|
+
"ContextEventListener",
|
|
111
|
+
"CounterClients",
|
|
112
|
+
"CounterFactory",
|
|
113
|
+
"DirSource",
|
|
114
|
+
"Dropped",
|
|
115
|
+
"ExportResult",
|
|
116
|
+
"Expose",
|
|
117
|
+
"ExtraSection",
|
|
118
|
+
"KeywordRouter",
|
|
119
|
+
"LintIssue",
|
|
120
|
+
"LoadOptions",
|
|
121
|
+
"LoadResult",
|
|
122
|
+
"LoadStatus",
|
|
123
|
+
"LoadedConfig",
|
|
124
|
+
"LoadedEntry",
|
|
125
|
+
"LoadedSkill",
|
|
126
|
+
"Loading",
|
|
127
|
+
"Omitted",
|
|
128
|
+
"ParseResult",
|
|
129
|
+
"Placement",
|
|
130
|
+
"Prompt",
|
|
131
|
+
"PromptPrefix",
|
|
132
|
+
"Provider",
|
|
133
|
+
"RawSkill",
|
|
134
|
+
"RegistryOptions",
|
|
135
|
+
"Renderer",
|
|
136
|
+
"ResolvedOptions",
|
|
137
|
+
"Router",
|
|
138
|
+
"RouterFactory",
|
|
139
|
+
"Section",
|
|
140
|
+
"SectionBudget",
|
|
141
|
+
"Session",
|
|
142
|
+
"SessionOptions",
|
|
143
|
+
"SessionState",
|
|
144
|
+
"SessionStateEntry",
|
|
145
|
+
"Skill",
|
|
146
|
+
"SkillNotFound",
|
|
147
|
+
"SkillRegistry",
|
|
148
|
+
"SkillSource",
|
|
149
|
+
"SkillTokens",
|
|
150
|
+
"Tier",
|
|
151
|
+
"TokenCounter",
|
|
152
|
+
"Tool",
|
|
153
|
+
"ToolContext",
|
|
154
|
+
"ToolMiddleware",
|
|
155
|
+
"ToolNotLoaded",
|
|
156
|
+
"ToolResult",
|
|
157
|
+
"ToolSchema",
|
|
158
|
+
"Trigger",
|
|
159
|
+
"Via",
|
|
160
|
+
"aload_skills",
|
|
161
|
+
"anthropic_expose",
|
|
162
|
+
"anthropic_tool_result",
|
|
163
|
+
"catalog_entry",
|
|
164
|
+
"count_tool",
|
|
165
|
+
"counter",
|
|
166
|
+
"counters",
|
|
167
|
+
"define_skill",
|
|
168
|
+
"env_config",
|
|
169
|
+
"estimate_tokens",
|
|
170
|
+
"export_skills",
|
|
171
|
+
"first_sentence",
|
|
172
|
+
"from_dir",
|
|
173
|
+
"inline",
|
|
174
|
+
"is_resource_path",
|
|
175
|
+
"json_tool",
|
|
176
|
+
"keyword_router",
|
|
177
|
+
"load_config",
|
|
178
|
+
"load_skills",
|
|
179
|
+
"normalize_text",
|
|
180
|
+
"openai_expose",
|
|
181
|
+
"parse_skill",
|
|
182
|
+
"register_counter",
|
|
183
|
+
"register_renderer",
|
|
184
|
+
"register_router",
|
|
185
|
+
"render_anthropic",
|
|
186
|
+
"render_catalog",
|
|
187
|
+
"render_gemini",
|
|
188
|
+
"render_generic",
|
|
189
|
+
"render_openai",
|
|
190
|
+
"resolve_counter",
|
|
191
|
+
"router",
|
|
192
|
+
"skill_block",
|
|
193
|
+
"skill_section",
|
|
194
|
+
"tool_schema",
|
|
195
|
+
"tool_text",
|
|
196
|
+
"truncate_text",
|
|
197
|
+
]
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"""The provider-neutral half of the Anthropic and OpenAI host-loop helpers.
|
|
2
|
+
|
|
3
|
+
The session is rebuilt from the conversation on every call (the transcript is the state). Loads that are not in the
|
|
4
|
+
transcript (code loads, router and trigger picks) travel in ``state``: Python lists cannot be weak-referenced, so the
|
|
5
|
+
helpers do not remember anything between calls. Save ``(await ctx.session(messages)).state`` after the first turn and
|
|
6
|
+
pass it as ``state=`` on later calls.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
from typing import TYPE_CHECKING, Any
|
|
13
|
+
|
|
14
|
+
from ._shapes import as_list, as_map, to_plain
|
|
15
|
+
from .transcript import FoundCall, find_tool_calls
|
|
16
|
+
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
from collections.abc import Callable, Mapping, Sequence
|
|
19
|
+
|
|
20
|
+
from .prompt import ExtraSection, Prompt
|
|
21
|
+
from .registry import SkillRegistry
|
|
22
|
+
from .session import Session, SessionState, ToolResult
|
|
23
|
+
|
|
24
|
+
__all__ = ["HostLoop", "LoopResult"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclass(frozen=True, slots=True)
|
|
28
|
+
class LoopResult:
|
|
29
|
+
"""One pending call and what ``session.dispatch`` returned for it."""
|
|
30
|
+
|
|
31
|
+
call: FoundCall
|
|
32
|
+
result: ToolResult
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def user_text(m: object) -> str | None:
|
|
36
|
+
"""The text of a user message, or ``None`` when it is not one (or only carries tool results)."""
|
|
37
|
+
msg = as_map(to_plain(m))
|
|
38
|
+
if msg is None or msg.get("role") != "user":
|
|
39
|
+
return None
|
|
40
|
+
content = msg.get("content")
|
|
41
|
+
if isinstance(content, str):
|
|
42
|
+
return content
|
|
43
|
+
blocks = as_list(content)
|
|
44
|
+
if blocks is None:
|
|
45
|
+
return None
|
|
46
|
+
parts: list[str] = []
|
|
47
|
+
for b in blocks:
|
|
48
|
+
block = as_map(b)
|
|
49
|
+
if block is not None and block.get("type") in ("text", "input_text") and isinstance(block.get("text"), str):
|
|
50
|
+
parts.append(block["text"])
|
|
51
|
+
return "\n".join(parts) or None
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class HostLoop:
|
|
55
|
+
"""Builds sessions and prompts from a conversation, and runs its pending tool calls."""
|
|
56
|
+
|
|
57
|
+
def __init__(self, registry: SkillRegistry, answered: Callable[[Sequence[object]], set[str]]) -> None:
|
|
58
|
+
self.registry = registry
|
|
59
|
+
self._answered = answered
|
|
60
|
+
|
|
61
|
+
async def prepare(self, messages: Sequence[object], state: SessionState | Mapping[str, Any] | None) -> Session:
|
|
62
|
+
"""The session for the next request: the transcript replayed on top of the given state, then triggers and the
|
|
63
|
+
router run for a new user turn."""
|
|
64
|
+
session = self.registry.session(state=state, messages=messages)
|
|
65
|
+
text = user_text(messages[-1]) if messages else None
|
|
66
|
+
if text is not None:
|
|
67
|
+
await session.prepare(text)
|
|
68
|
+
return session
|
|
69
|
+
|
|
70
|
+
async def prompt(
|
|
71
|
+
self,
|
|
72
|
+
messages: Sequence[object],
|
|
73
|
+
state: SessionState | Mapping[str, Any] | None,
|
|
74
|
+
extra: Sequence[ExtraSection] | Mapping[str, str] | None,
|
|
75
|
+
) -> Prompt:
|
|
76
|
+
"""The prompt for the next request, with the conversation as its messages."""
|
|
77
|
+
session = await self.prepare(messages, state)
|
|
78
|
+
return session.prompt(None, messages=messages, extra=extra)
|
|
79
|
+
|
|
80
|
+
async def run(self, messages: Sequence[object], state: SessionState | Mapping[str, Any] | None) -> list[LoopResult]:
|
|
81
|
+
"""Run every tool call in the transcript that has no result yet, in order, through ``session.dispatch`` on a
|
|
82
|
+
session rebuilt from the messages before them (so a ``load_skill`` among them applies live, with its event)."""
|
|
83
|
+
done = self._answered(messages)
|
|
84
|
+
cut = len(messages)
|
|
85
|
+
pending: list[FoundCall] = []
|
|
86
|
+
for i, m in enumerate(messages):
|
|
87
|
+
for c in find_tool_calls([m]):
|
|
88
|
+
if c.id is None or c.id in done:
|
|
89
|
+
continue
|
|
90
|
+
if not pending:
|
|
91
|
+
cut = i
|
|
92
|
+
pending.append(c)
|
|
93
|
+
if not pending:
|
|
94
|
+
return []
|
|
95
|
+
session = await self.prepare(messages[:cut], state)
|
|
96
|
+
return [LoopResult(c, await session.dispatch(c.name, c.args, call_id=c.id)) for c in pending]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""Generated by scripts/codegen.mjs from spec/schemas. Do not edit."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from typing import Any, Final
|
|
7
|
+
|
|
8
|
+
SCHEMAS: Final[dict[str, Any]] = json.loads(
|
|
9
|
+
"{\"context/load-result/v1\":{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"$id\":\"https://getviewport.com/schemas/context/load-result/v1.json\",\"title\":\"LoadResult\",\"description\":\"The outcome of loading a skill. A machine record: extra fields are accepted and preserved.\",\"type\":\"object\",\"required\":[\"status\",\"skill\"],\"properties\":{\"status\":{\"enum\":[\"loaded\",\"already_loaded\",\"over_budget\",\"not_found\",\"not_allowed\"]},\"skill\":{\"type\":\"string\"},\"tokens\":{\"type\":\"integer\",\"minimum\":0,\"description\":\"Instructions plus newly bound tool schemas, as counted against the budget.\"},\"tools\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"also_loaded\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"evicted\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"message\":{\"type\":[\"string\",\"null\"]}}},\"context/session-state/v1\":{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"$id\":\"https://getviewport.com/schemas/context/session-state/v1.json\",\"title\":\"SessionState\",\"description\":\"The persistable state of one Context session. A machine record: extra fields are accepted and preserved.\",\"type\":\"object\",\"required\":[\"v\",\"loaded\"],\"properties\":{\"v\":{\"const\":1},\"registry\":{\"type\":\"string\",\"description\":\"Digest of the registry the state was produced with.\"},\"loaded\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"required\":[\"name\",\"hash\",\"via\"],\"properties\":{\"name\":{\"type\":\"string\"},\"hash\":{\"type\":\"string\",\"description\":\"Content digest the session is pinned to.\"},\"via\":{\"enum\":[\"always\",\"model\",\"router\",\"trigger\",\"requires\",\"manual\"]},\"turn\":{\"type\":\"integer\",\"minimum\":0}}}},\"called\":{\"type\":\"array\",\"items\":{\"type\":\"string\"},\"description\":\"Tool names called so far, for tool_called triggers.\"},\"sent\":{\"type\":\"array\",\"description\":\"Model-loaded skills whose instructions are already in the transcript but which have since been evicted or unloaded. They stay counted: the conversation still holds them.\",\"items\":{\"type\":\"object\",\"required\":[\"name\",\"hash\"],\"properties\":{\"name\":{\"type\":\"string\"},\"hash\":{\"type\":\"string\"}}}}}},\"context/skill/v1\":{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"$id\":\"https://getviewport.com/schemas/context/skill/v1.json\",\"title\":\"SkillFrontmatter\",\"description\":\"The YAML frontmatter of a SKILL.md file. A strict superset of the Agent Skills specification (agentskills.io/specification): the six spec fields plus optional Viewport fields. Keys documented by Claude Code are accepted and preserved (see claude_code_keys in the loader); any other key is an error.\",\"type\":\"object\",\"required\":[\"name\",\"description\"],\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":64,\"pattern\":\"^[a-z0-9]+(-[a-z0-9]+)*$\",\"description\":\"Lowercase letters, digits and single hyphens. Must equal the skill's directory name.\"},\"description\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":1024,\"description\":\"What the skill does and when to use it.\"},\"license\":{\"type\":\"string\",\"description\":\"License name or a reference to a bundled license file.\"},\"compatibility\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":500,\"description\":\"Environment requirements.\"},\"metadata\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"string\"},\"description\":\"Client-specific string properties.\"},\"allowed-tools\":{\"type\":\"string\",\"description\":\"Agent Skills (experimental): space-separated pre-approved tools. Preserved, not enforced by Viewport.\"},\"tools\":{\"$ref\":\"https://getviewport.com/schemas/context/skill-sidecar/v1.json#/properties/tools\"},\"requires\":{\"$ref\":\"https://getviewport.com/schemas/context/skill-sidecar/v1.json#/properties/requires\"},\"loading\":{\"$ref\":\"https://getviewport.com/schemas/context/skill-sidecar/v1.json#/properties/loading\"},\"triggers\":{\"$ref\":\"https://getviewport.com/schemas/context/skill-sidecar/v1.json#/properties/triggers\"},\"priority\":{\"$ref\":\"https://getviewport.com/schemas/context/skill-sidecar/v1.json#/properties/priority\"},\"budget\":{\"$ref\":\"https://getviewport.com/schemas/context/skill-sidecar/v1.json#/properties/budget\"},\"version\":{\"$ref\":\"https://getviewport.com/schemas/context/skill-sidecar/v1.json#/properties/version\"}}},\"context/skill-sidecar/v1\":{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"$id\":\"https://getviewport.com/schemas/context/skill-sidecar/v1.json\",\"title\":\"SkillSidecar\",\"description\":\"agents/viewport.yaml inside a skill directory: the Viewport fields, kept out of SKILL.md for strict Agent Skills consumers. A key set both here and in the frontmatter is an error.\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"tools\":{\"type\":\"array\",\"uniqueItems\":true,\"items\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":128},\"description\":\"Names of tools bound to this skill: visible and callable only while the skill is loaded.\"},\"requires\":{\"type\":\"array\",\"uniqueItems\":true,\"items\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":64,\"pattern\":\"^[a-z0-9]+(-[a-z0-9]+)*$\"},\"description\":\"Skills loaded first, in this order.\"},\"loading\":{\"enum\":[\"always\",\"model\",\"router\",\"trigger\",\"manual\"],\"description\":\"How the skill enters a session. Default model.\"},\"triggers\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/trigger\"},\"description\":\"Conditions that load the skill (loading: trigger), also used as router hints.\"},\"priority\":{\"type\":\"integer\",\"minimum\":0,\"maximum\":100,\"description\":\"Eviction and truncation order for skills that are not required. Default 50.\"},\"budget\":{\"type\":\"integer\",\"minimum\":1,\"description\":\"Maximum tokens for the instructions. Exceeding it is a load error.\"},\"version\":{\"type\":\"string\",\"minLength\":1,\"description\":\"Free-form version label shown in events. Sessions pin the content hash.\"}},\"$defs\":{\"trigger\":{\"type\":\"object\",\"minProperties\":1,\"maxProperties\":2,\"additionalProperties\":false,\"properties\":{\"input\":{\"$ref\":\"https://getviewport.com/schemas/matcher/v1.json\",\"description\":\"Matcher evaluated against the user input text.\"},\"tool_called\":{\"type\":\"string\",\"minLength\":1,\"description\":\"Fires after a call to the named tool succeeds in this session (it returned and did not throw).\"},\"result\":{\"$ref\":\"https://getviewport.com/schemas/matcher/v1.json\",\"description\":\"With tool_called: fires only when the tool's return value matches. Use it when the tool reports failure as a value (for example { verified: false }).\"}}}}}}"
|
|
10
|
+
)
|