Skip to content

Commit 25973bb

Browse files
authored
Merge pull request #8 from g4-api/development
Refactor configuration files and remove deprecated resources; update …
2 parents 160e49c + 2f21997 commit 25973bb

19 files changed

Lines changed: 131 additions & 473 deletions

resources/base-manifest.json

Lines changed: 83 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,85 @@
11
{
2-
"clientLogConfiguration": {
3-
"agentLogConfiguration": {
4-
"enabled": true,
5-
"interval": 1000
6-
},
7-
"logLevel": "information",
8-
"sourceOptions": {
9-
"filter": "include",
10-
"sources": []
11-
}
12-
},
13-
"g4Server": {
14-
"schema": "http",
15-
"host": "localhost",
16-
"port": "9944"
17-
},
18-
"authentication": {
19-
"password": null,
20-
"token": "3xezq5Yc33laNOPNP8yCsK33vQcQZ87E/zyLNNscYNeqvKTHAm9C3wAEDQV7X9\u002BfuuHPhafDNXbSFgsbKmCncCKm7DRE5A6JtFSd90DNujujbQ3vLG4/4uSVCR76Z6VguIDSvRZ/pJTHCzBc9NNI/eb5fLHcjXyYrilm9NC7VTD/HOlgGC5CL\u002BoFhHoR8s10YuI9QpRioZbyDHysFumpAAv3/PG/p/QBKNoQpjtsUgMytrnqr3m1bgyXITG0u5AUR2VpZLCXQO6MxU7kwLwvdNGXUDfajBVT29KyjXUEWN9dK0R38XmgZFQ7orkKfN2z0x2SMfC5mvTDM6as\u002B/kYWFAvpqOZDhZ95sgQWp/zGig=",
21-
"username": null
22-
},
23-
"driverParameters": {
24-
"driver": "ChromeDriver",
25-
"driverBinaries": "http://localhost:4444/wd/hub"
26-
},
27-
"settings": {
28-
"automationSettings": {
29-
"loadTimeout": 60000,
30-
"maxParallel": 1,
31-
"returnFlatResponse": true,
32-
"returnStructuredResponse": true,
33-
"searchTimeout": 15000
34-
},
35-
"environmentsSettings": {
36-
"defaultEnvironment": "SystemParameters",
37-
"environmentVariables": null,
38-
"returnEnvironment": false
39-
},
40-
"exceptionsSettings": {
41-
"returnExceptions": true
42-
},
43-
"queueManagerSettings": {
44-
"properties": null,
45-
"type": null
46-
},
47-
"performancePointsSettings": {
48-
"returnPerformancePoints": true
49-
},
50-
"pluginsSettings": {
51-
"externalRepositories": null,
52-
"forceRuleReference": true
53-
},
54-
"screenshotsSettings": {
55-
"convertToBase64": false,
56-
"onExceptionOnly": false,
57-
"outputFolder": "C:\\Users\\s_roe\\OneDrive\\Desktop\\New folder\\g4-api\\src\\TestResults\\Deploy_s_roe 20250530T114855_8028\\Out\\Outputs\\Images",
58-
"returnScreenshots": false
59-
}
60-
}
2+
"clientLogConfiguration": {
3+
"agentLogConfiguration": {
4+
"enabled": true,
5+
"interval": 1000
6+
},
7+
"logLevel": "information",
8+
"sourceOptions": {
9+
"filter": "include",
10+
"sources": []
11+
}
12+
},
13+
"g4Server": {
14+
"schema": "http",
15+
"host": "localhost",
16+
"port": "9944"
17+
},
18+
"authentication": {
19+
"token": ""
20+
},
21+
"driverParameters": {
22+
"driver": "ChromeDriver",
23+
"driverBinaries": "http://localhost:4444/wd/hub"
24+
},
25+
"settings": {
26+
"automationSettings": {
27+
"loadTimeout": 60000,
28+
"maxParallel": 1,
29+
"returnFlatResponse": true,
30+
"returnStructuredResponse": true,
31+
"searchTimeout": 15000
32+
},
33+
"recorderSettings": {
34+
"enabled": false,
35+
"recorders": [
36+
{
37+
"mode": "standard",
38+
"schema": "http",
39+
"host": "localhost",
40+
"port": "9955",
41+
"driverParameters": {
42+
"capabilities": {
43+
"alwaysMatch": {
44+
"browserName": "Uia",
45+
"uia:options": {
46+
"label": "machine-a"
47+
}
48+
}
49+
},
50+
"driver": "UiaDriver",
51+
"driverBinaries": "http://localhost:4444/wd/hub",
52+
"firstMatch": [
53+
{}
54+
]
55+
},
56+
"thinkTimeSettings": {
57+
"enabled": false,
58+
"maxThinkTime": 10000,
59+
"minThinkTime": 3000
60+
}
61+
}
62+
]
63+
},
64+
"exceptionsSettings": {
65+
"returnExceptions": true
66+
},
67+
"queueManagerSettings": {
68+
"properties": null,
69+
"type": null
70+
},
71+
"performancePointsSettings": {
72+
"returnPerformancePoints": true
73+
},
74+
"pluginsSettings": {
75+
"externalRepositories": null,
76+
"forceRuleReference": true
77+
},
78+
"screenshotsSettings": {
79+
"convertToBase64": false,
80+
"onExceptionOnly": false,
81+
"outputFolder": ".",
82+
"returnScreenshots": false
83+
}
84+
}
6185
}

resources/copilot-instructions.md

Lines changed: 45 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,45 @@
1-
# G4 Integration Instructions (embed this at the top of your Copilot Chat context)
2-
3-
Enforce G4 flow: session → get_tools → find_tool → [DOM if needed] → build → attach_session → call.
4-
5-
Follow these steps **in order**—do not skip or reorder:
6-
7-
1. **Ensure a session - HIGH PRIORITY - MUST FOLLOW all steps**
8-
• Prompt the user for `driver_binaries` (default: `http://localhost:4444/wd/hub`) and `driver` (default: `ChromeDriver`).
9-
• Call the `start_g4_session` tool with those values.
10-
• Save the returned `session` ID.
11-
12-
2. **Discover your tool**
13-
- Call the **get_tools** tool (no arguments).
14-
- From its response, select the tool name that best matches the user’s action.
15-
16-
3. **Fetch its schema**
17-
- Call the **find_tool** tool with that exact tool name.
18-
- Parse its JSON response to extract the `inputSchema`.
19-
20-
4. **Handle element-interaction tools**
21-
If your selected tool requires interacting with page elements:
22-
a. Call the **get_application_dom** tool (no arguments).
23-
b. Parse its response and **extract the locator**(s) needed for your action.
24-
c. Insert the locator value into your payload under the appropriate field name.
25-
26-
5. **Build your request payload**
27-
- From the schema in Step 3, identify **all required** properties.
28-
- If any required field is missing, **prompt the user** for its value (including expected type).
29-
- Construct a JSON object that:
30-
• Includes **every** required field (with user-provided or default values)
31-
• Converts **all** field names to snake_case
32-
33-
6. **Attach your session**
34-
- Add the saved `session` ID into your payload under the `session` field.
35-
36-
7. **Invoke the tool**
37-
- Call the `tools/call` endpoint (or invoke the corresponding tool) with your completed JSON body.
1+
* **Token:** Always read G4_API_KEY from project-root .env (ask user if missing) and cache as token.
2+
* **Open AI:** Always read OPENAI_API_KEY from project-root .env (ask user if missing) and cache as OPENAI_API_KEY.
3+
* **Open AI:** Always read OPENAI_URI from project-root .env (ask user if missing) and cache as OPENAI_URI.
4+
* **Open AI:** Always read OPENAI_MODEL from project-root .env (ask user if missing) and cache as OPENAI_MODEL.
5+
* **Session:** If no driver_session, call start_g4_session with .env defaults: driver=ENV:WEB_DRIVER, driver_binaries=ENV:WEB_DRIVER_REPOSITORY, token=ENV:G4_API_KEY; save the returned session id.
6+
7+
* **Sequence (every call):**
8+
9+
1. get_tools
10+
2. find_tool **must include** tool_name
11+
3. (get_locator|get_application_dom if needed)
12+
4. build inputs per schema **must ask user** for missing mandatory fields
13+
5. add token
14+
6. add driver_session (if not start_g4_session)
15+
7. call
16+
17+
* **Required params:** For all tools, inputs **must include** token.
18+
* **Required params:** For all tools **except** start_g4_session, inputs **must include** driver_session.
19+
* If the schema from find_tool does **not** define these fields, add them.
20+
* **DOM discipline (page tools): For any tool that interacts with a page/UI:**:
21+
22+
1. Call get_locator with { intent, action, hints, constraints, driver_session, token }.
23+
2. Use only the returned primary locator (or an explicit provided fallback). Never guess.
24+
3. **If OpenAI is available** (`OPENAI_API_KEY`, `OPENAI_URI`, `OPENAI_MODEL` exist):
25+
→ Call `get_locator` and use **only** its returned primary locator.
26+
→ Do **not** call `get_application_dom`.
27+
4. **If OpenAI is NOT available**:
28+
→ Do **not** call `get_locator`.
29+
→ Call `get_application_dom` `get_application_dom`** and use its returned DOM—following the **`policy`** field—to analyze the page and **deterministically derive the locator** (no guessing).
30+
5. **If no valid locator can be derived** (ambiguous/missing):
31+
**Ask the user** to provide a locator (type in PascalCase + value) or a minimal DOM snippet.
32+
33+
* When calling `start_g4_rule`, if the rule definition includes `on_element`
34+
35+
1. You **must also include** the `locator` field.
36+
2. `locator` **must explicitly declare the locator type**, not just the value.
37+
3. Locator type names **must be PascalCase** (e.g. `Xpath`, `CssSelector`, `Id`, `Name`, `ClassName`, `AccessibilityId`).
38+
* **DO NOT** `XPath`, `css`, `cssSelector`
39+
* **DO** `Xpath`, `CssSelector`
40+
4. If `locator` is missing, invalid, or ambiguously cased → **ask the user**. Do **not** guess.
41+
5. If the locator was produced by `get_locator` or derived from `get_application_dom`, **preserve the locator type exactly** (PascalCase).
42+
43+
* **Hard stop**: A `start_g4_rule` call that contains `on_element` **without** a valid `locator` is **invalid** and must **not** be executed.
44+
* **Self-check before sending:** Verify: tool exists, inputs match schema, driver_session+token present (if required). If any check fails **fix or ask**—don’t call.
45+
* **No guessing:** Never invent tool names, parameters, or locators. If policy/schema/DOM info is missing or ambiguous, ask the user.

resources/demo-azure-pipeline.yaml

Lines changed: 0 additions & 136 deletions
This file was deleted.

resources/demo-bot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"authentication": {
3-
"token": "3xezq5Yc33laNOPNP8yCsK33vQcQZ87E/zyLNNscYNeqvKTHAm9C3wAEDQV7X9+fuuHPhafDNXbSFgsbKmCncCKm7DRE5A6JtFSd90DNujujbQ3vLG4/4uSVCR76Z6VguIDSvRZ/pJTHCzBc9NNI/eb5fLHcjXyYrilm9NC7VTD/HOlgGC5CL+oFhHoR8s10YuI9QpRioZbyDHysFumpAAv3/PG/p/QBKNoQpjtsUgMytrnqr3m1bgyXITG0u5AUR2VpZLCXQO6MxU7kwLwvdNGXUDfajBVT29KyjXUEWN9dK0R38XmgZFQ7orkKfN2z0x2SMfC5mvTDM6as+/kYWFAvpqOZDhZ95sgQWp/zGig=",
3+
"token": "",
44
"password": "",
55
"username": ""
66
},

resources/demo-github-actions.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

resources/demo-plugin.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)