@gaoding/cli 2.1.0 → 2.1.2
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 +30 -0
- package/contracts/operations/agent.send/input.schema.json +8 -84
- package/contracts/operations/agent.send/output.schema.json +6 -6
- package/contracts/operations/dam.folder.list/input.schema.json +1 -1
- package/contracts/operations/dam.folder.list/output.schema.json +1 -1
- package/contracts/operations/dam.list/input.schema.json +2 -5
- package/contracts/operations/dam.list/output.schema.json +1 -1
- package/contracts/operations/dam.search/input.schema.json +2 -5
- package/contracts/operations/dam.search/output.schema.json +1 -1
- package/contracts/operations/model.get/output.schema.json +6 -5
- package/contracts/operations/model.list/output.schema.json +5 -4
- package/contracts/operations/task.get/output.schema.json +22 -11
- package/contracts/operations/tool.call/models/image-edit-smart.schema.json +7 -5
- package/contracts/operations/tool.call/models/image-edit-standard.schema.json +6 -4
- package/contracts/operations/tool.call/models/image-enhance-smart.schema.json +5 -3
- package/contracts/operations/tool.call/models/image-enhance-standard.schema.json +3 -2
- package/contracts/operations/tool.call/models/image-expand-smart.schema.json +16 -10
- package/contracts/operations/tool.call/models/image-expand-standard.schema.json +13 -8
- package/contracts/operations/tool.call/models/image-layers-layout.schema.json +3 -2
- package/contracts/operations/tool.call/models/image-layers-smart.schema.json +3 -4
- package/contracts/operations/tool.call/models/image-matting-smart.schema.json +6 -4
- package/contracts/operations/tool.call/models/image-matting-standard.schema.json +3 -2
- package/contracts/operations/tool.call/models/image-ocr.schema.json +3 -2
- package/contracts/operations/tool.call/models/image-remove-smart.schema.json +6 -4
- package/contracts/operations/tool.call/models/image-remove-standard.schema.json +4 -3
- package/contracts/operations/tool.call/models/image-text-edit.schema.json +5 -3
- package/contracts/operations/tool.call/models/image-vectorize.schema.json +3 -2
- package/contracts/operations/tool.call/models/video-edit-smart.schema.json +6 -6
- package/contracts/operations/tool.call/models/video-enhance-smart.schema.json +7 -4
- package/contracts/operations/tool.call/models/video-enhance-standard.schema.json +5 -3
- package/contracts/operations/tool.call/ocr-payload.schema.json +4 -5
- package/contracts/operations/tool.call/output.schema.json +9 -8
- package/dist/bin/postinstall.js +22 -6
- package/dist/bin/sync-skill.js +33 -0
- package/dist/bin/task-worker.js +2 -2
- package/dist/src/bootstrap/create-cli.js +13 -6
- package/dist/src/bootstrap/create-runtime.js +103 -29
- package/dist/src/bootstrap/run-task-worker.js +6 -2
- package/dist/src/bootstrap/validators.js +87 -151
- package/dist/src/cli/action-binding.js +14 -37
- package/dist/src/cli/agent-commands.js +13 -13
- package/dist/src/cli/auth-commands.js +2 -1
- package/dist/src/cli/creation-help.js +9 -0
- package/dist/src/cli/dam-commands.js +10 -14
- package/dist/src/cli/editor-commands.js +16 -12
- package/dist/src/cli/errors.js +84 -26
- package/dist/src/cli/host-input.js +62 -5
- package/dist/src/cli/model-commands.js +9 -3
- package/dist/src/cli/observed-errors.js +7 -3
- package/dist/src/cli/org-commands.js +3 -1
- package/dist/src/cli/presenter.js +4 -5
- package/dist/src/cli/task-commands.js +6 -2
- package/dist/src/cli/tool-commands.js +12 -11
- package/dist/src/contracts/creation-input.js +20 -17
- package/dist/src/features/agent/creative-agent-adapter.js +6 -2
- package/dist/src/features/agent/creative-protocol.js +8 -29
- package/dist/src/features/agent/resource-authorizer.js +25 -17
- package/dist/src/features/agent/result-reader.js +31 -14
- package/dist/src/features/agent/use-cases.js +6 -31
- package/dist/src/features/auth/credential-store.js +1 -0
- package/dist/src/features/credits/use-cases.js +55 -28
- package/dist/src/features/dam/asset-projection.js +3 -6
- package/dist/src/features/dam/dam-api-adapter.js +30 -15
- package/dist/src/features/dam/object-storage.js +2 -1
- package/dist/src/features/dam/repository-catalog.js +30 -21
- package/dist/src/features/dam/use-cases.js +14 -9
- package/dist/src/features/editor/bridge-client.js +0 -2
- package/dist/src/features/editor/bridge-process.js +3 -2
- package/dist/src/features/editor/public-url.js +1 -36
- package/dist/src/features/editor/session-state.js +1 -0
- package/dist/src/features/editor/session.js +3 -2
- package/dist/src/features/editor/use-cases.js +27 -2
- package/dist/src/features/org/org-service.js +10 -1
- package/dist/src/features/org/use-cases.js +18 -4
- package/dist/src/features/task/process-owner.js +54 -0
- package/dist/src/features/task/store.js +102 -32
- package/dist/src/features/task/task-background.js +8 -4
- package/dist/src/features/task/use-cases.js +184 -84
- package/dist/src/features/tool/argument-paths.js +14 -0
- package/dist/src/features/tool/canvas-copy.js +28 -15
- package/dist/src/features/tool/canvas-matting.js +123 -0
- package/dist/src/features/tool/canvas-media.js +102 -55
- package/dist/src/features/tool/canvas-models.js +66 -33
- package/dist/src/features/tool/canvas-pricing.js +12 -0
- package/dist/src/features/tool/canvas-recovery.js +13 -30
- package/dist/src/features/tool/canvas-results.js +92 -93
- package/dist/src/features/tool/canvas-tool-adapter.js +134 -157
- package/dist/src/features/tool/canvas-video.js +44 -37
- package/dist/src/features/tool/catalog.js +2 -23
- package/dist/src/features/tool/dynamic-schema.js +42 -46
- package/dist/src/features/tool/ffprobe-executable.js +21 -0
- package/dist/src/features/tool/mns-catalog-adapter.js +61 -24
- package/dist/src/features/tool/resource-authorizer.js +11 -3
- package/dist/src/features/tool/tool-api-adapter.js +73 -82
- package/dist/src/features/tool/tool-definitions.js +23 -0
- package/dist/src/features/tool/tool-errors.js +25 -0
- package/dist/src/features/tool/tool-output.js +15 -0
- package/dist/src/features/tool/use-cases.js +74 -98
- package/dist/src/features/update/package-manager.js +124 -0
- package/dist/src/features/update/update-service.js +195 -55
- package/dist/src/platform/detached-spawn.js +9 -0
- package/dist/src/platform/file-lock.js +12 -4
- package/dist/src/platform/input-uri.js +23 -1
- package/dist/src/platform/local-json-file.js +97 -15
- package/dist/src/platform/media-type.js +46 -0
- package/dist/src/platform/open-browser.js +5 -2
- package/dist/src/platform/public-url.js +35 -0
- package/dist/src/platform/remote-error-evidence.js +33 -6
- package/dist/src/platform/resource-auth-key.js +35 -1
- package/dist/src/platform/safe-upload-file.js +38 -44
- package/dist/src/platform/schema-compiler.js +16 -0
- package/dist/src/platform/signature.js +2 -2
- package/dist/src/platform/signed-http-transport.js +4 -1
- package/dist/src/platform/url-safety.js +6 -1
- package/dist/src/platform/webm-header.js +41 -0
- package/dist/src/platform/windows-acl/LICENSE-mingw-w64 +43 -0
- package/dist/src/platform/windows-acl/arm64.node +0 -0
- package/dist/src/platform/windows-acl/ia32.node +0 -0
- package/dist/src/platform/windows-acl/x64.node +0 -0
- package/dist/src/platform/windows-host-job/arm64.exe +0 -0
- package/dist/src/platform/windows-host-job/ia32.exe +0 -0
- package/dist/src/platform/windows-host-job/sha256.json +7 -0
- package/dist/src/platform/windows-host-job/x64.exe +0 -0
- package/dist/src/platform/windows-private-state.js +72 -0
- package/dist/src/product/config.js +1 -1
- package/dist/src/telemetry/command-route.js +38 -0
- package/dist/src/telemetry/command-routes.json +1 -0
- package/dist/src/telemetry/failure-summary.js +3 -3
- package/dist/src/telemetry/invocation.js +1 -2
- package/dist/src/telemetry/process-errors.js +17 -33
- package/dist/src/telemetry/sanitize.js +19 -4
- package/dist/src/telemetry/sls-sink.js +45 -20
- package/package.json +4 -4
- package/skills/gd-cli/SKILL.md +18 -5
- package/skills/gd-cli/references/agent.md +9 -4
- package/skills/gd-cli/references/creation.md +3 -1
- package/skills/gd-cli/references/editor.md +7 -5
- package/skills/gd-cli/references/errors.md +19 -8
- package/skills/gd-cli/references/matting.md +3 -5
- package/skills/gd-cli/references/media-tools.md +10 -4
- package/skills/gd-cli/references/tool.md +9 -15
|
@@ -1,42 +1,23 @@
|
|
|
1
|
-
import { classifyTelemetryError, mapCliError } from "../cli/errors.js";
|
|
2
1
|
import { isInterruption } from "../platform/interruption.js";
|
|
3
2
|
import { randomBytes } from "node:crypto";
|
|
4
|
-
import { readFile
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
5
4
|
import { dirname, join } from "node:path";
|
|
6
5
|
import { homedir } from "node:os";
|
|
7
6
|
import { fileURLToPath } from "node:url";
|
|
8
7
|
import { gaodingProduct, insmindProduct } from "../product/config.js";
|
|
9
8
|
import { createTelemetryInvocation, hostTelemetryContext } from "./invocation.js";
|
|
10
9
|
import { createSlsTelemetrySink } from "./sls-sink.js";
|
|
11
|
-
// The
|
|
12
|
-
// so a user-supplied positional argument can never become an SLS operation name.
|
|
10
|
+
// The normal runtime or even Commander may be unavailable. Only package-owned names may enter SLS.
|
|
13
11
|
async function bootstrapDefinition(argv) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (token === "--")
|
|
23
|
-
break;
|
|
24
|
-
if (token === "--input" || token === "--locale") {
|
|
25
|
-
i++;
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
if (token === "--help" || token === "-h")
|
|
29
|
-
mode = "help";
|
|
30
|
-
else if (token === "--version" || token === "-V")
|
|
31
|
-
mode = "version";
|
|
32
|
-
else if (token === "--schema" && mode === "execute")
|
|
33
|
-
mode = "schema";
|
|
34
|
-
else if (!token.startsWith("-") && !names.has(path.join(".")) && path.length < 3)
|
|
35
|
-
path.push(token);
|
|
12
|
+
try {
|
|
13
|
+
const [{ identifyInvocation }, catalog] = await Promise.all([
|
|
14
|
+
import("./command-route.js"), readFile(new URL("./command-routes.json", import.meta.url), "utf8")
|
|
15
|
+
]);
|
|
16
|
+
return identifyInvocation(JSON.parse(catalog), argv);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return { operation: "bootstrap", mode: () => "execute" };
|
|
36
20
|
}
|
|
37
|
-
const name = path.join(".");
|
|
38
|
-
const operation = mode === "version" ? "version" : names.has(name) ? name : !name && mode === "help" ? "help" : "bootstrap";
|
|
39
|
-
return { operation, mode: () => mode };
|
|
40
21
|
}
|
|
41
22
|
/** Independent fallback for entrypoints which cannot construct the full runtime. */
|
|
42
23
|
export async function reportProcessError(error, options) {
|
|
@@ -55,8 +36,11 @@ export async function reportProcessError(error, options) {
|
|
|
55
36
|
catch { /* The package file may be unavailable during startup failure. */ }
|
|
56
37
|
}
|
|
57
38
|
const aborted = isInterruption(error, options.signal);
|
|
58
|
-
|
|
59
|
-
const
|
|
39
|
+
// The application error mapper imports Commander and feature dependencies which can themselves fail to load.
|
|
40
|
+
const mapper = await import("../cli/errors.js").catch(() => undefined);
|
|
41
|
+
const classification = mapper?.classifyTelemetryError(error, { aborted, product })
|
|
42
|
+
?? { outcome: aborted ? "interrupted" : "failure", errorCode: "INTERNAL_ERROR" };
|
|
43
|
+
const failure = mapper?.mapCliError(error, { aborted, product }).failure;
|
|
60
44
|
const telemetry = createTelemetryInvocation({ cliName: product.commandName, cliVersion: version,
|
|
61
45
|
env: options.environment ?? (process.env.CLI_TELEMETRY_ENV === "test" ? "test" : "production"),
|
|
62
46
|
processRole: options.processRole ?? "cli", now: Date.now,
|
|
@@ -69,8 +53,8 @@ export async function reportProcessError(error, options) {
|
|
|
69
53
|
telemetry.annotate(hostTelemetryContext(process.env));
|
|
70
54
|
if ((options.processRole ?? "cli") === "cli")
|
|
71
55
|
await telemetry.issue(definition);
|
|
72
|
-
const events = telemetry.finish(
|
|
73
|
-
outcome: "failure", error, errorCode:
|
|
56
|
+
const events = telemetry.finish(classification.outcome === "interrupted" ? { outcome: "interrupted", error } : {
|
|
57
|
+
outcome: "failure", error, errorCode: failure?.code ?? "INTERNAL_ERROR", errorMessage: failure?.message ?? "CLI startup failed.",
|
|
74
58
|
...(classification.httpStatus === undefined ? {} : { httpStatus: classification.httpStatus }),
|
|
75
59
|
...(classification.remoteErrorCode === undefined ? {} : { remoteErrorCode: classification.remoteErrorCode }),
|
|
76
60
|
...(classification.remoteErrorBody === undefined ? {} : { remoteErrorBody: classification.remoteErrorBody })
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { posix, win32 } from "node:path";
|
|
1
2
|
import { isSensitiveKey, redactSensitiveText } from "../platform/redact.js";
|
|
2
3
|
const ids = new Set(["account_id", "organization_id", "cli_task_id", "task_id", "dify_task_id", "content_id"]);
|
|
3
4
|
function sensitive(key) {
|
|
@@ -28,7 +29,15 @@ export function cleanText(value) {
|
|
|
28
29
|
}
|
|
29
30
|
export function cleanDiagnostic(value) {
|
|
30
31
|
const seen = new WeakSet();
|
|
31
|
-
|
|
32
|
+
const envelope = value && typeof value === "object" ? value : {};
|
|
33
|
+
const tool = envelope.operation === "tool.call";
|
|
34
|
+
const toolDiagnostic = (tool || (envelope.operation === "task.get" && ["dify", "toolkit", "sync"].includes(String(envelope.execution_protocol)))) && envelope.event_name === "stage_finished";
|
|
35
|
+
function clean(item, depth, inParameters = false) {
|
|
36
|
+
if (typeof item === "string" && inParameters) {
|
|
37
|
+
if (posix.isAbsolute(item) || win32.isAbsolute(item) || /^file:\/\//iu.test(item))
|
|
38
|
+
return "[Local file]";
|
|
39
|
+
item = item.replace(/file:\/\/[^\s<>"`]+/giu, "[Local file]");
|
|
40
|
+
}
|
|
32
41
|
if (typeof item === "string")
|
|
33
42
|
return /^data:[^,]*;base64,/iu.test(item) ? "[Binary omitted]" : cleanText(item);
|
|
34
43
|
if (typeof item === "bigint")
|
|
@@ -45,9 +54,15 @@ export function cleanDiagnostic(value) {
|
|
|
45
54
|
if (item instanceof Error)
|
|
46
55
|
return errorEvidence(item);
|
|
47
56
|
if (Array.isArray(item))
|
|
48
|
-
return item.map(v => clean(v, depth + 1));
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
return item.map(v => clean(v, depth + 1, inParameters));
|
|
58
|
+
const entries = Object.entries(item);
|
|
59
|
+
const fields = depth === 0 && envelope.event_name === "stage_finished"
|
|
60
|
+
? entries.filter(([key]) => key !== "parameters") : entries;
|
|
61
|
+
return Object.fromEntries(fields.map(([key, v]) => [key,
|
|
62
|
+
depth === 0 && toolDiagnostic && ["error_message", "error_stack", "remote_error_body"].includes(key)
|
|
63
|
+
? (key === "error_message" ? envelope.error_code ?? "TOOL_ERROR" : "[User content omitted]") :
|
|
64
|
+
inParameters && tool && key === "prompt" ? "[User content omitted]" :
|
|
65
|
+
depth === 0 && ids.has(key) ? v : sensitive(key) || (inParameters && key === "answers") ? "[REDACTED]" : clean(v, depth + 1, inParameters || key === "parameters")]));
|
|
51
66
|
}
|
|
52
67
|
return clean(value, 0);
|
|
53
68
|
}
|
|
@@ -8,6 +8,7 @@ import { withFileLock } from "../platform/file-lock.js";
|
|
|
8
8
|
const TTL = 7 * 86_400_000;
|
|
9
9
|
const CAPACITY = 10 * 1024 * 1024;
|
|
10
10
|
const BUDGET = 2_000;
|
|
11
|
+
const QUEUE_READ_BATCH = 8;
|
|
11
12
|
export function eventKey(event) {
|
|
12
13
|
const key = event.event_name === "command_step"
|
|
13
14
|
? [event.cli_name, event.env, event.trace_id, event.step]
|
|
@@ -104,30 +105,52 @@ export function createSlsTelemetrySink(options) {
|
|
|
104
105
|
...(count("first_at_ms") ? { first_at_ms: count("first_at_ms") } : {}),
|
|
105
106
|
...(count("last_at_ms") ? { last_at_ms: count("last_at_ms") } : {}) };
|
|
106
107
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
const directory = options.directory;
|
|
109
|
+
const names = await readdir(directory);
|
|
110
|
+
for (let offset = 0; offset < names.length; offset += QUEUE_READ_BATCH) {
|
|
111
|
+
const batch = names.slice(offset, offset + QUEUE_READ_BATCH);
|
|
112
|
+
// Read independent files together under the same lock. Settle every
|
|
113
|
+
// started read before releasing it, including on timeout or I/O error.
|
|
114
|
+
const records = await Promise.allSettled(batch.map(async (name) => {
|
|
115
|
+
checkBudget(deadline);
|
|
116
|
+
return /^[a-f0-9]{64}\.json$/u.test(name) ? readFile(join(directory, name), "utf8") : undefined;
|
|
117
|
+
}));
|
|
118
|
+
for (const [index, result] of records.entries()) {
|
|
119
|
+
checkBudget(deadline);
|
|
120
|
+
if (result.status === "rejected")
|
|
121
|
+
throw result.reason; // Unreadable files survive for replay.
|
|
122
|
+
await restoreEntry(directory, batch[index], result.value);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
healthReady = true;
|
|
126
|
+
}
|
|
127
|
+
async function restoreEntry(directory, name, raw) {
|
|
128
|
+
if (raw === undefined) {
|
|
129
|
+
// All writers hold the same lock, so remaining write temporaries are orphaned.
|
|
110
130
|
if (/^(?:[a-f0-9]{64}|delivery-status)\.json\.tmp-[a-f0-9-]+$/u.test(name)) {
|
|
111
|
-
await unlink(join(
|
|
131
|
+
await unlink(join(directory, name)).catch(() => undefined);
|
|
112
132
|
await dropped("interrupted_write", 1);
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
if (!/^[a-f0-9]{64}\.json$/u.test(name))
|
|
116
|
-
continue;
|
|
117
|
-
// An unreadable valid record is not corrupt and must survive for replay.
|
|
118
|
-
const raw = await readFile(join(options.directory, name), "utf8");
|
|
119
|
-
try {
|
|
120
|
-
const entry = JSON.parse(raw);
|
|
121
|
-
if (entry.event?.schema_version !== "6" || !Number.isFinite(entry.queuedAt) || !entry.event || eventKey(entry.event) !== name.slice(0, -5))
|
|
122
|
-
throw new Error();
|
|
123
|
-
entries.set(name.slice(0, -5), entry);
|
|
124
133
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
const entry = JSON.parse(raw);
|
|
138
|
+
if (entry.event?.schema_version !== "6" || !Number.isFinite(entry.queuedAt) || eventKey(entry.event) !== name.slice(0, -5))
|
|
139
|
+
throw new Error();
|
|
140
|
+
// Earlier v6 clients could queue input parameters and echoed Agent HTTP errors.
|
|
141
|
+
const event = entry.event;
|
|
142
|
+
if (event.event_name === "stage_finished") {
|
|
143
|
+
delete event.parameters;
|
|
144
|
+
const agent = event.operation === "agent.send" || (event.operation === "task.get" && !event.execution_protocol);
|
|
145
|
+
if (agent && Number(event.http_status) >= 400)
|
|
146
|
+
delete event.remote_error_body;
|
|
128
147
|
}
|
|
148
|
+
entries.set(name.slice(0, -5), entry);
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
await unlink(join(directory, name)).catch(() => undefined);
|
|
152
|
+
await dropped("corrupt", 1);
|
|
129
153
|
}
|
|
130
|
-
healthReady = true;
|
|
131
154
|
}
|
|
132
155
|
async function saveStatus() {
|
|
133
156
|
// Health recording must never stop the original event acknowledgement/backoff path.
|
|
@@ -189,7 +212,7 @@ export function createSlsTelemetrySink(options) {
|
|
|
189
212
|
lastEnqueueError = error instanceof Error && error.message === "Local state lock timed out." ? "lock_timeout"
|
|
190
213
|
: error instanceof Error && error.message === "Telemetry delivery budget exhausted." ? "budget_exhausted" : "storage_error";
|
|
191
214
|
});
|
|
192
|
-
if (options.background && deadline === undefined)
|
|
215
|
+
if (options.background && !options.reporterFlushes && deadline === undefined)
|
|
193
216
|
void writes.then(() => { if (!sending)
|
|
194
217
|
void start(Math.min(Date.now() + BUDGET, exitDeadline)); });
|
|
195
218
|
return writes.then(() => accepted);
|
|
@@ -282,6 +305,8 @@ export function createSlsTelemetrySink(options) {
|
|
|
282
305
|
async send(events) {
|
|
283
306
|
const deadline = exitDeadline = Date.now() + BUDGET;
|
|
284
307
|
await enqueue(events, deadline);
|
|
308
|
+
if (options.reporterFlushes)
|
|
309
|
+
return;
|
|
285
310
|
if (sending)
|
|
286
311
|
await sending;
|
|
287
312
|
if (Date.now() < deadline)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gaoding/cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "Gaoding command-line interface for agents and people.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"vitest": "4.1.10"
|
|
58
58
|
},
|
|
59
59
|
"gaodingRelease": {
|
|
60
|
-
"sourceCommit": "
|
|
61
|
-
"pipelineId": "
|
|
62
|
-
"pipelineUrl": "https://git.intra.gaoding.com/gtt/gaoding-cli/-/pipelines/
|
|
60
|
+
"sourceCommit": "db01676824330fe8f15c190fe71b3516b8b1924e",
|
|
61
|
+
"pipelineId": "246753",
|
|
62
|
+
"pipelineUrl": "https://git.intra.gaoding.com/gtt/gaoding-cli/-/pipelines/246753"
|
|
63
63
|
}
|
|
64
64
|
}
|
package/skills/gd-cli/SKILL.md
CHANGED
|
@@ -1,28 +1,41 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: gd-cli
|
|
3
|
-
description:
|
|
3
|
+
description: 用稿定做业务策划和多轮创作,查询工具能力与稿豆价格,生成或处理图片、视频、文本,操作稿定编辑器或管理素材库。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# GD CLI
|
|
7
7
|
|
|
8
8
|
## 按需发现当前能力
|
|
9
9
|
|
|
10
|
-
- 调用 `agent send`、`tool call`、`editor apply` 时,在输入 JSON
|
|
10
|
+
- 调用 `agent send`、`tool call`、`editor apply` 时,在输入 JSON 顶层填写发起命令的应用名 `host_application`。Codex Agent 通过 shell 执行时填 `codex`,其他宿主同理,如 `workbuddy`、`qwenwork`、`trae`。仅当用户亲自在终端执行时填 `terminal`。
|
|
11
11
|
- 首次使用时确认 `gd-cli --version`;不确定入口时读 `gd-cli --help`,沿相关命令组选择命令,执行前读其 `--help`。本 Skill 的示例不代表完整能力清单。
|
|
12
12
|
- 用户前台使用时,把可用升级提醒随本次结果转述给用户,一小时最多一次。只读取标准输出的宿主见下方「更新」。
|
|
13
13
|
- 结构化输入先读取命令公开支持的 `--schema`;模型、参数选项、价格与资源 ID 由对应目录或详情查询取得,不从旧示例猜值。发现不支持或查询失败时说明缺口,不静默替换用户明确约束。
|
|
14
|
+
- 先按操作对象选入口:附件图片、媒体链接及导出图片的改字、分层、矢量化等处理从 `tool list` 发现;作品 ID/编辑器链接中的元素操作才进入 Editor。只查过 Editor 不能判断图片工具是否支持。
|
|
15
|
+
- 用户明确要求用稿定策划、创作或处理时,以实际 CLI 调用和服务回复为完成依据;策划请求也应发现并调用 Agent,不能用宿主自行给出的建议冒充稿定回复。选定模型后读 `model get` 的详情再判断能否满足需求;不凭列表摘要宣布不支持,也不自行用本地插值、描图等替代稿定调用。本地脚本可用于素材准备;替代产物须单独说明,不能把指定的稿定任务报为完成。
|
|
16
|
+
- 先根据 Schema 构造并保存完整 JSON,再用 `--input request.json` 执行。命令不交互填参;若用 `--input -`,必须在同一条 shell 命令中通过管道或重定向送入完整 JSON,单独执行不会再向你提问。JSON 内的本地媒体用 `Path(path).resolve().as_uri()` 或 `pathToFileURL(path).href` 生成 URI;中文、空格和 `#` 保持原文件名并正确转义。
|
|
14
17
|
- 同一会话可复用同一路径/版本的 help 和静态 Schema;CLI 变化后重查。动态信息在本次任务选能力或报价时查询,身份/组织变化或明确不匹配时刷新相关结果,不全量扫描无关目录。
|
|
15
18
|
- 发现只说明当前实装 CLI 的能力,不等于升级,也不授予生成、写入或安装权限;未知结果的恢复按错误处理指引执行。
|
|
16
19
|
|
|
20
|
+
## 创作执行边界
|
|
21
|
+
|
|
22
|
+
选定路由后,执行前读取 [Tool](references/tool.md) 或 [Agent](references/agent.md) 的提交和交付流程;下方场景页用于选能力和准备素材,不能替代执行流程。
|
|
23
|
+
|
|
24
|
+
- 现在要结果时,默认同步。保留宿主返回的退出状态和进程句柄,等原进程交付完整结果。句柄丢失时,用 stderr 中的 CLI taskId 查原任务。running 时继续等,不让用户回来催取。
|
|
25
|
+
- 用户明确说稍后拿时,用 `--async`。收到受理回执就把 taskId 和当前状态给用户,本轮到此结束。等用户回来再取同一任务。
|
|
26
|
+
- 首次取得可用服务结果就先交付。不得为修正自己观察到的效果偏差,擅自换模型、调整选区或再次创作;需要返修时说明偏差并由用户决定。执行前的素材准备、原任务查询和结果下载不属于追加创作。
|
|
27
|
+
- 服务明确返回用于交付的资源 URL 是完整值,原样复制或保存后引用;不要手抄、拼接、截断或去掉查询参数。任务查询返回同一成品时仍使用实际返回的完整链接,不凭记忆重建。
|
|
28
|
+
- Tool 返回的价格区间只是估价,即使上下限相同也不能称为实扣;Agent 的实际用量与账本核对见 [费用来源](references/errors.md#费用来源)。
|
|
29
|
+
|
|
17
30
|
## 读取任务指引
|
|
18
31
|
|
|
19
32
|
按用户目标只读取对应参考:
|
|
20
33
|
|
|
21
34
|
- 按业务意图选择 Agent / Tool 创作路由、发现 Model 并生成图片、视频或文本:[创作](references/creation.md)
|
|
22
|
-
-
|
|
35
|
+
- 处理附件/链接中的图片或视频(含改字、分层、矢量化)、准备参考素材和 mask:[图片与视频工具选择](references/media-tools.md)
|
|
23
36
|
- 去背景、提取主体、透明 PNG,或补全被遮挡的物体:[抠图](references/matting.md)
|
|
24
|
-
-
|
|
37
|
+
- 操作已连接作品的 Shape/Connector 元素、预览、保存或断开:[编辑器](references/editor.md)
|
|
25
38
|
- 发现资源库、文件夹与标签,查询、上传、下载或管理 DAM 资源:[素材管理](references/dam.md)
|
|
26
39
|
- 登录或选择组织:[登录与组织](references/auth-org.md)
|
|
27
|
-
-
|
|
40
|
+
- 创作已受理/仍在运行、取回异步结果、解释费用、警告、错误或中断:[状态与错误处理](references/errors.md)
|
|
28
41
|
- 更新 CLI 与随包 Agent Skill:[更新](references/update.md)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Agent 创作
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
现在要结果时默认同步,保留并等待宿主返回的原进程句柄。用户明确稍后取回时用 `--async`,受理后当轮交接原 taskId 和状态。回来取件或同步输出丢失时,按[状态处理](errors.md)查原任务。
|
|
4
4
|
|
|
5
5
|
先读取输入规范。需要指定 Model 时,也先读取实时 Model detail:
|
|
6
6
|
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
gd-cli agent send --schema
|
|
9
9
|
gd-cli model list --tool <tool>
|
|
10
10
|
gd-cli model get <model>
|
|
11
|
-
gd-cli agent send --input request.json
|
|
12
|
-
gd-cli task get <taskId>
|
|
11
|
+
gd-cli agent send --input request.json
|
|
13
12
|
```
|
|
14
13
|
|
|
15
14
|
继续已有创作时,从上一条结果读取 `message.contextId`,原样填入下一次请求;同一创作的后续规划、生成和修改沿用该 Context。首次创作省略此字段。续聊示例:
|
|
@@ -23,11 +22,17 @@ gd-cli task get <taskId>
|
|
|
23
22
|
}
|
|
24
23
|
```
|
|
25
24
|
|
|
25
|
+
completed 表示本轮回复完整,先读 `result.message.parts` 再决定下一步:资源按实际内容交付;策划或普通确认文本如实转述,需要用户决定时询问;结构化 `data.questions` 则把问题交给用户。它们都不能被概括为“没有提交”,也不都表示图片/视频已生成。
|
|
26
|
+
|
|
27
|
+
交付本轮回复或资源时,一并报告 `usage.cost.amount` 的实际稿豆消耗。同步从原输出读,异步从 completed 任务的 `result` 读。返回 0 就报 0,缺失则说未取得。汇总只加不同 taskId 已取得的费用,同一任务重复取回只计一次。
|
|
28
|
+
|
|
29
|
+
收到结构化问题的用户回答后,沿用该结果的 `message.contextId`,把 `message.messageId` 放入 `data.questionMessageId`,`answers` 保留 question 原文并填写用户 values。这个 data Part 是本轮 parts 唯一一项,具体结构见 `agent send --schema`。普通文本补充或确认使用 text Part。每轮回复先判断是否需要用户信息,再继续;不替用户编造确认。
|
|
30
|
+
|
|
26
31
|
将用户要求和已确认信息放在 Text Part,区分图片可见特征与材质、功能等推断。未核实信息标为待确认,必要时向用户澄清;上一轮模型描述按其事实来源判断,不自动视为用户确认。交付文案保持相同的事实边界,风格、客群和场景设想作为建议表达。
|
|
27
32
|
|
|
28
33
|
需要指定 Model、生成参数或首尾帧时,在组装请求前读取 [生成约束与媒体角色](generation-constraints.md)。
|
|
29
34
|
|
|
30
|
-
|
|
35
|
+
本地素材按 Skill 根页构造标准 URI。也可用 `--input -` 从 stdin 传完整 JSON。
|
|
31
36
|
|
|
32
37
|
交付多个资源时,将每个 URL Part 的 `url`、`filename`、本地保存路径和展示名称作为一条记录一起处理;下载、重命名或调整顺序时保持对应,不按请求中的顺序重新配对。交付前核对每个最终链接的文件内容与名称一致;名称不足以辨认时查看资源内容。
|
|
33
38
|
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
- 反例:自行加上“没有原图,先生成一个示意商品”。即使标注“概念展示”,也改变了用户指定的对象;应先取得用户选择。
|
|
13
13
|
- 自由创作的区别:“设计一件虚构商品并制作宣传图”已允许创造对象,可以直接创作;仅未指定配色或版式时,可自行设计这些风格细节。
|
|
14
14
|
|
|
15
|
+
成品交付后用户要求修改,把本轮指定成品作为新任务的输入;先交付已有结果,后续创作以用户要求为准。持续策划或多轮创作对话使用 Agent。
|
|
16
|
+
|
|
15
17
|
## Creation Route
|
|
16
18
|
|
|
17
19
|
先判断 Creation Route,再选择或校验 Model。Model 和参数不决定 Agent 或 Tool 路由;两条路由都支持指定 Model 及其参数,`model list` 和 `model get` 是共享的实时发现能力。
|
|
@@ -56,4 +58,4 @@
|
|
|
56
58
|
|
|
57
59
|
用户本轮明确附图、点名文件或指定已有结果时,将该资源作为此次编辑目标;未指定时再从当前创作的最近相关结果选择。组装或复用请求 JSON 时,核对并更新全部资源字段中的 URL/本地路径、名称与角色,使其和本轮目标对应,不只替换文字。Agent 继续同一创作时,保留对应的 `message.contextId`。
|
|
58
60
|
|
|
59
|
-
Agent 将本地媒体写成独立
|
|
61
|
+
Agent 将本地媒体写成独立 URL Part;Tool 按所选 Model detail 写入对应媒体参数。按 Skill 根页从真实路径生成标准 file URI,保持原图/参考/首尾帧角色、顺序及重复引用。CLI 会在内部通过 DAM 完成临时上传并把公网 URL 传给创作服务;不要自行伪造 URL,也不要读取用户未明确授权的路径。
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
## 发现能力与使用边界
|
|
4
4
|
|
|
5
|
+
本分支操作作品 ID/编辑器链接对应的可编辑元素。附件图片里的文字、分层或矢量化先读 [图片与视频工具选择](media-tools.md),不因 Editor 没有对应 Action 就说 CLI 不支持。
|
|
6
|
+
|
|
5
7
|
首次进入此任务分支,读取当前安装版本的帮助;构造 Action 前查询输入 Schema:
|
|
6
8
|
|
|
7
9
|
```bash
|
|
@@ -16,14 +18,14 @@ gd-cli editor apply --schema
|
|
|
16
18
|
|
|
17
19
|
## 标准流程
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
按用户要求决定完成标准:只预览时交付截图和修改说明,明确尚未保存;要求持久化时,以保存成功和公开作品 URL 为准。复查不能覆盖用户“不保存”的要求。
|
|
20
22
|
|
|
21
|
-
1. 查询 `gd-cli editor connect --help
|
|
23
|
+
1. 查询 `gd-cli editor connect --help`。继续已有作品时用它的 ID 或链接连接;还不知道是哪份作品,先向用户索取。用户要新建 Board 时才省略目标。只有浏览器登录、加载、编辑/保存权限和内容检查通过后才成功;连接失败时停止作图。
|
|
22
24
|
2. 读取 `gd-cli editor snapshot`。以最新 Snapshot 中的完整元素为基础,只改变目标字段;Update 提交完整元素,不能提交 patch。
|
|
23
25
|
3. 根据 Schema 和 Snapshot 构造包含 `host_application` 和有序 `actions` 数组的对象,执行 `gd-cli editor apply --input actions.json`,或用 `--input -` 从 stdin 读取。使用简短语义 ID;Connector 的方向和目标必须符合业务关系。
|
|
24
26
|
4. 每次 Apply 后重新读取 Snapshot。涉及布局、文字或 Connector 时,执行 `gd-cli editor screenshot --json` 并打开返回的绝对 `path` 对应的实际 PNG。文件存在或 Action 已提交都不代表渲染正确。
|
|
25
|
-
5.
|
|
26
|
-
6.
|
|
27
|
+
5. 需要持久化且已有用户授权时,执行 `gd-cli editor save --json`,继续等待原命令完成,不因短暂无输出而中断或并发操作。只有保存成功才可声明作品已保存;把返回的 `workId` 和公开 `url` 交给用户,并保留 URL 中的环境参数。只预览时跳过本步。等待时限查 `editor save --help`。
|
|
28
|
+
6. 保存后无需继续操作,或用户表示不用再连接时,执行 `gd-cli editor disconnect` 并查看 disconnected 回执;断开连接不代替保存,也不授予保存权限。
|
|
27
29
|
|
|
28
30
|
`connect` 会替换旧 Session 并打开作品页面。连接前置检查失败会清理本次 Session,但保留浏览器页面;用户在页面中完成登录或处理访问权限后,再重新执行 `connect`。GD CLI 的 AK/SK 登录不能替代浏览器 AI+ 登录,账号密码应由用户在浏览器登录界面输入。
|
|
29
31
|
|
|
@@ -45,7 +47,7 @@ gd-cli editor apply --schema
|
|
|
45
47
|
|
|
46
48
|
发现可执行问题时,先读取最新 Snapshot,再提交修正。Update 必须包含完整元素,不能提交 patch。若 `fromId`、`toId` 正确,但截图中的 Connector 仍穿过端点 Shape,原样提交该 Connector 的完整 Update 以触发原生路径重算;业务关系正确时不为绕开渲染问题改动关系。
|
|
47
49
|
|
|
48
|
-
修正后再次执行 `snapshot`;涉及视觉变化时再次执行 `screenshot --json`
|
|
50
|
+
修正后再次执行 `snapshot`;涉及视觉变化时再次执行 `screenshot --json` 并打开图片。在用户授权的修改范围内处理可执行问题,随后按其预览/保存要求交付。
|
|
49
51
|
|
|
50
52
|
## 失败处理
|
|
51
53
|
|
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|
- `stdout` 只承载命令结果;结构化命令的 JSON 可直接解析。
|
|
4
4
|
- `stderr` 承载警告、授权提示和错误;不要把警告混入结果。
|
|
5
5
|
- 退出码 `0` 表示命令成功;异步提交仅表示受理,task get 仅表示查询成功,创作是否完成需看 state。
|
|
6
|
-
- 退出码 `1`
|
|
7
|
-
- 退出码 `2`
|
|
6
|
+
- 退出码 `1` 表示运行、服务或状态失败;依据 `error.code/message/details` 的事实和 `error.details.next_steps` 恢复。查询失败先查原任务,已提交且结果未知的写入先读回,不凭错误码猜未提交。
|
|
7
|
+
- 退出码 `2` 表示命令或输入错误;结合 `details.reason/field/issues` 和对应 help/Schema 修正明确的问题。mask 格式错误修 mask,文件访问错误检查路径;不能把二者互相解释。
|
|
8
8
|
- 退出码 `130` 表示用户中断;立即停止,不自动重试。
|
|
9
9
|
- `INSUFFICIENT_CREDITS` 只表示当前可用额度不足,不能据此区分账户余额、成员限额或其他扣费限制;不自动引导充值,不从余额查询或报价推断扣费一定成功。
|
|
10
10
|
|
|
11
|
+
|
|
11
12
|
## 千问办公桌面连接器
|
|
12
13
|
|
|
13
14
|
千问入口失败时,整个 stderr 是单个 `{code,message}` JSON,退出码含义保持不变。原生 CLI 的错误码、trace_id、任务 ID 和恢复步骤保留在 `message` 中,不读取不存在的 `error.details`。成功警告仍在 stderr。连接器的 `--version` 是上传包版本,底层 npm CLI 版本通过 `gd-cli --help` 查看;底层升级后重新读取 help 和 Schema。桌面登录使用 `gd-cli auth init`,自动打开浏览器失败会结束并报错,不使用 `--no-browser` 或等待聊天里出现授权链接。
|
|
14
15
|
|
|
15
|
-
##
|
|
16
|
+
## 持续取回与输出丢失
|
|
16
17
|
|
|
17
18
|
Agent 或 Tool 请求可能已经提交时,不因结果为空、耗时长或宿主显示执行结束就重新生成。原生 CLI 会在 stderr 提示任务 ID,失败时已知 ID 也保留在错误恢复信息中;执行会话仍可等待时继续等待,否则查询原调用:
|
|
18
19
|
|
|
@@ -23,13 +24,23 @@ gd-cli task get <id>
|
|
|
23
24
|
|
|
24
25
|
有 ID 时直接 get;没有 ID 时按列表中的时间、操作和输入摘要定位,多个候选无法区分就询问用户,不自动选最新一条。
|
|
25
26
|
|
|
26
|
-
- `completed`:读取 `result
|
|
27
|
-
- `running
|
|
27
|
+
- `completed`:读取 `result`;Tool 交付 content,Agent 读取 message.parts 后交付实际回复/资源或向用户提问。Agent 的本轮完整回复可能是补充或确认,按 [Agent 创作](agent.md) 衔接。
|
|
28
|
+
- `running` 表示原执行仍在进行。现在要结果时隔数秒继续查原 ID。明确稍后取回时,当轮给出状态和 ID,等用户回来再查。
|
|
28
29
|
- `unknown`:暂时无法确认终态;可复查同一 ID,仍未知就向用户说明。`partialResult` 是消息快照,不当成完整交付。
|
|
29
|
-
- `failed
|
|
30
|
+
- `failed` 时根据 `note` 和原错误说明原因。明确未派发的输入问题可以修正后调用。服务已拒绝时,向用户说明没有成品。换模型或改参数再发属于新的创作,须有用户补充的需求或另做一次的授权。
|
|
30
31
|
|
|
31
32
|
查询接口报错(包括未找到任务)不代表原生成失败;保留原任务 ID,不重新生成。
|
|
32
33
|
|
|
33
|
-
`task get` 退出码 0 只表示查询成功,原调用是否完成由 `state`
|
|
34
|
+
`task get` 退出码 0 只表示查询成功,原调用是否完成由 `state` 表示。持续查询以交付结果、明确失败或可解释的 unknown 阻断结束;用户明确要求稍后取回时保留 ID,主动中断后停止,不重提。
|
|
35
|
+
|
|
36
|
+
## 费用来源
|
|
37
|
+
|
|
38
|
+
| 来源 | 可以向用户说明什么 |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| model 目录、Tool `usage.cost.minimum/maximum` | 目录估价/区间;两值相等也不是实扣,缺失不表示免费 |
|
|
41
|
+
| Agent `usage.cost.amount` | 服务确认的这次调用实际消耗;总费用按不同 taskId 汇总 |
|
|
42
|
+
| `credits usage list/get` | 可对应的账本消费与归还;翻页与类型含义先读 help,不能用整页合计或余额变化猜某个任务的费用 |
|
|
43
|
+
|
|
44
|
+
重复读取同一 ID 是同一份 usage,不相加。用户未问费用时不必主动添加未经核实的“扣了几稿豆”;Tool 只有估价时可以直接交付产物,需要报价则明确称为估价。无法把账本记录对应到该调用时,说明尚未核实实扣。
|
|
34
45
|
|
|
35
|
-
|
|
46
|
+
不要从未知错误中推断内部实现,也不要输出本地凭证、请求签名或诊断日志中的敏感 URL。服务明确返回用于交付的资源链接属于任务结果,按完整值交付;不要对它套用诊断日志的脱敏规则而破坏下载链接。命令失败且没有安全恢复步骤时停止并报告,保留原始 stderr 的公开错误码和已知事实。
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
| 用户目标 | 处理流程 | 交付边界 |
|
|
8
8
|
| --- | --- | --- |
|
|
9
9
|
| 主体完整,只去背景;保留商品结构、文字、人脸或纹理 | 标准抠图:从原图分离前景,保留可见主体 | 不补出原图看不到的部位;细边、毛发、半透明材质和遮挡需复查 |
|
|
10
|
-
| 提取被遮挡的物品,并补全被挡部分;从复杂画面中重新呈现指定主体 |
|
|
10
|
+
| 提取被遮挡的物品,并补全被挡部分;从复杂画面中重新呈现指定主体 | 用户允许重建时,发现包含重绘与透明后处理的智能抠图,一次调用取最终 PNG | 补全内容是生成推测,可能改变结构和纹理;不能称为原物的精确恢复 |
|
|
11
11
|
|
|
12
12
|
仅有背景复杂并不等于必须重绘。用户要求保真、不能重绘时,优先标准抠图;效果不足就说明限制或请求更完整的原图,不能自行改为 AI 重建。用户明确要补全被挡主体时,可按其要求执行重建。
|
|
13
13
|
|
|
@@ -22,8 +22,6 @@
|
|
|
22
22
|
|
|
23
23
|
## 验收与交付
|
|
24
24
|
|
|
25
|
-
-
|
|
26
|
-
- 在明暗两种底色上检查边缘、孔洞、毛发与半透明区域,确认没有烘焙棋盘格、明显背景残留或误删主体。保持原尺寸或裁到主体边缘按用户要求处理。
|
|
27
|
-
- AI 重建另外对比商品结构、标识、人物身份和可见细节;说明哪些部位是生成补全,不能承诺像素级一致。
|
|
25
|
+
- 用户要看效果或提出返修时,结合实际文件和用户指出的部位说明。重建补全的细节属于模型生成。
|
|
28
26
|
- 使用结果文件或已授权下载链接交付。只完成重绘或拿到蒙版时,不宣布透明抠图完成;保留可用中间结果和未完成步骤。
|
|
29
|
-
-
|
|
27
|
+
- 智能抠图内含的处理阶段属于同一个 Tool 调用,不能逐阶段再算一次费用;Tool 返回目录估价,实扣解释见 [费用来源](errors.md#费用来源)。任务已受理后中断、超时或后处理失败时,先按 [错误处理](errors.md) 查询原任务,不能为拿到透明图而盲目重做已完成的收费生成。
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
先按 [创作](creation.md) 判断 Agent / Tool 路由。以下选择适用于单次 Tool 任务;业务编排仍交给 Agent,用户明确指定的路线与模型优先。
|
|
4
4
|
|
|
5
|
+
附件图片或媒体链接本身就是处理对象,包括图片里的文字、图片分层和矢量化。从 `tool list` 发现相应能力;只看 Editor 的元素类型不足以判断这些操作是否支持。Editor 面向已连接作品的元素,不要求先把附件转成 Board。先发现实际工具,再决定是否需要补充素材或解释能力缺口。
|
|
6
|
+
|
|
5
7
|
## 按目的选择 Tool
|
|
6
8
|
|
|
7
9
|
| 用户目标 | 发现方向 |
|
|
@@ -20,20 +22,24 @@
|
|
|
20
22
|
|
|
21
23
|
确认本次主图/原视频、修改目标和需保留内容。只带完成任务必需的参考,每张参考明确提供主体、风格、配色或布局中的哪一项;无关参考不上传。Prompt 按“修改对象 → 需要的变化 → 保留内容 → 各参考用途 → 输出要求”组织,取自用户需求与已确认素材。对于只参考风格的图片,说明借鉴范围;通常选语义相关的参考,减少一边提供强主体、一边要求忽略主体的冲突。模型已有的结构化参数放入对应字段。
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
扩图先区分用户要求的是成品像素尺寸还是画幅比例。按所选模型的 canvas 和 placement 说明填写原图位置、画布和分辨率。主图、选区与参考图各自放入 Schema 指定字段,参考图不能代替 mask。
|
|
26
|
+
|
|
27
|
+
“保留文字/细节、不要重画”等要求用于选择合适的处理方式和组织输入;不擅自升级成“所有像素必须完全相同”的验收门槛。核对相关模型详情后按用户要求调用,把可读的服务结果交付并如实说明已观察到的差异;不能仅因生成或超分可能改变细节就宣布所有工具不适用。
|
|
28
|
+
|
|
29
|
+
模型前置条件不等于工具整体限制。素材尚未提交、又因本地缺少依赖或无法准备必填字段而受阻时,读取同一 Tool 其他模型的详情;若用户未限定模型且其他模型满足明确要求,可以选择它再提交。不能静默放宽保真要求或改掉用户指定模型;没有合适路径时说明具体缺口。中间文件使用当前可写工作目录,不能把某个临时路径不可写说成 CLI 不支持处理。
|
|
24
30
|
|
|
25
31
|
## 提交前复核 mask
|
|
26
32
|
|
|
27
|
-
1. 读取所选模型的 mask
|
|
33
|
+
1. 读取所选模型的 mask 说明,确认必填/可选、文件要求及选区语义。当前二值 PNG 的 RGB 只用纯黑/纯白,有 alpha 时全部 255,尺寸与自动转正后的原图一致;灰边抗锯齿、半透明和用户彩色圈选图不能直接作 mask。根据圈选准备独立 mask,原图仍用未画圈的那份。文件格式合格不代表选区位置正确。
|
|
28
34
|
2. 实际查看自动转正后的原图和 mask,再将选区叠加到原图上做预览。逐项确认白区覆盖需处理的主体/部位、没有漏选,黑区包含需保护的内容;核对轮廓、孔洞、边缘及坐标,没有平移、拉伸或选到背景。叠加预览只供复核,提交的仍是 Schema 要求的原始 mask。
|
|
29
35
|
3. 白区须非空;全白仅适用于用户明确要处理全图。局部物体需要对应目标轮廓,不能用随意矩形代替;若用户本来指定矩形区域,则按其区域。发现选错先修正再提交,无法可靠定位时请用户圈选或补充目标。
|
|
30
|
-
4. 智能模型的可选 mask
|
|
36
|
+
4. 智能模型的可选 mask 可能仅转换成视觉边界提示;按模型详情判断,不能保证选区外像素完全不变。只有实际要传 mask 时才执行上述准备;mask 可选且目标可用文字明确表达时不强制制作。结果复查按下节的交付边界处理。
|
|
31
37
|
|
|
32
38
|
## 执行与交付
|
|
33
39
|
|
|
34
40
|
按 [Tool](tool.md) 提交一次并等待同一任务。计量模型先看当前单价与公式;估价不是实扣。未知或中断时查原任务,查询不会补做处理、上传或结算。
|
|
35
41
|
|
|
36
|
-
|
|
42
|
+
取得可读结果后先交付;用户需要效果复查时,结合原需求查看相关文字、位置、图层或声音,并如实说明偏差。音轨存在不能证明原声保持,图层上限也不保证每个物件都独立。效果差异不改变 CLI 已交付的事实;后续修改按用户授权执行,不因效果不理想自动换模型、增加层数或重跑。
|
|
37
43
|
|
|
38
44
|
分层时区分用途:图文分层侧重文字、图片与版式的可编辑结构;智能分层侧重把物件拆成独立图层。层数上限不是实际图层数的保证,不把智能分层当逐字 OCR。交付原生 JSON 及资源,不能称为 PSD。用户要求导入编辑器时,按 [编辑器](editor.md) 发现实际支持的导入/编辑流程,确认可编辑文字、图层与字体替换情况。
|
|
39
45
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Tool 创作
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
现在要结果时默认同步,保留并等待宿主返回的原进程句柄。用户明确稍后取回时用 `--async`,受理后当轮交接原 taskId 和状态。回来取件或同步输出丢失时,按[状态处理](errors.md)查原任务。
|
|
4
4
|
|
|
5
5
|
按顺序执行:
|
|
6
6
|
|
|
@@ -8,23 +8,17 @@
|
|
|
8
8
|
gd-cli tool list
|
|
9
9
|
gd-cli model list --tool <tool>
|
|
10
10
|
gd-cli model get <model> --tool <tool>
|
|
11
|
-
gd-cli tool call <tool> --input request.json
|
|
12
|
-
gd-cli task get <taskId>
|
|
11
|
+
gd-cli tool call <tool> --input request.json
|
|
13
12
|
```
|
|
14
13
|
|
|
15
|
-
用 `gd-cli tool call <tool> --schema` 查工具输入,用 `model get` 看选定模型的价格和预计耗时。`required` 标出模型所需输入,`default`
|
|
14
|
+
用 `gd-cli tool call <tool> --schema` 查工具输入,用 `model get` 看选定模型的价格和预计耗时。`required` 标出模型所需输入,`default` 标出服务默认值;有默认值的字段如仍列入当前模型的 required,构造请求时也要填写。选择目录列出的选项时用 `options[].value`。尺寸和分辨率写进 `width`、`height`、`resolution` 等字段,用户显式指定的值原样发送。`usageDescription` 描述跨字段规则,例如视频 mode 对首尾帧或素材字段的要求。
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
将选定模型放在请求顶层(如 `"model": "<model>"`,对应运行时 `arguments.model`),与 `host_application` 及该模型的参数并列。素材按模型声明的字段填写。例如 `image_urls` 接收 `["file:///inputs/product.png", "https://example.com/style.png"]`,保留顺序及重复引用。
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"model": "<model>",
|
|
23
|
-
"prompt": "<required prompt>",
|
|
24
|
-
"<parameter>": "<value>"
|
|
25
|
-
}
|
|
26
|
-
```
|
|
18
|
+
按 Skill 根页的方法从实际附件路径生成 URI,直接将生成的值写入请求对象。不要手写带中文、空格或 `#` 的 file URI。写好 JSON 文件再交给 `--input`,或把完整 JSON 送入 stdin;文件路径与媒体 URI 是两类输入。
|
|
19
|
+
|
|
20
|
+
同步输出(或异步任务 completed 时的 result)包含 `content` 和 `usage`。`content` 是文本、资源链接或带 JSON 文本的内嵌资源;`usage.cost.minimum/maximum` 是稿豆价格区间,即使两个值相同,也只能称为“目录估价”,不表示实际扣费。没有 cost 时说“未取得估价”;需要实扣时按 [费用来源](errors.md#费用来源) 查账本。
|
|
27
21
|
|
|
28
|
-
|
|
22
|
+
取得完整结果后先交付服务原产物,说明已观察到的偏差。不能为了达到自己的效果评分再追加收费调用;用户要求返修时再把具体修改作为下一次任务。自行写 SVG、插值放大或其他本地处理应说明来源,不能说成调用了相应工具。
|
|
29
23
|
|
|
30
|
-
|
|
24
|
+
交付多个资源时,将每个资源链接、返回名称、本地保存路径和展示名称作为一条记录一起处理;下载、重命名或调整顺序时保持对应,不按请求中的顺序重新配对。按实际返回类型交付。只收到封面时交付封面并说明尚未取得明确的视频;附件名称或类型不明时如实说明,不用猜测或重做。
|