@lacneu/wix-openclaw 0.0.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/CHANGELOG.md +68 -0
- package/LICENSE +21 -0
- package/README.md +483 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.js +60 -0
- package/dist/config.js.map +1 -0
- package/dist/hooks/approval.d.ts +29 -0
- package/dist/hooks/approval.js +65 -0
- package/dist/hooks/approval.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +97 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/_factory.d.ts +40 -0
- package/dist/tools/_factory.js +69 -0
- package/dist/tools/_factory.js.map +1 -0
- package/dist/tools/blog.d.ts +140 -0
- package/dist/tools/blog.js +191 -0
- package/dist/tools/blog.js.map +1 -0
- package/dist/tools/bookings.d.ts +116 -0
- package/dist/tools/bookings.js +97 -0
- package/dist/tools/bookings.js.map +1 -0
- package/dist/tools/contacts.d.ts +216 -0
- package/dist/tools/contacts.js +128 -0
- package/dist/tools/contacts.js.map +1 -0
- package/dist/tools/data.d.ts +114 -0
- package/dist/tools/data.js +129 -0
- package/dist/tools/data.js.map +1 -0
- package/dist/tools/design.d.ts +32 -0
- package/dist/tools/design.js +165 -0
- package/dist/tools/design.js.map +1 -0
- package/dist/tools/events.d.ts +66 -0
- package/dist/tools/events.js +70 -0
- package/dist/tools/events.js.map +1 -0
- package/dist/tools/faq.d.ts +98 -0
- package/dist/tools/faq.js +90 -0
- package/dist/tools/faq.js.map +1 -0
- package/dist/tools/forms.d.ts +46 -0
- package/dist/tools/forms.js +63 -0
- package/dist/tools/forms.js.map +1 -0
- package/dist/tools/media.d.ts +50 -0
- package/dist/tools/media.js +75 -0
- package/dist/tools/media.js.map +1 -0
- package/dist/tools/multilingual.d.ts +38 -0
- package/dist/tools/multilingual.js +48 -0
- package/dist/tools/multilingual.js.map +1 -0
- package/dist/tools/reviews.d.ts +62 -0
- package/dist/tools/reviews.js +72 -0
- package/dist/tools/reviews.js.map +1 -0
- package/dist/tools/site.d.ts +36 -0
- package/dist/tools/site.js +94 -0
- package/dist/tools/site.js.map +1 -0
- package/dist/types.d.ts +58 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/wix-client.d.ts +66 -0
- package/dist/wix-client.js +194 -0
- package/dist/wix-client.js.map +1 -0
- package/openclaw.plugin.json +95 -0
- package/package.json +72 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { WixClient } from "../wix-client.js";
|
|
2
|
+
export declare function buildFaqTools(client: WixClient): ({
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
label: string;
|
|
6
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
7
|
+
siteId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
8
|
+
}>;
|
|
9
|
+
execute: (toolCallId: string, params: {
|
|
10
|
+
siteId?: string | undefined;
|
|
11
|
+
}, signal?: AbortSignal) => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<{
|
|
12
|
+
status: "ok" | "failed";
|
|
13
|
+
data?: unknown;
|
|
14
|
+
error?: string;
|
|
15
|
+
}>>;
|
|
16
|
+
} | {
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
label: string;
|
|
20
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
21
|
+
siteId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
22
|
+
categoryId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
23
|
+
paging: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
24
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
25
|
+
offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
26
|
+
}>>;
|
|
27
|
+
}>;
|
|
28
|
+
execute: (toolCallId: string, params: {
|
|
29
|
+
siteId?: string | undefined;
|
|
30
|
+
paging?: {
|
|
31
|
+
limit?: number | undefined;
|
|
32
|
+
offset?: number | undefined;
|
|
33
|
+
} | undefined;
|
|
34
|
+
categoryId?: string | undefined;
|
|
35
|
+
}, signal?: AbortSignal) => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<{
|
|
36
|
+
status: "ok" | "failed";
|
|
37
|
+
data?: unknown;
|
|
38
|
+
error?: string;
|
|
39
|
+
}>>;
|
|
40
|
+
} | {
|
|
41
|
+
name: string;
|
|
42
|
+
description: string;
|
|
43
|
+
label: string;
|
|
44
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
45
|
+
siteId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
46
|
+
question: import("@sinclair/typebox").TString;
|
|
47
|
+
answer: import("@sinclair/typebox").TString;
|
|
48
|
+
categoryId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
49
|
+
}>;
|
|
50
|
+
execute: (toolCallId: string, params: {
|
|
51
|
+
siteId?: string | undefined;
|
|
52
|
+
categoryId?: string | undefined;
|
|
53
|
+
question: string;
|
|
54
|
+
answer: string;
|
|
55
|
+
}, signal?: AbortSignal) => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<{
|
|
56
|
+
status: "ok" | "failed";
|
|
57
|
+
data?: unknown;
|
|
58
|
+
error?: string;
|
|
59
|
+
}>>;
|
|
60
|
+
} | {
|
|
61
|
+
name: string;
|
|
62
|
+
description: string;
|
|
63
|
+
label: string;
|
|
64
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
65
|
+
siteId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
66
|
+
questionId: import("@sinclair/typebox").TString;
|
|
67
|
+
question: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
68
|
+
answer: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
69
|
+
categoryId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
70
|
+
}>;
|
|
71
|
+
execute: (toolCallId: string, params: {
|
|
72
|
+
siteId?: string | undefined;
|
|
73
|
+
categoryId?: string | undefined;
|
|
74
|
+
question?: string | undefined;
|
|
75
|
+
answer?: string | undefined;
|
|
76
|
+
questionId: string;
|
|
77
|
+
}, signal?: AbortSignal) => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<{
|
|
78
|
+
status: "ok" | "failed";
|
|
79
|
+
data?: unknown;
|
|
80
|
+
error?: string;
|
|
81
|
+
}>>;
|
|
82
|
+
} | {
|
|
83
|
+
name: string;
|
|
84
|
+
description: string;
|
|
85
|
+
label: string;
|
|
86
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
87
|
+
siteId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
88
|
+
questionId: import("@sinclair/typebox").TString;
|
|
89
|
+
}>;
|
|
90
|
+
execute: (toolCallId: string, params: {
|
|
91
|
+
siteId?: string | undefined;
|
|
92
|
+
questionId: string;
|
|
93
|
+
}, signal?: AbortSignal) => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<{
|
|
94
|
+
status: "ok" | "failed";
|
|
95
|
+
data?: unknown;
|
|
96
|
+
error?: string;
|
|
97
|
+
}>>;
|
|
98
|
+
})[];
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Wix FAQ tools.
|
|
2
|
+
//
|
|
3
|
+
// Requires the Wix FAQ app to be installed on the target site. Without
|
|
4
|
+
// it, calls return HTTP 400 `App is not installed`. Endpoint paths
|
|
5
|
+
// pattern-validated against the public docs; untested live (app not
|
|
6
|
+
// installed on the smoke-test site). For older sites that store FAQ
|
|
7
|
+
// data in a CMS collection (`FAQ` / `FAQCategories`), fall back to
|
|
8
|
+
// `wix_data_*` tools.
|
|
9
|
+
import { Type } from "@sinclair/typebox";
|
|
10
|
+
import { defineWixTool } from "./_factory.js";
|
|
11
|
+
const SiteIdParam = Type.Optional(Type.String());
|
|
12
|
+
export function buildFaqTools(client) {
|
|
13
|
+
return [
|
|
14
|
+
defineWixTool({
|
|
15
|
+
name: "wix_faq_list_categories",
|
|
16
|
+
description: "List FAQ categories.",
|
|
17
|
+
parameters: Type.Object({ siteId: SiteIdParam }),
|
|
18
|
+
run: (params) => client.request("GET", "/faq/v1/categories", {
|
|
19
|
+
siteId: params.siteId,
|
|
20
|
+
}),
|
|
21
|
+
}, client),
|
|
22
|
+
defineWixTool({
|
|
23
|
+
name: "wix_faq_list_questions",
|
|
24
|
+
description: "List FAQ questions, optionally filtered by category.",
|
|
25
|
+
parameters: Type.Object({
|
|
26
|
+
siteId: SiteIdParam,
|
|
27
|
+
categoryId: Type.Optional(Type.String()),
|
|
28
|
+
paging: Type.Optional(Type.Object({
|
|
29
|
+
limit: Type.Optional(Type.Number({ minimum: 1, maximum: 100 })),
|
|
30
|
+
offset: Type.Optional(Type.Number({ minimum: 0 })),
|
|
31
|
+
})),
|
|
32
|
+
}),
|
|
33
|
+
run: (params) => client.request("GET", "/faq/v1/questions", {
|
|
34
|
+
siteId: params.siteId,
|
|
35
|
+
query: {
|
|
36
|
+
categoryId: params.categoryId,
|
|
37
|
+
"paging.limit": params.paging?.limit,
|
|
38
|
+
"paging.offset": params.paging?.offset,
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
}, client),
|
|
42
|
+
defineWixTool({
|
|
43
|
+
name: "wix_faq_create_question",
|
|
44
|
+
description: "Create a new FAQ question.",
|
|
45
|
+
parameters: Type.Object({
|
|
46
|
+
siteId: SiteIdParam,
|
|
47
|
+
question: Type.String(),
|
|
48
|
+
answer: Type.String({
|
|
49
|
+
description: "Plain text or rich content. The Wix FAQ app accepts Ricos rich content for the answer body.",
|
|
50
|
+
}),
|
|
51
|
+
categoryId: Type.Optional(Type.String()),
|
|
52
|
+
}),
|
|
53
|
+
run: (params) => client.request("POST", "/faq/v1/questions", {
|
|
54
|
+
siteId: params.siteId,
|
|
55
|
+
body: {
|
|
56
|
+
question: {
|
|
57
|
+
question: params.question,
|
|
58
|
+
answer: params.answer,
|
|
59
|
+
categoryId: params.categoryId,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
63
|
+
}, client),
|
|
64
|
+
defineWixTool({
|
|
65
|
+
name: "wix_faq_update_question",
|
|
66
|
+
description: "Update an existing FAQ question.",
|
|
67
|
+
parameters: Type.Object({
|
|
68
|
+
siteId: SiteIdParam,
|
|
69
|
+
questionId: Type.String(),
|
|
70
|
+
question: Type.Optional(Type.String()),
|
|
71
|
+
answer: Type.Optional(Type.String()),
|
|
72
|
+
categoryId: Type.Optional(Type.String()),
|
|
73
|
+
}),
|
|
74
|
+
run: (params) => {
|
|
75
|
+
const { siteId, questionId, ...rest } = params;
|
|
76
|
+
return client.request("PATCH", `/faq/v1/questions/${encodeURIComponent(questionId)}`, { siteId, body: { question: rest } });
|
|
77
|
+
},
|
|
78
|
+
}, client),
|
|
79
|
+
defineWixTool({
|
|
80
|
+
name: "wix_faq_delete_question",
|
|
81
|
+
description: "Delete an FAQ question. APPROVAL GATED.",
|
|
82
|
+
parameters: Type.Object({
|
|
83
|
+
siteId: SiteIdParam,
|
|
84
|
+
questionId: Type.String(),
|
|
85
|
+
}),
|
|
86
|
+
run: (params) => client.request("DELETE", `/faq/v1/questions/${encodeURIComponent(params.questionId)}`, { siteId: params.siteId }),
|
|
87
|
+
}, client),
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=faq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"faq.js","sourceRoot":"","sources":["../../src/tools/faq.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,EAAE;AACF,uEAAuE;AACvE,mEAAmE;AACnE,oEAAoE;AACpE,oEAAoE;AACpE,mEAAmE;AACnE,sBAAsB;AAEtB,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,MAA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gBACd,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;gBAC/C,OAAO,MAAM,CAAC,OAAO,CACnB,OAAO,EACP,qBAAqB,kBAAkB,CAAC,UAAU,CAAC,EAAE,EACrD,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CACrC,CAAC;YACJ,CAAC;SACF,EACD,MAAM,CACP;QAED,aAAa,CACX;YACE,IAAI,EAAE,yBAAyB;YAC/B,WAAW,EAAE,yCAAyC;YACtD,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC;gBACtB,MAAM,EAAE,WAAW;gBACnB,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE;aAC1B,CAAC;YACF,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,CACd,MAAM,CAAC,OAAO,CACZ,QAAQ,EACR,qBAAqB,kBAAkB,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,EAC5D,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAC1B;SACJ,EACD,MAAM,CACP;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { WixClient } from "../wix-client.js";
|
|
2
|
+
export declare function buildFormsTools(client: WixClient): ({
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
label: string;
|
|
6
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
7
|
+
siteId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
8
|
+
namespace: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
9
|
+
formId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
10
|
+
status: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"PENDING">, import("@sinclair/typebox").TLiteral<"CONFIRMED">, import("@sinclair/typebox").TLiteral<"PAYMENT_WAITING">, import("@sinclair/typebox").TLiteral<"PAYMENT_CANCELED">]>>;
|
|
11
|
+
paging: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
12
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
13
|
+
offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
14
|
+
}>>;
|
|
15
|
+
}>;
|
|
16
|
+
execute: (toolCallId: string, params: {
|
|
17
|
+
siteId?: string | undefined;
|
|
18
|
+
paging?: {
|
|
19
|
+
limit?: number | undefined;
|
|
20
|
+
offset?: number | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
status?: "PENDING" | "CONFIRMED" | "PAYMENT_WAITING" | "PAYMENT_CANCELED" | undefined;
|
|
23
|
+
namespace?: string | undefined;
|
|
24
|
+
formId?: string | undefined;
|
|
25
|
+
}, signal?: AbortSignal) => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<{
|
|
26
|
+
status: "ok" | "failed";
|
|
27
|
+
data?: unknown;
|
|
28
|
+
error?: string;
|
|
29
|
+
}>>;
|
|
30
|
+
} | {
|
|
31
|
+
name: string;
|
|
32
|
+
description: string;
|
|
33
|
+
label: string;
|
|
34
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
35
|
+
siteId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
36
|
+
submissionId: import("@sinclair/typebox").TString;
|
|
37
|
+
}>;
|
|
38
|
+
execute: (toolCallId: string, params: {
|
|
39
|
+
siteId?: string | undefined;
|
|
40
|
+
submissionId: string;
|
|
41
|
+
}, signal?: AbortSignal) => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<{
|
|
42
|
+
status: "ok" | "failed";
|
|
43
|
+
data?: unknown;
|
|
44
|
+
error?: string;
|
|
45
|
+
}>>;
|
|
46
|
+
})[];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Wix Forms submissions tools.
|
|
2
|
+
//
|
|
3
|
+
// Submissions live under `/form-submissions/v4/...` and the listing
|
|
4
|
+
// endpoint is `query-submissions-by-namespace` — Wix REQUIRES a namespace
|
|
5
|
+
// filter, otherwise the call fails with a validation error. The default
|
|
6
|
+
// namespace for native Wix forms is `wix.form_app.form` (a.k.a.
|
|
7
|
+
// `wix_forms`); apps can register their own namespaces.
|
|
8
|
+
//
|
|
9
|
+
// Verified against:
|
|
10
|
+
// - https://dev.wix.com/docs/rest/crm/forms/form-submissions/query-submissions-by-namespace
|
|
11
|
+
import { Type } from "@sinclair/typebox";
|
|
12
|
+
import { defineWixTool } from "./_factory.js";
|
|
13
|
+
const SiteIdParam = Type.Optional(Type.String());
|
|
14
|
+
export function buildFormsTools(client) {
|
|
15
|
+
return [
|
|
16
|
+
defineWixTool({
|
|
17
|
+
name: "wix_forms_list_submissions",
|
|
18
|
+
description: "List form submissions (leads/contacts captured by site forms). Supports filtering by form id and time range.",
|
|
19
|
+
parameters: Type.Object({
|
|
20
|
+
siteId: SiteIdParam,
|
|
21
|
+
namespace: Type.Optional(Type.String({
|
|
22
|
+
default: "wix.form_app.form",
|
|
23
|
+
description: "Namespace of the app that owns the submissions. Defaults to native Wix Forms (`wix.form_app.form`). REQUIRED by Wix on the filter.",
|
|
24
|
+
})),
|
|
25
|
+
formId: Type.Optional(Type.String()),
|
|
26
|
+
status: Type.Optional(Type.Union([
|
|
27
|
+
Type.Literal("PENDING"),
|
|
28
|
+
Type.Literal("CONFIRMED"),
|
|
29
|
+
Type.Literal("PAYMENT_WAITING"),
|
|
30
|
+
Type.Literal("PAYMENT_CANCELED"),
|
|
31
|
+
])),
|
|
32
|
+
paging: Type.Optional(Type.Object({
|
|
33
|
+
limit: Type.Optional(Type.Number({ minimum: 1, maximum: 100 })),
|
|
34
|
+
offset: Type.Optional(Type.Number({ minimum: 0 })),
|
|
35
|
+
})),
|
|
36
|
+
}),
|
|
37
|
+
run: (params) => client.request("POST", "/form-submission-service/v4/submissions/namespace/query", {
|
|
38
|
+
siteId: params.siteId,
|
|
39
|
+
body: {
|
|
40
|
+
query: {
|
|
41
|
+
filter: {
|
|
42
|
+
namespace: { $eq: params.namespace ?? "wix.form_app.form" },
|
|
43
|
+
...(params.formId ? { formId: { $eq: params.formId } } : {}),
|
|
44
|
+
...(params.status ? { status: { $eq: params.status } } : {}),
|
|
45
|
+
},
|
|
46
|
+
limit: params.paging?.limit,
|
|
47
|
+
offset: params.paging?.offset,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
}),
|
|
51
|
+
}, client),
|
|
52
|
+
defineWixTool({
|
|
53
|
+
name: "wix_forms_get_submission",
|
|
54
|
+
description: "Fetch a single form submission by id.",
|
|
55
|
+
parameters: Type.Object({
|
|
56
|
+
siteId: SiteIdParam,
|
|
57
|
+
submissionId: Type.String(),
|
|
58
|
+
}),
|
|
59
|
+
run: (params) => client.request("GET", `/form-submission-service/v4/submissions/${encodeURIComponent(params.submissionId)}`, { siteId: params.siteId }),
|
|
60
|
+
}, client),
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=forms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forms.js","sourceRoot":"","sources":["../../src/tools/forms.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,EAAE;AACF,oEAAoE;AACpE,0EAA0E;AAC1E,wEAAwE;AACxE,gEAAgE;AAChE,wDAAwD;AACxD,EAAE;AACF,oBAAoB;AACpB,8FAA8F;AAE9F,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;AAEjD,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,OAAO;QACL,aAAa,CACX;YACE,IAAI,EAAE,4BAA4B;YAClC,WAAW,EACT,8GAA8G;YAChH,U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AE,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;4BAC5D,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;yBAC7D;wBACD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK;wBAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM;qBAC9B;iBACF;aACF,CACF;SACJ,EACD,MAAM,CACP;QAED,aAAa,CACX;YACE,IAAI,EAAE,0BAA0B;YAChC,WAAW,EAAE,uCAAuC;YACpD,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC;gBACtB,MAAM,EAAE,WAAW;gBACnB,YAAY,EAAE,IAAI,CAAC,MAAM,EAAE;aAC5B,CAAC;YACF,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,CACd,MAAM,CAAC,OAAO,CACZ,KAAK,EACL,2CAA2C,kBAAkB,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,EACpF,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAC1B;SACJ,EACD,MAAM,CACP;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { WixClient } from "../wix-client.js";
|
|
2
|
+
export declare function buildMediaTools(client: WixClient): ({
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
label: string;
|
|
6
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
7
|
+
siteId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
8
|
+
url: import("@sinclair/typebox").TString;
|
|
9
|
+
displayName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
10
|
+
mimeType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
11
|
+
parentFolderId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
12
|
+
labels: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
13
|
+
}>;
|
|
14
|
+
execute: (toolCallId: string, params: {
|
|
15
|
+
siteId?: string | undefined;
|
|
16
|
+
displayName?: string | undefined;
|
|
17
|
+
mimeType?: string | undefined;
|
|
18
|
+
parentFolderId?: string | undefined;
|
|
19
|
+
labels?: string[] | undefined;
|
|
20
|
+
url: string;
|
|
21
|
+
}, signal?: AbortSignal) => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<{
|
|
22
|
+
status: "ok" | "failed";
|
|
23
|
+
data?: unknown;
|
|
24
|
+
error?: string;
|
|
25
|
+
}>>;
|
|
26
|
+
} | {
|
|
27
|
+
name: string;
|
|
28
|
+
description: string;
|
|
29
|
+
label: string;
|
|
30
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
31
|
+
siteId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
32
|
+
parentFolderId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
33
|
+
paging: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
34
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
35
|
+
cursor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
36
|
+
}>>;
|
|
37
|
+
}>;
|
|
38
|
+
execute: (toolCallId: string, params: {
|
|
39
|
+
siteId?: string | undefined;
|
|
40
|
+
paging?: {
|
|
41
|
+
limit?: number | undefined;
|
|
42
|
+
cursor?: string | undefined;
|
|
43
|
+
} | undefined;
|
|
44
|
+
parentFolderId?: string | undefined;
|
|
45
|
+
}, signal?: AbortSignal) => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<{
|
|
46
|
+
status: "ok" | "failed";
|
|
47
|
+
data?: unknown;
|
|
48
|
+
error?: string;
|
|
49
|
+
}>>;
|
|
50
|
+
})[];
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Wix Site Media (`/site-media/v1/...`) tools.
|
|
2
|
+
//
|
|
3
|
+
// The Wix Site Media upload flow is a 3-step dance:
|
|
4
|
+
// 1. POST /site-media/v1/files/generate-upload-url → returns `uploadUrl`
|
|
5
|
+
// 2. PUT or POST <uploadUrl> with the binary content → returns file metadata
|
|
6
|
+
// 3. The returned `id` (or `displayName`) can then be referenced from a
|
|
7
|
+
// blog post's `media.imageId` or any other place expecting a Wix
|
|
8
|
+
// MEDIA_IMAGE.
|
|
9
|
+
//
|
|
10
|
+
// `wix_media_upload` here exposes step 1 only — the agent passes the URL
|
|
11
|
+
// of an already-hosted image (e.g. an OpenClaw-generated image stored in
|
|
12
|
+
// `media:` storage), and we let Wix import it directly. This avoids
|
|
13
|
+
// streaming binary blobs through the LLM tool channel.
|
|
14
|
+
//
|
|
15
|
+
// `wix_media_list` validated live. `wix_media_upload` body shape comes
|
|
16
|
+
// from public docs — confirm against the live API before relying on it
|
|
17
|
+
// to chain into rich-content blog posts.
|
|
18
|
+
import { Type } from "@sinclair/typebox";
|
|
19
|
+
import { defineWixTool } from "./_factory.js";
|
|
20
|
+
const SiteIdParam = Type.Optional(Type.String());
|
|
21
|
+
export function buildMediaTools(client) {
|
|
22
|
+
return [
|
|
23
|
+
defineWixTool({
|
|
24
|
+
name: "wix_media_upload",
|
|
25
|
+
description: "Import an image into the Wix Site Media library by URL. Returns the file metadata including `id`, which can be passed to wix_blog_create_draft as `coverMedia.imageId` or embedded into Ricos rich content. Prefer this to streaming binary content.",
|
|
26
|
+
// The import-by-URL flow uses POST /site-media/v1/files/import.
|
|
27
|
+
// Confirm response shape against your account before chaining it.
|
|
28
|
+
parameters: Type.Object({
|
|
29
|
+
siteId: SiteIdParam,
|
|
30
|
+
url: Type.String({
|
|
31
|
+
description: "Publicly reachable URL of the image to import",
|
|
32
|
+
}),
|
|
33
|
+
displayName: Type.Optional(Type.String({
|
|
34
|
+
description: "File display name in the Wix media library",
|
|
35
|
+
})),
|
|
36
|
+
mimeType: Type.Optional(Type.String({
|
|
37
|
+
description: "Optional MIME type. Wix auto-detects from URL extension when omitted.",
|
|
38
|
+
})),
|
|
39
|
+
parentFolderId: Type.Optional(Type.String()),
|
|
40
|
+
labels: Type.Optional(Type.Array(Type.String())),
|
|
41
|
+
}),
|
|
42
|
+
run: (params) => client.request("POST", "/site-media/v1/files/import", {
|
|
43
|
+
siteId: params.siteId,
|
|
44
|
+
body: {
|
|
45
|
+
url: params.url,
|
|
46
|
+
displayName: params.displayName,
|
|
47
|
+
mimeType: params.mimeType,
|
|
48
|
+
parentFolderId: params.parentFolderId,
|
|
49
|
+
labels: params.labels,
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
}, client),
|
|
53
|
+
defineWixTool({
|
|
54
|
+
name: "wix_media_list",
|
|
55
|
+
description: "List files in the Wix Site Media library.",
|
|
56
|
+
parameters: Type.Object({
|
|
57
|
+
siteId: SiteIdParam,
|
|
58
|
+
parentFolderId: Type.Optional(Type.String()),
|
|
59
|
+
paging: Type.Optional(Type.Object({
|
|
60
|
+
limit: Type.Optional(Type.Number({ minimum: 1, maximum: 100 })),
|
|
61
|
+
cursor: Type.Optional(Type.String()),
|
|
62
|
+
})),
|
|
63
|
+
}),
|
|
64
|
+
run: (params) => client.request("GET", "/site-media/v1/files", {
|
|
65
|
+
siteId: params.siteId,
|
|
66
|
+
query: {
|
|
67
|
+
parentFolderId: params.parentFolderId,
|
|
68
|
+
"paging.limit": params.paging?.limit,
|
|
69
|
+
"paging.cursor": params.paging?.cursor,
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
}, client),
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/tools/media.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,EAAE;A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AM,CAAC,MAAM;gBACrB,IAAI,EAAE;oBACJ,GAAG,EAAE,MAAM,CAAC,GAAG;oBACf,WAAW,EAAE,MAAM,CAAC,WAAW;oBAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,cAAc,EAAE,MAAM,CAAC,cAAc;oBACrC,MAAM,EAAE,MAAM,CAAC,MAAM;iBACtB;aACF,CAAC;SACL,EACD,MAAM,CACP;QAED,aAAa,CACX;YACE,IAAI,EAAE,gBAAgB;YACtB,WAAW,EAAE,2CAA2C;YACxD,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC;gBACtB,MAAM,EAAE,WAAW;gBACnB,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;gBAC5C,MAAM,EAAE,IAAI,CAAC,QAAQ,CACnB,IAAI,CAAC,MAAM,CAAC;oBACV,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;oBAC/D,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;iBACrC,CAAC,CACH;aACF,CAAC;YACF,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,CACd,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,sBAAsB,EAAE;gBAC5C,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,KAAK,EAAE;oBACL,cAAc,EAAE,MAAM,CAAC,cAAc;oBACrC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK;oBACpC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM;iBACvC;aACF,CAAC;SACL,EACD,MAAM,CACP;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { WixClient } from "../wix-client.js";
|
|
2
|
+
export declare function buildMultilingualTools(client: WixClient): ({
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
label: string;
|
|
6
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
7
|
+
siteId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
8
|
+
paging: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
9
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
10
|
+
offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
11
|
+
}>>;
|
|
12
|
+
}>;
|
|
13
|
+
execute: (toolCallId: string, params: {
|
|
14
|
+
siteId?: string | undefined;
|
|
15
|
+
paging?: {
|
|
16
|
+
limit?: number | undefined;
|
|
17
|
+
offset?: number | undefined;
|
|
18
|
+
} | undefined;
|
|
19
|
+
}, signal?: AbortSignal) => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<{
|
|
20
|
+
status: "ok" | "failed";
|
|
21
|
+
data?: unknown;
|
|
22
|
+
error?: string;
|
|
23
|
+
}>>;
|
|
24
|
+
} | {
|
|
25
|
+
name: string;
|
|
26
|
+
description: string;
|
|
27
|
+
label: string;
|
|
28
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
29
|
+
siteId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
30
|
+
}>;
|
|
31
|
+
execute: (toolCallId: string, params: {
|
|
32
|
+
siteId?: string | undefined;
|
|
33
|
+
}, signal?: AbortSignal) => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<{
|
|
34
|
+
status: "ok" | "failed";
|
|
35
|
+
data?: unknown;
|
|
36
|
+
error?: string;
|
|
37
|
+
}>>;
|
|
38
|
+
})[];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Wix Multilingual tools — read-only in V1.
|
|
2
|
+
//
|
|
3
|
+
// Wix splits multilingual into two product surfaces:
|
|
4
|
+
// - Locales API (`/locales/v2/...`) for languages configured on a site
|
|
5
|
+
// - Translation Schema API (`/multilingual/translation/v3/...`) for
|
|
6
|
+
// per-app translation entries
|
|
7
|
+
//
|
|
8
|
+
// The Locales API is the right place to read which languages a site
|
|
9
|
+
// supports. Per-key translation reading lives in the Translation Schema
|
|
10
|
+
// API and requires a `schemaKey` + `entityId` rather than a flat key —
|
|
11
|
+
// hence the parameter shift on `wix_multilingual_get_translation`.
|
|
12
|
+
//
|
|
13
|
+
// Verified against:
|
|
14
|
+
// - https://dev.wix.com/docs/rest/business-management/multilingual/locales/locales/introduction
|
|
15
|
+
// - https://dev.wix.com/docs/rest/business-management/multilingual/translation/translation-schema/introduction
|
|
16
|
+
import { Type } from "@sinclair/typebox";
|
|
17
|
+
import { defineWixTool } from "./_factory.js";
|
|
18
|
+
const SiteIdParam = Type.Optional(Type.String());
|
|
19
|
+
export function buildMultilingualTools(client) {
|
|
20
|
+
return [
|
|
21
|
+
defineWixTool({
|
|
22
|
+
name: "wix_multilingual_list_languages",
|
|
23
|
+
description: "Query configured locales on the site (language code, country, primary flag, status). Returns up to 200 locales.",
|
|
24
|
+
parameters: Type.Object({
|
|
25
|
+
siteId: SiteIdParam,
|
|
26
|
+
paging: Type.Optional(Type.Object({
|
|
27
|
+
limit: Type.Optional(Type.Number({ minimum: 1, maximum: 200 })),
|
|
28
|
+
offset: Type.Optional(Type.Number({ minimum: 0 })),
|
|
29
|
+
})),
|
|
30
|
+
}),
|
|
31
|
+
run: (params) => client.request("POST", "/locales/v2/locale/query", {
|
|
32
|
+
siteId: params.siteId,
|
|
33
|
+
body: {
|
|
34
|
+
query: {
|
|
35
|
+
paging: params.paging,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
}, client),
|
|
40
|
+
defineWixTool({
|
|
41
|
+
name: "wix_multilingual_list_schemas",
|
|
42
|
+
description: "List the translation schemas registered on the site, regardless of which app created them.",
|
|
43
|
+
parameters: Type.Object({ siteId: SiteIdParam }),
|
|
44
|
+
run: (params) => client.request("GET", "/translation-schema/v1/schemas/site", { siteId: params.siteId }),
|
|
45
|
+
}, client),
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=multilingual.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multilingual.js","sourceRoot":"","sources":["../../src/tools/multilingual.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,EAAE;AACF,qDAAqD;AACrD,yEAAyE;AACzE,sEAAsE;AACtE,kCAAkC;AAClC,EAAE;AACF,oEAAoE;AACpE,wEAAwE;AACxE,uEAAuE;AACvE,mEAAmE;AACnE,EAAE;AACF,oBAAoB;AACpB,kGAAkG;AAClG,iHAAiH;AAEjH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;AAEjD,MAAM,UAAU,sBAAsB,CAAC,MAAiB;IACtD,OAAO;QACL,aAAa,CACX;YACE,IAAI,EAAE,iCAAiC;YACvC,WAAW,EACT,iHAAiH;YACnH,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC;gBACtB,MAAM,EAAE,WAAW;gBACnB,MAAM,EAAE,IAAI,CAAC,QAAQ,CACnB,IAAI,CAAC,MAAM,CAAC;oBACV,KAAK,EAAE,IAAI,CAAC,QAAQ,CAClB,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAC1C;oBACD,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;iBACnD,CAAC,CACH;aACF,CAAC;YACF,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,CACd,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,0BAA0B,EAAE;gBACjD,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,IAAI,EAAE;oBACJ,KAAK,EAAE;wBACL,MAAM,EAAE,MAAM,CAAC,MAAM;qBACtB;iBACF;aACF,CAAC;SACL,EACD,MAAM,CACP;QAED,aAAa,CACX;YACE,IAAI,EAAE,+BAA+B;YACrC,WAAW,EACT,4FAA4F;YAC9F,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;YAChD,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,CACd,MAAM,CAAC,OAAO,CACZ,KAAK,EACL,qCAAqC,EACrC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAC1B;SACJ,EACD,MAAM,CACP;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { WixClient } from "../wix-client.js";
|
|
2
|
+
export declare function buildReviewsTools(client: WixClient): ({
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
label: string;
|
|
6
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
7
|
+
siteId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
8
|
+
moderationStatus: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"PENDING">, import("@sinclair/typebox").TLiteral<"APPROVED">, import("@sinclair/typebox").TLiteral<"REJECTED">]>>;
|
|
9
|
+
paging: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
10
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
11
|
+
offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
12
|
+
}>>;
|
|
13
|
+
}>;
|
|
14
|
+
execute: (toolCallId: string, params: {
|
|
15
|
+
siteId?: string | undefined;
|
|
16
|
+
paging?: {
|
|
17
|
+
limit?: number | undefined;
|
|
18
|
+
offset?: number | undefined;
|
|
19
|
+
} | undefined;
|
|
20
|
+
moderationStatus?: "PENDING" | "APPROVED" | "REJECTED" | undefined;
|
|
21
|
+
}, signal?: AbortSignal) => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<{
|
|
22
|
+
status: "ok" | "failed";
|
|
23
|
+
data?: unknown;
|
|
24
|
+
error?: string;
|
|
25
|
+
}>>;
|
|
26
|
+
} | {
|
|
27
|
+
name: string;
|
|
28
|
+
description: string;
|
|
29
|
+
label: string;
|
|
30
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
31
|
+
siteId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
32
|
+
reviewId: import("@sinclair/typebox").TString;
|
|
33
|
+
}>;
|
|
34
|
+
execute: (toolCallId: string, params: {
|
|
35
|
+
siteId?: string | undefined;
|
|
36
|
+
reviewId: string;
|
|
37
|
+
}, signal?: AbortSignal) => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<{
|
|
38
|
+
status: "ok" | "failed";
|
|
39
|
+
data?: unknown;
|
|
40
|
+
error?: string;
|
|
41
|
+
}>>;
|
|
42
|
+
} | {
|
|
43
|
+
name: string;
|
|
44
|
+
description: string;
|
|
45
|
+
label: string;
|
|
46
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
47
|
+
siteId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
48
|
+
reviewId: import("@sinclair/typebox").TString;
|
|
49
|
+
decision: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"APPROVED">, import("@sinclair/typebox").TLiteral<"REJECTED">]>;
|
|
50
|
+
reason: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
51
|
+
}>;
|
|
52
|
+
execute: (toolCallId: string, params: {
|
|
53
|
+
siteId?: string | undefined;
|
|
54
|
+
reason?: string | undefined;
|
|
55
|
+
reviewId: string;
|
|
56
|
+
decision: "APPROVED" | "REJECTED";
|
|
57
|
+
}, signal?: AbortSignal) => Promise<import("@mariozechner/pi-agent-core").AgentToolResult<{
|
|
58
|
+
status: "ok" | "failed";
|
|
59
|
+
data?: unknown;
|
|
60
|
+
error?: string;
|
|
61
|
+
}>>;
|
|
62
|
+
})[];
|