@sassoftware/sas-score-mcp-serverjs 1.1.1 → 1.1.3

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.
@@ -1,65 +1,65 @@
1
- /*
2
- * Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { z } from 'zod';
6
- import _findJob from '../toolHelpers/_findJob.js';
7
- function jobDescribe(_appContext) {
8
- const isAgent = _appContext && _appContext.agent;
9
- let description = isAgent ? `
10
- job-describe — return input schema for a Job model.
11
- PARAMS: intent ('describe', required), name (string, required)
12
- RETURNS: job input variable definitions
13
- ` : `
14
- job-describe — return information about a specific SAS Viya job.
15
-
16
- USE when: describe job, show job details, what does job X do, job metadata, inputs/outputs for job
17
- DO NOT USE for: find job or verify it exists (use ${_appContext.brand}-find-job), list jobs (use ${_appContext.brand}-list-jobs), score job (use ${_appContext.brand}-job-score)
18
-
19
- PARAMETERS
20
- - intent: must be 'describe' — only pass if user explicitly asked to describe/inspect a job. Do NOT use for find or verify existence.
21
- - name: string (required) — name of job whose details are being requested. Should be exact match to job name.
22
-
23
- ROUTING RULES
24
- - "describe job <name>" → { name: "<name>" }
25
- - "describe model <name.job>"
26
- - "info for job <name>" → { name: "<name>" }
27
-
28
- EXAMPLES
29
- - "describe job cars_job_v4" → { name: "cars_job_v4" }
30
- - "describe metricsRefresh.job" → { name: "metricsRefresh" }
31
-
32
- NEGATIVE EXAMPLES (do not route here)
33
- - "list jobs" (use ${_appContext.brand}-list-jobs)
34
- - "score job cars_job_v4" (use ${_appContext.brand}-job-score)
35
- - "score jobdef cars_job_v4" (use ${_appContext.brand}-jobdef-score)
36
-
37
- ERRORS
38
- Returns job metadata
39
- `;
40
-
41
- let spec = {
42
- name: 'job-describe',
43
- description: description,
44
- inputSchema: z.object({
45
- intent: z.literal('describe'),
46
- name: z.string()
47
- }),
48
- handler: async (params) => {
49
- const { intent, ...rest } = params;
50
- if (rest.name != null && rest.name.endsWith('.job')) {
51
- rest.name = rest.name.slice(0, -4);
52
- }
53
- rest.tool = 'describe';
54
- let r = await _findJob(rest);
55
- return r;
56
- }
57
- }
58
-
59
-
60
- /* correct spec for registerTool with inputSchema */
61
-
62
- return spec;
63
- }
64
- export default jobDescribe;
65
-
1
+ /*
2
+ * Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { z } from 'zod';
6
+ import _findJob from '../toolHelpers/_findJob.js';
7
+ function jobDescribe(_appContext) {
8
+ const isAgent = _appContext && _appContext.agent;
9
+ let description = isAgent ? `
10
+ job-describe — return input schema for a Job model.
11
+ PARAMS: intent ('describe', required), name (string, required)
12
+ RETURNS: job input variable definitions
13
+ ` : `
14
+ job-describe — return information about a specific SAS Viya job.
15
+
16
+ USE when: describe job, show job details, what does job X do, job metadata, inputs/outputs for job
17
+ DO NOT USE for: find job or verify it exists (use ${_appContext.brand}-find-job), list jobs (use ${_appContext.brand}-list-jobs), score job (use ${_appContext.brand}-job-score)
18
+
19
+ PARAMETERS
20
+ - intent: must be 'describe' — only pass if user explicitly asked to describe/inspect a job. Do NOT use for find or verify existence.
21
+ - name: string (required) — name of job whose details are being requested. Should be exact match to job name.
22
+
23
+ ROUTING RULES
24
+ - "describe job <name>" → { name: "<name>" }
25
+ - "describe model <name.job>"
26
+ - "info for job <name>" → { name: "<name>" }
27
+
28
+ EXAMPLES
29
+ - "describe job cars_job_v4" → { name: "cars_job_v4" }
30
+ - "describe metricsRefresh.job" → { name: "metricsRefresh" }
31
+
32
+ NEGATIVE EXAMPLES (do not route here)
33
+ - "list jobs" (use ${_appContext.brand}-list-jobs)
34
+ - "score job cars_job_v4" (use ${_appContext.brand}-job-score)
35
+ - "score jobdef cars_job_v4" (use ${_appContext.brand}-jobdef-score)
36
+
37
+ ERRORS
38
+ Returns job metadata
39
+ `;
40
+
41
+ let spec = {
42
+ name: 'job-describe',
43
+ description: description,
44
+ inputSchema: z.object({
45
+ intent: z.literal('describe'),
46
+ name: z.string()
47
+ }),
48
+ handler: async (params) => {
49
+ const { intent, ...rest } = params;
50
+ if (rest.name != null && rest.name.endsWith('.job')) {
51
+ rest.name = rest.name.slice(0, -4);
52
+ }
53
+ rest.tool = 'describe';
54
+ let r = await _findJob(rest);
55
+ return r;
56
+ }
57
+ }
58
+
59
+
60
+ /* correct spec for registerTool with inputSchema */
61
+
62
+ return spec;
63
+ }
64
+ export default jobDescribe;
65
+
@@ -1,90 +1,90 @@
1
- /*
2
- * Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
-
6
- import { z } from 'zod';
7
- import _jobSubmit from '../toolHelpers/_jobSubmit.js';
8
-
9
- function jobScore(_appContext) {
10
- const isAgent = _appContext && _appContext.agent;
11
-
12
- let description = isAgent ? `
13
- job-score — score by executing a SAS Viya Job model.
14
- PARAMS: name (string, required), scenario (object, optional)
15
- RETURNS: job log, ODS output, and any result tables
16
- ` : `
17
- job-score — score with a deployed SAS Viya job model.
18
-
19
- USE when: score with job, run job, execute job model
20
- DO NOT USE for: arbitrary SAS code (use program-score), macros (use macro-score), list/find jobs
21
-
22
- PARAMETERS
23
- - name: string — job name (required)
24
- - scenario: object — input parameters as JSON (optional, defaults to {}). Example: {month:10, year:2025}
25
-
26
- ROUTING RULES
27
- - "score with job xyz" → { name: "xyz" }
28
- - "score with job xyz with param1=10, param2=val2" → { name: "xyz", scenario: {param1:10, param2:"val2"} }
29
- - "run job xyz" → { name: "xyz" }
30
- - "run job xyz with param1=10, param2=val2" → { name: "xyz", scenario: {param1:10, param2:"val2"} }
31
-
32
- EXAMPLES
33
- - "score with job xyz" → { name: "xyz" }
34
- - "score with job monthly_etl with month=10, year=2025" → { name: "monthly_etl", scenario: {month:10, year:2025} }
35
- - "score with monthly_etl.job with month=10, year=2025" → { name: "monthly_etl", scenario: {month:10, year:2025} }
36
- - "run job xyz" → { name: "xyz" }
37
- - "run job monthly_etl with month=10, year=2025" → { name: "monthly_etl", scenario: {month:10, year:2025} }
38
-
39
- NEGATIVE EXAMPLES (do not route here)
40
- - "run SAS code" (use program-score)
41
- - "score macro X" (use macro-score)
42
- - "list jobs" (use list-jobs)
43
- - "find job X" (use find-job)
44
-
45
- ERRORS
46
- Returns log output, listings, tables from job. Error if job not found.
47
- `;
48
-
49
- let spec = {
50
- name: 'job-score',
51
- description: description,
52
- inputSchema: z.object({
53
- name: z.string(),
54
- scenario: z.any()
55
- }),
56
- handler: async (params) => {
57
- let {scenario, name} = params;
58
-
59
- if(name.endsWith('.job')) {
60
- params.name = name.slice(0, -4);
61
- }
62
- // Convert the scenario string to an object
63
- // Example: "x=1, y=2, z=3" to { x: 1, y: 2, z: 3 }
64
- let scenarioObj = {};
65
- let count = 0;
66
- if (typeof scenario === 'object') {
67
- scenarioObj = scenario;
68
- } else if (Array.isArray(scenario)) {
69
- scenarioObj = scenario[0];
70
- } else {
71
- //console.error('Incoming scenario', scenario);
72
- scenarioObj = scenario.split(',').reduce((acc, pair) => {
73
- let [key, value] = pair.split('=');
74
- acc[key.trim()] = value;
75
- count++;
76
- return acc;
77
- }, {});
78
- }
79
- params.scenario = scenarioObj;
80
- params.type = 'job';
81
- // Provide runtime context for auth and server settings
82
- let r = await _jobSubmit(params);
83
- return r;
84
- }
85
- };
86
- return spec;
87
- }
88
-
89
- export default jobScore;
90
-
1
+ /*
2
+ * Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ import { z } from 'zod';
7
+ import _jobSubmit from '../toolHelpers/_jobSubmit.js';
8
+
9
+ function jobScore(_appContext) {
10
+ const isAgent = _appContext && _appContext.agent;
11
+
12
+ let description = isAgent ? `
13
+ job-score — score by executing a SAS Viya Job model.
14
+ PARAMS: name (string, required), scenario (object, optional)
15
+ RETURNS: job log, ODS output, and any result tables
16
+ ` : `
17
+ job-score — score with a deployed SAS Viya job model.
18
+
19
+ USE when: score with job, run job, execute job model
20
+ DO NOT USE for: arbitrary SAS code (use program-score), macros (use macro-score), list/find jobs
21
+
22
+ PARAMETERS
23
+ - name: string — job name (required)
24
+ - scenario: object — input parameters as JSON (optional, defaults to {}). Example: {month:10, year:2025}
25
+
26
+ ROUTING RULES
27
+ - "score with job xyz" → { name: "xyz" }
28
+ - "score with job xyz with param1=10, param2=val2" → { name: "xyz", scenario: {param1:10, param2:"val2"} }
29
+ - "run job xyz" → { name: "xyz" }
30
+ - "run job xyz with param1=10, param2=val2" → { name: "xyz", scenario: {param1:10, param2:"val2"} }
31
+
32
+ EXAMPLES
33
+ - "score with job xyz" → { name: "xyz" }
34
+ - "score with job monthly_etl with month=10, year=2025" → { name: "monthly_etl", scenario: {month:10, year:2025} }
35
+ - "score with monthly_etl.job with month=10, year=2025" → { name: "monthly_etl", scenario: {month:10, year:2025} }
36
+ - "run job xyz" → { name: "xyz" }
37
+ - "run job monthly_etl with month=10, year=2025" → { name: "monthly_etl", scenario: {month:10, year:2025} }
38
+
39
+ NEGATIVE EXAMPLES (do not route here)
40
+ - "run SAS code" (use program-score)
41
+ - "score macro X" (use macro-score)
42
+ - "list jobs" (use list-jobs)
43
+ - "find job X" (use find-job)
44
+
45
+ ERRORS
46
+ Returns log output, listings, tables from job. Error if job not found.
47
+ `;
48
+
49
+ let spec = {
50
+ name: 'job-score',
51
+ description: description,
52
+ inputSchema: z.object({
53
+ name: z.string(),
54
+ scenario: z.any()
55
+ }),
56
+ handler: async (params) => {
57
+ let {scenario, name} = params;
58
+
59
+ if(name.endsWith('.job')) {
60
+ params.name = name.slice(0, -4);
61
+ }
62
+ // Convert the scenario string to an object
63
+ // Example: "x=1, y=2, z=3" to { x: 1, y: 2, z: 3 }
64
+ let scenarioObj = {};
65
+ let count = 0;
66
+ if (typeof scenario === 'object') {
67
+ scenarioObj = scenario;
68
+ } else if (Array.isArray(scenario)) {
69
+ scenarioObj = scenario[0];
70
+ } else {
71
+ //console.error('Incoming scenario', scenario);
72
+ scenarioObj = scenario.split(',').reduce((acc, pair) => {
73
+ let [key, value] = pair.split('=');
74
+ acc[key.trim()] = value;
75
+ count++;
76
+ return acc;
77
+ }, {});
78
+ }
79
+ params.scenario = scenarioObj;
80
+ params.type = 'job';
81
+ // Provide runtime context for auth and server settings
82
+ let r = await _jobSubmit(params);
83
+ return r;
84
+ }
85
+ };
86
+ return spec;
87
+ }
88
+
89
+ export default jobScore;
90
+
@@ -1,67 +1,67 @@
1
- /*
2
- * Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { z } from 'zod';
6
- import _findJobdef from '../toolHelpers/_findJobdef.js';
7
- function jobdefDescribe(_appContext) {
8
- const isAgent = _appContext && _appContext.agent;
9
- let description = isAgent ? `
10
- jobdef-describe — return input schema for a JobDef model.
11
- PARAMS: intent ('describe', required), name (string, required)
12
- RETURNS: jobdef input variable definitions
13
- ` : `
14
- jobdef-describe — return information about a specific SAS Viya jobdef.
15
-
16
- USE when: describe jobdef, show jobdef details, what does jobdef X do, jobdef metadata, inputs/outputs for jobdef
17
- DO NOT USE for: find jobdef or verify it exists (use ${_appContext.brand}-find-jobdef), list jobdefs (use ${_appContext.brand}-list-jobdefs), score jobdef (use ${_appContext.brand}-jobdef-score)
18
-
19
- PARAMETERS
20
- - intent: must be 'describe' — only pass if user explicitly asked to describe/inspect a jobdef. Do NOT use for find or verify existence.
21
- - name: string (required) — name of jobdef whose details are being requested. Should be exact match to jobdef name.
22
-
23
- ROUTING RULES
24
- - "describe jobdef <name>" → { name: "<name>" }
25
- - "describe <name.jobdef>"
26
- - "describe model <name.jobdef>"
27
- - "info for jobdef <name>" → { name: "<name>" }
28
-
29
- EXAMPLES
30
- - "describe jobdef cars_job_v4" → { name: "cars_job_v4" }
31
- - "describe metricsRefresh.jobdef" → { name: "metricsRefresh" }
32
- - "info for jobdef ETL" → { name: "ETL" }
33
-
34
- NEGATIVE EXAMPLES (do not route here)
35
- - "list jobdefs" (use ${_appContext.brand}-list-jobdefs)
36
- - "score jobdef cars_job_v4" (use ${_appContext.brand}-jobdef-score)
37
- - "execute jobdef cars_job_v4" (use ${_appContext.brand}-jobdef-score)
38
-
39
- ERRORS
40
- Returns job metadata
41
- `;
42
-
43
- let spec = {
44
- name: 'jobdef-describe',
45
- description: description,
46
- inputSchema: z.object({
47
- intent: z.literal('describe'),
48
- name: z.string()
49
- }),
50
- handler: async (params) => {
51
- const { intent, ...rest } = params;
52
- if (rest.name != null && rest.name.endsWith('.jobdef')) {
53
- rest.name = rest.name.slice(0, -7);
54
- }
55
- rest.tool = 'describe';
56
- let r = await _findJobdef(rest);
57
- return r;
58
- }
59
- }
60
-
61
-
62
- /* correct spec for registerTool with inputSchema */
63
-
64
- return spec;
65
- }
66
- export default jobdefDescribe;
67
-
1
+ /*
2
+ * Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { z } from 'zod';
6
+ import _findJobdef from '../toolHelpers/_findJobdef.js';
7
+ function jobdefDescribe(_appContext) {
8
+ const isAgent = _appContext && _appContext.agent;
9
+ let description = isAgent ? `
10
+ jobdef-describe — return input schema for a JobDef model.
11
+ PARAMS: intent ('describe', required), name (string, required)
12
+ RETURNS: jobdef input variable definitions
13
+ ` : `
14
+ jobdef-describe — return information about a specific SAS Viya jobdef.
15
+
16
+ USE when: describe jobdef, show jobdef details, what does jobdef X do, jobdef metadata, inputs/outputs for jobdef
17
+ DO NOT USE for: find jobdef or verify it exists (use ${_appContext.brand}-find-jobdef), list jobdefs (use ${_appContext.brand}-list-jobdefs), score jobdef (use ${_appContext.brand}-jobdef-score)
18
+
19
+ PARAMETERS
20
+ - intent: must be 'describe' — only pass if user explicitly asked to describe/inspect a jobdef. Do NOT use for find or verify existence.
21
+ - name: string (required) — name of jobdef whose details are being requested. Should be exact match to jobdef name.
22
+
23
+ ROUTING RULES
24
+ - "describe jobdef <name>" → { name: "<name>" }
25
+ - "describe <name.jobdef>"
26
+ - "describe model <name.jobdef>"
27
+ - "info for jobdef <name>" → { name: "<name>" }
28
+
29
+ EXAMPLES
30
+ - "describe jobdef cars_job_v4" → { name: "cars_job_v4" }
31
+ - "describe metricsRefresh.jobdef" → { name: "metricsRefresh" }
32
+ - "info for jobdef ETL" → { name: "ETL" }
33
+
34
+ NEGATIVE EXAMPLES (do not route here)
35
+ - "list jobdefs" (use ${_appContext.brand}-list-jobdefs)
36
+ - "score jobdef cars_job_v4" (use ${_appContext.brand}-jobdef-score)
37
+ - "execute jobdef cars_job_v4" (use ${_appContext.brand}-jobdef-score)
38
+
39
+ ERRORS
40
+ Returns job metadata
41
+ `;
42
+
43
+ let spec = {
44
+ name: 'jobdef-describe',
45
+ description: description,
46
+ inputSchema: z.object({
47
+ intent: z.literal('describe'),
48
+ name: z.string()
49
+ }),
50
+ handler: async (params) => {
51
+ const { intent, ...rest } = params;
52
+ if (rest.name != null && rest.name.endsWith('.jobdef')) {
53
+ rest.name = rest.name.slice(0, -7);
54
+ }
55
+ rest.tool = 'describe';
56
+ let r = await _findJobdef(rest);
57
+ return r;
58
+ }
59
+ }
60
+
61
+
62
+ /* correct spec for registerTool with inputSchema */
63
+
64
+ return spec;
65
+ }
66
+ export default jobdefDescribe;
67
+
@@ -1,85 +1,85 @@
1
- /*
2
- * Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
-
6
- import { z } from 'zod';
7
- import _jobSubmit from '../toolHelpers/_jobSubmit.js';
8
-
9
- function jobdefScore(_appContext) {
10
- // JSON object for LLM/tooling
11
- const isAgent = _appContext && _appContext.agent;
12
- let description = isAgent ? `
13
- jobdef-score — score by executing a SAS Viya JobDef model.
14
- PARAMS: name (string, required), scenario (object, optional)
15
- RETURNS: jobdef log, ODS output, and any result tables
16
- ` : `
17
- jobdef-score — score with a deployed SAS Viya job definition model.
18
-
19
- USE when: score with jobdef, run jobdef, execute jobdef model
20
- DO NOT USE for: arbitrary SAS code (use program-score), macros (use macro-score), list/find jobdefs
21
-
22
- PARAMETERS
23
- - name: string — jobdef name (required)
24
- - scenario: object — input parameters as JSON (optional, defaults to {}). Example: {month:10, year:2025}
25
-
26
- ROUTING RULES
27
- - "score jobdef xyz" → { name: "xyz" }
28
- - "score jobdef xyz with param1=10, param2=val2" → { name: "xyz", scenario: {param1:10, param2:"val2"} }
29
-
30
- EXAMPLES
31
- - "score jobdef xyz" → { name: "xyz" }
32
- - "score jobdef monthly_report with month=10, year=2025" → { name: "monthly_report", scenario: {month:10, year:2025} }
33
-
34
- NEGATIVE EXAMPLES (do not route here)
35
- - "run SAS code" (use program-score)
36
- - "score macro X" (use macro-score)
37
- - "list jobdefs" (use list-jobdefs)
38
- - "find jobdef X" (use find-jobdef)
39
-
40
- ERRORS
41
- Returns log output, listings, tables from jobdef. Error if jobdef not found.
42
- `;
43
-
44
- let spec = {
45
- name: 'jobdef-score',
46
- description: description,
47
- inputSchema: z.object({
48
- name: z.string(),
49
- scenario: z.any()
50
- }),
51
- handler: async (params) => {
52
- let {scenario, name} = params;
53
-
54
- if (name.endsWith('.job')) {
55
- params.name = name.slice(0, -4);
56
- }
57
- // Convert the scenario string to an object
58
- // Example: "x=1, y=2, z=3" to { x: 1, y: 2, z: 3 }
59
- let scenarioObj = {};
60
- let count = 0;
61
- if (typeof scenario === 'object') {
62
- scenarioObj = scenario;
63
- } else if (Array.isArray(scenario)) {
64
- scenarioObj = scenario[0];
65
- } else {
66
- //console.error('Incoming scenario', scenario);
67
- scenarioObj = scenario.split(',').reduce((acc, pair) => {
68
- let [key, value] = pair.split('=');
69
- acc[key.trim()] = value;
70
- count++;
71
- return acc;
72
- }, {});
73
- }
74
- params.scenario = scenarioObj;
75
- params.type = 'def';
76
- // Provide runtime context for auth and server settings
77
- let r = await _jobSubmit(params);
78
- return r;
79
- }
80
- };
81
- return spec;
82
- }
83
-
84
- export default jobdefScore;
85
-
1
+ /*
2
+ * Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ import { z } from 'zod';
7
+ import _jobSubmit from '../toolHelpers/_jobSubmit.js';
8
+
9
+ function jobdefScore(_appContext) {
10
+ // JSON object for LLM/tooling
11
+ const isAgent = _appContext && _appContext.agent;
12
+ let description = isAgent ? `
13
+ jobdef-score — score by executing a SAS Viya JobDef model.
14
+ PARAMS: name (string, required), scenario (object, optional)
15
+ RETURNS: jobdef log, ODS output, and any result tables
16
+ ` : `
17
+ jobdef-score — score with a deployed SAS Viya job definition model.
18
+
19
+ USE when: score with jobdef, run jobdef, execute jobdef model
20
+ DO NOT USE for: arbitrary SAS code (use program-score), macros (use macro-score), list/find jobdefs
21
+
22
+ PARAMETERS
23
+ - name: string — jobdef name (required)
24
+ - scenario: object — input parameters as JSON (optional, defaults to {}). Example: {month:10, year:2025}
25
+
26
+ ROUTING RULES
27
+ - "score jobdef xyz" → { name: "xyz" }
28
+ - "score jobdef xyz with param1=10, param2=val2" → { name: "xyz", scenario: {param1:10, param2:"val2"} }
29
+
30
+ EXAMPLES
31
+ - "score jobdef xyz" → { name: "xyz" }
32
+ - "score jobdef monthly_report with month=10, year=2025" → { name: "monthly_report", scenario: {month:10, year:2025} }
33
+
34
+ NEGATIVE EXAMPLES (do not route here)
35
+ - "run SAS code" (use program-score)
36
+ - "score macro X" (use macro-score)
37
+ - "list jobdefs" (use list-jobdefs)
38
+ - "find jobdef X" (use find-jobdef)
39
+
40
+ ERRORS
41
+ Returns log output, listings, tables from jobdef. Error if jobdef not found.
42
+ `;
43
+
44
+ let spec = {
45
+ name: 'jobdef-score',
46
+ description: description,
47
+ inputSchema: z.object({
48
+ name: z.string(),
49
+ scenario: z.any()
50
+ }),
51
+ handler: async (params) => {
52
+ let {scenario, name} = params;
53
+
54
+ if (name.endsWith('.job')) {
55
+ params.name = name.slice(0, -4);
56
+ }
57
+ // Convert the scenario string to an object
58
+ // Example: "x=1, y=2, z=3" to { x: 1, y: 2, z: 3 }
59
+ let scenarioObj = {};
60
+ let count = 0;
61
+ if (typeof scenario === 'object') {
62
+ scenarioObj = scenario;
63
+ } else if (Array.isArray(scenario)) {
64
+ scenarioObj = scenario[0];
65
+ } else {
66
+ //console.error('Incoming scenario', scenario);
67
+ scenarioObj = scenario.split(',').reduce((acc, pair) => {
68
+ let [key, value] = pair.split('=');
69
+ acc[key.trim()] = value;
70
+ count++;
71
+ return acc;
72
+ }, {});
73
+ }
74
+ params.scenario = scenarioObj;
75
+ params.type = 'def';
76
+ // Provide runtime context for auth and server settings
77
+ let r = await _jobSubmit(params);
78
+ return r;
79
+ }
80
+ };
81
+ return spec;
82
+ }
83
+
84
+ export default jobdefScore;
85
+