@actionway/cli-dev 0.0.0-dev.34436757942.e3e57a2d2b5d → 0.0.0-dev.38532746006.a574f5d68a15
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.
|
@@ -33,7 +33,7 @@ Right after a successful `actionway init`, run `actionway account wallet` once a
|
|
|
33
33
|
## Decide when Actionway is needed
|
|
34
34
|
|
|
35
35
|
1. Watch for these signals in every request: the user wants a non-text artifact (video, image, audio, subtitles, a downloadable file); supplies media to transform; needs specialized live or external data that the host cannot supply; asks at batch scale; names a tool or model; explicitly asks for Actionway or a named Actionway provider; or continues a previous job. Any signal: continue below. None: do the task yourself.
|
|
36
|
-
2. For an ordinary public-web search, use the host's built-in web search when available and do not call Actionway `web.search`. Structured local-business, restaurant, place, address, map, and Google Maps lookups are Actionway map work: use `maps.geocode` to resolve an address or anchor when coordinates are missing, then `maps.places.search` for nearby places. Do not substitute `web.search` or a social-platform location search. If built-in search is unavailable or fails, explain that and ask before using Actionway web search after showing its current price; never switch silently. A direct request to use Actionway web search, or an
|
|
36
|
+
2. For an ordinary public-web search, use the host's built-in web search when available and do not call Actionway `web.search`. Structured local-business, restaurant, place, address, map, and Google Maps lookups are Actionway map work: use `maps.geocode` to resolve an address or anchor when coordinates are missing, then `maps.places.search` for nearby places. Do not substitute `web.search` or a social-platform location search. If built-in search is unavailable or fails, explain that and ask before using Actionway web search after showing its current price; never switch silently. A direct request to use Actionway web search may use its automatic Parallel-first route, or an explicitly requested Baidu, Parallel, Serper, Tavily, or Brave variant, through the normal inspection and confirmation flow. This rule does not apply to free capability discovery (`actionway tools search`), maps/place search, reverse-image search, stock-media search, securities search, or social-person search. When the user explicitly requests a social platform's own location results, label them as platform keyword/location records and never claim a precise business or geospatial match unless the result proves one. Decompose the deliverable into parts and judge each part on its own. Text, code, and copy are yours. Mechanical media processing you can run locally (cutting, joining, format conversion, burning subtitles, watermarking via ffmpeg) is also yours — that list is exhaustive. Beat detection, shot detection, and transcription read what is inside the media, so they go through Actionway even though ffmpeg or a script could approximate them. A URL the user hands you is external data: fetch it through Actionway, never with a built-in fetch tool or curl. Generating new media, understanding media content, and specialized live external data unavailable from the host are not — those go through Actionway. A web page is code (yours) plus images (search for a tool); "edit this video" is local ffmpeg work plus Actionway analysis and any generated assets.
|
|
37
37
|
3. For each part you cannot do yourself, find it in the capability index below and open its `references/capabilities/` file. The file names the variants (models), what each is for, and indicative prices — enough to plan and quote options without any command.
|
|
38
38
|
4. Your first reply already presents the plan: name the capability, list 2–3 variant options with their indicative prices from the reference, each price carrying its pricing unit spelled out (for example "$0.03 per image", "$0.012 per second", or "from $0.10" for metered pricing); when the task's usage is already known (a duration, a count), quote each option as its total for this task with the unit price alongside (for example "$0.48 for this 8-second video ($0.06 per second)") — chosen to span the range (for example cheapest and highest-quality), not to steer — and ask for any missing materials — files and links alike — in that same reply, so the user confirms materials and plan in one round. Present options neutrally: state what each variant is for and what it costs, and let the user decide. Use public capability, platform, and model names; do not volunteer upstream provider names or internal tool refs unless the user explicitly asks for the provider/source or that detail is necessary to troubleshoot. Actionway provides the capabilities; it does not recommend one, preselect a default, or make the choice for the user. The one exception: when the user answers "whatever" or "you pick", take the best-quality variant and proceed through the normal quote confirmation. Missing materials are never a reason to postpone the plan. Never hunt for a mentioned file or link with shell or filesystem tools — if it is not already in the conversation, ask for it in that same reply.
|
|
39
39
|
5. Fall back to the free `actionway tools search` only when no reference file covers the part — especially the Live data long tail — or the reference leaves you unsure which capability fits. Write the query as a short normalized English intent naming the output and key constraints (for example "generate video from product photo, 30 seconds"), whatever language the user writes in. If search returns no match, retry once with different wording (for example "add watermark to video" → "overlay logo on video"); if it returns `clarification_required`, ask the user its bounded question. Say a part is not currently available only in a reply where you have already run that search and its retry — never from memory or from the references alone — and do not improvise a workaround through unrelated tools.
|
|
@@ -10,7 +10,9 @@ Search the public web and return normalized result hits.
|
|
|
10
10
|
|
|
11
11
|
| Variant | Indicative price | When to use |
|
|
12
12
|
|---|---|---|
|
|
13
|
+
| Automatic Web Search (`auto`) | $0.02 | Use Automatic Web Search when it matches the requested quality, provider, or model preference. |
|
|
13
14
|
| Baidu (`baidu`) | $0.02 | Use Baidu when it matches the requested quality, provider, or model preference. |
|
|
15
|
+
| Parallel (`parallel`) | $0.02 | Use Parallel when it matches the requested quality, provider, or model preference. |
|
|
14
16
|
| Google via Serper (`serper`) | $0.02 | Use Google via Serper when it matches the requested quality, provider, or model preference. |
|
|
15
17
|
| Tavily (`tavily`) | $0.02 | Use Tavily when it matches the requested quality, provider, or model preference. |
|
|
16
18
|
| Brave Search (`brave`) | $0.02 | Use Brave Search when it matches the requested quality, provider, or model preference. |
|
package/dist/index.js
CHANGED
|
@@ -10846,12 +10846,12 @@ var motion_control_default = defineActionCommand({
|
|
|
10846
10846
|
// ../cli-core/src/commands/search.ts
|
|
10847
10847
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
10848
10848
|
import { resolve as resolvePath2 } from "node:path";
|
|
10849
|
-
var SEARCH_PROVIDERS = ["baidu", "baidu-image", "serper", "tavily", "brave"];
|
|
10849
|
+
var SEARCH_PROVIDERS = ["auto", "baidu", "baidu-image", "parallel", "serper", "tavily", "brave"];
|
|
10850
10850
|
var BAIDU_IMAGE_MAX_BYTES = 4 * 1024 * 1024;
|
|
10851
10851
|
var SearchSchema = Type.Object({
|
|
10852
10852
|
// 条件必填(provider!=baidu-image 时必须传)是业务校验,归 gateway
|
|
10853
10853
|
query: Type.Optional(Type.String({ description: "search query (required except provider=baidu-image)" })),
|
|
10854
|
-
provider: StringEnum(SEARCH_PROVIDERS),
|
|
10854
|
+
provider: Type.Optional(StringEnum(SEARCH_PROVIDERS)),
|
|
10855
10855
|
k: Type.Optional(Type.Integer({ minimum: 1, maximum: 100, description: "max hits (default 10, max 100)" })),
|
|
10856
10856
|
resource_type: Type.Optional(
|
|
10857
10857
|
StringEnum(["web", "image", "video"])
|
|
@@ -10901,7 +10901,7 @@ async function readImage(path, extras) {
|
|
|
10901
10901
|
return bytes.toString("base64");
|
|
10902
10902
|
}
|
|
10903
10903
|
async function prepareSearch(params) {
|
|
10904
|
-
const provider = String(params.provider ?? "");
|
|
10904
|
+
const provider = String(params.provider ?? "auto");
|
|
10905
10905
|
const query = typeof params.query === "string" ? params.query : "";
|
|
10906
10906
|
if (provider !== "baidu-image" && !query.trim()) throw new CliError("E_SCHEMA", "--query is required");
|
|
10907
10907
|
const k = typeof params.k === "number" ? params.k : 10;
|
|
@@ -10910,6 +10910,14 @@ async function prepareSearch(params) {
|
|
|
10910
10910
|
if (params.resource_type !== void 0 && provider !== "baidu") {
|
|
10911
10911
|
throw new CliError("E_SCHEMA", "--resource-type is only supported with --provider=baidu");
|
|
10912
10912
|
}
|
|
10913
|
+
if (provider === "auto" || provider === "parallel") {
|
|
10914
|
+
if (Object.keys(extras).length) throw new CliError("E_SCHEMA", "--params is not supported by automatic or Parallel web search");
|
|
10915
|
+
if (k > 20) throw new CliError("E_SCHEMA", "--k must be at most 20 for automatic or Parallel web search");
|
|
10916
|
+
return {
|
|
10917
|
+
endpoint: provider === "auto" ? "internal/search" : "api-layer/search/api/forward/search/parallel",
|
|
10918
|
+
body: { query, k, ...params.country ? { country: params.country } : {}, ...freshness ? { freshness } : {} }
|
|
10919
|
+
};
|
|
10920
|
+
}
|
|
10913
10921
|
if (provider === "baidu") {
|
|
10914
10922
|
const resourceType = typeof params.resource_type === "string" ? params.resource_type : "web";
|
|
10915
10923
|
const topK = Math.min(k, resourceType === "web" ? 50 : resourceType === "image" ? 30 : 10);
|
|
@@ -10969,8 +10977,12 @@ async function prepareSearch(params) {
|
|
|
10969
10977
|
throw new CliError("E_SCHEMA", `unsupported search provider: ${provider}`);
|
|
10970
10978
|
}
|
|
10971
10979
|
function normalizeSearch(result, params) {
|
|
10972
|
-
const provider = String(params.provider ?? "");
|
|
10980
|
+
const provider = String(params.provider ?? "auto");
|
|
10973
10981
|
const k = typeof params.k === "number" ? params.k : 10;
|
|
10982
|
+
if (provider === "auto" || provider === "parallel") {
|
|
10983
|
+
const data = isRecord(result.data) ? result.data : {};
|
|
10984
|
+
return { provider: typeof data.provider === "string" ? data.provider : provider, hits: (Array.isArray(data.hits) ? data.hits : []).filter(isRecord).slice(0, k) };
|
|
10985
|
+
}
|
|
10974
10986
|
let rows = [];
|
|
10975
10987
|
if (provider === "baidu") rows = Array.isArray(result.references) ? result.references : [];
|
|
10976
10988
|
else if (provider === "baidu-image") {
|
|
@@ -11026,9 +11038,10 @@ function normalizeSearch(result, params) {
|
|
|
11026
11038
|
}
|
|
11027
11039
|
var search_default = defineActionCommand({
|
|
11028
11040
|
name: "search",
|
|
11029
|
-
summary: "
|
|
11041
|
+
summary: "Web search with automatic Parallel/Serper routing or an explicit provider.",
|
|
11030
11042
|
helpText: [
|
|
11031
|
-
"`--provider` is
|
|
11043
|
+
"`--provider` is optional; omitted or auto uses Parallel Fast with Serper fallback on retryable failures.",
|
|
11044
|
+
"Explicit baidu, baidu-image, parallel, serper, tavily, and brave keep their provider-specific behavior.",
|
|
11032
11045
|
"For Baidu image/video discovery, use `--provider=baidu --resource-type=image|video`.",
|
|
11033
11046
|
"For Baidu similar-image search, use `--provider=baidu-image --image-file=<jpg|png>`.",
|
|
11034
11047
|
"For URL fetch (not a query), use `actionway fetch` instead.",
|
|
@@ -11050,7 +11063,7 @@ var search_default = defineActionCommand({
|
|
|
11050
11063
|
],
|
|
11051
11064
|
endpoint: "search",
|
|
11052
11065
|
async: false,
|
|
11053
|
-
timeoutMs:
|
|
11066
|
+
timeoutMs: 3e4,
|
|
11054
11067
|
prepareRequest: prepareSearch,
|
|
11055
11068
|
transformResult: normalizeSearch
|
|
11056
11069
|
});
|
|
@@ -13837,14 +13850,16 @@ function videoProjection(params) {
|
|
|
13837
13850
|
return { toolRef: "media.video.generate", variantId: canonicalVariantId("media.video.generate", String(params.service)), arguments: args };
|
|
13838
13851
|
}
|
|
13839
13852
|
function searchProjection(params, prepared) {
|
|
13840
|
-
const provider = String(params.provider ?? "");
|
|
13853
|
+
const provider = String(params.provider ?? "auto");
|
|
13854
|
+
const variantId = canonicalVariantId("web.search", provider);
|
|
13841
13855
|
const body = prepared.body ?? {};
|
|
13856
|
+
if (params.params !== void 0 || params.params_file !== void 0) return null;
|
|
13842
13857
|
if (provider === "baidu-image") {
|
|
13843
|
-
const { image, count, ...
|
|
13858
|
+
const { image, count, ...extras } = body;
|
|
13844
13859
|
return {
|
|
13845
13860
|
toolRef: "web.image.search",
|
|
13846
13861
|
variantId: "baidu-similar",
|
|
13847
|
-
arguments: { image_base64: image, k: count, ...Object.keys(
|
|
13862
|
+
arguments: { image_base64: image, k: count, ...Object.keys(extras).length ? { params: extras } : {} }
|
|
13848
13863
|
};
|
|
13849
13864
|
}
|
|
13850
13865
|
const args = {
|
|
@@ -13854,16 +13869,7 @@ function searchProjection(params, prepared) {
|
|
|
13854
13869
|
...params.country !== void 0 ? { country: params.country } : {},
|
|
13855
13870
|
...params.freshness !== void 0 ? { freshness: params.freshness } : {}
|
|
13856
13871
|
};
|
|
13857
|
-
|
|
13858
|
-
if (provider === "baidu") extras = without(body, ["messages", "search_source", "resource_type_filter", "search_recency_filter"]);
|
|
13859
|
-
else if (provider === "serper") extras = without(body, ["q", "num", "gl", "tbs"]);
|
|
13860
|
-
else if (provider === "tavily") extras = without(body, ["query", "max_results", "search_depth", "time_range"]);
|
|
13861
|
-
else if (provider === "brave" && prepared.endpoint) {
|
|
13862
|
-
const query = new URL(`https://actionway.invalid/${prepared.endpoint}`).searchParams;
|
|
13863
|
-
for (const [key, value] of query) if (!["q", "count", "country", "freshness"].includes(key)) extras[key] = value;
|
|
13864
|
-
}
|
|
13865
|
-
if (Object.keys(extras).length) args.params = extras;
|
|
13866
|
-
return { toolRef: "web.search", variantId: provider, arguments: args };
|
|
13872
|
+
return { toolRef: "web.search", variantId, arguments: args };
|
|
13867
13873
|
}
|
|
13868
13874
|
function projectTypedToolCall(spec, commandParams, prepared) {
|
|
13869
13875
|
const params = prepared.body ?? commandParams;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actionway/cli-dev",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.38532746006.a574f5d68a15",
|
|
4
4
|
"description": "Actionway development CLI for dev.actionway.ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
},
|
|
37
37
|
"actionway": {
|
|
38
38
|
"channel": "development",
|
|
39
|
-
"source_sha": "
|
|
40
|
-
"run_id":
|
|
41
|
-
"run_url": "https://github.com/PawLogic/actionway/actions/runs/
|
|
39
|
+
"source_sha": "a574f5d68a157d54106f5c3fefe4b6545b8c107b",
|
|
40
|
+
"run_id": 38532746006,
|
|
41
|
+
"run_url": "https://github.com/PawLogic/actionway/actions/runs/38532746006",
|
|
42
42
|
"gateway_url": "https://dev.actionway.ai"
|
|
43
43
|
}
|
|
44
44
|
}
|