editmamei 1.3.0 → 1.5.0
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 +10 -9
- package/dist/bin/editmamei-core-darwin-arm64 +0 -0
- package/dist/bin/editmamei-core-darwin-x64 +0 -0
- package/dist/bin/editmamei-core-win-x64.exe +0 -0
- package/dist/cli/help.js +1 -1
- package/dist/core/server.js +112 -15
- package/dist/core/tool-groups.js +4 -3
- package/dist/core/tool-registry.js +3 -1
- package/dist/core/tool-tiers.js +2 -1
- package/dist/install-channel.js +52 -2
- package/dist/kernel/kernel.js +1 -0
- package/dist/kernel/module-lifecycle.js +44 -17
- package/dist/modules/ce/index.js +7 -0
- package/dist/perception/facets.js +4 -3
- package/dist/perception/region-scorer.js +1 -1
- package/dist/perception/scene-model.js +1 -1
- package/dist/perception/select-recipes.js +14 -3
- package/dist/platform/launch-readiness.js +25 -0
- package/dist/platform/macos-runner.js +18 -8
- package/dist/platform/script-queue.js +5 -19
- package/dist/platform/windows-runner.js +18 -8
- package/dist/skills/editmamei-skill.zip +0 -0
- package/dist/telemetry/activity.js +149 -0
- package/dist/telemetry/client.js +125 -8
- package/dist/telemetry/events.js +48 -3
- package/dist/tools/detection-tools.js +4 -4
- package/dist/tools/document-tools.js +23 -1
- package/dist/tools/preview-tools.js +1 -1
- package/dist/tools/scene-tools.js +8 -6
- package/dist/tools/selection-tools.js +155 -109
- package/dist/tools/sequence-tools.js +435 -0
- package/dist/update/check.js +24 -10
- package/dist/utils/operation-timeouts.js +92 -0
- package/dist/utils/run-script.js +25 -1
- package/dist/utils/session-log.js +18 -4
- package/dist/utils/tool-budget-context.js +14 -0
- package/dist/utils/xmp-crs.js +682 -0
- package/dist/version.js +1 -1
- package/package.json +10 -4
|
@@ -51,6 +51,10 @@ export const ERROR_CLASS_TABLE = [
|
|
|
51
51
|
errorClass: 'file_io',
|
|
52
52
|
pattern: /\b(ENOENT|EBUSY|EACCES|EPERM|EMFILE|ENOSPC)\b/,
|
|
53
53
|
},
|
|
54
|
+
{
|
|
55
|
+
errorClass: 'unknown_discriminator',
|
|
56
|
+
pattern: /unknown [^"]{1,40}"[^"]*"\. Allowed: /i,
|
|
57
|
+
},
|
|
54
58
|
{
|
|
55
59
|
errorClass: 'schema_validation',
|
|
56
60
|
pattern: /\bvalidat|required.*field|missing required argument|must be.*type|invalid (input|argument)/i,
|
|
@@ -76,6 +80,7 @@ export const ERROR_CLASS_TABLE = [
|
|
|
76
80
|
errorClass: 'wrong_layer_kind',
|
|
77
81
|
pattern: /pixel layer|text layer|smart object layer|layer kind|rasterize it first/i,
|
|
78
82
|
},
|
|
83
|
+
{ errorClass: 'channel_not_visible', pattern: /histogram for visible channels/i },
|
|
79
84
|
{ errorClass: 'ps_command_unavailable', pattern: /not currently available/i },
|
|
80
85
|
{ errorClass: 'timeout', pattern: /timed? ?out|Script execution timeout|exceeded.*bytes/i },
|
|
81
86
|
{
|
|
@@ -85,6 +90,10 @@ export const ERROR_CLASS_TABLE = [
|
|
|
85
90
|
{ errorClass: 'ai_selection_no_result', pattern: /returned no result/i },
|
|
86
91
|
{ errorClass: 'ps_general_error', pattern: /general photoshop error/i },
|
|
87
92
|
{ errorClass: 'ps_no_such_element', pattern: /no such element/i },
|
|
93
|
+
{
|
|
94
|
+
errorClass: 'extendscript_reference_error',
|
|
95
|
+
pattern: /\b[A-Za-z_$][\w$]*\s+is undefined\s*$/,
|
|
96
|
+
},
|
|
88
97
|
{ errorClass: 'write_not_verified', pattern: /did not verify/i },
|
|
89
98
|
{ errorClass: 'ps_empty_error', pattern: /:\s*$/ },
|
|
90
99
|
{ errorClass: 'ps_op_failed', pattern: /failed[: (]/i },
|
|
@@ -98,6 +107,11 @@ export function classifyError(error) {
|
|
|
98
107
|
}
|
|
99
108
|
return 'other';
|
|
100
109
|
}
|
|
110
|
+
export const NO_ERROR_TEXT_CLASS = 'no_error_text';
|
|
111
|
+
export const ALL_ERROR_CLASSES = [
|
|
112
|
+
...ERROR_CLASS_TABLE.map((entry) => entry.errorClass),
|
|
113
|
+
NO_ERROR_TEXT_CLASS,
|
|
114
|
+
];
|
|
101
115
|
export function elideImagePayloads(value) {
|
|
102
116
|
if (Array.isArray(value))
|
|
103
117
|
return value.map(elideImagePayloads);
|
|
@@ -253,7 +267,7 @@ export class SessionLog {
|
|
|
253
267
|
this.metaEmitted = true;
|
|
254
268
|
await this.writeLine(JSON.stringify(this.buildMetaEntry()));
|
|
255
269
|
}
|
|
256
|
-
async append(entry, result) {
|
|
270
|
+
async append(entry, result, resultBytes) {
|
|
257
271
|
if (!this.metaEmitted) {
|
|
258
272
|
await this.emitMeta();
|
|
259
273
|
}
|
|
@@ -263,14 +277,14 @@ export class SessionLog {
|
|
|
263
277
|
const callKey = JSON.stringify({ tool: entry.tool, args: sanitizedArgs });
|
|
264
278
|
const retrySignal = callKey === this.lastCallKey;
|
|
265
279
|
this.lastCallKey = callKey;
|
|
266
|
-
const
|
|
280
|
+
const finalResultBytes = resultBytes !== undefined ? resultBytes : computeResultBytes(result);
|
|
267
281
|
let hoisted = {};
|
|
268
282
|
try {
|
|
269
283
|
hoisted = hoistContextScalars(result);
|
|
270
284
|
}
|
|
271
285
|
catch {
|
|
272
286
|
}
|
|
273
|
-
const errorClass = classifyError(entry.error);
|
|
287
|
+
const errorClass = entry.success ? null : (classifyError(entry.error) ?? NO_ERROR_TEXT_CLASS);
|
|
274
288
|
const captureResult = process.env.EDITMAMEI_LOG_RESULTS === '1' && result !== undefined
|
|
275
289
|
? this.sanitizeValue(elideImagePayloads(result))
|
|
276
290
|
: undefined;
|
|
@@ -288,7 +302,7 @@ export class SessionLog {
|
|
|
288
302
|
edition: EDITION,
|
|
289
303
|
platform: process.platform,
|
|
290
304
|
ps_version: this.psVersion,
|
|
291
|
-
result_bytes:
|
|
305
|
+
result_bytes: finalResultBytes,
|
|
292
306
|
...hoisted,
|
|
293
307
|
...(errorClass !== null ? { error_class: errorClass } : {}),
|
|
294
308
|
retry_signal: retrySignal,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
const storage = new AsyncLocalStorage();
|
|
3
|
+
export function budgetContextFor(toolName, budgetMs, now = Date.now()) {
|
|
4
|
+
const ownDeadline = now + budgetMs;
|
|
5
|
+
const outer = storage.getStore();
|
|
6
|
+
const deadline = outer ? Math.min(ownDeadline, outer.deadline) : ownDeadline;
|
|
7
|
+
return { toolName, budgetMs, deadline };
|
|
8
|
+
}
|
|
9
|
+
export function runWithToolBudget(context, fn) {
|
|
10
|
+
return storage.run(context, fn);
|
|
11
|
+
}
|
|
12
|
+
export function currentToolBudget() {
|
|
13
|
+
return storage.getStore();
|
|
14
|
+
}
|