openmates 0.12.0-alpha.2 → 0.12.0-alpha.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.
- package/dist/{chunk-UG4LLEOG.js → chunk-3T6XUXII.js} +69 -10
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -4031,7 +4031,8 @@ var OpenMatesClient = class _OpenMatesClient {
|
|
|
4031
4031
|
if (!topSchema) return [];
|
|
4032
4032
|
const requestsProp = topSchema.properties?.requests;
|
|
4033
4033
|
const itemsRef = requestsProp?.items;
|
|
4034
|
-
const itemSchema = itemsRef ? resolveSchema(itemsRef) :
|
|
4034
|
+
const itemSchema = itemsRef ? resolveSchema(itemsRef) : topSchema;
|
|
4035
|
+
const inputShape = itemsRef ? "requests" : "flat";
|
|
4035
4036
|
if (!itemSchema?.properties) return [];
|
|
4036
4037
|
const required = new Set(
|
|
4037
4038
|
Array.isArray(itemSchema.required) ? itemSchema.required : []
|
|
@@ -4064,7 +4065,8 @@ var OpenMatesClient = class _OpenMatesClient {
|
|
|
4064
4065
|
type: typeStr,
|
|
4065
4066
|
description: resolved.description ?? "",
|
|
4066
4067
|
required: required.has(name),
|
|
4067
|
-
default: resolved.default
|
|
4068
|
+
default: resolved.default,
|
|
4069
|
+
inputShape
|
|
4068
4070
|
};
|
|
4069
4071
|
});
|
|
4070
4072
|
}
|
|
@@ -24966,6 +24968,12 @@ Only output the final Markdown table. Do NOT include explanations, notes, or any
|
|
|
24966
24968
|
text: "Get daily and hourly weather forecasts."
|
|
24967
24969
|
}
|
|
24968
24970
|
},
|
|
24971
|
+
rain_radar: {
|
|
24972
|
+
text: "Rain radar",
|
|
24973
|
+
description: {
|
|
24974
|
+
text: "Show nearby rain radar with an interactive timeline."
|
|
24975
|
+
}
|
|
24976
|
+
},
|
|
24969
24977
|
day: {
|
|
24970
24978
|
text: "Weather day"
|
|
24971
24979
|
}
|
|
@@ -27577,6 +27585,34 @@ Only output the final Markdown table. Do NOT include explanations, notes, or any
|
|
|
27577
27585
|
}
|
|
27578
27586
|
},
|
|
27579
27587
|
embeds: {
|
|
27588
|
+
weather: {
|
|
27589
|
+
rain_radar: {
|
|
27590
|
+
no_rain: {
|
|
27591
|
+
text: "No rain visible near this location."
|
|
27592
|
+
},
|
|
27593
|
+
unavailable: {
|
|
27594
|
+
text: "Rain radar is unavailable for this location."
|
|
27595
|
+
},
|
|
27596
|
+
peak: {
|
|
27597
|
+
text: "Peak"
|
|
27598
|
+
},
|
|
27599
|
+
at_location: {
|
|
27600
|
+
text: "At location"
|
|
27601
|
+
},
|
|
27602
|
+
play: {
|
|
27603
|
+
text: "Play"
|
|
27604
|
+
},
|
|
27605
|
+
pause: {
|
|
27606
|
+
text: "Pause"
|
|
27607
|
+
},
|
|
27608
|
+
frames: {
|
|
27609
|
+
text: "frames"
|
|
27610
|
+
},
|
|
27611
|
+
load_failed: {
|
|
27612
|
+
text: "Radar data could not be loaded. Showing the summary view instead."
|
|
27613
|
+
}
|
|
27614
|
+
}
|
|
27615
|
+
},
|
|
27580
27616
|
search: {
|
|
27581
27617
|
text: "Search"
|
|
27582
27618
|
},
|
|
@@ -40634,7 +40670,7 @@ The booking_token is shown in the output of:
|
|
|
40634
40670
|
} catch {
|
|
40635
40671
|
}
|
|
40636
40672
|
if (!hasExplicitInput && inlineTokens.length === 0) {
|
|
40637
|
-
const required = schemaParams
|
|
40673
|
+
const required = getEffectiveRequiredParams(schemaParams);
|
|
40638
40674
|
if (required.length > 0) {
|
|
40639
40675
|
const data = await client.getSkillInfo(app, skill, apiKey);
|
|
40640
40676
|
await printSkillInfo(client, app, data);
|
|
@@ -40642,7 +40678,7 @@ The booking_token is shown in the output of:
|
|
|
40642
40678
|
}
|
|
40643
40679
|
}
|
|
40644
40680
|
if (!hasExplicitInput && inlineTokens.length > 0 && schemaParams.length > 0) {
|
|
40645
|
-
const required = schemaParams
|
|
40681
|
+
const required = getEffectiveRequiredParams(schemaParams);
|
|
40646
40682
|
if (required.length > 1) {
|
|
40647
40683
|
const example = {};
|
|
40648
40684
|
for (const p of required) example[p.name] = `<${p.name}>`;
|
|
@@ -40650,7 +40686,7 @@ The booking_token is shown in the output of:
|
|
|
40650
40686
|
`This skill requires ${required.length} fields: ${required.map((p) => p.name).join(", ")}
|
|
40651
40687
|
|
|
40652
40688
|
Use --input to provide all fields:
|
|
40653
|
-
openmates apps ${app} ${skill} --input '
|
|
40689
|
+
openmates apps ${app} ${skill} --input '${buildInputUsageExample(schemaParams, example)}'
|
|
40654
40690
|
|
|
40655
40691
|
Run with --help for full parameter details:
|
|
40656
40692
|
openmates apps ${app} ${skill} --help
|
|
@@ -40699,7 +40735,7 @@ App details: openmates apps info <app-id>`
|
|
|
40699
40735
|
`
|
|
40700
40736
|
Usage:
|
|
40701
40737
|
openmates apps ${app} ${skill} <value>
|
|
40702
|
-
openmates apps ${app} ${skill} --input '
|
|
40738
|
+
openmates apps ${app} ${skill} --input '${buildInputUsageExample(schemaParams)}'`
|
|
40703
40739
|
);
|
|
40704
40740
|
} else {
|
|
40705
40741
|
console.error(
|
|
@@ -40844,17 +40880,38 @@ async function pollCodeRunStatus(client, statusPath, apiKey, jsonMode) {
|
|
|
40844
40880
|
}
|
|
40845
40881
|
}
|
|
40846
40882
|
function buildSkillInput(flags, inlineTokens, schemaParams) {
|
|
40883
|
+
const usesFlatInput = schemaParams?.some((p) => p.inputShape === "flat") ?? false;
|
|
40847
40884
|
if (typeof flags.input === "string") {
|
|
40848
|
-
|
|
40885
|
+
const parsed = JSON.parse(flags.input);
|
|
40886
|
+
if (usesFlatInput && Array.isArray(parsed.requests) && parsed.requests.length === 1) {
|
|
40887
|
+
const firstRequest = parsed.requests[0];
|
|
40888
|
+
if (firstRequest && typeof firstRequest === "object") {
|
|
40889
|
+
return firstRequest;
|
|
40890
|
+
}
|
|
40891
|
+
}
|
|
40892
|
+
return parsed;
|
|
40849
40893
|
}
|
|
40850
40894
|
const inlineText = inlineTokens.join(" ").trim();
|
|
40851
40895
|
if (inlineText) {
|
|
40852
|
-
const required = (schemaParams ?? [])
|
|
40853
|
-
const
|
|
40896
|
+
const required = getEffectiveRequiredParams(schemaParams ?? []);
|
|
40897
|
+
const flatLocationParam = usesFlatInput ? (schemaParams ?? []).find((p) => p.name === "location") : void 0;
|
|
40898
|
+
const paramName = required.length === 1 ? required[0].name : flatLocationParam?.name ?? "query";
|
|
40899
|
+
if (usesFlatInput) return { [paramName]: inlineText };
|
|
40854
40900
|
return { requests: [{ [paramName]: inlineText }] };
|
|
40855
40901
|
}
|
|
40856
40902
|
return {};
|
|
40857
40903
|
}
|
|
40904
|
+
function getEffectiveRequiredParams(schemaParams) {
|
|
40905
|
+
const required = schemaParams.filter((p) => p.required);
|
|
40906
|
+
if (required.length > 0) return required;
|
|
40907
|
+
const flatLocationParam = schemaParams.find((p) => p.inputShape === "flat" && p.name === "location");
|
|
40908
|
+
return flatLocationParam ? [flatLocationParam] : [];
|
|
40909
|
+
}
|
|
40910
|
+
function buildInputUsageExample(schemaParams, exampleItem) {
|
|
40911
|
+
const item = exampleItem ?? { [schemaParams[0]?.name ?? "query"]: "..." };
|
|
40912
|
+
if (schemaParams.some((p) => p.inputShape === "flat")) return JSON.stringify(item);
|
|
40913
|
+
return JSON.stringify({ requests: [item] });
|
|
40914
|
+
}
|
|
40858
40915
|
async function suggestAppOrSkill(client, app, skill, apiKey) {
|
|
40859
40916
|
try {
|
|
40860
40917
|
const data = await client.listApps(apiKey);
|
|
@@ -43092,7 +43149,9 @@ ${data.description}
|
|
|
43092
43149
|
}
|
|
43093
43150
|
process.stdout.write(`\x1B[1mExample\x1B[0m
|
|
43094
43151
|
`);
|
|
43095
|
-
const
|
|
43152
|
+
const usesFlatInput = params.some((p) => p.inputShape === "flat");
|
|
43153
|
+
const examplePayload = usesFlatInput ? exampleItem : { requests: [exampleItem] };
|
|
43154
|
+
const exampleJson = JSON.stringify(examplePayload, null, 2).split("\n").map((l) => ` ${l}`).join("\n");
|
|
43096
43155
|
process.stdout.write(
|
|
43097
43156
|
` \x1B[2mopenmates apps ${appId} ${data.id} --input '\x1B[0m
|
|
43098
43157
|
`
|
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED