hackshop-mcp 0.0.3 → 0.0.5
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/README.md +88 -34
- package/catalog.json +1584 -25
- package/dist/build-plan/index.d.ts +10 -0
- package/dist/build-plan/index.js +550 -0
- package/dist/build-plan/index.js.map +1 -0
- package/dist/build-plan/types.d.ts +153 -0
- package/dist/build-plan/types.js +2 -0
- package/dist/build-plan/types.js.map +1 -0
- package/dist/catalog/schema.d.ts +523 -7
- package/dist/catalog/schema.js +49 -0
- package/dist/catalog/schema.js.map +1 -1
- package/dist/core/assess.d.ts +36 -0
- package/dist/core/assess.js +100 -0
- package/dist/core/assess.js.map +1 -0
- package/dist/core/errors.d.ts +2 -0
- package/dist/core/errors.js +70 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/links.d.ts +3 -0
- package/dist/core/links.js +19 -0
- package/dist/core/links.js.map +1 -0
- package/dist/core/plan-gadget.d.ts +85 -0
- package/dist/core/plan-gadget.js +619 -0
- package/dist/core/plan-gadget.js.map +1 -0
- package/dist/core/resources.d.ts +37 -0
- package/dist/core/resources.js +143 -0
- package/dist/core/resources.js.map +1 -0
- package/dist/core/safety.d.ts +7 -0
- package/dist/core/safety.js +28 -0
- package/dist/core/safety.js.map +1 -0
- package/dist/core/tools.d.ts +247 -0
- package/dist/core/tools.js +164 -0
- package/dist/core/tools.js.map +1 -0
- package/dist/core/types.d.ts +163 -0
- package/dist/core/types.js +17 -0
- package/dist/core/types.js.map +1 -0
- package/dist/platforms/index.d.ts +26 -0
- package/dist/platforms/index.js +52 -0
- package/dist/platforms/index.js.map +1 -0
- package/dist/platforms/load.d.ts +4 -0
- package/dist/platforms/load.js +78 -0
- package/dist/platforms/load.js.map +1 -0
- package/dist/platforms/schema.d.ts +587 -0
- package/dist/platforms/schema.js +64 -0
- package/dist/platforms/schema.js.map +1 -0
- package/dist/sampling.d.ts +5 -0
- package/dist/sampling.js +44 -21
- package/dist/sampling.js.map +1 -1
- package/dist/server.d.ts +14 -1
- package/dist/server.js +164 -40
- package/dist/server.js.map +1 -1
- package/dist/site-url.d.ts +1 -0
- package/dist/site-url.js +4 -0
- package/dist/site-url.js.map +1 -0
- package/dist/telemetry.d.ts +29 -0
- package/dist/telemetry.js +100 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/tools/assess_hackability.d.ts +2 -29
- package/dist/tools/assess_hackability.js +11 -43
- package/dist/tools/assess_hackability.js.map +1 -1
- package/dist/tools/get_build_plan.d.ts +6 -0
- package/dist/tools/get_build_plan.js +16 -0
- package/dist/tools/get_build_plan.js.map +1 -0
- package/dist/tools/plan_gadget.d.ts +4 -0
- package/dist/tools/plan_gadget.js +14 -0
- package/dist/tools/plan_gadget.js.map +1 -0
- package/dist/tools/propose_hardware.d.ts +5 -0
- package/dist/tools/propose_hardware.js +57 -8
- package/dist/tools/propose_hardware.js.map +1 -1
- package/dist/tools/simulate_assembly.d.ts +315 -0
- package/dist/tools/simulate_assembly.js +145 -0
- package/dist/tools/simulate_assembly.js.map +1 -0
- package/package.json +4 -1
- package/platforms.json +779 -0
- package/tags.md +1 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AgentPlatform, CoreContext, DeviceEntry, DeviceLinks, Platform, Printable } from "./types.js";
|
|
3
|
+
export declare const assessHackabilityInput: z.ZodObject<{
|
|
4
|
+
device_name: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
device_name: string;
|
|
7
|
+
}, {
|
|
8
|
+
device_name: string;
|
|
9
|
+
}>;
|
|
10
|
+
export type AssessInput = z.infer<typeof assessHackabilityInput>;
|
|
11
|
+
export interface AssessOutput {
|
|
12
|
+
found: boolean;
|
|
13
|
+
device?: {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
category: string;
|
|
17
|
+
hackable: boolean;
|
|
18
|
+
hack_difficulty: number;
|
|
19
|
+
brick_risk: number | null;
|
|
20
|
+
brick_risk_label: string;
|
|
21
|
+
brick_risk_disclaimer: string | null;
|
|
22
|
+
firmware_links: string[];
|
|
23
|
+
community_size: string;
|
|
24
|
+
last_verified: string;
|
|
25
|
+
notes: string;
|
|
26
|
+
links: DeviceLinks;
|
|
27
|
+
build_page_url: string;
|
|
28
|
+
agent_platforms: AgentPlatform[];
|
|
29
|
+
physical: DeviceEntry["physical"] | null;
|
|
30
|
+
printables: Printable[];
|
|
31
|
+
next_steps: string[];
|
|
32
|
+
};
|
|
33
|
+
message?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function assessHackability(input: AssessInput, ctx: CoreContext): AssessOutput;
|
|
36
|
+
export declare function agentPlatformsFor(deviceId: string, platforms: Platform[]): AgentPlatform[];
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { buildUrls } from "../build-plan/index.js";
|
|
3
|
+
import { buildLinks } from "./links.js";
|
|
4
|
+
import { applyBrickRiskSafety } from "./safety.js";
|
|
5
|
+
export const assessHackabilityInput = z.object({
|
|
6
|
+
device_name: z.string().min(1).max(200),
|
|
7
|
+
});
|
|
8
|
+
function norm(s) {
|
|
9
|
+
return s.toLowerCase().replace(/[^a-z0-9]+/g, "");
|
|
10
|
+
}
|
|
11
|
+
export function assessHackability(input, ctx) {
|
|
12
|
+
const target = norm(input.device_name);
|
|
13
|
+
let match = ctx.catalog.find((d) => d.id === input.device_name);
|
|
14
|
+
if (!match)
|
|
15
|
+
match = ctx.catalog.find((d) => norm(d.name) === target);
|
|
16
|
+
if (!match && target.length > 0) {
|
|
17
|
+
const candidates = ctx.catalog.filter((d) => norm(d.name).includes(target));
|
|
18
|
+
if (candidates.length === 1) {
|
|
19
|
+
match = candidates[0];
|
|
20
|
+
}
|
|
21
|
+
else if (candidates.length > 1) {
|
|
22
|
+
const sorted = [...candidates].sort((a, b) => {
|
|
23
|
+
const la = norm(a.name).length;
|
|
24
|
+
const lb = norm(b.name).length;
|
|
25
|
+
if (la !== lb)
|
|
26
|
+
return la - lb;
|
|
27
|
+
if (a.name !== b.name)
|
|
28
|
+
return a.name.localeCompare(b.name);
|
|
29
|
+
return a.id.localeCompare(b.id);
|
|
30
|
+
});
|
|
31
|
+
match = sorted[0];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (!match) {
|
|
35
|
+
return {
|
|
36
|
+
found: false,
|
|
37
|
+
message: `"${input.device_name}" is not in the catalog. Cannot assess hackability without verification. Try a more specific name, or check the firmware links section of similar devices.`,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const safety = applyBrickRiskSafety(match);
|
|
41
|
+
const links = buildLinks(match);
|
|
42
|
+
const agentPlatforms = agentPlatformsFor(match.id, ctx.platforms);
|
|
43
|
+
const hackable = match.firmware_links.length > 0 || match.hack_difficulty <= 4;
|
|
44
|
+
const urls = buildUrls(match.id, ctx.siteUrl, agentPlatforms.length > 0);
|
|
45
|
+
const nextSteps = agentPlatforms.length > 0
|
|
46
|
+
? [
|
|
47
|
+
`Start a build at ${urls.build_page} to save the parts list, checklist and agent brief to My builds.`,
|
|
48
|
+
]
|
|
49
|
+
: [];
|
|
50
|
+
return {
|
|
51
|
+
found: true,
|
|
52
|
+
device: {
|
|
53
|
+
id: match.id,
|
|
54
|
+
name: match.name,
|
|
55
|
+
category: match.category,
|
|
56
|
+
hackable,
|
|
57
|
+
hack_difficulty: match.hack_difficulty,
|
|
58
|
+
brick_risk: safety.brick_risk,
|
|
59
|
+
brick_risk_label: safety.brick_risk_label,
|
|
60
|
+
brick_risk_disclaimer: safety.brick_risk_disclaimer,
|
|
61
|
+
firmware_links: match.firmware_links,
|
|
62
|
+
community_size: match.community_size_bucket,
|
|
63
|
+
last_verified: match.last_verified,
|
|
64
|
+
notes: match.notes,
|
|
65
|
+
links,
|
|
66
|
+
build_page_url: urls.build_page,
|
|
67
|
+
agent_platforms: agentPlatforms,
|
|
68
|
+
physical: match.physical ?? null,
|
|
69
|
+
printables: ctx.printablesFor(match, ctx.siteUrl),
|
|
70
|
+
next_steps: nextSteps,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export function agentPlatformsFor(deviceId, platforms) {
|
|
75
|
+
const matches = [];
|
|
76
|
+
for (const platform of platforms) {
|
|
77
|
+
const tierLabels = new Map(platform.tiers.map((tier) => [tier.id, tier.label]));
|
|
78
|
+
for (const board of platform.boards) {
|
|
79
|
+
if (board.device_id !== deviceId)
|
|
80
|
+
continue;
|
|
81
|
+
matches.push(toAgentPlatform(platform, board, tierLabels));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return matches;
|
|
85
|
+
}
|
|
86
|
+
function toAgentPlatform(platform, board, tierLabels) {
|
|
87
|
+
return {
|
|
88
|
+
platform_id: platform.id,
|
|
89
|
+
platform_name: platform.name,
|
|
90
|
+
support: board.support,
|
|
91
|
+
tier: board.tier,
|
|
92
|
+
tier_label: tierLabels.get(board.tier) ?? board.tier,
|
|
93
|
+
kind: board.kind,
|
|
94
|
+
build: board.build,
|
|
95
|
+
...(board.eol ? { eol: board.eol } : {}),
|
|
96
|
+
features: board.features,
|
|
97
|
+
note: board.note,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=assess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assess.js","sourceRoot":"","sources":["../../src/core/assess.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAWnD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,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OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,eAAe,CACtB,QAAkB,EAClB,KAAoB,EACpB,UAA+B;IAE/B,OAAO;QACL,WAAW,EAAE,QAAQ,CAAC,EAAE;QACxB,aAAa,EAAE,QAAQ,CAAC,IAAI;QAC5B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,UAAU,EAAE,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI;QACpD,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxC,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { NEED_VALUES } from "./types.js";
|
|
2
|
+
const FIELD_LABELS = {
|
|
3
|
+
idea: "`idea`",
|
|
4
|
+
limit: "`limit`",
|
|
5
|
+
needs: "`needs`",
|
|
6
|
+
platform: "`platform`",
|
|
7
|
+
budget_usd: "`budget_usd`",
|
|
8
|
+
owned_device_ids: "`owned_device_ids`",
|
|
9
|
+
device_id: "`device_id`",
|
|
10
|
+
device_name: "`device_name`",
|
|
11
|
+
size: "`size`",
|
|
12
|
+
};
|
|
13
|
+
export function formatInputError(toolName, zodError) {
|
|
14
|
+
return zodError.issues
|
|
15
|
+
.map((issue) => formatIssue(issue))
|
|
16
|
+
.join(" ");
|
|
17
|
+
}
|
|
18
|
+
function formatIssue(issue) {
|
|
19
|
+
const path = issue.path.map(String);
|
|
20
|
+
const field = fieldLabel(path);
|
|
21
|
+
if (issue.code === "invalid_enum_value") {
|
|
22
|
+
const options = issue.options.map(String);
|
|
23
|
+
return `${field} must be one of: ${options.join(", ")} (got ${JSON.stringify(issue.received)}).`;
|
|
24
|
+
}
|
|
25
|
+
if (issue.code === "too_small") {
|
|
26
|
+
if (issue.type === "string") {
|
|
27
|
+
return `${field} must be at least ${issue.minimum} characters.`;
|
|
28
|
+
}
|
|
29
|
+
if (issue.type === "number") {
|
|
30
|
+
return `${field} must be at least ${issue.minimum}.`;
|
|
31
|
+
}
|
|
32
|
+
if (issue.type === "array") {
|
|
33
|
+
return `${field} must include at least ${issue.minimum} item${issue.minimum === 1 ? "" : "s"}.`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (issue.code === "too_big") {
|
|
37
|
+
if (issue.type === "string") {
|
|
38
|
+
return `${field} must be at most ${issue.maximum} characters.`;
|
|
39
|
+
}
|
|
40
|
+
if (issue.type === "number") {
|
|
41
|
+
const got = typeof issue.path.at(-1) === "number" ? "" : "";
|
|
42
|
+
return `${field} must be at most ${issue.maximum}${got}.`;
|
|
43
|
+
}
|
|
44
|
+
if (issue.type === "array") {
|
|
45
|
+
return `${field} must include at most ${issue.maximum} items.`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (issue.code === "invalid_type") {
|
|
49
|
+
return `${field} must be ${issue.expected}.`;
|
|
50
|
+
}
|
|
51
|
+
if (issue.code === "custom") {
|
|
52
|
+
return `${field} ${issue.message}.`;
|
|
53
|
+
}
|
|
54
|
+
if (path[0] === "needs") {
|
|
55
|
+
return `${field} must be one of: ${NEED_VALUES.join(", ")}.`;
|
|
56
|
+
}
|
|
57
|
+
return `${field} is invalid: ${issue.message}.`;
|
|
58
|
+
}
|
|
59
|
+
function fieldLabel(path) {
|
|
60
|
+
if (path.length === 0)
|
|
61
|
+
return "input";
|
|
62
|
+
const [first, ...rest] = path;
|
|
63
|
+
if (!first)
|
|
64
|
+
return "input";
|
|
65
|
+
const base = FIELD_LABELS[first] ?? `\`${first}\``;
|
|
66
|
+
if (rest.length === 0)
|
|
67
|
+
return base;
|
|
68
|
+
return `\`${[first, ...rest].join(".").replace(/\.(\d+)/g, "[$1]")}\``;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,YAAY,GAA2B;IAC3C,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,QAAQ,EAAE,YAAY;IACtB,UAAU,EAAE,cAAc;IAC1B,gBAAgB,EAAE,oBAAoB;IACtC,SAAS,EAAE,aAAa;IACxB,WAAW,EAAE,eAAe;IAC5B,IAAI,EAAE,QAAQ;CACf,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAAC,QAAgB,EAAE,QAAoB;IACrE,OAAO,QAAQ,CAAC,MAAM;SACnB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;SAClC,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAAC,KAAiB;IACpC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAE/B,IAAI,KAAK,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;QACxC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC1C,OAAO,GAAG,KAAK,oBAAoB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;IACnG,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK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AG,CAAC;IAC/C,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,GAAG,KAAK,IAAI,KAAK,CAAC,OAAO,GAAG,CAAC;IACtC,CAAC;IAED,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC;QACxB,OAAO,GAAG,KAAK,oBAAoB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;IAC/D,CAAC;IAED,OAAO,GAAG,KAAK,gBAAgB,KAAK,CAAC,OAAO,GAAG,CAAC;AAClD,CAAC;AAED,SAAS,UAAU,CAAC,IAAc;IAChC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IACtC,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAC9B,IAAI,CAAC,KAAK;QAAE,OAAO,OAAO,CAAC;IAC3B,MAAM,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC;IACnD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,OAAO,KAAK,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
function ebayCondition(brickRisk) {
|
|
2
|
+
if (brickRisk === null)
|
|
3
|
+
return "used";
|
|
4
|
+
return brickRisk >= 4 ? "working" : "used";
|
|
5
|
+
}
|
|
6
|
+
export function buildEbayQuery(device) {
|
|
7
|
+
const cond = ebayCondition(device.brick_risk);
|
|
8
|
+
return `${device.name} ${cond}`;
|
|
9
|
+
}
|
|
10
|
+
export function buildLinks(device) {
|
|
11
|
+
const ebayQuery = buildEbayQuery(device);
|
|
12
|
+
return {
|
|
13
|
+
ebay_search_url: `https://www.ebay.com/sch/i.html?_nkw=${encodeURIComponent(ebayQuery)}&_sop=15`,
|
|
14
|
+
hackaday_search_url: `https://hackaday.com/?s=${encodeURIComponent(device.name)}`,
|
|
15
|
+
reddit_search_url: `https://www.reddit.com/search/?q=${encodeURIComponent(`${device.name} hack`)}&sort=new`,
|
|
16
|
+
google_search_url: `https://www.google.com/search?q=${encodeURIComponent(`${device.name} custom firmware OR hack OR mod`)}`,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"links.js","sourceRoot":"","sources":["../../src/core/links.ts"],"names":[],"mappings":"AAEA,SAAS,aAAa,CAAC,SAAwB;IAC7C,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IACtC,OAAO,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAmB;IAChD,MAAM,IAAI,GAAG,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC9C,OAAO,GAAG,MAAM,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,MAAmB;IAC5C,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACzC,OAAO;QACL,eAAe,EAAE,wCAAwC,kBAAkB,CAAC,SAAS,CAAC,UAAU;QAChG,mBAAmB,EAAE,2BAA2B,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QACjF,iBAAiB,EAAE,oCAAoC,kBAAkB,CAAC,GAAG,MAAM,CAAC,IAAI,OAAO,CAAC,WAAW;QAC3G,iBAAiB,EAAE,mCAAmC,kBAAkB,CAAC,GAAG,MAAM,CAAC,IAAI,iCAAiC,CAAC,EAAE;KAC5H,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { NEED_VALUES, type CoreContext, type Need, type Printable, type Size } from "./types.js";
|
|
3
|
+
export { NEED_VALUES, type Need, type Size };
|
|
4
|
+
export declare const planGadgetInput: z.ZodObject<{
|
|
5
|
+
idea: z.ZodString;
|
|
6
|
+
platform: z.ZodDefault<z.ZodEnum<["muse-esp32", "muse-linux", "any"]>>;
|
|
7
|
+
budget_usd: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
owned_device_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
9
|
+
needs: z.ZodOptional<z.ZodArray<z.ZodEnum<["voice", "screen", "images", "touch", "camera", "air-sensors", "e-ink", "battery", "round", "home-tunnel", "big-screen", "compute", "linux"]>, "many">>;
|
|
10
|
+
size: z.ZodDefault<z.ZodEnum<["pocket", "desk", "wall", "any"]>>;
|
|
11
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
size: "pocket" | "desk" | "wall" | "any";
|
|
14
|
+
idea: string;
|
|
15
|
+
platform: "any" | "muse-esp32" | "muse-linux";
|
|
16
|
+
limit: number;
|
|
17
|
+
budget_usd?: number | undefined;
|
|
18
|
+
needs?: ("round" | "e-ink" | "battery" | "voice" | "compute" | "linux" | "screen" | "images" | "touch" | "camera" | "air-sensors" | "home-tunnel" | "big-screen")[] | undefined;
|
|
19
|
+
owned_device_ids?: string[] | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
idea: string;
|
|
22
|
+
size?: "pocket" | "desk" | "wall" | "any" | undefined;
|
|
23
|
+
budget_usd?: number | undefined;
|
|
24
|
+
platform?: "any" | "muse-esp32" | "muse-linux" | undefined;
|
|
25
|
+
limit?: number | undefined;
|
|
26
|
+
needs?: ("round" | "e-ink" | "battery" | "voice" | "compute" | "linux" | "screen" | "images" | "touch" | "camera" | "air-sensors" | "home-tunnel" | "big-screen")[] | undefined;
|
|
27
|
+
owned_device_ids?: string[] | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
export type PlanGadgetInput = z.infer<typeof planGadgetInput>;
|
|
30
|
+
export interface PlanGadgetQuestion {
|
|
31
|
+
id: string;
|
|
32
|
+
question: string;
|
|
33
|
+
why: string;
|
|
34
|
+
options: Array<{
|
|
35
|
+
label: string;
|
|
36
|
+
value: string;
|
|
37
|
+
needs?: Need[];
|
|
38
|
+
budget_usd?: number;
|
|
39
|
+
size?: Size;
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
export interface PlanGadgetOutput {
|
|
43
|
+
inferred_needs: Need[];
|
|
44
|
+
inferred_preferences: InferredPreference[];
|
|
45
|
+
fit: "all" | "partial" | "none";
|
|
46
|
+
notes: string[];
|
|
47
|
+
warnings: string[];
|
|
48
|
+
questions: PlanGadgetQuestion[];
|
|
49
|
+
picks: Array<{
|
|
50
|
+
device_id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
platform_id: string;
|
|
53
|
+
platform_name: string;
|
|
54
|
+
support: "official" | "possible";
|
|
55
|
+
tier: string;
|
|
56
|
+
tier_label: string;
|
|
57
|
+
score: number;
|
|
58
|
+
why: string;
|
|
59
|
+
gaps: string[];
|
|
60
|
+
needs_met: Need[];
|
|
61
|
+
within_budget: boolean | null;
|
|
62
|
+
price_label: string | null;
|
|
63
|
+
build_page_url: string;
|
|
64
|
+
agent_brief_url: string;
|
|
65
|
+
links: string[];
|
|
66
|
+
build_command: string;
|
|
67
|
+
setup_steps: string[];
|
|
68
|
+
caveats: string[];
|
|
69
|
+
fabrication: {
|
|
70
|
+
printables: Printable[];
|
|
71
|
+
note: string;
|
|
72
|
+
};
|
|
73
|
+
}>;
|
|
74
|
+
terms: Array<{
|
|
75
|
+
platform_id: string;
|
|
76
|
+
summary: string;
|
|
77
|
+
url: string;
|
|
78
|
+
max_devices_per_token: number;
|
|
79
|
+
selling_allowed: boolean;
|
|
80
|
+
}>;
|
|
81
|
+
next_steps: string[];
|
|
82
|
+
}
|
|
83
|
+
type InferredPreference = "cheap";
|
|
84
|
+
export declare function planGadget(input: PlanGadgetInput, ctx: CoreContext): PlanGadgetOutput;
|
|
85
|
+
export declare function inferNeeds(idea: string): Need[];
|