@sassoftware/sas-score-mcp-serverjs 1.0.1-9 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.skills/.claude-plugin/plugin.json +59 -0
- package/.skills/agents/sas-score-mcp-serverjs-agent.md +26 -0
- package/.skills/copilot-instructions.md +62 -0
- package/.skills/skills/README.md +204 -0
- package/.skills/skills/detail-strategy/SKILL.md +316 -0
- package/.skills/skills/find-library-server/SKILL.md +62 -0
- package/.skills/skills/find-resources/SKILL.md +66 -0
- package/.skills/skills/list-library/SKILL.md +30 -0
- package/.skills/skills/list-mas-job-jobdef/SKILL.md +31 -0
- package/.skills/skills/list-tables/SKILL.md +30 -0
- package/.skills/skills/read-strategy/SKILL.md +87 -0
- package/.skills/skills/request-routing/SKILL.md +112 -0
- package/.skills/skills/score-cas/SKILL.md +95 -0
- package/.skills/skills/score-job-jobdef/SKILL.md +58 -0
- package/.skills/skills/score-mas-scr/SKILL.md +58 -0
- package/.skills/skills/score-program/SKILL.md +59 -0
- package/.skills/skills/score-strategy/SKILL.md +39 -0
- package/README.md +96 -54
- package/cli.js +11 -13
- package/openApi.yaml +121 -121
- package/package.json +16 -14
- package/scripts/docs/SCORE_SKILL_REFERENCE.md +17 -16
- package/scripts/docs/TOOL_DESCRIPTION_TEMPLATE.md +3 -3
- package/scripts/docs/TOOL_UPDATES_SUMMARY.md +65 -63
- package/scripts/docs/oauth-http-transport.md +2 -2
- package/scripts/docs/sas-mcp-tools-reference.md +43 -32
- package/scripts/plot_msrp_usa.py +49 -0
- package/scripts/refreshtoken.js +58 -0
- package/scripts/runListScr.mjs +16 -0
- package/src/createMcpServer.js +4 -1
- package/src/expressMcpServer.js +47 -49
- package/src/oauthHandlers/authorize.js +4 -1
- package/src/oauthHandlers/baseUrl.js +4 -0
- package/src/oauthHandlers/callback.js +4 -0
- package/src/oauthHandlers/getMetadata.js +4 -0
- package/src/oauthHandlers/index.js +4 -0
- package/src/oauthHandlers/token.js +4 -0
- package/src/openApi.yaml +121 -121
- package/src/processHeaders.js +10 -7
- package/src/setupSkills.js +1 -18
- package/src/toolHelpers/_casScore.js +32 -0
- package/src/toolHelpers/_desc.js +14 -0
- package/src/toolHelpers/_findJob.js +12 -0
- package/src/toolHelpers/_findJobdef.js +10 -0
- package/src/toolHelpers/_findLibrary.js +11 -0
- package/src/toolHelpers/_findMas.js +13 -0
- package/src/toolHelpers/_findScr.js +36 -0
- package/src/toolHelpers/_findTable.js +11 -0
- package/src/toolHelpers/_listJobdefs.js +12 -2
- package/src/toolHelpers/_listJobs.js +19 -8
- package/src/toolHelpers/{_listModels.js → _listMas.js} +4 -4
- package/src/toolHelpers/_listScr.js +13 -0
- package/src/toolHelpers/{_scrInfo.js → _scrDescribe.js} +4 -4
- package/src/toolHelpers/_scrScore.js +2 -2
- package/src/toolHelpers/_submitCasl.js +19 -17
- package/src/toolHelpers/{_tableInfo.js → _tableDescribe.js} +2 -2
- package/src/toolHelpers/getLogonPayload.js +2 -2
- package/src/toolSet/casModelScore.js +93 -0
- package/src/toolSet/casProgramScore.js +105 -0
- package/src/toolSet/devaScore.js +11 -6
- package/src/toolSet/findJob.js +74 -59
- package/src/toolSet/findJobdef.js +67 -64
- package/src/toolSet/findLibrary.js +28 -23
- package/src/toolSet/findMas.js +72 -0
- package/src/toolSet/findScr.js +69 -0
- package/src/toolSet/findTable.js +34 -27
- package/src/toolSet/getEnv.js +57 -57
- package/src/toolSet/jobDescribe.js +65 -0
- package/src/toolSet/jobScore.js +90 -0
- package/src/toolSet/jobdefDescribe.js +67 -0
- package/src/toolSet/jobdefScore.js +85 -0
- package/src/toolSet/listJobdefs.js +17 -8
- package/src/toolSet/listJobs.js +15 -8
- package/src/toolSet/listLibraries.js +16 -10
- package/src/toolSet/listMas.js +71 -0
- package/src/toolSet/listScr.js +62 -0
- package/src/toolSet/listTables.js +78 -66
- package/src/toolSet/{runMacro.js → macroScore.js} +86 -82
- package/src/toolSet/makeTools.js +39 -25
- package/src/toolSet/masDescribe.js +67 -0
- package/src/toolSet/masScore.js +95 -0
- package/src/toolSet/{runProgram.js → programScore.js} +96 -93
- package/src/toolSet/readTable.js +43 -26
- package/src/toolSet/sasQuery.js +24 -18
- package/src/toolSet/scrDescribe.js +55 -0
- package/src/toolSet/scrScore.js +63 -70
- package/src/toolSet/searchAssets.js +1 -1
- package/src/toolSet/setContext.js +8 -3
- package/src/toolSet/superstat.js +61 -61
- package/src/toolSet/tableDescribe.js +65 -0
- package/.agents/sas-score-mcp-serverjs-agent.md +0 -58
- package/.instructions/copilot-instructions.md +0 -201
- package/.instructions/enforce-find-resource-strategy.md +0 -35
- package/.skills/sas-find-library-smart/SKILL.md +0 -155
- package/.skills/sas-find-resource-strategy/SKILL.md +0 -105
- package/.skills/sas-list-resource-strategy/SKILL.md +0 -124
- package/.skills/sas-list-tables-smart/SKILL.md +0 -128
- package/.skills/sas-read-and-score-strategy/SKILL.md +0 -113
- package/.skills/sas-read-strategy/SKILL.md +0 -154
- package/.skills/sas-request-classifier/SKILL.md +0 -74
- package/.skills/sas-score-workflow-strategy/SKILL.md +0 -314
- package/scripts/optimize_final.py +0 -140
- package/scripts/optimize_tools.py +0 -99
- package/scripts/setup-skills.js +0 -34
- package/scripts/update_descriptions.py +0 -46
- package/src/authpkce.js +0 -219
- package/src/handleGetDelete.js +0 -34
- package/src/handleRequest.js +0 -112
- package/src/hapiMcpServer.js +0 -241
- package/src/toolSet/findModel.js +0 -60
- package/src/toolSet/listModels.js +0 -56
- package/src/toolSet/modelInfo.js +0 -55
- package/src/toolSet/modelScore.js +0 -89
- package/src/toolSet/runCasProgram.js +0 -98
- package/src/toolSet/runJob.js +0 -81
- package/src/toolSet/runJobdef.js +0 -82
- package/src/toolSet/scrInfo.js +0 -52
- package/src/toolSet/tableInfo.js +0 -58
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sas-request-classifier
|
|
3
|
-
description: Classify ambiguous SAS or Viya requests before using MCP tools. Use when prompts mention jobs, code, models, scoring, CAS tables, content, or resources and the correct SAS domain is not yet clear.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# SAS Request Classifier
|
|
7
|
-
|
|
8
|
-
Use this skill to determine what kind of SAS object, workflow, or environment the user is referring to before selecting tools.
|
|
9
|
-
|
|
10
|
-
## When to use
|
|
11
|
-
Use this skill when the request contains ambiguous domain terms such as:
|
|
12
|
-
- model
|
|
13
|
-
- score
|
|
14
|
-
- scoring
|
|
15
|
-
- read
|
|
16
|
-
- query
|
|
17
|
-
- job
|
|
18
|
-
- jobdef
|
|
19
|
-
- code
|
|
20
|
-
- table
|
|
21
|
-
- content
|
|
22
|
-
- asset
|
|
23
|
-
- resource
|
|
24
|
-
|
|
25
|
-
Use this skill before any execution-oriented tool call if there is a chance the request is referring to the wrong SAS domain.
|
|
26
|
-
|
|
27
|
-
## Goal
|
|
28
|
-
Map the user request to the most likely SAS domain and hand off to the correct downstream skill or tool path.
|
|
29
|
-
|
|
30
|
-
## Classification targets
|
|
31
|
-
Classify the request into one or more of these categories:
|
|
32
|
-
- Resource existence lookup (library/table/model/job/jobdef) -> Route to **sas-find-resource-strategy**
|
|
33
|
-
- Resource listing (library/table/model/job/jobdef) -> Route to **sas-list-resource-strategy**
|
|
34
|
-
- Reading or querying tables → Route to **sas-read-strategy**
|
|
35
|
-
- CAS resource, SAS resource, caslib, or table discovery → Route to **sas-find-library-smart**
|
|
36
|
-
- SAS data, libref, or table discovery → Route to **sas-find-library-smart**
|
|
37
|
-
- Score model or scoring artifact → Route to **sas-score-workflow-strategy**
|
|
38
|
-
- Read data and score together → Route to **sas-read-and-score-strategy**
|
|
39
|
-
- SAS job or flow execution
|
|
40
|
-
- SAS code or program analysis
|
|
41
|
-
- General content or metadata lookup
|
|
42
|
-
- Environment, auth, or connectivity issue
|
|
43
|
-
|
|
44
|
-
## Procedure
|
|
45
|
-
1. Read the request and identify ambiguous nouns and verbs.
|
|
46
|
-
2. Infer whether the request is asking to discover, inspect, execute, deploy, score, compare, or troubleshoot.
|
|
47
|
-
3. Decide the most likely SAS domain and matching skill.
|
|
48
|
-
4. If confidence is low, ask one focused clarifying question.
|
|
49
|
-
5. If confidence is high, load and use the relevant skill:
|
|
50
|
-
- **sas-find-resource-strategy** — Unified find-only strategy for library/table/model/job/jobdef
|
|
51
|
-
- **sas-list-resource-strategy** — Unified list strategy for library/table/model/job/jobdef with non-null pagination defaults
|
|
52
|
-
- **sas-find-library-smart** — Find CAS or SAS libraries
|
|
53
|
-
- **sas-list-tables-smart** — Browse tables in a library
|
|
54
|
-
- **sas-read-strategy** — Choose read-table vs. sas-query for data retrieval
|
|
55
|
-
- **sas-read-and-score-strategy** — Combine data reading with model scoring
|
|
56
|
-
- **sas-score-workflow-strategy** — Route scoring requests to correct execution engine
|
|
57
|
-
6. Only after classification and skill guidance, use MCP tools.
|
|
58
|
-
|
|
59
|
-
## Disambiguation hints
|
|
60
|
-
- "Run" often implies job execution, but may also mean scoring or model invocation. Check for "score" or "model" context.
|
|
61
|
-
- "Model" may refer to MAS models, SAS jobs, jobdefs, or SCR models. Look for context or type suffix (e.g., `.job`, `.mas`, `.scr`).
|
|
62
|
-
- "Score" may refer to model scoring or job execution. Look for model name or context.
|
|
63
|
-
- "Table" usually suggests CAS or SAS but confirm library name and server context.
|
|
64
|
-
- "Find" — resource lookup. Route to sas-find-resource-strategy.
|
|
65
|
-
- "List" or "browse" — resource exploration. Route to sas-list-resource-strategy.
|
|
66
|
-
- "Read", "query", "fetch" — data retrieval. Route to sas-read-strategy.
|
|
67
|
-
- "Predict", "score records", "run model on data" — combined workflow. Route to sas-read-and-score-strategy or sas-score-workflow-strategy.
|
|
68
|
-
|
|
69
|
-
## Output
|
|
70
|
-
When you finish classification, state:
|
|
71
|
-
- the inferred SAS domain
|
|
72
|
-
- the confidence level
|
|
73
|
-
- the relevant skill(s) to load
|
|
74
|
-
- any remaining ambiguity or clarifying questions needed
|
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sas-score-workflow-strategy
|
|
3
|
-
description: >
|
|
4
|
-
Guide the full model scoring workflow: validate model familiarity, route to appropriate scoring tool
|
|
5
|
-
based on model type, invoke scoring with scenario data, and present merged results. Use this skill
|
|
6
|
-
when the user wants to run predictions on data (already fetched or user-supplied). Supports generic
|
|
7
|
-
syntax: "score with model <name>.<type> scenario =<params>" where type is job|jobdef|mas|scr|sas.
|
|
8
|
-
Trigger phrases: "score these records", "predict using model", "run model on", "score with model X.mas".
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# SAS Score Workflow
|
|
12
|
-
|
|
13
|
-
Orchestrates model validation, type-based routing, scoring invocation, and result presentation.
|
|
14
|
-
Handles both MAS models and alternative scoring engines (jobs, jobdefs, SCR, SAS programs).
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## Generic Scoring Syntax
|
|
19
|
-
|
|
20
|
-
Users can invoke scoring with a unified syntax that automatically routes to the correct tool:
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
score with model <name>.<type> [scenario =<key=value pairs>]
|
|
24
|
-
score <name>.<type> [scenario =<key=value pairs>]
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**Type determines the routing:**
|
|
28
|
-
- `.job` → route to `sas-score-run-job` with scoring parameters
|
|
29
|
-
- `.jobdef` → route to `sas-score-run-jobdef` with scoring parameters
|
|
30
|
-
- `.mas` → route to `sas-score-model-score` (Model Analytical Service — default)
|
|
31
|
-
- `.scr` → route to `sas-score-scr-score` (SAS Container Runtime)
|
|
32
|
-
- `.sas` → route to `sas-score-run-sas-program` to run sas program in folder
|
|
33
|
-
|
|
34
|
-
If no type is specified (bare model name), assume `.mas` (MAS model).
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
## Type-Based Routing
|
|
39
|
-
|
|
40
|
-
### Parse and Strip Model Type
|
|
41
|
-
|
|
42
|
-
When a user provides a model name with a type suffix (e.g., `simplejon.job`, `churn.mas`):
|
|
43
|
-
|
|
44
|
-
1. **Extract the type:** Split on the last dot to identify the type suffix
|
|
45
|
-
- `simplejon.job` → type = `job`, base name = `simplejon`
|
|
46
|
-
- `churn.mas` → type = `mas`, base name = `churn`
|
|
47
|
-
- `fraud_detector.jobdef` → type = `jobdef`, base name = `fraud_detector`
|
|
48
|
-
|
|
49
|
-
2. **Validate the type:** Confirm it matches one of the supported types: `job`, `jobdef`, `mas`, `scr`, `sas`
|
|
50
|
-
- If type is unrecognized, assume `.mas` (default MAS model) and treat the entire input as the model name
|
|
51
|
-
|
|
52
|
-
3. **Strip the type suffix:** Remove the `.type` from the model name before passing to the routing tool
|
|
53
|
-
- **Critical:** Always pass the base name (without the dot and type) to the invoked tool
|
|
54
|
-
- `simplejon.job` → pass `simplejon` to `sas-score-run-job`
|
|
55
|
-
- `churn.mas` → pass `churn` to `sas-score-model-score`
|
|
56
|
-
- `fraud_detector.jobdef` → pass `fraud_detector` to `sas-score-run-jobdef`
|
|
57
|
-
|
|
58
|
-
### Type: `.mas` (Model Aggregation Service)
|
|
59
|
-
- **Tool**: `sas-score-model-score`
|
|
60
|
-
- **Use for**: Standard MAS-deployed predictive models
|
|
61
|
-
- **Example**: `score with model churn.mas scenario =age=45,income=60000`
|
|
62
|
-
- **Invocation**: `sas-score-model-score({ model: "churn", scenario: {...} })`
|
|
63
|
-
|
|
64
|
-
### Type: `.job` (SAS Viya Job)
|
|
65
|
-
- **Tool**: `sas-score-run-job`
|
|
66
|
-
- **Use for**: Pre-built scoring jobs with parameters
|
|
67
|
-
- **Example**: `score with model monthly_scorer.job scenario =month=10,year=2025`
|
|
68
|
-
- **Invocation**: `sas-score-run-job({ name: "monthly_scorer", scenario: {...} })`
|
|
69
|
-
|
|
70
|
-
### Type: `.jobdef` (SAS Viya Job Definition)
|
|
71
|
-
- **Tool**: `sas-score-run-jobdef`
|
|
72
|
-
- **Use for**: Job definitions that perform scoring logic
|
|
73
|
-
- **Example**: `score with model fraud_detector.jobdef using amount=500,merchant=online`
|
|
74
|
-
- **Invocation**: `sas-score-run-jobdef({ name: "fraud_detector", scenario: {...} })`
|
|
75
|
-
|
|
76
|
-
### Type: `.scr` (Score Code Runtime)
|
|
77
|
-
- **Tool**: `sas-score-scr-score`
|
|
78
|
-
- **Use for**: Models deployed in SCR containers (REST endpoints)
|
|
79
|
-
- **Example**: `score https://scr-host/models/loan.scr using age=45,credit=700`
|
|
80
|
-
- **Invocation**: `sas-score-scr-score({ url: "https://scr-host/models/loan", scenario: {...} })`
|
|
81
|
-
|
|
82
|
-
### Type: `.sas` (SAS Program / SQL)
|
|
83
|
-
- **Tool**: `sas-score-run-sas-program`
|
|
84
|
-
- **Use for**: Custom SAS or SQL scoring code
|
|
85
|
-
- **Example**: `score my_scoring_code.sas using x=1,y=2`
|
|
86
|
-
- **Invocation**: `sas-score-run-sas-program({ folder: "my_scoring_code", scenario: {...} })`
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## Scenario Parsing
|
|
93
|
-
|
|
94
|
-
The scenario parameter (comma-separated key=value pairs) is parsed into an object:
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
scenario =age=45,income=60000,region=South
|
|
98
|
-
↓ parsed as:
|
|
99
|
-
{ age: "45", income: "60000", region: "South" }
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Accepted formats:
|
|
103
|
-
- **String**: `age=45,income=60000`
|
|
104
|
-
- **Object**: `{ age: 45, income: 60000 }`
|
|
105
|
-
- **Array** (batch): `[ {age:45, income:60000}, {age:50, income:75000} ]`
|
|
106
|
-
|
|
107
|
-
---
|
|
108
|
-
|
|
109
|
-
## Integration with other skills
|
|
110
|
-
|
|
111
|
-
- **Before scoring table data**: Use `sas-find-resource-strategy` to verify library/table/model resources, then `sas-read-strategy` to fetch records
|
|
112
|
-
- **For read + score workflows**: Use `sas-read-and-score-strategy` for the complete end-to-end pattern
|
|
113
|
-
|
|
114
|
-
---
|
|
115
|
-
|
|
116
|
-
## Step 1 — Check model familiarity before scoring
|
|
117
|
-
|
|
118
|
-
Score immediately if:
|
|
119
|
-
- The user names a specific model they've used before in this session, OR
|
|
120
|
-
- The model name matches a previously confirmed model in the conversation
|
|
121
|
-
|
|
122
|
-
Pause and suggest investigation if:
|
|
123
|
-
- The model name is new, vague, or misspelled-looking (e.g. "the churn one", "that cancer model")
|
|
124
|
-
- The user seems unsure of the required input variable names
|
|
125
|
-
|
|
126
|
-
**Suggested message:**
|
|
127
|
-
> "I don't recognize that model — want me to use `sas-find-resource-strategy` to confirm it exists,
|
|
128
|
-
> or `model-info` to check its required inputs first?"
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
## Step 2 — Prepare the scenario data
|
|
133
|
-
|
|
134
|
-
**For a single record** (one object):
|
|
135
|
-
```javascript
|
|
136
|
-
scenario = { field1: value1, field2: value2, ... }
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
**For batch scoring** (multiple records — the typical case):
|
|
140
|
-
```javascript
|
|
141
|
-
scenario = [
|
|
142
|
-
{ field1: val1, field2: val2, ... },
|
|
143
|
-
{ field1: val3, field2: val4, ... },
|
|
144
|
-
...
|
|
145
|
-
]
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
**Critical rules:**
|
|
149
|
-
- Loop or call sas-score-model-score **once per row**.
|
|
150
|
-
- Field names in the scenario must match the model's expected input variable names **exactly**.
|
|
151
|
-
- If table column names differ from model input names, **flag this to the user** and ask for confirmation before scoring.
|
|
152
|
-
- Example: Table has `age_years`, but model expects `age` → ask user which column maps to which input.
|
|
153
|
-
- Do not add units, labels, or extra metadata — raw field values only.
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
## Step 3 — Invoke the appropriate scoring tool
|
|
158
|
-
|
|
159
|
-
Based on the type extracted from the model name, invoke the corresponding tool:
|
|
160
|
-
|
|
161
|
-
**For `.mas` (default):**
|
|
162
|
-
```javascript
|
|
163
|
-
sas-score-model-score({
|
|
164
|
-
model: "<modelname>",
|
|
165
|
-
scenario: scenario, // object or array
|
|
166
|
-
uflag: false // set true if you need field names prefixed with _
|
|
167
|
-
})
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
**For `.job`:**
|
|
171
|
-
```javascript
|
|
172
|
-
sas-score-run-job({
|
|
173
|
-
name: "<jobname>",
|
|
174
|
-
scenario: scenario
|
|
175
|
-
})
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
**For `.jobdef`:**
|
|
179
|
-
```javascript
|
|
180
|
-
sas-score-run-jobdef({
|
|
181
|
-
name: "<jobdefname>",
|
|
182
|
-
scenario: scenario
|
|
183
|
-
})
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
**For `.scr`:**
|
|
187
|
-
```javascript
|
|
188
|
-
sas-score-scr-score({
|
|
189
|
-
url: "<scr_endpoint_url>",
|
|
190
|
-
scenario: scenario
|
|
191
|
-
})
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
**For `.sas`:**
|
|
195
|
-
```javascript
|
|
196
|
-
sas-score-run-sas-program({
|
|
197
|
-
src: "<sas_or_sql_code>",
|
|
198
|
-
scenario: scenario
|
|
199
|
-
})
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
**Rules:**
|
|
203
|
-
- Pass the full batch in one call; do not loop over rows
|
|
204
|
-
- If scoring fails, return the structured error and suggest troubleshooting
|
|
205
|
-
- For MAS models, include uflag parameter if underscore-prefixed output is needed
|
|
206
|
-
- For jobs/jobdefs, scenario becomes parameter arguments
|
|
207
|
-
- For SCR, include full URL endpoint
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
|
|
211
|
-
## Step 4 — Present the results
|
|
212
|
-
|
|
213
|
-
Merge the scoring output back with the input records and present as a table where possible.
|
|
214
|
-
|
|
215
|
-
**Always surface:**
|
|
216
|
-
- The key prediction/score field(s) (e.g. `P_churn`, `score`, `prediction`, `P_risk`)
|
|
217
|
-
- Any probability/confidence fields for classification models (e.g. `P_class0`, `P_class1`)
|
|
218
|
-
- Selected input fields that drove the prediction, so the user can see context
|
|
219
|
-
|
|
220
|
-
**Formatting:**
|
|
221
|
-
- Present results in a table for clarity
|
|
222
|
-
- If results exceed 10 rows, show the first 10 and ask: *"Want to see more results or export the full set?"*
|
|
223
|
-
- Round numeric predictions to 2–4 decimal places for readability
|
|
224
|
-
|
|
225
|
-
---
|
|
226
|
-
|
|
227
|
-
## Common flows
|
|
228
|
-
|
|
229
|
-
**Flow A — Score rows with MAS model**
|
|
230
|
-
> "Score the first 10 customers in Public.customers with the churn model"
|
|
231
|
-
|
|
232
|
-
1. `sas-score-read-table` → { table: "Public.customers", limit: 10 }
|
|
233
|
-
2. `sas-score-model-score` → { model: "churn", scenario: [ ...10 row objects ] }
|
|
234
|
-
3. Present merged results with prediction + key inputs
|
|
235
|
-
|
|
236
|
-
**Flow B — Score with a scoring job**
|
|
237
|
-
> "Score December sales with the monthly_scorer job using month=12,year=2025"
|
|
238
|
-
|
|
239
|
-
1. `sas-score-run-job` → { name: "monthly_scorer", scenario: { month: "12", year: "2025" } }
|
|
240
|
-
2. Capture job output and tables
|
|
241
|
-
3. Present results
|
|
242
|
-
|
|
243
|
-
**Flow C — Score with a job definition**
|
|
244
|
-
> "Run fraud detection jobdef on transaction amount=500, merchant=online"
|
|
245
|
-
|
|
246
|
-
1. `sas-score-run-jobdef` → { name: "fraud_detection", scenario: { amount: "500", merchant: "online" } }
|
|
247
|
-
2. Capture log, listings, and tables
|
|
248
|
-
3. Present results
|
|
249
|
-
|
|
250
|
-
**Flow D — Score with SCR endpoint**
|
|
251
|
-
> "Score with the loan model at https://scr-host/models/loan using age=45, credit_score=700"
|
|
252
|
-
|
|
253
|
-
1. `sas-score-scr-score` → { url: "https://scr-host/models/loan", scenario: { age: "45", credit_score: "700" } }
|
|
254
|
-
2. Capture prediction response
|
|
255
|
-
3. Present result
|
|
256
|
-
|
|
257
|
-
**Flow E — Score results of an analytical query with MAS**
|
|
258
|
-
> "Score high-value customers (spend > 5000) in mylib.sales with the fraud model"
|
|
259
|
-
|
|
260
|
-
1. `sas-score-sas-query` → { table: "mylib.sales", sql: "SELECT * FROM mylib.sales WHERE spend > 5000" }
|
|
261
|
-
2. `sas-score-model-score` → { model: "fraud", scenario: [ ...result rows ] }
|
|
262
|
-
3. Present merged results
|
|
263
|
-
|
|
264
|
-
**Flow F — User supplies scenario data directly**
|
|
265
|
-
> "Score age=45, income=60000, region=South with the churn model"
|
|
266
|
-
|
|
267
|
-
1. Skip read step
|
|
268
|
-
2. `sas-score-model-score` → { model: "churn", scenario: { age: "45", income: "60000", region: "South" } }
|
|
269
|
-
3. Present result
|
|
270
|
-
|
|
271
|
-
**Flow G — Model unfamiliar, need to confirm**
|
|
272
|
-
> "Score Public.applicants with the creditRisk2 model"
|
|
273
|
-
|
|
274
|
-
1. Pause — "creditRisk2" is new
|
|
275
|
-
2. Suggest: `sas-find-resource-strategy` to confirm resource existence, `model-info` to get input variables
|
|
276
|
-
3. Once confirmed → `sas-score-read-table` + `sas-score-model-score`
|
|
277
|
-
|
|
278
|
-
**Flow H — Generic score syntax with type routing**
|
|
279
|
-
> "score with model churn.mas scenario =age=45,income=60000"
|
|
280
|
-
> "score fraud_detector.jobdef where scenario =amount=500"
|
|
281
|
-
> "score monthly_report.job using month=10,year=2025"
|
|
282
|
-
|
|
283
|
-
1. Parse model name to extract type (.mas, .job, .jobdef, .scr, .sas)
|
|
284
|
-
2. Route to appropriate tool based on type
|
|
285
|
-
3. Parse scenario and invoke tool with parameters
|
|
286
|
-
4. Present results from routed tool
|
|
287
|
-
|
|
288
|
-
---
|
|
289
|
-
|
|
290
|
-
## Error handling
|
|
291
|
-
|
|
292
|
-
| Problem | Action |
|
|
293
|
-
|---|---|
|
|
294
|
-
| Model not found | Use `sas-find-resource-strategy` to verify the model (or job/jobdef type) exists |
|
|
295
|
-
| Input field name mismatch | Show the mismatch (table has X, model expects Y), ask user to confirm mapping |
|
|
296
|
-
| Scoring error / invalid inputs | Return structured error, suggest `model-info` to check required inputs and data types |
|
|
297
|
-
| Empty read result | Tell user, ask if they want to adjust the query/filter before scoring |
|
|
298
|
-
| Missing input fields | Ask which table columns map to the required model inputs |
|
|
299
|
-
|
|
300
|
-
---
|
|
301
|
-
|
|
302
|
-
## Tips
|
|
303
|
-
|
|
304
|
-
- **Batch is better:** Always pass the full set of records in one `sas-score-model-score` call. Do not loop.
|
|
305
|
-
- **Confirm mappings:** If column names don't match model inputs, ask before scoring.
|
|
306
|
-
- **Show context:** Include key input columns in the result output so predictions make sense.
|
|
307
|
-
- **Limit output:** For large result sets (>10 rows), ask before showing all.
|
|
308
|
-
|
|
309
|
-
---
|
|
310
|
-
|
|
311
|
-
## Integration with other skills
|
|
312
|
-
|
|
313
|
-
- **Before scoring table data**: Use `sas-find-resource-strategy` to verify resources, then `sas-read-strategy` to fetch records
|
|
314
|
-
- **For read + score workflows**: Use `sas-read-and-score-strategy` for the complete end-to-end pattern
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
import re
|
|
3
|
-
|
|
4
|
-
# Read and replace listJobs
|
|
5
|
-
with open('src/toolSet/listJobs.js', 'r') as f:
|
|
6
|
-
content = f.read()
|
|
7
|
-
|
|
8
|
-
# Find and replace listJobs description - find the full description block
|
|
9
|
-
pattern = r'let description = `\n ## list-jobs.*? `;'
|
|
10
|
-
replacement = r'''let description = `
|
|
11
|
-
list-jobs — enumerate SAS Viya job assets.
|
|
12
|
-
|
|
13
|
-
USE when: list jobs, show jobs, browse jobs, list available jobs, next page of jobs
|
|
14
|
-
DO NOT USE for: find single job (use find-job), execute job (use run-job), run jobdef (use run-jobdef), sas code (use run-sas-program)
|
|
15
|
-
|
|
16
|
-
PARAMETERS
|
|
17
|
-
- limit: number (default: 10) — number of jobs per page
|
|
18
|
-
- start: number (default: 1) — 1-based page offset
|
|
19
|
-
- where: string (default: '') — optional filter expression
|
|
20
|
-
|
|
21
|
-
ROUTING RULES
|
|
22
|
-
- "list jobs" → { start: 1, limit: 10 }
|
|
23
|
-
- "show me 25 jobs" → { start: 1, limit: 25 }
|
|
24
|
-
- "list jobs limit 50" → { start: 1, limit: 50 }
|
|
25
|
-
- "next jobs" (after prior page) → { start: previousStart + previousLimit, limit: previousLimit }
|
|
26
|
-
|
|
27
|
-
EXAMPLES
|
|
28
|
-
- "list jobs" → { start: 1, limit: 10 }
|
|
29
|
-
- "list 25 jobs" → { start: 1, limit: 25 }
|
|
30
|
-
- "next jobs" → { start: 11, limit: 10 }
|
|
31
|
-
|
|
32
|
-
NEGATIVE EXAMPLES (do not route here)
|
|
33
|
-
- "find job abc" (use find-job)
|
|
34
|
-
- "run job abc" (use run-job)
|
|
35
|
-
- "list models" (use list-models)
|
|
36
|
-
|
|
37
|
-
PAGINATION
|
|
38
|
-
If returned length === limit, hint: next start = start + limit. Empty result with start > 1 means paged past end.
|
|
39
|
-
|
|
40
|
-
ERRORS
|
|
41
|
-
Surface backend error directly; never fabricate job names.
|
|
42
|
-
`;'''
|
|
43
|
-
|
|
44
|
-
if re.search(pattern, content, re.DOTALL):
|
|
45
|
-
content = re.sub(pattern, replacement, content, flags=re.DOTALL)
|
|
46
|
-
with open('src/toolSet/listJobs.js', 'w') as f:
|
|
47
|
-
f.write(content)
|
|
48
|
-
print("✓ Updated listJobs.js")
|
|
49
|
-
else:
|
|
50
|
-
print("✗ Pattern not found in listJobs.js")
|
|
51
|
-
|
|
52
|
-
# Read and replace listJobdefs
|
|
53
|
-
with open('src/toolSet/listJobdefs.js', 'r') as f:
|
|
54
|
-
content = f.read()
|
|
55
|
-
|
|
56
|
-
pattern = r'let description = `\n ## list-jobdefs.*? `;'
|
|
57
|
-
replacement = r'''let description = `
|
|
58
|
-
list-jobdefs — enumerate SAS Viya job definitions (jobdefs) assets.
|
|
59
|
-
|
|
60
|
-
USE when: list jobdefs, show jobdefs, browse jobdefs, list available jobdefs, next page
|
|
61
|
-
DO NOT USE for: find single jobdef (use find-jobdef), execute jobdef (use run-jobdef), find job (use find-job), sas code (use run-sas-program)
|
|
62
|
-
|
|
63
|
-
PARAMETERS
|
|
64
|
-
- limit: number (default: 10) — number of jobdefs per page
|
|
65
|
-
- start: number (default: 1) — 1-based page offset
|
|
66
|
-
- where: string (default: '') — optional filter expression
|
|
67
|
-
|
|
68
|
-
ROUTING RULES
|
|
69
|
-
- "list jobdefs" → { start: 1, limit: 10 }
|
|
70
|
-
- "show me 25 jobdefs" → { start: 1, limit: 25 }
|
|
71
|
-
- "next jobdefs" → { start: previousStart + previousLimit, limit: previousLimit }
|
|
72
|
-
|
|
73
|
-
EXAMPLES
|
|
74
|
-
- "list jobdefs" → { start: 1, limit: 10 }
|
|
75
|
-
- "list 25 jobdefs" → { start: 1, limit: 25 }
|
|
76
|
-
- "next jobdefs" → { start: 11, limit: 10 }
|
|
77
|
-
|
|
78
|
-
NEGATIVE EXAMPLES (do not route here)
|
|
79
|
-
- "find jobdef abc" (use find-jobdef)
|
|
80
|
-
- "list jobs" (use list-jobs)
|
|
81
|
-
- "run jobdef abc" (use run-jobdef)
|
|
82
|
-
|
|
83
|
-
PAGINATION
|
|
84
|
-
If returned length === limit, hint: next start = start + limit.
|
|
85
|
-
|
|
86
|
-
ERRORS
|
|
87
|
-
Surface backend error directly; never fabricate jobdef names.
|
|
88
|
-
`;'''
|
|
89
|
-
|
|
90
|
-
if re.search(pattern, content, re.DOTALL):
|
|
91
|
-
content = re.sub(pattern, replacement, content, flags=re.DOTALL)
|
|
92
|
-
with open('src/toolSet/listJobdefs.js', 'w') as f:
|
|
93
|
-
f.write(content)
|
|
94
|
-
print("✓ Updated listJobdefs.js")
|
|
95
|
-
else:
|
|
96
|
-
print("✗ Pattern not found in listJobdefs.js")
|
|
97
|
-
|
|
98
|
-
# Read and replace runCasProgram
|
|
99
|
-
with open('src/toolSet/runCasProgram.js', 'r') as f:
|
|
100
|
-
content = f.read()
|
|
101
|
-
|
|
102
|
-
pattern = r'let description = `\n## run-cas-program.*?Response\n`'
|
|
103
|
-
replacement = r'''let description = `
|
|
104
|
-
run-cas-program — execute a CAS program on SAS Viya server.
|
|
105
|
-
|
|
106
|
-
USE when: run cas program, execute cas, submit cas, run cas code, cas action
|
|
107
|
-
DO NOT USE for: macros (use run-macro), sas code (use run-sas-program), jobs (use run-job/find-job), jobdefs (use run-jobdef/find-jobdef), models (use find-model)
|
|
108
|
-
|
|
109
|
-
PARAMETERS
|
|
110
|
-
- src: string (required) — CAS program code to execute verbatim
|
|
111
|
-
- scenario: string | object (optional) — input parameters. Accepts: "x=1, y=2" or {x:1, y:2}
|
|
112
|
-
|
|
113
|
-
ROUTING RULES
|
|
114
|
-
- "run cas program 'action echo / code=\"xyz\"'" → { src: "action echo / code=\"xyz\"" }
|
|
115
|
-
- "submit cas action echo" → { src: "action echo" }
|
|
116
|
-
- "cas program with param1=10" → { src: "...", scenario: {param1: 10} }
|
|
117
|
-
|
|
118
|
-
EXAMPLES
|
|
119
|
-
- "run cas program 'action echo / code=\"hello\"'" → { src: "action echo / code=\"hello\"" }
|
|
120
|
-
- "execute cas action simple.summary" → { src: "action simple.summary" }
|
|
121
|
-
|
|
122
|
-
NEGATIVE EXAMPLES (do not route here)
|
|
123
|
-
- "run sas macro" (use run-macro)
|
|
124
|
-
- "submit sas code" (use run-sas-program)
|
|
125
|
-
- "run job X" (use run-job)
|
|
126
|
-
|
|
127
|
-
NOTES
|
|
128
|
-
Sends src verbatim without validation. For SAS macros use run-macro. For arbitrary SAS code use run-sas-program.
|
|
129
|
-
|
|
130
|
-
RESPONSE
|
|
131
|
-
Log output, listings, tables from CAS execution. Error if execution fails.
|
|
132
|
-
`'''
|
|
133
|
-
|
|
134
|
-
if re.search(pattern, content, re.DOTALL):
|
|
135
|
-
content = re.sub(pattern, replacement, content, flags=re.DOTALL)
|
|
136
|
-
with open('src/toolSet/runCasProgram.js', 'w') as f:
|
|
137
|
-
f.write(content)
|
|
138
|
-
print("✓ Updated runCasProgram.js")
|
|
139
|
-
else:
|
|
140
|
-
print("✗ Pattern not found in runCasProgram.js")
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
import re
|
|
3
|
-
|
|
4
|
-
# DevaScore optimization
|
|
5
|
-
deva_old = ''' let description = `
|
|
6
|
-
## deva-score — compute a numeric score based on two input values
|
|
7
|
-
|
|
8
|
-
LLM Invocation Guidance (When to use)
|
|
9
|
-
Use THIS tool when:
|
|
10
|
-
- User wants to calculate the deva score: "Calculate deva score for 5 and 10"
|
|
11
|
-
- User provides two numbers for scoring: "Score these values: 3 and 7"
|
|
12
|
-
- User wants to compute a score in a series: "Calculate scores for [list of numbers]"
|
|
13
|
-
|
|
14
|
-
Do NOT use this tool for:
|
|
15
|
-
- Scoring models (use model-score)
|
|
16
|
-
- Statistical calculations beyond deva scoring
|
|
17
|
-
- Looking up data or metadata
|
|
18
|
-
|
|
19
|
-
Purpose
|
|
20
|
-
Compute a numeric deva score by applying the formula (a + b) * 42 to two input numbers. For scoring more than two numbers, call this tool multiple times using the previous result as the first input (left-to-right fold).
|
|
21
|
-
|
|
22
|
-
Parameters
|
|
23
|
-
- a (number, required): First numeric input value
|
|
24
|
-
- b (number, required): Second numeric input value
|
|
25
|
-
|
|
26
|
-
Response Contract
|
|
27
|
-
Returns a numeric result: (a + b) * 42
|
|
28
|
-
The result is always a number representing the computed deva score.
|
|
29
|
-
|
|
30
|
-
Disambiguation & Clarification
|
|
31
|
-
- If user provides more than two numbers without clear instructions: "Do you want to calculate the deva score by combining these numbers left-to-right?"
|
|
32
|
-
- If user provides non-numeric input: "Please provide numeric values"
|
|
33
|
-
|
|
34
|
-
Examples (→ mapped params)
|
|
35
|
-
- "Calculate deva score for 5 and 10" → { a: 5, b: 10 } returns 630
|
|
36
|
-
- "Score 1 and 2" → { a: 1, b: 2 } returns 126
|
|
37
|
-
- For multiple numbers, chain calls: devaScore(1,2)→126, then devaScore(126,3)→5418
|
|
38
|
-
|
|
39
|
-
Negative Examples (should NOT call deva-score)
|
|
40
|
-
- "Score this customer with the credit model" (use model-score instead)
|
|
41
|
-
- "Calculate the mean of these values" (use run-sas-program or sas-query instead)
|
|
42
|
-
|
|
43
|
-
Related Tools
|
|
44
|
-
- None directly related (this is a specialized scoring tool)
|
|
45
|
-
|
|
46
|
-
Notes
|
|
47
|
-
For sequences of numbers, use a left-to-right fold: call devaScore(first, second), then use that result as the first parameter for devaScore(result, third), and so on.
|
|
48
|
-
`;'''
|
|
49
|
-
|
|
50
|
-
deva_new = ''' let description = `
|
|
51
|
-
deva-score — compute a numeric score based on two input values.
|
|
52
|
-
|
|
53
|
-
USE when: calculate deva score, score these values, compute score for numbers
|
|
54
|
-
DO NOT USE for: model scoring (use model-score), statistical calculations, data lookup
|
|
55
|
-
|
|
56
|
-
PARAMETERS
|
|
57
|
-
- a: number (required) — first input value
|
|
58
|
-
- b: number (required) — second input value
|
|
59
|
-
|
|
60
|
-
FORMULA: (a + b) * 42
|
|
61
|
-
|
|
62
|
-
ROUTING RULES
|
|
63
|
-
- "calculate deva score for 5 and 10" → { a: 5, b: 10 }
|
|
64
|
-
- "score 1 and 2" → { a: 1, b: 2 }
|
|
65
|
-
- "deva score a=3, b=7" → { a: 3, b: 7 }
|
|
66
|
-
- Multiple numbers → chain calls left-to-right: call(first, second), then call(result, third)
|
|
67
|
-
|
|
68
|
-
EXAMPLES
|
|
69
|
-
- "Calculate deva score for 5 and 10" → { a: 5, b: 10 } returns 630
|
|
70
|
-
- "Score 1 and 2" → { a: 1, b: 2 } returns 126
|
|
71
|
-
- "Deva score 20 and 30" → { a: 20, b: 30 } returns 2100
|
|
72
|
-
|
|
73
|
-
NEGATIVE EXAMPLES (do not route here)
|
|
74
|
-
- "Score this customer with credit model" (use model-score)
|
|
75
|
-
- "Calculate the mean of these values" (use run-sas-program or sas-query)
|
|
76
|
-
- "Statistical analysis of numbers" (use sas-query)
|
|
77
|
-
|
|
78
|
-
RESPONSE
|
|
79
|
-
Returns { score: (a + b) * 42 }
|
|
80
|
-
`;'''
|
|
81
|
-
|
|
82
|
-
files = {
|
|
83
|
-
'src/toolSet/devaScore.js': (deva_old, deva_new),
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
for filepath, (old, new) in files.items():
|
|
87
|
-
try:
|
|
88
|
-
with open(filepath, 'r', encoding='utf-8') as f:
|
|
89
|
-
content = f.read()
|
|
90
|
-
|
|
91
|
-
if old in content:
|
|
92
|
-
content = content.replace(old, new)
|
|
93
|
-
with open(filepath, 'w', encoding='utf-8') as f:
|
|
94
|
-
f.write(content)
|
|
95
|
-
print(f"✓ Updated {filepath}")
|
|
96
|
-
else:
|
|
97
|
-
print(f"✗ Pattern not found in {filepath}")
|
|
98
|
-
except Exception as e:
|
|
99
|
-
print(f"✗ Error updating {filepath}: {e}")
|
package/scripts/setup-skills.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
import os from 'os';
|
|
6
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
-
// Paths
|
|
8
|
-
let client = (process.env.CLIENTNAME == null) ? '.github' : `.${process.env.CLIENTNAME.toLowerCase()}`;
|
|
9
|
-
const source = path.join(__dirname, `../.skills`);
|
|
10
|
-
const destination = path.join(process.cwd(), client);
|
|
11
|
-
// const destination = path.join(os.homedir(), client)
|
|
12
|
-
console.error(`📁 Copying ${source} to ${destination}...`);
|
|
13
|
-
function copyFolderSync(from, to) {
|
|
14
|
-
if (!fs.existsSync(from)) return;
|
|
15
|
-
if (!fs.existsSync(to)) fs.mkdirSync(to, { recursive: true });
|
|
16
|
-
console.error(`📁 Copying folder: ${from} to ${to}`);
|
|
17
|
-
fs.readdirSync(from).forEach(element => {
|
|
18
|
-
const fromPath = path.join(from, element);
|
|
19
|
-
const toPath = path.join(to, element);
|
|
20
|
-
if (fs.lstatSync(fromPath).isFile()) {
|
|
21
|
-
fs.copyFileSync(fromPath, toPath);
|
|
22
|
-
} else if (fs.lstatSync(fromPath).isDirectory()) {
|
|
23
|
-
copyFolderSync(fromPath, toPath);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
copyFolderSync(source, destination);
|
|
30
|
-
console.error(`✅ Success: ${destination} folder is now in your project root.`);
|
|
31
|
-
} catch (err) {
|
|
32
|
-
console.error('❌ Error copying files:', err.message);
|
|
33
|
-
}
|
|
34
|
-
process.exit(0);
|