sideby 0.32.2 → 0.34.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/assets/brand/sai-painted-1024.png +0 -0
- package/assets/brand/sai-painted-128.png +0 -0
- package/assets/brand/sai-painted-256.png +0 -0
- package/assets/brand/sai-painted-64.png +0 -0
- package/dist/build.json +1 -1
- package/dist/src/cli/commands.js +76 -18
- package/dist/src/cli/format.js +3 -1
- package/dist/src/cli/json-schemas.js +34 -6
- package/dist/src/cli/main.js +12 -5
- package/dist/src/core/brand-mark.d.ts +18 -115
- package/dist/src/core/brand-mark.js +43 -174
- package/dist/src/core/live-sessions.d.ts +4 -0
- package/dist/src/core/live-sessions.js +17 -3
- package/dist/src/core/messages.d.ts +26 -5
- package/dist/src/core/messages.js +73 -16
- package/dist/src/core/quota-fetch.js +9 -2
- package/dist/src/core/session-status.d.ts +55 -0
- package/dist/src/core/session-status.js +59 -0
- package/dist/src/core/unattended-retry.d.ts +39 -0
- package/dist/src/core/unattended-retry.js +107 -0
- package/dist/src/core/unattended.d.ts +2 -2
- package/dist/src/core/unattended.js +10 -2
- package/dist/src/desktop/icon.d.ts +13 -1
- package/dist/src/desktop/icon.js +153 -285
- package/dist/src/families/claude/deliver.js +14 -2
- package/dist/src/families/claude/messaging.d.ts +14 -1
- package/dist/src/families/claude/messaging.js +24 -4
- package/dist/src/families/codex/deliver.d.ts +10 -1
- package/dist/src/families/codex/deliver.js +24 -2
- package/dist/src/families/messaging.d.ts +12 -1
- package/dist/src/handoff/messages.js +1 -1
- package/dist/src/menubar/script.d.ts +5 -0
- package/dist/src/menubar/script.js +111 -25
- package/dist/src/menubar/snapshot.d.ts +25 -5
- package/dist/src/menubar/snapshot.js +114 -26
- package/dist/src/menubar/strings.d.ts +22 -6
- package/dist/src/menubar/strings.js +22 -6
- package/dist/src/panel/handler.d.ts +2 -2
- package/dist/src/panel/handler.js +8 -2
- package/dist/src/panel/i18n.d.ts +11 -0
- package/dist/src/panel/i18n.js +35 -13
- package/dist/src/panel/page-logic.d.ts +41 -4
- package/dist/src/panel/page-logic.js +145 -10
- package/dist/src/panel/page-script.js +50 -11
- package/dist/src/panel/page-styles.js +5 -5
- package/dist/src/panel/page.js +2 -2
- package/dist/src/panel/theme.d.ts +4 -1
- package/dist/src/runtime.d.ts +3 -1
- package/dist/src/runtime.js +1 -1
- package/dist/src/unattended/hook.d.ts +4 -0
- package/dist/src/unattended/hook.js +86 -2
- package/package.json +2 -1
- package/schemas/menubar-snapshot.json +102 -2
- package/schemas/messages.json +6 -2
- package/schemas/send.json +6 -2
- package/schemas/sessions.json +22 -1
- package/skills/sideby/SKILL.md +1 -1
- package/skills/sideby/references/panel.md +1 -1
- package/skills/sideby/references/sessions.md +7 -4
- package/skills/sideby/references/unattended.md +4 -2
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { listPendingDecisions } from './unattended-pending.js';
|
|
2
|
+
/** The table of spec §3.32 step 1, in order; the first row whose `when` holds gives the status. */
|
|
3
|
+
export const STATUS_RULES = [
|
|
4
|
+
{ status: 'needs-you', reason: 'host-waits', when: (s) => s.host === 'needs-you' },
|
|
5
|
+
{ status: 'needs-you', reason: 'pending-decision', when: (s) => s.pendingDecisions > 0 },
|
|
6
|
+
{ status: 'needs-you', reason: 'message-to-approve', when: (s) => s.messagesToApprove > 0 },
|
|
7
|
+
{ status: 'needs-you', reason: 'message-to-paste', when: (s) => s.messagesToPaste > 0 },
|
|
8
|
+
{ status: 'busy', when: (s) => s.host === 'busy' },
|
|
9
|
+
{ status: 'idle', when: (s) => s.host === 'idle' },
|
|
10
|
+
{ status: 'unknown', when: () => true },
|
|
11
|
+
];
|
|
12
|
+
/** The status the first matching row of `STATUS_RULES` gives, and its reason when it is `needs-you`. */
|
|
13
|
+
export function sessionStatus(s) {
|
|
14
|
+
const row = STATUS_RULES.find((r) => r.when(s));
|
|
15
|
+
return row.reason ? { status: row.status, reason: row.reason } : { status: row.status };
|
|
16
|
+
}
|
|
17
|
+
/** The signals of one Session, from its Host status and what sideby keeps for it. */
|
|
18
|
+
export function signalsOf(s, kept) {
|
|
19
|
+
const pendingDecisions = kept.decisions.filter((d) => !d.doneAt &&
|
|
20
|
+
d.sessionId === s.sessionId &&
|
|
21
|
+
d.family === s.family &&
|
|
22
|
+
(!d.account || d.account === s.account)).length;
|
|
23
|
+
const mine = kept.receipts.filter((r) => r.toSessionId === s.sessionId && r.toAccount === s.account);
|
|
24
|
+
return {
|
|
25
|
+
host: s.status,
|
|
26
|
+
pendingDecisions,
|
|
27
|
+
messagesToApprove: mine.filter((r) => r.status === 'delivered' && r.needsApproval).length,
|
|
28
|
+
// Only where sideby can see the Session's record: a paste shows there and clears the row; without one it never would.
|
|
29
|
+
messagesToPaste: s.transcript ? mine.filter((r) => r.status === 'paste-needed').length : 0,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** Each Session with the status the table gives it; `reason` is set only on `needs-you`, and dropped otherwise. */
|
|
33
|
+
export function withStatus(sessions, kept) {
|
|
34
|
+
return sessions.map((s) => {
|
|
35
|
+
const { reason: _old, ...rest } = s;
|
|
36
|
+
const r = sessionStatus(signalsOf(s, kept));
|
|
37
|
+
return { ...rest, status: r.status, ...(r.reason ? { reason: r.reason } : {}) };
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/** How many of the newest Messages are looked at: each may read the end of its target's record. */
|
|
41
|
+
export const MESSAGES_LOOKED_AT = 50;
|
|
42
|
+
/**
|
|
43
|
+
* Reads what sideby keeps for Sessions: open Pending Decisions and the newest Messages, both without writing (an old
|
|
44
|
+
* done Decision is not deleted, a Message found read is not saved). A store that cannot be read adds a problem line
|
|
45
|
+
* and counts as empty.
|
|
46
|
+
*/
|
|
47
|
+
export async function readAttention(stateDir, messages, problems) {
|
|
48
|
+
const [decisions, receipts] = await Promise.all([
|
|
49
|
+
listPendingDecisions(stateDir, { prune: false }).catch((err) => {
|
|
50
|
+
problems.push(`could not read Pending Decisions (${err.code ?? err.message}); sessions waiting on one are not marked; run \`sideby unattended pending\` to see why`);
|
|
51
|
+
return [];
|
|
52
|
+
}),
|
|
53
|
+
messages().catch((err) => {
|
|
54
|
+
problems.push(`could not read sent messages (${err.code ?? err.message}); sessions with a message to paste are not marked; run \`sideby messages\` to see why`);
|
|
55
|
+
return [];
|
|
56
|
+
}),
|
|
57
|
+
]);
|
|
58
|
+
return { decisions, receipts };
|
|
59
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** How many times in a row one session's failed turn is started again before it is left for the user. */
|
|
2
|
+
export declare const RETRY_LIMIT = 3;
|
|
3
|
+
/** The wait before the first retry; each next one waits twice as long (1, 2 and 4 minutes). */
|
|
4
|
+
export declare const RETRY_FIRST_MS = 60000;
|
|
5
|
+
/** A streak older than this starts again from one (a failure the next night is not the fourth of last night's). */
|
|
6
|
+
export declare const RETRY_FRESH_MS: number;
|
|
7
|
+
/** The `timeout` of the hook entry: the longest wait (4 minutes) with room to spare. */
|
|
8
|
+
export declare const RETRY_HOOK_TIMEOUT_S = 600;
|
|
9
|
+
/** The wait before retry `n` (1-based). */
|
|
10
|
+
export declare const retryDelay: (n: number) => number;
|
|
11
|
+
/** The `StopFailure` error types (Claude Code's hook `error` field) that can be a passing failure. */
|
|
12
|
+
export declare const PASSING_ERRORS: readonly string[];
|
|
13
|
+
/**
|
|
14
|
+
* Whether a failed turn's error is a passing one, from the hook input's `error` type and its text
|
|
15
|
+
* (`last_assistant_message`, `error_details`). Checked with Claude Code 2.1.316 against a local server: HTTP 500 and
|
|
16
|
+
* a refused connection come as `server_error`, 429 as `rate_limit`, 408 as `unknown`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function passingFailure(error: string | undefined, text: string): boolean;
|
|
19
|
+
/** One session's run of failed turns that were started again. */
|
|
20
|
+
export interface RetryStreak {
|
|
21
|
+
/** How many failures in a row, this one included. */
|
|
22
|
+
count: number;
|
|
23
|
+
/** The wait this failure's hook owns; a later failure or a finished turn replaces or removes it. */
|
|
24
|
+
token: string;
|
|
25
|
+
at: string;
|
|
26
|
+
}
|
|
27
|
+
/** The session's streak, or undefined when there is none or its folder is not safe to read. */
|
|
28
|
+
export declare function readRetryStreak(stateDir: string, sessionId: string): Promise<RetryStreak | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* Counts one more failure for the session and returns the streak with a new token. A streak older than
|
|
31
|
+
* `RETRY_FRESH_MS` starts again from one. Throws when the folder is not safe to use (the caller then retries nothing).
|
|
32
|
+
*/
|
|
33
|
+
export declare function countFailure(stateDir: string, sessionId: string, now: Date): Promise<RetryStreak>;
|
|
34
|
+
/** Ends the session's streak: its turn finished, or it was left for the user. */
|
|
35
|
+
export declare function clearRetryStreak(stateDir: string, sessionId: string): Promise<void>;
|
|
36
|
+
/** What the model reads when its session is woken to go on after a passing failure. */
|
|
37
|
+
export declare function retryMessage(error: string, text: string, count: number, zh: boolean): string;
|
|
38
|
+
/** What the user reads in the morning when the retries ran out: kept as a Pending Decision. */
|
|
39
|
+
export declare function retryGaveUpText(error: string, text: string): string;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// Turn Retry (spec §3.37 item 6, ADR-0067): while Unattended Mode is on, a Claude turn that ended on a passing failure
|
|
2
|
+
// (an overloaded or failing server, a rate limit that is not a used-up Quota, a dropped or refused connection) is
|
|
3
|
+
// started again by `unattended-hook`'s background `StopFailure` entry, at most `RETRY_LIMIT` times in a row per
|
|
4
|
+
// session, each after a longer wait. A leaf module (Node built-ins and core/fs-safe.ts only): the hook imports it.
|
|
5
|
+
//
|
|
6
|
+
// The streak of one session is a file under `<state>/unattended/retries/`, named by a hash of the session id, so a
|
|
7
|
+
// session id never becomes a path. Both folders must be real folders of the user that nobody else can write to
|
|
8
|
+
// (`ownedFolder`, as for Pending Decisions); when one is not, nothing is read or written there and no turn is retried.
|
|
9
|
+
import { randomBytes } from 'node:crypto';
|
|
10
|
+
import { rm } from 'node:fs/promises';
|
|
11
|
+
import { join } from 'node:path';
|
|
12
|
+
import { ownedFolder, readSmallFile, sha256, writeFileAtomic } from './fs-safe.js';
|
|
13
|
+
/** How many times in a row one session's failed turn is started again before it is left for the user. */
|
|
14
|
+
export const RETRY_LIMIT = 3;
|
|
15
|
+
/** The wait before the first retry; each next one waits twice as long (1, 2 and 4 minutes). */
|
|
16
|
+
export const RETRY_FIRST_MS = 60_000;
|
|
17
|
+
/** A streak older than this starts again from one (a failure the next night is not the fourth of last night's). */
|
|
18
|
+
export const RETRY_FRESH_MS = 6 * 60 * 60_000;
|
|
19
|
+
/** The `timeout` of the hook entry: the longest wait (4 minutes) with room to spare. */
|
|
20
|
+
export const RETRY_HOOK_TIMEOUT_S = 600;
|
|
21
|
+
/** The wait before retry `n` (1-based). */
|
|
22
|
+
export const retryDelay = (n) => RETRY_FIRST_MS * 2 ** (Math.max(1, n) - 1);
|
|
23
|
+
/** The `StopFailure` error types (Claude Code's hook `error` field) that can be a passing failure. */
|
|
24
|
+
export const PASSING_ERRORS = ['rate_limit', 'overloaded', 'server_error', 'unknown'];
|
|
25
|
+
/**
|
|
26
|
+
* Claude Code's wording when a Quota, a plan limit, a spend cap or credits are used up (its error reference: "You've
|
|
27
|
+
* hit your session limit", "Fable limit reached", "monthly spend limit", "Credit balance is too low", "Usage credits
|
|
28
|
+
* required"). Waiting minutes does not help those: Auto Handoff or `autoContinueAtUsageLimit` takes them. A plain
|
|
29
|
+
* "Rate limit reached" is a throttle, not a used-up Quota.
|
|
30
|
+
*/
|
|
31
|
+
const USED_UP = /hit your|usage limit|out of (?:extra )?usage|spend limit|spending limit|credit balance|usage credits|(?<!rate )limit reached/i;
|
|
32
|
+
/** What an `unknown` error must say to count as passing: a timeout or overload status, or a dropped connection. */
|
|
33
|
+
const PASSING_TEXT = /\b(?:408|429|5\d\d)\b|timed? ?out|timeout|ECONNRESET|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|EPIPE|socket hang up|connection (?:refused|reset|error|closed)|network|overloaded|temporarily/i;
|
|
34
|
+
/**
|
|
35
|
+
* Whether a failed turn's error is a passing one, from the hook input's `error` type and its text
|
|
36
|
+
* (`last_assistant_message`, `error_details`). Checked with Claude Code 2.1.316 against a local server: HTTP 500 and
|
|
37
|
+
* a refused connection come as `server_error`, 429 as `rate_limit`, 408 as `unknown`.
|
|
38
|
+
*/
|
|
39
|
+
export function passingFailure(error, text) {
|
|
40
|
+
if (!error || !PASSING_ERRORS.includes(error) || USED_UP.test(text))
|
|
41
|
+
return false;
|
|
42
|
+
return error !== 'unknown' || PASSING_TEXT.test(text);
|
|
43
|
+
}
|
|
44
|
+
const PARTS = ['unattended', 'retries'];
|
|
45
|
+
const fileName = (sessionId) => `${sha256(sessionId).slice(0, 32)}.json`;
|
|
46
|
+
function parse(text) {
|
|
47
|
+
if (!text)
|
|
48
|
+
return undefined;
|
|
49
|
+
try {
|
|
50
|
+
const v = JSON.parse(text);
|
|
51
|
+
if (typeof v.count !== 'number' || !Number.isInteger(v.count) || v.count < 1)
|
|
52
|
+
return undefined;
|
|
53
|
+
if (typeof v.token !== 'string' || typeof v.at !== 'string' || !Number.isFinite(Date.parse(v.at)))
|
|
54
|
+
return undefined;
|
|
55
|
+
return { count: v.count, token: v.token, at: v.at };
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/** The session's streak, or undefined when there is none or its folder is not safe to read. */
|
|
62
|
+
export async function readRetryStreak(stateDir, sessionId) {
|
|
63
|
+
const dir = await ownedFolder(stateDir, PARTS, { create: false }).catch(() => null);
|
|
64
|
+
if (!dir)
|
|
65
|
+
return undefined;
|
|
66
|
+
return parse(await readSmallFile(join(dir, fileName(sessionId)), 4096));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Counts one more failure for the session and returns the streak with a new token. A streak older than
|
|
70
|
+
* `RETRY_FRESH_MS` starts again from one. Throws when the folder is not safe to use (the caller then retries nothing).
|
|
71
|
+
*/
|
|
72
|
+
export async function countFailure(stateDir, sessionId, now) {
|
|
73
|
+
const dir = (await ownedFolder(stateDir, PARTS, { create: true, private: true }));
|
|
74
|
+
const file = join(dir, fileName(sessionId));
|
|
75
|
+
const old = parse(await readSmallFile(file, 4096));
|
|
76
|
+
const fresh = old && now.getTime() - Date.parse(old.at) < RETRY_FRESH_MS;
|
|
77
|
+
const streak = {
|
|
78
|
+
count: fresh ? old.count + 1 : 1,
|
|
79
|
+
token: randomBytes(8).toString('hex'),
|
|
80
|
+
at: now.toISOString(),
|
|
81
|
+
};
|
|
82
|
+
await writeFileAtomic(file, `${JSON.stringify(streak)}\n`, 0o600);
|
|
83
|
+
return streak;
|
|
84
|
+
}
|
|
85
|
+
/** Ends the session's streak: its turn finished, or it was left for the user. */
|
|
86
|
+
export async function clearRetryStreak(stateDir, sessionId) {
|
|
87
|
+
const dir = await ownedFolder(stateDir, PARTS, { create: false }).catch(() => null);
|
|
88
|
+
if (dir)
|
|
89
|
+
await rm(join(dir, fileName(sessionId)), { force: true });
|
|
90
|
+
}
|
|
91
|
+
const clip = (s, max) => {
|
|
92
|
+
const one = s.replace(/\s+/g, ' ').trim();
|
|
93
|
+
return one.length <= max ? one : `${one.slice(0, max - 1)}…`;
|
|
94
|
+
};
|
|
95
|
+
/** What the model reads when its session is woken to go on after a passing failure. */
|
|
96
|
+
export function retryMessage(error, text, count, zh) {
|
|
97
|
+
const why = clip(`${error}${text ? `: ${text}` : ''}`, 200);
|
|
98
|
+
if (zh)
|
|
99
|
+
return `sideby 无人值守:你上一个回合因为暂时性的错误中断了(${why}),没人在,sideby 让会话接着做(第 ${count} 次,最多 ${RETRY_LIMIT} 次)。先看看已经做完了什么,不要重做,从中断的地方继续完成任务。`;
|
|
100
|
+
return `sideby's Unattended Mode: your last turn failed for a passing reason (${why}), and nobody is here to start it again, so sideby did (retry ${count} of ${RETRY_LIMIT}). Check what is already done, do not redo it, and continue the task where it stopped.`;
|
|
101
|
+
}
|
|
102
|
+
/** What the user reads in the morning when the retries ran out: kept as a Pending Decision. */
|
|
103
|
+
export function retryGaveUpText(error, text) {
|
|
104
|
+
const why = clip(`${error}${text ? `: ${text}` : ''}`, 300);
|
|
105
|
+
const waits = Array.from({ length: RETRY_LIMIT }, (_, i) => retryDelay(i + 1) / 60_000).join(', ');
|
|
106
|
+
return `The session stopped: its turn kept failing for a passing reason (${why}). sideby started it again ${RETRY_LIMIT} times (after ${waits} minutes) and then left it. Continue the session when you are back.`;
|
|
107
|
+
}
|
|
@@ -132,8 +132,8 @@ export declare const unattendedClock: (iso: string, now: Date, zh?: boolean) =>
|
|
|
132
132
|
/**
|
|
133
133
|
* Unattended Mode's session hooks: before the ask tool and when the model ends its turn (`Stop`, which keeps a turn
|
|
134
134
|
* that ended on a question going once) in Claude and Codex; and in Claude on every permission request Claude Code is
|
|
135
|
-
* about to show
|
|
136
|
-
* prompts are not covered.
|
|
135
|
+
* about to show, every MCP server form (`Elicitation`), and every turn that failed on an API error (`StopFailure`, in the background with `asyncRewake`, so its exit 2 wakes the session: Turn Retry,
|
|
136
|
+
* ADR-0067). Codex has no such events for them; its own approval prompts and failed turns are not covered.
|
|
137
137
|
*/
|
|
138
138
|
export declare function unattendedHookPart(): SessionHookPart;
|
|
139
139
|
/** The line a Claude Launch prints when the user's own `--settings` leaves no room for the hook. */
|
|
@@ -9,6 +9,7 @@ import { UserError } from './errors.js';
|
|
|
9
9
|
import { ownedFolder, writeFileAtomic } from './fs-safe.js';
|
|
10
10
|
import { sidebyHookCommand } from './session-hooks.js';
|
|
11
11
|
import { listPendingDecisions } from './unattended-pending.js';
|
|
12
|
+
import { RETRY_HOOK_TIMEOUT_S } from './unattended-retry.js';
|
|
12
13
|
import { clearUnattendedOverride, clockText, ensureUnattendedDir, MAX_MANUAL_MS, parseClock, parseDays, parseSlot, readUnattendedConfig, readUnattendedOverride, scheduleStretchAt, slotEnd, UNATTENDED_ENV, unattendedState, writeUnattendedOverride, } from './unattended-state.js';
|
|
13
14
|
/** Families whose sessions Unattended Mode covers in v1. */
|
|
14
15
|
export const UNATTENDED_FAMILIES = ['claude', 'codex'];
|
|
@@ -291,8 +292,8 @@ export const unattendedClock = (iso, now, zh = false) => clockText(Date.parse(is
|
|
|
291
292
|
/**
|
|
292
293
|
* Unattended Mode's session hooks: before the ask tool and when the model ends its turn (`Stop`, which keeps a turn
|
|
293
294
|
* that ended on a question going once) in Claude and Codex; and in Claude on every permission request Claude Code is
|
|
294
|
-
* about to show
|
|
295
|
-
* prompts are not covered.
|
|
295
|
+
* about to show, every MCP server form (`Elicitation`), and every turn that failed on an API error (`StopFailure`, in the background with `asyncRewake`, so its exit 2 wakes the session: Turn Retry,
|
|
296
|
+
* ADR-0067). Codex has no such events for them; its own approval prompts and failed turns are not covered.
|
|
296
297
|
*/
|
|
297
298
|
export function unattendedHookPart() {
|
|
298
299
|
const command = (family, event = 'PreToolUse') => sidebyHookCommand('unattended-hook', family, event);
|
|
@@ -305,6 +306,13 @@ export function unattendedHookPart() {
|
|
|
305
306
|
PermissionRequest: [{ matcher: '*', hooks: claude('PermissionRequest') }],
|
|
306
307
|
Stop: [{ hooks: claude('Stop') }],
|
|
307
308
|
Elicitation: [{ matcher: '*', hooks: claude('Elicitation') }],
|
|
309
|
+
// Waits up to 4 minutes before it wakes the session; Claude Code still enforces `timeout` on `asyncRewake`.
|
|
310
|
+
// No matcher: every failed turn reaches it, so a later failure that is not retried still ends an earlier wait.
|
|
311
|
+
StopFailure: [
|
|
312
|
+
{
|
|
313
|
+
hooks: [{ ...claude('StopFailure')[0], asyncRewake: true, timeout: RETRY_HOOK_TIMEOUT_S }],
|
|
314
|
+
},
|
|
315
|
+
],
|
|
308
316
|
},
|
|
309
317
|
codex: {
|
|
310
318
|
PreToolUse: [`{matcher="^request_user_input$",${codex('PreToolUse')}}`],
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
/** Text stored in every generated file, so `sideby app uninstall` deletes only what it wrote. */
|
|
2
2
|
export declare const APP_MARKER = "sideby-app-install";
|
|
3
|
+
/** Where the painting goes on a `size` canvas: inset from the tile's edge as in the Panel header. */
|
|
4
|
+
export declare function markRect(size: number): {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
w: number;
|
|
8
|
+
};
|
|
9
|
+
/** Decodes an 8-bit, non-interlaced RGB or RGBA PNG to straight-alpha RGBA pixels. */
|
|
10
|
+
export declare function decodePng(png: Buffer): {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
rgba: Uint8Array;
|
|
14
|
+
};
|
|
3
15
|
/** RGBA pixels (straight alpha) of the icon at `size`×`size`. */
|
|
4
16
|
export declare function renderIcon(size: number): Uint8Array;
|
|
5
17
|
/** Encodes straight-alpha RGBA pixels as a PNG with a `Software` text chunk holding APP_MARKER. */
|
|
@@ -12,5 +24,5 @@ export declare const ICONSET: readonly {
|
|
|
12
24
|
}[];
|
|
13
25
|
/** Builds an `.icns` file directly from PNGs; used when `iconutil` is not available. */
|
|
14
26
|
export declare function encodeIcns(pngs: ReadonlyMap<string, Buffer>): Buffer;
|
|
15
|
-
/** The same
|
|
27
|
+
/** The same icon as an SVG (1024-unit canvas), for Linux icon themes: the tile, and the painting as a `data:` image. */
|
|
16
28
|
export declare function iconSvg(): string;
|